RegisterClientScriptIncludeInternal() private method

private RegisterClientScriptIncludeInternal ( Type type, string resourceName ) : void
type Type
resourceName string
return void
Beispiel #1
0
        internal void RegisterScripts(List <ClientScriptItem> scripts, ResourceManager rm)
        {
            rm = rm ?? this.ResourceManager;

            foreach (ClientScriptItem item in scripts)
            {
                if (rm.RenderScripts == ResourceLocationType.Embedded || rm.RenderScripts == ResourceLocationType.CacheFly)
                {
                    if (rm.ScriptMode == ScriptMode.Release || item.PathEmbeddedDebug.IsEmpty())
                    {
                        rm.RegisterClientScriptIncludeInternal(item.Type, item.PathEmbedded);
                    }
                    else
                    {
                        rm.RegisterClientScriptIncludeInternal(item.Type, item.PathEmbeddedDebug);
                    }
                }
                else if (rm.RenderScripts == ResourceLocationType.File || rm.RenderScripts == ResourceLocationType.CacheFlyAndFile)
                {
                    if (rm.ScriptMode == ScriptMode.Release || item.PathDebug.IsEmpty())
                    {
                        rm.RegisterClientScriptIncludeInternal(item.PathEmbedded, rm.ResourcePath.ConcatWith(item.Path));
                    }
                    else
                    {
                        rm.RegisterClientScriptIncludeInternal(item.PathEmbedded, rm.ResourcePath.ConcatWith(item.PathDebug));
                    }
                }
            }
        }
Beispiel #2
0
        internal void RegisterScripts(List <ClientScriptItem> scripts, ResourceManager rm)
        {
            rm = rm ?? this.SafeResourceManager;

            if (rm == null)
            {
                return;
            }

            if (rm.IsSelfRender && !(this is ResourceManager))
            {
                var globalResources = this.GlobalResources;

                foreach (ClientScriptItem item in scripts)
                {
                    if (!this.IsGlobalResourceRegistered(item))
                    {
                        globalResources.Add(item);
                    }
                }

                return;
            }

            foreach (ClientScriptItem item in scripts)
            {
                var mode = this.DetermineRequiredResourceMode(rm.RenderScripts, item);

                if (mode == ResourceLocationType.Embedded)
                {
                    if (rm.ScriptMode == ScriptMode.Release || item.PathEmbeddedDebug.IsEmpty())
                    {
                        rm.RegisterClientScriptIncludeInternal(item.Type, item.PathEmbedded);
                    }
                    else
                    {
                        rm.RegisterClientScriptIncludeInternal(item.Type, item.PathEmbeddedDebug);
                    }
                }
                else if (mode == ResourceLocationType.File)
                {
                    if (rm.ScriptMode == ScriptMode.Release || item.PathDebug.IsEmpty())
                    {
                        rm.RegisterClientScriptIncludeInternal(item.PathEmbedded, item.Path.StartsWith("~") ? this.ResolveUrlLink(item.Path) : rm.ResourcePathInternal.ConcatWith(item.Path));
                    }
                    else
                    {
                        rm.RegisterClientScriptIncludeInternal(item.PathEmbedded, item.PathDebug.StartsWith("~") ? this.ResolveUrlLink(item.PathDebug) : rm.ResourcePathInternal.ConcatWith(item.PathDebug));
                    }
                }
#if ISPRO
                else if (mode == ResourceLocationType.CDN)
                {
                    if (rm.ScriptMode == ScriptMode.Release || item.PathDebug.IsEmpty())
                    {
                        rm.RegisterClientScriptIncludeInternal(item.PathEmbedded, ResourceManager.CDNPath.ConcatWith(item.Path));
                    }
                    else
                    {
                        rm.RegisterClientScriptIncludeInternal(item.PathEmbedded, ResourceManager.CDNPath.ConcatWith(item.PathDebug));
                    }
                }
#endif
            }
        }