public CMSAdminModuleMenu GetCurrentPlug()
        {
            CMSAdminModuleMenu plug = null;

            CMSAdminModule mod = this.Modules.Where(x => x.AreaKey.ToLower() == this.SelectedArea.ToLower()).FirstOrDefault();

            if (mod != null)
            {
                plug = mod.PluginMenus.Where(x => x.Action.ToLower() == this.CurrentActionFull.ToLower() &&
                                             x.Controller.ToLower() == this.CurrentController.ToLower()).FirstOrDefault();

                if (plug == null)
                {
                    plug = mod.PluginMenus.Where(x => x.Action.ToLower() == this.CurrentAction.ToLower() &&
                                                 x.Controller.ToLower() == this.CurrentController.ToLower()).FirstOrDefault();
                }
            }

            if (plug != null)
            {
                this.SelectedPluginActionName = plug.Caption;
            }

            return(plug);
        }
Exemple #2
0
        public void LoadModule()
        {
            ModuleID = AdminModuleQueryStringRoutines.GetModuleID();
            pf       = AdminModuleQueryStringRoutines.GetPluginFile();

            if (!String.IsNullOrEmpty(pf))
            {
                ModuleFamily = (from m in cmsHelper.AdminModules
                                where m.PluginID == ModuleID
                                select m).FirstOrDefault();

                PluginItem = (from m in ModuleFamily.PluginMenus
                              orderby m.Caption, m.SortOrder
                              where m.PluginParm == pf
                              select m).FirstOrDefault();

                UseAjax = PluginItem.UseAjax;

                Control c = Page.LoadControl(PluginItem.ControlFile);
                phAdminModule.Controls.Add(c);

                if (c is IAdminModule)
                {
                    var w = (IAdminModule)c;
                    w.SiteID              = SiteData.CurrentSiteID;
                    w.ModuleID            = ModuleID;
                    w.ModuleName          = pf;
                    w.QueryStringFragment = AdminModuleQueryStringRoutines.GenerateQueryStringFragment(pf, ModuleID);
                    w.QueryStringPattern  = AdminModuleQueryStringRoutines.GenerateQueryStringPattern(ModuleID);
                }
            }

            bLoadModule = true;
        }
        public bool EvalPlug(CMSAdminModuleMenu plug)
        {
            this.SelectedCssClass = "notSelectedModule";
            if (plug.AreaKey == this.SelectedArea && plug.Action == this.CurrentActionFull &&
                plug.Controller == this.CurrentController)
            {
                this.SelectedCssClass         = "selectedModule";
                this.SelectedPluginActionName = plug.Caption;

                return(true);
            }

            return(false);
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!this.HideList && cmsHelper.AdminModules.Any())
                {
                    GeneralUtilities.BindRepeater(rpModuleList, cmsHelper.AdminModules);
                }
                else
                {
                    rpModuleList.Visible = false;
                }
            }

            pnlNav.Visible = !this.HideList;

            if (this.ModuleID != Guid.Empty)
            {
                pnlSetter.Visible = true;
                int x = 0;
                foreach (var row in cmsHelper.AdminModules)
                {
                    if (this.ModuleID.ToString().ToLowerInvariant() == row.PluginID.ToString().ToLowerInvariant())
                    {
                        this.SelMenu = x.ToString();
                        break;
                    }
                    x++;
                }

                this.ModuleFamily = (from m in cmsHelper.AdminModules
                                     where m.PluginID == this.ModuleID
                                     select m).FirstOrDefault();
                if (this.ModuleFamily != null)
                {
                    litModuleTitle.Text = this.ModuleFamily.PluginName;

                    this.PluginItem = (from m in this.ModuleFamily.PluginMenus
                                       orderby m.Caption, m.SortOrder
                                       where m.PluginParm == pf
                                       select m).FirstOrDefault();

                    if (this.PluginItem != null)
                    {
                        litModuleTitle.Text = String.Format("{0} : {1}", this.ModuleFamily.PluginName, this.PluginItem.Caption);
                    }
                }
            }
        }
