Example #1
0
        protected override IEnumerable<ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();
            reference.Path = ResolveClientUrl("FocusBehavior.js");

            return new ScriptReference[] { reference };
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (string.IsNullOrEmpty(Path))
            {
                throw new ArgumentException("Script property must have a value");
            }

            var manager = ScriptManager.GetCurrent(Page);
            if (manager == null)
            {
                throw new ArgumentException("No script manager found for the current page. Have you added a ScriptManager to the master page?");
            }

            System.Web.UI.ScriptReference scriptReference;
            if (IsEmbedded)
            {
                var parentBaseType = Parent.GetType().BaseType;
                var scriptResourcePrefix = parentBaseType.Namespace;
                var scriptResourcePath = string.Format("{0}.{1}", scriptResourcePrefix, Path);
                var assemblyName = parentBaseType.Assembly.GetName().Name;
                scriptReference = new System.Web.UI.ScriptReference(scriptResourcePath, assemblyName);
            }
            else
            {
                scriptReference = new System.Web.UI.ScriptReference(Path);
            }

            manager.Scripts.Add(scriptReference);
        }
        protected virtual IEnumerable<ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();
             reference.Path = ResolveClientUrl("~/Scripts/jquery.maskedinput.min.js");

             return new ScriptReference[] { reference };
        }
Example #4
0
 protected virtual IEnumerable<ScriptReference> GetScriptReferences()
 {
     ScriptReference reference = new ScriptReference();
     //reference.Path = ResolveClientUrl("~/scripts/progress.js");
     reference.Path = "~/scripts/progress.js";
     return new ScriptReference[] { reference };
 }
Example #5
0
        protected virtual IEnumerable<ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();
            reference.Path = ResolveClientUrl("SampleTextBox.js");

            return new ScriptReference[] { reference };
        }
        protected override IEnumerable<ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();
            reference.Assembly = "AjaxButton";
            reference.Name = "AjaxButton.FocusHighlighter.js";

            return new ScriptReference[] { reference };
        }
		protected override IEnumerable<ScriptReference> GetScriptReferences()
		{
			ScriptReference reference = new ScriptReference();
			reference.Assembly = "PermissionCenter";
			reference.Name = "PermissionCenter.PcGridHoverBehavior.js";

			return new ScriptReference[] { reference };
		}
        IEnumerable<ScriptReference> IScriptControl.GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();
            reference.Assembly = "AjaxEnabled";
            reference.Name = "AjaxEnabled.PassTextBox.js";

            return new ScriptReference[] { reference };
        }
 public ScriptReferenceEventArgs(ScriptReference script)
 {
     if (script == null)
     {
         throw new ArgumentNullException("script");
     }
     _script = script;
 }
Example #10
0
        /// <summary>
        /// Gets the script references.
        /// </summary>
        /// <returns></returns>
        protected override IEnumerable<ScriptReference> GetScriptReferences()
        {
            ScriptReference reference = new ScriptReference();

            reference.Path = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "Mediachase.Ibn.Assignments.UI.Scripts.Hider.js");

            return new ScriptReference[] { reference };
        }
Example #11
0
        protected virtual IEnumerable <ScriptReference> GetScriptReferences()
        {
            ScriptReference script;

            script = new ScriptReference("MicrosoftAjaxTimer.js", String.Empty);
            script.NotifyScriptLoaded = false;
            yield return(script);
        }
 /// <summary>
 /// Gets the script references.
 /// </summary>
 /// <returns></returns>
 public override IEnumerable<ScriptReference> GetScriptReferences()
 {
     string assembly = typeof(TwitterDesigner).Assembly.FullName;
     var scripts = new List<ScriptReference>(base.GetScriptReferences());
     var designerScript = new ScriptReference(TwitterDesigner.designerScriptName, assembly);
     scripts.Add(designerScript);
     return scripts.ToArray();
 }
 public OpenScriptReference(ScriptReference reference) : base() {
     Assembly = reference.Assembly;
     IgnoreScriptPath = reference.IgnoreScriptPath;
     Name = reference.Name;
     NotifyScriptLoaded = false;
     Path = reference.Path;
     ResourceUICultures = reference.ResourceUICultures;
     ScriptMode = reference.ScriptMode;
 }
Example #14
0
        //public const string JQueryUrl = "http://code.jquery.com/jquery-1.8.3.min.js";
        public static void Register(ScriptManager scriptManager)
        {
            // Check if JQuery has been added before
            if (scriptManager.Scripts.FirstOrDefault(s => s.Path == JQueryUrl) != null)
            {
                return;
            }

            var sr = new ScriptReference(JQueryUrl);
            scriptManager.Scripts.Add(sr);
        }
 public ScriptResourceDefinition GetDefinition(ScriptReference scriptReference) {
     if (scriptReference == null) {
         throw new ArgumentNullException("scriptReference");
     }
     string name = scriptReference.Name;
     Assembly assembly = null;
     ScriptResourceDefinition definition = null;
     if (!String.IsNullOrEmpty(name)) {
         assembly = scriptReference.GetAssembly();
         definition = ScriptManager.ScriptResourceMapping.GetDefinition(name, assembly);
     }
     return definition;
 }
        protected override IEnumerable<ScriptReference> GetScriptReferences()
        {
            var script1 = new ScriptReference
            {
                Assembly = this.GetType().Assembly.FullName,
                Name = "Msts.Scripts.Chapter09.PasswordLengthValidator.js"
            };
            var script2 = new ScriptReference
            {
                Assembly = this.GetType().Assembly.FullName,
                Name = "Msts.Scripts.Chapter09.PasswordLengthBehavior.js"
            };

            return new[] { script1, script2 };
        }
        public IEnumerable<ScriptReference> GetScriptReferences()
        {
            var script1 = new ScriptReference
            {
                Assembly = this.GetType().Assembly.FullName,
                Name = "Msts.Scripts.Chapter09.PasswordLengthValidator.js"
            };
            var script2 = new ScriptReference
            {
                Assembly = this.GetType().Assembly.FullName,
                Name = "Msts.Scripts.Chapter09.PasswordLengthControl.js"
            };

            return new[] { script1, script2 };
        }
        public void AddScriptVersion(ScriptReference script)
        {
            var scriptName = Path.GetFileNameWithoutExtension(script.Path);

            if (scriptName != null)
            {
                var element = root.Elements("script").FirstOrDefault(s =>
                    String.Equals(s.Attribute("name").Value, scriptName,
                        StringComparison.CurrentCultureIgnoreCase));

                if (element != null)
                {
                    script.Path += String.Format("?{0}", element.Attribute("v"));
                }
            }
        }
        public ScriptResourceDefinition GetDefinition(ScriptReference scriptReference)
        {
            if (scriptReference == null)
            {
                throw new ArgumentNullException("scriptReference");
            }
            string   name     = scriptReference.Name;
            Assembly assembly = null;
            ScriptResourceDefinition definition = null;

            if (!String.IsNullOrEmpty(name))
            {
                assembly   = scriptReference.GetAssembly();
                definition = ScriptManager.ScriptResourceMapping.GetDefinition(name, assembly);
            }
            return(definition);
        }
        private void AddScript()
        {
            var page = HttpContext.Current.Handler as Page;
            if (page == null)
            {
                throw new ArgumentException("Script Manager not found");
            }

            var manager = ScriptManager.GetCurrent(page);
            if (manager != null)
            {
                var scriptReference = new ScriptReference("WebFeatures.Scripts.webChat.js", "WebFeatures");
                manager.Scripts.Add(scriptReference);
            }

            // var script = page.ClientScript.GetWebResourceUrl(typeof(WebChat), "WebFeatures.Scripts.webChat.js");
            // page.ClientScript.RegisterClientScriptInclude("WebChat", script);
        }
