Merge pull request #417 from marc1706/ticket/416
[ticket/416] Allow multiple inclusions of certain portal modules
This commit is contained in:
@@ -13,10 +13,18 @@ class portal_module
|
||||
{
|
||||
public $u_action;
|
||||
public $new_config = array();
|
||||
|
||||
/** @var \board3\portal\modules\module_interface */
|
||||
protected $c_class;
|
||||
|
||||
protected $db, $user, $cache, $template, $display_vars, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
|
||||
protected $root_path, $version_check, $request, $php_ext, $portal_helper, $modules_helper, $log;
|
||||
public $module_column = array();
|
||||
protected $root_path, $version_check, $request, $php_ext, $portal_helper, $modules_helper, $log, $portal_columns;
|
||||
|
||||
/** @var \board3\portal\portal\modules\manager */
|
||||
protected $modules_manager;
|
||||
|
||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||
protected $modules_constraints;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -43,14 +51,12 @@ class portal_module
|
||||
$this->portal_helper = $this->phpbb_container->get('board3.portal.helper');
|
||||
$this->modules_helper = $this->phpbb_container->get('board3.portal.modules_helper');
|
||||
$this->log = $phpbb_log;
|
||||
$this->portal_columns = $this->phpbb_container->get('board3.portal.columns');
|
||||
$this->modules_manager = $this->phpbb_container->get('board3.portal.modules.manager');
|
||||
$this->modules_constraints = $this->phpbb_container->get('board3.portal.modules.constraints_handler');
|
||||
define('PORTAL_MODULES_TABLE', $this->phpbb_container->getParameter('board3.portal.modules.table'));
|
||||
define('PORTAL_CONFIG_TABLE', $this->phpbb_container->getParameter('board3.portal.config.table'));
|
||||
|
||||
if (!function_exists('column_string_const'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions_modules.' . $this->php_ext);
|
||||
}
|
||||
|
||||
if(!function_exists('obtain_portal_config'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
@@ -64,6 +70,10 @@ class portal_module
|
||||
$form_key = 'acp_portal';
|
||||
add_form_key($form_key);
|
||||
|
||||
// Setup modules manager class
|
||||
$this->modules_manager->set_u_action($this->u_action)
|
||||
->set_acp_class(__CLASS__);
|
||||
|
||||
/**
|
||||
* Validation types are:
|
||||
* string, int, bool,
|
||||
@@ -120,7 +130,7 @@ class portal_module
|
||||
'MODULE_IMAGE_HEIGHT' => $module_data['module_image_height'],
|
||||
'MODULE_IMAGE_SRC' => ($module_data['module_image_src']) ? $this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $module_data['module_image_src'] : '',
|
||||
'MODULE_ENABLED' => ($module_data['module_status']) ? true : false,
|
||||
'MODULE_SHOW_IMAGE' => (in_array(column_num_string($module_data['module_column']), array('center', 'top', 'bottom'))) ? false : true,
|
||||
'MODULE_SHOW_IMAGE' => (in_array($this->portal_columns->number_to_string($module_data['module_column']), array('center', 'top', 'bottom'))) ? false : true,
|
||||
));
|
||||
|
||||
if($module_data['module_classname'] != '\board3\portal\modules\custom')
|
||||
@@ -156,7 +166,7 @@ class portal_module
|
||||
$cfg_array = ($this->request->is_set('config')) ? $this->request->variable('config', array('' => ''), true) : $this->new_config;
|
||||
$error = array();
|
||||
|
||||
// We validate the complete config if whished
|
||||
// We validate the complete config if wished
|
||||
validate_config_vars($display_vars['vars'], $cfg_array, $error);
|
||||
if ($submit && !check_form_key($form_key))
|
||||
{
|
||||
@@ -174,7 +184,7 @@ class portal_module
|
||||
|
||||
if($reset_module && !empty($module_data))
|
||||
{
|
||||
$this->reset_module($id, $mode, $module_id, $module_data);
|
||||
$this->modules_manager->reset_module($id, $mode, $module_id, $module_data);
|
||||
}
|
||||
|
||||
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
|
||||
@@ -309,7 +319,7 @@ class portal_module
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'ERROR_MSG' => implode('<br />', $error),
|
||||
|
||||
'B3P_U_ACTION' => $this->get_module_link('config', $module_id),
|
||||
'B3P_U_ACTION' => $this->modules_manager->get_module_link('config', $module_id),
|
||||
'B3P_ACP_ROOT' => $this->root_path,
|
||||
));
|
||||
|
||||
@@ -386,39 +396,41 @@ class portal_module
|
||||
|
||||
// Create an array of already installed modules
|
||||
$portal_modules = obtain_portal_modules();
|
||||
$installed_modules = array();
|
||||
$installed_modules = $module_column = array();
|
||||
|
||||
foreach($portal_modules as $cur_module)
|
||||
{
|
||||
$installed_modules[] = $cur_module['module_classname'];
|
||||
// Create an array with the columns the module is in
|
||||
$this->module_column[$cur_module['module_classname']][] = column_num_string($cur_module['module_column']);
|
||||
$module_column[$cur_module['module_classname']][] = $this->portal_columns->number_to_string($cur_module['module_column']);
|
||||
}
|
||||
$this->modules_constraints->set_module_column($module_column);
|
||||
unset($module_column);
|
||||
|
||||
if ($action == 'move_up')
|
||||
{
|
||||
$this->move_module_up($module_id);
|
||||
$this->modules_manager->move_module_vertical($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_UP);
|
||||
}
|
||||
else if ($action == 'move_down')
|
||||
{
|
||||
$this->move_module_down($module_id);
|
||||
$this->modules_manager->move_module_vertical($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_DOWN);
|
||||
}
|
||||
else if($action == 'move_right')
|
||||
{
|
||||
$this->move_module_right($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_RIGHT);
|
||||
}
|
||||
else if($action == 'move_left')
|
||||
{
|
||||
$this->move_module_left($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_LEFT);
|
||||
}
|
||||
else if ($action == 'delete')
|
||||
{
|
||||
$this->module_delete($id, $mode, $action, $module_id);
|
||||
$this->modules_manager->module_delete($id, $mode, $action, $module_id);
|
||||
}
|
||||
|
||||
$add_list = $this->request->variable('add', array('' => ''));
|
||||
$add_module = key($add_list);
|
||||
$add_column = $this->request->variable('add_column', column_string_num($add_module));
|
||||
$add_column = $this->request->variable('add_column', $this->portal_columns->string_to_number($add_module));
|
||||
if ($add_column)
|
||||
{
|
||||
$submit = ($this->request->is_set_post('submit')) ? true : false;
|
||||
@@ -426,29 +438,24 @@ class portal_module
|
||||
{
|
||||
$module_classname = $this->request->variable('module_classname', '');
|
||||
|
||||
$column_string = column_num_string($add_column);
|
||||
|
||||
// do we want to add the module to the side columns or to the center columns?
|
||||
if (in_array($column_string, array('left', 'right')))
|
||||
{
|
||||
$submit = $this->can_move_module(array('left', 'right'), $module_classname);
|
||||
}
|
||||
else if (in_array($column_string, array('center', 'top', 'bottom')))
|
||||
{
|
||||
$submit = $this->can_move_module(array('center', 'top', 'bottom'), $module_classname);
|
||||
}
|
||||
|
||||
// do not install if module already exists in that column
|
||||
if (!$submit && $module_classname != '\board3\portal\modules\custom')
|
||||
{
|
||||
trigger_error($this->user->lang['MODULE_ADD_ONCE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!($this->c_class = $this->portal_helper->get_module($module_classname)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Do not add modules that shouldn't be added
|
||||
if (!$this->modules_constraints->can_add_module($this->c_class, $add_column))
|
||||
{
|
||||
trigger_error($this->user->lang('UNABLE_TO_ADD_MODULE') . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Do not install if module already exists in the
|
||||
// column and it can't be added more than once
|
||||
if (!$this->c_class->can_multi_include() && !$this->modules_constraints->can_move_module($this->portal_columns->number_to_string($add_column), $module_classname))
|
||||
{
|
||||
trigger_error($this->user->lang['MODULE_ADD_ONCE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$sql = 'SELECT module_order
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_column = ' . $add_column . '
|
||||
@@ -499,40 +506,32 @@ class portal_module
|
||||
trigger_error($error_output . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
meta_refresh(3, $this->get_module_link('config', $module_id));
|
||||
meta_refresh(3, $this->modules_manager->get_module_link('config', $module_id));
|
||||
|
||||
trigger_error($this->user->lang['SUCCESS_ADD'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$this->template->assign_var('S_EDIT', true);
|
||||
$fileinfo = $name_ary = array();
|
||||
$column_string = column_num_string($add_column);
|
||||
$modules_list = $this->portal_helper->get_all_modules();
|
||||
|
||||
// Find new modules
|
||||
foreach ($modules_list as $module_class => $module)
|
||||
{
|
||||
if ($module_class !== '\board3\portal\modules\custom')
|
||||
// Module can't be added to this column
|
||||
if (!$this->modules_constraints->can_add_module($module, $add_column))
|
||||
{
|
||||
if (in_array($column_string, array('left', 'right')))
|
||||
{
|
||||
// does the module already exist in the side columns?
|
||||
if (!$this->can_move_module(array('left', 'right'), $module_class))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (in_array($column_string, array('center', 'top', 'bottom')))
|
||||
{
|
||||
// does the module already exist in the center columns?
|
||||
if (!$this->can_move_module(array('center', 'top', 'bottom'), $module_class))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($module->get_allowed_columns() & column_string_const($add_module))
|
||||
// Do not install if module already exists in the
|
||||
// column and it can't be added more than once
|
||||
if (!$module->can_multi_include() && !$this->modules_constraints->can_move_module($this->portal_columns->number_to_string($add_column), $module_class))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($module->get_allowed_columns() & $this->portal_columns->string_to_constant($add_module))
|
||||
{
|
||||
if ($module->get_language())
|
||||
{
|
||||
@@ -559,7 +558,7 @@ class portal_module
|
||||
}
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'add_column' => column_string_num($add_module),
|
||||
'add_column' => $this->portal_columns->string_to_number($add_module),
|
||||
));
|
||||
$this->template->assign_vars(array(
|
||||
'S_MODULE_NAMES' => $options,
|
||||
@@ -570,19 +569,18 @@ class portal_module
|
||||
{
|
||||
$this->template->assign_vars(array(
|
||||
'S_AJAX_REQUEST' => true,
|
||||
'U_ACTION' => str_replace('&', '&', $this->get_module_link('modules', $module_id)),
|
||||
'U_ACTION' => str_replace('&', '&', $this->modules_manager->get_module_link('modules', $module_id)),
|
||||
));
|
||||
$this->template->set_filenames(array(
|
||||
'body' => 'portal/acp_portal_modules.html')
|
||||
);
|
||||
$json_response = new \phpbb\json_response;
|
||||
$json_response->send(array(
|
||||
$this->modules_manager->handle_ajax_request(array(
|
||||
'MESSAGE_BODY' => $this->template->assign_display('body'),
|
||||
'MESSAGE_TITLE' => $this->user->lang['ADD_MODULE'],
|
||||
'MESSAGE_TEXT' => $this->user->lang['ADD_MODULE'],
|
||||
|
||||
'YES_VALUE' => $this->user->lang['SUBMIT'],
|
||||
'S_CONFIRM_ACTION' => str_replace('&', '&', $this->get_module_link('modules', $module_id)), //inefficient, rewrite whole function
|
||||
'S_CONFIRM_ACTION' => str_replace('&', '&', $this->modules_manager->get_module_link('modules', $module_id)), //inefficient, rewrite whole function
|
||||
'S_HIDDEN_FIELDS' => $s_hidden_fields
|
||||
));
|
||||
}
|
||||
@@ -602,10 +600,10 @@ class portal_module
|
||||
{
|
||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->c_class->get_language());
|
||||
}
|
||||
$template_column = column_num_string($row['module_column']);
|
||||
$template_column = $this->portal_columns->number_to_string($row['module_column']);
|
||||
|
||||
// find out of we can move modules to the left or right
|
||||
if(($this->c_class->get_allowed_columns() & column_string_const(column_num_string($row['module_column'] + 1))) || ($this->c_class->get_allowed_columns() & column_string_const(column_num_string($row['module_column'] + 2)) && $row['module_column'] != 2))
|
||||
if(($this->c_class->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($row['module_column'] + 1))) || ($this->c_class->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($row['module_column'] + 2)) && $row['module_column'] != 2))
|
||||
{
|
||||
/**
|
||||
* check if we can actually move
|
||||
@@ -614,9 +612,9 @@ class portal_module
|
||||
*/
|
||||
if ($row['module_classname'] != '\board3\portal\modules\custom')
|
||||
{
|
||||
$column_string = column_num_string($row['module_column'] + 1); // move 1 right
|
||||
$column_string = $this->portal_columns->number_to_string($row['module_column'] + 1); // move 1 right
|
||||
|
||||
if ($column_string == 'right' && !$this->can_move_module(array('left', 'right'), $row['module_classname']))
|
||||
if ($column_string == 'right' && !$this->modules_constraints->can_move_module(array('left', 'right'), $row['module_classname']))
|
||||
{
|
||||
$move_right = false;
|
||||
}
|
||||
@@ -635,7 +633,7 @@ class portal_module
|
||||
$move_right = false;
|
||||
}
|
||||
|
||||
if(($this->c_class->get_allowed_columns() & column_string_const(column_num_string($row['module_column'] - 1))) || ($this->c_class->get_allowed_columns() & column_string_const(column_num_string($row['module_column'] - 2)) && $row['module_column'] != 2))
|
||||
if(($this->c_class->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($row['module_column'] - 1))) || ($this->c_class->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($row['module_column'] - 2)) && $row['module_column'] != 2))
|
||||
{
|
||||
/**
|
||||
* check if we can actually move
|
||||
@@ -644,9 +642,9 @@ class portal_module
|
||||
*/
|
||||
if ($row['module_classname'] != '\board3\portal\modules\custom')
|
||||
{
|
||||
$column_string = column_num_string($row['module_column'] - 1); // move 1 left
|
||||
$column_string = $this->portal_columns->number_to_string($row['module_column'] - 1); // move 1 left
|
||||
|
||||
if ($column_string == 'left' && !$this->can_move_module(array('left', 'right'), $row['module_classname']))
|
||||
if ($column_string == 'left' && !$this->modules_constraints->can_move_module(array('left', 'right'), $row['module_classname']))
|
||||
{
|
||||
$move_left = false;
|
||||
}
|
||||
@@ -670,8 +668,8 @@ class portal_module
|
||||
'MODULE_IMAGE' => ($row['module_image_src']) ? '<img src="' . $this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $row['module_image_src'] . '" alt="' . $row['module_name'] . '" />' : '',
|
||||
'MODULE_ENABLED' => ($row['module_status']) ? true : false,
|
||||
|
||||
'U_DELETE' => $this->get_module_link('modules', $row['module_id']) . '&action=delete&module_classname=' . $row['module_classname'],
|
||||
'U_EDIT' => $this->get_module_link('config', $row['module_id']),
|
||||
'U_DELETE' => $this->modules_manager->get_module_link('modules', $row['module_id']) . '&action=delete&module_classname=' . $row['module_classname'],
|
||||
'U_EDIT' => $this->modules_manager->get_module_link('config', $row['module_id']),
|
||||
'U_MOVE_UP' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_up',
|
||||
'U_MOVE_DOWN' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_down',
|
||||
'U_MOVE_RIGHT' => ($move_right) ? $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_right' : '',
|
||||
@@ -696,523 +694,4 @@ class portal_module
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset module settings to default options
|
||||
*
|
||||
* @param int $id ID of the acp_portal module
|
||||
* @param string|int $mode Mode of the acp_portal module
|
||||
* @param int $module_id ID of the module that should be reset
|
||||
* @param array $module_data Array containing the module's database row
|
||||
*/
|
||||
protected function reset_module($id, $mode, $module_id, $module_data)
|
||||
{
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$sql = 'SELECT module_order, module_column, module_classname
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$module_data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!($this->c_class = $this->portal_helper->get_module($module_data['module_classname'])))
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
|
||||
$sql_ary = array(
|
||||
'module_name' => $this->c_class->get_name(),
|
||||
'module_image_src' => $this->c_class->get_image(),
|
||||
'module_group_ids' => '',
|
||||
'module_image_height' => 16,
|
||||
'module_image_width' => 16,
|
||||
'module_status' => B3_MODULE_ENABLED,
|
||||
);
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
$affected_rows = $this->db->sql_affectedrows();
|
||||
|
||||
if (empty($affected_rows))
|
||||
{
|
||||
// We need to return to the module config
|
||||
meta_refresh(3, $this->get_module_link('config', $module_id));
|
||||
trigger_error($this->user->lang['MODULE_NOT_EXISTS'] . adm_back_link($this->u_action . "&module_id=$module_id"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$this->cache->destroy('config');
|
||||
$this->cache->destroy('portal_config');
|
||||
obtain_portal_config(); // we need to prevent duplicate entry errors
|
||||
$this->c_class->install($module_id);
|
||||
$this->cache->purge();
|
||||
|
||||
// We need to return to the module config
|
||||
meta_refresh(3, $this->get_module_link('config', $module_id));
|
||||
|
||||
trigger_error($this->user->lang['MODULE_RESET_SUCCESS'] . adm_back_link($this->u_action . "&module_id=$module_id"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$confirm_text = (isset($this->user->lang[$module_data['module_name']])) ? sprintf($this->user->lang['MODULE_RESET_CONFIRM'], $this->user->lang[$module_data['module_name']]) : sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], utf8_normalize_nfc($module_data['module_name']));
|
||||
confirm_box(false, $confirm_text, build_hidden_fields(array(
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'module_reset' => true,
|
||||
'module_id' => $module_id,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module_data required for moving it
|
||||
*
|
||||
* @param int $module_id ID of the module that should be moved
|
||||
* @return array|null Module_data or empty if not successful
|
||||
*/
|
||||
public function get_move_module_data($module_id)
|
||||
{
|
||||
$sql = 'SELECT module_order, module_column, module_classname
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$module_data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $module_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle output after moving module
|
||||
*
|
||||
* @param bool $success Whether moving module was successful
|
||||
* @param bool $is_row Whether the module move was inside a row
|
||||
* @return void
|
||||
*/
|
||||
public function handle_after_move($success = true, $is_row = false)
|
||||
{
|
||||
if (!$success)
|
||||
{
|
||||
trigger_error($this->user->lang['UNABLE_TO_MOVE' . (($is_row) ? '_ROW' : '')] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$this->cache->destroy('portal_modules');
|
||||
|
||||
if ($this->request->is_ajax())
|
||||
{
|
||||
$json_response = new \phpbb\json_response;
|
||||
$json_response->send(array('success' => true));
|
||||
}
|
||||
redirect($this->u_action); // redirect in order to get rid of excessive URL parameters
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the module order to the last module in the column
|
||||
*
|
||||
* @param int $module_column Module column to check
|
||||
* @return int Module order of the last module in the column
|
||||
*/
|
||||
public function get_last_module_order($module_column)
|
||||
{
|
||||
$modules = obtain_portal_modules();
|
||||
$last_order = 1;
|
||||
foreach ($modules as $cur_module)
|
||||
{
|
||||
if ($cur_module['module_column'] != $module_column)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$last_order = max($last_order, $cur_module['module_order']);
|
||||
}
|
||||
|
||||
return $last_order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module up one row
|
||||
*
|
||||
* @param int $module_id ID of the module that should be moved
|
||||
*/
|
||||
public function move_module_up($module_id)
|
||||
{
|
||||
$updated = false;
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
if (($module_data !== false) && ($module_data['module_order'] > 1))
|
||||
{
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order + 1
|
||||
WHERE module_order = ' . (int) ($module_data['module_order'] - 1) . '
|
||||
AND module_column = ' . (int) $module_data['module_column'];
|
||||
|
||||
$this->db->sql_query($sql);
|
||||
$updated = $this->db->sql_affectedrows();
|
||||
if ($updated)
|
||||
{
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order - 1
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$this->handle_after_move($updated, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module down one row
|
||||
*
|
||||
* @param int $module_id ID of the module that should be moved
|
||||
*/
|
||||
public function move_module_down($module_id)
|
||||
{
|
||||
$updated = false;
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
if ($module_data !== false && $this->get_last_module_order($module_data['module_column']) != $module_data['module_order'])
|
||||
{
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order - 1
|
||||
WHERE module_order = ' . (int) ($module_data['module_order'] + 1) . '
|
||||
AND module_column = ' . (int) $module_data['module_column'];
|
||||
$this->db->sql_query($sql);
|
||||
$updated = $this->db->sql_affectedrows();
|
||||
if ($updated)
|
||||
{
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order + 1
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$this->handle_after_move($updated, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module left one column
|
||||
*
|
||||
* @param int $module_id ID of the module that should be moved
|
||||
*/
|
||||
public function move_module_left($module_id)
|
||||
{
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
if (!($this->c_class = $this->portal_helper->get_module($module_data['module_classname'])))
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
|
||||
$move_action = 0;
|
||||
|
||||
if ($module_data !== false && $module_data['module_column'] > column_string_num('left'))
|
||||
{
|
||||
if($this->c_class->columns & column_string_const(column_num_string($module_data['module_column'] - 1)))
|
||||
{
|
||||
$move_action = 1; // we move 1 column to the left
|
||||
}
|
||||
else if($this->c_class->columns & column_string_const(column_num_string($module_data['module_column'] - 2)) && $module_data['module_column'] != 2)
|
||||
{
|
||||
$move_action = 2; // we move 2 columns to the left
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->handle_after_move(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* moving only 1 column to the left means we will either end up in the left column
|
||||
* or in the center column. this is not possible when moving 2 columns to the left.
|
||||
* therefore we only need to check if we won't end up with a duplicate module in the
|
||||
* new column (side columns (left & right) or center columns (top, center, bottom)).
|
||||
* of course this does not apply to custom modules.
|
||||
*/
|
||||
if ($module_data['module_classname'] != '\board3\portal\modules\custom' && $move_action == 1)
|
||||
{
|
||||
$column_string = column_num_string($module_data['module_column'] - $move_action);
|
||||
// we can only move left to the left & center column
|
||||
if ($column_string == 'left' && !$this->can_move_module(array('right', 'left'), $module_data['module_classname']))
|
||||
{
|
||||
trigger_error($this->user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else if ($column_string == 'center' && !$this->can_move_module(array('top', 'center', 'bottom'), $module_data['module_classname']))
|
||||
{
|
||||
// we are moving from the right to the center column so we should move to the left column instead
|
||||
$move_action = 2;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order + 1
|
||||
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||
AND module_column = ' . ($module_data['module_column'] - $move_action);
|
||||
$this->db->sql_query($sql);
|
||||
$updated = $this->db->sql_affectedrows();
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_column = module_column - ' . $move_action . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order - 1
|
||||
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||
AND module_column = ' . $module_data['module_column'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
// the module that needs to moved is in the last row
|
||||
if(!$updated)
|
||||
{
|
||||
$sql = 'SELECT MAX(module_order) as new_order
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_order < ' . $module_data['module_order'] . '
|
||||
AND module_column = ' . (int) ($module_data['module_column'] - $move_action);
|
||||
$this->db->sql_query($sql);
|
||||
$new_order = $this->db->sql_fetchfield('new_order') + 1;
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = ' . $new_order . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->handle_after_move(false);
|
||||
}
|
||||
|
||||
$this->handle_after_move(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module right one column
|
||||
*
|
||||
* @param int $module_id ID of the module that should be moved
|
||||
*/
|
||||
public function move_module_right($module_id)
|
||||
{
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
if (!($this->c_class = $this->portal_helper->get_module($module_data['module_classname'])))
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
|
||||
$move_action = 0;
|
||||
|
||||
if ($module_data !== false && $module_data['module_column'] < column_string_num('right'))
|
||||
{
|
||||
if($this->c_class->columns & column_string_const(column_num_string($module_data['module_column'] + 1)))
|
||||
{
|
||||
$move_action = 1; // we move 1 column to the right
|
||||
}
|
||||
else if($this->c_class->columns & column_string_const(column_num_string($module_data['module_column'] + 2)) && $module_data['module_column'] != 2)
|
||||
{
|
||||
$move_action = 2; // we move 2 columns to the right
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->handle_after_move(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* moving only 1 column to the right means we will either end up in the right column
|
||||
* or in the center column. this is not possible when moving 2 columns to the right.
|
||||
* therefore we only need to check if we won't end up with a duplicate module in the
|
||||
* new column (side columns (left & right) or center columns (top, center, bottom)).
|
||||
* of course this does not apply to custom modules.
|
||||
*/
|
||||
if ($module_data['module_classname'] != '\board3\portal\modules\custom' && $move_action == 1)
|
||||
{
|
||||
$column_string = column_num_string($module_data['module_column'] + $move_action);
|
||||
// we can only move right to the right & center column
|
||||
if ($column_string == 'right' && !$this->can_move_module(array('right', 'left'), $module_data['module_classname']))
|
||||
{
|
||||
trigger_error($this->user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else if ($column_string == 'center' && !$this->can_move_module(array('top', 'center', 'bottom'), $module_data['module_classname']))
|
||||
{
|
||||
// we are moving from the left to the center column so we should move to the right column instead
|
||||
$move_action = 2;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order + 1
|
||||
WHERE module_order >= ' . (int) $module_data['module_order'] . '
|
||||
AND module_column = ' . (int) ($module_data['module_column'] + $move_action);
|
||||
$this->db->sql_query($sql);
|
||||
$updated = $this->db->sql_affectedrows();
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_column = module_column + ' . $move_action . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order - 1
|
||||
WHERE module_order >= ' . (int) $module_data['module_order'] . '
|
||||
AND module_column = ' . (int) $module_data['module_column'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
// the module that needs to moved is in the last row
|
||||
if(!$updated)
|
||||
{
|
||||
$sql = 'SELECT MAX(module_order) as new_order
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_order < ' . (int) $module_data['module_order'] . '
|
||||
AND module_column = ' . (int) ($module_data['module_column'] + $move_action);
|
||||
$this->db->sql_query($sql);
|
||||
$new_order = $this->db->sql_fetchfield('new_order') + 1;
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = ' . (int) $new_order . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->handle_after_move(false);
|
||||
}
|
||||
|
||||
$this->handle_after_move(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete module
|
||||
*
|
||||
* @param int|string $id Module ID of the acp_portal module
|
||||
* @param string $mode Mode of the acp_portal module
|
||||
* @param string $action Current action of the acp_portal module
|
||||
* @param int $module_id ID of the module that should be deleted
|
||||
*/
|
||||
protected function module_delete($id, $mode, $action, $module_id)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$module_data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if ($module_data !== false)
|
||||
{
|
||||
$module_classname = $this->request->variable('module_classname', '');
|
||||
|
||||
if (!($this->c_class = $this->portal_helper->get_module($module_classname)))
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$this->c_class->uninstall($module_data['module_id'], $this->db);
|
||||
|
||||
$sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order - 1
|
||||
WHERE module_column = ' . $module_data['module_column'] . '
|
||||
AND module_order > ' . $module_data['module_order'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$this->cache->purge(); // make sure we don't get errors after re-adding a module
|
||||
|
||||
if ($this->request->is_ajax())
|
||||
{
|
||||
$json_response = new \phpbb\json_response;
|
||||
$json_response->send(array(
|
||||
'success' => true,
|
||||
'MESSAGE_TITLE' => $this->user->lang['INFORMATION'],
|
||||
'MESSAGE_TEXT' => $this->user->lang['SUCCESS_DELETE'],
|
||||
));
|
||||
}
|
||||
trigger_error($this->user->lang['SUCCESS_DELETE'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->c_class->get_language())
|
||||
{
|
||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->c_class->get_language());
|
||||
}
|
||||
$confirm_text = (isset($this->user->lang[$module_data['module_name']])) ? sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], $this->user->lang[$module_data['module_name']]) : sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], utf8_normalize_nfc($module_data['module_name']));
|
||||
confirm_box(false, $confirm_text, build_hidden_fields(array(
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action,
|
||||
'module_id' => $module_id,
|
||||
'module_classname' => $module_classname,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->cache->destroy('portal_modules');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to module settings with specified ID and portal_module mode
|
||||
*
|
||||
* @param string $mode portal_module mode
|
||||
* @param int $module_id Module ID
|
||||
*
|
||||
* @return string Link to module settings
|
||||
*/
|
||||
protected function get_module_link($mode, $module_id)
|
||||
{
|
||||
return preg_replace(array('/i=[0-9]+/', '/mode=[a-zA-Z0-9_]+/'), array('i=%5C' . str_replace('\\', '%5C', __CLASS__), 'mode=' . $mode), $this->u_action) . (($module_id) ? '&module_id=' . $module_id : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module can be moved to desired column(s)
|
||||
*
|
||||
* @param array|int $target_column Column(s) the module should be
|
||||
* moved to
|
||||
* @param string $module_class Class of the module
|
||||
* @return bool True if module can be moved to desired column,
|
||||
* false if not
|
||||
*/
|
||||
public function can_move_module($target_column, $module_class)
|
||||
{
|
||||
$submit = true;
|
||||
|
||||
if (is_array($target_column))
|
||||
{
|
||||
foreach ($target_column as $column)
|
||||
{
|
||||
if (!$this->can_move_module($column, $module_class))
|
||||
{
|
||||
$submit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// do we want to add the module to the side columns or to the center columns?
|
||||
if (in_array($target_column, array('left', 'right')))
|
||||
{
|
||||
// does the module already exist in the side columns?
|
||||
if (isset($this->module_column[$module_class]) &&
|
||||
(in_array('left', $this->module_column[$module_class]) || in_array('right', $this->module_column[$module_class])))
|
||||
{
|
||||
$submit = false;
|
||||
}
|
||||
}
|
||||
else if (in_array($target_column, array('center', 'top', 'bottom')))
|
||||
{
|
||||
// does the module already exist in the center columns?
|
||||
if (isset($this->module_column[$module_class]) &&
|
||||
(in_array('center', $this->module_column[$module_class]) ||
|
||||
in_array('top', $this->module_column[$module_class]) ||
|
||||
in_array('bottom', $this->module_column[$module_class])))
|
||||
{
|
||||
$submit = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $submit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ services:
|
||||
board3.portal.main:
|
||||
class: board3\portal\controller\main
|
||||
arguments:
|
||||
- @board3.portal.columns
|
||||
- @config
|
||||
- @board3.portal.controller_helper
|
||||
- @template
|
||||
@@ -31,6 +32,7 @@ services:
|
||||
class: board3\portal\controller\helper
|
||||
arguments:
|
||||
- @auth
|
||||
- @board3.portal.columns
|
||||
- @config
|
||||
- @template
|
||||
- @user
|
||||
@@ -68,6 +70,9 @@ services:
|
||||
- @config
|
||||
- @request
|
||||
|
||||
board3.portal.columns:
|
||||
class: board3\portal\portal\columns
|
||||
|
||||
board3.portal.fetch_posts:
|
||||
class: board3\portal\portal\fetch_posts
|
||||
arguments:
|
||||
@@ -90,3 +95,26 @@ services:
|
||||
- %core.php_ext%
|
||||
tags:
|
||||
- { name: event.listener }
|
||||
|
||||
board3.portal.modules.manager:
|
||||
class: board3\portal\portal\modules\manager
|
||||
arguments:
|
||||
- @cache
|
||||
- @dbal.conn
|
||||
- @board3.portal.columns
|
||||
- @board3.portal.helper
|
||||
- @board3.portal.modules.constraints_handler
|
||||
- @board3.portal.modules.database_handler
|
||||
- @request
|
||||
- @user
|
||||
|
||||
board3.portal.modules.database_handler:
|
||||
class: board3\portal\portal\modules\database_handler
|
||||
arguments:
|
||||
- @dbal.conn
|
||||
|
||||
board3.portal.modules.constraints_handler:
|
||||
class: board3\portal\portal\modules\constraints_handler
|
||||
arguments:
|
||||
- @board3.portal.columns
|
||||
- @user
|
||||
|
||||
@@ -11,6 +11,9 @@ namespace board3\portal\controller;
|
||||
|
||||
class helper
|
||||
{
|
||||
/** @var \board3\portal\portal\columns */
|
||||
protected $portal_columns;
|
||||
|
||||
/**
|
||||
* Auth object
|
||||
* @var \phpbb\auth\auth
|
||||
@@ -76,6 +79,7 @@ class helper
|
||||
* NOTE: The parameters of this method must match in order and type with
|
||||
* the dependencies defined in the services.yml file for this service.
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \board3\portal\portal\columns $portal_columns Board3 Portal columns object
|
||||
* @param \phpbb\config\config $config phpBB Config object
|
||||
* @param \phpbb\template $template Template object
|
||||
* @param \phpbb\user $user User object
|
||||
@@ -84,9 +88,10 @@ class helper
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $php_ext PHP file extension
|
||||
*/
|
||||
public function __construct($auth, $config, $template, $user, $path_helper, $portal_helper, $phpbb_root_path, $php_ext)
|
||||
public function __construct($auth, $portal_columns, $config, $template, $user, $path_helper, $portal_helper, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->portal_columns = $portal_columns;
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
@@ -161,13 +166,15 @@ class helper
|
||||
*/
|
||||
protected function check_column_disabled($row)
|
||||
{
|
||||
return ($this->config['board3_left_column'] === false && column_num_string($row['module_column']) === 'left') || ($this->config['board3_right_column'] === false && column_num_string($row['module_column']) === 'right');
|
||||
return ($this->config['board3_left_column'] === false && $this->portal_columns->number_to_string($row['module_column']) === 'left') || ($this->config['board3_right_column'] === false && $this->portal_columns->number_to_string($row['module_column']) === 'right');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is in required groups
|
||||
*
|
||||
* @param array $row Module row
|
||||
*
|
||||
* @return bool True if group has access, false if not
|
||||
*/
|
||||
protected function check_group_access($row)
|
||||
{
|
||||
@@ -215,7 +222,7 @@ class helper
|
||||
{
|
||||
if (is_array($template_module))
|
||||
{
|
||||
$this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array(
|
||||
$this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array(
|
||||
'TEMPLATE_FILE' => 'portal/modules/' . $template_module['template'],
|
||||
'IMAGE_SRC' => $this->path_helper->get_web_root_path() . $this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $template_module['image_src'],
|
||||
'TITLE' => $template_module['title'],
|
||||
@@ -227,7 +234,7 @@ class helper
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array(
|
||||
$this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array(
|
||||
'TEMPLATE_FILE' => 'portal/modules/' . $template_module,
|
||||
'IMAGE_SRC' => $this->path_helper->get_web_root_path() . $this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $row['module_image_src'],
|
||||
'IMAGE_WIDTH' => $row['module_image_width'],
|
||||
|
||||
@@ -11,6 +11,9 @@ namespace board3\portal\controller;
|
||||
|
||||
class main
|
||||
{
|
||||
/** @var \board3\portal\portal\columns */
|
||||
protected $portal_columns;
|
||||
|
||||
/**
|
||||
* phpBB Config object
|
||||
* @var \phpbb\config\config
|
||||
@@ -81,6 +84,7 @@ class main
|
||||
* Constructor
|
||||
* NOTE: The parameters of this method must match in order and type with
|
||||
* the dependencies defined in the services.yml file for this service.
|
||||
* @param \board3\portal\portal\columns $portal_columns Board3 Portal columns object
|
||||
* @param \phpbb\config\config $config phpBB Config object
|
||||
* @param \board3\portal\controller\helper $controller_helper Controller helper
|
||||
* @param \phpbb\template $template Template object
|
||||
@@ -91,10 +95,11 @@ class main
|
||||
* @param string $config_table Board3 config table
|
||||
* @param string $modules_table Board3 modules table
|
||||
*/
|
||||
public function __construct($config, $controller_helper, $template, $user, $path_helper, $phpbb_root_path, $php_ext, $config_table, $modules_table)
|
||||
public function __construct($portal_columns, $config, $controller_helper, $template, $user, $path_helper, $phpbb_root_path, $php_ext, $config_table, $modules_table)
|
||||
{
|
||||
global $portal_root_path;
|
||||
|
||||
$this->portal_columns = $portal_columns;
|
||||
$this->config = $config;
|
||||
$this->controller_helper = $controller_helper;
|
||||
$this->template = $template;
|
||||
@@ -203,7 +208,7 @@ class main
|
||||
public function get_module_template($row, $module)
|
||||
{
|
||||
$template_module = false;
|
||||
$column = column_num_string($row['module_column']);
|
||||
$column = $this->portal_columns->number_to_string($row['module_column']);
|
||||
|
||||
if (in_array($column, array('left', 'right')) && $this->config['board3_' . $column . '_column'])
|
||||
{
|
||||
|
||||
@@ -155,26 +155,26 @@ function ap_validate($str)
|
||||
/**
|
||||
* Pagination routine, generates archive number sequence
|
||||
*/
|
||||
function generate_portal_pagination($base_url, $num_items, $per_page, $start_item, $type, $add_prevnext_text = false, $tpl_prefix = '')
|
||||
function generate_portal_pagination($base_url, $num_items, $per_page, $start_item, $type, $module_id = 0, $add_prevnext_text = false, $tpl_prefix = '')
|
||||
{
|
||||
global $template, $user;
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case "announcements":
|
||||
$pagination_type = 'ap';
|
||||
$anker = '#a';
|
||||
$pagination_type = 'ap_' . $module_id;
|
||||
$anker = '#a_' . $module_id;
|
||||
break;
|
||||
case "news":
|
||||
case "news_all":
|
||||
$pagination_type = 'np';
|
||||
$anker = '#n';
|
||||
$pagination_type = 'np_' . $module_id;
|
||||
$anker = '#n_' . $module_id;
|
||||
break;
|
||||
|
||||
default:
|
||||
// this shouldn't happen but default to announcements
|
||||
$pagination_type = 'ap';
|
||||
$anker = '#a';
|
||||
$pagination_type = 'ap_' . $module_id;
|
||||
$anker = '#a_' . $module_id;
|
||||
}
|
||||
|
||||
// Make sure $per_page is a valid value
|
||||
|
||||
@@ -7,59 +7,44 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert column number to string equivalent
|
||||
*
|
||||
* @param int $column Column number
|
||||
*
|
||||
* @return string String representation of column number; default: ''
|
||||
* @deprecated 2.1.0-RC1 (to be removed: 2.1.0)
|
||||
*/
|
||||
function column_num_string($column)
|
||||
{
|
||||
switch ($column)
|
||||
{
|
||||
case 1:
|
||||
return 'left';
|
||||
case 2:
|
||||
return 'center';
|
||||
case 3:
|
||||
return 'right';
|
||||
case 4:
|
||||
return 'top';
|
||||
case 5:
|
||||
return 'bottom';
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
$portal_columns = new \board3\portal\portal\columns();
|
||||
return $portal_columns->number_to_string($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert column string to equivalent number
|
||||
*
|
||||
* @param string $column Column name
|
||||
*
|
||||
* @return int The column number; default: 0
|
||||
* @deprecated 2.1.0-RC1 (to be removed: 2.1.0)
|
||||
*/
|
||||
function column_string_num($column)
|
||||
{
|
||||
switch ($column)
|
||||
{
|
||||
case 'left':
|
||||
return 1;
|
||||
case 'center':
|
||||
return 2;
|
||||
case 'right':
|
||||
return 3;
|
||||
case 'top':
|
||||
return 4;
|
||||
case 'bottom':
|
||||
return 5;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
$portal_columns = new \board3\portal\portal\columns();
|
||||
return $portal_columns->string_to_number($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert column string to equivalent constant
|
||||
*
|
||||
* @param string $column Column name
|
||||
*
|
||||
* @return int Column constant; default: 0
|
||||
* @deprecated 2.1.0-RC1 (to be removed: 2.1.0)
|
||||
*/
|
||||
function column_string_const($column)
|
||||
{
|
||||
switch ($column)
|
||||
{
|
||||
case 'top':
|
||||
return 1;
|
||||
case 'left':
|
||||
return 2;
|
||||
case 'center':
|
||||
return 4;
|
||||
case 'right':
|
||||
return 8;
|
||||
case 'bottom':
|
||||
return 16;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
$portal_columns = new \board3\portal\portal\columns();
|
||||
return $portal_columns->string_to_constant($column);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ $lang = array_merge($lang, array(
|
||||
'NO_ADMINISTRATORS_P' => 'No Administrators',
|
||||
'NO_MODERATORS_P' => 'No Moderators',
|
||||
'NO_GROUPS_P' => 'No Groups',
|
||||
'ACP_PORTAL_LEADERS' => 'The Team',
|
||||
|
||||
// ACP
|
||||
'ACP_PORTAL_LEADERS' => 'Team Settings',
|
||||
|
||||
@@ -52,6 +52,7 @@ $lang = array_merge($lang, array(
|
||||
'B3P_FILE_NOT_FOUND' => 'The requested file could not be found',
|
||||
'UNABLE_TO_MOVE' => 'It is not possible to move the block to the selected column.',
|
||||
'UNABLE_TO_MOVE_ROW' => 'It is not possible to move the block to the selected row.',
|
||||
'UNABLE_TO_ADD_MODULE' => 'It is not possible to add the module to the selected column.',
|
||||
'DELETE_MODULE_CONFIRM' => 'Are you sure you wish to delete the module "%1$s"?',
|
||||
'MODULE_RESET_SUCCESS' => 'Successfully reset the module settings.',
|
||||
'MODULE_RESET_CONFIRM' => 'Are you sure you wish to reset the settings of the module "%1$s"?',
|
||||
|
||||
@@ -41,19 +41,22 @@ class announcements extends module_base
|
||||
*/
|
||||
public $language = 'portal_announcements_module';
|
||||
|
||||
/** @var bool Can include this module multiple times */
|
||||
protected $multiple_includes = true;
|
||||
|
||||
/** @var \phpbb\auth\auth */
|
||||
protected $auth;
|
||||
|
||||
/** @var \phpbb\cache\driver */
|
||||
/** @var \phpbb\cache\service */
|
||||
protected $cache;
|
||||
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\pagination */
|
||||
@@ -81,10 +84,10 @@ class announcements extends module_base
|
||||
* Construct an announcements object
|
||||
*
|
||||
* @param \phpbb\auth\auth $auth phpBB auth service
|
||||
* @param \phpbb\cache\driver $cache phpBB cache driver
|
||||
* @param \phpbb\cache\service $cache phpBB cache driver
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\template\template $template phpBB template
|
||||
* @param \phpbb\db\driver\driver_interface $db Database driver
|
||||
* @param \phpbb\pagination $pagination phpBB pagination
|
||||
* @param \board3\portal\includes\modules_helper $modules_helper Portal modules helper
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
@@ -114,10 +117,11 @@ class announcements extends module_base
|
||||
*/
|
||||
public function get_template_center($module_id)
|
||||
{
|
||||
$announcement = $this->request->variable('announcement', -1);
|
||||
$announcement = $this->request->variable('announcement_' . $module_id, -1);
|
||||
$announcement = ($announcement > $this->config['board3_announcements_length_' . $module_id] -1) ? -1 : $announcement;
|
||||
$start = $this->request->variable('ap', 0);
|
||||
$start = $this->request->variable('ap_' . $module_id, 0);
|
||||
$start = ($start < 0) ? 0 : $start;
|
||||
$total_announcements = 1;
|
||||
|
||||
// Fetch announcements from portal functions.php with check if "read full" is requested.
|
||||
$portal_announcement_length = ($announcement < 0) ? $this->config['board3_announcements_length_' . $module_id] : 0;
|
||||
@@ -133,10 +137,28 @@ class announcements extends module_base
|
||||
(bool) $this->config['board3_announcements_forum_exclude_' . $module_id]
|
||||
);
|
||||
|
||||
$topic_icons = false;
|
||||
if(!empty($fetch_news['topic_icons']))
|
||||
{
|
||||
$topic_icons = true;
|
||||
}
|
||||
|
||||
// Standard announcements row
|
||||
$announcements_row = array(
|
||||
'NEWEST_POST_IMG' => $this->user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
|
||||
'READ_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
|
||||
'GOTO_PAGE_IMG' => $this->user->img('icon_post_target', 'GOTO_PAGE'),
|
||||
'S_DISPLAY_ANNOUNCEMENTS_RVS' => ($this->config['board3_show_announcements_replies_views_' . $module_id]) ? true : false,
|
||||
'S_TOPIC_ICONS' => $topic_icons,
|
||||
'MODULE_ID' => $module_id,
|
||||
);
|
||||
|
||||
// Any announcements present? If not terminate it here.
|
||||
if (sizeof($fetch_news) == 0)
|
||||
{
|
||||
$this->template->assign_block_vars('announcements_center_row', array(
|
||||
$this->template->assign_block_vars('announcements', $announcements_row);
|
||||
|
||||
$this->template->assign_block_vars('announcements.center_row', array(
|
||||
'S_NO_TOPICS' => true,
|
||||
'S_NOT_LAST' => false
|
||||
));
|
||||
@@ -210,6 +232,20 @@ class announcements extends module_base
|
||||
|
||||
$topic_tracking_info = (get_portal_tracking_info($fetch_news));
|
||||
|
||||
if ($this->config['board3_number_of_announcements_' . $module_id] != 0 && $this->config['board3_announcements_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start, 'announcements', $module_id);
|
||||
|
||||
$announcements_row = array_merge($announcements_row, array(
|
||||
'AP_PAGINATION' => (isset($pagination)) ? $pagination : '',
|
||||
'TOTAL_ANNOUNCEMENTS' => ($total_announcements == 1) ? $this->user->lang['VIEW_LATEST_ANNOUNCEMENT'] : sprintf($this->user->lang['VIEW_LATEST_ANNOUNCEMENTS'], $total_announcements),
|
||||
'AP_PAGE_NUMBER' => $this->pagination->on_page($total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start),
|
||||
));
|
||||
}
|
||||
|
||||
// Assign announcements row
|
||||
$this->template->assign_block_vars('announcements', $announcements_row);
|
||||
|
||||
if($announcement < 0)
|
||||
// Show the announcements overview
|
||||
{
|
||||
@@ -234,14 +270,9 @@ class announcements extends module_base
|
||||
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
$real_forum_id = ($forum_id == 0) ? $fetch_news['global_id']: $forum_id;
|
||||
$read_full_url = ($this->request->is_set('ap')) ? 'ap='. $start . '&announcement=' . $i . '#a' . $i : 'announcement=' . $i . '#a' . $i;
|
||||
$read_full_url = ($this->request->is_set('ap_' . $module_id)) ? "ap_{$module_id}=$start&announcement_{$module_id}=$i#a_{$module_id}_$i" : "announcement_{$module_id}=$i#a_{$module_id}_$i";
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
|
||||
if ($this->config['board3_announcements_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start, 'announcements');
|
||||
}
|
||||
|
||||
$replies = ($this->auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
|
||||
|
||||
switch ($fetch_news[$i]['topic_type'])
|
||||
@@ -282,7 +313,7 @@ class announcements extends module_base
|
||||
// Grab icons
|
||||
$icons = $this->cache->obtain_icons();
|
||||
|
||||
$this->template->assign_block_vars('announcements_center_row', array(
|
||||
$this->template->assign_block_vars('announcements.center_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
@@ -319,25 +350,17 @@ class announcements extends module_base
|
||||
'S_HAS_ATTACHMENTS' => (!empty($fetch_news[$i]['attachments'])) ? true : false,
|
||||
));
|
||||
|
||||
$this->pagination->generate_template_pagination($view_topic_url, 'announcements_center_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
|
||||
$this->pagination->generate_template_pagination($view_topic_url, 'announcements.center_row.pagination', 'ap_' . $module_id, $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
|
||||
|
||||
if(!empty($fetch_news[$i]['attachments']))
|
||||
{
|
||||
foreach ($fetch_news[$i]['attachments'] as $attachment)
|
||||
{
|
||||
$this->template->assign_block_vars('announcements_center_row.attachment', array(
|
||||
$this->template->assign_block_vars('announcements.center_row.attachment', array(
|
||||
'DISPLAY_ATTACHMENT' => $attachment)
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($this->config['board3_number_of_announcements_' . $module_id] != 0 && $this->config['board3_announcements_archive_' . $module_id])
|
||||
{
|
||||
$this->template->assign_vars(array(
|
||||
'AP_PAGINATION' => (isset($pagination)) ? $pagination : '',
|
||||
'TOTAL_ANNOUNCEMENTS' => ($total_announcements == 1) ? $this->user->lang['VIEW_LATEST_ANNOUNCEMENT'] : sprintf($this->user->lang['VIEW_LATEST_ANNOUNCEMENTS'], $total_announcements),
|
||||
'AP_PAGE_NUMBER' => $this->pagination->on_page($total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -363,14 +386,10 @@ class announcements extends module_base
|
||||
$read_full = $this->user->lang['BACK'];
|
||||
$real_forum_id = ($forum_id == 0) ? $fetch_news['global_id']: $forum_id;
|
||||
|
||||
$read_full_url = ($this->request->is_set('ap')) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "ap=$start#a$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#a$i");
|
||||
$read_full_url = ($this->request->is_set('ap_' . $module_id)) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "ap_{$module_id}=$start#a_{$module_id}_$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#a_{$module_id}_$i");
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($this->config['board3_announcements_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start, 'announcements');
|
||||
}
|
||||
|
||||
$this->template->assign_block_vars('announcements_center_row', array(
|
||||
$this->template->assign_block_vars('announcements.center_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
@@ -394,43 +413,20 @@ class announcements extends module_base
|
||||
'S_HAS_ATTACHMENTS' => (!empty($fetch_news[$i]['attachments'])) ? true : false,
|
||||
));
|
||||
|
||||
$this->pagination->generate_template_pagination($view_topic_url, 'announcements_center_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
|
||||
$this->pagination->generate_template_pagination($view_topic_url, 'announcements.center_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
|
||||
|
||||
if(!empty($fetch_news[$i]['attachments']))
|
||||
{
|
||||
foreach ($fetch_news[$i]['attachments'] as $attachment)
|
||||
{
|
||||
$this->template->assign_block_vars('announcements_center_row.attachment', array(
|
||||
$this->template->assign_block_vars('announcements.center_row.attachment', array(
|
||||
'DISPLAY_ATTACHMENT' => $attachment)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->config['board3_number_of_announcements_' . $module_id] <> 0 && $this->config['board3_announcements_archive_' . $module_id])
|
||||
{
|
||||
$this->template->assign_vars(array(
|
||||
'AP_PAGINATION' => (!empty($pagination)) ? $pagination : '',
|
||||
'TOTAL_ANNOUNCEMENTS' => ($total_announcements == 1) ? $this->user->lang['VIEW_LATEST_ANNOUNCEMENT'] : sprintf($this->user->lang['VIEW_LATEST_ANNOUNCEMENTS'], $total_announcements),
|
||||
'AP_PAGE_NUMBER' => $this->pagination->on_page($total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$topic_icons = false;
|
||||
if(!empty($fetch_news['topic_icons']))
|
||||
{
|
||||
$topic_icons = true;
|
||||
}
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'NEWEST_POST_IMG' => $this->user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
|
||||
'READ_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
|
||||
'GOTO_PAGE_IMG' => $this->user->img('icon_post_target', 'GOTO_PAGE'),
|
||||
'S_DISPLAY_ANNOUNCEMENTS_RVS' => ($this->config['board3_show_announcements_replies_views_' . $module_id]) ? true : false,
|
||||
'S_TOPIC_ICONS' => $topic_icons,
|
||||
));
|
||||
|
||||
if ($this->config['board3_announcements_style_' . $module_id])
|
||||
{
|
||||
return 'announcements_center_compact.html';
|
||||
|
||||
@@ -47,6 +47,9 @@ class custom extends module_base
|
||||
*/
|
||||
public $custom_acp_tpl = 'acp_portal_custom';
|
||||
|
||||
/** @var bool Can include this module multiple times */
|
||||
protected $multiple_includes = true;
|
||||
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
|
||||
@@ -47,10 +47,10 @@ class leaders extends module_base
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
@@ -67,8 +67,8 @@ class leaders extends module_base
|
||||
*
|
||||
* @param \phpbb\auth\auth $auth phpBB auth service
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver\driver_interface $db phpBB db driver
|
||||
* @param \phpbb\template\template $template phpBB template
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
|
||||
@@ -47,6 +47,9 @@ class links extends module_base
|
||||
*/
|
||||
public $custom_acp_tpl = 'acp_portal_links';
|
||||
|
||||
/** @var bool Can include this module multiple times */
|
||||
protected $multiple_includes = true;
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
@@ -56,13 +59,13 @@ class links extends module_base
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
@@ -81,9 +84,9 @@ class links extends module_base
|
||||
* Construct a links object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\db\driver\driver_interface $db phpBB db driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\template\template $template phpBB template
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
@@ -113,6 +116,8 @@ class links extends module_base
|
||||
// get user's groups
|
||||
$groups_ary = get_user_groups();
|
||||
|
||||
$this->template->assign_block_vars('portal_links', array('MODULE_ID' => $module_id));
|
||||
|
||||
for ($i = 0; $i < sizeof($links); $i++)
|
||||
{
|
||||
if ($links[$i]['type'] == self::LINK_INT)
|
||||
@@ -130,7 +135,7 @@ class links extends module_base
|
||||
|
||||
if (!empty($permission_check) || $links[$i]['permission'] == '')
|
||||
{
|
||||
$this->template->assign_block_vars('portallinks', array(
|
||||
$this->template->assign_block_vars('portal_links.links', array(
|
||||
'LINK_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
||||
'LINK_URL' => $cur_url,
|
||||
'MODULE_ID' => $module_id,
|
||||
|
||||
@@ -47,6 +47,9 @@ class main_menu extends module_base
|
||||
*/
|
||||
public $custom_acp_tpl = 'acp_portal_menu';
|
||||
|
||||
/** @var bool Can include this module multiple times */
|
||||
protected $multiple_includes = true;
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
@@ -57,13 +60,13 @@ class main_menu extends module_base
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
@@ -82,9 +85,9 @@ class main_menu extends module_base
|
||||
* Construct a main menu object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\db\driver\driver_interface $db phpBB db driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\template\template $template phpBB template
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx php file extension
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
@@ -111,6 +114,8 @@ class main_menu extends module_base
|
||||
|
||||
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
||||
|
||||
$this->template->assign_block_vars('portal_menu', array('MODULE_ID' => $module_id));
|
||||
|
||||
// get user's groups
|
||||
$groups_ary = get_user_groups();
|
||||
|
||||
@@ -118,9 +123,8 @@ class main_menu extends module_base
|
||||
{
|
||||
if ($links[$i]['type'] == self::LINK_CAT)
|
||||
{
|
||||
$this->template->assign_block_vars('portalmenu', array(
|
||||
$this->template->assign_block_vars('portal_menu.category', array(
|
||||
'CAT_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
||||
'MODULE_ID' => $module_id,
|
||||
));
|
||||
}
|
||||
else
|
||||
@@ -140,7 +144,7 @@ class main_menu extends module_base
|
||||
|
||||
if (!empty($permission_check) || $links[$i]['permission'] == '')
|
||||
{
|
||||
$this->template->assign_block_vars('portalmenu.links', array(
|
||||
$this->template->assign_block_vars('portal_menu.category.links', array(
|
||||
'LINK_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
||||
'LINK_URL' => $cur_url,
|
||||
'NEW_WINDOW' => ($links[$i]['type'] != self::LINK_INT && $this->config['board3_menu_url_new_window_' . $module_id]) ? true : false,
|
||||
|
||||
@@ -26,6 +26,9 @@ class module_base implements module_interface
|
||||
/** @var string Module language file */
|
||||
protected $language;
|
||||
|
||||
/** @var bool Can include this module multiple times */
|
||||
protected $multiple_includes = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -97,4 +100,12 @@ class module_base implements module_interface
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function can_multi_include()
|
||||
{
|
||||
return $this->multiple_includes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +95,16 @@ interface module_interface
|
||||
* Executes any additional commands for uninstalling the module
|
||||
*
|
||||
* @param int $module_id Module's ID
|
||||
* @param \phpbb\db\driver $db phpBB dbal driver
|
||||
* @param \phpbb\db\driver\driver_interface $db phpBB dbal driver
|
||||
*
|
||||
* @return bool True if uninstall was successful, false if not
|
||||
*/
|
||||
public function uninstall($module_id, $db);
|
||||
|
||||
/**
|
||||
* Whether module can be included more than once
|
||||
*
|
||||
* @return bool True if module can be included more than once, false if not
|
||||
*/
|
||||
public function can_multi_include();
|
||||
}
|
||||
|
||||
107
modules/news.php
107
modules/news.php
@@ -41,16 +41,19 @@ class news extends module_base
|
||||
*/
|
||||
public $language = 'portal_news_module';
|
||||
|
||||
/** @var bool Can include this module multiple times */
|
||||
protected $multiple_includes = true;
|
||||
|
||||
/** @var \phpbb\auth\auth */
|
||||
protected $auth;
|
||||
|
||||
/** @var \phpbb\cache */
|
||||
/** @var \phpbb\cache\service */
|
||||
protected $cache;
|
||||
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
/** @var \phpbb\db\driver\driver_Interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\pagination */
|
||||
@@ -62,7 +65,7 @@ class news extends module_base
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
@@ -81,13 +84,13 @@ class news extends module_base
|
||||
* Construct a news object
|
||||
*
|
||||
* @param \phpbb\auth\auth $auth phpBB auth
|
||||
* @param \phpbb\cache $cache phpBB cache system
|
||||
* @param \phpbb\cache\service $cache phpBB cache system
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\db\driver\driver_interface $db phpBB db driver
|
||||
* @param \phpbb\pagination $pagination phpBB pagination
|
||||
* @param \board3\portal\includes\modules_helper $modules_helper Portal modules helper
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\template\template $template phpBB template
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx php file extension
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
@@ -114,10 +117,10 @@ class news extends module_base
|
||||
*/
|
||||
public function get_template_center($module_id)
|
||||
{
|
||||
$news = $this->request->variable('news', -1);
|
||||
$news = $this->request->variable('news_' . $module_id, -1);
|
||||
$news = ($news > $this->config['board3_number_of_news_' . $module_id] -1) ? -1 : $news;
|
||||
$this->user->add_lang('viewforum');
|
||||
$start = $this->request->variable('np', 0);
|
||||
$start = $this->request->variable('np_' . $module_id, 0);
|
||||
$start = ($start < 0) ? 0 : $start;
|
||||
$total_news = 1;
|
||||
|
||||
@@ -135,10 +138,28 @@ class news extends module_base
|
||||
(bool) $this->config['board3_news_exclude_' . $module_id]
|
||||
);
|
||||
|
||||
$topic_icons = false;
|
||||
if(!empty($fetch_news['topic_icons']))
|
||||
{
|
||||
$topic_icons = true;
|
||||
}
|
||||
|
||||
// Standard news row
|
||||
$news_row = array(
|
||||
'S_NEWEST_OR_FIRST' => ($this->config['board3_news_show_last_' . $module_id]) ? $this->user->lang['JUMP_NEWEST'] : $this->user->lang['JUMP_FIRST'],
|
||||
'POSTED_BY_TEXT' => ($this->config['board3_news_show_last_' . $module_id]) ? $this->user->lang['LAST_POST'] : $this->user->lang['POSTED'],
|
||||
'S_DISPLAY_NEWS_RVS' => ($this->config['board3_show_news_replies_views_' . $module_id]) ? true : false,
|
||||
'S_TOPIC_ICONS' => $topic_icons,
|
||||
'MODULE_ID' => $module_id,
|
||||
);
|
||||
|
||||
// Any news present? If not terminate it here.
|
||||
if (sizeof($fetch_news) == 0)
|
||||
{
|
||||
$this->template->assign_block_vars('news_row', array(
|
||||
// Create standard news row
|
||||
$this->template->assign_block_vars('news', $news_row);
|
||||
|
||||
$this->template->assign_block_vars('news.news_row', array(
|
||||
'S_NO_TOPICS' => true,
|
||||
'S_NOT_LAST' => false,
|
||||
));
|
||||
@@ -204,6 +225,24 @@ class news extends module_base
|
||||
|
||||
$topic_tracking_info = get_portal_tracking_info($fetch_news);
|
||||
|
||||
// Create pagination if necessary
|
||||
if ($this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_news, $this->config['board3_number_of_news_' . $module_id], $start, ($this->config['board3_show_all_news_' . $module_id]) ? 'news_all' : 'news', $module_id);
|
||||
}
|
||||
|
||||
if ($this->config['board3_number_of_news_' . $module_id] <> 0 && $this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
$news_row = array_merge($news_row, array(
|
||||
'NP_PAGINATION' => (!empty($pagination)) ? $pagination : '',
|
||||
'TOTAL_NEWS' => ($total_news == 1) ? sprintf($this->user->lang['VIEW_FORUM_TOPICS'][1], $total_news) : sprintf($this->user->lang['VIEW_FORUM_TOPICS'][2], $total_news),
|
||||
'NP_PAGE_NUMBER' => $this->pagination->on_page($total_news, $this->config['board3_number_of_news_' . $module_id], $start),
|
||||
));
|
||||
}
|
||||
|
||||
// Create standard news row
|
||||
$this->template->assign_block_vars('news', $news_row);
|
||||
|
||||
if($news < 0)
|
||||
// Show the news overview
|
||||
{
|
||||
@@ -227,12 +266,8 @@ class news extends module_base
|
||||
$topic_id = $fetch_news[$i]['topic_id'];
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
$read_full_url = ($this->request->is_set('np')) ? 'np='. $start . '&news=' . $i . '#n' . $i : 'news=' . $i . '#n' . $i;
|
||||
$read_full_url = ($this->request->is_set('np_' . $module_id)) ? "np_$module_id=$start&news_$module_id=$i#n_{$module_id}_$i" : "news_$module_id=$i#n_{$module_id}_$i";
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_news, $this->config['board3_number_of_news_' . $module_id], $start, ($this->config['board3_show_all_news_' . $module_id]) ? 'news_all' : 'news');
|
||||
}
|
||||
|
||||
$replies = ($this->auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
|
||||
|
||||
@@ -274,9 +309,9 @@ class news extends module_base
|
||||
// Grab icons
|
||||
$icons = $this->cache->obtain_icons();
|
||||
|
||||
$this->pagination->generate_template_pagination($view_topic_url, 'pagination', 'np', $fetch_news[$i]['topic_replies'], $this->config['board3_number_of_news_' . $module_id], $start);
|
||||
$this->pagination->generate_template_pagination($view_topic_url, 'pagination', 'np_' . $module_id, $fetch_news[$i]['topic_replies'], $this->config['board3_number_of_news_' . $module_id], $start);
|
||||
|
||||
$this->template->assign_block_vars('news_row', array(
|
||||
$this->template->assign_block_vars('news.news_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
@@ -317,20 +352,11 @@ class news extends module_base
|
||||
{
|
||||
foreach ($fetch_news[$i]['attachments'] as $attachment)
|
||||
{
|
||||
$this->template->assign_block_vars('news_row.attachment', array(
|
||||
$this->template->assign_block_vars('news.news_row.attachment', array(
|
||||
'DISPLAY_ATTACHMENT' => $attachment)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->config['board3_number_of_news_' . $module_id] <> 0 && $this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
$this->template->assign_vars(array(
|
||||
'NP_PAGINATION' => (!empty($pagination)) ? $pagination : '',
|
||||
'TOTAL_NEWS' => ($total_news == 1) ? sprintf($this->user->lang['VIEW_FORUM_TOPICS'][1], $total_news) : sprintf($this->user->lang['VIEW_FORUM_TOPICS'][2], $total_news),
|
||||
'NP_PAGE_NUMBER' => $this->pagination->on_page($total_news, $this->config['board3_number_of_news_' . $module_id], $start))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -344,14 +370,10 @@ class news extends module_base
|
||||
$close_bracket = ' ]';
|
||||
$read_full = $this->user->lang['BACK'];
|
||||
|
||||
$read_full_url = ($this->request->is_set('np')) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "np=$start#n$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#n$i");
|
||||
$read_full_url = ($this->request->is_set('np_' . $module_id)) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "np_$module_id=$start#n_{$module_id}_$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#n_{$module_id}_$i");
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_news, $this->config['board3_number_of_news_' . $module_id], $start, ($this->config['board3_show_all_news_' . $module_id]) ? 'news_all' : 'news');
|
||||
}
|
||||
|
||||
$this->template->assign_block_vars('news_row', array(
|
||||
$this->template->assign_block_vars('news.news_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
|
||||
'TITLE' => $fetch_news[$i]['topic_title'],
|
||||
@@ -381,37 +403,18 @@ class news extends module_base
|
||||
{
|
||||
foreach ($fetch_news[$i]['attachments'] as $attachment)
|
||||
{
|
||||
$this->template->assign_block_vars('news_row.attachment', array(
|
||||
$this->template->assign_block_vars('news.news_row.attachment', array(
|
||||
'DISPLAY_ATTACHMENT' => $attachment)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->config['board3_number_of_news_' . $module_id] <> 0 && $this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
$this->template->assign_vars(array(
|
||||
'NP_PAGINATION' => (!empty($pagination)) ? $pagination : '',
|
||||
'TOTAL_NEWS' => ($total_news == 1) ? $this->user->lang['VIEW_FORUM_TOPIC'] : $this->user->lang('VIEW_FORUM_TOPICS', $total_news),
|
||||
'NP_PAGE_NUMBER' => $this->pagination->on_page($total_news, $this->config['board3_number_of_news_' . $module_id], $start))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$topic_icons = false;
|
||||
if(!empty($fetch_news['topic_icons']))
|
||||
{
|
||||
$topic_icons = true;
|
||||
}
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'NEWEST_POST_IMG' => $this->user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
|
||||
'READ_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
|
||||
'GOTO_PAGE_IMG' => $this->user->img('icon_post_target', 'GOTO_PAGE'),
|
||||
'S_NEWEST_OR_FIRST' => ($this->config['board3_news_show_last_' . $module_id]) ? $this->user->lang['JUMP_NEWEST'] : $this->user->lang['JUMP_FIRST'],
|
||||
'POSTED_BY_TEXT' => ($this->config['board3_news_show_last_' . $module_id]) ? $this->user->lang['LAST_POST'] : $this->user->lang['POSTED'],
|
||||
'S_DISPLAY_NEWS_RVS' => ($this->config['board3_show_news_replies_views_' . $module_id]) ? true : false,
|
||||
'S_TOPIC_ICONS' => $topic_icons,
|
||||
));
|
||||
|
||||
if($this->config['board3_news_style_' . $module_id])
|
||||
|
||||
67
portal/columns.php
Normal file
67
portal/columns.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal v2.1
|
||||
* @copyright (c) 2014 Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\portal;
|
||||
|
||||
class columns
|
||||
{
|
||||
/** @var array Column string to number map */
|
||||
protected $column_map = array(
|
||||
'left' => 1,
|
||||
'center' => 2,
|
||||
'right' => 3,
|
||||
'top' => 4,
|
||||
'bottom' => 5,
|
||||
);
|
||||
|
||||
/** @var array Column string to constant map */
|
||||
protected $constant_map = array(
|
||||
'top' => 1,
|
||||
'left' => 2,
|
||||
'center' => 4,
|
||||
'right' => 8,
|
||||
'bottom' => 16,
|
||||
);
|
||||
|
||||
/**
|
||||
* Convert column number to string equivalent
|
||||
*
|
||||
* @param int $column Column number
|
||||
*
|
||||
* @return string String representation of column number; default: ''
|
||||
*/
|
||||
public function number_to_string($column)
|
||||
{
|
||||
return (in_array($column, $this->column_map)) ? array_search($column, $this->column_map) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert column string to equivalent number
|
||||
*
|
||||
* @param string $column Column name
|
||||
*
|
||||
* @return int The column number; default: 0
|
||||
*/
|
||||
public function string_to_number($column)
|
||||
{
|
||||
return (isset($this->column_map[$column])) ? $this->column_map[$column] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert column string to equivalent constant
|
||||
*
|
||||
* @param string $column Column name
|
||||
*
|
||||
* @return int Column constant; default: 0
|
||||
*/
|
||||
public function string_to_constant($column)
|
||||
{
|
||||
return (isset($this->constant_map[$column])) ? $this->constant_map[$column] : 0;
|
||||
}
|
||||
}
|
||||
183
portal/modules/constraints_handler.php
Normal file
183
portal/modules/constraints_handler.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal v2.1
|
||||
* @copyright (c) 2014 Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
use board3\portal\portal\columns;
|
||||
|
||||
class constraints_handler
|
||||
{
|
||||
/** @var \board3\portal\portal\columns */
|
||||
protected $portal_columns;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var string Form action (link) */
|
||||
protected $u_action;
|
||||
|
||||
/** @var array Array with info about modules and their columns */
|
||||
public $module_column = array();
|
||||
|
||||
/**
|
||||
* Constructor for constraints handler
|
||||
*
|
||||
* @param columns $portal_columns Portal columns
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct(columns $portal_columns, $user)
|
||||
{
|
||||
$this->portal_columns = $portal_columns;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set u_action for module
|
||||
*
|
||||
* @param string $u_action u_action for module
|
||||
*/
|
||||
public function set_u_action($u_action)
|
||||
{
|
||||
$this->u_action = $u_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set module columns info
|
||||
*
|
||||
* @param array $module_column Array with info about modules and their columns
|
||||
*/
|
||||
public function set_module_column($module_column = array())
|
||||
{
|
||||
$this->module_column = $module_column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is conflict between the move action and existing modules
|
||||
*
|
||||
* @param array $module_data The module's data
|
||||
* @param int $move_action The move action
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function check_module_conflict($module_data, &$move_action)
|
||||
{
|
||||
/**
|
||||
* Moving only 1 column means we will either end up in a side column
|
||||
* or in the center column. This is not possible when moving 2 columns.
|
||||
* Therefore we only need to check if we won't end up with a duplicate
|
||||
* module in the new column (side columns (left & right) or center
|
||||
* columns (top, center, bottom)). Of course this does not apply to
|
||||
* custom modules.
|
||||
*/
|
||||
if ($module_data['module_classname'] != '\board3\portal\modules\custom' && abs($move_action) == 1)
|
||||
{
|
||||
$column_string = $this->portal_columns->number_to_string($module_data['module_column'] + $move_action);
|
||||
|
||||
// we can only move horizontally to center or side columns
|
||||
if (in_array($column_string, array('right', 'left')) && !$this->can_move_module(array('right', 'left'), $module_data['module_classname']))
|
||||
{
|
||||
trigger_error($this->user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else if ($column_string == 'center' && !$this->can_move_module(array('top', 'center', 'bottom'), $module_data['module_classname']))
|
||||
{
|
||||
// we are moving from the right to the center column so we should move to the left column instead
|
||||
$move_action = 2 * $move_action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module can be moved horizontally
|
||||
*
|
||||
* @param array $module_data Module's module data
|
||||
* @param int $direction Direction to move the module
|
||||
*
|
||||
* @return bool True if module can be moved, false if not
|
||||
*/
|
||||
public function can_move_horizontally($module_data, $direction)
|
||||
{
|
||||
if (isset($module_data['module_column']))
|
||||
{
|
||||
return ($direction === database_handler::MOVE_DIRECTION_RIGHT) ? $module_data['module_column'] < $this->portal_columns->string_to_number('right') : $module_data['module_column'] > $this->portal_columns->string_to_number('left');
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module can be moved to desired column(s)
|
||||
*
|
||||
* @param array|string $target_column Column(s) the module should be moved to
|
||||
* @param string $module_class Class of the module
|
||||
* @return bool True if module can be moved to desired column,
|
||||
* false if not
|
||||
*/
|
||||
public function can_move_module($target_column, $module_class)
|
||||
{
|
||||
if (is_array($target_column))
|
||||
{
|
||||
foreach ($target_column as $column)
|
||||
{
|
||||
if (!$this->can_move_module($column, $module_class))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if module already exists in the target columns
|
||||
return $this->check_module_already_exists($target_column, $module_class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module can be moved to desired column
|
||||
*
|
||||
* @param \board3\portal\modules\module_interface $module
|
||||
* @param string $column Column string
|
||||
*
|
||||
* @return bool True if module can be moved, false if not
|
||||
*/
|
||||
public function can_add_module($module, $column)
|
||||
{
|
||||
return (bool) ($module->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($column)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module already exists in specified target column type
|
||||
*
|
||||
* @param string $column Column to check
|
||||
* @param string $module_class Module class
|
||||
*
|
||||
* @return bool False if it already exists, true if not
|
||||
*/
|
||||
public function check_module_already_exists($column, $module_class)
|
||||
{
|
||||
if (isset($this->module_column[$module_class]))
|
||||
{
|
||||
// does the module already exist in the side columns?
|
||||
if (in_array($column, array('left', 'right')) &&
|
||||
(in_array('left', $this->module_column[$module_class]) || in_array('right', $this->module_column[$module_class])))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// does the module already exist in the center columns?
|
||||
else if (in_array($column, array('center', 'top', 'bottom')) &&
|
||||
(in_array('center', $this->module_column[$module_class]) || in_array('top', $this->module_column[$module_class]) || in_array('bottom', $this->module_column[$module_class])))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
168
portal/modules/database_handler.php
Normal file
168
portal/modules/database_handler.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal v2.1
|
||||
* @copyright (c) 2014 Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
use phpbb\db\driver\driver_interface;
|
||||
|
||||
class database_handler
|
||||
{
|
||||
/** @var int Move direction up */
|
||||
const MOVE_DIRECTION_UP = -1;
|
||||
|
||||
/** @var int Move driection down */
|
||||
const MOVE_DIRECTION_DOWN = 1;
|
||||
|
||||
/** @var int Move direction right */
|
||||
const MOVE_DIRECTION_RIGHT = 1;
|
||||
|
||||
/** @var int Move direction left */
|
||||
const MOVE_DIRECTION_LEFT = -1;
|
||||
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Constructor for modules manager
|
||||
*
|
||||
* @param \phpbb\db\driver\driver_interface $db Database driver
|
||||
*/
|
||||
public function __construct(driver_interface $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module data from database
|
||||
*
|
||||
* @param int $module_id Module ID
|
||||
* @return array Module data array
|
||||
*/
|
||||
public function get_module_data($module_id)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$module_data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $module_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run database part for resetting a module
|
||||
*
|
||||
* @param \board3\portal\modules\module_interface $module Module to reset
|
||||
* @param int $module_id Module ID of module
|
||||
*
|
||||
* @return int Number of affected rows
|
||||
*/
|
||||
public function reset_module($module, $module_id)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'module_name' => $module->get_name(),
|
||||
'module_image_src' => $module->get_image(),
|
||||
'module_group_ids' => '',
|
||||
'module_image_height' => 16,
|
||||
'module_image_width' => 16,
|
||||
'module_status' => B3_MODULE_ENABLED,
|
||||
);
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
return $this->db->sql_affectedrows();
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module vertically
|
||||
*
|
||||
* @param int $module_id Module ID
|
||||
* @param array $module_data Module data array
|
||||
* @param int $direction Direction to move, see constants in this class
|
||||
* @param int $step Moving step
|
||||
*
|
||||
* @return int Number of affected rows, 0 if unsuccessful
|
||||
*/
|
||||
public function move_module_vertical($module_id, $module_data, $direction, $step = 1)
|
||||
{
|
||||
if ($direction == self::MOVE_DIRECTION_DOWN)
|
||||
{
|
||||
$current_increment = ' + ' . $step;
|
||||
$other_increment = ' - ' . $step;
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_increment = ' - ' . $step;
|
||||
$other_increment = ' + ' . $step;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order' . $other_increment . '
|
||||
WHERE module_order = ' . (int) ($module_data['module_order'] + ($direction * $step)) . '
|
||||
AND module_column = ' . (int) $module_data['module_column'];
|
||||
$this->db->sql_query($sql);
|
||||
$updated = (bool) $this->db->sql_affectedrows();
|
||||
if ($updated)
|
||||
{
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order' . $current_increment . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
|
||||
return $updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module horizontally
|
||||
*
|
||||
* @param int $module_id Module ID
|
||||
* @param array $module_data Module data array
|
||||
* @param int $move_action The move action
|
||||
*/
|
||||
public function move_module_horizontal($module_id, $module_data, $move_action)
|
||||
{
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order + 1
|
||||
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||
AND module_column = ' . ($module_data['module_column'] + $move_action);
|
||||
$this->db->sql_query($sql);
|
||||
$updated = $this->db->sql_affectedrows();
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_column = ' . ($module_data['module_column'] + $move_action) . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order - 1
|
||||
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||
AND module_column = ' . $module_data['module_column'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
// the module that needs to moved is in the last row
|
||||
if (!$updated)
|
||||
{
|
||||
$sql = 'SELECT MAX(module_order) as new_order
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_order < ' . $module_data['module_order'] . '
|
||||
AND module_column = ' . (int) ($module_data['module_column'] + $move_action);
|
||||
$this->db->sql_query($sql);
|
||||
$new_order = $this->db->sql_fetchfield('new_order') + 1;
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = ' . $new_order . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
393
portal/modules/manager.php
Normal file
393
portal/modules/manager.php
Normal file
@@ -0,0 +1,393 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal v2.1
|
||||
* @copyright (c) 2014 Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
use board3\portal\includes\helper;
|
||||
use board3\portal\modules\module_interface;
|
||||
use board3\portal\portal\columns;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\request\request_interface;
|
||||
|
||||
class manager
|
||||
{
|
||||
/** @var \phpbb\cache\service */
|
||||
protected $cache;
|
||||
|
||||
/** @var \board3\portal\portal\columns */
|
||||
protected $portal_columns;
|
||||
|
||||
/** @var \board3\portal\includes\helper */
|
||||
protected $portal_helper;
|
||||
|
||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||
protected $constraints_handler;
|
||||
|
||||
/** @var \board3\portal\portal\modules\database_handler */
|
||||
protected $database_handler;
|
||||
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request_interface */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \board3\portal\modules\module_interface */
|
||||
protected $module;
|
||||
|
||||
/** @var string u_action of acp module */
|
||||
protected $u_action;
|
||||
|
||||
/** @var string class of acp module */
|
||||
protected $acp_class;
|
||||
|
||||
/**
|
||||
* Constructor for modules manager
|
||||
*
|
||||
* @param \phpbb\cache\service $cache phpBB cache
|
||||
* @param \phpbb\db\driver\driver_interface $db Database driver
|
||||
* @param \board3\portal\portal\columns $portal_columns Portal columns helper
|
||||
* @param \board3\portal\includes\helper $portal_helper Portal helper
|
||||
* @param \board3\portal\portal\modules\constraints_handler $constraints_handler Modules constraints handler
|
||||
* @param \board3\portal\portal\modules\database_handler $database_handler Modules database handler
|
||||
* @param \phpbb\request\request_interface $request phpBB request
|
||||
* @param \phpbb\user $user phpBB user
|
||||
*/
|
||||
public function __construct($cache, driver_interface $db, columns $portal_columns, helper $portal_helper, constraints_handler $constraints_handler, database_handler $database_handler, request_interface $request, $user)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->db = $db;
|
||||
$this->portal_columns = $portal_columns;
|
||||
$this->portal_helper = $portal_helper;
|
||||
$this->constraints_handler = $constraints_handler;
|
||||
$this->database_handler = $database_handler;
|
||||
$this->request = $request;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set u_action for module
|
||||
*
|
||||
* @param string $u_action u_action for module
|
||||
*
|
||||
* @return \board3\portal\portal\modules\manager This class
|
||||
*/
|
||||
public function set_u_action($u_action)
|
||||
{
|
||||
$this->u_action = $u_action;
|
||||
$this->constraints_handler->set_u_action($u_action);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set acp module class
|
||||
*
|
||||
* @param string $acp_class ACP module class
|
||||
*
|
||||
* @return \board3\portal\portal\modules\manager This class
|
||||
*/
|
||||
public function set_acp_class($acp_class)
|
||||
{
|
||||
$this->acp_class = $acp_class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module object
|
||||
*
|
||||
* @param string $class_name Module class name
|
||||
* @return null
|
||||
*/
|
||||
protected function get_module($class_name)
|
||||
{
|
||||
$module = $this->portal_helper->get_module($class_name);
|
||||
|
||||
if (!$module instanceof module_interface)
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->module = $module;
|
||||
}
|
||||
|
||||
unset($module);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle ajax request.
|
||||
* Method will return supplied data if request is an ajax request
|
||||
*
|
||||
* @param array $data Data to send
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function handle_ajax_request($data)
|
||||
{
|
||||
if ($this->request->is_ajax())
|
||||
{
|
||||
$json_response = new \phpbb\json_response;
|
||||
$json_response->send($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset module settings to default options
|
||||
*
|
||||
* @param int $id ID of the acp_portal module
|
||||
* @param string|int $mode Mode of the acp_portal module
|
||||
* @param int $module_id ID of the module that should be reset
|
||||
* @param array $module_data Array containing the module's database row
|
||||
*/
|
||||
public function reset_module($id, $mode, $module_id, $module_data)
|
||||
{
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
$this->get_module($module_data['module_classname']);
|
||||
|
||||
$affected_rows = $this->database_handler->reset_module($this->module, $module_id);
|
||||
|
||||
if (empty($affected_rows))
|
||||
{
|
||||
// We need to return to the module config
|
||||
meta_refresh(3, $this->get_module_link('config', $module_id));
|
||||
trigger_error($this->user->lang['MODULE_NOT_EXISTS'] . adm_back_link($this->u_action . "&module_id=$module_id"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$this->cache->destroy('config');
|
||||
$this->cache->destroy('portal_config');
|
||||
obtain_portal_config(); // we need to prevent duplicate entry errors
|
||||
$this->module->install($module_id);
|
||||
$this->cache->purge();
|
||||
|
||||
// We need to return to the module config
|
||||
meta_refresh(3, $this->get_module_link('config', $module_id));
|
||||
|
||||
trigger_error($this->user->lang['MODULE_RESET_SUCCESS'] . adm_back_link($this->u_action . "&module_id=$module_id"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$confirm_text = (isset($this->user->lang[$module_data['module_name']])) ? sprintf($this->user->lang['MODULE_RESET_CONFIRM'], $this->user->lang[$module_data['module_name']]) : sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], utf8_normalize_nfc($module_data['module_name']));
|
||||
confirm_box(false, $confirm_text, build_hidden_fields(array(
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'module_reset' => true,
|
||||
'module_id' => $module_id,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module_data required for moving it
|
||||
*
|
||||
* @param int $module_id ID of the module that should be moved
|
||||
* @return array|null Module_data or empty if not successful
|
||||
*/
|
||||
public function get_move_module_data($module_id)
|
||||
{
|
||||
return $this->database_handler->get_module_data($module_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle output after moving module
|
||||
*
|
||||
* @param bool $success Whether moving module was successful
|
||||
* @param bool $is_row Whether the module move was inside a row
|
||||
* @return void
|
||||
*/
|
||||
public function handle_after_move($success = true, $is_row = false)
|
||||
{
|
||||
if (!$success)
|
||||
{
|
||||
trigger_error($this->user->lang['UNABLE_TO_MOVE' . (($is_row) ? '_ROW' : '')] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$this->cache->destroy('portal_modules');
|
||||
|
||||
// Handle ajax requests
|
||||
$this->handle_ajax_request(array('success' => true));
|
||||
|
||||
redirect($this->u_action); // redirect in order to get rid of excessive URL parameters
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the module order to the last module in the column
|
||||
*
|
||||
* @param int $module_column Module column to check
|
||||
* @return int Module order of the last module in the column
|
||||
*/
|
||||
public function get_last_module_order($module_column)
|
||||
{
|
||||
$modules = obtain_portal_modules();
|
||||
$last_order = 1;
|
||||
foreach ($modules as $cur_module)
|
||||
{
|
||||
if ($cur_module['module_column'] != $module_column)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$last_order = max($last_order, $cur_module['module_order']);
|
||||
}
|
||||
|
||||
return $last_order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module vertically
|
||||
*
|
||||
* @param int $module_id Module ID
|
||||
* @param int $direction Direction of move, either -1 for up or 1 for down
|
||||
*/
|
||||
public function move_module_vertical($module_id, $direction)
|
||||
{
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
if ($module_data === false || ($direction == database_handler::MOVE_DIRECTION_UP && $module_data['module_order'] <= 1) ||
|
||||
($direction == database_handler::MOVE_DIRECTION_DOWN && $this->get_last_module_order($module_data['module_column']) == $module_data['module_order']))
|
||||
{
|
||||
$this->handle_after_move(false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->handle_after_move($this->database_handler->move_module_vertical($module_id, $module_data, $direction, 1), true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move module horizontally
|
||||
*
|
||||
* @param int $module_id ID of the module that should be moved
|
||||
* @param int $direction The direction to move the module
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function move_module_horizontal($module_id, $direction)
|
||||
{
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
$this->get_module($module_data['module_classname']);
|
||||
|
||||
$move_action = $this->get_horizontal_move_action($module_data, $direction);
|
||||
$this->constraints_handler->check_module_conflict($module_data, $move_action);
|
||||
|
||||
$this->database_handler->move_module_horizontal($module_id, $module_data, $move_action);
|
||||
|
||||
$this->handle_after_move(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the horizontal move action (columns to move)
|
||||
*
|
||||
* @param array $module_data Array containing the module data
|
||||
* @param int $direction Direction to move; 1 for right, -1 for left
|
||||
*
|
||||
* @return int|null Move action if module can be moved, calls
|
||||
* handle_after_move() if it can't be moved
|
||||
*/
|
||||
public function get_horizontal_move_action($module_data, $direction)
|
||||
{
|
||||
if ($this->constraints_handler->can_move_horizontally($module_data, $direction))
|
||||
{
|
||||
if ($this->module->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($module_data['module_column'] + $direction)))
|
||||
{
|
||||
return $direction; // we move 1 column
|
||||
}
|
||||
else if ($this->module->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($module_data['module_column'] + $direction * 2)) && $module_data['module_column'] != $this->portal_columns->string_to_number('center'))
|
||||
{
|
||||
return 2 * $direction; // we move 2 columns
|
||||
}
|
||||
}
|
||||
|
||||
$this->handle_after_move(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete module
|
||||
*
|
||||
* @param int|string $id Module ID of the acp_portal module
|
||||
* @param string $mode Mode of the acp_portal module
|
||||
* @param string $action Current action of the acp_portal module
|
||||
* @param int $module_id ID of the module that should be deleted
|
||||
*/
|
||||
public function module_delete($id, $mode, $action, $module_id)
|
||||
{
|
||||
$module_data = $this->get_move_module_data($module_id);
|
||||
|
||||
if ($module_data !== false)
|
||||
{
|
||||
$module_classname = $this->request->variable('module_classname', '');
|
||||
|
||||
$this->get_module($module_data['module_classname']);
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$this->module->uninstall($module_data['module_id'], $this->db);
|
||||
|
||||
$sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||
SET module_order = module_order - 1
|
||||
WHERE module_column = ' . $module_data['module_column'] . '
|
||||
AND module_order > ' . $module_data['module_order'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$this->cache->purge(); // make sure we don't get errors after re-adding a module
|
||||
|
||||
// Handle ajax request
|
||||
$this->handle_ajax_request(array(
|
||||
'success' => true,
|
||||
'MESSAGE_TITLE' => $this->user->lang['INFORMATION'],
|
||||
'MESSAGE_TEXT' => $this->user->lang['SUCCESS_DELETE'],
|
||||
));
|
||||
|
||||
trigger_error($this->user->lang['SUCCESS_DELETE'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->module->get_language())
|
||||
{
|
||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->module->get_language());
|
||||
}
|
||||
$confirm_text = (isset($this->user->lang[$module_data['module_name']])) ? sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], $this->user->lang[$module_data['module_name']]) : sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], utf8_normalize_nfc($module_data['module_name']));
|
||||
confirm_box(false, $confirm_text, build_hidden_fields(array(
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action,
|
||||
'module_id' => $module_id,
|
||||
'module_classname' => $module_classname,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->cache->destroy('portal_modules');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to module settings with specified ID and portal_module mode
|
||||
*
|
||||
* @param string $mode portal_module mode
|
||||
* @param int $module_id Module ID
|
||||
*
|
||||
* @return string Link to module settings
|
||||
*/
|
||||
public function get_module_link($mode, $module_id)
|
||||
{
|
||||
return preg_replace(array('/i=[0-9]+/', '/mode=[a-zA-Z0-9_]+/'), array('i=%5C' . str_replace('\\', '%5C', $this->acp_class), 'mode=' . $mode), $this->u_action) . (($module_id) ? '&module_id=' . $module_id : '');
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,51 @@
|
||||
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
|
||||
<!-- IF $S_POSTBODY_TOP --><div class="postbody portal-module-postbody"><!-- ENDIF -->
|
||||
<!-- BEGIN announcements_center_row -->
|
||||
<!-- IF announcements_center_row.S_NO_TOPICS -->
|
||||
<!-- BEGIN announcements -->
|
||||
<!-- IF announcements.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN center_row -->
|
||||
<!-- IF announcements.center_row.S_NO_TOPICS -->
|
||||
<div class="post bg2">
|
||||
<div class="inner">
|
||||
<span><strong>{L_NO_ANNOUNCEMENTS}</strong></span>
|
||||
<!-- ELSE -->
|
||||
<div class="post <!-- IF announcements_center_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --> portal-no-margin">
|
||||
<div class="post <!-- IF announcements.center_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --> portal-no-margin">
|
||||
<div class="inner">
|
||||
<h4 class="first"><a <!-- IF announcements_center_row.S_FIRST_ROW -->id="a" <!-- ENDIF -->name="a{announcements_center_row.A_ID}"></a><!-- IF announcements_center_row.S_UNREAD_INFO --><a href="{announcements_center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements_center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {announcements_center_row.ATTACH_ICON_IMG} <!-- IF announcements_center_row.S_POLL --> <strong>{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><!-- IF announcements_center_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{announcements_center_row.TOPIC_ICON_IMG}" width="{announcements_center_row.TOPIC_ICON_IMG_WIDTH}" height="{announcements_center_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{announcements_center_row.U_VIEW_COMMENTS}"><strong>{announcements_center_row.TITLE}</strong></a></h4>
|
||||
<!-- IF announcements_center_row.PAGINATION --><strong class="pagination"><span>{announcements_center_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<h4 class="first"><a <!-- IF announcements.center_row.S_FIRST_ROW -->id="a_{$MODULE_ID}" <!-- ENDIF -->name="a_{$MODULE_ID}_{announcements.center_row.A_ID}"></a><!-- IF announcements.center_row.S_UNREAD_INFO --><a href="{announcements.center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements.center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {announcements.center_row.ATTACH_ICON_IMG} <!-- IF announcements.center_row.S_POLL --> <strong>{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><!-- IF announcements.center_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{announcements.center_row.TOPIC_ICON_IMG}" width="{announcements.center_row.TOPIC_ICON_IMG_WIDTH}" height="{announcements.center_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{announcements.center_row.U_VIEW_COMMENTS}"><strong>{announcements.center_row.TITLE}</strong></a></h4>
|
||||
<!-- IF announcements.center_row.PAGINATION --><strong class="pagination"><span>{announcements.center_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<ul class="linklist">
|
||||
<li>{L_POSTED} {L_POST_BY_AUTHOR}{L_COLON} {announcements_center_row.POSTER_FULL} » {announcements_center_row.TIME}</li>
|
||||
<li class="rightside"><!-- IF announcements_center_row.FORUM_NAME -->{L_FORUM}{L_COLON} <strong><a href="{announcements_center_row.U_VIEWFORUM}">{announcements_center_row.FORUM_NAME}</a></strong><!-- ELSE -->{L_GLOBAL_ANNOUNCEMENT}<!-- ENDIF --></li>
|
||||
<li>{L_POSTED} {L_POST_BY_AUTHOR}{L_COLON} {announcements.center_row.POSTER_FULL} » {announcements.center_row.TIME}</li>
|
||||
<li class="rightside"><!-- IF announcements.center_row.FORUM_NAME -->{L_FORUM}{L_COLON} <strong><a href="{announcements.center_row.U_VIEWFORUM}">{announcements.center_row.FORUM_NAME}</a></strong><!-- ELSE -->{L_GLOBAL_ANNOUNCEMENT}<!-- ENDIF --></li>
|
||||
</ul>
|
||||
<!-- IF not $S_POSTBODY_TOP --><div class="postbody portal-module-postbody"><!-- ENDIF -->
|
||||
<div class="content">
|
||||
<br />{announcements_center_row.TEXT}
|
||||
<br />{announcements.center_row.TEXT}
|
||||
</div>
|
||||
<!-- IF announcements_center_row.S_HAS_ATTACHMENTS -->
|
||||
<!-- IF announcements.center_row.S_HAS_ATTACHMENTS -->
|
||||
<dl class="attachbox">
|
||||
<dt>{L_ATTACHMENTS}</dt>
|
||||
<!-- BEGIN attachment -->
|
||||
<dd>{announcements_center_row.attachment.DISPLAY_ATTACHMENT}</dd>
|
||||
<dd>{announcements.center_row.attachment.DISPLAY_ATTACHMENT}</dd>
|
||||
<!-- END attachment -->
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<br class="portal-clear" />
|
||||
<span class="portal-title-span">{L_TOPIC_VIEWS}{L_COLON} {announcements_center_row.TOPIC_VIEWS} • <a href="{announcements_center_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {announcements_center_row.REPLIES}</a> • <a href="{announcements_center_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span>
|
||||
<span class="portal-read-all-link">{announcements_center_row.OPEN}<a href="{announcements_center_row.U_READ_FULL}">{announcements_center_row.L_READ_FULL}</a>{announcements_center_row.CLOSE}</span>
|
||||
<span class="portal-title-span">{L_TOPIC_VIEWS}{L_COLON} {announcements.center_row.TOPIC_VIEWS} • <a href="{announcements.center_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {announcements.center_row.REPLIES}</a> • <a href="{announcements.center_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span>
|
||||
<span class="portal-read-all-link">{announcements.center_row.OPEN}<a href="{announcements.center_row.U_READ_FULL}">{announcements.center_row.L_READ_FULL}</a>{announcements.center_row.CLOSE}</span>
|
||||
<div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
|
||||
<!-- IF announcements_center_row.S_NOT_LAST --><br class="portal-clear" /><!-- ENDIF -->
|
||||
<!-- IF announcements_center_row.S_LAST_ROW and (AP_PAGINATION or TOTAL_ANNOUNCEMENTS) -->
|
||||
<!-- IF announcements.center_row.S_NOT_LAST --><br class="portal-clear" /><!-- ENDIF -->
|
||||
<!-- IF announcements.center_row.S_LAST_ROW and (announcements.AP_PAGINATION or announcements.TOTAL_ANNOUNCEMENTS) -->
|
||||
<hr class="dashed" />
|
||||
<div class="pagination">
|
||||
{TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF AP_PAGE_NUMBER --><!-- IF AP_PAGINATION --> • {AP_PAGE_NUMBER} • {AP_PAGINATION}<!-- ELSE --> • {AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
{announcements.TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF announcements.AP_PAGE_NUMBER --><!-- IF announcements.AP_PAGINATION --> • {announcements.AP_PAGE_NUMBER} • {announcements.AP_PAGINATION}<!-- ELSE --> • {announcements.AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF not $S_POSTBODY_TOP --></div><!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- END announcements_center_row -->
|
||||
<!-- END center_row -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END announcements -->
|
||||
<!-- IF $S_POSTBODY_TOP --></div><!-- ENDIF -->
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<!-- BEGIN announcements_center_row -->
|
||||
<!-- IF announcements_center_row.S_NO_TOPICS -->
|
||||
<!-- BEGIN announcements -->
|
||||
<!-- IF announcements.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN center_row -->
|
||||
<!-- IF announcements.center_row.S_NO_TOPICS -->
|
||||
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
|
||||
<div class="post bg2 portal-no-margin">
|
||||
<div class="inner">
|
||||
@@ -8,10 +10,10 @@
|
||||
</div>
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
<!-- ELSE -->
|
||||
<!-- IF announcements_center_row.S_FIRST_ROW -->
|
||||
<!-- IF announcements.center_row.S_FIRST_ROW -->
|
||||
{$CC_BLOCK_H_L}
|
||||
<dt id="a">{$TITLE}</dt>
|
||||
<!-- IF S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<dt id="a_{$MODULE_ID}">{$TITLE}</dt>
|
||||
<!-- IF announcements.S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<dd class="posts responsive-portal-announcements">{L_REPLIES}</dd>
|
||||
<dd class="views responsive-portal-announcements">{L_VIEWS}</dd>
|
||||
<!-- ENDIF -->
|
||||
@@ -19,43 +21,43 @@
|
||||
{$CC_BLOCK_H_R}
|
||||
<ul class="topiclist topics responsive-portal-announcements">
|
||||
<!-- ENDIF -->
|
||||
<li class="row<!-- IF announcements_center_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
|
||||
<dl class="icon {announcements_center_row.TOPIC_IMG_STYLE}">
|
||||
<dt style="<!-- IF announcements_center_row.TOPIC_ICON_IMG -->background-image: url({T_ICONS_PATH}{announcements_center_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{announcements_center_row.TOPIC_FOLDER_IMG_ALT}">
|
||||
<!-- IF announcements_center_row.S_UNREAD_TOPIC -->
|
||||
<a href="{announcements_center_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a>
|
||||
<li class="row<!-- IF announcements.center_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
|
||||
<dl class="icon {announcements.center_row.TOPIC_IMG_STYLE}">
|
||||
<dt style="<!-- IF announcements.center_row.TOPIC_ICON_IMG -->background-image: url({T_ICONS_PATH}{announcements.center_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{announcements.center_row.TOPIC_FOLDER_IMG_ALT}">
|
||||
<!-- IF announcements.center_row.S_UNREAD_TOPIC -->
|
||||
<a href="{announcements.center_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a>
|
||||
<!-- ENDIF -->
|
||||
<div class="list-inner">
|
||||
<!-- IF announcements_center_row.ATTACH_ICON_IMG -->{announcements_center_row.ATTACH_ICON_IMG} <!-- ENDIF -->
|
||||
<!-- IF announcements_center_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF -->
|
||||
<a href="{announcements_center_row.U_VIEW_COMMENTS}" title="{announcements_center_row.TITLE}" class="topictitle">{announcements_center_row.TITLE}</a>
|
||||
<!-- IF announcements.center_row.ATTACH_ICON_IMG -->{announcements.center_row.ATTACH_ICON_IMG} <!-- ENDIF -->
|
||||
<!-- IF announcements.center_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF -->
|
||||
<a href="{announcements.center_row.U_VIEW_COMMENTS}" title="{announcements.center_row.TITLE}" class="topictitle">{announcements.center_row.TITLE}</a>
|
||||
<!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> • <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->
|
||||
<!-- IF announcements_center_row.PAGINATION --><strong class="pagination"><span>{announcements_center_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<br />{L_POSTED} {L_POST_BY_AUTHOR} {announcements_center_row.POSTER_FULL} » {announcements_center_row.TIME}
|
||||
<!-- IF announcements_center_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{announcements_center_row.U_VIEWFORUM}" class="portal-forumtitle">{announcements_center_row.FORUM_NAME}</a>
|
||||
<!-- IF announcements.center_row.PAGINATION --><strong class="pagination"><span>{announcements.center_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<br />{L_POSTED} {L_POST_BY_AUTHOR} {announcements.center_row.POSTER_FULL} » {announcements.center_row.TIME}
|
||||
<!-- IF announcements.center_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{announcements.center_row.U_VIEWFORUM}" class="portal-forumtitle">{announcements.center_row.FORUM_NAME}</a>
|
||||
<!-- ELSE -->
|
||||
<br />{L_GLOBAL_ANNOUNCEMENT}
|
||||
<!-- ENDIF -->
|
||||
<!-- IF not S_DISPLAY_ANNOUNCEMENTS_RVS --><!-- IF announcements_center_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{announcements_center_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{announcements_center_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
<!-- IF not announcements.S_DISPLAY_ANNOUNCEMENTS_RVS --><!-- IF announcements.center_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{announcements.center_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{announcements.center_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
</div>
|
||||
</dt>
|
||||
<!-- IF S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<dd class="posts">{announcements_center_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
|
||||
<dd class="views">{announcements_center_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
|
||||
<!-- IF announcements.S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<dd class="posts">{announcements.center_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
|
||||
<dd class="views">{announcements.center_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
|
||||
<!-- ENDIF -->
|
||||
<dd class="lastpost"><span><dfn>{L_LAST_POST}</dfn>{L_POST_BY_AUTHOR} {announcements_center_row.USERNAME_FULL_LAST} <!-- IF announcements_center_row.S_UNREAD_INFO --><a href="{announcements_center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements_center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><br />
|
||||
{announcements_center_row.LAST_POST_TIME}</span>
|
||||
<dd class="lastpost"><span><dfn>{L_LAST_POST}</dfn>{L_POST_BY_AUTHOR} {announcements.center_row.USERNAME_FULL_LAST} <!-- IF announcements.center_row.S_UNREAD_INFO --><a href="{announcements.center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements.center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><br />
|
||||
{announcements.center_row.LAST_POST_TIME}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<!-- IF announcements_center_row.S_LAST_ROW -->
|
||||
<!-- IF AP_PAGINATION or TOTAL_ANNOUNCEMENTS -->
|
||||
<li class="row<!-- IF announcements_center_row.S_ROW_COUNT is even --> bg2<!-- ELSE --> bg1<!-- ENDIF --> portal-news-pagination">
|
||||
<!-- IF announcements.center_row.S_LAST_ROW -->
|
||||
<!-- IF announcements.AP_PAGINATION or announcements.TOTAL_ANNOUNCEMENTS -->
|
||||
<li class="row<!-- IF announcements.center_row.S_ROW_COUNT is even --> bg2<!-- ELSE --> bg1<!-- ENDIF --> portal-news-pagination">
|
||||
<div class="topic-actions">
|
||||
<div class="pagination">
|
||||
{TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF AP_PAGE_NUMBER --><!-- IF AP_PAGINATION --> • {AP_PAGE_NUMBER} • {AP_PAGINATION}<!-- ELSE --> • {AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
{announcements.TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF announcements.AP_PAGE_NUMBER --><!-- IF announcements.AP_PAGINATION --> • {announcements.AP_PAGE_NUMBER} • {announcements.AP_PAGINATION}<!-- ELSE --> • {announcements.AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -64,4 +66,6 @@
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END announcements_center_row -->
|
||||
<!-- END center_row -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END announcements -->
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<!-- BEGIN portal_links -->
|
||||
<!-- IF portal_links.MODULE_ID eq $MODULE_ID -->
|
||||
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
|
||||
<div class="portal-navigation">
|
||||
<ul>
|
||||
<!-- BEGIN portallinks -->
|
||||
<!-- IF $MODULE_ID eq portallinks.MODULE_ID --><li><a href="{portallinks.LINK_URL}" title="{portallinks.LINK_TITLE}" <!-- IF portallinks.NEW_WINDOW -->onclick="window.open('{portallinks.LINK_URL}'); return false;"<!-- ENDIF -->>{portallinks.LINK_TITLE}</a></li><!-- ENDIF -->
|
||||
<!-- BEGIN links -->
|
||||
<li><a href="{portal_links.links.LINK_URL}" title="{portal_links.links.LINK_TITLE}" <!-- IF portal_links.links.NEW_WINDOW -->onclick="window.open('{portal_links.links.LINK_URL}'); return false;"<!-- ENDIF -->>{portal_links.links.LINK_TITLE}</a></li>
|
||||
<!-- BEGINELSE -->
|
||||
<span class="portal-title-span gensmall"><strong>{L_LINKS_NO_LINKS}</strong></span><br />
|
||||
<!-- END portallinks -->
|
||||
<!-- END links -->
|
||||
</ul>
|
||||
</div>
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- END portal_links -->
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
<!-- BEGIN portal_menu -->
|
||||
<!-- IF portal_menu.MODULE_ID eq $MODULE_ID -->
|
||||
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
|
||||
<div class="portal-navigation">
|
||||
<!-- BEGIN portalmenu -->
|
||||
<!-- IF $MODULE_ID eq portalmenu.MODULE_ID -->
|
||||
<div class="menutitle">{portalmenu.CAT_TITLE}</div>
|
||||
<!-- BEGIN category -->
|
||||
<div class="menutitle">{portal_menu.category.CAT_TITLE}</div>
|
||||
<ul>
|
||||
<!-- BEGIN links -->
|
||||
<li><a href="{portalmenu.links.LINK_URL}" <!-- IF portalmenu.links.NEW_WINDOW -->onclick="window.open('{portalmenu.links.LINK_URL}'); return false;"<!-- ENDIF -->>{portalmenu.links.LINK_TITLE}</a></li>
|
||||
<li><a href="{portal_menu.category.links.LINK_URL}" <!-- IF portal_menu.category.links.NEW_WINDOW -->onclick="window.open('{portal_menu.category.links.LINK_URL}'); return false;"<!-- ENDIF -->>{portal_menu.category.links.LINK_TITLE}</a></li>
|
||||
<!-- END links -->
|
||||
</ul>
|
||||
<hr class="dashed" />
|
||||
<!-- ENDIF -->
|
||||
<!-- BEGINELSE -->
|
||||
<ul>
|
||||
<span class="portal-title-span gensmall"><strong>{L_MENU_NO_LINKS}</strong></span><br />
|
||||
</ul>
|
||||
<!-- END portalmenu -->
|
||||
<!-- END category -->
|
||||
</div>
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- END portal_menu -->
|
||||
|
||||
@@ -1,45 +1,48 @@
|
||||
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
|
||||
<!-- IF $S_POSTBODY_TOP --><div class="postbody portal-module-postbody"><!-- ENDIF -->
|
||||
<!-- BEGIN news -->
|
||||
<!-- IF news.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN news_row -->
|
||||
<!-- IF news_row.S_NO_TOPICS -->
|
||||
<!-- IF news.news_row.S_FIRST_ROW --><a id="n_{$MODULE_ID}"></a><!-- ENDIF -->
|
||||
<!-- IF news.news_row.S_NO_TOPICS -->
|
||||
<div class="post bg2">
|
||||
<div class="inner">
|
||||
<span><strong>{L_NO_NEWS}</strong></span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ELSE -->
|
||||
<div class="post <!-- IF news_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
|
||||
<div class="post <!-- IF news.news_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
|
||||
<div class="inner">
|
||||
<h4 class="first"><a id="n{news_row.N_ID}"></a><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF --><!-- IF news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}" width="{news_row.TOPIC_ICON_IMG_WIDTH}" height="{news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{news_row.U_VIEW_COMMENTS}"><strong>{news_row.TITLE}</strong></a></h4>
|
||||
<!-- IF news_row.PAGINATION --><strong class="pagination"><span>{news_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<h4 class="first"><a id="n_{$MODULE_ID}_{news.news_row.N_ID}"></a><!-- IF news.news_row.S_UNREAD_INFO --><a href="{news.news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news.news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news.news_row.ATTACH_ICON_IMG} <!-- IF news.news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF --><!-- IF news.news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news.news_row.TOPIC_ICON_IMG}" width="{news.news_row.TOPIC_ICON_IMG_WIDTH}" height="{news.news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{news.news_row.U_VIEW_COMMENTS}"><strong>{news.news_row.TITLE}</strong></a></h4>
|
||||
<!-- IF news.news_row.PAGINATION --><strong class="pagination"><span>{news.news_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<ul class="linklist">
|
||||
<li>{POSTED_BY_TEXT} {L_POST_BY_AUTHOR}{L_COLON} {news_row.POSTER_FULL} » {news_row.TIME}</li>
|
||||
<li class="rightside">{L_FORUM}{L_COLON} <strong><a href="{news_row.U_VIEWFORUM}">{news_row.FORUM_NAME}</a></strong></li>
|
||||
<li>{news.POSTED_BY_TEXT} {L_POST_BY_AUTHOR}{L_COLON} {news.news_row.POSTER_FULL} » {news.news_row.TIME}</li>
|
||||
<li class="rightside">{L_FORUM}{L_COLON} <strong><a href="{news.news_row.U_VIEWFORUM}">{news.news_row.FORUM_NAME}</a></strong></li>
|
||||
</ul>
|
||||
<!-- IF not $S_POSTBODY_TOP --><div class="postbody portal-module-postbody"><!-- ENDIF -->
|
||||
<div class="content">
|
||||
<br />{news_row.TEXT}
|
||||
<br />{news.news_row.TEXT}
|
||||
</div>
|
||||
<!-- IF news_row.S_HAS_ATTACHMENTS -->
|
||||
<!-- IF news.news_row.S_HAS_ATTACHMENTS -->
|
||||
<dl class="attachbox">
|
||||
<dt>{L_ATTACHMENTS}</dt>
|
||||
<!-- BEGIN attachment -->
|
||||
<dd>{news_row.attachment.DISPLAY_ATTACHMENT}</dd>
|
||||
<dd>{news.news_row.attachment.DISPLAY_ATTACHMENT}</dd>
|
||||
<!-- END attachment -->
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<br class="portal-clear" />
|
||||
<span class="portal-title-span">{L_TOPIC_VIEWS}{L_COLON} {news_row.TOPIC_VIEWS} • <a href="{news_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {news_row.REPLIES}</a> • <a href="{news_row.U_POST_COMMENT}">{L_PORTAL_POST_REPLY}</a></span>
|
||||
<span class="portal-read-all-link">{news_row.OPEN}<a href="{news_row.U_READ_FULL}">{news_row.L_READ_FULL}</a>{news_row.CLOSE}</span>
|
||||
<span class="portal-title-span">{L_TOPIC_VIEWS}{L_COLON} {news.news_row.TOPIC_VIEWS} • <a href="{news.news_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {news.news_row.REPLIES}</a> • <a href="{news.news_row.U_POST_COMMENT}">{L_PORTAL_POST_REPLY}</a></span>
|
||||
<span class="portal-read-all-link">{news.news_row.OPEN}<a href="{news.news_row.U_READ_FULL}">{news.news_row.L_READ_FULL}</a>{news.news_row.CLOSE}</span>
|
||||
<div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
|
||||
<!-- IF news_row.S_NOT_LAST --><br class="portal-clear" /><!-- ENDIF -->
|
||||
<!-- IF news_row.S_LAST_ROW -->
|
||||
<!-- IF not news_row.S_NO_TOPICS -->
|
||||
<!-- IF NP_PAGINATION or TOTAL_NEWS -->
|
||||
<!-- IF news.news_row.S_NOT_LAST --><br class="portal-clear" /><!-- ENDIF -->
|
||||
<!-- IF news.news_row.S_LAST_ROW -->
|
||||
<!-- IF not news.news_row.S_NO_TOPICS -->
|
||||
<!-- IF news.NP_PAGINATION or news.TOTAL_NEWS -->
|
||||
<hr class="dashed" />
|
||||
<div class="pagination">
|
||||
{TOTAL_NEWS}
|
||||
<!-- IF NP_PAGE_NUMBER --><!-- IF NP_PAGINATION --> • {NP_PAGE_NUMBER} • {NP_PAGINATION}<!-- ELSE --> • {NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
{news.TOTAL_NEWS}
|
||||
<!-- IF news.NP_PAGE_NUMBER --><!-- IF news.NP_PAGINATION --> • {news.NP_PAGE_NUMBER} • {news.NP_PAGINATION}<!-- ELSE --> • {news.NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
@@ -49,5 +52,7 @@
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<!-- END news_row -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END news -->
|
||||
<!-- IF $S_POSTBODY_TOP --></div><!-- ENDIF -->
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<!-- BEGIN news -->
|
||||
<!-- IF news.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN news_row -->
|
||||
<!-- IF news_row.S_NO_TOPICS -->
|
||||
<!-- IF news.news_row.S_NO_TOPICS -->
|
||||
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
|
||||
<div class="post bg2 portal-no-margin">
|
||||
<div class="inner">
|
||||
@@ -8,10 +10,10 @@
|
||||
</div>
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
<!-- ELSE -->
|
||||
<!-- IF news_row.S_FIRST_ROW -->
|
||||
<!-- IF news.news_row.S_FIRST_ROW -->
|
||||
{$CC_BLOCK_H_L}
|
||||
<dt id="n">{$TITLE}</dt>
|
||||
<!-- IF S_DISPLAY_NEWS_RVS -->
|
||||
<dt id="n_{$MODULE_ID}">{$TITLE}</dt>
|
||||
<!-- IF news.S_DISPLAY_NEWS_RVS -->
|
||||
<dd class="posts responsive-portal-news">{L_REPLIES}</dd>
|
||||
<dd class="views responsive-portal-news">{L_VIEWS}</dd>
|
||||
<!-- ENDIF -->
|
||||
@@ -19,51 +21,51 @@
|
||||
{$CC_BLOCK_H_R}
|
||||
<ul class="topiclist topics responsive-portal-news">
|
||||
<!-- ENDIF -->
|
||||
<li class="row<!-- IF news_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
|
||||
<dl class="icon {news_row.TOPIC_IMG_STYLE}">
|
||||
<dt <!-- IF news_row.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{news_row.TOPIC_FOLDER_IMG_ALT}">
|
||||
<!-- IF news_row.S_UNREAD_TOPIC -->
|
||||
<a href="{news_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a>
|
||||
<li class="row<!-- IF news.news_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
|
||||
<dl class="icon {news.news_row.TOPIC_IMG_STYLE}">
|
||||
<dt <!-- IF news.news_row.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{news.news_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{news.news_row.TOPIC_FOLDER_IMG_ALT}">
|
||||
<!-- IF news.news_row.S_UNREAD_TOPIC -->
|
||||
<a href="{news.news_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a>
|
||||
<!-- ENDIF -->
|
||||
<div class="list-inner">
|
||||
<!-- IF news_row.ATTACH_ICON_IMG -->{news_row.ATTACH_ICON_IMG} <!-- ENDIF -->
|
||||
<a href="{news_row.U_VIEW_COMMENTS}" title="{news_row.TITLE}" class="topictitle">{news_row.TITLE}</a><!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> • <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->
|
||||
<!-- IF news_row.PAGINATION -->
|
||||
<!-- IF news.news_row.ATTACH_ICON_IMG -->{news.news_row.ATTACH_ICON_IMG} <!-- ENDIF -->
|
||||
<a href="{news.news_row.U_VIEW_COMMENTS}" title="{news.news_row.TITLE}" class="topictitle">{news.news_row.TITLE}</a><!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> • <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->
|
||||
<!-- IF news.news_row.PAGINATION -->
|
||||
<div class="pagination">
|
||||
<ul><!-- BEGIN pagination -->
|
||||
<!-- IF news_row.pagination.S_IS_PREV -->
|
||||
<!-- ELSEIF news_row.pagination.S_IS_CURRENT --><li class="active"><span>{news_row.pagination.PAGE_NUMBER}</span></li>
|
||||
<!-- ELSEIF news_row.pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li>
|
||||
<!-- ELSEIF news_row.pagination.S_IS_NEXT -->
|
||||
<!-- ELSE --><li><a href="{news_row.pagination.PAGE_URL}">{news_row.pagination.PAGE_NUMBER}</a></li>
|
||||
<!-- IF news.news_row.pagination.S_IS_PREV -->
|
||||
<!-- ELSEIF news.news_row.pagination.S_IS_CURRENT --><li class="active"><span>{news.news_row.pagination.PAGE_NUMBER}</span></li>
|
||||
<!-- ELSEIF news.news_row.pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li>
|
||||
<!-- ELSEIF news.news_row.pagination.S_IS_NEXT -->
|
||||
<!-- ELSE --><li><a href="{news.news_row.pagination.PAGE_URL}">{news.news_row.pagination.PAGE_NUMBER}</a></li>
|
||||
<!-- ENDIF -->
|
||||
<!-- END pagination --->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<br />{L_POSTED} {L_POST_BY_AUTHOR} {news_row.POSTER_FULL} » {news_row.TIME}
|
||||
<!-- IF news_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{news_row.U_VIEWFORUM}" class="portal-forumtitle">{news_row.FORUM_NAME}</a>
|
||||
<br />{L_POSTED} {L_POST_BY_AUTHOR} {news.news_row.POSTER_FULL} » {news.news_row.TIME}
|
||||
<!-- IF news.news_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{news.news_row.U_VIEWFORUM}" class="portal-forumtitle">{news.news_row.FORUM_NAME}</a>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF not S_DISPLAY_NEWS_RVS --><!-- IF news_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{news_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{news_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
<!-- IF not S_DISPLAY_NEWS_RVS --><!-- IF news.news_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{news.news_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{news.news_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
</div> <!-- \END <div class="list-inner"> -->
|
||||
</dt>
|
||||
<!-- IF S_DISPLAY_NEWS_RVS -->
|
||||
<dd class="posts" data-skip-responsive="true">{news_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
|
||||
<dd class="views" data-skip-responsive="true">{news_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
|
||||
<dd class="posts" data-skip-responsive="true">{news.news_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
|
||||
<dd class="views" data-skip-responsive="true">{news.news_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
|
||||
<!-- ENDIF -->
|
||||
<dd class="lastpost"><span><dfn>{L_LAST_POST}</dfn>{L_POST_BY_AUTHOR} {news_row.USERNAME_FULL_LAST} <!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><br />
|
||||
{news_row.LAST_POST_TIME}</span>
|
||||
<dd class="lastpost"><span><dfn>{L_LAST_POST}</dfn>{L_POST_BY_AUTHOR} {news.news_row.USERNAME_FULL_LAST} <!-- IF news.news_row.S_UNREAD_INFO --><a href="{news.news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news.news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><br />
|
||||
{news.news_row.LAST_POST_TIME}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<!-- IF news_row.S_LAST_ROW -->
|
||||
<!-- IF NP_PAGINATION or TOTAL_NEWS -->
|
||||
<li class="row<!-- IF news_row.S_ROW_COUNT is even --> bg2<!-- ELSE --> bg1<!-- ENDIF --> portal-news-pagination">
|
||||
<!-- IF news.news_row.S_LAST_ROW -->
|
||||
<!-- IF news.NP_PAGINATION or news.TOTAL_NEWS -->
|
||||
<li class="row<!-- IF news.news_row.S_ROW_COUNT is even --> bg2<!-- ELSE --> bg1<!-- ENDIF --> portal-news-pagination">
|
||||
<div class="topic-actions">
|
||||
<div class="pagination">
|
||||
{TOTAL_NEWS}
|
||||
<!-- IF NP_PAGE_NUMBER --><!-- IF NP_PAGINATION --> • {NP_PAGE_NUMBER} • {NP_PAGINATION}<!-- ELSE --> • {NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
{news.TOTAL_NEWS}
|
||||
<!-- IF news.NP_PAGE_NUMBER --><!-- IF news.NP_PAGINATION --> • {news.NP_PAGE_NUMBER} • {news.NP_PAGINATION}<!-- ELSE --> • {news.NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -73,3 +75,5 @@
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END news_row -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END news -->
|
||||
|
||||
@@ -1,36 +1,38 @@
|
||||
<!-- BEGIN announcements_center_row -->
|
||||
<!-- IF announcements_center_row.S_FIRST_ROW -->
|
||||
<!-- BEGIN announcements -->
|
||||
<!-- IF announcements.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN center_row -->
|
||||
<!-- IF announcements.center_row.S_FIRST_ROW -->
|
||||
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
|
||||
<!-- ENDIF -->
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<tr class="row1">
|
||||
<td>
|
||||
<!-- IF announcements_center_row.S_NO_TOPICS -->
|
||||
<!-- IF announcements.center_row.S_NO_TOPICS -->
|
||||
<span class="gensmall"><strong>{L_NO_ANNOUNCEMENTS}</strong></span>
|
||||
<!-- ELSE -->
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<tr>
|
||||
<td class="cat">
|
||||
<a name="a"></a><a name="a{announcements_center_row.A_ID}"></a>
|
||||
<!-- IF announcements_center_row.S_UNREAD_INFO --><a href="{announcements_center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements_center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {announcements_center_row.ATTACH_ICON_IMG}<!-- IF announcements_center_row.S_POLL --> <strong>{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><!-- IF announcements_center_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{announcements_center_row.TOPIC_ICON_IMG}" width="{announcements_center_row.TOPIC_ICON_IMG_WIDTH}" height="{announcements_center_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{announcements_center_row.U_VIEW_COMMENTS}"><strong>{announcements_center_row.TITLE}</strong></a>
|
||||
<a name="a_{$MODULE_ID}"></a><a name="a_{$MODULE_ID}_{announcements.center_row.A_ID}"></a>
|
||||
<!-- IF announcements.center_row.S_UNREAD_INFO --><a href="{announcements.center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements.center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {announcements.center_row.ATTACH_ICON_IMG}<!-- IF announcements.center_row.S_POLL --> <strong>{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><!-- IF announcements.center_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{announcements.center_row.TOPIC_ICON_IMG}" width="{announcements.center_row.TOPIC_ICON_IMG_WIDTH}" height="{announcements.center_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{announcements.center_row.U_VIEW_COMMENTS}"><strong>{announcements.center_row.TITLE}</strong></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row<!-- IF announcements_center_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<tr class="row<!-- IF announcements.center_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<td style="padding:5px 5px 5px 5px;">
|
||||
|
||||
<span class="gensmall" style="float: left;">{L_POSTED} {L_POST_BY_AUTHOR}{L_COLON} {announcements_center_row.POSTER_FULL} » {announcements_center_row.TIME}</span>
|
||||
<span class="gensmall" style="float: left;">{L_POSTED} {L_POST_BY_AUTHOR}{L_COLON} {announcements.center_row.POSTER_FULL} » {announcements.center_row.TIME}</span>
|
||||
<span class="gensmall" style="float: right;">
|
||||
<!-- IF announcements_center_row.FORUM_NAME -->
|
||||
{L_FORUM}{L_COLON} <strong><a href="{announcements_center_row.U_VIEWFORUM}">{announcements_center_row.FORUM_NAME}</a></strong>
|
||||
<!-- IF announcements.center_row.FORUM_NAME -->
|
||||
{L_FORUM}{L_COLON} <strong><a href="{announcements.center_row.U_VIEWFORUM}">{announcements.center_row.FORUM_NAME}</a></strong>
|
||||
<!-- ELSE -->
|
||||
{L_GLOBAL_ANNOUNCEMENT}
|
||||
<!-- ENDIF -->
|
||||
</span>
|
||||
<br /><br />
|
||||
<div class="postbody">
|
||||
{announcements_center_row.TEXT}
|
||||
{announcements.center_row.TEXT}
|
||||
</div>
|
||||
<!-- IF announcements_center_row.S_HAS_ATTACHMENTS -->
|
||||
<!-- IF announcements.center_row.S_HAS_ATTACHMENTS -->
|
||||
<br clear="all" /><br />
|
||||
|
||||
<table class="tablebg" width="100%" cellspacing="1">
|
||||
@@ -39,30 +41,30 @@
|
||||
</tr>
|
||||
<!-- BEGIN attachment -->
|
||||
<tr>
|
||||
<!-- IF announcements_center_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{announcements_center_row.attachment.DISPLAY_ATTACHMENT}</td>
|
||||
<!-- IF announcements.center_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{announcements.center_row.attachment.DISPLAY_ATTACHMENT}</td>
|
||||
</tr>
|
||||
<!-- END attachment -->
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<br /><br />
|
||||
<!-- IF announcements_center_row.PAGINATION --><span style="float: right;">[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {announcements_center_row.PAGINATION} ]</span><!-- ENDIF -->
|
||||
<!-- IF announcements.center_row.PAGINATION --><span style="float: right;">[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {announcements.center_row.PAGINATION} ]</span><!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row<!-- IF announcements_center_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<tr class="row<!-- IF announcements.center_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<td>
|
||||
<span style="float: left;">{L_TOPIC_VIEWS}{L_COLON} {announcements_center_row.TOPIC_VIEWS} • <a href="{announcements_center_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {announcements_center_row.REPLIES}</a> • <a href="{announcements_center_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span>
|
||||
<span style="float: right;">{announcements_center_row.OPEN}<a href="{announcements_center_row.U_READ_FULL}">{announcements_center_row.L_READ_FULL}</a>{announcements_center_row.CLOSE} <a href="#wrapheader" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span>
|
||||
<span style="float: left;">{L_TOPIC_VIEWS}{L_COLON} {announcements.center_row.TOPIC_VIEWS} • <a href="{announcements.center_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {announcements.center_row.REPLIES}</a> • <a href="{announcements.center_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span>
|
||||
<span style="float: right;">{announcements.center_row.OPEN}<a href="{announcements.center_row.U_READ_FULL}">{announcements.center_row.L_READ_FULL}</a>{announcements.center_row.CLOSE} <a href="#wrapheader" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- IF announcements_center_row.S_NOT_LAST --><br /><!-- ENDIF -->
|
||||
<!-- IF announcements_center_row.S_LAST_ROW and (AP_PAGINATION or TOTAL_ANNOUNCEMENTS) -->
|
||||
<!-- IF announcements.center_row.S_NOT_LAST --><br /><!-- ENDIF -->
|
||||
<!-- IF announcements.center_row.S_LAST_ROW and (announcements.AP_PAGINATION or announcements.TOTAL_ANNOUNCEMENTS) -->
|
||||
<hr />
|
||||
<table width="100%" cellspacing="0">
|
||||
<tr>
|
||||
<td class="gensmall portal-pagination" valign="middle" align="right" nowrap="nowrap">
|
||||
{TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF AP_PAGE_NUMBER --><!-- IF AP_PAGINATION --> • {AP_PAGE_NUMBER} • {AP_PAGINATION}<!-- ELSE --> • {AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
{announcements.TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF announcements.AP_PAGE_NUMBER --><!-- IF announcements.AP_PAGINATION --> • {announcements.AP_PAGE_NUMBER} • {announcements.AP_PAGINATION}<!-- ELSE --> • {announcements.AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -71,7 +73,9 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- IF announcements_center_row.S_LAST_ROW -->
|
||||
<!-- IF announcements.center_row.S_LAST_ROW -->
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- END announcements_center_row -->
|
||||
<!-- END center_row -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END announcements -->
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
<!-- BEGIN announcements_center_row -->
|
||||
<!-- IF announcements_center_row.S_FIRST_ROW -->
|
||||
{$C_BLOCK_H_L}{$TITLE} <a name="a"></a>{$C_BLOCK_H_R}
|
||||
<!-- BEGIN announcements -->
|
||||
<!-- IF announcements.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN center_row -->
|
||||
<!-- IF announcements.center_row.S_FIRST_ROW -->
|
||||
{$C_BLOCK_H_L}{$TITLE} <a name="a_{$MODULE_ID}"></a>{$C_BLOCK_H_R}
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<!-- IF not announcements_center_row.S_NO_TOPICS -->
|
||||
<!-- IF not announcements.center_row.S_NO_TOPICS -->
|
||||
<tr class="nav">
|
||||
<!-- IF S_TOPIC_ICONS -->
|
||||
<!-- IF announcements.S_TOPIC_ICONS -->
|
||||
<td class="cat" align="center" colspan="3"> {L_TOPICS} </td>
|
||||
<!-- ELSE -->
|
||||
<td class="cat" align="center" colspan="2"> {L_TOPICS} </td>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<!-- IF announcements.S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<td class="cat" align="center"> {L_REPLIES} </td>
|
||||
<td class="cat" align="center"> {L_VIEWS} </td>
|
||||
<!-- ENDIF -->
|
||||
@@ -17,7 +19,7 @@
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF announcements_center_row.S_NO_TOPICS -->
|
||||
<!-- IF announcements.center_row.S_NO_TOPICS -->
|
||||
<tr class="row1">
|
||||
<td align="center">
|
||||
<span class="gensmall"><strong>{L_NO_ANNOUNCEMENTS}</strong></span>
|
||||
@@ -25,40 +27,42 @@
|
||||
</tr>
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td class="row1" width="25" align="center">{announcements_center_row.TOPIC_FOLDER_IMG}</td>
|
||||
<!-- IF S_TOPIC_ICONS --><td class="row1" width="25" align="center"><!-- IF announcements_center_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{announcements_center_row.TOPIC_ICON_IMG}" width="{announcements_center_row.TOPIC_ICON_IMG_WIDTH}" height="{announcements_center_row.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td><!-- ENDIF -->
|
||||
<td class="row1" width="25" align="center">{announcements.center_row.TOPIC_FOLDER_IMG}</td>
|
||||
<!-- IF announcements.S_TOPIC_ICONS --><td class="row1" width="25" align="center"><!-- IF announcements.center_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{announcements.center_row.TOPIC_ICON_IMG}" width="{announcements.center_row.TOPIC_ICON_IMG_WIDTH}" height="{announcements.center_row.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td><!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- IF announcements_center_row.PAGINATION --><span style="float: right; font-size:0.9em;"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {announcements_center_row.PAGINATION} ] </span><!-- ENDIF -->
|
||||
{announcements_center_row.ATTACH_ICON_IMG} <!-- IF announcements_center_row.S_POLL --> <strong style="font-size:1.1em;">{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><a title="{announcements_center_row.TITLE}" href="{announcements_center_row.U_VIEW_COMMENTS}" class="topictitle">{announcements_center_row.TITLE}</a>
|
||||
<p class="gensmall">{L_POSTED} {L_POST_BY_AUTHOR} {announcements_center_row.POSTER_FULL} » {announcements_center_row.TIME}
|
||||
<!-- IF announcements_center_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{announcements_center_row.U_VIEWFORUM}" style="font-weight: bold;">{announcements_center_row.FORUM_NAME}</a>
|
||||
<!-- IF announcements.center_row.PAGINATION --><span style="float: right; font-size:0.9em;"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {announcements.center_row.PAGINATION} ] </span><!-- ENDIF -->
|
||||
{announcements.center_row.ATTACH_ICON_IMG} <!-- IF announcements.center_row.S_POLL --> <strong style="font-size:1.1em;">{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><a title="{announcements.center_row.TITLE}" href="{announcements.center_row.U_VIEW_COMMENTS}" class="topictitle">{announcements.center_row.TITLE}</a>
|
||||
<p class="gensmall">{L_POSTED} {L_POST_BY_AUTHOR} {announcements.center_row.POSTER_FULL} » {announcements.center_row.TIME}
|
||||
<!-- IF announcements.center_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{announcements.center_row.U_VIEWFORUM}" style="font-weight: bold;">{announcements.center_row.FORUM_NAME}</a>
|
||||
<!-- ELSE -->
|
||||
{L_GLOBAL_ANNOUNCEMENT}
|
||||
<!-- ENDIF -->
|
||||
<!-- IF not S_DISPLAY_ANNOUNCEMENTS_RVS --><!-- IF announcements_center_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{announcements_center_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{announcements_center_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
<!-- IF not announcements.S_DISPLAY_ANNOUNCEMENTS_RVS --><!-- IF announcements.center_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{announcements.center_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{announcements.center_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
</p>
|
||||
</td>
|
||||
<!-- IF S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<td class="row1" width="50" align="center"><p class="topicdetails">{announcements_center_row.REPLIES}</p></td>
|
||||
<td class="row2" width="50" align="center"><p class="topicdetails">{announcements_center_row.TOPIC_VIEWS}</p></td>
|
||||
<!-- IF announcements.S_DISPLAY_ANNOUNCEMENTS_RVS -->
|
||||
<td class="row1" width="50" align="center"><p class="topicdetails">{announcements.center_row.REPLIES}</p></td>
|
||||
<td class="row2" width="50" align="center"><p class="topicdetails">{announcements.center_row.TOPIC_VIEWS}</p></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1" width="140" align="center">
|
||||
<p class="topicdetails" style="white-space: nowrap;"> {announcements_center_row.LAST_POST_TIME}</p>
|
||||
<p class="topicdetails">{announcements_center_row.USERNAME_FULL_LAST}
|
||||
<!-- IF not S_IS_BOT --><!-- IF announcements_center_row.S_UNREAD_INFO --><a href="{announcements_center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements_center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><!-- ENDIF -->
|
||||
<p class="topicdetails" style="white-space: nowrap;"> {announcements.center_row.LAST_POST_TIME}</p>
|
||||
<p class="topicdetails">{announcements.center_row.USERNAME_FULL_LAST}
|
||||
<!-- IF not S_IS_BOT --><!-- IF announcements.center_row.S_UNREAD_INFO --><a href="{announcements.center_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements.center_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><!-- ENDIF -->
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF announcements_center_row.S_LAST_ROW -->
|
||||
<!-- IF AP_PAGINATION or TOTAL_ANNOUNCEMENTS -->
|
||||
<tr class="row<!-- IF announcements_center_row.S_ROW_COUNT is even -->2<!-- ELSE -->1<!-- ENDIF -->">
|
||||
<td class="gensmall portal-pagination" valign="middle" align="right" nowrap="nowrap" colspan="<!-- IF S_TOPIC_ICONS and S_DISPLAY_ANNOUNCEMENTS_RVS -->6<!-- ELSEIF not S_TOPIC_ICONS and S_DISPLAY_ANNOUNCEMENTS_RVS -->5<!-- ELSEIF S_TOPIC_ICONS and not S_DISPLAY_ANNOUNCEMENTS_RVS -->4<!-- ELSE -->3<!-- ENDIF -->">{TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF AP_PAGE_NUMBER --><!-- IF AP_PAGINATION --> • {AP_PAGE_NUMBER} • {AP_PAGINATION}<!-- ELSE --> • {AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
|
||||
<!-- IF announcements.center_row.S_LAST_ROW -->
|
||||
<!-- IF announcements.AP_PAGINATION or announcements.TOTAL_ANNOUNCEMENTS -->
|
||||
<tr class="row<!-- IF announcements.center_row.S_ROW_COUNT is even -->2<!-- ELSE -->1<!-- ENDIF -->">
|
||||
<td class="gensmall portal-pagination" valign="middle" align="right" nowrap="nowrap" colspan="<!-- IF announcements.S_TOPIC_ICONS and announcements.S_DISPLAY_ANNOUNCEMENTS_RVS -->6<!-- ELSEIF not announcements.S_TOPIC_ICONS and announcements.S_DISPLAY_ANNOUNCEMENTS_RVS -->5<!-- ELSEIF announcements.S_TOPIC_ICONS and not announcements.S_DISPLAY_ANNOUNCEMENTS_RVS -->4<!-- ELSE -->3<!-- ENDIF -->">{TOTAL_ANNOUNCEMENTS}
|
||||
<!-- IF announcements.AP_PAGE_NUMBER --><!-- IF announcements.AP_PAGINATION --> • {announcements.AP_PAGE_NUMBER} • {announcements.AP_PAGINATION}<!-- ELSE --> • {announcements.AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</table>
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- END announcements_center_row -->
|
||||
<!-- END center_row -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END announcements -->
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<!-- BEGIN portal_links -->
|
||||
<!-- IF portal_links.MODULE_ID eq $MODULE_ID -->
|
||||
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<!-- BEGIN portallinks -->
|
||||
<!-- BEGIN links -->
|
||||
<tr class="row1">
|
||||
<td>
|
||||
<!-- IF $MODULE_ID eq portallinks.MODULE_ID --><a class="portal-arrow-bullet" href="{portallinks.LINK_URL}" title="{portallinks.LINK_TITLE}" <!-- IF portallinks.NEW_WINDOW -->onclick="window.open('{portallinks.LINK_URL}'); return false;"<!-- ENDIF -->> {portallinks.LINK_TITLE}</a><!-- ENDIF -->
|
||||
<a class="portal-arrow-bullet" href="{portal_links.links.LINK_URL}" title="{portal_links.links.LINK_TITLE}" <!-- IF portal_links.links.NEW_WINDOW -->onclick="window.open('{portal_links.links.LINK_URL}'); return false;"<!-- ENDIF -->> {portal_links.links.LINK_TITLE}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGINELSE -->
|
||||
@@ -12,6 +14,8 @@
|
||||
<span style="float: left" class="gensmall"><strong>{L_LINKS_NO_LINKS}</strong></span><br />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END portallinks -->
|
||||
<!-- END links -->
|
||||
</table>
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- END portal_links -->
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
<!-- BEGIN portal_menu -->
|
||||
<!-- IF portal_menu.MODULE_ID eq $MODULE_ID -->
|
||||
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<!-- BEGIN portalmenu -->
|
||||
<!-- IF $MODULE_ID eq portalmenu.MODULE_ID -->
|
||||
<!-- BEGIN category -->
|
||||
<tr class="row3">
|
||||
<td>
|
||||
<strong>{portalmenu.CAT_TITLE}</strong>
|
||||
<strong>{portal_menu.category.CAT_TITLE}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN links -->
|
||||
<tr class="row1">
|
||||
<td>
|
||||
<a class="portal-arrow-bullet" href="{portalmenu.links.LINK_URL}" title="{portalmenu.links.LINK_TITLE}" <!-- IF portalmenu.links.NEW_WINDOW -->onclick="window.open('{portalmenu.links.LINK_URL}'); return false;"<!-- ENDIF -->> {portalmenu.links.LINK_TITLE}</a>
|
||||
<a class="portal-arrow-bullet" href="{portal_menu.category.links.LINK_URL}" title="{portal_menu.category.links.LINK_TITLE}" <!-- IF portal_menu.category.links.NEW_WINDOW -->onclick="window.open('{portal_menu.category.links.LINK_URL}'); return false;"<!-- ENDIF -->> {portal_menu.category.links.LINK_TITLE}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END links -->
|
||||
<!-- ENDIF -->
|
||||
<!-- BEGINELSE -->
|
||||
<tr class="row1">
|
||||
<td>
|
||||
<span style="float:left;" class="gensmall"><strong>{L_MENU_NO_LINKS}</strong></span><br />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END portalmenu -->
|
||||
<!-- END category -->
|
||||
</table>
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- END portal_menu -->
|
||||
|
||||
@@ -2,29 +2,31 @@
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<tr class="row1">
|
||||
<td>
|
||||
<!-- BEGIN news -->
|
||||
<!-- IF news.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN news_row -->
|
||||
<!-- IF news_row.S_NO_TOPICS -->
|
||||
<!-- IF news.news_row.S_NO_TOPICS -->
|
||||
<span class="gensmall"><strong>{L_NO_NEWS}</strong></span>
|
||||
<!-- ELSE -->
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<tr>
|
||||
<td class="cat">
|
||||
<a name="n"></a><a name="n{news_row.N_ID}"></a>
|
||||
<!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><!-- IF news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}" width="{news_row.TOPIC_ICON_IMG_WIDTH}" height="{news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{news_row.U_LAST_COMMENTS}"><strong>{news_row.TITLE}</strong></a></td>
|
||||
<!-- IF news.news_row.S_FIRST_ROW --><a id="n_{$MODULE_ID}"></a><!-- ENDIF --><a name="n_{$MODULE_ID}_{news.news_row.N_ID}"></a>
|
||||
<!-- IF news.news_row.S_UNREAD_INFO --><a href="{news.news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news.news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news.news_row.ATTACH_ICON_IMG} <!-- IF news.news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}{L_COLON} </strong><!-- ENDIF --><!-- IF news.news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news.news_row.TOPIC_ICON_IMG}" width="{news.news_row.TOPIC_ICON_IMG_WIDTH}" height="{news.news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{news.news_row.U_LAST_COMMENTS}"><strong>{news.news_row.TITLE}</strong></a></td>
|
||||
</tr>
|
||||
<tr class="row<!-- IF news_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<tr class="row<!-- IF news.news_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<td style="padding:5px 5px 5px 5px;">
|
||||
<span class="gensmall" style="float: left;">{L_POSTED} {L_POST_BY_AUTHOR}{L_COLON} {news_row.POSTER_FULL} » {news_row.TIME}</span>
|
||||
<span class="gensmall" style="float: left;">{L_POSTED} {L_POST_BY_AUTHOR}{L_COLON} {news.news_row.POSTER_FULL} » {news.news_row.TIME}</span>
|
||||
<span class="gensmall" style="float: right;">
|
||||
<!-- IF news_row.FORUM_NAME -->
|
||||
{L_FORUM}{L_COLON} <strong><a href="{news_row.U_VIEWFORUM}">{news_row.FORUM_NAME}</a></strong>
|
||||
<!-- IF news.news_row.FORUM_NAME -->
|
||||
{L_FORUM}{L_COLON} <strong><a href="{news.news_row.U_VIEWFORUM}">{news.news_row.FORUM_NAME}</a></strong>
|
||||
<!-- ENDIF -->
|
||||
</span>
|
||||
<br /><br />
|
||||
<div class="postbody">
|
||||
{news_row.TEXT}
|
||||
{news.news_row.TEXT}
|
||||
</div>
|
||||
<!-- IF news_row.S_HAS_ATTACHMENTS -->
|
||||
<!-- IF news.news_row.S_HAS_ATTACHMENTS -->
|
||||
<br clear="all" /><br />
|
||||
|
||||
<table class="tablebg" width="100%" cellspacing="1">
|
||||
@@ -33,35 +35,37 @@
|
||||
</tr>
|
||||
<!-- BEGIN attachment -->
|
||||
<tr>
|
||||
<!-- IF news_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{news_row.attachment.DISPLAY_ATTACHMENT}</td>
|
||||
<!-- IF news.news_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{news.news_row.attachment.DISPLAY_ATTACHMENT}</td>
|
||||
</tr>
|
||||
<!-- END attachment -->
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<br /><br />
|
||||
<!-- IF news_row.PAGINATION --><span style="float: right;">[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {news_row.PAGINATION} ]</span><!-- ENDIF -->
|
||||
<!-- IF news.news_row.PAGINATION --><span style="float: right;">[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {news.news_row.PAGINATION} ]</span><!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row<!-- IF news_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<tr class="row<!-- IF news.news_row.S_ROW_COUNT is odd -->1<!-- ELSE -->2<!-- ENDIF -->">
|
||||
<td>
|
||||
<span style="float: left;">{L_TOPIC_VIEWS}{L_COLON} {news_row.TOPIC_VIEWS} • <a href="{news_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {news_row.REPLIES}</a> • <a href="{news_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span>
|
||||
<span style="float: right;">{news_row.OPEN}<a href="{news_row.U_READ_FULL}">{news_row.L_READ_FULL}</a>{news_row.CLOSE} <a href="#wrapheader" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span>
|
||||
<span style="float: left;">{L_TOPIC_VIEWS}{L_COLON} {news.news_row.TOPIC_VIEWS} • <a href="{news.news_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}{L_COLON} {news.news_row.REPLIES}</a> • <a href="{news.news_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span>
|
||||
<span style="float: right;">{news.news_row.OPEN}<a href="{news.news_row.U_READ_FULL}">{news.news_row.L_READ_FULL}</a>{news.news_row.CLOSE} <a href="#wrapheader" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<!-- ENDIF -->
|
||||
<!-- END news_row -->
|
||||
<!-- IF NP_PAGINATION or TOTAL_NEWS -->
|
||||
<hr />
|
||||
<table width="100%" cellspacing="0">
|
||||
<tr>
|
||||
<td class="gensmall portal-pagination" valign="middle" align="right" nowrap="nowrap">
|
||||
{TOTAL_NEWS}
|
||||
<!-- IF NP_PAGE_NUMBER --><!-- IF NP_PAGINATION --> • {NP_PAGE_NUMBER} • {NP_PAGINATION}<!-- ELSE --> • {NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF news.NP_PAGINATION or news.TOTAL_NEWS -->
|
||||
<hr />
|
||||
<table width="100%" cellspacing="0">
|
||||
<tr>
|
||||
<td class="gensmall portal-pagination" valign="middle" align="right" nowrap="nowrap">
|
||||
{news.TOTAL_NEWS}
|
||||
<!-- IF news.NP_PAGE_NUMBER --><!-- IF news.NP_PAGINATION --> • {news.NP_PAGE_NUMBER} • {news.NP_PAGINATION}<!-- ELSE --> • {news.NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END news -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<div id="pagecontent">
|
||||
<!-- BEGIN news -->
|
||||
<!-- IF news.MODULE_ID eq $MODULE_ID -->
|
||||
<!-- BEGIN news_row -->
|
||||
<!-- IF news_row.S_FIRST_ROW -->
|
||||
{$C_BLOCK_H_L}{$TITLE} <a name="n"></a>{$C_BLOCK_H_R}
|
||||
<!-- IF news.news_row.S_FIRST_ROW -->
|
||||
{$C_BLOCK_H_L}{$TITLE} <a id="n_{$MODULE_ID}"></a>{$C_BLOCK_H_R}
|
||||
<table class="tablebg" cellspacing="1" width="100%">
|
||||
<!-- IF not news_row.S_NO_TOPICS -->
|
||||
<!-- IF not news.news_row.S_NO_TOPICS -->
|
||||
<tr class="nav">
|
||||
<!-- IF S_TOPIC_ICONS -->
|
||||
<!-- IF news.S_TOPIC_ICONS -->
|
||||
<td class="cat" align="center" colspan="3"> {L_TOPICS} </td>
|
||||
<!-- ELSE -->
|
||||
<td class="cat" align="center" colspan="2"> {L_TOPICS} </td>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_DISPLAY_NEWS_RVS -->
|
||||
<!-- IF news.S_DISPLAY_NEWS_RVS -->
|
||||
<td class="cat" align="center"> {L_REPLIES} </td>
|
||||
<td class="cat" align="center"> {L_VIEWS} </td>
|
||||
<!-- ENDIF -->
|
||||
@@ -18,7 +19,7 @@
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF news_row.S_NO_TOPICS -->
|
||||
<!-- IF news.news_row.S_NO_TOPICS -->
|
||||
<tr class="row1">
|
||||
<td align="center">
|
||||
<span class="gensmall"><strong>{L_NO_NEWS}</strong></span>
|
||||
@@ -26,39 +27,40 @@
|
||||
</tr>
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td class="row1" width="25" align="center">{news_row.TOPIC_FOLDER_IMG}</td>
|
||||
<!-- IF S_TOPIC_ICONS --><td class="row1" width="25" align="center"><!-- IF news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}" width="{news_row.TOPIC_ICON_IMG_WIDTH}" height="{news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td><!-- ENDIF -->
|
||||
<td class="row1" width="25" align="center">{news.news_row.TOPIC_FOLDER_IMG}</td>
|
||||
<!-- IF S_TOPIC_ICONS --><td class="row1" width="25" align="center"><!-- IF news.news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news.news_row.TOPIC_ICON_IMG}" width="{news.news_row.TOPIC_ICON_IMG_WIDTH}" height="{news.news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td><!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- IF news_row.PAGINATION --><span style="float: right; font-size:0.9em;"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {news_row.PAGINATION} ] </span><!-- ENDIF -->
|
||||
{news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --> <strong style="font-size:1.1em;">{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF --><a title="{news_row.TITLE}" href="{news_row.U_VIEW_COMMENTS}" class="topictitle">{news_row.TITLE}</a>
|
||||
<p class="gensmall">{L_POSTED} {L_POST_BY_AUTHOR} {news_row.POSTER_FULL} » {news_row.TIME}
|
||||
<!-- IF news_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{news_row.U_VIEWFORUM}" style="font-weight: bold;">{news_row.FORUM_NAME}</a>
|
||||
<!-- IF news.news_row.PAGINATION --><span style="float: right; font-size:0.9em;"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} {news.news_row.PAGINATION} ] </span><!-- ENDIF -->
|
||||
{news.news_row.ATTACH_ICON_IMG} <!-- IF news.news_row.S_POLL --> <strong style="font-size:1.1em;">{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF --><a title="{news.news_row.TITLE}" href="{news.news_row.U_VIEW_COMMENTS}" class="topictitle">{news.news_row.TITLE}</a>
|
||||
<p class="gensmall">{L_POSTED} {L_POST_BY_AUTHOR} {news.news_row.POSTER_FULL} » {news.news_row.TIME}
|
||||
<!-- IF news.news_row.FORUM_NAME -->
|
||||
<br />{L_FORUM}{L_COLON} <a href="{news.news_row.U_VIEWFORUM}" style="font-weight: bold;">{news.news_row.FORUM_NAME}</a>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF not S_DISPLAY_NEWS_RVS --><!-- IF news_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{news_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{news_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
<!-- IF not news.S_DISPLAY_NEWS_RVS --><!-- IF news.news_row.FORUM_NAME -->• <!-- ENDIF -->{L_REPLIES}{L_COLON} <strong>{news.news_row.REPLIES}</strong> • {L_VIEWS}{L_COLON} <strong>{news.news_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
|
||||
</p>
|
||||
</td>
|
||||
<!-- IF S_DISPLAY_NEWS_RVS -->
|
||||
<td class="row1" width="50" align="center"><p class="topicdetails">{news_row.REPLIES}</p></td>
|
||||
<td class="row2" width="50" align="center"><p class="topicdetails">{news_row.TOPIC_VIEWS}</p></td>
|
||||
<!-- IF news.S_DISPLAY_NEWS_RVS -->
|
||||
<td class="row1" width="50" align="center"><p class="topicdetails">{news.news_row.REPLIES}</p></td>
|
||||
<td class="row2" width="50" align="center"><p class="topicdetails">{news.news_row.TOPIC_VIEWS}</p></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1" width="140" align="center">
|
||||
<p class="topicdetails" style="white-space: nowrap;"> {news_row.LAST_POST_TIME}</p>
|
||||
<p class="topicdetails">{news_row.USERNAME_FULL_LAST}
|
||||
<!-- IF not S_IS_BOT --><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><!-- ENDIF -->
|
||||
<p class="topicdetails" style="white-space: nowrap;"> {news.news_row.LAST_POST_TIME}</p>
|
||||
<p class="topicdetails">{news.news_row.USERNAME_FULL_LAST}
|
||||
<!-- IF not S_IS_BOT --><!-- IF news.news_row.S_UNREAD_INFO --><a href="{news.news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news.news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><!-- ENDIF -->
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF news_row.S_LAST_ROW -->
|
||||
<!-- IF NP_PAGINATION or TOTAL_NEWS -->
|
||||
<tr class="row<!-- IF news_row.S_ROW_COUNT is even -->2<!-- ELSE -->1<!-- ENDIF -->">
|
||||
<td class="gensmall portal-pagination" valign="middle" align="right" nowrap="nowrap" colspan="<!-- IF S_TOPIC_ICONS and S_DISPLAY_NEWS_RVS -->6<!-- ELSEIF not S_TOPIC_ICONS and S_DISPLAY_NEWS_RVS -->5<!-- ELSEIF S_TOPIC_ICONS and not S_DISPLAY_NEWS_RVS -->4<!-- ELSE -->3<!-- ENDIF -->">{TOTAL_NEWS}
|
||||
<!-- IF NP_PAGE_NUMBER --><!-- IF NP_PAGINATION --> • {NP_PAGE_NUMBER} • {NP_PAGINATION}<!-- ELSE --> • {NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
|
||||
<!-- IF news.news_row.S_LAST_ROW -->
|
||||
<!-- IF news.NP_PAGINATION or news.TOTAL_NEWS -->
|
||||
<tr class="row<!-- IF news.news_row.S_ROW_COUNT is even -->2<!-- ELSE -->1<!-- ENDIF -->">
|
||||
<td class="gensmall portal-pagination" valign="middle" align="right" nowrap="nowrap" colspan="<!-- IF news.S_TOPIC_ICONS and news.S_DISPLAY_NEWS_RVS -->6<!-- ELSEIF not news.S_TOPIC_ICONS and news.S_DISPLAY_NEWS_RVS -->5<!-- ELSEIF news.S_TOPIC_ICONS and not news.S_DISPLAY_NEWS_RVS -->4<!-- ELSE -->3<!-- ENDIF -->">{news.TOTAL_NEWS}
|
||||
<!-- IF news.NP_PAGE_NUMBER --><!-- IF news.NP_PAGINATION --> • {news.NP_PAGE_NUMBER} • {news.NP_PAGINATION}<!-- ELSE --> • {news.NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</table>
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
<!-- END news_row -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<!-- END news -->
|
||||
|
||||
@@ -69,7 +69,7 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
|
||||
$this->assertContains('The module was removed successfully.', $crawler->text());
|
||||
|
||||
// Add it back
|
||||
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&add[center]=true&sid=' . $this->sid);
|
||||
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&add[center]=true&module_column=2&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('submit')->form();
|
||||
$form->setValues(array('module_classname' => $module_name));
|
||||
self::submit($form);
|
||||
@@ -109,4 +109,34 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
|
||||
$crawler = self::request('GET', 'app.php/portal?sid=' . $this->sid);
|
||||
$this->assertContains('foobar', $crawler->text());
|
||||
}
|
||||
|
||||
public function data_add_second_module()
|
||||
{
|
||||
return array(
|
||||
array('\board3\portal\modules\news', 2, 'The module was added successfully.'),
|
||||
array('\board3\portal\modules\news', 1, 'It is not possible to add the module to the selected column.', true),
|
||||
array('\board3\portal\modules\attachments', 2, 'The module was added successfully'),
|
||||
array('\board3\portal\modules\attachments', 2, 'This module can only be added once', true),
|
||||
array('\board3\portal\modules\attachments', 1, 'This module can only be added once', true),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_add_second_module
|
||||
*/
|
||||
public function test_add_second_news($module_class, $column, $expected_message, $incomplete = false)
|
||||
{
|
||||
// Mark tests as incomplete that can't be run with the current DomCrawler
|
||||
if ($incomplete)
|
||||
{
|
||||
$this->markTestIncomplete('Cannot select invalid value in select in current DomCrawler');
|
||||
}
|
||||
|
||||
$this->add_lang_ext('board3/portal', 'info_acp_portal');
|
||||
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=modules&add_column=' . $column . '&add[center]=add&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('submit')->form();
|
||||
$form->setValues(array('module_classname' => $module_class));
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($expected_message, $crawler->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\acp;
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../../includes/functions.php');
|
||||
require_once(dirname(__FILE__) . '/../../../acp/portal_module.php');
|
||||
@@ -17,6 +17,19 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
static public $redirected = false;
|
||||
static public $error = false;
|
||||
static public $override_trigger_error = false;
|
||||
static public $error_type = E_USER_NOTICE;
|
||||
|
||||
/** @var \board3\portal\portal\modules\manager */
|
||||
protected $modules_manager;
|
||||
|
||||
/** @var \board3\portal\portal\columns */
|
||||
protected $portal_columns;
|
||||
|
||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||
protected $constraints_handler;
|
||||
|
||||
/** @var \board3\portal\includes\helper */
|
||||
protected $portal_helper;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -39,10 +52,13 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $phpbb_root_path, $phpEx),
|
||||
new \board3\portal\modules\donation($config, $template, $user),
|
||||
));
|
||||
$phpbb_container->set('board3.portal.helper', new \board3\portal\includes\helper($phpbb_container->get('board3.portal.module_collection')));
|
||||
$this->portal_helper = new \board3\portal\includes\helper($phpbb_container->get('board3.portal.module_collection'));
|
||||
$phpbb_container->set('board3.portal.helper', $this->portal_helper);
|
||||
$phpbb_container->set('board3.portal.modules_helper', new \board3\portal\includes\modules_helper(new \phpbb\auth\auth(), $config, $request));
|
||||
$phpbb_container->setParameter('board3.portal.modules.table', $table_prefix . 'portal_modules');
|
||||
$phpbb_container->setParameter('board3.portal.config.table', $table_prefix . 'portal_config');
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$phpbb_container->set('board3.portal.columns', $this->portal_columns);
|
||||
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));
|
||||
$cache->expects($this->any())
|
||||
->method('destroy')
|
||||
@@ -62,17 +78,22 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||
));
|
||||
$this->database_handler = new \board3\portal\portal\modules\database_handler($db);
|
||||
$this->constraints_handler = new \board3\portal\portal\modules\constraints_handler($this->portal_columns, $user);
|
||||
$this->modules_manager = new \board3\portal\portal\modules\manager($cache, $db, $this->portal_columns, $this->portal_helper, $this->constraints_handler, $this->database_handler, $request, $user);
|
||||
$phpbb_container->set('board3.portal.modules.manager', $this->modules_manager);
|
||||
$phpbb_container->set('board3.portal.modules.constraints_handler', $this->constraints_handler);
|
||||
$this->portal_module = new \board3\portal\acp\portal_module();
|
||||
$this->update_portal_modules();
|
||||
}
|
||||
|
||||
protected function update_portal_modules()
|
||||
{
|
||||
$this->portal_module->module_column = array();
|
||||
$this->constraints_handler->module_column = array();
|
||||
$portal_modules = obtain_portal_modules();
|
||||
foreach($portal_modules as $cur_module)
|
||||
{
|
||||
$this->portal_module->module_column[$cur_module['module_classname']][] = column_num_string($cur_module['module_column']);
|
||||
$this->constraints_handler->module_column[$cur_module['module_classname']][] = $this->portal_columns->number_to_string($cur_module['module_column']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,11 +104,18 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
|
||||
public function test_get_move_module_data()
|
||||
{
|
||||
$module_data = $this->portal_module->get_move_module_data(1);
|
||||
$module_data = $this->modules_manager->get_move_module_data(1);
|
||||
$this->assertEquals(array(
|
||||
'module_order' => 1,
|
||||
'module_column' => 1,
|
||||
'module_order' => '1',
|
||||
'module_column' => '1',
|
||||
'module_classname' => '\board3\portal\modules\clock',
|
||||
'module_id' => '1',
|
||||
'module_name' => '',
|
||||
'module_image_src' => '',
|
||||
'module_image_width' => '0',
|
||||
'module_image_height' => '0',
|
||||
'module_group_ids' => '',
|
||||
'module_status' => '1',
|
||||
), $module_data);
|
||||
}
|
||||
|
||||
@@ -106,30 +134,30 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
*/
|
||||
public function test_get_last_module_order($expected, $column)
|
||||
{
|
||||
$this->assertEquals($expected, $this->portal_module->get_last_module_order($column));
|
||||
$this->assertEquals($expected, $this->modules_manager->get_last_module_order($column));
|
||||
}
|
||||
|
||||
public function test_move_module_up()
|
||||
{
|
||||
self::$redirected = false;
|
||||
$this->portal_module->move_module_up(2);
|
||||
$this->modules_manager->move_module_vertical(2, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_UP);
|
||||
$this->assertTrue(self::$redirected);
|
||||
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE_ROW');
|
||||
self::$redirected = false;
|
||||
$this->portal_module->move_module_up(2);
|
||||
$this->modules_manager->move_module_vertical(2, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_UP);
|
||||
$this->assertFalse(self::$redirected);
|
||||
}
|
||||
|
||||
public function test_move_module_down()
|
||||
{
|
||||
self::$redirected = false;
|
||||
$this->portal_module->move_module_down(3);
|
||||
$this->modules_manager->move_module_vertical(3, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_DOWN);
|
||||
$this->assertTrue(self::$redirected);
|
||||
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE_ROW');
|
||||
self::$redirected = false;
|
||||
$this->portal_module->move_module_down(3);
|
||||
$this->modules_manager->move_module_vertical(3, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_DOWN);
|
||||
$this->assertFalse(self::$redirected);
|
||||
}
|
||||
|
||||
@@ -156,7 +184,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
self::$redirected = false;
|
||||
}
|
||||
|
||||
$this->portal_module->handle_after_move($success, $is_row);
|
||||
$this->modules_manager->handle_after_move($success, $is_row);
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
@@ -184,26 +212,26 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
if ($column_start > 3)
|
||||
{
|
||||
$this->setExpectedTriggerError(E_USER_ERROR, 'CLASS_NOT_FOUND');
|
||||
$this->portal_module->move_module_right($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_RIGHT);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($add_to_column)
|
||||
{
|
||||
$module_data = $this->portal_module->get_move_module_data($module_id);
|
||||
$this->portal_module->module_column[$module_data['module_classname']][] = column_num_string($add_to_column);
|
||||
$module_data = $this->modules_manager->get_move_module_data($module_id);
|
||||
$this->constraints_handler->module_column[$module_data['module_classname']][] = $this->portal_columns->number_to_string($add_to_column);
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= $move_right; $i++)
|
||||
{
|
||||
$data = $this->portal_module->get_move_module_data($module_id);
|
||||
$data = $this->modules_manager->get_move_module_data($module_id);
|
||||
$this->assertEquals($column_start, $data['module_column']);
|
||||
$this->portal_module->move_module_right($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_RIGHT);
|
||||
$column_start++;
|
||||
$this->update_portal_modules();
|
||||
}
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE');
|
||||
$this->portal_module->move_module_right($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_RIGHT);
|
||||
}
|
||||
|
||||
public function data_move_module_left()
|
||||
@@ -226,37 +254,37 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
if ($column_start > 3)
|
||||
{
|
||||
$this->setExpectedTriggerError(E_USER_ERROR, 'CLASS_NOT_FOUND');
|
||||
$this->portal_module->move_module_left($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_LEFT);
|
||||
return;
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= $move_right; $i++)
|
||||
{
|
||||
$data = $this->portal_module->get_move_module_data($module_id);
|
||||
$data = $this->modules_manager->get_move_module_data($module_id);
|
||||
$this->assertEquals($column_start, $data['module_column']);
|
||||
$this->portal_module->move_module_right($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_RIGHT);
|
||||
$this->update_portal_modules();
|
||||
$column_start++;
|
||||
}
|
||||
|
||||
if ($add_to_column)
|
||||
{
|
||||
$module_data = $this->portal_module->get_move_module_data($module_id);
|
||||
$this->portal_module->module_column[$module_data['module_classname']][] = column_num_string($add_to_column);
|
||||
$module_data = $this->modules_manager->get_move_module_data($module_id);
|
||||
$this->constraints_handler->module_column[$module_data['module_classname']][] = $this->portal_columns->number_to_string($add_to_column);
|
||||
}
|
||||
|
||||
// We always start in the right column = 3
|
||||
$column_start = 3;
|
||||
for ($i = 1; $i <= $move_left; $i++)
|
||||
{
|
||||
$data = $this->portal_module->get_move_module_data($module_id);
|
||||
$data = $this->modules_manager->get_move_module_data($module_id);
|
||||
$this->assertEquals($column_start, $data['module_column']);
|
||||
$this->portal_module->move_module_left($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_LEFT);
|
||||
$this->update_portal_modules();
|
||||
$column_start--;
|
||||
}
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE');
|
||||
$this->portal_module->move_module_left($module_id);
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_LEFT);
|
||||
}
|
||||
|
||||
public function data_can_move_module()
|
||||
@@ -277,7 +305,24 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
public function test_can_move_module($expected, $target_column, $module_class)
|
||||
{
|
||||
$this->update_portal_modules();
|
||||
$this->assertEquals($expected, $this->portal_module->can_move_module($target_column, $module_class));
|
||||
$this->assertEquals($expected, $this->constraints_handler->can_move_module($target_column, $module_class));
|
||||
}
|
||||
|
||||
public function data_can_add_module()
|
||||
{
|
||||
return array(
|
||||
array('\board3\portal\modules\clock', 1, true),
|
||||
array('\board3\portal\modules\clock', 2, false),
|
||||
array('\board3\portal\modules\birthday_list', 5, false),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_can_add_module
|
||||
*/
|
||||
public function test_can_add_module($module_class, $column, $expected)
|
||||
{
|
||||
$this->assertSame($expected, $this->constraints_handler->can_add_module($this->portal_helper->get_module($module_class), $column));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,4 +343,5 @@ function trigger_error($input, $type = E_USER_NOTICE)
|
||||
\trigger_error($input, $type);
|
||||
}
|
||||
phpbb_acp_move_module_test::$error = $input;
|
||||
phpbb_acp_move_module_test::$error_type = $type;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
global $cache;
|
||||
global $cache, $phpbb_extension_manager;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
@@ -36,12 +36,14 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
'board3_enable' => true,
|
||||
));
|
||||
$this->template = new \board3\portal\tests\mock\template($this);
|
||||
$this->user = $this->getMock('\phpbb\user', array('add_lang_ext'), array('\phpbb\datetime'));
|
||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
||||
$this->user->data['group_id'] = 2;
|
||||
$this->phpbb_root_path = dirname(__FILE__) . '/../../../../../../';
|
||||
$phpbb_extension_manager = new \phpbb_mock_extension_manager($this->phpbb_root_path, array('board3/portal'));
|
||||
$this->php_ext = 'php';
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$this->modules = array(
|
||||
'\board3\portal\modules\link_us' => new \board3\portal\modules\link_us($config, new \board3\portal\tests\mock\template($this), new \board3\portal\tests\mock\user),
|
||||
'\board3\portal\modules\link_us' => new \board3\portal\modules\link_us($this->config, new \board3\portal\tests\mock\template($this), new \board3\portal\tests\mock\user),
|
||||
);
|
||||
$this->portal_helper = new \board3\portal\includes\helper($this->modules);
|
||||
$this->path_helper = new \phpbb\path_helper(
|
||||
@@ -60,6 +62,7 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
{
|
||||
$controller_helper = new \board3\portal\controller\helper(
|
||||
$this->auth,
|
||||
$this->portal_columns,
|
||||
$this->config,
|
||||
$this->template,
|
||||
$this->user,
|
||||
@@ -109,7 +112,7 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
array(false, array(
|
||||
'module_status' => 1,
|
||||
'module_classname' => '\board3\portal\modules\link_us',
|
||||
'module_group_ids' => 3,4,
|
||||
'module_group_ids' => '3,4',
|
||||
)),
|
||||
);
|
||||
}
|
||||
@@ -122,9 +125,30 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
$this->assertEquals(($expected) ? $this->modules['\board3\portal\modules\link_us'] : false, $this->controller_helper->get_portal_module($row));
|
||||
}
|
||||
|
||||
public function test_get_portal_module_disabled_column()
|
||||
{
|
||||
$this->config['board3_left_column'] = false;
|
||||
$this->assertEquals(false, $this->controller_helper->get_portal_module(array(
|
||||
'module_status' => 1,
|
||||
'module_classname' => '\board3\portal\modules\link_us',
|
||||
'module_column' => 1,
|
||||
)));
|
||||
}
|
||||
|
||||
public function test_load_module_language()
|
||||
{
|
||||
$this->assertNull($this->controller_helper->load_module_language($this->modules['\board3\portal\modules\link_us']));
|
||||
$this->assertEquals('Link to us', $this->user->lang('LINK_US'));
|
||||
$this->assertFalse(isset($this->user->lang['PORTAL_LEADERS_EXT']));
|
||||
$module = $this->getMock('\board3\portal\modules\link_us', array('get_language'), array($this->config, new \board3\portal\tests\mock\template($this), new \board3\portal\tests\mock\user));
|
||||
$module->expects($this->any())
|
||||
->method('get_language')
|
||||
->willReturn(array(
|
||||
'vendor' => 'board3/portal',
|
||||
'file' => 'modules/portal_leaders_module',
|
||||
));
|
||||
$this->assertNull($this->controller_helper->load_module_language($module));
|
||||
$this->assertEquals('Team Settings', $this->user->lang('ACP_PORTAL_LEADERS'));
|
||||
}
|
||||
|
||||
public function data_assign_module_vars()
|
||||
|
||||
@@ -14,8 +14,8 @@ class phpbb_functions_functions_modules_test extends PHPUnit_Framework_TestCase
|
||||
public function data_column_num_string()
|
||||
{
|
||||
return array(
|
||||
array(0, ''),
|
||||
array(0, false),
|
||||
array('', ''),
|
||||
array('', false),
|
||||
array('left', 1),
|
||||
array('center', 2),
|
||||
array('right', 3),
|
||||
|
||||
39
tests/unit/modules/module_base_test.php
Normal file
39
tests/unit/modules/module_base_test.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_unit_modules_module_base_test extends \board3\portal\tests\testframework\test_case
|
||||
{
|
||||
/** @var \board3\portal\modules\module_base */
|
||||
protected $module_base;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->module_base = new \board3\portal\modules\module_base();
|
||||
}
|
||||
|
||||
public function test_get_templates()
|
||||
{
|
||||
$this->assertNull($this->module_base->get_template_side(5));
|
||||
$this->assertNull($this->module_base->get_template_center(5));
|
||||
$this->assertEquals(array(), $this->module_base->get_template_acp(5));
|
||||
}
|
||||
|
||||
public function test_install()
|
||||
{
|
||||
$this->assertTrue($this->module_base->install(5));
|
||||
$this->assertTrue($this->module_base->uninstall(5, null));
|
||||
}
|
||||
|
||||
public function test_can_multi_include()
|
||||
{
|
||||
$this->assertFalse($this->module_base->can_multi_include());
|
||||
}
|
||||
}
|
||||
67
tests/unit/portal/columns_test.php
Normal file
67
tests/unit/portal/columns_test.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal Testing
|
||||
* @copyright (c) Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class board3_portal_columns_test extends \board3\portal\tests\testframework\test_case
|
||||
{
|
||||
protected $portal_columns;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
}
|
||||
public function data_column_number_string()
|
||||
{
|
||||
return array(
|
||||
array(4, 'top'),
|
||||
array(1, 'left'),
|
||||
array(2, 'center'),
|
||||
array(3, 'right'),
|
||||
array(5, 'bottom'),
|
||||
array(0, ''),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_column_number_string
|
||||
*/
|
||||
public function test_number_to_string($number, $string)
|
||||
{
|
||||
$this->assertEquals($string, $this->portal_columns->number_to_string($number));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_column_number_string
|
||||
*/
|
||||
public function test_string_to_number($number, $string)
|
||||
{
|
||||
$this->assertEquals($number, $this->portal_columns->string_to_number($string));
|
||||
}
|
||||
|
||||
public function data_column_string_constant()
|
||||
{
|
||||
return array(
|
||||
array('top', 1),
|
||||
array('left', 2),
|
||||
array('center', 4),
|
||||
array('right', 8),
|
||||
array('bottom', 16),
|
||||
array('', 0),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_column_string_constant
|
||||
*/
|
||||
public function test_string_to_constant($string, $constant)
|
||||
{
|
||||
$this->assertEquals($constant, $this->portal_columns->string_to_constant($string));
|
||||
}
|
||||
}
|
||||
165
tests/unit/portal/modules_manager_confirm_box_test.php
Normal file
165
tests/unit/portal/modules_manager_confirm_box_test.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal Testing
|
||||
* @copyright (c) Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
class modules_manager_confirm_box_test extends \board3\portal\tests\testframework\database_test_case
|
||||
{
|
||||
protected $portal_columns;
|
||||
static public $is_ajax = false;
|
||||
static public $confirm = false;
|
||||
static public $confirm_text = '';
|
||||
static public $hidden_fields = array();
|
||||
static public $meta_refresh = array();
|
||||
static public $trigger_text = '';
|
||||
static public $trigger_type = '';
|
||||
|
||||
/** @var \board3\portal\portal\modules\manager */
|
||||
protected $modules_manager;
|
||||
|
||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||
protected $constraints_handler;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/../acp/fixtures/modules.xml');
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
global $cache, $db, $portal_config;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$user = new \board3\portal\tests\mock\user();
|
||||
$request =new \phpbb_mock_request();
|
||||
$this->request = $request;
|
||||
$this->user = $user;
|
||||
|
||||
$config = new \phpbb\config\config(array());
|
||||
|
||||
$this->portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
new \board3\portal\modules\birthday_list($config, null, $this->db, $user),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $this->phpbb_root_path, $this->phpEx),
|
||||
new \board3\portal\modules\donation($config, null, $user),
|
||||
));
|
||||
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$this->cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put', 'purge'));
|
||||
$this->cache->expects($this->any())
|
||||
->method('destroy')
|
||||
->withConsecutive(array($this->equalTo('config')), array($this->equalTo('portal_config')));
|
||||
$this->cache->expects($this->any())
|
||||
->method('get')
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(false));
|
||||
$this->cache->expects($this->any())
|
||||
->method('sql_exists')
|
||||
->with($this->anything());
|
||||
$this->cache->expects($this->any())
|
||||
->method('put')
|
||||
->with($this->anything());
|
||||
$this->cache->expects($this->any())
|
||||
->method('purge');
|
||||
$cache = $this->cache;
|
||||
$db = $this->db;
|
||||
$user->set(array(
|
||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||
'SUCCESS_DELETE' => 'SUCCESS_DELETE',
|
||||
));
|
||||
|
||||
$this->database_handler = new \board3\portal\portal\modules\database_handler($db);
|
||||
$this->constraints_handler = new \board3\portal\portal\modules\constraints_handler($this->portal_columns, $user);
|
||||
$this->modules_manager = new \board3\portal\portal\modules\manager($this->cache, $db, $this->portal_columns, $this->portal_helper, $this->constraints_handler, $this->database_handler, $request, $user);
|
||||
$portal_config = array();
|
||||
}
|
||||
|
||||
public function test_reset_module()
|
||||
{
|
||||
// Build confirm box first
|
||||
$this->modules_manager->set_u_action('adm/index.php?i=15&mode=foobar')->set_acp_class('foo\bar');
|
||||
self::$confirm = false;
|
||||
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, array()));
|
||||
$this->assertEquals('<input type="hidden" name="i" value="15" />
|
||||
<input type="hidden" name="mode" value="barfoo" />
|
||||
<input type="hidden" name="module_reset" value="1" />
|
||||
<input type="hidden" name="module_id" value="6" />
|
||||
', self::$hidden_fields);
|
||||
|
||||
// Actually reset module
|
||||
phpbb_acp_move_module_test::$override_trigger_error = true;
|
||||
self::$confirm = true;
|
||||
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, array()));
|
||||
$this->assertEquals(array(
|
||||
'seconds' => 3,
|
||||
'link' => 'adm/index.php?i=%5Cfoo%5Cbar&mode=config&module_id=6',
|
||||
), self::$meta_refresh);
|
||||
$this->assertEquals(phpbb_acp_move_module_test::$error_type, E_USER_NOTICE);
|
||||
$this->assertEquals(phpbb_acp_move_module_test::$error, 'adm/index.php?i=15&mode=foobar&module_id=6');
|
||||
phpbb_acp_move_module_test::$override_trigger_error = false;
|
||||
}
|
||||
|
||||
public function test_module_delete()
|
||||
{
|
||||
$this->cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put', 'purge'));
|
||||
$this->cache->expects($this->any())
|
||||
->method('destroy')
|
||||
->with($this->equalTo('portal_modules'));
|
||||
$this->cache->expects($this->any())
|
||||
->method('get')
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(false));
|
||||
$this->cache->expects($this->any())
|
||||
->method('sql_exists')
|
||||
->with($this->anything());
|
||||
$this->cache->expects($this->any())
|
||||
->method('put')
|
||||
->with($this->anything());
|
||||
$this->cache->expects($this->any())
|
||||
->method('purge');
|
||||
$this->request->overwrite('module_classname', '\board3\portal\modules\donation');
|
||||
$this->modules_manager = new \board3\portal\portal\modules\manager($this->cache, $this->db, $this->portal_columns, $this->portal_helper, $this->constraints_handler, $this->database_handler, $this->request, $this->user);
|
||||
$this->modules_manager->set_u_action('adm/index.php?i=15&mode=foobar')->set_acp_class('foo\bar');
|
||||
|
||||
// Trigger confirm box creation
|
||||
modules_manager_confirm_box_test::$confirm = false;
|
||||
$this->assertNull($this->modules_manager->module_delete(6, 'foobar', 'module_delete', 6));
|
||||
$this->assertEquals('<input type="hidden" name="i" value="6" />
|
||||
<input type="hidden" name="mode" value="foobar" />
|
||||
<input type="hidden" name="action" value="module_delete" />
|
||||
<input type="hidden" name="module_id" value="6" />
|
||||
<input type="hidden" name="module_classname" value="\board3\portal\modules\donation" />
|
||||
', self::$hidden_fields);
|
||||
|
||||
// Actually delete module
|
||||
phpbb_acp_move_module_test::$override_trigger_error = true;
|
||||
modules_manager_confirm_box_test::$confirm = true;
|
||||
$this->assertNull($this->modules_manager->module_delete(6, 'foobar', 'module_delete', 6));
|
||||
$this->assertEquals(E_USER_NOTICE, phpbb_acp_move_module_test::$error_type);
|
||||
$this->assertEquals('SUCCESS_DELETEadm/index.php?i=15&mode=foobar', phpbb_acp_move_module_test::$error);
|
||||
phpbb_acp_move_module_test::$override_trigger_error = false;
|
||||
}
|
||||
}
|
||||
|
||||
function confirm_box($check, $text = '', $hidden_fields = '')
|
||||
{
|
||||
modules_manager_confirm_box_test::$confirm_text = $text;
|
||||
modules_manager_confirm_box_test::$hidden_fields = $hidden_fields;
|
||||
return modules_manager_confirm_box_test::$confirm;
|
||||
}
|
||||
|
||||
function meta_refresh($seconds, $link)
|
||||
{
|
||||
modules_manager_confirm_box_test::$meta_refresh = array(
|
||||
'seconds' => $seconds,
|
||||
'link' => $link,
|
||||
);
|
||||
}
|
||||
122
tests/unit/portal/modules_manager_test.php
Normal file
122
tests/unit/portal/modules_manager_test.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal Testing
|
||||
* @copyright (c) Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
class board3_portal_modules_manager_test extends \board3\portal\tests\testframework\database_test_case
|
||||
{
|
||||
protected $portal_columns;
|
||||
static public $is_ajax = false;
|
||||
|
||||
/** @var \board3\portal\portal\modules\manager */
|
||||
protected $modules_manager;
|
||||
|
||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||
protected $constraints_handler;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/../acp/fixtures/modules.xml');
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
global $cache, $db;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$user = new \board3\portal\tests\mock\user();
|
||||
$request =new \phpbb_mock_request();
|
||||
|
||||
$config = new \phpbb\config\config(array());
|
||||
|
||||
$portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
new \board3\portal\modules\birthday_list($config, null, $this->db, $user),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $this->phpbb_root_path, $this->phpEx),
|
||||
new \board3\portal\modules\donation($config, null, $user),
|
||||
));
|
||||
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));
|
||||
$cache->expects($this->any())
|
||||
->method('destroy')
|
||||
->with($this->equalTo('portal_modules'));
|
||||
$cache->expects($this->any())
|
||||
->method('get')
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(false));
|
||||
$cache->expects($this->any())
|
||||
->method('sql_exists')
|
||||
->with($this->anything());
|
||||
$cache->expects($this->any())
|
||||
->method('put')
|
||||
->with($this->anything());
|
||||
$db = $this->db;
|
||||
$user->set(array(
|
||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||
));
|
||||
$this->database_handler = new \board3\portal\portal\modules\database_handler($db);
|
||||
$this->constraints_handler = new \board3\portal\portal\modules\constraints_handler($this->portal_columns, $user);
|
||||
$this->modules_manager = new \board3\portal\portal\modules\manager($cache, $db, $this->portal_columns, $portal_helper, $this->constraints_handler, $this->database_handler, $request, $user);
|
||||
$portal_modules = obtain_portal_modules();
|
||||
foreach($portal_modules as $cur_module)
|
||||
{
|
||||
$this->constraints_handler->module_column[$cur_module['module_classname']][] = $this->portal_columns->number_to_string($cur_module['module_column']);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_set_u_action()
|
||||
{
|
||||
$this->assertInstanceOf('\board3\portal\portal\modules\manager', $this->modules_manager->set_u_action('foobar'));
|
||||
}
|
||||
|
||||
public function test_set_acp_class()
|
||||
{
|
||||
$this->assertInstanceOf('\board3\portal\portal\modules\manager', $this->modules_manager->set_acp_class('foobar'));
|
||||
}
|
||||
|
||||
public function test_get_module_link()
|
||||
{
|
||||
$this->modules_manager->set_acp_class('foo\bar')->set_u_action('index.php?i=25&mode=barfoo');
|
||||
$this->assertEquals('index.php?i=%5Cfoo%5Cbar&mode=test&module_id=5', $this->modules_manager->get_module_link('test', 5));
|
||||
}
|
||||
|
||||
public function test_handle_ajax_request()
|
||||
{
|
||||
$this->assertNull($this->modules_manager->handle_ajax_request(array('foobar' => true)));
|
||||
}
|
||||
|
||||
public function test_get_horizontal_move_action()
|
||||
{
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE');
|
||||
$this->modules_manager->get_horizontal_move_action(array(), 6);
|
||||
}
|
||||
|
||||
public function test_set_module_column()
|
||||
{
|
||||
$module_column = $this->constraints_handler->module_column;
|
||||
$this->constraints_handler->set_module_column(array());
|
||||
$this->assertEquals(array(), $this->constraints_handler->module_column);
|
||||
$this->constraints_handler->set_module_column($module_column);
|
||||
$this->assertEquals($module_column, $this->constraints_handler->module_column);
|
||||
}
|
||||
|
||||
public function test_check_module_conflict()
|
||||
{
|
||||
phpbb_acp_move_module_test::$override_trigger_error = true;
|
||||
phpbb_acp_move_module_test::$error = '';
|
||||
phpbb_acp_move_module_test::$error_type = 0;
|
||||
$move_action = 1;
|
||||
$this->constraints_handler->check_module_conflict($this->modules_manager->get_move_module_data(2), $move_action);
|
||||
$this->assertEquals('UNABLE_TO_MOVE', phpbb_acp_move_module_test::$error);
|
||||
phpbb_acp_move_module_test::$override_trigger_error = false;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,6 @@ TRAVIS_PHP_VERSION=$2
|
||||
|
||||
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
|
||||
then
|
||||
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/develop\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/vendor\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml &> phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak
|
||||
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/develop\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/vendor\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml &> phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak
|
||||
cp phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user