Commit 042a900b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Merge commit 'origin/master' into feedback

Conflicts:

	htdocs/admin/site/options.php
	htdocs/lang/en.utf8/admin.php
	htdocs/lib/db/upgrade.php
	htdocs/lib/version.php
	htdocs/view/artefact.php
	htdocs/view/view.php
parents ece186f9 fd4ee3c2
......@@ -182,6 +182,7 @@ $deleteall = pieform(array(
'type' => 'submit',
'value' => get_string('deleteallnotifications', 'activity'),
'confirm' => get_string('reallydeleteallnotifications', 'activity'),
'class' => 'btn-del',
),
),
));
......
......@@ -154,6 +154,13 @@ $elements['addremovecolumns'] = array(
'separator' => '<br>',
'help' => 'true'
);
// TODO: add a way for plugins (like blog!) to have account preferences
$elements['multipleblogs'] = array(
'type' => 'checkbox',
'title'=> get_string('enablemultipleblogs' ,'account'),
'description' => get_string('enablemultipleblogsdescription', 'account'),
'defaultvalue' => $prefs->multipleblogs,
);
if (get_config('showtagssideblock')) {
$elements['tagssideblockmaxtags'] = array(
'type' => 'text',
......
......@@ -41,7 +41,7 @@ else {
}
require_once('pieforms/pieform.php');
require(get_config('libroot') . 'upgrade.php');
require(get_config('libroot') . 'registration.php');
require_once(get_config('libroot') . 'registration.php');
$upgrades = check_upgrades();
......
......@@ -35,6 +35,7 @@ define('SECTION_PAGE', 'siteoptions');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
require_once('searchlib.php');
require_once('antispam.php');
define('TITLE', get_string('siteoptions', 'admin'));
$langoptions = get_languages();
......@@ -46,6 +47,8 @@ $searchpluginoptions = get_search_plugins();
$countries = getoptions_country();
$spamtraps = available_spam_traps();
$siteoptionform = array(
'name' => 'siteoptions',
'jsform' => true,
......@@ -206,18 +209,6 @@ $siteoptionform = array(
'defaultvalue' => get_config('institutionautosuspend'),
'help' => true,
),
'captchaonregisterform' => array(
'type' => 'checkbox',
'title' => get_string('captchaonregisterform', 'admin'),
'description' => get_string('captchaonregisterformdescription', 'admin'),
'defaultvalue' => get_config('captchaonregisterform'),
),
'captchaoncontactform' => array(
'type' => 'checkbox',
'title' => get_string('captchaoncontactform', 'admin'),
'description' => get_string('captchaoncontactformdescription', 'admin'),
'defaultvalue' => get_config('captchaoncontactform'),
),
'showselfsearchsideblock' => array(
'type' => 'checkbox',
'title' => get_string('showselfsearchsideblock', 'admin'),
......@@ -263,6 +254,28 @@ $siteoptionform = array(
'description' => get_string('userscanhiderealnamesdescription', 'admin'),
'defaultvalue' => get_config('userscanhiderealnames'),
),
'antispam' => array(
'type' => 'select',
'title' => get_string('antispam', 'admin'),
'description' => get_string('antispamdescription', 'admin'),
'defaultvalue' => get_config('antispam'),
'options' => $spamtraps,
'help' => true,
),
'spamhaus' => array(
'type' => 'checkbox',
'title' => get_string('spamhaus', 'admin'),
'description' => get_string('spamhausdescription', 'admin'),
'defaultvalue' => get_config('spamhaus'),
'help' => true,
),
'surbl' => array(
'type' => 'checkbox',
'title' => get_string('surbl', 'admin'),
'description' => get_string('surbldescription', 'admin'),
'defaultvalue' => get_config('surbl'),
'help' => true,
),
'anonymouscomments' => array(
'type' => 'checkbox',
'title' => get_string('anonymouscomments', 'admin'),
......@@ -292,9 +305,9 @@ function siteoptions_submit(Pieform $form, $values) {
'defaultaccountlifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn',
'allowpublicviews', 'allowpublicprofiles', 'creategroups', 'createpublicgroups', 'searchplugin',
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'captchaonregisterform', 'captchaoncontactform', 'showselfsearchsideblock', 'showtagssideblock',
'showselfsearchsideblock', 'showtagssideblock',
'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes',
'remoteavatars', 'userscanhiderealnames', 'anonymouscomments',
'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 'surbl', 'anonymouscomments',
);
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
......
......@@ -295,10 +295,10 @@ function adduser_submit(Pieform $form, $values) {
try {
$importer->process();
log_info("Imported user account $user->id from leap2a file, see " . $importer->get('logfile') . ' for a full log');
log_info("Imported user account $user->id from Leap2A file, see " . $importer->get('logfile') . ' for a full log');
}
catch (ImportException $e) {
log_info("LEAP2A import failed: " . $e->getMessage());
log_info("Leap2A import failed: " . $e->getMessage());
die_info(get_string('leap2aimportfailed', 'admin'));
}
......
......@@ -28,7 +28,7 @@
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require('institution.php');
require_once('institution.php');
$id = param_integer('id');
$institution = new Institution(param_alpha('institution'));
......
......@@ -202,7 +202,7 @@ function bulkimport_validate(Pieform $form, $values) {
function bulkimport_submit(Pieform $form, $values) {
global $SESSION, $LEAP2AFILES;
log_info('Attempting to import ' . count($LEAP2AFILES) . ' users from LEAP2A files');
log_info('Attempting to import ' . count($LEAP2AFILES) . ' users from Leap2A files');
$SESSION->set('bulkimport_leap2afiles', $LEAP2AFILES);
$SESSION->set('bulkimport_authinstance', (int)$values['authinstance']);
......@@ -281,7 +281,7 @@ function import_next_user() {
catch (EmailException $e) {
// Suppress any emails (e.g. new institution membership) sent out
// during user creation, becuase the user doesn't have an email
// address until we've imported them from the LEAP2A file.
// address until we've imported them from the Leap2A file.
log_debug("Failed sending email during user import");
}
......@@ -304,10 +304,10 @@ function import_next_user() {
try {
$importer->process();
log_info("Imported user account $user->id from leap2a file, see $logfile for a full log");
log_info("Imported user account $user->id from Leap2A file, see $logfile for a full log");
}
catch (ImportException $e) {
log_info("LEAP2A import failed: " . $e->getMessage());
log_info("Leap2A import failed: " . $e->getMessage());
$FAILEDUSERS[$username] = get_string("leap2aimportfailed");
db_rollback();
continue;
......
......@@ -189,8 +189,8 @@ function edituser_site_submit(Pieform $form, $values) {
// Reset the sent and bounce counts otherwise mail will be disabled
// on the next send attempt
$u = new StdClass;
$u->email = $user->get('email');
$u->id = $user->get('id');
$u->email = $user->email;
$u->id = $user->id;
update_bounce_count($u,true);
update_send_count($u,true);
}
......
......@@ -47,7 +47,7 @@ if ($action == 'suspend') {
}
if ($action == 'search') {
require('searchlib.php');
require_once('searchlib.php');
$params = new StdClass;
$params->query = trim(param_variable('query', ''));
......
......@@ -33,7 +33,7 @@ define('TITLE', get_string('usersearch', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'usersearch');
require('searchlib.php');
require_once('searchlib.php');
$search = (object) array(
'query' => trim(param_variable('query', '')),
......
......@@ -29,7 +29,7 @@ define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require('searchlib.php');
require_once('searchlib.php');
$params = new StdClass;
$params->query = trim(param_variable('query', ''));
......
......@@ -231,8 +231,8 @@ function user_authorise($token, $useragent) {
throw new XmlrpcServerException('Unable to get information for the specified user');
}
require(get_config('docroot') . 'artefact/lib.php');
require(get_config('docroot') . 'artefact/internal/lib.php');
require_once(get_config('docroot') . 'artefact/lib.php');
require_once(get_config('docroot') . 'artefact/internal/lib.php');
$element_list = call_static_method('ArtefactTypeProfile', 'get_all_fields');
$element_required = call_static_method('ArtefactTypeProfile', 'get_mandatory_fields');
......@@ -502,6 +502,7 @@ function submit_view_for_assessment($username, $viewid) {
$view = new View($viewid);
$view->set('submittedhost', $authinstance->config['wwwroot']);
$view->set('submittedtime', db_format_timestamp(time()));
// Create secret key
$access = View::new_token($view->get('id'), false);
......@@ -544,6 +545,7 @@ function release_submitted_view($viewid, $assessmentdata, $teacherusername) {
// Release the view for editing
$view->set('submittedhost', null);
$view->set('submittedtime', null);
$view->commit();
db_commit();
}
......
......@@ -28,9 +28,9 @@
defined('INTERNAL') || die();
/**
* Implements LEAP2A import of blog related entries into Mahara
* Implements Leap2A import of blog related entries into Mahara
*
* For more information about LEAP blog importing, see:
* For more information about Leap blog importing, see:
* http://wiki.mahara.org/Developer_Area/Import//Export/LEAP_Import/Blog_Artefact_Plugin
*
* TODO:
......@@ -103,10 +103,17 @@ class LeapImportBlog extends LeapImportArtefactPlugin {
}
else {
// The blog can import any entry as a literal blog post
// Get files that this blogpost/catchall feels are a part of it
$otherrequiredentries = array();
foreach ($entry->link as $link) {
if ($importer->curie_equals($link['rel'], '', 'enclosure') && isset($link['href'])) {
$otherrequiredentries[] = (string)$link['href'];
}
}
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_ENTRY,
'score' => 10,
'other_required_entries' => array(),
'other_required_entries' => $otherrequiredentries,
);
}
......@@ -185,7 +192,7 @@ class LeapImportBlog extends LeapImportArtefactPlugin {
$artefactids = $importer->get_artefactids_imported_by_entryid((string)$blogpostlink['href']);
if (isset($artefactids[0])) {
$blogpost->attach($artefactids[0]);
} else { // it may be just an attached file, with no leap2a element in its own right ....
} else { // it may be just an attached file, with no Leap2A element in its own right ....
if ($id = self::attach_linked_file($blogpostentry, $blogpostlink, $importer)) {
$blogpost->attach($id);
$newartefactmapping[(string)$blogpostlink['href']][] = $id;
......@@ -201,6 +208,25 @@ class LeapImportBlog extends LeapImportArtefactPlugin {
}
break;
case self::STRATEGY_IMPORT_AS_ENTRY:
$blogpostids = $importer->get_artefactids_imported_by_entryid((string)$entry->id);
if (!isset($blogpostids[0])) {
// weird!
break;
}
$blogpost = new ArtefactTypeBlogPost($blogpostids[0]);
foreach ($entry->link as $link) {
if ($importer->curie_equals($link['rel'], '', 'enclosure') && isset($link['href'])) {
if (isset($artefactids[0])) {
$blogpost->attach($artefactids[0]);
} else {
if ($id = self::attach_linked_file($entry, $link, $importer)) {
$blogpost->attach($id);
$newartefactmapping[(string)$link['href']][] = $id;
}
}
}
}
$blogpost->commit();
self::setup_outoflinecontent_relationship($entry, $importer);
break;
default:
......@@ -210,8 +236,8 @@ class LeapImportBlog extends LeapImportArtefactPlugin {
}
/**
* Attaches a file to a blogpost entry that was just linked directly, rather than having a leap2a entry
* See http://wiki.cetis.ac.uk/LEAP2A_relationships#Attachments
* Attaches a file to a blogpost entry that was just linked directly, rather than having a Leap2a entry
* See http://wiki.leapspecs.org/2A/files
*
* @param SimpleXMLElement $blogpostentry
* @param SimpleXMLElement $blogpostlink
......@@ -241,7 +267,9 @@ class LeapImportBlog extends LeapImportArtefactPlugin {
public static function cleanup(PluginImportLeap $importer) {
if (self::$importedablog && self::$firstblogid) {
$blog = artefact_instance_from_id(self::$firstblogid);
$blog->delete();
if (!$blog->has_children()) { // TODO see #544160
$blog->delete();
}
}
}
......
......@@ -49,8 +49,8 @@ $blogs = (object) array(
list($blogs->count, $blogs->data) = ArtefactTypeBlog::get_blog_list($blogs->limit, $blogs->offset);
// If the user has exactly one blog, skip the blog listing and display it
if (!$delete && $blogs->offset == 0 && !empty($blogs->data) && count($blogs->data) == 1) {
// If the user has exactly one blog, and has not enabled multiple blogs, skip the blog listing and display it
if (!$delete && $blogs->offset == 0 && !empty($blogs->data) && count($blogs->data) == 1 && !$USER->get_account_preference('multipleblogs')) {
define('TITLE', get_string('viewblog','artefact.blog'));
define('SECTION_PAGE', 'view');
......
......@@ -138,10 +138,6 @@ class ArtefactTypeBlog extends ArtefactType {
}
}
public function is_container() {
return true;
}
/**
* This function updates or inserts the artefact. This involves putting
* some data in the artefact table (handled by parent::commit()), and then
......
{include file="header.tpl"}
<div id="myblogs rel">
<div class="rbuttons">
<a class="btn btn-add" href="{$WWWROOT}artefact/blog/new/">{str section="artefact.blog" tag="addblog"}</a>
</div>
<div id="myblogs rel">
{if !$blogs->data}
<div>{str tag=youhavenoblogs section=artefact.blog}</div>
{else}
......@@ -16,4 +16,5 @@
</table>
{$blogs->pagination}
{/if}
</div>
{include file="footer.tpl"}
......@@ -3,7 +3,6 @@
<div class="rbuttons">
<a class="btn btn-settings" href="{$WWWROOT}artefact/blog/settings/?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a>
<a class="btn btn-new" href="{$WWWROOT}artefact/blog/new">{str tag=addblog section=artefact.blog}</a>
<a class="btn btn-add" href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a>
</div>
......
......@@ -28,9 +28,9 @@
defined('INTERNAL') || die();
/**
* Implements LEAP2A import of file/folder related entries into Mahara
* Implements Leap2A import of file/folder related entries into Mahara
*
* For more information about LEAP file importing, see:
* For more information about Leap file importing, see:
* http://wiki.mahara.org/Developer_Area/Import//Export/LEAP_Import/File_Artefact_Plugin
*
* TODO:
......
......@@ -184,7 +184,7 @@ class PluginBlocktypeContactinfo extends PluginBlocktype {
* Overrides the default implementation so we can export enough information
* to reconstitute profile information again.
*
* LEAP2A export doesn't export profile related artefacts as entries, so we
* Leap2A export doesn't export profile related artefacts as entries, so we
* need to take that into account when exporting config for it.
*/
public static function export_blockinstance_config_leap(BlockInstance $bi) {
......
......@@ -259,7 +259,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype {
* Overrides the default implementation so we can export enough information
* to reconstitute profile information again.
*
* LEAP2A export doesn't export profile related artefacts as entries, so we
* Leap2A export doesn't export profile related artefacts as entries, so we
* need to take that into account when exporting config for it.
*/
public static function export_blockinstance_config_leap(BlockInstance $bi) {
......
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