예제 #1
0
        private void updateLinks()
        {
            if (_documentHasPublishedVersion)
            {
                // zb-00007 #29928 : refactor
                string currentLink = library.NiceUrl(_document.Id);
                l.Text = "<a href=\"" + currentLink + "\" target=\"_blank\">" + currentLink + "</a>";

                // domains
                domainText.Text = "";
                foreach (string s in _document.Path.Split(','))
                {
                    if (int.Parse(s) > -1)
                    {
                        cms.businesslogic.web.Document dChild = new cms.businesslogic.web.Document(int.Parse(s));
                        if (dChild.Published)
                        {
                            cms.businesslogic.web.Domain[] domains = cms.businesslogic.web.Domain.GetDomainsById(int.Parse(s));
                            if (domains.Length > 0)
                            {
                                for (int i = 0; i < domains.Length; i++)
                                {
                                    string tempLink = "";
                                    if (library.NiceUrl(int.Parse(s)) == "")
                                    {
                                        tempLink = "<em>N/A</em>";
                                    }
                                    else if (int.Parse(s) != _document.Id)
                                    {
                                        string tempNiceUrl = library.NiceUrl(int.Parse(s));

                                        string niceUrl = tempNiceUrl != "/" ? currentLink.Replace(tempNiceUrl.Replace(".aspx", ""), "") : currentLink;
                                        if (!niceUrl.StartsWith("/"))
                                        {
                                            niceUrl = "/" + niceUrl;
                                        }

                                        tempLink = "http://" + domains[i].Name + niceUrl;
                                    }
                                    else
                                    {
                                        tempLink = "http://" + domains[i].Name;
                                    }

                                    domainText.Text += "<a href=\"" + tempLink + "\" target=\"_blank\">" + tempLink + "</a><br/>";
                                }
                            }
                        }
                        else
                        {
                            l.Text = "<i>" + ui.Text("content", "parentNotPublished", dChild.Text, base.getUser()) + "</i>";
                        }
                    }
                }
            }
            else
            {
                l.Text = "<i>" + ui.Text("content", "itemNotPublished", base.getUser()) + "</i>";
            }
        }
예제 #2
0
        protected void go(object sender, EventArgs e) {
            // re-create xml
            if (Request.GetItemAsString("xml") != "")
            {
                Server.ScriptTimeout = 100000;
                Services.ContentService.RePublishAll();                
            }
            else if (Request.GetItemAsString("previews") != "")
            {
                Server.ScriptTimeout = 100000;
                umbraco.cms.businesslogic.web.Document.RegeneratePreviews();
            }
            else if (Request.GetItemAsString("refreshNodes") != "")
            {
                Server.ScriptTimeout = 100000;
                System.Xml.XmlDocument xd = new System.Xml.XmlDocument();

                //store children array here because iterating over an Array object is very inneficient.
                var doc = new cms.businesslogic.web.Document(int.Parse(Request.GetItemAsString("refreshNodes")));
                var c = doc.Children;
                foreach (cms.businesslogic.web.Document d in c)
                {
                    d.XmlGenerate(xd);
                    Response.Write("<li>Creating xml for " + d.Text + "</li>");
                    Response.Flush();
                }
            }
            
            //PPH changed this to a general library call for load balancing support
            library.RefreshContent();

            p_republish.Visible = false;
            p_done.Visible = true;
        }
예제 #3
0
        private void doPublishSubs(cms.businesslogic.web.Document d)
        {
            if (d.Published || PublishUnpublishedItems.Checked)
            {
                if (d.PublishWithResult(base.getUser()))
                {
                    // Needed for supporting distributed calls
                    if (UmbracoSettings.UseDistributedCalls)
                    {
                        library.UpdateDocumentCache(d.Id);
                    }
                    else
                    {
                        documents.Add(d);
                    }

                    nodesPublished++;
                    Application.Lock();
                    Application["publishDone" + nodeId.ToString()] = nodesPublished.ToString();
                    Application.UnLock();
                    foreach (cms.businesslogic.web.Document dc in d.Children)
                    {
                        doPublishSubs(dc);
                    }
                }
                else
                {
                    BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Error, d.Id, "Publishing failed due to event cancelling the publishing");
                }
            }
        }
예제 #4
0
        private void DoPublishSubs(cms.businesslogic.web.Document d)
        {
            if (d.Published || PublishUnpublishedItems.Checked)
            {
                if (d.PublishWithResult(base.getUser()))
                {
                    // Needed for supporting distributed calls
                    if (UmbracoSettings.UseDistributedCalls)
                    {
                        library.UpdateDocumentCache(d);
                    }
                    else
                    {
                        _documents.Add(d);
                    }

                    _nodesPublished++;
                    Application.Lock();
                    Application["publishDone" + _nodeId.ToString()] = _nodesPublished.ToString();
                    Application.UnLock();
                    foreach (var dc in d.Children)
                    {
                        DoPublishSubs(dc);
                    }
                }
                else
                {
                    LogHelper.Warn <publish>("Publishing failed due to event cancelling the publishing for document " + d.Id);
                }
            }
        }
예제 #5
0
        protected void go(object sender, EventArgs e)
        {
            // re-create xml
            if (Request.GetItemAsString("xml") != "")
            {
                Server.ScriptTimeout = 100000;
                Services.ContentService.RePublishAll();
            }
            else if (Request.GetItemAsString("previews") != "")
            {
                Server.ScriptTimeout = 100000;
                umbraco.cms.businesslogic.web.Document.RegeneratePreviews();
            }
            else if (Request.GetItemAsString("refreshNodes") != "")
            {
                Server.ScriptTimeout = 100000;
                System.Xml.XmlDocument xd = new System.Xml.XmlDocument();

                //store children array here because iterating over an Array object is very inneficient.
                var doc = new cms.businesslogic.web.Document(int.Parse(Request.GetItemAsString("refreshNodes")));
                var c   = doc.Children;
                foreach (cms.businesslogic.web.Document d in c)
                {
                    d.XmlGenerate(xd);
                    Response.Write("<li>Creating xml for " + d.Text + "</li>");
                    Response.Flush();
                }
            }

            //PPH changed this to a general library call for load balancing support
            library.RefreshContent();

            p_republish.Visible = false;
            p_done.Visible      = true;
        }
예제 #6
0
        public bool Delete()
        {
            var d = new cms.businesslogic.web.Document(ParentID);

            d.delete();

            // Log
            Log.Add(LogTypes.Delete, User.GetCurrent(), d.Id, "");

            return(true);
        }
