Пример #1
0
        public DNNGo_ThemePlugin_MenuPane UpdatePane(BasePage Context, DNNGo_ThemePlugin_MenuPane MenuPane)
        {
            MenuPane.LastIP   = WebHelper.UserHost;
            MenuPane.LastTime = DateTime.Now;
            MenuPane.LastUser = Context.UserId;

            MenuPane.Update();


            return(MenuPane);
        }
Пример #2
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);
        }
Пример #3
0
        public void Execute(BasePage Context)
        {
            //JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
            //Dictionary<String, Object> jsonPaneFields = new Dictionary<string, Object>();
            Int32 PaneID = WebHelper.GetIntParam(Context.Request, "PaneID", 0);

            DNNGo_ThemePlugin_MenuPane MenuPane = DNNGo_ThemePlugin_MenuPane.FindByKeyForEdit(PaneID);

            MenuPane.PaneName  = WebHelper.GetStringParam(Context.Request, "PaneName", MenuPane.PaneName);
            MenuPane.TagPane   = WebHelper.GetStringParam(Context.Request, "TagPane", MenuPane.TagPane);
            MenuPane.PaneWidth = WebHelper.GetStringParam(Context.Request, "PaneWidth", MenuPane.PaneWidth);
            MenuPane.Sort      = WebHelper.GetIntParam(Context.Request, "Sort", MenuPane.Sort);
            MenuPane.TabID     = WebHelper.GetIntParam(Context.Request, "EditTabID", MenuPane.TabID);

            //MenuPane.Options = WebHelper.GetStringParam(Context.Request, "Options", MenuPane.Options);

            List <KeyValueEntity> Options = MenuPane.SettingItems;

            Options = Context.UpdateSettings(Options, "PaneTopSpacing", WebHelper.GetStringParam(Context.Request, "PaneTopSpacing", "0"));
            Options = Context.UpdateSettings(Options, "PaneRightSpacing", WebHelper.GetStringParam(Context.Request, "PaneRightSpacing", "0"));
            Options = Context.UpdateSettings(Options, "PaneBottomSpacing", WebHelper.GetStringParam(Context.Request, "PaneBottomSpacing", "0"));
            Options = Context.UpdateSettings(Options, "PaneLeftSpacing", WebHelper.GetStringParam(Context.Request, "PaneLeftSpacing", "0"));
            Options = Context.UpdateSettings(Options, "PaneTopLine", WebHelper.GetStringParam(Context.Request, "PaneTopLine", "false"));
            Options = Context.UpdateSettings(Options, "PaneRightLine", WebHelper.GetStringParam(Context.Request, "PaneRightLine", "false"));
            Options = Context.UpdateSettings(Options, "PaneBottomLine", WebHelper.GetStringParam(Context.Request, "PaneBottomLine", "false"));
            Options = Context.UpdateSettings(Options, "PaneLeftLine", WebHelper.GetStringParam(Context.Request, "PaneLeftLine", "false"));

            MenuPane.Options = Options.ToJson();


            if (MenuPane.ID > 0)
            {
                MenuPane = UpdatePane(Context, MenuPane);
            }
            else
            {
                MenuPane = CreateNewPane(Context, MenuPane);
            }


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

            //转换数据为json
            //ResponseString = jsSerializer.Serialize(jsonPaneFields);

            ResponseString = MenuPane.ToJson();
        }
Пример #4
0
        /// <summary>
        /// 创建新的容器
        /// </summary>
        /// <returns></returns>
        public DNNGo_ThemePlugin_MenuPane CreateNewPane(BasePage Context, DNNGo_ThemePlugin_MenuPane MenuPane)
        {
            MenuPane.PortalId = Context.PortalId;
            MenuPane.ModuleId = Context.ModuleId;



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

            MenuPane.ID = MenuPane.Insert();
            return(MenuPane);
        }
Пример #5
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>");
                    }
                }
            }
        }
Пример #6
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();
        }
Пример #7
0
        /// <summary>
        /// 读取数据项参数
        /// </summary>
        /// <param name="DataItem">数据项</param>
        /// <param name="Name">参数名</param>
        /// <param name="DefaultValue">默认值</param>
        /// <returns></returns>
        public object GetSettingByStatic(DNNGo_ThemePlugin_MenuPane 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);
        }
