The Design of an Intranet Application Framework - More on Templates
(Page 4 of 4 )
The next two HTML pages are the templates that are going to be used to display the intranet and application pages respectively. The templates give the applications a uniform, neat and presentable look. They also, like the CSS sheet, make it easy to apply cosmetic changes in one place for all pages to accept those changes. In other words, it makes it very easy to maintain web pages.
Fig1. Intranet template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<link href="intranet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
body {
background-color: #a4c2c2;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="2">
<tr>
<td colspan="2" valign="top" class="logo">DAMARA NAMA PUBLISHING </td>
</tr>
<tr>
<td width="16%" valign="top" bgcolor="#FFFFFF"> </td>
<td width="84%" valign="top" bgcolor="#FFFFFF"><!-- TemplateBeginEditable name="welcome" -->welcome<!-- TemplateEndEditable --></td>
</tr>
<tr>
<td width="16%" valign="top" bgcolor="#FFFFFF"><!-- TemplateBeginEditable name="navigate" -->navigate<!-- TemplateEndEditable --></td>
<td valign="top" bgcolor="#FFFFFF"><!-- TemplateBeginEditable name="main" -->main<!-- TemplateEndEditable --></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top" class="copyright">copyright©2007</td>
</tr>
</table>
</body>
</html>
Fig2. Application template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<link href="intranet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #a4c2c2;
}
-->
</style></head>
<body>
<table width="100%" border="0" cellspacing="2">
<tr>
<td colspan="2" valign="top" class="logo">DAMARA NAMA PUBLISHING </td>
</tr>
<tr>
<td width="13%" valign="top" bgcolor="#FFFFFF"> </td>
<td width="87%" valign="top" bgcolor="#FFFFFF"><!-- TemplateBeginEditable name="welcome" -->welcome<!-- TemplateEndEditable --></td>
</tr>
<tr>
<td width="13%" valign="top" bgcolor="#FFFFFF"><!-- TemplateBeginEditable name="navigate" -->navigate<!-- TemplateEndEditable --></td>
<td valign="top" bgcolor="#FFFFFF"><!-- TemplateBeginEditable name="main" -->main<!-- TemplateEndEditable --></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top" class="copyright">copyright©2007</td>
</tr>
</table>
</body>
</html>
Since we are discussing the wider intranet components, I thought we could deal with the validation class before moving on to the application framework components. The validation class is mainly used to validate form data. It has five functions:
- filledin() - This function checks to see if the form variables are filled in.
- isadmin() - This function checks to see if a user has admin level access.
- checkemail() - This function checks to see if the email address supplied is valid.
- savepass() - This function saves a password in hash form.
- genpass() - This function generates a seven character password.
Below is a fuller outline of the validation class:
<?php
class validate{
function filledin($form_vars){
foreach($form_vars as $key=> $value)
{
if(empty($key) || ($value == ''))
return FALSE;
}
return TRUE;
}
function isadmin($sesslevel){
if($sesslevel == "admin"){
return TRUE;
}else{
return FALSE;
}
}
function checkemail($aEmail){
if(eregi("^([a-z.])+([a-z])+@([a-z])+(.)([a-z]{3})$",$aEmail))
return TRUE;
else
return FALSE;
}//end function
/*password functions*/
function savepass($apass){
$salt = 'SHIFLETT';
$password_hash = md5($salt . md5($apass . $salt));
return $password_hash;
}
function genpass(){
$chars = "1234567890abcdefghij345678klmnopqrs1234tuvwxyz1234567890";
$thepass = '';
for($i=0;$i<7;$i++){
$thepass .= $chars{rand() % 39};
}
return $thepass;
}
}
?>
Conclusion
This article discussed the design of the intranet as well as the applications that it will host. The next article will discuss the components of the application framework.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |