Пример #1
0
        private string GetTabUrl(int portalId, int moduleTabId, string queryString)
        {
            var url = DnnUrlUtils.NavigateUrl(moduleTabId);

            return(url);
            //var portalSettings = new PortalSettings(portalId);
            //portalSettings.PortalAlias = PortalAliasController.Instance.GetPortalAlias(portalSettings.DefaultPortalAlias);
            //var url = TestableGlobals.Instance.NavigateURL(moduleTabId, portalSettings, string.Empty, queryString);
            //return url;
        }
Пример #2
0
        public static bool CheckOpenContentSettings(ModuleInfo module, OpenContentSettings settings)
        {
            bool result = true;

            if (module != null && settings != null && settings.TemplateKey != null && settings.TemplateKey.TemplateDir != null && !settings.TemplateKey.TemplateDir.FolderExists)
            {
                var url = DnnUrlUtils.NavigateUrl(module.TabID);
                Log.Logger.ErrorFormat("Error loading OpenContent Template on page [{5}-{4}-{1}] module [{2}-{3}]. Reason: Template not found [{0}]", settings.TemplateKey.ToString(), url, module.ModuleID, module.ModuleTitle, module.TabID, module.PortalID);
                result = false;
            }
            return(result);
        }
Пример #3
0
        public static bool CheckOpenContentSettings(OpenContentModuleInfo module)
        {
            bool result   = true;
            var  settings = module.Settings;

            if (settings?.TemplateKey?.TemplateDir != null && !settings.TemplateKey.TemplateDir.FolderExists)
            {
                var url = DnnUrlUtils.NavigateUrl(module.ViewModule.TabID);
                Log.Logger.Error($"Error loading OpenContent Template on page [{module.ViewModule.PortalID}-{module.ViewModule.TabID}-{url}] module [{module.ViewModule.ModuleID}-{module.ViewModule.ModuleTitle}]. Reason: Template not found [{settings.TemplateKey}]");
                result = false;
            }
            return(result);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            JavaScript.RequestRegistration(CommonJs.DnnPlugins);
            cmdSave.Click += cmdSave_Click;

            var           m  = ModuleContext.Configuration;
            TabController tc = new TabController();
            var           mc = new ModuleController();
            // its the same for each module -> to cache
            var til = TabController.GetTabsBySortOrder(PortalSettings.PortalId, m.CultureCode, true)
                      .Where(t => /*!t.IsDeleted &&*/ t.ParentId != PortalSettings.AdminTabId &&
                             t.TabID != PortalSettings.AdminTabId &&
                             t.CultureCode == m.CultureCode);
            //var tid = tc.GetTabsByModuleID(m.ModuleID);
            var tmiLst = mc.GetAllTabsModulesByModuleID(m.ModuleID).Cast <ModuleInfo>();

            foreach (TabInfo ti in til)
            {
                {
                    ListItem li = new ListItem(ti.TabName, ti.TabID.ToString());
                    li.Text    = $"{ti.IndentedTabName} <a href='{DnnUrlUtils.NavigateUrl(ti.TabID)}' target='_blank' style='font-size: 10px;text-decoration: none;' class='clonetabid'>({ti.TabID})</span></a>";
                    li.Enabled = ti.TabID != m.TabID;
                    cblPages.Items.Add(li);

                    ModuleInfo tmi = tmiLst.SingleOrDefault(t => t.TabID == ti.TabID);

                    //if (tid.Keys.Contains(ti.TabID))
                    if (tmi != null)
                    {
                        if (tmi.IsDeleted)
                        {
                            //li.Enabled = false;
                            li.Text = $"<i>{li.Text}</i>";
                        }
                        else
                        {
                            li.Selected = true;
                        }
                    }
                }
            }
        }
Пример #5
0
        private static string PrepareErrorMessage(DnnApiController ctrl, Exception exc)
        {
            string friendlyMessage = string.Format("PortalId: {3} \nTab: {4} - {5} \nModule: {0} \nContext: {2} \nError: {1}",
                                                   ctrl.ActiveModule.ModuleID,
                                                   exc.Message,
                                                   LoggingUtils.HttpRequestLogInfo(HttpContext.Current),
                                                   ctrl.ActiveModule.PortalID,
                                                   ctrl.ActiveModule.TabID,
                                                   DnnUrlUtils.NavigateUrl(ctrl.ActiveModule.TabID)
                                                   );
            Exception lastExc = exc;

            while (lastExc.InnerException != null)
            {
                lastExc          = exc.InnerException;
                friendlyMessage += "\n" + lastExc.Message;
            }
            return(friendlyMessage);
        }
