aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/admin.php35
-rw-r--r--engine/lib/widgets.php15
-rw-r--r--languages/en.php13
-rw-r--r--mod/developers/languages/en.php9
-rw-r--r--mod/developers/start.php4
-rw-r--r--mod/thewire/start.php41
-rw-r--r--views/default/admin/dashboard.php11
-rw-r--r--views/default/admin/overview/statistics.php84
-rw-r--r--views/default/admin/statistics/overview.php77
-rw-r--r--views/default/css/admin.php124
-rw-r--r--views/default/layout/shells/widgets.php9
-rw-r--r--views/default/layout/shells/widgets/add_panel.php10
-rw-r--r--views/default/navigation/menu/elements/item.php4
-rw-r--r--views/default/widgets/content_stats/content.php18
-rw-r--r--views/default/widgets/new_users/content.php7
-rw-r--r--views/default/widgets/online_users/content.php3
16 files changed, 357 insertions, 107 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 1e8d51cdf..c8254a0ff 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -97,7 +97,7 @@ function elgg_add_admin_menu_item($section_id, $section_title, $parent_id = NULL
}
/**
- * Initialise the admin page.
+ * Initialise the admin backend.
*
* @return void
*/
@@ -121,9 +121,9 @@ function admin_init() {
elgg_register_action('profile/fields/delete', '', 'admin');
elgg_register_action('profile/fields/reorder', '', 'admin');
- // admin area overview and basic site settings
- elgg_add_admin_menu_item('overview', elgg_echo('admin:overview'));
- elgg_add_admin_menu_item('statistics', elgg_echo('admin:overview:statistics'), 'overview');
+ // statistics
+ elgg_add_admin_menu_item('statistics', elgg_echo('admin:statistics'));
+ elgg_add_admin_menu_item('overview', elgg_echo('admin:statistics:overview'), 'statistics');
// site
elgg_add_admin_menu_item('site', elgg_echo('admin:site'));
@@ -149,6 +149,25 @@ function admin_init() {
// plugins
elgg_add_admin_menu_item('utilities', elgg_echo('admin:utilities'));
+ // dashboard
+ elgg_register_menu_item('page', array(
+ 'name' => 'dashboard',
+ 'url' => 'pg/admin/dashboard',
+ 'title' => elgg_echo('admin:dashboard'),
+ 'context' => 'admin',
+ ));
+
+ // widgets
+ $widgets = array('online_users', 'new_users', 'content_stats');
+ foreach ($widgets as $widget) {
+ elgg_register_widget_type(
+ $widget,
+ elgg_echo("admin:widget:$widget"),
+ elgg_echo("admin:widget:$widget:help"),
+ 'admin'
+ );
+ }
+
register_page_handler('admin', 'admin_settings_page_handler');
}
@@ -179,9 +198,9 @@ function admin_settings_page_handler($page) {
elgg_unregister_css('screen');
- // default to overview
+ // default to dashboard
if (!isset($page[0]) || empty($page[0])) {
- $page = array('overview', 'statistics');
+ $page = array('dashboard');
}
// was going to fix this in the page_handler() function but
@@ -204,7 +223,9 @@ function admin_settings_page_handler($page) {
} else {
$view = 'admin/' . implode('/', $page);
$title = elgg_echo("admin:{$page[0]}");
- $title .= ' : ' . elgg_echo('admin:' . implode(':', $page));
+ if (count($page) > 1) {
+ $title .= ' : ' . elgg_echo('admin:' . implode(':', $page));
+ }
}
// allow a place to store helper views outside of the web-accessible views
diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php
index e11e4b8e3..9a092e92d 100644
--- a/engine/lib/widgets.php
+++ b/engine/lib/widgets.php
@@ -215,12 +215,13 @@ function elgg_is_widget_type($handler) {
*
* The widget types are stdClass objects.
*
- * @param string context The widget context or empty string for current context
+ * @param string $context The widget context or empty string for current context
+ * @param bool $exact Only return widgets registered for this context (false)
*
* @return array
* @since 1.8.0
*/
-function elgg_get_widget_types($context = "") {
+function elgg_get_widget_types($context = "", $exact = false) {
global $CONFIG;
if (empty($CONFIG->widgets) ||
@@ -236,8 +237,14 @@ function elgg_get_widget_types($context = "") {
$widgets = array();
foreach ($CONFIG->widgets->handlers as $key => $handler) {
- if (in_array('all', $handler->context) || in_array($context, $handler->context)) {
- $widgets[$key] = $handler;
+ if ($exact) {
+ if (in_array($context, $handler->context)) {
+ $widgets[$key] = $handler;
+ }
+ } else {
+ if (in_array('all', $handler->context) || in_array($context, $handler->context)) {
+ $widgets[$key] = $handler;
+ }
}
}
diff --git a/languages/en.php b/languages/en.php
index bf3445273..d02a13f23 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -515,7 +515,9 @@ $english = array(
'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:overview' => 'Overview',
+ 'admin:statistics' => "Statistics",
+ 'admin:statistics:overview' => 'Overview',
+
'admin:appearance' => 'Appearance',
'admin:utilities' => 'Utilities',
@@ -536,6 +538,14 @@ $english = array(
'admin:site:opt:linktext' => "Configure site...",
'admin:site:access:warning' => "Changing the access setting only affects the permissions on content created in the future.",
+ 'admin:dashboard' => 'Dashboard',
+ 'admin:widget:online_users' => 'Online users',
+ 'admin:widget:online_users:help' => 'Lists the users currently on the site',
+ 'admin:widget:new_users' => 'New users',
+ 'admin:widget:new_users:help' => 'Lists the newest users',
+ 'admin:widget:content_stats' => 'Content Statistics',
+ 'admin:widget:content_stats:help' => 'Keep track of the content created by your users',
+
/**
* Plugins
*/
@@ -589,7 +599,6 @@ $english = array(
'admin:plugins:dependencies:local_value' => 'Actual value',
'admin:plugins:dependencies:comment' => 'Comment',
- 'admin:overview: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.",
'admin:statistics:opt:description' => "View statistical information about users and objects on your site.",
'admin:statistics:opt:linktext' => "View statistics...",
diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php
index 644acfb5f..bd16a8c61 100644
--- a/mod/developers/languages/en.php
+++ b/mod/developers/languages/en.php
@@ -9,6 +9,15 @@ $english = array(
'admin:developers' => 'Developers',
'admin:developers:settings' => 'Settings',
'admin:developers:preview' => 'CSS Preview',
+
+ // settings
+ 'developers:label:simple_cache' => '',
+ 'developers:help:simple_cache' => '',
+ 'developers:label:views_cache' => '',
+ 'developers:help:views_cache' => '',
+ 'developers:label:' => '',
+ 'developers:help:' => '',
+
);
add_translation('en', $english);
diff --git a/mod/developers/start.php b/mod/developers/start.php
index ba84c3234..04c83bdde 100644
--- a/mod/developers/start.php
+++ b/mod/developers/start.php
@@ -6,8 +6,10 @@
elgg_register_event_handler('init', 'system', 'developers_init');
function developers_init() {
-
elgg_register_event_handler('pagesetup', 'system', 'developers_setup_menu');
+
+ $action_base = elgg_get_plugin_path() . 'developers/actions/developers';
+ elgg_register_action('developers/settings', "$action_base/settings.php", 'admin');
}
function developers_setup_menu() {
diff --git a/mod/thewire/start.php b/mod/thewire/start.php
index abb0cb019..6aba3aff6 100644
--- a/mod/thewire/start.php
+++ b/mod/thewire/start.php
@@ -1,5 +1,34 @@
<?php
+function rest_wire_post($username, $text) {
+ login(get_user(2));
+
+ $user = get_user_by_username($username);
+ if (!$user) {
+ throw new InvalidParameterException('Bad username');
+ }
+
+ $obj = new ElggObject();
+ $obj->subtype = 'thewire';
+ $obj->owner_guid = $user->guid;
+ $obj->access_id = ACCESS_PUBLIC;
+ $obj->method = 'api';
+ $obj->description = elgg_substr(strip_tags($text), 0, 140);
+
+ $guid = $obj->save();
+
+ add_to_river('river/object/thewire/create',
+ 'create',
+ $user->guid,
+ $obj->guid
+ );
+
+ return 'success';
+}
+
+
+
+
/**
* Elgg wire plugin
* The wire is simple twitter like plugin that allows users to post notes to the wire
@@ -19,7 +48,17 @@
function thewire_init() {
- // Set up menu for logged in users
+ expose_function('wire.post',
+ 'rest_wire_post',
+ array( 'username' => array ('type' => 'string'),
+ 'text' => array ('type' => 'string'),
+ ),
+ 'Post a status update to the wire',
+ 'POST',
+ false,
+ false);
+
+// Set up menu for logged in users
$item = new ElggMenuItem('thewire', elgg_echo('thewire:title'), 'pg/thewire');
elgg_register_menu_item('site', $item);
diff --git a/views/default/admin/dashboard.php b/views/default/admin/dashboard.php
new file mode 100644
index 000000000..57e15308d
--- /dev/null
+++ b/views/default/admin/dashboard.php
@@ -0,0 +1,11 @@
+<?php
+
+elgg_set_page_owner_guid(get_loggedin_userid());
+
+$params = array(
+ 'num_columns' => 2,
+ 'exact_match' => true,
+);
+$widgets = elgg_view_layout('widgets', $params);
+
+echo $widgets; \ No newline at end of file
diff --git a/views/default/admin/overview/statistics.php b/views/default/admin/overview/statistics.php
deleted file mode 100644
index 52bd4ddb2..000000000
--- a/views/default/admin/overview/statistics.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * Elgg statistics screen
- *
- * @package Elgg
- * @subpackage Core
- */
-
-// Work out number of users
-$users_stats = get_number_users();
-$total_users = get_number_users(true);
-
-// Get version information
-$version = get_version();
-$release = get_version(true);
-
-echo elgg_view('admin/statistics/extend');
-
-?>
-<div class="elgg-module elgg-inline-module">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('admin:statistics:label:basic'); ?></h3>
- </div>
- <div class="elgg-body">
- <table class="elgg-table-alt">
- <tr class="odd">
- <td><b><?php echo elgg_echo('admin:statistics:label:version'); ?> :</b></td>
- <td><?php echo elgg_echo('admin:statistics:label:version:release'); ?> - <?php echo $release; ?>, <?php echo elgg_echo('admin:statistics:label:version:version'); ?> - <?php echo $version; ?></td>
- </tr>
- <tr class="even">
- <td><b><?php echo elgg_echo('admin:statistics:label:numusers'); ?> :</b></td>
- <td><?php echo $users_stats; ?> <?php echo elgg_echo('active'); ?> / <?php echo $total_users; ?> <?php echo elgg_echo('total') ?></td>
- </tr>
- </table>
- </div>
-</div>
-
-<?php
-
-// Get entity statistics
-$entity_stats = get_entity_statistics();
-$even_odd = "";
-?>
-<div class="elgg-module elgg-inline-module">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('admin:statistics:label:numentities'); ?></h3>
- </div>
- <div class="elgg-body">
- <table class="elgg-table-alt">
- <?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>{$a}:</td>
- <td>{$b}</td>
- </tr>
-END;
- }
- }
- ?>
- </table>
- </div>
-</div> \ No newline at end of file
diff --git a/views/default/admin/statistics/overview.php b/views/default/admin/statistics/overview.php
new file mode 100644
index 000000000..09678fc9a
--- /dev/null
+++ b/views/default/admin/statistics/overview.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Elgg statistics screen
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+// Work out number of users
+$users_stats = get_number_users();
+$total_users = get_number_users(true);
+
+// Get version information
+$version = get_version();
+$release = get_version(true);
+
+?>
+<div class="admin_settings site_stats">
+ <?php echo elgg_view('overview/extend'); ?>
+ <h3><?php echo elgg_echo('admin:statistics:label:basic'); ?></h3>
+ <table class="styled">
+ <tr class="odd">
+ <td class="column-one"><b><?php echo elgg_echo('admin:statistics:label:version'); ?> :</b></td>
+ <td><?php echo elgg_echo('admin:statistics:label:version:release'); ?> - <?php echo $release; ?>, <?php echo elgg_echo('admin:statistics:label:version:version'); ?> - <?php echo $version; ?></td>
+ </tr>
+ <tr class="even">
+ <td class="column-one"><b><?php echo elgg_echo('admin:statistics:label:numusers'); ?> :</b></td>
+ <td><?php echo $users_stats; ?> <?php echo elgg_echo('active'); ?> / <?php echo $total_users; ?> <?php echo elgg_echo('total') ?></td>
+ </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/css/admin.php b/views/default/css/admin.php
index d92cf968c..9735de87f 100644
--- a/views/default/css/admin.php
+++ b/views/default/css/admin.php
@@ -385,7 +385,7 @@ input {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
-input[type="submit"], .elgg-submit-button {
+input[type="submit"], .elgg-submit-button, .elgg-action-button {
font-size: 14px;
font-weight: bold;
color: white;
@@ -400,12 +400,12 @@ input[type="submit"], .elgg-submit-button {
cursor: pointer;
outline: none;
}
-input[type="submit"]:hover, .elgg-submit-button:hover {
+input[type="submit"]:hover, .elgg-submit-button:hover, .elgg-action-button:hover {
color: white;
background-color: #000000;
text-decoration: none;
}
-.elgg-submit-button {
+.elgg-submit-button, .elgg-action-button {
padding: 4px 8px;
}
/* ***************************************
@@ -446,6 +446,124 @@ input[type="submit"]:hover, .elgg-submit-button:hover {
border-color: #555555;
}
+/* ***************************************
+ WIDGETS
+*************************************** */
+.elgg-widgets {
+ float: right;
+ min-height: 30px;
+}
+.elgg-widget-add-control {
+ text-align: right;
+ margin: 5px 5px 15px;
+}
+.elgg-widgets-add-panel {
+ padding: 10px;
+ margin: 0 5px 15px;
+ background: #eeeeee;
+ border: 1px solid #cccccc;
+}
+
+<?php //@todo location-dependent style: make an extension of elgg-gallery ?>
+.elgg-widgets-add-panel ul {
+ padding: 0;
+ margin: 0;
+}
+.elgg-widgets-add-panel li {
+ float: left;
+ margin: 2px 10px;
+ list-style: none;
+ width: 200px;
+ padding: 4px;
+ background-color: #eeeeee;
+ border: 1px solid #cccccc;
+ font-weight: bold;
+}
+.elgg-widgets-add-panel li a {
+ display: block;
+}
+
+<?php //@todo Convert to elgg-state-*? ?>
+.elgg-widget-available {
+ color: #333333;
+ cursor: pointer;
+}
+.elgg-widget-available:hover {
+ border-color: #aaaaaa;
+}
+.elgg-widget-unavailable {
+ color: #888888;
+}
+<?php //@todo extend elgg-module. Still too many location-dependent/overly-qualified styles ?>
+.elgg-widget {
+ background-color: #dedede;
+ padding: 1px;
+ margin: 0 5px 15px;
+ position: relative;
+}
+.elgg-widget:hover {
+ background-color: #cccccc;
+}
+.elgg-widget-title {
+ background-color: #f5f5f5;
+ height: 30px;
+ line-height: 30px;
+ overflow: hidden;
+}
+.elgg-widget-title h3 {
+ float: left;
+ padding: 0 45px 0 20px;
+ color: #333333;
+}
+.elgg-widget-controls a {
+ position: absolute;
+ top: 5px;
+ display: block;
+ width: 18px;
+ height: 18px;
+ border: 1px solid transparent;
+}
+a.elgg-widget-collapse-button {
+ left: 5px;
+ background:transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat 0px -385px;
+}
+.elgg-widget-controls a.elgg-widget-collapsed {
+ background-position: 0px -365px;
+}
+a.elgg-widget-delete-button {
+ right: 5px;
+ background:transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat -198px 3px;
+}
+a.elgg-widget-edit-button {
+ right: 25px;
+ background:transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat -300px -1px;
+}
+a.elgg-widget-edit-button:hover, a.elgg-widget-delete-button:hover {
+ border: 1px solid #cccccc;
+}
+.elgg-widget-container {
+ border-top: 1px solid #dedede;
+ background-color: white;
+ width: 100%;
+ overflow: hidden;
+}
+.elgg-widget-edit {
+ display: none;
+ width: 96%;
+ padding: 2%;
+ border-bottom: 1px solid #dedede;
+}
+.elgg-widget-content {
+ padding: 10px;
+}
+.drag-handle {
+ cursor: move;
+}
+.elgg-widget-placeholder {
+ border: 2px dashed #dedede;
+ margin-bottom: 15px;
+}
+
diff --git a/views/default/layout/shells/widgets.php b/views/default/layout/shells/widgets.php
index 82489b37f..656a0e4c3 100644
--- a/views/default/layout/shells/widgets.php
+++ b/views/default/layout/shells/widgets.php
@@ -2,14 +2,16 @@
/**
* Elgg widgets layout
*
- * @uses $vars['box'] Optional display box at the top of layout
- * @uses $vars['num_columns'] Number of widget columns for this layout
- * @uses $vars['show_add_widgets'] Display the add widgets button and panel
+ * @uses $vars['box'] Optional display box at the top of layout
+ * @uses $vars['num_columns'] Number of widget columns for this layout (3)
+ * @uses $vars['show_add_widgets'] Display the add widgets button and panel (true)
+ * @uses $vars['exact_match'] Widgets must match the current context (false)
*/
$box = elgg_get_array_value('box', $vars, '');
$num_columns = elgg_get_array_value('num_columns', $vars, 3);
$show_add_widgets = elgg_get_array_value('show_add_widgets', $vars, true);
+$exact_match = elgg_get_array_value('exact_match', $vars, false);
$owner = elgg_get_page_owner();
$context = elgg_get_context();
@@ -24,6 +26,7 @@ if (elgg_can_edit_widget_layout($context)) {
$params = array(
'widgets' => $widgets,
'context' => $context,
+ 'exact_match' => $exact_match,
);
echo elgg_view('layout/shells/widgets/add_panel', $params);
}
diff --git a/views/default/layout/shells/widgets/add_panel.php b/views/default/layout/shells/widgets/add_panel.php
index 1e2dc3bbc..2d2a05a08 100644
--- a/views/default/layout/shells/widgets/add_panel.php
+++ b/views/default/layout/shells/widgets/add_panel.php
@@ -1,9 +1,17 @@
<?php
+/**
+ * Widget add panel
+ *
+ * @uses $vars['widgets'] Array of current widgets
+ * @uses $vars['context'] The context for this widget layout
+ * @uses $vars['exact_match'] Only use widgets that match the context
+ */
$widgets = $vars['widgets'];
$context = $vars['context'];
+$exact = elgg_get_array_value('exact_match', $vars, false);
-$widget_types = elgg_get_widget_types($context);
+$widget_types = elgg_get_widget_types($context, $exact);
$current_handlers = array();
foreach ($widgets as $column_widgets) {
diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php
index 7903dbdc0..7c88c344c 100644
--- a/views/default/navigation/menu/elements/item.php
+++ b/views/default/navigation/menu/elements/item.php
@@ -3,15 +3,17 @@
$item = $vars['item'];
$class = '';
+$link_class = 'elgg-menu-closed';
if ($item->getSelected()) {
$class = 'class="selected"';
+ $link_class = 'elgg-menu-opened';
}
$link_vars = array();
$children = $item->getChildren();
if ($children) {
- $link_vars['class'] = 'elgg-menu-parent elgg-menu-closed';
+ $link_vars['class'] = "elgg-menu-parent $link_class";
}
echo "<li $class>";
diff --git a/views/default/widgets/content_stats/content.php b/views/default/widgets/content_stats/content.php
new file mode 100644
index 000000000..b5ea00e18
--- /dev/null
+++ b/views/default/widgets/content_stats/content.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Content stats widget
+ */
+
+$max = 5;
+
+$entity_stats = get_entity_statistics();
+$object_stats = $entity_stats['object'];
+arsort($object_stats);
+$object_stats = array_slice($object_stats, 0, $max);
+
+echo '<table class="elgg-table">';
+foreach ($object_stats as $subtype => $num) {
+ $name = elgg_echo("item:object:$subtype");
+ echo "<tr><td>$name</td><td>$num</td></tr>";
+}
+echo '</table>';
diff --git a/views/default/widgets/new_users/content.php b/views/default/widgets/new_users/content.php
new file mode 100644
index 000000000..cfa7d8bda
--- /dev/null
+++ b/views/default/widgets/new_users/content.php
@@ -0,0 +1,7 @@
+<?php
+
+echo elgg_list_entities(array(
+ 'type' => 'user',
+ 'subtype'=> null,
+ 'full_view' => FALSE
+)); \ No newline at end of file
diff --git a/views/default/widgets/online_users/content.php b/views/default/widgets/online_users/content.php
new file mode 100644
index 000000000..e1ff69811
--- /dev/null
+++ b/views/default/widgets/online_users/content.php
@@ -0,0 +1,3 @@
+<?php
+
+echo $users_online = get_online_users(); \ No newline at end of file