05-12-04 01:20 AM
Hi Morten
The solution we use (Ok its not particularly elegant) is t0 catch the
propertyChanging event in the Global.aspx file.
If the user has typed a duplicate file name we append the code with
the date and the 'XXXX'. The console checks current posting name and
if it sees the XXXX it generates a message saying that this is a
duplicate posting (Even though it isn't as the name has been changed.
As I say not particularly elegant but it does the job.
(Here the code is checking he file name but a minor change would let
it check the display name)
Please note the minimalist approach to comments.
Mikey
Protected Sub CmsPosting_PropertyChanging(ByVal sender As Object,
ByVal e As PropertyChangingEventArgs)
Dim p As Posting
If e.Target().getType().Name = "Posting" Then
p = e.Target
Dim propName As String = e.PropertyName
Dim tname As String = ""
If propName = "Name" Then
If CheckForDuplicateName(p, e.PropertyValue) Then
e.PropertyValue = e.PropertyValue +
DateTime.Now.ToString("dd-MMM-yyyy HH-mm-ss") & "xxxx"
End If
End If
End If
End Sub
Private Function CheckForDuplicateName(ByVal p As Posting, ByVal
val As String) As Boolean
Dim ch As Microsoft.ContentManagement.Publishing.Channel =
CmsHttpContext.Current.Channel()
Dim post As Posting
post = ch.Postings(val)
If Not post Is Nothing Then
Return True
End If
Return False
End Function
"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message news:<#cRCYUtLEHA.624@TK
2MSFTNGP11.phx.gbl>...[vbcol=seagreen]
> Hi Morten,
>
> the name is applied with a changed event handler later.
> But the name is already available in a Request.Form variable (you need to
> check which one as I don't have the info avail at the moment).
> More elegant is the solution with a modified console action.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
>
> "Morten Petterĝe" <morten@imano.nospam (remove the spam, leave the no)>
> wrote in message news:OFdcODqLEHA.1032@TK2MSFTNGP12.phx.gbl...
> name
> test
> if
> rights.
> switching
> check
[ Post a follow-up to this message ]
|