Пример #6
0
        private static string PrepareErrorMessage(DotNetNuke.Web.Razor.RazorModuleBase ctrl, Exception exc)
        {
            string friendlyMessage = string.Format("Alias: {3} \nTab: {4} - {5} \nModule: {0} \nContext: {2} \nError: {1}",
                                                   ctrl.ModuleContext.ModuleId,
                                                   exc.Message,
                                                   LoggingUtils.HttpRequestLogInfo(HttpContext.Current),
                                                   ctrl.ModuleContext.PortalAlias.HTTPAlias,
                                                   ctrl.ModuleContext.TabId,
                                                   DnnUrlUtils.NavigateUrl(ctrl.ModuleContext.TabId)
                                                   );
            Exception lastExc = exc;

            while (lastExc.InnerException != null)
            {
                lastExc          = lastExc.InnerException;
                friendlyMessage += "\n" + lastExc.Message;
            }
            return(friendlyMessage);
        }
Пример #7
0
        private static string PrepareErrorMessage(ModuleInfo module, Exception exc)
        {
            var    ps = PortalSettings.Current;
            string friendlyMessage = string.Format("Alias: {3} \nTab: {4} - {5} \nModule: {0} \nContext: {2} \nError: {1}",
                                                   module.ModuleID,
                                                   exc.Message,
                                                   LoggingUtils.HttpRequestLogInfo(HttpContext.Current),
                                                   ps.PortalAlias.HTTPAlias,
                                                   ps.ActiveTab.TabID,
                                                   DnnUrlUtils.NavigateUrl(ps.ActiveTab.TabID)
                                                   );
            Exception lastExc = exc;

            while (lastExc.InnerException != null)
            {
                lastExc          = lastExc.InnerException;
                friendlyMessage += "\n" + lastExc.Message;
            }
            return(friendlyMessage);
        }
Пример #8
0
        private static string PrepareErrorMessage(RenderEngine renderEngine, Exception exc)
        {
            var    ps = PortalSettings.Current;
            string friendlyMessage;

            if (ps == null)
            {
                friendlyMessage = $"Alias: unknown \nTab: unknown - {DnnUrlUtils.NavigateUrl(renderEngine.ModuleConfig.TabId)} \nModule: {renderEngine.ModuleConfig.ModuleId} \nContext: {HttpRequestLogInfo(HttpContext.Current)} \nError: {exc.Message}";
            }
            else
            {
                friendlyMessage = $"Alias: {ps.PortalAlias.HTTPAlias} \nTab: {ps.ActiveTab.TabID} - {DnnUrlUtils.NavigateUrl(ps.ActiveTab.TabID)} \nModule: {renderEngine.ModuleConfig.ModuleId} \nContext: {HttpRequestLogInfo(HttpContext.Current)} \nError: {exc.Message}";
            }
            Exception lastExc = exc;

            while (lastExc.InnerException != null)
            {
                lastExc          = lastExc.InnerException;
                friendlyMessage += "\n" + lastExc.Message;
            }
            return(friendlyMessage);
        }
 public string GetDocUrl(SearchResult searchResult)
 {
     return(DnnUrlUtils.NavigateUrl(searchResult.TabId));
 }
Пример #10
0
        private static string PrepareErrorMessage(DnnApiController ctrl, Exception exc)
        {
            string friendlyMessage;

            if (ctrl?.ActiveModule == null)
            {
                friendlyMessage = $"\n{exc.Message} \n{LoggingUtils.HttpRequestLogInfo(HttpContext.Current)} ";
            }
            else
            {
                friendlyMessage = $"\n{exc.Message} \n\n PortalId: {ctrl.ActiveModule.PortalID} \nTab: {ctrl.ActiveModule.TabID} - {DnnUrlUtils.NavigateUrl(ctrl.ActiveModule.TabID)} \nModule: {ctrl.ActiveModule.ModuleID} \n{LoggingUtils.HttpRequestLogInfo(HttpContext.Current)} ";
            }
            Exception lastExc = exc;

            while (lastExc.InnerException != null)
            {
                lastExc          = lastExc.InnerException;
                friendlyMessage += "\n" + lastExc.Message;
            }
            return(friendlyMessage);
        }
Пример #11
0
        private static string PrepareErrorMessage(DotNetNuke.Web.Razor.RazorModuleBase ctrl, Exception exc)
        {
            string    friendlyMessage = $"\n{exc.Message} \n\nAlias: {ctrl.ModuleContext.PortalAlias.HTTPAlias} \nTab: {ctrl.ModuleContext.TabId} - {DnnUrlUtils.NavigateUrl(ctrl.ModuleContext.TabId)} \nModule: {ctrl.ModuleContext.ModuleId} \n{LoggingUtils.HttpRequestLogInfo(HttpContext.Current)} ";
            Exception lastExc         = exc;

            while (lastExc.InnerException != null)
            {
                lastExc          = lastExc.InnerException;
                friendlyMessage += "\n" + lastExc.Message;
            }
            return(friendlyMessage);
        }
