/// <summary>
 /// Returns localized string.
 /// </summary>
 /// <param name="stringName">String to localize</param>
 public override string GetString(string stringName)
 {
     if (UseFileStrings)
     {
         return(ResHelper.GetFileString(stringName));
     }
     else
     {
         return(base.GetString(stringName));
     }
 }
Example #2
0
 /// <summary>
 /// Returns localized string.
 /// </summary>
 /// <param name="stringName">String to localize</param>
 public override string GetString(string stringName)
 {
     if (UseFileStrings || !CMSAppBase.ConnectionAvailable)
     {
         return(ResHelper.GetFileString(stringName));
     }
     else
     {
         return(base.GetString(stringName));
     }
 }
    /// <summary>
    /// Display collation dialog.
    /// </summary>
    public void DisplayCollationDialog()
    {
        string collation = DatabaseHelper.GetDatabaseCollation(ConnectionString);

        if (CMSString.Compare(collation, COLLATION_CASE_INSENSITIVE, true) != 0)
        {
            lblChangeCollation.ResourceString = string.Format(ResHelper.GetFileString("separationDB.collation"), collation);
            btnChangeCollation.ResourceString = string.Format(ResHelper.GetFileString("install.changecollation"), COLLATION_CASE_INSENSITIVE);
            plcChangeCollation.Visible        = true;
        }
    }
Example #4
0
    /// <summary>
    /// Display collation dialog.
    /// </summary>
    public void DisplayCollationDialog()
    {
        string collation = DatabaseHelper.GetDatabaseCollation(ConnectionString);

        if (!DatabaseHelper.IsSupportedDatabaseCollation(collation))
        {
            lblChangeCollation.ResourceString = String.Format(ResHelper.GetFileString("separationDB.collation"), collation);
            btnChangeCollation.ResourceString = String.Format(ResHelper.GetFileString("install.changecollation"), DatabaseHelper.DEFAULT_DB_COLLATION);
            plcChangeCollation.Visible        = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ltlScript.Text = ScriptHelper.GetScript("var hdnField=document.getElementById('" + hdnName.ClientID + "');var hdnLastSelected=document.getElementById('" + hdnLastSelected.ClientID + "');");

        if (RequestHelper.IsPostBack())
        {
            ltlScriptAfter.Text = ScriptHelper.GetScript("SelectTemplate(hdnLastSelected.value,hdnField.value);");
        }

        radAddSite.Text  = ResHelper.GetFileString("Install.radaddsite");
        radTemplate.Text = ResHelper.GetFileString("Install.radTemplate");
    }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblDBPassword.Text = ResHelper.GetFileString("Install.lblPassword");
        lblDBUsername.Text = ResHelper.GetFileString("Install.lblUsername");
        lblServerName.Text = ResHelper.GetFileString("Install.lblServername");
        lblSQLServer.Text  = IsDBSeparation ? GetString("separationDB.server") : ResHelper.GetFileString("Install.lblSQLServer");

        txtDBPassword.Enabled = radSQLAuthentication.Checked;
        txtDBUsername.Enabled = radSQLAuthentication.Checked;

        radSQLAuthentication.Text     = ResHelper.GetFileString("Install.radSQlAuthentication");
        radWindowsAuthentication.Text = ResHelper.GetFileString("Install.radWindowsAuthentication") + "<br /><span class=\"InstallAccountName\">" + String.Format(ResHelper.GetFileString("Install.Account"), WindowsIdentity.GetCurrent().Name) + "</span>";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lnkSkipLicense.Click += lnkSkipLicense_Click;

        if (!RequestHelper.IsPostBack())
        {
            lblLicenseCaption.Text = string.Format(ResHelper.GetFileString("Install.lblLicenseCaption"), FullHostName);
        }

        // License step strings
        lblLicenseTip.Text      = string.Format(ResHelper.GetFileString("Install.lblLicenseTip"), FullHostName);
        lblEnterLicenseKey.Text = ResHelper.GetFileString("Install.lblEnterLicenseKey");
        lnkSkipLicense.Text     = ResHelper.GetFileString("Install.lnkSkipLicense");
        lblFreeLicenseInfo.Text = ResHelper.GetFileString("Install.lblFreeLicenseInfo");
    }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     lblExistingDatabaseName.Text  = ResHelper.GetFileString("Install.lblExistingDatabaseName");
     lblNewDatabaseName.Text       = ResHelper.GetFileString("Install.lblNewDatabaseName");
     lblDatabase.Text              = IsDBSeparation ? GetString("separationDB.database") : ResHelper.GetFileString("Install.lblDatabase");
     radCreateNew.Text             = ResHelper.GetFileString("Install.radCreateNew");
     radUseExisting.Text           = ResHelper.GetFileString("Install.radUseExisting");
     chkCreateDatabaseObjects.Text = ResHelper.GetFileString("Install.chkCreateDatabaseObjects");
     plcRunningTasks.Visible       = IsDBSeparation;
     btnStopTasks.Click           += btnStopTasks_Click;
     if (IsDBSeparation)
     {
         iconHelp.ToolTip = spanScreenReader.Text = GetString("separationDB.enabledtasksseparation");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblSQLServer.Text = IsDBSeparation ? GetString("separationDB.server") : ResHelper.GetFileString("Install.lblSQLServer");

        txtDBPassword.Enabled = radSQLAuthentication.Checked;
        txtDBUsername.Enabled = radSQLAuthentication.Checked;

        if (ValidationHelper.GetBoolean(Service.Resolve <IAppSettingsService>()["CMSWWAGInstallation"], false))
        {
            radWindowsAuthentication.Text    = ResHelper.GetFileString("Install.WAGradWindowsAuthentication");
            radWindowsAuthentication.Enabled = false;
        }
        else
        {
            radWindowsAuthentication.Text = ResHelper.GetFileString("Install.radWindowsAuthentication") + "<br /><span>" + String.Format(ResHelper.GetFileString("Install.Account"), WindowsIdentity.GetCurrent().Name) + "</span>";
        }
    }
 /// <summary>
 /// Initialize control based on properties.
 /// </summary>
 public void InitControls()
 {
     if (!IsSqlAzure)
     {
         // For regular database allow user to change collation through wizard
         lblCollation.Text        = string.Format(ResHelper.GetFileString("install.databasecollation"), DatabaseHelper.DEFAULT_DB_COLLATION);
         rbLeaveCollation.Text    = string.Format(ResHelper.GetFileString("install.leavecollation"), Collation);
         rbChangeCollationCI.Text = string.Format(ResHelper.GetFileString("install.changecollation"), DatabaseHelper.DEFAULT_DB_COLLATION);
     }
     else
     {
         // For SQL Azure database show inform message only
         lblCollation.Text           = string.Format(ResHelper.GetFileString("install.databasecollationazure"), Collation, DatabaseHelper.DEFAULT_DB_COLLATION);
         rbLeaveCollation.Visible    = false;
         rbChangeCollationCI.Visible = false;
     }
 }
