public string GetItemPageUrl(int itemId, int spaceId)
        {
            string res = "";

            switch (ItemTypeName)
            {
            case type_WebSite:
                res = PortalUtils.NavigatePageURL(PID_SPACE_WEBSITES, "ItemID", itemId.ToString(),
                                                  PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "edit_item",
                                                  "moduleDefId=websites");
                break;

            case type_Domain:
                res = PortalUtils.NavigatePageURL(PID_SPACE_DIMAINS, "DomainID", itemId.ToString(),
                                                  PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "edit_item",
                                                  "moduleDefId=domains");
                break;

            case type_Organization:
                res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                  PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "organization_home",
                                                  "moduleDefId=ExchangeServer");
                break;
            }

            return(res);
        }
Beispiel #2
0
        protected string GetNavigateBandwidthDetails(int packageId)
        {
            DateTime startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime endDate   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));

            return
                (PortalUtils.NavigatePageURL("BandwidthReport", PortalUtils.SPACE_ID_PARAM, packageId.ToString(),
                                             "StartDate=" + startDate.Ticks.ToString(),
                                             "EndDate=" + endDate.Ticks.ToString(), "ctl=edit", "moduleDefId=BandwidthReport"));
        }
Beispiel #3
0
        private void ShortcutRedirect()
        {
            if (PanelSecurity.EffectiveUser.Role == UserRole.Administrator)
            {
                return; // not for administrators
            }
            string shortcut = Request["shortcut"];

            if ("vps".Equals(shortcut, StringComparison.InvariantCultureIgnoreCase))
            {
                // load hosting spaces
                PackageInfo[] packages = ES.Services.Packages.GetMyPackages(PanelSecurity.EffectiveUserId);
                if (packages.Length == 0)
                {
                    return; // no spaces - exit
                }
                // check if some package has VPS resource enabled
                foreach (PackageInfo package in packages)
                {
                    int            packageId = package.PackageId;
                    PackageContext cntx      = PackagesHelper.GetCachedPackageContext(packageId);
                    if (cntx.Groups.ContainsKey(ResourceGroups.VPS))
                    {
                        // VPS resource found
                        // check created VPS
                        VirtualMachineMetaItemsPaged vms = ES.Services.VPS.GetVirtualMachines(packageId, "", "", "", 0, Int32.MaxValue, false);
                        if (vms.Items.Length == 1)
                        {
                            // one VPS - redirect to its properties screen
                            Response.Redirect(PortalUtils.NavigatePageURL("SpaceVPS", "SpaceID", packageId.ToString(),
                                                                          "ItemID=" + vms.Items[0].ItemID.ToString(), "ctl=vps_general", "moduleDefId=VPS"));
                        }
                        else
                        {
                            // several VPS - redirect to VPS list page
                            Response.Redirect(PortalUtils.NavigatePageURL("SpaceVPS", "SpaceID", packageId.ToString(),
                                                                          "ctl=", "moduleDefId=VPS"));
                        }
                    }
                }

                // no VPS resources found
                // redirect to space home
                if (packages.Length == 1)
                {
                    Response.Redirect(PortalUtils.GetSpaceHomePageUrl(packages[0].PackageId));
                }
            }
        }
Beispiel #4
0
        public string GetItemPageUrl(string fullType, string itemType, int itemId, int spaceId, int accountId)
        {
            string res = "";

            if (fullType.Equals("Users"))
            {
                res = PortalUtils.GetUserHomePageUrl(itemId);
            }
            else
            {
                switch (itemType)
                {
                case TYPE_WEBSITE:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_WEBSITES, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "edit_item",
                                                      "moduleDefId=websites");
                    break;

                case TYPE_DOMAIN:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_DIMAINS, "DomainID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "edit_item",
                                                      "moduleDefId=domains");
                    break;

                case TYPE_ORGANIZATION:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "organization_home",
                                                      "moduleDefId=ExchangeServer");
                    break;

                case TYPE_EXCHANGEACCOUNT:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=edit_user",//"mid="+this.ModuleID.ToString(),
                                                      "AccountID=" + accountId, "Context=User",
                                                      "moduleDefId=ExchangeServer");
                    break;

                default:
                    res = PortalUtils.GetSpaceHomePageUrl(itemId);
                    break;
                }
            }

            return(res);
        }
        protected override MenuItem CreateMenuItem(string text, string key, string img)
        {
            string PID_SPACE_EXCHANGE_SERVER = "SpaceExchangeServer";

            MenuItem item = new MenuItem();

            item.Text        = GetLocalizedString("Text." + text);
            item.NavigateUrl = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGE_SERVER, "ItemID", ItemID.ToString(),
                                                           PortalUtils.SPACE_ID_PARAM + "=" + PackageId, DefaultPage.CONTROL_ID_PARAM + "=" + key,
                                                           "moduleDefId=exchangeserver");

            if (img == null)
            {
                item.ImageUrl = PortalUtils.GetThemedIcon("Icons/tool_48.png");
            }
            else
            {
                item.ImageUrl = PortalUtils.GetThemedIcon(img);
            }

            return(item);
        }
