Exemple #1
0
 public void UpdateListEntry(ListEntryInfo listEntry)
 {
     DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, listEntry.Text, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);
     EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_UPDATED);
     ClearListCache(listEntry.PortalID);
     ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
 }
Exemple #2
0
        /// <summary>
        /// Adds a new list entry to the database. If the current thread locale is not "en-US" then the text value will also be
        /// persisted to a resource file under App_GlobalResources using the list's name and the value as key.
        /// </summary>
        /// <param name="listEntry">The list entry.</param>
        /// <returns></returns>
        public int AddListEntry(ListEntryInfo listEntry)
        {
            bool EnableSortOrder = (listEntry.SortOrder > 0);

            ClearListCache(listEntry.PortalID);
            int entryId = DataProvider.Instance().AddListEntry(listEntry.ListName,
                                                               listEntry.Value,
                                                               listEntry.TextNonLocalized,
                                                               listEntry.ParentID,
                                                               listEntry.Level,
                                                               EnableSortOrder,
                                                               listEntry.DefinitionID,
                                                               listEntry.Description,
                                                               listEntry.PortalID,
                                                               listEntry.SystemList,
                                                               UserController.Instance.GetCurrentUserInfo().UserID);

            if (entryId != Null.NullInteger)
            {
                EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_CREATED);
            }
            if (System.Threading.Thread.CurrentThread.CurrentCulture.Name != DotNetNuke.Services.Localization.Localization.SystemLocale && !NonLocalizedLists.Contains(listEntry.ListName))
            {
                DotNetNuke.Services.Localization.LocalizationProvider.Instance.SaveString(listEntry.Value, listEntry.TextNonLocalized, "App_GlobalResources/List_" + listEntry.ListName + ".resx", System.Threading.Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), Services.Localization.LocalizationProvider.CustomizedLocale.None, true, true);
            }
            ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
            return(entryId);
        }
        public int AddListEntry(ListEntryInfo ListEntry)
        {
            bool EnableSortOrder = (ListEntry.SortOrder > 0);

            ClearCache(ListEntry.PortalID);
            int entryId = DataProvider.Instance().AddListEntry(ListEntry.ListName,
                                                               ListEntry.Value,
                                                               ListEntry.Text,
                                                               ListEntry.ParentID,
                                                               ListEntry.Level,
                                                               EnableSortOrder,
                                                               ListEntry.DefinitionID,
                                                               ListEntry.Description,
                                                               ListEntry.PortalID,
                                                               ListEntry.SystemList,
                                                               UserController.GetCurrentUserInfo().UserID);

            if (entryId != Null.NullInteger)
            {
                var objEventLog = new EventLogController();
                objEventLog.AddLog(ListEntry, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_CREATED);
            }

            return(entryId);
        }
        public void DeleteListEntryByListName(string ListName, string Value, bool DeleteChild)
        {
            ListEntryInfo entry = GetListEntryInfo(ListName, Value);

            DataProvider.Instance().DeleteListEntryByListName(ListName, Value, DeleteChild);
            ClearCache(entry.PortalID);
        }
        public void DeleteListEntryByID(int EntryID, bool DeleteChild)
        {
            ListEntryInfo entry = GetListEntryInfo(EntryID);

            DataProvider.Instance().DeleteListEntryByID(EntryID, DeleteChild);
            ClearCache(entry.PortalID);
        }
        public void UpdateListSortOrder(int EntryID, bool MoveUp)
        {
            DataProvider.Instance().UpdateListSortOrder(EntryID, MoveUp);
            ListEntryInfo entry = GetListEntryInfo(EntryID);

            ClearCache(entry.PortalID);
        }
        /// <summary>
        /// Adds a new list entry to the database. If the current thread locale is not "en-US" then the text value will also be
        /// persisted to a resource file under App_GlobalResources using the list's name and the value as key.
        /// </summary>
        /// <param name="listEntry">The list entry.</param>
        /// <returns></returns>
        public int AddListEntry(ListEntryInfo listEntry)
        {
            bool enableSortOrder = listEntry.SortOrder > 0;

            ClearListCache(listEntry.PortalID);
            int entryId = DataProvider.Instance().AddListEntry(listEntry.ListName,
                                                               listEntry.Value,
                                                               listEntry.TextNonLocalized,
                                                               listEntry.ParentID,
                                                               listEntry.Level,
                                                               enableSortOrder,
                                                               listEntry.DefinitionID,
                                                               listEntry.Description,
                                                               listEntry.PortalID,
                                                               listEntry.SystemList,
                                                               UserController.Instance.GetCurrentUserInfo().UserID);

            if (entryId != Null.NullInteger)
            {
                EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_CREATED);
            }
            if (Thread.CurrentThread.CurrentCulture.Name != Localization.SystemLocale && !NonLocalizedLists.Contains(listEntry.ListName))
            {
                if (string.IsNullOrEmpty(listEntry.ParentKey))
                {
                    LocalizationProvider.Instance.SaveString(listEntry.Value + ".Text", listEntry.TextNonLocalized, listEntry.ResourceFileRoot, Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), LocalizationProvider.CustomizedLocale.None, true, true);
                }
                else
                {
                    LocalizationProvider.Instance.SaveString(listEntry.ParentKey + "." + listEntry.Value + ".Text", listEntry.TextNonLocalized, listEntry.ResourceFileRoot, Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), LocalizationProvider.CustomizedLocale.None, true, true);
                }
            }
            ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
            return(entryId);
        }
        public void DeleteListEntryByID(int entryId, bool deleteChild)
        {
            ListEntryInfo entry = GetListEntryInfo(entryId);

            DataProvider.Instance().DeleteListEntryByID(entryId, deleteChild);
            ClearListCache(entry.PortalID);
            ClearEntriesCache(entry.ListName, entry.PortalID);
        }
        public void DeleteListEntryByListName(string listName, string listValue, bool deleteChild)
        {
            ListEntryInfo entry = GetListEntryInfo(listName, listValue);

            DataProvider.Instance().DeleteListEntryByListName(listName, listValue, deleteChild);
            ClearListCache(entry.PortalID);
            ClearEntriesCache(listName, entry.PortalID);
        }
