From ff31226fdeb972aac2f37f0098240cb366a9bb26 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 5 May 2010 19:14:48 +0000 Subject: Merged 18_new_admin branch to trunk. git-svn-id: http://code.elgg.org/elgg/trunk@5977 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../default/admin/components/admin_page_layout.php | 36 +++++ views/default/admin/components/plugin.php | 155 +++++++++++++++++++++ views/default/admin/components/plugin_settings.php | 21 +++ views/default/admin/components/sidemenu.php | 105 ++++++++++++++ 4 files changed, 317 insertions(+) create mode 100644 views/default/admin/components/admin_page_layout.php create mode 100644 views/default/admin/components/plugin.php create mode 100644 views/default/admin/components/plugin_settings.php create mode 100644 views/default/admin/components/sidemenu.php (limited to 'views/default/admin/components') diff --git a/views/default/admin/components/admin_page_layout.php b/views/default/admin/components/admin_page_layout.php new file mode 100644 index 000000000..4f2a67d48 --- /dev/null +++ b/views/default/admin/components/admin_page_layout.php @@ -0,0 +1,36 @@ + + + diff --git a/views/default/admin/components/plugin.php b/views/default/admin/components/plugin.php new file mode 100644 index 000000000..e56cdd4ef --- /dev/null +++ b/views/default/admin/components/plugin.php @@ -0,0 +1,155 @@ + 10) { + $top_url = "{$vars['url']}action/admin/plugins/reorder?plugin={$plugin}&order=1&__elgg_token=$token&__elgg_ts=$ts"; + $top_link = '' . elgg_echo('top') . ''; + + $order = $vars['order'] - 11; + + $up_url = "{$vars['url']}action/admin/plugins/reorder?plugin={$plugin}&order=$order&__elgg_token=$token&__elgg_ts=$ts"; + $up_link = '' . elgg_echo('up') . ''; +} + +if ($vars['order'] < $vars['maxorder']) { + $order = $vars['order'] + 11; + $down_url = "{$vars['url']}action/admin/plugins/reorder?plugin={$plugin}&order=$order&__elgg_token=$token&__elgg_ts=$ts"; + $down_link = '' . elgg_echo('down') . ''; + + $order = $vars['maxorder'] + 11; + $bottom_url = "{$vars['url']}action/admin/plugins/reorder?plugin={$plugin}&order=$order&__elgg_token=$token&__elgg_ts=$ts"; + $bottom_link = '' . elgg_echo('bottom') . ''; +} + +if ($active) { + $url = "{$vars['url']}action/admin/plugins/disable?plugin=$plugin&__elgg_token=$token&__elgg_ts=$ts"; + $enable_disable = '' . elgg_echo('disable') . ''; +} else { + $url = "{$vars['url']}action/admin/plugins/enable?plugin=$plugin&__elgg_token=$token&__elgg_ts=$ts"; + $enable_disable = '' . elgg_echo('enable') . ''; +} + + +$categories_list = ''; +if ($manifest['category']) { + $categories_arr = array(); + $base_url = "{$vars['url']}pg/admin/plugins?category="; + + foreach($manifest['category'] as $category) { + $url = $base_url . urlencode($category); + $categories_arr[] = "" . htmlspecialchars($category) . ''; + } + + $categories_list = implode(', ', $categories_arr); +} + +$screenshots = ''; +if ($manifest['screenshot']) { + $base_url = "{$vars['url']}mod/"; + + $limit = 4; + foreach ($manifest['screenshot'] as $screenshot) { + if ($limit <= 0) { + break; + } + + $screenshot_src = $base_url . $plugin . "/$screenshot"; + $screenshots .= "
  • "; + + $limit--; + } +} + +?> + +
    +
    + +
    + +
    + + [". elgg_echo('settings') ."]"; + } + ?> +

    + +
    $manifest['description'])); ?>
    +
    : ". htmlspecialchars($manifest['author']) ?>
    +
    : ". htmlspecialchars($manifest['version']) ?>
    + +

    + + +
    \ No newline at end of file diff --git a/views/default/admin/components/plugin_settings.php b/views/default/admin/components/plugin_settings.php new file mode 100644 index 000000000..22544e45f --- /dev/null +++ b/views/default/admin/components/plugin_settings.php @@ -0,0 +1,21 @@ + 'plugin', 'value' => $plugin)); +$form_body .= '

    ' . elgg_view('input/submit', array('value' => elgg_echo('save'))); +$form_body .= elgg_view('input/reset', array('value' => elgg_echo('reset'))) . '

    '; + +echo elgg_view_title($plugin_info['name']); + +echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/plugins/settings/save")); \ No newline at end of file diff --git a/views/default/admin/components/sidemenu.php b/views/default/admin/components/sidemenu.php new file mode 100644 index 000000000..4e02eecd9 --- /dev/null +++ b/views/default/admin/components/sidemenu.php @@ -0,0 +1,105 @@ +admin_sections; +$current_section = $vars['page'][0]; +$child_section = (isset($vars['page'][1])) ? $vars['page'][1] : NULL; + +// "Plugin Settings" is a special sidemenu item that is added automatically +// it's calculated here instead of in admin_init() because of preformance concerns. +$installed_plugins = get_installed_plugins(); +$plugin_settings_children = $sort = array(); +foreach ($installed_plugins as $plugin_id => $info) { + if (!$info['active']) { + continue; + } + + // @todo might not need to check if plugin is enabled here because + // this view wouldn't exist if it's not. right? + if (is_plugin_enabled($plugin_id) && elgg_view_exists("settings/{$plugin_id}/edit")) { + $plugin_settings_children[$plugin_id] = array( + 'title' => $info['manifest']['name'] + ); + $sort[] = elgg_strtolower($info['manifest']['name']); + } +} + +array_multisort($sort, SORT_ASC, SORT_STRING, $plugin_settings_children); + +if ($plugin_settings_children) { + // merge in legacy support with new support. + if (!isset($sections['plugin_settings'])) { + $sections['plugin_settings'] = array( + 'title' => elgg_echo('admin:plugin_settings'), + 'children' => $plugin_settings_children + ); + } else { + $sections['plugin_settings']['title'] = elgg_echo('admin:plugin_settings'); + if (isset($sections['plugin_settings']['children'])) { + $children = array_merge($plugin_settings_children, $sections['plugin_settings']['children']); + $sections['plugin_settings']['children'] = $children; + } + } +} + +?> + + + + \ No newline at end of file -- cgit v1.2.3