Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         loadDropPublishedFilter();
         loadDropMasterPages();
         loadDropThemes();
         loadDropMenus();
         loadDropsModuleTypes();
         loadDropReferMenuId();
         loadDropRouteId();
     }
     else
     {
         //reload params on every postback, because cannot manage dinamically fields
         var currModule = new PigeonCms.Module();
         try
         {
             if (DropModuleTypes.SelectedValue.Split('.').Length > 1)
             {
                 currModule.ModuleNamespace = DropModuleTypes.SelectedValue.Split('.')[0];
                 currModule.ModuleName = DropModuleTypes.SelectedValue.Split('.')[1];
             }
             currModule.CurrView = DropViews.SelectedValue;
             ModuleParams1.LoadParams(currModule);
         }
         catch { }
     }
 }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            loadDropTemplateBlocks();
            loadDropPublishedFilter();
            loadDropsModuleTypes();
            MenuHelper.LoadListMenu(ListMenu, 0);

            RadioMenuAll.Attributes.Add("onclick", "disableListMenu();");
            RadioMenuNone.Attributes.Add("onclick", "disableListMenu();");
            RadioMenuSelection.Attributes.Add("onclick", "enableListMenu();");
        }
        else
        {
            //reload params on every postback, because cannot manage dinamically fields
            PigeonCms.Module currentModule = new PigeonCms.Module();
            if (base.CurrentId > 0)
            {
                currentModule = new ModulesManager().GetByKey(base.CurrentId);
                ModuleParams1.LoadParams(currentModule);
            }
            else
            {
                //manually set ModType
                try
                {
                    currentModule.ModuleNamespace = LitModuleType.Text.Split('.')[0];
                    currentModule.ModuleName = LitModuleType.Text.Split('.')[1];
                    currentModule.CurrView = DropViews.SelectedValue;
                    ModuleParams1.LoadParams(currentModule);
                }
                catch { }
            }
        }
    }
Exemplo n.º 3
0
    protected void Grid1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var linkedModule = new PigeonCms.Module();
            var item = new PigeonCms.Menu();
            item = (PigeonCms.Menu)e.Row.DataItem;

            Literal LitStyle = (Literal)e.Row.FindControl("LitStyle");
            LitStyle.Text = "";
            if (!string.IsNullOrEmpty(item.CssClass))
                LitStyle.Text += "C: " + item.CssClass + "<br />";
            if (!string.IsNullOrEmpty(item.CurrThemeStored))
                LitStyle.Text += "T: " + item.CurrThemeStored + "<br />";
            if (!string.IsNullOrEmpty(item.CurrMasterPageStored))
                LitStyle.Text += "M: " + item.CurrMasterPageStored + "<br />";

            Literal LitModuleNameDesc = (Literal)e.Row.FindControl("LitModuleNameDesc");
            switch (item.ContentType)
            {
                case MenuContentType.Module:
                    linkedModule = new ModulesManager().GetByKey(item.ModuleId);
                    LitModuleNameDesc.Text = linkedModule.ModuleFullName + "<br>"
                        + "<i>"+ linkedModule.CurrView +"</i>";
                    break;
                case MenuContentType.Url:
                    LitModuleNameDesc.Text = MenuContentType.Url.ToString();
                    break;
                case MenuContentType.Javascript:
                    LitModuleNameDesc.Text = MenuContentType.Javascript.ToString();
                    break;
                case MenuContentType.Alias:
                    LitModuleNameDesc.Text = MenuContentType.Alias.ToString();
                    break;
                default:
                    break;
            }

            LinkButton LnkSel = (LinkButton)e.Row.FindControl("LnkSel");
            LnkSel.Text = "<i class='fa fa-pgn_edit fa-fw'></i>" + Utility.Html.GetTextPreview(item.Name, 20, "");

            var LitAlias = (Literal)e.Row.FindControl("LitAlias");
            string alias = item.Alias;
            if (item.ContentType == MenuContentType.Url && !string.IsNullOrEmpty(item.Link))
            {
                alias = "<a href='" + item.Link + "' target='_blank' title='" + item.Link + "'>" +
                    item.Alias + "</a>";
            }
            LitAlias.Text = alias + "<br />" + item.RoutePattern;

            //moduleContent
            if (this.AllowEditContentUrl && linkedModule.Id > 0)
            {
                var LnkModuleContent = (HyperLink)e.Row.FindControl("LnkModuleContent");
                if (!string.IsNullOrEmpty(linkedModule.EditContentUrl))
                {
                    LnkModuleContent.Visible = true;
                    LnkModuleContent.NavigateUrl = linkedModule.EditContentUrl;
                }
            }

            var LitAccessTypeDesc = (Literal)e.Row.FindControl("LitAccessTypeDesc");
            LitAccessTypeDesc.Text = RenderAccessTypeSummary(item);

            //Visible
            if (item.Visible)
            {
                var img1 = e.Row.FindControl("ImgVisibleOk");
                img1.Visible = true;
            }
            else
            {
                var img1 = e.Row.FindControl("ImgVisibleKo");
                img1.Visible = true;
            }

            //Published
            if (item.Published)
            {
                var img1 = e.Row.FindControl("ImgPublishedOk");
                img1.Visible = true;
            }
            else
            {
                var img1 = e.Row.FindControl("ImgPublishedKo");
                img1.Visible = true;
            }

            //Use SSL
            if (item.CurrentUseSsl)
            {
                var img1 = e.Row.FindControl("ImgUseSsl");
                img1.Visible = true;
            }

            //Delete
            if (item.IsCore)
            {
                var img1 = e.Row.FindControl("LnkDel");
                img1.Visible = false;
            }
            else
            {
                var img1 = e.Row.FindControl("LnkDel");
                img1.Visible = true;
            }
        }
    }