Example #11
0
    /// <summary>
    /// Set connection string into web.config.
    /// </summary>
    private void SetConnectionString()
    {
        string connectionStringName = DatabaseSeparationHelper.ConnStringSeparateName;

        if (!SystemContext.IsRunningOnAzure)
        {
            if (!SettingsHelper.SetConnectionString(connectionStringName, databaseDialog.ConnectionString))
            {
                string connStringDisplay   = ConnectionHelper.GetConnectionString(databaseDialog.AuthenticationType, databaseDialog.ServerName, databaseDialog.Database, databaseDialog.Username, databaseDialog.Password, 240, true);
                string resultStringDisplay = "&lt;add name=\"" + connectionStringName + "\" connectionString=\"" + connStringDisplay + "\"/&gt;";

                separationFinished.ErrorLabel.Visible = true;
                separationFinished.ErrorLabel.Text    = string.Format(ResHelper.GetFileString("Install.ConnectionStringError"), resultStringDisplay);
            }
        }
        else
        {
            string connStringValue = ConnectionHelper.GetConnectionString(databaseDialog.AuthenticationType, databaseDialog.ServerName, databaseDialog.Database, databaseDialog.Username, databaseDialog.Password, 240, true, "English", true);
            string connString      = "&lt;add name=\"" + connectionStringName + "\" connectionString=\"" + connStringValue + "\"/&gt;";
            string appSetting      = "&lt;Setting name=\"" + connectionStringName + "\" value=\"" + connStringValue + "\"/&gt;";

            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text    = string.Format(ResHelper.GetFileString("Install.ConnectionStringAzure"), connString, appSetting);
        }

        bool dbEngineSupportsOpenqueryCommand = !DatabaseSeparationHelper.IsUsingAzureDatabase;

        if (!dbEngineSupportsOpenqueryCommand)
        {
            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text   += GetManualCopyText();
        }

        if (PersistentStorageHelper.GetValueFromFile("SeparateDBSites") == null)
        {
            if (!separationFinished.ErrorLabel.Visible)
            {
                separationFinished.ErrorLabel.Text += "<br />";
            }
            else
            {
                separationFinished.ErrorLabel.Visible = true;
            }
            separationFinished.ErrorLabel.Text += ResHelper.GetFileString("separationdb.startsites");
        }
    }