Example #21
0
            public ScriptEffectiveInfo(ScriptReference scriptReference)
            {
                ScriptResourceDefinition definition =
                    ScriptManager.ScriptResourceMapping.GetDefinition(scriptReference);
                string   name     = scriptReference.Name;
                string   path     = scriptReference.Path;
                Assembly assembly = scriptReference.GetAssembly();

                if (definition != null)
                {
                    if (String.IsNullOrEmpty(path))
                    {
                        // only when the SR has no path, the mapping's path and debug path, if any, apply
                        path       = definition.Path;
                        _debugPath = definition.DebugPath;
                    }
                    name                          = definition.ResourceName;
                    assembly                      = definition.ResourceAssembly;
                    _cdnPath                      = definition.CdnPath;
                    _cdnDebugPath                 = definition.CdnDebugPath;
                    _cdnPathSecureConnection      = definition.CdnPathSecureConnection;
                    _cdnDebugPathSecureConnection = definition.CdnDebugPathSecureConnection;
                    LoadSuccessExpression         = definition.LoadSuccessExpression;
                }
                else if ((assembly == null) && !String.IsNullOrEmpty(name))
                {
                    // name is set and there is no mapping, default to SWE for assembly
                    assembly = AssemblyCache.SystemWebExtensions;
                }
                _resourceName = name;
                _assembly     = assembly;
                _path         = path;

                if (assembly != null && !String.IsNullOrEmpty(name) && String.IsNullOrEmpty(LoadSuccessExpression))
                {
                    var scriptResourceInfo = ScriptResourceInfo.GetInstance(assembly, name);
                    if (scriptResourceInfo != null)
                    {
                        LoadSuccessExpression = scriptResourceInfo.LoadSuccessExpression;
                    }
                }
            }
		/// <summary>
		/// Replaces already loaded scripts with fake script.
		/// </summary>
		/// <param name="script">A <see cref="ScriptReference" /> object.</param>
		private void ProcessLoadedScripts(ScriptReference script)
		{
			ICollection<AssetList> assetLists = AssetsHelper.LoadAssets();

			string scriptUrl = ResourceUrlHelper.ResolveScriptManagerUrl(this, script);

			foreach (KeyValuePair<string, string[]> loadedSet in LoadedScripts)
			{
				string setName = loadedSet.Key;
				string[] setUrls = loadedSet.Value;
				AssetList list = AssetsHelper.FindAssetList(assetLists, setName);
				if (list == null) continue;

				Asset asset = list.FindAsset(scriptUrl, setUrls);
				if (asset == null) continue;
				script.Name = "";
				script.Assembly = "";
				script.Path = ScriptHelper.GetCombinedScriptsUrl("fake", String.Empty);
				break;
			}
		}
        public static void RegisterClientScriptResource(Control control, Type type, string resourceName)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            if (control.Page == null)
            {
                throw new ArgumentException(AtlasWeb.ScriptRegistrationManager_ControlNotOnPage, "control");
            }
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (String.IsNullOrEmpty(resourceName))
            {
                throw new ArgumentNullException("resourceName");
            }

            ScriptManager sm = ScriptManager.GetCurrent(control.Page);

            if (sm == null)
            {
                control.Page.ClientScript.RegisterClientScriptResource(type, resourceName);
            }
            else
            {
                Assembly        assembly = AssemblyResourceLoader.GetAssemblyFromType(type);
                ScriptReference script   = new ScriptReference {
                    Name                 = resourceName,
                    Assembly             = assembly.FullName,
                    IsDirectRegistration = true,
                    ClientUrlResolver    = sm
                };
                string resourceUrl = script.GetUrlInternal(sm, sm.Zip);
                control.Page.ClientScript.RegisterClientScriptInclude(type, resourceName, resourceUrl, true);
                RegisteredScript entry = new RegisteredScript(control, type, resourceName, resourceUrl);
                sm.ScriptRegistration.ScriptBlocks.Add(entry);
            }
        }
Example #24
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                hdnfld_UserID.Value = UserId.ToString();

                string url = "";
            //string[] parameters = new string[3];
            //parameters = new string[1] { "user="******"");
               // hprlnkLogin.NavigateUrl = url;
                ScriptManager objScriptManager = ScriptManager.GetCurrent(this.Page);
                ScriptReference objScriptReference;

                objScriptReference = new ScriptReference(@"~/DesktopModules/Ourspace_Friends/js/friends.js");
                objScriptManager.Scripts.Add(objScriptReference);

                Ourspace_Utilities.View util = new Ourspace_Utilities.View();
               bool isFacebookUser = util.IsFacebookUser(UserId);
               if (isFacebookUser)
               {
                   pnlNonFbInfo.Visible = false;
                   pnlFbFriends.Visible = true;
                   pnlSearchFacebookFriends.Visible = true;
               }
               else
               {
                   pnlSearchFacebookFriends.Visible = false;
                   pnlNonFbInfo.Visible = true;
                   pnlFbFriends.Visible = false;
               }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #25
