Commit c9a117dc authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Merge commit 'origin/master' into stats

Conflicts:

	htdocs/lib/db/upgrade.php
	htdocs/lib/user.php
	htdocs/lib/version.php
	htdocs/user/view.php
parents c1e0459a 9cac2dd7
......@@ -8,6 +8,8 @@ mahara-*.tar.gz
mahara-*.zip
*.swp
.patches
test/selenium/results.html
test/selenium/*/index.html
/configure-stamp
/debian/files
/debian/mahara-apache.postinst.debhelper
......
......@@ -38,12 +38,14 @@ require_once('searchlib.php');
define('TITLE', get_string('siteoptions', 'admin'));
$langoptions = get_languages();
$themeoptions = get_themes();
$themeoptions = get_all_themes();
$yesno = array(true => get_string('yes'),
false => get_string('no'));
$searchpluginoptions = get_search_plugins();
$countries = getoptions_country();
$siteoptionform = array(
'name' => 'siteoptions',
'jsform' => true,
......@@ -72,8 +74,8 @@ $siteoptionform = array(
'type' => 'select',
'title' => get_string('country', 'admin'),
'description' => get_string('sitecountrydescription', 'admin'),
'defaultvalue' => 'nz',
'options' => getoptions_country(),
'defaultvalue' => get_config('country'),
'options' => array('' => get_string('nocountryselected')) + $countries,
'help' => true,
),
'theme' => array(
......@@ -236,6 +238,18 @@ $siteoptionform = array(
'defaultvalue' => get_config('tagssideblockmaxtags'),
'rules' => array('integer' => true, 'minvalue' => 0, 'maxvalue' => 1000),
),
'viewmicroheaders' => array(
'type' => 'checkbox',
'title' => get_string('smallviewheaders', 'admin'),
'description' => get_string('smallviewheadersdescription', 'admin'),
'defaultvalue' => get_config('viewmicroheaders'),
),
'userscanchooseviewthemes' => array(
'type' => 'checkbox',
'title' => get_string('userscanchooseviewthemes', 'admin'),
'description' => get_string('userscanchooseviewthemesdescription', 'admin'),
'defaultvalue' => get_config('userscanchooseviewthemes'),
),
)
);
......@@ -260,7 +274,7 @@ function siteoptions_submit(Pieform $form, $values) {
'allowpublicviews', 'allowpublicprofiles', 'creategroups', 'createpublicgroups', 'searchplugin',
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'captchaonregisterform', 'captchaoncontactform', 'showselfsearchsideblock', 'showtagssideblock',
'tagssideblockmaxtags'
'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes',
);
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
......
......@@ -199,7 +199,10 @@ function adduser_validate(Pieform $form, $values) {
$form->set_error('leap2afile', get_string('failedtoobtainuploadedleapfile', 'admin'));
}
if ($values['leap2afile']['type'] == 'application/zip') {
safe_require('artefact', 'file');
$ziptypes = PluginArtefactFile::get_mimetypes_from_description('zip');
if (in_array($values['leap2afile']['type'], $ziptypes)) {
// Unzip the file
$command = sprintf('%s %s %s %s',
escapeshellcmd(get_config('pathtounzip')),
......
......@@ -177,7 +177,7 @@ if ($institution || $add) {
$authtypes = auth_get_available_auth_types();
}
$themeoptions = get_themes();
$themeoptions = get_institution_themes($institution);
$themeoptions['sitedefault'] = '- ' . get_string('sitedefault', 'admin') . ' (' . $themeoptions[get_config('theme')] . ') -';
uksort($themeoptions, 'theme_sort');
......
......@@ -736,11 +736,11 @@ function get_peer_from_instanceid($authinstanceid) {
$sql = 'SELECT
h.*
FROM
{auth_instance} ai,
{auth_instance_config} aic,
{host} h
WHERE
ai.institution = h.institution AND
ai.id = ?';
aic.value = h.wwwroot AND
aic.instance = ? AND aic.field = \'wwwroot\'';
return get_record_sql($sql, array($authinstanceid));
}
......
......@@ -491,10 +491,12 @@ class ArtefactTypeBlogPost extends ArtefactType {
return;
}
db_begin();
$this->detach(); // Detach all file attachments
delete_records('artefact_blog_blogpost', 'blogpost', $this->id);
parent::delete();
db_commit();
}
/**
......
......@@ -79,7 +79,7 @@ postlist.rowfunction = function(d, n, gd) {
if (!confirm({$enc_publish_confirm})) {
return;
}
sendjsonrequest('publish.json.php', { 'id': d.id }, 'GET',
sendjsonrequest({$enc_wwwroot} + 'artefact/blog/view/publish.json.php', { 'id': d.id }, 'GET',
function (response) {
if (!response.error) {
$('poststatus'+d.id).innerHTML = {$enc_published};
......@@ -149,7 +149,7 @@ postlist.rowfunction = function(d, n, gd) {
if (!confirm({$enc_delete_confirm})) {
return;
}
sendjsonrequest('delete.json.php', { 'id' : d.id }, 'GET', function(response) {
sendjsonrequest({$enc_wwwroot} + 'artefact/blog/view/delete.json.php', { 'id' : d.id }, 'GET', function(response) {
if (!response.error) {
for (row in rows) {
rows[row].parentNode.removeChild(rows[row]);
......
......@@ -205,6 +205,13 @@ class PluginArtefactFile extends PluginArtefact {
db_commit();
}
public static function get_mimetypes_from_description($description=null) {
if (is_null($description)) {
return get_column('artefact_file_mime_types', 'mimetype');
}
return get_column('artefact_file_mime_types', 'mimetype', 'description', $description);
}
public static function can_be_disabled() {
return false;
}
......@@ -224,14 +231,14 @@ class PluginArtefactFile extends PluginArtefact {
public static function recalculate_quota() {
$data = get_records_sql_assoc("
SELECT a.owner, SUM(f.size) AS usage
SELECT a.owner, SUM(f.size) AS bytes
FROM {artefact} a JOIN {artefact_file_files} f ON a.id = f.artefact
WHERE a.artefacttype IN ('file', 'image', 'profileicon', 'archive')
AND a.owner IS NOT NULL
GROUP BY a.owner", array()
);
if ($data) {
return array_map(create_function('$a', 'return $a->usage;'), $data);
return array_map(create_function('$a', 'return $a->bytes;'), $data);
}
return array();
}
......
......@@ -105,8 +105,9 @@ foreach ( $element_list as $element => $type ) {
$items[$element]['cols'] = 50;
}
if ($element == 'country') {
$items[$element]['options'] = getoptions_country();
$items[$element]['defaultvalue'] = get_config('country') ? get_config('country') : 'nz';
$countries = getoptions_country();
$items[$element]['options'] = array('' => get_string('nocountryselected')) + $countries;
$items[$element]['defaultvalue'] = get_config('country');
}
if (get_helpfile_location('artefact', 'internal', 'profileform', $element)) {
......
......@@ -22,12 +22,13 @@ addLoadEvent(function() {
addElementClass(fieldset.tabLink.parentNode, 'current-tab');
addElementClass(fieldset.tabLink, 'current-tab');
removeElementClass(fieldset, 'safe-hidden');
removeElementClass(fieldset, 'collapsed');
$('profileform_fs').value = fsid;
}
else {
removeElementClass(fieldset.tabLink.parentNode, 'current-tab');
removeElementClass(fieldset.tabLink, 'current-tab');
addElementClass(fieldset, 'safe-hidden');
addElementClass(fieldset, 'collapsed');
}
});
e.stop();
......
......@@ -35,7 +35,7 @@ $string['myfiles'] = 'My Files';
$string['mandatory'] = 'Mandatory';
$string['public'] = 'Public';
$string['aboutdescription'] = 'Enter your real first and last name here. If you want to show a different name to people in the system, put that name in as your preferred name.';
$string['aboutdescription'] = 'Enter your real first and last name here. If you want to show a different name to people in the system, put that name in as your display name.';
$string['contactdescription'] = 'All of this information is private, unless you choose to put it in a view.';
$string['messagingdescription'] = 'Like your contact information, this information is private.';
$string['viewmyprofile'] = 'View my profile';
......@@ -52,7 +52,7 @@ $string['lastname'] = 'Last Name';
$string['fullname'] = 'Full Name';
$string['institution'] = 'Institution';
$string['studentid'] = 'Student ID';
$string['preferredname'] = 'Preferred Name';
$string['preferredname'] = 'Display Name';
$string['introduction'] = 'Introduction';
$string['email'] = 'Email Address';
$string['maildisabled'] = ' ';
......
<h3>Preferred Name</h3>
<p>You can choose to use a preferred name. This may be anything you like. It replaces your full name display to everyone but site administrators and staff</p>
<h3>Display Name</h3>
<p>You can choose to use a display name. This may be anything you like. It replaces your full name display to everyone but site administrators and staff</p>
......@@ -595,6 +595,11 @@ abstract class ArtefactType {
// Delete any references to these artefacts from non-artefact places.
delete_records_select('artefact_parent_cache', "artefact IN $idstr");
// The artefacts should have no 'real' children at this point, but they
// could still be in the artefact_parent_cache as parents if they had
// attachments, or if any of their children had attachments.
delete_records_select('artefact_parent_cache', "parent IN $idstr");
// Make sure that the artefacts are removed from any view blockinstances
if ($records = get_records_sql_array("
SELECT va.block, va.artefact, bi.configdata
......@@ -1038,6 +1043,14 @@ abstract class ArtefactType {
public function detach($attachmentid=null) {
if (is_null($attachmentid)) {
execute_sql("
DELETE FROM {artefact_parent_cache}
WHERE parent = ?
AND artefact IN (
SELECT attachment
FROM {artefact_attachment}
WHERE artefact = ?
)", array($this->id, $this->id));
delete_records('artefact_attachment', 'artefact', $this->id);
return;
}
......
......@@ -26,6 +26,7 @@
<FIELD NAME="startdate" TYPE="text" NOTNULL="true" />
<FIELD NAME="enddate" TYPE="text" NOTNULL="false" />
<FIELD NAME="employer" TYPE="text" NOTNULL="true" />
<FIELD NAME="employeraddress" TYPE="text" NOTNULL="false" />
<FIELD NAME="jobtitle" TYPE="text" NOTNULL="true" />
<FIELD NAME="positiondescription" TYPE="text" NOTNULL="false" />
<FIELD NAME="displayorder" TYPE="int" LENGTH="10" NOTNULL="true" />
......@@ -41,9 +42,10 @@
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="startdate" TYPE="text" NOTNULL="true" />
<FIELD NAME="enddate" TYPE="text" NOTNULL="false" />
<FIELD NAME="qualtype" TYPE="text" NOTNULL="true" />
<FIELD NAME="qualname" TYPE="text" NOTNULL="true" />
<FIELD NAME="qualtype" TYPE="text" NOTNULL="false" />
<FIELD NAME="qualname" TYPE="text" NOTNULL="false" />
<FIELD NAME="institution" TYPE="text" NOTNULL="true" />
<FIELD NAME="institutionaddress" TYPE="text" NOTNULL="false" />
<FIELD NAME="qualdescription" TYPE="text" NOTNULL="false" />
<FIELD NAME="displayorder" TYPE="int" LENGTH="10" NOTNULL="true" />
</FIELDS>
......
......@@ -108,6 +108,30 @@ function xmldb_artefact_resume_upgrade($oldversion=0) {
}
}
if ($oldversion < 2009122100) {
$table = new XMLDBTable('artefact_resume_employmenthistory');
$field = new XMLDBField('employeraddress');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('institutionaddress');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
}
if ($oldversion < 2010020300) {
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualtype');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualname');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
}
return $status;
}
......
......@@ -296,6 +296,7 @@ $inlinejs .= ArtefactTypeResumeComposite::get_showhide_composite_js();
$compositeforms = array();
foreach (ArtefactTypeResumeComposite::get_composite_artefact_types() as $compositetype) {
$inlinejs .= call_static_method(generate_artefact_class_name($compositetype), 'get_composite_js');
$inlinejs .= <<<EOF
tableRenderers.{$compositetype} = new TableRenderer(
'{$compositetype}list',
......
......@@ -85,5 +85,7 @@ $string['moveup'] = 'Move Up';
$string['movedown'] = 'Move Down';
$string['viewyourresume'] = 'View your Resumé';
$string['resumeofuser'] = 'Resumé of %s';
$string['employeraddress'] = 'Employer Address';
$string['institutionaddress'] = 'Institution Address';
?>
......@@ -576,6 +576,10 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
}
";
}
static function get_composite_js() {
return '';
}
}
class ArtefactTypeEmploymenthistory extends ArtefactTypeResumeComposite {
......@@ -624,6 +628,10 @@ class ArtefactTypeEmploymenthistory extends ArtefactTypeResumeComposite {
),
'title' => get_string('employer', 'artefact.resume'),
),
'employeraddress' => array(
'type' => 'text',
'title' => get_string('employeraddress', 'artefact.resume'),
),
'jobtitle' => array(
'type' => 'text',
'rules' => array(
......@@ -662,14 +670,23 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
}
public static function get_tablerenderer_title_js_string() {
$at = get_string('at');
return " r.qualname + ' (' + r.qualtype + ') {$at} ' + r.institution";
return " formatQualification(r.qualname, r.qualtype, r.institution)";
}
public static function format_render_self_data($data) {
$at = get_string('at');
foreach ($data as &$row) {
$row->qualification = $row->qualname . ' (' . $row->qualtype . ") $at " . $row->institution;
$row->qualification = '';
if (strlen($row->qualname) && strlen($row->qualtype)) {
$row->qualification = $row->qualname. ' (' . $row->qualtype . ') ' . $at . ' ';
}
else if (strlen($row->qualtype)) {
$row->qualification = $row->qualtype . ' ' . $at . ' ';
}
else if (strlen($row->qualname)) {
$row->qualification = $row->qualname . ' ' . $at . ' ';
}
$row->qualification .= $row->institution;
}
return $data;
}
......@@ -699,18 +716,16 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
),
'title' => get_string('institution', 'artefact.resume'),
),
'institutionaddress' => array(
'type' => 'text',
'title' => get_string('institutionaddress', 'artefact.resume'),
),
'qualtype' => array(
'type' => 'text',
'rules' => array(
'required' => true,
),
'title' => get_string('qualtype', 'artefact.resume'),
),
'qualname' => array(
'type' => 'text',
'rules' => array(
'required' => true,
),
'title' => get_string('qualname', 'artefact.resume'),
),
'qualdescription' => array(
......@@ -722,6 +737,26 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
),
);
}
static function get_composite_js() {
$at = get_string('at');
return <<<EOF
function formatQualification(name, type, institution) {
var qual = '';
if (name && type) {
qual = name + ' (' + type + ') {$at} ';
}
else if (type) {
qual = type + ' {$at} ';
}
else if (name) {
qual = name + ' {$at} ';
}
qual += institution;
return qual;
}
EOF;
}
}
class ArtefactTypeCertification extends ArtefactTypeResumeComposite {
......
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2008040200;
$config->release = '1.0.0';
$config->version = 2010020300;
$config->release = '1.0.1';
?>
......@@ -803,7 +803,7 @@ function auth_check_required_fields() {
}
if ($field == 'country') {
$elements[$field]['options'] = getoptions_country();
$elements[$field]['defaultvalue'] = get_config('country') ? get_config('country') : 'nz';
$elements[$field]['defaultvalue'] = get_config('country');
}
if ($field == 'email') {
......
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