Exemple #1
0
        public void Execute(BasePage Context)
        {
            //JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
            //Dictionary<String, Object> jsonPaneFields = new Dictionary<string, Object>();

            DNNGo_ThemePlugin_MenuRowItem MenuRow = new DNNGo_ThemePlugin_MenuRowItem();

            MenuRow.ID = WebHelper.GetIntParam(Context.Request, "RowID", 0);
            if (MenuRow.ID > 0)
            {
                MenuRow = DNNGo_ThemePlugin_MenuRowItem.FindByKeyForEdit(MenuRow.ID);
                MenuRow = UpdatePane(Context, MenuRow);
            }
            else
            {
                MenuRow = CreateNewPane(Context);
            }


            //foreach (var Field in DNNGo_ThemePlugin_MenuRowItem.Meta.Fields)
            //{
            //    jsonPaneFields.Add(Field.ColumnName, MenuRow[Field.ColumnName]);
            //}

            //转换数据为json
            //ResponseString = jsSerializer.Serialize(jsonPaneFields);
            ResponseString = MenuRow.ToJson();
        }
Exemple #2
0
        public DNNGo_ThemePlugin_MenuRowItem UpdatePane(BasePage Context, DNNGo_ThemePlugin_MenuRowItem RowItem)
        {
            RowItem.TagList = WebHelper.GetStringParam(Context.Request, "TagList", RowItem.TagList);
            RowItem.Title   = WebHelper.GetStringParam(Context.Request, "Title", RowItem.Title);
            //RowItem.RowType = WebHelper.GetIntParam(Context.Request, "RowType", 0);
            //RowItem.PaneID = WebHelper.GetIntParam(Context.Request, "PaneID", 0);
            RowItem.Sort = WebHelper.GetIntParam(Context.Request, "Sort", RowItem.Sort);
            //RowItem.TabID = WebHelper.GetIntParam(Context.Request, "EditTabID", 0);


            //绑定菜单
            RowItem.MenuLevel        = WebHelper.GetIntParam(Context.Request, "MenuLevel", RowItem.MenuLevel);
            RowItem.MenuSytle        = WebHelper.GetStringParam(Context.Request, "MenuSytle", RowItem.MenuSytle);
            RowItem.MenuDisplayTitle = WebHelper.GetIntParam(Context.Request, "MenuDisplayTitle", RowItem.MenuDisplayTitle);
            RowItem.MenuID           = WebHelper.GetIntParam(Context.Request, "MenuID", RowItem.MenuID);
            //绑定HTML
            RowItem.HTML_Title   = WebHelper.GetStringParam(Context.Request, "HTML_Title", RowItem.HTML_Title);
            RowItem.HTML_Content = WebHelper.GetStringParam(Context.Request, "HTML_Content", RowItem.HTML_Content);
            //绑定模块
            RowItem.BindModuleID = WebHelper.GetIntParam(Context.Request, "BindModuleID", RowItem.BindModuleID);
            RowItem.BindTabID    = WebHelper.GetIntParam(Context.Request, "BindTabID", RowItem.BindTabID);



            RowItem.LastIP   = WebHelper.UserHost;
            RowItem.LastTime = DateTime.Now;
            RowItem.LastUser = Context.UserId;

            RowItem.Update();

            return(RowItem);
        }
Exemple #3
0
        public void Execute(BasePage Context)
        {
            //JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
            //Dictionary<String, Object> jsonPaneFields = new Dictionary<string, Object>();

            Int32   RowID     = WebHelper.GetIntParam(Context.Request, "RowID", 0);
            Int32   DeleteRow = 0;
            Boolean Success   = false;

            DNNGo_ThemePlugin_MenuRowItem MenuRow = DNNGo_ThemePlugin_MenuRowItem.FindByKeyForEdit(RowID);

            if (MenuRow != null && MenuRow.ID > 0)
            {
                if (MenuRow.Delete() > 0)
                {
                    DeleteRow = 1;
                    Success   = true;
                }
            }
            //jsonPaneFields.Add("DeleteRow", DeleteRow);
            //jsonPaneFields.Add("Success", Success);

            //转换数据为json
            //ResponseString = jsSerializer.Serialize(jsonPaneFields);
            ResponseString = new { DeleteRow = DeleteRow, Success = Success }.ToJson();
        }
