Esempio n. 1
0
        public Settings(int moduleId, int tabModuleId)
        {
            _moduleId = moduleId;
            _tabModuleId = tabModuleId;

            var mc = new ModuleController();
            ModuleSettings = mc.GetModuleSettings(_moduleId);
            TabModuleSettings = mc.GetTabModuleSettings(_tabModuleId);

            History = TabModuleSettings.GetInteger(SettingName.History, _History);
            DescriptionLength = TabModuleSettings.GetInteger(SettingName.DescriptionLength, _DescriptionLength);
            EditorHeight = TabModuleSettings.GetInteger(SettingName.EditorHeight, _EditorHeight);
            DefaultViewType = Utilities.StringToViewType(TabModuleSettings.GetString(SettingName.DefaultViewType,_DefaultViewType));
            TemplateType = TabModuleSettings.GetString(SettingName.TemplateType, _TemplateType);
            TemplateName = TabModuleSettings.GetString(SettingName.TemplateName, _TemplateName);
            TemplateLocation = TabModuleSettings.GetString(SettingName.TemplateLocation, _TemplateLocation);
            
            
            //legacy
            ItemTemplate = TabModuleSettings.GetString(SettingName.ItemTemplate, Null.NullString);
            AltItemTemplate = TabModuleSettings.GetString(SettingName.AltItemTemplate, Null.NullString);
            Separator = TabModuleSettings.GetString(SettingName.HeaderTemplate, Null.NullString);
            HeaderTemplate = TabModuleSettings.GetString(SettingName.HeaderTemplate, Null.NullString);
            FooterTemplate = TabModuleSettings.GetString(SettingName.FooterTemplate, Null.NullString);

            Legacy = ModuleSettings.GetBoolean(SettingName.Legacy, _Legacy) || !Legacy && !string.IsNullOrEmpty(ItemTemplate);
        }
        public Configuration(int ModuleId)
        {
            _ModuleId       = ModuleId;
            _portalSettings = PortalController.GetCurrentPortalSettings();
            _TabID          = _portalSettings.ActiveTab.TabID;
            var mc = new DotNetNuke.Entities.Modules.ModuleController();

            _ModuleConfiguration = mc.GetModule(_ModuleId, _TabID);
            _TabModuleID         = _ModuleConfiguration.TabModuleID;

            Hashtable tabModuleSettings = mc.GetTabModuleSettings(_TabModuleID);
            Hashtable moduleSettings    = mc.GetModuleSettings(_ModuleId);

            //Merge the TabModuleSettings and ModuleSettings
            _Settings = new Hashtable();
            foreach (string strKey in tabModuleSettings.Keys)
            {
                _Settings[strKey] = tabModuleSettings[strKey];
            }
            foreach (string strKey in moduleSettings.Keys)
            {
                _Settings[strKey] = moduleSettings[strKey];
            }

            LoadSettings();
        }
        static DataTable GetSettingsTable(int id, SettingsType type)
        {
            var modules = new ModuleController();
            Hashtable settings = null;
            DataTable returnValue = null;

            switch (type)
            {
                case SettingsType.ModuleSettings:
                    settings = modules.GetModuleSettings(id);
                    returnValue = new DataTable(DataSetTableName.Settings);
                    break;
                case SettingsType.TabModuleSettings:
                    settings = modules.GetTabModuleSettings(id);
                    returnValue = new DataTable(DataSetTableName.TabSettings);
                    break;
            }

            var sortedSettings = new SortedList<string, string>();
            if (settings != null)
                foreach (DictionaryEntry item in settings)
                {
                    sortedSettings.Add(item.Key.ToString(), item.Value.ToString());
                }


            var dc = new DataColumn(SettingsTableColumn.Setting, typeof (string))
                         {ColumnMapping = MappingType.Attribute};
            if (returnValue != null) returnValue.Columns.Add(dc);

            dc = new DataColumn(SettingsTableColumn.Value, typeof (string)) {ColumnMapping = MappingType.Attribute};
            if (returnValue != null)
            {
                returnValue.Columns.Add(dc);

                foreach (var key in sortedSettings.Keys)
                {
                    var row = returnValue.NewRow();
                    row[SettingsTableColumn.Setting] = key;
                    row[SettingsTableColumn.Value] = sortedSettings[key];
                    returnValue.Rows.Add(row);
                }
                return returnValue;
            }
            return null;
        }
        public void ParseCSV(DotNetNuke.Services.FileSystem.FileInfo fileInfo, int startIndex)
        {
            using (CsvReader reader = new CsvReader(new StreamReader(fileInfo.PhysicalPath), true))
            {
                int tabModuleId = DataProvider.Instance().GetTabModuleIdByFileId(fileInfo.FileId);
                int lineNumber = 0;

                if (startIndex == 0)
                {
                    DataProvider.Instance().ClearTempLocations();
                }
                else
                {
                    lineNumber = startIndex;
                    reader.MoveTo(startIndex - 1);
                }

                try
                {
                    while (reader.ReadNextRecord())
                    {
                        lineNumber++;
                        Location location = new Location();
                        location.LocationId = Convert.ToInt32(GetValue(reader, "UNIQUE_KEY"), CultureInfo.InvariantCulture);
                        location.ExternalIdentifier = GetValue(reader, "EXTERNAL_IDENTIFIER");
                        location.Name = GetValue(reader, "LOCATION_NAME");
                        string address1 = GetValue(reader, "ADDRESS1");
                        string address2 = GetValue(reader, "ADDRESS2");
                        location.City = GetValue(reader, "CITY");
                        string state = GetValue(reader, "STATE");
                        location.PostalCode = GetValue(reader, "ZIP");
                        location.Phone = GetValue(reader, "PHONE_NUMBER");
                        location.LocationDetails = GetValue(reader, "LOCATION_DETAILS");
                        location.Website = GetValue(reader, "WEBSITE");
                        location.PortalId = this.portalId;
                        string locationType = GetValue(reader, "TYPE_OF_LOCATION");
                        if (locationType == string.Empty)
                        {
                            locationType = "Default";
                        }

                        string country = GetValue(reader, "COUNTRY");
                        DataTable dt = DataProvider.Instance().GetLocationTypes();
                        int locationTypeId = -1;

                        foreach (DataRow dr in dt.Rows)
                        {
                            if (Convert.ToString(dr["LocationTypeName"], CultureInfo.InvariantCulture) == locationType)
                            {
                                locationTypeId = Convert.ToInt32(dr["LocationTypeID"], CultureInfo.InvariantCulture);
                                location.LocationTypeId = locationTypeId;
                            }
                        }

                        if (locationTypeId == -1)
                        {
                            locationTypeId = DataProvider.Instance().InsertLocationType(locationType);
                            location.LocationTypeId = locationTypeId;
                        }

                        location.RegionId = ResolveState(state);
                        if (location.RegionId < 1)
                        {
                            location.RegionId = Convert.ToInt32(null, CultureInfo.InvariantCulture);
                        }

                        location.CountryId = ResolveCountry(country);
                        if (location.CountryId < 1)
                        {
                            ModuleController objModules = new ModuleController();
                            location.CountryId = Dnn.Utility.GetIntSetting(objModules.GetTabModuleSettings(tabModuleId), "DefaultCountry").Value;
                        }

                        location.CsvLineNumber = lineNumber;
                        location.Address = address1;

                        // Address2 is informational only - See Pat Renner.
                        location.Address2 = address2;

                        GeocodeResult geocodeResult = GetGeoCoordinates(tabModuleId, address1, location.City, location.RegionId, location.PostalCode, location.CountryId);
                        if (geocodeResult.Successful)
                        {
                            location.Latitude = geocodeResult.Latitude;
                            location.Longitude = geocodeResult.Longitude;
                        }

                        location.Approved = true;

                        try
                        {
                            location.SaveTemp(geocodeResult.Successful);
                        }
                        catch (SqlException ex)
                        {
                            Exceptions.LogException(ex);
                        }
                    }
                }
                catch (ArgumentException exc)
                {
                    Exceptions.LogException(exc);
                    this.FileMove(false);
                }

                if (lineNumber == 0)
                {
                    this.FileMove(false);
                }
            }
        }
