From 243e836190128b14e1c5aa53b6d01b6771b19d8c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 31 Oct 2010 20:03:50 +0000 Subject: First cut at a album sorting interface --- actions/sortalbum.php | 18 ++++++++++++++ languages/en.php | 6 +++++ pages/sortalbum.php | 38 +++++++++++++++++++++++++++++ pages/viewalbum.php | 3 +++ start.php | 8 ++++++ views/default/tidypics/css.php | 20 ++++++++++++++- views/default/tidypics/sort.php | 54 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 actions/sortalbum.php create mode 100644 pages/sortalbum.php create mode 100644 views/default/tidypics/sort.php diff --git a/actions/sortalbum.php b/actions/sortalbum.php new file mode 100644 index 000000000..1aa0e052f --- /dev/null +++ b/actions/sortalbum.php @@ -0,0 +1,18 @@ +setImageList($guids); + +system_message(sprintf(elgg_echo('tidypics:album:sorted'), $album->title)); +forward($album->getURL()); \ No newline at end of file diff --git a/languages/en.php b/languages/en.php index 2bb18d959..b2c88b27c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -49,6 +49,7 @@ $english = array( 'tidypics:stats' => 'Stats', 'tidypics:nophotosingroup' => 'This groups does not have any photos yet', 'tidypics:upgrade' => 'Upgrade', + 'tidypics:sort' => 'Sorting the %s album', 'flickr:setup' => 'Flickr Setup', 'flickr:usernamesetup' => 'Please enter your Flickr username here:', @@ -97,6 +98,7 @@ $english = array( 'album:addpix' => "Add photos to album", 'album:edit' => "Edit album", 'album:delete' => "Delete album", + 'album:sort' => "Sort album", 'image:edit' => "Edit image", 'image:delete' => "Delete image", @@ -116,6 +118,9 @@ $english = array( 'tidypics:uploader:filedesc' => 'Image files (jpeg, png, gif)', 'tidypics:uploader:instructs' => 'There are three easy steps for adding photos to your album using this uploader: choosing, uploading, and describing them. If you do not have Flash, there is also a basic uploader available.', 'tidypics:uploader:basic' => 'You can upload up to 10 photos at a time (%s MB maximum per photo)', + + 'tidypics:sort:instruct' => 'Sort the album photos by dragging and dropping the images. Then click the save button.', + //views 'image:total' => "Images in album:", @@ -195,6 +200,7 @@ The photo can be viewed here: %s", 'album:delete:confirm' => "Are you sure you want to delete this album?", 'album:created' => "Your new album has been created.", 'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings', + 'tidypics:album:sorted' => 'The album %s is sorted', 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success', diff --git a/pages/sortalbum.php b/pages/sortalbum.php new file mode 100644 index 000000000..0bbd8159e --- /dev/null +++ b/pages/sortalbum.php @@ -0,0 +1,38 @@ +container_guid) { + set_page_owner($album->container_guid); +} else { + set_page_owner($album->owner_guid); +} + +$owner = page_owner_entity(); + +$title = sprintf(elgg_echo('tidypics:sort'), $album->title); + +$content = elgg_view_title($title); +$content .= elgg_view('tidypics/sort', array('album' => $album)); + +$body = elgg_view_layout('two_column_left_sidebar', '', $content); + +page_draw($title, $body); diff --git a/pages/viewalbum.php b/pages/viewalbum.php index fe3c5bc62..870596769 100644 --- a/pages/viewalbum.php +++ b/pages/viewalbum.php @@ -54,6 +54,9 @@ if (can_write_to_container(0, $album->container_guid)) { add_submenu_item( elgg_echo('album:addpix'), $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid, 'photos'); + add_submenu_item( elgg_echo('album:sort'), + $CONFIG->wwwroot . 'pg/photos/sort/' . $album_guid, + 'photos'); add_submenu_item( elgg_echo('album:edit'), $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid, 'photos'); diff --git a/start.php b/start.php index 4d2b12798..1401c2c2c 100644 --- a/start.php +++ b/start.php @@ -257,6 +257,13 @@ function tidypics_page_handler($page) { include($CONFIG->pluginspath . "tidypics/pages/viewalbum.php"); break; + case "sort": //sort a photo album + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include($CONFIG->pluginspath . "tidypics/pages/sortalbum.php"); + break; + case "new": //create new album if (isset($page[1])) { set_input('username', $page[1]); @@ -532,6 +539,7 @@ register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypics/actio register_action("tidypics/ajax_upload", true, $CONFIG->pluginspath . "tidypics/actions/ajax_upload.php"); register_action("tidypics/ajax_upload_complete", true, $CONFIG->pluginspath . "tidypics/actions/ajax_upload_complete.php"); register_action("tidypics/addalbum", false, $CONFIG->pluginspath. "tidypics/actions/addalbum.php"); +register_action("tidypics/sortalbum", false, $CONFIG->pluginspath. "tidypics/actions/sortalbum.php"); register_action("tidypics/edit", false, $CONFIG->pluginspath. "tidypics/actions/edit.php"); register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php"); register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php"); diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php index f7dd256a1..abcdc86a9 100644 --- a/views/default/tidypics/css.php +++ b/views/default/tidypics/css.php @@ -384,4 +384,22 @@ float: right; .uploadifyError { border: 2px solid #FBCBBC; background-color: #FDE5DD; -} \ No newline at end of file +} + +#tidypics_album_sort { +padding:0; +margin:0; +} + +#tidypics_album_sort li { +float:left; +margin:3px; +width:161px; +height:161px; +} + +#tidypics_album_sort img { +border:1px solid #dedede; +padding:4px; +} + diff --git a/views/default/tidypics/sort.php b/views/default/tidypics/sort.php new file mode 100644 index 000000000..66dd8a999 --- /dev/null +++ b/views/default/tidypics/sort.php @@ -0,0 +1,54 @@ +getImageList(); + +// create submission form +$body = elgg_view('input/hidden', array('internalname' => 'guids')); +$body .= elgg_view('input/hidden', array('internalname' => 'album_guid', 'value' => $album->guid)); +$body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); +?> +
+
+ +
+ 'tidypics_sort_form', + 'action' => "{$vars['url']}action/tidypics/sortalbum", + 'body' => $body, + ); + echo elgg_view('input/form', $params); + ?> + + +
+
+ + \ No newline at end of file -- cgit v1.2.3