Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how can I rewrite this so I do not require dll ScriptHelper

Posted on 2010-09-16
3
Medium Priority
?
662 Views
Last Modified: 2012-05-10
ScriptHelper.RegisterStartupScript(this, GetType(), "closeSendDialog", ScriptHelper.GetScript("window.close();"));

how can I rewrite this so I do not require dll ScriptHelper
#region Assembly CMS.GlobalHelper.dll, v2.0.50727
// C:\inetpub\wwwroot\KenticoCMS\Bin\CMS.GlobalHelper.dll
#endregion

using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CMS.GlobalHelper
{
    // Summary:
    //     Methods for the script generating
    public static class ScriptHelper
    {
        // Summary:
        //     Script registration key for the dialog script
        public const string DIALOG_SCRIPT_KEY = "dialogScript";
        //
        // Summary:
        //     Edit document script key
        public const string EDIT_DOCUMENT_SCRIPT_KEY = "editDocumentScript";
        //
        // Summary:
        //     Script registration key for Lightbox
        public const string LIGHTBOX_KEY = "LightBox";
        //
        // Summary:
        //     Script registration key for the non modal win script
        public const string NEWWINDOW_SCRIPT_KEY = "newWindowScript";
        //
        // Summary:
        //     Prefix used for registering script files
        public const string SCRIPTFILE_PREFIX_KEY = "ScriptFile_";
        //
        // Summary:
        //     Script registration key for the editor toolbar
        public const string TOOLBAR_SCRIPT_KEY = "toolbarScript";
        //
        // Summary:
        //     Script registration key for cross-window scripting ("wopener")
        public const string WOPENER_SCRIPT_KEY = "wopenerScript";

        // Summary:
        //     If true, progress script is allowed on pages
        public static bool AllowProgressScript { get; set; }
        //
        // Summary:
        //     If true, automatic window title is enabled
        public static bool AllowTitleScript { get; set; }
        //
        // Summary:
        //     Capslock check script (OnCasplockOn and OnCapslockOff functions must be implemented)
        public static string CapslockScript { get; set; }
        //
        // Summary:
        //     Script code for the dialog handling
        public static string DialogScript { get; set; }
        //
        // Summary:
        //     Script code for the dialog handling
        public static string EditDocumentScript { get; set; }
        //
        // Summary:
        //     Script code for the dialog handling
        public static string NewWindowScript { get; set; }
        //
        // Summary:
        //     HTML Editor toolbar script
        public static string ToolbarScript { get; set; }
        //
        // Summary:
        //     Cross-window scripting script ("wopener")
        public static string WOpenerScript { get; set; }

        // Summary:
        //     Appends tooltip to control.
        //
        // Parameters:
        //   cntrl:
        //     Control
        //
        //   tooltipText:
        //     Tooltip
        //
        //   cursor:
        //     Mouse pointer
        public static void AppendTooltip(WebControl cntrl, string tooltipText, string cursor);
        //
        // Summary:
        //     Escapes the given HTML string for usage in the javascript string constant
        //
        // Parameters:
        //   text:
        //     Text to escape
        public static string EscapeHTMLString(string text);
        //
        // Summary:
        //     Escapes the given string for usage in the jQuery selectors. All meta-characters
        //     are escaped using '\'.
        //
        // Parameters:
        //   text:
        //     Text to escape.
        public static string EscapeJQueryCharacters(string text);
        //
        // Summary:
        //     Fixes common 'pendingCallbacks' javascript error
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void FixPendingCallbacks(Page page);
        //
        // Summary:
        //     Formats string to be used for tooltip
        //
        // Parameters:
        //   text:
        //     Tooltip string
        public static string FormatTooltipString(string text);
        //
        // Summary:
        //     Formats string to be used for tooltip
        //
        // Parameters:
        //   text:
        //     Tooltip string
        //
        //   encode:
        //     Indicates whether the tooltip text should be encoded
        public static string FormatTooltipString(string text, bool encode);
        //
        // Summary:
        //     Returns the javascript alert message
        //
        // Parameters:
        //   message:
        //     Message to display
        public static string GetAlertScript(string message);
        //
        // Summary:
        //     Returns the script to implement the specified code
        //
        // Parameters:
        //   url:
        //     URL of the script file
        public static string GetIncludeScript(string url);
        //
        // Summary:
        //     Returns javascript for page redirection.
        //
        // Parameters:
        //   url:
        //     Page url the user should be redirected to.
        //
        //   newWindowInCMSDesk:
        //     TREU - requested page should be opened in a new window when user is in CMSDesk,
        //     otherwise it is redirected to the requsted page in current window.
        public static string GetRedirectScript(string url, bool newWindowInCMSDesk);
        //
        // Summary:
        //     Returns the script to implement the specified code
        //
        // Parameters:
        //   script:
        //     Script to add
        public static string GetScript(string script);
        //
        // Summary:
        //     Encodes text to be used in javascript string and encapsulates it with "'"
        //
        // Parameters:
        //   text:
        //     Text to be encoded
        public static string GetString(string text);
        //
        // Summary:
        //     Encodes text to be used in javascript string and optionally encapsulates
        //     it with "'"
        //
        // Parameters:
        //   text:
        //     Text to be encoded
        //
        //   encapsulate:
        //     If true, text is encapsulated it with "'"
        public static string GetString(string text, bool encapsulate);
        //
        // Summary:
        //     Gets the script for the automatic window title
        //
        // Parameters:
        //   titlePart:
        //     Part of the window title
        public static string GetTitleScript(string titlePart);
        //
        // Summary:
        //     Returns true if the client script block is already registered
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   key:
        //     Key
        public static bool IsClientScriptBlockRegistered(Control control, string key);
        //
        // Summary:
        //     Returns true if the client script block is already registered
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   key:
        //     Key
        public static bool IsClientScriptBlockRegistered(Page page, string key);
        //
        // Summary:
        //     Determines whether Lightbox is already registered
        //
        // Parameters:
        //   page:
        //     Page to examine
        //
        // Returns:
        //     TRUE if Lightbox is already registered
        public static bool IsLightBoxRegistered(Page page);
        //
        // Summary:
        //     Determines whether MooTools library is already registered
        //
        // Parameters:
        //   page:
        //     Page to examine
        //
        // Returns:
        //     TRUE if MooTools library is already registered
        public static bool IsMooToolsRegistered(Page page);
        //
        // Summary:
        //     Ensures registration of the application constants script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterApplicationConstants(Page page);
        //
        // Summary:
        //     Ensures registration of the array declaration script
        //
        // Parameters:
        //   control:
        //     Control to register
        //
        //   arrayName:
        //     Name of the array to register
        //
        //   arrayValue:
        //     Value of the array to register
        public static void RegisterArrayDeclaration(Control control, string arrayName, string arrayValue);
        //
        // Summary:
        //     Ensures registration of the array declaration script
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   arrayName:
        //     Name of the array to register
        //
        //   arrayValue:
        //     Value of the array to register
        public static void RegisterArrayDeclaration(Page page, string arrayName, string arrayValue);
        //
        // Summary:
        //     Registers the client script block
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterClientScriptBlock(Control control, Type type, string key, string script);
        //
        // Summary:
        //     Registers the client script block
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterClientScriptBlock(Page page, Type type, string key, string script);
        //
        // Summary:
        //     Registers the client script include
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   url:
        //     Script URL
        public static void RegisterClientScriptInclude(Control control, Type type, string key, string url);
        //
        // Summary:
        //     Registers the client script include
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   url:
        //     Script URL
        public static void RegisterClientScriptInclude(Page page, Type type, string key, string url);
        //
        // Summary:
        //     Ensures registration of the main CMS script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterCMS(Page page);
        //
        // Summary:
        //     Registeres the script which checks the page completeness on postback
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterCompletePageScript(Page page);
        //
        // Summary:
        //     Registeres the script for modal dialogs
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterDialogScript(Page page);
        //
        // Summary:
        //     Ensures registration of script which causes correct resizing of uni flat
        //     selectors
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterFlatResize(Page page);
        //
        // Summary:
        //     Ensures registration of jQuery JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterJQuery(Page page);
        //
        // Summary:
        //     Ensures registration of jQuery dropshadow JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterJQueryShadow(Page page);
        //
        // Summary:
        //     Ensures registration of jQuery tooltips JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterJQueryTooltips(Page page);
        //
        // Summary:
        //     Ensures registration of all necessary JavaScript libraries for Lightbox functionality
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   target:
        //     Target control
        public static void RegisterLightbox(Page page, Control target);
        //
        // Summary:
        //     Ensures registration of all necessary JavaScript libraries for Lightbox functionality
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   target:
        //     Target control
        //
        //   group:
        //     Lightbox group name
        public static void RegisterLightbox(Page page, Control target, string group);
        //
        // Summary:
        //     Ensures registration of MooTools JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterMooTools(Page page);
        //
        // Summary:
        //     Registers the form submit statement
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterOnSubmitStatement(Control control, Type type, string key, string script);
        //
        // Summary:
        //     Registers the form submit statement
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterOnSubmitStatement(Page page, Type type, string key, string script);
        //
        // Summary:
        //     Ensures registration of the progress script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterProgress(Page page);
        //
        // Summary:
        //     Ensures registration of Prototype JavaScript framework
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterPrototype(Page page);
        //
        // Summary:
        //     Ensures registration of the save changes notification script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSaveChanges(Page page);
        //
        // Summary:
        //     Ensures registration of Scriptaculous (script.aculo.us) JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   load:
        //     Comma-separated values.  The scripts that can be specified are: builder,
        //     effects, dragdrop, controls, slider
        public static void RegisterScriptaculous(Page page, string load);
        //
        // Summary:
        //     Ensures registration of the main CMS script
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   scriptFile:
        //     Script file name to register
        public static void RegisterScriptFile(Page page, string scriptFile);
        //
        // Summary:
        //     Ensures registration of the shortcuts script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterShortcuts(Page page);
        //
        // Summary:
        //     Registers Silverlight's support script (http://code.msdn.microsoft.com/silverlightjs)
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSilverlight(Page page);
        //
        // Summary:
        //     Ensures registration of SKMenu JavaScript support
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSKMenu(Page page);
        //
        // Summary:
        //     Ensures registration of SKMenu JavaScript support
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   path:
        //     Relaitve path
        public static void RegisterSKMenu(Page page, string path);
        //
        // Summary:
        //     Ensures registration of the spellchecker script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSpellChecker(Page page);
        //
        // Summary:
        //     Registers the startup script
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterStartupScript(Control control, Type type, string key, string script);
        //
        // Summary:
        //     Registers the startup script
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterStartupScript(Page page, Type type, string key, string script);
        //
        // Summary:
        //     Ensures registration of atuomatic window title script
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   titlePart:
        //     Part of the window title
        public static void RegisterTitleScript(Page page, string titlePart);
        //
        // Summary:
        //     Ensures registration of tool tip script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterTooltip(Page page);
        //
        // Summary:
        //     Registeres the script which checks the page completeness on postback
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterWOpenerScript(Page page);
    }
}

Open in new window

0
Comment
Question by:omegalove
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 42

Assisted Solution

by:Meir Rivkin
Meir Rivkin earned 1000 total points
ID: 33696935
u can use Reflector to get the code source behind ScriptHelper (http://www.red-gate.com/products/reflector/)
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 1000 total points
ID: 33696960
for that particular case try this.:

Page.ClientScript.RegisterStartupScript(this.GetType(), "closeSendDialog", "window.close();",true);
0
 

Author Comment

by:omegalove
ID: 33702157
not sure what is the problem here. Can someone help me.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question