Exemple #1
0
        public ThemeFiles Resolve(ThemeItem themeItem)
        {
            // todo: implement caching with clear on publish.

            var stylesheets = new List <ThemeInclude>();
            var scripts     = new List <ThemeScriptInclude>();

            var children = themeItem?.InnerItem.GetChildren() ?? Enumerable.Empty <Item>();

            foreach (Item item in children)
            {
                if (_templateManager.TemplateIsOrBasedOn(item, StylesheetItem.TemplateId))
                {
                    var include = CreateThemeInclude(item);
                    stylesheets.Add(include);
                }

                if (_templateManager.TemplateIsOrBasedOn(item, ScriptItem.TemplateId))
                {
                    var include = CreateThemeScriptInclude(item);
                    scripts.Add(include);
                }
            }

            return(new ThemeFiles(stylesheets, scripts));
        }
Exemple #2
0
        private void IncrementFrequency(ThemeItem theme, XElement entity)
        {
            string     str  = entity.Attribute(BlockAttribute.ROLE);
            EntityRole role = EntityRole.Other;

            if (!str.IsEmpty())
            {
                role = (EntityRole)Enum.Parse(typeof(EntityRole), str);
            }
            switch (role)
            {
            case EntityRole.Adj:
                ++theme.FreqAdj;
                break;

            case EntityRole.Obj:
                ++theme.FreqObj;
                break;

            case EntityRole.Other:
                ++theme.FreqOther;
                break;

            case EntityRole.Subj:
                ++theme.FreqSubj;
                ++_SubjectCount;
                break;
            }
        }
        List <ThemeItem> GetThemes()
        {
            var themes    = new List <ThemeItem>();
            var themeList = _store.GetThemes();

            if (themeList != null && themeList.Count > 0)
            {
                var current = new ThemeItem();
                foreach (var themeTitle in themeList)
                {
                    var theme = themeTitle.ToLower();
                    var file  = Path.Join(AppSettings.WebRootPath, "themes", theme, Constants.ThemeScreenshot);
                    var data  = Path.Join(AppSettings.WebRootPath, "themes", theme, "assets", Constants.ThemeDataFile);
                    var item  = new ThemeItem
                    {
                        Title       = themeTitle,
                        Cover       = System.IO.File.Exists(file) ? $"themes/{theme}/{Constants.ThemeScreenshot}" : Constants.ImagePlaceholder,
                        IsCurrent   = theme == _blog.Theme.ToLower(),
                        HasSettings = System.IO.File.Exists(data)
                    };

                    if (theme == _blog.Theme.ToLower())
                    {
                        current = item;
                    }
                    else
                    {
                        themes.Add(item);
                    }
                }
                themes.Insert(0, current);
            }

            return(themes);
        }
Exemple #4
0
        public void LoadThemeResources()
        {
            IsBusy = true;

            var blueResources = new BlueResources();

            foreach (var key in blueResources.Keys)
            {
                IsBusyMessage = $"reading {key}...";

                try
                {
                    var item = new ThemeItem
                    {
                        ThemeKey           = key,
                        Title              = ParsingHelpers.BreakCaseNamedWord(key),
                        ControlName        = ParsingHelpers.GetControlName(key),
                        OriginalThemeColor = (Color)blueResources[key],
                        SelectedThemeColor = (Color)blueResources[key]
                    };

                    ThemeColors.Add(item);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine($"Exception reading value for: {key}. \n{ex}");
                }
            }

            IsBusyMessage = "";
            IsBusy        = false;
        }
Exemple #5
0
    private void CalculateTheme(float curveValue, ThemeItem item)
    {
        if (curveValue > item.Difficult)
        {
            item.Difficult = curveValue;
        }
        item.Interest = curveValue;
        int currentcompetition;



        int showperday = Mathf.RoundToInt(item.Competitionratio * curveValue);

        item.Views = showperday;
        if (curveValue > 0)
        {
            currentcompetition = Mathf.RoundToInt(item.Competitionratio / curveValue);
            if (currentcompetition < 0)
            {
                currentcompetition = 0;
            }
            item.Competition = currentcompetition;
        }
        item.DayViews = showperday;

        Debug.Log("showperday " + showperday + " competitonratio " + item.Competitionratio + " competiton " + item.Competition + " Views" + item.Views);
    }
Exemple #6
0
        public async Task Load()
        {
            var blogSettings = await DataService.CustomFields.GetBlogSettings();

            ThemeItems = new List <ThemeItem>();
            foreach (var theme in StorageService.GetThemes())
            {
                if (theme.ToLower() == blogSettings.Theme.ToLower())
                {
                    CurrentTheme = new ThemeItem
                    {
                        Title     = theme.Capitalize(),
                        IsCurrent = (blogSettings.Theme.ToLower() == theme.ToLower()),
                        Cover     = GetCover(theme)
                    };
                }
                else
                {
                    ThemeItems.Add(new ThemeItem
                    {
                        Title     = theme.Capitalize(),
                        IsCurrent = (blogSettings.Theme.ToLower() == theme.ToLower()),
                        Cover     = GetCover(theme)
                    });
                }
            }

            StateHasChanged();
        }
Exemple #7
0
 protected virtual void AddIncludeToOutput(HtmlTextWriter output, ThemeItem themeItem)
 {
     output.AddAttribute(HtmlTextWriterAttribute.Href, themeItem.FileLocation.Raw.Trim());
     output.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
     output.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
     output.RenderBeginTag(HtmlTextWriterTag.Link);
     output.RenderEndTag();
 }
Exemple #8
0
        public override void Initialize(Rendering rendering)
        {
            base.Initialize(rendering);
            var currentBlog = ManagerFactory.BlogManagerInstance.GetCurrentBlog();

            BlogItem  = currentBlog;
            Hyperlink = currentBlog.SafeGet(x => x.Url);
            Theme     = currentBlog.Theme.Item;
        }
        /// <summary>
        /// 数据访问通过条件查询并分页排序
        /// </summary>
        /// <param name="WhereString">查询条件</param>
        /// <param name="PageIndex">当前页码</param>
        /// <param name="PageSize">页大小(每页显示多少条数据)</param>
        /// <param name="OrderString">排序条件(排序条件为必须参数)</param>
        /// <returns>ThemeItem实体类对象</returns>
        public List <ThemeItem> SelectByWhereAndPage(string WhereString, int PageIndex, int PageSize, string OrderString, out int TotalCount)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@where", WhereString),
                new SqlParameter("@pageIndex", PageIndex),
                new SqlParameter("@pageSize", PageSize),
                new SqlParameter("@orderString", OrderString),
                new SqlParameter("@TotalCount", ParameterDirection.Output)
            };
            List <ThemeItem> list  = new List <ThemeItem>();
            ThemeItem        model = null;

            using (SqlDataReader dr = DBHelper.RunProcedure("ThemeItem_SelectByWhereAndPage", param))
            {
                while (dr.Read())
                {
                    model             = new ThemeItem();
                    model.ThemeItemId = Convert.ToInt32(dr["ThemeItemId"]);
                    if (DBNull.Value != dr["ThemeBaseItemId"])
                    {
                        model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]);
                    }
                    if (DBNull.Value != dr["ThemeItemName"])
                    {
                        model.ThemeItemName = dr["ThemeItemName"].ToString();
                    }
                    if (DBNull.Value != dr["ThemeId"])
                    {
                        model.ThemeId = Convert.ToInt32(dr["ThemeId"]);
                    }
                    if (DBNull.Value != dr["OrderIndex"])
                    {
                        model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]);
                    }
                    if (DBNull.Value != dr["IsDelete"])
                    {
                        model.IsDelete = Convert.ToBoolean(dr["IsDelete"]);
                    }
                    if (DBNull.Value != dr["ItemFlag"])
                    {
                        model.ItemFlag = dr["ItemFlag"].ToString();
                    }
                    list.Add(model);
                }
                if (dr.NextResult() && dr.Read())
                {
                    TotalCount = Convert.ToInt32(dr["TotalCount"]);
                }
                else
                {
                    TotalCount = 0;
                }
            }
            return(list);
        }