Example #12
0
    /// <summary>
    /// Set connection string into web.config.
    /// </summary>
    private void SetConnectionString()
    {
        string connectionStringName = DatabaseSeparationHelper.ConnStringSeparateName;
        string encodedPassword      = HttpUtility.HtmlEncode(HttpUtility.HtmlEncode(databaseDialog.Password));

        if (!SystemContext.IsRunningOnAzure)
        {
            if (!SettingsHelper.SetConnectionString(connectionStringName, databaseDialog.ConnectionString))
            {
                string connStringDisplay   = ConnectionHelper.BuildConnectionString(databaseDialog.AuthenticationType, databaseDialog.ServerName, databaseDialog.Database, databaseDialog.Username, encodedPassword, 240);
                string resultStringDisplay = "&lt;add name=\"" + connectionStringName + "\" connectionString=\"" + connStringDisplay + "\"/&gt;";

                separationFinished.ErrorLabel.Visible = true;
                separationFinished.ErrorLabel.Text    = string.Format(ResHelper.GetFileString("Install.ConnectionStringError"), resultStringDisplay);
            }
        }
        else
        {
            string connStringValue = ConnectionHelper.BuildConnectionString(databaseDialog.AuthenticationType, databaseDialog.ServerName, databaseDialog.Database, databaseDialog.Username, encodedPassword, 240, isForAzure: true);
            string connString      = "&lt;add name=\"" + connectionStringName + "\" connectionString=\"" + connStringValue + "\"/&gt;";
            string appSetting      = "&lt;Setting name=\"" + connectionStringName + "\" value=\"" + connStringValue + "\"/&gt;";

            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text    = string.Format(ResHelper.GetFileString("Install.ConnectionStringAzure"), connString, appSetting);
        }

        // If it doesn't support OpenQuery command, show info about need to do manual data move.
        if (!SqlServerCapabilities.SupportsOpenQueryCommand)
        {
            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text   += GetManualCopyText();
        }

        if (PersistentStorageHelper.GetValue("SeparateDBSites") == null)
        {
            if (!separationFinished.ErrorLabel.Visible)
            {
                separationFinished.ErrorLabel.Text += "<br />";
            }
            else
            {
                separationFinished.ErrorLabel.Visible = true;
            }
            separationFinished.ErrorLabel.Text += ResHelper.GetFileString("separationdb.startsites");
        }
    }
    /// <summary>
    /// Data bind.
    /// </summary>
    public void ReloadData()
    {
        if (WebTemplateInfoProvider.IsAnyTemplatePresent())
        {
            DataSet dsTemplates = WebTemplateInfoProvider.GetWebTemplates(null, "WebTemplateOrder", 0, null, true);
            if (!DataHelper.DataSourceIsEmpty(dsTemplates))
            {
                string firstTemplateName = "";
                int    firstTemplateId   = 0;

                // Find first allowed template
                foreach (DataRow row in dsTemplates.Tables[0].Rows)
                {
                    string templateEditions = ValidationHelper.GetString(row["WebTemplateLicenses"], "");
                    string templatePackages = ValidationHelper.GetString(row["WebTemplatePackages"], "");
                    if (IsTemplateAllowed(templateEditions, templatePackages))
                    {
                        firstTemplateName = ValidationHelper.GetString(row["WebTemplateName"], "");
                        firstTemplateId   = ValidationHelper.GetInteger(row["WebTemplateID"], 0);
                        break;
                    }
                }

                // Bind the list
                rptSites.DataSource = dsTemplates;
                rptSites.DataBind();

                // Select Corporate site by default
                if (string.IsNullOrEmpty(hdnLastSelected.Value) || (hdnLastSelected.Value == "0"))
                {
                    ltlScriptAfter.Text += ScriptHelper.GetScript("SelectTemplate('tpl" + firstTemplateId + "','" + firstTemplateName + "');");
                }
            }
        }
        else
        {
            plcInfo.Visible      = true;
            lblInfo.Text         = ResHelper.GetFileString("Install.TemplatesWarning");
            radWizard.Enabled    = false;
            radTemplate.Enabled  = false;
            plcTemplates.Visible = false;
            radExisting.Checked  = true;
        }
    }
