aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'start.php')
-rw-r--r--start.php42
1 files changed, 36 insertions, 6 deletions
diff --git a/start.php b/start.php
index 1129c7f2f..13a9e2d85 100644
--- a/start.php
+++ b/start.php
@@ -78,7 +78,8 @@ function tidypics_init() {
elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'tidypics_notify_message');
// ajax handler for uploads when use_only_cookies is set
- elgg_register_plugin_hook_handler('forward', 'csrf', 'tidypics_ajax_session_handler');
+ // using the all forward hook to work with walled gardens.
+ elgg_register_plugin_hook_handler('forward', 'all', 'tidypics_ajax_session_handler');
/*
// Register for notifications
@@ -88,17 +89,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 +298,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']));
@@ -318,7 +347,8 @@ function tidypics_entity_menu_setup($hook, $type, $return, $params) {
}
}
- if (elgg_instanceof($entity, 'object', 'album')) {
+ // only show these options if there are images
+ if (elgg_instanceof($entity, 'object', 'album') && $entity->getSize() > 0) {
$url = $entity->getURL() . '?limit=50&view=rss';
$url = elgg_format_url($url);
$slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
@@ -394,14 +424,14 @@ function tidypics_notify_message($hook, $type, $result, $params) {
if ($entity->first_upload) {
$descr = $entity->description;
- $title = $entity->title;
+ $title = $entity->getTitle();
$owner = $entity->getOwnerEntity();
return elgg_echo('tidypics:newalbum', array($owner->name))
. ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
} else {
if ($entity->shouldNotify()) {
$descr = $entity->description;
- $title = $entity->title;
+ $title = $entity->getTitle();
$owner = $entity->getOwnerEntity();
return elgg_echo('tidypics:updatealbum', array($owner->name, $title)) . ': ' . $entity->getURL();