Wednesday, November 11, 2009

Sitefinity Admin Tools

Telerik Sitefinity is an ASP.NET 2.0-based Content Management System (CMS) that enables the construction of dynamic, fully editable Web sites.
Sitefinity's out-of-the-box functionality, creating custom modules, and incorporating any ASP.NET 2.0 component in the site could be achieved by using Sitefinity APIs in the Visual Studio development environment.

Default Modules provided by them we can edit add our own controls in the tools.

Adding a Tools(Nothing but an customized module): our own control
1) Create a table in the DB access the link via.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[QFC_Module](
[ModuleID] [int] IDENTITY(1,1) NOT NULL,
[ModuleName] [nvarchar](255) NULL, -- UserMangement
[ModulePath] [nvarchar](500) NULL, -- /ApplicationPath/Folder/UserList.aspx
[Priority] [int] NULL, -- sequence
CONSTRAINT [PK_QFC_Module] PRIMARY KEY CLUSTERED
(
[ModuleID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

2) Add a Values manually
ex; 1, UserMangement, /ApplicationPath/Folder/UserList.aspx, Order
customized all modules admin would like to get in a CMS when login.

3)Write sp to get the Modules.



4).cs back based on the role also we can hide the link position. should control in DB level

if (!IsPostBack)
{
QFCLib objQFCLib = new QFCLib();
DataTable dtModules = objQFCLib.GetModules();
string strhtml = "";
try
{
if (dtModules.Rows.Count > 0)
{
foreach (DataRow dr in dtModules.Rows)
{
string strModuleName = dr["ModuleName"].ToString();
Telerik.WebControls.RadWindow rw = new Telerik.WebControls.RadWindow();
rw.Title = strModuleName;
rw.ID = "RW" + dr["ModuleID"].ToString();
rw.Height = Unit.Pixel(600);
rw.Width = Unit.Pixel(800);
rw.VisibleStatusbar = false;
RadWindowManager1.Windows.Add(rw);
strhtml += "

  • " + strModuleName + "
  • ";

    }
    }
    }
    catch (Exception ex)
    {
    AppLogger.LogError("PageLoad ModuleBinding() " + ex.Message, AppLogger.Severity.Error);
    }
    dtModules.Dispose();
    ul_container.InnerHtml = strhtml;

    }
    5)Drag and drop the Usercontrol on sitefinity tools.aspx page. just deactivate all controls placed on the Page.

    Copyright © 2009 Angel