Example #14
0
    /// <summary>
    /// Initialize wizard header.
    /// </summary>
    /// <param name="index">Step index</param>
    private void InitializeHeader(int index)
    {
        Help.Visible      = true;
        StartHelp.Visible = true;

        string imgName = null;

        lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - ";

        switch (index)
        {
        // SQL server and authentication mode
        case 0:
            imgName             = "header_separation_0.png";
            StartHelp.TopicName = Help.TopicName = "DBSeparation_StepConnection";
            lblHeader.Text     += ResHelper.GetString("separationDB.Step0");
            break;

        // Database
        case 1:
            imgName             = "header_separation_1.png";
            StartHelp.TopicName = Help.TopicName = "DBSeparation_StepDB";
            lblHeader.Text     += ResHelper.GetFileString("separationDB.Step1");
            break;

        // Separation
        case 2:
            imgName           = "header_separation_2.png";
            StartHelp.Visible = Help.Visible = false;
            lblHeader.Text   += ResHelper.GetFileString("separationDB.Step2");
            break;

        // Finish step
        case 3:
            imgName             = "header_separation_3.png";
            StartHelp.TopicName = Help.TopicName = "DBSeparation_StepFinish";
            lblHeader.Text     += ResHelper.GetFileString("Install.Step7");
            break;
        }

        lblHeader.Text          = string.Format(lblHeader.Text, wzdInstaller.ActiveStepIndex + 1);
        imgHeader.ImageUrl      = GetImageUrl("Others/Install/" + imgName);
        imgHeader.AlternateText = "Header";
    }
    protected string GetItemHTML(object dataItem)
    {
        DataRowView view                = (DataRowView)dataItem;
        string      templateId          = ValidationHelper.GetString(view["WebTemplateID"], "");
        string      templateName        = ValidationHelper.GetString(view["WebTemplateName"], "");
        string      templateDisplayName = ValidationHelper.GetString(view["WebTemplateDisplayName"], "");
        string      templateDescription = ValidationHelper.GetString(view["WebTemplateShortDescription"], "");
        string      templateEditions    = ValidationHelper.GetString(view["WebTemplateLicenses"], "");
        bool        isAllowed           = false;

        // Check if the current license is suitable for web template
        isAllowed = IsTemplateAllowed(templateEditions);

        // Generate HTML code
        StringBuilder builder = new StringBuilder();

        string cssClass     = isAllowed ? "install-item" : "install-disabled-item";
        string textColor    = isAllowed ? "" : "color:Silver;";
        string errorMessage = "";

        if (!isAllowed)
        {
            errorMessage  = "<div style=\"color:Red;\"><br />";
            errorMessage += String.Format(ResHelper.GetFileString("Install.WebTemplateRequiresLicense"), EditionsToString(templateEditions));
            errorMessage += ". " + String.Format(ResHelper.GetFileString("Install.WebTemplateCurrentLicense"), GetEditionName(CurrentEdition));
            // Finish the sentence
            errorMessage += ".</div>";
        }

        builder.Append("<div class=\"" + cssClass + "\" id=\"tpl" + templateId + "\"");
        if (isAllowed)
        {
            builder.Append(" onclick=\"SelectTemplate('tpl" + templateId + "','" + templateName + "')\"");
        }
        builder.Append(">\n");
        builder.Append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n");
        builder.Append("<tr>\n<td style=\"vertical-align:top;\">\n");
        builder.Append("<img style=\"margin: 3px;\" src=\"" + GetPreviewImage(templateId) + "\" width=\"140\" height=\"108\" alt=\"Preview\" />\n");
        builder.Append("</td>\n<td style=\"vertical-align:top;\">\n");
        builder.Append("<div style=\"margin: 3px;" + textColor + "\">\n<div>\n<strong>" + templateDisplayName + "</strong></div>\n");
        builder.Append("<br /><div>" + templateDescription + "</div>" + errorMessage + "</div></td></tr>\n</table>\n</div>\n");
        return(builder.ToString());
    }
Example #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     lblExistingDatabaseName.Text = ResHelper.GetFileString("Install.lblExistingDatabaseName");
     lblAdvanced.Text             = ResHelper.GetFileString("install.ShowAdvancedOptions");
     lblAdvanced.NavigateUrl      = "#";
     lblAdvanced.Attributes.Add("onclick", " AdvancedOptions('?'); ");
     lblNewDatabaseName.Text       = ResHelper.GetFileString("Install.lblNewDatabaseName");
     lblSchema.Text                = ResHelper.GetFileString("Install.Schema") + ":";
     lblDatabase.Text              = IsDBSeparation ? GetString("separationDB.database") : ResHelper.GetFileString("Install.lblDatabase");
     radCreateNew.Text             = ResHelper.GetFileString("Install.radCreateNew");
     radUseExisting.Text           = ResHelper.GetFileString("Install.radUseExisting");
     chkCreateDatabaseObjects.Text = ResHelper.GetFileString("Install.chkCreateDatabaseObjects");
     plcRunningTasks.Visible       = IsDBSeparation;
     btnStopTasks.Click           += btnStopTasks_Click;
     if (IsDBSeparation)
     {
         iconHelp.ToolTip = spanScreenReader.Text = GetString("separationDB.enabledtasksseparation");
     }
 }
    /// <summary>
    /// Adds trial license keys to DB. No license is added when running in web application gallery mode.
    /// </summary>
    private bool AddTrialLicenseKeys()
    {
        // Skip creation of trial license keys if running in WWAG mode
        if (ValidationHelper.GetBoolean(Service.Resolve <IAppSettingsService>()[WWAG_KEY], false))
        {
            return(false);
        }

        string licenseKey = ValidationHelper.GetString(Service.Resolve <IAppSettingsService>()["CMSTrialKey"], String.Empty);

        if (licenseKey != String.Empty)
        {
            return(LicenseHelper.AddTrialLicenseKeys(licenseKey, true, false));
        }

        pnlError.ErrorLabelText = ResHelper.GetFileString("Install.ErrorTrialLicense");

        return(false);
    }
Example #18
0
    /// <summary>
    /// Set connection string into web.config.
    /// </summary>
    private void SetConnectionString()
    {
        if (!SystemContext.IsRunningOnAzure)
        {
            if (!SettingsHelper.RemoveConnectionString(DatabaseSeparationHelper.ConnStringSeparateName))
            {
                separationFinished.ErrorLabel.Visible = true;
                string resultStringDisplay = " <br/><br/><strong>&lt;add name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" connectionString=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;</strong><br/><br/>";
                separationFinished.ErrorLabel.Text = GetString("separationDB.removeConnectionStringError") + resultStringDisplay;
            }
        }
        else
        {
            string connString = "&lt;add name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" connectionString=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;";
            string appSetting = "&lt;Setting name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" value=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;";

            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text    = String.Format(ResHelper.GetString("separationDB.removeConnectionStringErrorAzure"), connString, appSetting);
        }

        bool dbEngineSupportsOpenqueryCommand = !DatabaseSeparationHelper.IsUsingAzureDatabase;

        if (!dbEngineSupportsOpenqueryCommand)
        {
            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text   += GetManualCopyText();
        }

        if (PersistentStorageHelper.GetValueFromFile("SeparateDBSites") == null)
        {
            if (!separationFinished.ErrorLabel.Visible)
            {
                separationFinished.ErrorLabel.Text += "<br />";
            }
            else
            {
                separationFinished.ErrorLabel.Visible = true;
            }
            separationFinished.ErrorLabel.Text += ResHelper.GetFileString("separationdb.startsites");
        }
    }