Exemple #10
0
        public void UpdateListSortOrder(int EntryID, bool MoveUp)
        {
            DataProvider.Instance().UpdateListSortOrder(EntryID, MoveUp);
            ListEntryInfo entry = this.GetListEntryInfo(EntryID);

            this.ClearListCache(entry.PortalID);
            this.ClearEntriesCache(entry.ListName, entry.PortalID);
        }
        public void UpdateListEntry(ListEntryInfo ListEntry)
        {
            DataProvider.Instance().UpdateListEntry(ListEntry.EntryID, ListEntry.Value, ListEntry.Text, ListEntry.Description, UserController.GetCurrentUserInfo().UserID);
            var objEventLog = new EventLogController();

            objEventLog.AddLog(ListEntry, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_UPDATED);
            ClearCache(ListEntry.PortalID);
        }
Exemple #12
0
        /// <summary>
        /// Handles events when clicking image button in the grid (Edit/Up/Down)
        /// </summary>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        /// </history>
        protected void grdEntries_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                ListController ctlLists = new ListController();
                int            entryID  = Convert.ToInt32(((DataGrid)source).DataKeys[e.Item.ItemIndex]);

                switch (e.CommandName.ToLower())
                {
                case "delete":
                    DeleteItem(entryID);
                    InitList();
                    BindGrid();
                    break;

                case "edit":
                    EnableView(false);
                    EnableEdit(false);

                    ListEntryInfo entry = ctlLists.GetListEntryInfo(entryID);
                    this.txtEntryID.Text          = entryID.ToString();
                    this.txtParentKey.Text        = entry.ParentKey;
                    this.txtEntryName.Text        = entry.ListName;
                    this.txtEntryValue.Text       = entry.Value;
                    this.txtEntryText.Text        = entry.Text;
                    this.txtEntryName.ReadOnly    = true;
                    this.cmdSaveEntry.CommandName = "Update";

                    if (!(entry.DefinitionID == -1))
                    {
                        this.cmdDelete.Visible = true;
                        ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                    }
                    else
                    {
                        this.cmdDelete.Visible = false;
                    }

                    break;

                case "up":
                    ctlLists.UpdateListSortOrder(entryID, true);
                    InitList();
                    BindGrid();
                    break;

                case "down":
                    ctlLists.UpdateListSortOrder(entryID, false);
                    InitList();
                    BindGrid();
                    break;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        ///     Handles events when clicking image button in the grid (Edit/Up/Down)
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void EntriesGridItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                var ctlLists = new ListController();
                int entryID  = Convert.ToInt32(((GridDataItem)e.Item).GetDataKeyValue("EntryID"));

                switch (e.CommandName.ToLower())
                {
                case "delete":
                    Mode = "ListEntries";
                    DeleteItem(entryID);
                    break;

                case "edit":
                    Mode = "EditEntry";

                    ListEntryInfo entry = ctlLists.GetListEntryInfo(entryID);
                    txtEntryID.Text          = entryID.ToString(CultureInfo.InvariantCulture);
                    txtParentKey.Text        = entry.ParentKey;
                    txtEntryValue.Text       = entry.Value;
                    txtEntryText.Text        = entry.Text;
                    rowListName.Visible      = false;
                    cmdSaveEntry.CommandName = "Update";

                    if (!SystemList)
                    {
                        cmdDelete.Visible = true;
                        ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                    }
                    e.Canceled = true;                      //stop the grid from providing inline editing
                    DataBind();
                    break;

                case "up":
                    ctlLists.UpdateListSortOrder(entryID, true);
                    DataBind();
                    break;

                case "down":
                    ctlLists.UpdateListSortOrder(entryID, false);
                    DataBind();
                    break;
                }
            }
            catch (Exception exc)             //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 public void Add(string key, ListEntryInfo value)
 {
     int index;
     try //Do validation first
     {
         index = base.List.Add(value);
         _keyIndexLookup.Add(key.ToLower(), index);
     }
     catch (Exception exc)
     {
         Logger.Error(exc);
     }
 }
        public void Add(string key, ListEntryInfo value)
        {
            int index;

            try //Do validation first
            {
                index = base.List.Add(value);
                _keyIndexLookup.Add(key.ToLower(), index);
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);
            }
        }
Exemple #16
0
        public void Add(string key, ListEntryInfo value)
        {
            int index;

            try // Do validation first
            {
                index = this.List.Add(value);
                this._keyIndexLookup.Add(key.ToLowerInvariant(), index);
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
            }
        }
 public void Add( string key, ListEntryInfo value )
 {
     int index;
     // <tam:note key to be lowercase for appropiated seeking>
     try
     {
         index = base.List.Add( value );
         mKeyIndexLookup.Add( key.ToLower(), index );
     }
     catch( Exception )
     {
         //Throw ex
     }
 }
Exemple #18
0
        public void Add(string key, ListEntryInfo value)
        {
            int index;

            // <tam:note key to be lowercase for appropiated seeking>
            try
            {
                index = base.List.Add(value);
                mKeyIndexLookup.Add(key.ToLower(), index);
            }
            catch (Exception)
            {
                //Throw ex
            }
        }