Exemple #4
0
        /// <summary>
        /// 创建新的容器
        /// </summary>
        /// <returns></returns>
        public DNNGo_ThemePlugin_MenuRowItem CreateNewPane(BasePage Context)
        {
            DNNGo_ThemePlugin_MenuRowItem RowItem = new DNNGo_ThemePlugin_MenuRowItem();

            RowItem.TagList = WebHelper.GetStringParam(Context.Request, "TagList", "");
            RowItem.Title   = WebHelper.GetStringParam(Context.Request, "Title", "");
            RowItem.RowType = WebHelper.GetIntParam(Context.Request, "RowType", 0);
            RowItem.PaneID  = WebHelper.GetIntParam(Context.Request, "PaneID", 0);

            RowItem.Sort  = WebHelper.GetIntParam(Context.Request, "Sort", 999);
            RowItem.TabID = WebHelper.GetIntParam(Context.Request, "EditTabID", 0);


            RowItem.PortalId = Context.PortalId;
            RowItem.ModuleId = Context.ModuleId;



            RowItem.LastIP   = WebHelper.UserHost;
            RowItem.LastTime = DateTime.Now;
            RowItem.LastUser = Context.UserId;

            RowItem.ID = RowItem.Insert();
            return(RowItem);
        }
Exemple #5
0
        /// <summary>
        /// 绑定行中得菜单
        /// </summary>
        /// <param name="allTabs">所有菜单</param>
        /// <param name="MegaTab">当前菜单</param>
        /// <param name="MenuRowItem">行的设置</param>
        /// <param name="ChildLevel">当前级别</param>
        public void BindRowSubMenu(List <TabInfo> allTabs, TabInfo MegaTab, DNNGo_ThemePlugin_MenuRowItem MenuRowItem, Int32 ChildLevel)
        {
            List <TabInfo> SubList = allTabs.FindAll(r => r.ParentId == MegaTab.TabID);

            if (SubList != null && SubList.Count > 0 && (MenuRowItem.MenuLevel == 0 || MenuRowItem.MenuLevel >= ChildLevel))
            {
                BindString("<ul>");
                for (Int32 SubIndex = 0; SubIndex < SubList.Count; SubIndex++)
                {
                    var SubMenu = SubList[SubIndex];

                    if (SubMenu.IsVisible)
                    {
                        BindString("<li class=\"{0}\">", SubMenu.TabID == PortalSettings.ActiveTab.TabID ? "current" : "");
                        //绑定菜单链接
                        BindString(FormatAlink(SubMenu));
                        //绑定下级菜单
                        BindRowSubMenu(allTabs, SubMenu, MenuRowItem, ChildLevel + 1);

                        BindString("</li>");
                    }
                }
                BindString("</ul>");
            }
        }
Exemple #6
0
        /// <summary>
        /// 绑定行设置中的HTML内容
        /// </summary>
        /// <param name="RowItem"></param>
        public void BindHTMLModule(DNNGo_ThemePlugin_MenuRowItem RowItem)
        {
            if (RowItem.MenuDisplayTitle == 1)
            {
                BindString("<h3 class=\"submenu_title\">{0}</h3>", RowItem.HTML_Title);
            }

            BindString("<div class=\"menucontent\">{0}</div>", RowItem.HTML_Content);
        }