예제 #7
0
        public bool Delete()
        {
            cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(ParentID);

            // Log
            BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, User.GetCurrent(), d.Id, "");

            library.UnPublishSingleNode(d.Id);

            d.delete();

            return(true);
        }
예제 #8
0
        public override void DataBind()
        {
            base.DataBind();


            if (m_umbracoUser == null)
            {
                throw new ArgumentNullException("No User specified");
            }

            //get the logged in user's permissions
            UserPermissions currUserPermissions = new UserPermissions(UmbracoEnsuredPage.CurrentUser);

            //lookup permissions for last node selected
            int selectedNodeId = m_nodeID[m_nodeID.Length - 1];

            List <IAction> lstCurrUserActions   = currUserPermissions.GetExistingNodePermission(selectedNodeId);
            List <IAction> lstLookupUserActions = m_userPermissions.GetExistingNodePermission(selectedNodeId);

            List <IAction> lstAllActions = umbraco.BusinessLogic.Actions.Action.GetPermissionAssignable();

            //no node is selected, disable the check boxes
            if (m_nodeID[0] == -1)
            {
                ShowMessage("No node selected");
                return;
            }

            //ensure the current user has access to assign permissions.
            //if their actions list is null then it means that the node is not published.
            if (lstCurrUserActions == null || lstCurrUserActions.Contains(ActionRights.Instance))
            {
                BindExistingPermissions(lstAllActions, lstLookupUserActions);
            }
            else
            {
                ShowMessage("You do not have access to assign permissions to this node");
            }

            string names = "";

            foreach (int id in m_nodeID)
            {
                if (id > 0)
                {
                    names += new cms.businesslogic.web.Document(id).Text + ", ";
                }
            }

            lt_names.Text = names.Trim().Trim(',');
        }
예제 #9
0
        public bool Delete()
        {
            cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(ParentID);

            // Log
            BasePages.UmbracoEnsuredPage bp = new BasePages.UmbracoEnsuredPage();
            BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, bp.getUser(), d.Id, "");

            library.UnPublishSingleNode(d.Id);

            d.delete();

            return(true);
        }
예제 #10
0
 public bool Save()
 {
     cms.businesslogic.web.DocumentType dt = new cms.businesslogic.web.DocumentType(TypeID);
     cms.businesslogic.web.Document     d  = cms.businesslogic.web.Document.MakeNew(Alias, dt, BusinessLogic.User.GetUser(_userID), ParentID);
     if (d == null)
     {
         //TODO: Slace - Fix this to use the language files
         BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "Document Creation", "Document creation was canceled");
         return(false);
     }
     else
     {
         _returnUrl = "editContent.aspx?id=" + d.Id.ToString() + "&isNew=true";
         return(true);
     }
 }
예제 #11
0
        //PPH moving multiple nodes and publishing them aswell.
        private void handleChildNodes(cms.businesslogic.web.Document document)
        {
            //store children array here because iterating over an Array object is very inneficient.
            var children = document.Children;

            foreach (Document child in children.Where(child => child.Published))
            {
                child.Publish(new BusinessLogic.User(0));

                //using library.publish to support load balancing.
                library.UpdateDocumentCache(child.Id);
                if (child.HasChildren)
                {
                    handleChildNodes(child);
                }
            }
        }
        //PPH moving multiple nodes and publishing them aswell.
        private void handleChildNodes(cms.businesslogic.web.Document d)
        {
            //store children array here because iterating over an Array object is very inneficient.
            var c = d.Children;

            foreach (cms.businesslogic.web.Document cd in c)
            {
                if (cd.Published)
                {
                    cd.Publish(new umbraco.BusinessLogic.User(0));
                    //using library.publish to support load balancing.
                    umbraco.library.UpdateDocumentCache(cd.Id);


                    if (cd.HasChildren)
                    {
                        handleChildNodes(cd);
                    }
                }
            }
        }
예제 #13
0
 private void DoPublishSubs(cms.businesslogic.web.Document d)
 {
     if (d.Published || PublishUnpublishedItems.Checked)
     {
         if (d.PublishWithResult(UmbracoUser))
         {
             _nodesPublished++;
             Application.Lock();
             Application["publishDone" + _nodeId.ToString()] = _nodesPublished.ToString();
             Application.UnLock();
             foreach (var dc in d.Children)
             {
                 DoPublishSubs(dc);
             }
         }
         else
         {
             LogHelper.Warn <publish>("Publishing failed due to event cancelling the publishing for document " + d.Id);
         }
     }
 }