0
        private void SetupmojoCombined()
        {
            if (renderCombinedInHead) { return; }

            if (!assumeMojoCombinedIsLoaded)
            {
                if (combineScriptsWithScriptManager)
                {
                    ScriptReference script = new ScriptReference();
                    script.Path = "~/ClientScript" + mojoCombinedFullScript;
                    AddPathScriptReference(scriptManager, script);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                        "mojocombined", "\n<script  src=\""
                        + Page.ResolveUrl("~/ClientScript" + mojoCombinedFullScript)
                        + "\" type=\"text/javascript\" ></script>");
                }
            }

            //usedMojoCombinedFull = true;
        }
Example #26
0
        private void AddPathScriptReference(ScriptManager scriptManager, ScriptReference scriptReference)
        {
            if (scriptManager == null) { return; }
            if (scriptReference == null) { return; }
            //if (scriptManager.CompositeScript.Scripts.Contains(scriptReference)) { return; }
            foreach (ScriptReference s in scriptManager.CompositeScript.Scripts)
            {
                if (s.Path == scriptReference.Path) { return; }
            }

            scriptManager.CompositeScript.Scripts.Add(scriptReference);
        }
Example #27
0
        private void AddBundleScriptReference(ScriptManager scriptManager, ScriptReference scriptReference)
        {
            if (scriptManager == null) { return; }
            if (scriptReference == null) { return; }

            scriptManager.Scripts.Add(scriptReference);
        }
Example #28
0
 private void AddPathScriptReference(ScriptReference scriptReference)
 {
     AddPathScriptReference(scriptManager, scriptReference);
 }
Example #29
0
 /// <summary>
 /// should be in the format ~/path/to/yourscript.js
 /// </summary>
 /// <param name="scriptRelativeUrl"></param>
 public void AddPathScriptReference(string scriptRelativeUrl)
 {
     ScriptReference script = new ScriptReference();
     script.Path = scriptRelativeUrl;
     AddPathScriptReference(scriptManager, script);
 }
Example #30
0
 private void SetupSizzle()
 {
     if (combineScriptsWithScriptManager)
     {
         ScriptReference script = new ScriptReference();
         script.Path = "~/ClientScript/jqmojo/sizzle.js";
         AddPathScriptReference(scriptManager, script);
     }
     else
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                  "sizzle", "\n<script src=\""
                  + Page.ResolveUrl("~/ClientScript/jqmojo/sizzle.js") + "\" type=\"text/javascript\"></script>");
     }
 }