Exemple #19
0
 /// <summary>
 /// Updates the list entry in the database using the values set on the listEntry. Note that if the current thread locale is not "en-US" then the
 /// text value will be persisted to a resource file under App_GlobalResources using the list's name and the value as key. Also the supplied text value
 /// will *not* be written to the database in this case (i.e. we expect the text value in the database to be the en-US text value).
 /// </summary>
 /// <param name="listEntry">The list entry info item to update.</param>
 public void UpdateListEntry(ListEntryInfo listEntry)
 {
     if (System.Threading.Thread.CurrentThread.CurrentCulture.Name == DotNetNuke.Services.Localization.Localization.SystemLocale || NonLocalizedLists.Contains(listEntry.ListName))
     {
         DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, listEntry.TextNonLocalized, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);
     }
     else
     {
         ListEntryInfo oldItem = GetListEntryInfo(listEntry.EntryID); // look up existing db record to be able to just update the value or description and not touch the en-US text value
         DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, oldItem.TextNonLocalized, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);
         DotNetNuke.Services.Localization.LocalizationProvider.Instance.SaveString(listEntry.Value, listEntry.TextNonLocalized, "App_GlobalResources/List_" + listEntry.ListName + ".resx", System.Threading.Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), Services.Localization.LocalizationProvider.CustomizedLocale.None, true, true);
     }
     EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_UPDATED);
     ClearListCache(listEntry.PortalID);
     ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
 }
        /// <summary>
        /// Updates the list entry in the database using the values set on the listEntry. Note that if the current thread locale is not "en-US" then the
        /// text value will be persisted to a resource file under App_GlobalResources using the list's name and the value as key. Also the supplied text value
        /// will *not* be written to the database in this case (i.e. we expect the text value in the database to be the en-US text value).
        /// </summary>
        /// <param name="listEntry">The list entry info item to update.</param>
        public void UpdateListEntry(ListEntryInfo listEntry)
        {
            if (Thread.CurrentThread.CurrentCulture.Name == Localization.SystemLocale || NonLocalizedLists.Contains(listEntry.ListName))
            {
                DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, listEntry.TextNonLocalized, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);
            }
            else
            {
                var oldItem = GetListEntryInfo(listEntry.EntryID); // look up existing db record to be able to just update the value or description and not touch the en-US text value
                DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, oldItem.TextNonLocalized, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);

                var key = string.IsNullOrEmpty(listEntry.ParentKey)
                    ? listEntry.Value + ".Text"
                    : listEntry.ParentKey + "." + listEntry.Value + ".Text";

                LocalizationProvider.Instance.SaveString(key, listEntry.TextNonLocalized, listEntry.ResourceFileRoot,
                                                         Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), LocalizationProvider.CustomizedLocale.None, true, true);
            }
            EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_UPDATED);
            ClearListCache(listEntry.PortalID);
            ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
        }
Exemple #21
0
        private static void UpgradeToVersion620()
        {
            //add host (system) profanityfilter list
            const string listName = "ProfanityFilter";
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = Null.NullInteger;
                entry.ListName = listName;
                entry.Value = "ReplaceWithNothing";
                entry.Text = "FindThisText";
                entry.SystemList = true;
            }
            listController.AddListEntry(entry);

            //add same list to each portal
            foreach (PortalInfo portal in PortalController.Instance.GetPortals())
            {
                entry.PortalID = portal.PortalID;
                entry.SystemList = false;
                entry.ListName = listName + "-" + portal.PortalID;
                listController.AddListEntry(entry);

                //also create default social relationship entries for the portal
                RelationshipController.Instance.CreateDefaultRelationshipsForPortal(portal.PortalID);
            }

            //Convert old Messages to new schema
            ConvertOldMessages();

            //Replace old Messaging module on User Profile with new 
            ReplaceMessagingModule();

            //Move Photo Property to the end of the propert list.
            MovePhotoProperty();

            //Update Child Portal's Default Page
            UpdateChildPortalsDefaultPage();

            //Add core notification types
            AddCoreNotificationTypesFor620();

            //Console module should not be IPortable
            var consoleModule = DesktopModuleController.GetDesktopModuleByModuleName("Console", Null.NullInteger);
            consoleModule.SupportedFeatures = 0;
            consoleModule.BusinessControllerClass = "";
            DesktopModuleController.SaveDesktopModule(consoleModule, false, false);
        }