예제 #14
0
        public Control parseStringBuilder(StringBuilder tempOutput, page umbPage)
        {
            Control pageContent = new Control();

            bool stop      = false;
            bool debugMode = umbraco.presentation.UmbracoContext.Current.Request.IsDebug;

            while (!stop)
            {
                System.Web.HttpContext.Current.Trace.Write("template", "Begining of parsing rutine...");
                int tagIndex = tempOutput.ToString().ToLower().IndexOf("<?umbraco");
                if (tagIndex > -1)
                {
                    String tempElementContent = "";
                    pageContent.Controls.Add(new LiteralControl(tempOutput.ToString().Substring(0, tagIndex)));

                    tempOutput.Remove(0, tagIndex);

                    String    tag        = tempOutput.ToString().Substring(0, tempOutput.ToString().IndexOf(">") + 1);
                    Hashtable attributes = helper.ReturnAttributes(tag);

                    // Check whether it's a single tag (<?.../>) or a tag with children (<?..>...</?...>)
                    if (tag.Substring(tag.Length - 2, 1) != "/" && tag.IndexOf(" ") > -1)
                    {
                        String closingTag = "</" + (tag.Substring(1, tag.IndexOf(" ") - 1)) + ">";
                        // Tag with children are only used when a macro is inserted by the umbraco-editor, in the
                        // following format: "<?UMBRACO_MACRO ...><IMG SRC="..."..></?UMBRACO_MACRO>", so we
                        // need to delete extra information inserted which is the image-tag and the closing
                        // umbraco_macro tag
                        if (tempOutput.ToString().IndexOf(closingTag) > -1)
                        {
                            tempOutput.Remove(0, tempOutput.ToString().IndexOf(closingTag));
                        }
                    }



                    System.Web.HttpContext.Current.Trace.Write("umbTemplate", "Outputting item: " + tag);

                    // Handle umbraco macro tags
                    if (tag.ToString().ToLower().IndexOf("umbraco_macro") > -1)
                    {
                        if (debugMode)
                        {
                            pageContent.Controls.Add(new LiteralControl("<div title=\"Macro Tag: '" + System.Web.HttpContext.Current.Server.HtmlEncode(tag) + "'\" style=\"border: 1px solid #009;\">"));
                        }

                        // NH: Switching to custom controls for macros
                        if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages)
                        {
                            umbraco.presentation.templateControls.Macro macroControl = new umbraco.presentation.templateControls.Macro();
                            macroControl.Alias = helper.FindAttribute(attributes, "macroalias");
                            IDictionaryEnumerator ide = attributes.GetEnumerator();
                            while (ide.MoveNext())
                            {
                                if (macroControl.Attributes[ide.Key.ToString()] == null)
                                {
                                    macroControl.Attributes.Add(ide.Key.ToString(), ide.Value.ToString());
                                }
                            }
                            pageContent.Controls.Add(macroControl);
                        }
                        else
                        {
                            macro  tempMacro;
                            String macroID = helper.FindAttribute(attributes, "macroid");
                            if (macroID != String.Empty)
                            {
                                tempMacro = getMacro(macroID);
                            }
                            else
                            {
                                tempMacro = macro.GetMacro(helper.FindAttribute(attributes, "macroalias"));
                            }

                            if (tempMacro != null)
                            {
                                try
                                {
                                    Control c = tempMacro.renderMacro(attributes, umbPage.Elements, umbPage.PageID);
                                    if (c != null)
                                    {
                                        pageContent.Controls.Add(c);
                                    }
                                    else
                                    {
                                        System.Web.HttpContext.Current.Trace.Warn("Template", "Result of macro " + tempMacro.Name + " is null");
                                    }
                                }
                                catch (Exception e)
                                {
                                    System.Web.HttpContext.Current.Trace.Warn("Template", "Error adding macro " + tempMacro.Name, e);
                                }
                            }
                        }
                        if (debugMode)
                        {
                            pageContent.Controls.Add(new LiteralControl("</div>"));
                        }
                    }
                    else
                    {
                        if (tag.ToLower().IndexOf("umbraco_getitem") > -1)
                        {
                            // NH: Switching to custom controls for items
                            if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages)
                            {
                                umbraco.presentation.templateControls.Item itemControl = new umbraco.presentation.templateControls.Item();
                                itemControl.Field = helper.FindAttribute(attributes, "field");
                                IDictionaryEnumerator ide = attributes.GetEnumerator();
                                while (ide.MoveNext())
                                {
                                    if (itemControl.Attributes[ide.Key.ToString()] == null)
                                    {
                                        itemControl.Attributes.Add(ide.Key.ToString(), ide.Value.ToString());
                                    }
                                }
                                pageContent.Controls.Add(itemControl);
                            }
                            else
                            {
                                try
                                {
                                    if (helper.FindAttribute(attributes, "nodeId") != "" && int.Parse(helper.FindAttribute(attributes, "nodeId")) != 0)
                                    {
                                        cms.businesslogic.Content c = new umbraco.cms.businesslogic.Content(int.Parse(helper.FindAttribute(attributes, "nodeId")));
                                        item umbItem = new item(c.getProperty(helper.FindAttribute(attributes, "field")).Value.ToString(), attributes);
                                        tempElementContent = umbItem.FieldContent;

                                        // Check if the content is published
                                        if (c.nodeObjectType == cms.businesslogic.web.Document._objectType)
                                        {
                                            try
                                            {
                                                cms.businesslogic.web.Document d = (cms.businesslogic.web.Document)c;
                                                if (!d.Published)
                                                {
                                                    tempElementContent = "";
                                                }
                                            }
                                            catch { }
                                        }
                                    }
                                    else
                                    {
                                        // NH adds Live Editing test stuff
                                        item umbItem = new item(umbPage.Elements, attributes);
                                        //								item umbItem = new item(umbPage.PageElements[helper.FindAttribute(attributes, "field")].ToString(), attributes);
                                        tempElementContent = umbItem.FieldContent;
                                    }

                                    if (debugMode)
                                    {
                                        tempElementContent =
                                            "<div title=\"Field Tag: '" + System.Web.HttpContext.Current.Server.HtmlEncode(tag) + "'\" style=\"border: 1px solid #fc6;\">" + tempElementContent + "</div>";
                                    }
                                }
                                catch (Exception e)
                                {
                                    System.Web.HttpContext.Current.Trace.Warn("umbracoTemplate", "Error reading element (" + helper.FindAttribute(attributes, "field") + ")", e);
                                }
                            }
                        }
                    }
                    tempOutput.Remove(0, tempOutput.ToString().IndexOf(">") + 1);
                    tempOutput.Insert(0, tempElementContent);
                }
                else
                {
                    pageContent.Controls.Add(new LiteralControl(tempOutput.ToString()));
                    break;
                }
            }

            return(pageContent);
        }
