Ejemplo n.º 1
0
        /// <summary>
        /// This will create a notification type used by the module and also handle the actions that must be associated with it.
        /// </summary>
        /// <remarks>This should only ever run once, during 1.0.0 install (via IUpgradeable).
        /// </remarks>
        static internal void AddNotificationTypes()
        {
            var actions      = new List <NotificationTypeAction>();
            var deskModuleId = DesktopModuleController.GetDesktopModuleByFriendlyName("DNNQA").DesktopModuleID;

            var objNotificationType = new NotificationType
            {
                Name            = Constants.NotificationQaFlag,
                Description     = "Q&A Notification",
                DesktopModuleId = deskModuleId
            };

            if (NotificationsController.Instance.GetNotificationType(objNotificationType.Name) != null)
            {
                return;
            }
            var objAction = new NotificationTypeAction
            {
                NameResourceKey        = "AcceptInvite",
                DescriptionResourceKey = "AcceptInvite_Desc",
                APICall = "DesktopModules/DNNQA/API/SocialModuleService.ashx/ActionMethod",
                Order   = 1
            };

            actions.Add(objAction);

            NotificationsController.Instance.CreateNotificationType(objNotificationType);
            NotificationsController.Instance.SetNotificationTypeActions(actions, objNotificationType.NotificationTypeId);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This will create a notification type used by the module and also handle the actions that must be associated with it.
        /// </summary>
        static internal void AddNotificationTypes()
        {
            // part of the notification custom actions logic
            //var actions = new List<NotificationTypeAction>();

            var deskModuleId = DesktopModuleController.GetDesktopModuleByFriendlyName("Media").DesktopModuleID;

            var objNotificationType = new NotificationType
            {
                Name            = NOTIFICATION_TYPE,
                Description     = "DotNetNuke Media Settings Updated",
                DesktopModuleId = deskModuleId
            };

            if (NotificationsController.Instance.GetNotificationType(objNotificationType.Name) != null)
            {
                return;
            }

            // part of the notification custom actions logic
            // Code like this would allow us to call back our own code to perform an action
            //var objAction = new NotificationTypeAction
            //{
            //    NameResourceKey = "Informed",
            //    DescriptionResourceKey = "InformedDnnMediaUpdate",
            //    APICall = "DesktopModules/Media/ServiceName.ashx/ActionMethod",
            //    Order = 1
            //};
            //actions.Add(objAction);

            NotificationsController.Instance.CreateNotificationType(objNotificationType);

            // part of the notification custom actions logic
            //NotificationsController.Instance.SetNotificationTypeActions(actions, objNotificationType.NotificationTypeId);
        }
Ejemplo n.º 3
0
        internal static void AddAdminPage(TabController tabCtl, PortalInfo portal)
        {
            try
            {
                var desktopModule = DesktopModuleController.GetDesktopModuleByFriendlyName("CloudFlareClearCache Module");
                var pageName      = "CloudFlare Cache";
                var tabPath       = string.Format("//{0}//{1}", portal.PortalID == Null.NullInteger ? "Host" : "Admin", pageName);
                var tabId         = TabController.GetTabByTabPath(portal.PortalID, tabPath, Null.NullString);
                var existTab      = TabController.Instance.GetTab(tabId, portal.PortalID);

                if (existTab == null || existTab.TabID == Null.NullInteger)
                {
                    existTab = Upgrade.AddAdminPage(
                        PortalController.Instance.GetPortal(portal.PortalID),
                        pageName,
                        pageName,
                        "~/Icons/Sigma/Configuration_16X16_Standard.png",
                        "~/Icons/Sigma/Configuration_32X32_Standard.png",
                        true);
                }

                AddModuleToPage(desktopModule, existTab);
            }
            catch (Exception e)
            {
                LogError(e);
                throw;
            }
        }
Ejemplo n.º 4
0
    protected void btn_install_Click(object sender, EventArgs e)
    {
        bool go = true;

        System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Server.MapPath("DesktopModules/AIS/Installer/Modules.xml"));
        while (reader.Read())
        {
            if (reader.Name == "module" && reader.HasAttributes)
            {
                if (DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName")) == null)
                {
                    go = false;
                    break;
                }
            }
        }
        if (go)
        {
            procede();
        }
        else
        {
            pnl_friendly.Visible = false;
            pnl_install.Visible  = false;
            pnl_install_missing_files.Visible = true;
        }
    }
Ejemplo n.º 5
0
        protected virtual DesktopModuleInfo GetDesktopModule(PaFolder Folder)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();
            DesktopModuleInfo       objDesktopModule  = objDesktopModules.GetDesktopModuleByFriendlyName(Folder.FriendlyName);

            return(objDesktopModule);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This will create a notification type associated w/ the module and also handle the actions that must be associated with it.
        /// </summary>
        public void AddNotificationTypes()
        {
            var actions      = new List <NotificationTypeAction>();
            var deskModuleId = DesktopModuleController.GetDesktopModuleByFriendlyName(Constants.DESKTOPMODULE_FRIENDLYNAME).DesktopModuleID;

            var objNotificationType = new NotificationType
            {
                Name            = Constants.NOTIFICATION_INVITATIONUSED,
                Description     = "Social Invites: Invitation Used",
                DesktopModuleId = deskModuleId
            };

            if (NotificationsController.Instance.GetNotificationType(objNotificationType.Name) == null)
            {
                var objAction = new NotificationTypeAction
                {
                    NameResourceKey        = "RequestFriend",
                    DescriptionResourceKey = "RequestFriend_Desc",
                    APICall = "DesktopModules/SocialInvite/API/Notification/friend",
                    Order   = 1
                };
                actions.Add(objAction);

                NotificationsController.Instance.CreateNotificationType(objNotificationType);
                NotificationsController.Instance.SetNotificationTypeActions(actions, objNotificationType.NotificationTypeId);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Adds the module to page.
        /// </summary>
        /// <param name="portalId">The portal id.</param>
        /// <param name="tabId">The tab id.</param>
        /// <exception cref="System.ArgumentException">desktopModuleId</exception>
        private void AddModuleToPage(int portalId, int tabId)
        {
            TabPermissionCollection objTabPermissions = new TabController().GetTab(tabId, portalId, false).TabPermissions;
            var objPermissionController = new PermissionController();
            var objModules = new ModuleController();

            new EventLogController();

            int desktopModuleId =
                DesktopModuleController.GetDesktopModuleByFriendlyName("VanityURLs").DesktopModuleID;

            try
            {
                DesktopModuleInfo desktopModule;
                if (!DesktopModuleController.GetDesktopModules(portalId).TryGetValue(desktopModuleId, out desktopModule))
                {
                    throw new ArgumentException("desktopModuleId");
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }

            foreach (ModuleDefinitionInfo objModuleDefinition in
                     ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values)
            {
                var objModule = new ModuleInfo();
                objModule.PortalID               = portalId;
                objModule.TabID                  = tabId;
                objModule.ModuleOrder            = 0;
                objModule.ModuleTitle            = objModuleDefinition.FriendlyName;
                objModule.PaneName               = "ContentPane";
                objModule.ModuleDefID            = objModuleDefinition.ModuleDefID;
                objModule.InheritViewPermissions = true;
                objModule.CultureCode            = Null.NullString;
                objModule.AllTabs                = false;
                objModules.AddModule(objModule);
            }
        }
Ejemplo n.º 8
0
 protected bool IsLanguageModuleInstalled()
 {
     return(DesktopModuleController.GetDesktopModuleByFriendlyName("Languages") != null);
 }
Ejemplo n.º 9
0
        //-----------------------------------------------------------------------------
        //<summary>
        //UpgradeModule implements the IUpgradeable Interface
        //</summary>
        //<param name="Version">The current version of the module</param>
        //-----------------------------------------------------------------------------
        public string UpgradeModule(string version)
        {
            var message = String.Format("Social Invite Upgradeable actions for verion {0}.)", version);

            switch (version)
            {
            case "01.00.00":
                Integration.Mechanics.Instance.AddScoringDefinitions();
                message += "Added scoring definitions for Social Invite. " + Environment.NewLine;

                Integration.Notifications.Instance.AddNotificationTypes();
                message += "Added notification types for Social Invite. " + Environment.NewLine;

                Integration.Content.Instance.AddContentType();
                message += "Added content types for Social Invite. " + Environment.NewLine;

                DotNetNuke.SocialLibrary.Components.Common.Utilities.CategorizeSocialModule(DesktopModuleController.GetDesktopModuleByFriendlyName(Constants.DESKTOPMODULE_FRIENDLYNAME));
                DotNetNuke.SocialLibrary.Components.Common.Utilities.CategorizeSocialModule(DesktopModuleController.GetDesktopModuleByFriendlyName(Constants.DESKTOPMODULE_FRIENDLYNAME_REG));
                message += "Added Social Invite to Social module category. " + Environment.NewLine;

                break;
            }

            return(message);
        }
Ejemplo n.º 10
0
    private void procede()
    {
        PortalSettings          ps       = new PortalSettings();
        int                     portalId = ps.PortalId;
        TabController           tc       = new TabController();
        DesktopModuleController DMC      = new DesktopModuleController();
        //string check = "";
        Dictionary <String, String> settings = null;
        TabController TC = new TabController();

        System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Server.MapPath("DesktopModules/AIS/Installer/Modules.xml"));
        while (reader.Read())
        {
            if (reader.Name == "tab" && reader.HasAttributes)
            {
                TabInfo ti = TC.GetTabByName(reader.GetAttribute("name"), portalId);
                if (ti == null)
                {
                    if (reader.GetAttribute("parent") != null && reader.GetAttribute("parent") != "")
                    {
                        createPage(reader.GetAttribute("name"), getListPermissionsTab(reader.GetAttribute("name")), bool.Parse(reader.GetAttribute("visible")), bool.Parse(reader.GetAttribute("superTab")), reader.GetAttribute("parent"));
                    }
                    else
                    {
                        createPage(reader.GetAttribute("name"), getListPermissionsTab(reader.GetAttribute("name")), bool.Parse(reader.GetAttribute("visible")), bool.Parse(reader.GetAttribute("superTab")), "");
                    }
                    if
                    (reader.GetAttribute("dependency") != null && reader.GetAttribute("dependency") != "")
                    {
                        TC.DeleteTab(TC.GetTabByName(reader.GetAttribute("dependency"), portalId).TabID, portalId);
                        procede();
                        reader.Close();
                    }
                }
            }
            if (reader.Name == "module" && reader.HasAttributes)
            {
                if (DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName")) != null)
                {
                    DesktopModuleInfo dmi = DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"));
                    if (reader.AttributeCount > 2)
                    {
                        settings = new Dictionary <string, string>();
                        for (int i = 2; i < reader.AttributeCount; i = i + 2)
                        {
                            settings.Add(reader.GetAttribute(i), reader.GetAttribute(i + 1));
                        }
                    }
                    Label   lbl  = new Label();
                    Literal line = new Literal();
                    line.Text = "<br />";
                    TabInfo ti = new TabInfo();
                    ti.TabName = reader.GetAttribute("tab");
                    switch (checkPage(ti, DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"))))
                    {
                    case "OK":
                        break;

                    case "Page":

                        break;

                    case "Bin":
                        break;

                    default:
                        AddModuleToTab(tc.GetTabByName(ti.TabName, portalId), dmi, settings: settings);
                        break;
                    }
                }
            }
        }
        pnl_install.Visible = false;
        pnl_install_missing_files.Visible = false;
        pnl_manuel.Visible = true;
        pnl_fin.Visible    = true;
    }
Ejemplo n.º 11
0
    protected void btn_assistant_Click(object sender, EventArgs e)
    {
        try
        {
            PortalSettings ps       = new PortalSettings();
            int            portalId = ps.PortalId;
            pnl_friendly.Visible = true;
            pnl_install.Visible  = true;
            pnl_start.Visible    = false;
            TabController            TC     = new TabController();
            string                   check  = "";
            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Server.MapPath("DesktopModules/AIS/Installer/Modules.xml") /*"C:\\inetpub\\wwwroot\\DNN\\DesktopModules\\AIS\\Installer\\Modules.xml"*/);
            bool install = false;
            while (reader.Read())
            {
                Label   lbl  = new Label();
                Literal line = new Literal();
                line.Text = "<br />";
                if (reader.Name == "tab" && reader.HasAttributes)
                {
                    TabInfo ti = TC.GetTabByName(reader.GetAttribute("name"), portalId);
                    if (ti == null)
                    {
                        lbl.Text      = "Tab " + reader.GetAttribute("name") + " does not exist";
                        lbl.ForeColor = System.Drawing.Color.Red;
                        pnl_friendly.Controls.Add(lbl);
                        pnl_friendly.Controls.Add(line);
                        install = true;
                    }
                    else if (ti.IsDeleted)
                    {
                        lbl.Text      = "Tab " + ti.TabName + " is in the bin : please restore it or delete it permanently";
                        lbl.ForeColor = System.Drawing.Color.Red;
                        pnl_friendly.Controls.Add(lbl);
                        pnl_friendly.Controls.Add(line);
                    }
                }
                if (reader.Name == "module" && reader.HasAttributes)
                {
                    if (DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName")) != null)
                    {
                        DesktopModuleInfo dmi = DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"));


                        TabInfo ti = new TabInfo();
                        ti.TabName = reader.GetAttribute("tab");


                        switch (checkPage(ti, DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"))))
                        {
                        case "OK":
                            if (check != ti.TabName)
                            {
                                lbl.Text      = "Module " + dmi.FriendlyName + " is already implemented in tab " + ti.TabName;
                                lbl.ForeColor = System.Drawing.Color.Green;
                                pnl_friendly.Controls.Add(lbl);
                                pnl_friendly.Controls.Add(line);
                                check = ti.TabName;
                            }
                            break;

                        case "Page":

                            break;

                        case "Bin":

                            break;

                        default:
                            lbl.Text      = "Module " + dmi.FriendlyName + " does not exist in tab " + ti.TabName;
                            lbl.ForeColor = System.Drawing.Color.Red;
                            pnl_friendly.Controls.Add(lbl);
                            pnl_friendly.Controls.Add(line);
                            install = true;
                            break;
                        }
                    }
                    else
                    {
                        lbl.Text      = "Module " + reader.GetAttribute("friendlyName") + " does not exist in site";
                        lbl.ForeColor = System.Drawing.Color.Red;
                        pnl_friendly.Controls.Add(lbl);
                        pnl_friendly.Controls.Add(line);
                    }
                }
            }
            btn_install.Visible = install;
        }
        catch (Exception exc)
        {
            superlabel.Text += exc.Message;
        }
    }
Ejemplo n.º 12
0
        private void AddNotificationTypes()
        {
            var actions = new List <NotificationTypeAction>();

            //DesktopModule should not be null
            var deskModuleId = DesktopModuleController.GetDesktopModuleByFriendlyName("Social Groups").DesktopModuleID;

            //GroupPendingNotification
            var type = new NotificationType {
                Name = "GroupPendingNotification", Description = "Group Pending Notification", DesktopModuleId = deskModuleId
            };

            if (NotificationsController.Instance.GetNotificationType(type.Name) == null)
            {
                actions.Add(new NotificationTypeAction
                {
                    NameResourceKey        = "Approve",
                    DescriptionResourceKey = "ApproveGroup",
                    APICall = "DesktopModules/SocialGroups/API/ModerationService/ApproveGroup"
                });
                actions.Add(new NotificationTypeAction
                {
                    NameResourceKey        = "RejectGroup",
                    DescriptionResourceKey = "RejectGroup",
                    APICall = "DesktopModules/SocialGroups/API/ModerationService/RejectGroup"
                });
                NotificationsController.Instance.CreateNotificationType(type);
                NotificationsController.Instance.SetNotificationTypeActions(actions, type.NotificationTypeId);
            }

            //GroupApprovedNotification
            type = new NotificationType {
                Name = "GroupApprovedNotification", Description = "Group Approved Notification", DesktopModuleId = deskModuleId
            };
            if (NotificationsController.Instance.GetNotificationType(type.Name) == null)
            {
                NotificationsController.Instance.CreateNotificationType(type);
            }

            //GroupCreatedNotification
            type = new NotificationType {
                Name = "GroupCreatedNotification", Description = "Group Created Notification", DesktopModuleId = deskModuleId
            };
            if (NotificationsController.Instance.GetNotificationType(type.Name) == null)
            {
                actions.Clear();
                actions.Add(new NotificationTypeAction
                {
                    NameResourceKey        = "RejectGroup",
                    DescriptionResourceKey = "RejectGroup",
                    ConfirmResourceKey     = "DeleteItem",
                    APICall = "DesktopModules/SocialGroups/API/ModerationService/RejectGroup"
                });
                NotificationsController.Instance.CreateNotificationType(type);
                NotificationsController.Instance.SetNotificationTypeActions(actions, type.NotificationTypeId);
            }

            //GroupRejectedNotification
            type = new NotificationType {
                Name = "GroupRejectedNotification", Description = "Group Rejected Notification", DesktopModuleId = deskModuleId
            };
            if (NotificationsController.Instance.GetNotificationType(type.Name) == null)
            {
                NotificationsController.Instance.CreateNotificationType(type);
            }

            //GroupMemberPendingNotification
            type = new NotificationType {
                Name = "GroupMemberPendingNotification", Description = "Group Member Pending Notification", DesktopModuleId = deskModuleId
            };
            if (NotificationsController.Instance.GetNotificationType(type.Name) == null)
            {
                actions.Clear();
                actions.Add(new NotificationTypeAction
                {
                    NameResourceKey        = "Approve",
                    DescriptionResourceKey = "ApproveGroupMember",
                    ConfirmResourceKey     = "",
                    APICall = "DesktopModules/SocialGroups/API/ModerationService/ApproveMember"
                });
                actions.Add(new NotificationTypeAction
                {
                    NameResourceKey        = "RejectMember",
                    DescriptionResourceKey = "RejectGroupMember",
                    APICall = "DesktopModules/SocialGroups/API/ModerationService/RejectMember"
                });
                NotificationsController.Instance.CreateNotificationType(type);
                NotificationsController.Instance.SetNotificationTypeActions(actions, type.NotificationTypeId);
            }

            //GroupMemberApprovedNotification
            type = new NotificationType {
                Name = "GroupMemberApprovedNotification", Description = "Group Member Notification", DesktopModuleId = deskModuleId
            };
            if (NotificationsController.Instance.GetNotificationType(type.Name) == null)
            {
                NotificationsController.Instance.CreateNotificationType(type);
            }

            //GroupMemberRejectedNotification
            type = new NotificationType {
                Name = "GroupMemberRejectedNotification", Description = "Group Rejected Notification", DesktopModuleId = deskModuleId
            };
            if (NotificationsController.Instance.GetNotificationType(type.Name) == null)
            {
                NotificationsController.Instance.CreateNotificationType(type);
            }
        }