Exemple #10
0
        public override void Initialize(Rendering rendering)
        {
            base.Initialize(rendering);
            var currentBlog = BlogManager.GetCurrentBlog();

            BlogItem = currentBlog;

            Hyperlink = LinkManager.GetItemUrl(currentBlog);
            Theme     = currentBlog.Theme.Item;
        }
Exemple #11
0
        private ThemeItem FindTheme(XElement entity)
        {
            ThemeItem finded = null;

            if (entity != null)
            {
                _Themes.TryGetValue(GetValue(entity), out finded);
            }
            return(finded);
        }
Exemple #12
0
        private LinkItem AddLinkToSenteceRepository(XElement first, XElement second, string type)
        {
            LinkItem  finded      = null;
            ThemeItem firstTheme  = FindTheme(first);
            ThemeItem secondTheme = FindTheme(second);

            if ((firstTheme == null) || (secondTheme == null))
            {
                return(null);
            }

            string role1 = first.Attribute(BlockAttribute.ROLE);
            string role2 = second.Attribute(BlockAttribute.ROLE);
            int    id1   = firstTheme.ID;
            int    id2   = secondTheme.ID;

            if ((id1 == id2) || (role1.IsEqual(EntityRole.Other) && (role1 == role2)))
            {
                return(null);
            }

            if (first.Name.IsEqual(UnitTextType.VERB) || second.Name.IsEqual(UnitTextType.VERB))
            {
                return(null);
            }

            if (role1.IsEqual(EntityRole.Other) || role2.IsEqual(EntityRole.Other))
            {
                type = string.Empty;
            }
            bool     direction = type.IsEmpty();
            LinkItem link      = new LinkItem();

            link.SourceThemeID = id1;
            link.DestThemeID   = id2;
            link.Freq          = 0;
            link.Type          = type.Trim().ToUpper();

            string linkCode = string.Format("{0}_{1}_{2}", id1, id2, type);

            if (!_Links.TryGetValue(linkCode, out finded) && !direction)
            /// связь не найдена - при отсутствии направления поменяем местами темы
            {
                linkCode = string.Format("{0}_{1}_{2}", id2, id1, type);
                _Links.TryGetValue(linkCode, out finded);
            }
            if (finded == null)
            {
                _Links.Add(linkCode, link);
                finded = link;
            }
            ++finded.Freq;
            return(finded);
        }
Exemple #13
0
        protected override void DoRender(HtmlTextWriter output)
        {
            var blog = ManagerFactory.BlogManagerInstance.GetCurrentBlog();

            if (blog != null && !string.IsNullOrEmpty(blog.Theme.Raw))
            {
                var themeItem    = blog.Theme.Item;
                var currentTheme = new ThemeItem(themeItem);
                AddIncludeToOutput(output, currentTheme);
            }
        }
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="ThemeItem">ThemeItem实体对象</param>
 /// <returns>bool值,判断是否操作成功</returns>
 public bool Add(ThemeItem model)
 {
     SqlParameter[] param = new SqlParameter[]
     {
         new SqlParameter("@ThemeBaseItemId", model.ThemeBaseItemId),
         new SqlParameter("@ThemeItemName", model.ThemeItemName),
         new SqlParameter("@ThemeId", model.ThemeId),
         new SqlParameter("@OrderIndex", model.OrderIndex),
         new SqlParameter("@IsDelete", model.IsDelete),
         new SqlParameter("@ItemFlag", model.ItemFlag)
     };
     return(DBHelper.ExecuteNonQuery("ThemeItem_Add", param));
 }
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="ThemeItem">ThemeItem实体对象</param>
 /// <returns>int值,返回自增ID</returns>
 public int AddReturnId(ThemeItem model)
 {
     SqlParameter[] param = new SqlParameter[]
     {
         new SqlParameter("@ThemeBaseItemId", model.ThemeBaseItemId),
         new SqlParameter("@ThemeItemName", model.ThemeItemName),
         new SqlParameter("@ThemeId", model.ThemeId),
         new SqlParameter("@OrderIndex", model.OrderIndex),
         new SqlParameter("@IsDelete", model.IsDelete),
         new SqlParameter("@ItemFlag", model.ItemFlag)
     };
     return(Convert.ToInt32(DBHelper.ExecuteScalar("ThemeItem_AddReturnId", param)));
 }
Exemple #16
0
    public void Present(ThemeItem item)
    {
        Icon.sprite   = item.Icon;
        text.text     = item.Name;
        _currenttheme = item;
        Views.text    = item.Views.ToString() + " Запросов • " + item.Daylife + " • дней назад • " + item.Competition + " • видео по теме ";



        var interestcolorsbutton = _globusindicator.gameObject.GetComponent <RawImage>().color;

        interestcolorsbutton = Color.Lerp(Color.red, Color.green, item.Interest / (PlayerPrefs._playerPref.lvl * 10));
        _globusindicator.gameObject.GetComponent <RawImage>().color = interestcolorsbutton;
    }
Exemple #17
0
 private float GenerateCurve(int day, ThemeItem item)
 {
     a  = 1.0f;
     a -= 0.025f * day;
     b  = 1.0f - a;
     X += 1;
     Y  = ay * a * a * a + by * 3 * a * a * b + cy * 3 * a * b * b + dy * b * b * b;
     //изменяем длительность контента
     if (X > dx)
     {
         dx = X;
     }
     return(Y);
 }
Exemple #18
0
    public void CreateVideo(float damage)
    {
        currenttheme = PlayerPrefs._playerPref.currenttheme;
        Video currentvideo = new Video();

        currentvideo.Views = currenttheme.Views;
        currentvideo.Name  = CreateVideoMain.GetDataFromThemeST.CurrentVideoName;
        currentvideo.Icon  = CreateVideoMain.GetDataFromThemeST.CurrentVideoImage;
        GameObject videoObj = Instantiate(VideoPrefab, transform);

        videoList.Add(currentvideo);

        videoObj.GetComponent <VideoModel>().Model(currentvideo, currenttheme, damage);
        videoObj.GetComponent <VideoPresenter>().Present(currentvideo);
        videoObjList.Add(videoObj);
        currenttheme = null;
        TimeManager.ToPause(false);
    }
        /// <summary>
        /// 通过条件查询
        /// </summary>
        /// <param name="WhereString">查询条件</param>
        /// <returns>ThemeItem实体类对象</returns>
        public List <ThemeItem> SelectByWhere(string WhereString)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@where", WhereString)
            };
            List <ThemeItem> list  = new List <ThemeItem>();
            ThemeItem        model = null;

            using (SqlDataReader dr = DBHelper.RunProcedure("ThemeItem_SelectByWhere", param))
            {
                while (dr.Read())
                {
                    model             = new ThemeItem();
                    model.ThemeItemId = Convert.ToInt32(dr["ThemeItemId"]);
                    if (DBNull.Value != dr["ThemeBaseItemId"])
                    {
                        model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]);
                    }
                    if (DBNull.Value != dr["ThemeItemName"])
                    {
                        model.ThemeItemName = dr["ThemeItemName"].ToString();
                    }
                    if (DBNull.Value != dr["ThemeId"])
                    {
                        model.ThemeId = Convert.ToInt32(dr["ThemeId"]);
                    }
                    if (DBNull.Value != dr["OrderIndex"])
                    {
                        model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]);
                    }
                    if (DBNull.Value != dr["IsDelete"])
                    {
                        model.IsDelete = Convert.ToBoolean(dr["IsDelete"]);
                    }
                    if (DBNull.Value != dr["ItemFlag"])
                    {
                        model.ItemFlag = dr["ItemFlag"].ToString();
                    }
                    list.Add(model);
                }
            }
            return(list);
        }