Example #31
0
        private void SetupKnockoutJs()
        {
            if (WebConfigSettings.DisablejQueryUI) { return; }

            if (combineScriptsWithScriptManager)
            {
                ScriptReference script = new ScriptReference();
                script.Path = knockouJsPath;
                AddPathScriptReference(scriptManager, script);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                        "knockoutjs", "\n<script src=\""
                        + Page.ResolveUrl(knockouJsPath) + "\" type=\"text/javascript\"></script>");
            }
        }
		private static ScriptReference ConvertOneScriptToLocalScript(ScriptReference originalScript)
		{
			ScriptReference result = originalScript;

			if (string.IsNullOrEmpty(originalScript.Assembly) == false)
			{
				Assembly assembly = Assembly.Load(originalScript.Assembly);

				byte[] buffer = new byte[4096];

				string targetVFilePath = ScriptControlSection.GetSection().LocalScriptVirtualDir;

				targetVFilePath = Path.Combine(targetVFilePath, originalScript.Name);
				targetVFilePath = targetVFilePath.Replace('\\', '/');

				string targetFilePath = HttpContext.Current.Server.MapPath(targetVFilePath);

				string targetDir = Path.GetDirectoryName(targetFilePath);

				if (Directory.Exists(targetDir) == false)
					Directory.CreateDirectory(targetDir);

				if (FileTimeMatched(assembly.Location, targetFilePath) == false)
				{
					lock (typeof(ScriptControlHelper))
					{
						using (Stream stream = assembly.GetManifestResourceStream(originalScript.Name))
						{
							using (FileStream fs = new FileStream(targetFilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite))
							{
								stream.CopyTo(fs);
							}

							File.SetLastWriteTime(targetFilePath, File.GetLastAccessTime(assembly.Location));
						}
					}
				}

				result = new ScriptReference();
				result.Path = targetVFilePath;
			}

			return result;
		}
        protected internal override string GetUrl(ScriptManager scriptManager, bool zip)
        {
            bool isDebuggingEnabled = !scriptManager.DeploymentSectionRetail &&
                                      ((ScriptMode == ScriptMode.Debug) ||
                                       (((ScriptMode == ScriptMode.Inherit) || (ScriptMode == ScriptMode.Auto)) &&
                                        (scriptManager.IsDebuggingEnabled)));

            if (!String.IsNullOrEmpty(Path))
            {
                string path = Path;
                if (isDebuggingEnabled)
                {
                    path = GetDebugPath(path);
                }
                if (scriptManager.EnableScriptLocalization &&
                    (ResourceUICultures != null) && (ResourceUICultures.Length != 0))
                {
                    CultureInfo currentCulture = CultureInfo.CurrentUICulture;
                    string      cultureName    = null;
                    bool        found          = false;
                    while (!currentCulture.Equals(CultureInfo.InvariantCulture))
                    {
                        cultureName = currentCulture.ToString();
                        foreach (string uiCulture in ResourceUICultures)
                        {
                            if (String.Equals(cultureName, uiCulture.Trim(), StringComparison.OrdinalIgnoreCase))
                            {
                                found = true;
                                break;
                            }
                        }
                        if (found)
                        {
                            break;
                        }
                        currentCulture = currentCulture.Parent;
                    }
                    if (found)
                    {
                        path = (path.Substring(0, path.Length - 2) + cultureName + ".js");
                    }
                }

                // ResolveClientUrl is appropriate here because the path is consumed by the page it was declared within
                return(ClientUrlResolver.ResolveClientUrl(path));
            }
            List <Tuple <Assembly, List <Tuple <string, CultureInfo> > > > resources =
                new List <Tuple <Assembly, List <Tuple <string, CultureInfo> > > >();
            Tuple <Assembly, List <Tuple <string, CultureInfo> > > resourceList = null;

            foreach (ScriptReference reference in Scripts)
            {
                if ((scriptManager.AjaxFrameworkMode == AjaxFrameworkMode.Explicit) &&
                    reference.IsAjaxFrameworkScript(scriptManager) &&
                    reference.EffectiveResourceName.StartsWith("MicrosoftAjax.", StringComparison.Ordinal))
                {
                    continue;
                }
                bool hasPath = !String.IsNullOrEmpty(reference.EffectivePath);
#pragma warning disable 618
                // ScriptPath is obsolete but still functional
                bool hasScriptPath = (!String.IsNullOrEmpty(scriptManager.ScriptPath) && !reference.IgnoreScriptPath);
#pragma warning restore 618
                // cacheAssembly will be null if ScriptPath is set, but we still need the resource assembly in that case
                Assembly   resourceAssembly = null;
                string     resourceName     = null;
                Assembly   cacheAssembly    = null;
                ScriptMode effectiveScriptModeForReference = reference.EffectiveScriptMode;
                bool       isDebuggingEnabledForReference  =
                    (effectiveScriptModeForReference == ScriptMode.Inherit) ?
                    isDebuggingEnabled :
                    (effectiveScriptModeForReference == ScriptMode.Debug);
                if (!hasPath)
                {
                    resourceAssembly = reference.GetAssembly(scriptManager);
                    resourceName     = reference.EffectiveResourceName;
                    reference.DetermineResourceNameAndAssembly(scriptManager, isDebuggingEnabledForReference,
                                                               ref resourceName, ref resourceAssembly);
                    if ((resourceAssembly != scriptManager.AjaxFrameworkAssembly) &&
                        (resourceAssembly != AssemblyCache.SystemWebExtensions) &&
                        AssemblyCache.IsAjaxFrameworkAssembly(resourceAssembly))
                    {
                        // if it is coming from an assembly that is not the current ajax script assembly, make sure the assembly
                        // is not meant to be an ajax script assembly.
                        // it isnt an AjaxFrameworkScript but it might be from an assembly that is meant to
                        // be an ajax script assembly, in which case we should throw an error.
                        throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture,
                                                                          AtlasWeb.ScriptReference_ResourceRequiresAjaxAssembly, resourceName, resourceAssembly));
                    }
                    if (!hasScriptPath)
                    {
                        // The resource requested in the composite url will only contain the assembly name if it
                        // will ultimately come from the assembly -- if ScriptPath is set, it doesn't.
                        // We do still need to know the resource assembly in that case though, hence the separate
                        // assembly variables.
                        cacheAssembly = resourceAssembly;
                    }
                }

                CultureInfo culture = reference.DetermineCulture(scriptManager);
                if ((resourceList == null) || (resourceList.Item1 != cacheAssembly))
                {
                    resourceList = new Tuple <Assembly, List <Tuple <string, CultureInfo> > >(
                        cacheAssembly, new List <Tuple <string, CultureInfo> >());
                    resources.Add(resourceList);
                }
                if (hasPath || hasScriptPath)
                {
                    if (hasPath)
                    {
                        if (String.IsNullOrEmpty(reference.Path))
                        {
                            // the Path is coming from a script mapping, so its debug path applies
                            resourceName = reference.GetPath(scriptManager, reference.EffectivePath, reference.ScriptInfo.DebugPath,
                                                             isDebuggingEnabledForReference);
                        }
                        else
                        {
                            // path explicitly set, even if a mapping has a DebugPath it does not apply
                            resourceName = reference.GetPath(scriptManager, reference.Path, null,
                                                             isDebuggingEnabledForReference);
                        }
                    }
                    else
                    {
#pragma warning disable 618
                        // ScriptPath is obsolete but still functional
                        resourceName = ScriptReference.GetScriptPath(resourceName, resourceAssembly,
                                                                     culture, scriptManager.ScriptPath);
#pragma warning restore 618
                    }

                    // ResolveClientUrl not appropriate here because the handler that will serve the response is not
                    // in the same directory as the page that is generating the url. Instead, an absolute url is needed
                    // as with ResolveUrl(). However, ResolveUrl() would prepend the entire application root name. For
                    // example, ~/foo.js would be /TheApplicationRoot/foo.js. If there are many path based scripts the
                    // app root would be repeated many times, which for deep apps or long named apps could cause the url
                    // to reach the maximum 2048 characters very quickly. So, the path is combined with the control's
                    // AppRelativeTemplateSourceDirectory manually, so that ~/foo.js remains ~/foo.js, and foo/bar.js
                    // becomes ~/templatesource/foo/bar.js. Absolute paths can remain as is. The ScriptResourceHandler will
                    // resolve the ~/ with the app root using VirtualPathUtility.ToAbsolute().
                    if (UrlPath.IsRelativeUrl(resourceName) && !UrlPath.IsAppRelativePath(resourceName))
                    {
                        resourceName = UrlPath.Combine(ClientUrlResolver.AppRelativeTemplateSourceDirectory, resourceName);
                    }
                }
                resourceList.Item2.Add(new Tuple <string, CultureInfo>(resourceName, culture));
            }
            return(ScriptResourceHandler.GetScriptResourceUrl(resources, zip));
        }
 public ScriptReferenceEventArgs(ScriptReference script)
 {
     _script = script;
 }
