02-25-05 10: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")||(CmsHttpConte
xt.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
>
>
>
[ Post a follow-up to this message ]
|