Exemple #7
0
        public void Execute(BasePage Context)
        {
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
            Dictionary <String, Object> jsonPanes    = new Dictionary <string, Object>();

            Int32 EditTabID = WebHelper.GetIntParam(Context.Request, "EditTabID", 0);
            Int32 PaneID    = WebHelper.GetIntParam(Context.Request, "PaneID", 0);

            Int32   SortCount = 0;
            Boolean Success   = false;

            String SortJson = HttpUtility.UrlDecode(WebHelper.GetStringParam(Context.Request, "SortJson", "[]"));

            if (!String.IsNullOrEmpty(SortJson))
            {
                List <DNNGo_ThemePlugin_MenuPane> SortDicts = SortJson.ToObject <List <DNNGo_ThemePlugin_MenuPane> >();
                if (SortDicts != null && SortDicts.Count > 0)
                {
                    foreach (var SortDict in SortDicts)
                    {
                        if (PaneID > 0)
                        {
                            //设置的是行记录的排序

                            if (DNNGo_ThemePlugin_MenuRowItem.Update(new string[] { "Sort", "PaneID" }, new object[] { SortDict.Sort, PaneID }, new string[] { "ID" }, new object[] { SortDict.ID }) > 0)
                            {
                                SortCount++;
                            }
                        }
                        else
                        {
                            //设置的是列的排序
                            if (DNNGo_ThemePlugin_MenuPane.Update(String.Format("{0}={1}", DNNGo_ThemePlugin_MenuPane._.Sort, SortDict.Sort), String.Format("{0}={1}", DNNGo_ThemePlugin_MenuPane._.ID, SortDict.ID)) > 0)
                            {
                                SortCount++;
                            }
                        }
                        if (SortCount > 0)
                        {
                            Success = true;
                        }
                    }
                }
            }

            jsonPanes.Add("SortCount", SortCount);
            jsonPanes.Add("Success", Success);


            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonPanes);
        }
