예제 #1
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="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            HtmlEditorDataType h = new HtmlEditorDataType();

            h.Value     = this.ModuleSettings["Editor"].ToString();
            DesktopText =
                h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(this.ModuleSettings["ShowUpload"].ToString()),
                            this.PortalSettings);
            DesktopText.Width  = new Unit(this.ModuleSettings["Width"].ToString());
            DesktopText.Height = new Unit(this.ModuleSettings["Height"].ToString());

            if (!Page.IsPostBack)
            {
                if (bool.Parse(this.ModuleSettings["ENHANCEDHTML_GET_CONTENTS_FROM_PORTALS"].ToString()))
                {
                    kindOfContent.Items.Add(new ListItem("External Module", "Portal"));
                    CustomListDataType cldtAll =
                        new CustomListDataType(new ModulesDB().GetModulesAllPortals(), "ModuleTitle", "ModuleID");
                    listAllModules.CssClass       = "NormalTextBox";
                    listAllModules.DataSource     = cldtAll.DataSource;
                    listAllModules.DataValueField = cldtAll.DataValueField;
                    listAllModules.DataTextField  = cldtAll.DataTextField;
                    listAllModules.DataBind();
                }
                CustomListDataType cldt =
                    new CustomListDataType(new ModulesDB().GetModulesSinglePortal(this.PortalSettings.PortalID),
                                           "ModuleTitle", "ModuleID");
                listModules.CssClass       = "NormalTextBox";
                listModules.DataSource     = cldt.DataSource;
                listModules.DataValueField = cldt.DataValueField;
                listModules.DataTextField  = cldt.DataTextField;
                listModules.DataBind();

                string comando =
                    General.GetString("ENHANCEDHTML_CONFIRMDELETEMESSAGE", "Are You Sure You Wish To Delete This Item ?");
                cmdDeletePage.Attributes.Add("onClick", "javascript:return confirm('" + comando + "');");
                ViewState["UrlReferrer"] = HttpUrlBuilder.BuildUrl(PageID);

                CultureInfo[] listaLang = LanguageSwitcher.GetLanguageList(true);

                lstLanguages.Items.Add(new ListItem(General.GetString("ENHANCEDHTML_SHOWALLPAGES", "All Pages"), "0"));
                foreach (CultureInfo ci in listaLang)
                {
                    lstLanguages.Items.Add(new ListItem(ci.DisplayName, (ci.LCID).ToString()));
                    listLanguages.Items.Add(new ListItem(ci.DisplayName, (ci.LCID).ToString()));
                }
                lstLanguages.SelectedIndex  = 0;
                listLanguages.SelectedIndex = 0;
                ShowList();
            }
        }
예제 #2
0
        /// <summary>
        /// Shows the list.
        /// </summary>
        private void ShowList()
        {
            bool showAllPages = (int.Parse(lstLanguages.SelectedItem.Value) < 1);

            CultureInfo[]  listaLang = LanguageSwitcher.GetLanguageList(true);
            EnhancedHtmlDB ehdb      = new EnhancedHtmlDB();
            SqlDataReader  dr;

            lstPages.Items.Clear();

            if (showAllPages)
            {
                dr = ehdb.GetAllPages(ModuleID, WorkFlowVersion.Staging);
            }
            else
            {
                dr =
                    ehdb.GetLocalizedPages(ModuleID, int.Parse(lstLanguages.SelectedItem.Value), WorkFlowVersion.Staging);
            }


            try
            {
                while (dr.Read())
                {
                    if (showAllPages)
                    {
                        int    ccode = int.Parse(dr["CultureCode"].ToString());
                        string texto = string.Empty;

                        foreach (CultureInfo ci in listaLang)
                        {
                            if (ccode == ci.LCID)
                            {
                                texto = ci.DisplayName;
                            }
                        }
                        if (texto.Length != 0)
                        {
                            lstPages.Items.Add(
                                new ListItem((string)dr["Title"] + " (" + texto + ")", dr["ItemID"].ToString()));
                        }
                    }
                    else
                    {
                        lstPages.Items.Add(new ListItem((string)dr["Title"], dr["ItemID"].ToString()));
                    }
                }
            }
            finally
            {
                dr.Close();
            }
            if (lstPages.Items.Count > 0)
            {
                lstPages.SelectedIndex = 0;
                cmdEditPage.Enabled    = true;
                cmdDeletePage.Enabled  = true;
            }
            else
            {
                cmdEditPage.Enabled   = false;
                cmdDeletePage.Enabled = false;
            }
        }