Example #35
0
        private void SetupMSAjaxScripts(ScriptManager scriptManager)
        {
            if (scriptManager == null) { return; }

            ScriptReference scriptReference = new ScriptReference("MsAjaxBundle","");
            AddBundleScriptReference(scriptManager, scriptReference);

            //ScriptReference scriptReference = new ScriptReference("MicrosoftAjax.js", "System.Web.Extensions");
            //AddNamedScriptReference(scriptManager, scriptReference);

            //scriptReference = new ScriptReference("MicrosoftAjaxWebForms.js", "System.Web.Extensions");
            //AddNamedScriptReference(scriptManager, scriptReference);
        }
Example #36
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			valRelatedSelect.ErrorMessage = L10n.Term(".ERR_REQUIRED_FIELD");
			bSupportsPopups = Sql.ToBoolean(Page.Items["SupportsPopups"]);
			if ( this.IsMobile )
			{
				// 11/24/2010   .NET 4 has broken the compatibility of the browser file system. 
				// We are going to minimize our reliance on browser files in order to reduce deployment issues. 
				bSupportsPopups = Utils.SupportsPopups;
			}
			// 05/06/2010   Use a special Page flag to override the default IsPostBack behavior. 
			bool bIsPostBack = this.IsPostBack && !NotPostBack;
			if ( bIsPostBack )
			{
				dtLineItems = ViewState["LineItems"] as DataTable;
				grdMain.DataSource = dtLineItems;
			}
			else
			{
				Session.Remove(sRELATED_SOURCE_VIEW_NAME + "." + sRELATED_VIEW_NAME);
			}
			
			// 05/06/2010   Move the ajax refence code to Page_Load as it only needs to be called once. 
			ScriptManager mgrAjax = ScriptManager.GetCurrent(this.Page);
			// 11/23/2009   Taoqi 4.0 is very slow on Blackberry devices.  Lets try and turn off AJAX AutoComplete. 
			bAjaxAutoComplete = (mgrAjax != null);
			if ( this.IsMobile )
			{
				// 11/24/2010   .NET 4 has broken the compatibility of the browser file system. 
				// We are going to minimize our reliance on browser files in order to reduce deployment issues. 
				bAjaxAutoComplete = Utils.AllowAutoComplete && (mgrAjax != null);
			}
			if ( bAjaxAutoComplete )
			{
				ServiceReference svc = new ServiceReference("~/" + sRELATED_SOURCE_MODULE_NAME + "/AutoComplete.asmx");
				ScriptReference  scr = new ScriptReference ("~/" + sRELATED_SOURCE_MODULE_NAME + "/AutoComplete.js"  );
				if ( !mgrAjax.Services.Contains(svc) )
					mgrAjax.Services.Add(svc);
				if ( !mgrAjax.Scripts.Contains(scr) )
					mgrAjax.Scripts.Add(scr);
			}
		}