Exemple #20
0
    public void GenerateStats(ThemeItem item, int day)
    {
        float maxdifficult = PlayerPrefs._playerPref.lvl * 9;// - Mathf.Log(item.Views / PlayerPrefs._playerPref.followers); //9 - count of cards on board * count of turns

        Debug.Log("maxdiff: " + item.Views / PlayerPrefs._playerPref.followers + " itemviews " + item.Views);
        if (maxdifficult < 0)
        {
            maxdifficult = 1f;
        }
        ax = 0; ay = Random.Range(0.5f * maxdifficult, 1.5f * maxdifficult);
        bx = Random.Range(0, 5); by = maxdifficult;
        cx = Random.Range(5, 50) + bx; cy = Random.Range(0.5f * maxdifficult, 1.5f * maxdifficult);
        dx = Random.Range(5, 300) + cx + bx; dy = 0.0f;

        float curveValue = GenerateCurve(day, item);

        Debug.Log("maxdiff: " + maxdifficult + " curveValue: " + curveValue);
        item.Maxdifficult = maxdifficult;
        CalculateTheme(curveValue, item);
    }
        /// <summary>
        /// 通过Id查询
        /// </summary>
        /// <param name="Id">主键Id</param>
        /// <returns>ThemeItem实体类对象</returns>
        public ThemeItem SelectById(int Id)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@ThemeItemId", Id)
            };
            ThemeItem model = new ThemeItem();

            using (SqlDataReader dr = DBHelper.RunProcedure("ThemeItem_SelectById", param))
            {
                if (dr.Read())
                {
                    model.ThemeItemId = Convert.ToInt32(dr["ThemeItemId"]);
                    if (DBNull.Value != dr["ThemeBaseItemId"])
                    {
                        model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]);
                    }
                    if (DBNull.Value != dr["ThemeItemName"])
                    {
                        model.ThemeItemName = dr["ThemeItemName"].ToString();
                    }
                    if (DBNull.Value != dr["ThemeId"])
                    {
                        model.ThemeId = Convert.ToInt32(dr["ThemeId"]);
                    }
                    if (DBNull.Value != dr["OrderIndex"])
                    {
                        model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]);
                    }
                    if (DBNull.Value != dr["IsDelete"])
                    {
                        model.IsDelete = Convert.ToBoolean(dr["IsDelete"]);
                    }
                    if (DBNull.Value != dr["ItemFlag"])
                    {
                        model.ItemFlag = dr["ItemFlag"].ToString();
                    }
                }
            }
            return(model);
        }
        /// <summary>
        /// 查看全部
        /// </summary>
        /// <returns>list集合</returns>
        public List <ThemeItem> SelectAll()
        {
            List <ThemeItem> list  = new List <ThemeItem>();
            ThemeItem        model = null;

            using (SqlDataReader dr = DBHelper.RunProcedure("ThemeItem_SelectAll", null))
            {
                while (dr.Read())
                {
                    model             = new ThemeItem();
                    model.ThemeItemId = Convert.ToInt32(dr["ThemeItemId"]);
                    if (DBNull.Value != dr["ThemeBaseItemId"])
                    {
                        model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]);
                    }
                    if (DBNull.Value != dr["ThemeItemName"])
                    {
                        model.ThemeItemName = dr["ThemeItemName"].ToString();
                    }
                    if (DBNull.Value != dr["ThemeId"])
                    {
                        model.ThemeId = Convert.ToInt32(dr["ThemeId"]);
                    }
                    if (DBNull.Value != dr["OrderIndex"])
                    {
                        model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]);
                    }
                    if (DBNull.Value != dr["IsDelete"])
                    {
                        model.IsDelete = Convert.ToBoolean(dr["IsDelete"]);
                    }
                    if (DBNull.Value != dr["ItemFlag"])
                    {
                        model.ItemFlag = dr["ItemFlag"].ToString();
                    }
                    list.Add(model);
                }
            }
            return(list);
        }
Exemple #23
0
        /// <summary>
        /// добавление сущности в хранилище
        /// </summary>
        /// <param name="entity"></param>
        private void AddEntityToSentenceRepository(XElement entity)
        {
            if (!IsTheme(entity))
            {
                return;
            }

            ThemeItem theme = FindTheme(entity);

            if (theme == null)
            {
                ThemeItem newTheme = new ThemeItem();
                newTheme.ID           = _ThemeId;
                newTheme.Type         = entity.Attribute(BlockAttribute.TYPE);
                newTheme.Name         = GetThemeName(entity, GetMasterName(entity));
                newTheme.OriginalName = GetOriginalName(entity);
                ++_ThemeId;
                newTheme.FreqSubj  = 0;
                newTheme.FreqObj   = 0;
                newTheme.FreqAdj   = 0;
                newTheme.FreqOther = 0;
                _Themes.Add(GetValue(entity), newTheme);
                theme = newTheme;
            }
            IncrementFrequency(theme, entity);

            string id = entity.Attribute(BlockAttribute.ID);

            entity = new XElement(entity);
            if (!_Entities.ContainsKey(id))
            {
                _Entities.Add(id, entity);
            }
            entity.SetID(theme.ID.ToString());
            _SentenceEntities.Add(entity);

            /// добавим подтемы с правым отсечением
            AddLeftSubThemesToSentenceRepository(entity, id);
        }
Exemple #24
0
 public void Model(Video item, ThemeItem currenttheme, float damage)
 {
     _currentdamage = damage;
     _currentvideo  = item;
     _currenttheme  = currenttheme;
 }
Exemple #25
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="ThemeItem">ThemeItem实体对象</param>
 /// <returns>bool值,判断是否操作成功</returns>
 public bool Change(ThemeItem model)
 {
     return(dal.Change(model));
 }
