protected void Page_Load(object sender, EventArgs e) { SPSite site = SPContext.Current.Site; RepoServiceClient repo = new RepoServiceClient(site); Response.ContentType = "text/javascript"; string[] scriptNames = Request.QueryString["FilePaths"].Split(";"); string results = ""; foreach (string scriptName in scriptNames) { if (( scriptName ?? "" ).Trim() == "") continue; results += repo.Get(scriptName) + "\n"; } Response.Write(results); }
public object LoadContents(ConfigServiceClient cfg, RepoServiceClient repo) { if (cfg == null || repo == null) throw new ArgumentNullException(); StringBuilder stylesResult = new StringBuilder(); stylesResult.Append("<style>").AppendLine(); var cfgStyles = GetConfigGuidList(cfg); foreach (Guid cfgId in cfgStyles) { PageHeadConfig c = (PageHeadConfig) cfg.GetBranch<PageHeadConfig>(cfgId, this.Category()); if (c != null) { // v SiteConfigu mohou byt jen jmena souboru z adresare dane aplikace v SiteScripts, // nikdy primo kod, ktery by se vkladal do stranky (mozna u css by to tak byt nemuselo) foreach (string scriptFileName in c.StyleLinks) { if (string.IsNullOrWhiteSpace(scriptFileName)) continue; string scriptName = scriptFileName.ToLowerInvariant().EndsWith(".css") ? scriptFileName : scriptFileName + ".css"; var scriptKvp = repo.Get(scriptName); if (scriptKvp != null) { stylesResult.Append("/* " + scriptName + " start */\n"); stylesResult.Append(scriptKvp.StringUnicode); stylesResult.Append("/* " + scriptName + " end */\n"); } } } } stylesResult.Append("</style>"); return stylesResult.ToString(); }
private Stream OpenResourceInputStream(string path) { string pathtofile = RepoServiceClient.NormalizedFilePath(path); if (FullPathsToAllFilesAndFolders.Contains(pathtofile)) { RepoServiceClient scriptrepo = new RepoServiceClient(Site); var kvp = scriptrepo.Get(pathtofile); if (kvp != null) return new MemoryStream(kvp.BinaryData); } return null; }