Commit 26c26810 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files
parents f7bd85bb 8a0d85fd
......@@ -104,12 +104,17 @@ $javascript = <<<JAVASCRIPT
function installplugin(name) {
var d = loadJSONDoc('../upgrade.json.php', { 'name': name });
$(name).innerHTML = '<img src="{$loadingicon}" alt="{$loadingstring}" />';
$(name + '.message').innerHTML = '<img src="{$loadingicon}" alt="{$loadingstring}" />';
d.addCallbacks(function (data) {
if (data.success) {
var message = '{$successstring}' + data.newversion;
$(name).innerHTML = '<img src="{$successicon}" alt=":)" /> ' + message;
$(name + '.message').innerHTML = '<img src="{$successicon}" alt=":)" /> ' + message;
// move the whole thing into the list of installed plugins
// new parent node
var bits = name.split('\.');
var newparent = $(bits[0] + '.installed');
appendChildNodes(newparent, $(name));
}
if (data.error) {
var message = '';
......
......@@ -8,38 +8,46 @@
<div class="box-cnrs"><span class="cnr-tl"><span class="cnr-tr"><span class="cnr-bl"><span class="cnr-br">
<div class="maincontent">
<h2>Plugin Administration</h2>
{foreach from=$plugins key='plugintype' item='plugins'}
<h4>{str tag='plugintype'}: {$plugintype}</h4>
{assign var="installed" value=$plugins.installed}
{assign var="notinstalled" value=$plugins.notinstalled}
<p><b>{str tag='installedplugins'}</b></p>
{foreach from=$installed key='plugin' item='data'}
{$plugin}
{if $data.config}
(<a href="pluginconfig.php?plugintype={$plugintype}&amp;pluginname={$plugin}">{str tag='config'}</a>)
{/if}<br />
{if $data.types}
{foreach from=$data.types key='type' item='config'}
&nbsp;&nbsp;&nbsp;{$type}
{if $config} (<a href="pluginconfig.php?plugintype={$plugintype}&amp;pluginname={$plugin}&amp;type={$type}">{str tag='config'}</a>){/if}<br />
{/foreach}
{/if}
{/foreach}
{if $notinstalled}
<p><b>{str tag='notinstalledplugins'}</b></p>
{foreach from=$notinstalled key='plugin' item='data'}
{$plugin} {if $data.notinstallable} {str tag='notinstallable'} {$data.notinstallable}
{else} (<a href="" onClick="{$installlink}('{$plugintype}.{$plugin}'); return false;">install</a>)
{/if}
<div id="{$plugintype}.{$plugin}"></div>
{/foreach}
{/if}
{/foreach}
</div>
</span></span></span></span></div>
<h2>{str tag='pluginadmin' section='admin'}</h2>
<ul class="adminpluginstypes">
{foreach from=$plugins key='plugintype' item='plugins'}
<li><h4>{str tag='plugintype'}: {$plugintype}</h4></li>
{assign var="installed" value=$plugins.installed}
{assign var="notinstalled" value=$plugins.notinstalled}
<ul>
<li><b>{str tag='installedplugins'}</b></li>
<ul id="{$plugintype}.installed">
{foreach from=$installed key='plugin' item='data'}
<li id="{$plugintype}.{$plugin}">{$plugin}
{if $data.config}
(<a href="pluginconfig.php?plugintype={$plugintype}&amp;pluginname={$plugin}">{str tag='config'}</a>)
{/if}</li>
{if $data.types}
<ul>
{foreach from=$data.types key='type' item='config'}
<li>{$type}
{if $config} (<a href="pluginconfig.php?plugintype={$plugintype}&amp;pluginname={$plugin}&amp;type={$type}">{str tag='config'}</a>){/if}</li>
{/foreach}
</ul>
{/if}
{/foreach}
</ul>
{if $notinstalled}
<li><b>{str tag='notinstalledplugins'}</b></li>
<ul id="{$plugintype}.notinstalled">
{foreach from=$notinstalled key='plugin' item='data'}
<li id="{$plugintype}.{$plugin}">{$plugin} {if $data.notinstallable} {str tag='notinstallable'} {$data.notinstallable}
{else} (<a href="" onClick="{$installlink}('{$plugintype}.{$plugin}'); return false;">install</a>)
{/if}
<div id="{$plugintype}.{$plugin}.message"></div>
</li>
{/foreach}
</ul>
{/if}
</ul>
{/foreach}
</ul>
</div>
</div>
......
......@@ -32,7 +32,7 @@
<h4>{str section=mahara tag=views}</h4>
<ul>
{foreach from=$VIEWS key=key item=item name=view}
<li><a href="{$WWWROOT}view/view.php?id={$key}">{$item}</a></li>
<li><a href="{$WWWROOT}view/view.php?view={$key}">{$item}</a></li>
{/foreach}
</ul>
{/if}
......
......@@ -9,13 +9,11 @@ class="cnr-bl"><span class="cnr-br">
{if $VIEWCONTENT}
{$VIEWCONTENT}
{else}
{str tag=viewviewnotallowed}
{/if}
<table id="feedbacktable">
<thead>
<tr><th colspan=3>{str tag=feedback}</th></tr>
<tr><th colspan=4>{str tag=feedback}</th></tr>
</thead>
</table>
......
......@@ -35,21 +35,30 @@ $offset = param_integer('offset', 0);
$prefix = get_config('dbprefix');
if ($artefact) {
$table = 'artefact_feedback';
$table = 'artefact';
$artefactfield = 'artefact';
$whereartefact = ' AND artefact = ' . $artefact;
$whereartefactclause = ' AND artefact = ' . $artefact;
}
else {
$table = 'view_feedback';
$table = 'view';
$artefactfield = null;
$whereartefact = '';
$whereartefactclause = '';
}
$count = count_records($table, 'public', 1, 'view', $view, $artefactfield, $artefact);
$owner = get_field($table, 'owner', 'id', $artefact ? $artefact : $view);
$table .= '_feedback';
if ($owner == $USER->get('id')) {
$count = count_records($table, 'view', $view, $artefactfield, $artefact);
$publicclause = '';
}
else {
$count = count_records($table, 'public', 1, 'view', $view, $artefactfield, $artefact);
$publicclause = ' AND public = 1';
}
$feedback = get_records_sql_array('SELECT author, ctime, message
$feedback = get_records_sql_array('SELECT author, ctime, message, public
FROM ' . $prefix . $table . '
WHERE public = 1 AND view = ' . $view . $whereartefact . '
WHERE view = ' . $view . $whereartefactclause . $publicclause . '
ORDER BY id DESC', '', $offset, $limit);
$data = array();
......@@ -57,7 +66,8 @@ if ($feedback) {
foreach ($feedback as $record) {
$data[] = array('name' => display_name($record->author),
'date' => strftime(get_string('strftimedate'),strtotime($record->ctime)),
'message' => $record->message);
'message' => $record->message,
'public' => $record->public);
}
}
......
......@@ -91,9 +91,7 @@ function feedbackform() {
}
sendjsonrequest('addfeedback.json.php', data, function () {
removeElement('menuform');
if (form.public.checked) {
feedbacklist.doupdate();
}
feedbacklist.doupdate();
});
return false;
}
......@@ -165,7 +163,16 @@ addLoadEvent(view_menu);
var feedbacklist = new TableRenderer(
'feedbacktable',
'getfeedback.json.php',
['message', 'name', 'date']
['message',
'name',
'date',
function (r) {
if (r.public == 1) {
return;
}
return TD(null, '(' + get_string('private') + ')');
},
]
);
feedbacklist.limit = 10;
......
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