source: extensions/user_custom_fields/initadmin.php @ 32863

Last change on this file since 32863 was 32698, checked in by ddtddt, 3 years ago

[user_custom_fields] compatybilité piwigo 12

File size: 9.0 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | User Custom Fields plugin for Piwigo by TEMMII                        |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2016-2022 ddtddt               http://temmii.com/piwigo/ |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License as published by  |
9// | the Free Software Foundation                                          |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
19// | USA.                                                                  |
20// +-----------------------------------------------------------------------+
21
22//ajouter filtre sur page option pour supprimer email obligatoire
23
24add_event_handler('loc_begin_admin_page', 'ucf_add_popin');
25function ucf_add_popin(){
26  global $template;
27  $template->set_prefilter('user_list', 'ucf_add_popin_prefilter');
28  $template->set_prefilter('config', 'ucf_config_prefilter');
29}
30 
31function ucf_add_popin_prefilter($content){
32  // add js link
33  $search = '<div class="selection-mode-group-manager" style="right:30px">';
34  $replace = '{combine_script id="jquery.ucf" load=\'footer\' path="$UCF_PATH2/js/ucf.js"}';
35  $content = str_replace($search, $replace.$search, $content);
36
37//css
38  $search = '</style>';
39  $replace = '
40.user-property-user-ucf {
41    margin-bottom:34px;
42    height:20px;
43    color: #000;
44    cursor: pointer;
45}
46
47.user-ucf-title {
48    font-size:1em;
49}
50
51                  ';
52  $content = str_replace($search, $replace.$search, $content);
53       
54  $search = '<div id="UserList" class="UserListPopIn">
55
56  <div class="UserListPopInContainer">
57
58    <a class="icon-cancel CloseUserList"></a>
59    <div class="summary-properties-update-container">
60      <div class="summary-properties-container">
61        <div class="summary-container">
62          <div class="user-property-initials">
63            <div>
64              <span class="icon-blue"><!-- Initials (JP) --></span>
65            </div>
66          </div>
67          <div class="user-property-username">
68            <span class="edit-username-title"><!-- Name (Jessy Pinkman) --></span>
69            <span class="edit-username-specifier"><!-- You specifire (you) --></span>
70            <span class="edit-username icon-pencil"></span>
71          </div>
72          <div class="user-property-username-change">
73            <div class="summary-input-container">
74              <input class="user-property-input user-property-input-username" value="" placeholder="{\'Username\'|@translate}" />
75            </div>
76            <span class="icon-ok edit-username-validate"></span>
77            <span class="icon-cancel-circled edit-username-cancel"></span>
78          </div>
79          <div class="user-property-password-container">
80            <div class="user-property-password edit-password">
81              <p class="user-property-button"><span class="icon-key user-edit-icon"> </span>{\'Change Password\'|@translate}</p>
82            </div>
83            <div class="user-property-password-change">
84              <div class="summary-input-container">
85              <input class="user-property-input user-property-input-password" value="" placeholder="{\'Password\'|@translate}" />
86              </div>
87              <span class="icon-ok edit-password-validate"></span>
88              <span class="icon-cancel-circled edit-password-cancel"></span>
89            </div>
90            <div class="user-property-permissions">
91              <p class="user-property-button"> <span class="icon-lock user-edit-icon"> </span><a href="#" >{\'Permissions\'|@translate}</a></p>
92            </div>
93          </div>
94          <div class="user-property-register-visit">
95            <span class="user-property-register"><!-- Registered date XX/XX/XXXX --></span>
96            <span class="icon-calendar"></span>
97            <span class="user-property-last-visit"><!-- Last Visit date XX/XX/XXXX --></span>
98          </div>
99        </div>
100        <div class="properties-container">
101          <div class="user-property-column-title">
102            <p>{\'Properties\'|@translate}</p>
103          </div>
104          <div class="user-property-email">
105            <p class="user-property-label">{\'Email Adress\'|@translate}</p>
106            <input type="text" class="user-property-input" value="contact@jessy-pinkman.com" disabled="false"/>
107          </div>
108          <div class="user-property-status">
109            <p class="user-property-label">{\'Status\'|@translate}
110                <span class="icon-help-circled"
111                  title="<div class=\'tooltip-status-content\'>
112                    <div class=\'tooltip-status-row\'><span class=\'tooltip-col1\'>{\'user_status_webmaster\'|translate}</span><span class=\'tooltip-col2\'>{\'Has access to all administration functionnalities. Can manage both configuration and content.\'|translate}</span></div>
113                    <div class=\'tooltip-status-row\'><span class=\'tooltip-col1\'>{\'user_status_admin\'|translate}</span><span class=\'tooltip-col2\'>{\'Has access to administration. Can only manage content: photos/albums/users/tags/groups.\'|translate}</span></div>
114                    <div class=\'tooltip-status-row\'><span class=\'tooltip-col1\'>{\'user_status_normal\'|translate}</span><span class=\'tooltip-col2\'>{\'No access to administration, can see private content with appropriate permissions.\'|translate}</span></div>
115                    <div class=\'tooltip-status-row\'><span class=\'tooltip-col1\'>{\'user_status_generic\'|translate}</span><span class=\'tooltip-col2\'>{\'Can be shared by several individuals without conflict (they cannot change the password).\'|translate}</span></div>
116                    <div class=\'tooltip-status-row\'><span class=\'tooltip-col1\'>{\'user_status_guest\'|translate}</span><span class=\'tooltip-col2\'>{\'Equivalent to deactivation. The user is still in the list, but can no longer log in.\'|translate}</span></div>
117                  </div">
118                </span>
119            </p>
120            <div class="user-property-select-container">
121              <select name="status" class="user-property-select">
122                <option value="webmaster">{\'user_status_webmaster\'|@translate}</option>
123                <option value="admin">{\'user_status_admin\'|@translate}</option>
124                <option value="normal">{\'user_status_normal\'|@translate}</option>
125                <option value="generic">{\'user_status_generic\'|@translate}</option>
126                <option value="guest">{\'user_status_guest\'|@translate}  ({\'Deactivated\'|@translate})</option>
127              </select>
128            </div>
129          </div>
130          <div class="user-property-level">
131            <p class="user-property-label">{\'Privacy level\'|@translate}</p>
132            <div class="user-property-select-container">
133              <select name="privacy" class="user-property-select">
134                <option value="0">{\'Level 0\'|@translate}</option>
135                <option value="1">{\'Level 1\'|@translate}</option>
136                <option value="2">{\'Level 2\'|@translate}</option>
137                <option value="4">{\'Level 4\'|@translate}</option>
138                <option value="8">{\'Level 8\'|@translate}</option>
139              </select>
140            </div>
141          </div>
142          <div class="user-property-group-container">
143            <p class="user-property-label">{\'Groups\'|@translate}</p>
144            <div class="user-property-select-container user-property-group">
145              <select class="user-property-select" data-selectize="groups" placeholder="{\'Select groups or type them\'|translate}"
146                name="group_id[]" multiple style="box-sizing:border-box;"></select>
147            </div>
148          </div>';
149       
150  $replace = '<div class="user-property-user-ucf">
151            <span class="user-ucf-title"><span class="icon-pencil"></span><a data-url="{$UCF_ADMIN2}" href="#" >{\'Edit custom fields\'|@translate}</a></span>
152          </div>';
153                 
154  return str_replace($search,$search.$replace, $content);
155}
156
157function ucf_config_prefilter($content){
158  $search = '#(<li>
159        <label class="font-checkbox">
160          <span class="icon-check"></span>
161          <input type="checkbox" name="obligatory_user_mail_address").*Mail address is mandatory for registration\'\|translate}
162        </label>
163      </li>#ms';
164  return preg_replace($search, '', $content);
165}
Note: See TracBrowser for help on using the repository browser.