Commit f8dc3d77 authored by Nigel McNie's avatar Nigel McNie
Browse files

Cleanups to view/view.php now it's only doing views.

In particular, finally, the name of the user is linked to their profile page, which should surely help discovery of their profiles, given it's the main way that people see one another's content.
parent f01acfa7
......@@ -9,28 +9,17 @@
</div>
{/if}
<div id="view">
<h3>
{foreach name=viewnav from=$VIEWNAV item=item}
{$item}
{if !$smarty.foreach.viewnav.last}
:
{/if}
{/foreach}
</h3>
<h3>{$viewtitle|escape} {str tag=by section=view} <a href="{$WWWROOT}user/view.php?id={$viewowner}">{$formattedowner|escape}</a></h3>
{if $DESCRIPTION}
<p class="view-description">{$DESCRIPTION}</p>
{/if}
<p class="view-description">{$viewdescription}</p>
<div id="bottom-pane">
<div id="column-container">
{if $VIEWCONTENT}
{$VIEWCONTENT}
{/if}
<div class="cb">
</div>
<div id="bottom-pane">
<div id="column-container">
{$viewcontent}
<div class="cb">
</div>
</div>
</div>
<div id="publicfeedback">
<table id="feedbacktable">
<thead>
......
......@@ -37,19 +37,11 @@ if (!can_view_view($viewid)) {
throw new AccessDeniedException();
}
$viewbeingwatched = 0;
// TODO: remove this langstring
$title = get_string('titleformatted', 'view', $view->get('title'), $view->formatted_owner());
define('TITLE', $title);
$description = '';
$navlist = array($title);
$description = $view->get('description');
$jsartefact = 'undefined';
$content = $view->build_columns();
global $USER;
$tutorfilefeedbackformrow = '';
$submittedgroup = $view->get('submittedto');
if ($submittedgroup
&& record_exists('group_member',
......@@ -64,10 +56,6 @@ if ($submittedgroup
}
$viewbeingwatched = (int)record_exists('usr_watchlist_view', 'usr', $USER->get('id'), 'view', $viewid);
if (empty($tutorfilefeedbackformrow)) {
$tutorfilefeedbackformrow = '';
}
$getstring = quotestrings(array('mahara' => array(
'message', 'makepublic', 'placefeedback', 'cancel', 'complaint',
'feedbackonthisartefactwillbeprivate', 'notifysiteadministrator',
......@@ -91,7 +79,6 @@ else {
$javascript = <<<EOF
var view = {$viewid};
var artefact = {$jsartefact};
function feedbackform() {
if ($('menuform')) {
......@@ -112,9 +99,6 @@ function feedbackform() {
var data = {'view':view,
'public':form.ispublic.checked,
'message':form.message.value};
if (artefact) {
data.artefact = artefact;
}
sendjsonrequest('addfeedback.json.php', data, 'POST', function () {
removeElement('menuform');
feedbacklist.doupdate();
......@@ -147,9 +131,6 @@ function objectionform() {
var form = FORM({'id':'menuform','method':'post'});
submitobjection = function () {
var data = {'view':view, 'message':form.message.value};
if (artefact) {
data.artefact = artefact;
}
sendjsonrequest('objectionable.json.php', data, 'POST', function () { removeElement('menuform'); });
return false;
}
......@@ -182,7 +163,7 @@ function view_menu() {
A({'href':'', 'onclick':'window.print();return false;'},
{$getstring['print']})
);
if (config.loggedin && !artefact) {
if (config.loggedin) {
var linkTextFlag = {$viewbeingwatched};
var linkText = [{$getstring['addtowatchlist']}, {$getstring['removefromwatchlist']}];
link = A({'href': ''}, linkText[linkTextFlag]);
......@@ -252,8 +233,7 @@ var feedbacklist = new TableRenderer(
feedbacklist.limit = 10;
feedbacklist.view = view;
feedbacklist.artefact = artefact;
feedbacklist.statevars.push('view','artefact');
feedbacklist.statevars.push('view');
feedbacklist.emptycontent = {$getstring['nopublicfeedback']};
feedbacklist.updateOnLoad();
......@@ -274,15 +254,17 @@ $smarty = smarty(
'stylesheets' => array('style/views.css'),
)
);
$smarty->assign('DESCRIPTION', $description);
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('VIEWNAV', $navlist);
if (isset($content)) {
$smarty->assign('VIEWCONTENT', $content);
}
$smarty->assign('viewid', $viewid);
$smarty->assign('viewtitle', $view->get('title'));
$smarty->assign('viewdescription', $view->get('description'));
$smarty->assign('viewcontent', $view->build_columns());
$smarty->assign('viewowner', $view->get('owner'));
$smarty->assign('formattedowner', $view->formatted_owner());
if ($USER->get('id') == $view->get('owner')) {
$smarty->assign('can_edit', true);
$smarty->assign('viewid', $viewid);
}
$smarty->display('view/view.tpl');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment