aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2012-03-21 17:54:36 -0700
committerBrett Profitt <brett.profitt@gmail.com>2012-03-21 17:54:36 -0700
commitb3438c2d88ba48529275cadd57849cad7fc08e02 (patch)
tree222f271252223b1c5f091d97aadffbf04dce6d86 /start.php
parent5cc8de829c0a7b86c8df27293f4825d0e340d592 (diff)
downloadelgg-b3438c2d88ba48529275cadd57849cad7fc08e02.tar.gz
elgg-b3438c2d88ba48529275cadd57849cad7fc08e02.tar.bz2
Fixes #23. Added a menu item for setting the cover image.
Diffstat (limited to 'start.php')
-rw-r--r--start.php32
1 files changed, 30 insertions, 2 deletions
diff --git a/start.php b/start.php
index 1129c7f2f..e98e19261 100644
--- a/start.php
+++ b/start.php
@@ -88,17 +88,21 @@ function tidypics_init() {
*/
// Register actions
$base_dir = elgg_get_plugins_path() . 'tidypics/actions/photos';
+ elgg_register_action("photos/delete", "$base_dir/delete.php");
+
elgg_register_action("photos/album/save", "$base_dir/album/save.php");
elgg_register_action("photos/album/sort", "$base_dir/album/sort.php");
- elgg_register_action("photos/delete", "$base_dir/delete.php");
+ elgg_register_action("photos/album/set_cover", "$base_dir/album/set_cover.php");
+
elgg_register_action("photos/image/upload", "$base_dir/image/upload.php");
elgg_register_action("photos/image/save", "$base_dir/image/save.php");
- elgg_register_action("photos/batch/edit", "$base_dir/batch/edit.php");
elgg_register_action("photos/image/ajax_upload", "$base_dir/image/ajax_upload.php", 'logged_in');
elgg_register_action("photos/image/ajax_upload_complete", "$base_dir/image/ajax_upload_complete.php", 'logged_in');
elgg_register_action("photos/image/tag", "$base_dir/image/tag.php");
elgg_register_action("photos/image/untag", "$base_dir/image/untag.php");
+ elgg_register_action("photos/batch/edit", "$base_dir/batch/edit.php");
+
elgg_register_action("photos/admin/settings", "$base_dir/admin/settings.php", 'admin');
elgg_register_action("photos/admin/create_thumbnails", "$base_dir/admin/create_thumbnails.php", 'admin');
elgg_register_action("photos/admin/upgrade", "$base_dir/admin/upgrade.php", 'admin');
@@ -293,6 +297,30 @@ function tidypics_entity_menu_setup($hook, $type, $return, $params) {
}
if (elgg_instanceof($entity, 'object', 'image')) {
+ $album = $entity->getContainerEntity();
+ $cover_guid = $album->getCoverImageGuid();
+ if ($cover_guid != $entity->getGUID() && $album->canEdit()) {
+ $url = 'action/photos/album/set_cover'
+ . '?image_guid=' . $entity->getGUID()
+ . '&album_guid=' . $album->getGUID();
+
+ $params = array(
+ 'href' => $url,
+ 'text' => elgg_echo('album:cover_link'),
+ 'is_action' => true,
+ 'is_trusted' => true,
+ 'confirm' => elgg_echo('album:cover')
+ );
+ $text = elgg_view('output/confirmlink', $params);
+
+ $options = array(
+ 'name' => 'set_cover',
+ 'text' => $text,
+ 'priority' => 80,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
+
if (elgg_get_plugin_setting('view_count', 'tidypics')) {
$view_info = $entity->getViewInfo();
$text = elgg_echo('tidypics:views', array((int)$view_info['total']));