Commit 63289c56 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files
parents 0d7c8913 7e076874
logs
htdocs/js/MochiKit/Packed.js
......@@ -3,11 +3,14 @@ all: build
clean:
fakeroot make -f debian/rules clean
build:
build: mochikit_packed
rm -f ../mahara-apache2_*.deb ../mahara-apache_*.deb
dpkg-buildpackage -rfakeroot -us -uc -b -tc
debug:
debug: mochikit_packed
dpkg-buildpackage -rfakeroot -us -uc -b
mochikit_packed:
scripts/pack.sh
.PHONY: build
mahara (0.4.1-1) unstable; urgency=low
* Bugfix release
-- Martyn Smith <martyn@catalyst.net.nz> Tue, 23 Jan 2007 13:13:22 +1300
mahara (0.4.0-1) unstable; urgency=low
* Bugfix release
......
var/www/mahara/js/MochiKit/Packed.js var/www/mahara/js/MochiKit/setup.js
links
\ No newline at end of file
links
\ No newline at end of file
......@@ -24,7 +24,7 @@ binary:
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installdebconf
dh_installdebconf
dh_installcron
dh_installlogrotate
dh_compress
......@@ -39,6 +39,8 @@ binary:
dh_installdirs
dh_install
dh_link
dh_gencontrol
dh_md5sums
......
......@@ -455,8 +455,9 @@ class ArtefactTypeBlogPost extends ArtefactType {
$smarty->assign('artefact', $this);
$attachments = $this->get_attached_files();
if ($attachments) {
require_once('artefact.php');
foreach ($attachments as &$attachment) {
$f = new ArtefactTypeFile($attachment->id);
$f = artefact_instance_from_id($attachment->id);
$attachment->content = $f->render(FORMAT_ARTEFACT_LISTSELF, $options);
}
$smarty->assign('attachments', $attachments);
......
......@@ -174,6 +174,8 @@ $javascript = <<<EOF
// The file uploader uploads files to the list of blog post attachments
var copyrightnotice = '{$copyright}';
// The fourth parameter below is just a hack so that the user sees
// "Uploading file to blog post" in the upload status line.
var uploader = new FileUploader('uploader', 'upload.php', null, {$getstring['blogpost']}, false,
attachtopost, fileattached);
uploader.createid = {$createid};
......
......@@ -496,6 +496,10 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
return $data;
}
public static function get_render_list() {
return array(FORMAT_ARTEFACT_LISTSELF, FORMAT_ARTEFACT_RENDERMETADATA);
}
}
class ArtefactTypeFolder extends ArtefactTypeFileBase {
......
......@@ -73,7 +73,7 @@ switch ($type) {
$count = count_records_sql('
SELECT COUNT(v.id)
FROM ' . $prefix . 'view v
LEFT OUTER JOIN view_access_community a ON a.view=v.id
LEFT OUTER JOIN ' . $prefix . 'view_access_community a ON a.view=v.id
' . $where,
$values
);
......
......@@ -113,6 +113,9 @@ if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') {
baseElem = scripts[i];
}
}
if (base === null) {
base = src.substring(0, src.lastIndexOf('setup.js'));
}
if (base === null) {
return;
}
......
MochiKit.js
\ No newline at end of file
......@@ -31,6 +31,7 @@ $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';
$string['typevirusrepeat'] = 'Repeat virus upload';
......@@ -66,7 +67,6 @@ $string['stopmonitoringsuccess'] = 'Stopped monitoring successfully';
$string['stopmonitoringfailed'] = 'Failed to stop monitoring';
$string['newwatchlistmessage'] = 'New activity on your watchlist';
$string['newviewmessage'] = 'New view you have access to';
$string['newcontactusfrom'] = 'New contact us from';
$string['newcontactus'] = 'New contact us';
......@@ -78,6 +78,9 @@ $string['watchlistmessagecommunity'] = 'Activity on watchlist (Community)';
$string['newviewmessage'] = 'New view called';
$string['newviewsubject'] = 'New view';
$string['newviewaccessmessage'] = 'You have been added to the access list for the view called';
$string['newviewaccesssubject'] = 'New view access';
$string['onview'] = 'on View';
$string['onartefact'] = 'on Artefact';
$string['oncommunity'] = 'on Community';
......
......@@ -370,6 +370,7 @@ $string['alreadyinwatchlist'] = 'This %s is already in your watchlist';
$string['complaint'] = 'Complaint';
$string['date'] = 'Date';
$string['feedback'] = 'Feedback';
$string['feedbackmadeprivate'] = 'Feedback changed to private';
$string['feedbacksubmitted'] = 'Feedback submitted';
$string['makepublic'] = 'Make public';
$string['nopublicfeedback'] = 'No public feedback';
......@@ -377,6 +378,7 @@ $string['notifysiteadministrator'] = 'Notify site administrator';
$string['placefeedback'] = 'Place feedback';
$string['print'] = 'Print';
$string['private'] = 'Private';
$string['makeprivate'] = 'Change to Private';
$string['reportobjectionablematerial'] = 'Report objectionable material';
$string['reportsent'] = 'Your report has been sent';
$string['updatewatchlistfailed'] = 'Update of watchlist failed';
......@@ -504,6 +506,7 @@ $string['currentfriends'] = 'Friends';
$string['pendingfriends'] = 'Pending friends';
$string['friendlistfailure'] = 'Failed to modify your friends list';
$string['userdoesntwantfriends'] = 'This user doesn\'t want any new friends';
$string['friend'] = 'Friend';
$string['profileicon'] = 'Profile Icon';
......
......@@ -61,6 +61,8 @@ $string['empty_block'] = 'Select an artefact from the tree on the left to place
$string['viewinformationsaved'] = 'View information saved successfully';
$string['canteditdontown'] = 'You can\'t edit this view because you don\'t own it';
$string['canteditdontownfeedback'] = 'You can\'t edit this feedback because you don\'t own it';
$string['feedbackchangedtoprivate'] = 'Feedback changed to private';
$string['chooseformat'] = 'Select how you would like to display this artefact in this block ...';
......
......@@ -38,16 +38,16 @@ function activity_occurred($activitytype, $data) {
throw new Exception("Invalid activity type $activitytype");
}
//if (!empty($at->delay)) {
// $delayed = new StdClass;
// $delayed->type = $activitytype;
// $delayed->data = serialize($data);
// $delayed->ctime = db_format_timestamp(time());
// insert_record('activity_queue', $delayed);
//}
//else {
if (!empty($at->delay)) {
$delayed = new StdClass;
$delayed->type = $activitytype;
$delayed->data = serialize($data);
$delayed->ctime = db_format_timestamp(time());
insert_record('activity_queue', $delayed);
}
else {
handle_activity($at, $data);
//}
}
}
/**
......@@ -74,6 +74,7 @@ function activity_occurred($activitytype, $data) {
* - <b>watchlist (community) </b> must contain $community (id of community)
- 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) {
......@@ -312,23 +313,7 @@ function handle_activity($activitytype, $data) {
. ' ' . $viewinfo->title . ' ' . get_string('ownedby', 'activity');
$data->subject = get_string('newviewsubject', 'activity');
// add users on friendslist, userlist or grouplist...
$sql = 'SELECT userid, u.*, p.method
FROM (
SELECT (CASE WHEN usr1 = ? THEN usr2 ELSE usr1 END) AS userid
FROM ' . $prefix . 'usr_friend
WHERE (usr1 = ? OR usr2 = ?)
UNION SELECT member AS userid
FROM ' . $prefix . 'usr_group_member m
JOIN ' . $prefix . 'view_access_group g ON m.grp = g.grp
WHERE g.view = ?
UNION SELECT usr AS userid
FROM ' . $prefix . 'view_access_usr u
WHERE u.view = ?
) AS userlist
JOIN ' . $prefix . 'usr u ON u.id = userlist.userid
LEFT JOIN ' . $prefix . 'usr_activity_preference p ON p.usr = u.id';
$users = get_records_sql_array($sql, array($data->owner, $data->owner, $data->owner,
$data->view, $data->view));
$users = activity_get_viewaccess_users($data->view, $data->owner);
if (empty($users)) {
$users = array();
}
......@@ -337,6 +322,29 @@ function handle_activity($activitytype, $data) {
$user->message = $data->message . ' ' . display_name($viewinfo, $user);
}
break;
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");
}
if (!isset($data->oldusers)) {
throw new InvalidArgumentException("view access activity type requires oldusers to be set (even if empty)");
}
if (!$viewinfo = get_record_sql('SELECT u.*, v.title FROM ' . $prefix . 'usr u
JOIN ' . $prefix . 'view v ON v.owner = u.id
WHERE v.id = ?', array($data->view))) {
throw new InvalidArgumentException("Couldn't find view with id " . $data->view);
}
$data->message = get_string('newviewaccessmessage', 'activity')
. ' ' . $viewinfo->title . ' ' . get_string('ownedby', 'activity');
$data->subject = get_string('newviewaccesssubject', 'activity');
$users = array_diff_key(activity_get_viewaccess_users($data->view, $data->owner), $data->oldusers);
if (empty($users)) {
$users = array();
}
// ick
foreach ($users as $user) {
$user->message = $data->message . ' ' . display_name($viewinfo, $user);
}
case 'contactus':
break;
......@@ -426,10 +434,36 @@ function activity_set_defaults($user_id) {
function activity_process_queue() {
// stub for cronjob.
db_begin();
if ($toprocess = get_records('activity_queue')) {
foreach ($toprocess as $activity) {
handle_activity($activity->type, unserialize($activity->data));
}
delete_records('activity_queue');
}
db_commit();
}
function activity_get_viewaccess_users($view, $owner) {
$prefix = get_config('dbprefix');
$sql = 'SELECT userid, u.*, p.method
FROM (
SELECT (CASE WHEN usr1 = ? THEN usr2 ELSE usr1 END) AS userid
FROM ' . $prefix . 'usr_friend
WHERE (usr1 = ? OR usr2 = ?)
UNION SELECT member AS userid
FROM ' . $prefix . 'usr_group_member m
JOIN ' . $prefix . 'view_access_group g ON m.grp = g.grp
WHERE g.view = ?
UNION SELECT usr AS userid
FROM ' . $prefix . 'view_access_usr u
WHERE u.view = ?
) AS userlist
JOIN ' . $prefix . 'usr u ON u.id = userlist.userid
LEFT JOIN ' . $prefix . 'usr_activity_preference p ON p.usr = u.id';
return get_records_sql_assoc($sql, array($owner, $owner, $owner, $view, $view));
}
?>
......@@ -820,6 +820,7 @@
<SENTENCE TEXT="(name, admin, delay) VALUES ('feedback', 0, 0)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('watchlist', 0, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('newview', 0, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('viewaccess', 0, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('contactus', 1, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('objectionable', 1, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('virusrepeat', 1, 1)" />
......
......@@ -181,6 +181,14 @@ function xmldb_core_upgrade($oldversion=0) {
insert_record('cron', $c);
}
if ($oldversion < 2007012301) {
$at = new StdClass;
$at->name = 'viewaccess';
$at->admin = 0;
$at->delay = 1;
insert_record('activity_type', $at);
}
return $status;
}
......
......@@ -27,8 +27,8 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007012300;
$config->release = '0.4.0';
$config->version = 2007012301;
$config->release = '0.4.1';
$config->minupgradefrom = 2006121501;
$config->minupgraderelease = '0.1 (build tag BUILD_20061215)';
......
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