protected void Page_Load(object sender, EventArgs e) { if (Request.Files.Count > 0) { if (!Directory.Exists(Server.MapPath("") + "\\_temp")) { Directory.CreateDirectory(Server.MapPath("") + "\\_temp"); } foreach (string sScript in Request.Files) { HttpPostedFile script = Request.Files[sScript]; string filename = Server.MapPath("") + "\\_temp\\" + script.FileName; script.SaveAs(filename); CmsScript cmsScript = new CmsScript(); FileInfo fiScript = new FileInfo(filename); if (fiScript.Extension == ".css" || fiScript.Extension == ".js") { cmsScript.Name = fiScript.Name.Replace(fiScript.Extension, ""); StreamReader sr = new StreamReader(filename); cmsScript.Content = sr.ReadToEnd(); cmsScript.ScriptType = (fiScript.Extension == ".css") ? ScriptTypeEnum.Css : ScriptTypeEnum.Js; cmsScript.Site = SessionObject.CurrentSite; sr.Close(); sr.Dispose(); cmsScript.Save(); } fiScript.Delete(); } } }
public static void SetScriptInWholeSite(string scriptid, bool loadInWholeSite) { CmsScript script = BaseObject.GetById <CmsScript>(new Guid(scriptid)); script.LoadInWholeSite = loadInWholeSite; script.Save(); }
public static CmsScript SaveScript(CmsScript obj) { BaseService.CheckLoginAndLicense(); obj.Site = SessionObject.CurrentSite; obj.Save(); ////lijst van ObjectPermissions wordt hier alleen als drager gebruikt. ////in de licentieserver wordt deze lijst weer gesplitst en in 2 tabellen gezet //BaseCollection<ObjectPermission> objPermissions = obj.GetObjectPermissions4LicenseServer(); //if (objPermissions.Count > 0) //{ // //BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient(); // //client.SaveObjectPermissions(objPermissions); //} BitCaching.RemoveItemFromCache(obj.ID.ToString()); return(obj); }
public void UploadScripts(HttpContext context) { if (context.Request.Files.Count > 0) { if (!Directory.Exists(context.Server.MapPath("") + "\\_temp")) { Directory.CreateDirectory(context.Server.MapPath("") + "\\_temp"); } foreach (string sScript in context.Request.Files) { HttpPostedFile script = context.Request.Files[sScript]; string newFileName = script.FileName; if (script.FileName.Contains("\\")) { int lastSlashIndex = script.FileName.LastIndexOf("\\"); newFileName = script.FileName.Substring(lastSlashIndex); } string filename = context.Server.MapPath("") + "\\_temp\\" + newFileName; script.SaveAs(filename); CmsScript cmsScript = new CmsScript(); FileInfo fiScript = new FileInfo(filename); if (fiScript.Extension == ".css" || fiScript.Extension == ".js") { cmsScript.Name = fiScript.Name.Replace(fiScript.Extension, ""); StreamReader sr = new StreamReader(filename); cmsScript.Content = sr.ReadToEnd(); cmsScript.ScriptType = (fiScript.Extension == ".css") ? ScriptTypeEnum.Css : ScriptTypeEnum.Js; cmsScript.Site = SessionObject.CurrentSite; sr.Close(); sr.Dispose(); cmsScript.Save(); } fiScript.Delete(); } } }