Пример #1
0
        /// <summary>
        /// Handles the <c>MessageReceived</c> event of the Live Editing manager.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected override void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
        {
            switch (e.Type)
            {
                case "unpublishcontent":
                    Document currentPage = new Document(int.Parse(UmbracoContext.Current.PageId.ToString()));
                    //library.UnPublishSingleNode(currentPage.Id);
                    //currentPage.UnPublish();

                    //Unpublish (triphulcas way)
                    currentPage.SetProperty("public", 0);

                    string redirectUrl = "/";
                    try
                    {
                        redirectUrl = library.NiceUrl(currentPage.Parent.Id);
                    }
                    catch
                    {
                    }

                    //disable live editing:
                    UmbracoContext.Current.LiveEditingContext.Enabled = false;

                    Page.Response.Redirect(redirectUrl);
                    break;
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the MessageReceived event of the Manager control.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
        {
            switch (e.Type)
            {
            case "save":
                SaveButton_Click(sender, null);
                break;

            case "saveAndPublish":
                SaveAndPublishButton_Click(sender, null);
                break;
            }
        }
Пример #3
0
 /// <summary>
 /// Handles the <c>MessageReceived</c> event of the manager.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected override void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
 {
     switch (e.Type)
     {
         case "deletecontent":
             Document currentPage = new Document(int.Parse(UmbracoContext.Current.PageId.ToString()));
             string redirectUrl = "/";
             try
             {
                 redirectUrl = library.NiceUrl(currentPage.Parent.Id);
             }
             catch { }
             currentPage.delete();
             Page.Response.Redirect(redirectUrl);
             break;
     }
 }
Пример #4
0
        protected override void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
        {
            switch (e.Type)
            {
                case "injectmodule":
                    //update template, insert macro tag
                    InsertModule(NodeFactory.Node.GetCurrent().template, e.Message.Split(';')[0], e.Message.Split(';')[1], e.Message.Split(';')[2] == "prepend");
                    break;
                case "movemodule":

                    string moduleId = e.Message.Split(';')[0];
                    string parentId = e.Message.Split(';')[1];

                    int index = 0;
                    int.TryParse(e.Message.Split(';')[2], out index);

                    HtmlNode module = FindModule(NodeFactory.Node.GetCurrent().template, moduleId, false);

                    if (module != null)
                    {
                        FindModule(NodeFactory.Node.GetCurrent().template, moduleId, true);
                        MoveModule(NodeFactory.Node.GetCurrent().template, module, parentId, index);
                    }

                    break;

                case "removemodule":

                    FindModule(NodeFactory.Node.GetCurrent().template,  e.Message.Split(';')[0], true);

                    break;

            }
        }
Пример #5
0
 /// <summary>
 /// Handles the <c>MessageReceived</c> event of the Live Editing manager.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected virtual void Manager_MessageReceived(object sender, MesssageReceivedArgs e) { }
Пример #6
0
 /// <summary>
 /// Handles the MessageReceived event of the Manager control.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
 {
     switch (e.Type)
     {
         case "save":
             SaveButton_Click(sender, null);
             break;
         case "saveAndPublish":
             SaveAndPublishButton_Click(sender, null);
             break;
     }
 }
Пример #7
0
 /// <summary>
 /// Handles the <c>MessageReceived</c> event of the manager.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected override void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
 {
     switch (e.Type)
     {
         case "createcontent":      
             var userid = BasePages.UmbracoEnsuredPage.GetUserId(BasePages.UmbracoEnsuredPage.umbracoUserContextID);
             var typeToCreate = new DocumentType(Convert.ToInt32(m_AllowedDocTypesDropdown.SelectedValue));
             var newDoc = Document.MakeNew(m_NameTextBox.Text, typeToCreate, new BusinessLogic.User(userid), (int)UmbracoContext.Current.PageId);
             newDoc.SaveAndPublish(new BusinessLogic.User(userid));
             Page.Response.Redirect(library.NiceUrl(newDoc.Id), false);
             break;
     }
 }
Пример #8
0
 /// <summary>
 /// Handles the <c>MessageReceived</c> event of the manager.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
 {
     switch (e.Type)
     {
         case "edititem":
             StartEditing(int.Parse(e.Message));
             break;
     }
 }