Exemple #22
0
        public int AddListEntry(ListEntryInfo ListEntry)
        {
            bool EnableSortOrder = ListEntry.SortOrder > 0;

            return(DataProvider.Instance().AddListEntry(ListEntry.ListName, ListEntry.Value, ListEntry.Text, ListEntry.ParentKey, EnableSortOrder, ListEntry.DefinitionID, ListEntry.Description));
        }
 public void UpdateListEntry(ListEntryInfo listEntry)
 {
     DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, listEntry.Text, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);
     EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_UPDATED);
     ClearListCache(listEntry.PortalID);
     ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
 }
        /// <summary>
        /// Adds a new list entry to the database. If the current thread locale is not "en-US" then the text value will also be 
        /// persisted to a resource file under App_GlobalResources using the list's name and the value as key.
        /// </summary>
        /// <param name="listEntry">The list entry.</param>
        /// <returns></returns>
        public int AddListEntry(ListEntryInfo listEntry)
        {
            bool EnableSortOrder = (listEntry.SortOrder > 0);
            ClearListCache(listEntry.PortalID);
            int entryId = DataProvider.Instance().AddListEntry(listEntry.ListName,
                                                        listEntry.Value,
                                                        listEntry.TextNonLocalized,
                                                        listEntry.ParentID,
                                                        listEntry.Level,
                                                        EnableSortOrder,
                                                        listEntry.DefinitionID,
                                                        listEntry.Description,
                                                        listEntry.PortalID,
                                                        listEntry.SystemList,
                                                        UserController.Instance.GetCurrentUserInfo().UserID);

            if (entryId != Null.NullInteger)
            {
                EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_CREATED);
            }
            if (System.Threading.Thread.CurrentThread.CurrentCulture.Name != DotNetNuke.Services.Localization.Localization.SystemLocale && !NonLocalizedLists.Contains(listEntry.ListName))
            {
				if (string.IsNullOrEmpty(listEntry.ParentKey))
				{
					DotNetNuke.Services.Localization.LocalizationProvider.Instance.SaveString(listEntry.Value + ".Text", listEntry.TextNonLocalized, "App_GlobalResources/List_" + listEntry.ListName + ".resx", System.Threading.Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), Services.Localization.LocalizationProvider.CustomizedLocale.None, true, true);
				}
				else
				{
					DotNetNuke.Services.Localization.LocalizationProvider.Instance.SaveString(listEntry.ParentKey + "." + listEntry.Value + ".Text", listEntry.TextNonLocalized, "App_GlobalResources/List_" + listEntry.ListName + ".resx", System.Threading.Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), Services.Localization.LocalizationProvider.CustomizedLocale.None, true, true);
				}
            }
            ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
            return entryId;
        }
        /// <summary>
        /// Updates the list entry in the database using the values set on the listEntry. Note that if the current thread locale is not "en-US" then the
        /// text value will be persisted to a resource file under App_GlobalResources using the list's name and the value as key. Also the supplied text value 
        /// will *not* be written to the database in this case (i.e. we expect the text value in the database to be the en-US text value).
        /// </summary>
        /// <param name="listEntry">The list entry info item to update.</param>
        public void UpdateListEntry(ListEntryInfo listEntry)
        {
            if (System.Threading.Thread.CurrentThread.CurrentCulture.Name == DotNetNuke.Services.Localization.Localization.SystemLocale || NonLocalizedLists.Contains(listEntry.ListName))
            {
                DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, listEntry.TextNonLocalized, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);
            }
            else
            {
                ListEntryInfo oldItem = GetListEntryInfo(listEntry.EntryID); // look up existing db record to be able to just update the value or description and not touch the en-US text value
                DataProvider.Instance().UpdateListEntry(listEntry.EntryID, listEntry.Value, oldItem.TextNonLocalized, listEntry.Description, UserController.Instance.GetCurrentUserInfo().UserID);
				if (string.IsNullOrEmpty(listEntry.ParentKey))
				{
					DotNetNuke.Services.Localization.LocalizationProvider.Instance.SaveString(listEntry.Value + ".Text", listEntry.TextNonLocalized, "App_GlobalResources/List_" + listEntry.ListName + ".resx", System.Threading.Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), Services.Localization.LocalizationProvider.CustomizedLocale.None, true, true);
				}
				else
				{
					DotNetNuke.Services.Localization.LocalizationProvider.Instance.SaveString(listEntry.ParentKey + "." + listEntry.Value + ".Text", listEntry.TextNonLocalized, "App_GlobalResources/List_" + listEntry.ListName + ".resx", System.Threading.Thread.CurrentThread.CurrentCulture.Name, PortalController.Instance.GetCurrentPortalSettings(), Services.Localization.LocalizationProvider.CustomizedLocale.None, true, true);
				}
            }
            EventLogController.Instance.AddLog(listEntry, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_UPDATED);
            ClearListCache(listEntry.PortalID);
            ClearEntriesCache(listEntry.ListName, listEntry.PortalID);
        }
        /// <summary>
        /// Handles cmdSaveEntry.Click
        /// </summary>
        /// <remarks>
        /// Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        /// </history>
        protected void cmdSaveEntry_Click( object sender, EventArgs e )
        {
            ListController ctlLists = new ListController();
            ListEntryInfo entry = new ListEntryInfo();
            entry.ListName = txtEntryName.Text;
            entry.Value = txtEntryValue.Text;
            entry.Text = txtEntryText.Text;

            switch (cmdSaveEntry.CommandName.ToLower())
            {
                case "update":
                    entry.ParentKey = txtParentKey.Text;
                    entry.EntryID = Int16.Parse(txtEntryID.Text);

                    ctlLists.UpdateListEntry(entry);

                    InitList();
                    EnableView(true);
                    //BindListInfo()
                    BindGrid();

                    break;
                case "saveentry":
                    entry.ParentKey = txtParentKey.Text;
                    if (EnableSortOrder)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }

                    ctlLists.AddListEntry(entry);

                    InitList();
                    BindListInfo();
                    BindTree();
                    BindGrid();

                    break;
                case "savelist":
                    string strKey = "";
                    string strText = "";
                    if (ddlSelectParent.SelectedIndex != -1)
                    {
                        strKey = ddlSelectParent.SelectedItem.Value;
                        strText = ddlSelectParent.SelectedItem.Text;
                        entry.ParentKey = strKey;
                        strKey += ":";
                        strText += ":";
                    }

                    if (chkEnableSortOrder.Checked)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }

                    ctlLists.AddListEntry(entry);

                    strKey += this.txtEntryName.Text;
                    strText += this.txtEntryName.Text;

                    SelectedKey = strKey;
                    SelectedText = strText;

                    BindTree();
                    InitList();
                    BindListInfo();
                    BindGrid();
                    //Response.Redirect(NavigateURL(TabId))
                    break;
            }

        }
Exemple #27
0
        /// <summary>
        /// Handles cmdSaveEntry.Click
        /// </summary>
        /// <remarks>
        /// Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        /// </history>
        protected void cmdSaveEntry_Click(object sender, EventArgs e)
        {
            ListController ctlLists = new ListController();
            ListEntryInfo  entry    = new ListEntryInfo();

            entry.ListName = txtEntryName.Text;
            entry.Value    = txtEntryValue.Text;
            entry.Text     = txtEntryText.Text;

            switch (cmdSaveEntry.CommandName.ToLower())
            {
            case "update":
                entry.ParentKey = txtParentKey.Text;
                entry.EntryID   = Int16.Parse(txtEntryID.Text);

                ctlLists.UpdateListEntry(entry);

                InitList();
                EnableView(true);
                //BindListInfo()
                BindGrid();

                break;

            case "saveentry":
                entry.ParentKey = txtParentKey.Text;
                if (EnableSortOrder)
                {
                    entry.SortOrder = 1;
                }
                else
                {
                    entry.SortOrder = 0;
                }

                ctlLists.AddListEntry(entry);

                InitList();
                BindListInfo();
                BindTree();
                BindGrid();

                break;

            case "savelist":
                string strKey  = "";
                string strText = "";
                if (ddlSelectParent.SelectedIndex != -1)
                {
                    strKey          = ddlSelectParent.SelectedItem.Value;
                    strText         = ddlSelectParent.SelectedItem.Text;
                    entry.ParentKey = strKey;
                    strKey         += ":";
                    strText        += ":";
                }

                if (chkEnableSortOrder.Checked)
                {
                    entry.SortOrder = 1;
                }
                else
                {
                    entry.SortOrder = 0;
                }

                ctlLists.AddListEntry(entry);

                strKey  += this.txtEntryName.Text;
                strText += this.txtEntryName.Text;

                SelectedKey  = strKey;
                SelectedText = strText;

                BindTree();
                InitList();
                BindListInfo();
                BindGrid();
                //Response.Redirect(NavigateURL(TabId))
                break;
            }
        }
 public void UpdateListEntry(ListEntryInfo ListEntry)
 {
     DataProvider.Instance().UpdateListEntry(ListEntry.EntryID, ListEntry.ListName, ListEntry.Value, ListEntry.Text, ListEntry.Description);
 }
 public int AddListEntry(ListEntryInfo ListEntry)
 {
     bool EnableSortOrder = ListEntry.SortOrder > 0;
     return DataProvider.Instance().AddListEntry(ListEntry.ListName, ListEntry.Value, ListEntry.Text, ListEntry.ParentKey, EnableSortOrder, ListEntry.DefinitionID, ListEntry.Description);
 }
        /// <summary>
        /// Inserts a new status with the given name, in the given portal.
        /// </summary>
        /// <param name="statusName">Name of the status.</param>
        /// <param name="portalId">The portal ID.</param>
        public static void InsertStatus(string statusName, int portalId)
        {
            var listItem = new ListEntryInfo
            {
                Text = statusName,
                Value = statusName,
                DefinitionID = Null.NullInteger,
                PortalID = portalId,
                ListName = Utility.ApplicationStatusListName,
            };

            new ListController().AddListEntry(listItem);
        }