Exemple #26
0
        public override void Initialize(Rendering rendering)
        {
            base.Initialize(rendering);

            ThemeItem = CurrentBlog.Theme.Item;
        }
 public EditPage(ThemeItem item)
 {
     InitializeComponent();
     BindingContext = item;
 }
        /// <summary>
        ///   Initializes a new instance of the <see cref = "PortalModuleControl" /> class.
        /// </summary>
        public PortalModuleControl()
        {
            this.BaseSettings = new Dictionary<string, ISettingItem>();
            this.ButtonListAdmin = new List<Control>(3);
            this.ButtonListCustom = new List<Control>(3);
            this.ButtonListUser = new List<Control>(3);
            this.ApproveText = "SWI_APPROVE";
            this.ProductionVersionText = "SWI_SWAPTOPRODUCTION";
            this.PublishText = "SWI_PUBLISH";
            this.ReadyToApproveText = "SWI_READYTOAPPROVE";
            this.RejectText = "SWI_REJECT";
            this.RevertText = "SWI_REVERT";
            this.StagingVersionText = "SWI_SWAPTOSTAGING";
            this.SupportsPrint = true;
            this.Cacheable = true;

            // MVC
            var wrapper = new HttpContextWrapper(this.Context);

            var viewContext = new ViewContext { HttpContext = wrapper, ViewData = new ViewDataDictionary() };

            this.ViewContext = viewContext;

            // THEME MANAGEMENT
            var group = SettingItemGroup.THEME_LAYOUT_SETTINGS;
            var groupOrderBase = (int)SettingItemGroup.THEME_LAYOUT_SETTINGS;

            var applyTheme = new SettingItem<bool, CheckBox>
                {
                    Order = groupOrderBase + 10,
                    Group = group,
                    Value = true,
                    EnglishName = "Apply Theme",
                    Description = "Check this box to apply theme to this module"
                };
            this.BaseSettings.Add("MODULESETTINGS_APPLY_THEME", applyTheme);

            var themeOptions = new List<SettingOption>
                {
                    new SettingOption((int)ThemeList.Default, General.GetString("MODULESETTINGS_THEME_DEFAULT")),
                    new SettingOption((int)ThemeList.Alt, General.GetString("MODULESETTINGS_THEME_ALT"))
                };
            var theme = new SettingItem<string, ListControl>(new CustomListDataType(themeOptions, "Name", "Val"))
                {
                    Order = groupOrderBase + 20,
                    Group = group,
                    Value = ((int)ThemeList.Default).ToString(),
                    EnglishName = "Theme",
                    Description = "Choose theme for this module"
                };
            this.BaseSettings.Add("MODULESETTINGS_THEME", theme);

            if (HttpContext.Current != null)
            {
                // null in DesignMode
                // Added: Jes1111 - 2004-08-03
                var PortalSettings1 = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

                // end addition: Jes1111
                if (PortalSettings1 != null)
                {
                    // fix by The Bitland Prince
                    this.PortalID = PortalSettings1.PortalID;

                    // added: Jes1111 2004-08-02 - custom module theme
                    if (PortalSettings1.CustomSettings.ContainsKey("SITESETTINGS_ALLOW_MODULE_CUSTOM_THEMES") &&
                        PortalSettings1.CustomSettings["SITESETTINGS_ALLOW_MODULE_CUSTOM_THEMES"].ToString().Length != 0 &&
                        bool.Parse(PortalSettings1.CustomSettings["SITESETTINGS_ALLOW_MODULE_CUSTOM_THEMES"].ToString()))
                    {
                        var tempList = new List<object>(new ThemeManager(PortalSettings1.PortalPath).GetThemes());
                        var themeList =
                            tempList.Cast<ThemeItem>().Where(item => item.Name.ToLower().StartsWith("module")).ToList();

                        var customThemeNo = new ThemeItem { Name = string.Empty };
                        themeList.Insert(0, customThemeNo);
                        var moduleTheme =
                            new SettingItem<string, ListControl>(new CustomListDataType(themeList, "Name", "Name"))
                                {
                                    Order = groupOrderBase + 25,
                                    Group = group,
                                    EnglishName = "Custom Theme",
                                    Description = "Set a custom theme for this module only"
                                };
                        this.BaseSettings.Add("MODULESETTINGS_MODULE_THEME", moduleTheme);
                    }
                }
            }

            // switches title display on/off
            var showTitle = new SettingItem<bool, CheckBox>
                {
                    Order = groupOrderBase + 30,
                    Group = group,
                    Value = true,
                    EnglishName = "Show Title",
                    Description = "Switches title display on/off"
                };
            this.BaseSettings.Add("MODULESETTINGS_SHOW_TITLE", showTitle);

            // switches last modified summary on/off
            var showModifiedBy = new SettingItem<bool, CheckBox>
                {
                    Order = groupOrderBase + 40,
                    Group = group,
                    Value = false,
                    EnglishName = "Show Modified by",
                    Description = "Switches 'Show Modified by' display on/off"
                };
            this.BaseSettings.Add("MODULESETTINGS_SHOW_MODIFIED_BY", showModifiedBy);

            // gman3001: added 10/26/2004
            // - implement width, height, and content scrolling options for all modules
            // - implement auto-stretch option
            // Windows height
            var controlHeight = new SettingItem<int, TextBox>
                {
                    Value = 0,
                    MinValue = 0,
                    MaxValue = 3000,
                    Required = true,
                    Order = groupOrderBase + 50,
                    Group = group,
                    EnglishName = "Content Height",
                    Description = "Minimum height(in pixels) of the content area of this module. (0 for none)"
                };
            this.BaseSettings.Add("MODULESETTINGS_CONTENT_HEIGHT", controlHeight);

            // Windows width
            var controlWidth = new SettingItem<int, TextBox>
                {
                    Value = 0,
                    MinValue = 0,
                    MaxValue = 3000,
                    Required = true,
                    Order = groupOrderBase + 60,
                    Group = group,
                    EnglishName = "Content Width",
                    Description = "Minimum width(in pixels) of the content area of this module. (0 for none)"
                };
            this.BaseSettings.Add("MODULESETTINGS_CONTENT_WIDTH", controlWidth);

            // Content scrolling option
            var scrollingSetting = new SettingItem<bool, CheckBox>
                {
                    Value = false,
                    Order = groupOrderBase + 70,
                    Group = group,
                    EnglishName = "Content Scrolling",
                    Description = "Set to enable/disable scrolling of Content based on height and width settings."
                };
            this.BaseSettings.Add("MODULESETTINGS_CONTENT_SCROLLING", scrollingSetting);

            // Module Stretching option
            var stretchSetting = new SettingItem<bool, CheckBox>
                {
                    Value = true,
                    Order = groupOrderBase + 80,
                    Group = group,
                    EnglishName = "Module Auto Stretch",
                    Description =
                        "Set to enable/disable automatic stretching of the module's width to fill the empty area to the right of the module."
                };
            this.BaseSettings.Add("MODULESETTINGS_WIDTH_STRETCHING", stretchSetting);

            // gman3001: END

            // BUTTONS
            group = SettingItemGroup.BUTTON_DISPLAY_SETTINGS;
            groupOrderBase = (int)SettingItemGroup.BUTTON_DISPLAY_SETTINGS;

            // Show print button in view mode?
            var printButton1 = new SettingItem<bool, CheckBox>
                {
                    Value = false,
                    Order = groupOrderBase + 20,
                    Group = group,
                    EnglishName = "Show Print Button",
                    Description = "Show print button in view mode?"
                };
            this.BaseSettings.Add("MODULESETTINGS_SHOW_PRINT_BUTTION", printButton1);

            // added: Jes1111 2004-08-29 - choice! Default is 'true' for backward compatibility
            // Show Title for print?
            var showTitlePrint = new SettingItem<bool, CheckBox>
                {
                    Value = true,
                    Order = groupOrderBase + 25,
                    Group = group,
                    EnglishName = "Show Title for Print",
                    Description = "Show Title for this module in print popup?"
                };
            this.BaseSettings.Add("MODULESETTINGS_SHOW_TITLE_PRINT", showTitlePrint);

            // added: Jes1111 2004-08-02 - choices for Button display on module
            var buttonDisplayOptions = new List<SettingOption>
                {
                    new SettingOption(
                        (int)ModuleButton.RenderOptions.ImageOnly,
                        General.GetString("MODULESETTINGS_BUTTON_DISPLAY_IMAGE")),
                    new SettingOption(
                        (int)ModuleButton.RenderOptions.TextOnly,
                        General.GetString("MODULESETTINGS_BUTTON_DISPLAY_TEXT")),
                    new SettingOption(
                        (int)ModuleButton.RenderOptions.ImageAndTextCSS,
                        General.GetString("MODULESETTINGS_BUTTON_DISPLAY_BOTH")),
                    new SettingOption(
                        (int)ModuleButton.RenderOptions.ImageOnlyCSS,
                        General.GetString("MODULESETTINGS_BUTTON_DISPLAY_IMAGECSS"))
                };
            var buttonDisplay =
                new SettingItem<string, ListControl>(new CustomListDataType(buttonDisplayOptions, "Name", "Val"))
                    {
                        Order = groupOrderBase + 30,
                        Group = group,
                        Value = ((int)ModuleButton.RenderOptions.ImageOnly).ToString(),
                        EnglishName = "Display Buttons as:",
                        Description =
                            "Choose how you want module buttons to be displayed. Note that settings other than 'Image only' may require Zen or special treatment in the Theme."
                    };
            this.BaseSettings.Add("MODULESETTINGS_BUTTON_DISPLAY", buttonDisplay);

            // Jes1111 - not implemented yet
            // // Show email button in view mode?
            // SettingItem EmailButton = new SettingItem<bool, CheckBox>();
            // EmailButton.Value = "False";
            // EmailButton.Order = _groupOrderBase + 30;
            // EmailButton.Group = _Group;
            // this.BaseSettings.Add("ShowEmailButton",EmailButton);

            // Show arrows buttons to move modules (admin only, property authorize)
            var arrowButtons = new SettingItem<bool, CheckBox>
                {
                    Value = true,
                    Order = groupOrderBase + 40,
                    Group = group,
                    EnglishName = "Show Arrow Admin Buttons",
                    Description = "Show Arrow Admin buttons?"
                };
            this.BaseSettings.Add("MODULESETTINGS_SHOW_ARROW_BUTTONS", arrowButtons);

            // Show help button if exists
            var helpButton1 = new SettingItem<bool, CheckBox>
                {
                    Value = true,
                    Order = groupOrderBase + 50,
                    Group = group,
                    EnglishName = "Show Help Button",
                    Description = "Show help button in title if exists documentation for this module"
                };
            this.BaseSettings.Add("MODULESETTINGS_SHOW_HELP_BUTTON", helpButton1);

            // LANGUAGE/CULTURE MANAGEMENT
            groupOrderBase = (int)SettingItemGroup.CULTURE_SETTINGS;
            group = SettingItemGroup.CULTURE_SETTINGS;

            var cultureList = Localization.LanguageSwitcher.GetLanguageList(true);

            var culture =
                new SettingItem<string, ListControl>(new MultiSelectListDataType(cultureList, "DisplayName", "Name"))
                    {
                        Value = string.Empty,
                        Order = groupOrderBase + 10,
                        Group = group,
                        EnglishName = "Culture",
                        Description =
                            "Please choose the culture. Invariant cultures shows always the module, if you choose one or more cultures only when culture is selected this module will shown."
                    };
            this.BaseSettings.Add("MODULESETTINGS_CULTURE", culture);

            // Localized module title
            var counter = groupOrderBase + 11;

            // Ignore invariant
            foreach (var c in
                cultureList.Where(c => c != CultureInfo.InvariantCulture && !this.BaseSettings.ContainsKey(c.Name)))
            {
                var localizedTitle = new SettingItem<string, TextBox>
                    {
                        Order = counter,
                        Group = group,
                        EnglishName = string.Format("Title ({0})", c.Name),
                        Description = string.Format("Set title for {0} culture.", c.EnglishName)
                    };
                this.BaseSettings.Add(string.Format("MODULESETTINGS_TITLE_{0}", c.Name), localizedTitle);
                counter++;
            }

            // SEARCH
            if (this.Searchable)
            {
                groupOrderBase = (int)SettingItemGroup.MODULE_SPECIAL_SETTINGS;
                group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;

                var topicName = new SettingItem<string, TextBox>
                    {
                        Required = false,
                        Value = string.Empty,
                        // modified by Hongwei Shen([email protected]) 11/9/2005
                        // group base and order is not specified
                        Group = group,
                        Order = groupOrderBase,
                        EnglishName = "Topic",
                        Description = "Select a topic for this module. You may filter items by topic in Portal Search."
                    };

                // end of modification
                this.BaseSettings.Add("TopicName", topicName);
            }

            // Default configuration
            this.pageId = 0;

            this.moduleConfiguration = new ModuleSettings();

            var share = new SettingItem<bool, CheckBox>
                {
                    Value = false,
                    Order = groupOrderBase + 51,
                    Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS,
                    EnglishName = "ShareModule",
                    Description = "Share Module"
                };
            this.BaseSettings.Add("SHARE_MODULE", share);
        }
