|
Home > Archive > Microsoft Content Management Server > December 2006 > How to preselect a channel for a new posting
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 |
How to preselect a channel for a new posting
|
|
| svdkooij 2006-12-15, 1:17 pm |
| Hi.
Normally when I switch to the edit site and create a new posting, the
posting will be placed in the current channel.
At this moment our site has the following sitemap (part of it)
/Channels/News
/Channels/News/BoardNews (hidden)
/Channels/News/Location1 (hidden)
/Channels/News/Location2 (hidden)
/Channels/News/Location3 (hidden)
....and so one.
My idea was to create a dropdownlist containing the hidden news
channels. The author can select this channel. When the authors saves
the page (for the first time) the posting should automatically be
placed in the selected channel. How can this be done ?
Is there a common way of doing things ?
Regards
S.
| |
| Stefan Goßner [MSFT] 2006-12-19, 1:19 pm |
| Hi,
you need to create a custom console action for this.
Cheers,
Stefan
"svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
news:1166196774.370848.264010@n67g2000cwd.googlegroups.com...
> Hi.
>
> Normally when I switch to the edit site and create a new posting, the
> posting will be placed in the current channel.
>
> At this moment our site has the following sitemap (part of it)
> /Channels/News
> /Channels/News/BoardNews (hidden)
> /Channels/News/Location1 (hidden)
> /Channels/News/Location2 (hidden)
> /Channels/News/Location3 (hidden)
> ...and so one.
>
> My idea was to create a dropdownlist containing the hidden news
> channels. The author can select this channel. When the authors saves
> the page (for the first time) the posting should automatically be
> placed in the selected channel. How can this be done ?
>
> Is there a common way of doing things ?
>
> Regards
> S.
>
| |
| svdkooij 2006-12-20, 1:16 pm |
| Hi Stefan,
I created a new class that inherits from AuthoringSaveNewAction
(public class SaveNewNewsItem : AuthoringSaveNewAction)
Then I override the PerformActionBehaviour() but I get a "Cannot modify
read only object. The target object is read only and it cannot be
modified." error on the p.MoveTo which I don't quiet understand.
Regards
Sander
protected override void PerformActionBehavior()
{
base.PerformActionBehavior ();
// get current context stuff
CmsHttpContext cmsContext =3D CmsHttpContext.Current;
Posting p =3D cmsContext.Posting;
// move to posting
Channel channelBlog =3D
CmsHttpContext.Current.Searches.GetByPath("/Channels/News/BoardNews/")
as Channel;
p.MoveTo(channelBlog);
// commit
cmsContext.CommitAll();
}
Stefan Go=DFner [MSFT] wrote:[vbcol=seagreen]
> Hi,
>
> you need to create a custom console action for this.
>
> Cheers,
> Stefan
>
>
> "svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
> news:1166196774.370848.264010@n67g2000cwd.googlegroups.com...
| |
| Stefan Goßner [MSFT] 2006-12-21, 1:17 pm |
| Hi Sander,
please add a check in the PerformActionBehaviour if
CmsHttpContext.Current.Mode is PublishingMode.Update or not.
If not don't do this.
Cheers,
Stefan
"svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
news:1166627549.619543.235210@48g2000cwx.googlegroups.com...
Hi Stefan,
I created a new class that inherits from AuthoringSaveNewAction
(public class SaveNewNewsItem : AuthoringSaveNewAction)
Then I override the PerformActionBehaviour() but I get a "Cannot modify
read only object. The target object is read only and it cannot be
modified." error on the p.MoveTo which I don't quiet understand.
Regards
Sander
protected override void PerformActionBehavior()
{
base.PerformActionBehavior ();
// get current context stuff
CmsHttpContext cmsContext = CmsHttpContext.Current;
Posting p = cmsContext.Posting;
// move to posting
Channel channelBlog =
CmsHttpContext.Current.Searches.GetByPath("/Channels/News/BoardNews/")
as Channel;
p.MoveTo(channelBlog);
// commit
cmsContext.CommitAll();
}
Stefan Goßner [MSFT] wrote:[vbcol=seagreen]
> Hi,
>
> you need to create a custom console action for this.
>
> Cheers,
> Stefan
>
>
> "svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
> news:1166196774.370848.264010@n67g2000cwd.googlegroups.com...
| |
| svdkooij 2006-12-21, 7:21 pm |
| Hi Stefan.
Update indicated the an existing posting is in update mode but how can
a new page that has not been saved yet (I doing that with this action)
reach the update mode ?.
After "// move the posing" I added "if (cmsContext.Mode =3D=3D
PublishingMode.Update) { .... code ....}" but it's always unpublished
so the code will not be executed. I also noticed that the posting is
not saved at all. Looking at the html-source I noticed that the onclick
is doing nothing ( the parameter of CMS_preparePostbackUrl('') is
empty. Got no dialog the name the posting either (which I also would
like to do from the PerformActionBehaviour automatically )
Looks like I'm missing something in the implementation of the class...
(
Please enlight...
Regards
Sander
Stefan Go=DFner [MSFT] wrote:
> Hi Sander,
>
> please add a check in the PerformActionBehaviour if
> CmsHttpContext.Current.Mode is PublishingMode.Update or not.
> If not don't do this.
>
> Cheers,
> Stefan
>
> "svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
> news:1166627549.619543.235210@48g2000cwx.googlegroups.com...
> Hi Stefan,
>
> I created a new class that inherits from AuthoringSaveNewAction
> (public class SaveNewNewsItem : AuthoringSaveNewAction)
>
> Then I override the PerformActionBehaviour() but I get a "Cannot modify
> read only object. The target object is read only and it cannot be
> modified." error on the p.MoveTo which I don't quiet understand.
>
> Regards
> Sander
>
> protected override void PerformActionBehavior()
> {
> base.PerformActionBehavior ();
>
> // get current context stuff
> CmsHttpContext cmsContext =3D CmsHttpContext.Current;
> Posting p =3D cmsContext.Posting;
>
> // move to posting
> Channel channelBlog =3D
> CmsHttpContext.Current.Searches.GetByPath("/Channels/News/BoardNews/")
> as Channel;
> p.MoveTo(channelBlog);
>=20
> // commit
> cmsContext.CommitAll();
> }
>
| |
| Stefan Goßner [MSFT] 2006-12-22, 7:24 am |
| Hi Sander,
you might have noticed that during save two postbacks happen: the first goes
into update mode, the second goes back to unpublished mode.
If this does not happen in your implementation then your modifications
prevented the postback to update mode.
Cheers,
Stefan
"svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
news:1166741720.309843.309670@48g2000cwx.googlegroups.com...
Hi Stefan.
Update indicated the an existing posting is in update mode but how can
a new page that has not been saved yet (I doing that with this action)
reach the update mode ?.
After "// move the posing" I added "if (cmsContext.Mode ==
PublishingMode.Update) { .... code ....}" but it's always unpublished
so the code will not be executed. I also noticed that the posting is
not saved at all. Looking at the html-source I noticed that the onclick
is doing nothing ( the parameter of CMS_preparePostbackUrl('') is
empty. Got no dialog the name the posting either (which I also would
like to do from the PerformActionBehaviour automatically )
Looks like I'm missing something in the implementation of the class...
(
Please enlight...
Regards
Sander
Stefan Goßner [MSFT] wrote:
> Hi Sander,
>
> please add a check in the PerformActionBehaviour if
> CmsHttpContext.Current.Mode is PublishingMode.Update or not.
> If not don't do this.
>
> Cheers,
> Stefan
>
> "svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
> news:1166627549.619543.235210@48g2000cwx.googlegroups.com...
> Hi Stefan,
>
> I created a new class that inherits from AuthoringSaveNewAction
> (public class SaveNewNewsItem : AuthoringSaveNewAction)
>
> Then I override the PerformActionBehaviour() but I get a "Cannot modify
> read only object. The target object is read only and it cannot be
> modified." error on the p.MoveTo which I don't quiet understand.
>
> Regards
> Sander
>
> protected override void PerformActionBehavior()
> {
> base.PerformActionBehavior ();
>
> // get current context stuff
> CmsHttpContext cmsContext = CmsHttpContext.Current;
> Posting p = cmsContext.Posting;
>
> // move to posting
> Channel channelBlog =
> CmsHttpContext.Current.Searches.GetByPath("/Channels/News/BoardNews/")
> as Channel;
> p.MoveTo(channelBlog);
>
> // commit
> cmsContext.CommitAll();
> }
>
| |
| svdkooij 2006-12-24, 7:18 am |
| I'v noticed...
...but I don't understand how to proceed. Aren't there any
readingmaterials besides your book and the document I found on msdn
(Extending the Web Author Console) because the do not cover how to
preset channels or posting properties before the posting is even
saved..
I added the base.JavaScriptAction to my class but that leaves me with
normal save behaviour ommiting the PerformActionBehaviour (I checked
with a breakpoint)
Any form of an example would really be helpfull
Regards
Sander
Stefan Go=DFner [MSFT] wrote:
> Hi Sander,
>
> you might have noticed that during save two postbacks happen: the first g=
oes
> into update mode, the second goes back to unpublished mode.
> If this does not happen in your implementation then your modifications
> prevented the postback to update mode.
>
> Cheers,
> Stefan
>
> "svdkooij" <s.vd.kooij@srn.minjus.nl> wrote in message
> news:1166741720.309843.309670@48g2000cwx.googlegroups.com...
> Hi Stefan.
>
> Update indicated the an existing posting is in update mode but how can
> a new page that has not been saved yet (I doing that with this action)
> reach the update mode ?.
> After "// move the posing" I added "if (cmsContext.Mode =3D=3D
> PublishingMode.Update) { .... code ....}" but it's always unpublished
> so the code will not be executed. I also noticed that the posting is
> not saved at all. Looking at the html-source I noticed that the onclick
> is doing nothing ( the parameter of CMS_preparePostbackUrl('') is
> empty. Got no dialog the name the posting either (which I also would
> like to do from the PerformActionBehaviour automatically )
>
> Looks like I'm missing something in the implementation of the class...
> (
>=20
> Please enlight...
>=20
> Regards
> Sander
>=20
>=20
>
|
|
|
|
|