Example #19
0
    /// <summary>
    /// Set connection string into web.config.
    /// </summary>
    private void SetConnectionString()
    {
        if (!SystemContext.IsRunningOnAzure)
        {
            if (!SettingsHelper.RemoveConnectionString(DatabaseSeparationHelper.ConnStringSeparateName))
            {
                separationFinished.ErrorLabel.Visible = true;
                string resultStringDisplay = " <br/><br/><strong>&lt;add name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" connectionString=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;</strong><br/><br/>";
                separationFinished.ErrorLabel.Text = GetString("separationDB.removeConnectionStringError") + resultStringDisplay;
            }
        }
        else
        {
            string connString = "&lt;add name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" connectionString=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;";
            string appSetting = "&lt;Setting name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" value=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;";

            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text    = String.Format(GetString("separationDB.removeConnectionStringErrorAzure"), connString, appSetting);
        }

        // If it doesn't support OpenQuery command, show info about need to do manual data move.
        if (!SqlServerCapabilities.SupportsOpenQueryCommand)
        {
            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text   += GetManualCopyText();
        }

        if (PersistentStorageHelper.GetValue("SeparateDBSites") == null)
        {
            if (!separationFinished.ErrorLabel.Visible)
            {
                separationFinished.ErrorLabel.Text += "<br />";
            }
            else
            {
                separationFinished.ErrorLabel.Visible = true;
            }
            separationFinished.ErrorLabel.Text += ResHelper.GetFileString("separationdb.startsites");
        }
    }
Example #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblDBPassword.Text = ResHelper.GetFileString("Install.lblPassword");
        lblDBUsername.Text = ResHelper.GetFileString("Install.lblUsername");
        lblServerName.Text = ResHelper.GetFileString("Install.lblServername");
        lblSQLServer.Text  = IsDBSeparation ? GetString("separationDB.server") : ResHelper.GetFileString("Install.lblSQLServer");

        txtDBPassword.Enabled = radSQLAuthentication.Checked;
        txtDBUsername.Enabled = radSQLAuthentication.Checked;

        radSQLAuthentication.Text = ResHelper.GetFileString("Install.radSQlAuthentication");

        if (ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CMSWWAGInstallation"], false))
        {
            radWindowsAuthentication.Text    = "Windows authentication is disabled (it is not supported by SQL Azure)";
            radWindowsAuthentication.Enabled = false;
        }
        else
        {
            radWindowsAuthentication.Text = ResHelper.GetFileString("Install.radWindowsAuthentication") + "<br /><span class=\"InstallAccountName\">" + String.Format(ResHelper.GetFileString("Install.Account"), WindowsIdentity.GetCurrent().Name) + "</span>";
        }
    }
    /// <summary>
    /// Logs progress state.
    /// </summary>
    /// <param name="type">Type of the message</param>
    /// <param name="message">Message to be logged</param>
    private void LogProgressState(LogStatusEnum type, string message)
    {
        message = HTMLHelper.HTMLEncode(message);

        string logMessage  = null;
        string messageType = null;

        switch (type)
        {
        case LogStatusEnum.Info:
        case LogStatusEnum.Start:
            logMessage = message;
            break;

        case LogStatusEnum.Error:
        {
            messageType = "##ERROR##";
            logMessage  = "<strong>" + ResHelper.GetFileString("Global.ErrorSign", "ERROR:") + "&nbsp;</strong>" + message;
        }
        break;

        case LogStatusEnum.Warning:
        {
            messageType = "##WARNING##";
            logMessage  = "<strong>" + ResHelper.GetFileString("Global.Warning", "WARNING:") + "&nbsp;</strong>" + message;
        }
        break;

        case LogStatusEnum.Finish:
        case LogStatusEnum.UnexpectedFinish:
            logMessage = "<strong>" + message + "</strong>";
            break;
        }

        logMessage = messageType + logMessage;

        // Log to context
        Info.LogContext.AppendText(logMessage);
    }
    /// <summary>
    /// Try to set new license for actual domain.
    /// </summary>
    public void SetLicenseKey()
    {
        if (txtLicense.Text == "")
        {
            throw new InvalidOperationException(ResHelper.GetFileString("Install.LicenseEmpty"));
        }

        LicenseKeyInfo lki = new LicenseKeyInfo();

        lki.LoadLicense(txtLicense.Text, FullHostName);

        switch (lki.ValidationResult)
        {
        case LicenseValidationEnum.Expired:
            throw new InvalidOperationException(ResHelper.GetFileString("Install.LicenseNotValid.Expired"));

        case LicenseValidationEnum.Invalid:
            throw new InvalidOperationException(ResHelper.GetFileString("Install.LicenseNotValid.Invalid"));

        case LicenseValidationEnum.NotAvailable:
            throw new InvalidOperationException(ResHelper.GetFileString("Install.LicenseNotValid.NotAvailable"));

        case LicenseValidationEnum.WrongFormat:
            throw new InvalidOperationException(ResHelper.GetFileString("Install.LicenseNotValid.WrongFormat"));

        case LicenseValidationEnum.Valid:
            // Try to store license into database
            if ((FullHostName == "localhost") || (FullHostName == "127.0.0.1") || (lki.Domain == FullHostName))
            {
                LicenseKeyInfoProvider.SetLicenseKeyInfo(lki);
            }
            else
            {
                throw new InvalidOperationException(ResHelper.GetFileString("Install.LicenseForDifferentDomain"));
            }

            break;
        }
    }
    /// <summary>
    /// Sets step, that prompts user to enter connection string manually to web.config. ConnectionString is built inside the method.
    /// </summary>
    private void ManualConnectionStringInsertion()
    {
        var encodedPassword  = HttpUtility.HtmlEncode(HttpUtility.HtmlEncode(Password));
        var connectionString = ConnectionHelper.BuildConnectionString(AuthenticationType, userServer.ServerName, Database, userServer.DBUsername, encodedPassword, SqlInstallationHelper.DB_CONNECTION_TIMEOUT, isForAzure: SystemContext.IsRunningOnAzure);

        // Set error message
        var connectionStringEntry    = $"&lt;add name=\"CMSConnectionString\" connectionString=\"{connectionString}\"/&gt;";
        var applicationSettingsEntry = $"&lt;Setting name=\"CMSConnectionString\" value=\"{connectionString}\"/&gt;";

        lblErrorConnMessage.Text = SystemContext.IsRunningOnAzure
            ? String.Format(ResHelper.GetFileString("Install.ConnectionStringAzure"), connectionStringEntry, applicationSettingsEntry)
            : String.Format(ResHelper.GetFileString("Install.ConnectionStringError"), connectionStringEntry);

        // Set step that prompts user to enter connection string to web.config
        wzdInstaller.ActiveStepIndex = 2;

        if (!SystemContext.IsRunningOnAzure)
        {
            // Show troubleshoot link
            pnlError.DisplayError("Install.ErrorPermissions", HELP_TOPIC_DISK_PERMISSIONS_LINK);
        }
    }
