Changeset 25654
- Timestamp:
- Nov 23, 2013, 4:16:27 PM (10 years ago)
- Location:
- extensions/AdminTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdminTools/include/events.inc.php
r25629 r25654 21 21 'USER' => $MultiView->get_user(), 22 22 'CURRENT_USERNAME' => $user['id']==$conf['guest_id'] ? l10n('guest') : $user['username'], 23 'PWG_TOKEN' => get_pwg_token(), 23 24 ); 24 25 … … 27 28 { 28 29 global $picture; 30 31 include_once(PHPWG_ROOT_PATH . 'admin/include/functions.php'); 29 32 30 33 $url_self = duplicate_picture_url(); … … 38 41 )); 39 42 43 $template->set_prefilter('picture', 'admintools_remove_privacy'); 44 40 45 $query = 'SELECT element_id FROM ' . CADDIE_TABLE . ' 41 46 WHERE element_id = ' . $page['image_id'] .';'; … … 63 68 $url_self, 64 69 array('action'=>'add_to_caddie') 70 ); 71 72 // gets tags 73 $query = ' 74 SELECT id, name 75 FROM '.IMAGE_TAG_TABLE.' AS it 76 JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id 77 WHERE image_id = '.$page['image_id'].' 78 ;'; 79 $tag_selection = get_taglist($query); 80 81 $query = ' 82 SELECT id, name 83 FROM '.TAGS_TABLE.' 84 ;'; 85 $tags = get_taglist($query, false); 86 87 $tpl_vars['QUICK_EDIT'] = array( 88 'file' => $picture['current']['file'], 89 'name' => $picture['current']['name'], 90 'comment' => $picture['current']['comment'], 91 'author' => $picture['current']['author'], 92 'level' => $picture['current']['level'], 93 'date_creation' => substr($picture['current']['date_creation'], 0, 10), 94 'date_creation_time' => substr($picture['current']['date_creation'], 11, 5), 95 'tag_selection' => $tag_selection, 96 'tags' => $tags, 65 97 ); 66 98 } … … 122 154 $template->parse('ato'); 123 155 } 156 157 function admintools_remove_privacy($content) 158 { 159 $search = '{if $display_info.privacy_level and isset($available_permission_levels)}'; 160 $replace = '{if false}'; 161 return str_replace($search, $replace, $content); 162 } 163 164 function admintools_save_picture() 165 { 166 global $page, $conf; 167 168 if (isset($_GET['delete']) and get_pwg_token()==@$_GET['pwg_token']) 169 { 170 include_once(PHPWG_ROOT_PATH . 'admin/include/functions.php'); 171 172 delete_elements(array($page['image_id']), true); 173 invalidate_user_cache(); 174 175 if (isset($page['category'])) 176 { 177 redirect( 178 make_index_url( 179 array( 180 'category' => $page['category'] 181 ) 182 ) 183 ); 184 } 185 186 redirect(make_index_url()); 187 } 188 189 if (@$_POST['action'] == 'quick_edit') 190 { 191 include_once(PHPWG_ROOT_PATH . 'admin/include/functions.php'); 192 193 $data = array( 194 'name' => $_POST['name'], 195 'author' => $_POST['author'], 196 'level' => $_POST['level'], 197 ); 198 199 if ($conf['allow_html_descriptions']) 200 { 201 $data['comment'] = @$_POST['comment']; 202 } 203 else 204 { 205 $data['comment'] = strip_tags(@$_POST['comment']); 206 } 207 208 if (!empty($_POST['date_creation']) and strtotime($_POST['date_creation']) !== false) 209 { 210 $data['date_creation'] = $_POST['date_creation'] .' '. $_POST['date_creation_time']; 211 } 212 213 single_update( 214 IMAGES_TABLE, 215 $data, 216 array('id' => $page['image_id']) 217 ); 218 219 $tag_ids = array(); 220 if (!empty($_POST['tags'])) 221 { 222 $tag_ids = get_tag_ids($_POST['tags']); 223 } 224 set_tags($tag_ids, $page['image_id']); 225 } 226 } -
extensions/AdminTools/main.inc.php
r25617 r25654 34 34 { 35 35 add_event_handler('loc_after_page_header', 'admintools_add_public_controller'); 36 add_event_handler('loc_begin_picture', 'admintools_save_picture'); 36 37 } 37 38 -
extensions/AdminTools/template/public_controller.tpl
r25629 r25654 2 2 {combine_css path='admin/themes/default/fontello/css/fontello.css'} 3 3 {combine_css path=$ADMINTOOLS_PATH|cat:'template/fontello/css/fontello-ato.css'} 4 5 {if isset($ato.QUICK_EDIT)} 6 {*<!-- colorbox -->*} 7 {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'} 8 {combine_css id='colorbox' path='themes/default/js/plugins/colorbox/style2/colorbox.css'} 9 10 {*<!-- tokeninput -->*} 11 {combine_script id='jquery.tokeninput' load='footer' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'} 12 {combine_css path='themes/default/js/plugins/jquery.tokeninput.css'} 13 14 {*<!-- datepicker -->*} 15 {combine_script id='jquery.ui.datepicker' load='footer' path='themes/default/js/ui/jquery.ui.datepicker.js'} 16 17 {assign var=datepicker_language value='themes/default/js/ui/i18n/jquery.ui.datepicker-'|cat:$lang_info.code|cat:'.js'} 18 {if 'PHPWG_ROOT_PATH'|@constant|@cat:$datepicker_language|@file_exists} 19 {combine_script id='jquery.ui.datepicker'|cat:$lang_info.code load='footer' path=$datepicker_language} 20 {/if} 21 22 {combine_css path='themes/default/js/ui/theme/jquery.ui.core.css'} 23 {combine_css path='themes/default/js/ui/theme/jquery.ui.theme.css'} 24 {combine_css path='themes/default/js/ui/theme/jquery.ui.datepicker.css'} 25 {/if} 26 4 27 5 28 <div id="ato_header_closed"><a href="#" class="icon-tools"></a></div> … … 21 44 <li class="parent"><a href="#" class="icon-pencil">{'Edit'|translate}</a> 22 45 <ul> 23 <li><a href="# " class="icon-ato-flash edit-quick">{'Quick edit'|translate}</a></li>46 <li><a href="#ato_quick_edit" class="icon-ato-flash edit-quick">{'Quick edit'|translate}</a></li> 24 47 <li><a class="icon-ato-doc-text-inv" href="{$ato.U_EDIT}">{'Properties page'|translate}</a></li> 25 48 </ul> … … 34 57 {if isset($ato.IS_CATEGORY)} 35 58 <li><a class="icon-plus-circled" href="{$ato.U_SITE_ADMIN}photos_add&album={$ato.CATEGORY_ID}">{'Add Photos'|translate}</a></li> 59 {/if} 60 {if isset($ato.IS_PICTURE)} 61 <li><a class="icon-ato-cancel" href="{$ato.U_SELF}delete&pwg_token={$ato.PWG_TOKEN}" onclick="return confirm('{'Are you sure?'|translate|escape:javascript}')">{'delete photo'|translate|ucfirst}</a></li> 36 62 {/if} 37 63 … … 70 96 </div> 71 97 98 {if isset($ato.QUICK_EDIT)} 99 <div style="display:none;"> 100 <div id="ato_quick_edit"> 101 <form method="post" action="{$ato.U_SELF}"> 102 <fieldset class="left"> 103 <img src="{$current.derivatives.square->get_url()}" width="100" height="100"> 104 <br><input type="submit" value="{'Save'|translate}"> 105 <br><a href="#" class="icon-ato-cancel close-edit">{'Cancel'|translate}</a> 106 </fieldset> 107 108 <fieldset class="main"> 109 <label for="quick_edit_name">{'Name'|translate}</label> 110 <input type="text" name="name" id="quick_edit_name" value="{$ato.QUICK_EDIT.name|escape:html}"> 111 112 <label for="quick_edit_author">{'Author'|translate}</label> 113 <input type="text" name="author" id="quick_edit_author" value="{$ato.QUICK_EDIT.author|escape:html}"> 114 115 116 <label for="quick_edit_date_creation">{'Creation date'|translate}</label> 117 <input type="text" name="date_creation" id="quick_edit_date_creation" class="datepicker" value="{$ato.QUICK_EDIT.date_creation}"> 118 <input type="hidden" name="date_creation_time" value="{$ato.QUICK_EDIT.date_creation_time}"> 119 120 <label for="quick_edit_tags">{'Tags'|translate}</label> 121 <select name="tags" id="quick_edit_tags" class="tags"> 122 {foreach from=$ato.QUICK_EDIT.tag_selection item=tag} 123 <option value="{$tag.id}" class="selected">{$tag.name}</option> 124 {/foreach} 125 </select> 126 127 <label for="quick_edit_comment">{'Description'|translate}</label> 128 <textarea name="comment" id="quick_edit_comment">{$ato.QUICK_EDIT.comment}</textarea> 129 130 <label for="quick_edit_level">{'Who can see this photo?'|@translate}</label> 131 <select name="level" size="1"> 132 {html_options options=$available_permission_levels selected=$ato.QUICK_EDIT.level} 133 </select> 134 </fieldset> 135 136 <input type="hidden" name="action" value="quick_edit"> 137 </form> 138 </div> 139 </div> 140 {/if} 141 72 142 {footer_script require='jquery'} 73 143 (function($){ … … 111 181 }); 112 182 183 {*<!-- select boxes -->*} 113 184 $ato.find('.switcher').on({ 114 185 'change': function() { … … 120 191 }); 121 192 193 {*<!-- toggle toolbar -->*} 122 194 $ato.find('.close-panel').on('click', function(e) { 123 195 $ato.slideUp(); … … 128 200 e.preventDefault(); 129 201 }); 130 202 131 203 $ato_closed.on('click', function(e) { 132 204 $ato.slideDown(); … … 193 265 {/if} 194 266 267 {* <!-- quick edit -->*} 268 {if isset($ato.QUICK_EDIT)} 269 var $ato_edit = $('#ato_quick_edit'); 270 271 $ato_edit.css('background-color', $("#the_page #content").css('background-color')); 272 273 $ato_edit.find('.close-edit').on('click', function(e) { 274 $.colorbox.close() 275 e.preventDefault(); 276 }); 277 278 $ato_edit.find('.datepicker').datepicker({ 279 dateFormat: 'yy-mm-dd' 280 }); 281 282 $ato_edit.find('.tags').tokenInput( 283 [{foreach from=$ato.QUICK_EDIT.tags item=tag name=tags}{ldelim}"name":"{$tag.name|escape:javascript}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}], 284 { 285 hintText: '{'Type in a search term'|@translate}', 286 noResultsText: '{'No results'|@translate}', 287 searchingText: '{'Searching...'|@translate}', 288 newText: ' ({'new'|@translate})', 289 animateDropdown: false, 290 preventDuplicates: true, 291 allowFreeTagging: true 292 } 293 ); 294 295 $(".edit-quick").colorbox({ 296 inline: true, 297 transition: 'none', 298 title: '{'Quick edit'|translate|escape:javascript}', 299 width: 500, 300 top: 50 301 }); 302 {/if} 303 195 304 }(jQuery)); 196 305 {/footer_script} -
extensions/AdminTools/template/style.css
r25619 r25654 1 1 .icon-ato-null:before { content: ' '; } 2 3 .token-input-dropdown { 4 z-index:10000 !important; 5 } 2 6 3 7 #ato_header, #ato_header_closed { … … 125 129 color:#d00; 126 130 } 131 132 133 #ato_quick_edit { 134 padding:10px; 135 } 136 #ato_quick_edit fieldset { 137 margin:0; 138 padding:0; 139 border:none; 140 } 141 #ato_quick_edit fieldset.left { 142 float:left; 143 width:100px; 144 text-align:center; 145 } 146 #ato_quick_edit input[type="submit"] { 147 margin:1.5em 0; 148 } 149 #ato_quick_edit fieldset.main { 150 margin:0 0 0 110px; 151 } 152 #ato_quick_edit label { 153 display:block; 154 font-weight:bold; 155 } 156 #ato_quick_edit input, #ato_quick_edit textarea, #ato_quick_edit select { 157 width:100%; 158 margin:0 0 1em 0; 159 border-radius:2px; 160 padding:2px; 161 -moz-box-sizing:border-box; 162 box-sizing:border-box; 163 } 164 #ato_quick_edit textarea { 165 height:110px; 166 } 167 #ato_quick_edit ul.token-input-list { 168 width:100%; 169 margin:0 0 1em 0; 170 }
Note: See TracChangeset
for help on using the changeset viewer.