Changeset 1147:2e5cb79e4782 for admin
- Timestamp:
- 03/08/13 15:37:34 (12 years ago)
- Branch:
- twig
- Location:
- admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/posts.php
r796 r1147 12 12 13 13 require dirname(__FILE__).'/../inc/admin/prepend.php'; 14 14 global $_ctx; 15 15 dcPage::check('usage,contentadmin'); 16 16 … … 48 48 # Filter form we'll put in html_block 49 49 $users_combo = $categories_combo = array(); 50 $users_combo['-'] = $categories_combo['-'] = '';51 50 while ($users->fetch()) 52 51 { … … 61 60 } 62 61 63 $categories_combo[__('None')] = 'NULL'; 62 63 # Getting categories 64 $categories_combo = array(); 65 try { 66 $categories = $core->blog->getCategories(array('post_type'=>'post')); 64 67 while ($categories->fetch()) { 65 $categories_combo[str_repeat(' ',$categories->level-1).($categories->level-1 == 0 ? '' : '• '). 66 html::escapeHTML($categories->cat_title). 67 ' ('.$categories->nb_post.')'] = $categories->cat_id; 68 $categories_combo[$categories->cat_id] = 69 str_repeat(' ',$categories->level-1). 70 ($categories->level-1 == 0 ? '' : '• '). 71 html::escapeHTML($categories->cat_title); 68 72 } 69 73 } catch (Exception $e) { } 70 74 $status_combo = array( 71 '-' => ''72 75 ); 73 76 foreach ($core->blog->getAllPostStatus() as $k => $v) { 74 $status_combo[ $v] = (string) $k;77 $status_combo[(string) $k] = (string)$v; 75 78 } 76 79 77 80 $selected_combo = array( 78 '-' => '', 79 __('selected') => '1', 80 __('not selected') => '0' 81 '1' => __('is selected'), 82 '0' => __('is not selected') 81 83 ); 82 84 83 85 # Months array 84 $dt_m_combo['-'] = '';85 86 while ($dates->fetch()) { 86 $dt_m_combo[ dt::str('%B %Y',$dates->ts())] = $dates->year().$dates->month();87 $dt_m_combo[$dates->year().$dates->month()] = dt::str('%B %Y',$dates->ts()); 87 88 } 88 89 89 $lang_combo['-'] = '';90 90 while ($langs->fetch()) { 91 91 $lang_combo[$langs->post_lang] = $langs->post_lang; 92 92 } 93 94 $sortby_combo = array(95 __('Date') => 'post_dt',96 __('Title') => 'post_title',97 __('Category') => 'cat_title',98 __('Author') => 'user_id',99 __('Status') => 'post_status',100 __('Selected') => 'post_selected'101 );102 103 $order_combo = array(104 __('Descending') => 'desc',105 __('Ascending') => 'asc'106 );107 93 } 94 $form = new dcForm($core,'post','post.php'); 95 108 96 109 97 # Actions combo box … … 136 124 $core->callBehavior('adminPostsActionsCombo',array(&$combo_action)); 137 125 138 /* Get posts139 -------------------------------------------------------- */140 $user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : '';141 $cat_id = !empty($_GET['cat_id']) ? $_GET['cat_id'] : '';142 $status = isset($_GET['status']) ? $_GET['status'] : '';143 $selected = isset($_GET['selected']) ? $_GET['selected'] : '';144 $month = !empty($_GET['month']) ? $_GET['month'] : '';145 $lang = !empty($_GET['lang']) ? $_GET['lang'] : '';146 $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'post_dt';147 $order = !empty($_GET['order']) ? $_GET['order'] : 'desc';148 126 149 $show_filters = false;150 127 151 $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; 152 $nb_per_page = 30; 153 154 if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { 155 if ($nb_per_page != $_GET['nb']) { 156 $show_filters = true; 128 class monthComboFilter extends comboFilter { 129 public function applyFilter($params) { 130 $month=$this->avalues['values'][0]; 131 $params['post_month'] = substr($month,4,2); 132 $params['post_year'] = substr($month,0,4); 157 133 } 158 $nb_per_page = (integer) $_GET['nb'];159 134 } 160 161 $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);162 $params['no_content'] = true;163 164 # - User filter165 if ($user_id !== '' && in_array($user_id,$users_combo)) {166 $params['user_id'] = $user_id;167 $show_filters = true;168 } else {169 $user_id='';170 }171 172 # - Categories filter173 if ($cat_id !== '' && in_array($cat_id,$categories_combo)) {174 $params['cat_id'] = $cat_id;175 $show_filters = true;176 } else {177 $cat_id='';178 }179 180 # - Status filter181 if ($status !== '' && in_array($status,$status_combo)) {182 $params['post_status'] = $status;183 $show_filters = true;184 } else {185 $status='';186 }187 188 # - Selected filter189 if ($selected !== '' && in_array($selected,$selected_combo)) {190 $params['post_selected'] = $selected;191 $show_filters = true;192 } else {193 $selected='';194 }195 196 # - Month filter197 if ($month !== '' && in_array($month,$dt_m_combo)) {198 $params['post_month'] = substr($month,4,2);199 $params['post_year'] = substr($month,0,4);200 $show_filters = true;201 } else {202 $month='';203 }204 205 # - Lang filter206 if ($lang !== '' && in_array($lang,$lang_combo)) {207 $params['post_lang'] = $lang;208 $show_filters = true;209 } else {210 $lang='';211 }212 213 # - Sortby and order filter214 if ($sortby !== '' && in_array($sortby,$sortby_combo)) {215 if ($order !== '' && in_array($order,$order_combo)) {216 $params['order'] = $sortby.' '.$order;217 } else {218 $order='desc';219 }220 221 if ($sortby != 'post_dt' || $order != 'desc') {222 $show_filters = true;223 }224 } else {225 $sortby='post_dt';226 $order='desc';227 }228 229 # Get posts230 try {231 $posts = $core->blog->getPosts($params);232 $counter = $core->blog->getPosts($params,true);233 $post_list = new adminPostList($core,$posts,$counter->f(0));234 } catch (Exception $e) {235 $core->error->add($e->getMessage());236 }237 238 135 /* DISPLAY 239 136 -------------------------------------------------------- */ 240 $starting_script = dcPage::jsLoad('js/_posts_list.js'); 241 if (!$show_filters) { 242 $starting_script .= dcPage::jsLoad('js/filter-controls.js'); 243 } 137 $filterSet = new dcFilterSet($core,'fposts','posts.php'); 244 138 245 dcPage::open(__('Entries'),$starting_script); 139 $filterSet 140 ->addFilter(new comboFilter( 141 'users',__('Author'), __('Author'), 'user_id', $users_combo)) 142 ->addFilter(new comboFilter( 143 'category',__('Category'), __('Category'), 'cat_id', $categories_combo)) 144 ->addFilter(new comboFilter( 145 'post_status',__('Status'), __('Status'), 'post_status', $status_combo)) 146 ->addFilter(new comboFilter( 147 'lang',__('Lang'), __('Lang'), 'post_lang', $lang_combo)) 148 ->addFilter(new booleanFilter( 149 'selected',__('Selected'), __('The post : '),'post_selected', $selected_combo)) 150 ->addFilter(new monthComboFilter( 151 'month',__('Month'),__('Month'), 'post_month', $dt_m_combo,array('singleval' => 1))) 152 ->addFilter(new textFilter( 153 'search',__('Contains'),__('The entry contains'), 'search',20,255)); 246 154 247 if (!$core->error->flag()) 248 { 249 echo 250 '<h2>'.html::escapeHTML($core->blog->name).' › <span class="page-title">'.__('Entries').'</span></h2>'. 251 '<p class="top-add"><a class="button add" href="post.php">'.__('New entry').'</a></p>'; 252 253 if (!$show_filters) { 254 echo '<p><a id="filter-control" class="form-control" href="#">'. 255 __('Filters').'</a></p>'; 256 } 257 258 echo 259 '<form action="posts.php" method="get" id="filters-form">'. 260 '<fieldset><legend>'.__('Filters').'</legend>'. 261 '<div class="three-cols">'. 262 '<div class="col">'. 263 '<label for="user_id">'.__('Author:'). 264 form::combo('user_id',$users_combo,$user_id).'</label> '. 265 '<label for="cat_id">'.__('Category:'). 266 form::combo('cat_id',$categories_combo,$cat_id).'</label> '. 267 '<label for="status">'.__('Status:'). 268 form::combo('status',$status_combo,$status).'</label> '. 269 '</div>'. 270 271 '<div class="col">'. 272 '<label for="selected">'.__('Selected:'). 273 form::combo('selected',$selected_combo,$selected).'</label> '. 274 '<label for="month">'.__('Month:'). 275 form::combo('month',$dt_m_combo,$month).'</label> '. 276 '<label for="lang">'.__('Lang:'). 277 form::combo('lang',$lang_combo,$lang).'</label> '. 278 '</div>'. 279 280 '<div class="col">'. 281 '<p><label for="sortby">'.__('Order by:'). 282 form::combo('sortby',$sortby_combo,$sortby).'</label> '. 283 '<label for="order">'.__('Sort:'). 284 form::combo('order',$order_combo,$order).'</label></p>'. 285 '<p><label for="nb" class="classic">'. form::field('nb',3,3,$nb_per_page).' '. 286 __('Entries per page').'</label></p> '. 287 '<p><input type="submit" value="'.__('Apply filters').'" /></p>'. 288 '</div>'. 289 '</div>'. 290 '<br class="clear" />'. //Opera sucks 291 '</fieldset>'. 292 '</form>'; 293 294 # Show posts 295 $post_list->display($page,$nb_per_page, 296 '<form action="posts_actions.php" method="post" id="form-entries">'. 297 298 '%s'. 299 300 '<div class="two-cols">'. 301 '<p class="col checkboxes-helpers"></p>'. 302 303 '<p class="col right"><label for="action" class="classic">'.__('Selected entries action:').'</label> '. 304 form::combo('action',$combo_action). 305 '<input type="submit" value="'.__('ok').'" /></p>'. 306 form::hidden(array('user_id'),$user_id). 307 form::hidden(array('cat_id'),$cat_id). 308 form::hidden(array('status'),$status). 309 form::hidden(array('selected'),$selected). 310 form::hidden(array('month'),$month). 311 form::hidden(array('lang'),$lang). 312 form::hidden(array('sortby'),$sortby). 313 form::hidden(array('order'),$order). 314 form::hidden(array('page'),$page). 315 form::hidden(array('nb'),$nb_per_page). 316 $core->formNonce(). 317 '</div>'. 318 '</form>' 319 ); 320 } 155 $filterSet->setup(); 321 156 322 dcPage::helpBlock('core_posts'); 323 dcPage::close(); 157 $_ctx 158 ->fillPageTitle(__('Entries'),'posts.php'); 159 $params=new ArrayObject(); 160 $filterSet->applyFilters($params); 161 $_ctx->filters = '['.print_r($params->getArrayCopy(),true).']'; 162 163 $core->tpl->display('posts.html.twig'); 164 165 324 166 ?> -
admin/style/default.css
r1065 r1147 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 */ 13 14 /* ------------------------------------------------------------------ html */15 13 body { 16 14 font: 75%/1.5em Helvetica,Arial,sans-serif; … … 40 38 margin-bottom: 0.6em; 41 39 } 40 42 41 h2 { 43 42 color: #666; … … 52 51 font-size: 1.2em; 53 52 } 53 54 54 p, div.p { 55 55 margin: 0 0 1em 0; 56 56 } 57 57 58 hr { 58 59 height: 1px; … … 61 62 border-style: solid; 62 63 } 64 63 65 pre, code { 64 66 font: 100% "Andale Mono","Courier New",monospace; … … 77 79 cursor: help; 78 80 } 81 79 82 80 83 /* LAYOUT … … 148 151 height: 2em; 149 152 } 150 #info-box1 p {151 margin: 0;152 display: inline;153 }154 153 #info-box1 select { 155 154 width: 15em; … … 197 196 padding: 1em; 198 197 background: #fff; 198 -webkit-border-radius: .5em; 199 -moz-border-radius: .5em; 199 200 border-radius: .5em; 200 201 border: 1px solid #ddd; … … 254 255 background: #dfdfdf; 255 256 text-decoration: none; 257 -webkit-border-top-left-radius: .3em; 258 -webkit-border-top-right-radius: .3em; 259 -moz-border-radius-topleft: .3em; 260 -moz-border-radius-topright: .3em; 256 261 border-top-left-radius: .3em; 257 262 border-top-right-radius: .3em; … … 277 282 float: left; 278 283 margin-top: 1.2em; 279 margin-bottom: 3em;284 margin-bottom: 1em; 280 285 } 281 286 #main-menu h3 { … … 297 302 padding: .2em 0 0 32px; 298 303 background-repeat: no-repeat; 299 background-position: 12px . 4em;304 background-position: 12px .2em; 300 305 } 301 306 #main-menu a { … … 335 340 #footer { 336 341 clear: both; 337 padding: .75em 0; 338 background: #575859 url(dc_logo_small.png) no-repeat 8px bottom; 342 padding: .75em 2em; 343 margin: 6em 15px .5em 15px; 344 -webkit-border-radius: .3em; 345 -moz-border-radius: .3em; 346 border-radius: .3em; 347 background: #575859 url(dc_logo_small.png) no-repeat right bottom; 339 348 color: #fff; 340 349 } … … 369 378 border: 1px solid #999; 370 379 padding: 1em 1em 0 1em; 380 -moz-border-radius: 4px; 381 -webkit-border-radius: 4px; 371 382 border-radius: 4px; 372 383 } … … 433 444 color: #666; 434 445 } 446 435 447 #dashboard-items { 436 448 float: left; … … 501 513 border: 1px solid #ccc; 502 514 border-left: 1em solid #E5E3DA; 515 -moz-border-radius: .3em; 516 -webkit-border-radius: .3em; 503 517 border-radius: .3em; 504 518 } … … 538 552 height: 500px; 539 553 } 554 540 555 #add-file-f { 541 556 position: relative; … … 621 636 display: inline; 622 637 } 638 623 639 #default-favs h3 { 624 640 margin-top: 2em; 625 641 margin-bottom: 1em; 626 642 } 643 627 644 .fav-list { 628 645 list-style-type: none; … … 651 668 border: 1px solid #ddd; 652 669 padding: .2em; 670 -moz-border-radius: .5em; 671 -webkit-border-radius: .5em; 653 672 border-radius: .5em; 654 673 } … … 745 764 border: 1px solid #f3f3f3; 746 765 cursor: pointer; 766 -moz-border-radius: 4px; 767 -webkit-border-radius: 4px; 747 768 border-radius: 4px; 748 769 } … … 783 804 } 784 805 #help-button { 785 position: fixed;786 top: 3.2em;806 position: absolute; 807 top: 6.2em; 787 808 right: 0px; 788 809 cursor: pointer; … … 794 815 text-transform: capitalize; 795 816 padding: .33em .75em .33em 1em; 796 border-radius: 1em 0 0 1em; 817 -moz-border-radius: 1em 0 0 1em; 818 -webkit-border-top-left-radius: 1em; 819 -webkit-border-bottom-left-radius: 1em; 797 820 color: #444; 798 821 } … … 856 879 div.message, p.message, 857 880 div.static-msg, p.static-msg { 858 padding: 0.5em 0.5em 0.5em 4 8px;881 padding: 0.5em 0.5em 0.5em 40px; 859 882 margin-bottom: 1em; 883 -moz-border-radius: 8px; 884 -webkit-border-radius: 8px; 860 885 border-radius: 8px; 861 886 } … … 865 890 } 866 891 div.error, p.error { 867 background: # ffdec8 url(msg-error.png) no-repeat .7em .7em;868 color: # 000;892 background: #e5bfbf url(msg-error.png) no-repeat 5px 5px; 893 color: #600; 869 894 } 870 895 div.message, p.message, 871 896 div.static-msg, p.static-msg { 872 background: #666 url(msg-std.png) no-repeat .7em .7em;897 background: #666 url(msg-std.png) no-repeat 5px 5px; 873 898 color: #fff; 874 899 } … … 917 942 vertical-align: middle; 918 943 } 944 919 945 /* Si quelque chose a besoin d'être caché sauf pour les revues d'écran */ 920 946 .hidden { … … 951 977 overflow: auto; 952 978 } 979 953 980 .grid { 954 981 background: transparent repeat url('grid.png') 0 0; 955 982 } 983 956 984 .line p { 957 985 margin: 0; … … 960 988 color: #666; 961 989 } 990 962 991 ul.nice { 963 992 margin: 1em 0; … … 986 1015 right: 0; 987 1016 } 988 .distrib img {989 display: block;990 float: right;991 margin-top: -1em;992 }993 1017 /* TABLES 994 1018 -------------------------------------------------------- */ … … 1008 1032 margin-bottom: .5em; 1009 1033 } 1010 1011 1034 th, td { 1012 1035 border-width: 0 0 1px 0; … … 1018 1041 th { 1019 1042 text-align: left; 1020 border-bottom-color: #666;1021 1043 } 1022 1044 .noborder td, td.noborder, .noborder th, th.noborder { 1023 1045 border-width: 0; 1024 1046 } 1047 1025 1048 table .maximal, table.maximal { 1026 1049 width: 100%; … … 1029 1052 width: 1px; 1030 1053 } 1054 1031 1055 table .nowrap { 1032 1056 white-space: nowrap; 1033 1057 vertical-align: top; 1034 }1035 table.settings, table.prefs {1036 width: 80%;1037 }1038 table.settings th:first-child, table.prefs th:first-child {1039 width: 20%;1040 }1041 table.settings th + th, table.prefs th + th {1042 width: 30%;1043 }1044 table.settings th + th + th, table.prefs th + th + th {1045 width: 10%;1046 }1047 table.settings th:last-child, table.prefs th:last-child {1048 width: 40%;1049 1058 } 1050 1059 … … 1119 1128 font-weight: normal; 1120 1129 } 1130 1121 1131 input, textarea, select { 1122 1132 background: #f9f9f9; … … 1126 1136 border-color: #000 #ccc #ccc #000; 1127 1137 } 1128 input.invalid, textarea.invalid, select.invalid {1129 border: 1px solid red;1130 background: #fff;1131 color: red;1132 box-shadow: 0 0 0 1px rgba(218, 62, 90, 0.3)1133 }1134 1138 input, textarea, select, option { 1135 1139 font: 1em "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif; … … 1151 1155 background: transparent; 1152 1156 } 1157 1153 1158 label { 1154 1159 display: block; … … 1162 1167 color: #666; 1163 1168 } 1164 span.form-note {1165 font-style:italic;1166 font-weight: normal;1167 color: #666;1168 }1169 1169 p.form-note.warn, p.form-note.info, p.warning { 1170 1170 font-style: normal; … … 1172 1172 } 1173 1173 p.form-note.warn, p.warning { 1174 background: #ffd url(warning.png) no-repeat . 3em .3em;1174 background: #ffd url(warning.png) no-repeat .2em .2em; 1175 1175 border: 1px solid #f0c020; 1176 1176 } 1177 1177 p.form-note.info { 1178 background: #eef url(info.png) no-repeat . 3em .2em;1178 background: #eef url(info.png) no-repeat .2em .2em; 1179 1179 border: 1px solid #99f; 1180 1180 } … … 1196 1196 resize: vertical; 1197 1197 } 1198 1198 1199 label.required { 1199 1200 font-weight: bold; … … 1208 1209 p.field { 1209 1210 position: relative; 1210 1211 1211 1212 } 1212 1213 p.field label { … … 1220 1221 top: 0; 1221 1222 } 1223 1222 1224 label .maximal, textarea.maximal, input.maximal { 1223 1225 width: 100%; … … 1234 1236 padding-left: 20px; 1235 1237 } 1238 1239 a#toggle-filters { 1240 font-weight: bold; 1241 background: url(../images/plus.png) no-repeat 0 0; 1242 padding-left: 20px; 1243 } 1244 1245 a#toggle-filters.opened { 1246 background: url(../images/minus.png) no-repeat 0 0; 1247 } 1248 1236 1249 .constrained { 1237 1250 margin: 0; … … 1262 1275 padding: .1em .5em 0 .5em; 1263 1276 text-shadow: 0 1px 1px rgba(0,0,0,.3); 1277 -webkit-border-radius: .2em; 1278 -moz-border-radius: .2em; 1264 1279 border-radius: .2em; 1265 1280 margin-bottom: .1em; … … 1343 1358 } 1344 1359 a.button.add { 1360 -webkit-border-radius: .5em; 1361 -moz-border-radius: .5em; 1345 1362 border-radius: .5em; 1346 1363 margin-bottom: .1em; 1347 background: #2C8FD1 url( ../images/add.png) no-repeat 6px center;1364 background: #2C8FD1 url(add.png) no-repeat 6px center; 1348 1365 color: #fff; 1349 1366 padding: .2em 16px .2em 30px; … … 1354 1371 } 1355 1372 1356 /* jQuery Autocomplete plugin */ 1357 .ac_results { 1358 padding: 0px; 1359 border: 1px dotted #f90; 1360 background-color: white; 1361 overflow: hidden; 1362 z-index: 99999; 1363 } 1364 .ac_results ul { 1365 width: 100%; 1366 list-style-position: outside; 1367 list-style: none; 1368 padding: 0; 1369 margin: 0; 1370 } 1371 .ac_results li { 1372 margin: 0px; 1373 padding: 2px 5px; 1374 cursor: default; 1375 display: block; 1376 font: menu; 1377 font-size: 1em; 1378 line-height: 16px; 1379 overflow: hidden; 1380 } 1381 .ac_loading { 1382 background: transparent url('loader.gif') right center no-repeat; 1383 } 1384 .ac_over { 1385 background-color: #06c; 1386 color: white; 1387 } 1373 form#filters {font-size: 100%; background: #f0f0f0; padding: 1em; border-radius: .5em; border: 1px solid #ddd;} 1374 form#filters .margintop {padding-top: 1.33em;} 1375 form#filters ul, form#filters p {list-style-type:none;margin: 0; padding: 0 0 .5em 0; margin-left: 1em;} 1376 form#filters .col30 {border-left: 1px solid #999;} 1377 form#filters .col30 h3 {margin-left: 1em;} 1378 1379 p.line, li.line { position: relative; padding: 3px 0 0 28px; margin: 0 0 1em 0;} 1380 li.line input[type=submit] {position: absolute; left:0;top:0; padding: 0 .1em; margin: 0;} 1381 li.line input[type=checkbox], li.line input[type=checkbox] {position: absolute; left: 0; top: .2em; padding: 0 .1em; margin: 0;} 1382 li.line select { margin-right: 2em;} 1383 li.line label { display: block; width: 8em; float: left;} 1384 li.line label img {margin-right: 8px;} 1385 li.line span.or { 1386 text-align: right; 1387 margin-left: 5em; 1388 font-weight: bold; 1389 } 1390 p.line label.or + select {margin-left: 2em;} 1391 li.line { padding: 0 0 0 20px; height: 1em;} 1392 li.line label {width: auto;} 1393 1394 #available_filters input[type=submit] {padding: 0 .1em; margin-left: .5em;} 1395 1396 div.pagination span, div.pagination a { 1397 margin-right: 1em; 1398 }
Note: See TracChangeset
for help on using the changeset viewer.