Exemple #29
0
        /// <summary>
        /// Changed by [email protected]
        /// Page are different for custom page layout an theme, this cannot be static
        /// Added by [email protected]
        /// Cache by Manu
        /// non static function, Thierry : this is necessary for page custom layout and themes
        /// </summary>
        /// <returns>A System.Collections.Hashtable value...</returns>
        private Hashtable GetPageBaseSettings()
        {
            //Define base settings
            Hashtable        _baseSettings = new Hashtable();
            int              _groupOrderBase;
            SettingItemGroup _Group;

            #region Navigation Settings

            // 2_aug_2004 Cory Isakson
            _groupOrderBase = (int)SettingItemGroup.NAVIGATION_SETTINGS;
            _Group          = SettingItemGroup.NAVIGATION_SETTINGS;

            SettingItem TabPlaceholder = new SettingItem(new BooleanDataType());
            TabPlaceholder.Group       = _Group;
            TabPlaceholder.Order       = _groupOrderBase;
            TabPlaceholder.Value       = "False";
            TabPlaceholder.EnglishName = "Act as a Placeholder?";
            TabPlaceholder.Description = "Allows this tab to act as a navigation placeholder only.";
            _baseSettings.Add("TabPlaceholder", TabPlaceholder);

            SettingItem TabLink = new SettingItem(new StringDataType());
            TabLink.Group       = _Group;
            TabLink.Value       = string.Empty;
            TabLink.Order       = _groupOrderBase + 1;
            TabLink.EnglishName = "Static Link URL";
            TabLink.Description = "Allows this tab to act as a navigation link to any URL.";
            _baseSettings.Add("TabLink", TabLink);

            SettingItem TabUrlKeyword = new SettingItem(new StringDataType());
            TabUrlKeyword.Group       = _Group;
            TabUrlKeyword.Order       = _groupOrderBase + 2;
            TabUrlKeyword.EnglishName = "Url Keyword";
            TabUrlKeyword.Description = "Allows you to specify a keyword that would appear in your url.";
            _baseSettings.Add("TabUrlKeyword", TabUrlKeyword);

            SettingItem UrlPageName = new SettingItem(new StringDataType());
            UrlPageName.Group       = _Group;
            UrlPageName.Order       = _groupOrderBase + 3;
            UrlPageName.EnglishName = "Url Page Name";
            UrlPageName.Description = "This setting allows you to specify a name for this tab that will show up in the url instead of default.aspx";
            _baseSettings.Add("UrlPageName", UrlPageName);

            #endregion

            #region Metadata Management

            _groupOrderBase = (int)SettingItemGroup.META_SETTINGS;
            _Group          = SettingItemGroup.META_SETTINGS;
            SettingItem TabTitle = new SettingItem(new StringDataType());
            TabTitle.Group       = _Group;
            TabTitle.EnglishName = "Tab / Page Title";
            TabTitle.Description = "Allows you to enter a title (Shows at the top of your browser) for this specific Tab / Page. Enter something here to override the default portal wide setting.";
            _baseSettings.Add("TabTitle", TabTitle);

            SettingItem TabMetaKeyWords = new SettingItem(new StringDataType());
            TabMetaKeyWords.Group       = _Group;
            TabMetaKeyWords.EnglishName = "Tab / Page Keywords";
            TabMetaKeyWords.Description = "This setting is to help with search engine optimisation. Enter 1-15 Default Keywords that represent what this Tab / Page is about.Enter something here to override the default portal wide setting.";
            _baseSettings.Add("TabMetaKeyWords", TabMetaKeyWords);
            SettingItem TabMetaDescription = new SettingItem(new StringDataType());
            TabMetaDescription.Group       = _Group;
            TabMetaDescription.EnglishName = "Tab / Page Description";
            TabMetaDescription.Description = "This setting is to help with search engine optimisation. Enter a description (Not too long though. 1 paragraph is enough) that describes this particular Tab / Page. Enter something here to override the default portal wide setting.";
            _baseSettings.Add("TabMetaDescription", TabMetaDescription);
            SettingItem TabMetaEncoding = new SettingItem(new StringDataType());
            TabMetaEncoding.Group       = _Group;
            TabMetaEncoding.EnglishName = "Tab / Page Encoding";
            TabMetaEncoding.Description = "Every time your browser returns a page it looks to see what format it is retrieving. This allows you to specify the content type for this particular Tab / Page. Enter something here to override the default portal wide setting.";
            _baseSettings.Add("TabMetaEncoding", TabMetaEncoding);
            SettingItem TabMetaOther = new SettingItem(new StringDataType());
            TabMetaOther.Group       = _Group;
            TabMetaOther.EnglishName = "Additional Meta Tag Entries";
            TabMetaOther.Description = "This setting allows you to enter new tags into this Tab / Page's HEAD Tag. Enter something here to override the default portal wide setting.";
            _baseSettings.Add("TabMetaOther", TabMetaOther);
            SettingItem TabKeyPhrase = new SettingItem(new StringDataType());
            TabKeyPhrase.Group       = _Group;
            TabKeyPhrase.EnglishName = "Tab / Page Keyphrase";
            TabKeyPhrase.Description = "This setting can be used by a module or by a control. It allows you to define a message/phrase for this particular Tab / Page This can be used for search engine optimisation. Enter something here to override the default portal wide setting.";
            _baseSettings.Add("TabKeyPhrase", TabKeyPhrase);

            #endregion

            #region Layout and Theme

            // changed Thierry (Tiptopweb) : have a dropdown menu to select layout and themes
            _groupOrderBase = (int)SettingItemGroup.THEME_LAYOUT_SETTINGS;
            _Group          = SettingItemGroup.THEME_LAYOUT_SETTINGS;
            // get the list of available layouts
            // changed: Jes1111 - 2004-08-06
            ArrayList  layoutsList     = new ArrayList(new LayoutManager(portalSettings.PortalPath).GetLayouts());
            LayoutItem _noCustomLayout = new LayoutItem();
            _noCustomLayout.Name = string.Empty;
            layoutsList.Insert(0, _noCustomLayout);
            // get the list of available themes
            // changed: Jes1111 - 2004-08-06
            ArrayList themesList     = new ArrayList(new ThemeManager(portalSettings.PortalPath).GetThemes());
            ThemeItem _noCustomTheme = new ThemeItem();
            _noCustomTheme.Name = string.Empty;
            themesList.Insert(0, _noCustomTheme);
            // changed: Jes1111 - 2004-08-06
            SettingItem CustomLayout = new SettingItem(new CustomListDataType(layoutsList, "Name", "Name"));
            CustomLayout.Group       = _Group;
            CustomLayout.Order       = _groupOrderBase + 11;
            CustomLayout.EnglishName = "Custom Layout";
            CustomLayout.Description = "Set a custom layout for this tab only";
            _baseSettings.Add("CustomLayout", CustomLayout);
            //SettingItem CustomTheme = new SettingItem(new StringDataType());
            // changed: Jes1111 - 2004-08-06
            SettingItem CustomTheme = new SettingItem(new CustomListDataType(themesList, "Name", "Name"));
            CustomTheme.Group       = _Group;
            CustomTheme.Order       = _groupOrderBase + 12;
            CustomTheme.EnglishName = "Custom Theme";
            CustomTheme.Description = "Set a custom theme for the modules in this tab only";
            _baseSettings.Add("CustomTheme", CustomTheme);
            //SettingItem CustomThemeAlt = new SettingItem(new StringDataType());
            // changed: Jes1111 - 2004-08-06
            SettingItem CustomThemeAlt = new SettingItem(new CustomListDataType(themesList, "Name", "Name"));
            CustomThemeAlt.Group       = _Group;
            CustomThemeAlt.Order       = _groupOrderBase + 13;
            CustomThemeAlt.EnglishName = "Custom Alt Theme";
            CustomThemeAlt.Description = "Set a custom alternate theme for the modules in this tab only";
            _baseSettings.Add("CustomThemeAlt", CustomThemeAlt);

            SettingItem CustomMenuImage = new SettingItem(new CustomListDataType(GetImageMenu(), "Key", "Value"));
            CustomMenuImage.Group       = _Group;
            CustomMenuImage.Order       = _groupOrderBase + 14;
            CustomMenuImage.EnglishName = "Custom Image Menu";
            CustomMenuImage.Description = "Set a custom menu image for this tab";
            _baseSettings.Add("CustomMenuImage", CustomMenuImage);

            #endregion

            #region Language/Culture Management

            _groupOrderBase = (int)SettingItemGroup.CULTURE_SETTINGS;
            _Group          = SettingItemGroup.CULTURE_SETTINGS;
            CultureInfo[] cultureList = Rainbow.Framework.Localization.LanguageSwitcher.GetLanguageList(true);
            //Localized tab title
            int counter = _groupOrderBase + 11;

            foreach (CultureInfo c in cultureList)
            {
                //Ignore invariant
                if (c != CultureInfo.InvariantCulture && !_baseSettings.ContainsKey(c.Name))
                {
                    SettingItem LocalizedTabKeyPhrase = new SettingItem(new StringDataType());
                    LocalizedTabKeyPhrase.Order       = counter;
                    LocalizedTabKeyPhrase.Group       = _Group;
                    LocalizedTabKeyPhrase.EnglishName = "Tab Key Phrase (" + c.Name + ")";
                    LocalizedTabKeyPhrase.Description = "Key Phrase this Tab/Page for " + c.EnglishName + " culture.";
                    _baseSettings.Add("TabKeyPhrase_" + c.Name, LocalizedTabKeyPhrase);
                    SettingItem LocalizedTitle = new SettingItem(new StringDataType());
                    LocalizedTitle.Order       = counter;
                    LocalizedTitle.Group       = _Group;
                    LocalizedTitle.EnglishName = "Title (" + c.Name + ")";
                    LocalizedTitle.Description = "Set title for " + c.EnglishName + " culture.";
                    _baseSettings.Add(c.Name, LocalizedTitle);
                    counter++;
                }
            }

            #endregion

            return(_baseSettings);
        }
        /// <summary>
        /// Changed by [email protected]
        ///   Page are different for custom page layout an theme, this cannot be static
        ///   Added by [email protected]
        ///   Cache by Manu
        ///   non static function, Thierry : this is necessary for page custom layout and themes
        /// </summary>
        /// <returns>
        /// A System.Collections.Hashtable value...
        /// </returns>
        private Dictionary<string, ISettingItem> GetPageBaseSettings()
        {
            // Define base settings
            var baseSettings = new Dictionary<string, ISettingItem>();

            // 2_aug_2004 Cory Isakson
            var groupOrderBase = (int)SettingItemGroup.NAVIGATION_SETTINGS;
            var group = SettingItemGroup.NAVIGATION_SETTINGS;

            var tabPlaceholder = new SettingItem<bool, CheckBox>(new BaseDataType<bool, CheckBox>())
                {
                    Group = group,
                    Order = groupOrderBase,
                    Value = false,
                    EnglishName = "Act as a Placeholder?",
                    Description = "Allows this tab to act as a navigation placeholder only."
                };
            baseSettings.Add("TabPlaceholder", tabPlaceholder);

            var tabLink = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    Value = string.Empty,
                    Order = groupOrderBase + 1,
                    EnglishName = "Static Link URL",
                    Description = "Allows this tab to act as a navigation link to any URL."
                };
            baseSettings.Add("TabLink", tabLink);

            var tabUrlKeyword = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    Order = groupOrderBase + 2,
                    EnglishName = "URL Keyword",
                    Description = "Allows you to specify a keyword that would appear in your URL."
                };
            baseSettings.Add("TabUrlKeyword", tabUrlKeyword);

            var urlPageName = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    Order = groupOrderBase + 3,
                    EnglishName = "URL Page Name",
                    Description =
                        "This setting allows you to specify a name for this tab that will show up in the URL instead of default.aspx"
                };
            baseSettings.Add("UrlPageName", urlPageName);

            var PageList = new ArrayList(new PagesDB().GetPagesFlat(this.PortalSettings.PortalID));
            var noSelectedPage = new PageItem { Name = General.GetString("NONE") , ID = -1};
            PageList.Insert(0, noSelectedPage);

            var FB_LikeGate_Page = new SettingItem<string, ListControl>(new CustomListDataType(PageList, "Name", "ID")){
                Group = group,
                Order = groupOrderBase + 4,
                EnglishName = "FB Like Gate Page",
                Description =
                    "This setting allows you to specify an url to redirect if the user doesn't like your page"
            };
            baseSettings.Add("FB_LikeGate_Page", FB_LikeGate_Page);

            // groupOrderBase = (int)SettingItemGroup.META_SETTINGS;
            group = SettingItemGroup.META_SETTINGS;
            var tabTitle = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Title",
                    Description =
                        "Allows you to enter a title (Shows at the top of your browser) for this specific Tab / Page. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabTitle", tabTitle);

            var tabMetaKeyWords = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Keywords",
                    Description =
                        "This setting is to help with search engine optimization. Enter 1-15 Default Keywords that represent what this Tab / Page is about.Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaKeyWords", tabMetaKeyWords);
            var tabMetaDescription = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Description",
                    Description =
                        "This setting is to help with search engine optimization. Enter a description (Not too long though. 1 paragraph is enough) that describes this particular Tab / Page. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaDescription", tabMetaDescription);
            var tabMetaEncoding = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Encoding",
                    Description =
                        "Every time your browser returns a page it looks to see what format it is retrieving. This allows you to specify the content type for this particular Tab / Page. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaEncoding", tabMetaEncoding);
            var tabMetaOther = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Additional Meta Tag Entries",
                    Description =
                        "This setting allows you to enter new tags into this Tab / Page's HEAD Tag. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaOther", tabMetaOther);
            var tabKeyPhrase = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Keyphrase",
                    Description =
                        "This setting can be used by a module or by a control. It allows you to define a message/phrase for this particular Tab / Page This can be used for search engine optimisation. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabKeyPhrase", tabKeyPhrase);

            // changed Thierry (Tiptopweb) : have a dropdown menu to select layout and themes
            groupOrderBase = (int)SettingItemGroup.THEME_LAYOUT_SETTINGS;
            group = SettingItemGroup.THEME_LAYOUT_SETTINGS;

            // get the list of available layouts
            // changed: Jes1111 - 2004-08-06
            var layoutsList = new ArrayList(new LayoutManager(this.PortalSettings.PortalPath).GetLayouts());

            var noCustomLayout = new LayoutItem { Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)") };

            layoutsList.Insert(0, noCustomLayout);

            // get the list of available themes
            // changed: Jes1111 - 2004-08-06
            var themesList = new ArrayList(new ThemeManager(this.PortalSettings.PortalPath).GetThemes());
            var noCustomTheme = new ThemeItem { Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)") };
            themesList.Insert(0, noCustomTheme);

            // changed: Jes1111 - 2004-08-06
            var customLayout = new SettingItem<string, ListControl>(new CustomListDataType(layoutsList, "Name", "Name"))
                {
                    Group = group,
                    Order = groupOrderBase + 11,
                    EnglishName = "Custom Layout",
                    Description = "Set a custom layout for this tab only"
                };
            baseSettings.Add("CustomLayout", customLayout);

            // SettingItem CustomTheme = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customTheme = new SettingItem<string, ListControl>(new CustomListDataType(themesList, "Name", "Name"))
                {
                    Group = group,
                    Order = groupOrderBase + 12,
                    EnglishName = "Custom Theme",
                    Description = "Set a custom theme for the modules in this tab only"
                };
            baseSettings.Add("CustomTheme", customTheme);

            // SettingItem CustomThemeAlt = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customThemeAlt = new SettingItem<string, ListControl>(
                new CustomListDataType(themesList, "Name", "Name"))
                {
                    Group = group,
                    Order = groupOrderBase + 13,
                    EnglishName = "Custom Alt Theme",
                    Description = "Set a custom alternate theme for the modules in this tab only"
                };
            baseSettings.Add("CustomThemeAlt", customThemeAlt);

            var customMenuImage =
                new SettingItem<string, ListControl>(new CustomListDataType(this.GetImageMenu(), "Key", "Value"))
                    {
                        Group = group,
                        Order = groupOrderBase + 14,
                        EnglishName = "Custom Image Menu",
                        Description = "Set a custom menu image for this tab"
                    };
            baseSettings.Add("CustomMenuImage", customMenuImage);

            groupOrderBase = (int)SettingItemGroup.CULTURE_SETTINGS;
            group = SettingItemGroup.CULTURE_SETTINGS;
            var cultureList = LanguageSwitcher.GetLanguageList(true);

            // Localized tab title
            var counter = groupOrderBase + 11;

            // Ignore invariant
            foreach (
                var c in cultureList.Where(c => c != CultureInfo.InvariantCulture && !baseSettings.ContainsKey(c.Name)))
            {
                var localizedTabKeyPhrase = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                    {
                        Order = counter,
                        Group = group,
                        EnglishName = string.Format("Tab Key Phrase ({0})", c.Name),
                        Description = string.Format("Key Phrase this Tab/Page for {0} culture.", c.EnglishName)
                    };
                baseSettings.Add(string.Format("TabKeyPhrase_{0}", c.Name), localizedTabKeyPhrase);
                var localizedTitle = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                    {
                        Order = counter,
                        Group = group,
                        EnglishName = string.Format("Title ({0})", c.Name),
                        Description = string.Format("Set title for {0} culture.", c.EnglishName)
                    };
                baseSettings.Add(c.Name, localizedTitle);
                counter++;
            }

            return baseSettings;
        }
