public static void Delete(string NodeType, int NodeId, string Text)
 {
     LegacyDialogHandler.Delete(
         new HttpContextWrapper(HttpContext.Current),
         BasePage.Current.getUser(),
         NodeType, NodeId, Text);
 }
        protected void sbmt_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                var createMacroVal = 0;
                if (createMacro.Checked)
                {
                    createMacroVal = 1;
                }

                var xsltName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? xsltTemplate.SelectedValue :
                               Path.Combine("schema2", xsltTemplate.SelectedValue);

                var returnUrl = LegacyDialogHandler.Create(
                    new HttpContextWrapper(Context),
                    BasePage.Current.getUser(),
                    helper.Request("nodeType"),
                    createMacroVal,
                    xsltName + "|||" + rename.Text);

                BasePage.Current.ClientTools
                .ChangeContentFrameUrl(returnUrl)
                .ChildNodeCreated()
                .CloseModalWindow();
            }
        }
 public static string Create(string NodeType, int TypeId, int NodeId, string Text)
 {
     return(LegacyDialogHandler.Create(
                new HttpContextWrapper(HttpContext.Current),
                BasePage.Current.getUser(),
                NodeType, NodeId, Text, TypeId));
 }
Exemplo n.º 4
0
        public HttpResponseMessage DeleteLegacyItem(string nodeId, string alias, string nodeType)
        {
            //U4-2686 - alias is html encoded, make sure to decode
            alias = HttpUtility.HtmlDecode(alias);

            //In order to process this request we MUST have an HttpContext available
            var httpContextAttempt = TryGetHttpContext();
            if (httpContextAttempt.Success)
            {
                //this is a hack check based on legacy
                if (nodeType == "memberGroups")
                {
                    LegacyDialogHandler.Delete(httpContextAttempt.Result, Security.CurrentUser, nodeType, 0, alias);
                    return Request.CreateResponse(HttpStatusCode.OK);
                }

                int id;
                if (int.TryParse(nodeId, out id))
                {
                    LegacyDialogHandler.Delete(httpContextAttempt.Result, Security.CurrentUser, nodeType, id, alias);
                    return Request.CreateResponse(HttpStatusCode.OK);
                }

                //the way this legacy stuff used to work is that if the node id didn't parse, we would
                //pass the node id as the alias with an id of zero = sure whatevs.
                LegacyDialogHandler.Delete(httpContextAttempt.Result, Security.CurrentUser, nodeType, 0, nodeId);
                return Request.CreateResponse(HttpStatusCode.OK);
            }

            //We must have an HttpContext available for this to work.
            return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new InvalidOperationException("No HttpContext found in the current request"));
        }
Exemplo n.º 5
0
        protected void sbmt_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                int nodeId;
                if (int.TryParse(Request.QueryString["nodeId"], out nodeId) == false)
                {
                    nodeId = -1;
                }

                try
                {
                    var returnUrl = LegacyDialogHandler.Create(
                        new HttpContextWrapper(Context),
                        new User(Security.CurrentUser),
                        Request.GetItemAsString("nodeType"),
                        nodeId,
                        rename.Text.Trim(),
                        Request.QueryString.AsEnumerable().ToDictionary(x => x.Key, x => (object)x.Value));

                    BasePage.Current.ClientTools
                    .ChangeContentFrameUrl(returnUrl)
                    .ReloadActionNode(false, true)
                    .CloseModalWindow();
                }
                catch (Exception ex)
                {
                    CustomValidation.ErrorMessage = "* " + ex.Message;
                    CustomValidation.IsValid      = false;
                }
            }
        }
        public void Delete(string nodeId, string alias, string nodeType)
        {
            if (!AuthorizeRequest())
            {
                return;
            }

            //U4-2686 - alias is html encoded, make sure to decode
            alias = HttpUtility.HtmlDecode(alias);

            //check which parameters to pass depending on the types passed in
            int intNodeId;

            if (nodeType == "memberGroup")
            {
                LegacyDialogHandler.Delete(
                    new HttpContextWrapper(HttpContext.Current),
                    UmbracoUser,
                    nodeType, 0, nodeId);
            }
            else if (int.TryParse(nodeId, out intNodeId) && nodeType != "member") // Fix for #26965 - numeric member login gets parsed as nodeId
            {
                LegacyDialogHandler.Delete(
                    new HttpContextWrapper(HttpContext.Current),
                    UmbracoUser,
                    nodeType, intNodeId, alias);
            }
            else
            {
                LegacyDialogHandler.Delete(
                    new HttpContextWrapper(HttpContext.Current),
                    UmbracoUser,
                    nodeType, 0, nodeId);
            }
        }
Exemplo n.º 7
0
 private bool SecurityCheck(string nodeTypeAlias)
 {
     return(LegacyDialogHandler.UserHasCreateAccess(
                new HttpContextWrapper(Context),
                getUser(),
                nodeTypeAlias));
 }
Exemplo n.º 8
0
        protected void SubmitClick(object sender, System.EventArgs e)
        {
            int createFolder = 0;

            if (scriptType.SelectedValue == "")
            {
                createFolder = 1;
                ContainsValidator.Enabled = true;
                Page.Validate();
            }

            if (Page.IsValid)
            {
                string returnUrl = LegacyDialogHandler.Create(
                    new HttpContextWrapper(Context),
                    BasePage.Current.getUser(),
                    helper.Request("nodeType"),
                    createFolder,
                    rename.Text + '\u00A4' + scriptType.SelectedValue);

                BasePage.Current.ClientTools
                .ChangeContentFrameUrl(returnUrl)
                .ReloadActionNode(false, true)
                .CloseModalWindow();
            }
        }
Exemplo n.º 9
0
        protected void sbmt_Click(object sender, EventArgs e)
        {
            LegacyDialogHandler.Create(
                new HttpContextWrapper(Context),
                BasePage.Current.getUser(),
                helper.Request("nodeType"),
                -1,
                Cultures.SelectedValue);

            BasePage.Current.ClientTools
            .ReloadActionNode(false, true)
            .CloseModalWindow();
        }
Exemplo n.º 10
0
        protected void sbmt_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (ValidateAlias(rename.Text) == false)
                {
                    BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "Error",
                                                                  "Name is empty, invalid, or causing an invalid or duplicate alias.");
                    return;
                }

                var createTemplateVal = 0;
                if (createTemplate.Checked)
                {
                    createTemplateVal = 1;
                }

                // check master type
                string masterTypeVal = String.IsNullOrEmpty(Request.GetItemAsString("nodeId")) || Request.GetItemAsString("nodeId") == "init" ? masterType.SelectedValue : Request.GetItemAsString("nodeId");

                // set master type to none if no master type was selected, or the drop down was hidden because there were no doctypes available
                masterTypeVal = string.IsNullOrEmpty(masterTypeVal) ? "0" : masterTypeVal;

                string returnUrl;
                try
                {
                    // this *may* throw even if Page.IsValid because of race conditions
                    returnUrl = LegacyDialogHandler.Create(
                        new HttpContextWrapper(Context),
                        BasePage.Current.getUser(),
                        Request.GetItemAsString("nodeType"),
                        createTemplateVal,
                        rename.Text,
                        int.Parse(masterTypeVal));
                }
                catch (Exception ex)
                {
                    // because it's always nicer to show a message to user vs YSOD
                    BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "Error",
                                                                  ex.GetType().FullName + ": " + ex.Message);
                    return;
                }

                BasePage.Current.ClientTools
                .ChangeContentFrameUrl(returnUrl)
                .ChildNodeCreated()
                .CloseModalWindow();
            }
        }
Exemplo n.º 11
0
        private void DoCreation()
        {
            if (Page.IsValid)
            {
                var returnUrl = LegacyDialogHandler.Create(
                    new HttpContextWrapper(Context),
                    BasePage.Current.getUser(),
                    helper.Request("nodeType"),
                    int.Parse(Request["nodeID"]),
                    rename.Text,
                    int.Parse(nodeType.SelectedValue));

                BasePage.Current.ClientTools
                .ChangeContentFrameUrl(returnUrl)
                .CloseModalWindow();
            }
        }
Exemplo n.º 12
0
        protected void sbmt_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                var returnUrl = LegacyDialogHandler.Create(
                    new HttpContextWrapper(Context),
                    new User(Security.CurrentUser),
                    Request.GetItemAsString("nodeType"),
                    int.Parse(Request["nodeID"]),
                    rename.Text,
                    int.Parse(nodeType.SelectedValue));

                BasePage.Current.ClientTools
                .ChangeContentFrameUrl(returnUrl)
                .CloseModalWindow();
            }
        }
Exemplo n.º 13
0
        protected void sbmt_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                var memberType  = memberChooser.Visible ? int.Parse(nodeType.SelectedValue) : -1;
                var emailAppend = String.IsNullOrEmpty(Email.Text) ? "" : String.Format("|{0}|{1}|{2}", Email.Text, Password.Text, Login.Text);
                var returnUrl   = LegacyDialogHandler.Create(
                    new HttpContextWrapper(Context),
                    BasePage.Current.getUser(),
                    helper.Request("nodeType"),
                    -1,
                    rename.Text + emailAppend,
                    memberType);

                BasePage.Current.ClientTools
                .ChangeContentFrameUrl(returnUrl)
                .CloseModalWindow();
            }
        }
Exemplo n.º 14
0
        protected void sbmt_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                var createMacroVal = 0;
                if (createMacro.Checked)
                {
                    createMacroVal = 1;
                }

                var returnUrl = LegacyDialogHandler.Create(
                    new HttpContextWrapper(Context),
                    BasePage.Current.getUser(),
                    helper.Request("nodeType"),
                    createMacroVal,
                    template.SelectedValue + "|||" + rename.Text + "." + filetype.SelectedValue);

                BasePage.Current.ClientTools
                .ChangeContentFrameUrl(returnUrl)
                .ChildNodeCreated()
                .CloseModalWindow();
            }
        }