Changeset 1531:18a9e84c04e3 for admin
- Timestamp:
- 08/23/13 11:15:23 (11 years ago)
- Branch:
- default
- Location:
- admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/categories.php
r1525 r1531 17 17 # Remove a categories 18 18 if (!empty($_POST['categories'])) { 19 $error = false; 20 foreach ($_POST['categories'] as $cat_id) { 21 # Check if category to delete exists 22 $c = $core->blog->getCategory((integer) $cat_id); 23 if ($c->isEmpty()) { 24 continue; 19 try { 20 # Check if category where to move posts exists 21 $mov_cat = (int) $_POST['mov_cat']; 22 $mov_cat = $mov_cat ? $mov_cat : null; 23 if ($mov_cat !== null) { 24 $c = $core->blog->getCategory($mov_cat); 25 if ($c->isEmpty()) { 26 throw new Exception(__('Category where to move posts does not exist')); 27 } 28 unset($c); 29 30 if (in_array($mov_cat, $_POST['categories'])) { 31 throw new Exception(__('The entries cannot be moved to the category you choose to delete.')); 32 } 25 33 } 26 unset($c);27 34 28 try { 35 foreach ($_POST['categories'] as $cat_id) { 36 # Check if category to delete exists 37 $c = $core->blog->getCategory((integer) $cat_id); 38 if ($c->isEmpty()) { 39 continue; 40 } 41 unset($c); 42 43 # Move posts 44 if ($mov_cat != $cat_id) { 45 $core->blog->changePostsCategory($cat_id,$mov_cat); 46 } 47 29 48 # Delete category 30 49 $core->blog->delCategory($cat_id); 31 } catch (Exception $e) {32 $error = true;33 50 } 34 }35 if (!$error) {36 51 http::redirect('categories.php?del='.count($_POST['categories'])); 52 } catch (Exception $e) { 53 $core->error->add($e->getMessage()); 37 54 } 38 55 } … … 58 75 } 59 76 60 # --BEHAVIOR-- adminCategoriesActionsCombo61 $core->callBehavior('adminCategoriesActionsCombo',array(&$combo_action));62 63 77 64 78 /* Display … … 74 88 ); 75 89 76 if (!empty($_GET['add'])) {77 dcPage::message(__('The category has been successfully created.'));78 }79 90 if (!empty($_GET['del'])) { 80 dcPage::message(__('The category has been successfully removed.',81 82 83 84 91 dcPage::message(__('The category has been successfully removed.', 92 'The categories have been successfully removed.', 93 (int) $_GET['del'] 94 ) 95 ); 85 96 } 86 97 if (!empty($_GET['reord'])) { 87 98 dcPage::message(__('Categories have been successfully reordered.')); 88 }89 if (!empty($_GET['moved'])) {90 dcPage::message(__('The category has been successfully moved.'));91 99 } 92 100 … … 139 147 140 148 echo 141 '<p>'; 142 if ($rs->nb_total == 0) { 143 echo form::checkbox(array('categories[]'),$rs->cat_id); 144 } 145 146 echo 149 '<p>'. 150 form::checkbox(array('categories[]'),$rs->cat_id). 147 151 '<strong><a href="category.php?id='.$rs->cat_id.'">'.html::escapeHTML($rs->cat_title).'</a></strong>'. 148 152 ' (<a href="posts.php?cat_id='.$rs->cat_id.'">'. … … 164 168 '<div class="two-cols">'. 165 169 '<p class="col checkboxes-helpers"></p>'. 170 '<p class="col right"><label for="mov_cat">'.__('And choose the category which will receive its entries:').'</label> '. 171 form::combo('mov_cat',array_merge(array(__('(No cat)') => ''),$categories_combo),'','maximal').'</p> '. 166 172 '<p class="col right"><label for="action" class="classic">'.__('Selected categories action:').'</label> '. 167 173 form::combo('action',$combo_action). -
admin/js/_categories.js
r1525 r1531 3 3 $('.checkboxes-helpers').each(function() { 4 4 dotclear.checkboxesHelpers(this); 5 }); 6 7 $('#mov_cat').parent().hide(); 8 $('input[name="categories[]"]').click(function() { 9 $('#mov_cat').parent().parent().removeClass('two-cols').addClass('three-cols'); 10 $('#mov_cat').parent().show(); 5 11 }); 6 12
Note: See TracChangeset
for help on using the changeset viewer.