Пример #8
0
        /// <summary>
        /// 绑定MEGA菜单第一层
        /// </summary>
        /// <param name="allTabs"></param>
        /// <param name="ParentTab"></param>
        /// <returns></returns>
        public void BindMegaMenu(List <TabInfo> allTabs, TabInfo MegaTab, DNNGo_ThemePlugin_Menu MenuOptions, Int32 ChildLevel)
        {
            if (ChildLevel <= MaxLevel || MaxLevel <= 0)
            {
                //筛选当前所要打印的菜单
                //List<TabInfo> MegaTabs = allTabs.FindAll(r => r.ParentId == ParentTab.TabID);
                BindString("<div class=\"dnngo_menuslide\"  data-width=\"{0}\" data-position=\"{1}\">", MenuOptions.MenuWidth, GetSettingT <Int32>(MenuOptions, "MegaPosition", 0));
                BindString("<div class=\"dnngo_boxslide\">");

                ////循环调用每个顶级菜单的的二级菜单

                //查找菜单的设置
                List <KeyValueEntity> TabValues = FindTabValues(MenuOptions);

                //循环打印所有的列
                List <DNNGo_ThemePlugin_MenuPane> Panes = DNNGo_ThemePlugin_MenuPane.FindAllByTabID(MegaTab.TabID);

                if (Panes != null && Panes.Count > 0)
                {
                    BindString("<div class=\"dnngo_custommenu\">");

                    //循环打印所有的列到页面上
                    for (Int32 PaneIndex = 0; PaneIndex < Panes.Count; PaneIndex++)
                    {
                        var PaneItem = Panes[PaneIndex];

                        //BindString("<div class=\"menupane pane_{0} {2} {3} {4} {5}\"  style=\"width:{1}%;padding-top:{6}px;padding-right:{7}px;padding-bottom:{8}px;padding-left:{9}px;\">",
                        //    PaneItem.ID,
                        //    PaneItem.PaneWidth,
                        //    GetSettingT<Boolean>(PaneItem, "PaneTopLine", false) ? "topline" : "",
                        //    GetSettingT<Boolean>(PaneItem, "PaneBottomLine", false) ? "bottomline" : "",
                        //    GetSettingT<Boolean>(PaneItem, "PaneLeftLine", false) ? "leftline" : "",
                        //    GetSettingT<Boolean>(PaneItem, "PaneRightLine", false) ? "rightline" : "",
                        //    GetSettingT<Int32>(PaneItem, "PaneTopSpacing", 10),
                        //    GetSettingT<Int32>(PaneItem, "PaneRightSpacing", 10),
                        //    GetSettingT<Int32>(PaneItem, "PaneBottomSpacing", 10),
                        //    GetSettingT<Int32>(PaneItem, "PaneLeftSpacing", 10)
                        // );

                        //BindString("<div class=\"menupane pane_{0}\"  style=\"width:{1}%;\">",
                        //    PaneItem.ID,
                        //    PaneItem.PaneWidth
                        //    );

                        BindString("<div class=\"menupane pane_{0} {2} {3} {4} {5}\"  style=\"width:{1}%;\">",
                                   PaneItem.ID,
                                   PaneItem.PaneWidth,
                                   GetSettingT <String>(PaneItem, "PaneTopLine", "0") == "1" ? "topline" : "",
                                   GetSettingT <String>(PaneItem, "PaneBottomLine", "0") == "1" ? "bottomline" : "",
                                   GetSettingT <String>(PaneItem, "PaneLeftLine", "0") == "1" ? "leftline" : "",
                                   GetSettingT <String>(PaneItem, "PaneRightLine", "0") == "1" ? "rightline" : ""

                                   );


                        BindString("<div class=\"pane_space\"  style=\"padding-top:{0}px;padding-right:{1}px;padding-bottom:{2}px;padding-left:{3}px;\">",
                                   GetSettingT <Int32>(PaneItem, "PaneTopSpacing", 10),
                                   GetSettingT <Int32>(PaneItem, "PaneRightSpacing", 10),
                                   GetSettingT <Int32>(PaneItem, "PaneBottomSpacing", 10),
                                   GetSettingT <Int32>(PaneItem, "PaneLeftSpacing", 10)
                                   );

                        //打印行结构到列中
                        BindMegaMenuRow(allTabs, MegaTab, PaneItem, ChildLevel + 1);

                        BindString("</div>");
                        BindString("</div>");
                    }

                    BindString("</div>");
                    BindString("<div class=\"clear\"></div>");
                }

                BindString("</div>");
                BindString("</div>");
            }

            //return ContentTHML.ToString();
        }
Пример #9
0
 /// <summary>
 /// 读取XML参数
 /// </summary>
 /// <typeparam name="T">参数类型</typeparam>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public T GetSettingT <T>(DNNGo_ThemePlugin_MenuPane DataItem, String Name, object DefaultValue)
 {
     return((T)Convert.ChangeType(GetSetting(DataItem, Name, DefaultValue), typeof(T)));
 }
Пример #10
0
 /// <summary>
 /// 读取数据项参数
 /// </summary>
 /// <param name="DataItem">数据项</param>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public object GetSetting(DNNGo_ThemePlugin_MenuPane DataItem, String Name, object DefaultValue)
 {
     return(GetSettingByStatic(DataItem, Name, DefaultValue));
 }
Пример #11
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();
        }