示例#1
0
function items_list()
{
    global $layout;
    global $user;
    $navibars = new navibars();
    $navitable = new navitable("items_list");
    $navibars->title(t(22, 'Items'));
    $navibars->add_actions(array($user->permission("items.create") == 'false' ? '' : '<a href="?fid=' . $_REQUEST['fid'] . '&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>', 'search_form'));
    if ($_REQUEST['quicksearch'] == 'true') {
        $navitable->setInitialURL("?fid=" . $_REQUEST['fid'] . '&act=json&_search=true&quicksearch=' . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=json');
    $navitable->sortBy('date_modified', 'DESC');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=edit&id=');
    $navitable->enableSearch();
    if ($user->permission("items.delete") == 'true') {
        $navitable->enableDelete();
    }
    $navitable->setGridNotesObjectName("item");
    $navitable->addCol("ID", 'id', "40", "true", "left");
    $navitable->addCol(t(67, 'Title'), 'title', "320", "true", "left");
    $navitable->addCol(t(309, 'Social'), 'comments', "50", "true", "center");
    $navitable->addCol(t(78, 'Category'), 'category', "210", "true", "left");
    //$navitable->addCol(t(266, 'Author'), 'author_username', "80", "true", "left");
    $navitable->addCol(t(551, 'Date to display'), 'date_to_display', "60", "true", "center");
    $navitable->addCol(t(85, 'Date published'), 'dates', "100", "true", "center");
    $navitable->addCol(t(68, 'Status'), 'permission', "80", "true", "center");
    $navitable->addCol(t(168, 'Notes'), 'note', "50", "false", "center");
    $navitable->setLoadCallback('
        $("td[aria-describedby=\'items_list_category\']").truncate({
            "width": "auto",
            "token": "…",
            "side": "center",
            "addtitle": true
        });

        if($("#jqgh_items_list_category button").length < 1)
        {
            $("#jqgh_items_list_category").prepend("<button><i class=\\"fa fa-bars\\"></i></button>");
            $("#jqgh_items_list_category button")
            	.button()
            	.css(
            	{
                	"float": "right",
                	"margin-top": "0px",
                	"padding": "0px"
            	})
            	.on("click", items_list_choose_categories);

            $("#jqgh_items_list_category span.ui-button-text").css({"padding-top": "0", "padding-bottom": "0"});
        }
    ');
    // add categories filter
    $hierarchy = structure::hierarchy();
    $hierarchy = structure::hierarchyListClasses($hierarchy);
    $navibars->add_content('<div id="filter_categories_window" style="display: none;">' . $hierarchy . '</div>');
    $layout->add_script('$("#filter_categories_window ul").attr("data-name", "filter_categories_field");');
    $layout->add_script('
        $("#filter_categories_window ul").jAutochecklist({
            popup: false,
            absolutePosition: true,
            width: 0,
            listWidth: 400,
            listMaxHeight: 400,
            onItemClick: function(nval, li, selected_before, selected_after)
            {
                selected_after = selected_after.join(",");
                var filters = {
                    "groupOp" : "AND",
                    "rules": [
                        {
                            "field" : "category",
                            "op" : "in",
                            "data" : selected_after
                        },
                        {
                            "field" : "title",
                            "op" : "cn",
                            "data" : $("#navigate-quicksearch").val()
                        }
                    ]
                };

                $("#items_list").jqGrid(
                    "setGridParam",
                    {
                        search: true,
                        postData: { "filters": filters }
                    }
                ).trigger("reloadGrid");
            }
        });');
    $layout->add_script('
        function items_list_choose_categories()
        {
            $("#navigate-quicksearch").parent().on("submit", function(){
                $("#filter_categories_window ul").jAutochecklist("deselectAll");
            });

            $("#filter_categories_window ul").jAutochecklist("open");
            $(".jAutochecklist_list").css({"position": "absolute"});
            $(".jAutochecklist_list").css($("#jqgh_items_list_category button").offset());
            $(".jAutochecklist_dropdown_wrapper").hide();
            $(".jAutochecklist_list").css({
                "border-radius": "8px",
                "margin-left": "-373px",
                "margin-top": "16px"
            });
            $(".jAutochecklist_list").addClass("navi-ui-widget-shadow ui-menu ui-widget ui-widget-content ui-corner-all");

            return false;
        }
    ');
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
示例#2
0
function blocks_list()
{
    global $events;
    global $user;
    $navibars = new navibars();
    $navitable = new navitable("blocks_list");
    $navibars->title(t(23, 'Blocks'));
    // retrieve block groups, if more than 10, do not show quickmenu
    $group_blocks_links = array();
    list($bg_rs, $bg_total) = block_group::paginated_list(0, 10, 'title', 'desc');
    if ($bg_total > 0 && $bg_total <= 10) {
        foreach ($bg_rs as $bg) {
            $group_blocks_links[] = '<a class="ui-menu-action-bigger" href="?fid=' . $_REQUEST['fid'] . '&act=block_group_edit&id=' . $bg['id'] . '"><i class="fa fa-fw fa-caret-right"></i> ' . $bg['title'] . '</a>';
        }
        $events->add_actions('blocks', array('item' => null, 'navibars' => &$navibars), $group_blocks_links, '<a class="content-actions-submenu-trigger" href="?fid=' . $_REQUEST['fid'] . '&act=block_groups_list">
                <img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> ' . t(506, 'Groups') . ' &#9662;
            </a>');
    }
    $navibars->add_actions(array(!empty($group_blocks_links) ? '' : '<a href="?fid=' . $_REQUEST['fid'] . '&act=block_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> ' . t(506, 'Groups') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=block_types_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/brick_edit.png"> ' . t(167, 'Types') . '</a>'));
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>', 'search_form'));
    if (@$_REQUEST['quicksearch'] == 'true') {
        $navitable->setInitialURL("?fid=" . $_REQUEST['fid'] . '&act=json&_search=true&quicksearch=' . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=json');
    $navitable->sortBy('date_modified', 'desc');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=2&id=');
    $navitable->enableSearch();
    if ($user->permission("blocks.delete") == 'true') {
        $navitable->enableDelete();
    }
    $navitable->setGridNotesObjectName("block");
    $navitable->addCol("ID", 'id', "40", "true", "left");
    $navitable->addCol(t(160, 'Type'), 'type', "120", "true", "center");
    $navitable->addCol(t(67, 'Title'), 'title', "400", "true", "left");
    $navitable->addCol(t(85, 'Date published'), 'dates', "100", "true", "center");
    $navitable->addCol(t(364, 'Access'), 'access', "40", "true", "center");
    $navitable->addCol(t(65, 'Enabled'), 'enabled', "40", "true", "center");
    $navitable->addCol(t(168, 'Notes'), 'note', "50", "false", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
示例#3
0
function users_list()
{
    $navibars = new navibars();
    $navitable = new navitable("users_list");
    $navibars->title(t(15, 'Users'));
    $navibars->add_actions(array('<a href="?fid=users&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=users&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>', 'search_form'));
    if ($_REQUEST['quicksearch'] == 'true') {
        $navitable->setInitialURL("?fid=users&act=1&_search=true&quicksearch=" . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=users&act=1');
    $navitable->sortBy('id', 'DESC');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=users&act=2&id=');
    $navitable->enableDelete();
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(1, 'User'), 'username', "150", "true", "left");
    $navitable->addCol(t(44, 'E-Mail'), 'email', "150", "true", "left");
    $navitable->addCol(t(45, 'Profile'), 'profile', "100", "true", "left");
    $navitable->addCol(t(46, 'Language'), 'language', "80", "true", "left");
    $navitable->addCol(t(47, 'Blocked'), 'blocked', "50", "true", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
示例#4
0
function webusers_list()
{
    global $events;
    global $layout;
    $navibars = new navibars();
    $navitable = new navitable("webusers_list");
    $navibars->title(t(24, 'Web users'));
    $extra_actions = array('<a href="?fid=' . $_REQUEST['fid'] . '&act=export"><img height="16" align="absmiddle" width="16" src="img/icons/silk/table_save.png"> ' . t(475, 'Export') . '</a>');
    $events->add_actions('webusers', array('navibars' => &$navibars), $extra_actions);
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=webuser_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/group.png"> ' . t(506, 'Groups') . '</a>'));
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=create"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>', 'search_form'));
    if ($_REQUEST['quicksearch'] == 'true') {
        $navitable->setInitialURL("?fid=" . $_REQUEST['fid'] . '&act=1&_search=true&quicksearch=' . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=1');
    $navitable->sortBy('id', 'DESC');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=2&id=');
    $navitable->enableDelete();
    $navitable->setGridNotesObjectName("webuser");
    $navitable->addCol("ID", 'id', "40", "true", "left");
    $navitable->addCol(t(246, 'Avatar'), 'avatar', "60", "true", "center");
    $navitable->addCol(t(1, 'User'), 'username', "100", "true", "left");
    $navitable->addCol(t(159, 'Name'), 'fullname', "150", "true", "left");
    $navitable->addCol(t(506, 'Groups'), 'groups', "120", "true", "left");
    $navitable->addCol(t(247, 'Date joined'), 'joindate', "60", "true", "left");
    $navitable->addCol(t(321, 'Allowed'), 'access', "80", "true", "center");
    $navitable->addCol(t(168, 'Notes'), 'note', "32", "false", "center");
    // webuser groups filter
    $navitable->setLoadCallback('
        if($("#jqgh_webusers_list_groups button").length < 1)
        {
            $("#jqgh_webusers_list_groups").prepend("<button>");
            $("#jqgh_webusers_list_groups button").button({
                icons: { primary: "ui-icon-gear" },
                text: false
            }).css({
                "float": "right",
                "margin-top": "0px",
                "padding": "3px 0px"
            }).on("click", webusers_list_choose_groups);
        }
    ');
    $groups = webuser_group::all_in_array();
    $groups_html = array_map(function ($id, $name) {
        return '<li class="level1" data-value="g' . $id . '">' . $name . '</li>';
    }, array_keys($groups), array_values($groups));
    $navibars->add_content('
        <div id="filter_groups_window" style="display: none;">
            <ul data-name="filter_groups_field">' . implode("\n", $groups_html) . '
            </ul>
        </div>
    ');
    $layout->add_script('
        $("#filter_groups_window ul").jAutochecklist({
            popup: false,
            absolutePosition: true,
            width: 0,
            listWidth: 400,
            listMaxHeight: 400,
            onItemClick: function(nval, li, selected_before, selected_after)
            {
                selected_after = selected_after.join(",");
                var filters = {
                    "groupOp" : "AND",
                    "rules": [
                        {   "field" : "groups",
                            "op" : "in",
                            "data" : selected_after
                        },
                        {   "field" : "username",
                            "op" : "cn",
                            "data" : $("#navigate-quicksearch").val()
                        }
                    ]
                };

                $("#webusers_list").jqGrid("setGridParam", {
                    search: true,
                    postData: { "filters": filters }
                    }
                ).trigger("reloadGrid");
            }
        });');
    $layout->add_script('
        function webusers_list_choose_groups()
        {
            $("#navigate-quicksearch").parent().on("submit", function(){
                $("#filter_groups_window ul").jAutochecklist("deselectAll");
            });

            $("#filter_groups_window ul").jAutochecklist("open");
            $(".jAutochecklist_list").css({"position": "absolute"});
            $(".jAutochecklist_list").css($("#jqgh_webusers_list_groups button").offset());
            $(".jAutochecklist_dropdown_wrapper").hide();
            $(".jAutochecklist_list").css({
                "border-radius": "8px",
                "margin-left": "-373px",
                "margin-top": "16px"
            });
            $(".jAutochecklist_list").addClass("navi-ui-widget-shadow ui-menu ui-widget ui-widget-content ui-corner-all");

            return false;
        }
    ');
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
示例#5
0
function comments_list()
{
    $navibars = new navibars();
    $navitable = new navitable("comments_list");
    $navibars->title(t(250, 'Comments'));
    $navibars->add_actions(array('<a href="#" onclick="navigate_delete_dialog();"><img height="16" align="absmiddle" width="16" src="img/icons/silk/comments_delete.png"> ' . t(522, 'Remove Spam') . '</a>'));
    $delete_html = array();
    $delete_html[] = '<div id="navigate-delete-dialog" class="hidden">';
    $delete_html[] = t(60, 'Do you really want to delete the selected items?') . "<br /><br />";
    $delete_html[] = t(523, 'This function can NOT be undone.');
    $delete_html[] = '</div>';
    $delete_html[] = '<script language="javascript" type="text/javascript">';
    $delete_html[] = 'function navigate_delete_dialog()';
    $delete_html[] = '{';
    $delete_html[] = '$("#navigate-delete-dialog").removeClass("hidden");';
    $delete_html[] = '$("#navigate-delete-dialog").dialog({
							resizable: true,
							height: 150,
							width: 300,
							modal: true,
							title: "' . t(522, 'Remove Spam') . '",
							buttons: {
								"' . t(35, 'Delete') . '": function() {
									$(this).dialog("close");
									window.location.href = "?fid=' . $_REQUEST['fid'] . '&act=remove_spam";
								},
								"' . t(58, 'Cancel') . '": function() {
									$(this).dialog("close");
								}
							}
						});';
    $delete_html[] = '}';
    $delete_html[] = '</script>';
    $navibars->add_content(implode("\n", $delete_html));
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>', 'search_form'));
    if ($_REQUEST['quicksearch'] == 'true') {
        $navitable->setInitialURL("?fid=" . $_REQUEST['fid'] . '&act=1&_search=true&quicksearch=' . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=1');
    $navitable->sortBy('date_created', 'desc');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=2&id=');
    $navitable->enableDelete();
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(180, 'Item'), 'item', "200", "true", "left");
    $navitable->addCol(t(226, 'Date created'), 'date_created', "100", "true", "left");
    $navitable->addCol(t(1, 'User'), 'user', "100", "true", "left");
    $navitable->addCol(t(54, 'Text'), 'message', "200", "true", "left");
    $navitable->addCol(t(68, 'Status'), 'status', "80", "true", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}