Esempio n. 5
0
        private void GetControl(string view, string options)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    plhLoader.Controls.Clear();
                }
                ForumBase ctl = null;
                if (view.ToUpperInvariant() == "FORUMVIEW")
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                }
                else if (view.ToUpperInvariant() == "ADVANCED")
                {
                    ctl = (ForumBase)(LoadControl("~/desktopmodules/activeforums/advanced.ascx"));
                }
                else if ((view.ToUpperInvariant() == Views.Topics.ToUpperInvariant()) || (view.ToUpperInvariant() == "topics".ToUpperInvariant()))
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.TopicsView());
                }
                else if ((view.ToUpperInvariant() == Views.Topic.ToUpperInvariant()) || (view.ToUpperInvariant() == "topic".ToUpperInvariant()))
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.TopicView());
                }
                else if (view.ToUpperInvariant() == "USERSETTINGS".ToUpperInvariant())
                {
                    string ctlPath = string.Empty;
                    ctlPath = "~/DesktopModules/ActiveForums/controls/af_profile.ascx";
                    if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
                    {
                        ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                    }
                    else
                    {
                        ctl = (ForumBase)(LoadControl(ctlPath));
                    }
                }
                else
                {
                    string ctlPath = string.Empty;
                    ctlPath = "~/DesktopModules/ActiveForums/controls/af_" + view + ".ascx";
                    if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
                    {
                        ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                    }
                    else
                    {
                        ctl = (ForumBase)(LoadControl(ctlPath));
                    }

                }
                if (ForumId > 0 & ForumInfo != null)
                {
                    ctl.ForumInfo = ForumInfo;
                }
                ctl.ID = view;
                ctl.ForumId = ForumId;
                ctl.ForumModuleId = ForumModuleId;
                if (ForumTabId == -1)
                {
                    ForumTabId = TabId;
                }
                ctl.ForumTabId = ForumTabId;
                ctl.ForumGroupId = ForumGroupId;
                ctl.DefaultForumViewTemplateId = DefaultForumViewTemplateId;
                ctl.DefaultTopicsViewTemplateId = DefaultTopicsViewTemplateId;
                ctl.DefaultTopicViewTemplateId = DefaultTopicViewTemplateId;
                ctl.UseTemplatePath = UseTemplatePath;
                ctl.TemplatePath = TemplatePath;
                ctl.ParentForumId = ParentForumId;
                if (string.IsNullOrEmpty(ForumIds))
                {
                    ForumIds = UserForumsList;
                }

                if (SocialGroupId > 0)
                {
                    ForumController fc = new ForumController();
                    ForumIds = fc.GetForumIdsBySocialGroup(PortalId, SocialGroupId);

                    if (string.IsNullOrEmpty(ForumIds))
                    {
                        RoleController rc = new RoleController();
                        RoleInfo role = rc.GetRole(SocialGroupId, PortalId);
                        //Create new forum
                        bool isPrivate = false;
                        if (!role.IsPublic)
                        {
                            isPrivate = true;
                        }
                        Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
                        Hashtable htSettings = objModules.GetTabModuleSettings(TabModuleId);

                        fc.CreateGroupForum(PortalId, ModuleId, SocialGroupId, Convert.ToInt32(htSettings["ForumGroupTemplate"].ToString()), role.RoleName + " Discussions", role.Description, isPrivate, htSettings["ForumConfig"].ToString());
                        ForumIds = fc.GetForumIdsBySocialGroup(PortalId, SocialGroupId);
                    }
                }
                ctl.ForumIds = ForumIds;
                ctl.SocialGroupId = SocialGroupId;

                //ctl.PostID = PostID
                ctl.ModuleConfiguration = this.ModuleConfiguration;
                if (!(options == string.Empty))
                {
                    ctl.Params = options;
                }
                ControlsConfig cc = new ControlsConfig();
                cc.AppPath = Page.ResolveUrl("~/DesktopModules/ActiveForums/");
                cc.ThemePath = Page.ResolveUrl("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/");
                cc.TemplatePath = cc.ThemePath + "templates/";
                cc.SiteId = PortalId;
                cc.PageId = TabId;
                cc.InstanceId = ModuleId;
                cc.User = ForumUser;
                cc.DefaultViewRoles = Permissions.GetRoleIds(this.ModuleConfiguration.AuthorizedViewRoles.Split(';'), PortalId);
                cc.AdminRoles = Permissions.GetRoleIds(this.ModuleConfiguration.AuthorizedEditRoles.Split(';'), PortalId);
                cc.ProfileLink = ""; //GetProfileLink()
                cc.MembersLink = ""; // GetMembersLink()
                this.ControlConfig = cc;
                ctl.ControlConfig = cc;
                LinkControls(ctl.Controls);
                if (!(plhLoader.Controls.Contains(ctl)))
                {
                    plhLoader.Controls.Add(ctl);
                }
                string sOut = null;
                sOut = System.Environment.NewLine + "<!--  © 2004 - 2013 DNN Corp.,  All Rights Reserved -->" + System.Environment.NewLine;
                sOut += "<!-- Active Forums 5.0  -->" + System.Environment.NewLine;

                Literal lit = new Literal();
                lit.Text = sOut;
                plhLoader.Controls.Add(lit);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Esempio n. 6
