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
ba16996a
Commit
ba16996a
authored
Jul 17, 2016
by
Robert Lyon
Committed by
Gerrit Code Review
Jul 17, 2016
Browse files
Merge "Bug 1438894: Moving the profile introduction text to description column"
parents
ca00f969
e305c12a
Changes
8
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/internal/blocktype/profileinfo/lib.php
View file @
ba16996a
...
...
@@ -243,6 +243,16 @@ class PluginBlocktypeProfileinfo extends MaharaCoreBlocktype {
'template'
=>
'artefact:internal:artefactchooser-element.tpl'
,
);
}
/**
* Allow the introduction option to be displayed correctly
*/
public
static
function
artefactchooser_get_element_data
(
$artefact
)
{
if
(
$artefact
->
artefacttype
==
'introduction'
)
{
unset
(
$artefact
->
description
);
}
return
$artefact
;
}
/**
* Deliberately enforce _no_ sort order. The database will return them in
...
...
htdocs/artefact/internal/export/leap/lib.php
View file @
ba16996a
...
...
@@ -49,7 +49,7 @@ class LeapExportElementInternal extends LeapExportElement {
if
(
!
$data
=
$this
->
data_mapping
(
$a
))
{
if
(
$a
->
get
(
'artefacttype'
)
==
'introduction'
)
{
$this
->
smarty
->
assign
(
'contenttype'
,
'html'
);
$this
->
smarty
->
assign
(
'content'
,
clean_html
(
$a
->
get
(
'
title
'
)));
$this
->
smarty
->
assign
(
'content'
,
clean_html
(
$a
->
get
(
'
description
'
)));
}
continue
;
}
...
...
htdocs/artefact/internal/import/leap/lib.php
View file @
ba16996a
...
...
@@ -393,7 +393,8 @@ class LeapImportInternal extends LeapImportArtefactPlugin {
switch
(
$entrydata
[
'type'
])
{
case
'introduction'
:
$introduction
=
new
ArtefactTypeIntroduction
(
0
,
array
(
'owner'
=>
$importer
->
get
(
'usr'
)));
$introduction
->
set
(
'title'
,
$entrydata
[
'content'
][
'title'
]);
$introduction
->
set
(
'title'
,
'introduction'
);
$introduction
->
set
(
'description'
,
$entrydata
[
'content'
][
'title'
]);
$introduction
->
commit
();
$artefactmapping
[(
string
)
$entry
->
id
]
=
array
(
$introduction
->
get
(
'id'
));
break
;
...
...
htdocs/artefact/internal/index.php
View file @
ba16996a
...
...
@@ -31,7 +31,12 @@ $profile_data = get_records_select_array('artefact', "owner=? AND artefacttype I
if
(
$profile_data
)
{
foreach
(
$profile_data
as
$field
)
{
$profilefields
[
$field
->
artefacttype
]
=
$field
->
title
;
if
(
$field
->
artefacttype
==
'introduction'
)
{
$profilefields
[
$field
->
artefacttype
]
=
$field
->
description
;
}
else
{
$profilefields
[
$field
->
artefacttype
]
=
$field
->
title
;
}
}
}
...
...
htdocs/artefact/internal/lib.php
View file @
ba16996a
...
...
@@ -789,8 +789,14 @@ class ArtefactTypeEmail extends ArtefactTypeProfileField {
class
ArtefactTypeStudentid
extends
ArtefactTypeCachedProfileField
{}
class
ArtefactTypeIntroduction
extends
ArtefactTypeProfileField
{
public
function
commit
()
{
$this
->
set
(
'description'
,
$this
->
title
);
$this
->
set
(
'title'
,
'introduction'
);
parent
::
commit
();
}
public
function
render_self
(
$options
)
{
return
array
(
'html'
=>
clean_html
(
$this
->
title
),
'javascript'
=>
null
);
return
array
(
'html'
=>
clean_html
(
$this
->
description
),
'javascript'
=>
null
);
}
}
class
ArtefactTypeWebAddress
extends
ArtefactTypeProfileField
{
...
...
htdocs/lib/db/upgrade.php
View file @
ba16996a
...
...
@@ -4556,5 +4556,24 @@ function xmldb_core_upgrade($oldversion=0) {
clear_menu_cache
();
}
if
(
$oldversion
<
2016070801
)
{
log_debug
(
'Adjusting the profile "introduction" field to store the tinymce data in description field rather than title field for consistency'
);
if
(
$results
=
get_records_array
(
'artefact'
,
'artefacttype'
,
'introduction'
,
'id'
,
'id'
))
{
safe_require
(
'artefact'
,
'internal'
);
$count
=
0
;
$limit
=
1000
;
$total
=
count
(
$results
);
foreach
(
$results
as
$result
)
{
$introduction
=
new
ArtefactTypeIntroduction
(
$result
->
id
);
$introduction
->
commit
();
$count
++
;
if
((
$count
%
$limit
)
==
0
||
$count
==
$total
)
{
log_debug
(
"
$count
/
$total
"
);
set_time_limit
(
30
);
}
}
}
}
return
$status
;
}
htdocs/lib/user.php
View file @
ba16996a
...
...
@@ -663,6 +663,9 @@ function get_profile_field($userid, $field) {
$value
=
ArtefactTypeSocialprofile
::
get_social_profiles
();
}
}
else
if
(
$field
==
'introduction'
)
{
$value
=
get_field
(
'artefact'
,
'description'
,
'owner'
,
$userid
,
'artefacttype'
,
$field
);
}
else
{
$value
=
get_field
(
'artefact'
,
'title'
,
'owner'
,
$userid
,
'artefacttype'
,
$field
);
}
...
...
htdocs/lib/version.php
View file @
ba16996a
...
...
@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config
->
version
=
201607080
0
;
$config
->
version
=
201607080
1
;
$config
->
series
=
'16.10'
;
$config
->
release
=
'16.10dev'
;
$config
->
minupgradefrom
=
2012080604
;
...
...
Write
Preview
Markdown
is supported
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