Exemple #5
0
        protected void BuildWidgetInstall()
        {
            pnlReview.Visible = true;

            SiteData site = SiteData.CurrentSite;

            CMSAdminModuleMenu thisModule = cmsHelper.GetCurrentAdminModuleControl();
            string             sDir       = thisModule.ControlFile.Substring(0, thisModule.ControlFile.LastIndexOf("/"));
            List <CMSPlugin>   lstPlug    = cmsHelper.GetPluginsInFolder(sDir);

            CMSPlugin plug = lstPlug.Where(x => x.FilePath.EndsWith("PhotoGalleryPrettyPhoto.ascx")).FirstOrDefault();

            GalleryHelper gh = new GalleryHelper(site.SiteID);

            foreach (GridViewRow row in gvPages.Rows)
            {
                Guid gRootPage = Guid.Empty;
                Guid gGallery  = Guid.Empty;
                int  iPost     = 0;

                CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect");

                if (chkSelect.Checked)
                {
                    HiddenField hdnPostID = (HiddenField)row.FindControl("hdnPostID");

                    iPost = int.Parse(hdnPostID.Value);

                    List <WordPressPost> lstA = (from a in wpSite.Content
                                                 where a.PostType == WordPressPost.WPPostType.Attachment &&
                                                 a.ParentPostID == iPost
                                                 orderby a.PostDateUTC
                                                 select a).Distinct().ToList();

                    lstA.ToList().ForEach(q => q.ImportFileSlug = ddlFolders.SelectedValue + "/" + q.ImportFileSlug);
                    lstA.ToList().ForEach(q => q.ImportFileSlug = q.ImportFileSlug.Replace("//", "/").Replace("//", "/"));

                    WordPressPost post = (from p in wpSite.Content
                                          where p.PostID == iPost
                                          select p).FirstOrDefault();

                    ContentPage cp = null;

                    List <ContentPage> lstCP = pageHelper.FindPageByTitleAndDate(site.SiteID, post.PostTitle, post.PostName, post.PostDateUTC);

                    if (lstCP != null && lstCP.Any())
                    {
                        cp = lstCP.FirstOrDefault();
                    }

                    if (cp != null)
                    {
                        gRootPage = cp.Root_ContentID;
                        if (cp.PageText.Contains("[gallery]"))
                        {
                            cp.PageText = cp.PageText.Replace("[gallery]", "");
                            cp.SavePageEdit();
                        }
                    }

                    GalleryGroup gal = gh.GalleryGroupGetByName(post.PostTitle);

                    if (gal == null)
                    {
                        gal              = new GalleryGroup();
                        gal.SiteID       = site.SiteID;
                        gal.GalleryID    = Guid.Empty;
                        gal.GalleryTitle = post.PostTitle;

                        gal.Save();
                    }

                    gGallery = gal.GalleryID;

                    int iPos = 0;

                    foreach (var img in lstA)
                    {
                        img.ImportFileSlug = img.ImportFileSlug.Replace("//", "/").Replace("//", "/");

                        if (!chkFileGrab.Checked)
                        {
                            cmsHelper.GetFile(img.AttachmentURL, img.ImportFileSlug);
                        }

                        if (!string.IsNullOrEmpty(img.ImportFileSlug))
                        {
                            GalleryImageEntry theImg = gh.GalleryImageEntryGetByFilename(gGallery, img.ImportFileSlug);

                            if (theImg == null)
                            {
                                theImg = new GalleryImageEntry();
                                theImg.GalleryImage   = img.ImportFileSlug;
                                theImg.GalleryImageID = Guid.Empty;
                                theImg.GalleryID      = gGallery;
                            }
                            theImg.ImageOrder = iPos;
                            theImg.Save();

                            GalleryMetaData theMeta = gh.GalleryMetaDataGetByFilename(img.ImportFileSlug);

                            if (theMeta == null)
                            {
                                theMeta = new GalleryMetaData();
                                theMeta.GalleryImageMetaID = Guid.Empty;
                                theMeta.SiteID             = site.SiteID;
                            }

                            if (!string.IsNullOrEmpty(img.PostTitle) || !string.IsNullOrEmpty(img.PostContent))
                            {
                                theMeta.ImageTitle    = img.PostTitle;
                                theMeta.ImageMetaData = img.PostContent;

                                theMeta.Save();
                            }
                        }
                        iPos++;
                    }

                    if (gRootPage != Guid.Empty)
                    {
                        List <Widget> lstW = (from w in cp.GetWidgetList()
                                              where w.ControlPath.ToLower() == plug.FilePath.ToLower() &&
                                              w.ControlProperties.ToLower().Contains(gGallery.ToString().ToLower())
                                              select w).ToList();

                        if (lstW.Count < 1)
                        {
                            Widget newWidget = new Widget();
                            newWidget.ControlProperties = null;
                            newWidget.Root_ContentID    = gRootPage;
                            newWidget.Root_WidgetID     = Guid.NewGuid();
                            newWidget.WidgetDataID      = newWidget.Root_WidgetID;
                            newWidget.ControlPath       = plug.FilePath;
                            newWidget.EditDate          = SiteData.CurrentSite.Now;

                            newWidget.IsLatestVersion       = true;
                            newWidget.IsWidgetActive        = true;
                            newWidget.IsWidgetPendingDelete = false;
                            newWidget.WidgetOrder           = -1;
                            newWidget.PlaceholderName       = txtPlaceholderName.Text;

                            List <WidgetProps> lstProps = new List <WidgetProps>();
                            lstProps.Add(new WidgetProps {
                                KeyName = "ShowHeading", KeyValue = chkShowHeading.Checked.ToString()
                            });
                            lstProps.Add(new WidgetProps {
                                KeyName = "ScaleImage", KeyValue = chkScaleImage.Checked.ToString()
                            });
                            lstProps.Add(new WidgetProps {
                                KeyName = "ThumbSize", KeyValue = ddlSize.SelectedValue
                            });
                            lstProps.Add(new WidgetProps {
                                KeyName = "PrettyPhotoSkin", KeyValue = ddlSkin.SelectedValue
                            });
                            lstProps.Add(new WidgetProps {
                                KeyName = "GalleryID", KeyValue = gGallery.ToString()
                            });

                            newWidget.SaveDefaultControlProperties(lstProps);

                            newWidget.Save();
                        }
                    }
                }
            }
        }