Commit 7249cb9a authored by Richard Mansfield's avatar Richard Mansfield
Browse files
parents 84a2d3cd a256d4ad
......@@ -50,7 +50,6 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
insert_record('artefact_file_files', $data);
}
}
}
return $status;
......
......@@ -48,6 +48,22 @@ class PluginArtefactFile extends PluginArtefact {
)
);
}
public static function get_event_subscriptions() {
$subscriptions = array(
(object)array(
'plugin' => 'file',
'event' => 'createuser',
'callfunction' => 'newuser',
),
);
return $subscriptions;
}
public static function newuser($event, $user) {
update_record('usr', array('quotaused' => 0, 'quota' => get_config_plugin('defaultquota')), array('id' => $user->id));
}
public static function get_toplevel_artefact_types() {
return array('file');
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007010900;
$config->version = 2007011603;
$config->release = '0.1';
?>
......@@ -47,9 +47,10 @@ $creategroup = pieform(array(
'cols' => 70,
),
'members' => array(
'type' => 'userlist',
'title' => get_string('groupmembers'),
'rules' => array( 'required' => true ),
'type' => 'userlist',
'title' => get_string('groupmembers'),
'rules' => array( 'required' => true ),
'filter' => false,
),
'submit' => array(
'type' => 'submitcancel',
......
......@@ -79,6 +79,8 @@
<FIELD NAME="suspendedctime" TYPE="datetime" NOTNULL="false"/>
<FIELD NAME="suspendedreason" TYPE="text" NOTNULL="false"/>
<FIELD NAME="suspendedcusr" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="quota" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="quotaused" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......
......@@ -159,6 +159,19 @@ function xmldb_core_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2007011600) {
// Add the 'quota' and 'quotaused' fields to the usr table
$table = new XMLDBTable('usr');
$field = new XMLDBField('quota');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, false, false, false);
add_field($table, $field);
$field = new XMLDBField('quotaused');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, false, true, null, null, null, 0);
add_field($table, $field);
execute_sql('UPDATE ' . get_config('dbprefix') . 'usr SET quota=10485760');
}
return $status;
}
......
......@@ -87,15 +87,15 @@ function pieform_element_userlist_get_value(Pieform $form, $element) {
return null;
}
function form_element_userlist_rule_required($value, $element) {
function pieform_element_userlist_rule_required(Pieform $form, $value, $element) {
if (is_array($value) && count($value)) {
return false;
return null;
}
return true;
return $form->i18n('rule', 'required', 'required', $element);
}
function form_element_userlist_set_attributes($element) {
function pieform_element_userlist_set_attributes($element) {
// By default, use the filter select box
if (!isset($element['filter'])) {
$element['filter'] = true;
......
......@@ -815,7 +815,7 @@ class Pieform {
if (!$this->get_error($element['name'])) {
// See if this element has a function that describes
// how this rule should apply to it
$function = 'pieform_element_' . $element['name'] . '_rule_' . $rule;
$function = 'pieform_element_' . $element['type'] . '_rule_' . $rule;
if (!function_exists($function)) {
// Try instead the default rule function
$function = 'pieform_rule_' . $rule;
......
......@@ -334,7 +334,7 @@ function upgrade_plugin($upgrade) {
$exists = false;
$table = $plugintype . '_event_subscription';
if (empty($upgrade->install)) {
$exists = record_exists($table, 'plugin' , $pluginname, 'event', $event->event());
$exists = record_exists($table, 'plugin' , $pluginname, 'event', $event->event);
}
$event->plugin = $pluginname;
if (empty($exists)) {
......
......@@ -27,8 +27,8 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007011500;
$config->release = '0.3.1';
$config->version = 2007011600;
$config->release = '0.3.2';
$config->minupgradefrom = 2006121501;
$config->minupgraderelease = '0.1 (build tag BUILD_20061215)';
......
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