0
 private static void UpgradeToVersion621()
 {
     //update administrators' role description.
     var portalController = new PortalController();
     var moduleController = new ModuleController();
     foreach (PortalInfo portal in portalController.GetPortals())
     {
         //update about me's template
         var myProfileTabId = TabController.GetTabByTabPath(portal.PortalID, "//ActivityFeed//MyProfile", string.Empty);
         if (myProfileTabId != Null.NullInteger)
         {
             var tabModules = moduleController.GetTabModules(myProfileTabId);
             foreach (var module in tabModules.Values)
             {
                 var settings = moduleController.GetTabModuleSettings(module.TabModuleID);
                 if (settings.ContainsKey("ProfileTemplate") && settings["ProfileTemplate"].ToString().Contains("<div class=\"pBio\">"))
                 {
                     var template = @"<div class=""pBio"">
                             <h3 data-bind=""text: AboutMeText""></h3>
                             <span data-bind=""text: EmptyAboutMeText, visible: Biography().length==0""></span>
                             <p data-bind=""html: Biography""></p>
                             </div>
                             <div class=""pAddress"">
                             <h3 data-bind=""text: LocationText""></h3>
                             <span data-bind=""text: EmptyLocationText, visible: Street().length=0 && Location().length==0 && Country().length==0 && PostalCode().length==0""></span>
                             <p><span data-bind=""text: Street()""></span><span data-bind=""visible: Street().length > 0""><br/></span>
                             <span data-bind=""text: Location()""></span><span data-bind=""visible: Location().length > 0""><br/></span>
                             <span data-bind=""text: Country()""></span><span data-bind=""visible: Country().length > 0""><br/></span>
                             <span data-bind=""text: PostalCode()""></span>
                             </p>
                             </div>
                             <div class=""pContact"">
                             <h3 data-bind=""text: GetInTouchText""></h3>
                             <span data-bind=""text: EmptyGetInTouchText, visible: Telephone().length==0 && Email().length==0 && Website().length==0 && IM().length==0""></span>
                             <ul>
                             <li data-bind=""visible: Telephone().length > 0""><strong><span data-bind=""text: TelephoneText"">:</span></strong> <span data-bind=""text: Telephone()""></span></li>
                             <li data-bind=""visible: Email().length > 0""><strong><span data-bind=""text: EmailText"">:</span></strong> <span data-bind=""text: Email()""></span></li>
                             <li data-bind=""visible: Website().length > 0""><strong><span data-bind=""text: WebsiteText"">:</span></strong> <span data-bind=""text: Website()""></span></li>
                             <li data-bind=""visible: IM().length > 0""><strong><span data-bind=""text: IMText"">:</span></strong> <span data-bind=""text: IM()""></span></li>
                             </ul>
                             </div>
                             <div class=""dnnClear""></div>";
                     moduleController.UpdateTabModuleSetting(module.TabModuleID, "ProfileTemplate", template);
                 }
             }
         }
     }
 }
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            txtMessage.Visible = true;
            bool itemExists = false;

            if (ItemId > -1)
            {
                //Using GetItemTypeId as substitute for IfExists
                if (Item.GetItemTypeId(ItemId, PortalId) > -1)
                {
                    itemExists = true;
                    bool inUse = false;
                    var modulesInUse = new StringBuilder();
                    var mc = new ModuleController();
                    ArrayList modules = mc.GetModulesByDefinition(PortalId, Utility.DnnFriendlyModuleName);

                    foreach (ModuleInfo module in modules)
                    {
                        Hashtable settings = mc.GetTabModuleSettings(module.TabModuleID);

                        if (settings.ContainsKey("DisplayType") && settings["DisplayType"].ToString() == "ArticleDisplay")
                        {
                            int articleId;
                            if (settings.ContainsKey("adArticleId") && int.TryParse(settings["adArticleId"].ToString(), out articleId))
                            {
                                if (articleId == ItemId)
                                {
                                    inUse = true;
                                    modulesInUse.AppendFormat("{0} ({1}){2}", module.ModuleTitle, module.TabID, Environment.NewLine);
                                    break;
                                }
                            }
                        }
                    }

                    ArrayList featuredRelationships = ItemRelationship.GetItemChildRelationships(ItemId, Util.RelationshipType.ItemToFeaturedItem.GetId());
                    bool isFeatured = featuredRelationships.Count > 0;

                    if (!inUse && !isFeatured)
                    {
                        //Item.DeleteItem(ItemId);
                        Item.DeleteItem(ItemId, PortalId);
                        txtMessage.Text = Localization.GetString("DeleteSuccess", LocalResourceFile);

                    }
                    else
                    {
                        var errorMessage = new StringBuilder();

                        if (inUse)
                        {
                            errorMessage.AppendFormat("{0}{1}", Localization.GetString("DeleteFailureInUse", LocalResourceFile), Environment.NewLine);
                            errorMessage.Append(modulesInUse.ToString());
                        }
                        if (isFeatured)
                        {
                            errorMessage.AppendFormat("{0}{1}", Localization.GetString("DeleteFailureIsFeatured", LocalResourceFile), Environment.NewLine);

                            foreach (ItemRelationship rel in featuredRelationships)
                            {
                                Category parentCategory = Category.GetCategory(rel.ChildItemId, PortalId);
                                errorMessage.AppendFormat("{0}{1}", parentCategory.Name, Environment.NewLine);
                            }
                        }
                        txtMessage.Text = errorMessage.ToString();
                    }
                }
            }
            if (!itemExists)
            {
                txtMessage.Text = Localization.GetString("DeleteFailure", LocalResourceFile);
            }
            ShowOnlyMessage();
        }