Exemple #31
0
 public static void MoneyPerDay(ThemeItem theme, int viewsperday, Video video)
 {
     _moneyperday = (viewsperday * theme.MoneyEffective) / 1000;
 }
        /// <summary>
        /// Changed by [email protected]
        ///   Page are different for custom page layout an theme, this cannot be static
        ///   Added by [email protected]
        ///   Cache by Manu
        ///   non static function, Thierry : this is necessary for page custom layout and themes
        /// </summary>
        /// <returns>
        /// A System.Collections.Hashtable value...
        /// </returns>
        private Dictionary <string, ISettingItem> GetPageBaseSettings()
        {
            // Define base settings
            var baseSettings = new Dictionary <string, ISettingItem>();

            // 2_aug_2004 Cory Isakson
            var groupOrderBase = (int)SettingItemGroup.NAVIGATION_SETTINGS;
            var group          = SettingItemGroup.NAVIGATION_SETTINGS;

            var tabPlaceholder = new SettingItem <bool, CheckBox>(new BaseDataType <bool, CheckBox>())
            {
                Group       = group,
                Order       = groupOrderBase,
                Value       = false,
                EnglishName = "Act as a Placeholder?",
                Description = "Allows this tab to act as a navigation placeholder only."
            };

            baseSettings.Add("TabPlaceholder", tabPlaceholder);

            var tabLink = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                Value       = string.Empty,
                Order       = groupOrderBase + 1,
                EnglishName = "Static Link URL",
                Description = "Allows this tab to act as a navigation link to any URL."
            };

            baseSettings.Add("TabLink", tabLink);

            var tabUrlKeyword = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                Order       = groupOrderBase + 2,
                EnglishName = "URL Keyword",
                Description = "Allows you to specify a keyword that would appear in your URL."
            };

            baseSettings.Add("TabUrlKeyword", tabUrlKeyword);

            var urlPageName = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                Order       = groupOrderBase + 3,
                EnglishName = "URL Page Name",
                Description =
                    "This setting allows you to specify a name for this tab that will show up in the URL instead of default.aspx"
            };

            baseSettings.Add("UrlPageName", urlPageName);

            var PageList       = new ArrayList(new PagesDB().GetPagesFlat(this.PortalSettings.PortalID));
            var noSelectedPage = new PageItem {
                Name = General.GetString("NONE"), ID = -1
            };

            PageList.Insert(0, noSelectedPage);


            var FB_LikeGate_Page = new SettingItem <string, ListControl>(new CustomListDataType(PageList, "Name", "ID"))
            {
                Group       = group,
                Order       = groupOrderBase + 4,
                EnglishName = "FB Like Gate Page",
                Description =
                    "This setting allows you to specify an url to redirect if the user doesn't like your page"
            };

            baseSettings.Add("FB_LikeGate_Page", FB_LikeGate_Page);

            // groupOrderBase = (int)SettingItemGroup.META_SETTINGS;
            group = SettingItemGroup.META_SETTINGS;
            var tabTitle = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Title",
                Description =
                    "Allows you to enter a title (Shows at the top of your browser) for this specific Tab / Page. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabTitle", tabTitle);

            var tabMetaKeyWords = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Keywords",
                Description =
                    "This setting is to help with search engine optimization. Enter 1-15 Default Keywords that represent what this Tab / Page is about.Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaKeyWords", tabMetaKeyWords);
            var tabMetaDescription = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Description",
                Description =
                    "This setting is to help with search engine optimization. Enter a description (Not too long though. 1 paragraph is enough) that describes this particular Tab / Page. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaDescription", tabMetaDescription);
            var tabMetaEncoding = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Encoding",
                Description =
                    "Every time your browser returns a page it looks to see what format it is retrieving. This allows you to specify the content type for this particular Tab / Page. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaEncoding", tabMetaEncoding);
            var tabMetaOther = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Additional Meta Tag Entries",
                Description =
                    "This setting allows you to enter new tags into this Tab / Page's HEAD Tag. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabMetaOther", tabMetaOther);
            var tabKeyPhrase = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
            {
                Group       = group,
                EnglishName = "Tab / Page Keyphrase",
                Description =
                    "This setting can be used by a module or by a control. It allows you to define a message/phrase for this particular Tab / Page This can be used for search engine optimisation. Enter something here to override the default portal wide setting."
            };

            baseSettings.Add("TabKeyPhrase", tabKeyPhrase);

            // changed Thierry (Tiptopweb) : have a dropdown menu to select layout and themes
            groupOrderBase = (int)SettingItemGroup.THEME_LAYOUT_SETTINGS;
            group          = SettingItemGroup.THEME_LAYOUT_SETTINGS;

            // get the list of available layouts
            // changed: Jes1111 - 2004-08-06
            var layoutsList = new ArrayList(new LayoutManager(this.PortalSettings.PortalPath).GetLayouts());


            var noCustomLayout = new LayoutItem {
                Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)")
            };

            layoutsList.Insert(0, noCustomLayout);

            // get the list of available themes
            // changed: Jes1111 - 2004-08-06
            var themesList    = new ArrayList(new ThemeManager(this.PortalSettings.PortalPath).GetThemes());
            var noCustomTheme = new ThemeItem {
                Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)")
            };

            themesList.Insert(0, noCustomTheme);

            // changed: Jes1111 - 2004-08-06
            var customLayout = new SettingItem <string, ListControl>(new CustomListDataType(layoutsList, "Name", "Name"))
            {
                Group       = group,
                Order       = groupOrderBase + 11,
                EnglishName = "Custom Layout",
                Description = "Set a custom layout for this tab only"
            };

            baseSettings.Add("CustomLayout", customLayout);

            // SettingItem CustomTheme = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customTheme = new SettingItem <string, ListControl>(new CustomListDataType(themesList, "Name", "Name"))
            {
                Group       = group,
                Order       = groupOrderBase + 12,
                EnglishName = "Custom Theme",
                Description = "Set a custom theme for the modules in this tab only"
            };

            baseSettings.Add("CustomTheme", customTheme);

            // SettingItem CustomThemeAlt = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customThemeAlt = new SettingItem <string, ListControl>(
                new CustomListDataType(themesList, "Name", "Name"))
            {
                Group       = group,
                Order       = groupOrderBase + 13,
                EnglishName = "Custom Alt Theme",
                Description = "Set a custom alternate theme for the modules in this tab only"
            };

            baseSettings.Add("CustomThemeAlt", customThemeAlt);

            var customMenuImage =
                new SettingItem <string, ListControl>(new CustomListDataType(this.GetImageMenu(), "Key", "Value"))
            {
                Group       = group,
                Order       = groupOrderBase + 14,
                EnglishName = "Custom Image Menu",
                Description = "Set a custom menu image for this tab"
            };

            baseSettings.Add("CustomMenuImage", customMenuImage);

            groupOrderBase = (int)SettingItemGroup.CULTURE_SETTINGS;
            group          = SettingItemGroup.CULTURE_SETTINGS;
            var cultureList = LanguageSwitcher.GetLanguageList(true);

            // Localized tab title
            var counter = groupOrderBase + 11;

            // Ignore invariant
            foreach (
                var c in cultureList.Where(c => c != CultureInfo.InvariantCulture && !baseSettings.ContainsKey(c.Name)))
            {
                var localizedTabKeyPhrase = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
                {
                    Order       = counter,
                    Group       = group,
                    EnglishName = string.Format("Tab Key Phrase ({0})", c.Name),
                    Description = string.Format("Key Phrase this Tab/Page for {0} culture.", c.EnglishName)
                };
                baseSettings.Add(string.Format("TabKeyPhrase_{0}", c.Name), localizedTabKeyPhrase);
                var localizedTitle = new SettingItem <string, TextBox>(new BaseDataType <string, TextBox>())
                {
                    Order       = counter,
                    Group       = group,
                    EnglishName = string.Format("Title ({0})", c.Name),
                    Description = string.Format("Set title for {0} culture.", c.EnglishName)
                };
                baseSettings.Add(c.Name, localizedTitle);
                counter++;
            }

            return(baseSettings);
        }
        /// <summary>
        /// Read the Path dir and returns
        ///   an ArrayList with all the Themes found, public and privates
        /// </summary>
        /// <returns>
        /// A list of theme items.
        /// </returns>
        public List<ThemeItem> GetPrivateThemes()
        {
            List<ThemeItem> privateThemeList;

            if (!CurrentCache.Exists(Key.ThemeList(this.PortalThemePath)))
            {
                privateThemeList = new List<ThemeItem>();

                // Try to read directories from private theme path
                var themes = Directory.Exists(this.PortalThemePath)
                                 ? Directory.GetDirectories(this.PortalThemePath)
                                 : new string[0];

                for (var i = 0; i <= themes.GetUpperBound(0); i++)
                {
                    var t = new ThemeItem { Name = themes[i].Substring(this.PortalThemePath.Length + 1) };

                    // Ignore CVS and SVN
                    if (t.Name != "CVS" && t.Name != "_svn")
                    {
                        privateThemeList.Add(t);
                    }
                }

                CurrentCache.Insert(
                    Key.ThemeList(this.PortalThemePath), privateThemeList, new CacheDependency(this.PortalThemePath));

                // Debug.WriteLine("Storing privateThemeList in Cache: item count is " + privateThemeList.Count.ToString());
            }
            else
            {
                privateThemeList = (List<ThemeItem>)CurrentCache.Get(Key.ThemeList(this.PortalThemePath));

                // Debug.WriteLine("Retrieving privateThemeList from Cache: item count is " + privateThemeList.Count.ToString());
            }

            return privateThemeList;
        }