Commit 5981580d authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files
parents 9a426d84 fa611360
......@@ -38,6 +38,7 @@ if ($USER->get('admin')) {
$readsavefail = get_string('failedtomarkasread', 'activity');
$readsave = get_string('markedasread', 'activity');
$morestr = get_string('more...');
$javascript = <<<JAVASCRIPT
var activitylist = new TableRenderer(
......@@ -45,10 +46,23 @@ var activitylist = new TableRenderer(
'index.json.php',
[
function(r) {
if (r.url) {
return TD(null,A({'href': r.url}, r.message));
if (r.message) {
var messagemore;
if (r.url) {
messagemore = [r.message, BR(null), A({'href' : r.url}, '{$morestr}')];
}
else {
messagemore = r.message;
}
return TD(null, A({'href': '', 'onclick': 'showHideMessage(' + r.id + '); return false;'}, r.subject),
DIV({'id' : 'message-' + r.id, 'style': 'display:none'}, messagemore));
}
else if (r.url) {
return TD(null, A({'href': r.url}, r.subject));
}
return TD(null,r.message);
else {
return TD(null, r.subject);
}
},
'type',
'date',
......@@ -104,6 +118,15 @@ function markread(form) {
)
}
function showHideMessage(id) {
if (getStyle('message-' + id, 'display') == 'none') {
showElement('message-' + id);
}
else {
hideElement('message-' + id);
}
}
JAVASCRIPT;
$smarty = smarty(array('tablerenderer'));
......
......@@ -36,21 +36,22 @@ if (!$install) {
}
if ($install) {
$message = '';
if (!get_config('installed')) {
try {
core_install_defaults();
}
catch (SQLException $e) {
echo json_encode(array(
'success' => 0,
'errormessage' => $e->getMessage()
));
exit;
json_reply(true, $e->getMessage());
}
catch (TemplateParserException $e) {
// these ones are non fatal...
$message = $e->getMessage()
. ' ' . '<a href="' . get_config('wwwroot') .'admin/templates.php">'
. get_string('fixtemplatescontinue', 'admin') . '</a>';
}
}
echo json_encode(array('success' => 1));
exit;
json_reply(false, $message);
}
$upgrade = check_upgrades($name);
......
......@@ -59,15 +59,18 @@ if (!empty($upgrades['core']->install)) {
$('coredata').innerHTML = '<img src="{$loadingicon}" alt="{$loadingstring}" />';
d.addCallbacks(function (data) {
if ( data.success ) {
if ( !data.error ) {
var message = '{$coresuccess}';
if (data.message) {
message += ' (' + data.message + ')';
}
$('coredata').innerHTML = '<img src="{$successicon}" alt=":)" /> ' + message;
$('finished').style.visibility = 'visible';
}
else {
var message = '';
if (data.errormessage) {
message = data.errormessage;
if (data.message) {
message = data.message;
}
else {
message = '{$failurestring}';
......@@ -99,7 +102,7 @@ $js .= <<< EOJS
$(element).innerHTML = '<img src="{$loadingicon}" alt="{$loadingstring}" />';
d.addCallbacks(function (data) {
if ( data.success ) {
if ( !data.error ) {
var message;
if (data.install) {
message = '{$installsuccessstring}';
......@@ -112,8 +115,8 @@ $js .= <<< EOJS
}
else {
var message = '';
if (data.errormessage) {
message = data.errormessage;
if (data.message) {
message = data.message;
}
else {
message = '{$failurestring}';
......
......@@ -29,7 +29,8 @@ define('MENUITEM', 'myfiles');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'file');
$strings = array('cancel', 'delete', 'description', 'edit', 'editfile', 'editfolder', 'home', 'name', 'nofilesfound', 'savechanges');
$strings = array('cancel', 'delete', 'description', 'edit', 'editfile', 'editfolder',
'home', 'name', 'nofilesfound', 'savechanges');
$getstring = array();
foreach ($strings as $string) {
$getstring[$string] = "'" . get_string($string) . "'";
......
......@@ -44,9 +44,10 @@ else {
$prefix = get_config('dbprefix');
$filedata = get_records_sql_array('SELECT a.id, a.artefacttype, a.mtime, f.size, a.title, a.description
FROM ' . $prefix . 'artefact a
INNER JOIN ' . $prefix . 'artefact_file_files f ON f.artefact = a.id
LEFT OUTER JOIN ' . $prefix . 'artefact_file_files f ON f.artefact = a.id
WHERE a.owner = ' . $userid . '
AND a.parent' . $infolder, '');
AND a.parent' . $infolder . "
AND a.artefacttype IN ('folder','file','image')", '');
if (!$filedata) {
$filedata = array();
......
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
<div id="column-left">
<div class="content">
<div class="box-cnrs"><span class="cnr-tl"><span class="cnr-tr"><span
class="cnr-bl"><span class="cnr-br">
......@@ -21,5 +26,6 @@ class="cnr-bl"><span class="cnr-br">
</div>
</span></span></span></span></div>
</div>
</div>
{include file="footer.tpl"}
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
<div id="column-left">
<div class="content">
<div class="box-cnrs"><span class="cnr-tl"><span class="cnr-tr"><span
class="cnr-bl"><span class="cnr-br">
......@@ -11,5 +15,5 @@ class="cnr-bl"><span class="cnr-br">
</div>
</span></span></span></span></div>
</div>
</div>
{include file="footer.tpl"}
......@@ -31,10 +31,12 @@ require('init.php');
require_once('pieforms/pieform.php');
if ($USER->is_logged_in()) {
$name = display_name($USER->get('id'));
$userid = $USER->get('id');
$name = display_name($userid);
$email = $USER->get('email');
}
else {
$userid = null;
$name = '';
$email = '';
}
......@@ -76,6 +78,10 @@ $contactform = pieform(array(
'required' => true
),
),
'userid' => array(
'type' => 'hidden',
'value' => $userid,
),
'submit' => array(
'type' => 'submit',
'value' => get_string('submitcontactinformation')
......@@ -85,10 +91,13 @@ $contactform = pieform(array(
function contactus_submit($values) {
$data = new StdClass;
$data->name = $values['name'];
$data->email = $values['email'];
$data->subject = $values['subject'];
$data->message = $values['message'];
$data->fromname = $values['name'];
$data->fromaddress = $values['email'];
$data->subject = $values['subject'];
$data->message = $values['message'];
if ($values['userid']) {
$data->userfrom = $values['userid'];
}
require_once('activity.php');
activity_occurred('contactus', $data);
json_reply(false, get_string('contactinformationsent'));
......
......@@ -44,6 +44,7 @@ $string['upgradeloading'] = 'Loading...';
$string['upgradesuccess'] = 'Successfully upgraded to version ';
$string['upgradefailure'] = 'Failed to upgrade!';
$string['noupgrades'] = 'Nothing to upgrade! You are fully up to date!';
$string['fixtemplatescontinue'] = 'Try fixing this and continuing here (templates were not installed)';
// Admin navigation menu
$string['configsite'] = 'Configure Site';
......@@ -169,4 +170,5 @@ $string['institutionupdatedsuccessfully'] = 'Institution updated successfully';
$string['registrationallowed'] = 'Registration allowed?';
$string['registrationalloweddescription'] = 'Whether users can register for the system with this institution';
?>
......@@ -245,7 +245,7 @@ $string['heightshort'] = 'h';
$string['filter'] = 'Filter';
$string['expand'] = 'Expand';
$string['collapse'] = 'Collapse';
$string['more...'] = 'More ...';
$string['nohelpfound'] = 'There was no help found for this item';
// Search
......@@ -271,7 +271,7 @@ $string['feedbacksubmitted'] = 'Feedback submitted';
$string['itemaddedtowatchlist'] = 'This item has been added to your watchlist';
$string['itemalreadyinwatchlist'] = 'This item is already in your watchlist';
$string['makepublic'] = 'Make public';
$string['nopublicfeedbackhasbeenplacedonthisview'] = 'No public feedback has been placed on this view';
$string['nopublicfeedback'] = 'No public feedback';
$string['notifysiteadministrator'] = 'Notify site administrator';
$string['placefeedback'] = 'Place feedback';
$string['print'] = 'Print';
......
......@@ -473,4 +473,9 @@ class ArtefactNotFoundException extends Exception {}
* Exception - view not found
*/
class ViewNotFoundException extends Exception {}
/**
* Exception - anything to do with template parsing
*/
class TemplateParserException extends Exception {}
?>
......@@ -57,7 +57,7 @@ function template_parse($templatename) {
if (count($blockids) != count(array_unique($blockids))) {
$dups = array_unique(array_diff_assoc($blockids, array_unique($blockids)));
throw new InvalidArgumentException("This template ($templatename) has duplicate block ids: " . implode(', ', $dups));
throw new TemplateParserException("This template ($templatename) has duplicate block ids: " . implode(', ', $dups));
}
$temp = array('type' => 'html',
......@@ -76,7 +76,7 @@ function template_parse_block($blockstr) {
// the first bit should be 'block'
if ($bits[0] != 'block') {
throw new InvalidArgumentException("Invalid block section $blockstr");
throw new TemplateParserException("Invalid block section $blockstr");
}
array_shift($bits);
......@@ -86,16 +86,16 @@ function template_parse_block($blockstr) {
}
if (!isset($data['id']) || empty($data['id']) || strpos($data['id'], 'tpl_') !== 0) {
throw new InvalidArgumentException("Invalid block section $blockstr - must have an id beginning with tpl_");
throw new TemplateParserException("Invalid block section $blockstr - must have an id beginning with tpl_");
}
if (!isset($data['type']) || empty($data['type'])) {
throw new InvalidArgumentException("Invalid block section $blockstr - must have a type");
throw new TemplateParserException("Invalid block section $blockstr - must have a type");
}
$types = array('artefact', 'label', 'title', 'author', 'description');
if (!in_array($data['type'], $types)){
throw new InvalidArgumentException("Invalid block section $blockstr (type " . $data['type']
throw new TemplateParserException("Invalid block section $blockstr (type " . $data['type']
. " not one of " . implode(', ', $types));
}
......@@ -110,14 +110,14 @@ function template_parse_block($blockstr) {
if (isset($data['artefacttype'])) {
if (!$plugin = get_field('artefact_installed_type', 'plugin', 'name', $data['artefacttype'])) {
throw new InvalidArgumentException("artefacttype " . $data['artefacttype'] . " is not installed");
throw new TemplateParserException("artefacttype " . $data['artefacttype'] . " is not installed");
}
if (isset($data['format'])) { // check the artefacttype can render to this format.
safe_require('artefact', $plugin);
if (!artefact_can_render_to($data['artefacttype'], $data['format'])) {
throw new InvalidArgumentException("Artefacttype " . $data['artefacttype'] . " can't render to format "
throw new TemplateParserException("Artefacttype " . $data['artefacttype'] . " can't render to format "
. $format['format']);
}
}
......@@ -129,23 +129,23 @@ function template_parse_block($blockstr) {
safe_require('artefact', $data['plugintype']);
}
catch (Exception $e) {
throw new InvalidArgumentException("Couldn't find plugin type " . $data['plugintype']);
throw new TemplateParserException("Couldn't find plugin type " . $data['plugintype']);
}
}
if (isset($data['defaultartefacttype'])) {
if (isset($data['artefacttype']) && $data['artefacttype'] != $data['defaultartefacttype']) {
throw new InvalidArgumentException("Default artefact type " . $data['defaultartefacttype']
throw new TemplateParserException("Default artefact type " . $data['defaultartefacttype']
. " doesn't make sense given artefact type " . $data['artefacttype']);
}
else if (isset($data['plugintype'])
&& !in_array($data['defaultartefacttype'],
call_static_method(generate_class_name($data['plugintype']), 'get_artefact_types'))) {
throw new InvalidArgumentException("Default artefact type " . $data['defaultartefacttype']
throw new TemplateParserException("Default artefact type " . $data['defaultartefacttype']
." doesn't make sense given plugin type " . $data['plugintype']);
}
if (!$plugin = get_field('artefact_installed_type', 'plugin', 'name', $data['defaultartefacttype'])) {
throw new InvalidArgumentException("Default artefact type " . $data['defaultartefacttype']
throw new TemplateParserException("Default artefact type " . $data['defaultartefacttype']
. " is not installed");
}
// look for a default format...
......@@ -154,7 +154,7 @@ function template_parse_block($blockstr) {
$data['defaultformat'] = $data['format'];
}
else {
throw new InvalidArgumentException("Default artefact type " . $data['defaultartefacttype']
throw new TemplateParserException("Default artefact type " . $data['defaultartefacttype']
." specified but with no format method (couldn't find in either "
." default format, or fallback format field");
}
......@@ -162,13 +162,13 @@ function template_parse_block($blockstr) {
// check the default artefact type can render to the given default format
safe_require('artefact', $plugin);
if (!artefact_can_render_to($data['defaultartefacttype'], $data['defaultformat'])) {
throw new InvalidArgumentException("Default artefact type " . $data['defaultartefacttype']
throw new TemplateParserException("Default artefact type " . $data['defaultartefacttype']
. " can't render to defaultformat " . $format['defaultformat']);
}
// check this default artefact is a 0 or 1 artefact
if (!call_static_method(generate_artefact_class_name($data['defaultartefacttype']), 'is_0_or_1')) {
throw new InvalidArgumentException("Default artefact type " . $data['defaultartefacttype']
throw new TemplateParserException("Default artefact type " . $data['defaultartefacttype']
." is not a 0 or 1 type artefact");
}
}
......@@ -232,7 +232,7 @@ function template_locate($templatename, $fetchdb=true) {
return $template;
}
throw new InvalidArgumentException("Invalid template name $templatename, couldn't find");
throw new TemplateParserException("Invalid template name $templatename, couldn't find");
}
/**
......
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Penny Leach <penny@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$template = new StdClass;
$template->title = 'Blog with Profile Information';
$template->description = 'This View template will allow you to provide your Blog and/or Blog postings alongside any Profile information you wish to provide. Ideal for course related reflective journals and records of learning as well as personal blogs.';
$template->category = 'blog';
?>
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Penny Leach <penny@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$template = new StdClass;
$template->title = 'Files and Free Text';
$template->description = 'This View template will allow you to present a list of documents and files and provides you with a large label block, where you may enter any other text you wish such as links to relevant websites. This is ideal for course related work or specific interest portfolios.';
$template->category = 'academic';
?>
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Penny Leach <penny@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$template = new StdClass;
$template->title = 'Image Gallery';
$template->description = 'This View template will allow you to create a gallery of images from your Files area and provide a description below each picture. Ideal for displaying art, design and photograhic work.';
$template->category = 'gallery';
?>
......@@ -438,7 +438,7 @@ function upgrade_templates() {
foreach ($dbtemplates as $name => $guff) {
if (!is_readable($guff['location'] . 'config.php')) {
throw new InvalidArgumentException("missing config.php for template $name");
throw new TemplateParserException("missing config.php for template $name");
}
require_once($guff['location'] . 'config.php');
$fordb = new StdClass;
......
......@@ -309,27 +309,36 @@ form {
/* RIGHT SIDE BOX BEGIN */
div.sidebar {
background: #FFFFFF url(../images/sidebox2_top_headerbg.gif) no-repeat top;
padding: 10px 0 0 10px;
margin: 0 0 5px 0;
padding: 10px 0 0 10px;
margin: 0 0 5px 0;
color: #FFFFFF;
font-weight: bold;
}
#sitemenu {
margin: 20px 5px 0 0;
padding: 0;
}
#sitemenu li {
padding: 0 0 0 0px;
margin: 0 10px 0 0px;
padding: 0 0 0 13px;
margin: 0 5px 0 0px;
color: #000000;
font-weight: bold;
background: url(../images/icon_arrow.gif) no-repeat left;
list-style-type: none;
line-height: 18px;
}
div.sidebar-botcorners {
padding: 0 0 0 0;
margin: 0 0 0 0px;
margin: 0 0 0 0;
}
div.loginbox-botcorners {
padding: 0 0 0 0;
margin: 0 0 0 -10px;
}
#loginbox {
......
......@@ -5,5 +5,5 @@
<li><a href="{$item.link|escape}">{$item.name}</a></li>
{/foreach}
</ul>
<div class="sidebar-botcorners"><img src="{image_path imagelocation='images/sidebox_bot.gif'}" border="0"></div>
<div class="loginbox-botcorners"><img src="{image_path imagelocation='images/sidebox_bot.gif'}" border="0"></div>
</div>
{include file="header.tpl"}
<div id="column-right">
{include file="adminmenu.tpl"}
</div>
<div id="column-left">
<div class="content">
<div class="box-cnrs"><span class="cnr-tl"><span class="cnr-tr"><span
class="cnr-bl"><span class="cnr-br">
......@@ -14,5 +17,6 @@ class="cnr-bl"><span class="cnr-br">
</div>
</span></span></span></span></div>
</div>
</div>
{include file="footer.tpl"}
......@@ -72,7 +72,7 @@
</ul>
{/if}
{/if}
<div id="maincontentwrapper">
<div id="maincontentwrapper">
{insert name="messages"}
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