Beispiel #1
0
        public Subject GetCurrentSubject(PageItem pageItem, HttpContextBase httpContext)
        {
            var subjectId = httpContext.Request.RawUrl;

            if (httpContext.Items["Comments.SubjectId"] != null)
            {
                subjectId = httpContext.Items["Comments.SubjectId"].ToString();
            }

            var subject = new Subject
            {
                Id = subjectId
            };

            var page = httpContext.CurrentHandler as Page;
            if (page != null)
            {
                subject.Title = page.Title;
            }

            if (httpContext.Items["Comments.SubjectTitle"] != null)
            {
                subject.Title = httpContext.Items["Comments.SubjectTitle"].ToString();
            }

            if (httpContext.Items["Comments.SubjectType"] != null)
            {
                subject.Type = httpContext.Items["Comments.SubjectType"].ToString();
            }

            return subject;
        }
        private void GetThePath (PageItem pi)
        {
            ItemFinalList.Add(pi);

            if (pi.parentId != null)
            {
                GetThePath(ItemAllChildren.Where(x => x.pageId == pi.parentId).First());
            }
        }
Beispiel #3
0
        public static string GetPageUrl(CultureInfo targetCulture, PageItem page)
        {
            if (targetCulture != null)
            {
                return GetPageUrl(targetCulture.Name, page);
            }

            return GetPageUrl(String.Empty, page);
        }
Beispiel #4
0
        private string GetMenuText(PageItem page)
        {
            if (!String.IsNullOrEmpty(page.MenuText))
            {
                return page.MenuText;
            }

            return page.DisplayName;
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageItem = NhSession.Get<PageItem>(PageId);

            if (!IsPostBack)
            {
                BindForm();
            }
        }
Beispiel #6
0
        public DesignerLayoutService(PageItem currentPage, CultureInfo designerCulture, IEnumerable<LocatedWidgetViewModel> widgets)
        {
            Require.NotNull(currentPage, "currentPage");
            Require.NotNull(designerCulture, "designerCulture");
            Require.NotNull(widgets, "widgets");

            this.CurrentPage = currentPage;
            this.DesignerCulture = designerCulture;
            this.Widgets = new List<LocatedWidgetViewModel>(widgets);
        }
        private bool RenderItem(PageItem item, int span)
        {
            var renderText = true;

            _writer.Append($"<a title='{item.Index}'");

            if (!string.IsNullOrEmpty(item.Href))
            {
                _writer.Append($" href='{item.Href}'");
            }

            if (!string.IsNullOrEmpty(item.Target))
            {
                _writer.Append($" target='{item.Target}'");
            }

            if (item.Color >= 0)
            {
                _writer.Append($" class='c{item.Color}'");
            }

            if (item.Span > 0)
            {
                var s = item.Span + (span < 0 ? span : 0);

                if (s < item.Span && Math.Abs(span) > s)
                {
                    renderText = false;
                }

                _writer.Append($" style='min-width: {BLOCK_WIDTH * (s + 1) + s * 2}px'");
            }

            if (!string.IsNullOrEmpty(item.Caption))
            {
                _writer.Append($" st='{item.Caption}'");
            }

            if (!string.IsNullOrEmpty(item.Id))
            {
                _writer.Append($" id='{item.Id}'");
            }

            _writer.Append(">");
            _writer.Append(renderText ? item.Text ?? item.Value.ToString() : "&#8594;");
            _writer.Append("</a>");

            return(renderText);
        }
        internal virtual void WriteEndItemToStream(RPLWriter rplWriter, List <PageItem> itemsOnPage)
        {
            if (rplWriter == null)
            {
                return;
            }
            BinaryWriter binaryWriter = rplWriter.BinaryWriter;
            int          num          = itemsOnPage?.Count ?? 0;
            long         value        = 0L;

            RPLItemMeasurement[] array = null;
            if (binaryWriter != null)
            {
                value = binaryWriter.BaseStream.Position;
                binaryWriter.Write((byte)16);
                binaryWriter.Write(m_offset);
                binaryWriter.Write(num);
            }
            else
            {
                array = new RPLItemMeasurement[num];
                ((RPLContainer)m_rplElement).Children = array;
            }
            if (itemsOnPage != null)
            {
                for (int i = 0; i < num; i++)
                {
                    PageItem pageItem = itemsOnPage[i];
                    if (pageItem != null)
                    {
                        if (binaryWriter != null)
                        {
                            pageItem.WritePageItemSizes(binaryWriter);
                        }
                        else
                        {
                            array[i] = pageItem.WritePageItemSizes();
                        }
                    }
                }
            }
            if (binaryWriter != null)
            {
                m_offset = binaryWriter.BaseStream.Position;
                binaryWriter.Write((byte)254);
                binaryWriter.Write(value);
                binaryWriter.Write(byte.MaxValue);
            }
        }
