Example #1
0
function run()
{
    global $DB;
    switch (@$_REQUEST['act']) {
        case 'list':
            $object_type = $_REQUEST['object'];
            $page = intval($_REQUEST['page']);
            $max = intval($_REQUEST['rows']);
            $object_id = intval($_REQUEST['object_id']);
            $ws_id = intval($_REQUEST['website']);
            $offset = ($page - 1) * $max;
            $rows = nvweb_permissions_rows($ws_id, $object_type, $object_id);
            navitable::jqgridJson($rows, $page, $offset, $max, count($rows));
            core_terminate();
            break;
        default:
    }
}
function webdictionary_list()
{
    global $events;
    global $website;
    $navibars = new navibars();
    $navitable = new navitable("webdictionary_list");
    $navibars->title(t(21, 'Dictionary'));
    if (count($website->languages) > 0) {
        foreach ($website->languages as $wslg_code => $wslg) {
            $wslg_links[] = '<a href="?fid=' . $_REQUEST['fid'] . '&act=edit_language&code=' . $wslg_code . '"><i class="fa fa-fw fa-caret-right"></i> ' . language::name_by_code($wslg_code) . '</a>';
        }
        $events->add_actions('blocks', array('item' => null, 'navibars' => &$navibars), $wslg_links, '<a class="content-actions-submenu-trigger" href="#"><img height="16" align="absmiddle" width="16" src="img/icons/silk/comment_edit.png"> ' . t(602, 'Edit language') . ' &#9662;</a>');
    }
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=edit"><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'));
    $navitable->setQuickSearchURL('?fid=' . $_REQUEST['fid'] . '&act=json&_search=true&quicksearch=');
    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('node_id');
    $navitable->setDataIndex('node_id');
    $navitable->setEditUrl('node_id', '?fid=' . $_REQUEST['fid'] . '&act=edit&id=', 'path');
    $navitable->max_rows = 500;
    $navitable->addCol("#id#", 'id', "40", "true", "left", NULL, "true");
    // ghost (unique) ID
    $navitable->addCol("ID", 'node_id', "90", "true", "left");
    // textual ID
    $navitable->addCol(t(191, 'Source'), 'source', "60", "true", "left");
    $navitable->addCol(t(46, 'Language'), 'lang', "50", "true", "left");
    $navitable->addCol(t(54, 'Text'), 'text', "400", "true", "left");
    $navitable->addCol("Path", "path", 0, "false", "left", NULL, "true");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
Example #3
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();
}
Example #4
0
function block_groups_list()
{
    global $user;
    global $DB;
    global $website;
    $navibars = new navibars();
    $navitable = new navitable('block_groups_list');
    $navibars->title(t(23, 'Blocks') . ' / ' . t(506, 'Groups'));
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/brick.png"> ' . t(23, 'Blocks') . '</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=block_group_edit"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=block_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>'));
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=block_groups_json');
    $navitable->sortBy('id');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=block_group_edit&id=');
    $navitable->setGridNotesObjectName("block_group");
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(237, 'Code'), 'code', "120", "true", "left");
    $navitable->addCol(t(67, 'Title'), 'title', "200", "true", "left");
    $navitable->addCol(t(23, 'Blocks'), 'blocks', "80", "true", "left");
    $navitable->addCol(t(168, 'Notes'), 'note', "50", "false", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
Example #5
0
function webuser_groups_list()
{
    global $user;
    global $DB;
    global $website;
    $navibars = new navibars();
    $navitable = new navitable('webuser_groups_list');
    $navibars->title(t(24, 'Web users') . ' / ' . t(506, 'Groups'));
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/user.png"> ' . t(24, 'Web users') . '</a>'));
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=webuser_group_edit"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=webuser_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>'));
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=webuser_groups_json');
    $navitable->sortBy('id');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=webuser_group_edit&id=');
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(237, 'Code'), 'code', "100", "true", "left");
    $navitable->addCol(t(159, 'Name'), 'name', "300", "true", "left");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
Example #6
0
function profiles_list()
{
    $navibars = new navibars();
    $navitable = new navitable("profiles_list");
    $navibars->title(t(243, 'Profiles'));
    $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('id');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=2&id=');
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(159, 'Name'), 'name', "400", "true", "left");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
Example #7
0
function themes_sample_content_export_form()
{
    // templates, blocks, files, properties
    global $user;
    global $DB;
    global $website;
    global $layout;
    global $theme;
    $navibars = new navibars();
    $naviforms = new naviforms();
    $navibars->title(t(367, 'Themes') . ' / ' . t(480, 'Export sample content'));
    $layout->navigate_media_browser();
    // we can use media browser in this function
    $navibars->add_actions(array('<a href="#" onclick="javascript: navigate_media_browser();" title="Ctrl+M"><img height="16" align="absmiddle" width="16" src="img/icons/silk/images.png"> ' . t(36, 'Media') . '</a>'));
    $navibars->add_actions(array('<a href="#" onclick="navigate_tabform_submit(0);"><img height="16" align="absmiddle" width="16" src="img/icons/silk/accept.png"> ' . t(34, 'Save') . '</a>'));
    $navibars->form();
    /*
    $navibars->add_tab(t(43, "Main"));
    
    $navibars->add_tab_content_row(array(
        '<label>'.t(67, 'Title').'</label>',
        $naviforms->textfield('theme-title', $website->name)
    ));
    */
    $navibars->add_tab(t(16, "Structure"));
    // select structure points to export
    $hierarchy = structure::hierarchy(0);
    $categories_list = structure::hierarchyList($hierarchy);
    $navibars->add_tab_content_row(array('<label>' . t(330, 'Categories') . '<br /></label>', '<div class="category_tree" id="category-tree-parent">
            <img src="img/icons/silk/world.png" align="absmiddle" /> ' . $website->name . '<div class="tree_ul">' . $categories_list . '</div>' . '</div>', '<label>&nbsp;</label>', '<button id="theme_export_sample_content_select_all_categories">' . t(481, 'Select all') . '</button>'));
    $navibars->add_tab_content($naviforms->hidden('categories', ''));
    $layout->add_script('        
        $("#category-tree-parent .tree_ul").jstree({
            plugins: ["changed", "types", "checkbox"],
            "types" :
            {
                "default":  {   "icon": "img/icons/silk/folder.png"    },
                "leaf":     {   "icon": "img/icons/silk/page_white.png"      }
            },
            "checkbox":
            {
                three_state: false,
                cascade: "undetermined"
            },
            "core":
            {
                dblclick_toggle: false
            }
        })
        .on("dblclick.jstree", function(e)
        {
            e.preventDefault();
            e.stopPropagation();
        
            var li = $(e.target).closest("li");
            $("#category-tree-parent .tree_ul").jstree("open_node", "#" + li[0].id);
        
            var children_nodes = new Array();
            children_nodes.push(li);
            $(li).find("li").each(function() {
                children_nodes.push("#" + $(this)[0].id);
            });
        
            $("#category-tree-parent .tree_ul").jstree("select_node", children_nodes);
        
            return false;
        })
        .on("changed.jstree", function(e, data)
        {        
            var i, j, r = [];
            var categories = new Array();
            $("#categories").val("");       
        
            for(i = 0, j = data.selected.length; i < j; i++)
            {
                var id = data.instance.get_node(data.selected[i]).data.nodeId;
                categories.push(id);
            }
            
            if(categories.length > 0)
                $("#categories").val(categories);                                                                
        });

        $("#theme_export_sample_content_select_all_categories").on("click", function(e)
        {
            e.stopPropagation();
            e.preventDefault();
            $("#category-tree-parent .tree_ul").jstree("select_all");
            return false;
        });
	');
    $navibars->add_tab(t(22, "Elements"));
    // select elements to export
    $navitable_items = new navitable("items_list");
    $navitable_items->setURL('?fid=items&act=1');
    $navitable_items->sortBy('date_modified', 'DESC');
    $navitable_items->setDataIndex('id');
    $navitable_items->max_rows = 9999999;
    $navitable_items->addCol("ID", 'id', "40", "true", "left");
    $navitable_items->addCol(t(67, 'Title'), 'title', "350", "true", "left");
    $navitable_items->addCol(t(309, 'Social'), 'comments', "80", "true", "center");
    $navitable_items->addCol(t(78, 'Category'), 'category', "150", "true", "center");
    $navitable_items->addCol(t(266, 'Author'), 'author_username', "100", "true", "left");
    $navitable_items->addCol(t(85, 'Date published'), 'dates', "100", "true", "center");
    $navitable_items->addCol(t(80, 'Permission'), 'permission', "80", "true", "center");
    $navitable_items->after_select_callback = ' $("#elements").val(navitable_items_list_selected_rows); ';
    $navitable_items->setLoadCallback('
        if(!themes_export_first_select_elements) 
        {
            $("#cb_items_list").trigger("click");
            themes_export_first_select_elements = true; 
        }
    ');
    $navibars->add_tab_content($naviforms->hidden('elements', ''));
    $navibars->add_tab_content($navitable_items->generate());
    $navibars->add_tab(t(544, "Block groups"));
    // select blocks to export
    $navitable_block_groups = new navitable("block_groups_list");
    $navitable_block_groups->setURL('?fid=blocks&act=block_groups_json');
    $navitable_block_groups->sortBy('id', 'DESC');
    $navitable_block_groups->setDataIndex('id');
    $navitable_items->max_rows = 9999999;
    $navitable_block_groups->addCol("ID", 'id', "80", "true", "left");
    $navitable_block_groups->addCol(t(237, 'Code'), 'code', "120", "true", "left");
    $navitable_block_groups->addCol(t(67, 'Title'), 'title', "200", "true", "left");
    $navitable_block_groups->addCol(t(23, 'Blocks'), 'blocks', "80", "true", "left");
    $navitable_block_groups->after_select_callback = ' $("#block_groups").val(navitable_block_groups_list_selected_rows); ';
    $navitable_block_groups->setLoadCallback('
        if(!themes_export_first_select_blockgrp) 
        {
            $("#cb_block_groups_list").trigger("click");
            themes_export_first_select_blockgrp = true; 
        }
    ');
    $navibars->add_tab_content($naviforms->hidden('block_groups', ''));
    $navibars->add_tab_content($navitable_block_groups->generate());
    $navibars->add_tab(t(23, "Blocks"));
    // select blocks to export
    $navitable_blocks = new navitable("blocks_list");
    $navitable_blocks->setURL('?fid=blocks&act=1');
    $navitable_blocks->sortBy('id', 'DESC');
    $navitable_blocks->setDataIndex('id');
    $navitable_items->max_rows = 9999999;
    $navitable_blocks->addCol("ID", 'id', "40", "true", "left");
    $navitable_blocks->addCol(t(160, 'Type'), 'type', "120", "true", "center");
    $navitable_blocks->addCol(t(67, 'Title'), 'title', "400", "true", "left");
    $navitable_blocks->addCol(t(85, 'Date published'), 'dates', "100", "true", "center");
    $navitable_blocks->addCol(t(364, 'Access'), 'access', "40", "true", "center");
    $navitable_blocks->addCol(t(65, 'Enabled'), 'enabled', "40", "true", "center");
    $navitable_blocks->after_select_callback = ' $("#blocks").val(navitable_blocks_list_selected_rows); ';
    $navitable_blocks->setLoadCallback('
        if(!themes_export_first_select_blocks) 
        {
            $("#cb_blocks_list").trigger("click"); 
            themes_export_first_select_blocks = true; 
        }
    ');
    $navibars->add_tab_content($naviforms->hidden('blocks', ''));
    $navibars->add_tab_content($navitable_blocks->generate());
    $navibars->add_tab(t(250, "Comments"));
    // select comments to export
    $navitable_comments = new navitable("comments_list");
    $navitable_comments->setURL('?fid=comments&act=1');
    $navitable_comments->sortBy('date_created', 'desc');
    $navitable_comments->setDataIndex('id');
    $navitable_items->max_rows = 9999999;
    $navitable_comments->addCol("ID", 'id', "80", "true", "left");
    $navitable_comments->addCol(t(180, 'Item'), 'item', "200", "true", "left");
    $navitable_comments->addCol(t(226, 'Date created'), 'date_created', "100", "true", "left");
    $navitable_comments->addCol(t(1, 'User'), 'user', "100", "true", "left");
    $navitable_comments->addCol(t(54, 'Text'), 'message', "200", "true", "left");
    $navitable_comments->addCol(t(68, 'Status'), 'status', "80", "true", "center");
    $navitable_comments->after_select_callback = ' $("#comments").val(navitable_comments_list_selected_rows); ';
    $navitable_comments->setLoadCallback('
        if(!themes_export_first_select_comments) 
        {
            $("#cb_comments_list").trigger("click"); 
            themes_export_first_select_comments = true; 
        }
    ');
    $navibars->add_tab_content($naviforms->hidden('comments', ''));
    $navibars->add_tab_content($navitable_comments->generate());
    $navibars->add_tab(t(89, "Files"));
    $navibars->add_tab_content_row(array('<label>' . t(141, 'Folder') . '</label>', $naviforms->dropbox('folder', 0, 'folder')));
    $navibars->add_tab_content_row('<div class="subcomment"><span class="ui-icon ui-icon-info" style="float: left;"></span> ' . t(482, 'All sample files should be placed in a folder. Navigate CMS will also add files used in contents.') . '</div>');
    // auto-select everything on load
    $layout->add_script('
        themes_export_first_select_elements = false;
        themes_export_first_select_blockgrp = false;
        themes_export_first_select_blocks   = false;
        themes_export_first_select_comments = false;

        $("#theme_export_sample_content_select_all_categories").trigger("click");               
    ');
    return $navibars->generate();
}
Example #8
0
function websites_list()
{
    global $user;
    $navibars = new navibars();
    $navitable = new navitable("websites_list");
    $navibars->title(t(241, 'Websites'));
    $navibars->add_actions(array($user->permission('websites.edit') == 'true' ? '<a href="?fid=' . $_REQUEST['fid'] . '&act=edit"><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('id');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=2&id=');
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(328, 'Favicon'), 'favicon', "32", "true", "center");
    $navitable->addCol(t(159, 'Name'), 'name', "200", "true", "left");
    $navitable->addCol(t(187, 'Homepage'), 'homepage', "300", "true", "center");
    $navitable->addCol(t(68, 'Status'), 'permission', "100", "true", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
Example #9
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();
}
Example #10
0
function functions_list()
{
    $navibars = new navibars();
    $navitable = new navitable("functions_list");
    $navibars->title(t(240, 'Functions'));
    $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('id');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=2&id=');
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(78, 'Category'), 'category', "100", "true", "left");
    $navitable->addCol(t(237, 'Code'), 'codename', "100", "true", "left");
    $navitable->addCol(t(242, 'Icon'), 'icon', "50", "true", "center");
    $navitable->addCol(t(67, 'Title'), 'lid', "200", "true", "left");
    $navitable->addCol(t(65, 'Enabled'), 'enabled', "80", "true", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
function nvweb_permissions_rows($website_id, $object_type, $object_id)
{
    global $DB;
    $naviforms = new naviforms();
    $object = new stdClass();
    if ($object_type == 'user') {
        $object = new user();
        $object->load($object_id);
    } else {
        if ($object_type == 'profile') {
            $object = new profile();
            $object->load($object_id);
        }
    }
    $permissions_definitions = permission::get_definitions();
    $permissions_values = permission::get_values($object_type, $object, $permissions_definitions, $website_id);
    $permissions_definitions = array_merge($permissions_definitions['system'], $permissions_definitions['functions'], $permissions_definitions['settings'], $permissions_definitions['extensions']);
    $out = array();
    $iRow = 0;
    for ($i = 0; $i < count($permissions_definitions); $i++) {
        $control = '';
        $type = '';
        $scope = t(470, 'System');
        $field_name = "wid" . $website_id . "." . $permissions_definitions[$i]['name'];
        if ($permissions_definitions[$i]['scope'] == 'functions') {
            $scope = t(240, 'Functions');
        } else {
            if ($permissions_definitions[$i]['scope'] == 'settings') {
                $scope = t(459, 'Settings');
            } else {
                if ($permissions_definitions[$i]['scope'] == 'extensions') {
                    $scope = t(327, 'Extensions');
                }
            }
        }
        switch ($permissions_definitions[$i]['type']) {
            case 'boolean':
                $type = t(206, 'Boolean');
                $control = $naviforms->buttonset($field_name, array('true' => '<span class="ui-icon ui-icon-circle-check"></span>', 'false' => '<span class="ui-icon ui-icon-circle-close"></span>'), $permissions_values[$permissions_definitions[$i]['name']], "navigate_permission_change_boolean(this);");
                break;
            case 'integer':
                $type = t(468, 'Integer');
                $control = $naviforms->textfield($field_name, $permissions_values[$permissions_definitions[$i]['name']], '99%', 'navigate_permission_change_text(this);');
                break;
            case 'option':
            case 'moption':
                $options = $permissions_definitions[$i]['options'];
                switch ($options) {
                    case "websites":
                        $options = array();
                        $DB->query("SELECT id, name FROM nv_websites");
                        $websites = $DB->result();
                        foreach ($websites as $ws) {
                            $options[$ws->id] = $ws->name;
                        }
                        break;
                    case "extensions":
                        $options = array();
                        $extensions = extension::list_installed(null, true);
                        foreach ($extensions as $ext) {
                            $options[$ext['code']] = $ext['title'];
                        }
                        break;
                    case "structure":
                        $options = array();
                        $categories = $permissions_values[$permissions_definitions[$i]['name']];
                        if (!is_array($categories)) {
                            $categories = array();
                        }
                        $categories = array_filter($categories);
                        $control = '<button data-permission-name="' . $permissions_definitions[$i]['name'] . '" 
                                                    data-action="structure" data-value="' . json_encode($categories) . '" 
                                                    title="' . count($categories) . '"><i class="fa fa-sitemap fa-fw"></i> ' . t(611, "Choose") . '</button>';
                        break;
                    default:
                }
                $type = t(200, 'Options');
                if (empty($control)) {
                    $control = $naviforms->selectfield($field_name, array_keys($options), array_values($options), $permissions_values[$permissions_definitions[$i]['name']], 'navigate_permission_change_option(this);', $permissions_definitions[$i]['type'] == 'moption');
                }
                break;
            case 'color':
                $type = t(441, 'Color');
                $control = $naviforms->colorfield($field_name, $permissions_values[$permissions_definitions[$i]['name']], array(), 'navigate_permission_change_text');
                break;
            case 'string':
            default:
                $type = t(469, 'String');
                $control = $naviforms->textfield($field_name, $permissions_values[$permissions_definitions[$i]['name']], '99%', 'navigate_permission_change_text(this);');
                break;
        }
        // search filters
        if (!empty($_REQUEST['filters'])) {
            $include = navitable::jqgridCheck(array('name' => $permissions_definitions[$i]['name'], 'scope' => $scope, 'type' => $type, 'value' => $permissions_values[$permissions_definitions[$i]['name']]), $_REQUEST['filters']);
            if (!$include) {
                continue;
            }
        }
        $out[$iRow] = array(0 => $permissions_definitions[$i]['name'], 1 => '<div data-description="' . $permissions_definitions[$i]['description'] . '">' . '<span class="ui-icon ui-icon-float ui-icon-info"></span>&nbsp;' . '<span>' . $permissions_definitions[$i]['name'] . '</span></div>', 2 => $scope, 3 => $type, 4 => $control);
        $iRow++;
    }
    return $out;
}
Example #12
0
function backups_list()
{
    $navibars = new navibars();
    $navitable = new navitable("backups_list");
    $navibars->title(t(329, 'Backups'));
    $navibars->add_actions(array('<a href="#" onclick="navigate_restore_dialog();"><img height="16" align="absmiddle" width="16" src="img/icons/silk/database_refresh.png"> ' . t(412, 'Restore') . '</a> '));
    $navibars->add_actions(array('<a href="?fid=backups&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=backups&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=backups&act=1&_search=true&quicksearch=" . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=backups&act=1');
    $navitable->sortBy('id');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=backups&act=2&id=');
    $navitable->addCol("ID", 'id', "80", "true", "left");
    $navitable->addCol(t(196, 'Date and time'), 'date_created', "150", "true", "center");
    $navitable->addCol(t(67, 'Title'), 'title', "400", "true", "left");
    $navitable->addCol(t(409, 'Size'), 'size', "80", "true", "center");
    $navitable->addCol(t(68, 'Status'), 'status', "150", "true", "left");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
Example #13
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();
}
Example #14
0
function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    global $theme;
    $out = '';
    $item = new structure();
    switch ($_REQUEST['act']) {
        case 'load':
        case 'edit':
        case 2:
            // edit/new form
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    property::save_properties_from_post('structure', $item->id);
                    $item = $item->reload();
                    // reorder associated category elements
                    if (!empty($_POST['elements-order'])) {
                        $response = item::reorder($_POST['elements-order']);
                        if ($response !== true) {
                            throw new Exception($response);
                        }
                    }
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'save', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
                }
            } else {
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'load', $item->dictionary[$website->languages_list[0]]['title']);
                }
            }
            $out = structure_form($item);
            break;
        case 3:
        case "reorder":
            $ok = structure::reorder($_REQUEST['parent'], $_REQUEST['children_order']);
            echo json_encode($ok);
            core_terminate();
            break;
        case "homepager":
            $node = $_REQUEST['node'];
            $website->homepage = $node;
            $ok = $website->save();
            echo json_encode($ok);
            core_terminate();
            break;
        case 4:
        case "remove":
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $structure = structure::hierarchy(-1);
                    // root level (0) including Web node (-1)
                    $out = structure_tree($structure);
                    users_log::action($_REQUEST['fid'], $item->id, 'remove');
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
                    $out = structure_form($item);
                }
            }
            break;
        case 95:
            // free path checking
            $path = $_REQUEST['path'];
            $id = $_REQUEST['id'];
            $DB->query('SELECT type, object_id, lang
	 					  FROM nv_paths
						 WHERE path = ' . protect($path) . '
						   AND website = ' . $website->id);
            $rs = $DB->result();
            echo json_encode($rs);
            core_terminate();
            break;
        case "category_path":
            // return category paths
            echo json_encode(path::loadElementPaths('structure', intval($_REQUEST['id'])));
            core_terminate();
            break;
        case 'json_find_item':
            // find items by its title
            // the items must have its own path (free OR not embedded to a category)
            $DB->query('
				SELECT SQL_CALC_FOUND_ROWS nvw.node_id as id, nvw.text as text
				  FROM nv_webdictionary nvw, nv_items nvi
				 WHERE nvw.node_type = "item"
				   AND nvw.node_id = nvi.id
				   AND nvw.subtype = "title"
				   AND (	nvi.association = "free" OR
				            (nvi.association = "category" AND nvi.embedding=0)
				   )
				   AND nvw.lang = ' . protect($_REQUEST['lang']) . '
				   AND nvw.website = ' . $website->id . '
				   AND nvw.website = nvi.website
				   AND nvw.text LIKE ' . protect('%' . $_REQUEST['title'] . '%') . '
		      ORDER BY nvw.text ASC
			     LIMIT ' . intval($_REQUEST['page_limit']) . '
			     OFFSET ' . max(0, intval($_REQUEST['page_limit']) * (intval($_REQUEST['page']) - 1)), 'array');
            $rows = $DB->result();
            $total = $DB->foundRows();
            echo json_encode(array('items' => $rows, 'totalCount' => $total));
            core_terminate();
            break;
        case "search_by_title":
            // json search title request (for "copy from" properties dialog)
            $DB->query('
				SELECT node_id as id, text as label, text as value
					  FROM nv_webdictionary
					 WHERE node_type = "structure"
					   AND subtype = "title"
					   AND lang = ' . protect($_REQUEST['lang']) . '
					   AND website = ' . $website->id . '
					   AND text LIKE ' . protect('%' . $_REQUEST['title'] . '%') . '
			      ORDER BY text ASC
				     LIMIT 30', 'array');
            echo json_encode($DB->result());
            core_terminate();
            break;
        case "copy_from_template_zones":
            // return template properties for a structure id
            $item = new structure();
            $item->load(intval($_REQUEST['id']));
            $template = new template();
            $template->load($item->template);
            $zones = array();
            for ($ps = 0; $ps < count($template->properties); $ps++) {
                // ignore non structure properties
                if (!isset($template->properties[$ps]->element) || $template->properties[$ps]->element != 'structure') {
                    continue;
                }
                // ignore non-textual properties
                if (!in_array($template->properties[$ps]->type, array("text", "textarea", "rich_textarea"))) {
                    continue;
                }
                $title = $template->properties[$ps]->name;
                if (!empty($theme)) {
                    $title = $theme->t($title);
                }
                $zones[] = array('type' => 'property', 'code' => $template->properties[$ps]->id, 'title' => $title);
            }
            echo json_encode($zones);
            core_terminate();
            break;
        case "raw_zone_content":
            // return raw item contents
            if ($_REQUEST['zone'] == 'property') {
                $DB->query('SELECT text
							  FROM nv_webdictionary
							 WHERE node_type = "property-structure"
							   AND subtype = ' . protect('property-' . $_REQUEST['section'] . '-' . $_REQUEST['lang']) . '
							   AND lang = ' . protect($_REQUEST['lang']) . '
							   AND website = ' . $website->id . '
							   AND node_id = ' . protect($_REQUEST['node_id']), 'array');
                $data = $DB->first();
                echo $data['text'];
            }
            core_terminate();
            break;
        case 'votes_reset':
            webuser_vote::remove_object_votes('structure', intval($_REQUEST['id']));
            echo 'true';
            core_terminate();
            break;
        case 'votes_by_webuser':
            if ($_POST['oper'] == 'del') {
                $ids = explode(',', $_POST['id']);
                for ($i = 0; $i < count($ids); $i++) {
                    if ($ids[$i] > 0) {
                        $vote = new webuser_vote();
                        $vote->load($ids[$i]);
                        $vote->delete();
                    }
                }
                webuser_vote::update_object_score('structure', $vote->object_id);
                echo 'true';
                core_terminate();
            }
            $max = intval($_GET['rows']);
            $page = intval($_GET['page']);
            $offset = ($page - 1) * $max;
            if ($_REQUEST['_search'] == 'false') {
                list($dataset, $total) = webuser_vote::object_votes_by_webuser('structure', intval($_REQUEST['id']), $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'], $offset, $max);
            }
            $out = array();
            for ($i = 0; $i < count($dataset); $i++) {
                if (empty($dataset[$i])) {
                    continue;
                }
                $out[$i] = array(0 => $dataset[$i]['id'], 1 => core_ts2date($dataset[$i]['date'], true), 2 => $dataset[$i]['username']);
            }
            navitable::jqgridJson($out, $page, $offset, $max, $total);
            core_terminate();
            break;
        case 0:
            // tree / search result
        // tree / search result
        default:
            $structure = structure::hierarchy(-1);
            // root level (0) including Web node (-1)
            $out = structure_tree($structure);
            break;
    }
    return $out;
}
Example #15
0
function templates_list()
{
    $navibars = new navibars();
    $navitable = new navitable("templates_list");
    $navibars->title(t(20, 'Templates'));
    $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('id');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=load&id=');
    $navitable->disableSelect();
    $navitable->addCol("ID", 'id', "60", "true", "left");
    $navitable->addCol(t(67, 'Title'), 'title', "260", "true", "left");
    $navitable->addCol(t(368, 'Theme'), 'theme', "180", "false", "left");
    $navitable->addCol(t(68, 'Status'), 'permission', "80", "true", "center");
    $navitable->addCol(t(65, 'Enabled'), 'enabled', "60", "true", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
 public static function jqgridCheck($row, $filters)
 {
     $filters = json_decode($filters);
     if ($filters->groupOp == 'OR') {
         $result = false;
     } else {
         $result = true;
     }
     foreach ($filters->rules as $rule) {
         if ($filters->groupOp == 'OR') {
             $result = $result || navitable::jqgridcompare($row[$rule->field], $rule->op, $rule->data, true);
         } else {
             $result = $result && navitable::jqgridcompare($row[$rule->field], $rule->op, $rule->data, true);
         }
     }
     return $result;
 }