Exemple #31
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     Handles cmdSaveEntry.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        ///     Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        ///     [cnurse]  01/30/2007	Extracted to separte user control
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnSaveEntryClick(object sender, EventArgs e)
        {
            var ctlLists = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = ListPortalID;
                entry.ListName = txtEntryName.Text;
                entry.Value = txtEntryValue.Text;
                entry.Text = txtEntryText.Text;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                    case "update":
                        entry.ParentKey = SelectedList.ParentKey;
                        entry.EntryID = Int16.Parse(txtEntryID.Text);

                        ctlLists.UpdateListEntry(entry);

                        DataBind();
                        break;
                    case "saveentry":
                        if (SelectedList != null)
                        {
                            entry.ParentKey = SelectedList.ParentKey;
                            entry.ParentID = SelectedList.ParentID;
                            entry.Level = SelectedList.Level;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }
                        ctlLists.AddListEntry(entry);

                        DataBind();
                        break;
                    case "savelist":
                        if (ddlSelectParent.SelectedIndex != -1)
                        {
                            int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value);
                            ListEntryInfo parentEntry = ctlLists.GetListEntryInfo(parentID);
                            entry.ParentID = parentID;
                            entry.DefinitionID = parentEntry.DefinitionID;
                            entry.Level = parentEntry.Level + 1;
                            entry.ParentKey = parentEntry.Key;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }
                        ctlLists.AddListEntry(entry);

                        SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName;

                        Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey));
                        break;
                }
            }
        }
