trint99
-
9/23/2006 2:47:23 AM
Re: Don't show editiable regions when document not checked out.
The following code is a stop-gap fix until the new version comes out. (Hey, Kentico guys. If you want to use this for your fix, that's fine with me.) All of this code was scavanged from various parts of CMSPageManager.cs. Use with caution as I don't use culture on my site so I left out some things.
In CMSControls_CS/CMSEditableRegions.cs starting around line 219...
private void ReloadControls() { // Clear control collection. this.Controls.Clear();
// BEGIN EDIT: To prevent editable controls from displaying when the page is not checked out. int userId; if( this.Context.Session["CMSUserID"] == null ) { userId = 0; } else { userId = System.Convert.ToInt32( this.Context.Session["CMSUserID"] ); }
Kentico.CMS.TreeEngine.TreeProvider tree = new Kentico.CMS.TreeEngine.TreeProvider(); tree.UserID = userId; Kentico.CMS.TreeEngine.TreeNode node = tree.SelectSingleNode( this.CurrentPageAliasPath, Kentico.CMS.TreeEngine.TreePathTypeEnum.AliasPath );
int checkedOut = System.Convert.ToInt32( node.GetValue( "CheckedOutByUserID" ) );
// Add child controls to the control collection. if( checkedOut == userId & this.IsEditable == true & this.IsAuthorized == true ) //if ( this.IsEditable == true & this.IsAuthorized == true ) // END EDIT
Pretty simple workaround, if you ask me.
Thanks!
|