Esempio n. 8
0
        /// <summary>
        /// The GetTabModuleSettings Method returns a hashtable of
        /// custom module/tab specific settings from the database.  This method is
        /// used by some user control modules (Xml, Image, etc) to access misc
        /// settings.
        /// </summary>
        /// <returns>A Hashtable of settings (key/value pairs)</returns>
        /// <remarks>
        /// </remarks>
        ///	<param name="TabModuleId">The current tabModule</param>
        public static Hashtable GetTabModuleSettings( int TabModuleId )
        {
            ModuleController objModules = new ModuleController();

            return objModules.GetTabModuleSettings( TabModuleId );
        }
        private bool UserHasRights(int tabId)
        {
            var modules = new ModuleController();
            Dictionary<int, ModuleInfo> tabModules = modules.GetTabModules(tabId);

            foreach (ModuleInfo module in tabModules.Values)
            {
                if (module.DesktopModule.FriendlyName.Equals(Utility.DnnFriendlyModuleName))
                {
                    bool overrideable;
                    object overrideableObj = modules.GetTabModuleSettings(module.TabModuleID)["Overrideable"];
                    if (overrideableObj != null && bool.TryParse(overrideableObj.ToString(), out overrideable) && overrideable)
                    {
                        // keep checking until there is an overrideable module that the user is authorized to see.  BD
                        if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.View, string.Empty, module))
                        {
                            return true;
                        }
                    }
                }
            }

            return false;
        }
        static void AddSettings(XmlNode nodeModule, ModuleInfo module)
        {
            var objModuleController = new ModuleController();
            var moduleSettings = objModuleController.GetModuleSettings(module.ModuleID);
            var tabModuleSettings = objModuleController.GetTabModuleSettings(module.TabModuleID);

            var handleModuleSettings = true;
            var handleTabModuleSettings = true;

            if (module.DesktopModule.BusinessControllerClass != "" && module.DesktopModule.IsPortable)
            {
                try
                {
                    var businessController = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass,
                                                                     module.DesktopModule.BusinessControllerClass);
                    if (businessController is IPortable2)
                    {
                        handleModuleSettings =
                            Convert.ToBoolean(!(((IPortable2) businessController).ManagesModuleSettings));
                        handleTabModuleSettings =
                            Convert.ToBoolean(!(((IPortable2) businessController).ManagesTabModuleSettings));
                    }
                }
                catch
                {
                }
            }

            XmlAttribute xmlattr;

            if (moduleSettings.Count > 0 && handleModuleSettings)
            {
// ReSharper disable PossibleNullReferenceException
                XmlNode settingsNode = nodeModule.OwnerDocument.CreateElement("modulesettings");

                foreach (string key in moduleSettings.Keys)
                {
                    XmlNode settingNode = nodeModule.OwnerDocument.CreateElement("setting");
                    xmlattr = nodeModule.OwnerDocument.CreateAttribute("name");
                    xmlattr.Value = key;
                    settingNode.Attributes.Append(xmlattr);
                    // ReSharper restore PossibleNullReferenceException
                    xmlattr = nodeModule.OwnerDocument.CreateAttribute("value");
                    xmlattr.Value = moduleSettings[key].ToString();
                    settingNode.Attributes.Append(xmlattr);
                    settingsNode.AppendChild(settingNode);
                }
                nodeModule.AppendChild(settingsNode);
            }

            if (tabModuleSettings.Count > 0 && handleTabModuleSettings)
            {
// ReSharper disable PossibleNullReferenceException
                XmlNode settingsNode = nodeModule.OwnerDocument.CreateElement("tabmodulesettings");
// ReSharper restore PossibleNullReferenceException
                foreach (string key in tabModuleSettings.Keys)
                {
                    XmlNode settingNode = nodeModule.OwnerDocument.CreateElement("setting");
                    xmlattr = nodeModule.OwnerDocument.CreateAttribute("name");
                    xmlattr.Value = key;
// ReSharper disable PossibleNullReferenceException
                    settingNode.Attributes.Append(xmlattr);
// ReSharper restore PossibleNullReferenceException
                    xmlattr = nodeModule.OwnerDocument.CreateAttribute("value");
                    xmlattr.Value = tabModuleSettings[key].ToString();
                    settingNode.Attributes.Append(xmlattr);
                    settingsNode.AppendChild(settingNode);
                }
                nodeModule.AppendChild(settingsNode);
            }
        }
        static void DeserializeTabModuleSettings(XmlNodeList nodeTabModuleSettings, int moduleId, int tabId)
        {
            var objModules = new ModuleController();
            var tabModuleId = objModules.GetModule(moduleId, tabId).TabModuleID;

            var applySettings = Convert.ToBoolean(objModules.GetTabModuleSettings(tabModuleId).Count == 0);
            foreach (XmlElement nodeSetting in nodeTabModuleSettings)
            {
                var name = nodeSetting.Attributes["name"].Value;
                var value = nodeSetting.Attributes["value"].Value;
                if (applySettings || nodeSetting.GetAttribute("installmode").ToLowerInvariant() == "force")
                {
                    objModules.UpdateTabModuleSetting(tabModuleId, name, value);
                }
            }
        }
        public void BuildModuleSettings()
        {
            XmlNode publishNode = _doc.SelectSingleNode("publish");
            XmlNode settingsNode = _doc.CreateElement("modulesettings");

            //TODO: get a list of module settings, parse through the list and generate XMl
            var mc = new ModuleController();
            //we aren't using modulesettings in Publish, only tabmodulesettings
            //System.Collections.Hashtable moduleSettings = mc.GetModuleSettings(_moduleId);
            ModuleInfo mi = mc.GetModule(_moduleId, _tabId);
            System.Collections.Hashtable tabModuleSettings = mc.GetTabModuleSettings(mi.TabModuleID);

            foreach (string key in tabModuleSettings.Keys)
            {
                XmlNode settingNode = _doc.CreateElement("tabmodulesetting");
                settingNode.Attributes.Remove(settingNode.Attributes["xmlns:xsd"]);
                settingNode.Attributes.Remove(settingNode.Attributes["xmlns:xsi"]);

                settingsNode.AppendChild(settingNode);

                XmlNode keyNode = _doc.CreateElement("Key");
                keyNode.AppendChild(_doc.CreateTextNode(key));
                settingNode.AppendChild(keyNode);
                XmlNode valueNode = _doc.CreateElement("Value");
                valueNode.AppendChild(_doc.CreateTextNode(tabModuleSettings[key].ToString()));
                settingNode.AppendChild(valueNode);
                settingsNode.AppendChild(_doc.ImportNode(settingNode, true));
            }
            publishNode.AppendChild(_doc.ImportNode(settingsNode, true));
        }
Esempio n. 13
0
 /// <summary>
 /// for this you need to have put a setting in the 
 /// moduleController.UpdateTabModuleSetting(moduleInfo.tabModuleId, MODULE_SETTING_KEY_ASMX, "this.asmx");  
 /// this answers whether the moduleId and tabId received go with the Url they accessed
 /// This is an important security check
 /// </summary>
 /// <returns></returns>
 public bool canModuleAccessCurrentUrl()
 {
     if (moduleInfo == null)
         return false;
     var retVal = false;
     var moduleController = new ModuleController();
     var settings = moduleController.GetTabModuleSettings(moduleInfo.TabModuleID);
     if (settings.ContainsKey(MODULE_SETTING_KEY_ASMX))
     {
         var setting = settings[MODULE_SETTING_KEY_ASMX] as string;
         if (setting.Length > 0) // else false, of course
             retVal = asmxName.ToLower().Contains(setting.ToLower());
     }
     return retVal;
 }