Exemple #32
0
        /// <summary>
        /// Creates the portal.
        /// </summary>
        /// <param name="portalName">Name of the portal.</param>
        /// <param name="adminUser">The obj admin user.</param>
        /// <param name="description">The description.</param>
        /// <param name="keyWords">The key words.</param>
        /// <param name="template"> </param>
        /// <param name="homeDirectory">The home directory.</param>
        /// <param name="portalAlias">The portal alias.</param>
        /// <param name="serverPath">The server path.</param>
        /// <param name="childPath">The child path.</param>
        /// <param name="isChildPortal">if set to <c>true</c> means the portal is child portal.</param>
        /// <returns>Portal id.</returns>
        public int CreatePortal(string portalName, UserInfo adminUser, string description, string keyWords, PortalTemplateInfo template, 
                                string homeDirectory, string portalAlias, string serverPath, string childPath, bool isChildPortal)
        {
            string message = Null.NullString;
            int administratorId = Null.NullInteger;

            //Attempt to create a new portal
            int portalId = CreatePortal(portalName, homeDirectory);

            string templatePath, templateFile;
            PrepareLocalizedPortalTemplate(template, out templatePath, out templateFile);
            string mergedTemplatePath = Path.Combine(templatePath, templateFile);

            if (portalId != -1)
            {
                if (String.IsNullOrEmpty(homeDirectory))
                {
                    homeDirectory = "Portals/" + portalId;
                }
                string mappedHomeDirectory = String.Format(Globals.ApplicationMapPath + "\\" + homeDirectory + "\\").Replace("/", "\\");
                message += CreateProfileDefinitions(portalId, mergedTemplatePath);
                if (message == Null.NullString)
                {
                    //add administrator
                    try
                    {
                        adminUser.PortalID = portalId;
                        UserCreateStatus createStatus = UserController.CreateUser(ref adminUser);
                        if (createStatus == UserCreateStatus.Success)
                        {
                            administratorId = adminUser.UserID;
                            //reload the UserInfo as when it was first created, it had no portal id and therefore
                            //used host profile definitions
                            adminUser = UserController.GetUserById(adminUser.PortalID, adminUser.UserID);
                        }
                        else
                        {
                            message += UserController.GetUserCreateStatus(createStatus);
                        }
                    }
                    catch (Exception Exc)
                    {
                        Logger.Error(Exc);
                        message += Localization.GetString("CreateAdminUser.Error") + Exc.Message + Exc.StackTrace;
                    }
                }
                else
                {
                    throw new Exception(message);
                }
                if (String.IsNullOrEmpty(message) && administratorId > 0)
                {
                    try
                    {
                        //the upload directory may already exist if this is a new DB working with a previously installed application
                        if (Directory.Exists(mappedHomeDirectory))
                        {
                            Globals.DeleteFolderRecursive(mappedHomeDirectory);
                        }
                    }
                    catch (Exception Exc)
                    {
                        Logger.Error(Exc);
                        message += Localization.GetString("DeleteUploadFolder.Error") + Exc.Message + Exc.StackTrace;
                    }

                    //Set up Child Portal
                    if (message == Null.NullString)
                    {
                        if (isChildPortal)
                        {
                            message = CreateChildPortalFolder(childPath);
                        }
                    }
                    else
                    {
                        throw new Exception(message);
                    }
                    if (message == Null.NullString)
                    {
                        try
                        {
                            //create the upload directory for the new portal
                            Directory.CreateDirectory(mappedHomeDirectory);
                            //ensure that the Templates folder exists
                            string templateFolder = String.Format("{0}Templates", mappedHomeDirectory);
                            if (!Directory.Exists(templateFolder))
                            {
                                Directory.CreateDirectory(templateFolder);
                            }

                            //ensure that the Users folder exists
                            string usersFolder = String.Format("{0}Users", mappedHomeDirectory);
                            if (!Directory.Exists(usersFolder))
                            {
                                Directory.CreateDirectory(usersFolder);
                            }

                            //copy the default page template
                            CopyPageTemplate("Default.page.template", mappedHomeDirectory);

                            // process zip resource file if present
                            if (File.Exists(template.ResourceFilePath))
                            {
                                ProcessResourceFileExplicit(mappedHomeDirectory, template.ResourceFilePath);
                            }

							//copy getting started css into portal's folder.
							var hostGettingStartedFile = string.Format("{0}GettingStarted.css", Globals.HostMapPath);
							if (File.Exists(hostGettingStartedFile))
							{
								var portalFile = mappedHomeDirectory + "GettingStarted.css";
								if (!File.Exists(portalFile))
								{
									File.Copy(hostGettingStartedFile, portalFile);
								}
							}
                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);
                            message += Localization.GetString("ChildPortal.Error") + Exc.Message + Exc.StackTrace;
                        }
                    }
                    else
                    {
                        throw new Exception(message);
                    }
                    if (message == Null.NullString)
                    {
                        try
                        {
                            FolderMappingController.Instance.AddDefaultFolderTypes(portalId);
                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);
                            message += Localization.GetString("DefaultFolderMappings.Error") + Exc.Message + Exc.StackTrace;
                        }
                    }
                    else
                    {
                        throw new Exception(message);
                    }

                    LocaleCollection newPortalLocales = null;
                    if (message == Null.NullString)
                    {
                        try
                        {
                            ParseTemplate(portalId, templatePath, templateFile, administratorId, PortalTemplateModuleAction.Replace, true, out newPortalLocales);
                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);
                            message += Localization.GetString("PortalTemplate.Error") + Exc.Message + Exc.StackTrace;
                        }
                    }
                    else
                    {
                        throw new Exception(message);
                    }
                    if (message == Null.NullString)
                    {
                        var portal = GetPortal(portalId);
						portal.Description = description;
						portal.KeyWords = keyWords;
						portal.UserTabId = TabController.GetTabByTabPath(portal.PortalID, "//UserProfile", portal.CultureCode);
                        if (portal.UserTabId == -1)
                        {
                            portal.UserTabId = TabController.GetTabByTabPath(portal.PortalID, "//ActivityFeed", portal.CultureCode);
                        }
                        portal.SearchTabId = TabController.GetTabByTabPath(portal.PortalID, "//SearchResults", portal.CultureCode);
						UpdatePortalInfo(portal);
						adminUser.Profile.PreferredLocale = portal.DefaultLanguage;
						var portalSettings = new PortalSettings(portal);
						adminUser.Profile.PreferredTimeZone = portalSettings.TimeZone;
						UserController.UpdateUser(portal.PortalID, adminUser);
                        DesktopModuleController.AddDesktopModulesToPortal(portalId);
                        AddPortalAlias(portalId, portalAlias);

                        if (newPortalLocales != null)
                        {
                            foreach (Locale newPortalLocale in newPortalLocales.AllValues)
                            {
                                Localization.AddLanguageToPortal(portalId, newPortalLocale.LanguageId, false);
                            }
                        }

                        try
                        {
                            RelationshipController.Instance.CreateDefaultRelationshipsForPortal(portalId);
                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);                            
                        }

                        //add profanity list to new portal
                        try
                        {
                            const string listName = "ProfanityFilter";
                            var listController = new ListController();
                            var entry = new ListEntryInfo();
                            entry.PortalID = portalId;
                            entry.SystemList = false;
                            entry.ListName = listName + "-" + portalId;
                            listController.AddListEntry(entry);

                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);
                        }

                        //add banned password list to new portal
                        try
                        {
                            const string listName = "BannedPasswords";
                            var listController = new ListController();
                            var entry = new ListEntryInfo();
                            entry.PortalID = portalId;
                            entry.SystemList = false;
                            entry.ListName = listName + "-" + portalId;
                            listController.AddListEntry(entry);

                        }
                        catch (Exception Exc)
                        {
                            Logger.Error(Exc);
                        }

                        // Add default workflows
                        try
                        {
                            ContentWorkflowController.Instance.CreateDefaultWorkflows(portalId);
                        }
                        catch (Exception ex)
                        {
                            Logger.Error(ex);
                        }

                        ServicesRoutingManager.ReRegisterServiceRoutesWhileSiteIsRunning();

                        try
                        {
                            var objEventLogInfo = new LogInfo();
                            objEventLogInfo.BypassBuffering = true;
                            objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("Install Portal:", portalName));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("FirstName:", adminUser.FirstName));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("LastName:", adminUser.LastName));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("Username:"******"Email:", adminUser.Email));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("Description:", description));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("Keywords:", keyWords));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("Template:", template.TemplateFilePath));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("TemplateCulture:", template.CultureCode));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("HomeDirectory:", homeDirectory));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("PortalAlias:", portalAlias));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("ServerPath:", serverPath));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("ChildPath:", childPath));
                            objEventLogInfo.LogProperties.Add(new LogDetailInfo("IsChildPortal:", isChildPortal.ToString()));
                            var eventLog = new EventLogController();
                            eventLog.AddLog(objEventLogInfo);
                        }
                        catch (Exception exc)
                        {
                            Logger.Error(exc);
                        }
                    }
                    else
                    {
                        throw new Exception(message);
                    }
                }
                else
                {
                    DeletePortalInfo(portalId);
                    portalId = -1;
                    throw new Exception(message);
                }
            }
            else
            {
                message += Localization.GetString("CreatePortal.Error");
                throw new Exception(message);
            }
            return portalId;
        }
        /// <summary>
        ///     Handles cmdSaveEntry.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        ///     Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        protected void OnSaveEntryClick(object sender, EventArgs e)
        {
            String entryValue;
            String entryText;

            if (UserInfo.IsSuperUser)
            {
                entryValue = txtEntryValue.Text;
                entryText  = txtEntryText.Text;
            }
            else
            {
                var ps = new PortalSecurity();

                entryValue = ps.InputFilter(txtEntryValue.Text, PortalSecurity.FilterFlag.NoScripting);
                entryText  = ps.InputFilter(txtEntryText.Text, PortalSecurity.FilterFlag.NoScripting);
            }
            var listController = new ListController();
            var entry          = new ListEntryInfo();

            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID     = ListPortalID;
                entry.ListName     = ListName;
                entry.Value        = entryValue;
                entry.Text         = entryText;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                case "update":
                    entry.ParentKey = SelectedList.ParentKey;
                    entry.EntryID   = Int16.Parse(txtEntryID.Text);
                    bool canUpdate = true;
                    foreach (var curEntry in listController.GetListEntryInfoItems(SelectedList.Name, entry.ParentKey, entry.PortalID))
                    {
                        if (entry.EntryID != curEntry.EntryID)                                 //not the same item we are trying to update
                        {
                            if (entry.Value == curEntry.Value && entry.Text == curEntry.Text)
                            {
                                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                                canUpdate = false;
                                break;
                            }
                        }
                    }

                    if (canUpdate)
                    {
                        listController.UpdateListEntry(entry);
                        DataBind();
                    }
                    break;

                case "saveentry":
                    if (SelectedList != null)
                    {
                        entry.ParentKey = SelectedList.ParentKey;
                        entry.ParentID  = SelectedList.ParentID;
                        entry.Level     = SelectedList.Level;
                    }
                    if (chkEnableSortOrder.Checked)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }

                    if (listController.AddListEntry(entry) == Null.NullInteger)                             //entry already found in database
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }


                    DataBind();
                    break;

                case "savelist":
                    if (ddlSelectParent.SelectedIndex != -1)
                    {
                        int           parentID    = Int32.Parse(ddlSelectParent.SelectedItem.Value);
                        ListEntryInfo parentEntry = listController.GetListEntryInfo(parentID);
                        entry.ParentID     = parentID;
                        entry.DefinitionID = parentEntry.DefinitionID;
                        entry.Level        = parentEntry.Level + 1;
                        entry.ParentKey    = parentEntry.Key;
                    }
                    if (chkEnableSortOrder.Checked)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }

                    if (listController.AddListEntry(entry) == Null.NullInteger)                             //entry already found in database
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    else
                    {
                        SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName;
                        Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey));
                    }
                    break;
                }
            }
        }
 public void UpdateListEntry(ListEntryInfo ListEntry)
 {
     DataProvider.Instance().UpdateListEntry(ListEntry.EntryID, ListEntry.Value, ListEntry.Text, ListEntry.Description, UserController.GetCurrentUserInfo().UserID);
     var objEventLog = new EventLogController();
     objEventLog.AddLog(ListEntry, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_UPDATED);
     ClearCache(ListEntry.PortalID);
 }
