Commit 08ccea91 authored by Nigel McNie's avatar Nigel McNie
Browse files

Some cleanups from the merge to trunk. Removing a bunch of files, fixing blocktype/lib.php

parent 2da93496
<?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
*
*/
define('INTERNAL', 1);
define('ADMIN', 1);
define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'template.php');
require_once('upgrade.php');
json_headers();
$name = param_alpha('name');
try {
$template = template_parse($name);
upgrade_template($name, $template);
json_reply(false, '');
}
catch (TemplateParserException $e) {
json_reply('local', $e->getMessage());
}
?>
<?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
*
*/
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions/templatesadmin');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('templatesadmin', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'templates');
require_once(get_config('libroot') . 'template.php');
$installedtemplates = get_column('template', 'name');
$alltemplates = array();
$templates = get_dir_contents(get_config('dataroot') . 'templates/');
foreach ($templates as $dir) {
$alltemplates[$dir] = array();
}
$templates = get_dir_contents(get_config('libroot') . 'templates/');
foreach ($templates as $dir) {
if (!array_key_exists($dir,$templates)) {
$alltemplates[$dir] = array();
}
}
foreach (array_keys($alltemplates) as $t) {
try {
$alltemplates[$t]['template'] = template_parse($t);
}
catch (TemplateParserException $e) {
$alltemplates[$t]['error'] = $e->getMessage();
}
if (in_array($t, $installedtemplates)) {
$alltemplates[$t]['installed'] = true;
}
}
$loadingicon = theme_get_url('images/loading.gif');
$successicon = theme_get_url('images/success.gif');
$failureicon = theme_get_url('images/failure.gif');
$loadingstring = json_encode(get_string('upgradeloading', 'admin'));
$successstring = json_encode(get_string('upgradesuccess', 'admin'));
$failurestring = json_encode(get_string('upgradefailure', 'admin'));
$javascript = <<<JAVASCRIPT
function installtemplate(name) {
$(name + '.message').innerHTML = '<img src="{$loadingicon}" alt="' + {$loadingstring} + '" />';
sendjsonrequest('templateinstall.json.php', { 'name': name }, 'GET', function (data) {
if (!data.error) {
var message = {$successstring};
$(name + '.message').innerHTML = '<img src="{$successicon}" alt=":)" /> ' + message;
// move the whole thing into the list of installed plugins
// new parent node
$(name + '.status').src = '$successicon';
}
else {
var message = '';
if (data.message) {
message = data.message;
}
else {
message = {$failurestring};
}
$(name + '.message').innerHTML = '<img src="{$failureicon}" alt=":(" /> ' + message;
}
},
function () {
message = {$failurestring};
$(name).innerHTML = message;
},
true);
}
JAVASCRIPT;
$smarty = smarty();
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('templates', $alltemplates);
$smarty->assign('installlink', 'installtemplate');
$smarty->display('admin/extensions/templates.tpl');
?>
......@@ -84,7 +84,12 @@ abstract class PluginBlocktype extends Plugin {
*/
public static abstract function get_artefacts(BlockInstance $instance);
public static function has_config() {
/**
* this is different to has_config - has_config is plugin wide config settings
* this is specific to this TYPE of plugin and relates to whether individual instances
* can be configured within a view
*/
public static function has_instance_config() {
return false;
}
......
<?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 Nigel McNie <nigel@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
json_headers();
$pluginname = param_variable('pluginname');
$parent = param_integer('parent', null);
$userid = param_integer('userid', $USER->get('id'));
if ($parent === null) {
$parentcondition = 'IS NULL';
}
else {
$parentcondition = ' = ' . $db->quote($parent);
}
// Get all artefacts we require
$data = get_records_sql_array("SELECT id, artefacttype, container, title
FROM {artefact}
WHERE artefacttype IN (
SELECT name
FROM {artefact_installed_type}
WHERE plugin = ?
)
AND parent $parentcondition
AND owner = ?
ORDER BY title", array($pluginname, $userid));
if (!$data) {
echo json_encode(array('error' => false,
'data' => false));
exit;
}
// Format the data for return. Each artefact type has the opportunity to format
// the data how they see fit
safe_require('artefact', $pluginname);
$artefacts = array();
foreach ($data as $artefact) {
$classname = 'ArtefactType' . ucfirst($artefact->artefacttype);
$a = null;
if (method_exists($classname, 'format_child_data')) {
$a = call_static_method($classname, 'format_child_data', $artefact, $pluginname);
}
else {
$a = new StdClass;
$a->id = $artefact->id;
$a->isartefact = true;
$a->title = '';
$a->text = $artefact->title;
$a->container = (bool) $artefact->container;
$a->parent = $artefact->id;
}
$a->artefacttype = $artefact->artefacttype;
$artefacts[] = $a;
}
$classname = generate_class_name('artefact', $pluginname);
if (method_exists($classname, 'sort_child_data')) {
usort($artefacts, array($classname, 'sort_child_data'));
}
// Build the JSON to return
$items = array();
foreach ($artefacts as $artefact) {
$artefactclass = generate_artefact_class_name($artefact->artefacttype);
$items[] = array(
'id' => $artefact->id,
'isartefact' => $artefact->isartefact,
'container' => $artefact->container,
'text' => $artefact->text,
'title' => $artefact->title,
'pluginname' => $pluginname,
'parent' => $artefact->parent,
'type' => $artefact->artefacttype,
'rendersto' => call_static_method($artefactclass, 'get_render_list')
);
}
echo json_encode(array('error' => false,
'data' => $items));
?>
This diff is collapsed.
<?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 Meredith Henson <m.j.henson@massey.ac.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 = 'Teaching Programme Planning, Evaluation and Assessment Template';
$template->description = 'This View template is designed for teachers and teacher trainees to present a programme for review.';
$template->category = 'academic';
?>
.PPAE_Template {
width:100%;
}
.PPAE_Template td {
padding: 20px;
}
.PPAW_Template td div {
padding: 0;
margin: 0;
}
.PPAE_Template title {
padding-bottom:50px;
}
\ No newline at end of file
<table id="test_template">
<tbody>
<tr>
<th>Group Name </th>
<td>{{block type="label" id="tpl_label1"}}</td>
</tr>
<tr>
<th width="387">Student Names</th>
<td width="816">{{block type="label" id="tpl_label2"}} {{block type="label" id="tpl_label3"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="label" id="tpl_label4"}} {{block type="label" id="tpl_label5"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th colspan="2">Mission and Vision Statement (Concept and Concept Outline) </th>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog1"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th height="24" colspan="2">Physical Design of the space (explain, using theorists, how you created ambeince and support of holistic learning for each child)</th>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_files1" artefacttype="file"}}</td>
</tr>
<tr>
<th height="24">&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog2"}}</td>
</tr>
<tr>
<th colspan="2">&nbsp;</th>
</tr>
<tr>
<th colspan="2"><strong>Schedule or timetable of tasks and events prior to opening </strong></th>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_files2" artefacttype="file"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog3"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th colspan="2"><strong>Curriculum Matrix for first six weeks, specific activities for beginners, intermediates, end-game (provide NZCF AO/level cross-reference) </strong></th>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_files3" artefacttype="file"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog4"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th colspan="2"><p>Yearlong Teaching and Learning Topics plan for beginners, intermediates and end-game. <br />
(Justify your choices by citing educationalists, psychologists and other theorists) </p> </th>
</tr>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_files4" artefacttype="file"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog5"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th colspan="2"><strong>Priorised table of equipment, materials and supplies </strong></th>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_files5" artefacttype="file"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog6"}}</td>
</tr>
</tbody>
</table>
<?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';
?>
<table cellpadding="20">
<tr>
<td colspan="2">
<h5>{{block type="title" id="tpl_title"}}</h5>
<h3>{{block type="author" id="tpl_author"}}</h3>
</td>
</tr>
<tr>
<td>
{{block type="label" id="tpl_blogslabel"}}<br>
{{block type="artefact" id="tpl_blog1" plugintype="blog"}}<br>
{{block type="artefact" id="tpl_blog2" plugintype="blog"}}<br>
</td>
<td>
{{block type="label" id="tpl_profilelabel"}}<br>
{{block type="artefact" plugintype="internal" format="listself" id="tpl_profile"}}<br>
</td>
</tr>
</table>
<?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 Meredith Henson <m.j.henson@massey.ac.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 Reflections Template';
$template->description = 'This View template is designed to present a number of different Blogs for assessment. It is ideal for students presenting their reflective journals for tutor feedback';
$template->category = 'academic';
?>
.Blog_Reflections_Template {
width:100%;
}
.Blog_Reflections_Template td {
padding: 20px;
}
.Blog_Reflections_Template td div {
padding: 0;
margin: 0;
}
.Blog_Reflections_Template title {
padding-bottom:50px;
}
\ No newline at end of file
<table id="test_template">
<tbody>
<tr>
<th width="387">Student Name </th>
<td width="816">{{block type="author" id="tpl_author"}}</td>
<td width="204">&nbsp;</td>
<td width="204">&nbsp;</td>
</tr>
<tr>
<th>Reflection One Title </th>
<td>{{block type="label" id="tpl_label1"}}</td>
<td><strong>Last Date Available </strong></td>
<td>{{block type="label" id="tpl_label2"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog1"}}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Reflection Two Title </th>
<td>{{block type="label" id="tpl_label3"}}</td>
<td><strong>Last Date Available </strong></td>
<td>{{block type="label" id="tpl_label4"}}</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>{{block type="artefact" id="tpl_blog2"}}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>