Beispiel #9
0
        public void DeletePage(PageItem page)
        {
            var portalSettings = PortalController.Instance.GetCurrentPortalSettings();
            var tab            = TabController.Instance.GetTab(page.Id, portalSettings.PortalId);

            if (tab == null)
            {
                throw new PageNotFoundException();
            }

            if (TabPermissionController.CanDeletePage(tab))
            {
                TabController.Instance.SoftDeleteTab(tab.TabID, portalSettings);
            }
        }
        //
        // GET: /SysApi/
        public ActionResult Index(SysApiSearchArgs arg, int pageIndex = 1)
        {
            int      appId    = arg.AppId.ConvertTo <int>(-1);
            PageItem pageItem = new PageItem {
                PageIndex = pageIndex, PageSize = 15
            };
            SysApplicationLogic         appLogic = new SysApplicationLogic();
            List <SysApplicationEntity> listApp  = appLogic.GetSysApplicationList().ToList <SysApplicationEntity>();

            ViewBag.DictionaryApplication = listApp.ToDictionary(k => k.AppId, v => v);
            List <SysApiEntity> sysApiList = logic.GetSysApiList(appId, arg.Status, arg.ApiName, pageItem).ToList <SysApiEntity>();

            ViewBag.SysApiList = new PagedList <SysApiEntity>(sysApiList, pageItem.PageIndex, pageItem.PageSize, pageItem.TotalCount);
            return(View(arg));
        }
Beispiel #11
0
        public virtual void TestFixtureSetUp()
        {
            var engine = new ContentEngine(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None),
                                           "n2nodb",
                                           new WindsorServiceContainer(),
                                           EventBroker.Instance,
                                           new ContainerConfigurer());

            N2.Context.Replace(engine);
            engine.Initialize();
            engine.Host.CurrentSite.RootItemID  = 1;
            engine.Host.CurrentSite.StartPageID = 1;

            page = CreateOneItem <PageItem>(1, "page", null);
        }
 private void tbFind_TextChanged(object sender, EventArgs e)
 {
     if (!DesignMode)
     {
         lStatus.Text           = "";
         position               = null; // reset position when edit changes?? todo not really
         _Viewer.HighlightText  = tbFind.Text;
         ckHighlightAll.Enabled = bFindNext.Enabled = bFindPrevious.Enabled =
             tbFind.Text.Length > 0;
         if (tbFind.Text.Length > 0)
         {
             FindNext();
         }
     }
 }
        private int getPageOrder(int idToSearch)
        {
            List <PageItem> pages = new PagesDB().GetPagesFlat(this.PortalSettings.PortalID);

            while (pages.Count > 0)
            {
                PageItem page = pages.First <PageItem>();
                pages.Remove(page);
                if (page.ID == idToSearch)
                {
                    return(page.Order);
                }
            }
            return(-1);
        }
