protected void RegisterClientSideBaseValidationScripts() { var template = new ScriptTemplate(this, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.BaseValidator.js"); template.Replace("@@CLIENTID@@", ClientID); template.Replace("@@INPUT_CLIENTID@@", InputControl.ClientID); template.Replace("@@INPUT_NORMAL_BKCOLOR@@", ColorTranslator.ToHtml(InputNormalColor)); template.Replace("@@INPUT_INVALID_BKCOLOR@@", ColorTranslator.ToHtml(InvalidInputColor)); template.Replace("@@INPUT_NORMAL_BORDERCOLOR@@", ColorTranslator.ToHtml(InputNormalBorderColor)); template.Replace("@@INPUT_INVALID_BORDERCOLOR@@", ColorTranslator.ToHtml(InvalidInputBorderColor)); template.Replace("@@INPUT_NORMAL_CSS@@", InputNormalCSS); template.Replace("@@INPUT_INVALID_CSS@@", InvalidInputCSS); template.Replace("@@CLIENT_EVALUATION_CLASS@@", ClientSideOnValidateFunctionName); template.Replace("@@IGNORE_EMPTY_VALUE@@", IgnoreEmptyValue ? "true" : "false"); Page.ClientScript.RegisterClientScriptBlock(GetType(), "BaseValidationScripts", template.Script, true); template = new ScriptTemplate(this, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.BaseValidator_OnClientValidation.js"); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientSideOnValidateFunctionName, template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { var template = new ScriptTemplate(this, "MatrixPACS.ImageServer.Web.Common.WebControls.Validators.WebServiceValidator.js"); template.Replace("@@WEBSERVICE_OPERATION@@", ServiceOperation); template.Replace("@@WEBSERVICE_URL@@", ServiceURL); template.Replace("@@PARAMETER_FUNCTION@@", ParamsFunction); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { var template = new ScriptTemplate(this, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.DateValidator.js"); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@IGNORE_EMPTY_VALUE@@", IgnoreEmptyValue ? "true" : "false"); template.Replace("@@DATE_FORMAT@@", InputDateParser.DateFormat); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { var template = new ScriptTemplate(this, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.RangeValidator.js"); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@MIN_VALUE@@", MinValue.ToString()); template.Replace("@@MAX_VALUE@@", MaxValue.ToString()); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { var template = new ScriptTemplate(this, "MatrixPACS.ImageServer.Web.Common.WebControls.Validators.RangeValidator.js"); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@MIN_VALUE@@", MinValue.ToString()); template.Replace("@@MAX_VALUE@@", MaxValue.ToString()); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { var template = new ScriptTemplate(this, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.RegularExpressionValidator.js"); template.Replace("@@REGULAR_EXPRESSION@@", ValidationExpression.Replace("\\", "\\\\").Replace("'", "\\'")); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@IGNORE_EMPTY_VALUE@@", IgnoreEmptyValue ? "true" : "false"); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { var template = new ScriptTemplate(this, "Macro.ImageServer.Web.Common.WebControls.Validators.RegularExpressionValidator.js"); template.Replace("@@REGULAR_EXPRESSION@@", ValidationExpression.Replace("\\", "\\\\").Replace("'", "\\'")); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@IGNORE_EMPTY_VALUE@@", IgnoreEmptyValue ? "true" : "false"); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { RegisterClientSideBaseValidationScripts(); var template = new ScriptTemplate(this, "MatrixPACS.ImageServer.Web.Common.WebControls.Validators.ConditionalRequiredFieldValidator.js"); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@IGNORE_EMPTY_VALUE@@", IgnoreEmptyValue ? "true" : "false"); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected void RegisterWebServiceInitScripts() { var template = new ScriptTemplate(GetType().Assembly, "MatrixPACS.ImageServer.Web.Common.WebControls.Validators.WebServiceValidator_Init.js"); template.Replace("@@WEBSERVICE_URL@@", ServiceURL); Page.ClientScript.RegisterStartupScript(GetType(), "WebServiceInit", template.Script, true); }
protected override void OnInit(EventArgs e) { base.OnInit(e); PhoneticNameRowIndicator.ImageUrl = ImageServerConstants.ImageURLs.PhoneticName; IdeographyNameIndicator.ImageUrl = ImageServerConstants.ImageURLs.IdeographyName; var script = new ScriptTemplate(typeof(PersonNameInputPanel).Assembly, "Macro.ImageServer.Web.Application.Controls.PersonNameInputPanel.js"); script.Replace("@@CLIENTID@@", ClientID); script.Replace("@@PHONETIC_ROW_CLIENTID@@", PhoneticRow.ClientID); script.Replace("@@IDEOGRAPHY_ROW_CLIENTID@@", IdeographicRow.ClientID); ShowOtherNameFormatButton.OnClientClick = ClientID + "_ShowOtherNameFormats(); return false;"; Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID, script.Script, true); PersonGivenNameValidator.IgnoreEmptyValue = !Required; PersonLastNameValidator.IgnoreEmptyValue = !Required; //Dynamically set all of the Validation Groups PersonTitle.ValidationGroup = ValidationGroup; PersonTitleValidator.ValidationGroup = ValidationGroup; PersonGivenName.ValidationGroup = ValidationGroup; PersonGivenNameValidator.ValidationGroup = ValidationGroup; PersonMiddleName.ValidationGroup = ValidationGroup; PersonMiddleNameValidator.ValidationGroup = ValidationGroup; PersonLastName.ValidationGroup = ValidationGroup; PersonLastNameValidator.ValidationGroup = ValidationGroup; PersonSuffix.ValidationGroup = ValidationGroup; PersonSuffixValidator.ValidationGroup = ValidationGroup; PhoneticTitle.ValidationGroup = ValidationGroup; PhoneticGivenName.ValidationGroup = ValidationGroup; PhoneticMiddleName.ValidationGroup = ValidationGroup; PhoneticLastName.ValidationGroup = ValidationGroup; PhoneticSuffix.ValidationGroup = ValidationGroup; IdeographicTitle.ValidationGroup = ValidationGroup; IdeographicGivenName.ValidationGroup = ValidationGroup; IdeographicMiddleName.ValidationGroup = ValidationGroup; IdeographicLastName.ValidationGroup = ValidationGroup; IdeographicSuffix.ValidationGroup = ValidationGroup; }
private void RegisterClientSideScripts() { ScriptTemplate template = new ScriptTemplate(typeof(AddFilesystemDialog).Assembly, "Macro.ImageServer.Web.Application.Pages.Admin.Configure.FileSystems.Filesystem.js"); template.Replace("@@HW_PERCENTAGE_INPUT_CLIENTID@@", HighWatermarkTextBox.ClientID); template.Replace("@@HW_SIZE_CLIENTID@@", HighWatermarkSize.ClientID); template.Replace("@@LW_PERCENTAGE_INPUT_CLIENTID@@", LowWatermarkTextBox.ClientID); template.Replace("@@LW_SIZE_CLIENTID@@", LowWaterMarkSize.ClientID); template.Replace("@@PATH_INPUT_CLIENTID@@", PathTextBox.ClientID); template.Replace("@@TOTAL_SIZE_INDICATOR_CLIENTID@@", TotalSizeIndicator.ClientID); template.Replace("@@USED_SIZE_INDICATOR_CLIENTID@@", UsedSizeIndicator.ClientID); template.Replace("@@TOTAL_SIZE_CLIENTID@@", TotalSize.ClientID); template.Replace("@@USED_SIZE_CLIENTID@@", AvailableSize.ClientID); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_scripts", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { // Register Javascript for client-side validation string comparison = GreaterThan ? ">=" : "<="; var template = new ScriptTemplate(this, "MatrixPACS.ImageServer.Web.Common.WebControls.Validators.RangeComparisonValidator.js"); template.Replace("@@COMPARE_INPUT_CLIENTID@@", GetControlRenderID(ControlToCompare)); template.Replace("@@MIN_VALUE@@", MinValue.ToString()); template.Replace("@@MAX_VALUE@@", MaxValue.ToString()); template.Replace("@@COMPARISON_OP@@", comparison); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@IGNORE_EMPTY_VALUE@@", IgnoreEmptyValue ? "true" : "false"); template.Replace("@@ERROR_MESSAGE@@", Escape(ErrorMessage)); Platform.Log(LogLevel.Error, template.Script); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
/// <summary> /// Takes the classless script written by the user and embeds it in the main script template. /// This gives the script access to the engine classes that it will require. /// </summary> /// <param name="script">The classless script.</param> /// <returns>The complete script.</returns> private String PrecompileScript(String script) { StringBuilder usings = new StringBuilder(4096); String classlessScript = String.Empty; script = script ?? String.Empty; using (StringReader sr = new StringReader(script)) { // Collect all using statements from the script String line = null; while ((line = sr.ReadLine()) != null) { // Ignore comments and whitespace if (line.StartsWith("//") || line.Trim() == String.Empty) { continue; } if (!line.TrimStart().StartsWith("using ")) { break; } // Collect using statement usings.AppendLine(line); } // The remaining portion of the script will be kept as the actual script if (line != null) { classlessScript = line + sr.ReadToEnd(); } } // Fill in the script template with the collected information script = new ScriptTemplate().TransformText().Replace(ScriptManager.ScriptUsingsInsertionIdentifier, usings.ToString()); script = script.Replace(ScriptManager.ScriptCodeInsertionIdentifier, classlessScript); return(script); }
protected override void RegisterClientSideValidationExtensionScripts() { // Register Javascript for client-side validation string comparison = GreaterThan ? ">=" : "<="; Platform.Log(LogLevel.Error, "RegisterClientSideValidationExtensionScripts = {0}", ErrorMessage); var template = new ScriptTemplate(this, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.RangeComparisonValidator.js"); template.Replace("@@COMPARE_INPUT_CLIENTID@@", GetControlRenderID(ControlToCompare)); template.Replace("@@MIN_VALUE@@", MinValue.ToString()); template.Replace("@@MAX_VALUE@@", MaxValue.ToString()); template.Replace("@@COMPARISON_OP@@", comparison); template.Replace("@@CONDITION_CHECKBOX_CLIENTID@@", ConditionalCheckBox != null ? ConditionalCheckBox.ClientID : "null"); template.Replace("@@VALIDATE_WHEN_UNCHECKED@@", ValidateWhenUnchecked ? "true" : "false"); template.Replace("@@IGNORE_EMPTY_VALUE@@", IgnoreEmptyValue ? "true" : "false"); template.Replace("@@ERROR_MESSAGE@@", ErrorMessage); Platform.Log(LogLevel.Error, template.Script); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }
protected void RegisterWebServiceInitScripts() { var template = new ScriptTemplate(GetType().Assembly, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.WebServiceValidator_Init.js"); template.Replace("@@WEBSERVICE_URL@@", ServiceURL); Page.ClientScript.RegisterStartupScript(GetType(), "WebServiceInit", template.Script, true); }
protected override void RegisterClientSideValidationExtensionScripts() { var template = new ScriptTemplate(this, "ClearCanvas.ImageServer.Web.Common.WebControls.Validators.WebServiceValidator.js"); template.Replace("@@WEBSERVICE_OPERATION@@", ServiceOperation); template.Replace("@@WEBSERVICE_URL@@", ServiceURL); template.Replace("@@PARAMETER_FUNCTION@@", ParamsFunction); Page.ClientScript.RegisterClientScriptBlock(GetType(), ClientID + "_ValidatorClass", template.Script, true); }