protected void Page_Load(object sender, EventArgs e) { AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext,"DesktopModules/OpenFiles/","images"); alpaca.RegisterAll(); int fileid = int.Parse(Page.Request.QueryString["fileId"]); var fm = DotNetNuke.Services.FileSystem.FileManager.Instance; File = fm.GetFile(fileid); ScopeWrapper.Visible = fm.IsImageFile(File); lblNoImage.Visible = !ScopeWrapper.Visible; }
protected override void OnInit(EventArgs e) { base.OnInit(e); bIndexAll.Visible = UserInfo.IsSuperUser; hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); //OpenContentSettings settings = this.OpenContentSettings(); //AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, settings.Template.Uri().FolderPath, "query"); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext.PortalId, "", ""); alpaca.RegisterAll(false, false); string itemId = null;//Request.QueryString["id"] == null ? -1 : int.Parse(Request.QueryString["id"]); AlpacaContext = new AlpacaContext(PortalId, ModuleId, itemId, ScopeWrapper.ClientID, hlCancel.ClientID, cmdSave.ClientID, null, null, null); }
protected override void OnInit(EventArgs e) { base.OnInit(e); hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); OpenContentSettings settings = this.OpenContentSettings(); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext.PortalId, "DeskTopModules/OpenContent", "formsettings"); //AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, "", ""); alpaca.RegisterAll(true, true); string itemId = null; AlpacaContext = new AlpacaContext(PortalId, ModuleId, itemId, ScopeWrapper.ClientID, hlCancel.ClientID, cmdSave.ClientID, null, null, null); AlpacaContext.Bootstrap = true; }
protected override void OnInit(EventArgs e) { base.OnInit(e); hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); bool bootstrap = App.Services.CreateGlobalSettingsRepository(ModuleContext.PortalId).GetEditLayout() != AlpacaLayoutEnum.DNN; bool loadBootstrap = bootstrap && App.Services.CreateGlobalSettingsRepository(ModuleContext.PortalId).GetLoadBootstrap(); bool loadGlyphicons = bootstrap && App.Services.CreateGlobalSettingsRepository(ModuleContext.PortalId).GetLoadGlyphicons(); OpenContentSettings settings = this.OpenContentSettings(); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext.PortalId, "DeskTopModules/OpenContent", "formsettings"); //AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, "", ""); alpaca.RegisterAll(bootstrap, loadBootstrap, loadGlyphicons); string itemId = null; AlpacaContext = new AlpacaContext(PortalId, ModuleId, itemId, ScopeWrapper.ClientID, hlCancel.ClientID, cmdSave.ClientID, null, null, null); AlpacaContext.Bootstrap = true; }
protected override void OnInit(EventArgs e) { base.OnInit(e); var editLayout = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetEditLayout(); var bootstrap = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetEditLayout() != AlpacaLayoutEnum.DNN; bool loadBootstrap = bootstrap && OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetLoadBootstrap(); hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); OpenContentSettings settings = this.OpenContentSettings(); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, settings.Template.ManifestFolderUri.FolderPath, ""); alpaca.RegisterAll(bootstrap, loadBootstrap); string itemId = Request.QueryString["id"]; AlpacaContext = new AlpacaContext(PortalId, ModuleId, itemId, ScopeWrapper.ClientID, hlCancel.ClientID, cmdSave.ClientID, hlDelete.ClientID, ddlVersions.ClientID); AlpacaContext.Bootstrap = bootstrap; AlpacaContext.Horizontal = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetEditLayout() == AlpacaLayoutEnum.BootstrapHorizontal; }
protected override void OnInit(EventArgs e) { base.OnInit(e); var globalSettingsController = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController(ModuleContext.PortalId); var bootstrap = globalSettingsController.GetEditLayout() != AlpacaLayoutEnum.DNN; bool loadBootstrap = bootstrap && globalSettingsController.GetLoadBootstrap(); Key = Request.QueryString["key"]; hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); OpenContentSettings settings = this.OpenContentSettings(); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext.PortalId, settings.Template.ManifestFolderUri.FolderPath, Key); alpaca.RegisterAll(bootstrap, loadBootstrap); string itemId = null;//Request.QueryString["id"] == null ? -1 : int.Parse(Request.QueryString["id"]); AlpacaContext = new AlpacaContext(PortalId, ModuleId, itemId, ScopeWrapper.ClientID, hlCancel.ClientID, cmdSave.ClientID, null, null, null); AlpacaContext.Bootstrap = bootstrap; AlpacaContext.Horizontal = globalSettingsController.GetEditLayout() == AlpacaLayoutEnum.BootstrapHorizontal; }
protected override void OnInit(EventArgs e) { base.OnInit(e); var editLayout = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetEditLayout(); var bootstrap = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetEditLayout() != AlpacaLayoutEnum.DNN; bool loadBootstrap = bootstrap && OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetLoadBootstrap(); hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); OpenContentSettings settings = ModuleContext.Configuration.OpenContentSettings(); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext.PortalId, settings.Template.ManifestFolderUri.FolderPath, ""); alpaca.RegisterAll(bootstrap, loadBootstrap); string itemId = Request.QueryString["id"]; AlpacaContext = new AlpacaContext(ModuleContext.PortalId, ModuleContext.ModuleId, itemId, ScopeWrapper.ClientID, hlCancel.ClientID, cmdSave.ClientID, null, hlDelete.ClientID, ddlVersions.ClientID); AlpacaContext.Bootstrap = bootstrap; AlpacaContext.Horizontal = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController.GetEditLayout() == AlpacaLayoutEnum.BootstrapHorizontal; ModuleInfo module = ModuleContext.Configuration; IDictionary moduleSettings = new Hashtable(module.ModuleSettings); moduleSettings["template"] = settings.TemplateKey.Folder + "/" + "formsubmissions"; moduleSettings["data"] = ""; moduleSettings["query"] = ""; /* * var moduleClone = new ModuleInfo(); * foreach (System.Collections.DictionaryEntry item in module.ModuleSettings) * { * moduleClone.ModuleSettings.Add(item.Key, item.Value); * } * moduleClone.ModuleID = module.ModuleID; * moduleClone.TabID = module.TabID; * moduleClone.TabModuleID = module.TabModuleID; * moduleClone.PortalID = module.PortalID; * moduleClone.ModuleSettings["template"] = settings.TemplateKey.ToString(); * module = moduleClone; */ engine = new RenderEngine(module, moduleSettings); }
protected override void OnInit(EventArgs e) { base.OnInit(e); hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); OpenContentSettings settings = this.OpenContentSettings(); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, "" /*settings.Template.Uri().FolderPath*/, "builder"); alpaca.RegisterAll(false); //string ItemId = Request.QueryString["id"]; //AlpacaContext = new AlpacaContext(PortalId, ModuleId, ItemId, ScopeWrapper.ClientID, null, cmdSave.ClientID, null, null); ClientResourceManager.RegisterScript(Page, "~/DesktopModules/OpenContent/js/builder/formbuilder.js", FileOrder.Js.DefaultPriority); ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/OpenContent/js/builder/formbuilder.css", FileOrder.Css.DefaultPriority); //ClientResourceManager.RegisterScript(Page, "~/DesktopModules/OpenContent/js/bootstrap/js/bootstrap.min.js", FileOrder.Js.DefaultPriority); //ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/OpenContent/js/bootstrap/css/bootstrap.min.css", FileOrder.Css.DefaultPriority); if (OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri)) { string title = string.IsNullOrEmpty(settings.Template.Manifest.Title) ? "Data" : settings.Template.Manifest.Title + " "; ddlForms.Items.Add(new ListItem(title, "")); } if (OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri, settings.Template.Key.ShortKey)) { ddlForms.Items.Add(new ListItem("Settings", settings.Template.Key.ShortKey)); } if (settings.Template.Manifest.AdditionalDataExists()) { foreach (var addData in settings.Template.Manifest.AdditionalData) { if (OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri, addData.Key)) { string title = string.IsNullOrEmpty(addData.Value.Title) ? addData.Key : addData.Value.Title; ddlForms.Items.Add(new ListItem(title, addData.Key)); } } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); var globalSettingsController = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController(ModuleContext.PortalId); var bootstrap = globalSettingsController.GetEditLayout() != AlpacaLayoutEnum.DNN; bool loadBootstrap = bootstrap && globalSettingsController.GetLoadBootstrap(); hlCancel.NavigateUrl = Globals.NavigateURL(); cmdSave.NavigateUrl = Globals.NavigateURL(); cmdCopy.NavigateUrl = Globals.NavigateURL(); OpenContentSettings settings = this.OpenContentSettings(); string prefix = (string.IsNullOrEmpty(settings.Template.Collection) || settings.Template.Collection == "Items") ? "" : settings.Template.Collection; AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext.PortalId, settings.Template.ManifestFolderUri.FolderPath, prefix); alpaca.RegisterAll(bootstrap, loadBootstrap); string itemId = Request.QueryString["id"]; AlpacaContext = new AlpacaContext(PortalId, ModuleId, itemId, ScopeWrapper.ClientID, hlCancel.ClientID, cmdSave.ClientID, cmdCopy.ClientID, hlDelete.ClientID, ddlVersions.ClientID); AlpacaContext.Bootstrap = bootstrap; AlpacaContext.Horizontal = globalSettingsController.GetEditLayout() == AlpacaLayoutEnum.BootstrapHorizontal; AlpacaContext.IsNew = settings.Template.IsListTemplate && string.IsNullOrEmpty(itemId); }
protected override void OnInit(EventArgs e) { base.OnInit(e); var virtualFolderOfSchemaFiles = AppConfig.Instance.SchemaFolder; var portalFolder = AppConfig.Instance.PortalFolder(PortalSettings); if (!portalFolder.FolderExists) { Directory.CreateDirectory(portalFolder.PhysicalFullDirectory); } var schemaFile = new FileUri(portalFolder, "schema.json"); if (schemaFile.FileExists) { virtualFolderOfSchemaFiles = AppConfig.Instance.PortalFolder(PortalSettings); } AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, virtualFolderOfSchemaFiles.FolderPath, ""); alpaca.RegisterAll(false, false); }
public HttpResponseMessage Edit(string id) { try { var module = OpenContentModuleConfig.Create(ActiveModule, PortalSettings); IDataSource ds = DataSourceManager.GetDataSource(module.Settings.Manifest.DataSource); var dsContext = OpenContentUtils.CreateDataContext(module); IDataItem dsItem = null; if (module.IsListMode()) { if (!string.IsNullOrEmpty(id)) // not a new item { dsItem = ds.Get(dsContext, id); } } else { dsContext.Single = true; dsItem = ds.Get(dsContext, null); } int createdByUserid = -1; var json = ds.GetAlpaca(dsContext, true, true, true); if (ds is IDataActions) { var actions = ((IDataActions)ds).GetActions(dsContext, dsItem); if (json["options"] == null) { json["options"] = new JObject(); } if (json["options"]["form"] == null) { json["options"]["form"] = new JObject(); } if (json["options"]["form"]["buttons"] == null) { json["options"]["form"]["buttons"] = new JObject(); } var buttons = json["options"]["form"]["buttons"] as JObject; var newButtons = new JObject(); foreach (var act in actions) { var but = buttons[act.Name]; if (but == null) { but = new JObject(); } but["after"] = act.AfterExecute; newButtons[act.Name] = but; } json["options"]["form"]["buttons"] = newButtons; } if (dsItem != null) { json["data"] = dsItem.Data; if (json["schema"]["properties"]["ModuleTitle"] is JObject) { if (json["data"]["ModuleTitle"] != null && json["data"]["ModuleTitle"].Type == JTokenType.String) { json["data"]["ModuleTitle"] = ActiveModule.ModuleTitle; } else if (json["data"]["ModuleTitle"] != null && json["data"]["ModuleTitle"].Type == JTokenType.Object) { json["data"]["ModuleTitle"][DnnLanguageUtils.GetCurrentCultureCode()] = ActiveModule.ModuleTitle; } } var versions = ds.GetVersions(dsContext, dsItem); if (versions != null) { json["versions"] = versions; } createdByUserid = dsItem.CreatedByUserId; } var context = new JObject(); var currentLocale = DnnLanguageUtils.GetCurrentLocale(PortalSettings.PortalId); context["culture"] = currentLocale.Code; //todo why not use DnnLanguageUtils.GetCurrentCultureCode() ??? context["defaultCulture"] = LocaleController.Instance.GetDefaultLocale(PortalSettings.PortalId).Code; context["numberDecimalSeparator"] = currentLocale.Culture.NumberFormat.NumberDecimalSeparator; context["rootUrl"] = System.Web.VirtualPathUtility.ToAbsolute(string.Concat(System.Web.HttpRuntime.AppDomainAppVirtualPath, "/")); context["alpacaCulture"] = AlpacaEngine.AlpacaCulture(currentLocale.Code); context["bootstrap"] = App.Services.CreateGlobalSettingsRepository(PortalSettings.PortalId).GetEditLayout() != AlpacaLayoutEnum.DNN; context["horizontal"] = App.Services.CreateGlobalSettingsRepository(PortalSettings.PortalId).GetEditLayout() == AlpacaLayoutEnum.BootstrapHorizontal; json["context"] = context; //todo: can't we do some of these checks at the beginning of this method to fail faster? if (!DnnPermissionsUtils.HasEditPermissions(module, module.Settings.Manifest.GetEditRole(), createdByUserid)) { return(Request.CreateResponse(HttpStatusCode.Unauthorized)); } return(Request.CreateResponse(HttpStatusCode.OK, json)); } catch (Exception exc) { App.Services.Logger.Error(exc); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc)); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, "DesktopModules/OpenFiles/", ""); alpaca.RegisterAll(); }