Пример #12
0
        private static string PrepareErrorMessage(ModuleInfo module, Exception exc)
        {
            var       ps = PortalSettings.Current;
            var       friendlyMessage = $"Alias: {ps.PortalAlias.HTTPAlias} \nTab: {ps.ActiveTab.TabID} - {DnnUrlUtils.NavigateUrl(ps.ActiveTab.TabID)} \nModule: {module.ModuleID} \nContext: {LoggingUtils.HttpRequestLogInfo(HttpContext.Current)} \nError: {exc.Message}";
            Exception lastExc         = exc;

            while (lastExc.InnerException != null)
            {
                lastExc          = lastExc.InnerException;
                friendlyMessage += "\n" + lastExc.Message;
            }
            return(friendlyMessage);
        }
Пример #13
0
        public List <MenuAction> GetMenuActions()
        {
            var actions = new List <MenuAction>();

            TemplateManifest template        = _settings.Template;
            bool             templateDefined = template != null;

            bool isListPageRequest   = _renderinfo.IsListPageRequest;
            bool isDetailPageRequest = _renderinfo.IsDetailPageRequest;

            //Add item / Edit Item
            if (templateDefined && template.DataNeeded() && !_settings.Manifest.DisableEdit)
            {
                string title = App.Services.Localizer.GetString(isListPageRequest ? "Add.Action" : "Edit.Action", ResourceFile);
                if (!string.IsNullOrEmpty(_settings.Manifest.Title))
                {
                    title = title + " " + _settings.Manifest.Title;
                }

                actions.Add(
                    new MenuAction(
                        title,
                        isListPageRequest ? "~/DesktopModules/OpenContent/images/addcontent2.png" : "~/DesktopModules/OpenContent/images/editcontent2.png",
                        isDetailPageRequest ? RenderContext.EditUrl("id", _renderinfo.DetailItemId) : RenderContext.EditUrl(),
                        ActionType.Add
                        )
                    );
            }

            //Add AdditionalData manage actions
            if (templateDefined && template.Manifest.AdditionalDataDefined() && !_settings.Manifest.DisableEdit)
            {
                foreach (var addData in template.Manifest.AdditionalDataDefinition)
                {
                    if (addData.Value.SourceRelatedDataSource == RelatedDataSourceType.AdditionalData)
                    {
                        actions.Add(
                            new MenuAction(
                                addData.Value.Title,
                                "~/DesktopModules/OpenContent/images/editcontent2.png",
                                RenderContext.EditUrl("key", addData.Key, "EditAddData"),
                                ActionType.Edit
                                )
                            );
                    }
                    else
                    {
                        actions.Add(
                            new MenuAction(
                                addData.Value.Title,
                                "~/DesktopModules/OpenContent/images/editcontent2.png",
                                DnnUrlUtils.NavigateUrl(addData.Value.DataTabId),
                                ActionType.Edit
                                )
                            );
                    }
                }
            }

            //Manage Form Submissions
            if (templateDefined && OpenContentUtils.FormExist(_settings.Template.ManifestFolderUri))
            {
                actions.Add(
                    new MenuAction(
                        "Submissions",
                        "~/DesktopModules/OpenContent/images/editcontent2.png",
                        RenderContext.EditUrl("Submissions"),
                        ActionType.Edit
                        )
                    );
            }

            //Edit Template Settings
            if (templateDefined && _settings.Template.SettingsNeeded())
            {
                actions.Add(
                    new MenuAction(
                        App.Services.Localizer.GetString("EditSettings.Action", ResourceFile),
                        "~/DesktopModules/OpenContent/images/editsettings2.png",
                        RenderContext.EditUrl("EditSettings"),
                        ActionType.Misc,
                        SecurityAccessLevel.AdminRights
                        )
                    );
            }

            //Edit Form Settings
            if (templateDefined && OpenContentUtils.FormExist(_settings.Template.ManifestFolderUri))
            {
                actions.Add(
                    new MenuAction(
                        App.Services.Localizer.GetString("FormSettings.Action", ResourceFile),
                        "~/DesktopModules/OpenContent/images/editsettings2.png",
                        RenderContext.EditUrl("formsettings"),
                        ActionType.Misc,
                        SecurityAccessLevel.AdminRights
                        )
                    );
            }

            //Edit Notifications Settings
            if (templateDefined)
            {
                actions.Add(
                    new MenuAction(
                        App.Services.Localizer.GetString("Notifications.Action", ResourceFile),
                        "~/DesktopModules/OpenContent/images/editsettings2.png",
                        RenderContext.EditUrl("notifications"),
                        ActionType.Misc,
                        SecurityAccessLevel.AdminRights
                        )
                    );
            }
            //if (templateDefined)
            //{
            //    actions.Add(ModuleContext.GetNextActionID(),
            //        Localization.GetString("Notifications.Action", LocalResourceFile),
            //        ModuleActionType.ContentOptions,
            //        "",
            //        "~/DesktopModules/OpenContent/images/editsettings2.png",
            //        ModuleContext.EditUrl("notifications"),
            //        false,
            //        SecurityAccessLevel.Admin,
            //        true,
            //        false);
            //}

            //Switch Template
            actions.Add(
                new MenuAction(
                    App.Services.Localizer.GetString("EditInit.Action", ResourceFile),
                    "~/DesktopModules/OpenContent/images/editinit.png",
                    RenderContext.EditUrl("EditInit"),
                    ActionType.Misc,
                    SecurityAccessLevel.AdminRights
                    )
                );

            //Edit Filter Settings
            if (templateDefined && _renderinfo.IsListMode)
            {
                if (_settings.Manifest.Index)
                {
                    actions.Add(
                        new MenuAction(
                            App.Services.Localizer.GetString("EditQuery.Action", ResourceFile),
                            "~/DesktopModules/OpenContent/images/editfilter.png",
                            RenderContext.EditUrl("EditQuery"),
                            ActionType.Misc,
                            SecurityAccessLevel.AdminRights
                            )
                        );
                }
            }

            //Form Builder
            if (templateDefined && OpenContentUtils.BuildersExist(_settings.Template.ManifestFolderUri))
            {
                actions.Add(
                    new MenuAction(
                        App.Services.Localizer.GetString("Builder.Action", ResourceFile),
                        "~/DesktopModules/OpenContent/images/formbuilder.png",
                        RenderContext.EditUrl("FormBuilder"),
                        ActionType.Misc,
                        SecurityAccessLevel.AdminRights
                        )
                    );
            }

            //Edit Template Files
            if (templateDefined)
            {
                actions.Add(
                    new MenuAction(
                        App.Services.Localizer.GetString("EditTemplate.Action", ResourceFile),
                        "~/DesktopModules/OpenContent/images/edittemplate.png",
                        RenderContext.EditUrl("EditTemplate"),
                        ActionType.Misc,
                        SecurityAccessLevel.SuperUserRights
                        )
                    );
            }

            //Edit Raw Data
            if (templateDefined && _settings.Manifest != null &&
                (template.DataNeeded() || template.SettingsNeeded() || template.Manifest.AdditionalDataDefined()) && !_settings.Manifest.DisableEdit)
            {
                actions.Add(
                    new MenuAction(
                        App.Services.Localizer.GetString("EditData.Action", ResourceFile),
                        "~/DesktopModules/OpenContent/images/edit.png",
                        isDetailPageRequest ? RenderContext.EditUrl("id", _renderinfo.DetailItemId, "EditData") : RenderContext.EditUrl("EditData"),
                        ActionType.Edit,
                        SecurityAccessLevel.SuperUserRights
                        )
                    );
            }

            //Template Exchange
            actions.Add(
                new MenuAction(
                    App.Services.Localizer.GetString("ShareTemplate.Action", ResourceFile),
                    "~/DesktopModules/OpenContent/images/exchange.png",
                    RenderContext.EditUrl("ShareTemplate"),
                    ActionType.Misc,
                    SecurityAccessLevel.SuperUserRights
                    )
                );

            //Clone Module
            actions.Add(
                new MenuAction(
                    App.Services.Localizer.GetString("CloneModule.Action", ResourceFile),
                    "~/DesktopModules/OpenContent/images/clonemodule.png",
                    RenderContext.EditUrl("CloneModule"),
                    ActionType.Misc,
                    SecurityAccessLevel.AdminRights
                    )
                );

            //Edit Global Settings
            actions.Add(
                new MenuAction(
                    App.Services.Localizer.GetString("EditGlobalSettings.Action", ResourceFile),
                    "~/DesktopModules/OpenContent/images/settings.png",
                    RenderContext.EditUrl("EditGlobalSettings"),
                    ActionType.Misc,
                    SecurityAccessLevel.SuperUserRights
                    )
                );

            //Help
            actions.Add(
                new MenuAction(
                    App.Services.Localizer.GetString("Help.Action", ResourceFile),
                    "~/DesktopModules/OpenContent/images/help.png",
                    "https://opencontent.readme.io",
                    ActionType.Misc,
                    SecurityAccessLevel.SuperUserRights,
                    true
                    )
                );

            return(actions);
        }
 internal string GetUrl(int detailTabId, string cultureCode, string pagename, string idParam)
 {
     return(DnnUrlUtils.NavigateUrl(detailTabId, cultureCode, _portalSettings, pagename, idParam));
 }
 public string GetUrl(int detailTabId, string getCurrentCultureCode)
 {
     return(DnnUrlUtils.NavigateUrl(detailTabId, _portalSettings, getCurrentCultureCode));
 }