Commit 8ee29cca authored by Penny Leach's avatar Penny Leach
Browse files

Merged the viewaccess and new view activity types.

parent 9585196c
......@@ -30,7 +30,6 @@ $string['typemaharamessage'] = 'System message';
$string['typeusermessage'] = 'Message from other users';
$string['typefeedback'] = 'Feedback';
$string['typewatchlist'] = 'Watchlist';
$string['typenewview'] = 'New view';
$string['typeviewaccess'] = 'New view access';
$string['typecontactus'] = 'Contact us';
$string['typeobjectionable'] = 'Objectionable content';
......@@ -72,8 +71,6 @@ $string['newcontactusfrom'] = 'New contact us from';
$string['newcontactus'] = 'New contact us';
$string['newfeedbackonview'] = 'New feedback on view';
$string['newfeedbackonartefact'] = 'New feedback on artefact';
$string['newviewmessage'] = 'has created a view called "%s" and has granted you access to it.';
$string['newviewsubject'] = 'New view created';
$string['newviewaccessmessage'] = 'You have been added to the access list for the view called';
$string['newviewaccesssubject'] = 'New view access';
......
......@@ -69,7 +69,6 @@ function activity_occurred($activitytype, $data) {
* - <b>feedback (view)</b> must contain $view (id) and $message
* - <b>watchlist (view) </b> must contain $view (id of view)
- and should also contain $subject (or a boring default will be used)
* - <b>newview</b> must contain $owner userid of view owner AND $view (id of new view)
* - <b>viewaccess</b> must contain $owner userid of view owner AND $view (id of view) and $oldusers array of userids before access change was committed.
*/
function handle_activity($activitytype, $data, $cron=false) {
......@@ -258,33 +257,7 @@ function handle_activity($activitytype, $data, $cron=false) {
}
break;
case 'newview':
if (!is_numeric($data->owner) || !is_numeric($data->view)) {
throw new InvalidArgumentException("New view activity type requires view and owner to be set");
}
if (!$viewinfo = get_record_sql('SELECT u.*, v.title FROM {usr} u
JOIN {view} v ON v.owner = u.id
WHERE v.id = ?', array($data->view))) {
if (!empty($cron)) { //probably deleted already
return;
}
throw new InvalidArgumentException("Couldn't find view with id " . $data->view);
}
$data->message = get_string('newviewmessage', 'activity', $viewinfo->title);
$data->subject = get_string('newviewsubject', 'activity');
$data->url = get_config('wwwroot') . 'view/view.php?id=' . $data->view;
// add users on friendslist or userlist...
$users = activity_get_viewaccess_users($data->view, $data->owner, 'newview');
if (empty($users)) {
$users = array();
}
// ick
foreach ($users as $user) {
$user->message = display_name($viewinfo, $user) . ' ' . $data->message;
}
break;
$data->oldusers = array();
case 'viewaccess':
if (!is_numeric($data->owner) || !is_numeric($data->view)) {
throw new InvalidArgumentException("view access activity type requires view and owner to be set");
......
......@@ -412,6 +412,14 @@ function xmldb_core_upgrade($oldversion=0) {
set_config('imagemaxheight', 1024);
}
if ($oldversion < 20070782205) {
set_field('activity_queue', 'type', 'viewaccess', 'type', 'newview');
set_field('notification_internal_activity', 'type', 'viewaccess', 'type', 'newview');
set_field('notification_emaildigest_queue', 'type', 'viewaccess', 'type', 'newview');
delete_records('usr_activity_preference', 'activity', 'newview');
delete_records('activity_type', 'name', 'newview');
}
return $status;
}
......
......@@ -636,7 +636,6 @@ function core_install_firstcoredata_defaults() {
array('usermessage', 0, 0),
array('feedback', 0, 0),
array('watchlist', 0, 1),
array('newview', 0, 1),
array('viewaccess', 0, 1),
array('contactus', 1, 1),
array('objectionable', 1, 1),
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007082204;
$config->version = 2007082205;
$config->release = '0.9.0alpha3dev';
$config->minupgradefrom = 2007080700;
$config->minupgraderelease = '0.8.0 (release tag 0.8.0_RELEASE)';
......
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