Exemple #35
0
 public void UpdateListEntry(ListEntryInfo ListEntry)
 {
     DataProvider.Instance().UpdateListEntry(ListEntry.EntryID, ListEntry.ListName, ListEntry.Value, ListEntry.Text, ListEntry.Description);
 }
        /// <summary>
        ///     Handles cmdSaveEntry.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        ///     Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        protected void OnSaveEntryClick(object sender, EventArgs e)
        {
            String entryValue;
            String entryText;
            if (UserInfo.IsSuperUser)
            {
                entryValue = txtEntryValue.Text;
                entryText = txtEntryText.Text;
            }
            else
            {
                var ps = new PortalSecurity();

                entryValue = ps.InputFilter(txtEntryValue.Text, PortalSecurity.FilterFlag.NoScripting);
                entryText = ps.InputFilter(txtEntryText.Text, PortalSecurity.FilterFlag.NoScripting);
            }
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = ListPortalID;
                entry.ListName = txtEntryName.Text;
                entry.Value = entryValue;
                entry.Text = entryText;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                    case "update":
                        entry.ParentKey = SelectedList.ParentKey;
                        entry.EntryID = Int16.Parse(txtEntryID.Text);
                        bool canUpdate = true;
                        foreach (var curEntry in listController.GetListEntryInfoItems(SelectedList.Name, entry.ParentKey, entry.PortalID))
                        {
                            if (entry.EntryID != curEntry.EntryID) //not the same item we are trying to update
                            {
                                if (entry.Value == curEntry.Value && entry.Text == curEntry.Text)
                                {
                                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                                    canUpdate = false;
                                    break;
                                }

                            }
                        }

                        if (canUpdate)
                        {
                            listController.UpdateListEntry(entry);
                            DataBind();
                        }
                        break;
                    case "saveentry":
                        if (SelectedList != null)
                        {
                            entry.ParentKey = SelectedList.ParentKey;
                            entry.ParentID = SelectedList.ParentID;
                            entry.Level = SelectedList.Level;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }

                        if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                        }

                        DataBind();
                        break;
                    case "savelist":
                        if (ddlSelectParent.SelectedIndex != -1)
                        {
                            int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value);
                            ListEntryInfo parentEntry = listController.GetListEntryInfo(parentID);
                            entry.ParentID = parentID;
                            entry.DefinitionID = parentEntry.DefinitionID;
                            entry.Level = parentEntry.Level + 1;
                            entry.ParentKey = parentEntry.Key;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }

                        if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                        }
                        else
                        {
                            SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName;
                            Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey));
                        }
                        break;
                }
            }
        }
Exemple #37
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     Handles cmdSaveEntry.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        ///     Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        ///     [cnurse]  01/30/2007	Extracted to separte user control
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnSaveEntryClick(object sender, EventArgs e)
        {
            var ctlLists = new ListController();
            var entry    = new ListEntryInfo();

            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID     = ListPortalID;
                entry.ListName     = txtEntryName.Text;
                entry.Value        = txtEntryValue.Text;
                entry.Text         = txtEntryText.Text;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                case "update":
                    entry.ParentKey = SelectedList.ParentKey;
                    entry.EntryID   = Int16.Parse(txtEntryID.Text);

                    ctlLists.UpdateListEntry(entry);

                    DataBind();
                    break;

                case "saveentry":
                    if (SelectedList != null)
                    {
                        entry.ParentKey = SelectedList.ParentKey;
                        entry.ParentID  = SelectedList.ParentID;
                        entry.Level     = SelectedList.Level;
                    }
                    if (chkEnableSortOrder.Checked)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }
                    //save the list as system list when its edit by host user.
                    entry.SystemList = ListPortalID == Null.NullInteger;

                    ctlLists.AddListEntry(entry);

                    DataBind();
                    break;

                case "savelist":
                    if (ddlSelectParent.SelectedIndex != -1)
                    {
                        int           parentID    = Int32.Parse(ddlSelectParent.SelectedItem.Value);
                        ListEntryInfo parentEntry = ctlLists.GetListEntryInfo(parentID);
                        entry.ParentID     = parentID;
                        entry.DefinitionID = parentEntry.DefinitionID;
                        entry.Level        = parentEntry.Level + 1;
                        entry.ParentKey    = parentEntry.Key;
                    }
                    if (chkEnableSortOrder.Checked)
                    {
                        entry.SortOrder = 1;
                    }
                    else
                    {
                        entry.SortOrder = 0;
                    }
                    //save the list as system list when its edit by host user.
                    entry.SystemList = ListPortalID == Null.NullInteger;
                    ctlLists.AddListEntry(entry);

                    SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName;

                    Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey));
                    break;
                }
            }
        }
