For this exercise, We will explain how to create a button in 20/20 DataShed's admin pages which only administrators can see.
To add a button to the administrative pages in 20/20 DataShed which only the administrators can see.
In this tutorial, we will perform the following actions:
<%@ Language="VBScript" ENABLESESSIONSTATE="False" %>
<%
Option Explicit
response.buffer = true
dim booleanIsParentFolder
booleanIsParentFolder = False
%>
<!--#include file="_locals.asp"-->
<% IF CheckRoles(optionStr("permitManageItems_Write"),arrRoles) THEN %>
<ul class="adminVerticalMenuList" id="adminCustomMenuList">
<li><a href="MyLink.html">My Button Text</a></li>
</ul>
<% END IF %>
Example answer: "1,3"
Example answer: "1,2"
optionStr("permitManageUsers_Write")
The above code would produce a list of roles which have permission to manage users. Typically this would be an administrator.
optionStr("permitSQLReports_Write")
The above code would produce a list of roles which have permission to create SQL reports. Typically this would be a webmaster or administrator.
optionStr("permitDatabaseUtilities_Write") &","& optionStr("permitManageCategories_Write")
The above code would produce a list of roles which have permission to both perform database backups and add/delete/rename categories. Typically this would be a webmaster.
optionStr("permitChangePassword_Write")
The above code would produce a list of roles which have permission to change their own account password. Typically this would be any registered user.
<% IF CheckRoles(optionStr("permitDatabaseUtilities_Write") &","& optionStr("permitManageCategories_Write"),arrRoles) THEN %>
If this is true, then this user is a webmaster or privelaged administrator.
<% ELSE %>
Otherwise, this user is not authorized.
< END IF %>
In the previous sections we created an ASP file -- a "stand-alone" script with a very simple purpose to produce a button (only for users with some administrative privelage who can manage items in the database). Now we will show you how 20/20 DataShed's skinning engine can execute ("include") that file within your admin template.
[2020Execute_myAdminButton.asp]
In the example code below, you can see that we'll include the button under the other menu buttons.
<html>
<head>
<title></title>
</head>
<body>
<!-- HEADER STUFF -->
<h1>Welcome to the Admin Pages!</h1>
<!-- END OF HEADER STUFF -->
<!-- MENU STUFF -->
<div style="float:left;width:200px;">
[2020Inject_ApplicationToolsOptions]
[2020Inject_AccountMenuOptions]
[2020Inject_AdminMenuOptions]
[2020Inject_ContextMenuOptions]
[2020Inject_QuickFindForm]
[2020Execute_myAdminButton.asp]
</div>
<!-- END OF MENU STUFF -->
<!-- BODY (Main Content) STUFF -->
<div style="margin-left:215px;">
[2020Inject_2020Applications_AdminBody]
</div>
<!-- END OF BODY STUFF -->
</body>
</html>
Example: http://www.your_domain.com/login.asp?objApplication=RemoveAllYou should see your new button within your template. (And anybody without permission to manage items will not see the new button.
In 20/20 DataShed versions prior to v1.1.1(Beta), the "2020applications_adminstylesheet.css" defined the menus by their ID attributes instead of by their classname.
This was done to provide greater flexibility for each of the individual menu sections. However, it has since become apparent that the classname would be more efficient.
As well, the information in the tutorial above (the comments about the button's style and CSS inheritance assumes that the "2020applications_adminstylesheet.css" file contains the most up-to-date revisions.
Follow these instructions to update your stylesheet if you'd like this new button to be styled similar to the other menu buttons:
/* MAIN MENU styles */
.adminVerticalMenuList #adminAppToolsSubMenuList,
#adminAccountMenuList,
#adminAdminMenuList,
#adminContextMenuList {
text-align:left;
width:170px;
margin:0px;
padding:0px;
border-style:solid;
border-color:#a0a9bc;
border-width:1px;
border-top-width:0px;
border-bottom-width:0px;
line-height:22px;
}
#adminAppToolsSubMenuList {
border-top-width:1px;
}
.adminVerticalMenuList li #adminAppToolsSubMenuList li,
#adminAccountMenuList li,
#adminAdminMenuList li,
#adminContextMenuList li {
display:inline;
}
.adminVerticalMenuList li a,
.adminVerticalMenuList li a:link,
.adminVerticalMenuList li a:active,
.adminVerticalMenuList li a:visited #adminAppToolsSubMenuList li a,
#adminAccountMenuList li a,
#adminAdminMenuList li a,
#adminAppToolsSubMenuList li a:link,
#adminAccountMenuList li a:link,
#adminAdminMenuList li a:link,
#adminAppToolsSubMenuList li a:active,
#adminAccountMenuList li a:active,
#adminAdminMenuList li a:active,
#adminAppToolsSubMenuList li a:visited,
#adminAccountMenuList li a:visited,
#adminAdminMenuList li a:visited,
#adminContextMenuList li a,
#adminContextMenuList li a:link,
#adminContextMenuList li a:active,
#adminContextMenuList li a:visited {
margin:0px;
width:99.99%;
display:block;
background-color:#ded4b4;
border-style:solid;
border-color:#a0a9bc;
border-width:0px;
border-bottom-width:1px;
text-decoration:none;
font-family:Tahoma,Arial,serif;
font-weight:bold;
font-size:10px;
}
#adminContextMenuList li a,
#adminContextMenuList li a:visited,
#adminContextMenuList li a:link,
#adminContextMenuList li a:active {
background-color:#183c63;
color:#ebe9e3;
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFebe9e3', EndColorStr='#FF183c63')
}
.adminVerticalMenuList li a:hover #adminAppToolsSubMenuList li a:hover,
#adminAccountMenuList li a:hover,
#adminAdminMenuList li a:hover,
#adminContextMenuList li a:hover {
background-color:#fbf6e5;
border-style:outset;
color:#a0a9bc;
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFffffff', EndColorStr='#FFebe9e3')
}
.adminVerticalMenuList .currentPageMenuItem a,
.adminVerticalMenuList .currentPageMenuItem a:link,
.adminVerticalMenuList .currentPageMenuItem a:active,
.adminVerticalMenuList .currentPageMenuItem a:visited #adminAppToolsSubMenuList .currentPageMenuItem a,
#adminAccountMenuList .currentPageMenuItem a,
#adminAdminMenuList .currentPageMenuItem a,
#adminAppToolsSubMenuList .currentPageMenuItem a:link,
#adminAccountMenuList .currentPageMenuItem a:link,
#adminAdminMenuList .currentPageMenuItem a:link,
#adminAppToolsSubMenuList .currentPageMenuItem a:active,
#adminAccountMenuList .currentPageMenuItem a:active,
#adminAdminMenuList .currentPageMenuItem a:active,
#adminAppToolsSubMenuList .currentPageMenuItem a:visited,
#adminAccountMenuList .currentPageMenuItem a:visited,
#adminAdminMenuList .currentPageMenuItem a:visited {
background-color:#fbf6e5;
border-style:outset;
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFffffff', EndColorStr='#FFebe9e3')
}
.adminVerticalMenuList .importantPageMenuItemOn a,
.adminVerticalMenuList .importantPageMenuItemOn a:link,
.adminVerticalMenuList .importantPageMenuItemOn a:active,
.adminVerticalMenuList .importantPageMenuItemOn a:visited #adminAppToolsSubMenuList .importantPageMenuItemOn a,
#adminAccountMenuList .importantPageMenuItemOn a,
#adminAdminMenuList .importantPageMenuItemOn a,
#adminAppToolsSubMenuList .importantPageMenuItemOn a:link,
#adminAccountMenuList .importantPageMenuItemOn a:link,
#adminAdminMenuList .importantPageMenuItemOn a:link,
#adminAppToolsSubMenuList .importantPageMenuItemOn a:active,
#adminAccountMenuList .importantPageMenuItemOn a:active,
#adminAdminMenuList .importantPageMenuItemOn a:active,
#adminAppToolsSubMenuList .importantPageMenuItemOn a:visited,
#adminAccountMenuList .importantPageMenuItemOn a:visited,
#adminAdminMenuList .importantPageMenuItemOn a:visited {
background-color:#fbf6e5;
border-style:outset;
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFffffff', EndColorStr='#FFebe9e3')
}