[ticket/495] Correctly load template files for modules

B3P-495
This commit is contained in:
Marc Alexander
2015-03-03 14:55:56 +01:00
parent a699a92e31
commit 42973b1a10
3 changed files with 21 additions and 3 deletions

View File

@@ -692,6 +692,7 @@ class portal_module
'ICON_MOVE_LEFT_DISABLED' => '<img src="' . $this->root_path . 'adm/images/icon_left_disabled.gif" alt="' . $this->user->lang['MOVE_LEFT'] . '" title="' . $this->user->lang['MOVE_LEFT'] . '" />',
'ICON_MOVE_RIGHT' => '<img src="' . $this->root_path . 'adm/images/icon_right.gif" alt="' . $this->user->lang['MOVE_RIGHT'] . '" title="' . $this->user->lang['MOVE_RIGHT'] . '" />',
'ICON_MOVE_RIGHT_DISABLED' => '<img src="' . $this->root_path . 'adm/images/icon_right_disabled.gif" alt="' . $this->user->lang['MOVE_RIGHT'] . '" title="' . $this->user->lang['MOVE_RIGHT'] . '" />',
'B3P_U_ACTION' => $this->modules_manager->get_module_link('modules', $module_id),
));
}

View File

@@ -45,7 +45,7 @@
<h1>{L_ACP_PORTAL_MODULES}</h1>
<p>{L_ACP_PORTAL_MODULES_EXP}</p>
<form id="acp_portal_modules" method="post" action="{U_ACTION}" data-ajax="true">
<form id="acp_portal_modules" method="post" action="{B3P_U_ACTION}" data-ajax="true">
<fieldset class="tabulated">
<legend>{L_ACP_PORTAL_MODULES}</legend>

View File

@@ -226,7 +226,7 @@ class helper
if (is_array($template_module))
{
$this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array(
'TEMPLATE_FILE' => 'portal/modules/' . $template_module['template'],
'TEMPLATE_FILE' => $this->parse_template_file($template_module['template']),
'IMAGE_SRC' => $this->path_helper->get_web_root_path() . ltrim($this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $template_module['image_src'], './'),
'TITLE' => $template_module['title'],
'CODE' => $template_module['code'],
@@ -238,7 +238,7 @@ class helper
else
{
$this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array(
'TEMPLATE_FILE' => 'portal/modules/' . $template_module,
'TEMPLATE_FILE' => $this->parse_template_file($template_module),
'IMAGE_SRC' => $this->path_helper->get_web_root_path() . ltrim($this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $row['module_image_src'], './'),
'IMAGE_WIDTH' => $row['module_image_width'],
'IMAGE_HEIGHT' => $row['module_image_height'],
@@ -264,4 +264,21 @@ class helper
// Obtain portal config
obtain_portal_config();
}
/**
* Parse template file by prefixing default modules with the portal path
*
* @param string $template_file HTML template
*
* @return string Parsed template file
*/
protected function parse_template_file($template_file)
{
if (strpos($template_file, '@') === false)
{
$template_file = 'portal/modules/' . $template_file;
}
return $template_file;
}
}