Exemple #38
0
        private static void UpgradeToVersion710()
        {
            //create a placeholder entry - uses the most common 5 character password (seed list is 6 characters and above)
            const string listName = "BannedPasswords";
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = Null.NullInteger;
                entry.ListName = listName;
                entry.Value = "12345";
                entry.Text = "Placeholder";
                entry.SystemList = false;
            }

            //add list to each portal and update primary alias
            foreach (PortalInfo portal in PortalController.Instance.GetPortals())
            {
                entry.PortalID = portal.PortalID;
                entry.SystemList = false;
                entry.ListName = listName + "-" + portal.PortalID;
                listController.AddListEntry(entry);

                var defaultAlias = PortalController.GetPortalSetting("DefaultPortalAlias", portal.PortalID, String.Empty);
                if (!String.IsNullOrEmpty(defaultAlias))
                {
                    foreach (var alias in PortalAliasController.Instance.GetPortalAliasesByPortalId(portal.PortalID).Where(alias => alias.HTTPAlias == defaultAlias))
                    {
                        alias.IsPrimary = true;
                        PortalAliasController.Instance.UpdatePortalAlias(alias);
                    }
                }
            }

            // Add File Content Type
            var typeController = new ContentTypeController();
            var contentTypeFile = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault();

            if (contentTypeFile == null)
            {
                typeController.AddContentType(new ContentType { ContentType = "File" });
            }

            var fileContentType = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault();


            //only perform following for an existing installation upgrading
            if (Globals.Status == Globals.UpgradeStatus.Upgrade)
            {
                UpdateFoldersForParentId();
                ImportDocumentLibraryCategories();
                ImportDocumentLibraryCategoryAssoc(fileContentType);
            }

            //Add 404 Log
            var logTypeInfo = new LogTypeInfo
            {
                LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                LogTypeFriendlyName = "HTTP Error Code 404 Page Not Found",
                LogTypeDescription = "",
                LogTypeCSSClass = "OperationFailure",
                LogTypeOwner = "DotNetNuke.Logging.EventLogType"
            };
            LogController.Instance.AddLogType(logTypeInfo);

            //Add LogType
            var logTypeConf = new LogTypeConfigInfo
            {
                LoggingIsActive = true,
                LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                KeepMostRecent = "100",
                NotificationThreshold = 1,
                NotificationThresholdTime = 1,
                NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                MailFromAddress = Null.NullString,
                MailToAddress = Null.NullString,
                LogTypePortalID = "*"
            };
            LogController.Instance.AddLogTypeConfigInfo(logTypeConf);

            UninstallPackage("DotNetNuke.SearchInput");

            //enable password strength meter for new installs only
            HostController.Instance.Update("EnableStrengthMeter", Globals.Status == Globals.UpgradeStatus.Install ? "Y" : "N");

            //Add IP filter log type
            var logTypeFilterInfo = new LogTypeInfo
            {
                LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(),
                LogTypeFriendlyName = "HTTP Error Code 403.6 forbidden ip address rejected",
                LogTypeDescription = "",
                LogTypeCSSClass = "OperationFailure",
                LogTypeOwner = "DotNetNuke.Logging.EventLogType"
            };
            LogController.Instance.AddLogType(logTypeFilterInfo);

            //Add LogType
            var logTypeFilterConf = new LogTypeConfigInfo
            {
                LoggingIsActive = true,
                LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(),
                KeepMostRecent = "100",
                NotificationThreshold = 1,
                NotificationThresholdTime = 1,
                NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                MailFromAddress = Null.NullString,
                MailToAddress = Null.NullString,
                LogTypePortalID = "*"
            };
            LogController.Instance.AddLogTypeConfigInfo(logTypeFilterConf);

            int tabID = TabController.GetTabByTabPath(Null.NullInteger, "//Host//SearchAdmin", Null.NullString);
            if (tabID > Null.NullInteger)
            {
                TabController.Instance.DeleteTab(tabID, Null.NullInteger);
            }

            var modDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Search Admin");

            if (modDef != null)
                AddAdminPages("Search Admin", "Manage search settings associated with DotNetNuke's search capability.", "~/Icons/Sigma/Search_16x16_Standard.png", "~/Icons/Sigma/Search_32x32_Standard.png", true, modDef.ModuleDefID, "Search Admin", "");

            CopyGettingStartedStyles();
        }
        public int AddListEntry(ListEntryInfo ListEntry)
        {
            bool EnableSortOrder = (ListEntry.SortOrder > 0);
            ClearCache(ListEntry.PortalID);
            int entryId = DataProvider.Instance().AddListEntry(ListEntry.ListName,
                                                        ListEntry.Value,
                                                        ListEntry.Text,
                                                        ListEntry.ParentID,
                                                        ListEntry.Level,
                                                        EnableSortOrder,
                                                        ListEntry.DefinitionID,
                                                        ListEntry.Description,
                                                        ListEntry.PortalID,
                                                        ListEntry.SystemList,
                                                        UserController.GetCurrentUserInfo().UserID);

            if (entryId != Null.NullInteger)
            {
                var objEventLog = new EventLogController();
                objEventLog.AddLog(ListEntry, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LISTENTRY_CREATED);
            }

            return entryId;
        }