diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-05 19:14:48 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-05 19:14:48 +0000 |
commit | ff31226fdeb972aac2f37f0098240cb366a9bb26 (patch) | |
tree | 1f0caa75c9a340cf28ce9a81a4cbe3230d13abf3 | |
parent | 81ffac29fabc175eebdbf95578da046f4f00611b (diff) | |
download | elgg-ff31226fdeb972aac2f37f0098240cb366a9bb26.tar.gz elgg-ff31226fdeb972aac2f37f0098240cb366a9bb26.tar.bz2 |
Merged 18_new_admin branch to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@5977 36083f99-b078-4883-b0ff-0f9b5a30f544
95 files changed, 1282 insertions, 803 deletions
diff --git a/actions/admin/plugins/disable.php b/actions/admin/plugins/disable.php index d5042e2bf..ac80d46e3 100644 --- a/actions/admin/plugins/disable.php +++ b/actions/admin/plugins/disable.php @@ -21,6 +21,7 @@ foreach ($plugin as $p) { // Disable if (disable_plugin($p)) { system_message(sprintf(elgg_echo('admin:plugins:disable:yes'), $p)); + elgg_delete_admin_notice('first_installation_plugin_reminder'); } else { register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p)); } @@ -30,4 +31,3 @@ elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); forward($_SERVER['HTTP_REFERER']); -exit; diff --git a/actions/admin/plugins/disableall.php b/actions/admin/plugins/disableall.php index 70a945ee4..80553e9d1 100644 --- a/actions/admin/plugins/disableall.php +++ b/actions/admin/plugins/disableall.php @@ -16,6 +16,7 @@ $plugins = get_installed_plugins(); foreach ($plugins as $p => $data) { // Disable if (disable_plugin($p)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:disable:yes'), $p)); } else { register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p)); @@ -26,4 +27,3 @@ elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); forward($_SERVER['HTTP_REFERER']); -exit; diff --git a/actions/admin/plugins/enable.php b/actions/admin/plugins/enable.php index b5286336b..053fbc556 100644 --- a/actions/admin/plugins/enable.php +++ b/actions/admin/plugins/enable.php @@ -11,8 +11,8 @@ // block non-admin users admin_gatekeeper(); -// Get the plugin $plugin = get_input('plugin'); + if (!is_array($plugin)) { $plugin = array($plugin); } @@ -20,6 +20,7 @@ if (!is_array($plugin)) { foreach ($plugin as $p) { // Disable if (enable_plugin($p)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:enable:yes'), $p)); } else { register_error(sprintf(elgg_echo('admin:plugins:enable:no'), $p)); @@ -29,5 +30,4 @@ foreach ($plugin as $p) { elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); -forward($_SERVER['HTTP_REFERER']); -exit; +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/actions/admin/plugins/enableall.php b/actions/admin/plugins/enableall.php index ea4b48f95..d1758a4b3 100644 --- a/actions/admin/plugins/enableall.php +++ b/actions/admin/plugins/enableall.php @@ -16,6 +16,7 @@ $plugins = get_installed_plugins(); foreach ($plugins as $p => $data) { // Enable if (enable_plugin($p)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:enable:yes'), $p)); } else { register_error(sprintf(elgg_echo('admin:plugins:enable:no'), $p)); @@ -26,5 +27,4 @@ foreach ($plugins as $p => $data) { elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); -forward($_SERVER['HTTP_REFERER']); -exit; +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/actions/admin/plugins/reorder.php b/actions/admin/plugins/reorder.php index 6050a585f..6423dc14c 100644 --- a/actions/admin/plugins/reorder.php +++ b/actions/admin/plugins/reorder.php @@ -13,8 +13,8 @@ admin_gatekeeper(); // Get the plugin $mod = get_input('plugin'); -$mod = str_replace('.','',$mod); -$mod = str_replace('/','',$mod); +$mod = str_replace('.', '', $mod); +$mod = str_replace('/', '', $mod); // Get the new order $order = (int) get_input('order'); @@ -35,6 +35,7 @@ if ($key = array_search($mod, $plugins)) { // Disable if (regenerate_plugin_list($plugins)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:reorder:yes'), $plugin)); } else { register_error(sprintf(elgg_echo('admin:plugins:reorder:no'), $plugin)); diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php new file mode 100644 index 000000000..197f183f9 --- /dev/null +++ b/actions/admin/plugins/simple_update_states.php @@ -0,0 +1,41 @@ +<?php +/** + * Elgg administration simple plugin bulk enable / disable + * + * Shows an alphabetical list of "simple" plugins. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$installed_plugins = get_installed_plugins(); +$enabled_plugins = get_input('enabled_plugins', array()); + +$success = TRUE; + +foreach ($installed_plugins as $plugin => $info) { + // this is only for simple plugins. + if (!isset($info['manifest']['admin_interface']) || $info['manifest']['admin_interface'] != 'simple') { + continue; + } + + $plugin_enabled = is_plugin_enabled($plugin); + + // only effect changes to plugins not already in that state. + if ($plugin_enabled && !in_array($plugin, $enabled_plugins)) { + $success = $success && disable_plugin($plugin); + } elseif (!$plugin_enabled && in_array($plugin, $enabled_plugins)) { + $success = $success && enable_plugin($plugin); + } +} + +if ($success) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); + system_message(elgg_echo('admin:plugins:simple_simple_success')); +} else { + register_error(elgg_echo('admins:plugins:simple_simple_fail')); +} + +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/actions/admin/site/update_advanced.php b/actions/admin/site/update_advanced.php new file mode 100644 index 000000000..c9b78c261 --- /dev/null +++ b/actions/admin/site/update_advanced.php @@ -0,0 +1,74 @@ +<?php +/** + * Elgg update site action + * + * This is an update version of the sitesettings/install action + * which is used by the admin panel to modify basic settings. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +admin_gatekeeper(); + +if (datalist_get('default_site')) { + $site = get_entity(datalist_get('default_site')); + if (!($site instanceof ElggSite)) { + throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite')); + } + + $site->url = get_input('wwwroot'); + + datalist_set('path', sanitise_filepath(get_input('path'))); + datalist_set('dataroot', sanitise_filepath(get_input('dataroot'))); + + if (get_input('simplecache_enabled')) { + elgg_view_enable_simplecache(); + } else { + elgg_view_disable_simplecache(); + } + + if (get_input('viewpath_cache_enabled')) { + elgg_enable_filepath_cache(); + } else { + elgg_disable_filepath_cache(); + } + + set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID()); + + $user_default_access = (get_input('allow_user_default_access')) ? 1 : 0; + set_config('allow_user_default_access', $user_default_access, $site->getGUID()); + + set_config('view', get_input('view'), $site->getGUID()); + + $debug = get_input('debug'); + if ($debug) { + set_config('debug', $debug, $site->getGUID()); + } else { + unset_config('debug', $site->getGUID()); + } + + $https_login = get_input('https_login'); + if ($https_login) { + set_config('https_login', 1, $site->getGUID()); + } else { + unset_config('https_login', $site->getGUID()); + } + + $api = get_input('api'); + if ($api) { + unset_config('disable_api', $site->getGUID()); + } else { + set_config('disable_api', 'disabled', $site->getGUID()); + } + + if ($site->save()) { + system_message(elgg_echo("admin:configuration:success")); + } else { + register_error(elgg_echo("admin:configuration:fail")); + } + + forward($_SERVER['HTTP_REFERER']); +}
\ No newline at end of file diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php index d9fa8f367..5914ab0b5 100644 --- a/actions/admin/site/update_basic.php +++ b/actions/admin/site/update_basic.php @@ -11,83 +11,21 @@ * @link http://elgg.org/ */ -global $CONFIG; - -// block non-admin users admin_gatekeeper(); -if (get_input('settings') == 'go') { - if (datalist_get('default_site')) { - $site = get_entity(datalist_get('default_site')); - if (!($site instanceof ElggSite)) { - throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite')); - } - - $site->description = get_input('sitedescription'); - $site->name = get_input('sitename'); - $site->email = get_input('siteemail'); - $site->url = get_input('wwwroot'); - - datalist_set('path',sanitise_filepath(get_input('path'))); - datalist_set('dataroot',sanitise_filepath(get_input('dataroot'))); - if (get_input('simplecache_enabled')) { - elgg_view_enable_simplecache(); - } else { - elgg_view_disable_simplecache(); - } - if (get_input('viewpath_cache_enabled')) { - elgg_enable_filepath_cache(); - } else { - elgg_disable_filepath_cache(); - } - - set_config('language', get_input('language'), $site->getGUID()); - - set_config('default_access', get_input('default_access'), $site->getGUID()); - - if (get_input('allow_user_default_access')) { - set_config('allow_user_default_access', 1, $site->getGUID()); - } else { - set_config('allow_user_default_access', 0, $site->getGUID()); - } - - set_config('view', get_input('view'), $site->getGUID()); - - $debug = get_input('debug'); - if ($debug) { - set_config('debug', $debug, $site->getGUID()); - } else { - unset_config('debug', $site->getGUID()); - } - - $https_login = get_input('https_login'); - if ($https_login) { - set_config('https_login', 1, $site->getGUID()); - } else { - unset_config('https_login', $site->getGUID()); - } - - $usage = get_input('usage'); - if ($usage) { - unset_config('ping_home', $site->getGUID()); - } else { - set_config('ping_home', 'disabled', $site->getGUID()); - } +if (datalist_get('default_site')) { + $site = get_entity(datalist_get('default_site')); + if (!($site instanceof ElggSite)) { + throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite')); + } - $api = get_input('api'); - if ($api) { - unset_config('disable_api', $site->getGUID()); - } else { - set_config('disable_api', 'disabled', $site->getGUID()); - } + $site->description = get_input('sitedescription'); + $site->name = get_input('sitename'); + $site->email = get_input('siteemail'); + $site->save(); - if ($site->save()) { - system_message(elgg_echo("admin:configuration:success")); - } else { - register_error(elgg_echo("admin:configuration:fail")); - } + set_config('language', get_input('language'), $site->getGUID()); - forward($_SERVER['HTTP_REFERER']); - exit; - } -} + forward($_SERVER['HTTP_REFERER']); + exit; +}
\ No newline at end of file diff --git a/actions/login.php b/actions/login.php index fed45fbc5..ef6b0b898 100644 --- a/actions/login.php +++ b/actions/login.php @@ -35,12 +35,7 @@ if ($result) { unset($_SESSION['last_forward_from']); forward($forward_url); } else { - if ((isadminloggedin()) && (!datalist_get('first_admin_login'))) { - system_message(elgg_echo('firstadminlogininstructions')); - datalist_set('first_admin_login', time()); - - forward('pg/admin/plugins'); - } else if (get_input('returntoreferer')) { + if (get_input('returntoreferer')) { forward($_SERVER['HTTP_REFERER']); } else { // forward to index for front page overrides. diff --git a/actions/plugins/settings/save.php b/actions/plugins/settings/save.php index bbbb6a367..6aa47b60e 100644 --- a/actions/plugins/settings/save.php +++ b/actions/plugins/settings/save.php @@ -10,22 +10,52 @@ $params = get_input('params'); $plugin = get_input('plugin'); +if (!$plugin_info = load_plugin_manifest($plugin)) { + register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin)); + forward($_SERVER['HTTP_REFERER']); +} + +$plugin_name = $plugin_info['name']; -gatekeeper(); +admin_gatekeeper(); $result = false; -foreach ($params as $k => $v) { - // Save - $result = set_plugin_setting($k, $v, $plugin); +$options = array( + 'plugin' => $plugin, + 'manifest' => $plugin_info, + 'settings' => $params +); - // Error? - if (!$result) { - register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin)); - forward($_SERVER['HTTP_REFERER']); - exit; +// allow a plugin to override the save action for their settings +if (elgg_action_exist("settings/$plugin/save")) { + action("settings/$plugin/save"); +} else { + foreach ($params as $k => $v) { + if (!$result = set_plugin_setting($k, $v, $plugin)) { + register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name)); + forward($_SERVER['HTTP_REFERER']); + exit; + } } } -system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin)); +system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin_name)); forward($_SERVER['HTTP_REFERER']); +// +//$trigger = trigger_plugin_hook('plugin:save_settings', $plugin, $options, NULL); +//if ($trigger === NULL) { +// foreach ($params as $k => $v) { +// if (!$result = set_plugin_setting($k, $v, $plugin)) { +// register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name)); +// forward($_SERVER['HTTP_REFERER']); +// exit; +// } +// } +//} elseif ($trigger === FALSE) { +// register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name)); +// forward($_SERVER['HTTP_REFERER']); +//} +// +//system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin_name)); +//forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/actions/register.php b/actions/register.php index efbc3def3..081a4e454 100644 --- a/actions/register.php +++ b/actions/register.php @@ -53,7 +53,21 @@ if (!$CONFIG->disable_registration) { system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename)); // Forward on success, assume everything else is an error... - forward(); + // If just registered admin user, login the user in and forward to the + // plugins simple settings page. + if (!datalist_get('first_admin_login')) { + login($new_user); + // remove the "you've registered!" system_message(); + $_SESSION['msg']['messages'] = array(); + + // remind users to enable / disable desired tools + elgg_add_admin_notice('first_installation_plugin_reminder', elgg_echo('firstadminlogininstructions')); + + datalist_set('first_admin_login', time()); + forward('pg/admin/plugins/simple'); + } else { + forward(); + } } else { register_error(elgg_echo("registerbad")); } diff --git a/actions/systemsettings/install.php b/actions/systemsettings/install.php index 18440c62d..589e3a06c 100644 --- a/actions/systemsettings/install.php +++ b/actions/systemsettings/install.php @@ -10,8 +10,11 @@ * @link http://elgg.org/ */ +global $CONFIG; define('INSTALLING', TRUE); -elgg_set_viewtype('failsafe'); // Set failsafe again incase we get an exception thrown + +// Set failsafe again in case we get an exception thrown +elgg_set_viewtype('failsafe'); if (is_installed()) { forward(); @@ -43,7 +46,6 @@ if (get_input('settings') == 'go') { $site->name = get_input('sitename'); $site->url = $url; $site->description = get_input('sitedescription'); - $site->email = get_input('siteemail'); $site->access_id = ACCESS_PUBLIC; $guid = $site->save(); @@ -51,6 +53,12 @@ if (get_input('settings') == 'go') { throw new InstallationException(sprintf(elgg_echo('InstallationException:CantCreateSite'), get_input('sitename'), get_input('wwwroot'))); } + $site->email = get_input('siteemail'); + + // this is needed to grab plugins + $CONFIG->site_guid = $guid; + $CONFIG->site = $site; + datalist_set('installed',time()); datalist_set('path', $path); datalist_set('dataroot', $dataroot); @@ -94,16 +102,18 @@ if (get_input('settings') == 'go') { enable_plugin(trim($plugin), $site->getGUID()); } } else { - enable_plugin('profile', $site->getGUID()); - enable_plugin('logbrowser', $site->getGUID()); - enable_plugin('diagnostics', $site->getGUID()); - enable_plugin('uservalidationbyemail', $site->getGUID()); - enable_plugin('htmlawed', $site->getGUID()); - enable_plugin('search', $site->getGUID()); + // activate plugins with manifest.xml: elgg_install_state = enabled + $plugins = get_plugin_list(); + foreach ($plugins as $plugin) { + if ($manifest = load_plugin_manifest($plugin)) { + if (isset($manifest['elgg_install_state']) && $manifest['elgg_install_state'] == 'enabled') { + enable_plugin($plugin); + } + } + } } // reset the views path in case of installing over an old data dir. - // @todo should this warn / error first? $dataroot = datalist_get('dataroot'); $cache = new ElggFileCache($dataroot); $cache->delete('view_paths'); diff --git a/admin/index.php b/admin/index.php index 4ee190213..1d41306b6 100644 --- a/admin/index.php +++ b/admin/index.php @@ -13,4 +13,4 @@ require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); // Make sure only valid admin users can see this admin_gatekeeper(); -forward('pg/admin/statistics/');
\ No newline at end of file +forward('pg/admin/overview/');
\ No newline at end of file diff --git a/admin/menu_items.php b/admin/menu_items.php deleted file mode 100644 index 5642957e1..000000000 --- a/admin/menu_items.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Elgg administration menu items - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); -admin_gatekeeper(); - -$vars = array( - 'menu_items' => get_register('menu') -); - -$main_box = elgg_view("admin/menu_items", $vars); -$content = elgg_view_layout("one_column_with_sidebar", $main_box); - -page_draw(elgg_echo('admin:plugins'), $content);
\ No newline at end of file diff --git a/admin/plugins.php b/admin/plugins.php deleted file mode 100644 index 39478f153..000000000 --- a/admin/plugins.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Elgg administration plugin system index - * This is a special page that permits the configuration of plugins in a standard way. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); -admin_gatekeeper(); -regenerate_plugin_list(); - -$show_category = get_input('category', NULL); - -// Get a list of the all categories -// and trim down the plugin list if we're not viewing all categories. -// @todo this could be cached somewhere after have the manifest loaded -$categories = array(); -$installed_plugins = get_installed_plugins(); - -foreach ($installed_plugins as $i => $plugin) { - $plugin_categories = $plugin['manifest']['category']; - - // handle plugins that don't declare categories - if ((!$plugin_categories && $show_category) || ($show_category && !in_array($show_category, $plugin_categories))) { - unset($installed_plugins[$i]); - } - - foreach ($plugin_categories as $category) { - if (!array_key_exists($category, $categories)) { - $categories[$category] = elgg_echo("admin:plugins:label:moreinfo:categories:$category"); - } - } -} - -// Display main admin menu -$vars = array( - 'installed_plugins' => $installed_plugins, - 'categories' => $categories, - 'show_category' => $show_category -); - -$main_box = elgg_view("admin/plugins", $vars); -$content = elgg_view_layout("one_column_with_sidebar", $main_box); - -page_draw(elgg_echo('admin:plugins'), $content); diff --git a/admin/site.php b/admin/site.php deleted file mode 100644 index aed952318..000000000 --- a/admin/site.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * Elgg administration site system index - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -// Get the Elgg framework -require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); - -// Make sure only valid admin users can see this -admin_gatekeeper(); - -// Display main admin menu - -$title = elgg_view_title(elgg_echo('admin:site')); -$main_box = elgg_view("admin/site"); -$content = elgg_view_layout("one_column_with_sidebar", $title . $main_box); - -page_draw(elgg_echo("admin:site"), $content);
\ No newline at end of file diff --git a/admin/statistics.php b/admin/statistics.php deleted file mode 100644 index 9823995b5..000000000 --- a/admin/statistics.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * Elgg administration statistics index - * This is a special page that displays a number of statistics - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -// Get the Elgg framework -require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); - -// Make sure only valid admin users can see this -admin_gatekeeper(); - -// Display main admin menu -$title = elgg_view_title(elgg_echo('admin:statistics')); -$main_box = elgg_view("admin/statistics"); -$content = elgg_view_layout("one_column_with_sidebar", $title . $main_box); - -page_draw(elgg_echo("admin:statistics"), $content);
\ No newline at end of file diff --git a/admin/user.php b/admin/user.php deleted file mode 100644 index c0d63d7e0..000000000 --- a/admin/user.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -/** - * Elgg administration user system index - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -// Get the Elgg framework -require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); - -// Make sure only valid admin users can see this -admin_gatekeeper(); - -// Are we performing a search -$search = get_input('s'); -$limit = get_input('limit', 10); -$offset = get_input('offset', 0); - -$context = get_context(); - -$title = elgg_view_title(elgg_echo('admin:user')); - -set_context('search'); - -$result = "<div class='members_list'>".elgg_list_entities(array('type' => 'user', 'limit' => $limit, 'offset' => $offset, 'full_view' => FALSE))."</div>"; - -set_context('admin'); - -// Display main admin menu -page_draw(elgg_echo("admin:user"), - elgg_view_layout("one_column_with_sidebar", $title . elgg_view("admin/user") . $result)); diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 7e8e43f40..304179828 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -236,5 +236,18 @@ function get_site_secret() { return $secret; } +/** + * Check if an action is registered and its file exists. + * + * @param string $action + * @return BOOL + * @since 1.8 + */ +function elgg_action_exist($action) { + global $CONFIG; + + return (isset($CONFIG->actions[$action]) && file_exists($CONFIG->actions[$action]['file'])); +} + // Register some actions *************************************************** register_elgg_event_handler("init","system","actions_init"); diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 8d9ffeba0..73e891332 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -28,53 +28,108 @@ * @param string $view The view to extend, by default this is 'admin/main'. * @param int $priority Optional priority to govern the appearance in the list. */ -function extend_elgg_admin_page( $new_admin_view, $view = 'admin/main', $priority = 500) { - return elgg_extend_view($view, $new_admin_view, $priority); +function extend_elgg_admin_page($new_admin_view, $view = 'admin/main', $priority = 500) { + elgg_deprecated_notice('extend_elgg_admin_page() does nothing now. Extend admin views manually. See http://docs.elgg.org/', 1.8); + //return elgg_extend_view($view, $new_admin_view, $priority); } /** - * Initialise the admin page. + * Add an admin area section or child section (aka tab). + * + * Used in conjuction with http://elgg.org/admin/section/child_section style + * page handler. + * + * @param string $section_id Globally unique section id. + * @param string $section_title Human readable section title. + * @param string $parent_id If a child section, the parent section id. Cannot have grandchildren. */ -function admin_init() { - // Add plugin main menu option (last) - extend_elgg_admin_page('admin/main_opt/statistics', 'admin/main'); - extend_elgg_admin_page('admin/main_opt/site', 'admin/main'); - extend_elgg_admin_page('admin/main_opt/user', 'admin/main'); - extend_elgg_admin_page('admin/main_opt/plugins', 'admin/main', 999); // Always last - - register_action('admin/user/ban', false, "", true); - register_action('admin/user/unban', false, "", true); - register_action('admin/user/delete', false, "", true); - register_action('admin/user/resetpassword', false, "", true); - register_action('admin/user/makeadmin', false, "", true); - register_action('admin/user/removeadmin', false, "", true); - register_action('admin/site/update_basic', false, "", true); - register_action('admin/menu_items', false, "", true); - - - // Page handler - register_page_handler('admin', 'admin_settings_page_handler'); +function elgg_add_admin_section($section_id, $section_title, $parent_id = NULL) { + global $CONFIG; + + if (!isset($CONFIG->admin_sections)) { + $CONFIG->admin_sections = array(); + } + + // have to support adding a child section to a missing parent + // because of plugin order problems. A plugin can extend + // an admin section added by different plugin lower in the load priority. + if ($parent_id) { + if (!isset($CONFIG->admin_sections[$parent_id])) { + $CONFIG->admin_sections[$parent_id] = array('children' => array()); + } + + if (!isset($CONFIG->admin_sections[$parent_id][$section_id])) { + $CONFIG->admin_sections[$parent_id]['children'][$section_id] = array('title' => $section_title); + return TRUE; + } else { + return FALSE; + } + } else { + // children can be defined before parents + if (!isset($CONFIG->admin_sections[$section_id])) { + $CONFIG->admin_sections[$section_id] = array( + 'title' => $section_title, + 'children' => array() + ); + return TRUE; + } else { + // allow to define this since children can be defined before the parent. + $CONFIG->admin_sections[$section_id] = array( + 'title' => $section_title + ); + } + } } /** - * Add submenu items for admin page. - * - * @return unknown_type + * Initialise the admin page. */ -function admin_pagesetup() { - if (get_context() == 'admin') { - global $CONFIG; - - add_submenu_item(elgg_echo('admin:statistics'), $CONFIG->wwwroot . 'pg/admin/statistics/'); - add_submenu_item(elgg_echo('admin:site'), $CONFIG->wwwroot . 'pg/admin/site/'); - add_submenu_item(elgg_echo('admin:user'), $CONFIG->wwwroot . 'pg/admin/user/'); - add_submenu_item(elgg_echo('admin:plugins'), $CONFIG->wwwroot . 'pg/admin/plugins/'); - add_submenu_item(elgg_echo('admin:menu_items'), $CONFIG->wwwroot . 'pg/admin/menu_items/'); - } +function admin_init() { + register_action('admin/user/ban', FALSE, "", TRUE); + register_action('admin/user/unban', FALSE, "", TRUE); + register_action('admin/user/delete', FALSE, "", TRUE); + register_action('admin/user/resetpassword', FALSE, "", TRUE); + register_action('admin/user/makeadmin', FALSE, "", TRUE); + register_action('admin/user/removeadmin', FALSE, "", TRUE); + + register_action('admin/site/update_basic', FALSE, "", TRUE); + register_action('admin/site/update_advanced', FALSE, "", TRUE); + + register_action('admin/menu_items', FALSE, "", TRUE); + + register_action('admin/plugins/simple_update_states', FALSE, '', TRUE); + + + // admin area overview and basic site settings + elgg_add_admin_section('overview', elgg_echo('admin:overview')); + elgg_add_admin_section('site', elgg_echo('admin:site')); + elgg_add_admin_section('basic', elgg_echo('admin:site:basic'), 'site'); + elgg_add_admin_section('advanced', elgg_echo('admin:site:advanced'), 'site'); + + // appearance + elgg_add_admin_section('appearance', elgg_echo('admin:appearance')); + //elgg_add_admin_section('basic', elgg_echo('admin:appearance'), 'appearance'); + elgg_add_admin_section('menu_items', elgg_echo('admin:menu_items'), 'appearance'); + + // users + elgg_add_admin_section('users', elgg_echo('admin:users')); + elgg_add_admin_section('online', elgg_echo('admin:users:online'), 'users'); + elgg_add_admin_section('add', elgg_echo('admin:users:add'), 'users'); + elgg_add_admin_section('find', elgg_echo('admin:users:find'), 'users'); + + // plugins + elgg_add_admin_section('plugins', elgg_echo('admin:plugins')); + elgg_add_admin_section('simple', elgg_echo('admin:plugins:simple'), 'plugins'); + elgg_add_admin_section('advanced', elgg_echo('admin:plugins:advanced'), 'plugins'); + + // handled in the admin sidemenu so we don't have to generate this on every page load. + //elgg_add_admin_section('plugin_settings', elgg_echo('admin:plugin_settings')); + + register_page_handler('admin', 'admin_settings_page_handler'); } /** - * Handle admin pages. + * Handle admin pages. Expects corresponding views as admin/section/subsection * * @param $page * @return unknown_type @@ -82,72 +137,124 @@ function admin_pagesetup() { function admin_settings_page_handler($page) { global $CONFIG; - $path = $CONFIG->path . "admin/index.php"; + admin_gatekeeper(); - if ($page[0]) { - switch ($page[0]) { - case 'user' : $path = $CONFIG->path . "admin/user.php"; break; - case 'statistics' : $path = $CONFIG->path . "admin/statistics.php"; break; - case 'plugins' : $path = $CONFIG->path . "admin/plugins.php"; break; - case 'site' : $path = $CONFIG->path . "admin/site.php"; break; - case 'menu_items' : $path = $CONFIG->path . 'admin/menu_items.php'; break; - } + // default to overview + if (!isset($page[0]) || empty($page[0])) { + $page = array('overview'); } - if ($page[1]) { - set_input('username', $page[1]); + // was going to fix this in the page_handler() function but + // it's commented to explicitly return a string if there's a trailing / + if (empty($page[count($page)-1])) { + array_pop($page); } - include($path); + $vars = array('page' => $page); + + // special page for plugin settings since we create the form for them + if ($page[0] == 'plugin_settings' && isset($page[1]) && elgg_view_exists("settings/{$page[1]}/edit")) { + $view = '/admin/components/plugin_settings'; + $vars['plugin'] = $page[1]; + $vars['entity'] = find_plugin_settings($page[1]); + $title = elgg_echo("admin:plugin_settings:{$page[1]}"); + } else { + $view = 'admin/' . implode('/', $page); + $title = elgg_echo('admin:' . implode(':', $page)); + } + + // allow a place to store helper views outside of the web-accessible views + if ($page[0] == 'components' || !($content = elgg_view($view, $vars))) { + $title = elgg_echo('admin:unknown_section'); + $content = elgg_echo('admin:unknown_section'); + } + + $body = elgg_view('admin/components/admin_page_layout', array('content' => $content, 'page' => $page)); + page_draw($title, $body); } /** - * Write a persistent message to the administrator's notification window. + * Write a persistent message to the admin view. + * Useful to alert the admin to take a certain action. + * The id is a unique ID that can be cleared once the admin + * completes the action. * - * Currently this writes a message to the admin store, we may want to come up with another way at some point. + * eg: add_admin_notice('twitter_service_no_api', + * 'Before your users can use Twitter services on this site, you must set up + * the Twitter API key in the <a href="link">Twitter Services Settings</a>'); * - * @param string $subject Subject of the message + * @param string $id A unique ID that your plugin can remember * @param string $message Body of the message */ -function send_admin_message($subject, $message) { - $subject = sanitise_string($subject); - $message = sanitise_string($message); - - if (($subject) && ($message)) { - $admin_message = new ElggObject(); - $admin_message->subtype = 'admin_message'; - $admin_message->access_id = ACCESS_PUBLIC; - $admin_message->title = $subject; - $admin_message->description = $message; - - return $admin_message->save(); +function elgg_add_admin_notice($id, $message) { + if ($id && $message) { + $admin_notice = new ElggObject(); + $admin_notice->subtype = 'admin_notice'; + // admins can see ACCESS_PRIVATE but no one else can. + $admin_notice->access_id = ACCESS_PRIVATE; + $admin_notice->admin_notice_id = $id; + $admin_notice->description = $message; + + return $admin_notice->save(); } return false; } + +/** + * Remove an admin notice by ID. + * + * eg In actions/twitter_service/save_settings: + * if (is_valid_twitter_api_key()) { + * delete_admin_notice('twitter_services_no_api'); + * } + * + * @param string $id The unique ID assigned in add_admin_notice() + */ +function elgg_delete_admin_notice($id) { + if (!$id) { + return FALSE; + } + $result = TRUE; + if ($notices = elgg_get_entities_from_metadata(array('metadata_name' => 'admin_notice_id', 'metadata_value' => $id))) { + // in case a bad plugin adds many, let it remove them all at once. + foreach ($notices as $notice) { + $result = ($result && $notice->delete()); + } + return $result; + } + return FALSE; +} + /** * List all admin messages. * * @param int $limit Limit */ -function list_admin_messages($limit = 10) { - return elgg_list_entities(array( +function elgg_get_admin_notices($limit = 10) { + return elgg_get_entities_from_metadata(array( 'type' => 'object', - 'subtype' => 'admin_message', + 'subtype' => 'admin_notice', 'limit' => $limit )); } /** - * Remove an admin message. - * - * @param int $guid The + * Check if an admin notice is currently active. + * @param string $id The unique ID used to register the notice. */ -function clear_admin_message($guid) { - return delete_entity($guid); +function elgg_admin_notice_exists($id) { + $notice = elgg_get_entities_from_metadata(array( + 'type' => 'object', + 'subtype' => 'admin_notice', + 'metadata_name_value_pair' => array('name' => 'admin_notice_id', 'value' => $id) + )); + + return ($notice) ? TRUE : FALSE; } -/// Register init functions + +// Register init functions register_elgg_event_handler('init', 'system', 'admin_init'); register_elgg_event_handler('pagesetup', 'system', 'admin_pagesetup'); diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 0e62914e2..b365585c8 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -354,6 +354,11 @@ function load_plugin_manifest($plugin) { } } + // handle plugins that don't define a name + if (!isset($elements['name'])) { + $elements['name'] = ucwords($plugin); + } + return $elements; } @@ -677,6 +682,10 @@ function enable_plugin($plugin, $site_guid = 0) { throw new InvalidClassException(sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $site_guid, "ElggSite")); } + if (!$plugin_info = load_plugin_manifest($plugin)) { + return FALSE; + } + // getMetadata() doesn't return an array if only one plugin is enabled if ($enabled = $site->enabled_plugins) { if (!is_array($enabled)) { @@ -689,8 +698,42 @@ function enable_plugin($plugin, $site_guid = 0) { $enabled[] = $plugin; $enabled = array_unique($enabled); - $return = $site->setMetaData('enabled_plugins', $enabled); - $ENABLED_PLUGINS_CACHE = $enabled; + if ($return = $site->setMetaData('enabled_plugins', $enabled)) { + + // for other plugins that want to hook into this. + if ($return && !trigger_elgg_event('enable', 'plugin', array('plugin' => $plugin, 'manifest' => $plugin_info))) { + $return = FALSE; + } + + // for this plugin's on_enable + if ($return && isset($plugin_info['on_enable'])) { + // pull in the actual plugin's start so the on_enable function is callabe + // NB: this will not run re-run the init hooks! + $start = "{$CONFIG->pluginspath}$plugin/start.php"; + if (!file_exists($start) || !include($start)) { + $return = FALSE; + } + + // need language files for the messages + $translations = "{$CONFIG->pluginspath}$plugin/languages/"; + register_translations($translations); + if (!is_callable($plugin_info['on_enable'])) { + $return = FALSE; + } else { + $on_enable = call_user_func($plugin_info['on_enable']); + // allow null to mean "I don't care" like other subsystems + $return = ($on_disable === FALSE) ? FALSE : TRUE; + } + } + + // disable the plugin if the on_enable or trigger results failed + if (!$return) { + array_pop($enabled); + $site->setMetaData('enabled_plugins', $enabled); + } + + $ENABLED_PLUGINS_CACHE = $enabled; + } return $return; } @@ -721,6 +764,10 @@ function disable_plugin($plugin, $site_guid = 0) { throw new InvalidClassException(sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $site_guid, "ElggSite")); } + if (!$plugin_info = load_plugin_manifest($plugin)) { + return FALSE; + } + // getMetadata() doesn't return an array if only one plugin is enabled if ($enabled = $site->enabled_plugins) { if (!is_array($enabled)) { @@ -730,6 +777,8 @@ function disable_plugin($plugin, $site_guid = 0) { $enabled = array(); } + $old_enabled = $enabled; + // remove the disabled plugin from the array if (FALSE !== $i = array_search($plugin, $enabled)) { unset($enabled[$i]); @@ -738,7 +787,32 @@ function disable_plugin($plugin, $site_guid = 0) { // if we're unsetting all the plugins, this will return an empty array. // it will fail with FALSE, though. $return = (FALSE === $site->enabled_plugins = $enabled) ? FALSE : TRUE; - $ENABLED_PLUGINS_CACHE = $enabled; + + if ($return) { + // for other plugins that want to hook into this. + if ($return && !trigger_elgg_event('disable', 'plugin', array('plugin' => $plugin, 'manifest' => $plugin_info))) { + $return = FALSE; + } + + // for this plugin's on_disable + if ($return && isset($plugin_info['on_disable'])) { + if (!is_callable($plugin_info['on_disable'])) { + $return = FALSE; + } else { + $on_disable = call_user_func($plugin_info['on_disable']); + // allow null to mean "I don't care" like other subsystems + $return = ($on_disable === FALSE) ? FALSE : TRUE; + } + } + + // disable the plugin if the on_enable or trigger results failed + if (!$return) { + $site->enabled_plugins = $old_enabled; + $ENABLED_PLUGINS_CACHE = $old_enabled; + } else { + $ENABLED_PLUGINS_CACHE = $enabled; + } + } return $return; } diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index f4b1fc69b..b5b68ebe0 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -417,13 +417,6 @@ function login(ElggUser $user, $persistent = false) { set_last_login($_SESSION['guid']); reset_login_failure_count($user->guid); // Reset any previous failed login attempts - // Set admin shortcut flag if this is an admin -// if (isadminloggedin()) { -// //@todo REMOVE THIS. -// global $is_admin; -// $is_admin = true; -// } - return true; } diff --git a/languages/en.php b/languages/en.php index aab05c8f4..83a7c5159 100644 --- a/languages/en.php +++ b/languages/en.php @@ -382,7 +382,7 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'registerbad' => "Your registration was unsuccessful. The username may already exist, your passwords might not match, or your username or password may be too short.", 'registerdisabled' => "Registration has been disabled by the system administrator", - 'firstadminlogininstructions' => 'Your new Elgg site has been successfully installed and your administrator account created. You can now configure your site further by enabling various installed plugin tools.', + 'firstadminlogininstructions' => "Enable and disable plugins to customize your new Elgg site! (Remember to hit 'Save' when you're done.)", 'registration:notemail' => 'The email address you provided does not appear to be a valid email address.', 'registration:userexists' => 'That username already exists', @@ -436,19 +436,29 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'admin:configuration:success' => "Your settings have been saved.", 'admin:configuration:fail' => "Your settings could not be saved.", + 'admin:unknown_section' => 'Invalid Admin Section.', + 'admin' => "Administration", 'admin:description' => "The admin panel allows you to control all aspects of the system, from user management to how plugins behave. Choose an option below to get started.", - 'admin:user' => "User Administration", - 'admin:user:description' => "This admin panel allows you to control user settings for your site. Choose an option below to get started.", - 'admin:user:adduser:label' => "Click here to add a new user...", - 'admin:user:opt:linktext' => "Configure users...", - 'admin:user:opt:description' => "Configure users and account information. ", + 'admin:overview' => 'Overview', + + 'admin:appearance' => 'Appearance', + + 'admin:users' => "Users", + 'admin:users:online' => 'Currently Online', + 'admin:users:add' => 'Add', + 'admin:users:description' => "This admin panel allows you to control user settings for your site. Choose an option below to get started.", + 'admin:users:adduser:label' => "Click here to add a new user...", + 'admin:users:opt:linktext' => "Configure users...", + 'admin:users:opt:description' => "Configure users and account information. ", + 'admin:users:find' => 'Find', - 'admin:site' => "Site Administration", + 'admin:site' => "Site Settings", + 'admin:site:basic' => 'Basic', + 'admin:site:advanced' => 'Advanced', 'admin:site:description' => "This admin panel allows you to control global settings for your site. Choose an option below to get started.", 'admin:site:opt:linktext' => "Configure site...", - 'admin:site:opt:description' => "Configure the site technical and non-technical settings. ", 'admin:site:access:warning' => "Changing the access setting only affects the permissions on content created in the future.", /** @@ -460,7 +470,7 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'plugins:usersettings:save:fail' => "There was a problem saving user settings for the %s plugin.", 'item:object:plugin' => 'Plugin configuration settings', - 'admin:plugins' => "Tool Administration", + 'admin:plugins' => "Plugins", 'admin:plugins:description' => "This admin panel allows you to control and configure tools installed on your site.", 'admin:plugins:opt:linktext' => "Configure tools...", 'admin:plugins:opt:description' => "Configure the tools installed on the site. ", @@ -481,6 +491,14 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'admin:plugins:enable:yes' => "Plugin %s was enabled successfully.", 'admin:plugins:enable:no' => "Plugin %s could not be enabled.", 'admin:plugins:categories:all' => 'All categories', + 'admin:plugins:plugin_website' => 'Plugin website', + 'admin:plugins:author' => '%s', + 'admin:plugins:version' => 'Version %s', + 'admin:plugins:simple' => 'Simple', + 'admin:plugins:advanced' => 'Advanced', + 'admin:plugin_settings' => 'Plugin Settings', + 'admin:plugins:simple_simple_fail' => 'Could not save settings.', + 'admin:plugins:simple_simple_success' => 'Settings saved.', 'admin:statistics' => "Statistics", 'admin:statistics:description' => "This is an overview of statistics on your site. If you need more detailed statistics, a professional administration feature is available.", @@ -555,6 +573,7 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", */ 'save' => "Save", + 'reset' => 'Reset', 'publish' => "Publish", 'cancel' => "Cancel", 'saving' => "Saving ...", @@ -742,12 +761,12 @@ Alternatively, you can enter your database settings below and we will try and do 'installation:settings:dbwizard:savefail' => "We were unable to save the new settings.php. Please save the following file as engine/settings.php using a text editor.", - 'installation:sitename' => "The name of your site (eg \"My social networking site\"):", - 'installation:sitedescription' => "Short description of your site (optional)", - 'installation:wwwroot' => "The site URL, followed by a trailing slash:", - 'installation:path' => "The full path to your site root on your disk, followed by a trailing slash:", - 'installation:dataroot' => "The full path to the directory where uploaded files will be stored, followed by a trailing slash:", - 'installation:dataroot:warning' => "You must create this directory manually. It should sit in a different directory to your Elgg installation.", + 'installation:sitename' => "The name of your site:", + 'installation:sitedescription' => "Short description of your site (optional):", + 'installation:wwwroot' => "The site URL:", + 'installation:path' => "The full path of the Elgg installation:", + 'installation:dataroot' => "The full path the data directory:", + 'installation:dataroot:warning' => "You must create this directory manually. It should be in a different directory to your Elgg installation.", 'installation:sitepermissions' => "The default access permissions:", 'installation:language' => "The default language for your site:", 'installation:debug' => "Debug mode provides extra information which can be used to diagnose faults. However, it can slow your system down so should only be used if you are having problems:", @@ -759,7 +778,7 @@ Alternatively, you can enter your database settings below and we will try and do 'installation:httpslogin:label' => "Enable HTTPS logins", 'installation:view' => "Enter the view which will be used as the default for your site or leave this blank for the default view (if in doubt, leave as default):", - 'installation:siteemail' => "Site email address (used when sending system emails)", + 'installation:siteemail' => "Site email address (used when sending system emails):", 'installation:disableapi' => "The RESTful API is a flexible and extensible interface that enables applications to use certain Elgg features remotely.", 'installation:disableapi:label' => "Enable the RESTful API", diff --git a/mod/blog/manifest.xml b/mod/blog/manifest.xml index 483e83fab..d88eaa994 100644 --- a/mod/blog/manifest.xml +++ b/mod/blog/manifest.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.8" /> - <field key="description" value="Elgg blog plugin" /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.8" /> + <field key="description" value="Elgg blog plugin" /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/blog/views/default/blog/forms/edit.php b/mod/blog/views/default/blog/forms/edit.php index bb900e311..2b3366e48 100644 --- a/mod/blog/views/default/blog/forms/edit.php +++ b/mod/blog/views/default/blog/forms/edit.php @@ -147,6 +147,8 @@ $publish_date_input = elgg_view('input/datetime', array( 'value' => $values['publish_date'] )); +$categories_input = elgg_view('categories', $vars); + // hidden inputs //$container_guid_input = elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $values['container_guid'])); $guid_input = elgg_view('input/hidden', array('internalname' => 'guid', 'value' => $values['guid'])); @@ -202,13 +204,13 @@ $body_input $access_input </p> - - <p> <label for="blog_status">$status_label</label> $status_input </p> +$categories_input + $guid_input $container_guid_input $forward_input diff --git a/mod/bookmarks/manifest.xml b/mod/bookmarks/manifest.xml index 687b62a7e..eab7ba9c6 100644 --- a/mod/bookmarks/manifest.xml +++ b/mod/bookmarks/manifest.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="Elgg bookmarks plugin." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="Elgg bookmarks plugin." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="disabled" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/captcha/manifest.xml b/mod/captcha/manifest.xml index ef8b66775..60b7e2551 100644 --- a/mod/captcha/manifest.xml +++ b/mod/captcha/manifest.xml @@ -7,4 +7,5 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/categories/actions/save.php b/mod/categories/actions/save.php index 21602f659..3e93b6325 100644 --- a/mod/categories/actions/save.php +++ b/mod/categories/actions/save.php @@ -1,5 +1,4 @@ <?php - /** * Elgg categories plugin category saver * @@ -13,10 +12,10 @@ $categories = get_input('categories'); $categories = string_to_tag_array($categories); -global $CONFIG; $site = $CONFIG->site; $site->categories = $categories; system_message(elgg_echo("categories:save:success")); -forward($_SERVER['HTTP_REFERER']); +elgg_delete_admin_notice('categories_admin_notice_no_categories'); +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/mod/categories/languages/en.php b/mod/categories/languages/en.php index 588c194e4..cbe5a608f 100644 --- a/mod/categories/languages/en.php +++ b/mod/categories/languages/en.php @@ -1,15 +1,12 @@ <?php - $english = array( - - 'categories' => 'Categories', - 'categories:settings' => 'Set site categories', - 'categories:explanation' => 'To set some predefined site-wide categories that will be used throughout your system, enter them below, separated with commas. Compatible tools will then display them when the user creates or edits content.', - 'categories:save:success' => 'Site categories were successfully saved.', - 'categories:results' => "Results for the site category: %s", - - ); - - add_translation("en",$english); +$english = array( + 'categories' => 'Categories', + 'categories:settings' => 'Set site categories', + 'categories:explanation' => 'To set some predefined site-wide categories that will be used throughout your system, enter them below, separated with commas. Compatible tools will then display them when the user creates or edits content.', + 'categories:save:success' => 'Site categories were successfully saved.', + 'categories:results' => "Results for the site category: %s", + 'categories:on_enable_reminder' => "You haven't added any categories yet! <a href=\"%s\">Add categories now.</a>", +); -?>
\ No newline at end of file +add_translation("en",$english);
\ No newline at end of file diff --git a/mod/categories/manifest.xml b/mod/categories/manifest.xml index 443872e57..635543ee3 100644 --- a/mod/categories/manifest.xml +++ b/mod/categories/manifest.xml @@ -1,10 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="Site wide categories" /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="name" value="Site-wide Categories" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="Site-wide Categories lets administrators define categories that users across the site can add content to." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> + <field key="on_enable" value="categories_on_enable" /> + <field key="on_disable" value="categories_on_disable" /> </plugin_manifest> diff --git a/mod/categories/start.php b/mod/categories/start.php index dd6da16d5..60ee01065 100644 --- a/mod/categories/start.php +++ b/mod/categories/start.php @@ -15,52 +15,39 @@ * */ function categories_init() { - global $CONFIG; elgg_extend_view('css', 'categories/css'); - register_action('categories/save',false,$CONFIG->pluginspath . 'categories/actions/save.php',true); + register_action('settings/categories/save', FALSE, $CONFIG->pluginspath . 'categories/actions/save.php', TRUE); register_page_handler('categories', 'categories_page_handler'); + register_elgg_event_handler('update','all','categories_save'); + register_elgg_event_handler('create','all','categories_save'); } -/** - * Set up admin menu item - * - */ -function categories_pagesetup() { - if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; - add_submenu_item(elgg_echo('categories:settings'), $CONFIG->wwwroot . 'mod/categories/settings.php'); - } -} /** * Page handler * */ function categories_page_handler() { - include(dirname(__FILE__) . "/listing.php"); - return true; + return TRUE; } /** - * Save site categories + * Save site categories to and object upon save / edit * */ function categories_save($event, $object_type, $object) { - if ($object instanceof ElggEntity) { - $marker = get_input('universal_category_marker'); if ($marker == 'on') { - $categories = get_input('universal_categories_list'); - + if (empty($categories)) { $categories = array(); } @@ -68,12 +55,26 @@ function categories_save($event, $object_type, $object) { $object->universal_categories = $categories; } } + return TRUE; +} - return true; +/** + * Add a reminder to set default categories. + */ +function categories_on_enable() { + if (!$site->categories) { + global $CONFIG; + $message = sprintf(elgg_echo('categories:on_enable_reminder'), "{$CONFIG->url}pg/admin/plugin_settings/categories"); + elgg_add_admin_notice('categories_admin_notice_no_categories', $message); + } + return TRUE; } +/** + * Clean up admin notices on disable. + */ +function categories_on_disable() { + elgg_delete_admin_notice('categories_admin_notice_no_categories'); +} -register_elgg_event_handler('init','system','categories_init'); -register_elgg_event_handler('pagesetup','system','categories_pagesetup'); -register_elgg_event_handler('update','all','categories_save'); -register_elgg_event_handler('create','all','categories_save'); +register_elgg_event_handler('init','system','categories_init');
\ No newline at end of file diff --git a/mod/categories/views/default/categories/css.php b/mod/categories/views/default/categories/css.php index d2cf5a8a8..6dfe60047 100644 --- a/mod/categories/views/default/categories/css.php +++ b/mod/categories/views/default/categories/css.php @@ -1,11 +1,11 @@ <?php - /** - * Categories CSS extender - * - * @package Elgg File Repository - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Categories CSS extender + * + * @package Categories + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ ?> .categories .input-checkboxes { @@ -25,13 +25,13 @@ } #two_column_left_sidebar_maincontent .contentWrapper .categories { border:1px solid #CCCCCC; - -webkit-border-radius: 4px; + -webkit-border-radius: 4px; -moz-border-radius: 4px; padding:5px; - margin:0 0 15px 0; + margin:0 0 15px 0; } #two_column_left_sidebar_maincontent .contentWrapper .categories p { - margin:0; + margin:0; } #two_column_left_sidebar_maincontent .contentWrapper .blog_post .categories { border:none; @@ -41,10 +41,10 @@ #two_column_left_sidebar .blog_categories { background:white; - -webkit-border-radius: 8px; + -webkit-border-radius: 8px; -moz-border-radius: 8px; - padding:10px; - margin:0 10px 10px 10px; + padding:10px; + margin:0 10px 10px 10px; } #two_column_left_sidebar .blog_categories h2 { background:none; diff --git a/mod/categories/views/default/categories/settings.php b/mod/categories/views/default/categories/settings.php deleted file mode 100644 index 7f38b6579..000000000 --- a/mod/categories/views/default/categories/settings.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -echo elgg_view_title(elgg_echo('categories:settings')); - -?> - -<div class="contentWrapper"> - <p> - <?php echo elgg_echo('categories:explanation'); ?> - </p> - - - <?php - - echo elgg_view('input/form', array( - 'action' => $vars['url'] . 'action/categories/save', - 'method' => 'post', - 'body' => elgg_view('categories/settingsform',$vars) - ) - ); - - ?> - -</div>
\ No newline at end of file diff --git a/mod/categories/views/default/categories/settingsform.php b/mod/categories/views/default/categories/settingsform.php deleted file mode 100644 index 044f01dcd..000000000 --- a/mod/categories/views/default/categories/settingsform.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - - echo elgg_view('input/tags',array('value' => $vars['categories'], - 'internalname' => 'categories')); - -?> - <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
\ No newline at end of file diff --git a/mod/categories/settings.php b/mod/categories/views/default/settings/categories/edit.php index 260b057c3..3742fd1e6 100644 --- a/mod/categories/settings.php +++ b/mod/categories/views/default/settings/categories/edit.php @@ -1,5 +1,4 @@ <?php - /** * Elgg categories plugin settings page * @@ -10,15 +9,7 @@ * @link http://elgg.com/ */ -// Load engine and restrict to admins -require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php'); -admin_gatekeeper(); - -// Set context -set_context('admin'); - // Get site and categories -global $CONFIG; $site = $CONFIG->site; $categories = $site->categories; @@ -26,10 +17,12 @@ if (empty($categories)) { $categories = array(); } -// Load category save view -$body = elgg_view('categories/settings',array('categories' => $categories)); - - -$body = elgg_view_layout('two_column_left_sidebar', '', $body); - -page_draw(elgg_echo('categories:settings'), $body); +?> +<div class="contentWrapper"> + <p> + <?php echo elgg_echo('categories:explanation'); ?> + </p> + <?php + echo elgg_view('input/tags', array('value' => $categories, 'internalname' => 'categories')); + ?> +</div>
\ No newline at end of file diff --git a/mod/crontrigger/manifest.xml b/mod/crontrigger/manifest.xml index 3728534b5..8058ebb1e 100644 --- a/mod/crontrigger/manifest.xml +++ b/mod/crontrigger/manifest.xml @@ -7,4 +7,5 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> -</plugin_manifest>
\ No newline at end of file + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/custom_index/manifest.xml b/mod/custom_index/manifest.xml index 2fb36cf22..16e648f54 100644 --- a/mod/custom_index/manifest.xml +++ b/mod/custom_index/manifest.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="A simple plugin to replace the sites index page with boxes containing the latest content from the site." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="A simple plugin to replace the sites index page with boxes containing the latest content from the site." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/defaultwidgets/manifest.xml b/mod/defaultwidgets/manifest.xml index 8388e5803..2fa825d6c 100644 --- a/mod/defaultwidgets/manifest.xml +++ b/mod/defaultwidgets/manifest.xml @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Milan Magudia & Curverider" /> - <field key="version" value="2.04" /> - <field key="description" value="This plugin enables an administrator to define a default set of widgets for new users" /> - <field key="copyright" value="HedgeHogs & Curverider Ltd" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Milan Magudia & Curverider" /> + <field key="version" value="2.04" /> + <field key="description" value="This plugin enables an administrator to define a default set of widgets for new users" /> + <field key="copyright" value="HedgeHogs & Curverider Ltd" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/diagnostics/manifest.xml b/mod/diagnostics/manifest.xml index f9a725966..1e1df8881 100644 --- a/mod/diagnostics/manifest.xml +++ b/mod/diagnostics/manifest.xml @@ -7,4 +7,5 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> -</plugin_manifest>
\ No newline at end of file + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/ecml/manifest.xml b/mod/ecml/manifest.xml index f74c78de0..77ece69de 100644 --- a/mod/ecml/manifest.xml +++ b/mod/ecml/manifest.xml @@ -11,4 +11,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/ecml/start.php b/mod/ecml/start.php index 4ea50766e..c0ce1d4d6 100644 --- a/mod/ecml/start.php +++ b/mod/ecml/start.php @@ -36,7 +36,7 @@ function ecml_init() { elgg_extend_view('css', 'ecml/admin/css'); // admin action to save permissions - register_action('ecml/save_permissions', FALSE, dirname(__FILE__) . '/actions/save_permissions.php', TRUE); + register_action('settings/ecml/save', FALSE, dirname(__FILE__) . '/actions/save_permissions.php', TRUE); // show ECML-enabled icon on free-text input areas elgg_extend_view('input/longtext', 'ecml/input_ext', 0); @@ -78,7 +78,7 @@ function ecml_init() { function ecml_pagesetup(){ if (get_context() == 'admin' && isadminloggedin()) { global $CONFIG; - add_submenu_item(elgg_echo('ecml'), $CONFIG->wwwroot . 'pg/ecml_admin'); + } } diff --git a/mod/ecml/views/default/ecml/admin/ecml_admin.php b/mod/ecml/views/default/settings/ecml/edit.php index b7038b54c..1ad88aa9b 100644 --- a/mod/ecml/views/default/ecml/admin/ecml_admin.php +++ b/mod/ecml/views/default/settings/ecml/edit.php @@ -16,7 +16,6 @@ $perms = $vars['config']->ecml_permissions; ksort($views); ksort($keywords); -echo elgg_view_title(elgg_echo('ecml:admin')); echo '<p class="margin_top">' . elgg_echo('ecml:admin:instruction') . '</p>'; // yes I'm using a table because this is table. @@ -67,13 +66,8 @@ foreach ($keywords as $keyword => $keyword_info) { } $form_body .= '</table>'; -$form_body .= elgg_view('input/submit', array('value' => elgg_echo('submit'))); -$form_body .= elgg_view('input/reset', array('value' => elgg_echo('reset'), 'class' => 'cancel_button')); -echo elgg_view('input/form', array( - 'body' => $form_body, - 'action' => $vars['url'] . 'action/ecml/save_permissions' -)); +echo $form_body; ?> <script type="text/javascript"> diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml index a14e99b4b..f0f82a699 100644 --- a/mod/embed/manifest.xml +++ b/mod/embed/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2009-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/externalpages/manifest.xml b/mod/externalpages/manifest.xml index 3793d7803..52da20256 100644 --- a/mod/externalpages/manifest.xml +++ b/mod/externalpages/manifest.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="This is a very simple plugin that lets site admin populate an about page, terms, privacy and contact. You can also edit the frontpage text." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="This is a very simple plugin that lets site admin populate an about page, terms, privacy and contact. You can also edit the frontpage text." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/file/manifest.xml b/mod/file/manifest.xml index f3f44d3bf..444d2ac80 100644 --- a/mod/file/manifest.xml +++ b/mod/file/manifest.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="File browser plugin" /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="File browser plugin" /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/friends/manifest.xml b/mod/friends/manifest.xml index faed8ce63..8cdd8c6bd 100644 --- a/mod/friends/manifest.xml +++ b/mod/friends/manifest.xml @@ -7,4 +7,5 @@ <field key="copyright" value="(c) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/garbagecollector/manifest.xml b/mod/garbagecollector/manifest.xml index 805cce48e..a806dd916 100644 --- a/mod/garbagecollector/manifest.xml +++ b/mod/garbagecollector/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> -</plugin_manifest>
\ No newline at end of file + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/groups/manifest.xml b/mod/groups/manifest.xml index 86a7dfa1d..523b060ac 100644 --- a/mod/groups/manifest.xml +++ b/mod/groups/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/htmlawed/manifest.xml b/mod/htmlawed/manifest.xml index e71e614d0..045a9a670 100644 --- a/mod/htmlawed/manifest.xml +++ b/mod/htmlawed/manifest.xml @@ -2,9 +2,11 @@ <plugin_manifest> <field key="author" value="Curverider Ltd" /> <field key="version" value="1.5" /> - <field key="description" value="Provide tag filtering for user input (highly recommended)." /> + <field key="description" value="Provides security filtering. Disabling this plugin is extremely insecure. DO NOT DISABLE." /> <field key="website" value="http://www.elgg.org/" /> <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 3" /> <field key="elgg_version" value="2009041701" /> -</plugin_manifest>
\ No newline at end of file + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/invitefriends/manifest.xml b/mod/invitefriends/manifest.xml index 4e17a5d27..cf039ee13 100644 --- a/mod/invitefriends/manifest.xml +++ b/mod/invitefriends/manifest.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="Invite friends to Elgg network via email invites." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="Invite friends to Elgg network via email invites." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/logbrowser/manifest.xml b/mod/logbrowser/manifest.xml index e47d7bb37..4ec2cdf44 100644 --- a/mod/logbrowser/manifest.xml +++ b/mod/logbrowser/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> -</plugin_manifest>
\ No newline at end of file + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/logrotate/manifest.xml b/mod/logrotate/manifest.xml index 02f461815..cfbb14d8c 100644 --- a/mod/logrotate/manifest.xml +++ b/mod/logrotate/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> -</plugin_manifest>
\ No newline at end of file + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/members/manifest.xml b/mod/members/manifest.xml index 2248f8853..37959b66e 100644 --- a/mod/members/manifest.xml +++ b/mod/members/manifest.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="A simple plugin to let users browser other members." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="A simple plugin to let users browser other members." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/messageboard/manifest.xml b/mod/messageboard/manifest.xml index 4c89bdc40..f66f0dd59 100644 --- a/mod/messageboard/manifest.xml +++ b/mod/messageboard/manifest.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="This plugin allows users to put a message board on their profile for other users to post comments." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="This plugin allows users to put a message board on their profile for other users to post comments." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/messages/manifest.xml b/mod/messages/manifest.xml index c903c7658..0c8731e76 100644 --- a/mod/messages/manifest.xml +++ b/mod/messages/manifest.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="version" value="1.7" /> - <field key="description" value="Elgg internal messages plugin. This plugin lets user send each other messages." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="version" value="1.7" /> + <field key="description" value="Elgg internal messages plugin. This plugin lets user send each other messages." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/notifications/manifest.xml b/mod/notifications/manifest.xml index d76abc6ae..6e1f73b9c 100644 --- a/mod/notifications/manifest.xml +++ b/mod/notifications/manifest.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="Elgg notifications plugin" /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="Elgg notifications plugin" /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml index 7e9b2c5e4..0445ed0c8 100644 --- a/mod/pages/manifest.xml +++ b/mod/pages/manifest.xml @@ -7,4 +7,5 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/profile/manifest.xml b/mod/profile/manifest.xml index 902292379..a1307f24d 100644 --- a/mod/profile/manifest.xml +++ b/mod/profile/manifest.xml @@ -1,12 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider ltd" /> - <field key="version" value="1.8" /> - <field key="category" value="bundled" /> - <field key="category" value="social" /> - <field key="description" value="Elgg profile plugin." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider ltd" /> + <field key="version" value="1.8" /> + <field key="category" value="bundled" /> + <field key="category" value="social" /> + <field key="description" value="Elgg profile plugin." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/reportedcontent/manifest.xml b/mod/reportedcontent/manifest.xml index 1d127cde3..e5a34ba99 100644 --- a/mod/reportedcontent/manifest.xml +++ b/mod/reportedcontent/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/riverdashboard/manifest.xml b/mod/riverdashboard/manifest.xml index 24133b7d4..6082cf5ec 100644 --- a/mod/riverdashboard/manifest.xml +++ b/mod/riverdashboard/manifest.xml @@ -6,4 +6,5 @@ <field key="website" value="http://www.elgg.org/" /> <field key="copyright" value="(C) Curverider 2010" /> <field key="licence" value="GNU Public License version 2" /> -</plugin_manifest>
\ No newline at end of file + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/search/manifest.xml b/mod/search/manifest.xml index b54744903..0041325ad 100644 --- a/mod/search/manifest.xml +++ b/mod/search/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010, MITRE 2009" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> -</plugin_manifest>
\ No newline at end of file + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> +</plugin_manifest> diff --git a/mod/sitepages/manifest.xml b/mod/sitepages/manifest.xml index 1ed844b9e..55affc96f 100644 --- a/mod/sitepages/manifest.xml +++ b/mod/sitepages/manifest.xml @@ -10,4 +10,5 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009030702" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/tagcloud/manifest.xml b/mod/tagcloud/manifest.xml index 7f08072b9..6338debaf 100644 --- a/mod/tagcloud/manifest.xml +++ b/mod/tagcloud/manifest.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider, Cash Costello" /> - <field key="version" value="1.0" /> - <field key="description" value="Site-wide and widget-based tag clouds." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider, Cash Costello" /> + <field key="version" value="1.0" /> + <field key="description" value="Site-wide and widget-based tag clouds." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/thewire/manifest.xml b/mod/thewire/manifest.xml index a4239313a..a0384b7ce 100644 --- a/mod/thewire/manifest.xml +++ b/mod/thewire/manifest.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.8" /> - <field key="description" value="Provides a microblogging service for your Elgg site." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="recommends" value="smsclient" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.8" /> + <field key="description" value="Provides a microblogging service for your Elgg site." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="recommends" value="smsclient" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="simple" /> </plugin_manifest> diff --git a/mod/tinymce/manifest.xml b/mod/tinymce/manifest.xml index 139d5b7a4..a7a039c48 100644 --- a/mod/tinymce/manifest.xml +++ b/mod/tinymce/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/twitter/manifest.xml b/mod/twitter/manifest.xml index 5439409db..d5fecbcb5 100644 --- a/mod/twitter/manifest.xml +++ b/mod/twitter/manifest.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="Elgg simple twitter widget" /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="Elgg simple twitter widget" /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/uservalidationbyemail/manifest.xml b/mod/uservalidationbyemail/manifest.xml index 944c870fb..8e29a1bbf 100644 --- a/mod/uservalidationbyemail/manifest.xml +++ b/mod/uservalidationbyemail/manifest.xml @@ -7,4 +7,6 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2009033101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/walledgarden/manifest.xml b/mod/walledgarden/manifest.xml index 1f4b28a1b..e81af202f 100644 --- a/mod/walledgarden/manifest.xml +++ b/mod/walledgarden/manifest.xml @@ -7,4 +7,5 @@ <field key="copyright" value="(C) Curverider 2008-2010" /> <field key="licence" value="GNU Public License version 2" /> <field key="elgg_version" value="2010030101" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/mod/zaudio/manifest.xml b/mod/zaudio/manifest.xml index 6db4cbf47..7af57d6d9 100644 --- a/mod/zaudio/manifest.xml +++ b/mod/zaudio/manifest.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="This simple plugin lets users play mp3's in the page." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="This simple plugin lets users play mp3's in the page." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> + <field key="elgg_install_state" value="enabled" /> + <field key="admin_interface" value="advanced" /> </plugin_manifest> diff --git a/views/default/admin/menu_items.php b/views/default/admin/appearance/menu_items.php index 2bf71f083..0f2637ba6 100644 --- a/views/default/admin/menu_items.php +++ b/views/default/admin/appearance/menu_items.php @@ -8,7 +8,7 @@ * @link http://elgg.org/ */ -$menu_items = $vars['menu_items']; +$menu_items = get_register('menu'); $featured_urls = get_config('menu_items_featured_urls'); // get an alphabetical sort of the items + urls 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 @@ +<?php +/** + * Elgg admin page layout. Includes the admin sidebar and the ownerblock (for legacy support) + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$notices_html = ''; +if ($notices = elgg_get_admin_notices()) { + foreach ($notices as $notice) { + $notices_html .= elgg_view_entity($notice); + } +} + +?> +<div id="elgg_content" class="clearfloat sidebar"> + <div id="elgg_sidebar"> + <?php + echo elgg_view('admin/components/sidemenu', $vars); + echo '<hr />'; + echo elgg_view('page_elements/owner_block'); + ?> + </div> + + <div id="elgg_page_contents" class="clearfloat"> + <?php + if ($notices) { + echo "<div class=\"admin_notices\">$notices_html</div>"; + } + echo $vars['content']; + ?> + </div> +</div> diff --git a/views/default/admin/plugins_opt/plugin.php b/views/default/admin/components/plugin.php index 61a197043..e56cdd4ef 100644 --- a/views/default/admin/plugins_opt/plugin.php +++ b/views/default/admin/components/plugin.php @@ -100,18 +100,14 @@ if ($manifest['screenshot']) { <?php if (elgg_view_exists("settings/{$plugin}/edit")) { - - $settings_link = "<a class='plugin_settings small link'>[". elgg_echo('settings') ."]</a>"; - - $settings_panel = "<div class='pluginsettings hidden'>"; - $settings_panel .= elgg_view("object/plugin", array('plugin' => $plugin, 'entity' => find_plugin_settings($plugin))); - $settings_panel .= "</div>"; + $link = "{$vars['url']}pg/admin/plugin_settings/$plugin"; + $settings_link = "<a class='plugin_settings small link' href='$link'>[". elgg_echo('settings') ."]</a>"; } ?> <h3><?php echo "$plugin_pretty_name $settings_link"; ?></h3> <?php echo $settings_panel; - + if ($manifest) { ?> <div class="plugin_description"><?php echo elgg_view('output/longtext',array('value' => $manifest['description'])); ?></div> 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 @@ +<?php +/** + * Elgg plugin settings + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$plugin = $vars['plugin']; +$plugin_info = load_plugin_manifest($plugin); + +$form_body = elgg_view("settings/{$plugin}/edit", $vars); +$form_body .= elgg_view('input/hidden', array('internalname' => 'plugin', 'value' => $plugin)); +$form_body .= '<p>' . elgg_view('input/submit', array('value' => elgg_echo('save'))); +$form_body .= elgg_view('input/reset', array('value' => elgg_echo('reset'))) . '</p>'; + +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 @@ +<?php +/** + * Elgg admin sidebar + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$sections = $vars['config']->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; + } + } +} + +?> + +<ul class="admin submenu"> + <?php foreach ($sections as $id => $info) { + $parent_class = ($current_section == $id) ? 'selected' : ''; + $link = "{$vars['url']}pg/admin/$id"; + + $expand_child = $children_menu = $expanded = ''; + // parent menu items with children default to the first child element. + if (isset($info['children']) && $info['children']) { + $link = ''; + if ($current_section == $id) { + $hidden = ''; + $expanded = '-'; + } else { + $hidden = 'style="display: none;"'; + $expanded = '+'; + } + $expand_child = "<span class=\"expand_child\">$expanded</span> "; + $children_menu = "<ul class=\"admin child_submenu\" $hidden>"; + foreach ($info['children'] as $child_id => $child_info) { + $child_selected = ($child_section == $child_id) ? "class=\"selected\"" : ''; + $child_link = "{$vars['url']}pg/admin/$id/$child_id"; + if (!$link) { + $link = $child_link; + } + $children_menu .= "<li $child_selected><a href=\"$child_link\">{$child_info['title']}</a></li>"; + } + $children_menu .= '</ul>'; + } + + $parent_class = ($parent_class) ? "class=\"$parent_class\"" : ''; + + echo "<li $parent_class><a href=\"$link\">$expand_child{$info['title']}</a> + $children_menu + </li>"; + } + ?> +</ul> + +<script type="text/javascript"> + $('a span.expand_child').click(function() { + var submenu = $(this).parent().parent().find('ul.child_submenu'); + submenu.slideToggle(); + + if ($(this).html() == '+') { + $(this).html('-'); + } else { + $(this).html('+'); + } + + return false; + }); +</script>
\ No newline at end of file diff --git a/views/default/admin/main.php b/views/default/admin/main.php deleted file mode 100644 index e345f56d6..000000000 --- a/views/default/admin/main.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Elgg administration main screen - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -// Description of what's going on -echo elgg_view('output/longtext', array('value' => elgg_echo("admin:description"))); diff --git a/views/default/admin/main_opt/plugins.php b/views/default/admin/main_opt/plugins.php deleted file mode 100644 index b8ae611d3..000000000 --- a/views/default/admin/main_opt/plugins.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Elgg plugin sub-component on the main menu. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -global $CONFIG; -?> -<div class="menu_admin_option"> - <h2><?php echo elgg_echo('admin:plugins'); ?> </h2> - <p><?php echo elgg_echo('admin:plugins:opt:description'); ?><br /> - <a href="<?php echo $CONFIG->wwwroot . "pg/admin/plugins/"; ?>"><?php echo elgg_echo('admin:plugins:opt:linktext'); ?></a></p> -</div>
\ No newline at end of file diff --git a/views/default/admin/main_opt/site.php b/views/default/admin/main_opt/site.php deleted file mode 100644 index e21dcc3fe..000000000 --- a/views/default/admin/main_opt/site.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Elgg site sub-component on the main menu. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ -?> -<div class="menu_admin_option"> - <h2><?php echo elgg_echo('admin:site'); ?> </h2> - <p><?php echo elgg_echo('admin:site:opt:description'); ?><br /> - <a href="<?php echo $CONFIG->wwwroot . "pg/admin/site/"; ?>"><?php echo elgg_echo('admin:site:opt:linktext'); ?></a></p> -</div>
\ No newline at end of file diff --git a/views/default/admin/main_opt/statistics.php b/views/default/admin/main_opt/statistics.php deleted file mode 100644 index 5b063b82e..000000000 --- a/views/default/admin/main_opt/statistics.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Elgg satistics sub-component on the main menu. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ -?> -<div class="menu_admin_option"> - <h2><?php echo elgg_echo('admin:statistics'); ?> </h2> - <p><?php echo elgg_echo('admin:statistics:opt:description'); ?><br /> - <a href="<?php echo $CONFIG->wwwroot . "pg/admin/statistics/"; ?>"><?php echo elgg_echo('admin:statistics:opt:linktext'); ?></a></p> -</div> diff --git a/views/default/admin/main_opt/user.php b/views/default/admin/main_opt/user.php deleted file mode 100644 index f1dc28e5e..000000000 --- a/views/default/admin/main_opt/user.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Elgg user sub-component on the main menu. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ -?> -<div class="menu_admin_option"> - <h2><?php echo elgg_echo('admin:user'); ?> </h2> - <p><?php echo elgg_echo('admin:user:opt:description'); ?><br /> - <a href="<?php echo $CONFIG->wwwroot . "pg/admin/user/"; ?>"><?php echo elgg_echo('admin:user:opt:linktext'); ?></a></p> -</div>
\ No newline at end of file diff --git a/views/default/admin/statistics_opt/basic.php b/views/default/admin/overview.php index f89314fef..6fe0bcd45 100644 --- a/views/default/admin/statistics_opt/basic.php +++ b/views/default/admin/overview.php @@ -32,4 +32,49 @@ $release = get_version(true); </tr> </table> +</div> + +<?php + + +// Get entity statistics +$entity_stats = get_entity_statistics(); +$even_odd = ""; +?> +<div class="admin_settings site_entities"> + <h3><?php echo elgg_echo('admin:statistics:label:numentities'); ?></h3> + <table class="styled"> + <?php + foreach ($entity_stats as $k => $entry) { + arsort($entry); + foreach ($entry as $a => $b) { + + //This function controls the alternating class + $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; + + if ($a == "__base__") { + $a = elgg_echo("item:{$k}"); + if (empty($a)) + $a = $k; + } else { + if (empty($a)) { + $a = elgg_echo("item:{$k}"); + } else { + $a = elgg_echo("item:{$k}:{$a}"); + } + + if (empty($a)) { + $a = "$k $a"; + } + } + echo <<< END + <tr class="{$even_odd}"> + <td class="column_one">{$a}:</td> + <td>{$b}</td> + </tr> +END; + } + } + ?> + </table> </div>
\ No newline at end of file diff --git a/views/default/admin/statistics.php b/views/default/admin/overview/numentities.php index 7c987a607..0d0e1b83b 100644 --- a/views/default/admin/statistics.php +++ b/views/default/admin/overview/numentities.php @@ -7,5 +7,3 @@ * @author Curverider Ltd * @link http://elgg.org/ */ - -global $CONFIG;
\ No newline at end of file diff --git a/views/default/admin/statistics_opt/online.php b/views/default/admin/overview/online.php index 6485a3bac..0045f8299 100644 --- a/views/default/admin/statistics_opt/online.php +++ b/views/default/admin/overview/online.php @@ -14,7 +14,7 @@ if( (is_plugin_enabled('search')) && (is_plugin_enabled('profile')) ) { $users_online = get_online_users(); get_context('admin'); ?> - + <div class="admin_settings members_list users_online"> <h3><?php echo elgg_echo('admin:statistics:label:onlineusers'); ?></h3> <?php echo $users_online; ?> diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins/advanced.php index 5a5d37f8c..d5def1eb1 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins/advanced.php @@ -1,6 +1,8 @@ <?php /** - * Elgg administration plugin main screen + * Elgg administration advanced plugin screen + * + * Shows a list of all plugins sorted by load order. * * @package Elgg * @subpackage Core @@ -8,16 +10,39 @@ * @link http://elgg.org/ */ -global $CONFIG; +regenerate_plugin_list(); +$installed_plugins = get_installed_plugins(); +$plugin_list = array(); +$show_category = get_input('category', NULL); + +// Get a list of the all categories +// and trim down the plugin list if we're not viewing all categories. +// @todo this could be cached somewhere after have the manifest loaded +$categories = array(); + +foreach ($installed_plugins as $id => $plugin) { + $plugin_categories = $plugin['manifest']['category']; + + // handle plugins that don't declare categories + if ((!$plugin_categories && $show_category) || ($show_category && !in_array($show_category, $plugin_categories))) { + unset($installed_plugins[$id]); + } + + foreach ($plugin_categories as $category) { + if (!array_key_exists($category, $categories)) { + $categories[$category] = elgg_echo("admin:plugins:label:moreinfo:categories:$category"); + } + } +} $ts = time(); $token = generate_action_token($ts); -$categories = array_merge(array('' => elgg_echo('admin:plugins:categories:all')), $vars['categories']); +$categories = array_merge(array('' => elgg_echo('admin:plugins:categories:all')), $categories); $category_pulldown = elgg_view('input/pulldown', array( 'internalname' => 'category', 'options_values' => $categories, - 'value' => $vars['show_category'] + 'value' => $show_category )); $category_button = elgg_view('input/button', array( @@ -33,7 +58,7 @@ $category_form = elgg_view('input/form', array( $title = elgg_view_title(elgg_echo('admin:plugins')); // @todo Until "en/disable all" means "All plugins on this page" hide when not looking at all. -if (!isset($vars['show_category']) || empty($vars['show_category'])) { +if (!isset($show_category) || empty($show_category)) { $buttons = "<a class='action_button' href=\"{$CONFIG->url}action/admin/plugins/enableall?__elgg_token=$token&__elgg_ts=$ts\">".elgg_echo('enableall')."</a> <a class='action_button disabled' href=\"{$CONFIG->url}action/admin/plugins/disableall?__elgg_token=$token&__elgg_ts=$ts\">".elgg_echo('disableall')."</a> "; $buttons .= "<br /><br />"; } else { @@ -48,16 +73,12 @@ $buttons .= $category_form; <div class="content_header_title"><?php echo $title ?></div> <div class="content_header_options"><?php echo $buttons ?></div> </div> +<br /> <?php -echo elgg_view('output/longtext', array('value' => elgg_echo("admin:plugins:description"))); $limit = get_input('limit', 10); $offset = get_input('offset', 0); -// Get the installed plugins -$installed_plugins = $vars['installed_plugins']; -$count = count($installed_plugins); - $plugin_list = get_plugin_list(); $max = 0; foreach($plugin_list as $key => $foo) { @@ -67,19 +88,19 @@ foreach($plugin_list as $key => $foo) { // Display list of plugins $n = 0; foreach ($installed_plugins as $plugin => $data) { - echo elgg_view("admin/plugins_opt/plugin", array('plugin' => $plugin, 'details' => $data, 'maxorder' => $max, 'order' => array_search($plugin, $plugin_list))); + echo elgg_view('admin/components/plugin', array( + 'plugin' => $plugin, + 'details' => $data, + 'maxorder' => $max, + 'order' => array_search($plugin, $plugin_list) + )); $n++; } - ?> - <script type="text/javascript"> -$(document).ready(function() { - $('a.plugin_settings.link').click(function() { - elgg_slide_toggle($(this), '.plugin_details', '.pluginsettings'); - }); - $('a.manifest_details.link').click(function() { - elgg_slide_toggle($(this), '.plugin_details', '.manifest_file'); + $(document).ready(function() { + $('a.manifest_details.link').click(function() { + elgg_slide_toggle($(this), '.plugin_details', '.manifest_file'); + }); }); -}); -</script> +</script>
\ No newline at end of file diff --git a/views/default/admin/plugins/simple.php b/views/default/admin/plugins/simple.php new file mode 100644 index 000000000..ad85f9ce0 --- /dev/null +++ b/views/default/admin/plugins/simple.php @@ -0,0 +1,96 @@ +<?php +/** + * Elgg administration simple plugin screen + * + * Shows an alphabetical list of "simple" plugins. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +regenerate_plugin_list(); +$installed_plugins = get_installed_plugins(); +$plugin_list = array(); +$title = elgg_view_title(elgg_echo('admin:plugins')); + +foreach ($installed_plugins as $installed_name => $plugin) { + if (!isset($plugin['manifest']['admin_interface']) || $plugin['manifest']['admin_interface'] == 'advanced') { + continue; + } + + $plugin['installed_name'] = $installed_name; + + $plugin_list[$plugin['manifest']['name']] = $plugin; +} + +ksort($plugin_list); +$form_body .= <<<___END + <div id="content_header" class="clearfloat"> + <div class="content_header_title">$title</div> + </div> + <ul class="admin_plugins margin_top"> +___END; + +foreach ($plugin_list as $name => $info) { + $manifest = $info['manifest']; + $version_valid = (isset($manifest['elgg_version'])) ? check_plugin_compatibility($manifest['elgg_version']) : FALSE; + if ($info['active']) { + $active_class = 'active'; + $checked = 'checked="checked"'; + } else { + $active_class = 'not_active'; + $checked = ''; + } + + $author = $link = $version = $settings = ''; + + if (isset($manifest['author'])) { + $author = sprintf(elgg_echo('admin:plugins:author'), $manifest['author']); + } + + if (isset($manifest['version'])) { + $version = ' | ' . sprintf(elgg_echo('admin:plugins:version'), $manifest['version']); + } + + if (isset($manifest['website'])) { + $link = " | <a href=\"{$manifest['website']}\">" . elgg_echo('admin:plugins:plugin_website') . '</a>'; + } + + if (elgg_view_exists("settings/{$info['installed_name']}/edit")) { + $settings_href = "{$vars['url']}pg/admin/plugin_settings/{$info['installed_name']}"; + $settings = " | <a class='plugin_settings link' href='$settings_href'>". elgg_echo('settings') ."</a>"; + } + + $form_body .= <<<___END + <li class="plugin_details $active_class"> + <span class="plugin_controls"> + <input type="checkbox" id="{$info['installed_name']}" class="plugin_enabled" $checked name="enabled_plugins[]" value="{$info['installed_name']}"/> + <label for="{$info['installed_name']}">$name</label> + </span> + + <span class="plugin_info"> + <span class="plugin_description"> + {$manifest['description']} + </span> + <span class="plugin_metadata small"> + $author + $version + $link + $settings + </span> + </span> + </li> +___END; +} + +$form_body .= '</ul>'; +$form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); +$form_body .= elgg_view('input/reset', array('value' => elgg_echo('reset'), 'class' => 'action_button disabled')); + +echo elgg_view('input/form', array( + 'action' => "{$vars['url']}action/admin/plugins/simple_update_states", + 'body' => $form_body, + 'class' => 'admin_plugins_simpleview' +));
\ No newline at end of file diff --git a/views/default/admin/site.php b/views/default/admin/site.php deleted file mode 100644 index 2c2775ad0..000000000 --- a/views/default/admin/site.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Elgg administration site main screen - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -global $CONFIG; - -// Description of what's going on -echo "<div class='margin_top'>".elgg_view('output/longtext', array('value' => elgg_echo("admin:site:description")))."</div>"; - -echo elgg_view("settings/system",array("action" => $CONFIG->wwwroot."action/admin/site/update_basic")); // Always want to do this first.
\ No newline at end of file diff --git a/views/default/admin/site/advanced.php b/views/default/admin/site/advanced.php new file mode 100644 index 000000000..da7b98a1a --- /dev/null +++ b/views/default/admin/site/advanced.php @@ -0,0 +1,50 @@ +<?php +/** + * Elgg administration site advanced settings + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$action = $vars['url'] . "action/admin/site/update_advanced"; + +$form_body = ""; + +foreach(array('wwwroot', 'path', 'dataroot', 'view') as $field) { + $form_body .= "<p>"; + $form_body .= elgg_echo('installation:' . $field) . "<br />"; + $warning = elgg_echo('installation:warning:' . $field); + if ($warning != 'installation:warning:' . $field) echo "<b>" . $warning . "</b><br />"; + $value = $vars['config']->$field; + $form_body .= elgg_view("input/text",array('internalname' => $field, 'value' => $value)); + $form_body .= "</p>"; +} + +$form_body .= "<p>" . elgg_echo('admin:site:access:warning') . "<br />"; +$form_body .= elgg_echo('installation:sitepermissions') . elgg_view('input/access', array('internalname' => 'default_access','value' => $vars['config']->default_access)) . "</p>"; +$form_body .= "<p>" . elgg_echo('installation:allow_user_default_access:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:allow_user_default_access:label')), 'internalname' => 'allow_user_default_access', 'value' => ($vars['config']->allow_user_default_access ? elgg_echo('installation:allow_user_default_access:label') : "") )) . "</p>"; +$form_body .= "<p>" . elgg_echo('installation:simplecache:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:simplecache:label')), 'internalname' => 'simplecache_enabled', 'value' => ($vars['config']->simplecache_enabled ? elgg_echo('installation:simplecache:label') : "") )) . "</p>"; +$form_body .= "<p>" . elgg_echo('installation:viewpathcache:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:viewpathcache:label')), 'internalname' => 'viewpath_cache_enabled', 'value' => (($vars['config']->viewpath_cache_enabled) ? elgg_echo('installation:viewpathcache:label') : "") )) . "</p>"; + +$debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice')); +$form_body .= "<p>" . elgg_echo('installation:debug'); +$form_body .= elgg_view('input/pulldown', array('options_values' => $debug_options, 'internalname' => 'debug', 'value' => $vars['config']->debug)); +$form_body .= '</p>'; + +$form_body .= "<p>" . elgg_echo('installation:httpslogin') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:httpslogin:label')), 'internalname' => 'https_login', 'value' => ($vars['config']->https_login ? elgg_echo('installation:httpslogin:label') : "") )) . "</p>"; + +$form_body .= "<p>" . elgg_echo('installation:disableapi') . "<br />"; +$on = elgg_echo('installation:disableapi:label'); +if ((isset($CONFIG->disable_api)) && ($CONFIG->disable_api == true)) { + $on = ($vars['config']->disable_api ? "" : elgg_echo('installation:disableapi:label')); +} +$form_body .= elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:disableapi:label')), 'internalname' => 'api', 'value' => $on )); +$form_body .= "</p>"; + +$form_body .= elgg_view('input/hidden', array('internalname' => 'settings', 'value' => 'go')); + +$form_body .= "<div class='divider'></div>".elgg_view('input/submit', array('value' => elgg_echo("save"))); +$form_body = "<div class='admin_settings site_admin margin_top'>".$form_body."</div>"; +echo elgg_view('input/form', array('action' => $action, 'body' => $form_body)); diff --git a/views/default/admin/site/basic.php b/views/default/admin/site/basic.php new file mode 100644 index 000000000..104823a28 --- /dev/null +++ b/views/default/admin/site/basic.php @@ -0,0 +1,30 @@ +<?php +/** + * Elgg administration site basic settings + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$action = $vars['url'] . "action/admin/site/update_basic"; + +$form_body = ""; + +foreach(array('sitename','sitedescription', 'siteemail') as $field) { + $form_body .= "<p>"; + $form_body .= elgg_echo('installation:' . $field) . "<br />"; + $warning = elgg_echo('installation:warning:' . $field); + if ($warning != 'installation:warning:' . $field) echo "<b>" . $warning . "</b><br />"; + $value = $vars['config']->$field; + $form_body .= elgg_view("input/text",array('internalname' => $field, 'value' => $value)); + $form_body .= "</p>"; +} + +$languages = get_installed_translations(); +$form_body .= "<p>" . elgg_echo('installation:language') . elgg_view("input/pulldown", array('internalname' => 'language', 'value' => $vars['config']->language, 'options_values' => $languages)) . "</p>"; + +$form_body .= "<div class='divider'></div>".elgg_view('input/submit', array('value' => elgg_echo("save"))); +$form_body = "<div class='admin_settings site_admin margin_top'>".$form_body."</div>"; +echo elgg_view('input/form', array('action' => $action, 'body' => $form_body)); diff --git a/views/default/admin/statistics_opt/numentities.php b/views/default/admin/statistics_opt/numentities.php deleted file mode 100644 index 4336c5a82..000000000 --- a/views/default/admin/statistics_opt/numentities.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * Elgg statistics screen - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -// Get entity statistics -$entity_stats = get_entity_statistics(); -$even_odd = ""; -?> -<div class="admin_settings site_entities"> - <h3><?php echo elgg_echo('admin:statistics:label:numentities'); ?></h3> - <table class="styled"> - <?php - foreach ($entity_stats as $k => $entry) { - arsort($entry); - foreach ($entry as $a => $b) { - - //This function controls the alternating class - $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - - if ($a == "__base__") { - $a = elgg_echo("item:{$k}"); - if (empty($a)) - $a = $k; - } else { - if (empty($a)) { - $a = elgg_echo("item:{$k}"); - } else { - $a = elgg_echo("item:{$k}:{$a}"); - } - - if (empty($a)) { - $a = "$k $a"; - } - } - echo <<< END - <tr class="{$even_odd}"> - <td class="column_one">{$a}:</td> - <td>{$b}</td> - </tr> -END; - } - } - ?> - </table> -</div>
\ No newline at end of file diff --git a/views/default/admin/user.php b/views/default/admin/user.php deleted file mode 100644 index ba7eb3d4a..000000000 --- a/views/default/admin/user.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Elgg administration user main screen - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -// Intro -echo "<div class='margin_top'>".elgg_view('output/longtext', array('value' => elgg_echo("admin:user:description")))."</div>"; -//echo elgg_view("admin/user_opt/adduser"); -// add a new user form -echo elgg_view('account/forms/useradd', array('show_admin'=>true)); -// search for a user -echo elgg_view("admin/user_opt/search"); - -if ($vars['list']) { - echo $vars['list']; -}
\ No newline at end of file diff --git a/views/default/admin/user_opt/adduser.php b/views/default/admin/user_opt/adduser.php deleted file mode 100644 index e69de29bb..000000000 --- a/views/default/admin/user_opt/adduser.php +++ /dev/null diff --git a/views/default/admin/users/add.php b/views/default/admin/users/add.php new file mode 100644 index 000000000..4275b27e1 --- /dev/null +++ b/views/default/admin/users/add.php @@ -0,0 +1,6 @@ +<?php +/** + * Display an add user form. + */ + +echo elgg_view('account/forms/useradd', array('show_admin'=>true));
\ No newline at end of file diff --git a/views/default/admin/user_opt/search.php b/views/default/admin/users/find.php index f853dcf3c..9684cb88c 100644 --- a/views/default/admin/user_opt/search.php +++ b/views/default/admin/users/find.php @@ -7,8 +7,8 @@ * @author Curverider Ltd * @link http://elgg.org/ */ - -if( (is_plugin_enabled('search')) && (is_plugin_enabled('profile')) ) { + +if( (is_plugin_enabled('search')) && (is_plugin_enabled('profile')) ) { ?> <div class="admin_settings user_search"> <form action="<?php echo $vars['url']; ?>pg/search/" method="get"> diff --git a/views/default/admin/users/online.php b/views/default/admin/users/online.php new file mode 100644 index 000000000..22b183da8 --- /dev/null +++ b/views/default/admin/users/online.php @@ -0,0 +1,14 @@ +<?php +// users online +if ((is_plugin_enabled('search')) && (is_plugin_enabled('profile'))) { + get_context('search'); + $users_online = get_online_users(); + get_context('admin'); + ?> + + <div class="admin_settings members_list users_online"> + <h3><?php echo elgg_echo('admin:statistics:label:onlineusers'); ?></h3> + <?php echo $users_online; ?> + </div> +<?php +}
\ No newline at end of file diff --git a/views/default/css.php b/views/default/css.php index 639433aab..b81945eb4 100644 --- a/views/default/css.php +++ b/views/default/css.php @@ -1460,8 +1460,8 @@ a.action_button:focus { LIKES *************************************** */ .likes_list_holder { - position: relative; - float:right; + position: relative; + float:right; } .likes_list_holder a.user_like { cursor:pointer; @@ -1491,13 +1491,13 @@ a.action_button:focus { .likes_list_holder .likes_list { background-color: white; border:1px solid #cccccc; - width: 345px; - height: auto; - position: absolute; - text-align: left; - z-index: 9999; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; + width: 345px; + height: auto; + position: absolute; + text-align: left; + z-index: 9999; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; -webkit-box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5); -moz-box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5); } @@ -1578,6 +1578,27 @@ p.elgg_likes_owner { margin:0; border:none; } +.plugin_controls { + padding: 3px 3px 3px 0; + font-weight: bold; + float: left; + width: 150px; +} +form.admin_plugins_simpleview .submit_button { + margin-right:20px; +} +.plugin_info { + margin: 3px; + padding-left: 150px; + display: block; +} +.plugin_metadata { + display:block; + color:#999999; +} +.plugin_name input[type="checkbox"] { + margin-right: 10px; +} .plugin_details { margin:0 0 5px 0; padding:0 7px 4px 10px; @@ -1609,4 +1630,22 @@ p.elgg_likes_owner { .admin_settings.menuitems li.custom_menuitem { margin-bottom:20px; } - +.admin .child_submenu li a{ + margin-left: 15px; + background-color: white; + color: #4690D6; +} +.admin_notices { + padding-bottom: 15px; +} +.admin_notices p { + background-color:#BDE5F8; + color: black; + border: 1px solid blue; + font-weight: bold; + padding:3px 10px; + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); /* safari v3+ */ + -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); /* FF v3.5+ */ + -webkit-border-radius: 4px; + -moz-border-radius: 4px; +} diff --git a/views/default/object/admin_notice.php b/views/default/object/admin_notice.php new file mode 100644 index 000000000..1a162ce4d --- /dev/null +++ b/views/default/object/admin_notice.php @@ -0,0 +1,11 @@ +<?php +/** + * A persistent admin notice to be displayed on all admin pages until cleared. + */ + +if (isset($vars['entity']) && elgg_instanceof($vars['entity'], 'object', 'admin_notice')) { + $notice = $vars['entity']; + $message = $notice->description; + echo "<p>$message</p>"; +} + |