aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/guidtool/export.php22
-rw-r--r--mod/guidtool/format_picker.php25
-rw-r--r--mod/guidtool/import.php4
-rw-r--r--mod/guidtool/index.php18
-rw-r--r--mod/guidtool/languages/en.php4
-rw-r--r--mod/guidtool/start.php52
-rw-r--r--mod/guidtool/view.php22
-rw-r--r--mod/guidtool/views/default/forms/guidtool/export.php23
-rw-r--r--mod/guidtool/views/default/forms/guidtool/format.php40
-rw-r--r--mod/guidtool/views/default/guidtool/gallery.php26
-rw-r--r--mod/guidtool/views/default/guidtool/listing.php31
-rw-r--r--mod/guidtool/views/default/guidtool/profile.php16
-rw-r--r--mod/guidtool/views/default/object/guidtoolwrapper.php21
13 files changed, 299 insertions, 5 deletions
diff --git a/mod/guidtool/export.php b/mod/guidtool/export.php
new file mode 100644
index 000000000..e1a2b86c6
--- /dev/null
+++ b/mod/guidtool/export.php
@@ -0,0 +1,22 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ $entity_guid = get_input('entity_guid');
+
+ // Render the file upload page
+ $title = elgg_echo('guidbrowser:export');
+ $body = elgg_view_title($title);
+ $body .= elgg_view("forms/guidtool/export", array('entity_guid' => $entity_guid));
+
+ $body = elgg_view_layout('one_column', $body);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/mod/guidtool/format_picker.php b/mod/guidtool/format_picker.php
new file mode 100644
index 000000000..f5e12143d
--- /dev/null
+++ b/mod/guidtool/format_picker.php
@@ -0,0 +1,25 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ global $CONFIG;
+
+ admin_gatekeeper();
+
+ $formats = guidtool_get_import_actions();
+
+ $title = elgg_echo("guidtool:pickformat");
+ $body = elgg_view_title($title);
+ $body .= elgg_view('forms/guidtool/format', array('formats' => $formats));
+
+ $body = elgg_view_layout('one_column', $body);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/mod/guidtool/import.php b/mod/guidtool/import.php
index bab06135f..bfb3f698b 100644
--- a/mod/guidtool/import.php
+++ b/mod/guidtool/import.php
@@ -10,11 +10,13 @@
*/
admin_gatekeeper();
+
+ $format = get_input('format', 'opendd');
// Render the file upload page
$title = elgg_echo("guidtool:import");
$body = elgg_view_title($title);
- $body .= elgg_view("forms/guidtool/import");
+ $body .= elgg_view("forms/guidtool/import", array('format' => $format, 'forward_url'));
$body = elgg_view_layout('one_column', $body);
diff --git a/mod/guidtool/index.php b/mod/guidtool/index.php
index 9494d8790..cc10f770f 100644
--- a/mod/guidtool/index.php
+++ b/mod/guidtool/index.php
@@ -19,9 +19,25 @@
$limit = get_input('limit', 10);
$offset = get_input('offset');
+ $title = elgg_echo("guidtool");
+ // Get entities
+ $entities = get_entities("","","","",$limit, $offset);
+ $count = get_entities("","","","",$limit, $offset, true);
+
+ $wrapped_entries = array();
+
+ foreach ($entities as $e)
+ {
+ $tmp = new ElggObject();
+ $tmp->subtype = 'guidtoolwrapper';
+ $tmp->entity = $e;
+ $wrapped_entries[] = $tmp;
+ }
+
+ $body = elgg_view_title($title) . elgg_view_entity_list($wrapped_entries, $count, $offset, $limit, false);
// Display main admin menu
- page_draw(elgg_echo("guidtool"),elgg_view_layout("one_column", $body));
+ page_draw($title,elgg_view_layout("one_column", $body));
set_context($context);
?> \ No newline at end of file
diff --git a/mod/guidtool/languages/en.php b/mod/guidtool/languages/en.php
index e74624605..cb80143e2 100644
--- a/mod/guidtool/languages/en.php
+++ b/mod/guidtool/languages/en.php
@@ -19,6 +19,10 @@
'guidtool:browse' => 'Browse GUID',
'guidtool:import' => 'Import',
'guidtool:import:desc' => 'Paste the data you want to import in following window, this must be in "%s" format.',
+
+ 'guidtool:pickformat' => 'Please select the format that you wish to import or export.',
+
+ 'guidbrowser:export' => 'Export',
);
add_translation("en",$english);
diff --git a/mod/guidtool/start.php b/mod/guidtool/start.php
index f658d5abf..f6e461ed3 100644
--- a/mod/guidtool/start.php
+++ b/mod/guidtool/start.php
@@ -42,8 +42,37 @@
{
switch ($page[0])
{
- case 'import' :
- include($CONFIG->pluginspath . "guidtool/import.php");
+ case 'view' :
+ case 'export':
+
+ if ((isset($page[1]) && (!empty($page[1])))) {
+ add_submenu_item('GUID:'.$page[1], $CONFIG->url . "pg/guidtool/view/{$page[1]}/");
+ add_submenu_item(elgg_echo('guidbrowser:export'), $CONFIG->url . "pg/guidtool/export/{$page[1]}/");
+
+ set_input('entity_guid', $page[1]);
+ if ($page[0] == 'view')
+ include($CONFIG->pluginspath . "guidtool/view.php");
+ else
+ {
+ if ((isset($page[2]) && (!empty($page[2])))) {
+ set_input('format', $page[2]);
+ include($CONFIG->pluginspath . "guidtool/export.php");
+ } else {
+ set_input('forward_url', $CONFIG->url . "pg/guidtool/export/$page[1]/");
+ include($CONFIG->pluginspath . "guidtool/format_picker.php");
+ }
+ }
+ }
+ else include($CONFIG->pluginspath . "guidtool/index.php");
+ break;
+ case 'import' :
+ if ((isset($page[1]) && (!empty($page[1])))) {
+ set_input('format', $page[1]);
+ include($CONFIG->pluginspath . "guidtool/import.php");
+ } else {
+ set_input('forward_url', $CONFIG->url . "pg/guidtool/import/");
+ include($CONFIG->pluginspath . "guidtool/format_picker.php");
+ }
break;
default:
include($CONFIG->pluginspath . "guidtool/index.php");
@@ -53,7 +82,24 @@
include($CONFIG->pluginspath . "guidtool/index.php");
}
-
+ /**
+ * Get a list of import actions
+ *
+ */
+ function guidtool_get_import_actions()
+ {
+ global $CONFIG;
+
+ $return = array();
+
+ foreach ($CONFIG->actions as $action => $handler)
+ {
+ if (strpos($action, "import/")===0)
+ $return[] = substr($action, 7);
+ }
+
+ return $return;
+ }
// Initialise log
register_elgg_event_handler('init','system','guidtool_init');
diff --git a/mod/guidtool/view.php b/mod/guidtool/view.php
new file mode 100644
index 000000000..c9f1f9fc5
--- /dev/null
+++ b/mod/guidtool/view.php
@@ -0,0 +1,22 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ $entity_guid = get_input('entity_guid');
+
+ // Render the file upload page
+ $title = "GUID: $entity_guid";
+ $body = elgg_view_title($title);
+ $body .= elgg_view("guidtool/profile", array('entity_guid' => $entity_guid));
+
+ $body = elgg_view_layout('one_column', $body);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/mod/guidtool/views/default/forms/guidtool/export.php b/mod/guidtool/views/default/forms/guidtool/export.php
new file mode 100644
index 000000000..cb92991a2
--- /dev/null
+++ b/mod/guidtool/views/default/forms/guidtool/export.php
@@ -0,0 +1,23 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ global $CONFIG;
+
+ $format = $vars['format'];
+ if (!$format) $format = 'opendd';
+
+ $entity_guid = get_input('entity_guid');
+
+
+?>
+<div id="export">
+<?php echo elgg_view('output/longtext', array('value' => htmlentities(file_get_contents($CONFIG->url . "export/$format/$entity_guid/")))) ?>
+</div> \ No newline at end of file
diff --git a/mod/guidtool/views/default/forms/guidtool/format.php b/mod/guidtool/views/default/forms/guidtool/format.php
new file mode 100644
index 000000000..7a3f397d5
--- /dev/null
+++ b/mod/guidtool/views/default/forms/guidtool/format.php
@@ -0,0 +1,40 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ $formats = $vars['formats'];
+
+ if (!$formats)
+ $formats = array('opendd');
+
+ $format = get_input('format');
+ if ($format)
+ {
+ forward(get_input('forward_url') . $format . "/");
+ exit;
+ }
+
+?>
+
+<div id="formatpicker">
+ <form method="get">
+ <select name="format">
+ <?php
+ foreach ($formats as $format)
+ {
+ ?>
+ <option value="<?php echo $format; ?>"><?php echo $format; ?></option>
+ <?php
+ }
+ ?>
+ </select>
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo("go"); ?>" />
+ </form>
+</div> \ No newline at end of file
diff --git a/mod/guidtool/views/default/guidtool/gallery.php b/mod/guidtool/views/default/guidtool/gallery.php
new file mode 100644
index 000000000..9212df17b
--- /dev/null
+++ b/mod/guidtool/views/default/guidtool/gallery.php
@@ -0,0 +1,26 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ global $CONFIG;
+
+ $entity = $vars['entity']->entity;
+ $by = $entity->getOwnerEntity();
+
+
+
+ $info .= "<p><b><a href=\"{$CONFIG->url}pg/guidtool/view/{$entity->guid}/\">" . get_class($entity) . "</a></b></p>";
+
+ $info .= "<div>";
+ if ($by) $info .= elgg_echo('by') . " <a href=\"".$by->getURL()."\">{$by->name}</a> ";
+ $info .= " " . friendly_time($entity->time_created )."</div>";
+
+ echo elgg_view_listing($icon, $info);
+?> \ No newline at end of file
diff --git a/mod/guidtool/views/default/guidtool/listing.php b/mod/guidtool/views/default/guidtool/listing.php
new file mode 100644
index 000000000..21d93b64a
--- /dev/null
+++ b/mod/guidtool/views/default/guidtool/listing.php
@@ -0,0 +1,31 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ global $CONFIG;
+
+ $entity = $vars['entity']->entity;
+ $by = $entity->getOwnerEntity();
+
+ $icon = elgg_view(
+ 'graphics/icon', array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
+
+ $info .= "<p><b><a href=\"{$CONFIG->url}pg/guidtool/view/{$entity->guid}/\">" . get_class($entity) . "</a></b></p>";
+
+ $info .= "<div>";
+ if ($by) $info .= elgg_echo('by') . " <a href=\"".$by->getURL()."\">{$by->name}</a> ";
+ $info .= " " . friendly_time($entity->time_created )."</div>";
+
+ echo elgg_view_listing($icon, $info);
+?> \ No newline at end of file
diff --git a/mod/guidtool/views/default/guidtool/profile.php b/mod/guidtool/views/default/guidtool/profile.php
new file mode 100644
index 000000000..d32141b11
--- /dev/null
+++ b/mod/guidtool/views/default/guidtool/profile.php
@@ -0,0 +1,16 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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/
+ */
+
+ $entity_guid = $vars['entity_guid'];
+
+
+ echo elgg_view('export/entity', array('entity' => get_entity($entity_guid)));
+?> \ No newline at end of file
diff --git a/mod/guidtool/views/default/object/guidtoolwrapper.php b/mod/guidtool/views/default/object/guidtoolwrapper.php
new file mode 100644
index 000000000..d83f7fb30
--- /dev/null
+++ b/mod/guidtool/views/default/object/guidtoolwrapper.php
@@ -0,0 +1,21 @@
+<?php
+ /**
+ * Elgg GUID Tool
+ *
+ * @package ElggGUIDTool
+ * @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 ($vars['full']) {
+ echo elgg_view("guidtool/profile",$vars);
+ } else {
+ if (get_input('search_viewtype') == "gallery") {
+ echo elgg_view('guidtool/gallery',$vars);
+ } else {
+ echo elgg_view("guidtool/listing",$vars);
+ }
+ }
+?> \ No newline at end of file