Commit 1a7a7fbd authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add lower menu to ViewView

parent af936298
......@@ -13,6 +13,8 @@ class="cnr-bl"><span class="cnr-br">
{str tag=viewviewnotallowed}
{/if}
<div id="viewmenu"></div>
</div>
</span></span></span></span></div>
</div>
......
......@@ -34,8 +34,88 @@ if (can_view_view($viewid)) {
$content = 'view template display here';
}
$getstring = quotestrings(array('message', 'makepublic', 'placefeedback',
'cancel', 'complaint', 'notifysiteadministrator',
'addtowatchlist', 'placefeedback',
'reportobjectionablematerial', 'print'));
$wwwroot = get_config('wwwroot');
$javascript = <<<JAVASCRIPT
var viewid = {$viewid};
function feedbackform() {
var form = FORM({'id':'feedback','method':'post'});
submitfeedback = function () {
// @todo add support for attached files when user is a tutor.
sendjsonrequest('addfeedback.json.php',
{'view':viewid,
'message':form.message.value,
'public':form.public.checked},
function () { removeElement('feedback'); });
return false;
}
appendChildNodes(form,
TABLE({'border':0, 'cellspacing':0},
TBODY(null,
TR(null, TH(null, LABEL(null, {$getstring['message']}))),
TR(null, TD(null, TEXTAREA({'rows':5, 'cols':80, 'name':'message'}))),
TR(null, TH(null, LABEL(null, {$getstring['makepublic']}),
INPUT({'type':'checkbox', 'name':'public'}))),
TR(null, TD(null,
INPUT({'type':'button', 'value':{$getstring['placefeedback']},
'onclick':'submitfeedback();'}),
INPUT({'type':'button', 'value':{$getstring['cancel']},
'onclick':"removeElement('feedback');"}))))));
appendChildNodes('viewmenu', DIV(null, form));
return false;
}
function objectionform() {
var form = FORM({'id':'objection','method':'post'});
submitobjection = function () {
sendjsonrequest('objectionable.json.php',
{'view':viewid, 'message':form.message.value},
function () { removeElement('objection'); });
return false;
}
appendChildNodes(form,
TABLE({'border':0, 'cellspacing':0},
TBODY(null,
TR(null, TH(null, LABEL(null, {$getstring['complaint']}))),
TR(null, TD(null, TEXTAREA({'rows':5, 'cols':80, 'name':'message'}))),
TR(null, TD(null,
INPUT({'type':'button', 'value':{$getstring['notifysiteadministrator']},
'onclick':'submitobjection();'}),
INPUT({'type':'button', 'value':{$getstring['cancel']},
'onclick':"removeElement('objection');"}))))));
appendChildNodes('viewmenu', DIV(null, form));
return false;
}
function view_menu(type, id) {
var addwatchlist = A({'href':''}, {$getstring['addtowatchlist']});
addwatchlist.onclick = function () {
sendjsonrequest('addwatchlist.json.php', {'viewid':id});
return false;
}
appendChildNodes('viewmenu',
A({'href':'', 'onclick':'return feedbackform();'}, {$getstring['placefeedback']}), ' | ',
A({'href':'', 'onclick':'return objectionform();'},
{$getstring['reportobjectionablematerial']}), ' | ',
A({'href':'', 'onclick':'window.print();'}, {$getstring['print']}), ' | ',
addwatchlist);
}
addLoadEvent(function () {view_menu('view', {$viewid}); });
JAVASCRIPT;
$smarty = smarty();
$smarty->clear_assign('MAINNAV');
//$smarty->clear_assign('MAINNAV');
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('TITLE', $view->title);
if (isset($content)) {
$smarty->assign('VIEWCONTENT', $content);
......
Markdown is supported
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