Example #1
0
        public static void InitURLLibrary(Control control)
        {
            string Message = "This module requires that you're running \"advanced\" mode of DNN URL Rewriter. Legacy modes such as \"HumanFriendly\" & \"SearchFriendly\" are not supported. Feel free to open a support ticket at Vanjaro.com for further assistance.";

            if (HttpContext.Current.Application.AllKeys.Contains("Common-Rewriter"))
            {
                if (HttpContext.Current.Application["Common-Rewriter"].ToString() != "advanced")
                {
                    Skin.AddModuleMessage(control, Message, DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
                }
            }
            else
            {
                ProviderConfiguration ProviderConfiguration = ProviderConfiguration.GetProviderConfiguration("friendlyUrl");
                if (ProviderConfiguration != null && !string.IsNullOrEmpty(ProviderConfiguration.DefaultProvider) && ProviderConfiguration.DefaultProvider.ToLower() == "dnnfriendlyurl")
                {
                    string item = ((Provider)ProviderConfiguration.Providers[ProviderConfiguration.DefaultProvider]).Attributes["urlformat"];
                    if (string.IsNullOrWhiteSpace(item))
                    {
                        item = "searchfriendly";
                    }

                    if (item.ToLower() != "advanced")
                    {
                        Skin.AddModuleMessage(control, Message, DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
                    }

                    HttpContext.Current.Application.Add("Common-Rewriter", item.ToLower());
                }
                else
                {
                    HttpContext.Current.Application.Add("Common-Rewriter", "advanced");
                }
            }
        }
        /// <summary>
        /// Displays a message of messageType for specified module, with optional localization.
        /// </summary>
        /// <param name="module">Module.</param>
        /// <param name="message">Message body.</param>
        /// <param name="messageType">Message type.</param>
        /// <param name="localize">If set to <c>true</c> localize message.</param>
        public static void Message(this PortalModuleBase module, string message, MessageType messageType = MessageType.Info, bool localize = false)
        {
            var locmessage = localize ? Localization.GetString(message, module.LocalResourceFile) : message;

            Skin.AddModuleMessage(module, locmessage,
                                  (ModuleMessage.ModuleMessageType)messageType);
        }
Example #3
0
        public void cmdDeleteUserRole_click(object sender, ImageClickEventArgs e)
        {
            if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) == false)
            {
                return;
            }
            try
            {
                var cmdDeleteUserRole = (ImageButton)sender;
                int roleId            = Convert.ToInt32(cmdDeleteUserRole.Attributes["roleId"]);
                int userId            = Convert.ToInt32(cmdDeleteUserRole.Attributes["userId"]);

                RoleInfo role = RoleController.Instance.GetRole(PortalId, r => r.RoleID == roleId);
                if (!RoleController.DeleteUserRole(UserController.GetUserById(PortalId, userId), role, PortalSettings, chkNotify.Checked))
                {
                    Skin.AddModuleMessage(this, Localization.GetString("RoleRemoveError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                }
                BindGrid();
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                Skin.AddModuleMessage(this, Localization.GetString("RoleRemoveError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdAddNewRecord_Click redirect to add new record dialog when the add new record button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void cmdAddNewRecord_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtDepartment.Text))
                {
                    BindGrid();
                    DataSet oDs = (DataSet)gvDepartment.DataSource;
                    DataRow oDr = oDs.Tables[0].NewRow();
                    oDr["Department"]        = txtDepartment.Text;
                    oDr["OwnerFolder"]       = txtOwnerFolder.Text;
                    oDr["RootNamespace"]     = txtRootNamespace.Text;
                    oDr["OwnerName"]         = txtOwnerName.Text;
                    oDr["OwnerOrganization"] = txtOwnerOrganization.Text;
                    oDr["OwnerWebsite"]      = txtOwnerWebsite.Text;
                    oDr["OwnerEmail"]        = txtOwnerEmail.Text;
                    oDr["IconFile"]          = txtIconFile.Text;

                    oDs.Tables[0].Rows.Add(oDr);
                    oDs.WriteXml(strXMLfile);
                    BindGrid();
                }
                else
                {
                    Skin.AddModuleMessage(this, Localization.GetString("Department.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                }

                // return to main page
                //Response.Redirect(Globals.NavigateURL(AddNewRecord, "COLUMN_NAME=" + ddlCOLUMN_NAME.SelectedValue, "mid=" + ModuleId.ToString()));
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #5
0
        private string GetVisualizerFolder()
        {
            var sVisualizerFolder = Convert.ToString(this.Settings[ReportsController.SETTING_Visualizer]);

            if (string.IsNullOrEmpty(sVisualizerFolder) || !this.VisualizerFolderExists(sVisualizerFolder))
            {
                if (this.VisualizerFolderExists("Grid"))
                {
                    // Default to grid if its installed, otherwise default to none selected
                    // This should cover most upgrades from pre-Visualizer versions as long as the
                    // user sticks with the default and installs Grid, if not, then they are advanced
                    // enough to know what to do.

                    sVisualizerFolder = "Grid";
                }
                else if (this.IsEditable)
                {
                    Skin.AddModuleMessage(this,
                                          Localization.GetString("VisualizerNotConfigured.Text",
                                                                 this.LocalResourceFile),
                                          ModuleMessage.ModuleMessageType.RedError);
                }
            }
            return(sVisualizerFolder);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.UserInfo.IsSuperUser && Directory.Exists(this.Server.MapPath("App_Code/Reports")))
            {
                Skin.AddModuleMessage(this, Localization.GetString("CleanUpOldAppCode.Text", this.LocalResourceFile),
                                      ModuleMessage.ModuleMessageType.YellowWarning);
            }
            //durthaler added code
            if (!IsPostBack)
            {
                txtStartDate.Text  = DateTime.Now.AddDays(-7).ToShortDateString();
                txtEndingDate.Text = DateTime.Now.ToShortDateString();
                LoadUsers();
            }
            //end durthaler added code
            this.Report               = ReportsController.GetReport(this.ModuleConfiguration);
            this.InfoPane.Visible     = this.Report.ShowInfoPane;
            this.ControlsPane.Visible = this.Report.ShowControls;

            if (this.Report.ShowInfoPane)
            {
                this.TitleLiteral.Text       = this.Report.Title;
                this.DescriptionLiteral.Text = this.Report.Description;
            }

            if (this.Report.AutoRunReport)
            {
                this.RunReport();
            }
        }
Example #7
0
        private void BindGrid(string type, DataGrid grid, HtmlGenericControl noItemsControl)
        {
            var installPath     = Globals.ApplicationMapPath + "\\Install\\" + type;
            var packages        = new Dictionary <string, PackageInfo>();
            var invalidPackages = new List <string>();

            foreach (string file in Directory.GetFiles(installPath))
            {
                if (file.ToLower().EndsWith(".zip") || file.ToLower().EndsWith(".resources"))
                {
                    PackageController.ParsePackage(file, installPath, packages, invalidPackages);
                }
            }

            if (invalidPackages.Count > 0)
            {
                var pkgErrorsMsg = invalidPackages.Aggregate(string.Empty, (current, pkg) => current + (pkg + "<br />"));
                Skin.AddModuleMessage(this, Localization.GetString("PackageErrors.Text", LocalResourceFile) + pkgErrorsMsg, ModuleMessage.ModuleMessageType.RedError);
            }

            if (packages.Count == 0)
            {
                noItemsControl.Visible = true;
                grid.Visible           = false;
            }
            else
            {
                noItemsControl.Visible = false;
                grid.DataSource        = packages.Values;
                grid.DataBind();
            }
        }
Example #8
0
        private bool ValidateUI(IList <RadComboBoxItem> checkedItems, bool htmlEncode, ref string searchText, bool doReplace)
        {
            if (String.IsNullOrEmpty(searchText))
            {
                Skin.AddModuleMessage(this, LocalizeString("NoSearchText"), ModuleMessage.ModuleMessageType.YellowWarning);
                return(false);
            }

            if (checkedItems.Count <= 0)
            {
                var msg = string.Format(LocalizeString("NoSearchItems"), LocalizeString("Search"));
                Skin.AddModuleMessage(this, msg, ModuleMessage.ModuleMessageType.YellowWarning);
                return(false);
            }

            if (htmlEncode)
            {
                searchText = HttpUtility.HtmlEncode(searchText);
            }


            // Show either the single-table search results, or the multi-table search results
            divSearchResults.Visible    = (checkedItems.Count == 1);
            divReplaceResults.Visible   = (checkedItems.Count == 1 && doReplace);
            divOperationResults.Visible = (checkedItems.Count > 0);

            return(true);
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (CurrentUserCanEdit)
                {
                    // If IsEditable, then the visitor has edit permissions to the module, is
                    // currently logged in, and the portal is in edit mode.
                    Skin.AddModuleMessage(this, GetLocalizedString("InjectionInfo.Text"), ModuleMessage.ModuleMessageType.BlueInfo);
                }
                else
                {
                    // hide the module container (and the rest of the module as well)
                    ContainerControl.Visible = false;
                }

                // inject any strings insto the page
                ExecutePageInjection();
            }
            catch (Exception exc)
            {
                // Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc, IsEditable);
            }
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserInfo.IsSuperUser && Directory.Exists(Server.MapPath("App_Code/Reports")))
            {
                Skin.AddModuleMessage(this, Localization.GetString("CleanUpOldAppCode.Text", LocalResourceFile),
                                      ModuleMessage.ModuleMessageType.YellowWarning);
            }

            Report                    = ReportsController.GetReport(ModuleConfiguration);
            InfoPane.Visible          = Report.ShowInfoPane;
            ControlsPane.Visible      = Report.ShowControls;
            ExportExcelButton.Visible = Report.ExportExcel;


            if (Report.ShowInfoPane)
            {
                TitleLiteral.Text       = Report.Title;
                DescriptionLiteral.Text = Report.Description;
            }

            if (Report.AutoRunReport)
            {
                RunReport();
            }
        }
 protected void AddMessage(string Message, string Type, Exception ex = null)
 {
     if (Type == "Error")
     {
         Exceptions.LogException(ex);
         if (UserInfo.IsSuperUser)
         {
             Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.RedError);
         }
         else
         {
             Skin.AddModuleMessage(this, Localization.GetString("msgError.Text", this.LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
         }
     }
     else if (Type == "Success")
     {
         Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.GreenSuccess);
     }
     else if (Type == "Warning")
     {
         Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.YellowWarning);
     }
     else if (Type == "Information")
     {
         Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.BlueInfo);
     }
 }
 protected bool ValidateDataSource(bool ShowMessage)
 {
     if (string.IsNullOrEmpty(this.Report.DataSource))
     {
         if (ShowMessage)
         {
             if (this.ParentModule.UserInfo.IsSuperUser)
             {
                 Skin.AddModuleMessage(this.ParentModule,
                                       Localization.GetString("HostNoReport.Message",
                                                              this.ParentModule.LocalResourceFile),
                                       ModuleMessage.ModuleMessageType.YellowWarning);
             }
             else if (this.ParentModule.IsEditable)
             {
                 Skin.AddModuleMessage(this.ParentModule,
                                       Localization.GetString("AdminNoReport.Message",
                                                              this.ParentModule.LocalResourceFile),
                                       ModuleMessage.ModuleMessageType.YellowWarning);
             }
         }
         return(false);
     }
     return(true);
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdAddNewRecord_Click redirect to add new record dialog when the add new record button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void cmdAddNewRecord_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtID.Text))
                {
                    BindGrid();
                    DataSet oDs = (DataSet)gvMenu.DataSource;
                    DataRow oDr = oDs.Tables[0].NewRow();
                    oDr["ID"]        = txtID.Text;
                    oDr["LinkLabel"] = txtLinkLabel.Text;
                    oDr["LinkPath"]  = txtLinkPath.Text;
                    oDs.Tables[0].Rows.Add(oDr);
                    oDs.WriteXml(strXMLfile);
                    BindGrid();
                }
                else
                {
                    Skin.AddModuleMessage(this, Localization.GetString("txtID.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                }

                // return to main page
                //Response.Redirect(Globals.NavigateURL(AddNewRecord, "COLUMN_NAME=" + ddlCOLUMN_NAME.SelectedValue, "mid=" + ModuleId.ToString()));
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #14
0
        private void OnSaveFilterClick(object sender, EventArgs e)
        {
            var ipf = new IPFilterInfo();

            ipf.IPAddress  = txtFirstIP.Text;
            ipf.SubnetMask = txtSubnet.Text;
            ipf.RuleType   = Convert.ToInt32(cboType.SelectedValue);

            if ((ipf.IPAddress == "127.0.0.1" || ipf.IPAddress == "localhost" || ipf.IPAddress == "::1" || ipf.IPAddress == "*") && ipf.RuleType == 2)
            {
                Skin.AddModuleMessage(this, Localization.GetString("CannotDeleteLocalhost.Text", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                return;
            }

            if (IPFilterController.Instance.IsAllowableDeny(Request.UserHostAddress, ipf) == false)
            {
                Skin.AddModuleMessage(this, Localization.GetString("CannotDeleteIPInUse.Text", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                return;
            }

            if (!String.IsNullOrEmpty(Request.QueryString["IPFilterID"]))
            {
                ipf.IPFilterID = Convert.ToInt32(Request.QueryString["IPFilterID"]);
                IPFilterController.Instance.UpdateIPFilter(ipf);
            }
            else
            {
                IPFilterController.Instance.AddIPFilter(ipf);
            }
            Response.Redirect(Globals.NavigateURL(TabId), true);
        }
Example #15
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Check to see if the login failed
            string errorReason = HttpContext.Current.Request.Params["error_reason"];

            if (errorReason != null)
            {
                Skin.AddModuleMessage(this, Localization.GetString("PrivateConfirmationMessage", Localization.SharedResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                AddEventLog("unknown user", Null.NullInteger, PortalSettings.PortalName, IPAddress, EventLogType.LOGIN_FAILURE, errorReason);

                return;
            }

            if (IsPostBack)
            {
                //Save the return Url in the cookie
                HttpContext.Current.Response.Cookies.Set(new HttpCookie("returnurl", RedirectURL)
                {
                    Expires = DateTime.Now.AddMinutes(5),
                    Path    = (!string.IsNullOrEmpty(Globals.ApplicationPath) ? Globals.ApplicationPath : "/")
                });
            }

            Page.RegisterAsyncTask(new PageAsyncTask(GetUserAsync));
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnLoad runs when this program start is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //If user not in Access Roles or Super User, then we will redirect to Access Denied page
            if (!UserInfo.IsSuperUser)
            {
                Skin.AddModuleMessage(this, Localization.GetString("SuperUser.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                //cmdCreate.Visible = false;
                return;
            }

            try
            {
                // setup the strXMLFile for global access
                ModuleController modCtrl = new ModuleController();
                _rootPath = @HttpContext.Current.Server.MapPath("~/DesktopModules/") + modCtrl.GetModule(ModuleId).DesktopModule.FolderName.Replace("/", "\\") + "\\Templates";

                if (!IsPostBack)
                {
                    //Bind data to the GridView control.
                    BindGrid();
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #17
0
 private void HandleVisualizerLoadError()
 {
     Skin.AddModuleMessage(this,
                           Localization.GetString("VisualizerLoadError.Text",
                                                  this.LocalResourceFile),
                           ModuleMessage.ModuleMessageType.RedError);
 }
Example #18
0
 private bool AutoExecuteReport(VisualizerControlBase ctlVisualizer, ReportInfo report, ref DataTable results,
                                bool fromCache)
 {
     try
     {
         results = ReportsController.ExecuteReport(
             report, string.Concat(ReportsController.CACHEKEY_Reports, Convert.ToString(this.ModuleId)),
             report.CacheDuration <= 0, this, ref fromCache);
     }
     catch (DataSourceException ex)
     {
         // Display the error message to host users only
         if (this.UserInfo.IsSuperUser)
         {
             Skin.AddModuleMessage(this,
                                   string.Format(Localization.GetString("HostExecuteError.Message",
                                                                        this.LocalResourceFile),
                                                 ex.LocalizedMessage),
                                   ModuleMessage.ModuleMessageType.RedError);
         }
         else if (this.IsEditable)
         {
             Skin.AddModuleMessage(this,
                                   Localization.GetString("AdminExecuteError.Message",
                                                          this.LocalResourceFile),
                                   ModuleMessage.ModuleMessageType.RedError);
         }
         Services.Exceptions.Exceptions.LogException(ex);
         ctlVisualizer.Visible = false;
         return(false);
     }
     return(true);
 }
Example #19
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    _rootPath = Server.MapPath("~/");
                    var settingValue = Settings["ICG.Modules.SimpleFileList"];
                    if (settingValue != null)
                    {
                        var portalPath = Server.MapPath("~/Portals/" + this.PortalId);

                        dgrFileList.Columns[0].HeaderText = Localization.GetString("FileHeader", this.LocalResourceFile);
                        dgrFileList.DataSource            = FileUtility.GetSafeFileList(string.Concat(portalPath, settingValue.ToString()), GetExcludedFiles(), GetSortOrder());
                        dgrFileList.DataBind();
                    }
                    else
                    {
                        Skin.AddModuleMessage(this, Localization.GetString("NotConfigured", this.LocalResourceFile), ModuleMessage.ModuleMessageType.BlueInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Example #20
0
        /// <summary>
        /// Users request to query the db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExecuteQuery_Click(object sender, EventArgs e)
        {
            //Secondary security fix
            if (IsEditable && txtQuery.Text.ToLower().StartsWith("select"))
            {
                try
                {
                    var ds = ExportHelper.ReturnDataSet(txtQuery.Text);
                    if (ds != null)
                    {
                        GridDS.DataSource = ds;
                        GridDS.DataBind();

                        //Check if the gridds has records on it, we show the exporter buttons
                        liExportCsv.Visible = GridDS.Rows.Count > 0;
                        liExportXml.Visible = GridDS.Rows.Count > 0;
                    }
                }
                catch (Exception ex)
                {
                    Skin.AddModuleMessage(this, "Query Error: " + ex.Message, ModuleMessage.ModuleMessageType.RedError);
                    GridDS.DataSource = null;
                    GridDS.DataBind();
                }
            }
            else
            {
                Skin.AddModuleMessage(this, "Your query MUST start with the word SELECT",
                                      ModuleMessage.ModuleMessageType.RedError);
            }
        }
Example #21
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/27/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [VMasanas]  9/28/2004   Changed redirect to Access Denied
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmdEmail.Click   += TestEmail;
            cmdRestart.Click += RestartApplication;
            cmdUpdate.Click  += UpdateSettings;
            cmdUpgrade.Click += OnUpgradeClick;
            cmdCache.Click   += ClearCache;
            IncrementCrmVersionButton.Click           += IncrementCrmVersion;
            chkCrmEnableCompositeFiles.CheckedChanged += EnableCompositeFilesChanged;
            try
            {
                CheckSecurity();

                //If this is the first visit to the page, populate the site data
                if (!Page.IsPostBack)
                {
                    BindData();
                    BindSearchIndex();

                    if (Request.QueryString["smtpwarning"] != null)
                    {
                        Skin.AddModuleMessage(this, Localization.GetString("SmtpServerWarning", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        private bool RestoreTab(TabInfo tab)
        {
            var success = true;

            if (tab != null)
            {
                if (!Null.IsNull(tab.ParentId) && tabsListBox.Items.FindByValue(tab.ParentId.ToString(CultureInfo.InvariantCulture)) != null)
                {
                    Skin.AddModuleMessage(this,
                                          string.Format(Localization.GetString("ChildTab.ErrorMessage", LocalResourceFile), tab.TabName),
                                          ModuleMessage.ModuleMessageType.YellowWarning);
                    success = false;
                }
                else
                {
                    var tabController = new TabController();
                    tabController.RestoreTab(tab, PortalSettings);

                    //restore modules in this tab
                    modulesListBox.Items.Cast <ListItem>().ToList().ForEach(i =>
                    {
                        var values   = i.Value.Split('-');
                        var tabId    = int.Parse(values[0]);
                        var moduleId = int.Parse(values[1]);
                        if (tabId == tab.TabID)
                        {
                            RestoreModule(moduleId, tabId);
                        }
                    });
                }
            }
            return(success);
        }
        private void LoadSettings()
        {
            cboSettings.Items.Clear();

            var strFile = Globals.ApplicationMapPath + "\\" + cboTokens.SelectedItem.Value.ToLower().Replace("/", "\\").Replace(".ascx", ".xml");

            if (File.Exists(strFile))
            {
                try
                {
                    var xmlDoc = new XmlDocument();
                    xmlDoc.Load(strFile);
                    foreach (XmlNode xmlSetting in xmlDoc.SelectNodes("//Settings/Setting"))
                    {
                        cboSettings.AddItem(xmlSetting.SelectSingleNode("Name").InnerText, xmlSetting.SelectSingleNode("Name").InnerText);
                    }
                }
                catch
                {
                    Skin.AddModuleMessage(this, "Error Loading Settings File For Object", ModuleMessage.ModuleMessageType.RedError);
                }
            }
            else
            {
                Skin.AddModuleMessage(this, "Object Selected Does Not Have Settings Defined", ModuleMessage.ModuleMessageType.YellowWarning);
            }
            cboSettings.InsertItem(0, "<" + Localization.GetString("Not_Specified") + ">", "");
        }
        /// <summary>Raises the <see cref="E:System.Web.UI.Control.Load" /> event.</summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DotNetNuke.Common.Globals.IsEditMode() && !string.IsNullOrEmpty(this.Model.AdminMessage))
            {
                Skin.AddModuleMessage(this, string.Empty, this.Model.AdminMessage, ModuleMessage.ModuleMessageType.YellowWarning);
            }
        }
        protected void OnDeleteClick(object sender, EventArgs e)
        {
            var failure          = false;
            var strSkinPath      = Globals.ApplicationMapPath.ToLower() + cboSkins.SelectedItem.Value;
            var strContainerPath = Globals.ApplicationMapPath.ToLower() + cboContainers.SelectedItem.Value;

            string strMessage;

            if (UserInfo.IsSuperUser == false && cboSkins.SelectedItem.Value.IndexOf("\\portals\\_default\\", 0) != -1)
            {
                strMessage = Localization.GetString("SkinDeleteFailure", LocalResourceFile);
                Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError);
                failure = true;
            }
            else
            {
                if (cboSkins.SelectedIndex > 0)
                {
                    SkinPackageInfo skinPackage = SkinController.GetSkinPackage(PortalId, cboSkins.SelectedItem.Text, "Skin");
                    if (skinPackage != null)
                    {
                        strMessage = Localization.GetString("UsePackageUnInstall", LocalResourceFile);
                        Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError);
                        return;
                    }
                    if (Directory.Exists(strSkinPath))
                    {
                        Globals.DeleteFolderRecursive(strSkinPath);
                    }
                    if (Directory.Exists(strSkinPath.Replace("\\" + SkinController.RootSkin.ToLower() + "\\", "\\" + SkinController.RootContainer + "\\")))
                    {
                        Globals.DeleteFolderRecursive(strSkinPath.Replace("\\" + SkinController.RootSkin.ToLower() + "\\", "\\" + SkinController.RootContainer + "\\"));
                    }
                }
                else if (cboContainers.SelectedIndex > 0)
                {
                    var skinPackage = SkinController.GetSkinPackage(PortalId, cboContainers.SelectedItem.Text, "Container");
                    if (skinPackage != null)
                    {
                        strMessage = Localization.GetString("UsePackageUnInstall", LocalResourceFile);
                        Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError);
                        return;
                    }
                    if (Directory.Exists(strContainerPath))
                    {
                        Globals.DeleteFolderRecursive(strContainerPath);
                    }
                }
            }
            if (!failure)
            {
                LoadCombos();
                ShowSkins();
                ShowContainers();
            }
        }
        private void UpdateSkin()
        {
            if (cboSettings.SelectedIndex > 0)
            {
                if ((cboValue.SelectedItem != null) || !String.IsNullOrEmpty(txtValue.Text))
                {
                    var objStreamReader = File.OpenText(cboFiles.SelectedItem.Value);
                    var strSkin         = objStreamReader.ReadToEnd();
                    objStreamReader.Close();
                    var strTag     = "<dnn:" + cboTokens.SelectedItem.Text + " runat=\"server\" id=\"dnn" + cboTokens.SelectedItem.Text + "\"";
                    var intOpenTag = strSkin.IndexOf(strTag);
                    if (intOpenTag != -1)
                    {
                        var    intCloseTag       = strSkin.IndexOf(" />", intOpenTag);
                        var    strAttribute      = cboSettings.SelectedItem.Value;
                        var    intStartAttribute = strSkin.IndexOf(strAttribute, intOpenTag);
                        string strValue          = cboValue.Visible ? cboValue.SelectedItem.Value : txtValue.Text;
                        if (intStartAttribute != -1 && intStartAttribute < intCloseTag)
                        {
                            //remove attribute
                            var intEndAttribute = strSkin.IndexOf("\" ", intStartAttribute);
                            strSkin = strSkin.Substring(0, intStartAttribute) + strSkin.Substring(intEndAttribute + 2);
                        }
                        //add attribute
                        strSkin = strSkin.Insert(intOpenTag + strTag.Length, " " + strAttribute + "=\"" + strValue + "\"");
                        try
                        {
                            File.SetAttributes(cboFiles.SelectedItem.Value, FileAttributes.Normal);
                            var objStream = File.CreateText(cboFiles.SelectedItem.Value);
                            objStream.WriteLine(strSkin);
                            objStream.Close();

                            UpdateManifest();

                            Skin.AddModuleMessage(this, "Skin Successfully Updated", ModuleMessage.ModuleMessageType.GreenSuccess);
                        }
                        catch
                        {
                            Skin.AddModuleMessage(this, "Error Updating Skin File", ModuleMessage.ModuleMessageType.RedError);
                        }
                    }
                    else
                    {
                        Skin.AddModuleMessage(this, "Selected File Does Not Contain Token", ModuleMessage.ModuleMessageType.YellowWarning);
                    }
                }
                else
                {
                    Skin.AddModuleMessage(this, "You Must Specify A Value For The Setting", ModuleMessage.ModuleMessageType.YellowWarning);
                }
            }
            else
            {
                Skin.AddModuleMessage(this, "You Must Select A Token Setting", ModuleMessage.ModuleMessageType.YellowWarning);
            }
        }
        private void clearMessagePlaceHolder()
        {
            var ctl = this.FindControl("dnnSkinMessage");

            if (ctl != null)
            {
                this.Controls.Remove(ctl);
            }
            Skin.AddModuleMessage(this, "", ModuleMessageType.BlueInfo);
        }
Example #28
0
 private void HandleMissingVisualizerError()
 {
     if (this.IsEditable)
     {
         Skin.AddModuleMessage(this,
                               Localization.GetString("VisualizerDoesNotExist.Text",
                                                      this.LocalResourceFile),
                               ModuleMessage.ModuleMessageType.RedError);
     }
 }
Example #29
0
        private bool IsAuthorizedUser()
        {
            if (!UserInfo.IsSuperUser)
            {
                Skin.AddModuleMessage(this, LocalizeString("AccessDenied"), ModuleMessage.ModuleMessageType.RedError);
                divMain.Visible = false;
            }

            return(UserInfo.IsSuperUser);
        }
Example #30
0
 private void HandleVisualizerException(VisualizerException vex)
 {
     if (this.IsEditable)
     {
         Skin.AddModuleMessage(this,
                               string.Format(Localization.GetString("VisualizerError.Message",
                                                                    this.LocalResourceFile),
                                             vex.LocalizedMessage),
                               ModuleMessage.ModuleMessageType.RedError);
     }
 }