public ModuleActionCollection GetIndexActions() { var actions = new ModuleActionCollection(); var existingDivision = !Null.IsNull(Settings.DivisionID); actions.Add( -1, LocalizeString("AddDivision.Action"), ModuleActionType.AddContent, "", UniversityIcons.Add, ModuleContext.EditUrl("EditDivision"), false, SecurityAccessLevel.Edit, !existingDivision && SecurityContext.CanAdd(typeof(DivisionInfo)), false ); actions.Add( -1, LocalizeString("EditDivision.Action"), ModuleActionType.EditContent, "", UniversityIcons.Edit, ModuleContext.EditUrl("division_id", Settings.DivisionID.ToString(), "EditDivision"), false, SecurityAccessLevel.Edit, existingDivision, false ); return(actions); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Request["fileid"] != null && Request["fileAction"] != null) { GetFile(Request["fileAction"], Request["fileid"]); } fetchExtensions.Click += FetchExtensionsClick; setupCredentials.Visible = false; updateCredentials.Visible = false; fetchExtensions.Visible = false; setupCredentials.NavigateUrl = ModuleContext.EditUrl("Store"); updateCredentials.NavigateUrl = ModuleContext.EditUrl("Store"); Dictionary <string, string> settings = PortalController.Instance.GetPortalSettings(ModuleContext.PortalId); if (settings.ContainsKey("Store_Username")) { fetchExtensions.Visible = true; updateCredentials.Visible = true; } else { setupCredentials.Visible = true; } }
protected void cmdAdd_Click(object sender, EventArgs e) { try { if (!ModuleContext.PortalSettings.UserInfo.IsSuperUser) { Response.Redirect(Globals.NavigateURL("Access Denied"), true); } if (Page.IsValid) { string scriptFileName = "_" + Path.GetFileNameWithoutExtension(fileName.Text) + "." + scriptFileType.SelectedValue.ToLowerInvariant(); string srcFile = Server.MapPath(string.Format(razorScriptFileFormatString, scriptFileName)); // write file StreamWriter objStream = null; objStream = File.CreateText(srcFile); objStream.WriteLine(Localization.GetString("NewScript", LocalResourceFile)); objStream.Close(); Response.Redirect(ModuleContext.EditUrl("Edit"), true); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public void EnsureActionButton() { var modSecurity = new ModuleSecurity(ModuleContext); var useButtons = Settings.UseButtonsInForm; if (Settings.OnlyFormIsShown) { var url = Globals.NavigateURL(ModuleContext.TabId); var title = Localization.GetString("BackToForm.Action", LocalResourceFile); ActionLink.NavigateUrl = url; ActionLink.Text = title; placeholderActions.Visible = useButtons; } else if (Settings.OnlyListIsShown && modSecurity.IsAllowedToAddRow() && SchemaIsDefined() && (modSecurity.IsAllowedToAdministrateModule() || HasAddPermissonByQuota())) { var url = ModuleContext.EditUrl(); var title = Localization.GetString(ModuleActionType.AddContent, LocalResourceFile); ActionLink.NavigateUrl = url; ActionLink.Text = title; placeholderActions.Visible = useButtons; } }
private void UpdateGridColumns(DataGrid grid) { foreach (DataGridColumn column in grid.Columns) { if (ReferenceEquals(column.GetType(), typeof(ImageCommandColumn))) { var imageColumn = (ImageCommandColumn)column; if (!String.IsNullOrEmpty(imageColumn.CommandName)) { imageColumn.Text = Localization.GetString(imageColumn.CommandName, LocalResourceFile); } if (imageColumn.CommandName == "Delete") { var parameters = new string[2]; parameters[0] = "rtab=" + ModuleContext.TabId; parameters[1] = "packageId=KEYFIELD"; var formatString = ModuleContext.NavigateUrl(ModuleContext.TabId, "UnInstall", false, parameters); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; imageColumn.Visible = UserController.GetCurrentUserInfo().IsSuperUser; } if (imageColumn.CommandName == "Edit") { string formatString = ModuleContext.EditUrl("PackageID", "KEYFIELD", "Edit"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } } } }
void BindData() { if (!SchemaIsDefined()) { ShowModuleMessage("NoFieldsDefined.ErrorMessage", ModuleContext.EditUrl("Manage"), "No fields defined"); } else { var mustBind = true; if (Settings.ShowSearchTextBox) { if (!_search.DataBindingNeeded()) { ctlPagingControl.TotalRecords = 0; ctlPagingControl.Visible = false; lblNoRecordsFound.Visible = false; mustBind = false; } } else { panSearch.Visible = false; } if (mustBind) { switch (RenderMethod) { case SettingName.XslUserDefinedStyleSheet: var styleSheet = (string)ModuleContext.Settings[RenderMethod]; if (string.IsNullOrEmpty(styleSheet)) { BindDataToDataGrid(); } else { BindDataUsingXslTransform(styleSheet); } break; case SettingName.XslPreDefinedStyleSheet: var oldStyleSheet = (string)ModuleContext.Settings[RenderMethod]; var newStyleSheet = CopyScriptToPortal(oldStyleSheet); var mc = new ModuleController(); mc.UpdateTabModuleSetting(TabModuleId, SettingName.RenderingMethod, "XslUserDefinedStyleSheet"); mc.UpdateTabModuleSetting(TabModuleId, SettingName.XslUserDefinedStyleSheet, newStyleSheet); BindDataUsingXslTransform(newStyleSheet); break; default: //grid rendering BindDataToDataGrid(); break; } } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { _PortalDefault = PortalSettings.DefaultLanguage; if (!Page.IsPostBack) { BindDefaultLanguageSelector(); BindGrid(); chkBrowser.Checked = ModuleContext.PortalSettings.EnableBrowserLanguage; } if (!UserInfo.IsSuperUser) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("HostOnlyMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.BlueInfo); } systemDefaultLanguageLabel.Language = Localization.SystemLocale; if (PortalSettings.ContentLocalizationEnabled) { defaultLanguageLabel.Language = PortalSettings.DefaultLanguage; defaultLanguageLabel.Visible = true; languagesComboBox.Visible = false; updateButton.Visible = false; cmdEnableLocalizedContent.Visible = false; defaultPortalMessage.Text = Localization.GetString("PortalDefaultPublished.Text", LocalResourceFile); enabledPublishedPlaceHolder.Visible = true; } else { defaultLanguageLabel.Visible = false; languagesComboBox.Visible = true; updateButton.Visible = true; cmdEnableLocalizedContent.Visible = Host.EnableContentLocalization; defaultPortalMessage.Text = Localization.GetString("PortalDefaultEnabled.Text", LocalResourceFile); enabledPublishedPlaceHolder.Visible = false; } addLanguageLink.Visible = UserInfo.IsSuperUser; addLanguageLink.NavigateUrl = ModuleContext.EditUrl("Edit"); createLanguagePackLink.Visible = UserInfo.IsSuperUser; createLanguagePackLink.NavigateUrl = ModuleContext.EditUrl("PackageWriter"); verifyLanguageResourcesLink.Visible = UserInfo.IsSuperUser; verifyLanguageResourcesLink.NavigateUrl = ModuleContext.EditUrl("Verify"); installLanguagePackLink.Visible = UserInfo.IsSuperUser; installLanguagePackLink.NavigateUrl = Util.InstallURL(ModuleContext.TabId, ""); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
public ActionResult AdminPanel() { bool mustRedirect = false; string newUrl = string.Empty; if (PortalSettings.EnablePopUps) { if (Request.QueryString["popUp"] == null || Request.QueryString["popUp"] != "true" || Request.Url.Query.IndexOf("popUp") == -1) { mustRedirect = true; newUrl = ModuleContext.EditUrl("popUp", "true", "AdminPanel", "controller", "AdminPanel", "action", "AdminPanel"); } } else { if (Request.QueryString["SkinSrc"] == null) { mustRedirect = true; newUrl = ModuleContext.EditUrl("", "", "AdminPanel", "controller", "AdminPanel", "action", "AdminPanel", "SkinSrc=[G]Skins%2f_default%2fNo+Skin&ContainerSrc=[G]Containers%2f_default%2fNo+Container"); } } if (!User.IsInRole("MyDnnSupportAgent")) { //add agent role to current user var role = RoleController.Instance.GetRoleByName(PortalSettings.PortalId, "MyDnnSupportAgent"); RoleController.AddUserRole(User, role, PortalSettings, DotNetNuke.Security.Roles.RoleStatus.Approved, Null.NullDate, Null.NullDate, true, false); } var model = new ModuleConfigStatusViewModel(); model.VisitorsOnlineEnabled = bool.Parse(PortalController.GetPortalSetting("MyDnnVisitorsOnlineEnabled", PortalSettings.PortalId, "false"));; model.LiveChatEnabled = bool.Parse(PortalController.GetPortalSetting("MyDnnLiveChatEnabled", PortalSettings.PortalId, "false"));; var moduleID = int.Parse(PortalController.GetPortalSetting("MyDnnLiveChatModuleID", PortalSettings.PortalId, "-1")); if (moduleID != -1) { var objModuleInfo = new ModuleController().GetModule(moduleID); var Settings = objModuleInfo.ModuleSettings; model.ModuleID = objModuleInfo.ModuleID; model.TabID = objModuleInfo.TabID; model.BasicSettingsUpdated = Settings["UpdateBasicSettings"] != null?bool.Parse(Settings["UpdateBasicSettings"].ToString()) : false; model.WidgetSettingsUpdated = Settings["UpdateWidgetSettings"] != null?bool.Parse(Settings["UpdateWidgetSettings"].ToString()) : false;; } if (mustRedirect) { return(Redirect(newUrl)); } else { return(View(model)); } }
protected void cmdEditEmail_Click(object sender, EventArgs e) { var fileId = GetEditableFileId(XslTracking.Url.ToLowerInvariant()); if (fileId > -1) { SaveSettings(); Response.Redirect(ModuleContext.EditUrl("FileID", fileId.ToString(CultureInfo.InvariantCulture), "GenerateXsl"), true); } }
protected string GetEditUrl(string ipfilterId) { string editUrl = ModuleContext.EditUrl("IPFilterID", ipfilterId, "EditIPFilters"); if (ModuleContext.PortalSettings.EnablePopUps) { editUrl = UrlUtils.PopUpUrl(editUrl, this, ModuleContext.PortalSettings, false, false); } return(editUrl); }
protected string GetEditUrl(string id) { var editUrl = ModuleContext.EditUrl("Id", id, "RedirectionSettings"); if (ModuleContext.PortalSettings.EnablePopUps) { editUrl = UrlUtils.PopUpUrl(editUrl, this, ModuleContext.PortalSettings, false, false); } return(editUrl); }
protected string EditUrlRule(object oUrlRuleId) { var editUrl = ModuleContext.EditUrl("UrlRuleId", oUrlRuleId.ToString(), "rules_edit"); if (ModuleContext.PortalSettings.EnablePopUps) { //editUrl = UrlUtils.PopUpUrl(editUrl, this, ModuleContext.PortalSettings, true, false); } return(editUrl); }
protected void cmdCancel_Click(object sender, EventArgs e) { try { Response.Redirect(ModuleContext.EditUrl("Edit"), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { products.DataSource = controller.GetProducts(); products.DataBind(); } addButton.NavigateUrl = ModuleContext.EditUrl("Edit"); }
private void Page_Load(object sender, System.EventArgs e) { try { var editUrl = ModuleContext.EditUrl(); if (ModuleContext.PortalSettings.EnablePopUps) { editUrl = UrlUtils.PopUpUrl(editUrl, this, ModuleContext.PortalSettings, true, false); lbEdit.Attributes.Add("onclick", "return " + editUrl); } else { lbEdit.Click += delegate(object sen, EventArgs ev) { Response.Redirect(editUrl, true); }; } if (!Page.IsPostBack) { ShowUrls(); //string CacheMode = PortalController.GetPortalSetting("OOC_CacheMode", PortalId, "ServerCache"); int DefaultCacheDuration = PortalController.GetPortalSettingAsInteger("OOC_CacheDuration", PortalId, 60); string DefaultIncludeVaryBy = PortalController.GetPortalSetting("OOC_IncludeVaryBy", PortalId, ""); string DefaultExcludeVaryBy = PortalController.GetPortalSetting("OOC_ExcludeVaryBy", PortalId, "returnurl"); int DefaultMaxVaryByCount = PortalController.GetPortalSettingAsInteger("OOC_MaxVaryByCount", PortalId, 0); bool VaryByBrowser = PortalController.GetPortalSettingAsBoolean("OOC_VaryByBrowser", PortalId, false); lDefault.Text = "Default Cache Duration : " + DefaultCacheDuration + " - " + (string.IsNullOrEmpty(DefaultIncludeVaryBy) ? "" : "Default Include Parameters : " + DefaultIncludeVaryBy + " - ") + (VaryByBrowser ? " + Browser - " : "") + (string.IsNullOrEmpty(DefaultExcludeVaryBy) ? "" : "Default Exclude Parameters: " + DefaultExcludeVaryBy + " - ") + (DefaultMaxVaryByCount == 0 ? "" : "Default Max Vary By Count : " + DefaultMaxVaryByCount + " - "); ddlProvider.DataSource = OutputCachingProvider.GetProviderList(); ddlProvider.DataBind(); ddlProvider.Items.Insert(0, new ListItem(Localization.GetString("Remove_Provider", LocalResourceFile), "Remove_Provider")); ddlProvider.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), "None_Specified")); if (ddlDefault.Items.Count == 2) { ddlDefault.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), "")); } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
private void BindDefinition() { if (IsAddDefinitionMode) { var definition = new ModuleDefinitionInfo { DesktopModuleID = DesktopModule.DesktopModuleID, ModuleDefID = Null.NullInteger }; definitionsEditor.DataSource = definition; definitionsEditor.DataBind(); cmdDeleteDefinition.Visible = false; cmdUpdateDefinition.Text = Localization.GetString("cmdCreateDefinition", LocalResourceFile); cmdCancelDefinition.Visible = true; pnlDefinition.Visible = true; pnlControls.Visible = false; definitionSelectRow.Visible = false; definitionName.Visible = true; definitionNameLiteral.Visible = false; } else { if (ModuleDefinition != null && ModuleDefinition.DesktopModuleID == DesktopModule.DesktopModuleID) { definitionsEditor.DataSource = ModuleDefinition; definitionsEditor.DataBind(); cmdDeleteDefinition.Visible = true; cmdUpdateDefinition.Text = Localization.GetString("cmdUpdateDefinition", LocalResourceFile); if (!Page.IsPostBack) { Localization.LocalizeDataGrid(ref grdControls, LocalResourceFile); } grdControls.DataSource = ModuleDefinition.ModuleControls.Values; grdControls.DataBind(); pnlDefinition.Visible = true; pnlControls.Visible = true; definitionSelectRow.Visible = true; definitionName.Visible = false; definitionNameLiteral.Visible = true; cmdAddControl.NavigateUrl = ModuleContext.EditUrl("ModuleControlID", "-1", "EditControl", "packageId=" + PackageID, "moduledefid=" + ModuleDefinition.ModuleDefID); } else { pnlDefinition.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { cmdConfig.NavigateUrl = ModuleContext.EditUrl("Manage"); if (!IsPostBack) { Localization.LocalizeGridView(ref GridView1, LocalResourceFile); } BindData(); if (GridView1.Rows.Count == 0) { lblTemplate.Visible = false; } }
protected override void OnLoad() { base.OnLoad(); // Generate the Add redirect URL var editUrl = ModuleContext.EditUrl("{0}"); View.Model.AddUrl = ModuleContext.PortalSettings.EnablePopUps ? UrlUtils.PopUpUrl(editUrl, null, ModuleContext.PortalSettings, false, false) : editUrl; View.Model.ModeType = Request.QueryString["type"]; // Load Redirects View.Model.Redirections = _redirectionController.GetRedirectionsByPortal(ModuleContext.PortalId); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { var contacts = controller.GetContacts(); clients.DataSource = contacts; clients.DataBind(); //testDataGrid.DataSource = contacts; //testDataGrid.DataBind(); } addButton.NavigateUrl = ModuleContext.EditUrl("Edit"); }
private void MyEditUrl(LinkButton lb, string ctl) { var editUrl = ModuleContext.EditUrl(ctl); if (ModuleContext.PortalSettings.EnablePopUps) { editUrl = UrlUtils.PopUpUrl(editUrl, this, ModuleContext.PortalSettings, true, false); lb.Attributes.Add("onclick", "return " + editUrl); } else { lb.Click += delegate(object sender, EventArgs e) { Response.Redirect(editUrl, true); }; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); foreach (DataGridColumn column in providersGrid.Columns) { if (ReferenceEquals(column.GetType(), typeof(ImageCommandColumn))) { var imageColumn = (ImageCommandColumn)column; var formatString = ModuleContext.EditUrl("ProviderId", "KEYFIELD", "UrlProviderSettings"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } } }
void Page_Load(object sender, EventArgs e) { _schemaDataSet = UdtController.GetSchemaDataset(); SetupClientScripts(); if (!IsPostBack) { if (Request.QueryString["fileid"].AsString().Length > 0 || Request.QueryString["Edit"].AsString().ToLowerInvariant() == "current") { IFileInfo file = null; if (Request.QueryString["Edit"].AsString().ToLowerInvariant() == "current") { var script = ModuleContext.Settings[SettingName.XslUserDefinedStyleSheet].ToString(); if (!string.IsNullOrEmpty(script)) { file = FileManager.Instance.GetFile(ModuleContext.PortalId, script); } ReturnUrl = Globals.NavigateURL(); } else { var fileId = int.Parse(Request.QueryString["fileid"]); file = FileManager.Instance.GetFile(fileId); ReturnUrl = ModuleContext.EditUrl("Manage"); } if (file != null && file.Extension.ToLowerInvariant().StartsWith("xsl") && Utilities.HasWritePermission(file.Folder, ModuleContext.PortalId)) { EditExistingScriptAndTemplates(file); } else { InitializeNewScript(); } } else { InitializeNewScript(); } ListTemplateSetHeaderAndFooter(); TemplatesPopulateColumnDropDownLists(); TemplatesSetVisibility(!IsTrackingEmailMode); } }
protected void grdControls_ItemDataBound(object sender, DataGridItemEventArgs e) { DataGridItem item = e.Item; if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.SelectedItem) { var editHyperlink = item.Controls[3].Controls[0] as HyperLink; if (editHyperlink != null) { editHyperlink.NavigateUrl = ModuleContext.EditUrl("ModuleControlID", editHyperlink.NavigateUrl, "EditControl", "packageId=" + PackageID, "moduledefid=" + ModuleDefinition.ModuleDefID); } } }
public ModuleActionCollection GetIndexActions() { var actions = new ModuleActionCollection { new ModuleAction(-1) { CommandName = ModuleActionType.AddContent, CommandArgument = String.Empty, Icon = String.Empty, Title = LocalizeString("AddMessage"), Url = ModuleContext.EditUrl("Edit"), Secure = SecurityAccessLevel.Edit, UseActionEvent = false, Visible = true, NewWindow = false }, new ModuleAction(-1) { CommandName = ModuleActionType.ContentOptions, CommandArgument = String.Empty, Icon = String.Empty, Title = LocalizeString("AdminList"), Url = ModuleContext.EditUrl("AdminList"), Secure = SecurityAccessLevel.Edit, UseActionEvent = false, Visible = true, NewWindow = false }, new ModuleAction(-1) { CommandName = ModuleActionType.ContentOptions, CommandArgument = String.Empty, Icon = String.Empty, Title = LocalizeString("ResetDailyMessage"), Url = ModuleContext.EditUrl("ResetDailyMessage"), //Url = DotNetNuke.Common.Globals.NavigateURL(ModuleContext.TabId,string.Empty,"removeLog=true"),//ModuleContext.EditUrl("ResetDailyMessage"), Secure = SecurityAccessLevel.Edit, UseActionEvent = false, Visible = true, NewWindow = false } }; return(actions); }
private void InitForm(string template) { bool templateDefined = !string.IsNullOrEmpty(template); string settings = ModuleContext.Settings["data"] as string; bool settingsDefined = !string.IsNullOrEmpty(settings); if (!templateDefined || !settingsDefined) { pHelp.Visible = true; } if (ModuleContext.PortalSettings.UserInfo.IsSuperUser) { hlTempleteExchange.NavigateUrl = ModuleContext.EditUrl("ShareTemplate"); hlTempleteExchange.Visible = true; } if (pHelp.Visible && ModuleContext.EditMode) { hlEditSettings.NavigateUrl = ModuleContext.EditUrl("EditSettings"); hlEditSettings.Visible = true; scriptList.Items.AddRange(OpenFormUtils.GetTemplatesFiles(PortalSettings, ModuleId, template).ToArray()); scriptList.Visible = true; } if (string.IsNullOrEmpty(template)) { ScopeWrapper.Visible = false; } if (templateDefined) { IncludeResourses(template); } if (settingsDefined) { SettingsDTO set = JsonConvert.DeserializeObject <SettingsDTO>(settings); if (!string.IsNullOrEmpty(set.Settings.SiteKey)) { ClientResourceManager.RegisterScript(Page, "https://www.google.com/recaptcha/api.js", FileOrder.Js.DefaultPriority, "DnnPageHeaderProvider"); lReCaptcha.Text = "<div class=\"g-recaptcha\" data-sitekey=\"" + set.Settings.SiteKey + "\"></div>"; } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack && HttpContext.Current.User.Identity.IsAuthenticated) { devisDataGrid.PagerStyle.Mode = PagerMode.NumericPages; DevisUserPreferences prefs = controller.GetDevisUserPreferences(); if (prefs == null) { controller.AddDevisUserPreferences(); ShowAllDevis(); } else if (prefs.DevisTab == 0) { ShowAllDevis(); } else { ShowUserDevis(); } } if (HttpContext.Current.User.Identity.IsAuthenticated) { addButton.NavigateUrl = ModuleContext.EditUrl("Edit"); } else { addButton.Visible = false; devisDataGrid.Visible = false; allDevisButton.Visible = false; userDevisButton.Visible = false; logInPromptLabel.Visible = true; } }
protected void cmdGenerateEmail_Click(object sender, EventArgs e) { SaveSettings(); Response.Redirect(ModuleContext.EditUrl("tracking", "true", "GenerateXsl"), true); }
void cmdGenerateXSL_Click(object sender, EventArgs e) { SaveSettings(); Response.Redirect(ModuleContext.EditUrl("GenerateXsl"), true); }
protected void GetExtensions() { try { string fileCheck = Localization.GetString("StoreFile", LocalResourceFile); string postData = ""; Stream oStream; Dictionary <string, string> settings = PortalController.Instance.GetPortalSettings(ModuleContext.PortalId); var ps = new PortalSecurity(); string username = ps.DecryptString(settings["Store_Username"], Config.GetDecryptionkey()); string password = ps.DecryptString(settings["Store_Password"], Config.GetDecryptionkey()); postData = postData + "username="******"&password="******"POST"; // Create POST data and convert it to a byte array. byte[] byteArray = Encoding.UTF8.GetBytes(postData); request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = byteArray.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); WebResponse response = request.GetResponse(); oStream = response.GetResponseStream(); XmlTextReader oReader; XPathDocument oXMLDocument; oReader = new XmlTextReader((oStream)); var dt = new DataTable(); //instance of a datarow DataRow drow; //creating two datacolums Column1 and Column2 var dcol1 = new DataColumn("Package", typeof(string)); var dcol2 = new DataColumn("Filename", typeof(string)); var dcol3 = new DataColumn("Download", typeof(string)); var dcol4 = new DataColumn("Deploy", typeof(string)); //adding datacolumn to datatable dt.Columns.Add(dcol1); dt.Columns.Add(dcol2); dt.Columns.Add(dcol3); dt.Columns.Add(dcol4); oReader.XmlResolver = null; try { oXMLDocument = new XPathDocument(oReader); } catch (Exception) { grdSnow.EmptyDataText = LocalizeString("NoData"); grdSnow.DataBind(); return; } var nav = oXMLDocument.CreateNavigator(); var orderDetailIterator = nav.Select("orders/order/orderdetails/orderdetail"); var i = 0; while (orderDetailIterator.MoveNext()) { var packageName = orderDetailIterator.Current.GetAttribute("packagename", "").Replace("'", "''").Trim(); var filesIterator = orderDetailIterator.Current.Select("files/file"); while (filesIterator.MoveNext()) { //instance of a datarow drow = dt.NewRow(); //add rows to datatable dt.Rows.Add(drow); var fileName = filesIterator.Current.GetAttribute("filename", ""); var fileId = filesIterator.Current.GetAttribute("fileid", ""); var deploy = filesIterator.Current.GetAttribute("deploy", ""); //add Column values dt.Rows[i][dcol1] = packageName; dt.Rows[i][dcol2] = fileName; var portalSettings = PortalController.Instance.GetCurrentPortalSettings(); dt.Rows[i][dcol3] = "<a class='dnnPrimaryAction' href='" + Globals.NavigateURL(portalSettings.ActiveTab.TabID, Null.NullString, "fileAction", "download", "fileid", fileId) + "'>" + LocalizeString("download") + "</a>"; if (deploy == "true") { dt.Rows[i][dcol4] = "<a class='dnnPrimaryAction' href=" + "\"" + ModuleContext.EditUrl("fileID", fileId, "Download", "package", Server.UrlPathEncode(packageName)) + "\"" + ">" + LocalizeString("deploy") + "</a>"; } else { dt.Rows[i][dcol4] = "N/A"; } i = i + 1; } } grdSnow.DataSource = dt; grdSnow.DataBind(); } catch (Exception) { grdSnow.EmptyDataText = LocalizeString("NoData"); grdSnow.DataBind(); } }
private void BindButtons(OpenContentSettings settings, RenderInfo info) { bool templateDefined = info.Template != null; bool settingsDefined = !string.IsNullOrEmpty(settings.Data); bool settingsNeeded = false; if (rblUseTemplate.SelectedIndex == 0 && ddlTemplate.SelectedIndex >= 0) // existing template { //create tmp TemplateManifest var templateManifest = new FileUri(ddlTemplate.SelectedValue).ToTemplateManifest(); settingsNeeded = templateManifest.SettingsNeeded(); templateDefined = templateDefined && (!ddlTemplate.Visible || (settings.Template.Key.ToString() == ddlTemplate.SelectedValue)); settingsDefined = settingsDefined || !settingsNeeded; } else // new template { templateDefined = false; } if (!templateDefined && !settings.FirstTimeInitialisation && ddlTemplate.Items.FindByValue(settings.TemplateKey.ToString()) == null) { lCurrentTemplate.Text = settings.TemplateKey.ToString(); phCurrentTemplate.Visible = true; } bSave.CssClass = "dnnPrimaryAction"; bSave.Enabled = true; hlEditSettings.CssClass = "dnnSecondaryAction"; hlEditContent.CssClass = "dnnSecondaryAction"; //if (ModuleContext.PortalSettings.UserInfo.IsSuperUser) hlEditSettings.Enabled = false; hlEditSettings.Visible = settingsNeeded && !RenderOnlySaveButton; if (templateDefined && ModuleContext.EditMode && settingsNeeded) { //hlTempleteExchange.NavigateUrl = ModuleContext.EditUrl("ShareTemplate"); hlEditSettings.NavigateUrl = ModuleContext.EditUrl("EditSettings"); //hlTempleteExchange.Visible = true; hlEditSettings.Enabled = true; //bSave.CssClass = "dnnSecondaryAction"; //bSave.Enabled = false; //hlEditSettings.CssClass = "dnnPrimaryAction"; //hlEditContent.CssClass = "dnnSecondaryAction"; } hlEditContent.Visible = !RenderOnlySaveButton; hlEditContent2.Visible = !RenderOnlySaveButton; hlEditContent.Enabled = false; hlEditContent2.Enabled = false; if (templateDefined && settingsDefined && ModuleContext.EditMode) { hlEditContent.NavigateUrl = ModuleContext.EditUrl("Edit"); hlEditContent.Enabled = true; hlEditContent2.NavigateUrl = ModuleContext.EditUrl("Edit"); hlEditContent2.Enabled = true; //bSave.CssClass = "dnnSecondaryAction"; //bSave.Enabled = false; //hlEditSettings.CssClass = "dnnSecondaryAction"; //hlEditContent.CssClass = "dnnPrimaryAction"; var template = new FileUri(ddlTemplate.SelectedValue); var manifest = template.ToTemplateManifest(); hlEditContent.Text = App.Services.Localizer.GetString(manifest.IsListTemplate ? "Add.Action" : "Edit.Action", ResourceFile); if (!string.IsNullOrEmpty(manifest.Title)) { hlEditContent.Text = hlEditContent.Text + " " + manifest.Title; } } }