Example #24
0
    /// <summary>
    /// Initializes controls.
    /// </summary>
    private void SetControls()
    {
        if (!RequestHelper.IsCallback())
        {
            PreviousButton.Attributes.Remove("disabled");
            NextButton.Attributes.Remove("disabled");
        }

        StartHelp.Tooltip      = ResHelper.GetFileString("install.tooltip");
        StartHelp.TopicName    = HELP_TOPIC_LINK;
        StartHelp.IconCssClass = "cms-icon-80";
        Response.Cache.SetNoStore();
        Help.Tooltip      = ResHelper.GetFileString("install.tooltip");
        Help.IconCssClass = "cms-icon-80";
        separationFinished.InfoLabel.ResourceString = "separationDB.joinOK";
        progress.NextButtonClientID             = NextButton.ClientID;
        progress.PreviousButtonClientID         = PreviousButton.ClientID;
        asyncControl.OnFinished                += asyncControl_OnFinished;
        asyncControl.OnError                   += asyncControl_OnError;
        PageTitle.TitleText                     = GetString("separationDB.joinTitle");
        CurrentMaster.Body.Attributes["class"] += " install-body-join";
        asyncControl.LogPanel.CssClass          = "Hidden";
    }
    /// <summary>
    /// Initialize wizard header.
    /// </summary>
    /// <param name="index">Step index</param>
    private void InitializeHeader(int index)
    {
        Help.Visible      = true;
        StartHelp.Visible = true;

        string imgName = null;

        lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - ";

        switch (index)
        {
        // Ready
        case 0:
            imgName             = "header_join_0.png";
            StartHelp.TopicName = Help.TopicName = "DBJoin_StepRead";
            lblHeader.Text     += ResHelper.GetString("separationDB.joinStep0");
            break;

        // Progress
        case 1:
            imgName           = "header_join_1.png";
            StartHelp.Visible = Help.Visible = false;
            lblHeader.Text   += ResHelper.GetFileString("separationDB.joinStep1");
            break;

        // Finish step
        case 2:
            imgName             = "header_join_2.png";
            StartHelp.TopicName = Help.TopicName = "DBJoin_StepFinish";
            lblHeader.Text     += ResHelper.GetFileString("Install.Step7");
            break;
        }

        lblHeader.Text          = string.Format(lblHeader.Text, wzdInstaller.ActiveStepIndex + 1);
        imgHeader.ImageUrl      = GetImageUrl("Others/Install/" + imgName);
        imgHeader.AlternateText = "Header";
    }
    /// <summary>
    /// Validates control, returns error if failed.
    /// </summary>
    public bool ValidateForSeparation()
    {
        // Check if separation is not already completed
        if (SqlInstallationHelper.DatabaseIsSeparated())
        {
            DisplaySeparationError(GetString("separationDB.separationerror"));
            return(false);
        }

        // Check the server name
        if (String.IsNullOrEmpty(txtServerName.Text))
        {
            DisplaySeparationError(ResHelper.GetFileString("Install.ErrorServerEmpty"));
            return(false);
        }

        if (radSQLAuthentication.Checked)
        {
            // Check the user name and password
            if (String.IsNullOrEmpty(txtDBUsername.Text) || String.IsNullOrEmpty(txtDBPassword.Text))
            {
                DisplaySeparationError(ResHelper.GetFileString("install.errorusernamepasswordempty"));
                return(false);
            }
        }

        // Check if it is possible to connect to the database
        string res = TestNewConnection();

        if (string.IsNullOrEmpty(res))
        {
            return(true);
        }

        DisplaySeparationError(res);
        return(false);
    }
