Commit b913791c authored by Robert Lyon's avatar Robert Lyon
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>
parent 6c2d7992
...@@ -72,8 +72,7 @@ class LayoutPreviewImage { ...@@ -72,8 +72,7 @@ class LayoutPreviewImage {
$class = true; $class = true;
foreach ($this->layout as $key => $row) { foreach ($this->layout as $key => $row) {
$style = 'layout' . (int)$class; $style = 'layout' . (int)$class;
$columns = explode('-', $row); $columns = explode(',', $row);
foreach ($columns as $column) { foreach ($columns as $column) {
$col_width = $this->get_percentage_column_width(count($columns), $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}'/>"; $layout .= "<rect x='{$x}' y='{$y}' width='{$col_width}' height='{$col_height}' class='{$style}'/>";
......
...@@ -1054,8 +1054,8 @@ class View { ...@@ -1054,8 +1054,8 @@ class View {
for ($i=0; $i<$numrows; $i++) { for ($i=0; $i<$numrows; $i++) {
$id = $collayouts['row' . ($i+1)]; $id = $collayouts['row' . ($i+1)];
$widths = get_field('view_layout_columns', 'widths', 'id', $id); $widths = get_field('view_layout_columns', 'widths', 'id', $id);
$customlayout[$i+1] = $widths;
$hyphenatedwidths = str_replace(',', '-', $widths); $hyphenatedwidths = str_replace(',', '-', $widths);
$customlayout[$i+1] = $hyphenatedwidths;
$alttext .= $hyphenatedwidths; $alttext .= $hyphenatedwidths;
if ($i != $numrows - 1) { if ($i != $numrows - 1) {
$alttext .= ' / '; $alttext .= ' / ';
...@@ -1192,7 +1192,7 @@ class View { ...@@ -1192,7 +1192,7 @@ class View {
for ($i=0; $i<$numrows; $i++) { for ($i=0; $i<$numrows; $i++) {
if (array_key_exists(($i+1), $rowscols)) { if (array_key_exists(($i+1), $rowscols)) {
$widths = get_field('view_layout_columns', 'widths', 'id', $rowscols[$i+1]); $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])); $newrec = insert_record('view_layout_rows_columns', (object) array('viewlayout' => $newlayoutid, 'row' => ($i+1), 'columns' => $rowscols[$i+1]));
if (!$newrec) { if (!$newrec) {
db_rollback(); db_rollback();
......
...@@ -72,7 +72,7 @@ foreach ($layoutrows as $key => $layout) { ...@@ -72,7 +72,7 @@ foreach ($layoutrows as $key => $layout) {
$structure = array(); $structure = array();
for ($r = 1; $r <= count($layout); $r++) { 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']); $structure['text'] = implode(' / ', $structure['layout']);
$l = new LayoutPreviewImage($structure); $l = new LayoutPreviewImage($structure);
...@@ -105,7 +105,7 @@ $clnumcolumnsdefault = $defaultlayout->columns; ...@@ -105,7 +105,7 @@ $clnumcolumnsdefault = $defaultlayout->columns;
$clwidths = $defaultlayout->widths; $clwidths = $defaultlayout->widths;
// Ready custom layout preview. // 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'); $defaultlayoutpreviewdata['text'] = get_string($defaultcustomlayout[1]->widths, 'view');
$defaultlayoutpreview = new LayoutPreviewImage($defaultlayoutpreviewdata); $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