Beispiel #6
0
 protected void cmdSearch_Click(object sender, ImageClickEventArgs e)
 {
     if (tbObjectId.Text.Length > 0)
     {
         Response.Redirect(PortalUtils.GetUserHomePageUrl(Int32.Parse(tbObjectId.Text)));
     }
     else
     {
         String strText = tbSearchText.Text;
         if (strText.Length > 0)
         {
             Response.Redirect(NavigatePageURL(PortalUtils.GetUserCustomersPageId(),
                                               PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(),
                                               "FilterColumn=" + ddlFilterColumn.SelectedValue,
                                               "FilterValue=" + Server.UrlEncode(FilterValue)));
         }
         else
         {
             Response.Redirect(PortalUtils.NavigatePageURL(PortalUtils.GetObjectSearchPageId(),
                                                           PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(),
                                                           "Query=" + Server.UrlEncode(tbSearch.Text), "FullType=Users"));
         }
     }
 }
Beispiel #7
0
 protected string GetNavigateDiskspaceDetails(int packageId)
 {
     return(PortalUtils.NavigatePageURL("DiskspaceReport", PortalUtils.SPACE_ID_PARAM, packageId.ToString(),
                                        "ctl=edit", "moduleDefId=DiskspaceReport"));
 }
        private MenuItem CreateMenuItem(PackageContext cntx, XmlNode xmlNode)
        {
            string pageId = GetXmlAttribute(xmlNode, "pageID");

            if (!PortalUtils.PageExists(pageId))
            {
                return(null);
            }

            string url           = GetXmlAttribute(xmlNode, "url");
            string title         = GetXmlAttribute(xmlNode, "title");
            string imageUrl      = GetXmlAttribute(xmlNode, "imageUrl");
            string target        = GetXmlAttribute(xmlNode, "target");
            string resourceGroup = GetXmlAttribute(xmlNode, "resourceGroup");
            string quota         = GetXmlAttribute(xmlNode, "quota");
            bool   disabled      = Utils.ParseBool(GetXmlAttribute(xmlNode, "disabled"), false);

            // get custom page parameters
            XmlNodeList   xmlParameters = xmlNode.SelectNodes("Parameters/Add");
            List <string> parameters    = new List <string>();

            foreach (XmlNode xmlParameter in xmlParameters)
            {
                parameters.Add(xmlParameter.Attributes["name"].Value
                               + "=" + xmlParameter.Attributes["value"].Value);
            }

            // add menu item
            string pageUrl = !String.IsNullOrEmpty(url) ? url : PortalUtils.NavigatePageURL(
                pageId, PortalUtils.SPACE_ID_PARAM, cntx.Package.PackageId.ToString(), parameters.ToArray());
            string   pageName = !String.IsNullOrEmpty(title) ? title : PortalUtils.GetLocalizedPageName(pageId);
            MenuItem item     = new MenuItem(pageName, "", "", disabled ? null : pageUrl);

            item.ImageUrl = PortalUtils.GetThemedIcon(imageUrl);

            if (!String.IsNullOrEmpty(target))
            {
                item.Target = target;
            }
            item.Selectable = !disabled;

            // check groups/quotas
            bool display = true;

            if (cntx != null)
            {
                display = (String.IsNullOrEmpty(resourceGroup) ||
                           cntx.Groups.ContainsKey(resourceGroup)) &&
                          (String.IsNullOrEmpty(quota) ||
                           (cntx.Quotas.ContainsKey(quota) &&
                            cntx.Quotas[quota].QuotaAllocatedValue != 0));
            }

            // process nested menu items
            XmlNodeList xmlMenuNodes = xmlNode.SelectNodes("MenuItems/MenuItem");

            foreach (XmlNode xmlMenuNode in xmlMenuNodes)
            {
                MenuItem menuItem = CreateMenuItem(cntx, xmlMenuNode);
                if (menuItem != null)
                {
                    item.ChildItems.Add(menuItem);
                }
            }

            if (display && !(disabled && item.ChildItems.Count == 0))
            {
                return(item);
            }

            return(null);
        }