예제 #15
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //validate!
            int id;
            if (!int.TryParse(Request.QueryString["id"], out id))
            {
                //if this is invalid show an error
                this.DisplayFatalError("Invalid query string");
                return;
            }
            m_ContentId = id;


            this.UnPublish.Click += new System.EventHandler(this.UnPublishDo);

            //_document = new cms.businesslogic.web.Document(int.Parse(Request.QueryString["id"]));
            _document = new Document(true, id);

            //check if the doc exists
            if (string.IsNullOrEmpty(_document.Path))
            {
                //if this is invalid show an error
                this.DisplayFatalError("No document found with id " + m_ContentId);
                //reset the content id to null so processing doesn't continue on OnLoad
                m_ContentId = null;
                return;
            }

            // we need to check if there's a published version of this document
            _documentHasPublishedVersion = _document.HasPublishedVersion();

            // Check publishing permissions
            if (!base.getUser().GetPermissions(_document.Path).Contains(ActionPublish.Instance.Letter.ToString()))
                _canPublish = controls.ContentControl.publishModes.SendToPublish;
            cControl = new controls.ContentControl(_document, _canPublish, "TabView1");

            cControl.ID = "TabView1";

            cControl.Width = Unit.Pixel(666);
            cControl.Height = Unit.Pixel(666);

            // Add preview button

            foreach (uicontrols.TabPage tp in cControl.GetPanels())
            {
                addPreviewButton(tp.Menu, _document.Id);
            }

            plc.Controls.Add(cControl);


            System.Web.UI.WebControls.PlaceHolder publishStatus = new PlaceHolder();
            if (_documentHasPublishedVersion)
            {
                littPublishStatus.Text = ui.Text("content", "lastPublished", base.getUser()) + ": " + _document.VersionDate.ToShortDateString() + " &nbsp; ";

                publishStatus.Controls.Add(littPublishStatus);
                if (base.getUser().GetPermissions(_document.Path).IndexOf("U") > -1)
                    UnPublish.Visible = true;
                else
                    UnPublish.Visible = false;
            }
            else
            {
                littPublishStatus.Text = ui.Text("content", "itemNotPublished", base.getUser());
                publishStatus.Controls.Add(littPublishStatus);
                UnPublish.Visible = false;
            }

            UnPublish.Text = ui.Text("content", "unPublish", base.getUser());
            UnPublish.ID = "UnPublishButton";
            UnPublish.Attributes.Add("onClick", "if (!confirm('" + ui.Text("defaultdialogs", "confirmSure", base.getUser()) + "')) return false; ");
            publishStatus.Controls.Add(UnPublish);

            publishProps.addProperty(ui.Text("content", "publishStatus", base.getUser()), publishStatus);

            // Template
            PlaceHolder template = new PlaceHolder();
            cms.businesslogic.web.DocumentType DocumentType = new cms.businesslogic.web.DocumentType(_document.ContentType.Id);
            cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(DocumentType.Text));


            //template picker
            cControl.PropertiesPane.addProperty(ui.Text("template"), template);
            int defaultTemplate;
            if (_document.Template != 0)
                defaultTemplate = _document.Template;
            else
                defaultTemplate = DocumentType.DefaultTemplate;

            if (this.getUser().UserType.Name == "writer")
            {
                if (defaultTemplate != 0)
                    template.Controls.Add(new LiteralControl(cms.businesslogic.template.Template.GetTemplate(defaultTemplate).Text));
                else
                    template.Controls.Add(new LiteralControl(ui.Text("content", "noDefaultTemplate")));
            }
            else
            {
                ddlDefaultTemplate.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
                foreach (cms.businesslogic.template.Template t in DocumentType.allowedTemplates)
                {

                    ListItem tTemp = new ListItem(t.Text, t.Id.ToString());
                    if (t.Id == defaultTemplate)
                        tTemp.Selected = true;
                    ddlDefaultTemplate.Items.Add(tTemp);
                }
                template.Controls.Add(ddlDefaultTemplate);
            }


            // Editable update date, release date and expire date added by NH 13.12.04
            dp.ID = "updateDate";
            dp.Text = _document.UpdateDate.ToShortDateString() + " " + _document.UpdateDate.ToShortTimeString();
            publishProps.addProperty(ui.Text("content", "updateDate", base.getUser()), dp);

            dpRelease.ID = "releaseDate";
            dpRelease.DateTime = _document.ReleaseDate;
            dpRelease.ShowTime = true;
            publishProps.addProperty(ui.Text("content", "releaseDate", base.getUser()), dpRelease);

            dpExpire.ID = "expireDate";
            dpExpire.DateTime = _document.ExpireDate;
            dpExpire.ShowTime = true;
            publishProps.addProperty(ui.Text("content", "expireDate", base.getUser()), dpExpire);

            cControl.Save += new System.EventHandler(Save);
            cControl.SaveAndPublish += new System.EventHandler(Publish);
            cControl.SaveToPublish += new System.EventHandler(SendToPublish);

            // Add panes to property page...
            cControl.tpProp.Controls.AddAt(1, publishProps);
            cControl.tpProp.Controls.AddAt(2, linkProps);

            // add preview to properties pane too
            addPreviewButton(cControl.tpProp.Menu, _document.Id);


        }
        private void HandleDocumentMoveOrCopy()
        {
            if (helper.Request("copyTo") != "" && helper.Request("id") != "")
            {
                // Check if the current node is allowed at new position
                bool nodeAllowed = false;

                cms.businesslogic.Content currentNode = new cms.businesslogic.Content(int.Parse(helper.Request("id")));
                int oldParent = -1;
                if (currentNode.Level > 1)
                {
                    oldParent = currentNode.Parent.Id;
                }
                cms.businesslogic.Content newNode = new cms.businesslogic.Content(int.Parse(helper.Request("copyTo")));

                // Check on contenttypes
                if (int.Parse(helper.Request("copyTo")) == -1)
                {
                    nodeAllowed = true;
                }
                else
                {
                    foreach (int i in newNode.ContentType.AllowedChildContentTypeIDs.ToList())
                    {
                        if (i == currentNode.ContentType.Id)
                        {
                            nodeAllowed = true;
                            break;
                        }
                    }
                    if (!nodeAllowed)
                    {
                        feedback.Text = ui.Text("moveOrCopy", "notAllowedByContentType", base.getUser());
                        feedback.type = umbraco.uicontrols.Feedback.feedbacktype.error;
                    }
                    else
                    {
                        // Check on paths
                        if (((string)("," + newNode.Path + ",")).IndexOf("," + currentNode.Id + ",") > -1)
                        {
                            nodeAllowed   = false;
                            feedback.Text = ui.Text("moveOrCopy", "notAllowedByPath", base.getUser());
                            feedback.type = umbraco.uicontrols.Feedback.feedbacktype.error;
                        }
                    }
                }


                if (nodeAllowed)
                {
                    pane_form.Visible        = false;
                    pane_form_notice.Visible = false;
                    panel_buttons.Visible    = false;

                    string newNodeCaption = newNode.Id == -1 ? ui.Text(helper.Request("app")) : newNode.Text;

                    string[] nodes = { currentNode.Text, newNodeCaption };

                    if (UmbracoContext.Current.Request["mode"] == "cut")
                    {
                        if (UmbracoContext.Current.Request["app"] == "content")
                        {
                            //PPH changed this to document instead of cmsNode to handle republishing.
                            cms.businesslogic.web.Document d = new umbraco.cms.businesslogic.web.Document(int.Parse(helper.Request("id")));
                            d.Move(int.Parse(helper.Request("copyTo")));
                            if (d.Published)
                            {
                                d.Publish(new umbraco.BusinessLogic.User(0));
                                //using library.publish to support load balancing.
                                //umbraco.library.PublishSingleNode(d.Id);
                                umbraco.library.UpdateDocumentCache(d.Id);

                                //PPH added handling of load balanced moving of multiple nodes...
                                if (d.HasChildren)
                                {
                                    handleChildNodes(d);
                                }

                                //Using the general Refresh content method instead as it supports load balancing.
                                //we only need to do this if the node is actually published.
                                library.RefreshContent();
                            }
                            d.Save(); //stub to save stuff to the db.
                        }
                        else
                        {
                            Media m = new Media(int.Parse(UmbracoContext.Current.Request["id"]));
                            m.Move(int.Parse(UmbracoContext.Current.Request["copyTo"]));
                            m.XmlGenerate(new XmlDocument());
                            library.ClearLibraryCacheForMedia(m.Id);
                        }

                        feedback.Text = ui.Text("moveOrCopy", "moveDone", nodes, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                        feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success;

                        // refresh tree
                        ClientTools.MoveNode(currentNode.Id.ToString(), newNode.Path);
                    }
                    else
                    {
                        cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(int.Parse(helper.Request("id")));
                        d.Copy(int.Parse(helper.Request("copyTo")), this.getUser(), RelateDocuments.Checked);
                        feedback.Text = ui.Text("moveOrCopy", "copyDone", nodes, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                        feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success;
                        ClientTools.CopyNode(currentNode.Id.ToString(), newNode.Path);
                    }
                }
            }
        }
예제 #17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Check for editing
            int documentId = int.Parse(helper.Request("nodeId"));
            cms.businesslogic.web.Document documentObject = new cms.businesslogic.web.Document(documentId);
            jsShowWindow.Text = "";

            ph_errorpage.Controls.Add(errorPagePicker);
            ph_loginpage.Controls.Add(loginPagePicker);

            pp_login.Text = ui.Text("login");
            pp_pass.Text = ui.Text("password");
            pp_loginPage.Text = ui.Text("paLoginPage");
            pp_errorPage.Text = ui.Text("paErrorPage");

            pane_chooseMode.Text = ui.Text("publicAccess", "paHowWould", base.getUser());
            pane_pages.Text = ui.Text("publicAccess", "paSelectPages", base.getUser());
            pane_simple.Text = ui.Text("publicAccess", "paSimple", base.getUser());
            pane_advanced.Text = ui.Text("publicAccess", "paAdvanced", base.getUser());

            if (!IsPostBack)
            {
                if (Access.IsProtected(documentId, documentObject.Path) && Access.GetProtectionType(documentId) != ProtectionType.NotProtected)
                {
                    bt_buttonRemoveProtection.Visible = true;
                    bt_buttonRemoveProtection.Attributes.Add("onClick", "return confirm('" + ui.Text("areyousure") + "')");

                    // Get login and error pages
                    int errorPage = Access.GetErrorPage(documentObject.Path);
                    int loginPage = Access.GetLoginPage(documentObject.Path);
                    try
                    {
                        Document loginPageObj = new Document(loginPage);
                        if (loginPageObj != null)
                        {
                            loginPagePicker.Text = loginPage.ToString();
                        }
                        Document errorPageObj = new Document(errorPage);
                        if (errorPageObj != null)
                        {
                            errorPagePicker.Text = errorPage.ToString();
                        }
                    }
                    catch
                    {
                    }

                    if (Access.GetProtectionType(documentId) == ProtectionType.Simple)
                    {
                        MembershipUser m = Access.GetAccessingMembershipUser(documentId);
                        simpleLogin.Text = m.UserName;
                        pane_simple.Visible = true;
                        pane_advanced.Visible = false;
                        bt_protect.CommandName = "simple";

                    }
                    else if (Access.GetProtectionType(documentId) == ProtectionType.Advanced)
                    {
                        pane_simple.Visible = false;
                        pane_advanced.Visible = true;
                        bt_protect.CommandName = "advanced";
                    }

                    p_buttons.Visible = true;
                    p_mode.Visible = false;
                }
            }

            // Load up membergrouops
            _memberGroups.ID = "Membergroups";
            _memberGroups.Width = 175;
            string selectedGroups = "";
            string[] _roles = Roles.GetAllRoles();

            if (_roles.Length > 0)
            {
                foreach (string role in _roles)
                {
                    ListItem li = new ListItem(role, role);
                    if (!IsPostBack)
                    {
                        if (cms.businesslogic.web.Access.IsProtectedByMembershipRole(int.Parse(helper.Request("nodeid")), role))
                            selectedGroups += role + ",";
                    }
                    _memberGroups.Items.Add(li);
                }
            }
            else
            {
                p_noGroupsFound.Visible = true;
                rb_advanced.Enabled = false;
            }
            _memberGroups.Value = selectedGroups;
            groupsSelector.Controls.Add(_memberGroups);

            bt_protect.Text = ui.Text("update");
            bt_buttonRemoveProtection.Text = ui.Text("paRemoveProtection");

            // Put user code to initialize the page here
        }
예제 #18
0
        private void HandleDocumentMoveOrCopy() 
		{
			if (helper.Request("copyTo") != "" && helper.Request("id") != "") 
			{
				// Check if the current node is allowed at new position
				bool nodeAllowed = false;

				cms.businesslogic.Content currentNode = new cms.businesslogic.Content(int.Parse(helper.Request("id")));
                int oldParent = -1;
                if (currentNode.Level > 1)
                   oldParent = currentNode.Parent.Id;
				cms.businesslogic.Content newNode = new cms.businesslogic.Content(int.Parse(helper.Request("copyTo")));

				// Check on contenttypes
				if (int.Parse(helper.Request("copyTo")) == -1)
					nodeAllowed = true;
				else 
				{
					foreach (int i in newNode.ContentType.AllowedChildContentTypeIDs.ToList())
						if (i == currentNode.ContentType.Id) 
						{
							nodeAllowed = true;
							break;
						}
                    if (!nodeAllowed) {
                        feedback.Text = ui.Text("moveOrCopy", "notAllowedByContentType", base.getUser());
                        feedback.type = umbraco.uicontrols.Feedback.feedbacktype.error;
                    } else {
                        // Check on paths
                        if (((string)("," + newNode.Path + ",")).IndexOf("," + currentNode.Id + ",") > -1) {
                            nodeAllowed = false;
                            feedback.Text = ui.Text("moveOrCopy", "notAllowedByPath", base.getUser());
                            feedback.type = umbraco.uicontrols.Feedback.feedbacktype.error;
                        }
                    }
				}


				if (nodeAllowed) 
				{
                    pane_form.Visible = false;
                    pane_form_notice.Visible = false;
                    panel_buttons.Visible = false;

                    string newNodeCaption = newNode.Id == -1 ? ui.Text(helper.Request("app")) : newNode.Text;

                    string[] nodes = {currentNode.Text, newNodeCaption };

                    if (UmbracoContext.Current.Request["mode"] == "cut")
                    {
                        if (UmbracoContext.Current.Request["app"] == "content")
                        {
                            //PPH changed this to document instead of cmsNode to handle republishing.
                            cms.businesslogic.web.Document d = new umbraco.cms.businesslogic.web.Document(int.Parse(helper.Request("id")));
                            d.Move(int.Parse(helper.Request("copyTo")));
                            if (d.Published)
                            {
                                d.Publish(new umbraco.BusinessLogic.User(0));
                                //using library.publish to support load balancing.
                                //umbraco.library.PublishSingleNode(d.Id);
                                umbraco.library.UpdateDocumentCache(d.Id);

                                //PPH added handling of load balanced moving of multiple nodes...
                                if (d.HasChildren)
                                {
                                    handleChildNodes(d);
                                }

                                //Using the general Refresh content method instead as it supports load balancing. 
                                //we only need to do this if the node is actually published.
                                library.RefreshContent();
                            }
                            d.Save(); //stub to save stuff to the db.
                        }
                        else
                        {
                            Media m = new Media(int.Parse(UmbracoContext.Current.Request["id"]));
                            m.Move(int.Parse(UmbracoContext.Current.Request["copyTo"]));
                            m.XmlGenerate(new XmlDocument());
                            library.ClearLibraryCacheForMedia(m.Id);
                        }                                 

                        feedback.Text = ui.Text("moveOrCopy", "moveDone", nodes, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                        feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success;

                        // refresh tree
						ClientTools.MoveNode(currentNode.Id.ToString(), newNode.Path);

                    } 
					else 
					{
						cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(int.Parse(helper.Request("id")));
						d.Copy(int.Parse(helper.Request("copyTo")), this.getUser(), RelateDocuments.Checked);
						feedback.Text = ui.Text("moveOrCopy", "copyDone", nodes, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                        feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success;
						ClientTools.CopyNode(currentNode.Id.ToString(), newNode.Path);
                    }
				} 
			}
		}
예제 #19
0
        public override void DataBind()
        {
            base.DataBind();
            
            
            if (m_umbracoUser == null)
                throw new ArgumentNullException("No User specified");

            //get the logged in user's permissions
            UserPermissions currUserPermissions = new UserPermissions(UmbracoEnsuredPage.CurrentUser);
            
            //lookup permissions for last node selected
            int selectedNodeId = m_nodeID[m_nodeID.Length - 1];
            
            List<IAction> lstCurrUserActions = currUserPermissions.GetExistingNodePermission(selectedNodeId);
            List<IAction> lstLookupUserActions = m_userPermissions.GetExistingNodePermission(selectedNodeId);
            
            List<IAction> lstAllActions = umbraco.BusinessLogic.Actions.Action.GetPermissionAssignable();

            //no node is selected, disable the check boxes
            if (m_nodeID[0] == -1)
            {
                ShowMessage("No node selected");
                return;
            }

            //ensure the current user has access to assign permissions.
            //if their actions list is null then it means that the node is not published.
            if (lstCurrUserActions == null || lstCurrUserActions.Contains(ActionRights.Instance))
                BindExistingPermissions(lstAllActions, lstLookupUserActions);
            else
                ShowMessage("You do not have access to assign permissions to this node");

            string names = "";
            foreach (int id in m_nodeID) {
                if(id > 0)
                    names += new cms.businesslogic.web.Document(id).Text + ", ";
            }

			lt_names.Text = names.Trim().Trim(',');
        }
예제 #20
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nodeId = int.Parse(helper.Request("id"));
            cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(nodeId);
            pageName = d.Text;

            // add control prefix to variable for support with masterpages
            string prefix = PublishUnpublishedItems.ClientID.Replace(PublishUnpublishedItems.ID, "");
            masterPagePrefix.Text = prefix;

            // by default we only count the published ones
            int TotalNodesToPublish = cms.businesslogic.web.Document.CountSubs(nodeId, true);
            try
            {
                Application.Lock();
                // We add both all nodes and only published nodes to the application variables so we can ajax query depending on checkboxes
                Application["publishTotalAll" + nodeId.ToString()] = cms.businesslogic.CMSNode.CountSubs(nodeId).ToString();
                Application["publishTotal" + nodeId.ToString()] = TotalNodesToPublish.ToString();
                Application["publishDone" + nodeId.ToString()] = "0";
            }
            finally
            {
                Application.UnLock();
            }
            total.Text = TotalNodesToPublish.ToString();

            // Put user code to initialize the page here
            if (!IsPostBack)
            {
                // Add caption to checkbox
                PublishAll.Text = ui.Text("publish", "publishAll", d.Text, base.getUser());
                ok.Text = ui.Text("content", "publish", base.getUser());
                ok.Attributes.Add("style", "width: 60px");
                ok.Attributes.Add("onClick", "startPublication();");

                // Add checkbox event, so the publish unpublished childs gets enabled
                PublishUnpublishedItems.LabelAttributes.Add("disabled", "true");
                PublishUnpublishedItems.LabelAttributes.Add("id", "publishUnpublishedItemsLabel");
                PublishUnpublishedItems.InputAttributes.Add("disabled", "true");
                PublishAll.InputAttributes.Add("onclick", "togglePublishingModes(this)");
            }
            else
            {

                if (PublishAll.Checked)
                {
                    nodesPublished = 0;

                    doPublishSubs(d);

                    //PPH added load balancing...
                    //content.Instance.PublishNode(documents);
                    foreach (cms.businesslogic.web.Document doc in documents)
                    {
                        if (doc.Published)
                        {
                            library.PublishSingleNode(doc.Id);
                        }
                    }

                    Application.Lock();
                    Application["publishTotal" + nodeId.ToString()] = 0;
                    Application.UnLock();

                    feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.success;

                    feedbackMsg.Text = ui.Text("publish", "nodePublishAll", d.Text, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";

                    ClientTools.ReloadActionNode(true, true);

                    Application.Lock();

                    Application["publishTotal" + nodeId.ToString()] = null;
                    Application["publishDone" + nodeId.ToString()] = null;
                    Application.UnLock();
                }
                else
                {
                    if (d.PublishWithResult(base.getUser()))
                    {
                        library.PublishSingleNode(d.Id);
                        feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.success;
                        feedbackMsg.Text = ui.Text("publish", "nodePublish", d.Text, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                    }
                    else {
                        feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.error;
                        feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByEvent", d.Text, base.getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                    }
                    ClientTools.ReloadActionNode(true, false);
                }

                TheForm.Visible = false;
                theEnd.Visible = true;
            }
        }
예제 #21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nodeId = int.Parse(helper.Request("id"));
            cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(nodeId);
            pageName = d.Text;

            // add control prefix to variable for support with masterpages
            string prefix = PublishUnpublishedItems.ClientID.Replace(PublishUnpublishedItems.ID, "");

            masterPagePrefix.Text = prefix;

            // by default we only count the published ones
            int TotalNodesToPublish = cms.businesslogic.web.Document.CountSubs(nodeId, true);

            try
            {
                Application.Lock();
                // We add both all nodes and only published nodes to the application variables so we can ajax query depending on checkboxes
                Application["publishTotalAll" + nodeId.ToString()] = cms.businesslogic.CMSNode.CountSubs(nodeId).ToString();
                Application["publishTotal" + nodeId.ToString()]    = TotalNodesToPublish.ToString();
                Application["publishDone" + nodeId.ToString()]     = "0";
            }
            finally
            {
                Application.UnLock();
            }
            total.Text = TotalNodesToPublish.ToString();

            // Put user code to initialize the page here
            if (!IsPostBack)
            {
                // Add caption to checkbox
                PublishAll.Text = ui.Text("publish", "publishAll", d.Text, base.getUser());
                ok.Text         = ui.Text("content", "publish", base.getUser());
                ok.Attributes.Add("style", "width: 60px");
                ok.Attributes.Add("onClick", "startPublication();");

                // Add checkbox event, so the publish unpublished childs gets enabled
                PublishUnpublishedItems.LabelAttributes.Add("disabled", "true");
                PublishUnpublishedItems.LabelAttributes.Add("id", "publishUnpublishedItemsLabel");
                PublishUnpublishedItems.InputAttributes.Add("disabled", "true");
                PublishAll.InputAttributes.Add("onclick", "togglePublishingModes(this)");
            }
            else
            {
                if (PublishAll.Checked)
                {
                    nodesPublished = 0;

                    doPublishSubs(d);

                    //PPH added load balancing...
                    //content.Instance.PublishNode(documents);
                    foreach (cms.businesslogic.web.Document doc in documents)
                    {
                        if (doc.Published)
                        {
                            library.UpdateDocumentCache(doc.Id);
                        }
                    }

                    Application.Lock();
                    Application["publishTotal" + nodeId.ToString()] = 0;
                    Application.UnLock();

                    feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.success;

                    feedbackMsg.Text = ui.Text("publish", "nodePublishAll", d.Text, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";

                    ClientTools.ReloadActionNode(true, true);

                    Application.Lock();

                    Application["publishTotal" + nodeId.ToString()] = null;
                    Application["publishDone" + nodeId.ToString()]  = null;
                    Application.UnLock();
                }
                else
                {
                    if (d.PublishWithResult(base.getUser()))
                    {
                        library.UpdateDocumentCache(d.Id);
                        feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.success;
                        feedbackMsg.Text = ui.Text("publish", "nodePublish", d.Text, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                    }
                    else
                    {
                        feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.notice;
                        feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByEvent", d.Text, base.getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
                    }
                    ClientTools.ReloadActionNode(true, false);
                }

                TheForm.Visible = false;
                theEnd.Visible  = true;
            }
        }
예제 #22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Check for editing
            int documentId = int.Parse(helper.Request("nodeId"));

            cms.businesslogic.web.Document documentObject = new cms.businesslogic.web.Document(documentId);
            jsShowWindow.Text = "";

            ph_errorpage.Controls.Add(errorPagePicker);
            ph_loginpage.Controls.Add(loginPagePicker);

            pp_login.Text     = ui.Text("login");
            pp_pass.Text      = ui.Text("password");
            pp_loginPage.Text = ui.Text("paLoginPage");
            pp_errorPage.Text = ui.Text("paErrorPage");

            pane_chooseMode.Text = ui.Text("publicAccess", "paHowWould", base.getUser());
            pane_pages.Text      = ui.Text("publicAccess", "paSelectPages", base.getUser());
            pane_simple.Text     = ui.Text("publicAccess", "paSimple", base.getUser());
            pane_advanced.Text   = ui.Text("publicAccess", "paAdvanced", base.getUser());

            if (!IsPostBack)
            {
                if (Access.IsProtected(documentId, documentObject.Path) && Access.GetProtectionType(documentId) != ProtectionType.NotProtected)
                {
                    bt_buttonRemoveProtection.Visible = true;
                    bt_buttonRemoveProtection.Attributes.Add("onClick", "return confirm('" + ui.Text("areyousure") + "')");

                    // Get login and error pages
                    int errorPage = Access.GetErrorPage(documentObject.Path);
                    int loginPage = Access.GetLoginPage(documentObject.Path);
                    try
                    {
                        Document loginPageObj = new Document(loginPage);
                        if (loginPageObj != null)
                        {
                            loginPagePicker.Text = loginPage.ToString();
                        }
                        Document errorPageObj = new Document(errorPage);
                        if (errorPageObj != null)
                        {
                            errorPagePicker.Text = errorPage.ToString();
                        }
                    }
                    catch
                    {
                    }

                    if (Access.GetProtectionType(documentId) == ProtectionType.Simple)
                    {
                        MembershipUser m = Access.GetAccessingMembershipUser(documentId);
                        simpleLogin.Text       = m.UserName;
                        pane_simple.Visible    = true;
                        pane_advanced.Visible  = false;
                        bt_protect.CommandName = "simple";
                    }
                    else if (Access.GetProtectionType(documentId) == ProtectionType.Advanced)
                    {
                        pane_simple.Visible    = false;
                        pane_advanced.Visible  = true;
                        bt_protect.CommandName = "advanced";
                    }

                    p_buttons.Visible = true;
                    p_mode.Visible    = false;
                }
            }

            // Load up membergrouops
            _memberGroups.ID    = "Membergroups";
            _memberGroups.Width = 175;
            string selectedGroups = "";

            string[] _roles = Roles.GetAllRoles();

            if (_roles.Length > 0)
            {
                foreach (string role in _roles)
                {
                    ListItem li = new ListItem(role, role);
                    if (!IsPostBack)
                    {
                        if (cms.businesslogic.web.Access.IsProtectedByMembershipRole(int.Parse(helper.Request("nodeid")), role))
                        {
                            selectedGroups += role + ",";
                        }
                    }
                    _memberGroups.Items.Add(li);
                }
            }
            else
            {
                p_noGroupsFound.Visible = true;
                rb_advanced.Enabled     = false;
            }
            _memberGroups.Value = selectedGroups;
            groupsSelector.Controls.Add(_memberGroups);


            bt_protect.Text = ui.Text("update");
            bt_buttonRemoveProtection.Text = ui.Text("paRemoveProtection");

            // Put user code to initialize the page here
        }
예제 #23
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //validate!
            int id;

            if (!int.TryParse(Request.QueryString["id"], out id))
            {
                //if this is invalid show an error
                this.DisplayFatalError("Invalid query string");
                return;
            }
            m_ContentId = id;


            this.UnPublish.Click += new System.EventHandler(this.UnPublishDo);

            //_document = new cms.businesslogic.web.Document(int.Parse(Request.QueryString["id"]));
            _document = new Document(true, id);

            //check if the doc exists
            if (string.IsNullOrEmpty(_document.Path))
            {
                //if this is invalid show an error
                this.DisplayFatalError("No document found with id " + m_ContentId);
                //reset the content id to null so processing doesn't continue on OnLoad
                m_ContentId = null;
                return;
            }

            // we need to check if there's a published version of this document
            _documentHasPublishedVersion = _document.HasPublishedVersion();

            // Check publishing permissions
            if (!base.getUser().GetPermissions(_document.Path).Contains(ActionPublish.Instance.Letter.ToString()))
            {
                _canPublish = controls.ContentControl.publishModes.SendToPublish;
            }
            cControl = new controls.ContentControl(_document, _canPublish, "TabView1");

            cControl.ID = "TabView1";

            cControl.Width  = Unit.Pixel(666);
            cControl.Height = Unit.Pixel(666);

            // Add preview button

            foreach (uicontrols.TabPage tp in cControl.GetPanels())
            {
                addPreviewButton(tp.Menu, _document.Id);
            }

            plc.Controls.Add(cControl);


            System.Web.UI.WebControls.PlaceHolder publishStatus = new PlaceHolder();
            if (_documentHasPublishedVersion)
            {
                littPublishStatus.Text = ui.Text("content", "lastPublished", base.getUser()) + ": " + _document.VersionDate.ToShortDateString() + " &nbsp; ";

                publishStatus.Controls.Add(littPublishStatus);
                if (base.getUser().GetPermissions(_document.Path).IndexOf("U") > -1)
                {
                    UnPublish.Visible = true;
                }
                else
                {
                    UnPublish.Visible = false;
                }
            }
            else
            {
                littPublishStatus.Text = ui.Text("content", "itemNotPublished", base.getUser());
                publishStatus.Controls.Add(littPublishStatus);
                UnPublish.Visible = false;
            }

            UnPublish.Text = ui.Text("content", "unPublish", base.getUser());
            UnPublish.ID   = "UnPublishButton";
            UnPublish.Attributes.Add("onClick", "if (!confirm('" + ui.Text("defaultdialogs", "confirmSure", base.getUser()) + "')) return false; ");
            publishStatus.Controls.Add(UnPublish);

            publishProps.addProperty(ui.Text("content", "publishStatus", base.getUser()), publishStatus);

            // Template
            PlaceHolder template = new PlaceHolder();

            cms.businesslogic.web.DocumentType DocumentType = new cms.businesslogic.web.DocumentType(_document.ContentType.Id);
            cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(DocumentType.Text));



            //template picker
            cControl.PropertiesPane.addProperty(ui.Text("template"), template);
            int defaultTemplate;

            if (_document.Template != 0)
            {
                defaultTemplate = _document.Template;
            }
            else
            {
                defaultTemplate = DocumentType.DefaultTemplate;
            }

            if (this.getUser().UserType.Name == "writer")
            {
                if (defaultTemplate != 0)
                {
                    template.Controls.Add(new LiteralControl(cms.businesslogic.template.Template.GetTemplate(defaultTemplate).Text));
                }
                else
                {
                    template.Controls.Add(new LiteralControl(ui.Text("content", "noDefaultTemplate")));
                }
            }
            else
            {
                ddlDefaultTemplate.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
                foreach (cms.businesslogic.template.Template t in DocumentType.allowedTemplates)
                {
                    ListItem tTemp = new ListItem(t.Text, t.Id.ToString());
                    if (t.Id == defaultTemplate)
                    {
                        tTemp.Selected = true;
                    }
                    ddlDefaultTemplate.Items.Add(tTemp);
                }
                template.Controls.Add(ddlDefaultTemplate);
            }


            // Editable update date, release date and expire date added by NH 13.12.04
            dp.ID   = "updateDate";
            dp.Text = _document.UpdateDate.ToShortDateString() + " " + _document.UpdateDate.ToShortTimeString();
            publishProps.addProperty(ui.Text("content", "updateDate", base.getUser()), dp);

            dpRelease.ID       = "releaseDate";
            dpRelease.DateTime = _document.ReleaseDate;
            dpRelease.ShowTime = true;
            publishProps.addProperty(ui.Text("content", "releaseDate", base.getUser()), dpRelease);

            dpExpire.ID       = "expireDate";
            dpExpire.DateTime = _document.ExpireDate;
            dpExpire.ShowTime = true;
            publishProps.addProperty(ui.Text("content", "expireDate", base.getUser()), dpExpire);

            // url's
            updateLinks();
            linkProps.addProperty(ui.Text("content", "urls", base.getUser()), l);

            if (domainText.Text != "")
            {
                linkProps.addProperty(ui.Text("content", "alternativeUrls", base.getUser()), domainText);
            }

            cControl.Save           += new System.EventHandler(Save);
            cControl.SaveAndPublish += new System.EventHandler(Publish);
            cControl.SaveToPublish  += new System.EventHandler(SendToPublish);

            // Add panes to property page...
            cControl.tpProp.Controls.AddAt(1, publishProps);
            cControl.tpProp.Controls.AddAt(2, linkProps);

            // add preview to properties pane too
            addPreviewButton(cControl.tpProp.Menu, _document.Id);
        }