Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Server.ScriptTimeout = 1000000;

            ShowLocaleSetting = CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting");

            var isMasterReload = CommonLogic.QueryStringBool("master");

            pnlReload.Visible = isMasterReload;
            pnlUpload.Visible = !isMasterReload;

            if (isMasterReload && !StringResourceManager.CheckStringResourceExcelFileExists(ShowLocaleSetting))
            {
                ctlAlertMessage.PushAlertMessage("The server does not have any string resource files for the chosen locale.", AlertMessage.AlertType.Error);
                pnlReload.Visible = false;
            }

            if (!IsPostBack)
            {
                litSelectFileInstructions.Text = String.Format(AppLogic.GetStringForDefaultLocale("admin.stringresources.SelectFile"), ShowLocaleSetting);
                lnkBack1.NavigateUrl           = AppLogic.AdminLinkUrl("stringresources.aspx") + "?filterlocale=" + Localization.CheckLocaleSettingForProperCase(ShowLocaleSetting);
                lnkBack2.NavigateUrl           = AppLogic.AdminLinkUrl("stringresources.aspx") + "?filterlocale=" + Localization.CheckLocaleSettingForProperCase(ShowLocaleSetting);

                if (isMasterReload)
                {
                    litStage.Text = string.Format(AppLogic.GetStringForDefaultLocale("admin.stringresources.ReloadMaster"), ShowLocaleSetting);
                }
                else
                {
                    litStage.Text = string.Format(AppLogic.GetStringForDefaultLocale("admin.stringresources.ImportFile1"), ShowLocaleSetting);
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowLocaleSetting = Localization.CheckLocaleSettingForProperCase(CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));
            var isMasterStringResource = CommonLogic.QueryStringBool("master");

            if (isMasterStringResource)
            {
                if (!StringResourceManager.CheckStringResourceExcelFileExists(ShowLocaleSetting))
                {
                    AlertMessageControl.PushAlertMessage(AppLogic.GetString("admin.StringResources.NoFileFound", SkinID, ShowLocaleSetting), AlertMessage.AlertType.Error);
                    return;
                }

                ImportFiles = StringResourceManager.GetStringResourceFilesForLocale(ShowLocaleSetting);
            }
            else
            {
                ImportFiles = new[] { CommonLogic.SafeMapPath("~/images/" + CommonLogic.QueryStringCanBeDangerousContent("SpreadsheetName")) };
            }

            if (!IsPostBack)
            {
                CancelLink.NavigateUrl = String.Format("{0}?filterlocale={1}", AppLogic.AdminLinkUrl("stringresources.aspx"), ShowLocaleSetting);

                if (isMasterStringResource)
                {
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginReload", SkinID, LocaleSetting);
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ReloadLocale", SkinID, LocaleSetting), ShowLocaleSetting);
                }
                else
                {
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginImport", SkinID, LocaleSetting);
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ProcessingFile", SkinID, LocaleSetting), ImportFiles.First());
                }

                // Preview the data
                try
                {
                    var validationResult = StringResourceImporter.Validate(ShowLocaleSetting, ImportFiles, (StringResourceImporter.ImportOption)CommonLogic.QueryStringUSInt("option"));
                    DataReportGrid.DataSource = validationResult;
                }
                catch (Exception exception)
                {
                    while (exception.InnerException != null)
                    {
                        exception = exception.InnerException;
                    }

                    AlertMessageControl.PushAlertMessage(exception.Message, AlertMessage.AlertType.Error);
                    ActionsPanel.Visible = false;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");
            Server.ScriptTimeout = 1000000;

            ShowLocaleSetting = Localization.CheckLocaleSettingForProperCase(CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));

            // this should tell that the excel file to be loaded
            // is a master string resource for the locale i.e. strings.fr-FR.xls
            if (isMasterStringResource)
            {
                bool exists = StringResourceManager.CheckStringResourceExcelFileExists(ShowLocaleSetting);
                if (!exists)
                {
                    resetError(AppLogic.GetString("admin.StringResources.NoFileFound", SkinID, ShowLocaleSetting), true);
                    return;
                }
                else
                {
                    ExcelFiles = StringResourceManager.GetStringResourceFilesForLocale(ShowLocaleSetting);
                }
            }
            else
            {
                SpreadsheetName = CommonLogic.QueryStringCanBeDangerousContent("SpreadsheetName");
                ExcelFiles.Add(CommonLogic.SafeMapPath("~/images" + "/" + SpreadsheetName + ".xls"));
            }

            if (!IsPostBack)
            {
                if (isMasterStringResource)
                {
                    litStage.Text       = string.Format(AppLogic.GetString("admin.stringresources.ReloadMaster", SkinID, ShowLocaleSetting), CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginReload", SkinID, LocaleSetting);
                    ltStrings.Text      = "<a href=\"" + AppLogic.AdminLinkUrl("stringresource.aspx") + "?showlocalesetting=" + ShowLocaleSetting + "\">" + AppLogic.GetString("admin.importstringresourcefile2.CancelReload", SkinID, LocaleSetting) + "</a>";
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ReloadLocale", SkinID, LocaleSetting), ShowLocaleSetting);
                }
                else
                {
                    //litStage.Text = string.Format(String.Format(AppLogic.GetString("admin.importstringresourcefile2.Step2", SkinID, LocaleSetting)), CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginImport", SkinID, LocaleSetting);
                    ltStrings.Text      = "<a href=\"" + AppLogic.AdminLinkUrl("stringresource.aspx") + "?showlocalesetting=" + ShowLocaleSetting + "\">" + AppLogic.GetString("admin.importstringresourcefile2.CancelImport", SkinID, LocaleSetting) + "</a>";
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ProcessingFile", SkinID, LocaleSetting), ExcelFiles[0]);
                }
                ltVerify.Text = AppLogic.GetString("admin.importstringresourcefile2.Good", SkinID, LocaleSetting);
                loadData();
            }
        }
Beispiel #4
0
        protected void btnLoadExcelServer_Click(object sender, EventArgs e)
        {
            resetError("", false);

            string selectedLocale = ddLocales.SelectedValue;

            string stringResourceFilePath   = string.Empty;
            bool   stringResourceFileExists = StringResourceManager.CheckStringResourceExcelFileExists(selectedLocale);

            if (stringResourceFileExists)
            {
                Response.Redirect(string.Format(AppLogic.AdminLinkUrl("importstringresourcefile1.aspx") + "?showlocalesetting={0}&master=true", selectedLocale));
            }
            else
            {
                resetError(string.Format("String Resource File {0} not found!!!", stringResourceFilePath), true);
            }
        }