Beispiel #9
0
 public string NavigatePageURL(string pageId, string keyName, string keyValue, params string[] additionalParams)
 {
     return(PortalUtils.NavigatePageURL(pageId, keyName, keyValue, additionalParams));
 }
Beispiel #10
0
        private void BindMenu(MenuItemCollection items, XmlNodeList nodes)
        {
            foreach (XmlNode node in nodes)
            {
                string pageId = null;
                if (node.Attributes["pageID"] != null)
                {
                    pageId = node.Attributes["pageID"].Value;
                }

                if (!PortalUtils.PageExists(pageId))
                {
                    continue;
                }

                string url = null;
                if (node.Attributes["url"] != null)
                {
                    url = node.Attributes["url"].Value;
                }

                string title = null;
                if (node.Attributes["title"] != null)
                {
                    title = node.Attributes["title"].Value;
                }

                string target = null;
                if (node.Attributes["target"] != null)
                {
                    target = node.Attributes["target"].Value;
                }

                string resourceGroup = null;
                if (node.Attributes["resourceGroup"] != null)
                {
                    resourceGroup = node.Attributes["resourceGroup"].Value;
                }

                string quota = null;
                if (node.Attributes["quota"] != null)
                {
                    quota = node.Attributes["quota"].Value;
                }

                bool disabled = false;
                if (node.Attributes["disabled"] != null)
                {
                    disabled = Utils.ParseBool(node.Attributes["disabled"].Value, false);
                }

                // get custom page parameters
                XmlNodeList   xmlParameters = node.SelectNodes("Parameters/Add");
                List <string> parameters    = new List <string>();
                foreach (XmlNode xmlParameter in xmlParameters)
                {
                    parameters.Add(xmlParameter.Attributes["name"].Value
                                   + "=" + xmlParameter.Attributes["value"].Value);
                }

                // add menu item
                string pageUrl = !String.IsNullOrEmpty(url) ? url : PortalUtils.NavigatePageURL(
                    pageId, PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), parameters.ToArray());
                string   pageName = !String.IsNullOrEmpty(title) ? title : PortalUtils.GetLocalizedPageName(pageId);
                MenuItem item     = new MenuItem(pageName, "", "", disabled ? null : pageUrl);

                if (!String.IsNullOrEmpty(target))
                {
                    item.Target = target;
                }
                item.Selectable = !disabled;

                // check groups/quotas
                bool display = true;
                if (cntx != null)
                {
                    display = (String.IsNullOrEmpty(resourceGroup) ||
                               cntx.Groups.ContainsKey(resourceGroup)) &&
                              (String.IsNullOrEmpty(quota) ||
                               (cntx.Quotas.ContainsKey(quota) &&
                                cntx.Quotas[quota].QuotaAllocatedValue != 0));
                }

                if (display)
                {
                    // process nested menu items
                    XmlNodeList xmlNestedNodes = node.SelectNodes("MenuItems/MenuItem");
                    BindMenu(item.ChildItems, xmlNestedNodes);
                }

                if (display && !(disabled && item.ChildItems.Count == 0))
                {
                    items.Add(item);
                }
            }
        }
        public string GetItemPageUrl(string fullType, string itemType, int itemId, int spaceId, int accountId, string textSearch = "")
        {
            string res = "";

            if (fullType.Equals("AccountHome"))
            {
                res = PortalUtils.GetUserHomePageUrl(itemId);
            }
            else
            {
                switch (itemType)
                {
                case TYPE_WEBSITE:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_WEBSITES, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "edit_item",
                                                      "moduleDefId=websites");
                    break;

                case TYPE_DOMAIN:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_DIMAINS, "DomainID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "edit_item",
                                                      "moduleDefId=domains");
                    break;

                case TYPE_ORGANIZATION:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, DefaultPage.CONTROL_ID_PARAM + "=" + "organization_home",
                                                      "moduleDefId=ExchangeServer");
                    break;

                case TYPE_EXCHANGEACCOUNT:
                    if (fullType.Equals("Mailbox"))
                    {
                        res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                          PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=mailbox_settings",
                                                          "AccountID=" + accountId, "moduleDefId=ExchangeServer");
                    }
                    else
                    {
                        res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                          PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=edit_user",
                                                          "AccountID=" + accountId, "moduleDefId=ExchangeServer");
                    }
                    break;

                case TYPE_RDSCOLLECTION:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=rds_edit_collection",
                                                      "CollectionId=" + accountId, "moduleDefId=ExchangeServer");
                    break;

                case TYPE_LYNC:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId.ToString(), "ctl=edit_lync_user",
                                                      "AccountID=" + accountId, "moduleDefId=ExchangeServer");
                    break;

                case TYPE_FOLDER:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId.ToString(), "ctl=enterprisestorage_folder_settings",
                                                      "FolderID=" + textSearch, "moduleDefId=ExchangeServer");
                    break;

                case TYPE_SHAREPOINT:
                case TYPE_SHAREPOINTENTERPRISE:
                    res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
                                                      PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=" + (itemType == TYPE_SHAREPOINT ? "sharepoint_edit_sitecollection" : "sharepoint_enterprise_edit_sitecollection"),
                                                      "SiteCollectionID=" + accountId, "moduleDefId=ExchangeServer");
                    break;

                default:
                    res = PortalUtils.GetSpaceHomePageUrl(spaceId);
                    break;
                }
            }

            return(res);
        }
        private void BindMenu(MenuItemCollection items, XmlNodeList nodes)
        {
            bool ecUserEnabled  = false;
            bool ecAdminEnabled = PanelSecurity.SelectedUser.EcommerceEnabled;
            //
            UserInfo parent = UsersHelper.GetUser(PanelSecurity.SelectedUser.OwnerId);

            //
            if (parent != null)
            {
                ecUserEnabled = parent.EcommerceEnabled;
            }

            foreach (XmlNode node in nodes)
            {
                string pageId = null;
                if (node.Attributes["pageID"] != null)
                {
                    pageId = node.Attributes["pageID"].Value;
                }

                if (!PortalUtils.PageExists(pageId))
                {
                    continue;
                }

                string url = null;
                if (node.Attributes["url"] != null)
                {
                    url = node.Attributes["url"].Value;
                }

                string title = null;
                if (node.Attributes["title"] != null)
                {
                    title = node.Attributes["title"].Value;
                }

                string target = null;
                if (node.Attributes["target"] != null)
                {
                    target = node.Attributes["target"].Value;
                }

                string roles = null;
                if (node.Attributes["roles"] != null)
                {
                    roles = node.Attributes["roles"].Value;
                }

                // get custom page parameters
                XmlNodeList   xmlParameters = node.SelectNodes("Parameters/Add");
                List <string> parameters    = new List <string>();
                foreach (XmlNode xmlParameter in xmlParameters)
                {
                    parameters.Add(xmlParameter.Attributes["name"].Value
                                   + "=" + xmlParameter.Attributes["value"].Value);
                }

                bool display = true;
                // set user role visibility second
                if (!String.IsNullOrEmpty(roles))
                {
                    display = false;
                    string[] arrRoles = roles.Split(',');
                    string   userRole = PanelSecurity.SelectedUser.Role.ToString();
                    foreach (string role in arrRoles)
                    {
                        if (String.Compare(userRole, role, true) == 0)
                        {
                            display = true;
                            break;
                        }
                    }
                }
                // set ecommerce user visibility first
                if (display && node.Attributes["ecuser"] != null)
                {
                    display = ecUserEnabled;
                }
                // set ecommerce admin visibility third
                if (display && node.Attributes["ecadmin"] != null)
                {
                    display = ecAdminEnabled;
                }


                //Audit Log functionality is disabled when user is in Demo mode
                if ((pageId == "AuditLog") && (PanelSecurity.SelectedUser.IsDemo))
                {
                    display = false;
                }

                // add menu item
                if (display)
                {
                    string pageUrl = !String.IsNullOrEmpty(url) ? url : PortalUtils.NavigatePageURL(
                        pageId, PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(), parameters.ToArray());
                    string   pageName = !String.IsNullOrEmpty(title) ? title : PortalUtils.GetLocalizedPageName(pageId);
                    MenuItem item     = new MenuItem(pageName, "", "", pageUrl);

                    if (!String.IsNullOrEmpty(target))
                    {
                        item.Target = target;
                    }

                    items.Add(item);

                    // process nested menu items
                    XmlNodeList xmlNestedNodes = node.SelectNodes("MenuItems/MenuItem");
                    BindMenu(item.ChildItems, xmlNestedNodes);
                }
            }
        }