Commit 01a16c39 authored by Richard Mansfield's avatar Richard Mansfield

Signed-off-by: Richard Mansfield <richardm@catalyst.net.nz>

Fix merge
Simplify to use normal themes as view themes
Remove view/edit profile page links from menu and add to edit profile page
Add link to edit profile page when editing profile View
Use microheader on view editing pages
parent e0a037c3
{include file="header.tpl"}
<div class="rbuttons">
<a href="{$WWWROOT}user/view.php">{str tag=viewmyprofilepage}</a>&nbsp;
<a class="btn-edit" href="{$WWWROOT}view/blocks.php?profile=1">{str tag=editmyprofilepage}</a>
</div>
{$profileform}
<script type="text/javascript">
......
......@@ -184,7 +184,6 @@ $string['siteoptionsset'] = 'Site options have been updated.';
$string['sitethemedescription'] = 'The default theme for the site';
$string['tagssideblockmaxtags'] = 'Maximum Tags in Cloud';
$string['tagssideblockmaxtagsdescription'] = 'The default number of tags to display in user tag clouds';
$string['theme'] = 'Theme';
$string['trustedsites'] = 'Trusted sites';
$string['updatesiteoptions'] = 'Update site options';
$string['usersallowedmultipleinstitutions'] = 'Users allowed multiple institutions';
......
......@@ -474,8 +474,6 @@ $string['findgroups'] = 'Find Groups';
$string['returntosite'] = 'Return to Site';
$string['siteadministration'] = 'Site Administration';
$string['useradministration'] = 'User Administration';
$string['viewmyprofilepage'] = 'View profile page';
$string['editmyprofilepage'] = 'Edit profile page';
$string['unreadmessages'] = 'unread messages';
$string['unreadmessage'] = 'unread message';
......@@ -875,17 +873,17 @@ $string['remotehost'] = 'Remote host %s';
$string['Copyof'] = 'Copy of %s';
// Profie views
// Profile views
$string['loggedinusersonly'] = 'Logged in users only';
$string['allowpublicaccess'] = 'Allow public (non logged in) access';
$string['thisistheprofilepagefor'] = 'This is the profile page for %s';
$string['viewmyprofilepage'] = 'View profile page';
$string['editmyprofilepage'] = 'Edit profile page';
$string['usersprofile'] = "%s's Profile";
$string['pleasedonotreplytothismessage'] = "Please do not reply to this message.";
$string['theme'] = 'Theme';
$string['deleteduser'] = 'Deleted user';
$string['recentupdates'] = 'Recent Updates';
$string['theme'] = 'Theme';
?>
......@@ -514,21 +514,26 @@ function get_language_root($language=null) {
* Return a list of available themes.
*/
function get_themes() {
$themes = array();
$themebase = get_config('docroot') . 'theme/';
if (!$themedir = opendir($themebase)) {
throw new SystemException('Unable to read theme directory '.$themebase);
}
while (false !== ($subdir = readdir($themedir))) {
if ($subdir != "." && $subdir != ".." && is_dir($themebase . $subdir)) {
$config_path = $themebase . $subdir . '/themeconfig.php';
if (is_readable($config_path)) {
require($config_path);
$themes[$subdir] = isset($theme->displayname) ? $theme->displayname : $subdir;
static $themes = null;
if (is_null($themes)) {
$themes = array();
$themebase = get_config('docroot') . 'theme/';
if (!$themedir = opendir($themebase)) {
throw new SystemException('Unable to read theme directory '.$themebase);
}
while (false !== ($subdir = readdir($themedir))) {
if ($subdir != "." && $subdir != ".." && is_dir($themebase . $subdir)) {
$config_path = $themebase . $subdir . '/themeconfig.php';
if (is_readable($config_path)) {
require($config_path);
$themes[$subdir] = isset($theme->displayname) ? $theme->displayname : $subdir;
}
}
}
closedir($themedir);
}
closedir($themedir);
return $themes;
}
......
......@@ -247,7 +247,7 @@ function Pieform(data) {//{{{
self.iframe = createDOM('iframe', {
'name': iframeName,
'id' : iframeName,
'style': 'position: absolute; visibility: hidden; height: 0;'
'style': 'position: absolute; visibility: hidden;'
});
insertSiblingNodesAfter(self.data.name, self.iframe);
}
......
......@@ -486,14 +486,6 @@ class View {
return $this->groupobj;
}
public function get_theme() {
if ($theme = $this->get('theme')) {
return explode('/', $theme, 2);
}
$sitedefault = get_config('theme');
return array($sitedefault, $sitedefault);
}
public function delete() {
db_begin();
......@@ -873,8 +865,7 @@ class View {
}
$viewtheme = param_variable('viewtheme', '');
if ($viewtheme != join('/', $this->get_theme())
&& preg_match('#^[a-z0-9-]+/[a-z0-9-]+$#i', $viewtheme)) {
if ($viewtheme && $viewtheme != $this->get('theme')) {
$this->set('theme', $viewtheme);
}
......@@ -1720,36 +1711,6 @@ class View {
return $baseurl;
}
/**
* Returns the list of avaliable view themes
*/
public static function get_viewthemes() {
static $list = null;
if (is_null($list)) {
foreach (array_keys(get_themes()) as $themename) {
$viewthemebase = get_config('docroot') . 'theme/' . $themename . '/viewthemes/';
if (is_dir($viewthemebase) && $viewthemedir = opendir($viewthemebase)) {
while (false !== ($subdir = readdir($viewthemedir))) {
if ($subdir != "." && $subdir != ".." && is_dir($viewthemebase . $subdir)) {
$configfile = $viewthemebase . $subdir . '/config.php';
if (is_readable($configfile)) {
require($configfile);
$list[] = array(
'id' => $themename . '/' . $subdir,
'name' => $viewtheme->name
);
}
}
}
}
}
}
usort($list, create_function('$a, $b', 'return strnatcasecmp($a["name"], $b["name"]);'));
return $list;
}
/**
* Builds data for the artefact chooser.
*
......
......@@ -1872,18 +1872,6 @@ function mahara_standard_nav() {
'weight' => 40,
'ignore' => !$exportenabled,
),
array(
'path' => 'profile/view',
'url' => 'user/view.php',
'title' => get_string('viewmyprofilepage'),
'weight' => 9,
),
array(
'path' => 'profile/editprofilepage',
'url' => 'view/blocks.php?profile=1',
'title' => get_string('editmyprofilepage'),
'weight' => 9,
),
array(
'path' => 'groups',
'url' => 'group/mygroups.php',
......
<?php
$viewtheme = new stdClass;
$viewtheme->name = 'Aqua';
?>
<?php
$viewtheme = new stdClass;
$viewtheme->name = 'Mahara';
?>
<?php
$viewtheme = new stdClass;
$viewtheme->name = 'Fresh';
?>
......@@ -539,14 +539,6 @@ div.rbuttons .small-logo {
padding: .5em;
margin: 0 .25em 1px;
}
#dropshadow {
background-image: url(../images/dropshadow.png);
background-repeat: repeat-x;
z-index: 1;
height: 15px;
width: 100%;
float: left;
}
.viewheader .small-logo img {
margin: .5em;
padding: 0;
......
......@@ -44,4 +44,3 @@
</div>
</div>
{include file="footer.tpl"}
{include file="header.tpl"}
{include file="viewmicroheader.tpl"}
<h1>{$PAGEHEADING|escape}</h1>
{if $columns}
{str tag="editblockspagedescription" section="view"}
......@@ -19,29 +20,24 @@
<div class="cb"></div>
</div>
<table id="middle-pane">
<tr>
<div id="middle-pane">
<table class="fullwidth"><tr>
<td>
<a id="layout-link" href="columns.php?id={$view}&amp;c={$category}&amp;new={$new}"{if !$can_change_layout} class="disabled"{/if}>{str tag='changeviewlayout' section='view'}</a> {contextualhelp plugintype="core" pluginname="view" section="changeviewlayout"}
</td>
<td class="center">
<select id="viewtheme-select" name="viewtheme">
<option value="">Choose theme...</option>
{foreach from=$viewthemes item=theme}
<option value="{$theme.id|escape}"{if $theme.id == $viewtheme} selected="selected" style="font-weight: bold;"{/if}>{$theme.name|escape}</option>
{foreach from=$viewthemes key=themeid item=themename}
<option value="{$themeid|escape}"{if $themeid == $viewtheme} selected="selected" style="font-weight: bold;"{/if}>{$themename|escape}</option>
{/foreach}
</select>
</td>
<td class="right">
<a id="btn-displaymyview" href="{$viewurl|escape}">{str tag=displaymyview section=view} &raquo;</a>
<a id="btn-displaymyview" href="view.php?id={$view}&amp;new={$new}">{str tag=displaymyview section=view} &raquo;</a></td>
</td>
</tr>
</table>
<a id="btn-displaymyview" class="fr" href="view.php?id={$view}&amp;new={$new}">{str tag=displaymyview section=view} &raquo;</a>
<a id="layout-link" href="columns.php?id={$view}&amp;c={$category}&amp;new={$new}"{if !$can_change_layout} class="disabled"{/if}>{str tag='changeviewlayout' section='view'}</a> {contextualhelp plugintype="core" pluginname="view" section="changeviewlayout"}
<div class="cb"></div>
</tr></table>
</div>
<div id="bottom-pane">
<div id="column-container">
......@@ -95,4 +91,4 @@
</div>
</div>
{/if}
{include file="footer.tpl"}
{include file="microfooter.tpl"}
......@@ -14,12 +14,12 @@
</div>
<div class="lbuttons">
{if $backurl}<a class="btn-reply" href="{$backurl}">{str tag=back}</a>&nbsp;{/if}
{if $can_edit}<a class="btn-edit" href="blocks.php?id={$viewid}&amp;new={$new}">{str tag=edit}</a>{/if}
{if $can_edit}<a class="btn-edit" href="{$WWWROOT}view/blocks.php?id={$viewid}&amp;new={$new}">{str tag=edit}</a>&nbsp;{/if}
{if $edit_profile}<a class="btn-edit" href="{$WWWROOT}artefact/internal/index.php">{str tag=editprofile section=artefact.internal}</a>{/if}
</div>
<div class="center">
{if !$new}<a href="{$WWWROOT}view/view.php?id={$viewid}">{/if}{$viewtitle|escape}{if !$new}</a>{/if}{if $ownername} {str tag=by section=view} <a href="{$WWWROOT}{$ownerlink}">{$ownername|escape}</a>{/if}</div>
</div>
<!--div id="dropshadow"></div-->
</div>
<div id="main-wrapper">
<div class="main-column">
......
<?php
$viewtheme = new stdClass;
$viewtheme->name = 'Raw';
?>
<?php
$viewtheme = new stdClass;
$viewtheme->name = 'Sunset';
?>
<?php
$viewtheme = new stdClass;
$viewtheme->name = 'Ultima';
?>
......@@ -87,7 +87,6 @@
text-align: center;
}
<<<<<<< HEAD:htdocs/theme/views.css
/* Between top and bottom pane */
#middle-pane {
width: 100%;
......@@ -95,22 +94,10 @@
#middle-pane td {
width: 33%;
}
=======
>>>>>>> master:htdocs/theme/views.css
<<<<<<< HEAD:htdocs/theme/views.css
/* Bottom half of the page */
#page #bottom-pane {
margin: .5em 0;
border: 5px solid #eee;
}
#column-container {
width: 100%;
=======
/********************** Bottom pane of Edit View *************************/
html>body #column-container {
* width: 100%;
>>>>>>> master:htdocs/theme/views.css
}
#blocksinstruction {
padding: 0 1em .5em;
......@@ -491,8 +478,8 @@ div.artefactchooser-splitter {
padding: 1em;
}
#view-wizard-controls form {
display: inline;
#view-wizard-controls {
padding-bottom: .5em;
}
#view-description {
......
......@@ -67,24 +67,22 @@ if (!$view || !can_view_view($view->get('id'))) {
}
// Set up theme
list($basetheme, $viewtheme) = $view->get_theme();
if ($THEME->basename != $basetheme) {
$THEME = new Theme($basetheme);
$viewtheme = $view->get('theme');
if ($viewtheme && $THEME->basename != $viewtheme) {
$THEME = new Theme($viewtheme);
}
$stylesheets = array(
// Basic structure CSS
'<link rel="stylesheet" type="text/css" href="'
. get_config('wwwroot') . 'theme/views.css">',
// Extra CSS for the view theme
'<link rel="stylesheet" type="text/css" href="'
. get_config('wwwroot') . 'theme/' . $basetheme . '/viewthemes/' . $viewtheme . '/views.css">',
);
$stylesheets = array('<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'theme/views.css">');
$name = display_name($user);
define('TITLE', $name);
$smarty = smarty(
array('lib/pieforms/static/core/pieforms.js'),
$stylesheets
$stylesheets,
array(),
array(
'stylesheets' => array('style/views.css'),
'sidebars' => false,
)
);
$sql = "SELECT g.*, a.type FROM {group} g JOIN (
......@@ -309,11 +307,12 @@ $smarty->assign('canmessage', can_send_message($loggedinid, $userid));
$smarty->assign('NAME',$name);
$smarty->assign('USERID', $userid);
$smarty->assign('viewid', $view->get('id'));
$smarty->assign('viewtitle', 'This is the profile of ' . display_name($user) . ' at ' . get_config('sitename'));
$smarty->assign('viewtitle', get_string('usersprofile', 'mahara', display_name($user, null, true)));
if ($loggedinid && $loggedinid == $userid) {
$smarty->assign('edit_url', get_config('wwwroot') . 'view/blocks.php?profile=' . $userid);
$smarty->assign('can_edit', true);
$smarty->assign('edit_profile', true);
}
if (isset($_SERVER['HTTP_REFERER']) && false === strpos($_SERVER['HTTP_REFERER'], get_config('wwwroot') . 'user/view.php?id=' . $userid)) {
if (isset($_SERVER['HTTP_REFERER'])) {
$smarty->assign('backurl', $_SERVER['HTTP_REFERER']);
}
$smarty->assign('viewcontent', $view->build_columns());
......
......@@ -116,39 +116,24 @@ if ($category === '') {
$view->process_changes($category, $new);
// Set up theme
list($basetheme, $viewtheme) = $view->get_theme();
if ($THEME->basename != $basetheme) {
$THEME = new Theme($basetheme);
}
$stylesheets = array(
// Basic structure CSS
'<link rel="stylesheet" type="text/css" href="'
. get_config('wwwroot') . 'theme/views.css">',
// Extra CSS for the view theme
'<link rel="stylesheet" type="text/css" href="'
. get_config('wwwroot') . 'theme/' . $basetheme . '/viewthemes/' . $viewtheme . '/views.css">',
$extraconfig = array(
'stylesheets' => array('style/views.css'),
'sidebars' => false,
);
<<<<<<< HEAD:htdocs/view/blocks.php
foreach ($THEME->get_url('style/style.css', true, 'artefact/file') as $sheet) {
=======
// Set up theme
$viewtheme = $view->get('theme');
if ($viewtheme && $THEME->basename != $viewtheme) {
$THEME = new Theme($viewtheme);
}
// Pull in cross-theme view stylesheet and file stylesheets
$stylesheets = array('<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'theme/views.css">');
foreach (array_reverse($THEME->get_url('style/style.css', true, 'artefact/file')) as $sheet) {
>>>>>>> master:htdocs/view/blocks.php
$stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . $sheet . '">';
}
<<<<<<< HEAD:htdocs/view/blocks.php
$smarty = smarty(
array('views', 'tinytinymce', 'paginator', 'tablerenderer', 'artefact/file/js/filebrowser.js', 'lib/pieforms/static/core/pieforms.js'),
$stylesheets,
false,
array('sidebars' => false)
);
=======
$smarty = smarty(array('views', 'tinymce', 'paginator', 'tablerenderer', 'artefact/file/js/filebrowser.js', 'lib/pieforms/static/core/pieforms.js', 'blocktype/creativecommons/js/creativecommons.js'), $stylesheets, false, $extraconfig);
>>>>>>> master:htdocs/view/blocks.php
// The list of categories for the tabbed interface
$smarty->assign('category_list', $view->build_category_list($category, $new));
......@@ -156,9 +141,6 @@ $smarty->assign('category_list', $view->build_category_list($category, $new));
// The list of blocktypes for the default category
$smarty->assign('blocktype_list', $view->build_blocktype_list($category));
$smarty->assign('viewtheme', "$basetheme/$viewtheme");
$smarty->assign('viewthemes', View::get_viewthemes());
// Tell smarty we're editing rather than just rendering
$smarty->assign('editing', true);
......@@ -188,12 +170,21 @@ $smarty->assign('profile', $profile);
$smarty->assign('view', $view->get('id'));
$smarty->assign('groupid', $group);
$smarty->assign('institution', $institution);
$smarty->assign('viewurl', (!empty($profile))
? get_config('wwwroot') . 'user/view.php?id=' . $view->get('owner')
: 'view.php?id=' . $view->get('id') . '&new=' . $new
);
$smarty->assign('can_change_layout', (!$USER->get_account_preference('addremovecolumns') || ($view->get('numcolumns') > 1 && $view->get('numcolumns') < 5)));
$smarty->assign('viewtheme', $viewtheme);
$smarty->assign('viewthemes', get_themes());
$smarty->assign('viewid', $view->get('id'));
$smarty->assign('viewtitle', $view->get('title'));
$owner = $view->get('owner');
if ($owner) {
$smarty->assign('ownerlink', 'user/view.php?id=' . $owner);
}
else if ($group) {
$smarty->assign('ownerlink', 'group/view.php?id=' . $group);
}
$blockid = $view->get_blockinstance_currently_being_configured();
if (!$blockid) {
$blockid = param_integer('block', 0);
......
......@@ -139,34 +139,23 @@ if ($USER->is_logged_in()) {
$objectionform = pieform(objection_form());
}
<<<<<<< HEAD:htdocs/view/view.php
// Set up theme
list($basetheme, $viewtheme) = $view->get_theme();
if ($THEME->basename != $basetheme) {
$THEME = new Theme($basetheme);
$viewtheme = $view->get('theme');
if ($viewtheme && $THEME->basename != $viewtheme) {
$THEME = new Theme($viewtheme);
}
$stylesheets = array(
// Basic structure CSS
'<link rel="stylesheet" type="text/css" href="'
. get_config('wwwroot') . 'theme/views.css">',
// Extra CSS for the view theme
'<link rel="stylesheet" type="text/css" href="'
. get_config('wwwroot') . 'theme/' . $basetheme . '/viewthemes/' . $viewtheme . '/views.css">',
);
=======
$stylesheets = array('<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'theme/views.css">');
$can_edit = $USER->can_edit_view($view) && !$submittedgroup && !$view->is_submitted();
>>>>>>> master:htdocs/view/view.php
$smarty = smarty(
<<<<<<< HEAD:htdocs/view/view.php
array('mahara', 'tablerenderer', 'feedbacklist', 'artefact/resume/resumeshowhide.js'),
$stylesheets,
=======
array('paginator', 'feedbacklist', 'artefact/resume/resumeshowhide.js'),
array('<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'theme/views.css">'),
>>>>>>> master:htdocs/view/view.php
$stylesheets,
array(),
array('sidebars' => false)
array(
'stylesheets' => array('style/views.css'),
'sidebars' => false,
)
);
$javascript = <<<EOF
......@@ -179,38 +168,18 @@ EOF;
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('new', $new);
$smarty->assign('viewid', $viewid);
<<<<<<< HEAD:htdocs/view/view.php
=======
$smarty->assign('viewtitle', $view->get('title'));
$smarty->assign('feedback', $feedback);
>>>>>>> master:htdocs/view/view.php
$owner = $view->get('owner');
<<<<<<< HEAD:htdocs/view/view.php
if ($owner && $USER->get('id') == $owner && !$submittedgroup && !$view->is_submitted()) {
$smarty->assign('edit_url', get_config('wwwroot') . 'view/blocks.php?id=' . $viewid . '&new=' . $new);
}
$ownerlink = '';
=======
$smarty->assign('owner', $owner);
$smarty->assign('tags', $view->get('tags'));
>>>>>>> master:htdocs/view/view.php
if ($owner) {
<<<<<<< HEAD:htdocs/view/view.php
$ownerlink = 'user/view.php?id=' . $owner;
=======
$smarty->assign('ownerlink', 'user/view.php?id=' . $owner);
>>>>>>> master:htdocs/view/view.php
}
else if ($group) {
$ownerlink = 'group/view.php?id=' . $group;
$smarty->assign('ownerlink', 'group/view.php?id=' . $group);
}
<<<<<<< HEAD:htdocs/view/view.php
$smarty->assign('viewtitle', get_string('viewtitle', 'view',
$view->get('title'),
'<a href="' . get_config('wwwroot') . hsc($ownerlink) . '">' . display_name($owner) . '</a>'
));
=======
if ($can_edit) {
$smarty->assign('can_edit', 1);