|
Home > Archive > Microsoft Content Management Server > February 2005 > Customizing delete
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Customizing delete
|
|
| Randall 2005-02-25, 2:50 am |
| Hi all,
I am trying to customizing the delete action and for that I am writing code
in this module.
protected override void PerformActionBehavior()
{
base.PerformActionBehavior();
customcode();
}
Looks like this module is never called. Any suggestions?
Thanks!
Randall
| |
| Frank Joppe 2005-02-25, 5:49 pm |
| Randall:
Did you write this custom code in a custom control? Are you sure you
are using this custom control in your console or a substitution of it?
"=?Utf-8?B?UmFuZGFsbA==?=" <Randall@discussions.microsoft.com> wrote in message news:<69E705A6-3139-4A03-A39A-538EE8B561E5@microsoft.com>...
> Hi all,
>
> I am trying to customizing the delete action and for that I am writing code
> in this module.
> protected override void PerformActionBehavior()
> {
>
> base.PerformActionBehavior();
> customcode();
> }
>
> Looks like this module is never called. Any suggestions?
>
> Thanks!
> Randall
| |
| Stefan [MSFT] 2005-02-25, 5:49 pm |
| Hi Randall,
if it never gets called, then you might not have added your custom action to
the defaultconsole.ascx file.
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:69E705A6-3139-4A03-A39A-538EE8B561E5@microsoft.com...
> Hi all,
>
> I am trying to customizing the delete action and for that I am writing
code
> in this module.
> protected override void PerformActionBehavior()
> {
>
> base.PerformActionBehavior();
> customcode();
> }
>
> Looks like this module is never called. Any suggestions?
>
> Thanks!
> Randall
>
| |
| Randall 2005-02-25, 5:49 pm |
| Stefan,
What do you mean by custom action? Delete.cs or the customcode() method?
Thanks!
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> if it never gets called, then you might not have added your custom action to
> the defaultconsole.ascx file.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:69E705A6-3139-4A03-A39A-538EE8B561E5@microsoft.com...
> code
>
>
>
| |
| Randall 2005-02-25, 5:49 pm |
| Stafan and Frank,
Thanks for replying back to me.
Custom control is a function defined in that delete.cs file. and in
PerformActionBehaviour after calling the Base.PerformBehaviourAction I am
trying to call this function.
I am sure that this delete.cs is called because I have added it
defaultconsole.ascx.
If I do debugging then Control goes in that module and does everything but
if I just run the application then after deleteing the posting nothing
happens.
Any idea?
I appreciate your help.
Thanks!!
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> if it never gets called, then you might not have added your custom action to
> the defaultconsole.ascx file.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:69E705A6-3139-4A03-A39A-538EE8B561E5@microsoft.com...
> code
>
>
>
| |
| Stefan [MSFT] 2005-02-25, 5:49 pm |
| Hi Randall,
a custom action is one of your actions. You need to add or replace one of
the actions in the defaultconsole.ascx with your own action to get it
implemented.
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:C2D14449-148B-4DF2-A610-5CA142F92079@microsoft.com...[vbcol=seagreen]
> Stefan,
>
> What do you mean by custom action? Delete.cs or the customcode() method?
>
> Thanks!
> Randall
>
> "Stefan [MSFT]" wrote:
>
action to[vbcol=seagreen]
rights[vbcol=seagreen]
| |
| Stefan [MSFT] 2005-02-25, 5:49 pm |
| Hi Randall,
please explain in more detail. You mentioned when doing debugging the
routine is called.
When is it not called?
What is the difference?
I did not understand the explanation below.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:078EEDD8-B743-49BD-AEE0-79C6AC47F997@microsoft.com...[vbcol=seagreen]
> Stafan and Frank,
>
> Thanks for replying back to me.
> Custom control is a function defined in that delete.cs file. and in
> PerformActionBehaviour after calling the Base.PerformBehaviourAction I am
> trying to call this function.
> I am sure that this delete.cs is called because I have added it
> defaultconsole.ascx.
>
> If I do debugging then Control goes in that module and does everything but
> if I just run the application then after deleteing the posting nothing
> happens.
>
> Any idea?
> I appreciate your help.
>
> Thanks!!
> Randall
>
>
> "Stefan [MSFT]" wrote:
>
action to[vbcol=seagreen]
rights[vbcol=seagreen]
| |
| Randall 2005-02-25, 5:49 pm |
| I did that . That's how it executes the custom console action except for that
method.
Any idea ? I appreciate you help.
Thanks!
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> a custom action is one of your actions. You need to add or replace one of
> the actions in the defaultconsole.ascx with your own action to get it
> implemented.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:C2D14449-148B-4DF2-A610-5CA142F92079@microsoft.com...
> action to
> rights
>
>
>
| |
| Stefan [MSFT] 2005-02-25, 5:49 pm |
| Hi Randall,
please post your complete code.
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:4A4BF6BA-C631-492D-AADD-DAFCDBD634F7@microsoft.com...
> I did that . That's how it executes the custom console action except for
that[vbcol=seagreen]
> method.
> Any idea ? I appreciate you help.
>
> Thanks!
> Randall
>
> "Stefan [MSFT]" wrote:
>
of[vbcol=seagreen]
rights[vbcol=seagreen]
method?[vbcol=seagreen]
writing[vbcol=seagreen]
| |
| Randall 2005-02-25, 5:49 pm |
| Stefan,
Here is the code.
====================
using System;
using System.IO;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using Microsoft.ContentManagement.Publishing;
using Microsoft.ContentManagement.Publishing.Extensions.Placeholders;
using Microsoft.ContentManagement.Web;
using Microsoft.ContentManagement.WebAuthor;
using Microsoft.ContentManagement.WebControls;
using Microsoft.ContentManagement.WebControls.ConsoleControls;
using System.Data.SqlClient;
using System.Xml;
namespace CMSCustomControls
{
/// <summary>
/// Summary description for Delete.
/// </summary>
public class Delete :
Microsoft.ContentManagement.WebControls.ConsoleControls.DeleteAction
{
public Delete()
{
//
// TODO: Add constructor logic here
//
}
public override string Text
{
get
{
return "Delete";
}
}
//
public override string ActionJavascript
{
get
{
if((CmsHttpContext.Current.Posting.Name.ToLower()=="default")||(CmsHttpContext.Current.Posting.Template.Name=="Topics"))
{
if(CmsHttpContext.Current.Posting.CustomProperties["Delete"].Value ==
"False")
{
string returnValue;
returnValue = "window.alert('You can not delete this posting.')";
return returnValue;
}
else
{
string action = base.ActionJavascript;
return action;
}
}
else
{
string action = base.ActionJavascript;
return action;
}
}
}
protected override void PerformActionBehavior()
{
base.PerformActionBehavior();
GenerateRssXml();
}
protected string GetPostingSummary(Posting p)
{
return p.Description;
}
protected void GenerateRssXml()
{
XmlTextWriter Xmlwriter = new XmlTextWriter("c:/news/index1.xml",
Encoding.UTF8);
Xmlwriter.WriteStartElement("rss");
Xmlwriter.WriteAttributeString("version", "2.0");
Xmlwriter.WriteStartElement("channel");
Xmlwriter.WriteElementString("title","News Releases");
Xmlwriter.WriteElementString("link","link");
Xmlwriter.WriteElementString("copyright","© Copyright");
//Xmlwriter.WriteElementString("description","Description of your Web
site");
int i=0;
PostingCollection pc = newschannel.Postings ;
foreach (Posting p in newschannel.Postings )
{
Xmlwriter.WriteElementString("title",title);
Xmlwriter.WriteElementString("link","+p.url" );
Xmlwriter.WriteElementString("pubDate",p.StartDate.ToLocalTime().ToString("r"));
Xmlwriter.WriteElementString("description",GetPostingSummary(p);
Xmlwriter.WriteElementString("pubDate",p.StartDate
..ToLocalTime().ToString("r"));
Xmlwriter.WriteEndElement();
Xmlwriter.Close();
}
}
}
=============================
index1.xml is never created.
Did I miss something?
Thanks!
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> please post your complete code.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:4A4BF6BA-C631-492D-AADD-DAFCDBD634F7@microsoft.com...
> that
> of
> rights
> method?
> writing
>
>
>
| |
| Randall 2005-02-25, 5:49 pm |
| Stefan,
Did you get a chance to look at the code?
I appreciate your help.
Regards,
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> please post your complete code.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:4A4BF6BA-C631-492D-AADD-DAFCDBD634F7@microsoft.com...
> that
> of
> rights
> method?
> writing
>
>
>
| |
| Randall 2005-02-25, 5:49 pm |
| HI Stefan,
I get htis error when I debug this code.
Delete Failed
--------------------------------------------------------------------------------
Error Details:
Failures occurred during the multi-object commit. One or more objects
modified in this session could not be committed. The session transaction was
rolled-back. Contact the site administrator.
--------------------------------------------------------------------------------
Reattempt Delete Cancel
Any suggestions?
Thanks!
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> please explain in more detail. You mentioned when doing debugging the
> routine is called.
> When is it not called?
> What is the difference?
> I did not understand the explanation below.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:078EEDD8-B743-49BD-AEE0-79C6AC47F997@microsoft.com...
> action to
> rights
>
>
>
| |
| Stefan [MSFT] 2005-02-25, 8:46 pm |
| Hi Randall,
please add a commit in your console actions right after calling
base.PerformActionBehaviour.
Also check if workflow events are configured and being executed - disable
them to ensure that there is no bad interaction between your workflow event
and the console action.
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:DF00653C-7E70-4882-971F-B73BE7E4E725@microsoft.com...
> HI Stefan,
> I get htis error when I debug this code.
> Delete Failed
>
>
> --------------------------------------------------------------------------
------
> Error Details:
> Failures occurred during the multi-object commit. One or more objects
> modified in this session could not be committed. The session transaction
was
> rolled-back. Contact the site administrator.
> --------------------------------------------------------------------------
------[vbcol=seagreen]
> Reattempt Delete Cancel
>
> Any suggestions?
>
> Thanks!
> Randall
>
> "Stefan [MSFT]" wrote:
>
rights[vbcol=seagreen]
am[vbcol=seagreen]
but[vbcol=seagreen]
writing[vbcol=seagreen]
| |
| Stefan [MSFT] 2005-02-25, 8:46 pm |
| Hi Randall,
from what I can see the code looks good.
Did you set a breakpoint in PerformActionBehaviour?
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:DC9F8918-50B5-43AA-AE14-0A3D5A332690@microsoft.com...[vbcol=seagreen]
> Stefan,
>
> Did you get a chance to look at the code?
> I appreciate your help.
>
> Regards,
> Randall
>
> "Stefan [MSFT]" wrote:
>
rights[vbcol=seagreen]
for[vbcol=seagreen]
one[vbcol=seagreen]
it[vbcol=seagreen]
custom[vbcol=seagreen]
no[vbcol=seagreen]
| |
| Randall 2005-02-26, 8:46 pm |
| Yes . I did that and then it executes the code but throws the error. If I
don't set the brekpoint it doesn't look like that it executes the code. Also
how can I "Also check if workflow events are configured and being executed -
disable
them to ensure that there is no bad interaction between your workflow event
and the console action."
I appreciate your help.
Thanks!
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> from what I can see the code looks good.
> Did you set a breakpoint in PerformActionBehaviour?
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:DC9F8918-50B5-43AA-AE14-0A3D5A332690@microsoft.com...
> rights
> for
> one
> it
> custom
> no
>
>
>
| |
| Stefan [MSFT] 2005-02-27, 7:46 am |
| Hi Randall,
that does not sound correct. Setting a breakpoint does not change the
execution path.
If the behaviour is different it might be a timing issue.
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:485FC8B5-E27C-45F3-85D3-5A41E455B3A9@microsoft.com...
> Yes . I did that and then it executes the code but throws the error. If I
> don't set the brekpoint it doesn't look like that it executes the code.
Also
> how can I "Also check if workflow events are configured and being
executed -
> disable
> them to ensure that there is no bad interaction between your workflow
event[vbcol=seagreen]
> and the console action."
>
> I appreciate your help.
> Thanks!
> Randall
>
>
>
> "Stefan [MSFT]" wrote:
>
rights[vbcol=seagreen]
except[vbcol=seagreen]
replace[vbcol=seagreen]
get[vbcol=seagreen]
no[vbcol=seagreen]
customcode()[vbcol=seagreen]
confers[vbcol=seagreen]
message[vbcol=seagreen]
I am[vbcol=seagreen]
| |
| Randall 2005-02-27, 5:52 pm |
| Stefan,
Thanks for replying back to me.
It chages the behavious because even if I write page.Response.End() in the
method it doesn't stop the execution. It's weird and I don't understand this
behaviour.
I hope you can think of something else.
I appreciate your help.
Regards
Randall
"Stefan [MSFT]" wrote:
> Hi Randall,
>
> that does not sound correct. Setting a breakpoint does not change the
> execution path.
> If the behaviour is different it might be a timing issue.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:485FC8B5-E27C-45F3-85D3-5A41E455B3A9@microsoft.com...
> Also
> executed -
> event
> rights
> except
> replace
> get
> no
> customcode()
> confers
> message
> I am
>
>
>
|
|
|
|
|