Skip to content
GitLab
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
4064ecd3
Commit
4064ecd3
authored
Sep 24, 2013
by
Aaron Wells
Committed by
Gerrit Code Review
Sep 25, 2013
Browse files
Backwards compatibility for pre-flexible-layout Pages
Bug 1229550 Change-Id: I3c42c63a82b662e680234029ed5254bebbf9f26c
parent
26fabf4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/comment/import/leap/lib.php
View file @
4064ecd3
...
...
@@ -58,6 +58,7 @@ class LeapImportComment extends LeapImportArtefactPlugin {
'title'
=>
'--'
,
'type'
=>
'portfolio'
,
'numrows'
=>
1
,
'numcolumns'
=>
1
,
'ctime'
=>
$time
,
'mtime'
=>
$time
,
'atime'
=>
$time
,
...
...
htdocs/import/leap/lib.php
View file @
4064ecd3
...
...
@@ -802,10 +802,22 @@ class PluginImportLeap extends PluginImport {
$rows
=
$entry
->
xpath
(
'mahara:view[1]/mahara:row'
);
$rowcount
=
count
(
$rows
);
// A flag that indicates whether this is an old-style one-row layout, or a new-style multi-row layout
$onerowlayout
=
false
;
if
(
$rowcount
<
1
||
$rowcount
>
View
::
$maxlayoutrows
)
{
// Whoops, invalid number of rows
$this
->
trace
(
"Invalid number of rows specified for potential view
{
$entry
->
id
}
, falling back to standard import"
,
self
::
LOG_LEVEL_VERBOSE
);
return
false
;
// Check for a pre-1.8 (one-row) layout
$columns
=
$entry
->
xpath
(
'mahara:view[1]/mahara:column'
);
$columncount
=
count
(
$columns
);
if
(
$columncount
<
1
||
$columncount
>
5
)
{
// Whoops, invalid number of rows
$this
->
trace
(
"Invalid number of rows specified for potential view
{
$entry
->
id
}
, falling back to standard import"
,
self
::
LOG_LEVEL_VERBOSE
);
return
false
;
}
else
{
$onerowlayout
=
true
;
$rows
=
array
(
$columns
);
$rowcount
=
1
;
}
}
$layout
=
null
;
...
...
@@ -875,12 +887,15 @@ class PluginImportLeap extends PluginImport {
$rowindex
=
1
;
foreach
(
$rows
as
$row
)
{
$columns
=
$row
->
xpath
(
'mahara:column'
);
$columncount
=
count
(
$columns
);
if
(
$columncount
<
1
||
$columncount
>
5
)
{
// Whoops, invalid number of columns
$this
->
trace
(
"Invalid number of columns specified for potential view
{
$entry
->
id
}
, falling back to standard import"
,
self
::
LOG_LEVEL_VERBOSE
);
return
false
;
// If this is the old one-row layout, we'll have handled that earlier, and have the one row's columns be in $columns
if
(
!
$onerowlayout
)
{
$columns
=
$row
->
xpath
(
'mahara:column'
);
$columncount
=
count
(
$columns
);
if
(
$columncount
<
1
||
$columncount
>
5
)
{
// Whoops, invalid number of columns
$this
->
trace
(
"Invalid number of columns specified for potential view
{
$entry
->
id
}
, falling back to standard import"
,
self
::
LOG_LEVEL_VERBOSE
);
return
false
;
}
}
$colindex
=
1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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