aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-29 02:30:15 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-29 02:30:15 +0000
commit13a495664c79037557e6c5ea7c3e442be0523139 (patch)
tree35d83ec7008d10670fad0dca5e94e3b243beaad2 /mod
parent855b008013aad0426ab0332b040bddb033bb6af9 (diff)
downloadelgg-13a495664c79037557e6c5ea7c3e442be0523139.tar.gz
elgg-13a495664c79037557e6c5ea7c3e442be0523139.tar.bz2
Cleaned up the log browser plugin
git-svn-id: http://code.elgg.org/elgg/trunk@7467 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/logbrowser/languages/en.php48
-rw-r--r--mod/logbrowser/start.php14
-rw-r--r--mod/logbrowser/views/default/admin/overview/logbrowser.php20
-rw-r--r--mod/logbrowser/views/default/logbrowser/adminlinks.php10
-rw-r--r--mod/logbrowser/views/default/logbrowser/css.php42
-rw-r--r--mod/logbrowser/views/default/logbrowser/form.php14
-rw-r--r--mod/logbrowser/views/default/logbrowser/table.php72
-rw-r--r--mod/logbrowser/views/default/object/logwrapper.php48
8 files changed, 154 insertions, 114 deletions
diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php
index 37726b040..3a6555431 100644
--- a/mod/logbrowser/languages/en.php
+++ b/mod/logbrowser/languages/en.php
@@ -1,26 +1,26 @@
<?php
- /**
- * Elgg log browser plugin language pack
- *
- * @package ElggLogBrowser
- */
+/**
+ * Elgg log browser plugin language pack
+ *
+ * @package ElggLogBrowser
+ */
- $english = array(
-
- /**
- * Menu items and titles
- */
-
- 'logbrowser' => 'Log browser',
- 'logbrowser:browse' => 'Browse system log',
- 'logbrowser:search' => 'Refine results',
- 'logbrowser:user' => 'Username to search by',
- 'logbrowser:starttime' => 'Beginning time (for example "last monday", "1 hour ago")',
- 'logbrowser:endtime' => 'End time',
-
- 'logbrowser:explore' => 'Explore log',
-
- );
-
- add_translation("en",$english);
-?> \ No newline at end of file
+$english = array(
+ 'logbrowser' => 'Log browser',
+ 'logbrowser:browse' => 'Browse system log',
+ 'logbrowser:search' => 'Refine results',
+ 'logbrowser:user' => 'Username to search by',
+ 'logbrowser:starttime' => 'Beginning time (for example "last monday", "1 hour ago")',
+ 'logbrowser:endtime' => 'End time',
+
+ 'logbrowser:explore' => 'Explore log',
+
+ 'logbrowser:date' => 'Date and time',
+ 'logbrowser:user:name' => 'User',
+ 'logbrowser:user:guid' => 'User GUID',
+ 'logbrowser:object' => 'Object type',
+ 'logbrowser:object:guid' => 'Object GUID',
+ 'logbrowser:action' => 'Action',
+);
+
+add_translation("en", $english); \ No newline at end of file
diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php
index 70f0c89f8..7a510b6e6 100644
--- a/mod/logbrowser/start.php
+++ b/mod/logbrowser/start.php
@@ -5,23 +5,21 @@
* @package ElggLogBrowser
*/
+elgg_register_event_handler('init', 'system', 'logbrowser_init');
+
/**
- * Initialise the log browser and set up the menus.
- *
+ * Initialize the log browser plugin.
*/
function logbrowser_init() {
global $CONFIG;
// Extend CSS
- elgg_extend_view('css','logbrowser/css');
+ elgg_extend_view('css/admin', 'logbrowser/css');
- // Extend context menu with admin logbrowsre link
+ // Extend context menu with admin logbrowser link
if (isadminloggedin()) {
- elgg_extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000);
+ elgg_extend_view('profile/menu/adminlinks', 'logbrowser/adminlinks', 10000);
}
elgg_add_admin_submenu_item('logbrowser', elgg_echo('logbrowser'), 'overview');
}
-
-// Initialise log browser
-elgg_register_event_handler('init','system','logbrowser_init');
diff --git a/mod/logbrowser/views/default/admin/overview/logbrowser.php b/mod/logbrowser/views/default/admin/overview/logbrowser.php
index 5ff3df096..373e48a49 100644
--- a/mod/logbrowser/views/default/admin/overview/logbrowser.php
+++ b/mod/logbrowser/views/default/admin/overview/logbrowser.php
@@ -1,6 +1,8 @@
<?php
/**
- * Elgg log browser.
+ * Elgg log browser admin page
+ *
+ * @note The ElggObject this creates for each entry is temporary
*
* @package ElggLogBrowser
*/
@@ -43,23 +45,21 @@ $form = elgg_view('logbrowser/form', array(
// Get log entries
$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
-$log_entries = array();
-foreach ($log as $l) {
- $tmp = new ElggObject();
- $tmp->subtype = 'logwrapper';
- $tmp->entry = $l;
- $log_entries[] = $tmp;
-}
+$table = elgg_view('logbrowser/table', array('log_entries' => $log));
-$list = elgg_view_entity_list($log_entries, $count, $offset, $limit, false, false);
+$nav = elgg_view('navigation/pagination',array(
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+));
// display admin body
$body = <<<__HTML
$title
$form
<div class="admin_settings log_browser radius8 clearfix">
- $list
+ $nav $table $nav
</div>
__HTML;
diff --git a/mod/logbrowser/views/default/logbrowser/adminlinks.php b/mod/logbrowser/views/default/logbrowser/adminlinks.php
index c52419c89..03e42fbb8 100644
--- a/mod/logbrowser/views/default/logbrowser/adminlinks.php
+++ b/mod/logbrowser/views/default/logbrowser/adminlinks.php
@@ -1,4 +1,10 @@
<?php
-
+/**
+ * The dropdown link for exploring a user's log
+ *
+ * @package ElggLogBrowser
+ */
?>
-<a href="<?php echo elgg_get_site_url(); ?>mod/logbrowser/?user_guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("logbrowser:explore"); ?></a> \ No newline at end of file
+<a href="<?php echo elgg_get_site_url(); ?>pg/admin/overview/logbrowser/?user_guid=<?php echo $vars['entity']->guid; ?>">
+ <?php echo elgg_echo("logbrowser:explore"); ?>
+</a> \ No newline at end of file
diff --git a/mod/logbrowser/views/default/logbrowser/css.php b/mod/logbrowser/views/default/logbrowser/css.php
index 1612bff99..5e2f4e168 100644
--- a/mod/logbrowser/views/default/logbrowser/css.php
+++ b/mod/logbrowser/views/default/logbrowser/css.php
@@ -1,10 +1,9 @@
<?php
-
- /**
- * Elgg logbrowser CSS
- *
- * @package logbrowser
- */
+/**
+ * Elgg logbrowser CSS
+ *
+ * @package ElggLogBrowser
+ */
?>
#logbrowser_search_area {
@@ -22,27 +21,30 @@
padding-bottom:7px;
}
.log_entry {
- width: 710px;
- font-size: 80%;
- background:white;
- margin:0 10px 5px 10px;
- border:1px solid white;
+ margin: 5px;
}
-.log_entry:hover {
- background-color: #eeeeee;
- border:1px solid #666666;
+.log_entry td, th {
+ padding: 4px 8px;
+ background: white;
+ border: 1px solid #cccccc;
}
-.log_entry td {
+.log_entry th {
+ background-color: #dddddd;
}
-.log_entry_user {
- width: 120px;
+.log_entry .alt td {
+ background: #eeeeee;
}
.log_entry_time {
width: 210px;
- padding:2px;
}
-.log_entry_item {
-
+.log_entry_user {
+ width: 120px;
+}
+.log_entry_guid {
+ width: 80px;
+}
+.log_entry_object {
+ width: 120px;
}
.log_entry_action {
width: 75px;
diff --git a/mod/logbrowser/views/default/logbrowser/form.php b/mod/logbrowser/views/default/logbrowser/form.php
index c87b67703..7f52d04c9 100644
--- a/mod/logbrowser/views/default/logbrowser/form.php
+++ b/mod/logbrowser/views/default/logbrowser/form.php
@@ -1,3 +1,10 @@
+<?php
+/**
+ * Log browser search form
+ *
+ * @package ElggLogBrowser
+ */
+?>
<div id="logbrowser_search_area">
<?php
@@ -46,12 +53,15 @@
$wrappedform = elgg_view('input/form', array(
'body' => $form,
'method' => 'get',
- 'action' => "pg/admin/logbrowser",
+ 'action' => "pg/admin/overview/logbrowser/",
+ 'disable_security' => true,
));
?>
<div id="log_browser_search_form" class="hidden radius8"><?php echo $wrappedform; ?></div>
<p>
- <a class="link" onclick="elgg_slide_toggle(this,'#logbrowser_search_area','#log_browser_search_form');"><?php echo elgg_echo('logbrowser:search'); ?></a>
+ <a class="link" onclick="elgg_slide_toggle(this,'#logbrowser_search_area','#log_browser_search_form');">
+ <?php echo elgg_echo('logbrowser:search'); ?>
+ </a>
</p>
</div> \ No newline at end of file
diff --git a/mod/logbrowser/views/default/logbrowser/table.php b/mod/logbrowser/views/default/logbrowser/table.php
new file mode 100644
index 000000000..77de5dcaa
--- /dev/null
+++ b/mod/logbrowser/views/default/logbrowser/table.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Log browser table
+ *
+ * @package ElggLogBrowser
+ */
+
+$log_entries = $vars['log_entries'];
+?>
+
+<table class="log_entry">
+ <tr>
+ <th><?php echo elgg_echo('logbrowser:date'); ?></th>
+ <th><?php echo elgg_echo('logbrowser:user:name'); ?></th>
+ <th><?php echo elgg_echo('logbrowser:user:guid'); ?></th>
+ <th><?php echo elgg_echo('logbrowser:object'); ?></th>
+ <th><?php echo elgg_echo('logbrowser:object:guid'); ?></th>
+ <th><?php echo elgg_echo('logbrowser:action'); ?></th>
+ </tr>
+<?php
+ $alt = '';
+ foreach ($log_entries as $entry) {
+ $user = get_entity($entry->performed_by_guid);
+ if ($user) {
+ $user_link = elgg_view('output/url', array(
+ 'href' => $user->getURL(),
+ 'text' => $user->name
+ ));
+ $user_guid_link = elgg_view('output/url', array(
+ 'href' => elgg_get_site_url() . "pg/admin/overview/logbrowser/?user_guid=$user->guid",
+ 'text' => $user->getGUID()
+ ));
+ } else {
+ $user_guid_link = $user_link = '&nbsp;';
+ }
+
+ $object = get_object_from_log_entry($entry->id);
+ if (is_callable(array($object, 'getURL'))) {
+ $object_link = elgg_view('output/url', array(
+ 'href' => $object->getURL(),
+ 'text' => $entry->object_class
+ ));
+ } else {
+ $object_link = $entry->object_class;
+ }
+?>
+ <tr <?php echo $alt; ?>>
+ <td class="log_entry_time">
+ <?php echo date('r', $entry->time_created); ?>
+ </td>
+ <td class="log_entry_user">
+ <?php echo $user_link; ?>
+ </td>
+ <td class="log_entry_guid">
+ <?php echo $user_guid_link; ?>
+ </td>
+ <td class="log_entry_object">
+ <?php echo $object_link; ?>
+ </td>
+ <td class="log_entry_guid">
+ <?php echo $entry->object_id; ?>
+ </td>
+ <td class="log_entry_action">
+ <?php echo elgg_echo($entry->event); ?>
+ </td>
+ </tr>
+<?php
+
+ $alt = $alt ? '' : 'class="alt"';
+ }
+?>
+</table> \ No newline at end of file
diff --git a/mod/logbrowser/views/default/object/logwrapper.php b/mod/logbrowser/views/default/object/logwrapper.php
deleted file mode 100644
index 12d34dfd1..000000000
--- a/mod/logbrowser/views/default/object/logwrapper.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
- /**
- * Elgg log browser.
- *
- * @package ElggLogBrowser
-
-
- */
-
- $entry = $vars['entity']->entry;
-
- $by = get_entity($entry->performed_by_guid);
- $object = get_object_from_log_entry($entry->id);
-
- if (is_callable(array($object, 'getURL')))
- $obj_url = $object->getURL();
-
- //echo elgg_view_listing($icon, $info);
-?>
- <table class="log_entry">
- <tr>
- <td class="log_entry_time">
- <?php echo date('r', $entry->time_created ); ?>
- </td>
- <td class="log_entry_user">
- <?php if ($by) {
- echo "<a href=\"".$by->getURL()."\">{$by->name}</a>";
- echo " <a href=\"?user_guid={$by->guid}\">" . $by->guid . "</a>";
- }
- else echo "&nbsp;"; ?>
- <td>
- <td class="log_entry_item">
- <?php
- if ($obj_url) echo "<a href=\"$obj_url\">";
- echo "{$entry->object_class}";
- if ($obj_url) echo "</a>";
- echo " " . $entry->object_id;
-
- ?>
- </td>
- <td class="log_entry_action">
- <div class="log_entry_action_<?php echo $entry->event; ?>">
- <?php echo elgg_echo($entry->event); ?>
- </div>
- </td>
- </tr>
- </table>
- \ No newline at end of file