Ignore:
Timestamp:
Feb 24, 2011, 4:45:43 PM (13 years ago)
Author:
patdenice
Message:

Plugins can add their own modules.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/PWG_Stuffs/admin/manage.php

    r7855 r9369  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
    5 // Enregistrement de l'ordre
     5global $pwg_loaded_plugins;
     6
     7// Delete module
     8if (isset($_GET['del']) and !is_adviser())
     9{
     10  pwg_query('DELETE FROM ' . STUFFS_TABLE . ' WHERE id = ' . $_GET['del'] . ' LIMIT 1;');
     11  redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php');
     12}
     13
     14// Save order
    615if (isset($_POST['submitOrder']) and !is_adviser())
    716{
     
    2736}
    2837
    29 // Affichage des modules et de leur position
    30 $q = 'SELECT id, name, descr, type, id_line, width, datas
     38// Display
     39$q = 'SELECT id, name, descr, path, parent, id_line, width, datas
    3140FROM ' . STUFFS_TABLE . '
    3241ORDER BY pos ASC;';
     
    3443$num = 0;
    3544$pos = 1;
    36 $cat_mod = array('name' => l10n('Categories'), 'type' => '-', 'description' => '');
    3745$id_line_options = array(
    3846    '' => '-',
     
    5058while ($module = mysql_fetch_assoc($result))
    5159{
    52         $module['name'] = $module['type'] != 'MainBlock' ? $module['name'] : l10n('stuffs_main_block');
     60  $module['name'] = !empty($module['path']) ? $module['name'] : l10n('stuffs_main_block');
    5361
    5462  $template->append('modules', array(
     
    5664    'NAME' => trigger_event('render_stuffs_name', $module['name']),
    5765    'DESC' => $module['descr'],
    58     'TYPE' => $module['type'],
    59     'TYPE_NAME' => (isset($modules[$module['type']]['name']) ? $modules[$module['type']]['name'] : ''),
     66    'PATH' => $module['path'],
     67    'TYPE_NAME' => (isset($modules[$module['path']]['name']) ? $modules[$module['path']]['name'] : ''),
    6068    'POS' => 10 * $pos++,
    6169    'ID_LINE_OPTIONS' => $id_line_options,
    6270    'ID_LINE_SELECTED' => $module['id_line'],
    63                 'WIDTH' => $module['width'],
    64                 'ID' => $module['id'],
    65     'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadd_module.php&type=' . $module['type'] . '&edit=' . $module['id'],
     71    'WIDTH' => $module['width'],
     72    'ID' => $module['id'],
     73    'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&tab=edit_module&edit='.$module['id'],
    6674    'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&del=' . $module['id'] : '',
    67   ));
     75    'MISSING' => (isset($module['parent']) and !isset($pwg_loaded_plugins[$module['parent']])),
     76    )
     77  );
    6878
    69   if ($module['type'] == 'MainBlock' and !empty($module['datas']))
     79  if (empty($module['path']) and !empty($module['datas']))
    7080  {
    7181    $datas = unserialize($module['datas']);
Note: See TracChangeset for help on using the changeset viewer.