Changeset 9510 for extensions/community
- Timestamp:
- Mar 4, 2011, 9:18:39 AM (14 years ago)
- Location:
- extensions/community
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/admin_permissions.php
r9501 r9510 32 32 $admin_base_url = get_root_url().'admin.php?page=plugin-community-permissions'; 33 33 34 $who_options = array( 35 'any_visitor' => l10n('any visitor'), 36 'any_registered_user' => l10n('any registered user'), 37 'user' => l10n('a specific user'), 38 'group' => l10n('a group'), 39 ); 40 34 41 // +-----------------------------------------------------------------------+ 35 42 // | Check Access and exit when user status is not ok | … … 44 51 if (isset($_POST['submit_add'])) 45 52 { 46 $who_options = array('any_visitor', 'any_registered_user', 'user', 'group'); 47 48 if (!in_array($_POST['who'], $who_options)) 53 if (!in_array($_POST['who'], array_keys($who_options))) 49 54 { 50 55 die('hacking attempt: invalid "who" option'); … … 66 71 } 67 72 68 check_input_parameter('moderate ', $_POST, false, '/^(true|false)$/');73 check_input_parameter('moderated', $_POST, false, '/^(true|false)$/'); 69 74 70 75 // creating the permission … … 76 81 'recursive' => isset($_POST['recursive']) ? 'true' : 'false', 77 82 'create_subcategories' => isset($_POST['create_subcategories']) ? 'true' : 'false', 78 'moderated' => $_POST['moderate '],83 'moderated' => $_POST['moderated'], 79 84 ); 80 81 mass_inserts( 82 COMMUNITY_PERMISSIONS_TABLE, 83 array_keys($insert), 84 array($insert) 85 ); 86 87 array_push( 88 $page['infos'], 89 l10n('Permission added') 90 ); 85 86 if (isset($_POST['edit'])) 87 { 88 check_input_parameter('edit', $_POST, false, PATTERN_ID); 89 90 $insert['id'] = $_POST['edit']; 91 92 mass_updates( 93 COMMUNITY_PERMISSIONS_TABLE, 94 array( 95 'primary' => array('id'), 96 'update' => array_keys($insert), 97 ), 98 array($insert) 99 ); 100 101 $page['highlight'] = $insert['id']; 102 103 array_push( 104 $page['infos'], 105 l10n('Permission updated') 106 ); 107 } 108 else 109 { 110 mass_inserts( 111 COMMUNITY_PERMISSIONS_TABLE, 112 array_keys($insert), 113 array($insert) 114 ); 115 116 $page['highlight'] = pwg_db_insert_id(COMMUNITY_PERMISSIONS_TABLE); 117 118 array_push( 119 $page['infos'], 120 l10n('Permission added') 121 ); 122 } 91 123 92 124 conf_update_param('community_update', time()); … … 128 160 // +-----------------------------------------------------------------------+ 129 161 162 // edit mode? 163 if (isset($_GET['edit'])) 164 { 165 check_input_parameter('edit', $_GET, false, PATTERN_ID); 166 167 $query = ' 168 SELECT 169 * 170 FROM '.COMMUNITY_PERMISSIONS_TABLE.' 171 WHERE id = '.$_GET['edit'].' 172 ;'; 173 $result = pwg_query($query); 174 $row = pwg_db_fetch_assoc($result); 175 176 if (isset($row['id'])) 177 { 178 $template->assign( 179 array( 180 'edit' => $row['id'], 181 'who_options_selected' => $row['type'], 182 'user_options_selected' => $row['user_id'], 183 'group_options_selected' => $row['group_id'], 184 'category_options_selected' => $row['category_id'], 185 'recursive' => get_boolean($row['recursive']), 186 'create_subcategories' => get_boolean($row['create_subcategories']), 187 'moderated' => get_boolean($row['moderated']), 188 ) 189 ); 190 } 191 } 192 else 193 { 194 $template->assign( 195 array( 196 'moderated' => true, 197 ) 198 ); 199 } 200 201 // who options 202 $template->assign( 203 array( 204 'who_options' => $who_options, 205 ) 206 ); 130 207 131 208 // list of users … … 322 399 $trust_tooltip = l10n('uploaded photos are directly displayed in the gallery'); 323 400 } 401 402 $highlight = false; 403 if (isset($_GET['edit']) and $permission['id'] == $_GET['edit']) 404 { 405 $highlight = true; 406 } 407 if (isset($page['highlight']) and $permission['id'] == $page['highlight']) 408 { 409 $highlight = true; 410 } 411 324 412 325 413 $template->append( … … 333 421 'RECURSIVE_TOOLTIP' => l10n('Apply to sub-albums'), 334 422 'CREATE_SUBCATEGORIES' => get_boolean($permission['create_subcategories']), 335 'U_DELETE' => $admin_base_url.'&delete='.$permission['id'] 423 'U_DELETE' => $admin_base_url.'&delete='.$permission['id'], 424 'U_EDIT' => $admin_base_url.'&edit='.$permission['id'], 425 'HIGHLIGHT' => $highlight, 336 426 ) 337 427 ); -
extensions/community/admin_permissions.tpl
r9500 r9510 2 2 <style> 3 3 form fieldset p {text-align:left;margin:0 0 1.5em 0;line-height:20px;} 4 .permissionActions {text-align:center;height:20px} 5 .permissionActions a:hover {border:none} 6 .permissionActions img {margin-bottom:-2px} 7 .rowSelected {background-color:#C2F5C2 !important} 4 8 </style> 5 9 {/literal} … … 56 60 </div> 57 61 62 {if not isset($edit)} 58 63 <a id="displayForm" href="#">{'Add a permission'|@translate}</a> 64 {/if} 59 65 60 <form method="post" name="add_permission" action="{$F_ADD_ACTION}" class="properties" style="display:none">66 <form method="post" name="add_permission" action="{$F_ADD_ACTION}" class="properties" {if not isset($edit)}style="display:none"{/if}> 61 67 <fieldset> 62 <legend>{ 'Add a permission'|@translate}</legend>68 <legend>{if isset($edit)}{'Edit a permission'|@translate}{else}{'Add a permission'|@translate}{/if}</legend> 63 69 64 70 <p> … … 66 72 <br> 67 73 <select name="who"> 68 <option value="any_visitor">{'any visitor'|@translate}</option> 69 <option value="any_registered_user">{'any registered user'|@translate}</option> 70 <option value="user">{'a specific user'|@translate}</option> 71 <option value="group">{'a group'|@translate}</option> 74 {html_options options=$who_options selected=$who_options_selected} 72 75 </select> 73 76 74 <select name="who_user" style="display:none">77 <select name="who_user" {if not isset($user_options_selected)}style="display:none"{/if}> 75 78 {html_options options=$user_options selected=$user_options_selected} 76 79 </select> 77 80 78 <select name="who_group" style="display:none">81 <select name="who_group" {if not isset($group_options_selected)}style="display:none"{/if}> 79 82 {html_options options=$group_options selected=$group_options_selected} 80 83 </select> … … 85 88 <br> 86 89 <select class="categoryDropDown" name="category"> 87 <option value="0" >{'The whole gallery'|@translate}</option>90 <option value="0" {if not isset($category_options_selected)}selected="selected"{/if}>{'The whole gallery'|@translate}</option> 88 91 <option disabled="disabled">------------</option> 89 92 {html_options options=$category_options selected=$category_options_selected} 90 93 </select> 91 94 <br> 92 <label><input type="checkbox" name="recursive" checked="checked"> {'Apply to sub-albums'|@translate}</label>95 <label><input type="checkbox" name="recursive" {if $recursive}checked="checked"{/if}> {'Apply to sub-albums'|@translate}</label> 93 96 <br> 94 <label><input type="checkbox" name="create_subcategories" > {'ability to create sub-albums'|@translate}</label>97 <label><input type="checkbox" name="create_subcategories" {if $create_subcategories}checked="checked"{/if}> {'ability to create sub-albums'|@translate}</label> 95 98 </p> 96 99 97 100 <p> 98 101 <strong>{'Which level of trust?'|@translate}</strong> 99 <br><label><input type="radio" name="moderate " value="true" checked="checked"> <em>{'low trust'|@translate}</em> : {'uploaded photos must be validated by an administrator'|@translate}</label>100 <br><label><input type="radio" name="moderate " value="false"> <em>{'high trust'|@translate}</em> : {'uploaded photos are directly displayed in the gallery'|@translate}</label>102 <br><label><input type="radio" name="moderated" value="true" {if $moderated}checked="checked"{/if}> <em>{'low trust'|@translate}</em> : {'uploaded photos must be validated by an administrator'|@translate}</label> 103 <br><label><input type="radio" name="moderated" value="false" {if not $moderated}checked="checked"{/if}> <em>{'high trust'|@translate}</em> : {'uploaded photos are directly displayed in the gallery'|@translate}</label> 101 104 </p> 105 106 {if isset($edit)} 107 <input type="hidden" name="edit" value="{$edit}"> 108 {/if} 102 109 103 110 <p style="margin:0;"> 104 <input class="submit" type="submit" name="submit_add" value="{'Add'|@translate}"/> 111 <input class="submit" type="submit" name="submit_add" value="{if isset($edit)}{'Submit'|@translate}{else}{'Add'|@translate}{/if}"/> 112 <a href="{$F_ADD_ACTION}">{'Cancel'|@translate}</a> 105 113 </p> 106 114 </fieldset> … … 116 124 {if not empty($permissions)} 117 125 {foreach from=$permissions item=permission name=permission_loop} 118 <tr class="{if $smarty.foreach.permission_loop.index is odd}row1{else}row2{/if} ">126 <tr class="{if $smarty.foreach.permission_loop.index is odd}row1{else}row2{/if}{if $permission.HIGHLIGHT} rowSelected{/if}"> 119 127 <td>{$permission.WHO}</td> 120 128 <td>{$permission.WHERE}</td> … … 128 136 {/if} 129 137 </td> 130 <td style="text-align:center;"> 138 <td class="permissionActions"> 139 <a href="{$permission.U_EDIT}"> 140 <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" alt="{'edit'|@translate}" title="{'edit'|@translate}" /> 141 </a> 131 142 <a href="{$permission.U_DELETE}" onclick="return confirm( document.getElementById('btn_delete').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');"> 132 <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" class="button" style="border:none" id="btn_delete" alt="{'delete'|@translate}" title="{'delete'|@translate}" />143 <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" id="btn_delete" alt="{'delete'|@translate}" title="{'Delete permission'|@translate}" /> 133 144 </a> 134 145 </td> -
extensions/community/language/en_UK/plugin.lang.php
r9453 r9510 52 52 53 53 $lang['No album, this photo is orphan'] = 'No album, this photo is orphan'; 54 55 $lang['Cancel'] = 'Cancel'; 56 $lang['Permission updated'] = 'Permission updated'; 57 $lang['Delete permission'] = 'Delete permission'; 54 58 ?> -
extensions/community/language/fr_FR/plugin.lang.php
r9453 r9510 54 54 55 55 $lang['No album, this photo is orphan'] = 'Aucun album, cette photo est orpheline'; 56 $lang['Cancel'] = 'Annuler'; 57 $lang['Permission updated'] = 'Permission mise à jour'; 58 $lang['Delete permission'] = 'Supprimer la permission'; 56 59 ?>
Note: See TracChangeset
for help on using the changeset viewer.