Example #37
0
        private void SetupQtFile()
        {
            CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();

            bool loadedQtLangFile = false;
            if (defaultCulture.TwoLetterISOLanguageName != "en")
            {
                if (File.Exists(HostingEnvironment.MapPath("~/ClientScript/jqmojo/" + defaultCulture.TwoLetterISOLanguageName + ".qtfile.js")))
                {
                    if (combineScriptsWithScriptManager)
                    {
                        ScriptReference script = new ScriptReference();
                        script.Path = "~/ClientScript/jqmojo/" + defaultCulture.TwoLetterISOLanguageName + ".qtfile.js";
                        AddPathScriptReference(scriptManager, script);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                         "qtfilelocalize", "\n<script src=\""
                         + Page.ResolveUrl("~/ClientScript/jqmojo/" + defaultCulture.TwoLetterISOLanguageName + ".qtfile.js") + "\" type=\"text/javascript\"></script>");
                    }
                    loadedQtLangFile = true;
                }
            }

            if (!loadedQtLangFile)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                     "qtfilelocalize", "\n<script src=\""
                     + Page.ResolveUrl("~/ClientScript/jqmojo/en.qtfile.js") + "\" type=\"text/javascript\"></script>");
            }

            //if (combineScriptsWithScriptManager)
            //{
            //    ScriptReference script = new ScriptReference();
            //    script.Path = "~/ClientScript/jqmojo/mojoqtfilev2.js";
            //    AddPathScriptReference(scriptManager, script);
            //}
            //else
            //{

                Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                     "qtfile", "\n<script src=\""
                     + Page.ResolveUrl("~/ClientScript/jqmojo/mojoqtfilev2.js") + "\" type=\"text/javascript\"></script>");
            //}
        }