Changeset 3833:ea88f004549f for admin/index.php
- Timestamp:
- 08/30/18 16:26:16 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/index.php
r3781 r3833 115 115 if ($core->auth->user_prefs->dashboard->doclinks) { 116 116 if (!empty($__resources['doc'])) { 117 $doc_links = '<div class="box small dc-box" ><h3>' . __('Documentation and support') . '</h3><ul>';117 $doc_links = '<div class="box small dc-box" id="doc-and-support"><h3>' . __('Documentation and support') . '</h3><ul>'; 118 118 119 119 foreach ($__resources['doc'] as $k => $v) { … … 150 150 -------------------------------------------------------- */ 151 151 dcPage::open(__('Dashboard'), 152 dcPage::jsLoad('js/jquery/jquery-ui.custom.js') . 153 dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') . 152 154 dcPage::jsLoad('js/_index.js') . 153 155 $admin_post_behavior . … … 244 246 } 245 247 246 # Dashboard items and contents (processed first, as we need to know the result before displaying the icons.) 247 $dashboardItems = ''; 248 foreach ($__dashboard_items as $i) { 249 foreach ($i as $v) { 250 $dashboardItems .= $v; 251 } 252 } 253 $dashboardContents = ''; 254 foreach ($__dashboard_contents as $i) { 255 foreach ($i as $v) { 256 $dashboardContents .= $v; 257 } 258 } 259 260 # Dashboard elements: icons then boxes (items then contents) 261 echo '<div id="dashboard-main">'; 262 248 # Get current main orders 249 $main_order = $core->auth->user_prefs->dashboard->main_order; 250 $main_order = ($main_order != '' ? explode(',', $main_order) : array()); 251 252 # Get current boxes orders 253 $boxes_order = $core->auth->user_prefs->dashboard->boxes_order; 254 $boxes_order = ($boxes_order != '' ? explode(',', $boxes_order) : array()); 255 256 # Get current boxes items orders 257 $boxes_items_order = $core->auth->user_prefs->dashboard->boxes_items_order; 258 $boxes_items_order = ($boxes_items_order != '' ? explode(',', $boxes_items_order) : array()); 259 260 # Get current boxes contents orders 261 $boxes_contents_order = $core->auth->user_prefs->dashboard->boxes_contents_order; 262 $boxes_contents_order = ($boxes_contents_order != '' ? explode(',', $boxes_contents_order) : array()); 263 264 $composeItems = function ($list, $blocks, $flat = false) { 265 266 $ret = array(); 267 $items = array(); 268 269 if ($flat) { 270 $items = $blocks; 271 } else { 272 foreach ($blocks as $i) { 273 foreach ($i as $v) { 274 $items[] = $v; 275 } 276 } 277 } 278 279 # First loop to find ordered indexes 280 $order = array(); 281 $index = 0; 282 foreach ($items as $v) { 283 if (preg_match('/<div.*?id="([^"].*?)".*?>/ms', $v, $match)) { 284 $id = $match[1]; 285 $position = array_search($id, $list, true); 286 if ($position !== false) { 287 $order[$position] = $index; 288 } 289 } 290 $index++; 291 } 292 293 # Second loop to combine ordered items 294 $index = 0; 295 foreach ($items as $v) { 296 $position = array_search($index, $order, true); 297 if ($position !== false) { 298 $ret[$position] = $v; 299 } 300 $index++; 301 } 302 # Reorder items on their position (key) 303 ksort($ret); 304 305 # Third loop to combine unordered items 306 $index = 0; 307 foreach ($items as $v) { 308 $position = array_search($index, $order, true); 309 if ($position === false) { 310 $ret[count($ret)] = $v; 311 } 312 $index++; 313 } 314 315 return join('', $ret); 316 }; 317 318 # Compose dashboard items (doc, …) 319 $dashboardItems = $composeItems($boxes_items_order, $__dashboard_items); 320 # Compose dashboard contents (plugin's modules) 321 $dashboardContents = $composeItems($boxes_contents_order, $__dashboard_contents); 322 323 $__dashboard_boxes = array(); 324 if ($dashboardItems != '') { 325 $__dashboard_boxes[] = '<div class="db-items" id="db-items">' . $dashboardItems . '</div>'; 326 } 327 if ($dashboardContents != '') { 328 $__dashboard_boxes[] = '<div class="db-contents" id="db-contents">' . $dashboardContents . '</div>'; 329 } 330 $dashboardBoxes = $composeItems($boxes_order, $__dashboard_boxes, true); 331 332 # Compose main area 333 $__dashboard_main = array(); 263 334 if (!$core->auth->user_prefs->dashboard->nofavicons) { 264 335 # Dashboard icons 265 echo'<div id="icons">';336 $dashboardIcons = '<div id="icons">'; 266 337 foreach ($__dashboard_icons as $i) { 267 echo 268 '<p><a href="' . $i[1] . '"><img src="' . dc_admin_icon_url($i[2]) . '" alt="" />' . 338 $dashboardIcons .= '<p><a href="' . $i[1] . '"><img src="' . dc_admin_icon_url($i[2]) . '" alt="" />' . 269 339 '<br /><span class="db-icon-title">' . $i[0] . '</span></a></p>'; 270 340 } 271 echo'</div>';272 } 273 341 $dashboardIcons .= '</div>'; 342 $__dashboard_main[] = $dashboardIcons; 343 } 274 344 if ($core->auth->user_prefs->dashboard->quickentry) { 275 345 if ($core->auth->check('usage,contentadmin', $core->blog->id)) { … … 279 349 ); 280 350 281 echo351 $dashboardQuickEntry = 282 352 '<div id="quick">' . 283 353 '<h3>' . __('Quick entry') . sprintf(' › %s', $core->auth->getOption('post_format')) . '</h3>' . … … 320 390 '</form>' . 321 391 '</div>'; 322 } 323 } 324 325 if ($dashboardContents != '' || $dashboardItems != '') { 326 echo 327 '<div id="dashboard-boxes">' . 328 ($dashboardItems != '' ? '<div class="db-items">' . $dashboardItems . '</div>' : '') . 329 ($dashboardContents != '' ? '<div class="db-contents">' . $dashboardContents . '</div>' : '') . 330 '</div>'; 331 } 332 333 echo '</div>'; #end dashboard-main 392 $__dashboard_main[] = $dashboardQuickEntry; 393 } 394 } 395 if ($dashboardBoxes != '') { 396 $__dashboard_main[] = '<div id="dashboard-boxes">' . $dashboardBoxes . '</div>'; 397 } 398 $dashboardMain = $composeItems($main_order, $__dashboard_main, true); 399 400 # Dashboard elements 401 echo '<div id="dashboard-main">' . $dashboardMain . '</div>'; 402 334 403 dcPage::helpBlock('core_dashboard'); 335 404 dcPage::close();
Note: See TracChangeset
for help on using the changeset viewer.