public static function renderAllGroups() { if (!mainwp_current_user_can("dashboard", "manage_groups")) { mainwp_do_not_have_permissions("manage groups"); return; } ?> <div class="wrap"> <?php do_action("mainwp-pageheader-sites", "ManageGroups"); ?> <div class="mainwp_managegroups-outsidebox"> <span id="mainwp_managegroups-addnew-container"><input type="button" name="Add new" value="<?php _e('Add New', 'mainwp'); ?> " class="managegroups-addnew button" /></span> <h3><?php _e('Groups', 'mainwp'); ?> </h3> <div class="mainwp_managegroups-insidebox"> <input id="managegroups-filter" style="margin-top: .5em;" type="text" value="" placeholder="Type here to filter groups" /> <hr> <ul id="managegroups-list"> <li class="managegroups-listitem managegroups-group-add hidden"> <span class="mainwp_group-actions actions-input"><a href="#" class="managegroups-savenew"><?php _e('Save', 'mainwp'); ?> </a> | <a href="#" class="managegroups-cancel"><?php _e('Cancel', 'mainwp'); ?> </a></span> <input type="text" name="name" value="" /> </li> <?php echo MainWPManageGroups::getGroupListContent(); ?> </ul> </div> </div> <div class="mainwp_managegroups-outsidebox"> <div style="float: right; margin-top: 12px;"><?php _e('Display by:', 'mainwp'); ?> <a href="#" class="mainwp_action left mainwp_action_down" id="group_sites_by_name"><strong><?php _e('Site Name', 'mainwp'); ?> </strong></a><a href="#" class="mainwp_action right" id="group_sites_by_url"><?php _e('URL', 'mainwp'); ?> </a></div> <h3><?php _e('Websites', 'mainwp'); ?> </h3> <div class="mainwp_managegroups-insidebox" id="managegroups-sites-list"> <input id="managegroups_site-filter" style="margin-top: .5em;" type="text" value="" placeholder="Type here to filter sites" /> <div style="float:right; margin-top: .7em"><?php _e('Select: ', 'mainwp'); ?> <a href="#" onClick="return mainwp_managegroups_ss_select(this, true)"><?php _e('All', 'mainwp'); ?> </a> | <a href="#" onClick="return mainwp_managegroups_ss_select(this, false)"><?php _e('None', 'mainwp'); ?> </a></div> <hr> <ul id="managegroups-listsites"> <?php echo MainWPManageGroups::getWebsiteListContent(); ?> </ul> </div> </div> <div style="clear: both;"></div> <br /> <input type="button" name="Save selection" value="<?php _e('Save Selection', 'mainwp'); ?> " class="managegroups-saveAll button-primary" /> <span id="managegroups-saved"><?php _e('Saved', 'mainwp'); ?> </span> </div> <?php do_action("mainwp-pagefooter-sites", "ManageGroups"); ?> <script type="text/javascript"> jQuery(document).ready(function () { jQuery('#group_sites_by_name').live('click', function(event) { jQuery(this).addClass('mainwp_action_down'); jQuery('#group_sites_by_url').removeClass('mainwp_action_down'); jQuery('#managegroups-sites-list').find('.website_url').hide(); jQuery('#managegroups-sites-list').find('.website_name').show(); return false; }); jQuery('#group_sites_by_url').live('click', function(event) { jQuery(this).addClass('mainwp_action_down'); jQuery('#group_sites_by_name').removeClass('mainwp_action_down'); jQuery('#managegroups-sites-list').find('.website_name').hide(); jQuery('#managegroups-sites-list').find('.website_url').show(); return false; }); jQuery('.managegroups-listitem').live({ mouseenter: function() { if (jQuery(this).find('.text').is(":visible")) jQuery(this).find('.actions-text').show(); else jQuery(this).find('.actions-input').show(); }, mouseleave: function() { jQuery(this).find('.actions-text').hide(); jQuery(this).find('.actions-input').hide(); } }); jQuery('.managegroups-rename').live('click', function() { var parentObj = jQuery(this).parents('.managegroups-listitem'); parentObj.find('.text').hide(); parentObj.find('.actions-text').hide(); parentObj.find('.input').show(); parentObj.find('.actions-input').show(); return false; }); jQuery('.managegroups-save').live('click', function() { var parentObj = jQuery(this).parents('.managegroups-listitem'); var groupId = parentObj.attr('id'); var newName = parentObj.find('.input input').val(); var data = mainwp_secure_data({ action:'mainwp_group_rename', groupId:groupId, newName: newName }); jQuery.post(ajaxurl, data, function(pParentObj) { return function (response) { if (response.error) return; response = jQuery.trim(response.result); pParentObj.find('.input input').val(response); pParentObj.find('.text').html(response); pParentObj.find('.input').hide(); pParentObj.find('.actions-input').hide(); pParentObj.find('.text').show(); pParentObj.find('.actions-text').show(); } }(parentObj), 'json'); return false; }); jQuery('.managegroups-delete').live('click', function() { var confirmed = confirm('This will permanently delete this group. Proceed?'); if (confirmed) { var parentObj = jQuery(this).parents('.managegroups-listitem'); parentObj.css('background-color', '#F8E0E0'); var groupId = parentObj.attr('id'); var data = { action:'mainwp_group_delete', groupId:groupId }; jQuery.post(ajaxurl, data, function(pParentObj) { return function (response) { response = jQuery.trim(response); if (response == 'OK') pParentObj.animate({opacity: 0}, 300, function() {pParentObj.remove()}); } }(parentObj)); } return false; }); jQuery('.managegroups-addnew').live('click', function() { var addNewContainer = jQuery('.managegroups-group-add'); addNewContainer.find('input').val(''); addNewContainer.show(); }); jQuery('.managegroups-cancel').live('click', function() { var addNewContainer = jQuery('.managegroups-group-add'); addNewContainer.hide(); addNewContainer.find('input').val(''); }); jQuery('.managegroups-savenew').live('click', function() { var parentObj = jQuery(this).parents('.managegroups-listitem'); var newName = parentObj.find('input').val(); var data = mainwp_secure_data({ action:'mainwp_group_add', newName: newName }); jQuery.post(ajaxurl, data, function (response) { try { resp = jQuery.parseJSON(response); if (resp.error != undefined) return; } catch (err) { } response = jQuery.trim(response); var addNewContainer = jQuery('.managegroups-group-add'); addNewContainer.hide(); addNewContainer.find('input').val(''); addNewContainer.after(response); }); return false; }); jQuery('.managegroups-radio').live('click', function() { var parentObj = jQuery(this).parents('.managegroups-listitem'); var groupId = parentObj.attr('id'); var data = { action:'mainwp_group_getsites', groupId: groupId } jQuery.post(ajaxurl, data, function (response) { response = jQuery.trim(response); if (response == 'ERROR') return; jQuery('input[name="sites"]').attr('checked', false); var websiteIds = jQuery.parseJSON(response); for (var i = 0; i < websiteIds.length; i++) { jQuery('input[name="sites"][value="'+websiteIds[i]+'"]').attr('checked', true); } }); }); jQuery('.managegroups-saveAll').live('click', function() { var checkedGroup = jQuery('input[name="groups"]:checked'); var groupId = checkedGroup.val(); if (groupId == undefined) return; var allCheckedWebsites = jQuery('input[name="sites"]:checked'); var allCheckedIds = []; for (var i = 0; i < allCheckedWebsites.length; i++) { allCheckedIds.push(jQuery(allCheckedWebsites[i]).val()); } var data = mainwp_secure_data({ action:'mainwp_group_updategroup', groupId: groupId, websiteIds: allCheckedIds }); jQuery.post(ajaxurl, data, function (response) { jQuery('#managegroups-saved').stop(true, true); jQuery('#managegroups-saved').show(); jQuery('#managegroups-saved').fadeOut(2000); return; }, 'json'); }); }); </script> <?php }
function mainwp_group_updategroup() { $this->secure_request('mainwp_group_updategroup'); MainWPManageGroups::updateGroup(); }
function new_menus() { if (MainWPUtility::isAdmin()) { //Adding the page to manage your added sites/groups //The first page which will display the post area etc.. MainWPSecurityIssues::initMenu(); MainWPManageSites::initMenu(); MainWPPost::initMenu(); MainWPPage::initMenu(); MainWPThemes::initMenu(); MainWPPlugins::initMenu(); MainWPUser::initMenu(); MainWPManageBackups::initMenu(); MainWPOfflineChecks::initMenu(); MainWPBulkUpdateAdminPasswords::initMenu(); MainWPManageGroups::initMenu(); MainWPSettings::initMenu(); MainWPExtensions::initMenu(); do_action('mainwp_admin_menu'); MainWPDocumentation::initMenu(); MainWPServerInformation::initMenu(); MainWPChildScan::initMenu(); MainWPAPISettings::initMenu(); } }