protected void Page_Load(object sender, EventArgs e) { rfvControlName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvCodeName"); rfvControlDisplayName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvDisplayName"); // Initialize breadcrumbs string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("Development_FormUserControl_Edit.Controls"); breadcrumbs[0, 1] = "~/CMSModules/FormControls/Pages/Development/List.aspx"; breadcrumbs[0, 2] = ""; breadcrumbs[1, 0] = GetString("Development_FormUserControl_Edit.New"); breadcrumbs[1, 1] = ""; breadcrumbs[1, 2] = ""; // Initialize page this.CurrentMaster.Title.Breadcrumbs = breadcrumbs; this.CurrentMaster.Title.TitleText = GetString("Development_FormUserControl_Edit.Title"); this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_FormControl/new.png"); this.CurrentMaster.Title.HelpTopicName = "new_form_control"; this.CurrentMaster.Title.HelpName = "helpTopic"; // Initialize file selector FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; tbFileName.DialogConfig = config; tbFileName.AllowEmptyValue = false; tbFileName.SelectedPathPrefix = "~/CMSFormControls/"; tbFileName.ValidationError = GetString("Development_FormUserControl_Edit.rfvFileName"); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (StopProcessing) { // Do nothing return; } // Setup file system selector var config = new FileSystemDialogConfiguration { AllowedExtensions = "ascx", ShowFolders = false, }; ucFileSystemSelector.DialogConfig = config; if (!RequestHelper.IsPostBack() && !controlsLoaded) { // Initial load LoadControls(ControlPath); } }
protected void Page_Load(object sender, EventArgs e) { // Setup the filesystem browser if (!String.IsNullOrEmpty(Path)) { // Register scripts ScriptHelper.RegisterJQuery(this.Page); CMSDialogHelper.RegisterDialogHelper(this.Page); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "InitResizers", "$j(InitResizers());", true); CSSHelper.RegisterCSSBlock(Page, ".TooltipImage{max-width:200px; max-height:200;}"); string filePath = Server.MapPath(Path); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } // Setup the browser FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.StartingPath = Path; config.AllowedExtensions = "gif;png;bmp;jpg;jpeg;css;skin"; config.ShowFolders = false; config.AllowManage = true; selFile.Config = config; } }
protected void Page_Load(object sender, EventArgs e) { // Setup the filesystem browser if (!String.IsNullOrEmpty(Path)) { // Register scripts ScriptHelper.RegisterJQuery(this.Page); CMSDialogHelper.RegisterDialogHelper(this.Page); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "InitResizers", "$j(InitResizers());", true); CSSHelper.RegisterCSSBlock(Page, ".TooltipImage{max-width:200px; max-height:200;}"); string filePath = Server.MapPath(Path); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } // Setup the browser FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.StartingPath = Path; config.AllowedExtensions = "gif;png;bmp;jpg;jpeg;css;skin"; config.ShowFolders = false; config.AllowManage = true; selFile.Config = config; } }
protected void Page_Load(object sender, EventArgs e) { // Setup page title text and image this.CurrentMaster.Title.TitleText = GetString("Development-WebPart_Edit.TitleNew"); this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_WebPart/new.png"); this.CurrentMaster.Title.HelpTopicName = "new_web_part"; this.CurrentMaster.Title.HelpName = "helpTopic"; // Initialize btnOk.Text = GetString("general.ok"); rfvWebPartDisplayName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorDisplayName"); rfvWebPartName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorWebPartName"); webpartSelector.ShowInheritedWebparts = false; radNewWebPart.Text = GetString("developmentwebparteditnewwepart"); radInherited.Text = GetString("Development-WebPart_Edit.Inherited"); lblWebpartList.Text = GetString("DevelopmentWebPartEdit.InheritedWebPart"); // Set breadcrumbs int i = 0; pageTitleTabs[i, 0] = GetString("Development-WebPart_Edit.WebParts"); pageTitleTabs[i, 1] = URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/WebParts/Development/Category_Frameset.aspx"); pageTitleTabs[i, 2] = ""; pageTitleTabs[i, 3] = "if (parent.frames['webparttree']) { parent.frames['webparttree'].location.href = '" + URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/WebParts/Development/WebPart_Tree.aspx") + "'; }"; i++; int parentid = QueryHelper.GetInteger("parentid", 0); WebPartCategoryInfo categoryInfo = WebPartCategoryInfoProvider.GetWebPartCategoryInfoById(parentid); // Check if the parent category is a root category, if not => display both (root + parent) if ((categoryInfo != null) && (categoryInfo.CategoryParentID != 0)) { // Add a cetegory tab pageTitleTabs[i, 0] = HTMLHelper.HTMLEncode(categoryInfo.CategoryDisplayName); pageTitleTabs[i, 1] = URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/WebParts/Development/Category_Frameset.aspx") + "?categoryid=" + categoryInfo.CategoryID; pageTitleTabs[i, 2] = ""; i++; } pageTitleTabs[i, 0] = GetString("Development-WebPart_Edit.New"); pageTitleTabs[i, 1] = ""; pageTitleTabs[i, 2] = ""; this.CurrentMaster.Title.Breadcrumbs = pageTitleTabs; FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSWebParts"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSWebParts/"; }
private void SetupControl() { // Setup file system selector for FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; selectFileName.DialogConfig = config; }
private void SetupControl() { // Setup file system selector for FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; selectFileName.DialogConfig = config; }
/// <summary> /// Setups the control. /// </summary> private void SetupControl() { // Get path string filePath = Path; if (string.IsNullOrEmpty(filePath)) { IThemeInfo themeObject = UIContext.EditedObject as IThemeInfo; if (themeObject != null) { // Get the specific theme path for the current theme object filePath = themeObject.GetThemePath(); } else { // Use the general theme path filePath = "~/App_Themes/"; } } // Setup the file system browser if (!String.IsNullOrEmpty(filePath)) { string absoluteFilePath = string.Empty; try { absoluteFilePath = Server.MapPath(filePath); } catch (Exception ex) { selFile.Visible = false; ShowError(ex.Message); return; } // Create folder if does not exist if (!Directory.Exists(absoluteFilePath)) { Directory.CreateDirectory(absoluteFilePath); } // Setup the browser var config = new FileSystemDialogConfiguration(); config.StartingPath = filePath; config.AllowedExtensions = AllowedExtensions; config.NewTextFileExtension = NewTextFileExtension; config.ShowFolders = false; config.AllowZipFolders = true; config.AllowManage = true; selFile.Config = config; } }
protected void Page_Load(object sender, EventArgs e) { // Setup page title text and image CurrentMaster.Title.TitleText = GetString("Development.Javascript"); CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_Javascript/object.png"); CurrentMaster.Title.HelpTopicName = "development_javascript_files"; CurrentMaster.Title.HelpName = "helpTopic"; CurrentMaster.PanelContent.CssClass = ""; // Register scripts ScriptHelper.RegisterJQuery(Page); CMSDialogHelper.RegisterDialogHelper(Page); ScriptManager.RegisterStartupScript(Page, typeof(Page), "InitResizers", "$j(InitResizers());", true); CSSHelper.RegisterCSSBlock(Page, ".TooltipImage{max-width:200px; max-height:200;}"); // Ensure the directory string path = "~/CMSScripts/Custom"; string filePath = String.Empty; try { filePath = Server.MapPath(path); } catch (Exception ex) { selFile.Visible = false; ShowError(ex.Message); return; } if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } // Setup the browser FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.StartingPath = path; config.AllowedExtensions = "js"; config.NewTextFileExtension = "js"; config.ShowFolders = false; config.AllowManage = true; selFile.Config = config; }
/// <summary> /// Raises the callback event. /// </summary> public void RaiseCallbackEvent(string eventArgument) { //LoadDisplayValues(eventArgument); // Configure dialog FileSystemDialogConfiguration config = DialogConfig; config.SelectedPath = eventArgument; ApplyProperties(); string url = GetDialogURL(config, SelectedPathPrefix); mHiddenUrl.Value = url; }
protected void Page_Load(object sender, EventArgs e) { // Disable "Generate new files" option on azure / precompiled environment if (SystemContext.IsPrecompiledWebsite || SystemContext.IsRunningOnAzure) { radNewFile.Enabled = false; radNewFile.Checked = false; radNewFile.ToolTipResourceString = "webpart.edit.precompiledsite"; radExistingFile.Checked = true; plcSelectFile.Visible = true; plcFileName.Visible = false; } // Setup page title text and image PageTitle.TitleText = GetString("Development-WebPart_Edit.TitleNew"); // Initialize btnOk.Text = GetString("general.ok"); rfvWebPartDisplayName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorDisplayName"); rfvWebPartName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorWebPartName"); rfvCodeFileName.ErrorMessage = GetString("webpart.codefilenamerequired"); webpartSelector.ShowInheritedWebparts = false; lblWebpartList.Text = GetString("DevelopmentWebPartEdit.InheritedWebPart"); // Set breadcrumbs PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("Development-WebPart_Edit.WebParts"), RedirectUrl = UIContextHelper.GetElementUrl("CMS.Design", "Development.WebParts", false), Target = "_parent" }); PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("Development-WebPart_Edit.New"), }); FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSWebParts/"; FileSystemSelector.DefaultPath = "CMSWebParts"; }
protected void Page_Load(object sender, EventArgs e) { // Setup page title text and image CurrentMaster.Title.TitleText = GetString("Development.Javascript"); CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_Javascript/object.png"); CurrentMaster.Title.HelpTopicName = "development_javascript_files"; CurrentMaster.Title.HelpName = "helpTopic"; CurrentMaster.PanelContent.CssClass = ""; // Register scripts ScriptHelper.RegisterJQuery(Page); CMSDialogHelper.RegisterDialogHelper(Page); ScriptManager.RegisterStartupScript(Page, typeof(Page), "InitResizers", "$j(InitResizers());", true); CSSHelper.RegisterCSSBlock(Page, ".TooltipImage{max-width:200px; max-height:200;}"); // Ensure the directory string path = "~/CMSScripts/Custom"; string filePath = String.Empty; try { filePath = Server.MapPath(path); } catch (Exception ex) { selFile.Visible = false; ShowError(ex.Message); return; } if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } // Setup the browser FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.StartingPath = path; config.AllowedExtensions = "js"; config.NewTextFileExtension = "js"; config.ShowFolders = false; config.AllowManage = true; selFile.Config = config; }
protected void Page_Load(object sender, EventArgs e) { // Get strings for controls on page pnlGeneral.GroupingText = GetString("general.general"); pnlControlScope.GroupingText = GetString("development.formcontrols.controlscope"); rfvCodeName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvCodeName"); rfvDisplayName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvDisplayName"); controlId = QueryHelper.GetInteger("controlid", 0); plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; if (!RequestHelper.IsPostBack()) { LoadData(); } drpDataType_SelectedIndexChanged(sender, e); chkForBizForms_CheckedChanged(sender, e); // Show 'saved' info message if (QueryHelper.GetString("saved", String.Empty) != String.Empty) { ShowChangesSaved(); } // Initialize file selector FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; tbFileName.DialogConfig = config; tbFileName.AllowEmptyValue = false; tbFileName.SelectedPathPrefix = "~/CMSFormControls/"; tbFileName.ValidationError = GetString("Development_FormUserControl_Edit.rfvFileName"); UploadFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; UploadFile.ObjectID = controlId; UploadFile.ObjectType = SiteObjectType.FORMUSERCONTROL; }
protected void Page_Load(object sender, EventArgs e) { // Control initializations rfvDisplayName.ErrorMessage = GetString("InlineControl_Edit.ErrorDisplayName"); rfvName.ErrorMessage = GetString("InlineControl_Edit.ErrorName"); // Check 'Assign with current web site' check box if ((CMSContext.CurrentSite != null) && (!RequestHelper.IsPostBack())) { chkAssign.Text = GetString("General.AssignWithWebSite") + " " + HTMLHelper.HTMLEncode(CMSContext.CurrentSite.DisplayName); chkAssign.Checked = true; chkAssign.Visible = true; } // Initializes page title control string[,] pageTitleTabs = new string[2, 3]; pageTitleTabs[0, 0] = GetString("InlineControl_Edit.ItemListLink"); pageTitleTabs[0, 1] = "~/CMSModules/InlineControls/Pages/Development/List.aspx"; pageTitleTabs[0, 2] = string.Empty; pageTitleTabs[1, 0] = GetString("InlineControl_Edit.NewItemCaption"); pageTitleTabs[1, 1] = string.Empty; pageTitleTabs[1, 2] = string.Empty; CurrentMaster.Title.Breadcrumbs = pageTitleTabs; CurrentMaster.Title.TitleText = GetString("Edit.NewControl"); CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_InlineControl/new.png"); CurrentMaster.Title.HelpTopicName = "new_control"; CurrentMaster.Title.HelpName = "helpTopic"; FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSInlineControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSInlineControls/"; FileSystemSelector.ValidationError = GetString("Edit.ErrorFileName"); }
/// <summary> /// Page load event. /// </summary> protected void Page_Load(object sender, EventArgs e) { if (StopProcessing) { selFile.StopProcessing = true; } else { // Set properties of inner filesystem selector FileSystemDialogConfiguration config = selFile.DialogConfig; config.ShowFolders = true; config.AllowedFolders = AllowedFolders; config.DefaultPath = DefaultPath; config.DialogHeight = DialogHeight; config.DialogWidth = DialogWidth; config.ExcludedFolders = ExcludedFolders; config.SelectedPath = SelectedPath; config.StartingPath = ValidationHelper.GetString(StartingPath, "~/"); config.UseRelativeDimensions = UseRelativeDimensions; selFile.AllowEmptyValue = AllowEmptyValue; } }
/// <summary> /// Raises the callback event. /// </summary> public void RaiseCallbackEvent(string eventArgument) { //LoadDisplayValues(eventArgument); // Configure dialog FileSystemDialogConfiguration config = DialogConfig; string width = config.DialogWidth.ToString(); string height = config.DialogHeight.ToString(); if (config.UseRelativeDimensions) { width += "%"; height += "%"; } config.SelectedPath = eventArgument; ApplyProperties(); string url = GetDialogURL(config, SelectedPathPrefix); mHiddenUrl.Value = url; }
protected void Page_Load(object sender, EventArgs e) { // Get strings for controls on page pnlUseFor.GroupingText = GetString("development.formcontrols.usefor"); pnlShowIn.GroupingText = GetString("development.formcontrols.showin"); rfvCodeName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvCodeName"); rfvDisplayName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvDisplayName"); controlId = QueryHelper.GetInteger("controlid", 0); this.plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; if (!RequestHelper.IsPostBack()) { LoadData(); } drpDataType_SelectedIndexChanged(sender, e); chkForBizForms_CheckedChanged(sender, e); // Show 'saved' info message if (QueryHelper.GetString("saved", String.Empty) != String.Empty) { lblInfo.Visible = true; } // Initialize file selector FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; tbFileName.DialogConfig = config; tbFileName.AllowEmptyValue = false; tbFileName.SelectedPathPrefix = "~/CMSFormControls/"; tbFileName.ValidationError = GetString("Development_FormUserControl_Edit.rfvFileName"); }
protected void Page_Load(object sender, EventArgs e) { // Controls initializations rfvDisplayName.ErrorMessage = GetString("InlineControl_Edit.ErrorDisplayName"); rfvName.ErrorMessage = GetString("InlineControl_Edit.ErrorName"); plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; // Get inline control ID from querystring controlId = QueryHelper.GetInteger("inlinecontrolid", 0); InlineControlInfo inlineControlObj = InlineControlInfoProvider.GetInlineControlInfo(controlId); EditedObject = inlineControlObj; // Fill editing form if (!RequestHelper.IsPostBack()) { LoadData(inlineControlObj); if (QueryHelper.GetBoolean("saved", false)) { ShowInformation(GetString("general.changessaved")); } } FileSystemDialogConfiguration config = new FileSystemDialogConfiguration { DefaultPath = "CMSInlineControls", AllowedExtensions = "ascx", ShowFolders = false }; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSInlineControls/"; FileSystemSelector.ValidationError = GetString("InlineControl_Edit.ErrorFileName"); }
/// <summary> /// Applies properties to the dialog configuration /// </summary> private void ApplyProperties() { FileSystemDialogConfiguration config = DialogConfig; // Apply starting path string startingPath = ValidationHelper.GetString(GetValue("StartingPath"), null); if (!String.IsNullOrEmpty(startingPath)) { config.StartingPath = startingPath; } // Apply allowed extensions string allowedExtensions = ValidationHelper.GetString(GetValue("AllowedExtensions"), null); if (!String.IsNullOrEmpty(allowedExtensions)) { config.AllowedExtensions = allowedExtensions; } // Apply allowed extensions string newExtension = ValidationHelper.GetString(GetValue("NewTextFileExtension"), null); if (!String.IsNullOrEmpty(newExtension)) { config.NewTextFileExtension = newExtension; } // Allow management object allowManage = GetValue("AllowManage"); if (allowManage != null) { config.AllowManage = ValidationHelper.GetBoolean(allowManage, false); } }
protected void Page_Load(object sender, EventArgs e) { // Setup page title text and image PageTitle.TitleText = GetString("Development-WebPart_Edit.TitleNew"); // Initialize btnOk.Text = GetString("general.ok"); rfvWebPartDisplayName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorDisplayName"); rfvWebPartName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorWebPartName"); rfvCodeFileName.ErrorMessage = GetString("webpart.codefilenamerequired"); webpartSelector.ShowInheritedWebparts = false; lblWebpartList.Text = GetString("DevelopmentWebPartEdit.InheritedWebPart"); // Set breadcrumbs PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("Development-WebPart_Edit.WebParts"), RedirectUrl = UIContextHelper.GetElementUrl("CMS.Design", "Development.WebParts", false), Target = "_parent" }); PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("Development-WebPart_Edit.New"), }); FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSWebParts/"; FileSystemSelector.DefaultPath = "CMSWebParts"; }
protected void Page_Load(object sender, EventArgs e) { // Get strings for controls on page pnlUseFor.GroupingText = GetString("development.formcontrols.usefor"); pnlShowIn.GroupingText = GetString("development.formcontrols.showin"); rfvCodeName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvCodeName"); rfvDisplayName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvDisplayName"); controlId = QueryHelper.GetInteger("controlid", 0); this.plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; if (!RequestHelper.IsPostBack()) { LoadData(); } drpDataType_SelectedIndexChanged(sender, e); chkForBizForms_CheckedChanged(sender, e); // Show 'saved' info message if (QueryHelper.GetString("saved", String.Empty) != String.Empty) { lblInfo.Visible = true; } // Initialize file selector FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; tbFileName.DialogConfig = config; tbFileName.AllowEmptyValue = false; tbFileName.SelectedPathPrefix = "~/CMSFormControls/"; tbFileName.ValidationError = GetString("Development_FormUserControl_Edit.rfvFileName"); }
/// <summary> /// Applies properties to the dialog configuration /// </summary> private void ApplyProperties() { FileSystemDialogConfiguration config = DialogConfig; // Apply selected path if (!String.IsNullOrEmpty(SelectedPath)) { config.SelectedPath = SelectedPath; } // Apply starting path if (!String.IsNullOrEmpty(StartingPath)) { config.StartingPath = StartingPath; } // Apply default path if (!String.IsNullOrEmpty(DefaultPath)) { config.DefaultPath = DefaultPath; } // Apply allowed extensions if (!String.IsNullOrEmpty(AllowedExtensions)) { config.AllowedExtensions = AllowedExtensions; } // Apply excluded extensions if (!String.IsNullOrEmpty(ExcludedExtensions)) { config.ExcludedExtensions = ExcludedExtensions; } // Apply allowed folders if (!String.IsNullOrEmpty(AllowedFolders)) { config.AllowedFolders = AllowedFolders; } // Apply excluded folders if (!String.IsNullOrEmpty(ExcludedFolders)) { config.ExcludedFolders = ExcludedFolders; } // Apply new text files extensions if (!String.IsNullOrEmpty(NewTextFileExtension)) { config.NewTextFileExtension = NewTextFileExtension; } // Apply dialog width if (DialogWidth > 0) { config.DialogWidth = DialogWidth; } // Apply dialog height if (DialogHeight > 0) { config.DialogHeight = DialogHeight; } // Apply Use relative dimensions if (GetValue("UseRelativeDimensions") != null) { config.UseRelativeDimensions = UseRelativeDimensions; } // Apply starting path if (GetValue("AllowManage") != null) { config.AllowManage = AllowManage; } // Apply starting path if (GetValue("ShowFolders") != null) { config.ShowFolders = ShowFolders; } }
protected void Page_Load(object sender, EventArgs e) { // Controls initializations rfvDisplayName.ErrorMessage = GetString("InlineControl_Edit.ErrorDisplayName"); rfvName.ErrorMessage = GetString("InlineControl_Edit.ErrorName"); plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; // Get inline control ID from querystring controlId = QueryHelper.GetInteger("inlinecontrolid", 0); InlineControlInfo inlineControlObj = InlineControlInfoProvider.GetInlineControlInfo(controlId); EditedObject = inlineControlObj; // Fill editing form if (!RequestHelper.IsPostBack()) { LoadData(inlineControlObj); if (QueryHelper.GetBoolean("saved", false)) { ShowInformation(GetString("general.changessaved")); } } FileSystemDialogConfiguration config = new FileSystemDialogConfiguration { DefaultPath = "CMSInlineControls", AllowedExtensions = "ascx", ShowFolders = false }; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSInlineControls/"; FileSystemSelector.ValidationError = GetString("InlineControl_Edit.ErrorFileName"); }
protected void Page_Load(object sender, EventArgs e) { // Get and check template ID pageTemplateId = QueryHelper.GetInteger("templateid", 0); if (pageTemplateId <= 0) { return; } // Register refresh script string refreshScript = ScriptHelper.GetScript(@"function RefreshContent() { if ((parent != null) && (parent.Refresh != null)) parent.Refresh(); var txtDisplayName = document.getElementById('" + txtTemplateDisplayName.TextBox.ClientID + @"'); var wopener = parent.wopener; if ((wopener != null) && (wopener.SetTemplateName)) wopener.SetTemplateName(txtDisplayName.value); }"); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "pageTemplateRefreshScript", refreshScript); // Hide teaser lblUploadFile.Visible = false; UploadFile.Visible = false; lblTemplateDisplayName.Text = GetString("Administration-PageTemplate_General.TemplateDisplayName"); lblTemplateCodeName.Text = GetString("Administration-PageTemplate_General.TemplateCodeName"); lblTemplateCategory.Text = GetString("Administration-PageTemplate_General.Category"); lblTemplateDescription.Text = GetString("Administration-PageTemplate_General.TemplateDescription"); lblTemplateType.Text = GetString("Administration-PageTemplate_General.Type"); lblShowAsMasterTemplate.Text = GetString("Administration-PageTemplate_General.ShowAsMasterTemplate"); lblInheritLevels.Text = GetString("Administration-PageTemplate_General.InheritLevels"); lblUploadFile.Text = GetString("Administration-PageTemplate_General.lblUpload"); rfvTemplateDisplayName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateDisplayName"); rfvTemplateCodeName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateCodeName"); // New item link string[,] actions = new string[1, 9]; actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[0, 1] = GetString("general.save"); actions[0, 2] = null; actions[0, 3] = null; actions[0, 4] = null; actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); actions[0, 6] = "lnksave_click"; actions[0, 7] = null; actions[0, 8] = "true"; this.CurrentMaster.HeaderActions.LinkCssClass = "ContentSaveLinkButton"; this.CurrentMaster.HeaderActions.Actions = actions; this.CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed); if (!RequestHelper.IsPostBack()) { FillDropDown(); } pti = PageTemplateInfoProvider.GetPageTemplateInfo(pageTemplateId); if (pti != null) { if (!RequestHelper.IsPostBack()) { // Load the initial data LoadData(); lvlElem.Value = pti.InheritPageLevels; lvlElem.Level = 10; } else { // Load just the flags pageTemplateIsReusable = pti.IsReusable; pageTemplateWebParts = pti.WebParts; } // Show teaser if needed if (!pti.DisplayName.ToLower().StartsWith("ad-hoc")) { lblUploadFile.Visible = true; UploadFile.Visible = true; UploadFile.ObjectID = pageTemplateId; UploadFile.ObjectType = PortalObjectType.PAGETEMPLATE; UploadFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; } FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSTemplates"; config.AllowedExtensions = "aspx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSTemplates/"; FileSystemSelector.ValidationError = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateFileName"); // Script for dynamic hiding of inherited levels string script = @" function HideOrShowInheritLevels() { var tr = document.getElementById('" + inheritLevels.ClientID + @"'); if (tr) { var checkbox = document.getElementById('" + chkShowAsMasterTemplate.ClientID + @"') ; if(checkbox != null) { if(checkbox.checked == 1) { tr.style.display = 'none'; } else { tr.style.display = ''; } } } }"; // Hide inherited levels if (chkShowAsMasterTemplate.Checked) { inheritLevels.Style.Add("display", "none"); } else { inheritLevels.Style.Clear(); } // Register script to page ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "showOrHide", ScriptHelper.GetScript(script)); chkShowAsMasterTemplate.Attributes.Add("onclick", "HideOrShowInheritLevels();"); //Page.Focus(); //Page.Form.Focus(); //ScriptHelper.RegisterStartupScript(this, typeof(string), "focus", ScriptHelper.GetScript("document.getElementById('" +Page.Form.ClientID + "').focus();")); } }
/// <summary> /// Returns query string which will be passed to the CMS dialogs (Insert image or media/Insert link). /// </summary> /// <param name="config">Dialog configuration</param> /// <param name="selectedPathPrefix">Path prefix of selected value</param> public string GetDialogURL(FileSystemDialogConfiguration config, string selectedPathPrefix) { StringBuilder builder = new StringBuilder(); // Set constraints // Allowed files extensions if (!String.IsNullOrEmpty(config.AllowedExtensions)) { builder.Append("&allowed_extensions=" + Server.UrlEncode(config.AllowedExtensions)); } // Excluded extensions if (!String.IsNullOrEmpty(config.ExcludedExtensions)) { builder.Append("&excluded_extensions=" + Server.UrlEncode(config.ExcludedExtensions)); } // Allowed folders if (!String.IsNullOrEmpty(config.AllowedFolders)) { builder.Append("&allowed_folders=" + Server.UrlEncode(config.AllowedFolders)); } // Excluded folders if (!String.IsNullOrEmpty(config.ExcludedFolders)) { builder.Append("&excluded_folders=" + Server.UrlEncode(config.ExcludedFolders)); } // Default path-preselected path in filesystem tree if (!String.IsNullOrEmpty(config.DefaultPath)) { builder.Append("&default_path=" + Server.UrlEncode(config.DefaultPath)); } // Deny non-application starting path if (!config.AllowNonApplicationPath) { builder.Append("&allow_nonapp_path=0"); } // SelectedPath - actual value of textbox if (!String.IsNullOrEmpty(config.SelectedPath)) { string selectedPath = config.SelectedPath; if (!(selectedPath.StartsWith("~") || selectedPath.StartsWith("/") || selectedPath.StartsWith(".") || selectedPath.StartsWith("\\")) && ((String.IsNullOrEmpty(config.StartingPath)) || (config.StartingPath.StartsWith("~"))) && (!String.IsNullOrEmpty(selectedPathPrefix))) { selectedPath = selectedPathPrefix.TrimEnd('/') + "/" + selectedPath.TrimStart('/'); } builder.Append("&selected_path=" + Server.UrlEncode(selectedPath)); } // Starting path in filesystem if (!String.IsNullOrEmpty(config.StartingPath)) { builder.Append("&starting_path=" + Server.UrlEncode(config.StartingPath)); } // Show only folders|files builder.Append("&show_folders=" + Server.UrlEncode(config.ShowFolders.ToString())); // Editor client id if (!String.IsNullOrEmpty(config.EditorClientID)) { builder.Append("&editor_clientid=" + Server.UrlEncode(config.EditorClientID)); } // Get hash for complete query string string query = HttpUtility.UrlPathEncode("?" + builder.ToString().TrimStart('&')); string hash = QueryHelper.GetHash(query); // Get complete query string with attached hash string queryString = HttpUtility.UrlPathEncode(URLHelper.EncodeQueryString("?" + builder.Append("&hash=" + hash).ToString().TrimStart('&'))); string baseUrl = "~/CMSFormControls/Selectors/"; // Get complet URL return(ResolveUrl(baseUrl + "SelectFileOrFolder/Default.aspx" + queryString)); }
protected void Page_Load(object sender, EventArgs e) { // Setup page title text and image PageTitle.TitleText = GetString("Development-WebPart_Edit.TitleNew"); // Initialize btnOk.Text = GetString("general.ok"); rfvWebPartDisplayName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorDisplayName"); rfvWebPartName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorWebPartName"); webpartSelector.ShowInheritedWebparts = false; lblWebpartList.Text = GetString("DevelopmentWebPartEdit.InheritedWebPart"); // Set breadcrumbs PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("Development-WebPart_Edit.WebParts"), RedirectUrl = UIContextHelper.GetElementUrl("CMS.Design", "Development.WebParts", false), Target = "_parent" }); PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("Development-WebPart_Edit.New"), }); FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSWebParts/"; FileSystemSelector.DefaultPath = "CMSWebParts"; }
protected void Page_Load(object sender, EventArgs e) { // Get and check template ID pageTemplateId = QueryHelper.GetInteger("templateid", 0); if (pageTemplateId <= 0) { return; } // Register refresh script string refreshScript = ScriptHelper.GetScript(@"function RefreshContent() { if ((parent != null) && (parent.Refresh != null)) parent.Refresh(); var txtDisplayName = document.getElementById('" + txtTemplateDisplayName.TextBox.ClientID + @"'); var wopener = parent.wopener; if ((wopener != null) && (wopener.SetTemplateName)) wopener.SetTemplateName(txtDisplayName.value); }"); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "pageTemplateRefreshScript", refreshScript); // Hide teaser lblUploadFile.Visible = false; UploadFile.Visible = false; lblTemplateDisplayName.Text = GetString("Administration-PageTemplate_General.TemplateDisplayName"); lblTemplateCodeName.Text = GetString("Administration-PageTemplate_General.TemplateCodeName"); lblTemplateCategory.Text = GetString("Administration-PageTemplate_General.Category"); lblTemplateDescription.Text = GetString("Administration-PageTemplate_General.TemplateDescription"); lblTemplateType.Text = GetString("Administration-PageTemplate_General.Type"); lblShowAsMasterTemplate.Text = GetString("Administration-PageTemplate_General.ShowAsMasterTemplate"); lblInheritLevels.Text = GetString("Administration-PageTemplate_General.InheritLevels"); lblUploadFile.Text = GetString("Administration-PageTemplate_General.lblUpload"); rfvTemplateDisplayName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateDisplayName"); rfvTemplateCodeName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateCodeName"); // New item link string[,] actions = new string[1, 9]; actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[0, 1] = GetString("general.save"); actions[0, 2] = null; actions[0, 3] = null; actions[0, 4] = null; actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); actions[0, 6] = "lnksave_click"; actions[0, 7] = null; actions[0, 8] = "true"; this.CurrentMaster.HeaderActions.LinkCssClass = "ContentSaveLinkButton"; this.CurrentMaster.HeaderActions.Actions = actions; this.CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed); if (!RequestHelper.IsPostBack()) { FillDropDown(); } pti = PageTemplateInfoProvider.GetPageTemplateInfo(pageTemplateId); if (pti != null) { if (!RequestHelper.IsPostBack()) { // Load the initial data LoadData(); lvlElem.Value = pti.InheritPageLevels; lvlElem.Level = 10; } else { // Load just the flags pageTemplateIsReusable = pti.IsReusable; pageTemplateWebParts = pti.WebParts; } // Show teaser if needed if (!pti.DisplayName.ToLower().StartsWith("ad-hoc")) { lblUploadFile.Visible = true; UploadFile.Visible = true; UploadFile.ObjectID = pageTemplateId; UploadFile.ObjectType = PortalObjectType.PAGETEMPLATE; UploadFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; } FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSTemplates"; config.AllowedExtensions = "aspx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSTemplates/"; FileSystemSelector.ValidationError = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateFileName"); // Script for dynamic hiding of inherited levels string script = @" function HideOrShowInheritLevels() { var tr = document.getElementById('" + inheritLevels.ClientID + @"'); if (tr) { var checkbox = document.getElementById('" + chkShowAsMasterTemplate.ClientID + @"') ; if(checkbox != null) { if(checkbox.checked == 1) { tr.style.display = 'none'; } else { tr.style.display = ''; } } } }"; // Hide inherited levels if (chkShowAsMasterTemplate.Checked) { inheritLevels.Style.Add("display", "none"); } else { inheritLevels.Style.Clear(); } // Register script to page ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "showOrHide", ScriptHelper.GetScript(script)); chkShowAsMasterTemplate.Attributes.Add("onclick", "HideOrShowInheritLevels();"); //Page.Focus(); //Page.Form.Focus(); //ScriptHelper.RegisterStartupScript(this, typeof(string), "focus", ScriptHelper.GetScript("document.getElementById('" +Page.Form.ClientID + "').focus();")); } }
protected void Page_Load(object sender, EventArgs e) { // Get strings for controls on page pnlGeneral.GroupingText = GetString("general.general"); pnlControlScope.GroupingText = GetString("development.formcontrols.controlscope"); rfvCodeName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvCodeName"); rfvDisplayName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvDisplayName"); controlId = QueryHelper.GetInteger("controlid", 0); plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; if (!RequestHelper.IsPostBack()) { LoadData(); } drpDataType_SelectedIndexChanged(sender, e); chkForBizForms_CheckedChanged(sender, e); // Show 'saved' info message if (QueryHelper.GetString("saved", String.Empty) != String.Empty) { ShowChangesSaved(); } // Initialize file selector FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; tbFileName.DialogConfig = config; tbFileName.AllowEmptyValue = false; tbFileName.SelectedPathPrefix = "~/CMSFormControls/"; tbFileName.ValidationError = GetString("Development_FormUserControl_Edit.rfvFileName"); UploadFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; UploadFile.ObjectID = controlId; UploadFile.ObjectType = SiteObjectType.FORMUSERCONTROL; }
protected void Page_Load(object sender, EventArgs e) { lbWebPartCategory.Text = GetString("Development-WebPart_Edit.WebPartCategory"); lblWebPartType.Text = GetString("Development-WebPart_Edit.WebPartType"); lblUploadFile.Text = GetString("Development-WebPart_Edit.lblUpload"); btnOk.Text = GetString("general.ok"); rfvWebPartDisplayName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorDisplayName"); rfvWebPartName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorWebPartName"); lblLoadGeneration.Text = GetString("LoadGeneration.Title"); plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; // Get the webpart ID webPartId = QueryHelper.GetInteger("webpartID", 0); WebPartInfo wi = null; // fill in the form, edit webpart if (!RequestHelper.IsPostBack()) { // Fill webpart type drop down list DataHelper.FillListControlWithEnum(typeof(WebPartTypeEnum), drpWebPartType, "Development-WebPart_Edit.Type", null); // edit web part if (webPartId > 0) { wi = WebPartInfoProvider.GetWebPartInfo(webPartId); EditedObject = wi; if (wi != null) { txtWebPartDescription.Text = wi.WebPartDescription; txtWebPartDisplayName.Text = wi.WebPartDisplayName; FileSystemSelector.Value = wi.WebPartFileName; txtWebPartName.Text = wi.WebPartName; drpWebPartType.SelectedValue = wi.WebPartType.ToString(); chkSkipInsertProperties.Checked = wi.WebPartSkipInsertProperties; drpGeneration.Value = wi.WebPartLoadGeneration; drpModule.Value = wi.WebPartResourceID; if (wi.WebPartParentID != 0) { WebPartInfo parentInfo = WebPartInfoProvider.GetWebPartInfo(wi.WebPartParentID); if (parentInfo != null) { txtInheritedName.Text = parentInfo.WebPartDisplayName; } plcFileSystemSelector.Visible = false; plcInheritedName.Visible = true; lblWebPartFileName.ResourceString = "DevelopmentWebPartGeneral.InheritedWebPart"; } WebPartCategoryInfo ci = WebPartCategoryInfoProvider.GetWebPartCategoryInfoById(wi.WebPartCategoryID); if (ci != null) { categorySelector.Value = ci.CategoryID.ToString(); } // Init file uploader lblUploadFile.Visible = true; attachmentFile.Visible = true; attachmentFile.ObjectID = webPartId; attachmentFile.ObjectType = PortalObjectType.WEBPART; attachmentFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; } } else { int parentCategoryId = QueryHelper.GetInteger("parentId", 0); categorySelector.Value = parentCategoryId.ToString(); lblUploadFile.Visible = false; attachmentFile.Visible = false; } } // Initialize the master page elements Title = "Web parts - Edit"; FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.StartingPath = "~/CMSWebParts/"; config.DefaultPath = "CMSWebParts"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSWebParts/"; }
/// <summary> /// Initialization from query string. /// </summary> public void InitFromQueryString() { // Get allowed and excluded folders and extensions FileSystemDialogConfiguration config = Config; Hashtable p; var paramsGuid = QueryHelper.GetString("params", ""); if (!String.IsNullOrEmpty(paramsGuid)) { // Try to get parameters p = (Hashtable)WindowHelper.GetItem(paramsGuid, true); // ... and validate hash if ((p == null) || !QueryHelper.ValidateHash("hash", "selectedvalue")) { // Redirect to error page URLHelper.Redirect(UIHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext")); return; } } else { p = new Hashtable(); } config.AllowManage = ValidationHelper.GetBoolean(GetParameter(p, "allow_manage"), config.AllowManage); config.AllowedExtensions = ValidationHelper.GetString(GetParameter(p, "allowed_extensions"), config.AllowedExtensions); config.NewTextFileExtension = ValidationHelper.GetString(GetParameter(p, "newfile_extension"), config.NewTextFileExtension); config.AllowedFolders = ValidationHelper.GetString(GetParameter(p, "allowed_folders"), config.AllowedFolders); config.ExcludedExtensions = ValidationHelper.GetString(GetParameter(p, "excluded_extensions"), config.ExcludedExtensions); config.ExcludedFolders = ValidationHelper.GetString(GetParameter(p, "excluded_folders"), config.ExcludedFolders); config.AllowNonApplicationPath = ValidationHelper.GetBoolean(GetParameter(p, "allow_nonapp_path"), config.AllowNonApplicationPath); // Get starting path var startingPath = ValidationHelper.GetString(GetParameter(p, "starting_path"), "~/"); if (startingPath.StartsWithCSafe("~") && (startingPath != "~/")) { startingPath = startingPath.TrimEnd('/'); } else { // If only application path allowed, set it if (!config.AllowNonApplicationPath) { string startPath = startingPath; if (startingPath.StartsWithCSafe("~")) { startPath = Server.MapPath(startingPath); } if (!startPath.StartsWithCSafe(Server.MapPath("~/"))) { startingPath = "~/"; } } else if (!startingPath.EndsWithCSafe(":\\")) { startingPath = startingPath.TrimEnd('\\'); } } config.StartingPath = startingPath; // Get selected path var selectedPath = ValidationHelper.GetString(GetParameter(p, "selected_path"), String.Empty); // If starting path under website try to map selected path if (startingPath.StartsWithCSafe("~") && !String.IsNullOrEmpty(selectedPath)) { try { selectedPath = Server.MapPath(selectedPath).Replace(Server.MapPath(startingPath).TrimEnd('\\'), startingPath); } catch { } } // Fix slashes selectedPath = selectedPath.StartsWithCSafe("~") ? Path.EnsureSlashes(selectedPath, true) : Path.EnsureBackslashes(selectedPath, true); config.SelectedPath = selectedPath; // Get default path config.DefaultPath = ValidationHelper.GetString(GetParameter(p, "default_path"), String.Empty); string origDefaultPath = config.DefaultPath; if (selectedPath.StartsWithCSafe(startingPath)) { // item to be selected string selectedItem = config.SelectedPath.Replace(startingPath, string.Empty); char slashChar = '\\'; if (selectedPath.StartsWithCSafe("~")) { slashChar = '/'; } selectedItem = selectedItem.TrimStart(slashChar).TrimEnd(slashChar); if (selectedItem.LastIndexOfCSafe(slashChar) != -1) { selectedItem = selectedItem.Substring(0, selectedItem.LastIndexOfCSafe(slashChar)); } config.DefaultPath = selectedItem; } string defaultPath = String.Format("{0}\\{1}", startingPath, config.DefaultPath); if (startingPath.StartsWithCSafe("~")) { try { defaultPath = Server.MapPath(defaultPath); } catch { // Set default path defaultPath = string.Empty; } } if (!Directory.Exists(defaultPath)) { try { defaultPath = Server.MapPath(String.Format("{0}\\{1}", startingPath, origDefaultPath)); } catch { // Set default path defaultPath = string.Empty; } config.DefaultPath = Directory.Exists(defaultPath) ? origDefaultPath : string.Empty; } // Get mode config.ShowFolders = ValidationHelper.GetBoolean(GetParameter(p, "show_folders"), false); config.AllowZipFolders = ValidationHelper.GetBoolean(GetParameter(p, "allow_zip_folders"), false); }
/// <summary> /// Initialization from query string. /// </summary> public void InitFromQueryString() { // Get allowed and excluded folders and extensions FileSystemDialogConfiguration config = Config; config.AllowManage = QueryHelper.GetBoolean("allow_manage", config.AllowManage); config.AllowedExtensions = QueryHelper.GetString("allowed_extensions", config.AllowedExtensions); config.NewTextFileExtension = QueryHelper.GetString("newfile_extension", config.NewTextFileExtension); config.AllowedFolders = QueryHelper.GetString("allowed_folders", config.AllowedFolders); config.ExcludedExtensions = QueryHelper.GetString("excluded_extensions", config.ExcludedExtensions); config.ExcludedFolders = QueryHelper.GetString("excluded_folders", config.ExcludedFolders); config.AllowNonApplicationPath = QueryHelper.GetBoolean("allow_nonapp_path", config.AllowNonApplicationPath); // Get starting path var startingPath = QueryHelper.GetString("starting_path", "~/"); if (startingPath.StartsWithCSafe("~") && (startingPath != "~/")) { startingPath = startingPath.TrimEnd('/'); } else { // If only application path allowed, set it if (!config.AllowNonApplicationPath) { string startPath = startingPath; if (startingPath.StartsWithCSafe("~")) { startPath = Server.MapPath(startingPath); } if (!startPath.StartsWithCSafe(Server.MapPath("~/"))) { startingPath = "~/"; } } else if (!startingPath.EndsWithCSafe(":\\")) { startingPath = startingPath.TrimEnd('\\'); } } config.StartingPath = startingPath; // Get selected path var selectedPath = QueryHelper.GetString("selected_path", String.Empty); // If starting path under website try to map selected path if (startingPath.StartsWithCSafe("~") && !String.IsNullOrEmpty(selectedPath)) { try { selectedPath = Server.MapPath(selectedPath).Replace(Server.MapPath(startingPath).TrimEnd('\\'), startingPath); } catch { } } // Fix slashes selectedPath = selectedPath.StartsWithCSafe("~") ? Path.EnsureSlashes(selectedPath, true) : Path.EnsureBackslashes(selectedPath, true); config.SelectedPath = selectedPath; // Get default path config.DefaultPath = QueryHelper.GetString("default_path", String.Empty); string origDefaultPath = config.DefaultPath; if (selectedPath.StartsWithCSafe(startingPath)) { // item to be selected string selectedItem = config.SelectedPath.Replace(startingPath, string.Empty); char slashChar = '\\'; if (selectedPath.StartsWithCSafe("~")) { slashChar = '/'; } selectedItem = selectedItem.TrimStart(slashChar).TrimEnd(slashChar); if (selectedItem.LastIndexOfCSafe(slashChar) != -1) { selectedItem = selectedItem.Substring(0, selectedItem.LastIndexOfCSafe(slashChar)); } config.DefaultPath = selectedItem; } string defaultPath = String.Format("{0}\\{1}", startingPath, config.DefaultPath); if (startingPath.StartsWithCSafe("~")) { try { defaultPath = Server.MapPath(defaultPath); } catch { // Set default path defaultPath = string.Empty; } } if (!Directory.Exists(defaultPath)) { try { defaultPath = Server.MapPath(String.Format("{0}\\{1}", startingPath, origDefaultPath)); } catch { // Set default path defaultPath = string.Empty; } config.DefaultPath = Directory.Exists(defaultPath) ? origDefaultPath : string.Empty; } // Get mode config.ShowFolders = QueryHelper.GetBoolean("show_folders", false); }
/// <summary> /// Returns query string which will be passed to the CMS dialogs (Insert image or media/Insert link). /// </summary> /// <param name="config">Dialog configuration</param> /// <param name="selectedPathPrefix">Path prefix of selected value</param> public string GetDialogURL(FileSystemDialogConfiguration config, string selectedPathPrefix) { StringBuilder builder = new StringBuilder(); // Set constraints // Allowed files extensions if (!String.IsNullOrEmpty(config.AllowedExtensions)) { builder.Append("&allowed_extensions=" + Server.UrlEncode(config.AllowedExtensions)); } // Excluded extensions if (!String.IsNullOrEmpty(config.ExcludedExtensions)) { builder.Append("&excluded_extensions=" + Server.UrlEncode(config.ExcludedExtensions)); } // Allowed folders if (!String.IsNullOrEmpty(config.AllowedFolders)) { builder.Append("&allowed_folders=" + Server.UrlEncode(config.AllowedFolders)); } // Excluded folders if (!String.IsNullOrEmpty(config.ExcludedFolders)) { builder.Append("&excluded_folders=" + Server.UrlEncode(config.ExcludedFolders)); } // Default path-preselected path in filesystem tree if (!String.IsNullOrEmpty(config.DefaultPath)) { builder.Append("&default_path=" + Server.UrlEncode(config.DefaultPath)); } // Deny non-application starting path if (!config.AllowNonApplicationPath) { builder.Append("&allow_nonapp_path=0"); } // SelectedPath - actual value of textbox if (!String.IsNullOrEmpty(config.SelectedPath)) { string selectedPath = config.SelectedPath; if (!(selectedPath.StartsWith("~") || selectedPath.StartsWith("/") || selectedPath.StartsWith(".") || selectedPath.StartsWith("\\")) && ((String.IsNullOrEmpty(config.StartingPath)) || (config.StartingPath.StartsWith("~"))) && (!String.IsNullOrEmpty(selectedPathPrefix))) { selectedPath = selectedPathPrefix.TrimEnd('/') + "/" + selectedPath.TrimStart('/'); } builder.Append("&selected_path=" + Server.UrlEncode(selectedPath)); } // Starting path in filesystem if (!String.IsNullOrEmpty(config.StartingPath)) { builder.Append("&starting_path=" + Server.UrlEncode(config.StartingPath)); } // Show only folders|files builder.Append("&show_folders=" + Server.UrlEncode(config.ShowFolders.ToString())); // Editor client id if (!String.IsNullOrEmpty(config.EditorClientID)) { builder.Append("&editor_clientid=" + Server.UrlEncode(config.EditorClientID)); } // Get hash for complete query string string query = HttpUtility.UrlPathEncode("?" + builder.ToString().TrimStart('&')); string hash = QueryHelper.GetHash(query); // Get complete query string with attached hash string queryString = HttpUtility.UrlPathEncode(URLHelper.EncodeQueryString("?" + builder.Append("&hash=" + hash).ToString().TrimStart('&'))); string baseUrl = "~/CMSFormControls/Selectors/"; // Get complet URL return ResolveUrl(baseUrl + "SelectFileOrFolder/Default.aspx" + queryString); }
/// <summary> /// Returns query string which will be passed to the CMS dialogs (Insert image or media/Insert link). /// </summary> /// <param name="config">Dialog configuration</param> /// <param name="selectedPathPrefix">Path prefix of selected value</param> public string GetDialogURL(FileSystemDialogConfiguration config, string selectedPathPrefix) { StringBuilder builder = new StringBuilder(); var p = new Hashtable(); if (!String.IsNullOrEmpty(config.AllowedExtensions)) { p["allowed_extensions"] = config.AllowedExtensions; } // New text file extension if (!String.IsNullOrEmpty(config.NewTextFileExtension)) { p["newfile_extension"] = config.NewTextFileExtension; } // Excluded extensions if (!String.IsNullOrEmpty(config.ExcludedExtensions)) { p["excluded_extensions"] = config.ExcludedExtensions; } // Allowed folders if (!String.IsNullOrEmpty(config.AllowedFolders)) { p["allowed_folders"] = config.AllowedFolders; } // Excluded folders if (!String.IsNullOrEmpty(config.ExcludedFolders)) { p["excluded_folders"] = config.ExcludedFolders; } // Default path-preselected path in filesystem tree if (!String.IsNullOrEmpty(config.DefaultPath)) { p["default_path"] = config.DefaultPath; } // Deny non-application starting path if (!config.AllowNonApplicationPath) { p["allow_nonapp_path"] = "0"; } // Allow manage if (config.AllowManage) { p["allow_manage"] = "1"; } // SelectedPath - actual value of textbox if (!String.IsNullOrEmpty(config.SelectedPath)) { string selectedPath = config.SelectedPath; if (!(selectedPath.StartsWithCSafe("~") || selectedPath.StartsWithCSafe("/") || selectedPath.StartsWithCSafe(".") || selectedPath.StartsWithCSafe("\\")) && ((String.IsNullOrEmpty(config.StartingPath)) || (config.StartingPath.StartsWithCSafe("~"))) && (!String.IsNullOrEmpty(selectedPathPrefix))) { selectedPath = selectedPathPrefix.TrimEnd('/') + "/" + selectedPath.TrimStart('/'); } p["selected_path"] = selectedPath; } // Starting path in filesystem if (!String.IsNullOrEmpty(config.StartingPath)) { p["starting_path"] = config.StartingPath; } // Show only folders|files p["show_folders"] = config.ShowFolders.ToString(); p["allow_zip_folders"] = config.AllowZipFolders.ToString(); // Editor client id if (!String.IsNullOrEmpty(config.EditorClientID)) { builder.Append("&editor_clientid=" + Server.UrlEncode(config.EditorClientID)); } // Register parameters within Window helper var paramsGuid = Guid.NewGuid().ToString(); WindowHelper.Add(paramsGuid, p, true); builder.Append("¶ms=", Server.UrlEncode(paramsGuid)); // Get the query string query = HttpUtility.UrlPathEncode("?" + builder.ToString().TrimStart('&')); // Get complete query string with attached hash query = URLHelper.AddParameterToUrl(query, "hash", QueryHelper.GetHash(query)); const string baseUrl = "~/CMSFormControls/Selectors/"; // Get complete URL return ResolveUrl(baseUrl + "SelectFileOrFolder/Default.aspx" + query); }
protected void Page_Load(object sender, EventArgs e) { if (!RequestHelper.IsPostBack()) { drpTypeSelector.ControlType = FormUserControlTypeEnum.Input; } CurrentMaster.DisplaySiteSelectorPanel = true; rfvControlName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvCodeName"); rfvControlDisplayName.ErrorMessage = GetString("Development_FormUserControl_Edit.rfvDisplayName"); // Initialize breadcrumbs string[,] breadcrumbs = new string[2,3]; breadcrumbs[0, 0] = GetString("Development_FormUserControl_Edit.Controls"); breadcrumbs[0, 1] = "~/CMSModules/FormControls/Pages/Development/List.aspx"; breadcrumbs[0, 2] = ""; breadcrumbs[1, 0] = GetString("Development_FormUserControl_Edit.New"); breadcrumbs[1, 1] = ""; breadcrumbs[1, 2] = ""; // Initialize page CurrentMaster.Title.Breadcrumbs = breadcrumbs; CurrentMaster.Title.TitleText = GetString("Development_FormUserControl_Edit.Title"); CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_FormControl/new.png"); CurrentMaster.Title.HelpTopicName = "new_form_control"; CurrentMaster.Title.HelpName = "helpTopic"; // Initialize file selector FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSFormControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; tbFileName.DialogConfig = config; tbFileName.AllowEmptyValue = false; tbFileName.SelectedPathPrefix = "~/CMSFormControls/"; tbFileName.ValidationError = GetString("Development_FormUserControl_Edit.rfvFileName"); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); dialog = QueryHelper.GetBoolean("dialog", false); // Check template ID if (PageTemplateID <= 0) { return; } // Register refresh script string refreshScript = ScriptHelper.GetScript( @" function RefreshContent() { if ((parent != null) && (parent.Refresh != null)) parent.Refresh(); var txtDisplayName = document.getElementById('" + txtTemplateDisplayName.TextBox.ClientID + @"'); var wopener = parent.wopener; if ((wopener != null) && (wopener.SetTemplateName)) wopener.SetTemplateName(txtDisplayName.value); } " ); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "pageTemplateRefreshScript", refreshScript); // Hide teaser lblUploadFile.Visible = false; UploadFile.Visible = false; lblTemplateDisplayName.Text = GetString("Administration-PageTemplate_General.TemplateDisplayName"); lblTemplateCodeName.Text = GetString("Administration-PageTemplate_General.TemplateCodeName"); lblTemplateCategory.Text = GetString("Administration-PageTemplate_General.Category"); lblTemplateDescription.Text = GetString("Administration-PageTemplate_General.TemplateDescription"); lblTemplateType.Text = GetString("Administration-PageTemplate_General.Type"); lblShowAsMasterTemplate.Text = GetString("Administration-PageTemplate_General.ShowAsMasterTemplate"); lblInheritLevels.Text = GetString("Administration-PageTemplate_General.InheritLevels"); lblUploadFile.Text = GetString("Administration-PageTemplate_General.lblUpload"); rfvTemplateDisplayName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateDisplayName"); rfvTemplateCodeName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateCodeName"); pnlObjectLocking.ObjectManager.OnSaveData += new EventHandler <SimpleObjectManagerEventArgs>(ObjectManager_OnSaveData); pnlObjectLocking.ObjectManager.OnAfterAction += new EventHandler <SimpleObjectManagerEventArgs>(ObjectManager_OnAfterAction); if (!RequestHelper.IsPostBack()) { FillDropDown(); } if (PageTemplate != null) { plcAdHoc.Visible = (PageTemplate.PageTemplateType == PageTemplateTypeEnum.Portal) && PageTemplate.IsReusable; if (!RequestHelper.IsPostBack()) { // Load the initial data LoadData(); lvlElem.Value = PageTemplate.InheritPageLevels; } else { // Load just the flags pageTemplateIsReusable = PageTemplate.IsReusable; pageTemplateWebParts = PageTemplate.WebParts; } // Show teaser if needed if (!PageTemplate.DisplayName.ToLowerCSafe().StartsWithCSafe("ad-hoc")) { lblUploadFile.Visible = true; UploadFile.Visible = true; UploadFile.ObjectID = PageTemplateID; UploadFile.ObjectType = PortalObjectType.PAGETEMPLATE; UploadFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; } FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSTemplates"; config.AllowedExtensions = "aspx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSTemplates/"; FileSystemSelector.ValidationError = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateFileName"); // Script for dynamic hiding of inherited levels string script = @" function HideOrShowInheritLevels() { var tr = document.getElementById('" + inheritLevels.ClientID + @"'); if (tr) { var checkbox = document.getElementById('" + chkShowAsMasterTemplate.ClientID + @"') ; if(checkbox != null) { if(checkbox.checked == 1) { tr.style.display = 'none'; } else { tr.style.display = ''; } } } } " ; // Hide inherited levels if (chkShowAsMasterTemplate.Checked) { inheritLevels.Style.Add("display", "none"); } else { inheritLevels.Style.Clear(); } // Register script to page ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "showOrHide", ScriptHelper.GetScript(script)); chkShowAsMasterTemplate.Attributes.Add("onclick", "HideOrShowInheritLevels();"); } }
protected void Page_Load(object sender, EventArgs e) { // Control initializations rfvDisplayName.ErrorMessage = GetString("InlineControl_Edit.ErrorDisplayName"); rfvName.ErrorMessage = GetString("InlineControl_Edit.ErrorName"); // Check 'Assign with current web site' check box if ((CMSContext.CurrentSite != null) && (!RequestHelper.IsPostBack())) { chkAssign.Text = GetString("General.AssignWithWebSite") + " " + CMSContext.CurrentSite.DisplayName; chkAssign.Checked = true; chkAssign.Visible = true; } // Initializes page title control string[,] pageTitleTabs = new string[2, 3]; pageTitleTabs[0, 0] = GetString("InlineControl_Edit.ItemListLink"); pageTitleTabs[0, 1] = "~/CMSModules/InlineControls/Pages/Development/List.aspx"; pageTitleTabs[0, 2] = string.Empty; pageTitleTabs[1, 0] = GetString("InlineControl_Edit.NewItemCaption"); pageTitleTabs[1, 1] = string.Empty; pageTitleTabs[1, 2] = string.Empty; CurrentMaster.Title.Breadcrumbs = pageTitleTabs; CurrentMaster.Title.TitleText = GetString("Edit.NewControl"); CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_InlineControl/new.png"); CurrentMaster.Title.HelpTopicName = "new_control"; CurrentMaster.Title.HelpName = "helpTopic"; FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSInlineControls"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSInlineControls/"; FileSystemSelector.ValidationError = GetString("Edit.ErrorFileName"); }
protected void Page_Load(object sender, EventArgs e) { lbWebPartCategory.Text = GetString("Development-WebPart_Edit.WebPartCategory"); lblWebPartType.Text = GetString("Development-WebPart_Edit.WebPartType"); lblUploadFile.Text = GetString("Development-WebPart_Edit.lblUpload"); btnOk.Text = GetString("general.ok"); rfvWebPartDisplayName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorDisplayName"); rfvWebPartName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorWebPartName"); this.lblLoadGeneration.Text = GetString("LoadGeneration.Title"); this.plcDevelopment.Visible = SettingsKeyProvider.DevelopmentMode; // Get the webpart ID webPartId = QueryHelper.GetInteger("webpartID", 0); WebPartInfo wi = null; // fill in the form, edit webpart if (!RequestHelper.IsPostBack()) { // Fill webpart type drop down list DataHelper.FillListControlWithEnum(typeof(WebPartTypeEnum), drpWebPartType, "Development-WebPart_Edit.Type", null); // edit web part if (webPartId > 0) { wi = WebPartInfoProvider.GetWebPartInfo(webPartId); if (wi != null) { txtWebPartDescription.Text = wi.WebPartDescription; txtWebPartDisplayName.Text = wi.WebPartDisplayName; FileSystemSelector.Value = wi.WebPartFileName; txtWebPartName.Text = wi.WebPartName; drpWebPartType.SelectedValue = wi.WebPartType.ToString(); drpGeneration.Value = wi.WebPartLoadGeneration; drpModule.Value = wi.WebPartResourceID; if (wi.WebPartParentID != 0) { WebPartInfo parentInfo = WebPartInfoProvider.GetWebPartInfo(wi.WebPartParentID); if (parentInfo != null) { txtInheritedName.Text = parentInfo.WebPartDisplayName; } plcFileSystemSelector.Visible = false; plcInheritedName.Visible = true; lblWebPartFileName.ResourceString = "DevelopmentWebPartGeneral.InheritedWebPart"; } WebPartCategoryInfo ci = WebPartCategoryInfoProvider.GetWebPartCategoryInfoById(wi.WebPartCategoryID); if (ci != null) { categorySelector.Value = ci.CategoryID.ToString(); } // Init file uploader lblUploadFile.Visible = true; attachmentFile.Visible = true; attachmentFile.ObjectID = webPartId; attachmentFile.ObjectType = PortalObjectType.WEBPART; attachmentFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; } } else { int parentCategoryId = QueryHelper.GetInteger("parentId", 0); categorySelector.Value = parentCategoryId.ToString(); lblUploadFile.Visible = false; attachmentFile.Visible = false; } } // Initialize the master page elements this.Title = "Web parts - Edit"; FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSWebParts"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSWebParts/"; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); dialog = QueryHelper.GetBoolean("dialog", false); // Check template ID if (PageTemplateID <= 0) { return; } // Register refresh script string refreshScript = ScriptHelper.GetScript( @" function RefreshContent() { if ((parent != null) && (parent.Refresh != null)) parent.Refresh(); var txtDisplayName = document.getElementById('" + txtTemplateDisplayName.TextBox.ClientID + @"'); var wopener = parent.wopener; if ((wopener != null) && (wopener.SetTemplateName)) wopener.SetTemplateName(txtDisplayName.value); } " ); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "pageTemplateRefreshScript", refreshScript); // Hide teaser lblUploadFile.Visible = false; UploadFile.Visible = false; lblTemplateDisplayName.Text = GetString("Administration-PageTemplate_General.TemplateDisplayName"); lblTemplateCodeName.Text = GetString("Administration-PageTemplate_General.TemplateCodeName"); lblTemplateCategory.Text = GetString("Administration-PageTemplate_General.Category"); lblTemplateDescription.Text = GetString("Administration-PageTemplate_General.TemplateDescription"); lblTemplateType.Text = GetString("Administration-PageTemplate_General.Type"); lblShowAsMasterTemplate.Text = GetString("Administration-PageTemplate_General.ShowAsMasterTemplate"); lblInheritLevels.Text = GetString("Administration-PageTemplate_General.InheritLevels"); lblUploadFile.Text = GetString("Administration-PageTemplate_General.lblUpload"); rfvTemplateDisplayName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateDisplayName"); rfvTemplateCodeName.ErrorMessage = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateCodeName"); pnlObjectLocking.ObjectManager.OnSaveData += new EventHandler<SimpleObjectManagerEventArgs>(ObjectManager_OnSaveData); pnlObjectLocking.ObjectManager.OnAfterAction += new EventHandler<SimpleObjectManagerEventArgs>(ObjectManager_OnAfterAction); if (!RequestHelper.IsPostBack()) { FillDropDown(); } if (PageTemplate != null) { plcAdHoc.Visible = (PageTemplate.PageTemplateType == PageTemplateTypeEnum.Portal) && PageTemplate.IsReusable; if (!RequestHelper.IsPostBack()) { // Load the initial data LoadData(); lvlElem.Value = PageTemplate.InheritPageLevels; } else { // Load just the flags pageTemplateIsReusable = PageTemplate.IsReusable; pageTemplateWebParts = PageTemplate.WebParts; } // Show teaser if needed if (!PageTemplate.DisplayName.ToLowerCSafe().StartsWithCSafe("ad-hoc")) { lblUploadFile.Visible = true; UploadFile.Visible = true; UploadFile.ObjectID = PageTemplateID; UploadFile.ObjectType = PortalObjectType.PAGETEMPLATE; UploadFile.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; } FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSTemplates"; config.AllowedExtensions = "aspx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSTemplates/"; FileSystemSelector.ValidationError = GetString("Administration-PageTemplate_General.ErrorEmptyTemplateFileName"); // Script for dynamic hiding of inherited levels string script = @" function HideOrShowInheritLevels() { var tr = document.getElementById('" + inheritLevels.ClientID + @"'); if (tr) { var checkbox = document.getElementById('" + chkShowAsMasterTemplate.ClientID + @"') ; if(checkbox != null) { if(checkbox.checked == 1) { tr.style.display = 'none'; } else { tr.style.display = ''; } } } } " ; // Hide inherited levels if (chkShowAsMasterTemplate.Checked) { inheritLevels.Style.Add("display", "none"); } else { inheritLevels.Style.Clear(); } // Register script to page ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "showOrHide", ScriptHelper.GetScript(script)); chkShowAsMasterTemplate.Attributes.Add("onclick", "HideOrShowInheritLevels();"); } }
/// <summary> /// Setups the control. /// </summary> private void SetupControl() { // Get path string filePath = Path; if (string.IsNullOrEmpty(filePath)) { IThemeInfo themeObject = UIContext.EditedObject as IThemeInfo; if (themeObject != null) { // Get the specific theme path for the current theme object filePath = themeObject.GetThemePath(); } else { // Use the general theme path filePath = "~/App_Themes/"; } } // Setup the file system browser if (!String.IsNullOrEmpty(filePath)) { string absoluteFilePath = string.Empty; try { absoluteFilePath = Server.MapPath(filePath); } catch (Exception ex) { selFile.Visible = false; ShowError(ex.Message); return; } // Create folder if does not exist if (!Directory.Exists(absoluteFilePath)) { Directory.CreateDirectory(absoluteFilePath); } // Setup the browser FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.StartingPath = filePath; config.AllowedExtensions = AllowedExtensions; config.NewTextFileExtension = NewTextFileExtension; config.ShowFolders = false; config.AllowManage = true; selFile.Config = config; } }
protected void Page_Load(object sender, EventArgs e) { // Setup page title text and image this.CurrentMaster.Title.TitleText = GetString("Development-WebPart_Edit.TitleNew"); this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_WebPart/new.png"); this.CurrentMaster.Title.HelpTopicName = "new_web_part"; this.CurrentMaster.Title.HelpName = "helpTopic"; // Initialize btnOk.Text = GetString("general.ok"); rfvWebPartDisplayName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorDisplayName"); rfvWebPartName.ErrorMessage = GetString("Development-WebPart_Edit.ErrorWebPartName"); webpartSelector.ShowInheritedWebparts = false; radNewWebPart.Text = GetString("developmentwebparteditnewwepart"); radInherited.Text = GetString("Development-WebPart_Edit.Inherited"); lblWebpartList.Text = GetString("DevelopmentWebPartEdit.InheritedWebPart"); // Set breadcrumbs int i = 0; pageTitleTabs[i, 0] = GetString("Development-WebPart_Edit.WebParts"); pageTitleTabs[i, 1] = URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/WebParts/Development/Category_Frameset.aspx"); pageTitleTabs[i, 2] = ""; pageTitleTabs[i, 3] = "if (parent.frames['webparttree']) { parent.frames['webparttree'].location.href = '" + URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/WebParts/Development/WebPart_Tree.aspx") + "'; }"; i++; int parentid = QueryHelper.GetInteger("parentid", 0); WebPartCategoryInfo categoryInfo = WebPartCategoryInfoProvider.GetWebPartCategoryInfoById(parentid); // Check if the parent category is a root category, if not => display both (root + parent) if ((categoryInfo != null) && (categoryInfo.CategoryParentID != 0)) { // Add a cetegory tab pageTitleTabs[i, 0] = HTMLHelper.HTMLEncode(categoryInfo.CategoryDisplayName); pageTitleTabs[i, 1] = URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/WebParts/Development/Category_Frameset.aspx") + "?categoryid=" + categoryInfo.CategoryID; pageTitleTabs[i, 2] = ""; i++; } pageTitleTabs[i, 0] = GetString("Development-WebPart_Edit.New"); pageTitleTabs[i, 1] = ""; pageTitleTabs[i, 2] = ""; this.CurrentMaster.Title.Breadcrumbs = pageTitleTabs; FileSystemDialogConfiguration config = new FileSystemDialogConfiguration(); config.DefaultPath = "CMSWebParts"; config.AllowedExtensions = "ascx"; config.ShowFolders = false; FileSystemSelector.DialogConfig = config; FileSystemSelector.AllowEmptyValue = false; FileSystemSelector.SelectedPathPrefix = "~/CMSWebParts/"; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (StopProcessing) { // Do nothing return; } // Setup file system selector var config = new FileSystemDialogConfiguration { AllowedExtensions = "ascx", ShowFolders = false, }; ucFileSystemSelector.DialogConfig = config; if (!RequestHelper.IsPostBack() && !controlsLoaded) { // Initial load LoadControls(ControlPath); } }
/// <summary> /// Returns query string which will be passed to the CMS dialogs (Insert image or media/Insert link). /// </summary> /// <param name="config">Dialog configuration</param> /// <param name="selectedPathPrefix">Path prefix of selected value</param> public string GetDialogURL(FileSystemDialogConfiguration config, string selectedPathPrefix) { StringBuilder builder = new StringBuilder(); var p = new Hashtable(); if (!String.IsNullOrEmpty(config.AllowedExtensions)) { p["allowed_extensions"] = config.AllowedExtensions; } // New text file extension if (!String.IsNullOrEmpty(config.NewTextFileExtension)) { p["newfile_extension"] = config.NewTextFileExtension; } // Excluded extensions if (!String.IsNullOrEmpty(config.ExcludedExtensions)) { p["excluded_extensions"] = config.ExcludedExtensions; } // Allowed folders if (!String.IsNullOrEmpty(config.AllowedFolders)) { p["allowed_folders"] = config.AllowedFolders; } // Excluded folders if (!String.IsNullOrEmpty(config.ExcludedFolders)) { p["excluded_folders"] = config.ExcludedFolders; } // Default path-preselected path in filesystem tree if (!String.IsNullOrEmpty(config.DefaultPath)) { p["default_path"] = config.DefaultPath; } // Deny non-application starting path if (!config.AllowNonApplicationPath) { p["allow_nonapp_path"] = "0"; } // Allow manage if (config.AllowManage) { p["allow_manage"] = "1"; } // SelectedPath - actual value of textbox if (!String.IsNullOrEmpty(config.SelectedPath)) { string selectedPath = config.SelectedPath; if (!(selectedPath.StartsWith("~", StringComparison.Ordinal) || selectedPath.StartsWith("/", StringComparison.Ordinal) || selectedPath.StartsWith(".", StringComparison.Ordinal) || selectedPath.StartsWith("\\", StringComparison.Ordinal)) && (String.IsNullOrEmpty(config.StartingPath) || config.StartingPath.StartsWith("~", StringComparison.Ordinal)) && !String.IsNullOrEmpty(selectedPathPrefix)) { selectedPath = selectedPathPrefix.TrimEnd('/') + "/" + selectedPath.TrimStart('/'); } p["selected_path"] = selectedPath; } // Starting path in filesystem if (!String.IsNullOrEmpty(config.StartingPath)) { p["starting_path"] = config.StartingPath; } // Show only folders|files p["show_folders"] = config.ShowFolders.ToString(); p["allow_zip_folders"] = config.AllowZipFolders.ToString(); // Editor client id if (!String.IsNullOrEmpty(config.EditorClientID)) { builder.Append("&editor_clientid=" + Server.UrlEncode(config.EditorClientID)); } // Register parameters within Window helper var paramsGuid = Guid.NewGuid().ToString(); WindowHelper.Add(paramsGuid, p, true); builder.Append("¶ms=", Server.UrlEncode(paramsGuid)); // Get the query string query = HttpUtility.UrlPathEncode("?" + builder.ToString().TrimStart('&')); // Get complete query string with attached hash query = URLHelper.AddParameterToUrl(query, "hash", QueryHelper.GetHash(query)); const string baseUrl = "~/CMSFormControls/Selectors/"; // Get complete URL return(ResolveUrl(baseUrl + "SelectFileOrFolder/Default.aspx" + query)); }