Commit 50710e07 authored by Robert Lyon's avatar Robert Lyon Committed by Aaron Wells
Browse files

Bug 1461040: Stopping layout thumbs being created from langstring info



There is no need to go to tha lang string info as the items already
have the layout info we need.

Currently breaks where lang packs have the strings defined to
something else

Change-Id: I93dfef6975a60b26980fbea7aefa645d30948a32
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit b913791c)
parent 7f951439
......@@ -72,8 +72,7 @@ class LayoutPreviewImage {
$class = true;
foreach ($this->layout as $key => $row) {
$style = 'layout' . (int)$class;
$columns = explode('-', $row);
$columns = explode(',', $row);
foreach ($columns as $column) {
$col_width = $this->get_percentage_column_width(count($columns), $column);
$layout .= "<rect x='{$x}' y='{$y}' width='{$col_width}' height='{$col_height}' class='{$style}'/>";
......
......@@ -1054,8 +1054,8 @@ class View {
for ($i=0; $i<$numrows; $i++) {
$id = $collayouts['row' . ($i+1)];
$widths = get_field('view_layout_columns', 'widths', 'id', $id);
$customlayout[$i+1] = $widths;
$hyphenatedwidths = str_replace(',', '-', $widths);
$customlayout[$i+1] = $hyphenatedwidths;
$alttext .= $hyphenatedwidths;
if ($i != $numrows - 1) {
$alttext .= ' / ';
......@@ -1192,7 +1192,7 @@ class View {
for ($i=0; $i<$numrows; $i++) {
if (array_key_exists(($i+1), $rowscols)) {
$widths = get_field('view_layout_columns', 'widths', 'id', $rowscols[$i+1]);
$structure['layout']['row' . ($i + 1)] = get_string($widths, 'view');
$structure['layout']['row' . ($i + 1)] = $widths;
$newrec = insert_record('view_layout_rows_columns', (object) array('viewlayout' => $newlayoutid, 'row' => ($i+1), 'columns' => $rowscols[$i+1]));
if (!$newrec) {
db_rollback();
......
......@@ -72,7 +72,7 @@ foreach ($layoutrows as $key => $layout) {
$structure = array();
for ($r = 1; $r <= count($layout); $r++) {
$structure['layout']['row' . $r] = get_string($layoutcolumns[$layout[$r]]->widths, 'view');
$structure['layout']['row' . $r] = $layoutcolumns[$layout[$r]]->widths;
}
$structure['text'] = implode(' / ', $structure['layout']);
$l = new LayoutPreviewImage($structure);
......@@ -105,7 +105,7 @@ $clnumcolumnsdefault = $defaultlayout->columns;
$clwidths = $defaultlayout->widths;
// Ready custom layout preview.
$defaultlayoutpreviewdata['layout']['row1'] = get_string($defaultcustomlayout[1]->widths, 'view');
$defaultlayoutpreviewdata['layout']['row1'] = $defaultcustomlayout[1]->widths;
$defaultlayoutpreviewdata['text'] = get_string($defaultcustomlayout[1]->widths, 'view');
$defaultlayoutpreview = new LayoutPreviewImage($defaultlayoutpreviewdata);
......
Markdown is supported
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