Beispiel #1
0
        /// <summary>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            HtmlEditorDataType h = new HtmlEditorDataType();

            h.Value            = moduleSettings["Editor"].ToString();
            DesktopText        = h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()), portalSettings);
            DesktopText.Width  = new System.Web.UI.WebControls.Unit(moduleSettings["Width"].ToString());
            DesktopText.Height = new System.Web.UI.WebControls.Unit(moduleSettings["Height"].ToString());

            if (!Page.IsPostBack)
            {
                if (bool.Parse(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(portalSettings.PortalID), "ModuleTitle", "ModuleID");
                listModules.CssClass       = "NormalTextBox";
                listModules.DataSource     = cldt.DataSource;
                listModules.DataValueField = cldt.DataValueField;
                listModules.DataTextField  = cldt.DataTextField;
                listModules.DataBind();

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

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

                lstLanguages.Items.Add(new ListItem(Esperantus.Localize.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;
                montaLista();
            }
        }
Beispiel #2
0
        private void montaLista()
        {
            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 != string.Empty)
                        {
                            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;
            }
        }