Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
cf544b51
Commit
cf544b51
authored
Mar 15, 2017
by
Robert Lyon
Committed by
Gerrit Code Review
Mar 15, 2017
Browse files
Merge "Allow HTML in Résumé Achievements and Ed/Emp sections (Bug #989195)"
parents
af028885
6e5724e2
Changes
10
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/resume/composite.json.php
View file @
cf544b51
...
...
@@ -36,6 +36,21 @@ if (!$data = get_records_sql_array($sql, array($owner, $type))) {
$data
=
array
();
}
$classname
=
generate_artefact_class_name
(
$type
);
$iswysiwyg
=
false
;
if
(
is_callable
(
$classname
.
'::is_wysiwyg'
))
{
$iswysiwyg
=
call_static_method
(
$classname
,
'is_wysiwyg'
);
}
foreach
(
$data
as
&
$row
)
{
foreach
(
$row
as
$key
=>
$value
)
{
if
(
$iswysiwyg
&&
preg_match
(
'/description$/'
,
$key
))
{
$row
->
{
$key
}
=
clean_html
(
$row
->
{
$key
});
}
else
{
$row
->
{
$key
}
=
hsc
(
$row
->
{
$key
});
}
}
}
// Add artefact attachments it there are any
$datawithattachments
=
array
();
foreach
(
$data
as
$record
)
{
...
...
htdocs/artefact/resume/db/upgrade.php
View file @
cf544b51
...
...
@@ -50,5 +50,37 @@ function xmldb_artefact_resume_upgrade($oldversion=0) {
execute_sql
(
"UPDATE
{
blocktype_installed_category
}
SET category = 'internal' WHERE category = 'resume'"
);
}
if
(
$oldversion
<
2017030600
)
{
log_debug
(
"Allow WYSIWYG HTML for the field 'description' of Resume Book, Certification, and Membership fields"
);
// Escape all HTML tags in the old database
$types
=
array
(
'book'
,
'membership'
,
'certification'
,
'employmenthistory'
,
'educationhistory'
);
foreach
(
$types
as
$type
)
{
log_debug
(
"Cleaning up data for "
.
$type
);
$total
=
count_records
(
'artefact_resume_'
.
$type
);
$count
=
0
;
$limit
=
1000
;
for
(
$i
=
0
;
$i
<=
$total
;
$i
+=
$limit
)
{
$sql
=
"
SELECT r.id, r.description
FROM {artefact_resume_"
.
$type
.
"} r
ORDER BY r.id"
;
$resumes
=
get_records_sql_array
(
$sql
,
array
(),
$i
,
$limit
);
foreach
(
$resumes
as
$item
)
{
// Escape HTML tags in "description"
$item
->
description
=
hsc
(
$item
->
description
);
set_field
(
'artefact_resume_'
.
$type
,
'description'
,
$item
->
description
,
'id'
,
$item
->
id
);
$count
+=
$limit
;
}
if
((
$count
%
$limit
)
==
0
||
$count
>=
$total
)
{
if
(
$count
>
$total
)
{
$count
=
$total
;
}
log_debug
(
"
$count
/
$total
"
);
set_time_limit
(
30
);
}
}
}
}
return
$status
;
}
htdocs/artefact/resume/lib.php
View file @
cf544b51
...
...
@@ -577,6 +577,10 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume implements
return
true
;
}
public
static
function
is_wysiwyg
()
{
return
false
;
}
public
function
can_have_attachments
()
{
return
true
;
}
...
...
@@ -1248,6 +1252,10 @@ class ArtefactTypeEmploymenthistory extends ArtefactTypeResumeComposite {
"
;
}
public
static
function
is_wysiwyg
()
{
return
true
;
}
public
static
function
get_tablerenderer_title_js_string
()
{
return
" row.jobtitle + ': ' + row.employer"
;
}
...
...
@@ -1303,10 +1311,10 @@ class ArtefactTypeEmploymenthistory extends ArtefactTypeResumeComposite {
'size'
=>
50
,
),
'positiondescription'
=>
array
(
'type'
=>
'
textarea
'
,
'type'
=>
'
wysiwyg
'
,
'rows'
=>
10
,
'cols'
=>
50
,
'r
esizable'
=>
false
,
'r
ules'
=>
array
(
'maxlength'
=>
65536
)
,
'title'
=>
get_string
(
'positiondescription'
,
'artefact.resume'
),
),
'attachments'
=>
array
(
...
...
@@ -1386,6 +1394,10 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
"
;
}
public
static
function
is_wysiwyg
()
{
return
true
;
}
public
static
function
get_tablerenderer_title_js_string
()
{
return
" formatQualification(row.qualname, row.qualtype, row.institution)"
;
}
...
...
@@ -1461,10 +1473,10 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
'size'
=>
50
,
),
'qualdescription'
=>
array
(
'type'
=>
'
textarea
'
,
'type'
=>
'
wysiwyg
'
,
'rows'
=>
10
,
'cols'
=>
50
,
'r
esizable'
=>
false
,
'r
ules'
=>
array
(
'maxlength'
=>
65536
)
,
'title'
=>
get_string
(
'qualdescription'
,
'artefact.resume'
),
),
'attachments'
=>
array
(
...
...
@@ -1566,6 +1578,10 @@ class ArtefactTypeCertification extends ArtefactTypeResumeComposite {
"
;
}
public
static
function
is_wysiwyg
()
{
return
true
;
}
public
static
function
get_tablerenderer_title_js_string
()
{
return
"row.title"
;
}
...
...
@@ -1603,10 +1619,10 @@ class ArtefactTypeCertification extends ArtefactTypeResumeComposite {
'size'
=>
20
,
),
'description'
=>
array
(
'type'
=>
'
textarea
'
,
'type'
=>
'
wysiwyg
'
,
'rows'
=>
10
,
'cols'
=>
50
,
'r
esizable'
=>
false
,
'r
ules'
=>
array
(
'maxlength'
=>
65536
)
,
'title'
=>
get_string
(
'description'
),
),
'attachments'
=>
array
(
...
...
@@ -1681,6 +1697,10 @@ class ArtefactTypeBook extends ArtefactTypeResumeComposite {
"
;
}
public
static
function
is_wysiwyg
()
{
return
true
;
}
public
static
function
get_tablerenderer_title_js_string
()
{
return
"row.title + ' (' + row.contribution + ')'"
;
}
...
...
@@ -1733,10 +1753,10 @@ EOF;
'size'
=>
50
,
),
'description'
=>
array
(
'type'
=>
'
textarea
'
,
'type'
=>
'
wysiwyg
'
,
'rows'
=>
10
,
'cols'
=>
50
,
'r
esizable'
=>
false
,
'r
ules'
=>
array
(
'maxlength'
=>
65536
)
,
'title'
=>
get_string
(
'detailsofyourcontribution'
,
'artefact.resume'
),
),
'attachments'
=>
array
(
...
...
@@ -1817,6 +1837,10 @@ class ArtefactTypeMembership extends ArtefactTypeResumeComposite {
"
;
}
public
static
function
is_wysiwyg
()
{
return
true
;
}
public
static
function
get_tablerenderer_title_js_string
()
{
return
"row.title"
;
}
...
...
@@ -1859,10 +1883,10 @@ class ArtefactTypeMembership extends ArtefactTypeResumeComposite {
'size'
=>
50
,
),
'description'
=>
array
(
'type'
=>
'
textarea
'
,
'type'
=>
'
wysiwyg
'
,
'rows'
=>
10
,
'cols'
=>
50
,
'r
esizable'
=>
false
,
'r
ules'
=>
array
(
'maxlength'
=>
65536
)
,
'title'
=>
get_string
(
'description'
,
'artefact.resume'
),
),
'attachments'
=>
array
(
...
...
htdocs/artefact/resume/version.php
View file @
cf544b51
...
...
@@ -12,5 +12,5 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
201
30729
00
;
$config
->
release
=
'1.0.
2
'
;
$config
->
version
=
201
70306
00
;
$config
->
release
=
'1.0.
3
'
;
htdocs/theme/raw/plugintype/artefact/resume/templates/fragments/book.tpl
View file @
cf544b51
...
...
@@ -78,7 +78,7 @@
<div
id=
"book-content-
{
$row
->
id
}{
if
$artefactid
}
-
{
$artefactid
}{/
if
}
"
class=
"collapse resume-content"
>
{
if
$row
->
description
}
<p
class=
"content-text"
>
{
$row
->
description
}
{
$row
->
description
|
safe
}
</p>
{/
if
}
...
...
htdocs/theme/raw/plugintype/artefact/resume/templates/fragments/certification.tpl
View file @
cf544b51
...
...
@@ -79,7 +79,7 @@
<div
id=
"certification-content-
{
$row
->
id
}{
if
$artefactid
}
-
{
$artefactid
}{/
if
}
"
class=
"collapse resume-content"
>
{
if
$row
->
description
}
<p
class=
"content-text"
>
{
$row
->
description
}
{
$row
->
description
|
safe
}
</p>
{/
if
}
...
...
htdocs/theme/raw/plugintype/artefact/resume/templates/fragments/educationhistory.tpl
View file @
cf544b51
...
...
@@ -79,7 +79,7 @@
<div
id=
"education-content-
{
$row
->
id
}{
if
$artefactid
}
-
{
$artefactid
}{/
if
}
"
class=
"collapse resume-content"
>
{
if
$row
->
qualdescription
}
<p
class=
"content-text"
>
{
$row
->
qualdescription
}
{
$row
->
qualdescription
|
safe
}
</p>
{/
if
}
...
...
htdocs/theme/raw/plugintype/artefact/resume/templates/fragments/employmenthistory.tpl
View file @
cf544b51
...
...
@@ -78,7 +78,7 @@
<div
id=
"employment-content-
{
$row
->
id
}{
if
$artefactid
}
-
{
$artefactid
}{/
if
}
"
class=
"collapse resume-content"
>
{
if
$row
->
positiondescription
}
<p
class=
"content-text"
>
{
$row
->
positiondescription
}
{
$row
->
positiondescription
|
safe
}
</p>
{/
if
}
...
...
htdocs/theme/raw/plugintype/artefact/resume/templates/fragments/membership.tpl
View file @
cf544b51
...
...
@@ -82,7 +82,7 @@
<div
id=
"membership-content-
{
$row
->
id
}{
if
$artefactid
}
-
{
$artefactid
}{/
if
}
"
class=
"collapse resume-content"
>
{
if
$row
->
description
}
<p
class=
"content-text"
>
{
$row
->
description
}
{
$row
->
description
|
safe
}
</p>
{/
if
}
...
...
test/behat/features/artefact/resume/resume_page.feature
View file @
cf544b51
...
...
@@ -34,7 +34,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And
I follow
"Education and employment"
# Adding Education history
And
I press
"addeducationhistorybutton"
And I
fill in
the following
:
And I
set
the following
fields to these values
:
|
addeducationhistory_startdate
|
1
Jan
2009
|
|
addeducationhistory_enddate
|
2
Dec
2010
|
|
addeducationhistory_institution
|
something
|
...
...
@@ -48,7 +48,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And
I click on
"addeducationhistory_submit"
And
I should see
"Saved successfully"
And
I press
"addeducationhistorybutton"
And I
fill in
the following
:
And I
set
the following
fields to these values
:
|
addeducationhistory_startdate
|
1
Jan
2009
|
|
addeducationhistory_enddate
|
2
Dec
2010
|
|
addeducationhistory_institution
|
this
is
an
institution
|
...
...
@@ -64,7 +64,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And
I click on
"Move up"
in
"something"
row
# Adding an Employment history
And
I press
"addemploymenthistorybutton"
And I
fill in
the following
:
And I
set
the following
fields to these values
:
|
addemploymenthistory_startdate
|
1
Jan
2009
|
|
addemploymenthistory_enddate
|
02
Dec
2010
|
|
addemploymenthistory_employer
|
Test
|
...
...
@@ -77,7 +77,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And
I click on
"addemploymenthistory_submit"
Then
I should see
"Saved successfully"
And
I press
"addemploymenthistorybutton"
And I
fill in
the following
:
And I
set
the following
fields to these values
:
|
addemploymenthistory_startdate
|
1
Jan
2009
|
|
addemploymenthistory_enddate
|
02
Dec
2010
|
|
addemploymenthistory_employer
|
asdhgol
|
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment