Changeset 1532:f6c9584b4677
- Timestamp:
- 08/23/13 13:16:14 (10 years ago)
- Branch:
- default
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/categories.php
r1531 r1532 55 55 } 56 56 57 # Update order 58 if (!empty($_POST['categories_order'])) 59 { 60 $categories = json_decode($_POST['categories_order']); 61 62 foreach ($categories as $category) { 63 if (!empty($category->item_id)) { 64 $core->blog->updCategoryPosition($category->item_id, $category->left, $category->right); 65 } 66 } 67 http::redirect('categories.php?reord=1'); 68 } 69 57 70 # Reset order 58 71 if (!empty($_POST['reset'])) … … 78 91 /* Display 79 92 -------------------------------------------------------- */ 80 dcPage::open(__('Categories'), 81 dcPage::jsToolMan()."\n". 82 dcPage::jsLoad('js/_categories.js'), 93 $rs = $core->blog->getCategories(array('post_type'=>'post')); 94 95 $starting_script = dcPage::jsToolMan()."\n"; 96 if (!$core->auth->user_prefs->accessibility->nodragdrop 97 && $core->auth->check('categories',$core->blog->id) 98 && $rs->count()>1) { 99 $starting_script .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js'); 100 $starting_script .= dcPage::jsLoad('js/jquery/jquery.mjs.nestedSortable.js'); 101 } 102 $starting_script .= dcPage::jsLoad('js/_categories.js'); 103 104 dcPage::open(__('Categories'),$starting_script, 83 105 dcPage::breadcrumb( 84 106 array( … … 99 121 } 100 122 101 $rs = $core->blog->getCategories(array('post_type'=>'post'));102 103 123 $categories_combo = array(); 104 124 if (!$rs->isEmpty()) … … 131 151 while ($rs->fetch()) 132 152 { 133 $attr = 'id="cat '.$rs->cat_id.'"';153 $attr = 'id="cat_'.$rs->cat_id.'"'; 134 154 if ($rs->nb_total == 0) { 135 155 $attr .= ' class="deletable"'; … … 188 208 '</form>'. 189 209 '</div>'; 210 211 if (!$core->auth->user_prefs->accessibility->nodragdrop 212 && $core->auth->check('categories',$core->blog->id) 213 && $rs->count()>1) { 214 echo 215 '<div class="col clear">'. 216 '<form action="categories.php" method="post">'. 217 '<p>'. 218 '<input type="hidden" id="categories_order" name="categories_order" value=""/>'. 219 '<input id="save-set-order" type="submit" value="'.__('Save categories order').'"/>'. 220 $core->formNonce().'</p>'. 221 '</form>'. 222 '</div>'; 223 } 190 224 } 191 225 -
admin/js/_categories.js
r1531 r1532 1 /* TODO: Some nice drag and drop on categories */2 1 $(function() { 2 if ($.fn['nestedSortable']!==undefined) { 3 $('#categories ul li').css('cursor','move'); 4 $('#save-set-order').prop('disabled',true).addClass('disabled'); 5 $('#categories ul').nestedSortable({ 6 listType: 'ul', 7 items: 'li', 8 placeholder: 'placeholder', 9 update: function() { 10 $('#categories_order').attr('value',JSON.stringify($('#categories ul').nestedSortable('toArray'))); 11 $('#save-set-order').prop('disabled',false).removeClass('disabled'); 12 } 13 }); 14 } 15 3 16 $('.checkboxes-helpers').each(function() { 4 17 dotclear.checkboxesHelpers(this); -
admin/style/default.css
r1526 r1532 632 632 font-weight: bold; 633 633 margin-top: 2em; 634 } 635 #categories .placeholder { 636 outline: 1px dashed #4183C4; 637 min-height: 2.5em; 638 } 639 #save-set-order.disabled { 640 text-shadow: none; 641 color: #000; 642 background: #F5F5F5; 643 background: -webkit-gradient(linear, left top, left bottom, from(#DFDFDF), to(#F5F5F5)); 644 background: -moz-linear-gradient(center top , #F5F5F5, #DFDFDF) repeat scroll 0 0 transparent; 645 border: 1px solid #CCCCCC; 646 } 647 #save-set-order.disabled:hover { 648 color: #666; 649 background: #DFDFDF; 650 border: 1px solid #CCCCCC; 634 651 } 635 652 /* ------------------------------------------------------------------ media */ -
inc/core/class.dc.blog.php
r1468 r1532 555 555 $this->triggerBlog(); 556 556 } 557 558 /** 559 Set category position 560 561 @param id <b>integer</b> Category ID 562 @param left <b>integer</b> Category ID before 563 @param right <b>integer</b> Category ID after 564 */ 565 public function updCategoryPosition($id,$left,$right) 566 { 567 $this->categories()->updatePosition($id,$left,$right); 568 $this->triggerBlog(); 569 } 557 570 558 571 /** -
inc/core/class.dc.categories.php
r1179 r1532 188 188 } 189 189 190 public function updatePosition($id,$left,$right) 191 { 192 $sql = 'UPDATE '.$this->table.' SET ' 193 .$this->f_left.' = '.$left.', ' 194 .$this->f_right.' = '.$right 195 .' WHERE '.$this->f_id .' = '.(integer) $id 196 .$this->getCondition(); 197 198 $this->con->begin(); 199 try { 200 $this->con->execute($sql); 201 $this->con->commit(); 202 } catch (Exception $e) { 203 $this->con->rollback(); 204 throw $e; 205 } 206 } 207 190 208 public function deleteNode($node,$keep_children=true) 191 209 { -
locales/fr/main.po
r1531 r1532 649 649 msgstr "Choisissez une catégorie à supprimer :" 650 650 651 msgid "Save categories order" 652 msgstr "Sauver l'ordre des catégories" 653 651 654 msgid "And choose the category which will receive its entries:" 652 655 msgstr "Et sélectionnez la catégorie qui recevra ses (éventuels) billets :"
Note: See TracChangeset
for help on using the changeset viewer.