Microsoft Content Management Server - Re: Url Replacement in HTMLplaceholder results ?nrmode=unpublished

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > August 2005 > Re: Url Replacement in HTMLplaceholder results ?nrmode=unpublished





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 Re: Url Replacement in HTMLplaceholder results ?nrmode=unpublished
Danny Hille

2005-08-31, 7:49 am

After a lot of testing peeking and poking I ended up where i started.
- New day same problem.

I rewrote my code to use the methods exposed by the plaveholdercontroles.
That did not help at all, i checked the url was valid. infact i wrote a test
aspx page
that takes a posting as a querystringparameter.
and enables you to edit the xml/html placeholdres on a page.
using this method the urls are still being written to the server as
?REMODE=Unpublished (even though I use updatemode)

Please help me, or direct me to a consulent that can help with this problem.

To minimize the amount of code i just unclude the save method.

//----------------------------------------------------------------------------------------------
// savePostingDetails
//----------------------------------------------------------------------------------------------
string savePostingDetails()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
string pguid = Request.Form["postingGUID"];
if(pguid!=null && pguid!="")
{
CmsApplicationContext cac = new CmsApplicationContext();
try
{
string un=Session["VELUXCMSUser"] as String;
string pw=Session["VELUXCMSPassword"] as String;
if(un!=null && pw!=null)
{
//This ugly hack is to support formslogin/autologin (is doesnot matter
if we use formslogin of windows authentication)
//the MCMS urls are still saved as nrmode=unpublished
//Te reason i dont use CmsHttpContext.Current.... is that this code is
not nessarely called from a template
cac.AuthenticateAsUser( un,pw,PublishingMode.Unpublished);
}
else
{
cac. AuthenticateAsCurrentUser(PublishingMode
.Update);
}
Posting p = cac.Searches.GetByGuid(pguid)as Posting;
if(p!=null)
{
if(p.CanSetProperties)
{
bool shouldsubmit = false;
//Set DisplayName
string postingDisplayName =
Server.UrlDecode(Request.Form["postingDisplayName"]);
if(postingDisplayName!=null && postingDisplayName!=p.DisplayName)
p.DisplayName = postingDisplayName;

//Set Name
string postingName = Request.Form["postingName"];
if(postingName!=null && postingName!=p.Name)
p.Name = postingName;

//Set Discription
string postingDescription = Request.Form["postingDescription"];
if(postingDescription!=null && postingDescription!=p.Description)
p.Description = postingDescription;

for(int i=0;i<p.Placeholders.Count;i++)
{
string type = "";
string raw = "";
string placeHolderContent =
Request.Form["postingPlaceholder_"+p.Placeholders[i].Name];
if(placeHolderContent!=null)
{
string content = "";
if(p.Placeholders[i] is XmlPlaceholder)
{
//do stuff for the XmlPlaceholder
}
else if(p.Placeholders[i] is HtmlPlaceholder)
{
//save HtmlPlaceholder content if content differs from postdate
type = "HtmlPlaceholder";
HtmlPlaceholder hph = p.Placeholders[i] as HtmlPlaceholder;
if(hph!=null)
{
content = hph.Html;
if(content!=placeHolderContent)
{
hph.Html = placeHolderContent;
shouldsubmit=true;
}
}
}
else
{
type = "Other";
//Discard if other
}
}
}
if(shouldsubmit)
{
if(p.CanSubmit)
{
p.Submit();
}
if(p.CanApprove)
{
p.Approve();
}
cac.CommitAll();
}
}
}

}
catch(Exception ex)
{
string exc = ex.ToString();
sb.Append(exc);
}
finally{cac.Dispose();}
}
// debug
sb.Append("<tt>");
for(int i=0;i< Request.Form.Count;i++)
{
sb.Append(Request.Form.AllKeys[i] + " = " +
Request.Form[i].Replace("<","<").Replace(">",">") + "<br>");
}
sb.Append("</tt></div>");
return sb.ToString();
}

Thanks
Danny
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com