Exemplo n.º 4
0
    protected void Grid1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var item = new PigeonCms.Module();
            item = (Module)e.Row.DataItem;

            LinkButton LnkTitle = (LinkButton)e.Row.FindControl("LnkTitle");
            LnkTitle.Text = "<i class='fa fa-pgn_edit fa-fw'></i>" + Utility.Html.GetTextPreview(item.Title, 20, "");

            Literal LitModuleNameDesc = (Literal)e.Row.FindControl("LitModuleNameDesc");
            LitModuleNameDesc.Text = item.ModuleFullName + "<br>"
                + "<i>" + item.CurrView + "</i>";

            Literal LitMenuEntries = (Literal)e.Row.FindControl("LitMenuEntries");
            if (item.MenuSelection == ModulesMenuSelection.AllPages)
                LitMenuEntries.Text = Utility.GetLabel("LblAll", "All");
            else if (item.MenuSelection == ModulesMenuSelection.NoPages)
                LitMenuEntries.Text = Utility.GetLabel("LblNone", "None");
            else if (item.MenuSelection == ModulesMenuSelection.List)
            {
                string entries = "";
                foreach (string menuType in item.ModulesMenuTypes)
                {
                    var menuType1 = new Menutype();
                    menuType1 = new MenutypesManager().GetByMenuType(menuType);
                    entries += "[" + menuType1.MenuType + "], ";  //record1.MenuType + "|"
                }
                foreach (int menuId in item.ModulesMenu)
                {
                    PigeonCms.Menu record1 = new PigeonCms.Menu();
                    record1 = new MenuManager().GetByKey(menuId);
                    entries += record1.Name + ", ";  //record1.MenuType + "|"
                }
                if (entries.EndsWith(", ")) entries = entries.Substring(0, entries.Length - 2);
                LitMenuEntries.Text = Utility.Html.GetTextPreview(entries, 30, "");
            }

            Literal LitAccessTypeDesc = (Literal)e.Row.FindControl("LitAccessTypeDesc");
            LitAccessTypeDesc.Text = item.ReadAccessType.ToString();
            if (item.ReadAccessType != MenuAccesstype.Public)
            {
                string roles = "";
                foreach (string role in item.ReadRolenames)
                {
                    roles += role + ", ";
                }
                if (roles.EndsWith(", ")) roles = roles.Substring(0, roles.Length - 2);
                if (roles.Length > 0)
                    roles = " (" + roles + ")";
                LitAccessTypeDesc.Text += Utility.Html.GetTextPreview(roles, 30, "");

                //render access level
                if (!string.IsNullOrEmpty(item.ReadAccessCode))
                    LitAccessTypeDesc.Text += item.ReadAccessCode;
                if (item.ReadAccessLevel > 0)
                    LitAccessTypeDesc.Text += " (" + item.ReadAccessLevel.ToString() + ")";
            }

            //moduleContent
            var LnkModuleContent = (HyperLink)e.Row.FindControl("LnkModuleContent");
            if (!string.IsNullOrEmpty(item.EditContentUrl))
            {
                LnkModuleContent.Visible = true;
                LnkModuleContent.NavigateUrl = item.EditContentUrl;
            }

            //Published
            if (item.Published)
            {
                var img1 = e.Row.FindControl("ImgPublishedOk");
                img1.Visible = true;
            }
            else
            {
                var img1 = e.Row.FindControl("ImgPublishedKo");
                img1.Visible = true;
            }

            //Delete
            if (item.IsCore)
            {
                var img1 = e.Row.FindControl("LnkDel");
                img1.Visible = false;
            }
            else
            {
                var img1 = e.Row.FindControl("LnkDel");
                img1.Visible = true;
            }
        }
    }