Beispiel #14
0
 public bool IsIdentical(TPageCollection otherPages)
 {
     if (otherPages == null || this.Count != otherPages.Count)
     {
         return(false);
     }
     foreach (TPage PageItem in this)
     {
         if (!PageItem.IsIdentical(otherPages.Find(p => p.Name == PageItem.Name)))
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #15
0
        /// <summary>
        /// The AddPage_Click server event handler is used
        ///   to add a new tab for this portal
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"/> instance containing the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected void AddPageClick(object sender, EventArgs e)
        {
            if (this.Settings["TAB_VERSION"] == null)
            {
                return;
            }

            if (this.Settings["TAB_VERSION"].ToString().ToLowerInvariant() == "true")
            {
                // Use Old Version
                // New tabs go to the end of the list
                var t = new PageItem
                {
                    // Just in case it comes to be empty
                    Name  = General.GetString("TAB_NAME", "New Page Name"),
                    ID    = -1,
                    Order = 990000
                };
                this.PortalPages.Add(t);

                // write tab to database
                var tabs = new PagesDB();
                t.ID = tabs.AddPage(this.PortalSettings.PortalID, t.Name, t.Order);

                // Reset the order numbers for the tabs within the list
                this.OrderPages();

                // Clear SiteMaps Cache
                AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();

                // Redirect to edit page
                // 3_aug_2004 Cory Isakson added returntabid so that PageLayout could return to the tab it was called from.
                // added mID by Mario Endara <*****@*****.**> to support security check (2004/11/09)
                this.Response.Redirect(
                    HttpUrlBuilder.BuildUrl(
                        "~/DesktopModules/CoreModules/Pages/PageLayout.aspx",
                        t.ID,
                        "mID=" + this.ModuleID + "&returntabid=" + this.Page.PageID));
            }
            else
            {
                // Redirect to New Form - Mike Stone 19/12/2004
                this.Response.Redirect(
                    HttpUrlBuilder.BuildUrl(
                        "~/DesktopModules/CoreModules/Pages/AddPage.aspx",
                        "mID=" + this.ModuleID + "&returntabid=" + this.Page.PageID));
            }
        }
        void Open(PageItem Page)
        {
            try
            {
                OpenFileDialog dlg = new OpenFileDialog()
                {
                    FileName    = "",
                    Filter      = "All Files (*.*)|*.*|Xml Files (*.xml)|*.xml",
                    FilterIndex = 2
                };

                if (dlg.ShowDialog() == true)
                {
                    bool IsPrinting       = Page.IsPrinting;
                    bool IsGridVisible    = Page.IsGridVisible;
                    bool IsDeletedVisible = Page.IsDeletedVisible;

                    using (TextReader reader = new StreamReader(dlg.FileName))
                    {
                        XmlSerializer serializer = new XmlSerializer(Page.GetType(), Page.GetTypes());

                        PageItem newPage = new PageItem();
                        newPage = (PageItem)serializer.Deserialize(reader);

                        // restore not serialized valules
                        newPage.IsPrinting       = IsPrinting;
                        newPage.IsGridVisible    = IsGridVisible;
                        newPage.IsDeletedVisible = IsDeletedVisible;

                        // newPage.Signals = ??


                        // get all DataBlockLogicItem items
                        //var list = from item in newPage.Items
                        //           where item is DataBlockLogicItem
                        //           select item;


                        this.DataContext = newPage;
                        Page             = null;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
 /// <summary>
 /// Maps an action to a result model object.
 /// </summary>
 /// <param name="portal">The action to map.</param>
 /// <returns>
 /// The mapped action.
 /// </returns>
 public static PageViewModel ToPageViewModel(PageItem page)
 {
     return(page == null ? null : new PageViewModel
     {
         Id = page.Id,
         Uri = page.Uri,
         Name = page.Name,
         Description = page.Description,
         HtmlContent = page.HtmlContent,
         StyleContent = page.StyleContent,
         ModifiedDate = page.ModifiedDate,
         Portal = ToResourceItem(page.Portal),
         Master = ToResourceItem(page.Master),
         Children = ToPageListViewModel(page.Children.OfType <PageItem>())
     });
 }
Beispiel #18
0
 internal void Reset()
 {
     m_header           = null;
     m_footer           = null;
     m_rplReportSection = null;
     m_bodyOffset       = 0L;
     m_offset           = 0L;
     m_itemRenderSizes  = null;
     m_sectionIndex     = -1;
     m_bodyHelper       = null;
     m_itemsOnPage      = 0;
     if (Done)
     {
         m_body = null;
     }
 }
Beispiel #19
0
        internal override void WriteCustomNonSharedItemProps(RPLElementProps nonSharedProps, PageContext pageContext)
        {
            Microsoft.ReportingServices.OnDemandReportRendering.Image image = (Microsoft.ReportingServices.OnDemandReportRendering.Image)m_source;
            ImageInstance imageInstance = (ImageInstance)image.Instance;
            RPLImageProps rPLImageProps = (RPLImageProps)nonSharedProps;

            if (m_invalidImage)
            {
                WriteInvalidImage(rPLImageProps, pageContext, m_imageProps);
            }
            else
            {
                WriteImage(imageInstance, null, rPLImageProps, pageContext, m_imageProps);
            }
            rPLImageProps.ActionInfo = PageItem.WriteActionInfo(image.ActionInfo);
        }
Beispiel #20
0
        public override void WriteCustomNonSharedItemProps(RPLElementProps nonSharedProps, PageContext pageContext)
        {
            AspNetCore.ReportingServices.OnDemandReportRendering.Image image = (AspNetCore.ReportingServices.OnDemandReportRendering.Image)base.m_source;
            ImageInstance imageInstance = (ImageInstance)image.Instance;
            RPLImageProps rPLImageProps = (RPLImageProps)nonSharedProps;

            if (this.m_invalidImage)
            {
                base.WriteInvalidImage(rPLImageProps, pageContext, this.m_imageProps);
            }
            else
            {
                base.WriteImage(imageInstance, null, rPLImageProps, pageContext, this.m_imageProps);
            }
            rPLImageProps.ActionInfo = PageItem.WriteActionInfo(image.ActionInfo);
        }
 public void Reset()
 {
     this.m_header           = null;
     this.m_footer           = null;
     this.m_rplReportSection = null;
     this.m_bodyOffset       = 0L;
     this.m_offset           = 0L;
     this.m_itemRenderSizes  = null;
     this.m_sectionIndex     = -1;
     this.m_bodyHelper       = null;
     this.m_itemsOnPage      = 0;
     if (this.Done)
     {
         this.m_body = null;
     }
 }
        /// <summary>
        /// This user control will render the breadcrumb navigation for the current tab.
        /// Ver. 1.0 - 24. dec 2002 - First realase by Cory Isakson
        /// </summary>
        /// <param name="pageID">ID of the page</param>
        /// <returns></returns>
        public ArrayList GetPageCrumbs(int pageID)
        {
            // Create Instance of Connection and Command Object
            using (SqlConnection myConnection = Config.SqlConnectionString)
            {
                using (SqlCommand myCommand = new SqlCommand("rb_GetTabCrumbs", myConnection))
                {
                    // Mark the Command as a SPROC
                    myCommand.CommandType = CommandType.StoredProcedure;
                    // Add Parameters to SPROC
                    SqlParameter parameterPageID = new SqlParameter(strPageID, SqlDbType.Int, 4);
                    parameterPageID.Value = pageID;
                    myCommand.Parameters.Add(parameterPageID);
                    SqlParameter parameterCrumbs = new SqlParameter("@CrumbsXML", SqlDbType.NVarChar, 4000);
                    parameterCrumbs.Direction = ParameterDirection.Output;
                    myCommand.Parameters.Add(parameterCrumbs);
                    // Execute the command
                    myConnection.Open();

                    try
                    {
                        myCommand.ExecuteNonQuery();
                    }

                    finally
                    {
                        myConnection.Close();
                    }
                    // Build a Hashtable from the XML string returned
                    ArrayList   Crumbs   = new ArrayList();
                    XmlDocument CrumbXML = new XmlDocument();
                    CrumbXML.LoadXml(parameterCrumbs.Value.ToString().Replace("&", "&amp;"));

                    //Iterate through the Crumbs XML
                    foreach (XmlNode node in CrumbXML.FirstChild.ChildNodes)
                    {
                        PageItem tab = new PageItem();
                        tab.ID    = Int16.Parse(node.Attributes.GetNamedItem("tabID").Value);
                        tab.Name  = node.InnerText;
                        tab.Order = Int16.Parse(node.Attributes.GetNamedItem("level").Value);
                        Crumbs.Add(tab);
                    }
                    //Return the Crumb Page Items as an arraylist
                    return(Crumbs);
                }
            }
        }
        protected override bool OnButtonPressEvent(Gdk.EventButton ev)
        {
            if (ev.Button == 3)
            {
                var hitAreaItem = hitList.FirstOrDefault(x => x.Contains(new PointD((double)ev.X, (double)ev.Y)));
                if (hitAreaItem == null)
                {
                    return(false);
                }

                string text;
                if (hitAreaItem.pi is PageText)
                {
                    text = (hitAreaItem.pi as PageText).Text;
                }
                else if (hitAreaItem.pi is PageTextHtml)
                {
                    text = (hitAreaItem.pi as PageTextHtml).Text;
                }
                else
                {
                    return(false);
                }
                selectedItem = hitAreaItem.pi;
                QueueDraw();
                GdkWindow.Invalidate();
                Menu     popupMenu = new Menu();
                MenuItem menuItem  = new MenuItem("Копировать");
                menuItem.Activated += (sender, e) => {
                    Gtk.Clipboard clipboard = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));
                    clipboard.Text = text;
                    selectedItem   = null;
                    QueueDraw();
                    GdkWindow.Invalidate();
                };
                popupMenu.Add(menuItem);
                popupMenu.ShowAll();
                popupMenu.Popup();
                popupMenu.Hidden += (sender, e) => {
                    selectedItem = null;
                    QueueDraw();
                    GdkWindow.Invalidate();
                };
            }
            // Insert button press handling code here.
            return(base.OnButtonPressEvent(ev));
        }
Beispiel #24
0
        private static void AddTextBox(Control control, Page page, PageItem item, ref int offsetY)
        {
            offsetY += 8;
            var left = 16;

            if (item.IsRequired)
            {
                var lblRequied = new Label()
                {
                    Text      = "*",
                    Location  = new Point(left, offsetY),
                    ForeColor = Color.Red,
                    Size      = new Size(15, 15),
                    TextAlign = ContentAlignment.MiddleLeft
                };
                left += lblRequied.Width;
                control.Controls.Add(lblRequied);
            }
            var lbl = new Label()
            {
                Text      = item.Label,
                Location  = new Point(left, offsetY),
                Height    = 15,
                AutoSize  = true,
                TextAlign = ContentAlignment.MiddleLeft
            };

            offsetY += lbl.Height;
            control.Controls.Add(lbl);
            offsetY += 4;
            var txt = new TextBox()
            {
                Text      = item.DefaultValue,
                Location  = new Point(16, offsetY),
                Width     = control.Width - 32,
                Anchor    = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
                TextAlign = HorizontalAlignment.Left,
            };

            txt.TextChanged += (sender, args) =>
            {
                item.Value = txt.Text.Trim();
                page.Init();
            };
            offsetY += txt.Height;
            control.Controls.Add(txt);
        }
        //Add Indah Fuldner 25.04.2003 (With assumtion that the rootlevel tab has ParentPageID = 0)
        /// <summary>
        /// Gets the bread crumbs.
        /// </summary>
        /// <param name="tab">The tab.</param>
        /// <param name="tabList">The tab list.</param>
        /// <returns></returns>
        private ArrayList GetBreadCrumbs(PageSettings tab, ArrayList tabList)
        {
            int parentPageID = tab.PageID;
            //string test=tab.PageName;
            int test = tab.PageID;

            ArrayList _breadCrumbsText = new ArrayList();

            PageItem myPageItem = new PageItem();

            myPageItem.ID    = tab.PageID;
            myPageItem.Name  = tab.PageName;
            myPageItem.Order = tab.PageOrder;

            _breadCrumbsText.Add(myPageItem);

            //Search for the root tab in current array
            PageStripDetails rootTab;

            for (int i = 0; i < tabList.Count; i++)
            {
                rootTab = (PageStripDetails)tabList[i];

                if (rootTab.PageID == parentPageID)
                {
                    parentPageID = rootTab.ParentPageID;
                    if (test != rootTab.PageID) //(test!=rootTab.PageName)
                    {
                        PageItem myItem = new PageItem();
                        myItem.ID    = rootTab.PageID;
                        myItem.Name  = rootTab.PageName;
                        myItem.Order = rootTab.PageOrder;
                        _breadCrumbsText.Add(myItem);
                    }
                    if (parentPageID != 0)
                    {
                        i = -1;
                    }
                    else
                    {
                        return(_breadCrumbsText);
                    }
                }
            }
            return(_breadCrumbsText);
        }
        public void CanRender_TreeNode_WithChildNode()
        {
            PageItem root = CreateOneItem <PageItem>(1, "root", null);
            PageItem item = CreateOneItem <PageItem>(1, "item", root);
            TreeNode tn   = new TreeNode(root);

            tn.Controls.Add(new TreeNode(item));

            StringBuilder sb = new StringBuilder();

            using (HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(sb)))
            {
                tn.RenderControl(writer);
            }

            Assert.AreEqual("<ul><li><a href=\"/root.aspx\">root</a><ul><li><a href=\"/item.aspx\">item</a></li></ul></li></ul>", sb.ToString());
        }
        public HttpResponseMessage DeletePage(PageItem page)
        {
            if (!_securityService.CanDeletePage(page.Id))
            {
                return(GetForbiddenResponse());
            }

            try
            {
                _pagesController.DeletePage(page);
                return(Request.CreateResponse(HttpStatusCode.OK, new { Status = 0 }));
            }
            catch (PageNotFoundException)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
        }
Beispiel #28
0
        // Finds the page which is clicked by the mouse.
        public int FindPage(int offsetX, int offsetY)
        {
            int lastIndex  = QuickSearch(offsetY, false);
            int firstIndex = GetFirstPageInRow(lastIndex);

            // find exact page
            for (int i = firstIndex; i <= lastIndex; i++)
            {
                PageItem item = this[i];
                if (new Rectangle(item.OffsetX, item.OffsetY, item.Width, item.Height).Contains(
                        new Point(offsetX, offsetY)))
                {
                    return(i);
                }
            }
            return(firstIndex);
        }
Beispiel #29
0
        public ActionResult EditForm(int?id)
        {
            var obj = new PageItem();

            var listTree = userPageRepository.GetListForTree <object>();

            if (id.HasValue)
            {
                obj = userPageRepository.GetItemById <PageItem>(id.Value);
            }

            return(Json(new
            {
                data = obj,
                listTree = listTree
            }, JsonRequestBehavior.AllowGet));
        }
        void Print(PageItem Page)
        {
            try
            {
                Page.IsGridVisible = false;
                Page.IsPrinting    = true;

                ContentControl cc = new ContentControl();
                cc.ContentTemplate = this.FindResource("LogicPageItemTemplate1") as DataTemplate;
                cc.Content         = Page;

                PrintDialog dlg = new System.Windows.Controls.PrintDialog();
                dlg.PrintQueue  = LocalPrintServer.GetDefaultPrintQueue();
                dlg.PrintTicket = dlg.PrintQueue.DefaultPrintTicket;
                dlg.PrintTicket.PageOrientation = PageOrientation.Landscape;
                dlg.PrintTicket.OutputQuality   = OutputQuality.High;
                //dlg.PrintTicket.OutputColor = OutputColor.Monochrome;
                dlg.PrintTicket.TrueTypeFontMode = TrueTypeFontMode.DownloadAsNativeTrueTypeFont;

                Nullable <bool> result = dlg.ShowDialog();
                if (result == true)
                {
                    System.Printing.PrintCapabilities capabilities = dlg.PrintQueue.GetPrintCapabilities(dlg.PrintTicket);

                    double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / UnitConverter.CmToDip(42.0),
                                            capabilities.PageImageableArea.ExtentHeight / UnitConverter.CmToDip(29.7));

                    cc.LayoutTransform = new ScaleTransform(scale, scale);

                    Size sz = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);

                    cc.Measure(sz);
                    cc.Arrange(new Rect(new Point(capabilities.PageImageableArea.OriginWidth, capabilities.PageImageableArea.OriginHeight), sz));
                    cc.UpdateLayout();

                    dlg.PrintVisual(cc, "Page");
                }

                Page.IsGridVisible = true;
                Page.IsPrinting    = false;
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
Beispiel #31
0
        public void Drop(object data, object target, Point point)
        {
            var item = new PageItem
            {
                Name   = Guid.NewGuid().ToString(),
                X      = point.X,
                Y      = point.Y,
                Width  = 50,
                Height = 22
            };

            _currentPage.Add(item);

            IoC.Get <IProjectManager>().CurrentProject.Add(_currentPage);

            NotifyOfPropertyChange((() => Items));
        }
 private void RdlViewerFind_VisibleChanged(object sender, EventArgs e)
 {
     lStatus.Text = "";
     if (this.Visible)
     {
         _Viewer.HighlightText = tbFind.Text;
         tbFind.Focus();
         FindNext();         // and go find the contents of the textbox
     }
     else
     {   // turn off any highlighting when find control not visible
         _Viewer.HighlightPageItem = position = null;
         _Viewer.HighlightText     = null;
         _Viewer.HighlightAll      = false;
         ckHighlightAll.Checked    = false;
     }
 }
Beispiel #33
0
        public override void CalculateRepeatWithPage(RPLWriter rplWriter, PageContext pageContext, PageItem[] siblings)
        {
            base.AdjustOriginFromItemsAbove(siblings, null);
            ItemSizes itemSizes = null;

            if (base.ResolveItemHiddenState(rplWriter, null, pageContext, true, ref itemSizes))
            {
                this.CalculateHiddenItemRenderSize(pageContext, true);
            }
            else
            {
                AspNetCore.ReportingServices.OnDemandReportRendering.Rectangle rectangle = (AspNetCore.ReportingServices.OnDemandReportRendering.Rectangle)base.m_source;
                this.m_staticItem   = base.CreateChildren(rectangle.ReportItemCollection, pageContext, rectangle.Width.ToMillimeters(), rectangle.Height.ToMillimeters(), rectangle.IsSimple);
                base.m_itemsCreated = true;
                if (itemSizes != null)
                {
                    itemSizes.SetPaddings(base.m_itemPageSizes.PaddingRight, base.m_itemPageSizes.PaddingBottom);
                }
                if (base.m_children != null)
                {
                    double   num      = base.m_itemPageSizes.PaddingBottom;
                    PageItem pageItem = null;
                    for (int i = 0; i < base.m_children.Length; i++)
                    {
                        pageItem = base.m_children[i];
                        if (pageItem != null)
                        {
                            pageItem.CalculateRepeatWithPage(rplWriter, pageContext, base.m_children);
                            num = Math.Max(num, pageItem.ItemPageSizes.Bottom + base.m_itemPageSizes.PaddingBottom);
                        }
                    }
                    if (itemSizes != null)
                    {
                        base.ConsumeWhitespaceVertical(itemSizes, num, pageContext);
                    }
                    else
                    {
                        base.ConsumeWhitespaceVertical(base.m_itemPageSizes, num, pageContext);
                    }
                }
                base.m_itemState = State.OnPage;
                this.CreateItemRenderSizes(itemSizes, pageContext, true);
                base.CalculateRepeatWithRenderSizes(pageContext);
            }
        }
Beispiel #34
0
        public void Move(PageItem from, PageItem to, DropPosition dropPosition)
        {
            var pageCache = PageCache.From(_session);

            if (dropPosition == DropPosition.Over)
            {
                to.Pages.Add(from);
                to.Pages.AdjustOrders(false);
                return;
            }

            if (dropPosition == DropPosition.Before)
            {
                var pages = new PageItemCollectionWrapper(to.Parent == null ? pageCache.RootPages : to.Parent.Pages);

                if (from.IsSiblingOf(to))
                {
                    pages.MoveBefore(to, from);
                }
                else
                {
                    pages.AddBefore(to, from);
                }

                pages.AdjustOrders(false);

                return;
            }

            if (dropPosition == DropPosition.After)
            {
                var pages = new PageItemCollectionWrapper(to.Parent == null ? pageCache.RootPages : to.Parent.Pages);

                if (from.IsSiblingOf(to))
                {
                    pages.MoveAfter(to, from);
                }
                else
                {
                    pages.AddAfter(to, from);
                }

                pages.AdjustOrders(false);
            }
        }
Beispiel #35
0
        /// <summary>
        /// Gets the pages parent.
        /// </summary>
        /// <param name="portalId">
        /// The portal ID.
        /// </param>
        /// <param name="pageId">
        /// The page ID.
        /// </param>
        /// <returns>
        /// A System.Data.SqlClient.SqlDataReader value...
        /// </returns>
        public IList <PageItem> GetPagesParent(int portalId, int pageId)
        {
            // Create Instance of Connection and Command Object
            var connection = Config.SqlConnectionString;
            var sqlCommand = new SqlCommand("rb_GetTabsParent", connection)
            {
                CommandType = CommandType.StoredProcedure
            };

            // Mark the Command as a SPROC
            // Add Parameters to SPROC
            var parameterPortalId = new SqlParameter(StrPortalId, SqlDbType.Int, 4)
            {
                Value = portalId
            };

            sqlCommand.Parameters.Add(parameterPortalId);
            var parameterPageId = new SqlParameter(StrPageId, SqlDbType.Int, 4)
            {
                Value = pageId
            };

            sqlCommand.Parameters.Add(parameterPageId);

            // Execute the command
            connection.Open();
            var dr = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);

            IList <PageItem> result = new List <PageItem>();

            while (dr.Read())
            {
                var item = new PageItem {
                    ID = Convert.ToInt32(dr["PageID"]), Name = (string)dr["PageName"]
                };
                result.Add(item);
            }
            // Added by Ashish - Connection Pool Issue
            if (dr != null)
            {
                dr.Close();
            }

            return(result);
        }
Beispiel #36
0
        protected SiteProvidingItem CreateTheItemTree()
        {
            int id = 22;
            SiteProvidingItem rootItem = CreateOneItem <SiteProvidingItem>(++id, id.ToString(), null);
            SiteProvidingItem site1    = CreateOneItem <SiteProvidingItem>(++id, id.ToString(), rootItem);
            SiteProvidingItem site2    = CreateOneItem <SiteProvidingItem>(++id, id.ToString(), rootItem);
            PageItem          item3    = CreateOneItem <PageItem>(++id, id.ToString(), rootItem);
            PageItem          item4    = CreateOneItem <PageItem>(++id, id.ToString(), rootItem);
            PageItem          item1_1  = CreateOneItem <PageItem>(++id, id.ToString(), site1);
            PageItem          item1_2  = CreateOneItem <PageItem>(++id, id.ToString(), site1);
            PageItem          item2_1  = CreateOneItem <PageItem>(++id, id.ToString(), site2);
            PageItem          item3_1  = CreateOneItem <PageItem>(++id, id.ToString(), item3);
            PageItem          item3_2  = CreateOneItem <PageItem>(++id, id.ToString(), item3);
            SiteProvidingItem site1_1  = CreateOneItem <SiteProvidingItem>(++id, id.ToString(), site1);
            SiteProvidingItem site4_1  = CreateOneItem <SiteProvidingItem>(++id, id.ToString(), item4);

            return(rootItem);
        }
Beispiel #37
0
        public void RevertsToRewrittenUrl_WhenNoParentStartPage_InApplication()
        {
            string previousPath = Url.ApplicationPath;

            Url.ApplicationPath = "/HelloWorld/";
            try
            {
                PageItem page = CreateOneItem <PageItem>(10, "offsidepage", null);

                string url = parser.BuildUrl(page);

                Assert.AreEqual("/HelloWorld/Default.aspx?page=10", url);
            }
            finally
            {
                Url.ApplicationPath = previousPath;
            }
        }
Beispiel #38
0
        public PageItemView(PageItem page)
        {
            Require.NotNull(page, "page");

            Id = page.Id;
            DisplayName = page.DisplayName;
            UrlSegment = page.UrlSegment;
            Layout = page.Layout.DisplayName.Localize();
            LayoutPreviewImage = page.Layout.PreviewImageVirtualPath;
            AspxVirtualPath = page.Layout.AspxVirtualPath;
            PagePath = page.GetPagePath();
            IsDeletable = page.IsDeletable;
            Skin = String.Empty;
            SkinPreviewImage = String.Empty;

            if (page.Skin != null)
            {
                Skin = page.Skin.DisplayName.Localize();
                SkinPreviewImage = page.Skin.PreviewImageVirtualPath;
            }

            CreatedTime = page.CreatedTime.ToString(CultureInfo.CurrentCulture);
            LastModifiedTime = page.ModifiedTime.ToString(CultureInfo.CurrentCulture);
        }
Beispiel #39
0
        public static string GetNodeImageUrl(PageItem page)
        {
            string fileName = page.Published ? "icon-page-online.png" : "icon-page-offline.png";

            return UrlUtil.ToAbsoluteHtmlPath(UrlUtil.Combine(AdminSession.Current.Skin.VirtualPath, "Images/" + fileName));
        }
        /// <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;
        }
Beispiel #41
0
        private string GetMenuUrl(PageItem page)
        {
            if (_pageCache.Homepage != null && page.Id == _pageCache.Homepage.Id)
            {
                return FrontendEnvironment.GetRootUrl(Culture);
            }

            return FrontendEnvironment.GetPageUrl(Culture, page);
        }
Beispiel #42
0
 public LocatedWidget(PageItem page)
 {
     Require.NotNull(page, "page");
     Page = page;
     Attributes = new EntityAttributeCollection();
 }
        private void UpdatePageInformation()
        {
            try
            {
                this.Pages = new List<PageItem>();
                List<iFormBuilderAPI.Page> getPages = iFormAPI.GetAllPagesInProfile();
                if (getPages == null)
                    return;

                PageItem pg;
                foreach (iFormBuilderAPI.Page page in getPages)
                {
                    pg = new PageItem(page, page.NAME);
                    this.Pages.Add(pg);
                }
            }
            catch
            {
                return;
            }
        }
Beispiel #44
0
        public static string GetPageUrl(string targetCulture, PageItem page)
        {
            Require.NotNull(page, "page");

            return GetFullUrl(targetCulture, page.GetPagePath());
        }
Beispiel #45
0
 static TreeNode CreateNode(PageItem page)
 {
     return new TreeNode
     {
         Text = String.Format("<span id='page-{0}' class='node-text'>{1}</span><input class='pageinfo' type='hidden' value='{2}' />", page.Id, page.DisplayName, new PageItemView(page).ToJson().Replace("\"", "&quot;")),
         Value = page.Id.ToString(),
         Encoded = false,
         Expanded = false,
         ImageUrl = GetNodeImageUrl(page)
     };
 }
Beispiel #46
0
        /// <summary>
        /// Gets the pages parent.
        /// </summary>
        /// <param name="portalId">
        /// The portal ID.
        /// </param>
        /// <param name="pageId">
        /// The page ID.
        /// </param>
        /// <returns>
        /// A System.Data.SqlClient.SqlDataReader value...
        /// </returns>
        public IList<PageItem> GetPagesParent(int portalId, int pageId)
        {
            // Create Instance of Connection and Command Object
            var connection = Config.SqlConnectionString;
            var sqlCommand = new SqlCommand("rb_GetTabsParent", connection)
                {
                    CommandType = CommandType.StoredProcedure
                };

            // Mark the Command as a SPROC
            // Add Parameters to SPROC
            var parameterPortalId = new SqlParameter(StrPortalId, SqlDbType.Int, 4) { Value = portalId };
            sqlCommand.Parameters.Add(parameterPortalId);
            var parameterPageId = new SqlParameter(StrPageId, SqlDbType.Int, 4) { Value = pageId };
            sqlCommand.Parameters.Add(parameterPageId);

            // Execute the command
            connection.Open();
            var dr = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);

            IList<PageItem> result = new List<PageItem>();

            while (dr.Read())
            {
                var item = new PageItem { ID = Convert.ToInt32(dr["PageID"]), Name = (string)dr["PageName"] };
                result.Add(item);
            }

            return result;
        }
