aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-09 15:13:03 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-09 15:13:03 +0000
commitd1f12039e6ddd29dd18bb9132673e6ff6668e5f0 (patch)
treea7bb5f81b96cc14cff709645af5860881d55fea5
parente71557a73340f21fc43f5a80f7baabecca43289a (diff)
downloadelgg-d1f12039e6ddd29dd18bb9132673e6ff6668e5f0.tar.gz
elgg-d1f12039e6ddd29dd18bb9132673e6ff6668e5f0.tar.bz2
Refs #492: Export and delete links next to entity
git-svn-id: https://code.elgg.org/elgg/trunk@2688 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/guidtool/actions/delete.php21
-rw-r--r--mod/guidtool/languages/en.php3
-rw-r--r--mod/guidtool/start.php4
-rw-r--r--mod/guidtool/views/default/guidtool/listing.php11
4 files changed, 37 insertions, 2 deletions
diff --git a/mod/guidtool/actions/delete.php b/mod/guidtool/actions/delete.php
new file mode 100644
index 000000000..36126ee10
--- /dev/null
+++ b/mod/guidtool/actions/delete.php
@@ -0,0 +1,21 @@
+<?php
+ global $CONFIG;
+
+ admin_gatekeeper();
+ action_gatekeeper();
+
+ $guid = (int)get_input('guid');
+ $entity = get_entity($guid);
+
+ if ($entity)
+ {
+ if ($entity->delete())
+ system_message(sprintf(elgg_echo('guidtool:deleted'), $guid));
+ else
+ register_error(sprintf(elgg_echo('guidtool:notdeleted'), $guid));
+ }
+ else
+ register_error(sprintf(elgg_echo('guidtool:notdeleted'), $guid));
+
+ forward($_SERVER['HTTP_REFERER']);
+?> \ No newline at end of file
diff --git a/mod/guidtool/languages/en.php b/mod/guidtool/languages/en.php
index 6c7f9e383..5365deede 100644
--- a/mod/guidtool/languages/en.php
+++ b/mod/guidtool/languages/en.php
@@ -23,6 +23,9 @@
'guidtool:pickformat' => 'Please select the format that you wish to import or export.',
'guidbrowser:export' => 'Export',
+
+ 'guidtool:deleted' => 'GUID %d deleted',
+ 'guidtool:notdeleted' => 'GUID %d not deleted',
);
add_translation("en",$english);
diff --git a/mod/guidtool/start.php b/mod/guidtool/start.php
index 5af18b904..0a416320b 100644
--- a/mod/guidtool/start.php
+++ b/mod/guidtool/start.php
@@ -27,6 +27,10 @@
// Register a page handler, so we can have nice URLs
register_page_handler('guidtool','guidtool_page_handler');
+
+ // Register some actions
+ register_action("guidtool/delete",false, $CONFIG->pluginspath . "guidtool/actions/delete.php", true);
+
}
/**
diff --git a/mod/guidtool/views/default/guidtool/listing.php b/mod/guidtool/views/default/guidtool/listing.php
index fed278568..d543b8e03 100644
--- a/mod/guidtool/views/default/guidtool/listing.php
+++ b/mod/guidtool/views/default/guidtool/listing.php
@@ -20,13 +20,20 @@
'size' => 'small',
)
);
-
+
+ $ts = time();
+ $token = generate_action_token($ts);
+
+ $controllinks = "<a href=\"{$CONFIG->url}pg/guidtool/export/{$entity->guid}/\">".elgg_echo('export')."</a> ";
+ if ($entity->canEdit())
+ $controllinks .= elgg_view('output/confirmlink', array('text' => elgg_echo('delete'), 'href' => "{$CONFIG->url}action/guidtool/delete?guid={$entity->guid}&__elgg_token=$token&__elgg_ts=$ts"));
+
$strap = $entity->title ? $entity->title : $entity->name;
$info .= "<p><b><a href=\"{$CONFIG->url}pg/guidtool/view/{$entity->guid}/\">[GUID:{$entity->guid}] " . get_class($entity) . " " . get_subtype_from_id($entity->subtype) . "</a></b> $strap</p>";
$info .= "<div>";
if ($by) $info .= elgg_echo('by') . " <a href=\"".$by->getURL()."\">{$by->name}</a> ";
- $info .= " " . friendly_time($entity->time_created )."</div>";
+ $info .= " " . friendly_time($entity->time_created )." [$controllinks]</div>";
echo elgg_view_listing($icon, $info);
?> \ No newline at end of file