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)); } } }
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); }
private void CreateHostingSpace() { if (!Page.IsValid) { return; } string spaceName = ddlPlans.SelectedItem.Text; string ftpAccount = (rbFtpAccountName.SelectedIndex == 0) ? null : ftpAccountName.Text; string domainName = txtDomainName.Text.Trim(); PackageResult result = null; try { result = ES.Services.Packages.AddPackageWithResources(PanelSecurity.SelectedUserId, Utils.ParseInt(ddlPlans.SelectedValue, 0), spaceName, Utils.ParseInt(ddlStatus.SelectedValue, 0), chkPackageLetter.Checked, chkCreateResources.Checked, domainName, true, chkCreateWebSite.Checked, chkCreateFtpAccount.Checked, ftpAccount, chkCreateMailAccount.Checked); if (result.Result < 0) { ShowResultMessage(result.Result); lblMessage.Text = AntiXss.HtmlEncode(GetExceedingQuotasMessage(result.ExceedingQuotas)); return; } } catch (Exception ex) { ShowErrorMessage("USERWIZARD_CREATE_ACCOUNT", ex); return; } // go to space home Response.Redirect(PortalUtils.GetSpaceHomePageUrl(result.Result)); }
public string GetSpaceHomeUrl(int spaceId) { return(PortalUtils.GetSpaceHomePageUrl(spaceId)); }
private void CreateHostingSpace() { if (!Page.IsValid) { return; } string spaceName = ddlPlans.SelectedItem.Text; string ftpAccount = (rbFtpAccountName.SelectedIndex == 0) ? null : ftpAccountName.Text; string domainName = txtDomainName.Text.Trim(); PackageResult result = null; try { result = ES.Services.Packages.AddPackageWithResources(PanelSecurity.SelectedUserId, Utils.ParseInt(ddlPlans.SelectedValue, 0), spaceName, Utils.ParseInt(ddlStatus.SelectedValue, 0), chkPackageLetter.Checked, chkCreateResources.Checked, domainName, false, chkCreateWebSite.Checked, chkCreateFtpAccount.Checked, ftpAccount, chkCreateMailAccount.Checked, txtHostName.Text); if (result.Result < 0) { ShowResultMessage(result.Result); lblMessage.Text = PortalAntiXSS.Encode(GetExceedingQuotasMessage(result.ExceedingQuotas)); return; } else { if ((chkIntegratedOUProvisioning.Checked) & !string.IsNullOrEmpty(domainName)) { UserInfo user = UsersHelper.GetUser(PanelSecurity.SelectedUserId); if (user != null) { if (user.Role != UserRole.Reseller) { UserSettings settings = ES.Services.Users.GetUserSettings(user.UserId, UserSettings.EXCHANGE_POLICY); string orgId = domainName.ToLower(); if (settings != null && settings["OrgIdPolicy"] != null) { orgId = GetOrgId(settings["OrgIdPolicy"], domainName, result.Result); } ES.Services.Organizations.CreateOrganization(result.Result, orgId, domainName.ToLower(), domainName.ToLower()); if (result.Result < 0) { ShowErrorMessage("USERWIZARD_CREATE_ACCOUNT"); return; } } } } } } catch (Exception ex) { ShowErrorMessage("USERWIZARD_CREATE_ACCOUNT", ex); return; } // go to space home Response.Redirect(PortalUtils.GetSpaceHomePageUrl(result.Result)); }
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); }