Hello Bryan,
We just translated the implementation to VB for you. You can find it in the attached archive.
In case you have already made some changes to RadEditorControl.ascx.vb file since the original version, here is the code we have added(in red):
Private btnUnlock As Button
...
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
...
If DesignerMode = DesignerModes.Public OrElse DesignerMode = DesignerModes.PublicLogged Then
...
Else
Dim isAdmin As Boolean = ServerInfo.Principal.IsInRole("Administrators")
If isAdmin AndAlso (Not Me.Enabled) AndAlso (Me._deignerPageStatus = DesignerPageStatus.Unlocked OrElse Me._deignerPageStatus = DesignerPageStatus.AsLive) AndAlso (Me._deignerLayoutStatus = DesignerLayoutStatus.Unlocked OrElse Me._deignerLayoutStatus = DesignerLayoutStatus.AsLive)
Then
btnUnlock = New Button()
btnUnlock.Text = "Unlock and lose changes"
btnUnlock.ToolTip = String.Format("This content is checked out by '{0}'", GetGuiltyUser())
AddHandler btnUnlock.Click, AddressOf btnUnlock_Click
workflowHolder1.Controls.Add(btnUnlock)
' Add link to ContentDiff tool
workflowHolder1.Controls.Add(New LiteralControl(" "))
Dim link As HyperLink = New HyperLink()
link.Text = "View changes"
link.NavigateUrl = String.Format("javascript:radDesignerControl.showContentDiffs({0}, '{1}')", Me._cellId, Me.SelectedLanguage)
workflowHolder1.Controls.Add(link)
End If
...
End Sub 'Page_Load
Private Sub btnUnlock_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim pageManager As PageManager = CType(TelerikCmsContext.Current.CmsManager.CmsPageManager, PageManager)
pageManager.DeleteCellContent(Me.CellId, 0)
pageManager.ChangeDefaultCellStatus(CellId, CByte(DesignerContentStatus.Unlocked))
Response.Redirect(Request.RawUrl, True)
End Sub
Private Function GetGuiltyUser() As String
Dim username As String = String.Empty
Dim dbFactory As Telerik.ContentManagement.Db.DatabaseFactory = New Telerik.ContentManagement.Db.DatabaseFactory(DataStore.DbMode, DataStore.ConnectionString)
Using db As Telerik.ContentManagement.Db.Database = dbFactory.CreateDatabase()
Dim sql As String = "SELECT" & ControlChars.CrLf & " users.Username" & ControlChars.CrLf & "FROM" & ControlChars.CrLf & " RadDesignerPageCellContents contents" & ControlChars.CrLf & "INNER JOIN" & ControlChars.CrLf & " RadDesignerUsers AS users" & ControlChars.CrLf & "ON" & ControlChars.CrLf & " contents.UserId = users.UserId" & ControlChars.CrLf & "WHERE" & ControlChars.CrLf & " contents.CellId = " & Me._cellId
Dim command As IDbCommand = db.NewCommand(sql, False)
Dim reader As IDataReader = command.ExecuteReader()
If reader.Read() Then
username = reader(0).ToString()
End If
reader.Close()
End Using
Return username
End Function
Hope this will help.
Sincerely yours,
Vlad
the telerik team