aboutsummaryrefslogtreecommitdiff
path: root/mod/logbrowser
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 16:42:04 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 16:42:04 +0000
commitf93ce10e56f335cfe1678ea93ca971f77eb839e1 (patch)
treeff3c81a8643cfa093cf1f902b243282b31e03324 /mod/logbrowser
parentf4df8ab602cd8d9d2ead55999f312b2da6eea1e0 (diff)
downloadelgg-f93ce10e56f335cfe1678ea93ca971f77eb839e1.tar.gz
elgg-f93ce10e56f335cfe1678ea93ca971f77eb839e1.tar.bz2
Added basic log browser.
updateclient & logbrowser are switched on by default in new installs. git-svn-id: https://code.elgg.org/elgg/trunk@1579 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/logbrowser')
-rw-r--r--mod/logbrowser/graphics/defaultlarge.jpgbin0 -> 10840 bytes
-rw-r--r--mod/logbrowser/graphics/defaultmedium.jpgbin0 -> 2517 bytes
-rw-r--r--mod/logbrowser/graphics/defaultsmall.jpgbin0 -> 1117 bytes
-rw-r--r--mod/logbrowser/graphics/defaulttiny.jpgbin0 -> 965 bytes
-rw-r--r--mod/logbrowser/index.php38
-rw-r--r--mod/logbrowser/languages/en.php23
-rw-r--r--mod/logbrowser/manifest.xml9
-rw-r--r--mod/logbrowser/start.php49
-rw-r--r--mod/logbrowser/views/default/logbrowser/gallery.php37
-rw-r--r--mod/logbrowser/views/default/logbrowser/icon.php29
-rw-r--r--mod/logbrowser/views/default/logbrowser/listing.php37
-rw-r--r--mod/logbrowser/views/default/object/logwrapper.php18
12 files changed, 240 insertions, 0 deletions
diff --git a/mod/logbrowser/graphics/defaultlarge.jpg b/mod/logbrowser/graphics/defaultlarge.jpg
new file mode 100644
index 000000000..8b7576c47
--- /dev/null
+++ b/mod/logbrowser/graphics/defaultlarge.jpg
Binary files differ
diff --git a/mod/logbrowser/graphics/defaultmedium.jpg b/mod/logbrowser/graphics/defaultmedium.jpg
new file mode 100644
index 000000000..996efac47
--- /dev/null
+++ b/mod/logbrowser/graphics/defaultmedium.jpg
Binary files differ
diff --git a/mod/logbrowser/graphics/defaultsmall.jpg b/mod/logbrowser/graphics/defaultsmall.jpg
new file mode 100644
index 000000000..3bda4a3c7
--- /dev/null
+++ b/mod/logbrowser/graphics/defaultsmall.jpg
Binary files differ
diff --git a/mod/logbrowser/graphics/defaulttiny.jpg b/mod/logbrowser/graphics/defaulttiny.jpg
new file mode 100644
index 000000000..a83495ee6
--- /dev/null
+++ b/mod/logbrowser/graphics/defaulttiny.jpg
Binary files differ
diff --git a/mod/logbrowser/index.php b/mod/logbrowser/index.php
new file mode 100644
index 000000000..8afecc9bd
--- /dev/null
+++ b/mod/logbrowser/index.php
@@ -0,0 +1,38 @@
+<?php
+ /**
+ * Elgg log browser.
+ *
+ * @package ElggLogBrowser
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+
+ $context = get_context();
+ set_context('search');
+
+ $limit = get_input('limit', 10);
+ $offset = get_input('offset');
+
+ // Get log entries
+ $log = get_system_log("", "","",$limit, $offset);
+ $count = get_system_log("", "","",$limit, $offset, true);
+ $log_entries = array();
+
+ foreach ($log as $l)
+ {
+ $tmp = new ElggObject();
+ $tmp->subtype = 'logwrapper';
+ $tmp->entry = $l;
+ $log_entries[] = $tmp;
+ }
+
+ $result = elgg_view_entity_list($log_entries, $count, $offset, $limit, false);
+
+// Display main admin menu
+ page_draw(elgg_echo("logbrowser"),elgg_view_layout("one_column", $result));
+ set_context($context);
+
+?> \ No newline at end of file
diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php
new file mode 100644
index 000000000..50ba14fc7
--- /dev/null
+++ b/mod/logbrowser/languages/en.php
@@ -0,0 +1,23 @@
+<?php
+ /**
+ * Elgg log browser plugin language pack
+ *
+ * @package ElggLogBrowser
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $english = array(
+
+ /**
+ * Menu items and titles
+ */
+
+ 'logbrowser' => 'Log browser',
+ 'logbrowser:browse' => 'Browse system log',
+ );
+
+ add_translation("en",$english);
+?> \ No newline at end of file
diff --git a/mod/logbrowser/manifest.xml b/mod/logbrowser/manifest.xml
new file mode 100644
index 000000000..e7db2bb83
--- /dev/null
+++ b/mod/logbrowser/manifest.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+ <field key="author" value="Marcus Povey" />
+ <field key="version" value="1.0" />
+ <field key="description" value="Browse the system event log" />
+ <field key="website" value="http://www.elgg.org/" />
+ <field key="copyright" value="(C) Curverider 2008" />
+ <field key="licence" value="GNU Public License version 2" />
+</plugin_manifest> \ No newline at end of file
diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php
new file mode 100644
index 000000000..c1b4ff73f
--- /dev/null
+++ b/mod/logbrowser/start.php
@@ -0,0 +1,49 @@
+<?php
+ /**
+ * Elgg log browser.
+ *
+ * @package ElggLogBrowser
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ /**
+ * Initialise the log browser and set up the menus.
+ *
+ */
+ function logbrowser_init()
+ {
+ global $CONFIG;
+
+ if (isadminloggedin())
+ {
+ add_menu(elgg_echo('logbrowser'), $CONFIG->wwwroot . "pg/logbrowser/",array(
+ menu_item(elgg_echo('logbrowser:browse'), $CONFIG->wwwroot."pg/logbrowser/"),
+ ),'logbrowser');
+
+ }
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('logbrowser','logbrowser_page_handler');
+ }
+
+ /**
+ * Log browser page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+ function logbrowser_page_handler($page)
+ {
+ global $CONFIG;
+
+ // only interested in one page for now
+ include($CONFIG->pluginspath . "logbrowser/index.php");
+ }
+
+
+
+ // Initialise log
+ register_elgg_event_handler('init','system','logbrowser_init');
+?> \ No newline at end of file
diff --git a/mod/logbrowser/views/default/logbrowser/gallery.php b/mod/logbrowser/views/default/logbrowser/gallery.php
new file mode 100644
index 000000000..1c8de10e6
--- /dev/null
+++ b/mod/logbrowser/views/default/logbrowser/gallery.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg log browser.
+ *
+ * @package ElggLogBrowser
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $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();
+
+ $icon = elgg_view(
+ "logbrowser/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
+
+ $info .= "<p><b>";
+ if ($obj_url) $info .= "<a href=\"$obj_url\">";
+ $info .= "{$entry->object_class}";
+ if ($obj_url) $info .= "</a>";
+ $info .= " " . elgg_echo($entry->event) . "</b></p>";
+
+ $info .= "<div>" . elgg_echo('by') . " <a href=\"".$by->getURL()."\">{$by->name}</a> ".date('r', $entry->time_created )."</div>";
+
+ echo elgg_view_listing($icon, $info);
+?> \ No newline at end of file
diff --git a/mod/logbrowser/views/default/logbrowser/icon.php b/mod/logbrowser/views/default/logbrowser/icon.php
new file mode 100644
index 000000000..233442f50
--- /dev/null
+++ b/mod/logbrowser/views/default/logbrowser/icon.php
@@ -0,0 +1,29 @@
+<?php
+ /**
+ * Elgg log browser.
+ *
+ * @package ElggLogBrowser
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+ $group = $vars['entity'];
+
+ // Get size
+ if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar')))
+ $vars['size'] = "medium";
+
+ // Get any align and js
+ if (!empty($vars['align'])) {
+ $align = " align=\"{$vars['align']}\" ";
+ } else {
+ $align = "";
+ }
+
+
+?>
+
+<div class="logbrowsericon">
+<img src="<?php echo $vars['url']; ?>mod/logbrowser/graphics/default<?php echo $vars['size']; ?>.jpg" border="0" <?php echo $align; ?> <?php echo $vars['js']; ?> />
+</div> \ No newline at end of file
diff --git a/mod/logbrowser/views/default/logbrowser/listing.php b/mod/logbrowser/views/default/logbrowser/listing.php
new file mode 100644
index 000000000..1c8de10e6
--- /dev/null
+++ b/mod/logbrowser/views/default/logbrowser/listing.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg log browser.
+ *
+ * @package ElggLogBrowser
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $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();
+
+ $icon = elgg_view(
+ "logbrowser/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
+
+ $info .= "<p><b>";
+ if ($obj_url) $info .= "<a href=\"$obj_url\">";
+ $info .= "{$entry->object_class}";
+ if ($obj_url) $info .= "</a>";
+ $info .= " " . elgg_echo($entry->event) . "</b></p>";
+
+ $info .= "<div>" . elgg_echo('by') . " <a href=\"".$by->getURL()."\">{$by->name}</a> ".date('r', $entry->time_created )."</div>";
+
+ echo elgg_view_listing($icon, $info);
+?> \ No newline at end of file
diff --git a/mod/logbrowser/views/default/object/logwrapper.php b/mod/logbrowser/views/default/object/logwrapper.php
new file mode 100644
index 000000000..673d732e8
--- /dev/null
+++ b/mod/logbrowser/views/default/object/logwrapper.php
@@ -0,0 +1,18 @@
+<?php
+ /**
+ * Elgg log browser.
+ *
+ * @package ElggLogBrowser
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ if (get_input('search_viewtype') == "gallery") {
+ echo elgg_view('logbrowser/gallery',$vars);
+ } else {
+ echo elgg_view("logbrowser/listing",$vars);
+ }
+
+?> \ No newline at end of file