Exemple #8
0
        /// <summary>
        /// 绑定菜单中的行
        /// </summary>
        /// <param name="MegaTab"></param>
        /// <param name="MenuPane"></param>
        public void BindMegaMenuRow(List <TabInfo> allTabs, TabInfo MegaTab, DNNGo_ThemePlugin_MenuPane MenuPane, Int32 ChildLevel)
        {
            //读取当前列中得行集合
            List <DNNGo_ThemePlugin_MenuRowItem> RowList = DNNGo_ThemePlugin_MenuRowItem.FindAllByPaneID(MenuPane.ID);

            if (RowList != null && RowList.Count > 0)
            {
                //循环打印所有的行到页面上
                for (Int32 RowIndex = 0; RowIndex < RowList.Count; RowIndex++)
                {
                    var RowItem = RowList[RowIndex];

                    //载入不同的类型填充到行记录中


                    if (RowItem.RowType == (Int32)EnumRowType.HTML)
                    {
                        //载入HTML内容到菜单
                        BindString("<div class=\"submodule {0}\">", EnumHelper.GetEnumTextVal(RowItem.RowType, typeof(EnumRowType)));

                        BindHTMLModule(RowItem);

                        BindString("</div>");
                    }
                    else if (RowItem.RowType == (Int32)EnumRowType.Module)
                    {
                        //载入第三方模块到菜单
                        BindString("<div class=\"submodule {0}\">", EnumHelper.GetEnumTextVal(RowItem.RowType, typeof(EnumRowType)));

                        BindModule(RowItem);

                        BindString("</div>");
                    }
                    else if (RowItem.RowType == (Int32)EnumRowType.Menu)
                    {
                        //载入下级菜单到菜单
                        BindString("<div class=\"submenu {0} {1}\">", EnumHelper.GetEnumTextVal(RowItem.RowType, typeof(EnumRowType)), RowItem.MenuSytle);

                        BindRowMenu(allTabs, MegaTab, RowItem);

                        BindString("</div>");
                    }
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// 绑定行中的菜单项
        /// </summary>
        public void BindRowMenu(List <TabInfo> allTabs, TabInfo MegaTab, DNNGo_ThemePlugin_MenuRowItem MenuRowItem)
        {
            //设置了菜单,并且所有集合中包含了菜单才会打印
            if (MenuRowItem.MenuID > 0 && allTabs.Exists(r => r.TabID == MenuRowItem.MenuID))
            {
                TabInfo BindTabInfo = allTabs.Find(r => r.TabID == MenuRowItem.MenuID);


                if (MenuRowItem.MenuDisplayTitle == 1 && BindTabInfo.IsVisible)
                {
                    BindString("<h3 class=\"submenu_title\">{0}</h3>", FormatAlink(BindTabInfo));
                }


                Int32 ChildLevel = 1;

                BindRowSubMenu(allTabs, BindTabInfo, MenuRowItem, ChildLevel);
            }
        }
Exemple #10
0
        public void Execute(BasePage Context)
        {
            Int32   DeleteRow  = 0;
            Int32   DeletePane = 0;
            Boolean Success    = false;

            Int32 PaneID = WebHelper.GetIntParam(Context.Request, "PaneID", 0);

            if (PaneID > 0)
            {
                DNNGo_ThemePlugin_MenuPane MenuPane = DNNGo_ThemePlugin_MenuPane.FindByKeyForEdit(PaneID);
                if (MenuPane != null && MenuPane.ID > 0)
                {
                    List <DNNGo_ThemePlugin_MenuRowItem> RowItems = DNNGo_ThemePlugin_MenuRowItem.FindAll(DNNGo_ThemePlugin_MenuRowItem._.PaneID, PaneID);
                    foreach (var RowItem in RowItems)
                    {
                        if (RowItem.Delete() > 0)
                        {
                            DeleteRow++;
                        }
                    }


                    if (MenuPane.Delete() > 0)
                    {
                        DeleteRow = 1;
                        Success   = true;
                    }
                }
                else
                {
                    Success = false;
                }
            }
            else
            {
                Success = false;
            }

            //转换数据为json
            ResponseString = new  { DeletePane = DeletePane, DeleteRow = DeleteRow, Success = Success }.ToJson();
        }
Exemple #11
0
        /// <summary>
        /// 读取数据项参数
        /// </summary>
        /// <param name="DataItem">数据项</param>
        /// <param name="Name">参数名</param>
        /// <param name="DefaultValue">默认值</param>
        /// <returns></returns>
        public object GetSettingByStatic(DNNGo_ThemePlugin_MenuRowItem DataItem, String Name, object DefaultValue)
        {
            object o = DefaultValue;

            if (DataItem != null && DataItem.ID > 0 && !String.IsNullOrEmpty(DataItem.Options))
            {
                try
                {
                    List <KeyValueEntity> ItemSettings = DataItem.Options.ToList <KeyValueEntity>();
                    KeyValueEntity        KeyValue     = ItemSettings.Find(r1 => r1.Key.ToLower() == Name.ToLower());
                    if (KeyValue != null && !String.IsNullOrEmpty(KeyValue.Key))
                    {
                        o = KeyValue.Value;
                    }
                }
                catch
                {
                }
            }
            return(o);
        }
Exemple #12
0
        /// <summary>
        /// 绑定页面上需要加载的模块
        /// </summary>
        public void BindModule(DNNGo_ThemePlugin_MenuRowItem RowItem)
        {
            ModuleController objModules          = new ModuleController();
            ModuleInfo       ModuleConfiguration = objModules.GetModule(RowItem.BindModuleID, RowItem.BindTabID);

            if (ModuleConfiguration != null && ModuleConfiguration.ModuleID > 0)
            {
                //这里可以加上代码控制标题是否显示
                if (RowItem.MenuDisplayTitle == 1)
                {
                    BindString("<h3 class=\"submenu_title\">{0}</h3>", ModuleConfiguration.ModuleTitle);
                }

                BindString("<div class=\"menucontent\"> ");

                try
                {
                    //phContentHTML.Controls.Add(ModuleControlFactory.LoadModuleControl(Page, ModuleConfiguration));

                    //PortalModuleBase _Control = ControlUtilities.LoadControl<PortalModuleBase>(this, ModuleConfiguration.ModuleControl.ControlSrc);
                    //_Control.ID = String.Format("{0}_{1}", ModuleConfiguration.ModuleID, Path.GetFileNameWithoutExtension(ModuleConfiguration.ModuleControl.ControlSrc));
                    //_Control.ModuleContext.Configuration = ModuleConfiguration;
                    //_Control.ModuleConfiguration = ModuleConfiguration;
                    //phContentHTML.Controls.Add(_Control);

                    var control = ModuleControlFactory.LoadModuleControl(Page, ModuleConfiguration);
                    if (control != null)
                    {
                        control.ID = String.Format("{0}_{1}", ModuleConfiguration.ModuleID, Path.GetFileNameWithoutExtension(ModuleConfiguration.ModuleControl.ControlSrc));
                        phContentHTML.Controls.Add(control);
                    }
                }
                catch
                { }



                BindString("</div>");
            }
        }
Exemple #13
0
 /// <summary>
 /// 读取XML参数
 /// </summary>
 /// <typeparam name="T">参数类型</typeparam>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public T GetSettingT <T>(DNNGo_ThemePlugin_MenuRowItem DataItem, String Name, object DefaultValue)
 {
     return((T)Convert.ChangeType(GetSetting(DataItem, Name, DefaultValue), typeof(T)));
 }
Exemple #14
0
 /// <summary>
 /// 读取数据项参数
 /// </summary>
 /// <param name="DataItem">数据项</param>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public object GetSetting(DNNGo_ThemePlugin_MenuRowItem DataItem, String Name, object DefaultValue)
 {
     return(GetSettingByStatic(DataItem, Name, DefaultValue));
 }
Exemple #15
0
        public void Execute(BasePage Context)
        {
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
            Dictionary <String, Object> jsonPanes    = new Dictionary <string, Object>();

            Int32 EditTabID = WebHelper.GetIntParam(Context.Request, "EditTabID", 0);


            Int32      Record = 0;
            QueryParam qp     = new QueryParam();

            qp.Orderfld  = DNNGo_ThemePlugin_MenuPane._.Sort;
            qp.OrderType = 0;

            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuPane._.PortalId, Context.PortalId, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuPane._.TabID, EditTabID, SearchType.Equal));

            List <DNNGo_ThemePlugin_MenuPane> MenuPanes = DNNGo_ThemePlugin_MenuPane.FindAll(qp, out Record);

            foreach (var MenuPane in MenuPanes)
            {
                if (MenuPane != null && MenuPane.ID > 0)
                {
                    //Dictionary<String, Object> jsonPane = new Dictionary<string, Object>();

                    //foreach (var Field in DNNGo_ThemePlugin_MenuPane.Meta.Fields)
                    //{
                    //    jsonPane.Add(Field.ColumnName, MenuPane[Field.ColumnName]);
                    //}
                    //筛选出列记录的选项集合
                    if (!String.IsNullOrEmpty(MenuPane.Options))
                    {
                        //List<KeyValueEntity> Options = MenuPane.SettingItems;
                    }


                    //查找当前容器下所有的行数据
                    QueryParam qpRows = new QueryParam();
                    qpRows.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuRowItem._.PortalId, Context.PortalId, SearchType.Equal));
                    qpRows.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuRowItem._.PaneID, MenuPane.ID, SearchType.Equal));
                    qpRows.Orderfld  = DNNGo_ThemePlugin_MenuRowItem._.Sort;
                    qpRows.OrderType = 0;

                    List <DNNGo_ThemePlugin_MenuRowItem> MenuRows = DNNGo_ThemePlugin_MenuRowItem.FindAll(qpRows, out Record);

                    MenuPane.Rows = MenuRows;


                    //Dictionary<String, Object> jsonRows = new Dictionary<string, Object>();
                    //foreach (var MenuRow in MenuRows)
                    //{
                    //    if (MenuRow != null && MenuRow.ID > 0)
                    //    {
                    //        Dictionary<String, Object> jsonRow = new Dictionary<string, Object>();

                    //        foreach (var RowField in DNNGo_ThemePlugin_MenuRowItem.Meta.Fields)
                    //        {
                    //            jsonRow.Add(RowField.ColumnName, MenuRow[RowField.ColumnName]);
                    //        }
                    //        //筛选出行记录的选项集合
                    //        if (!String.IsNullOrEmpty(MenuRow.Options))
                    //        {

                    //        }


                    //        jsonRows.Add( MenuRow.ID.ToString(), jsonRow);
                    //    }
                    //}

                    //jsonPane.Add("Rows", jsonRows);


                    //jsonPanes.Add( MenuPane.ID.ToString(), jsonPane);
                }
            }
            //转换数据为json
            ResponseString = MenuPanes.ToJson();
        }