diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/logbrowser/graphics/defaultlarge.jpg | bin | 0 -> 10840 bytes | |||
-rw-r--r-- | mod/logbrowser/graphics/defaultmedium.jpg | bin | 0 -> 2517 bytes | |||
-rw-r--r-- | mod/logbrowser/graphics/defaultsmall.jpg | bin | 0 -> 1117 bytes | |||
-rw-r--r-- | mod/logbrowser/graphics/defaulttiny.jpg | bin | 0 -> 965 bytes | |||
-rw-r--r-- | mod/logbrowser/index.php | 38 | ||||
-rw-r--r-- | mod/logbrowser/languages/en.php | 23 | ||||
-rw-r--r-- | mod/logbrowser/manifest.xml | 9 | ||||
-rw-r--r-- | mod/logbrowser/start.php | 49 | ||||
-rw-r--r-- | mod/logbrowser/views/default/logbrowser/gallery.php | 37 | ||||
-rw-r--r-- | mod/logbrowser/views/default/logbrowser/icon.php | 29 | ||||
-rw-r--r-- | mod/logbrowser/views/default/logbrowser/listing.php | 37 | ||||
-rw-r--r-- | mod/logbrowser/views/default/object/logwrapper.php | 18 |
12 files changed, 240 insertions, 0 deletions
diff --git a/mod/logbrowser/graphics/defaultlarge.jpg b/mod/logbrowser/graphics/defaultlarge.jpg Binary files differnew file mode 100644 index 000000000..8b7576c47 --- /dev/null +++ b/mod/logbrowser/graphics/defaultlarge.jpg diff --git a/mod/logbrowser/graphics/defaultmedium.jpg b/mod/logbrowser/graphics/defaultmedium.jpg Binary files differnew file mode 100644 index 000000000..996efac47 --- /dev/null +++ b/mod/logbrowser/graphics/defaultmedium.jpg diff --git a/mod/logbrowser/graphics/defaultsmall.jpg b/mod/logbrowser/graphics/defaultsmall.jpg Binary files differnew file mode 100644 index 000000000..3bda4a3c7 --- /dev/null +++ b/mod/logbrowser/graphics/defaultsmall.jpg diff --git a/mod/logbrowser/graphics/defaulttiny.jpg b/mod/logbrowser/graphics/defaulttiny.jpg Binary files differnew file mode 100644 index 000000000..a83495ee6 --- /dev/null +++ b/mod/logbrowser/graphics/defaulttiny.jpg 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 |