Example #27
0
    /// <summary>
    /// Initialize wizard header.
    /// </summary>
    /// <param name="index">Step index</param>
    private void InitializeHeader(int index)
    {
        Help.Visible        = true;
        StartHelp.Visible   = true;
        StartHelp.TopicName = Help.TopicName = HELP_TOPIC_LINK;

        lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - ";

        string[] stepIcons  = { " icon-cogwheel", " icon-database", " icon-separate", " icon-check-circle icon-style-allow" };
        string[] stepTitles = { GetString("install.sqlsetting"), GetString("install.lbldatabase"), GetString("install.separation"), GetString("install.finishstep") };

        // Set common properties to each step icon
        for (var i = 0; i < stepIcons.Length; i++)
        {
            // Step panel
            var pnlStepIcon = new Panel();
            pnlStepIcon.ID       = "stepPanel" + i;
            pnlStepIcon.CssClass = "install-step-panel";
            pnlHeaderImages.Controls.Add(pnlStepIcon);

            // Step icon
            var icon = new CMSIcon();
            icon.ID       = "stepIcon" + i;
            icon.CssClass = "install-step-icon cms-icon-200" + stepIcons[i];
            icon.Attributes.Add("aria-hidden", "true");
            pnlStepIcon.Controls.Add(icon);

            // Step icon title
            var title = new HtmlGenericControl("title");
            title.ID        = "stepTitle" + i;
            title.InnerText = stepTitles[i];
            title.Attributes.Add("class", "install-step-title");
            pnlStepIcon.Controls.Add(title);

            // Render separator only between step icons
            if (i < stepIcons.Length - 1)
            {
                // Separator panel
                var pnlSeparator = new Panel();
                pnlSeparator.ID       = "separatorPanel" + i;
                pnlSeparator.CssClass = "install-step-icon-separator";
                pnlHeaderImages.Controls.Add(pnlSeparator);

                // Separator icon
                var separatorIcon = new CMSIcon();
                separatorIcon.CssClass = "icon-arrow-right cms-icon-150";
                separatorIcon.Attributes.Add("aria-hidden", "true");
                pnlSeparator.Controls.Add(separatorIcon);
            }
        }

        var currentStepIndex = wzdInstaller.ActiveStepIndex;

        switch (index)
        {
        // SQL server and authentication mode
        case 0:
            lblHeader.Text += ResHelper.GetString("separationDB.Step0");
            SetSelectedCSSClass("stepPanel0");
            break;

        // Database
        case 1:
        case COLLATION_DIALOG_INDEX:
            lblHeader.Text += ResHelper.GetFileString("separationDB.Step1");
            SetSelectedCSSClass("stepPanel1");
            currentStepIndex = 1;
            break;

        // Separation
        case 2:
            StartHelp.Visible = Help.Visible = false;
            lblHeader.Text   += ResHelper.GetFileString("separationDB.Step2");
            SetSelectedCSSClass("stepPanel2");
            break;

        // Finish step
        case 3:
            lblHeader.Text += ResHelper.GetFileString("Install.Step7");
            SetSelectedCSSClass("stepPanel3");
            break;
        }

        lblHeader.Text = string.Format(lblHeader.Text, currentStepIndex + 1);
    }