Beispiel #47
0
        /// <summary>
        /// Gets the pages flat.
        /// </summary>
        /// <param name="portalId">
        /// The portal ID.
        /// </param>
        /// <returns>
        /// A list of page items.
        /// </returns>
        public List<PageItem> GetPagesFlat(int portalId)
        {
            // Create Instance of Connection and Command Object
            using (var connection = Config.SqlConnectionString)
            using (var sqlCommand = new SqlCommand("rb_GetTabsFlat", connection))
            {
                // Mark the Command as a SPROC
                sqlCommand.CommandType = CommandType.StoredProcedure;

                // Add Parameters to SPROC
                var parameterPortalId = new SqlParameter("@PortalID", SqlDbType.Int, 4) { Value = portalId };
                sqlCommand.Parameters.Add(parameterPortalId);

                // Execute the command
                connection.Open();
                var result = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
                var desktopPages = new List<PageItem>();

                // Read the result set
                try
                {
                    while (result.Read())
                    {
                        var tabItem = new PageItem
                            {
                                ID = (int)result["PageID"],
                                Name = (string)result["PageName"],
                                Order = (int)result["PageOrder"],
                                NestLevel = (int)result["NestLevel"]
                            };
                        desktopPages.Add(tabItem);
                    }
                }
                finally
                {
                    result.Close(); // by Manu, fixed bug 807858
                }

                return desktopPages;
            }
        }
        /// <summary>
        /// Gets the bread crumbs.
        /// </summary>
        /// <param name="tab">The tab.</param>
        /// <param name="tabList">The tab list.</param>
        /// <returns></returns>
        private ArrayList GetBreadCrumbs(PageSettings tab, ArrayList tabList)
        {
            int parentTabID = tab.PageID;
            int test = tab.PageID;

            ArrayList _breadCrumbsText = new ArrayList();

            PageItem myTabItem = new PageItem();
            myTabItem.ID = tab.PageID;
            myTabItem.Name = tab.PageName;
            myTabItem.Order = tab.PageOrder;

            _breadCrumbsText.Add(myTabItem);

            //Search for the root tab in current array
            PageStripDetails rootTab;

            for (int i = 0; i < tabList.Count; i++)
            {
                rootTab = (PageStripDetails) tabList[i];

                if (rootTab.PageID == parentTabID)
                {
                    parentTabID = rootTab.ParentPageID;
                    if (test != rootTab.PageID)
                    {
                        PageItem myItem = new PageItem();
                        myItem.ID = rootTab.PageID;
                        myItem.Name = rootTab.PageName;
                        myItem.Order = rootTab.PageOrder;
                        _breadCrumbsText.Add(myItem);
                    }
                    if (parentTabID != 0)
                        i = -1;
                    else
                        return _breadCrumbsText;
                }
            }
            return _breadCrumbsText;
        }
