Solved

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

Posted on 2010-09-16
3
626 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
3 Comments
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 250 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 250 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now