Example #28
0
    /// <summary>
    /// Initialize wizard header.
    /// </summary>
    /// <param name="index">Step index</param>
    private void InitializeHeader(int index)
    {
        Help.Visible        = true;
        StartHelp.Visible   = true;
        StartHelp.TopicName = Help.TopicName = HELP_TOPIC_LINK;

        lblHeader.Text = ResHelper.GetFileString("Install.Step") + " - ";

        string[] stepIcons  = { " icon-cogwheel", " icon-merge", " icon-check-circle icon-style-allow" };
        string[] stepTitles = { GetString("install.prerequisites"), GetString("install.merging"), GetString("install.finishstep") };

        // Set common properties to each step icon
        for (var i = 0; i < stepIcons.Length; i++)
        {
            // Step panel
            var pnlStepIcon = new Panel();
            pnlStepIcon.ID       = "stepPanel" + i;
            pnlStepIcon.CssClass = "install-step-panel";
            pnlHeaderImages.Controls.Add(pnlStepIcon);

            // Step icon
            var icon = new CMSIcon();
            icon.ID       = "stepIcon" + i;
            icon.CssClass = "install-step-icon cms-icon-200" + stepIcons[i];
            icon.Attributes.Add("aria-hidden", "true");
            pnlStepIcon.Controls.Add(icon);

            // Step icon title
            var title = new HtmlGenericControl("title");
            title.ID        = "stepTitle" + i;
            title.InnerText = stepTitles[i];
            title.Attributes.Add("class", "install-step-title");
            pnlStepIcon.Controls.Add(title);

            // Render separator only between step icons
            if (i < stepIcons.Length - 1)
            {
                // Separator panel
                var pnlSeparator = new Panel();
                pnlSeparator.ID       = "separatorPanel" + i;
                pnlSeparator.CssClass = "install-step-icon-separator";
                pnlHeaderImages.Controls.Add(pnlSeparator);

                // Separator icon
                var separatorIcon = new CMSIcon();
                separatorIcon.CssClass = "icon-arrow-right cms-icon-150";
                separatorIcon.Attributes.Add("aria-hidden", "true");
                pnlSeparator.Controls.Add(separatorIcon);
            }
        }

        switch (index)
        {
        // Ready
        case 0:
        {
            lblHeader.Text += GetString("separationDB.joinStep0");
            SetSelectedCSSClass("stepPanel0");
            break;
        }

        // Progress
        case 1:
        {
            StartHelp.Visible = Help.Visible = false;
            lblHeader.Text   += ResHelper.GetFileString("separationDB.joinStep1");
            SetSelectedCSSClass("stepPanel1");
            break;
        }

        // Finish step
        case 2:
        {
            lblHeader.Text += ResHelper.GetFileString("Install.Step7");
            SetSelectedCSSClass("stepPanel2");
            break;
        }
        }

        lblHeader.Text = string.Format(lblHeader.Text, wzdInstaller.ActiveStepIndex + 1);
    }
Example #29
0
    /// <summary>
    /// Validates control.
    /// </summary>
    public bool ValidateForSeparation()
    {
        // Get database name
        if (radCreateNew.Checked && SqlServerCapabilities.SupportsDatabaseCreation)
        {
            Database = txtNewDatabaseName.Text;
        }
        else
        {
            Database = txtExistingDatabaseName.Text;
        }
        Database = TextHelper.LimitLength(Database, 100, String.Empty);

        if (String.IsNullOrEmpty(Database))
        {
            DisplaySeparationError(GetString("Install.ErrorDBNameEmpty"));
            return(false);
        }

        // Set up the connection string
        ConnectionString = ConnectionHelper.BuildConnectionString(AuthenticationType, ServerName, Database, Username, Password, 240);

        // Test existing DB
        if (radUseExisting.Checked || !SqlServerCapabilities.SupportsDatabaseCreation)
        {
            if (SqlServerCapabilities.ControlServerPermissionAvailable &&
                !DatabaseHelper.CheckDBPermission(DatabasePermission.ModifyDatabase, AuthenticationType, ServerName, Username, Password))
            {
                DisplaySeparationError(GetString("separationDB.permissionmodify"));
                return(false);
            }

            if (!String.IsNullOrEmpty(ConnectionHelper.TestConnection(AuthenticationType, ServerName, Database, Username, Password)))
            {
                DisplaySeparationError(String.Format(ResHelper.GetFileString("Install.ErrorDatabseDoesntExist"), Database));
                return(false);
            }

            if (DatabaseSeparationHelper.CheckCMDatabase(ConnectionString))
            {
                DisplaySeparationError(GetString("separationDB.errorCMexists"));
                return(false);
            }
        }
        // Test new DB
        else
        {
            if (DatabaseHelper.DatabaseExists(ConnectionString))
            {
                DisplaySeparationError(GetString("separationDB.ErrorDBExists"));
                return(false);
            }
            if (SqlServerCapabilities.ControlServerPermissionAvailable)
            {
                if (!DatabaseHelper.CheckDBPermission(DatabasePermission.ModifyDatabase, AuthenticationType, ServerName, Username, Password))
                {
                    DisplaySeparationError(GetString("separationDB.permissionmodify"));
                    return(false);
                }
                if (!DatabaseHelper.CheckDBPermission(DatabasePermission.CreateDatabase, AuthenticationType, ServerName, Username, Password))
                {
                    DisplaySeparationError(GetString("separationDB.permissioncreate"));
                    return(false);
                }
            }
        }

        // Test if tasks are stopped
        if (SchedulingHelper.EnableScheduler || SchedulingHelper.IsAnyTaskRunning())
        {
            DisplaySeparationError(GetString("separationDB.stoptaskserror"));
            return(false);
        }
        iconHelp.Visible = btnStopTasks.Visible = true;

        // Test if separation process is not already started.
        if (DatabaseSeparationHelper.SeparationInProgress)
        {
            DisplaySeparationError(GetString("separationDB.processalreadystarted"));
            return(false);
        }

        return(true);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     lblLog.Text = ResHelper.GetFileString("Install.lblLog");
 }