Beispiel #49
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (!IsValid)
            {
                return;
            }

            PageItem page = CurrentPage;
            if (page == null)
            {
                page = new PageItem(ParentPage);
            }

            page.DisplayName = Name.Text.Trim();
            page.UrlSegment = UrlSegment.Text.Trim();
            page.BindedDomains = BindedDomains.Text.Trim();
            page.VisibleInMenu = VisibleInMenu.Checked;
            page.Published = Published.Checked;
            page.UpdateLayout(TemplateManager.FindLayout(CurrentLayout.Text));

            page.UniqueName = PageUniqueName.Text.Trim();
            page.IsDeletable = Deletable.Checked;

            if (CurrentSkin.Text.Length > 0)
            {
                page.Skin = TemplateManager.FindSkin(CurrentSkin.Text);
            }
            else
            {
                page.Skin = null;
            }

            if (!IsEditing)
            {
                if (ParentPage != null)
                {
                    ParentPage.Pages.Add(page);
                    ParentPage.Pages.AdjustOrders(false);
                }
                else
                {
                    var rootPages = PageCache.From(NhSession).RootPages;

                    if (rootPages.Any())
                        page.Order = rootPages.Max(it => it.Order) + 1;

                    NhSession.Save(page);
                }
            }

            page.ModifiedTime = DateTime.Now;

            NhSession.Commit();

            ClientScript.RegisterStartupScript(this.GetType(), "Success",
                String.Format("onSaved('{0}', {1}, {2}, {3}, '{4}', \"{5}\");",
                    page.DisplayName,
                    page.Id,
                    ParentPageId,
                    CurrentPage == null ? "false" : "true",
                    TreeNode.GetNodeImageUrl(page),
                    new PageItemView(page).ToJson().Replace("\"", "&quot;")
                    ),
                true);
        }
Beispiel #50
0
        static void AddNode(PageItem page, TreeNode node)
        {
            foreach (var child in page.Pages)
            {
                var childNode = CreateNode(child);
                node.Nodes.Add(childNode);

                AddNode(child, childNode);
            }
        }