Example #1
0
}
// Load jquery UI to animate background color on change comment status and to transfer a comment to recycle bin
require_js('#jqueryUI#');
require_js('communication.js');
// auto requires jQuery
// Load the appropriate blog navigation styles (including calendar, comment forms...):
require_css($AdminUI->get_template('blog_base.css'));
// Default styles for the blog navigation
// Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images:
require_js_helper('colorbox');
// Include files to work with charts
require_js('#easypiechart#');
require_css('jquery/jquery.easy-pie-chart.css');
if (empty($blog)) {
    // Init JS to quick edit an order of the blogs in the table cell by AJAX
    init_field_editor_js(array('field_prefix' => 'order-blog-', 'action_url' => $admin_url . '?ctrl=dashboard&order_action=update&order_data='));
}
// Display <html><head>...</head> section! (Note: should be done early if actions do not redirect)
$AdminUI->disp_html_head();
// Display title, menu, messages, etc. (Note: messages MUST be displayed AFTER the actions)
$AdminUI->disp_body_top();
if ($blog) {
    // We want to look at a specific blog:
    // Begin payload block:
    // This div is to know where to display the message after overlay close:
    echo '<div class="first_payload_block">' . "\n";
    $AdminUI->disp_payload_begin();
    echo '<h2 class="page-title">' . $Blog->dget('name') . '</h2>';
    echo '<div class="row browse"><div class="col-lg-9 col-xs-12 floatleft">';
    load_class('items/model/_itemlist.class.php', 'ItemList');
    $block_item_Widget = new Widget('dash_item');
Example #2
0
/**
 * Initialize list mode; Several actions need this.
 */
function init_list_mode()
{
    global $tab, $tab_type, $Blog, $UserSettings, $ItemList, $AdminUI;
    // set default itemslist param prefix
    $items_list_param_prefix = 'items_';
    if (param('p', 'integer', NULL) || param('title', 'string', NULL)) {
        // Single post requested, do not filter any post types. If the user
        // has clicked a post link on the dashboard and previously has selected
        // a tab which would filter this post, it wouldn't be displayed now.
        $tab = 'full';
        // in case of single item view params prefix must be empty
        $items_list_param_prefix = NULL;
    } else {
        // Store/retrieve preferred tab from UserSettings:
        $UserSettings->param_Request('tab', 'pref_browse_tab', 'string', NULL, true, true);
        $UserSettings->param_Request('tab_type', 'pref_browse_tab_type', 'string', NULL, true, true);
    }
    if ($tab == 'tracker' && !$Blog->get_setting('use_workflow')) {
        // Display workflow view only if it is enabled
        global $Messages;
        $Messages->add(T_('Workflow feature has not been enabled for this collection.'), 'note');
        $tab = 'full';
    }
    /*
     * Init list of posts to display:
     */
    load_class('items/model/_itemlist.class.php', 'ItemList2');
    if (!empty($tab) && !empty($items_list_param_prefix)) {
        // Use different param prefix for each tab
        $items_list_param_prefix .= substr($tab, 0, 7) . '_';
        //.utf8_strtolower( $tab_type ).'_';
    }
    // Set different filterset name for each different tab and tab_type
    $filterset_name = $tab == 'type' ? $tab . '_' . utf8_strtolower($tab_type) : $tab;
    // Create empty List:
    $ItemList = new ItemList2($Blog, NULL, NULL, $UserSettings->get('results_per_page'), 'ItemCache', $items_list_param_prefix, $filterset_name);
    // COPY (func)
    $ItemList->set_default_filters(array('visibility_array' => get_visibility_statuses('keys')));
    if ($Blog->get_setting('orderby') == 'RAND') {
        // Do not display random posts in backoffice for easy management
        $ItemList->set_default_filters(array('orderby' => 'datemodified'));
    }
    switch ($tab) {
        case 'full':
            $ItemList->set_default_filters(array('types' => NULL));
            // $AdminUI->breadcrumbpath_add( T_('All items'), '?ctrl=items&amp;blog=$blog$&amp;tab='.$tab.'&amp;filter=restore' );
            // require colorbox js
            require_js_helper('colorbox');
            $AdminUI->breadcrumbpath_add(T_('All'), '?ctrl=items&amp;blog=$blog$&amp;tab=full&amp;filter=restore');
            break;
        case 'manual':
            if ($Blog->get('type') != 'manual') {
                // Display this tab only for manual blogs
                global $admin_url;
                header_redirect($admin_url . '?ctrl=items&blog=' . $Blog->ID . '&tab=type&tab_type=posts&filter=restore');
            }
            global $ReqURI, $blog;
            init_field_editor_js(array('action_url' => $ReqURI . '&blog=' . $blog . '&order_action=update&order_data='));
            $AdminUI->breadcrumbpath_add(T_('Manual view'), '?ctrl=items&amp;blog=$blog$&amp;tab=' . $tab . '&amp;filter=restore');
            break;
        case 'type':
            // Filter a posts list by type
            $ItemList->set_default_filters(array('types' => get_item_types_by_tab($tab_type)));
            $AdminUI->breadcrumbpath_add(T_($tab_type), '?ctrl=items&amp;blog=$blog$&amp;tab=' . $tab . '&amp;tab_type=' . urlencode($tab_type) . '&amp;filter=restore');
            break;
        case 'tracker':
            // In tracker mode, we want a different default sort:
            $ItemList->set_default_filters(array('orderby' => 'priority', 'order' => 'ASC'));
            $AdminUI->breadcrumbpath_add(T_('Workflow view'), '?ctrl=items&amp;blog=$blog$&amp;tab=tracker&amp;filter=restore');
            $AdminUI->set_page_manual_link('workflow-features');
            // JS to edit priority of items from list view
            require_js('jquery/jquery.jeditable.js', 'rsc_url');
            break;
        default:
            // Delete the pref_browse_tab setting so that the default
            // (full) gets used the next time the user wants to browse
            // a blog and we don't run into the same error again.
            $UserSettings->delete('pref_browse_tab');
            $UserSettings->dbupdate();
            debug_die('Unknown filterset [' . $tab . ']');
    }
    // Init filter params:
    if (!$ItemList->load_from_Request()) {
        // If we could not init a filterset from request
        // typically happens when we could no fall back to previously saved filterset...
        // echo ' no filterset!';
    }
}