Commit 7a8e51cb authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith

The reworking of the sidebars

parent abc98039
......@@ -6,9 +6,8 @@
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str section="artefact.blog" tag=$pagetitle}</h2>
{$textinputform}
......
......@@ -7,9 +7,7 @@
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<div id="myblogs">
......
......@@ -6,9 +6,8 @@
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str section="artefact.blog" tag="newblog"}</h2>
{$newblogform}
......
......@@ -6,9 +6,8 @@
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str section="artefact.blog" tag="newblogpost"}</h2>
{$newpostform}
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str section="artefact.blog" tag="blogsettings"}</h2>
......
......@@ -6,9 +6,7 @@
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str section="artefact.blog" tag="viewblog"} - {$blog->get('title')|escape}</h2>
......
......@@ -42,8 +42,20 @@ browser.changedircallback = uploader.updatedestination;
JAVASCRIPT;
$smarty = smarty(array('tablerenderer',
'artefact/file/js/file.js'));
$smarty = smarty(
array('tablerenderer', 'artefact/file/js/file.js'),
array(),
array(),
array(
'sideblocks' => array(
array(
'name' => 'quota',
'weight' => -10,
'data' => array(),
),
),
)
);
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->display('artefact:file:index.tpl');
......
{include file="header.tpl"}
<div id="column-right">
{include file="quota.tpl"}
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str section="artefact.file" tag="myfiles"}</h2>
......
......@@ -28,7 +28,20 @@ define('INTERNAL', 1);
define('MENUITEM', 'myprofile');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('profileicons', 'artefact.internal'));
$smarty = smarty(array('tablerenderer'));
$smarty = smarty(
array('tablerenderer'),
array(),
array(),
array(
'sideblocks' => array(
array(
'name' => 'quota',
'weight' => -10,
'data' => array(),
),
),
)
);
$settingsform = new Pieform(array(
'name' => 'settings',
......
{include file="header.tpl"}
{include file="sidebar.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="columnleftstart.tpl"}
<div class="fr leftrightlink"><a href="profileicons.php" id="editprofileicons">{str tag="editprofileicons" section="artefact.internal"} &raquo;</a></div>
......
{include file="header.tpl"}
<div id="column-right">
{include file="quota.tpl"}
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
......
{include file="header.tpl"}
{include file="sidebar.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="columnleftstart.tpl"}
<h2>{str section="artefact.internal" tag="emailactivation"}</h2>
<p>
......
......@@ -699,6 +699,72 @@ function auth_handle_account_expiries() {
}
}
function auth_generate_login_form() {
require_once('pieforms/pieform.php');
$institutions = get_records_menu('institution', '', '', 'name, displayname');
$defaultinstitution = get_cookie('institution');
if (!$defaultinstitution) {
$defaultinstitution = 'mahara';
}
$loginform = get_login_form_js(pieform(array(
'name' => 'login',
'renderer' => 'div',
'submit' => false,
'plugintype' => 'auth',
'pluginname' => 'internal',
'elements' => array(
'login' => array(
'type' => 'fieldset',
'legend' => get_string('login'),
'elements' => array(
'login_username' => array(
'type' => 'text',
'title' => get_string('username') . ':',
'description' => get_string('usernamedescription'),
'rules' => array(
'required' => true
)
),
'login_password' => array(
'type' => 'password',
'title' => get_string('password') . ':',
'description' => get_string('passworddescription'),
'value' => '',
'rules' => array(
'required' => true
)
),
'login_institution' => array(
'type' => 'select',
'title' => get_string('institution') . ':',
'defaultvalue' => $defaultinstitution,
'options' => $institutions,
'rules' => array(
'required' => true
),
'ignore' => count($institutions) == 1,
'help' => true,
),
'chelp' => array(
'value' => get_help_icon('core', 'login', null, null, null, 'loginbox'),
),
)
),
'submit' => array(
'type' => 'submit',
'value' => get_string('login')
),
'register' => array(
'value' => '<div><a href="' . get_config('wwwroot') . 'register.php" tabindex="2">' . get_string('register') . '</a>'
. '<br><a href="' . get_config('wwwroot') . 'forgotpass.php" tabindex="2">' . get_string('passwordreminder') . '</a></div>'
)
)
)));
return $loginform;
}
class PluginAuth extends Plugin {
......
......@@ -33,67 +33,6 @@ define('TITLE', get_string('home'));
// Check for whether the user is logged in, before processing the page. After
// this, we can guarantee whether the user is logged in or not for this page.
if (!$USER->is_logged_in()) {
require_once('pieforms/pieform.php');
$institutions = get_records_menu('institution', '', '', 'name, displayname');
$defaultinstitution = get_cookie('institution');
if (!$defaultinstitution) {
$defaultinstitution = 'mahara';
}
$loginform = get_login_form_js(pieform(array(
'name' => 'login',
'renderer' => 'div',
'submit' => false,
'plugintype' => 'auth',
'pluginname' => 'internal',
'elements' => array(
'login' => array(
'type' => 'fieldset',
'legend' => get_string('login'),
'elements' => array(
'login_username' => array(
'type' => 'text',
'title' => get_string('username') . ':',
'description' => get_string('usernamedescription'),
'rules' => array(
'required' => true
)
),
'login_password' => array(
'type' => 'password',
'title' => get_string('password') . ':',
'description' => get_string('passworddescription'),
'value' => '',
'rules' => array(
'required' => true
)
),
'login_institution' => array(
'type' => 'select',
'title' => get_string('institution') . ':',
'defaultvalue' => $defaultinstitution,
'options' => $institutions,
'rules' => array(
'required' => true
),
'ignore' => count($institutions) == 1,
'help' => true,
),
'chelp' => array(
'value' => get_help_icon('core', 'login', null, null, null, 'loginbox'),
),
)
),
'submit' => array(
'type' => 'submit',
'value' => get_string('login')
),
'register' => array(
'value' => '<div><a href="' . get_config('wwwroot') . 'register.php" tabindex="2">' . get_string('register') . '</a>'
. '<br><a href="' . get_config('wwwroot') . 'forgotpass.php" tabindex="2">' . get_string('passwordreminder') . '</a></div>'
)
)
)));
$pagename = 'loggedouthome';
}
else {
......@@ -101,9 +40,6 @@ else {
}
$smarty = smarty();
if (!$USER->is_logged_in()) {
$smarty->assign('login_form', $loginform);
}
$smarty->assign('page_content', get_site_page_content($pagename));
$smarty->display('index.tpl');
......
......@@ -54,6 +54,7 @@ defined('INTERNAL') || die();
//smarty(array('js/tablerenderer.js', 'artefact/file/js/filebrowser.js'))
function &smarty($javascript = array(), $headers = array(), $pagestrings = array(), $extraconfig = array()) {
global $USER, $SESSION;
$SIDEBLOCKS = array();
require_once(get_config('libroot') . 'smarty/Smarty.class.php');
$wwwroot = get_config('wwwroot');
......@@ -207,9 +208,6 @@ EOF;
$smarty->compile_dir = get_config('dataroot').'smarty/compile';
$smarty->cache_dir = get_config('dataroot').'smarty/cache';
if (get_config('installed')) {
$smarty->assign('SITEMENU', site_menu());
}
$smarty->assign('THEMEURL', get_config('themeurl'));
$smarty->assign('STYLESHEETLIST', array_reverse(theme_get_url('style/style.css', null, true)));
$smarty->assign('WWWROOT', $wwwroot);
......@@ -252,6 +250,37 @@ EOF;
$smarty->assign('PAGEHELPICON', $help[1]);
}
// ---------- sideblock stuff ----------
if (get_config('installed')) {
$smarty->assign('SITEMENU', site_menu());
$SIDEBLOCKS[] = array(
'name' => 'mainmenu',
'weight' => 10,
'data' => site_menu(),
);
}
if (!$USER->is_logged_in()) {
$SIDEBLOCKS[] = array(
'name' => 'login',
'weight' => -10,
'id' => 'loginbox',
'data' => array(
'loginform' => auth_generate_login_form(),
),
);
}
if (isset($extraconfig['sideblocks']) && is_array($extraconfig['sideblocks'])) {
foreach ($extraconfig['sideblocks'] as $sideblock) {
$SIDEBLOCKS[] = $sideblock;
}
}
usort($SIDEBLOCKS, create_function('$a,$b', 'if ($a["weight"] == $b["weight"]) return 0; return ($a["weight"] < $b["weight"]) ? -1 : 1;'));
$smarty->assign('SIDEBLOCKS', $SIDEBLOCKS);
return $smarty;
}
......
......@@ -500,13 +500,16 @@ div.sidebar p {
/* LOGIN FOR COLUMN RIGHT ONLY BEGINS */
.loginbox-botcorners {
.sidebar-botcorners {
margin-left: -10px;
}
#loginbox .sidebar-botcorners {
margin-left: 0;
}
#column-right #loginbox {
width: 228px;
background: #FFF url(../images/sidebox1_top_headerbg.gif) no-repeat top;
padding-top: 10px;
padding: 10px 0 0 0;
margin-bottom: 10px;
color: #000;
}
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="activity"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="activityprefs"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="preferences"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="watchlist"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str section="admin" tag="adminfiles"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="myaddressbook"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
<div id="column-left">
<div class="content">
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
<div id="column-left">
<div class="content">
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="mycommunities"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="myownedcommunities"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{$community->name}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="creategroup"}</h2>
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="editgroup"}</h2>
{$editgroup}
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{str tag="mygroups"}</h2>
......
{include file="header.tpl"}
{include file="sidebar.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
{include file="columnleftstart.tpl"}
<h2>{str tag="myfriends"}</h2>
<form>
......
{include file="header.tpl"}
<div id="column-right">
{if !$LOGGEDIN}
<div id="loginbox">
<noscript><p>{str tag="javascriptnotenabled"}</p></noscript>
{$login_form}
<div class="sidebar-botcorners"><img src="{theme_path location='images/sidebox_bot.gif'}" border="0" alt=""></div>
</div>
{/if}
{include file="adminmenu.tpl"}
</div>
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
{$page_content}
......
{include file="header.tpl"}
<div id="column-right">
<div class="sidebarforgotpassword"><a href="{$WWWROOT}forgotpass.php">{str tag=forgotpassword}</a></div>
<div class="sidebarforgotpassword-botcorners"><img src="{theme_path location='images/sidebox_bot.gif'}" border="0" alt=""></div>
{include file="adminmenu.tpl"}
</div>
{include file="columnleftstart.tpl"}
{include file="columnfullstart.tpl"}
<h2>{str tag=register}</h2>
{if $register_form}
......@@ -17,5 +9,5 @@
{elseif $register_profile_form}
{$register_profile_form}
{/if}
{include file="columnleftend.tpl"}
{include file="columnfullend.tpl"}
{include file="footer.tpl"}
<div id="column-right">
{foreach from=$SIDEBLOCKS item=sideblock}