Changeset 1390:67a4bd21e3a9
- Timestamp:
- 08/15/13 19:26:48 (11 years ago)
- Branch:
- 2.5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/categories.php
r1179 r1390 31 31 $mov_cat = $mov_cat ? $mov_cat : null; 32 32 if ($mov_cat !== null) { 33 $c = $core->blog->getCategory((integer) $_POST[' del_cat']);33 $c = $core->blog->getCategory((integer) $_POST['mov_cat']); 34 34 if ($c->isEmpty()) { 35 35 throw new Exception(__('This category does not exist.')); … … 141 141 echo '</div>'; 142 142 143 $categories_combo = array(); 144 if (!$rs->isEmpty()) 145 { 146 $l = $rs->level; 147 $full_name = array($rs->cat_title); 148 149 while ($rs->fetch()) { 150 if ($rs->level < $l) { 151 $full_name = array(); 152 } elseif ($rs->level == $l) { 153 array_pop($full_name); 154 } 155 $full_name[] = html::escapeHTML($rs->cat_title); 156 $categories_combo[implode(' / ',$full_name)] = $rs->cat_id; 157 $l = $rs->level; 158 } 159 } 160 143 161 echo '<div class="col">'. 144 162 … … 146 164 '<fieldset><legend>'.__('Add a new category').'</legend>'. 147 165 '<p><label class="required" for="cat_title"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').' '. 148 form::field('cat_title',30,255 ).'</label></p>'.166 form::field('cat_title',30,255,'','maximal').'</label></p>'. 149 167 '<p><label for="new_cat_parent">'.__('Parent:').' '. 150 '<select id="new_cat_parent" name="new_cat_parent">'. 151 '<option value="0">'.__('Top level').'</option>'; 152 while ($rs->fetch()) { 153 echo '<option value="'.$rs->cat_id.'">'. 154 str_repeat(' ',$rs->level-1).($rs->level-1 == 0 ? '' : '• '). 155 html::escapeHTML($rs->cat_title).'</option>'; 156 } 157 echo 158 '</select></label></p>'. 168 form::combo('new_cat_parent',array_merge(array(__('(No cat)') => 0),$categories_combo),'','maximal'). 169 '</label></p>'. 159 170 '<p><input type="submit" value="'.__('Create').'" /></p>'. 160 171 $core->formNonce(). … … 164 175 if (!$rs->isEmpty()) 165 176 { 166 $cats = array();167 $dest = array(' ' => '');168 $l = $rs->level;169 $full_name = array($rs->cat_title);170 while ($rs->fetch())171 {172 if ($rs->level < $l) {173 $full_name = array();174 } elseif ($rs->level == $l) {175 array_pop($full_name);176 }177 $full_name[] = html::escapeHTML($rs->cat_title);178 179 $cats[implode(' / ',$full_name)] = $rs->cat_id;180 $dest[implode(' / ',$full_name)] = $rs->cat_id;181 182 $l = $rs->level;183 }184 185 177 echo 186 178 '<form action="categories.php" method="post" id="delete-category">'. 187 179 '<fieldset><legend>'.__('Remove a category').'</legend>'. 188 180 '<p><label for="del_cat">'.__('Choose a category to remove:').' '. 189 form::combo('del_cat',$cat s).'</label></p> '.181 form::combo('del_cat',$categories_combo,'','maximal').'</label></p> '. 190 182 '<p><label for="mov_cat">'.__('And choose the category which will receive its entries:').' '. 191 form::combo('mov_cat', $dest).'</label></p> '.183 form::combo('mov_cat',array_merge(array(__('(No cat)') => ''),$categories_combo),'','maximal').'</label></p> '. 192 184 '<p><input type="submit" value="'.__('Delete').'" class="delete" /></p>'. 193 185 $core->formNonce().
Note: See TracChangeset
for help on using the changeset viewer.