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

Merge commit 'origin/master' into tagsearch

parents 649ff55a 2b13a209
......@@ -5,7 +5,7 @@
<div>{$blog->description|clean_html}</div>
</td>
<td class="right">
<a href="{$WWWROOT}artefact/blog/settings/?id={$blog->id}" class="btn-edit">{str tag=settings}</a>
<a href="{$WWWROOT}artefact/blog/settings/?id={$blog->id}" class="btn-settings">{str tag=settings}</a>
<a href="{$WWWROOT}artefact/blog/index.php?delete={$blog->id}" class="btn-del">{str tag=delete}</a>
<a href="{$WWWROOT}artefact/blog/post.php?blog={$blog->id}" class="btn-add">{str tag=addpost section=artefact.blog}</a>
</td>
......
......@@ -5,8 +5,15 @@
* This file is distributed under the same terms as Mahara itself
*/
#postlist td.postdetails {
padding-bottom: 2em;
padding-bottom: 1em;
font-style: italic;
font-size: .9em;
color: #888;
}
#postlist th {
padding: 1em .4em .25em .4em;
font-size: 1.3em;
border-top: 1px dotted #d1d1d1;
}
#postlist p {
margin: 0 0 1em 0;
......@@ -15,3 +22,25 @@
#bloglist td .addicon {
margin: 0;
}
#editpost_filebrowser_empty_selectlist {
margin: 0;
}
#postlist .attachments {
margin-top: 1em;
}
#postlist .attachments th {
padding: .25em .5em;
font-size: 1em;
border-top: none;
}
#postlist input.delete,
#postlist input.edit {
font-size: .7em;
font-family: Arial, Helvetica, sans-serif;
color: blue;
}
table#bloglist .right a {
font-size: .9em;
margin-left: 1em;
padding-left: 1em;
}
......@@ -2,19 +2,19 @@
<div id="myblogs rel">
<div class="rbuttons">
<div><a class="btn-add" href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a></div>
<div><a class="btn-edit" href="{$WWWROOT}artefact/blog/settings/?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a></div>
<div><a class="btn-add" href="{$WWWROOT}artefact/blog/new">{str tag=addblog section=artefact.blog}</a></div>
<a class="btn-add" href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a>
<a class="btn-edit" href="{$WWWROOT}artefact/blog/settings/?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a>
<a class="btn-add" href="{$WWWROOT}artefact/blog/new">{str tag=addblog section=artefact.blog}</a>
</div>
<p>{$blog->get('description')}</p>
{if $blog->count_children() > 0}
<div><table id="postlist" class="hidden tablerenderer fullwidth nohead">
<table id="postlist" class="hidden tablerenderer fullwidth nohead">
<tbody>
<tr><td></td><td></td><td></td></tr>
</tbody>
</table></div>
</table>
{else}
<div class="message">{$strnopostsaddone}</div>
{/if}
......
......@@ -21,11 +21,33 @@
form#files .foldernav {
padding: 0 0 0 2em;
font-size: 1.2em;
font-size: 1.4em;
line-height: 1.6em;
height: 1.7em;
background: url(../images/foldernav.gif) no-repeat left 2px;
}
#files_filebrowser_filelist_container {
margin-left: 2.5em;
}
#files_filebrowser_agreement td {
font-size: .9em;
}
#files_filebrowser_edit_row td {
border-top: 0;
border-left: 1px solid #eee;
border-right: 1px solid #eee;
border-bottom: 1px solid #eee;
}
#files_filebrowser_edit_row td td {
border: none;
}
#files_filebrowser_edit_row #files_filebrowser_edit_heading {
text-align: left;
font-size: 1.2em;
}
#files_filebrowser_edit_row table td #files_filebrowser_edit_artefact {
margin-left: 65px;
}
tr.folderhover.directory-item td {
background-color: #ffc !important;
......@@ -34,8 +56,13 @@ tr.folderhover.directory-item a {
color: #000;
text-decoration: none;
}
tr.folder td {
background-color: #d3e4f2;
tr.folder.r0 td {
background: #e7e7e7;
}
tr.folder.r1 td {
background: #eee;
}
tr.folder td.filename {
font-weight: bold;
}
......@@ -45,7 +72,6 @@ tr.folder td {
}
.filelist thead th {
padding: 0.125em 0.25em;
border-bottom: 1px dotted #d1d1d1;
}
form#files .filelist thead th {
padding: 0.25em 0.5em;
......@@ -53,7 +79,6 @@ form#files .filelist thead th {
.filelist td {
padding: 0.125em 0.25em;
line-height: 2em;
border-bottom: 1px dotted #d1d1d1;
}
form#files .filelist td {
padding: 0.25em 0.5em;
......@@ -89,3 +114,6 @@ form#files .filelist td {
color: #C3C3C3;
}
.icon-drag {
cursor: move;
}
......@@ -17,13 +17,16 @@ input#myfriends_addfriend_add {
#email_list {
line-height: 2em;
line-height: 2em;
}
#email_list a {
color: #ca0000;
font-size: .9em;
text-decoration: none;
margin-left: .5em;
}
#profileform_email_container a {
font-size: .9em;
}
.profile-fieldsets fieldset {
......
......@@ -28,26 +28,8 @@
class LeapExportElementBook extends LeapExportElementResumeComposite {}
class LeapExportElementCertification extends LeapExportElementResumeComposite {}
class LeapExportElementMembership extends LeapExportElementResumeComposite {}
class LeapExportElementEducationhistory extends LeapExportElementResumeComposite {
public function get_categories() {
return array_merge(parent::get_categories(), array(
'life_area' => array(
'scheme' => 'life_area',
'term' => 'Education',
)
));
}
}
class LeapExportElementEmploymenthistory extends LeapExportElementResumeComposite {
public function get_categories() {
return array_merge(parent::get_categories(), array(
'life_area' => array(
'scheme' => 'life_area',
'term' => 'Work',
)
));
}
}
class LeapExportElementEducationhistory extends LeapExportElementResumeComposite {}
class LeapExportElementEmploymenthistory extends LeapExportElementResumeComposite {}
class LeapExportElementContactinformation extends LeapExportElement {
public function get_categories() {
......@@ -195,7 +177,7 @@ class LeapExportElementResumeComposite extends LeapExportElement {
$xml = '';
foreach ($this->composites as $c) {
$classname = 'LeapExportElementResumeCompositeChild' . $this->artefact->get('artefacttype');
$child = new $classname($this->exporter, $this->artefact, $c);
$child = new $classname($this->artefact, $this->exporter, $c);
$xml .= $child->get_export_xml();
if ($siblings = $child->get_siblings()) {
foreach ($siblings as $sibling) {
......@@ -228,10 +210,6 @@ class LeapExportElementResumeComposite extends LeapExportElement {
'scheme' => 'selection_type',
'term' => 'Grouping'
),
'life_area' => array(
'scheme' => 'life_area',
'term' => 'Development',
)
);
}
}
......@@ -246,10 +224,13 @@ abstract class LeapExportElementResumeCompositeChild extends LeapExportElement {
protected $originalrecord;
protected $parentartefact;
public function __construct(LeapExporter $exporter, ArtefactTypeResumeComposite $parentartefact, $child) {
public function __construct(ArtefactTypeResumeComposite $parentartefact, LeapExporter $exporter, $child) {
$this->originalrecord = $child;
$this->entrydata = $this->record_to_entrydata($child);
$this->parentartefact = $parentartefact;
// We pass 'null' as the artefact ID, as this class represents
// composite children that aren't really artefacts. The field
// 'parentartefact' holds a reference to the parent.
parent::__construct(null, $exporter);
$this->assign_smarty_vars();
}
......@@ -263,6 +244,10 @@ abstract class LeapExportElementResumeCompositeChild extends LeapExportElement {
}
$this->smarty->assign('leaptype', $this->get_leap_type());
$this->smarty->assign('contenttype', 'text');
if (!$categories = $this->get_categories()) {
$categories = array();
}
$this->smarty->assign('categories', $categories);
$this->add_links();
$this->smarty->assign('links', $this->links);
}
......@@ -347,10 +332,10 @@ class LeapExportElementResumeCompositeChildEducationhistory extends LeapExportEl
public function ensure_siblings() {
$this->siblings = array(
'is_supported_by' => new LeapExportElementResumeCompositeSibling($this->exporter, $this->parentartefact, $this, array(
'is_supported_by' => new LeapExportElementResumeCompositeSibling($this->parentartefact, $this->exporter, $this, array(
'title' => $this->originalrecord->institution,
), 'organisation', 'supports'),
'supports' => new LeapExportElementResumeCompositeSibling($this->exporter, $this->parentartefact, $this, array(
'supports' => new LeapExportElementResumeCompositeSibling($this->parentartefact, $this->exporter, $this, array(
'title' => $this->originalrecord->qualtype,
'content' => $this->originalrecord->qualname,
), 'achievement', 'is_supported_by')
......@@ -369,13 +354,22 @@ class LeapExportElementResumeCompositeChildEducationhistory extends LeapExportEl
public function get_leap_type() {
return 'activity';
}
public function get_categories() {
return array_merge(parent::get_categories(), array(
'life_area' => array(
'scheme' => 'life_area',
'term' => 'Education',
)
));
}
}
class LeapExportElementResumeCompositeChildEmploymenthistory extends LeapExportElementResumeCompositeChildWithSiblings {
public function ensure_siblings() {
$this->siblings = array(
'is_supported_by' => new LeapExportElementResumeCompositeSibling($this->exporter, $this->parentartefact, $this, array(
'is_supported_by' => new LeapExportElementResumeCompositeSibling($this->parentartefact, $this->exporter, $this, array(
'title' => $this->originalrecord->employer,
), 'organisation', 'supports')
);
......@@ -393,12 +387,21 @@ class LeapExportElementResumeCompositeChildEmploymenthistory extends LeapExportE
public function get_leap_type() {
return 'activity';
}
public function get_categories() {
return array_merge(parent::get_categories(), array(
'life_area' => array(
'scheme' => 'life_area',
'term' => 'Work',
)
));
}
}
class LeapExportElementResumeCompositeChildBook extends LeapExportElementResumeCompositeChildWithSiblings {
public function ensure_siblings() {
$this->siblings = array(
'relation' => new LeapExportElementResumeCompositeSibling($this->exporter, $this->parentartefact, $this, array(
'relation' => new LeapExportElementResumeCompositeSibling($this->parentartefact, $this->exporter, $this, array(
'title' => $this->originalrecord->contribution
), 'achievement', 'relation')
);
......@@ -415,6 +418,15 @@ class LeapExportElementResumeCompositeChildBook extends LeapExportElementResumeC
public function get_leap_type() {
return 'resource';
}
public function get_categories() {
return array(
'resource_type' => array(
'scheme' => 'resource_type',
'term' => 'Printed'
),
);
}
}
/**
......
......@@ -44,6 +44,21 @@ class LeapImportResume extends LeapImportArtefactPlugin {
*/
const STRATEGY_IMPORT_AS_ABILITY = 2;
/**
* Achievements map in Mahara to certifications/accreditations
*/
const STRATEGY_IMPORT_AS_ACHIEVEMENT = 3;
/**
* Activities in category life_area:Work map to employment history
*/
const STRATEGY_IMPORT_AS_EMPLOYMENT = 4;
/**
* Resources of resource_type:Printed map to books/publications
*/
const STRATEGY_IMPORT_AS_BOOK = 5;
/**
* Description of strategies used
*/
......@@ -52,10 +67,10 @@ class LeapImportResume extends LeapImportArtefactPlugin {
$correctplugintype = count($entry->xpath('mahara:artefactplugin[@mahara:plugin="resume"]')) == 1;
// Goals, cover letter & interests
$correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'entry') . ']')) == 1;
if ($correctrdftype && $correctplugintype) {
// Goals, cover letter, interests match here
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_ENTRY,
'score' => 100,
......@@ -63,10 +78,10 @@ class LeapImportResume extends LeapImportArtefactPlugin {
);
}
// Skills
$correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'ability') . ']')) == 1;
if ($correctrdftype && $correctplugintype) {
// Skills match here
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_ABILITY,
'score' => 100,
......@@ -74,6 +89,53 @@ class LeapImportResume extends LeapImportArtefactPlugin {
);
}
// Achievements
$correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'achievement') . ']')) == 1;
if ($correctrdftype && $correctplugintype) {
if (count($entry->xpath('mahara:artefactplugin[@mahara:plugin="resume" and @mahara:type="pseudo:certification"]')) == 1) {
// We know for certain these are meant to be certifications within Mahara
$score = 100;
}
else {
// Some things are achievements, but are wrapped up in other things within Mahara,
// so these don't get the full score. Of course, if nothing
// else claims them, they'll be imported as certifications
$score = 50;
}
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_ACHIEVEMENT,
'score' => $score,
'other_required_entries' => array(),
);
}
// Employment
$correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'activity') . ']')) == 1;
$correctcategoryscheme = count($entry->xpath('a:category[('
. $importer->curie_xpath('@scheme', PluginImportLeap::NS_CATEGORIES, 'life_area#') . ') and @term="Work"]')) == 1;
if ($correctrdftype && $correctcategoryscheme) {
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_EMPLOYMENT,
'score' => 100,
'other_required_entries' => array(), // TODO: we need is_supported_by entries, which in mahara usually refer to organisations
);
}
// Books
$correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'resource') . ']')) == 1;
$correctcategoryscheme = count($entry->xpath('a:category[('
. $importer->curie_xpath('@scheme', PluginImportLeap::NS_CATEGORIES, 'resource_type#') . ') and @term="Printed"]')) == 1;
if ($correctrdftype && $correctcategoryscheme) {
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_BOOK,
'score' => 100,
'other_required_entries' => array(),
);
}
return $strategies;
}
......@@ -124,6 +186,46 @@ class LeapImportResume extends LeapImportArtefactPlugin {
}
}
break;
case self::STRATEGY_IMPORT_AS_ACHIEVEMENT:
$dates = PluginImportLeap::get_leap_dates($entry);
$enddate = (isset($dates['end'])) ? self::convert_leap_date_to_resume_date($dates['end']) : '';
$values = array(
'date' => $enddate,
'title' => $entry->title,
'description' => PluginImportLeap::get_entry_content($entry, $importer),
'displayorder' => '', // TODO: if it's part of a selection_type#Grouping of mahara:type=certification, get ordering from there
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'certification', $importer->get('usr'));
break;
case self::STRATEGY_IMPORT_AS_EMPLOYMENT:
$dates = PluginImportLeap::get_leap_dates($entry);
$startdate = (isset($dates['start'])) ? self::convert_leap_date_to_resume_date($dates['start']) : '';
$enddate = (isset($dates['end'])) ? self::convert_leap_date_to_resume_date($dates['end']) : '';
$values = array(
'startdate' => $startdate,
'enddate' => $enddate,
'employer' => '', // TODO - get from related organisation
'jobtitle' => $entry->title,
'positiondescription' => PluginImportLeap::get_entry_content($entry, $importer),
'displayorder' => '', // TODO: get from the grouping, or failing that, from this entry itself
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'employmenthistory', $importer->get('usr'));
break;
case self::STRATEGY_IMPORT_AS_BOOK:
$dates = PluginImportLeap::get_leap_dates($entry);
$enddate = (isset($dates['end'])) ? self::convert_leap_date_to_resume_date($dates['end']) : '';
$values = array(
'date' => $enddate,
'title' => $entry->title,
'contribution' => '', // TODO - get from related entry
'description' => PluginImportLeap::get_entry_content($entry, $importer), // TODO Still debate over what this is the description of
'displayorder' => '', // TODO: get from the grouping, or failing that, from this entry itself
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'book', $importer->get('usr'));
break;
default:
throw new ImportException($importer, 'TODO: get_string: unknown strategy chosen for importing entry');
}
......@@ -213,6 +315,23 @@ class LeapImportResume extends LeapImportArtefactPlugin {
return $artefact->get('id');
}
/**
* Converts a LEAP2A date point to a plain text version for resume date
* purposes.
*
* @param array $date The date - expected to come from {PluginImportLeap::....()}
* @return string The date in string form for resume composites
*/
private static function convert_leap_date_to_resume_date($date) {
if (isset($date['value'])) {
return strftime(get_string_from_language(/* TODO: user's language */'en.utf8', 'strftimedaydatetime'), strtotime($date['value']));
}
if (isset($date['label'])) {
return $date['label'];
}
return '';
}
}
?>
......@@ -375,17 +375,27 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
* @throws Exception
*/
public static function process_compositeform(Pieform $form, $values) {
global $USER;
self::ensure_composite_value($values, $values['compositetype'], $USER->get('id'));
}
/**
* Ensures that the given value for the given composite is present
* TODO: expand on these docs.
*/
public static function ensure_composite_value($values, $compositetype, $owner) {
if (!in_array($compositetype, self::get_composite_artefact_types())) {
throw new SystemException("ensure_composite_value called with invalid composite type");
}
try {
$a = artefact_instance_from_type($values['compositetype']);
$a = artefact_instance_from_type($compositetype, $owner);
$a->set('mtime', time());
}
catch (Exception $e) {
global $USER;
$classname = generate_artefact_class_name($values['compositetype']);
$classname = generate_artefact_class_name($compositetype);
$a = new $classname(0, array(
'owner' => $USER->get('id'),
'title' => get_string($values['compositetype'], 'artefact.resume'),
'owner' => $owner,
'title' => get_string($compositetype, 'artefact.resume'),
)
);
}
......@@ -394,7 +404,7 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
$values['artefact'] = $a->get('id');
$table = 'artefact_resume_' . $values['compositetype'];
$table = 'artefact_resume_' . $compositetype;
if (!empty($values['id'])) {
update_record($table, (object)$values, 'id');
}
......
......@@ -14,28 +14,51 @@
#resumewrap table {
width: 100%;
}
#resumewrap form table td,
#resumewrap form table tbody th {
#resumewrap table td {
padding: 0;
}
#resumewrap form table td,
#resumewrap form table tbody th {
padding: .25em;
#resumewrap #addemploymenthistory table td,
#resumewrap #addeducationhistory table td,
#resumewrap #addcertification table td,
#resumewrap #addbook table td,
#resumewrap #addmembership table td {
padding: 0.25em;
}
#resumewrap table table {
width: auto;
}
#resumewrap form {
margin: 0;
}
#resumewrap form .resumecontactinfo td,
#resumewrap form .resumecontactinfo tbody th,
#personalinformation table table td,
#personalinformation table table tbody th {
padding: 0.25em;
}
fieldset legend.resumeh3 a {
background: none;
padding: 0;
}
#resumewrap fieldset table {
float: left;
}
tr#contactinformation_contactinformation_container th {
display: none;
}
tr#contactinformation_contactinformation_container td .resumecontactinfo th {
width: 30%;
display: table-cell;
display: block;
width: 170px;
line-height: 1.6em;
}
#personalinformation fieldset th label {
font-weight: bold;
font-size: 1em;
}
#goalform .mceEditor .mceLayout,
#skillform .mceEditor .mceLayout {
margin-bottom: 1em;
}
......@@ -31,7 +31,7 @@
// it to suit your environment.
//