From 4e0c1576475390faa2f1fb4c4dc2902a953f440e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 25 Feb 2009 12:16:53 +0000 Subject: First commit --- actions/addalbum.php | 72 ++++++++++ actions/delete.php | 105 +++++++++++++++ actions/download.php | 43 ++++++ actions/edit_multi.php | 62 +++++++++ actions/editalbum.php | 91 +++++++++++++ actions/icon.php | 41 ++++++ actions/upload.php | 133 +++++++++++++++++++ contributions.txt | 170 ++++++++++++++++++++++++ edit.php | 46 +++++++ edit_multi.php | 33 +++++ friends.php | 43 ++++++ graphics/Thumbs.db | Bin 0 -> 18944 bytes graphics/arrow_next.gif | Bin 0 -> 304 bytes graphics/arrow_previous.gif | Bin 0 -> 306 bytes graphics/bl.gif | Bin 0 -> 215 bytes graphics/br.gif | Bin 0 -> 217 bytes graphics/btnClose.gif | Bin 0 -> 361 bytes graphics/btnContract.gif | Bin 0 -> 188 bytes graphics/btnExpand.gif | Bin 0 -> 192 bytes graphics/btnNext.gif | Bin 0 -> 308 bytes graphics/btnPrevious.gif | Bin 0 -> 317 bytes graphics/icons/Thumbs.db | Bin 0 -> 24064 bytes graphics/icons/album.gif | Bin 0 -> 1411 bytes graphics/icons/general.jpg | Bin 0 -> 7036 bytes graphics/icons/general.png | Bin 0 -> 7177 bytes graphics/icons/river_icon_album.gif | Bin 0 -> 398 bytes graphics/icons/river_icon_image.gif | Bin 0 -> 284 bytes graphics/img_error.jpg | Bin 0 -> 5864 bytes graphics/loader.gif | Bin 0 -> 2545 bytes graphics/tl.gif | Bin 0 -> 214 bytes graphics/tr.gif | Bin 0 -> 217 bytes graphics/ttl.gif | Bin 0 -> 288 bytes graphics/ttp.gif | Bin 0 -> 192 bytes graphics/ttr.gif | Bin 0 -> 288 bytes index.php | 45 +++++++ languages/de.php | 114 ++++++++++++++++ languages/en.php | 115 ++++++++++++++++ languages/es.php | 115 ++++++++++++++++ languages/pl.php | 115 ++++++++++++++++ manifest.xml | 9 ++ newalbum.php | 31 +++++ start.php | 174 +++++++++++++++++++++++++ tasks.txt | 66 ++++++++++ thumbnail.php | 55 ++++++++ tidypics_user_instructions_.txt | 71 ++++++++++ upload.php | 49 +++++++ view.php | 62 +++++++++ views/default/input/accessRead.php | 61 +++++++++ views/default/input/cover_checkbox.php | 45 +++++++ views/default/input/multi_radio.php | 42 ++++++ views/default/object/album.php | 137 +++++++++++++++++++ views/default/object/image.php | 130 ++++++++++++++++++ views/default/river/object/album/annotate.php | 13 ++ views/default/river/object/album/create.php | 13 ++ views/default/river/object/image/annotate.php | 13 ++ views/default/river/object/image/create.php | 13 ++ views/default/settings/tidypics/edit.php | 10 ++ views/default/tidypics/css.php | 128 ++++++++++++++++++ views/default/tidypics/forms/edit.php | 115 ++++++++++++++++ views/default/tidypics/forms/edit_multi.php | 44 +++++++ views/default/tidypics/forms/upload.php | 79 +++++++++++ views/default/tidypics/groupprofile_albums.php | 60 +++++++++ views/default/tidypics/icon.php | 41 ++++++ views/default/tidypics/menu.php | 16 +++ views/default/widgets/album_view/edit.php | 21 +++ views/default/widgets/album_view/view.php | 53 ++++++++ views/rss/object/file.php | 30 +++++ world.php | 37 ++++++ 68 files changed, 2961 insertions(+) create mode 100644 actions/addalbum.php create mode 100644 actions/delete.php create mode 100644 actions/download.php create mode 100644 actions/edit_multi.php create mode 100644 actions/editalbum.php create mode 100644 actions/icon.php create mode 100644 actions/upload.php create mode 100644 contributions.txt create mode 100644 edit.php create mode 100644 edit_multi.php create mode 100644 friends.php create mode 100644 graphics/Thumbs.db create mode 100644 graphics/arrow_next.gif create mode 100644 graphics/arrow_previous.gif create mode 100644 graphics/bl.gif create mode 100644 graphics/br.gif create mode 100644 graphics/btnClose.gif create mode 100644 graphics/btnContract.gif create mode 100644 graphics/btnExpand.gif create mode 100644 graphics/btnNext.gif create mode 100644 graphics/btnPrevious.gif create mode 100644 graphics/icons/Thumbs.db create mode 100644 graphics/icons/album.gif create mode 100644 graphics/icons/general.jpg create mode 100644 graphics/icons/general.png create mode 100644 graphics/icons/river_icon_album.gif create mode 100644 graphics/icons/river_icon_image.gif create mode 100644 graphics/img_error.jpg create mode 100644 graphics/loader.gif create mode 100644 graphics/tl.gif create mode 100644 graphics/tr.gif create mode 100644 graphics/ttl.gif create mode 100644 graphics/ttp.gif create mode 100644 graphics/ttr.gif create mode 100644 index.php create mode 100644 languages/de.php create mode 100644 languages/en.php create mode 100644 languages/es.php create mode 100644 languages/pl.php create mode 100644 manifest.xml create mode 100644 newalbum.php create mode 100644 start.php create mode 100644 tasks.txt create mode 100644 thumbnail.php create mode 100644 tidypics_user_instructions_.txt create mode 100644 upload.php create mode 100644 view.php create mode 100644 views/default/input/accessRead.php create mode 100644 views/default/input/cover_checkbox.php create mode 100644 views/default/input/multi_radio.php create mode 100644 views/default/object/album.php create mode 100644 views/default/object/image.php create mode 100644 views/default/river/object/album/annotate.php create mode 100644 views/default/river/object/album/create.php create mode 100644 views/default/river/object/image/annotate.php create mode 100644 views/default/river/object/image/create.php create mode 100644 views/default/settings/tidypics/edit.php create mode 100644 views/default/tidypics/css.php create mode 100644 views/default/tidypics/forms/edit.php create mode 100644 views/default/tidypics/forms/edit_multi.php create mode 100644 views/default/tidypics/forms/upload.php create mode 100644 views/default/tidypics/groupprofile_albums.php create mode 100644 views/default/tidypics/icon.php create mode 100644 views/default/tidypics/menu.php create mode 100644 views/default/widgets/album_view/edit.php create mode 100644 views/default/widgets/album_view/view.php create mode 100644 views/rss/object/file.php create mode 100644 world.php diff --git a/actions/addalbum.php b/actions/addalbum.php new file mode 100644 index 000000000..127885270 --- /dev/null +++ b/actions/addalbum.php @@ -0,0 +1,72 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + // Make sure we're logged in (send us to the front page if not) + if (!isloggedin()) forward(); + + // Get input data + $title = get_input('albumtitle'); + $body = get_input('albumbody'); + $tags = get_input('albumtags'); + $access = get_input('access_id'); + $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); + $back_url = 'pg/photos/new/' . get_entity($container_guid)->username; + + // Cache to the session + $_SESSION['albumtitle'] = $title; + $_SESSION['albumbody'] = $body; + $_SESSION['albumtags'] = $tags; + + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags); + // Make sure the title / description aren't blank + if (empty($title) || empty($body)) { + register_error(elgg_echo("album:blank")); + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page + + // Otherwise, save the blog post + } else { + + // Initialise a new ElggObject + $album = new ElggObject(); + // Tell the system it's an album + $album->subtype = "album"; + + // Set its owner to the current user + $album->container_guid = $container_guid; + $album->owner_guid = $_SESSION['user']->getGUID(); + // For now, set its access to public (we'll add an access dropdown shortly) + $album->access_id = $access; + // Set its title and description appropriately + $album->title = $title; + $album->description = $body; + // Before we can set metadata, we need to save the blog post + if (!$album->save()) { + register_error(elgg_echo("album:error")); + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page + } + // Now let's add tags. We can pass an array directly to the object property! Easy. + if (is_array($tagarray)) { + $album->tags = $tagarray; + } + // Success message + system_message(elgg_echo("album:created")); + // Remove the blog post cache + unset($_SESSION['albumtitle']); + unset($_SESSION['albumbody']); + unset($_SESSION['albumtags']); + // Forward to the main blog page + + forward("pg/photos/upload/" . $album->guid); + + } + +?> \ No newline at end of file diff --git a/actions/delete.php b/actions/delete.php new file mode 100644 index 000000000..6b8789fb4 --- /dev/null +++ b/actions/delete.php @@ -0,0 +1,105 @@ +canEdit()) { + $subtype = $photoObject->getSubtype(); + $container = get_entity($photoObject->container_guid); + + if ($subtype!='image' && $subtype!='album') forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //back off if not an album or image + + if ($subtype == 'image') { //deleting an image + $forward_url = $container->getURL(); //forward back to album after deleting pictures + $images = array($photoObject); + } else { //deleting an album + $forward_url = 'pg/photos/owned/' . $container->username; + $images = get_entities("object","image", $guid, '', 999); //get all the images from this album, or the image requested + } //end of subtype comparison + + //loop through all images and delete them + foreach($images as $im) { + $thumbnail = $im->thumbnail; + $smallthumb = $im->smallthumb; + $largethumb = $im->largethumb; + + if ($thumbnail) { //delete standard thumbnail image + $delfile = new ElggFile(); + $delfile->owner_guid = $im->getOwner(); + $delfile->setFilename($thumbnail); + $delfile->delete(); + } + if ($smallthumb) { //delete small thumbnail image + $delfile = new ElggFile(); + $delfile->owner_guid = $im->getOwner(); + $delfile->setFilename($smallthumb); + $delfile->delete(); + } + if ($largethumb) { //delete large thumbnail image + $delfile = new ElggFile(); + $delfile->owner_guid = $im->getOwner(); + $delfile->setFilename($largethumb); + $delfile->delete(); + } + if ($im) { //delete actual image file + $delfile = new ElggFile($im->getGUID()); + $delfile->owner_guid = $im->getOwner(); + //$delfile->setFilename($im->originalfilename); + if (!$delfile->delete()) { + if ($subtype=='image') register_error(elgg_echo("file:deletefailed")); //unable to delete object + } else { + if ($subtype=='image') system_message(elgg_echo("file:deleted")); //successfully deleted object + } + } //end delete actual image file + } //end looping through each image to delete it + + //now that all images have been deleted, delete the album + if ($subtype=='album') { + //delete the album's directory manually; first create a temp file to get the directory path + $tmpfile = new ElggFile(); + $tmpfile->setFilename('image/' . $guid . '/._tmp_del_tidypics_album_'); + $tmpfile->subtype = 'image'; + $tmpfile->container_guid = $guid; + $tmpfile->open("write"); + $tmpfile->write(''); + $tmpfile->close(); + $tmpfile->save(); + $albumdir = eregi_replace('/._tmp_del_tidypics_album_', '', $tmpfile->getFilenameOnFilestore()); + $tmpfile->delete(); + if (is_dir($albumdir)) + rmdir($albumdir); + + //delete object from database + if (!$photoObject->delete()) { + register_error(elgg_echo("file:deletefailed")); //unable to delete object + } else { + system_message(elgg_echo("file:deleted")); //successfully deleted object + } + } //end of delete album + + + } else { //user does not have permissions to delete this image or album + $container = $_SESSION['user']; + register_error(elgg_echo("file:deletefailed")); + } //end of canEdit() comparison + + } else { // unable to get Elgg entity + register_error(elgg_echo("file:deletefailed")); + } //end of get_entitty() + + forward($forward_url); + +?> \ No newline at end of file diff --git a/actions/download.php b/actions/download.php new file mode 100644 index 000000000..31f21f0f5 --- /dev/null +++ b/actions/download.php @@ -0,0 +1,43 @@ +originalfilename; + $mime = $file->mimetype; + + header("Content-type: $mime"); + if (strpos($mime, "image/")!==false) + header("Content-Disposition: inline; filename=\"$filename\""); + else + header("Content-Disposition: attachment; filename=\"$filename\""); + + + $readfile = new ElggFile($file_guid); + $readfile->owner_guid = $file->owner_guid; + //$readfile->setFilename($filename); + + $contents = $readfile->grabFile(); + + if (empty($contents)) + echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/icons/general.jpg" ); + else + echo $contents; + + exit; + } + else + register_error(elgg_echo("image:downloadfailed")); + +?> \ No newline at end of file diff --git a/actions/edit_multi.php b/actions/edit_multi.php new file mode 100644 index 000000000..9bb9c4eed --- /dev/null +++ b/actions/edit_multi.php @@ -0,0 +1,62 @@ + $im){ + $image = get_entity($im); + + if ($image->canEdit()){ + + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags_array[$key]); + + //set description appropriately + $image->title = $title_array[$key]; + + //set description appropriately + $image->description = $caption_array[$key]; + + // Before we can set metadata, we need to save the image + if (!$image->save()) { + array_push($not_updated, $image->guid); + } + + // Now let's add tags. We can pass an array directly to the object property! Easy. + $image->clearMetadata('tags'); + if (is_array($tagarray)) { + $image->tags = $tagarray; + } + + //if cover meta is sent from image save as metadata + if($cover == $im){ + $album_entity->cover = $im; + } + } + } + // Success message + if (count($not_updated) > 0) { + register_error(elgg_echo("images:notedited")); + } else { + system_message(elgg_echo("images:edited")); + } + + // Forward to the main album page + forward($album_entity->getURL()); + + +?> \ No newline at end of file diff --git a/actions/editalbum.php b/actions/editalbum.php new file mode 100644 index 000000000..36b0f7379 --- /dev/null +++ b/actions/editalbum.php @@ -0,0 +1,91 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + // Make sure we're logged in (send us to the front page if not) + if (!isloggedin()) forward(); + + // Get input data + $guid = (int) get_input('albumpost'); + $title = get_input('albumtitle'); + $body = get_input('albumbody'); + $access = get_input('access_id'); + $tags = get_input('albumtags'); + $back_url = 'mod/tidypics/edit.php?file_guid=' . $guid; + + // Make sure we actually have permission to edit + $album = get_entity($guid); + if ($album->canEdit()) + { + + // Cache to the session + $_SESSION['albumtitle'] = $title; + $_SESSION['albumbody'] = $body; + $_SESSION['albumtags'] = $tags; + + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags); + + // Get owning user + $owner = get_entity($album->getOwner()); + + // edit access only if access is different from current + + if($album->access_id != $access) + { + $album->access_id = $access; + + //get images from album and update access on image entities + $images = get_entities("object","image", $guid, '', 999, '', false); + foreach($images as $im){ + $im->access_id = $access; + $im->save(); + //new core updates all metadata access as well! + } + } + + + // Set its title and description appropriately + $album->title = $title; + $album->description = $body; + + // Before we can set metadata, we need to save the image + if (!$album->save()) { + register_error(elgg_echo("album:error")); + $album->delete(); + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page + } + + // Now let's add tags. We can pass an array directly to the object property! Easy. + $album->clearMetadata('tags'); + if (is_array($tagarray)) { + $album->tags = $tagarray; + } + + //if cover meta is sent from image save as metadata + if(get_input('cover') == elgg_echo('album:cover:yes')){ + $container = get_entity($album->container_guid); + $container->cover = $album->guid; + } + + // Success message + system_message(elgg_echo("album:edited")); + + // Remove the image cache + unset($_SESSION['albumtitle']); + unset($_SESSION['albumbody']); + unset($_SESSION['albumtags']); + + // Forward to the main blog page + forward($album->getURL()); + + } +?> \ No newline at end of file diff --git a/actions/icon.php b/actions/icon.php new file mode 100644 index 000000000..718425819 --- /dev/null +++ b/actions/icon.php @@ -0,0 +1,41 @@ +thumbnail; + $mime = $file->mimetype; + + header("Content-type: $mime"); + if (strpos($mime, "image/")!==false) + header("Content-Disposition: inline; filename=\"$filename\""); + else + header("Content-Disposition: attachment; filename=\"$filename\""); + + + $readfile = new ElggFile(); + $readfile->owner_guid = $file->owner_guid; + $readfile->setFilename($filename); + + $contents = $readfile->grabFile(); + + if (empty($contents)) + echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/icons/general.jpg" ); + else + echo $contents; + + exit; + } + else + register_error(elgg_echo("file:downloadfailed")); +?> \ No newline at end of file diff --git a/actions/upload.php b/actions/upload.php new file mode 100644 index 000000000..f969f6f40 --- /dev/null +++ b/actions/upload.php @@ -0,0 +1,133 @@ +getGUID(); + + $not_uploaded = array(); + $uploaded_images = array(); + + foreach($_FILES as $key => $sent_file) { + if(!empty($sent_file['name'])) { + $name = $_FILES[$key]['name']; + $mime = $_FILES[$key]['type']; + + //make sure file is an image + if($mime == 'image/jpeg' || $mime == 'image/gif' || $mime == 'image/png' || $mime == 'image/pjpeg') { + //this will save to users folder in /image/ and organize by photo album + $prefix = "image/" . $container_guid . "/"; + $file = new ElggFile(); + $filestorename = strtolower(time().$name); + $file->setFilename($prefix.$filestorename); + $file->setMimeType($mime); + $file->originalfilename = $name; + $file->subtype="image"; + $file->access_id = $access_id; + if ($container_guid) { + $file->container_guid = $container_guid; + } + $file->open("write"); + $file->write(get_uploaded_file($key)); + $file->close(); + $result = $file->save(); + + if ($result) { //file was saved; now create some thumbnails + //get maximum file size from plugin settings + if (get_plugin_setting('maxfilesize','tidypics')) { + if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) { + $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB + } else { + $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics'); + } + } else { + $maxfilesize = 10240; //if the file size limit is not set, default to 10MB + } + $maxfilesize = 1024 * $maxfilesize; //convert to bytes + + //check file size and remove picture if it exceeds the maximum + if (filesize($file->getFilenameOnFilestore())<= $maxfilesize) { + array_push($uploaded_images, $file->guid); + + // Generate thumbnail + //TODO: REMOVE THE BELOW IF STATEMENT ONCE get_resized_image_from_existing_file() ACCEPTS IMAGES OVER 0.9MB IN SIZE + if (filesize($file->getFilenameOnFilestore())<= 943718) { //create thumbnails if file size < 0.9MB + try {$thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); } catch (Exception $e) { $thumblarge = false; } + try {$thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); } catch (Exception $e) { $thumbsmall = false; } + try {$thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); } catch (Exception $e) { $thumbnail = false; } + } + if ($thumbnail) { + $thumb = new ElggFile(); + $thumb->setMimeType($mime); + $thumb->setFilename($prefix."thumb".$filestorename); + $thumb->open("write"); + if ($thumb->write($thumbnail)) { + $file->thumbnail = $prefix."thumb".$filestorename; + } else { + $thumb->delete(); + } + $thumb->close(); + } + if ($thumbsmall) { + $thumb = new ElggFile(); + $thumb->setMimeType($mime); + $thumb->setFilename($prefix."smallthumb".$filestorename); + $thumb->open("write"); + if ($thumb->write($thumbsmall)) { + $file->smallthumb = $prefix."smallthumb".$filestorename; + } else { + $thumb->delete(); + } + $thumb->close(); + } + if ($thumblarge) { + $thumb = new ElggFile(); + $thumb->setMimeType($mime); + $thumb->setFilename($prefix."largethumb".$filestorename); + $thumb->open("write"); + if ($thumb->write($thumblarge)) { + $file->largethumb = $prefix."largethumb".$filestorename; + } else { + $thumb->delete(); + } + $thumb->close(); + } + } else { //file exceeds file size limit, so delete it + $file->delete(); + array_push($not_uploaded, $name); + } //end of file size check + } else { //file was not saved for some unknown reason + array_push($not_uploaded, $name); + } //end of file saved check and thumbnail creation + } else { // file is not a supported image type + array_push($not_uploaded, $name); + } //end of mimetype block + } //end of file name empty check + } //end of loop + + if (count($not_uploaded) == 0) { + system_message(elgg_echo("images:saved")); + } else { + $error = elgg_echo("image:uploadfailed") . '
'; + foreach($not_uploaded as $im_name){ + $error .= ' [' . $im_name . '] '; + } + $error .= ' ' . elgg_echo("image:notimage"); + register_error($error); + } //end of upload check + + if (count($uploaded_images)>0) { + forward($CONFIG->wwwroot . 'mod/tidypics/edit_multi.php?files=' . implode('-', $uploaded_images)); //forward to multi-image edit page + } else { + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page + } + +?> \ No newline at end of file diff --git a/contributions.txt b/contributions.txt new file mode 100644 index 000000000..ff014654c --- /dev/null +++ b/contributions.txt @@ -0,0 +1,170 @@ +Elgg community and users: + + The original author of Tidypics has not been active in the Elgg community lately. Therefore, I took on the task of improving his plug-in and maintaining a log of all changes in this file. If you contribute to this plug-in, please record your changes here and release them under a GPL license. + +Best regards, + +Gabriel Monge-Franco (gabrielinux) +http://gabriel.mongefranco.com + + +------------------------------------------------------------------------ +Version 1.08.2 Change List +Release Date: 02/13/2008 +Contributors: + * Gabriel Monge-Franco (http://gabriel.mongefranco.com) +------------------------------------------------------------------------ +BEGIN VERSION 1.08.2 CHANGES +------------------------------------------------------------------------ +* Fixed bug introduced in v1.08.1 that broke the picture upload (thanks to Karsten Schulze). +* Fixed empty variables in several files that were supposed to send the user back to the previous page, but didn't. +* Cleaned up change log (contributions.txt). +* Finally fixed the Polish language file!!! Yay!! :) + +* TODO: Work around large image (high resolution) limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly or ImageMagic if available) + - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system. + - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed. +* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not. +* TODO: allow group members to add pictures to group photo albums +* TODO: implement photo anotations +* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views. +* TODO: create a new widget to show pictures (in slideshow) in a user's profile. +* TODO: add settings for group albums so that the group owner can select the number of albums to show. +* TODO: implement a way to move pictures from one album to another (should be pretty easy). +* TODO: add an "Add Photos" option to the user widget similar to the one in the group widget. +* TODO: implement automagic file resizing to meet the admin's maximum resolution and file size. + +* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out. +------------------------------------------------------------------------ +END VERSION 1.08.2 CHANGES +------------------------------------------------------------------------ + + +------------------------------------------------------------------------ +Version 1.08.1 Change List +Release Date: 02/13/2008 +Contributors: + * Gabriel Monge-Franco (http://gabriel.mongefranco.com) + * LKLaRose (http://community.elgg.org/pg/profile/lauren) + * Webgalli (http://community.elgg.org/pg/profile/webgalli) + * Karsten Schulze (http://ks.frinx.eu) + * Cash (http://community.elgg.org/pg/profile/costelloc) +------------------------------------------------------------------------ +BEGIN VERSION 1.08.1 CHANGES +------------------------------------------------------------------------ +* Fixed bug introduced in v1.08 that caused fake files to be created during thumbnail creation (thanks to Karsten Schulze). +* Reverted to old directory structure that saves pictures to /image/ALBUMGUID/picGUID (v1.08 saved to /image/ALBUMGUID__picGUID, thus keeping everything in one folder). +* Album directory is now deleted when the album is deleted (along with every picture inside of the album). +* Reverted thumbnail and small thumbnail to use picture cropping instead of scaling, so that sites that already use Tidypics can keep a consisting look and feel. +* Completed River integration by moving album and image directories to an "object" sub-directory (thanks to LKLaRose). +* Added status messages/graphics to give the user some feedback. +* Fixed bug in profile widget whereby the selected number of albums had no effect (thanks to @Webgalli and @cheltenham). +* Fixed bug introduced in v1.06 that prevented anonymous users from viewing a user's album (thanks to Karsten Schulze). +* Fixed more language file bugs (thanks to Karsten Schulze). +* Administrators can now set a file size limit from the plugin configuration (it has to be in Kilobytes). + +* JUST PLAIN WEIRD: Fixed Polish language file (thanks to @Vazco, Ian Medlock and Brett Profitt) and saved as UTF8 without BOM. However, it still doesn't work. Can somebody try saving it on a Polish box for me? :) + +* TODO: fix Polish language file -- it seems to break the whole Elgg site! Maybe it needs to use HTML codes in place of international characters? +* TODO: Work around large image (high resolution) limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly or ImageMagic if available) + - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system. + - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed. +* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not. +* TODO: allow group members to add pictures to group photo albums +* TODO: implement photo anotations +* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views. +* TODO: create a new widget to show pictures (in slideshow) in a user's profile. +* TODO: add settings for group albums so that the group owner can select the number of albums to show. +* TODO: implement a way to move pictures from one album to another (should be pretty easy). + +* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out. +------------------------------------------------------------------------ +END VERSION 1.08.1 CHANGES +------------------------------------------------------------------------ + + +------------------------------------------------------------------------ +Version 1.08 Change List +Release Date: 02/08/2008 +Contributors: + * Gabriel Monge-Franco (http://gabriel.mongefranco.com) +------------------------------------------------------------------------ +BEGIN VERSION 1.08 CHANGES +------------------------------------------------------------------------ +* Merged most (safe) changes made by other contributors in v1.07. + - Did not include SWFuploader or JQuery due to the number of bugs reported. +* Changed ugly "new album" picture into something better looking. +* Fixed bug whereby image objects were deleted from the database, but they physical files remained on the server. + - Since deleting directories was not possible without the use of unsafe file operations, albums no longer create new directories. Instead, all pictures are saved as /image/ALBUMGUID__picturename. +* Fixed some bugs in the English, Spanish and German language files and added missing error messages. +* Thumbnails now display the default error image (same as new album) when the requested image cannot be found. +* Fixed a bug in the multi-edit form that did not allow image titles to be saved. +* Removed some customizations made to edit.php action in v1.07 since they removed the ability to add titles to images. +* Fixed bug introduced in v1.07 that prevented images from being set as album covers. +* Fixed miscellaneous bugs in group albums widget. +* Removed jQuery for now since it was making the albums too slow. In the future, we should look into replacing individual image views with lightbox2 or jQuery lightbox album views. + + +* TODO: fix Polish language file -- it seems to break the whole Elgg site! Maybe it needs to use HTML codes in place of international characters? +* TODO: Work around 0.9MB source file size limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly) + - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system. + - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed. +* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not. +* TODO: allow group members to add pictures to group photo albums +* TODO: implement photo anotations +* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views. + +* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out. +------------------------------------------------------------------------ +END VERSION 1.08 CHANGES +------------------------------------------------------------------------ + + +------------------------------------------------------------------------ +Version 1.07 Change List +Release Date: 02/03/2008 +Contributors: + * vazco (http://community.elgg.org/pg/profile/vazco) + * simophin (http://community.elgg.org/pg/profile/simophin) +------------------------------------------------------------------------ +BEGIN VERSION 1.07 CHANGES +------------------------------------------------------------------------ +* About 10 missing translations added +* Translated to polish +* When no album is present, user can add a new album straight from the widget if he has the required rights +* Added some missing

+* Changed some getFilename(), but would it be safe to execute shell commands directly??? +------------------------------------------------------------------------ +END VERSION 1.06 CHANGES +------------------------------------------------------------------------ + diff --git a/edit.php b/edit.php new file mode 100644 index 000000000..2c202e402 --- /dev/null +++ b/edit.php @@ -0,0 +1,46 @@ +canEdit()) + forward(); + + $subtype = $file->getSubtype(); + + if($subtype == 'album'){ + if($container = $file->container_guid) + set_page_owner($container); + + $area2 .= elgg_view_title($title = elgg_echo('album:edit')); + } + elseif($subtype == 'image'){ + if($container = get_entity($file->container_guid)->container_guid) + set_page_owner($container); + + $area2 .= elgg_view_title($title = elgg_echo('image:edit')); + } + else{ + forward(); + } + + $area2 .= elgg_view("tidypics/forms/edit",array('entity' => $file, 'subtype' => $subtype)); + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + page_draw(elgg_echo("edit"), $body); + + +?> \ No newline at end of file diff --git a/edit_multi.php b/edit_multi.php new file mode 100644 index 000000000..2fdc85e42 --- /dev/null +++ b/edit_multi.php @@ -0,0 +1,33 @@ +canEdit()){ + array_push($new_file_array, $file_guid); + } + if(!$album_guid) $album_guid = $entity->container_guid; + + } + } + + $area2 .= elgg_view_title($title = elgg_echo('image:edit')); + $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid)); + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + page_draw(elgg_echo("edit"), $body); +?> \ No newline at end of file diff --git a/friends.php b/friends.php new file mode 100644 index 000000000..61ed52380 --- /dev/null +++ b/friends.php @@ -0,0 +1,43 @@ +username); + } + } + + if (is_null(page_owner_entity()->name) || page_owner_entity()->name == '') { + $friendname = get_input('username'); + } else { + $friendname = page_owner_entity()->name; + }; + + if(isloggedin() && (page_owner() == $_SESSION['guid'])) { + $area2 = elgg_view_title($title = elgg_echo('album:yours:friends')); + } else { + $area2 = elgg_view_title($title = sprintf(elgg_echo('album:friends'), "$friendname")); + } + + set_context('search'); + set_input('search_viewtype', 'gallery'); + $area2 .= list_user_friends_objects(page_owner(), 'album'); + + set_context('photos'); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + + // Finally draw the page + page_draw(sprintf(elgg_echo("album:friends"),$_SESSION['user']->name), $body); +?> \ No newline at end of file diff --git a/graphics/Thumbs.db b/graphics/Thumbs.db new file mode 100644 index 000000000..46eac31d3 Binary files /dev/null and b/graphics/Thumbs.db differ diff --git a/graphics/arrow_next.gif b/graphics/arrow_next.gif new file mode 100644 index 000000000..6b3d8f829 Binary files /dev/null and b/graphics/arrow_next.gif differ diff --git a/graphics/arrow_previous.gif b/graphics/arrow_previous.gif new file mode 100644 index 000000000..e7ded54eb Binary files /dev/null and b/graphics/arrow_previous.gif differ diff --git a/graphics/bl.gif b/graphics/bl.gif new file mode 100644 index 000000000..735fcb582 Binary files /dev/null and b/graphics/bl.gif differ diff --git a/graphics/br.gif b/graphics/br.gif new file mode 100644 index 000000000..90cdccdcb Binary files /dev/null and b/graphics/br.gif differ diff --git a/graphics/btnClose.gif b/graphics/btnClose.gif new file mode 100644 index 000000000..b8ab4638d Binary files /dev/null and b/graphics/btnClose.gif differ diff --git a/graphics/btnContract.gif b/graphics/btnContract.gif new file mode 100644 index 000000000..9be301039 Binary files /dev/null and b/graphics/btnContract.gif differ diff --git a/graphics/btnExpand.gif b/graphics/btnExpand.gif new file mode 100644 index 000000000..72a8471b3 Binary files /dev/null and b/graphics/btnExpand.gif differ diff --git a/graphics/btnNext.gif b/graphics/btnNext.gif new file mode 100644 index 000000000..467f23246 Binary files /dev/null and b/graphics/btnNext.gif differ diff --git a/graphics/btnPrevious.gif b/graphics/btnPrevious.gif new file mode 100644 index 000000000..298c1e99c Binary files /dev/null and b/graphics/btnPrevious.gif differ diff --git a/graphics/icons/Thumbs.db b/graphics/icons/Thumbs.db new file mode 100644 index 000000000..fb5d56ed3 Binary files /dev/null and b/graphics/icons/Thumbs.db differ diff --git a/graphics/icons/album.gif b/graphics/icons/album.gif new file mode 100644 index 000000000..73ce91356 Binary files /dev/null and b/graphics/icons/album.gif differ diff --git a/graphics/icons/general.jpg b/graphics/icons/general.jpg new file mode 100644 index 000000000..23494eff2 Binary files /dev/null and b/graphics/icons/general.jpg differ diff --git a/graphics/icons/general.png b/graphics/icons/general.png new file mode 100644 index 000000000..267ae010c Binary files /dev/null and b/graphics/icons/general.png differ diff --git a/graphics/icons/river_icon_album.gif b/graphics/icons/river_icon_album.gif new file mode 100644 index 000000000..e1bbfedaa Binary files /dev/null and b/graphics/icons/river_icon_album.gif differ diff --git a/graphics/icons/river_icon_image.gif b/graphics/icons/river_icon_image.gif new file mode 100644 index 000000000..6f8bfd6af Binary files /dev/null and b/graphics/icons/river_icon_image.gif differ diff --git a/graphics/img_error.jpg b/graphics/img_error.jpg new file mode 100644 index 000000000..e3aad2aed Binary files /dev/null and b/graphics/img_error.jpg differ diff --git a/graphics/loader.gif b/graphics/loader.gif new file mode 100644 index 000000000..7ac990cf0 Binary files /dev/null and b/graphics/loader.gif differ diff --git a/graphics/tl.gif b/graphics/tl.gif new file mode 100644 index 000000000..ff93dadcc Binary files /dev/null and b/graphics/tl.gif differ diff --git a/graphics/tr.gif b/graphics/tr.gif new file mode 100644 index 000000000..8dc197272 Binary files /dev/null and b/graphics/tr.gif differ diff --git a/graphics/ttl.gif b/graphics/ttl.gif new file mode 100644 index 000000000..8e44c0374 Binary files /dev/null and b/graphics/ttl.gif differ diff --git a/graphics/ttp.gif b/graphics/ttp.gif new file mode 100644 index 000000000..36f7211c4 Binary files /dev/null and b/graphics/ttp.gif differ diff --git a/graphics/ttr.gif b/graphics/ttr.gif new file mode 100644 index 000000000..66d06941e Binary files /dev/null and b/graphics/ttr.gif differ diff --git a/index.php b/index.php new file mode 100644 index 000000000..00b09d14b --- /dev/null +++ b/index.php @@ -0,0 +1,45 @@ +username) || empty($owner->username)) { + //if not logged in, see world pictures instead + if (!isloggedin()) forward('pg/photos/world'); + forward('pg/photos/owned/' . $_SESSION['user']->username); + } + + //set the title + $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name")); + + //allow new album creation + if(can_write_to_container($_SESSION['guid'], page_owner())){ + $area2 .= 'username.'">'.elgg_echo('album:create').'

'; + } + + // Get objects + set_context('search'); + set_input('search_viewtype', 'gallery'); + $area2 .= list_entities("object","album",page_owner(),10); + + set_context('photos'); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + + // Finally draw the page + page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body); +?> \ No newline at end of file diff --git a/languages/de.php b/languages/de.php new file mode 100644 index 000000000..2d668f72f --- /dev/null +++ b/languages/de.php @@ -0,0 +1,114 @@ + "Bild", + 'images' => "Bilder", + 'caption' => "Untertitel", + 'photos' => "Photos", + 'images:upload' => "Bilder hochladen", + 'album' => "Fotoalbum", + 'albums' => "Fotoalben", + 'album:yours' => "Deine Fotoalben", + 'album:yours:friends' => "Fotoalben von Freunden", + 'album:user' => "Fotoalben von %s", + 'album:friends' => "Fotoalben von Freunden von %s", + 'album:all' => "Alle Fotoalben", + 'album:group' => "Alben der Gruppe", + 'item:object:image' => "Photos", + 'item:object:album' => "Alben", + 'tidypics:settings:maxfilesize' => "Maximale Dateigre in den Kilobytes (KB):", + + //actions + + 'album:create' => "Neues Album", + 'album:add' => "Fotoalbum hinzufügen", + 'album:addpix' => "Fotos hinzufügen", + 'album:edit' => "Album bearbeiten", + 'album:delete' => "Album löschen", + + 'image:edit' => "Bild bearbeiten", + 'image:delete' => "Bild löschen", + 'image:download' => "Download Bild", + + //forms + + 'album:title' => "Titel", + 'album:desc' => "Beschreibung", + 'album:tags' => "Stichwörter", + 'album:cover' => "Albumcover erstellen?", + 'album:cover:yes' => "Ja", + 'image:access:note' => "(Zugriffsberechtigung wird vom Album übernommen)", + + //views + + 'image:total' => "Bilder im Album:", + 'image:by' => "Bild hinzugefügt von", + 'album:by' => "Album erstellt von:", + 'album:created:on' => "Verursacht", + 'image:none' => "Noch keine Bilder hinzugefügt.", + 'image:back' => "Zurück", + 'image:next' => "Weiter", + + //widgets + + 'album:widget' => "Fotoalben", + 'album:more' => "Alle Alben ansehen", + 'album:widget:description' => "Zeige Deine neuesten Fotoalben", + 'album:display:number' => "Anzahl der Alben, die angezeigt werden sollen", + 'album:num_albums' => "Anzahl der anzuzeigenden Alben", + + // river + + //images + 'image:river:created' => "%s hat hochgeladen:", + 'image:river:item' => "ein Bild", + 'image:river:annotate' => "%s kommentierte", + + //albums + 'album:river:created' => "%s erstellte", + 'album:river:item' => "ein Album", + 'album:river:annotate' => "%s kommentierte", + + // Status messages + + 'image:saved' => "Dein Bild wurde gespeichert.", + 'images:saved' => "Alle Bilder wurden gespeichert.", + 'image:deleted' => "Dein Bild wurde gelöscht.", + 'image:delete:confirm' => "Willst Du das Bild wirklich löschen?", + + 'images:edited' => "Dein Bild wurde aktualisiert.", + 'album:edited' => "Dein Album wurde aktualisiert.", + 'album:saved' => "Dein Album wurde gespeichert.", + 'album:deleted' => "Dein Album wurde gelöscht.", + 'album:delete:confirm' => "Willst Du das Album wirklich löschen?", + 'album:created' => "Ihr neues Album ist hergestellt worden.", + 'tidypics:status:processing' => "Warten Sie bitte, whrend wir verarbeiten Ihre Abbildung....", + + //Error messages + + 'image:none' => "Kein Bilder gefunden.", + 'image:uploadfailed' => "Dateien konnten nicht hochgeladen werden:", + 'image:deletefailed' => "Bild konnte nicht gelöscht werden.", + 'image:downloadfailed' => "Dieses Bild ist nicht diesmal vorhanden.", + + 'image:notimage' => 'Wir akzeptieren nur jpeg, gif, und png Dateien der erlaubten Dateigre an.', + 'images:notedited' => 'Nicht alle Bilder konnten hochgeladen werden', + + 'album:none' => "Keine Alben gefunden.", + 'album:uploadfailed' => "Sorry; Dein Album konnte nicht gespeichert werden.", + 'album:deletefailed' => "Dein Album konnte nicht gelöscht werden.", + 'album:blank' => "Geben Sie diesem Album einen Titel und eine Beschreibung bitte." + ); + + add_translation("de",$german); +?> diff --git a/languages/en.php b/languages/en.php new file mode 100644 index 000000000..2316a9e2f --- /dev/null +++ b/languages/en.php @@ -0,0 +1,115 @@ + "Image", + 'images' => "Images", + 'caption' => "Caption", + 'photos' => "Photos", + 'images:upload' => "Upload Images", + 'album' => "Photo Album", + 'albums' => "Photo Albums", + 'album:yours' => "Your photo albums", + 'album:yours:friends' => "Your friends' photo albums", + 'album:user' => "%s's photo albums", + 'album:friends' => "%s's friends' photo albums", + 'album:all' => "All site photo albums", + 'album:group' => "Group albums", + 'item:object:image' => "Photos", + 'item:object:album' => "Albums", + 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):", + + //actions + + 'album:create' => "New Album", + 'album:add' => "Add Photo Album", + 'album:addpix' => "Add photos", + 'album:edit' => "Edit album", + 'album:delete' => "Delete album", + + 'image:edit' => "Edit image", + 'image:delete' => "Delete image", + 'image:download' => "Download image", + + //forms + + 'album:title' => "Title", + 'album:desc' => "Description", + 'album:tags' => "Tags", + 'album:cover' => "Make image album cover?", + 'album:cover:yes' => "Yes", + 'image:access:note' => "(view access is inherited from the album)", + + //views + + 'image:total' => "Images in album:", + 'image:by' => "Image added by", + 'album:by' => "Album created by", + 'album:created:on' => "Created", + 'image:none' => "No images have been added yet.", + 'image:back' => "Back", + 'image:next' => "Next", + + //widgets + + 'album:widget' => "Photo Albums", + 'album:more' => "View all albums", + 'album:widget:description' => "Showcase your latest photo albums", + 'album:display:number' => "Number of albums to display", + 'album:num_albums' => "Number of albums to display", + + // river + + //images + 'image:river:created' => "%s uploaded", + 'image:river:item' => "an image", + 'image:river:annotate' => "%s commented on", + + //albums + 'album:river:created' => "%s created", + 'album:river:item' => "an album", + 'album:river:annotate' => "%s commented on", + + // Status messages + + 'image:saved' => "Your image was successfully saved.", + 'images:saved' => "All images were successfully saved.", + 'image:deleted' => "Your image was successfully deleted.", + 'image:delete:confirm' => "Are you sure you want to delete this image?", + + 'images:edited' => "Your images were successfully updated.", + 'album:edited' => "Your album was successfully updated.", + 'album:saved' => "Your album was successfully saved.", + 'album:deleted' => "Your album was successfully deleted.", + 'album:delete:confirm' => "Are you sure you want to delete this album?", + 'album:created' => "Your new album has been created.", + 'tidypics:status:processing' => "Please wait while we process your picture....", + + //Error messages + + 'image:none' => "We could not find any images at the moment.", + 'image:uploadfailed' => "Files not uploaded:", + 'image:deletefailed' => "Your image could not be deleted at this time.", + 'image:downloadfailed' => "Sorry; this image is not available at this time.", + + 'image:notimage' => "We only accept jpeg, gif, or png images of the allowed file size.", + 'images:notedited' => "Not all images were successfully updated", + + 'album:none' => "We could not find any albums at the moment.", + 'album:uploadfailed' => "Sorry; we could not save your album.", + 'album:deletefailed' => "Your album could not be deleted at this time.", + 'album:blank' => "Please give this album a title and description." + ); + + add_translation("en",$english); +?> \ No newline at end of file diff --git a/languages/es.php b/languages/es.php new file mode 100644 index 000000000..babb87068 --- /dev/null +++ b/languages/es.php @@ -0,0 +1,115 @@ + "Imagen", + 'images' => "Imágenes", + 'caption' => "Leyenda", + 'photos' => "Fotos", + 'images:upload' => "Subir Imágenes", + 'album' => "Állbum de Fotos", + 'albums' => "Álbums de Fotos", + 'album:yours' => "Tus álbums de fotos", + 'album:yours:friends' => "Álbums de tus amigos", + 'album:user' => "Állbums de %s", + 'album:friends' => "Albums de los amigos de %s", + 'album:all' => "Todos los álbums", + 'album:group' => "Állbums del grupo", + 'item:object:image' => "Fotos", + 'item:object:album' => "Állbums", + 'tidypics:settings:maxfilesize' => "Tamaño máximo en kilo bytes (KB):", + + //actions + + 'album:create' => "Nuevo álbum", + 'album:add' => "Añadir álbum de fotos", + 'album:addpix' => "Añadir fotos", + 'album:edit' => "Modificar álbum", + 'album:delete' => "Eliminar álbum", + + 'image:edit' => "Modificar imagen", + 'image:delete' => "Eliminar imagen", + 'image:download' => "Descargar imagen", + + //forms + + 'album:title' => "Título", + 'album:desc' => "Descripción", + 'album:tags' => "Etiquetas", + 'album:cover' => "¿Hacer portada del álbum?", + 'album:cover:yes' => "Si", + 'image:access:note' => "(los permisos de acceso se heredan del álbum)", + + //views + + 'image:total' => "Imágenes en el álbum:", + 'image:by' => "Imagen añadida por", + 'album:by' => "Album creado por", + 'album:created:on' => "Creado", + 'image:none' => "Todavía no se han añadido imágenes.", + 'image:back' => "Anterior", + 'image:next' => "Siguiente", + + //widgets + + 'album:widget' => "Albums de Fotos", + 'album:more' => "Ver todos los albums", + 'album:widget:description' => "Muestra tus álbums de fotos más recientes", + 'album:display:number' => "Número de albums a mostrar", + 'album:num_albums' => "Número de albums a mostrar", + + // river + + //images + 'image:river:created' => "%s subió", + 'image:river:item' => "una imagen", + 'image:river:annotate' => "%s comentó en", + + //albums + 'album:river:created' => "%s creó", + 'album:river:item' => "un album", + 'album:river:annotate' => "%s comentó en", + + // Status messages + + 'image:saved' => "Tu imagen ha sido guardada.", + 'images:saved' => "Todas tus imágenes han sido guardadas.", + 'image:deleted' => "Tu imagen ha sido borrada.", + 'image:delete:confirm' => "¿Deseas borrar esta imagen?", + + 'images:edited' => "Tus imágenes han sido actualizadas.", + 'album:edited' => "Tu álbum ha sido actualizado.", + 'album:saved' => "Tu álbum ha sido guardado.", + 'album:deleted' => "Tu álbum ha sido borrado con éxito.", + 'album:delete:confirm' => "¿Deseas borrar este álbum?", + 'album:created' => "Tu nuevo álbum ha sido creado.", + 'tidypics:status:processing' => "Por favor espera mientras procesamos tu imagen....", + + //Error messages + + 'image:none' => "No ha sido psible encontrar ninguna imagen en este momento.", + 'image:uploadfailed' => "Algunos ficheros no se pudieron subir:", + 'image:deletefailed' => "Tu imagen no ha podido ser borrada en este momento.", + 'image:downloadfailed' => "Esta imagen no se encuentra disponible en este momento.", + + 'image:notimage' => "Sólo se aceptan imágenes jpeg, gif, o png del tamaño permitido.", + 'images:notedited' => "No se pudieron actualizar todas las imágenes.", + + 'album:none' => "Actualmente no hay ningún álbum de fotos.", + 'album:uploadfailed' => "No se ha podido guardar el álbum.", + 'album:deletefailed' => "En este momento no se ha podido borrar el álbum.", + 'album:blank' => "Por favor entra un título y descripción para tu nuevo álbum." + ); + + add_translation("es",$spanish); +?> \ No newline at end of file diff --git a/languages/pl.php b/languages/pl.php new file mode 100644 index 000000000..047b17220 --- /dev/null +++ b/languages/pl.php @@ -0,0 +1,115 @@ + "Obrazek", + 'images' => "Obrazki", + 'caption' => "Opis", + 'photos' => "Zdjęcia", + 'images:upload' => "Dodaj obrazki", + 'album' => "Album zdjęciowy", + 'albums' => "Albumy zdjęciowe", + 'album:yours' => "Twoje albumy", + 'album:yours:friends' => "Albumy twoich znajomych", + 'album:user' => "Albumy użytkownika %s", + 'album:friends' => "Albumy przyjaciół użytkownika %s", + 'album:all' => "Wszystkie publiczne albumy", + 'album:group' => "Albumy rejsu", + 'item:object:image' => "Zdjęcia", + 'item:object:album' => "Albumy", + 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):", + + //actions + + 'album:create' => "Nowy album", + 'album:add' => "Dodaj album zdjęciowy", + 'album:addpix' => "Dodaj zdjęcia", + 'album:edit' => "Edytuj album", + 'album:delete' => "Skasuj album", + + 'image:edit' => "Edytuj obrazek", + 'image:delete' => "Skasuj obrazek", + 'image:download' => "Pobierz obrazek", + + //forms + + 'album:title' => "Tytuł albumu", + 'album:desc' => "Opis (widoczny tylko dla twórcy)", + 'album:tags' => "Tagi", + 'album:cover' => "Ustaw jako okładkę albumu?", + 'album:cover:yes' => "Tak", + 'image:access:note' => "(prawa dostępu pobierane są z ustawień albumu)", + + //views + + 'image:total' => "Obrazki w albumie:", + 'image:by' => "Obrazek dodany przez", + 'album:by' => "Album stworzony przez", + 'album:created:on' => "Stworzono", + 'image:none' => "Nie dodano jeszcze żadnych obrazków.", + 'image:back' => "Poprzednia", + 'image:next' => "Kolejna", + + //widgets + + 'album:widget' => "Albumy zdjęciowe", + 'album:more' => "Pokaż wszystkie albumy", + 'album:widget:description' => "Pokazuje twoje ostatnie albumy zdjęciowe", + 'album:display:number' => "Liczba wyświetlanych albumów", + 'album:num_albums' => "Liczba wyświetlanych albumów", + + // river + + //images + 'image:river:created' => "wgrano %s", + 'image:river:item' => "obrazek", + 'image:river:annotate' => "%s skomentował", + + //albums + 'album:river:created' => "Stworzono %s", + 'album:river:item' => "album", + 'album:river:annotate' => "%s skomentował", + + // Status messages + + 'image:saved' => "Twój obrazek został pomyślnie zapisany.", + 'images:saved' => "Wszystkie obrazki zostały pomyślnie zapisane.", + 'image:deleted' => "Twój obrazek został pomyślnie skasowany.", + 'image:delete:confirm' => "Czy jesteś pewien że chcesz skasować ten obrazek?", + + 'images:edited' => "Twoje obrazki zostały pomyślnie zapisane.", + 'album:edited' => "Twój album został pomyślnie zapisany.", + 'album:saved' => "Twój album został pomyślnie zapisany.", + 'album:deleted' => "Twój album został skasowany.", + 'album:delete:confirm' => "Na pewno chcesz skasować ten album?", + 'album:created' => "Stworzono nowy album.", + 'tidypics:status:processing' => "Please wait while we process your picture....", + + //Error messages + + 'image:none' => "Jeszcze nie dodano żadnych obrazków.", + 'image:uploadfailed' => "Pliki nie zapisane:", + 'image:deletefailed' => "Nie udało się skasować obrazka.", + 'image:downloadfailed' => "Nie udało się ściągnąć albumu.", + + 'image:notimage' => "Akceptowane formaty to tylko: jpeg, gif i png, and the allowed file size.", + 'images:notedited' => "Nie wszystkie obrazki zostały zapisane", + + 'album:none' => "Jeszcze nie dodano żadnych albumów.", + 'album:uploadfailed' => "Nie udało się zapisać twojego albumu.", + 'album:deletefailed' => "Nie udało się usunąć twojego albumu.", + 'album:blank' => "Please give this albumu a tytuł and opis." + ); + + add_translation("pl",$polish); +?> \ No newline at end of file diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 000000000..1dfd9b7a7 --- /dev/null +++ b/manifest.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/newalbum.php b/newalbum.php new file mode 100644 index 000000000..8df0ec019 --- /dev/null +++ b/newalbum.php @@ -0,0 +1,31 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + // Load Elgg engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + // Get the current page's owner + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + + $area2 = elgg_view_title(elgg_echo('album:add')); + $area2 .= elgg_view("tidypics/forms/edit"); + + // Display page + page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 )); + + +?> \ No newline at end of file diff --git a/start.php b/start.php new file mode 100644 index 000000000..f3c675d52 --- /dev/null +++ b/start.php @@ -0,0 +1,174 @@ +wwwroot . "pg/photos/owned/" . $_SESSION['user']->username); + } + + // Extend CSS + extend_view('css', 'tidypics/css'); + + // Extend hover-over and profile menu + extend_view('profile/menu/links','tidypics/menu'); + + //group view ** psuedo widget view for group pages** + extend_view('groups/right_column','tidypics/groupprofile_albums'); + + // Register a page handler, so we can have nice URLs + register_page_handler('photos','tidypics_page_handler'); + + // Add a new tidypics widget + add_widget_type('album_view',elgg_echo("album:widget"),elgg_echo("album:widget:description"), 'profile'); + + // Register a URL handler for files + register_entity_url_handler('image_url','object','image'); + register_entity_url_handler('album_url','object','album'); + + // Register entity type + register_entity_type('object','image'); + register_entity_type('object','album'); + + } + + /** + * Sets up submenus for tidypics. Triggered on pagesetup. + */ + function tidypics_submenus() { + + global $CONFIG; + + $page_owner = page_owner_entity(); + + // General submenu options + if (get_context() == "photos") { + if (isloggedin() && (page_owner() == $_SESSION['guid'] || !page_owner())) { + add_submenu_item(sprintf(elgg_echo("album:yours"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/owned/" . page_owner_entity()->username, '1view'); + add_submenu_item(sprintf(elgg_echo('album:yours:friends'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/friends/". page_owner_entity()->username, '1view'); + add_submenu_item(sprintf(elgg_echo('album:all'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/world/", '1view'); + } else if (page_owner() && $page_owner instanceof ElggUser) { + add_submenu_item(sprintf(elgg_echo('album:friends'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,'1view'); + add_submenu_item(sprintf(elgg_echo('album:all'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/world/", '1view'); + } + } + if (isloggedin() && ($page_owner instanceof ElggGroup)) { + add_submenu_item(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/owned/" . page_owner_entity()->username, 'photo_albums'); + } + } + + /** + * tidypics page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ + function tidypics_page_handler($page) { + + global $CONFIG; + + if (isset($page[0])) + { + switch($page[0]) + { + case "owned": //view list of albums owned by container + if (isset($page[1])) set_input('username',$page[1]); + + /* if you want to put new album action in the submenu, just do it like this ---------> + if(can_write_to_container($_SESSION['guid'], page_owner())){ + add_submenu_item(elgg_echo('album:create'), $CONFIG->wwwroot . "pg/photos/new/". page_owner_entity()->username, 'pagesactions'); + } + */ + include($CONFIG->pluginspath . "tidypics/index.php"); + break; + + case "view": //view an image individually + set_input('guid',$page[1]); + include($CONFIG->pluginspath . "tidypics/view.php"); + break; + + case "album": //view an album individually + set_input('guid',$page[1]); + @include(dirname(dirname(dirname(__FILE__))) . "/entities/index.php"); + break; + + case "new": //create new album + if (isset($page[1])) set_input('username',$page[1]); + include($CONFIG->pluginspath . "tidypics/newalbum.php"); + break; + + case "upload": //upload images to album + if (isset($page[1])) set_input('container_guid',$page[1]); + include($CONFIG->pluginspath . "tidypics/upload.php"); + break; + + case "friends": + if (isset($page[1])) set_input('username',$page[1]); + include($CONFIG->pluginspath . "tidypics/friends.php"); + break; + + case "world": + include($CONFIG->pluginspath . "tidypics/world.php"); + break; + + } + } + else + { + // Include the standard profile index + if (isset($page[1])) set_input('username',$page[1]); + include($CONFIG->pluginspath . "tidypics/index.php"); + } + + } + + /** + * Populates the ->getUrl() method for file objects + * + * @param ElggEntity $entity album/image entity + * @return string File URL + */ + function image_url($entity) { + global $CONFIG; + $title = $entity->title; + $title = friendly_title($title); + return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title; + + } + + function album_url($entity) { + global $CONFIG; + $title = $entity->title; + $title = friendly_title($title); + return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title; + + } + + // Make sure tidypics_init is called on initialisation + register_elgg_event_handler('init','system','tidypics_init'); + register_elgg_event_handler('pagesetup','system','tidypics_submenus'); + + // Register actions + register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypics/actions/upload.php"); + register_action("tidypics/addalbum", false, $CONFIG->pluginspath. "tidypics/actions/addalbum.php"); + register_action("tidypics/editalbum", false, $CONFIG->pluginspath. "tidypics/actions/editalbum.php"); + register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php"); + register_action("tidypics/icon", true, $CONFIG->pluginspath. "tidypics/actions/icon.php"); + register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php"); + register_action("tidypics/download", true, $CONFIG->pluginspath . "tidypics/actions/download.php"); + +?> \ No newline at end of file diff --git a/tasks.txt b/tasks.txt new file mode 100644 index 000000000..879d8cb42 --- /dev/null +++ b/tasks.txt @@ -0,0 +1,66 @@ + +Tasks: + + -> DONE --clean up css + -> DONE -- test river views + -> DONE -- enable widget views + -> DONE -- multi image uploader form. + + -> DONE -- Album covers: implement cover option for NEW uploaded images @ upload.php action + i want to enable multi uploader so better to put it in there. + (radio box so only one image can be the cover) + + -> DONE -- /pg/photos/owned + Edit the way album list is presented (make it nicer) + -> DONE -- when adding or editing album -> + saving the album's view access should also edit + all containing image view access + if add new album + -> all image uploads default to albums current access + -> all image edits can not change access + if edit album + -> change access of album and cycle through all current images. + + -> DONE -- Album covers: implemented edit image screen to specify album cover + -> DONE -- allow photo albums for users + -> DONE -- internationalize all text + -> DONE -- clean up unecessary functions from file plugin + -> DONE -- limit uploader to image only mimetype + -> DONE -- (for now) see if i can get rid of any unecessary meta + -> DONE -- create friends views and world views + -> DONE -- add breadcrumb + -> DONE -- (but optimize) add thumbnail icons for listings + + + + --------- CAVEATS ----------- + + + -> SOLVED -- (just clear the pagination css class) problem: + when viewing an indie album, the images are floated. + if the pagination is enabled the bottom bar does not clear the + floated images + +Problem: +the delete action does not delete any actual images +the current method should work, but it doesnt +look for clues in engine/lib/filestore.php +when deleting an album, easy way to delete all images +is just to find the albums folder and delete it. + +Problem: +when defining covers for album , i need to edit the input/checkboxes view +in order submit correctly. Remove the [] as part of the name + +-------------------- +my differences due to theme +------------------------ +My customizations: + +in the controls i am added to submenu +edit this out when packaging + + -> if i add album actions to submenu i lose "js confirm" on delete + -> change the album access permissions for groups to have + only 3 choices (logged in , everyone, or group only) + \ No newline at end of file diff --git a/thumbnail.php b/thumbnail.php new file mode 100644 index 000000000..0e6142cbb --- /dev/null +++ b/thumbnail.php @@ -0,0 +1,55 @@ +getSubtype() == "image") { + // Get file thumbnail + if ($size == "small") { + $thumbfile = $file->smallthumb; + } else { + $thumbfile = $file->largethumb; + } + + // Grab the file + if ($thumbfile && !empty($thumbfile)) { + $readfile = new ElggFile(); + $readfile->owner_guid = $file->owner_guid; + $readfile->setFilename($thumbfile); + //$mime = $file->getMimeType(); + $contents = $readfile->grabFile(); + } + } //end subtype comparison + } //end get_entity + + // Open error image if file was not found + if (!isset($contents) || is_null($contents) || $file->getSubtype()!='image') { + //$vars['url'].'mod/tidypics/graphics/img_error.jpg + forward('mod/tidypics/graphics/img_error.jpg'); + } //end of default error image + + // Return the thumbnail and exit + header("Content-type: image"); + echo $contents; + exit; +?> \ No newline at end of file diff --git a/tidypics_user_instructions_.txt b/tidypics_user_instructions_.txt new file mode 100644 index 000000000..eb2c2a809 --- /dev/null +++ b/tidypics_user_instructions_.txt @@ -0,0 +1,71 @@ +-------------------------------------------- +Tidypics Photo Gallery plugin version 1.05 +Release #5. +Release Date: October 27, 2008 +-------------------------------------------- + +Installation +------------------ +1. Drop into root/mod/ +2. Enable plugin via admin panel. +3. Done + + + +Requirements +------------------------ +Will function with all versions of elgg, but current SVN build is needed +for consistency. +Reason: +Updating the album access persmissions will auto-update the access for all +images contained in the album, but when updating each image entity, +the metadata for that entity also needs to be updated. The function that accomplishes +this is only in the current SVN build. +If you do not use the current SVN build of elgg, you will likely get incorrectly +synced access permissions. Just wait for elg 1.1 and all will be dandy. +No changes need to be made to tidypics since the function is called via hook. + + + +Recorded problems: +---------------------------- +1. when viewing an individual album, the image gallery displayed is a collection + of floated divs. If pagination is enabled the bottom pagination bar does not + clear the floated images and you will get a messy display. I did not yet + research a better way to create a gallery view while being inline with elggs listing functions. + +2. The delete action does not delete any actual . + The current method should work, but it does not. + I am quite sure this is unintended, but we will have to wait till the core + gets updated. + Currently NO IMAGES will ever be deleted from your serverspace. + +3. The groups view is a little odd because all other content like blogs, pages, are in list view. + I refuse to put albums in list view, so if you want that, sorry! (just steal the list view from object/albums.php) + + +Cost to use this plugin: +---------------------------------- + + Participation in the tidypics group on community.elgg.org + + We need: + ------------------------ + 1. User testing + 2. Bug reports + 3. Functionality, usability, feature requests/discussions + 4. Developers: Feature enhancements. + + If you do not pay the advertised cost of tidypics, you are stealing this plugin! + Don't be a taker!! + + Bye! + + - Jade + + + + + + + \ No newline at end of file diff --git a/upload.php b/upload.php new file mode 100644 index 000000000..320c5ce6d --- /dev/null +++ b/upload.php @@ -0,0 +1,49 @@ +canEdit()) + forward('pg/photos/owned/'); + + //set group to "real" container + $container = $album_entity->container_guid; + set_page_owner($container); + } + else + forward('pg/photos/owned/'); + + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); + } + + set_context('photos'); + $title = elgg_echo('album:addpix'); + $area2 .= elgg_view_title($title); + + $area2 .= '

'. $album_entity->title. '

'; + + $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album ) ); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2, $area3); + + page_draw($title, $body); +?> \ No newline at end of file diff --git a/view.php b/view.php new file mode 100644 index 000000000..e0121baae --- /dev/null +++ b/view.php @@ -0,0 +1,62 @@ +container_guid)->container_guid; + + if ($top_container) { + set_page_owner($top_container); + } else { + set_page_owner($entity->owner_guid); + } + + // Set the body to be the full view of the entity, and the title to be its title + $area2 = elgg_view_entity($entity,true); + if ($shell) { + $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2); + } else { + $body = $area2; + } + + } else { + $body = elgg_echo('notfound'); + } + + // Display the page + if ($shell) { + page_draw("", $body); + } else { + header("Content-type: text/html; charset=UTF-8"); + echo $body; + } + +?> \ No newline at end of file diff --git a/views/default/input/accessRead.php b/views/default/input/accessRead.php new file mode 100644 index 000000000..81392b19f --- /dev/null +++ b/views/default/input/accessRead.php @@ -0,0 +1,61 @@ + 0) + { + + /* my hacks (pay no attention please =D ) + //allow showing of group for write access + if($vars['group_write']) $vars['options'] = trigger_plugin_hook('access:collections:write','user',array('user_id' => $_SESSION['guid'], 'site_id' => 0),$vars['options']); + */ + + //developer check - to check the value being sent initially + //echo 'given value: '.$vars['value'].'
'; + + //if no value currently set - specify default + if (empty($vars['value']) && $vars['value'] != '0') + $vars['value'] = 2; + + + foreach($vars['options'] as $key => $option) { + if ($key == $vars['value']) { +?> + + class=""> + + \ No newline at end of file diff --git a/views/default/input/cover_checkbox.php b/views/default/input/cover_checkbox.php new file mode 100644 index 000000000..48c7d51cc --- /dev/null +++ b/views/default/input/cover_checkbox.php @@ -0,0 +1,45 @@ + $option) { + + if ($option != $vars['value']) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + + $labelint = (int) $label; + if ("{$label}" == "{$labelint}") { + $label = $option; + } + + $disabled = ""; + if ($vars['disabled']) $disabled = ' disabled="yes" '; + echo "
"; + } + +?> \ No newline at end of file diff --git a/views/default/input/multi_radio.php b/views/default/input/multi_radio.php new file mode 100644 index 000000000..11f4c13b8 --- /dev/null +++ b/views/default/input/multi_radio.php @@ -0,0 +1,42 @@ + $option) { + + if ($vars['set'] != $vars['value']) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + + $labelint = (int) $label; + if ("{$label}" == "{$labelint}") { + $label = $option; + } + + $disabled = ""; + if ($vars['disabled']) $disabled = ' disabled="yes" '; + echo "
"; + } + +?> \ No newline at end of file diff --git a/views/default/object/album.php b/views/default/object/album.php new file mode 100644 index 000000000..b95d55eed --- /dev/null +++ b/views/default/object/album.php @@ -0,0 +1,137 @@ +getGUID(); + $tags = $file->tags; + $title = $file->title; + $desc = $file->description; + $owner = $vars['entity']->getOwnerEntity(); + $friendlytime = friendly_time($vars['entity']->time_created); + $mime = $file->mimetype; + + if (get_context() == "search") { + + if (get_input('search_viewtype') == "gallery") { + //default gallery view for album listing @ /photos/owned/ + + //get album cover if one was set + if($file->cover) + $album_cover = 'thumbnail'; + else + $album_cover = 'new album'; + + ?> + + + '.$title.'

'; + $info .= "

username}\">{$owner->name} {$friendlytime}"; + $numcomments = elgg_count_comments($file); + if ($numcomments) + $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")"; + $info .= "

"; + + $icon = "getURL()}\">" . elgg_view("tidypics/icon", array('album' => true, 'size' => 'small')) . ""; + + echo elgg_view_listing($icon, $info); + + } + + } else { + // individual album view +?> +
+username) || empty(page_owner_entity()->username)) { //when no owner available, link to world photos +?> +  >  + + name); ?> >  + + +
+ +'.$title.''; + echo '
'.autop($desc).'
'; + + if ($file->canEdit()) { // add edits + // specific to my theme only + //add_submenu_item(elgg_echo('album:addpix'), $vars['url'] . "pg/photos/upload/". $file_guid , '', 'jade'); + //add_submenu_item(elgg_echo('album:edit'), $vars['url'] . "mod/tidypics/edit.php?file_guid=". $file_guid , '', 'jade'); + //add_submenu_item(elgg_echo('album:delete'), $vars['url'] . "action/tidypics/delete?file=". $file_guid , '', 'jade'); + +?> +
+ "> +   + + $vars['url'] . "action/tidypics/delete?file=" . $file->getGUID(), + 'text' => elgg_echo("album:delete"), + 'confirm' => elgg_echo("album:delete:confirm"), + )); + ?> +
+guid); + } + + if(count($count) > 0) + echo list_entities("object","image", $file_guid, 24, false); + else + echo elgg_echo('image:none'); + +?> +
+
+
$tags));?>
+ name; ?>
+
+
+ + diff --git a/views/default/object/image.php b/views/default/object/image.php new file mode 100644 index 000000000..063ad09cb --- /dev/null +++ b/views/default/object/image.php @@ -0,0 +1,130 @@ +getGUID(); + $tags = $file->tags; + $title = $file->title; + $desc = $file->description; + $owner = $vars['entity']->getOwnerEntity(); + $friendlytime = friendly_time($vars['entity']->time_created); + + $mime = $file->mimetype; + +if (get_context() == "search") { //if this is the search view + + + if (get_input('search_viewtype') == "gallery") { + ?> +
+ thumbnail +
+ '.$title.'

'; + $info .= "

username}\">{$owner->name} {$friendlytime}"; + $numcomments = elgg_count_comments($file); + if ($numcomments) + $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")"; + $info .= "

"; + $icon = "getURL()}\">" . elgg_view("tidypics/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . ""; + + echo elgg_view_listing($icon, $info); + } +} +else { //tidypics image display + + if (!$vars['full']) { //simple gallery view + +?> +
+ thumbnail +
+container_guid); + + //compile back | next links + $current = array_search($file_guid, $_SESSION['image_sort']); + + if(!$current){ // means we are no longer using the correct album array + + //rebuild the array -> + $count = get_entities("object","image", $album->guid, '', 999); + $_SESSION['image_sort'] = array(); + + foreach($count as $image){ + array_push($_SESSION['image_sort'], $image->guid); + } + + $current = array_search($file_guid, $_SESSION['image_sort']); + } + + if(!$current == 0) + $back = '<<' . elgg_echo('image:back') . '  '; + + if(array_key_exists(($current+1), $_SESSION['image_sort'])) + $next = '  ' . elgg_echo('image:next') . '>>'; + +?> +
+username) || empty(page_owner_entity()->username)) { //when no owner available, link to world photos +?> +  >  + + name); ?> >  + + title; ?> >  + +
+' . $title . ''; + echo '
' . autop($desc) . '
'; + echo '
'; + echo '
' . $back . $next . '
'; + if($next) echo ''; + echo '' . $title . ''; + if($next) echo ''; + echo '
'; +?> +
+   +canEdit()) { // add edit controls +?> +   + $vars['url'] . "action/tidypics/delete?file=" . $file->getGUID(), + 'text' => elgg_echo("image:delete"), + 'confirm' => elgg_echo("image:delete:confirm"), + )); + } + ?> +
+ +
+
$tags));?>
+ name; ?>
+
+ \ No newline at end of file diff --git a/views/default/river/object/album/annotate.php b/views/default/river/object/album/annotate.php new file mode 100644 index 000000000..691b0c7ec --- /dev/null +++ b/views/default/river/object/album/annotate.php @@ -0,0 +1,13 @@ +getSubject(); + $object = $statement->getObject(); + + $url = "getURL()}\">{$performed_by->name}"; + $string = sprintf(elgg_echo("album:river:annotate"),$url) . " "; + $string .= "getURL() . "\">" . elgg_echo("album:river:item") . ""; + + echo $string; + +?> \ No newline at end of file diff --git a/views/default/river/object/album/create.php b/views/default/river/object/album/create.php new file mode 100644 index 000000000..68553309c --- /dev/null +++ b/views/default/river/object/album/create.php @@ -0,0 +1,13 @@ +getSubject(); + $object = $statement->getObject(); + + $url = "getURL()}\">{$performed_by->name}"; + $string = sprintf(elgg_echo("album:river:created"),$url) . " "; + $string .= "getURL() . "\">" . elgg_echo("album:river:item") . ""; + + echo $string; + +?> \ No newline at end of file diff --git a/views/default/river/object/image/annotate.php b/views/default/river/object/image/annotate.php new file mode 100644 index 000000000..b0b1b8719 --- /dev/null +++ b/views/default/river/object/image/annotate.php @@ -0,0 +1,13 @@ +getSubject(); + $object = $statement->getObject(); + + $url = "getURL()}\">{$performed_by->name}"; + $string = sprintf(elgg_echo("image:river:annotate"),$url) . " "; + $string .= "getURL() . "\">" . elgg_echo("image:river:item") . ""; + + echo $string; + +?> \ No newline at end of file diff --git a/views/default/river/object/image/create.php b/views/default/river/object/image/create.php new file mode 100644 index 000000000..3f5bbb5e8 --- /dev/null +++ b/views/default/river/object/image/create.php @@ -0,0 +1,13 @@ +getSubject(); + $object = $statement->getObject(); + + $url = "getURL()}\">{$performed_by->name}"; + $string = sprintf(elgg_echo("image:river:created"),$url) . " "; + $string .= "getURL() . "\">" . elgg_echo("image:river:item") . ""; + + echo $string; + +?> \ No newline at end of file diff --git a/views/default/settings/tidypics/edit.php b/views/default/settings/tidypics/edit.php new file mode 100644 index 000000000..2c63edff8 --- /dev/null +++ b/views/default/settings/tidypics/edit.php @@ -0,0 +1,10 @@ +maxfilesize; + if (!$maxfilesize) $maxfilesize = (int) 10240; //set the default maximum file size to 10MB (1024KB * 10 = 10240KB = 10MB) + +?> +

+ + + 'params[maxfilesize]', 'value' => $maxfilesize)); ?> +

\ No newline at end of file diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php new file mode 100644 index 000000000..f9f5b09e6 --- /dev/null +++ b/views/default/tidypics/css.php @@ -0,0 +1,128 @@ + + /* --- independent view for image/album SHARED --- */ + +#tidypics_title{ + font-size:1.2em; + font-weight:bold; +} +#tidypics_desc{ + padding:0 20px; + font-style:italic; +} +#tidypics_info{ + padding:20px; + line-height:1.5em; +} + +#tidypics_controls{ + text-align:center; + margin-bottom:10px; +} + +#tidypics_controls a{ + margin:10px; +} + + /* independent album view only */ + +.album_images{ + float:left; + width:160px; + height:160px; + margin:4px; + padding:5px; + border:1px solid #ccc; + text-align:center; +} + + /* independent image view only */ + +#image_full{ + text-align:center; + margin:10px; +} +#image_full img{ + padding:5px; + border:1px solid #ccc; + margin:7px 0; +} + +/* --- albums gallery view --- */ + +.album_cover{ + padding:2px; + border:1px solid #ccc; + margin:8px 0; +} + + +/* ------ album WIDGET VIEW ------ */ + +#album_widget_container{ + text-align:center; +} + +.album_widget_single_item{ + +} +.album_widget_title{ + +} +.album_widget_timestamp { + color:#666666; + margin:0; +} +.collapsable_box #album_widget_layout { + margin:0; +} + +/* --------- image upload/edit forms ------------ */ + +#image_upload_list li{ + margin:3px 0; +} +.edit_image_container{ + padding:5px; + margin:5px 0; + overflow:auto; +} +.edit_images{ + float:right; + width:160px; + height:160px; + margin:4px; + padding:5px; + border:1px solid #ccc; + text-align:center; +} +.image_info{ + float:left; + width:60%; +} +.image_info label{ + font-size:1em; +} +.edit_image{ + float:right; + border:1px solid #ccc; + width:153px; + height:153px; +} + +/* --------- tidypics river items ------------ */ + +.river_image_create { + background: url(mod/tidypics/graphics/icons/river_icon_image.gif) no-repeat left -1px; +} +.river_album_create { + background: url(mod/tidypics/graphics/icons/river_icon_album.gif) no-repeat left -1px; +} + +.pagination { + clear:both !important; +} + \ No newline at end of file diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php new file mode 100644 index 000000000..efe4aa508 --- /dev/null +++ b/views/default/tidypics/forms/edit.php @@ -0,0 +1,115 @@ +title); + $action = "tidypics/editalbum"; + $title = $vars['entity']->title; + $body = $vars['entity']->description; + $tags = $vars['entity']->tags; + $access_id = $vars['entity']->access_id; + $subtype = $vars['subtype']; + + // if nothing is sent, create new, but only new albums are sent here + // new images are sent to upload.php + } else { + $title = elgg_echo("album:add"); + $action = "tidypics/addalbum"; + $tags = ""; + $title = ""; + $description = ""; + } + + // in case we have some cached details + if (isset($vars['albumtitle'])) { + $title = $vars['albumtitle']; + $body = $vars['albumbody']; + $tags = $vars['albumtags']; + } + + $container_guid = get_input('container_guid'); + if (!$container_guid) $container_guid = page_owner(); + +?> +
+

+ + "albumtitle", "value" => $title,)); ?> +

+ +

+ + "albumbody","value" => $body,)); ?> +

+ +

+ + "albumbody","value" => $body,)); ?> +

+ +

+ + "albumtags","value" => $tags,)); ?> +

+ + guid; + $container_guid = $vars['entity']->container_guid; + $cover_guid = get_entity($container_guid)->cover; + + if($cover_guid == $vars['entity']->guid) + $cover = 'yes'; + + ?> +

+ + "cover", "value" => $cover, 'options' => array(elgg_echo('album:cover:yes')))); ?> +

+

+ + 'access_id','value' => $access_id)); ?> +

+ + +

+ + 'access_id','value' => $access_id)); ?> +

+ + + + + +

+
\ No newline at end of file diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php new file mode 100644 index 000000000..252a660bd --- /dev/null +++ b/views/default/tidypics/forms/edit_multi.php @@ -0,0 +1,44 @@ + +
+cover) $no_cover = true; + + foreach($file_array as $key => $file_guid){ + $entity = get_entity($file_guid); + $guid = $entity->guid; + $body = $entity->description; + $tags = $entity->tags; + $container_guid = $entity->container_guid; + if($no_cover && !$cover) $cover = $guid; + + echo '
'; + echo '' . $title . ''; + echo '
'; + echo '

'; + echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n"; + echo '

'; + echo '

"; + echo elgg_view("input/text",array("internalname" => "caption[$key]", "value" => $body,)) . "\n"; + echo "

"; + echo '

\n"; + echo elgg_view("input/tags", array( "internalname" => "tags[$key]","value" => $tags)) . "\n"; + echo '

'; + echo '' . "\n"; + echo ''; + echo elgg_view("input/multi_radio", array( "internalname" => "cover", "value" => $guid, 'options' => array('yes'), 'set' => $cover)); + echo '
'; + echo '
'; + + } + echo elgg_echo('image:access:note'); +?> + +

+
\ No newline at end of file diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php new file mode 100644 index 000000000..35768f64c --- /dev/null +++ b/views/default/tidypics/forms/upload.php @@ -0,0 +1,79 @@ +access_id; + if (get_plugin_setting('maxfilesize','tidypics')) { + if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) { + $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB + } else { + $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics'); + } + } else { + $maxfilesize = 10240; //if the file size limit is not set, default to 10MB + } + +?> + +
+

+
+
+

+
    +' . elgg_view("input/file",array('internalname' => "upload_$x")) . "\n"; + } +?> +
+

+ + + 'access_id','value' => $access_id)); ?> + +

+ '; + + ?> + " onclick="showhide('tidypics_loader');" /> +

+ +
\ No newline at end of file diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php new file mode 100644 index 000000000..ea11006fa --- /dev/null +++ b/views/default/tidypics/groupprofile_albums.php @@ -0,0 +1,60 @@ +num_display; + //if no number has been set, default to 5 + if (!$number) + $number = 5; + + $owner = page_owner_entity(); + $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false); + + echo '
'; + echo '

' . elgg_echo('albums') . '

'; + + if ($owner_albums) { + echo '
'; + foreach($owner_albums as $album){ + + //get album cover if one was set + if($album->cover) + $album_cover = 'album cover'; + else + $album_cover = 'new album'; + + ?> +
+ +
time_created);?>
+ getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")
"; + ?> + +
+ username) || empty($owner->username)) { + echo '' . elgg_echo('album:all') . ''; + } else { + echo '' . elgg_echo('album:more') . ''; + } + + //close album_widget_container div + echo "
"; + } else { + + echo '
'; + echo '

'.elgg_echo("album:none").'

'; + if ($owner && ($owner->canWriteToContainer($_SESSION['user']))){ + echo 'username.'>'.elgg_echo("album:add").''; + echo '
'; + } + + } + //close group_albums_widget div + echo "
"; +?> \ No newline at end of file diff --git a/views/default/tidypics/icon.php b/views/default/tidypics/icon.php new file mode 100644 index 000000000..614fa3ad0 --- /dev/null +++ b/views/default/tidypics/icon.php @@ -0,0 +1,41 @@ +wwwroot}mod/tidypics/graphics/icons/album.gif\" border=\"0\" />"; +} +else{ + + $mime = $vars['mimetype']; + if (isset($vars['thumbnail'])) { + $thumbnail = $vars['thumbnail']; + } else { + $thumbnail = false; + } + + $size = $vars['size']; + if ($size != 'large') { + $size = 'small'; + } + + if ($thumbnail && strpos($mime, "image/")!==false) + echo ""; + else + { + if ($size == 'large') + echo "wwwroot}mod/tidypics/graphics/icons/general_lrg.gif\" border=\"0\" />"; + else + echo "wwwroot}mod/tidypics/graphics/icons/general.gif\" border=\"0\" />"; + } +} +?> \ No newline at end of file diff --git a/views/default/tidypics/menu.php b/views/default/tidypics/menu.php new file mode 100644 index 000000000..4368993dd --- /dev/null +++ b/views/default/tidypics/menu.php @@ -0,0 +1,16 @@ + + +

+ +

\ No newline at end of file diff --git a/views/default/widgets/album_view/edit.php b/views/default/widgets/album_view/edit.php new file mode 100644 index 000000000..2d7c7708f --- /dev/null +++ b/views/default/widgets/album_view/edit.php @@ -0,0 +1,21 @@ +

+ : + + num_display == '') $vars['entity']->num_display = 5; + ?> + +

\ No newline at end of file diff --git a/views/default/widgets/album_view/view.php b/views/default/widgets/album_view/view.php new file mode 100644 index 000000000..347332971 --- /dev/null +++ b/views/default/widgets/album_view/view.php @@ -0,0 +1,53 @@ +num_display; + //if no number has been set, default to 5 + if (!$number) + $number = 5; + + $owner = page_owner_entity(); + $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false); + + if ($owner_albums) { + echo '
'; + + foreach($owner_albums as $album){ + + //get album cover if one was set + if($album->cover) + $album_cover = '' . $album->title . ''; + else + $album_cover = '' . $album->title . ''; + ?> +
+ +
time_created);?>
+ getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")
"; + ?> + +
+ username; + echo "" . elgg_echo('album:more') . ""; + echo "
"; + + } else { + + echo '

'.elgg_echo("album:none").'

'; + + //check if owner has write rights. If so, let him edit the album + $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); + + if ($owner->username == get_entity($container_guid)->username){ + echo '

username.'>'.elgg_echo("album:create").'

'; + } + + } +?> \ No newline at end of file diff --git a/views/rss/object/file.php b/views/rss/object/file.php new file mode 100644 index 000000000..3bd84d076 --- /dev/null +++ b/views/rss/object/file.php @@ -0,0 +1,30 @@ +title; + if (empty($title)) { + $title = substr($vars['entity']->description,0,32); + if (strlen($vars['entity']->description) > 32) + $title .= " ..."; + } + +?> + + + getURL(); ?> + time_created) ?> + getURL(); ?> + <![CDATA[<?php echo $title; ?>]]> + description)); ?>]]> + + diff --git a/world.php b/world.php new file mode 100644 index 000000000..2e80f5393 --- /dev/null +++ b/world.php @@ -0,0 +1,37 @@ +name), $body); +?> \ No newline at end of file -- cgit v1.2.3 From 48c831f882f029768bfe930b7b9734b420830cd8 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 20:30:48 +0000 Subject: Let's get this show on the road --- contributions.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/contributions.txt b/contributions.txt index ff014654c..7b6a073d7 100644 --- a/contributions.txt +++ b/contributions.txt @@ -1,11 +1,14 @@ -Elgg community and users: +Project Lead: +Gabriel Monge-Franco (gabrielinux) +http://gabriel.mongefranco.com - The original author of Tidypics has not been active in the Elgg community lately. Therefore, I took on the task of improving his plug-in and maintaining a log of all changes in this file. If you contribute to this plug-in, please record your changes here and release them under a GPL license. +Original Author: +Jade Dominguez +http://www.tastyseed.com/ -Best regards, -Gabriel Monge-Franco (gabrielinux) -http://gabriel.mongefranco.com +See individual change logs for contributors to those builds + ------------------------------------------------------------------------ -- cgit v1.2.3 From 672eb863f7ef868f3ea61508be88c72a6e703e33 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 20:34:12 +0000 Subject: moving tasks to tracker --- tasks.txt | 66 --------------------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 tasks.txt diff --git a/tasks.txt b/tasks.txt deleted file mode 100644 index 879d8cb42..000000000 --- a/tasks.txt +++ /dev/null @@ -1,66 +0,0 @@ - -Tasks: - - -> DONE --clean up css - -> DONE -- test river views - -> DONE -- enable widget views - -> DONE -- multi image uploader form. - - -> DONE -- Album covers: implement cover option for NEW uploaded images @ upload.php action - i want to enable multi uploader so better to put it in there. - (radio box so only one image can be the cover) - - -> DONE -- /pg/photos/owned - Edit the way album list is presented (make it nicer) - -> DONE -- when adding or editing album -> - saving the album's view access should also edit - all containing image view access - if add new album - -> all image uploads default to albums current access - -> all image edits can not change access - if edit album - -> change access of album and cycle through all current images. - - -> DONE -- Album covers: implemented edit image screen to specify album cover - -> DONE -- allow photo albums for users - -> DONE -- internationalize all text - -> DONE -- clean up unecessary functions from file plugin - -> DONE -- limit uploader to image only mimetype - -> DONE -- (for now) see if i can get rid of any unecessary meta - -> DONE -- create friends views and world views - -> DONE -- add breadcrumb - -> DONE -- (but optimize) add thumbnail icons for listings - - - - --------- CAVEATS ----------- - - - -> SOLVED -- (just clear the pagination css class) problem: - when viewing an indie album, the images are floated. - if the pagination is enabled the bottom bar does not clear the - floated images - -Problem: -the delete action does not delete any actual images -the current method should work, but it doesnt -look for clues in engine/lib/filestore.php -when deleting an album, easy way to delete all images -is just to find the albums folder and delete it. - -Problem: -when defining covers for album , i need to edit the input/checkboxes view -in order submit correctly. Remove the [] as part of the name - --------------------- -my differences due to theme ------------------------- -My customizations: - -in the controls i am added to submenu -edit this out when packaging - - -> if i add album actions to submenu i lose "js confirm" on delete - -> change the album access permissions for groups to have - only 3 choices (logged in , everyone, or group only) - \ No newline at end of file -- cgit v1.2.3 From 1919b91c1843014e695168999ffca09d7370a458 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 20:35:40 +0000 Subject: removing old instructions --- tidypics_user_instructions_.txt | 71 ----------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 tidypics_user_instructions_.txt diff --git a/tidypics_user_instructions_.txt b/tidypics_user_instructions_.txt deleted file mode 100644 index eb2c2a809..000000000 --- a/tidypics_user_instructions_.txt +++ /dev/null @@ -1,71 +0,0 @@ --------------------------------------------- -Tidypics Photo Gallery plugin version 1.05 -Release #5. -Release Date: October 27, 2008 --------------------------------------------- - -Installation ------------------- -1. Drop into root/mod/ -2. Enable plugin via admin panel. -3. Done - - - -Requirements ------------------------- -Will function with all versions of elgg, but current SVN build is needed -for consistency. -Reason: -Updating the album access persmissions will auto-update the access for all -images contained in the album, but when updating each image entity, -the metadata for that entity also needs to be updated. The function that accomplishes -this is only in the current SVN build. -If you do not use the current SVN build of elgg, you will likely get incorrectly -synced access permissions. Just wait for elg 1.1 and all will be dandy. -No changes need to be made to tidypics since the function is called via hook. - - - -Recorded problems: ----------------------------- -1. when viewing an individual album, the image gallery displayed is a collection - of floated divs. If pagination is enabled the bottom pagination bar does not - clear the floated images and you will get a messy display. I did not yet - research a better way to create a gallery view while being inline with elggs listing functions. - -2. The delete action does not delete any actual . - The current method should work, but it does not. - I am quite sure this is unintended, but we will have to wait till the core - gets updated. - Currently NO IMAGES will ever be deleted from your serverspace. - -3. The groups view is a little odd because all other content like blogs, pages, are in list view. - I refuse to put albums in list view, so if you want that, sorry! (just steal the list view from object/albums.php) - - -Cost to use this plugin: ----------------------------------- - - Participation in the tidypics group on community.elgg.org - - We need: - ------------------------ - 1. User testing - 2. Bug reports - 3. Functionality, usability, feature requests/discussions - 4. Developers: Feature enhancements. - - If you do not pay the advertised cost of tidypics, you are stealing this plugin! - Don't be a taker!! - - Bye! - - - Jade - - - - - - - \ No newline at end of file -- cgit v1.2.3 From 389a15ac797fd5e060631ec9feb1568837c5088f Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 20:41:12 +0000 Subject: assuming minor version tick for release for now - might go to 1.5 --- manifest.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/manifest.xml b/manifest.xml index 1dfd9b7a7..2cdfa8579 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,9 +1,10 @@ - - + + - - + + + -- cgit v1.2.3 From 7550a4521b7f8e0b4a6e76ca109c8a5b5848726c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 20:48:04 +0000 Subject: tweaks to language - english --- languages/en.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/languages/en.php b/languages/en.php index 2316a9e2f..a4b82b6d3 100644 --- a/languages/en.php +++ b/languages/en.php @@ -1,12 +1,4 @@ "Photo Album", 'albums' => "Photo Albums", 'album:yours' => "Your photo albums", - 'album:yours:friends' => "Your friends' photo albums", + 'album:yours:friends' => "Friends' photo albums", 'album:user' => "%s's photo albums", 'album:friends' => "%s's friends' photo albums", 'album:all' => "All site photo albums", -- cgit v1.2.3 From a5202ff8f416b327a26df87d0e92dd4ccdb8c084 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 20:57:15 +0000 Subject: defensive coding for empty album --- views/default/object/album.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/views/default/object/album.php b/views/default/object/album.php index b95d55eed..9d3dc507f 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -111,14 +111,15 @@ //build array for back | next links $_SESSION['image_sort'] = array(); - foreach($count as $image){ - array_push($_SESSION['image_sort'], $image->guid); - } + if(count($count) > 0) { + foreach($count as $image){ + array_push($_SESSION['image_sort'], $image->guid); + } - if(count($count) > 0) echo list_entities("object","image", $file_guid, 24, false); - else + } else { echo elgg_echo('image:none'); + } ?>
-- cgit v1.2.3 From a8176a4e82e5c66b3557ea9d96ac563e4e030e3f Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 21:09:07 +0000 Subject: unnecessary files removed --- graphics/Thumbs.db | Bin 18944 -> 0 bytes graphics/icons/Thumbs.db | Bin 24064 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 graphics/Thumbs.db delete mode 100644 graphics/icons/Thumbs.db diff --git a/graphics/Thumbs.db b/graphics/Thumbs.db deleted file mode 100644 index 46eac31d3..000000000 Binary files a/graphics/Thumbs.db and /dev/null differ diff --git a/graphics/icons/Thumbs.db b/graphics/icons/Thumbs.db deleted file mode 100644 index fb5d56ed3..000000000 Binary files a/graphics/icons/Thumbs.db and /dev/null differ -- cgit v1.2.3 From e5b3b8b9bdd999c1e4c1ac583417340eacb72269 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 21:20:30 +0000 Subject: updated widget for Elgg 1.5 --- languages/en.php | 4 ++-- views/default/widgets/album_view/view.php | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/languages/en.php b/languages/en.php index a4b82b6d3..21fe56f2d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -23,7 +23,7 @@ //actions - 'album:create' => "New Album", + 'album:create' => "Create New Album", 'album:add' => "Add Photo Album", 'album:addpix' => "Add photos", 'album:edit' => "Edit album", @@ -97,7 +97,7 @@ 'image:notimage' => "We only accept jpeg, gif, or png images of the allowed file size.", 'images:notedited' => "Not all images were successfully updated", - 'album:none' => "We could not find any albums at the moment.", + 'album:none' => "No albums have been created yet.", 'album:uploadfailed' => "Sorry; we could not save your album.", 'album:deletefailed' => "Your album could not be deleted at this time.", 'album:blank' => "Please give this album a title and description." diff --git a/views/default/widgets/album_view/view.php b/views/default/widgets/album_view/view.php index 347332971..d56e0c3fc 100644 --- a/views/default/widgets/album_view/view.php +++ b/views/default/widgets/album_view/view.php @@ -1,3 +1,4 @@ +
num_display; @@ -9,7 +10,7 @@ $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false); if ($owner_albums) { - echo '
'; + echo '
'; foreach($owner_albums as $album){ @@ -40,14 +41,12 @@ } else { - echo '

'.elgg_echo("album:none").'

'; + echo '

' . elgg_echo("album:none") . '

'; - //check if owner has write rights. If so, let him edit the album - $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); - - if ($owner->username == get_entity($container_guid)->username){ + if (get_loggedin_userid() == page_owner()) { echo '

username.'>'.elgg_echo("album:create").'

'; } } -?> \ No newline at end of file +?> +
\ No newline at end of file -- cgit v1.2.3 From b52a10cf375a85a8c2d0b0e22791ff6e0c6773c1 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 21:27:28 +0000 Subject: updated the edit album form to use default permissions and be better formatted --- views/default/tidypics/forms/edit.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php index efe4aa508..97170163b 100644 --- a/views/default/tidypics/forms/edit.php +++ b/views/default/tidypics/forms/edit.php @@ -25,6 +25,10 @@ $tags = ""; $title = ""; $description = ""; + if (defined('ACCESS_DEFAULT')) + $access_id = ACCESS_DEFAULT; + else + $access_id = 0; } // in case we have some cached details @@ -38,6 +42,7 @@ if (!$container_guid) $container_guid = page_owner(); ?> +

@@ -112,4 +117,5 @@ ?>

-
\ No newline at end of file + +
\ No newline at end of file -- cgit v1.2.3 From 350610666805c76ee736eba0b4b9069cc8d84c52 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 22:13:50 +0000 Subject: I think I have the submenus straightened out --- start.php | 63 ++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/start.php b/start.php index f3c675d52..74d6dd22e 100644 --- a/start.php +++ b/start.php @@ -2,10 +2,6 @@ /** * Elgg tidypics * - * @package ElggFile - * @author Curverider Ltd - * @copyright Curverider Ltd 2008 - * @link http://elgg.com/ */ /** @@ -26,7 +22,7 @@ extend_view('css', 'tidypics/css'); // Extend hover-over and profile menu - extend_view('profile/menu/links','tidypics/menu'); + extend_view('profile/menu/links','tidypics/menu'); //group view ** psuedo widget view for group pages** extend_view('groups/right_column','tidypics/groupprofile_albums'); @@ -35,7 +31,7 @@ register_page_handler('photos','tidypics_page_handler'); // Add a new tidypics widget - add_widget_type('album_view',elgg_echo("album:widget"),elgg_echo("album:widget:description"), 'profile'); + add_widget_type('album_view', elgg_echo("album:widget"), elgg_echo("album:widget:description"), 'profile'); // Register a URL handler for files register_entity_url_handler('image_url','object','image'); @@ -56,20 +52,49 @@ $page_owner = page_owner_entity(); - // General submenu options - if (get_context() == "photos") { - if (isloggedin() && (page_owner() == $_SESSION['guid'] || !page_owner())) { - add_submenu_item(sprintf(elgg_echo("album:yours"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/owned/" . page_owner_entity()->username, '1view'); - add_submenu_item(sprintf(elgg_echo('album:yours:friends'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/friends/". page_owner_entity()->username, '1view'); - add_submenu_item(sprintf(elgg_echo('album:all'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/world/", '1view'); - } else if (page_owner() && $page_owner instanceof ElggUser) { - add_submenu_item(sprintf(elgg_echo('album:friends'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,'1view'); - add_submenu_item(sprintf(elgg_echo('album:all'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/world/", '1view'); - } - } - if (isloggedin() && ($page_owner instanceof ElggGroup)) { - add_submenu_item(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/owned/" . page_owner_entity()->username, 'photo_albums'); + // context is only set to photos on individual pages, not on group pages + if (get_context() == "photos") { + + // owner gets "your albumn", "your friends albums" + if (get_loggedin_userid() == $page_owner->guid) { + add_submenu_item( elgg_echo("album:yours"), + $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username, + '1view' ); + + add_submenu_item( elgg_echo('album:yours:friends'), + $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, + '1view'); + } else if (isloggedin()) { + // logged nut not owner gets "your albums", "page owners albums", "page owner's friends albums" + add_submenu_item( elgg_echo("album:yours"), + $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username, + '1view' ); + add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, + '1view' ); + add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, + '1view'); + } else { + // non logged in user gets "page owners albums", "page owner's friends albums" + add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, + '1view' ); + add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, + '1view'); } + + add_submenu_item( sprintf(elgg_echo('album:all'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/world/", + '1view'); + } + + if (isloggedin() && ($page_owner instanceof ElggGroup)) { + add_submenu_item(sprintf(elgg_echo("album:user"),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, + 'photo_albums'); + } } /** -- cgit v1.2.3 From 85acd20012d7f0364294f33fd3f5f5792aa833bc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 20 Mar 2009 22:16:31 +0000 Subject: --- contributions.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contributions.txt b/contributions.txt index 7b6a073d7..65dd95c5a 100644 --- a/contributions.txt +++ b/contributions.txt @@ -10,6 +10,21 @@ http://www.tastyseed.com/ See individual change logs for contributors to those builds +------------------------------------------------------------------------ +Version 1.09 Change List +Release Date: ??/??/2009 +Contributors: + * Gabriel Monge-Franco (http://gabriel.mongefranco.com) + * Cash Costello +------------------------------------------------------------------------ +BEGIN VERSION 1.09 CHANGES +------------------------------------------------------------------------ +* Fixed submenus on sidebar of album pages +------------------------------------------------------------------------ +END VERSION 1.09 CHANGES +------------------------------------------------------------------------ + + ------------------------------------------------------------------------ Version 1.08.2 Change List -- cgit v1.2.3 From effd41e3b327234adf2997895da7e80b88458af1 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 15:28:23 +0000 Subject: moved add album to menu --- index.php | 30 +++++++++------------------- languages/en.php | 2 +- start.php | 59 ++++++++++++++++++++++++++------------------------------ 3 files changed, 37 insertions(+), 54 deletions(-) diff --git a/index.php b/index.php index 00b09d14b..32c389e2e 100644 --- a/index.php +++ b/index.php @@ -2,17 +2,10 @@ /** * Elgg tidypics photo gallery main page * - * @package ElggFile - * @author Curverider Ltd - * @copyright Curverider Ltd 2008 - * @link http://elgg.com/ - * - * * */ - //require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); //get the owner of the current page $owner = page_owner_entity(); @@ -25,21 +18,16 @@ } //set the title - $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name")); - - //allow new album creation - if(can_write_to_container($_SESSION['guid'], page_owner())){ - $area2 .= 'username.'">'.elgg_echo('album:create').'

'; - } - + $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name")); + // Get objects - set_context('search'); - set_input('search_viewtype', 'gallery'); - $area2 .= list_entities("object","album",page_owner(),10); + set_context('search'); + set_input('search_viewtype', 'gallery'); + $area2 .= list_entities("object","album",page_owner(),10); - set_context('photos'); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + set_context('photos'); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); // Finally draw the page - page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body); + page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body); ?> \ No newline at end of file diff --git a/languages/en.php b/languages/en.php index 21fe56f2d..7e7185c5d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -23,7 +23,7 @@ //actions - 'album:create' => "Create New Album", + 'album:create' => "Create new album", 'album:add' => "Add Photo Album", 'album:addpix' => "Add photos", 'album:edit' => "Edit album", diff --git a/start.php b/start.php index 74d6dd22e..7c3f888e8 100644 --- a/start.php +++ b/start.php @@ -9,7 +9,6 @@ */ function tidypics_init() { - // Get config global $CONFIG; // Set up menu for logged in users @@ -56,38 +55,42 @@ if (get_context() == "photos") { // owner gets "your albumn", "your friends albums" - if (get_loggedin_userid() == $page_owner->guid) { + if (get_loggedin_userid() == $page_owner->guid && get_loggedin_userid()) { + add_submenu_item( elgg_echo('album:create'), + $CONFIG->wwwroot . "pg/photos/new/". $page_owner->username, + 'tidypics' ); + add_submenu_item( elgg_echo("album:yours"), $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username, - '1view' ); + 'tidypics' ); add_submenu_item( elgg_echo('album:yours:friends'), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, - '1view'); + 'tidypics'); } else if (isloggedin()) { // logged nut not owner gets "your albums", "page owners albums", "page owner's friends albums" add_submenu_item( elgg_echo("album:yours"), $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username, - '1view' ); + 'tidypics' ); add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name), $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, - '1view' ); + 'tidypics' ); add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, - '1view'); - } else { + 'tidypics'); + } else if ($page_owner->guid) { // non logged in user gets "page owners albums", "page owner's friends albums" add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name), $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, - '1view' ); + 'tidypics' ); add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, - '1view'); + 'tidypics'); } add_submenu_item( sprintf(elgg_echo('album:all'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/world/", - '1view'); + 'tidypics'); } if (isloggedin() && ($page_owner instanceof ElggGroup)) { @@ -112,12 +115,6 @@ { case "owned": //view list of albums owned by container if (isset($page[1])) set_input('username',$page[1]); - - /* if you want to put new album action in the submenu, just do it like this ---------> - if(can_write_to_container($_SESSION['guid'], page_owner())){ - add_submenu_item(elgg_echo('album:create'), $CONFIG->wwwroot . "pg/photos/new/". page_owner_entity()->username, 'pagesactions'); - } - */ include($CONFIG->pluginspath . "tidypics/index.php"); break; @@ -128,7 +125,7 @@ case "album": //view an album individually set_input('guid',$page[1]); - @include(dirname(dirname(dirname(__FILE__))) . "/entities/index.php"); + include(dirname(dirname(dirname(__FILE__))) . "/entities/index.php"); break; case "new": //create new album @@ -167,21 +164,19 @@ * @param ElggEntity $entity album/image entity * @return string File URL */ - function image_url($entity) { - global $CONFIG; - $title = $entity->title; - $title = friendly_title($title); - return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title; - - } + function image_url($entity) { + global $CONFIG; + $title = $entity->title; + $title = friendly_title($title); + return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title; + } - function album_url($entity) { - global $CONFIG; - $title = $entity->title; - $title = friendly_title($title); - return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title; - - } + function album_url($entity) { + global $CONFIG; + $title = $entity->title; + $title = friendly_title($title); + return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title; + } // Make sure tidypics_init is called on initialisation register_elgg_event_handler('init','system','tidypics_init'); -- cgit v1.2.3 From 8b474ce9723b7d717c65415149de947fbedceeba Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 15:44:07 +0000 Subject: updated the upload pages --- languages/en.php | 2 +- upload.php | 4 +--- views/default/tidypics/forms/upload.php | 30 ++++++++++++------------------ 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/languages/en.php b/languages/en.php index 7e7185c5d..bc64fd550 100644 --- a/languages/en.php +++ b/languages/en.php @@ -25,7 +25,7 @@ 'album:create' => "Create new album", 'album:add' => "Add Photo Album", - 'album:addpix' => "Add photos", + 'album:addpix' => "Add photos to", 'album:edit' => "Edit album", 'album:delete' => "Delete album", diff --git a/upload.php b/upload.php index 320c5ce6d..4fcf27695 100644 --- a/upload.php +++ b/upload.php @@ -37,10 +37,8 @@ } set_context('photos'); - $title = elgg_echo('album:addpix'); + $title = elgg_echo('album:addpix') . ' ' . $album_entity->title; $area2 .= elgg_view_title($title); - - $area2 .= '

'. $album_entity->title. '

'; $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album ) ); $body = elgg_view_layout('two_column_left_sidebar', '', $area2, $area3); diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php index 35768f64c..be87c8697 100644 --- a/views/default/tidypics/forms/upload.php +++ b/views/default/tidypics/forms/upload.php @@ -1,27 +1,19 @@ access_id; - if (get_plugin_setting('maxfilesize','tidypics')) { - if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) { - $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB - } else { - $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics'); - } + $container_guid = get_input('container_guid'); + $access_id = get_entity($vars['album'])->access_id; + if (get_plugin_setting('maxfilesize','tidypics')) { + if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) { + $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB } else { - $maxfilesize = 10240; //if the file size limit is not set, default to 10MB + $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics'); } + } else { + $maxfilesize = 10240; //if the file size limit is not set, default to 10MB + } ?> +


@@ -76,4 +69,5 @@ function showhide(layer_ref) { " onclick="showhide('tidypics_loader');" />

-
\ No newline at end of file + +
\ No newline at end of file -- cgit v1.2.3 From 450b57bc95f405aebb1dc110bafc1b5def5041f4 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 15:57:48 +0000 Subject: code cleanup --- edit.php | 8 ++----- edit_multi.php | 8 ++----- friends.php | 8 ++----- index.php | 2 +- newalbum.php | 34 +++++++++++--------------- thumbnail.php | 60 ++++++++++++++++++++++------------------------ upload.php | 9 ++----- view.php | 76 +++++++++++++++++++++++++++------------------------------- world.php | 18 ++++++-------- 9 files changed, 93 insertions(+), 130 deletions(-) diff --git a/edit.php b/edit.php index 2c202e402..4e6d0d2ec 100644 --- a/edit.php +++ b/edit.php @@ -1,14 +1,10 @@ - * @copyright Curverider Ltd 2008 - * @link http://elgg.com/ */ // Load Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); - + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - - $area2 = elgg_view_title(elgg_echo('album:add')); - $area2 .= elgg_view("tidypics/forms/edit"); - + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + + $area2 = elgg_view_title(elgg_echo('album:add')); + $area2 .= elgg_view("tidypics/forms/edit"); + // Display page - page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 )); + page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 )); - ?> \ No newline at end of file diff --git a/thumbnail.php b/thumbnail.php index 0e6142cbb..b4c745ae2 100644 --- a/thumbnail.php +++ b/thumbnail.php @@ -1,46 +1,42 @@ getSubtype() == "image") { - // Get file thumbnail - if ($size == "small") { - $thumbfile = $file->smallthumb; - } else { - $thumbfile = $file->largethumb; - } + if ($file = get_entity($file_guid)) { + if ($file->getSubtype() == "image") { + // Get file thumbnail + if ($size == "small") { + $thumbfile = $file->smallthumb; + } else { + $thumbfile = $file->largethumb; + } - // Grab the file - if ($thumbfile && !empty($thumbfile)) { - $readfile = new ElggFile(); - $readfile->owner_guid = $file->owner_guid; - $readfile->setFilename($thumbfile); - //$mime = $file->getMimeType(); - $contents = $readfile->grabFile(); - } - } //end subtype comparison - } //end get_entity + // Grab the file + if ($thumbfile && !empty($thumbfile)) { + $readfile = new ElggFile(); + $readfile->owner_guid = $file->owner_guid; + $readfile->setFilename($thumbfile); + //$mime = $file->getMimeType(); + $contents = $readfile->grabFile(); + } + } //end subtype comparison + } //end get_entity // Open error image if file was not found if (!isset($contents) || is_null($contents) || $file->getSubtype()!='image') { @@ -49,7 +45,7 @@ } //end of default error image // Return the thumbnail and exit - header("Content-type: image"); - echo $contents; - exit; + header("Content-type: image"); + echo $contents; + exit; ?> \ No newline at end of file diff --git a/upload.php b/upload.php index 4fcf27695..062fec325 100644 --- a/upload.php +++ b/upload.php @@ -1,15 +1,10 @@ container_guid)->container_guid; - - if ($top_container) { - set_page_owner($top_container); - } else { - set_page_owner($entity->owner_guid); - } + //set "real" container - image container is the album , group/user is the album container + $top_container = get_entity($entity->container_guid)->container_guid; + + if ($top_container) { + set_page_owner($top_container); + } else { + set_page_owner($entity->owner_guid); + } // Set the body to be the full view of the entity, and the title to be its title - $area2 = elgg_view_entity($entity,true); - if ($shell) { - $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2); - } else { - $body = $area2; - } - - } else { - $body = elgg_echo('notfound'); - } - - // Display the page + $area2 = elgg_view_entity($entity,true); if ($shell) { - page_draw("", $body); + $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2); } else { - header("Content-type: text/html; charset=UTF-8"); - echo $body; + $body = $area2; } + } else { + $body = elgg_echo('notfound'); + } + + // Display the page + if ($shell) { + page_draw("", $body); + } else { + header("Content-type: text/html; charset=UTF-8"); + echo $body; + } + ?> \ No newline at end of file diff --git a/world.php b/world.php index 2e80f5393..d5dbf1f2a 100644 --- a/world.php +++ b/world.php @@ -1,25 +1,21 @@ Date: Sat, 21 Mar 2009 15:59:18 +0000 Subject: more cleanup --- upload.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/upload.php b/upload.php index 062fec325..dda327ef8 100644 --- a/upload.php +++ b/upload.php @@ -10,26 +10,26 @@ // Get the current page's owner - if ($album = (int) get_input('container_guid')) - { - $album_entity = get_entity($album); - - //if album does not exist or user does not have access - if(!$album_entity || !$album_entity->canEdit()) - forward('pg/photos/owned/'); - - //set group to "real" container - $container = $album_entity->container_guid; - set_page_owner($container); - } - else + if ($album = (int) get_input('container_guid')) + { + $album_entity = get_entity($album); + + //if album does not exist or user does not have access + if(!$album_entity || !$album_entity->canEdit()) forward('pg/photos/owned/'); + + //set group to "real" container + $container = $album_entity->container_guid; + set_page_owner($container); + } + else + forward('pg/photos/owned/'); - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); + } set_context('photos'); $title = elgg_echo('album:addpix') . ' ' . $album_entity->title; -- cgit v1.2.3 From e340946cd80864a9b2c816e2f21a57d934761fcb Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 16:02:37 +0000 Subject: setting page owner --- edit_multi.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/edit_multi.php b/edit_multi.php index c6eb7de88..c4f35bc07 100644 --- a/edit_multi.php +++ b/edit_multi.php @@ -8,16 +8,24 @@ gatekeeper(); set_context('photos'); + + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); + } + $file_string = get_input('files'); $file_array_sent = explode('-', $file_string); $new_file_array = array(); - foreach($file_array_sent as $file_guid){ - if ($entity = get_entity($file_guid)){ - if($entity->canEdit()){ + foreach ($file_array_sent as $file_guid) { + if ($entity = get_entity($file_guid)) { + if ($entity->canEdit()){ array_push($new_file_array, $file_guid); } - if(!$album_guid) $album_guid = $entity->container_guid; + if (!$album_guid) + $album_guid = $entity->container_guid; } } -- cgit v1.2.3 From fd2278f46e5123c43343f57cf764d45a0b57ec24 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 16:13:06 +0000 Subject: updated views for edit multiple images --- edit_multi.php | 7 ++++--- languages/en.php | 2 ++ views/default/tidypics/forms/edit_multi.php | 8 +++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/edit_multi.php b/edit_multi.php index c4f35bc07..dd58759fe 100644 --- a/edit_multi.php +++ b/edit_multi.php @@ -29,9 +29,10 @@ } } - - $area2 .= elgg_view_title($title = elgg_echo('image:edit')); + + $title = elgg_echo('tidypics:editprops'); + $area2 .= elgg_view_title($title); $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid)); $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); - page_draw(elgg_echo("edit"), $body); + page_draw($title, $body); ?> \ No newline at end of file diff --git a/languages/en.php b/languages/en.php index bc64fd550..7e8d67f39 100644 --- a/languages/en.php +++ b/languages/en.php @@ -20,6 +20,8 @@ 'item:object:image' => "Photos", 'item:object:album' => "Albums", 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):", + + 'tidypics:editprops' => 'Edit Image Properties', //actions diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php index 252a660bd..ebd2ef11a 100644 --- a/views/default/tidypics/forms/edit_multi.php +++ b/views/default/tidypics/forms/edit_multi.php @@ -3,6 +3,7 @@ * form for mass editing all uploaded images */ ?> +
- -

-
\ No newline at end of file + +

+ +
\ No newline at end of file -- cgit v1.2.3 From ac0e60fd90c55a3a7d4f2001eb9e4cce44a5b259 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 16:57:57 +0000 Subject: cleaning up friends album view and individual album view --- edit.php | 45 ++++++++++++------------- friends.php | 4 +-- index.php | 14 +++++--- views/default/object/album.php | 8 +---- views/default/tidypics/css.php | 10 +++--- views/default/tidypics/forms/edit.php | 63 +++++++++++++++++------------------ 6 files changed, 70 insertions(+), 74 deletions(-) diff --git a/edit.php b/edit.php index 4e6d0d2ec..3e597cf05 100644 --- a/edit.php +++ b/edit.php @@ -10,33 +10,30 @@ set_context('photos'); $file = (int) get_input('file_guid'); - if (!$file = get_entity($file)) - forward(); + if (!$file = get_entity($file)) + forward(); - if(!$file->canEdit()) - forward(); + if (!$file->canEdit()) + forward(); - $subtype = $file->getSubtype(); + $subtype = $file->getSubtype(); - if($subtype == 'album'){ - if($container = $file->container_guid) - set_page_owner($container); - - $area2 .= elgg_view_title($title = elgg_echo('album:edit')); - } - elseif($subtype == 'image'){ - if($container = get_entity($file->container_guid)->container_guid) - set_page_owner($container); + if ($subtype == 'album') { + if($container = $file->container_guid) + set_page_owner($container); - $area2 .= elgg_view_title($title = elgg_echo('image:edit')); - } - else{ - forward(); - } - - $area2 .= elgg_view("tidypics/forms/edit",array('entity' => $file, 'subtype' => $subtype)); - $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); - page_draw(elgg_echo("edit"), $body); - + $title = elgg_echo('album:edit'); + } else if ($subtype == 'image') { + if ($container = get_entity($file->container_guid)->container_guid) + set_page_owner($container); + + $title = elgg_echo('image:edit'); + } else { + forward(); + } + $area2 .= elgg_view_title($title); + $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $file, 'subtype' => $subtype)); + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + page_draw($title, $body); ?> \ No newline at end of file diff --git a/friends.php b/friends.php index 50e4aabc3..c9deb4772 100644 --- a/friends.php +++ b/friends.php @@ -24,12 +24,12 @@ if(isloggedin() && (page_owner() == $_SESSION['guid'])) { $area2 = elgg_view_title($title = elgg_echo('album:yours:friends')); } else { - $area2 = elgg_view_title($title = sprintf(elgg_echo('album:friends'), "$friendname")); + $area2 = elgg_view_title($title = sprintf(elgg_echo('album:friends'), $friendname)); } set_context('search'); set_input('search_viewtype', 'gallery'); - $area2 .= list_user_friends_objects(page_owner(), 'album'); + $area2 .= list_user_friends_objects(page_owner(), 'album', 10, true, false); set_context('photos'); $body = elgg_view_layout('two_column_left_sidebar', '', $area2); diff --git a/index.php b/index.php index 8839cd95d..45c849878 100644 --- a/index.php +++ b/index.php @@ -18,16 +18,22 @@ } //set the title - $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name")); - + $title = sprintf(elgg_echo('album:user'), "$owner->name"); + $area2 = elgg_view_title($title); + + // temporary code - move to view when cleaned up + //$area2 .= '
'; + // Get objects set_context('search'); set_input('search_viewtype', 'gallery'); - $area2 .= list_entities("object","album",page_owner(),10); + $area2 .= list_entities("object", "album", page_owner(), 10); + + //$area2 .= '
'; set_context('photos'); $body = elgg_view_layout('two_column_left_sidebar', '', $area2); // Finally draw the page - page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body); + page_draw($title, $body); ?> \ No newline at end of file diff --git a/views/default/object/album.php b/views/default/object/album.php index 9d3dc507f..464806ca1 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -1,12 +1,6 @@ title); - $action = "tidypics/editalbum"; - $title = $vars['entity']->title; - $body = $vars['entity']->description; - $tags = $vars['entity']->tags; - $access_id = $vars['entity']->access_id; - $subtype = $vars['subtype']; + if (isset($vars['entity'])) { + $title = sprintf(elgg_echo("album:edit"),$object->title); + $action = "tidypics/editalbum"; + $title = $vars['entity']->title; + $body = $vars['entity']->description; + $tags = $vars['entity']->tags; + $access_id = $vars['entity']->access_id; + $subtype = $vars['subtype']; - // if nothing is sent, create new, but only new albums are sent here - // new images are sent to upload.php - } else { - $title = elgg_echo("album:add"); - $action = "tidypics/addalbum"; - $tags = ""; - $title = ""; - $description = ""; - if (defined('ACCESS_DEFAULT')) - $access_id = ACCESS_DEFAULT; - else - $access_id = 0; - } + // if nothing is sent, create new, but only new albums are sent here + // new images are sent to upload.php + } else { + $title = elgg_echo("album:add"); + $action = "tidypics/addalbum"; + $tags = ""; + $title = ""; + $description = ""; + if (defined('ACCESS_DEFAULT')) + $access_id = ACCESS_DEFAULT; + else + $access_id = 0; + } // in case we have some cached details - if (isset($vars['albumtitle'])) { - $title = $vars['albumtitle']; - $body = $vars['albumbody']; - $tags = $vars['albumtags']; - } + if (isset($vars['albumtitle'])) { + $title = $vars['albumtitle']; + $body = $vars['albumbody']; + $tags = $vars['albumtags']; + } - $container_guid = get_input('container_guid'); - if (!$container_guid) $container_guid = page_owner(); - + $container_guid = get_input('container_guid'); + if (!$container_guid) $container_guid = page_owner(); + ?>
@@ -49,8 +49,7 @@ "albumtitle", "value" => $title,)); ?>

-- cgit v1.2.3 From abbcdf538949aed8cc91f65bdf1c563506fc8614 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 17:22:31 +0000 Subject: fixed view album - removed breadcrumbs for now --- index.php | 7 +----- start.php | 2 +- viewalbum.php | 43 ++++++++++++++++++++++++++++++++ views/default/object/album.php | 56 ++++++++++++++---------------------------- 4 files changed, 64 insertions(+), 44 deletions(-) create mode 100644 viewalbum.php diff --git a/index.php b/index.php index 45c849878..6b17e12e8 100644 --- a/index.php +++ b/index.php @@ -20,17 +20,12 @@ //set the title $title = sprintf(elgg_echo('album:user'), "$owner->name"); $area2 = elgg_view_title($title); - - // temporary code - move to view when cleaned up - //$area2 .= '

'; - + // Get objects set_context('search'); set_input('search_viewtype', 'gallery'); $area2 .= list_entities("object", "album", page_owner(), 10); - //$area2 .= '
'; - set_context('photos'); $body = elgg_view_layout('two_column_left_sidebar', '', $area2); diff --git a/start.php b/start.php index 7c3f888e8..9474ed746 100644 --- a/start.php +++ b/start.php @@ -125,7 +125,7 @@ case "album": //view an album individually set_input('guid',$page[1]); - include(dirname(dirname(dirname(__FILE__))) . "/entities/index.php"); + include($CONFIG->pluginspath . "tidypics/viewalbum.php"); break; case "new": //create new album diff --git a/viewalbum.php b/viewalbum.php new file mode 100644 index 000000000..5c8f0b2b9 --- /dev/null +++ b/viewalbum.php @@ -0,0 +1,43 @@ +container_guid) { + set_page_owner($entity->container_guid); + } else { + set_page_owner($entity->owner_guid); + } + + // Set the body to be the full view of the entity, and the title to be its title + if ($entity instanceof ElggObject) { + $title = $entity->title; + } else if ($entity instanceof ElggEntity) { + $title = $entity->name; + } + + $area2 = elgg_view_title($title); + + $area2 .= elgg_view_entity($entity, true); + + // Otherwise? + } else { + } + + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + + // Display the page + page_draw($title, $body); +?> \ No newline at end of file diff --git a/views/default/object/album.php b/views/default/object/album.php index 464806ca1..a1b238812 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -13,7 +13,7 @@ $owner = $vars['entity']->getOwnerEntity(); $friendlytime = friendly_time($vars['entity']->time_created); $mime = $file->mimetype; - + if (get_context() == "search") { if (get_input('search_viewtype') == "gallery") { @@ -59,30 +59,11 @@ } else { // individual album view ?> -
-username) || empty(page_owner_entity()->username)) { //when no owner available, link to world photos -?> -  >  - - name); ?> >  - - -
- +
'.$title.'
'; - echo '
'.autop($desc).'
'; + echo '
'.autop($desc).'
'; - if ($file->canEdit()) { // add edits - // specific to my theme only - //add_submenu_item(elgg_echo('album:addpix'), $vars['url'] . "pg/photos/upload/". $file_guid , '', 'jade'); - //add_submenu_item(elgg_echo('album:edit'), $vars['url'] . "mod/tidypics/edit.php?file_guid=". $file_guid , '', 'jade'); - //add_submenu_item(elgg_echo('album:delete'), $vars['url'] . "action/tidypics/delete?file=". $file_guid , '', 'jade'); + if ($file->canEdit()) { // add controls ?>
@@ -97,23 +78,23 @@ ?>
0) { - foreach($count as $image){ - array_push($_SESSION['image_sort'], $image->guid); - } + if(count($count) > 0) { + foreach($count as $image){ + array_push($_SESSION['image_sort'], $image->guid); + } - echo list_entities("object","image", $file_guid, 24, false); - } else { - echo elgg_echo('image:none'); - } + echo list_entities("object","image", $file_guid, 24, false); + } else { + echo elgg_echo('image:none'); + } ?>
@@ -128,5 +109,6 @@ echo elgg_view_comments($file); } -} + echo '
'; + } // end of individual album view ?> -- cgit v1.2.3 From 9cd649361936640a11c249443c6c8f4e00f2399d Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 17:39:26 +0000 Subject: wrong path on include elgg engine --- viewalbum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viewalbum.php b/viewalbum.php index 5c8f0b2b9..2a5999379 100644 --- a/viewalbum.php +++ b/viewalbum.php @@ -4,7 +4,7 @@ * Tidypics Album View Page */ - include_once(dirname(dirname(__FILE__)) . "/engine/start.php"); + include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); // Get the GUID of the entity we want to view $guid = (int) get_input('guid'); -- cgit v1.2.3 From 26be16aaf2189a4b50b06494aab6c6690480a371 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 17:53:07 +0000 Subject: finished updating display of single image --- start.php | 2 +- view.php | 56 ------------------------ viewimage.php | 42 ++++++++++++++++++ views/default/object/image.php | 97 ++++++++++++++++++------------------------ 4 files changed, 84 insertions(+), 113 deletions(-) delete mode 100644 view.php create mode 100644 viewimage.php diff --git a/start.php b/start.php index 9474ed746..a0162319c 100644 --- a/start.php +++ b/start.php @@ -120,7 +120,7 @@ case "view": //view an image individually set_input('guid',$page[1]); - include($CONFIG->pluginspath . "tidypics/view.php"); + include($CONFIG->pluginspath . "tidypics/viewimage.php"); break; case "album": //view an album individually diff --git a/view.php b/view.php deleted file mode 100644 index 60fb47864..000000000 --- a/view.php +++ /dev/null @@ -1,56 +0,0 @@ -container_guid)->container_guid; - - if ($top_container) { - set_page_owner($top_container); - } else { - set_page_owner($entity->owner_guid); - } - - // Set the body to be the full view of the entity, and the title to be its title - $area2 = elgg_view_entity($entity,true); - if ($shell) { - $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2); - } else { - $body = $area2; - } - - } else { - $body = elgg_echo('notfound'); - } - - // Display the page - if ($shell) { - page_draw("", $body); - } else { - header("Content-type: text/html; charset=UTF-8"); - echo $body; - } - -?> \ No newline at end of file diff --git a/viewimage.php b/viewimage.php new file mode 100644 index 000000000..85e8d8215 --- /dev/null +++ b/viewimage.php @@ -0,0 +1,42 @@ +container_guid)->container_guid; + + if ($top_container) { + set_page_owner($top_container); + } else { + set_page_owner($entity->owner_guid); + } + + $title = $entity->title; + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity($entity, true); + + } else { + $body = elgg_echo('notfound'); + } + + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + + // Display the page + page_draw($title, $body); +?> \ No newline at end of file diff --git a/views/default/object/image.php b/views/default/object/image.php index 063ad09cb..97095822e 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -1,10 +1,7 @@ mimetype; -if (get_context() == "search") { //if this is the search view - + if (get_context() == "search") { //if this is the search view if (get_input('search_viewtype') == "gallery") { ?> @@ -40,73 +36,60 @@ if (get_context() == "search") { //if this is the search view echo elgg_view_listing($icon, $info); } -} -else { //tidypics image display + } else { + //tidypics image display - if (!$vars['full']) { //simple gallery view + if (!$vars['full']) { //simple gallery view ?>
thumbnail
container_guid); + echo '
'; + + $album = get_entity($file->container_guid); - //compile back | next links - $current = array_search($file_guid, $_SESSION['image_sort']); + //compile back | next links + $current = array_search($file_guid, $_SESSION['image_sort']); - if(!$current){ // means we are no longer using the correct album array + if (!$current) { // means we are no longer using the correct album array - //rebuild the array -> - $count = get_entities("object","image", $album->guid, '', 999); - $_SESSION['image_sort'] = array(); + //rebuild the array -> + $count = get_entities("object","image", $album->guid, '', 999); + $_SESSION['image_sort'] = array(); - foreach($count as $image){ - array_push($_SESSION['image_sort'], $image->guid); - } + foreach($count as $image){ + array_push($_SESSION['image_sort'], $image->guid); + } - $current = array_search($file_guid, $_SESSION['image_sort']); - } + $current = array_search($file_guid, $_SESSION['image_sort']); + } - if(!$current == 0) - $back = '<<' . elgg_echo('image:back') . '  '; + if (!$current == 0) + $back = '<<' . elgg_echo('image:back') . '  '; - if(array_key_exists(($current+1), $_SESSION['image_sort'])) - $next = '  ' . elgg_echo('image:next') . '>>'; + if (array_key_exists(($current+1), $_SESSION['image_sort'])) + $next = '  ' . elgg_echo('image:next') . '>>'; ?> -
-username) || empty(page_owner_entity()->username)) { //when no owner available, link to world photos -?> -  >  - - name); ?> >  - - title; ?> >  - -
+ ' . $title . '
'; - echo '
' . autop($desc) . '
'; - echo '
'; - echo '
' . $back . $next . '
'; - if($next) echo ''; - echo '' . $title . ''; - if($next) echo ''; - echo '
'; + echo '
' . autop($desc) . '
'; + echo '
'; + echo '
' . $back . $next . '
'; + if ($next) echo ''; + echo '' . $title . ''; + if ($next) echo ''; + echo '
'; ?>
  canEdit()) { // add edit controls + if ($file->canEdit()) { // add edit controls ?>   elgg_echo("image:delete"), 'confirm' => elgg_echo("image:delete:confirm"), )); - } + } ?>
@@ -123,8 +106,10 @@ else { //tidypics image display name; ?>
'; + } -} + } // end of tidypics image display ?> \ No newline at end of file -- cgit v1.2.3 From 7acd3a2947f7bd92ded5bc5f02baa5db87f6b212 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 18:12:50 +0000 Subject: cleaned up actions - formatting --- actions/addalbum.php | 100 +++++++++++++++++++++------------------------ actions/delete.php | 6 +-- actions/download.php | 7 +--- actions/edit_multi.php | 58 +++++++++++++------------- actions/editalbum.php | 108 +++++++++++++++++++++++-------------------------- actions/icon.php | 13 ++---- actions/upload.php | 33 ++++++++++----- 7 files changed, 156 insertions(+), 169 deletions(-) diff --git a/actions/addalbum.php b/actions/addalbum.php index 127885270..f2d423abd 100644 --- a/actions/addalbum.php +++ b/actions/addalbum.php @@ -1,72 +1,66 @@ - * @copyright Curverider Ltd 2008 - * @link http://elgg.org/ */ // Make sure we're logged in (send us to the front page if not) - if (!isloggedin()) forward(); + if (!isloggedin()) forward(); // Get input data - $title = get_input('albumtitle'); - $body = get_input('albumbody'); - $tags = get_input('albumtags'); - $access = get_input('access_id'); - $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); - $back_url = 'pg/photos/new/' . get_entity($container_guid)->username; + $title = get_input('albumtitle'); + $body = get_input('albumbody'); + $tags = get_input('albumtags'); + $access = get_input('access_id'); + $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); + $back_url = 'pg/photos/new/' . get_entity($container_guid)->username; // Cache to the session - $_SESSION['albumtitle'] = $title; - $_SESSION['albumbody'] = $body; - $_SESSION['albumtags'] = $tags; + $_SESSION['albumtitle'] = $title; + $_SESSION['albumbody'] = $body; + $_SESSION['albumtags'] = $tags; // Convert string of tags into a preformatted array - $tagarray = string_to_tag_array($tags); + $tagarray = string_to_tag_array($tags); // Make sure the title / description aren't blank - if (empty($title) || empty($body)) { - register_error(elgg_echo("album:blank")); - forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page + if (empty($title) || empty($body)) { + register_error(elgg_echo("album:blank")); + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page - // Otherwise, save the blog post - } else { + // Otherwise, save the album + } else { - // Initialise a new ElggObject - $album = new ElggObject(); - // Tell the system it's an album - $album->subtype = "album"; + // Initialise a new ElggObject + $album = new ElggObject(); + // Tell the system it's an album + $album->subtype = "album"; - // Set its owner to the current user - $album->container_guid = $container_guid; - $album->owner_guid = $_SESSION['user']->getGUID(); - // For now, set its access to public (we'll add an access dropdown shortly) - $album->access_id = $access; - // Set its title and description appropriately - $album->title = $title; - $album->description = $body; - // Before we can set metadata, we need to save the blog post - if (!$album->save()) { - register_error(elgg_echo("album:error")); - forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page - } - // Now let's add tags. We can pass an array directly to the object property! Easy. - if (is_array($tagarray)) { - $album->tags = $tagarray; - } - // Success message - system_message(elgg_echo("album:created")); - // Remove the blog post cache - unset($_SESSION['albumtitle']); - unset($_SESSION['albumbody']); - unset($_SESSION['albumtags']); - // Forward to the main blog page - - forward("pg/photos/upload/" . $album->guid); - + // Set its owner to the current user + $album->container_guid = $container_guid; + $album->owner_guid = $_SESSION['user']->getGUID(); + // For now, set its access to public (we'll add an access dropdown shortly) + $album->access_id = $access; + // Set its title and description appropriately + $album->title = $title; + $album->description = $body; + // Before we can set metadata, we need to save the blog post + if (!$album->save()) { + register_error(elgg_echo("album:error")); + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page } + // Now let's add tags. We can pass an array directly to the object property! Easy. + if (is_array($tagarray)) { + $album->tags = $tagarray; + } + // Success message + system_message(elgg_echo("album:created")); + // Remove the album post cache + unset($_SESSION['albumtitle']); + unset($_SESSION['albumbody']); + unset($_SESSION['albumtags']); + + forward("pg/photos/upload/" . $album->guid); + } + ?> \ No newline at end of file diff --git a/actions/delete.php b/actions/delete.php index 6b8789fb4..e142e9660 100644 --- a/actions/delete.php +++ b/actions/delete.php @@ -1,12 +1,8 @@ $im){ + foreach($image_guid_array as $key => $im) { $image = get_entity($im); - if ($image->canEdit()){ + if ($image->canEdit()) { - // Convert string of tags into a preformatted array + // Convert string of tags into a preformatted array $tagarray = string_to_tag_array($tags_array[$key]); - //set description appropriately + //set description appropriately $image->title = $title_array[$key]; - //set description appropriately + //set description appropriately $image->description = $caption_array[$key]; - // Before we can set metadata, we need to save the image + // Before we can set metadata, we need to save the image if (!$image->save()) { array_push($not_updated, $image->guid); } - // Now let's add tags. We can pass an array directly to the object property! Easy. + // Now let's add tags. We can pass an array directly to the object property! Easy. $image->clearMetadata('tags'); if (is_array($tagarray)) { $image->tags = $tagarray; } - //if cover meta is sent from image save as metadata - if($cover == $im){ + //if cover meta is sent from image save as metadata + if ($cover == $im) { $album_entity->cover = $im; } } - } - // Success message - if (count($not_updated) > 0) { - register_error(elgg_echo("images:notedited")); - } else { - system_message(elgg_echo("images:edited")); - } + } + + // Success message + if (count($not_updated) > 0) { + register_error(elgg_echo("images:notedited")); + } else { + system_message(elgg_echo("images:edited")); + } - // Forward to the main album page - forward($album_entity->getURL()); - + // Forward to the main album page + forward($album_entity->getURL()); ?> \ No newline at end of file diff --git a/actions/editalbum.php b/actions/editalbum.php index 36b0f7379..78b1f1653 100644 --- a/actions/editalbum.php +++ b/actions/editalbum.php @@ -1,91 +1,85 @@ - * @copyright Curverider Ltd 2008 - * @link http://elgg.org/ */ // Make sure we're logged in (send us to the front page if not) - if (!isloggedin()) forward(); + if (!isloggedin()) forward(); // Get input data - $guid = (int) get_input('albumpost'); - $title = get_input('albumtitle'); - $body = get_input('albumbody'); - $access = get_input('access_id'); - $tags = get_input('albumtags'); - $back_url = 'mod/tidypics/edit.php?file_guid=' . $guid; + $guid = (int) get_input('albumpost'); + $title = get_input('albumtitle'); + $body = get_input('albumbody'); + $access = get_input('access_id'); + $tags = get_input('albumtags'); + $back_url = 'mod/tidypics/edit.php?file_guid=' . $guid; // Make sure we actually have permission to edit - $album = get_entity($guid); - if ($album->canEdit()) - { + $album = get_entity($guid); + if ($album->canEdit()) + { - // Cache to the session - $_SESSION['albumtitle'] = $title; - $_SESSION['albumbody'] = $body; - $_SESSION['albumtags'] = $tags; + // Cache to the session + $_SESSION['albumtitle'] = $title; + $_SESSION['albumbody'] = $body; + $_SESSION['albumtags'] = $tags; - // Convert string of tags into a preformatted array - $tagarray = string_to_tag_array($tags); + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags); - // Get owning user - $owner = get_entity($album->getOwner()); + // Get owning user + $owner = get_entity($album->getOwner()); - // edit access only if access is different from current - - if($album->access_id != $access) - { - $album->access_id = $access; + // edit access only if access is different from current + if ($album->access_id != $access) + { + $album->access_id = $access; - //get images from album and update access on image entities - $images = get_entities("object","image", $guid, '', 999, '', false); - foreach($images as $im){ - $im->access_id = $access; - $im->save(); - //new core updates all metadata access as well! - } + //get images from album and update access on image entities + $images = get_entities("object","image", $guid, '', 999, '', false); + foreach ($images as $im) { + $im->access_id = $access; + $im->save(); + //new core updates all metadata access as well! } + } // Set its title and description appropriately - $album->title = $title; - $album->description = $body; + $album->title = $title; + $album->description = $body; // Before we can set metadata, we need to save the image - if (!$album->save()) { - register_error(elgg_echo("album:error")); - $album->delete(); - forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page - } + if (!$album->save()) { + register_error(elgg_echo("album:error")); + $album->delete(); + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page + } // Now let's add tags. We can pass an array directly to the object property! Easy. - $album->clearMetadata('tags'); - if (is_array($tagarray)) { - $album->tags = $tagarray; - } + $album->clearMetadata('tags'); + if (is_array($tagarray)) { + $album->tags = $tagarray; + } //if cover meta is sent from image save as metadata - if(get_input('cover') == elgg_echo('album:cover:yes')){ - $container = get_entity($album->container_guid); - $container->cover = $album->guid; - } + if (get_input('cover') == elgg_echo('album:cover:yes')) { + $container = get_entity($album->container_guid); + $container->cover = $album->guid; + } // Success message - system_message(elgg_echo("album:edited")); + system_message(elgg_echo("album:edited")); // Remove the image cache - unset($_SESSION['albumtitle']); - unset($_SESSION['albumbody']); - unset($_SESSION['albumtags']); + unset($_SESSION['albumtitle']); + unset($_SESSION['albumbody']); + unset($_SESSION['albumtags']); // Forward to the main blog page - forward($album->getURL()); + forward($album->getURL()); - } + } ?> \ No newline at end of file diff --git a/actions/icon.php b/actions/icon.php index 718425819..bfc18198a 100644 --- a/actions/icon.php +++ b/actions/icon.php @@ -1,18 +1,13 @@ thumbnail; $mime = $file->mimetype; @@ -35,7 +30,7 @@ echo $contents; exit; - } - else + } else { register_error(elgg_echo("file:downloadfailed")); + } ?> \ No newline at end of file diff --git a/actions/upload.php b/actions/upload.php index f969f6f40..896cce8e7 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -17,12 +17,12 @@ $uploaded_images = array(); foreach($_FILES as $key => $sent_file) { - if(!empty($sent_file['name'])) { + if (!empty($sent_file['name'])) { $name = $_FILES[$key]['name']; $mime = $_FILES[$key]['type']; - //make sure file is an image - if($mime == 'image/jpeg' || $mime == 'image/gif' || $mime == 'image/png' || $mime == 'image/pjpeg') { + //make sure file is an image + if ($mime == 'image/jpeg' || $mime == 'image/gif' || $mime == 'image/png' || $mime == 'image/pjpeg') { //this will save to users folder in /image/ and organize by photo album $prefix = "image/" . $container_guid . "/"; $file = new ElggFile(); @@ -52,18 +52,27 @@ $maxfilesize = 10240; //if the file size limit is not set, default to 10MB } $maxfilesize = 1024 * $maxfilesize; //convert to bytes - + //check file size and remove picture if it exceeds the maximum if (filesize($file->getFilenameOnFilestore())<= $maxfilesize) { array_push($uploaded_images, $file->guid); - + // Generate thumbnail //TODO: REMOVE THE BELOW IF STATEMENT ONCE get_resized_image_from_existing_file() ACCEPTS IMAGES OVER 0.9MB IN SIZE if (filesize($file->getFilenameOnFilestore())<= 943718) { //create thumbnails if file size < 0.9MB - try {$thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); } catch (Exception $e) { $thumblarge = false; } - try {$thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); } catch (Exception $e) { $thumbsmall = false; } - try {$thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); } catch (Exception $e) { $thumbnail = false; } + try { + $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); + } catch (Exception $e) { $thumblarge = false; } + + try { + $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); + } catch (Exception $e) { $thumbsmall = false; } + + try { + $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); + } catch (Exception $e) { $thumbnail = false; } } + if ($thumbnail) { $thumb = new ElggFile(); $thumb->setMimeType($mime); @@ -76,6 +85,7 @@ } $thumb->close(); } + if ($thumbsmall) { $thumb = new ElggFile(); $thumb->setMimeType($mime); @@ -88,6 +98,7 @@ } $thumb->close(); } + if ($thumblarge) { $thumb = new ElggFile(); $thumb->setMimeType($mime); @@ -107,11 +118,11 @@ } else { //file was not saved for some unknown reason array_push($not_uploaded, $name); } //end of file saved check and thumbnail creation - } else { // file is not a supported image type + } else { // file is not a supported image type array_push($not_uploaded, $name); - } //end of mimetype block + } //end of mimetype block } //end of file name empty check - } //end of loop + } //end of for loop if (count($not_uploaded) == 0) { system_message(elgg_echo("images:saved")); -- cgit v1.2.3 From 3b5ce30c7f4c2158f26c8ebb7e7bef3e19ece9e9 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 18:50:27 +0000 Subject: added river integration for 1.5 - did not add update album or create/update image --- actions/addalbum.php | 10 ++++++++-- languages/en.php | 6 +++--- views/default/river/object/album/create.php | 15 ++++++++++++--- views/default/tidypics/css.php | 9 +++++++++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/actions/addalbum.php b/actions/addalbum.php index f2d423abd..23fdfd22d 100644 --- a/actions/addalbum.php +++ b/actions/addalbum.php @@ -38,12 +38,12 @@ // Set its owner to the current user $album->container_guid = $container_guid; $album->owner_guid = $_SESSION['user']->getGUID(); - // For now, set its access to public (we'll add an access dropdown shortly) $album->access_id = $access; // Set its title and description appropriately $album->title = $title; $album->description = $body; - // Before we can set metadata, we need to save the blog post + + // Before we can set metadata, we need to save the album if (!$album->save()) { register_error(elgg_echo("album:error")); forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page @@ -53,8 +53,14 @@ if (is_array($tagarray)) { $album->tags = $tagarray; } + + // add to river (check to make sure we're running > Elgg 1.5 first) + if (function_exists('add_to_river')) + add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid); + // Success message system_message(elgg_echo("album:created")); + // Remove the album post cache unset($_SESSION['albumtitle']); unset($_SESSION['albumbody']); diff --git a/languages/en.php b/languages/en.php index 7e8d67f39..90c2c8b5a 100644 --- a/languages/en.php +++ b/languages/en.php @@ -67,12 +67,12 @@ //images 'image:river:created' => "%s uploaded", 'image:river:item' => "an image", - 'image:river:annotate' => "%s commented on", + 'image:river:annotate' => "a comment on the image", //albums - 'album:river:created' => "%s created", + 'album:river:created' => "%s created a new photo album: ", 'album:river:item' => "an album", - 'album:river:annotate' => "%s commented on", + 'album:river:annotate' => "a comment on the photo album", // Status messages diff --git a/views/default/river/object/album/create.php b/views/default/river/object/album/create.php index 68553309c..fcc87277d 100644 --- a/views/default/river/object/album/create.php +++ b/views/default/river/object/album/create.php @@ -1,13 +1,22 @@ subject_guid); + $album = get_entity($vars['item']->object_guid); + + $url = "getURL()}\">{$performed_by->name}"; + $string = sprintf(elgg_echo("album:river:created"),$url) . " "; + $string .= "getURL() . "\">" . $album->title . ""; +} else { // Elgg 1.2 $statement = $vars['statement']; $performed_by = $statement->getSubject(); $object = $statement->getObject(); - + $url = "getURL()}\">{$performed_by->name}"; $string = sprintf(elgg_echo("album:river:created"),$url) . " "; - $string .= "getURL() . "\">" . elgg_echo("album:river:item") . ""; + $string .= "getURL() . "\">" . $object->title . ""; +} - echo $string; +echo $string; ?> \ No newline at end of file diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php index a682ff677..c1957d5d9 100644 --- a/views/default/tidypics/css.php +++ b/views/default/tidypics/css.php @@ -121,6 +121,15 @@ .river_album_create { background: url(mod/tidypics/graphics/icons/river_icon_album.gif) no-repeat left -1px; } +.river_object_album_create { + background: url(mod/tidypics/graphics/icons/river_icon_album.gif) no-repeat left -1px; +} +.river_object_image_comment { + background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +} +.river_object_album_comment { + background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +} .pagination { clear:both !important; -- cgit v1.2.3 From 744f81dbf2ad98e61dddba8fa21cf74ee7c60989 Mon Sep 17 00:00:00 2001 From: alfalive Date: Sun, 22 Mar 2009 18:36:14 +0000 Subject: FIXED problem for german letters umlaute äöü and ÄÖÜ Importand! (File is stored in UTF-8 Without BOM) by alfalive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/de.php | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/languages/de.php b/languages/de.php index 2d668f72f..5a2d57df5 100644 --- a/languages/de.php +++ b/languages/de.php @@ -5,6 +5,8 @@ * @author Curverider Ltd * @copyright Curverider Ltd 2008 * @link http://elgg.com/ + * + * FIXED problem for german letters umlaute äöü and ÄÖÜ Importand! (File is stored in UTF-8 Without BOM) */ $german = array( @@ -26,37 +28,37 @@ 'album:group' => "Alben der Gruppe", 'item:object:image' => "Photos", 'item:object:album' => "Alben", - 'tidypics:settings:maxfilesize' => "Maximale Dateigre in den Kilobytes (KB):", + 'tidypics:settings:maxfilesize' => "Maximale Dateigröße in den Kilobytes (KB):", //actions 'album:create' => "Neues Album", - 'album:add' => "Fotoalbum hinzufügen", - 'album:addpix' => "Fotos hinzufügen", + 'album:add' => "Fotoalbum hinzufügen", + 'album:addpix' => "Fotos hinzufügen", 'album:edit' => "Album bearbeiten", - 'album:delete' => "Album löschen", + 'album:delete' => "Album löschen", 'image:edit' => "Bild bearbeiten", - 'image:delete' => "Bild löschen", + 'image:delete' => "Bild löschen", 'image:download' => "Download Bild", //forms 'album:title' => "Titel", 'album:desc' => "Beschreibung", - 'album:tags' => "Stichwörter", + 'album:tags' => "Stichwörter", 'album:cover' => "Albumcover erstellen?", 'album:cover:yes' => "Ja", - 'image:access:note' => "(Zugriffsberechtigung wird vom Album übernommen)", + 'image:access:note' => "(Zugriffsberechtigung wird vom Album übernommen)", //views 'image:total' => "Bilder im Album:", - 'image:by' => "Bild hinzugefügt von", + 'image:by' => "Bild hinzugefügt von", 'album:by' => "Album erstellt von:", 'album:created:on' => "Verursacht", - 'image:none' => "Noch keine Bilder hinzugefügt.", - 'image:back' => "Zurück", + 'image:none' => "Noch keine Bilder hinzugefügt.", + 'image:back' => "Zurück", 'image:next' => "Weiter", //widgets @@ -83,30 +85,30 @@ 'image:saved' => "Dein Bild wurde gespeichert.", 'images:saved' => "Alle Bilder wurden gespeichert.", - 'image:deleted' => "Dein Bild wurde gelöscht.", - 'image:delete:confirm' => "Willst Du das Bild wirklich löschen?", + 'image:deleted' => "Dein Bild wurde gelöscht.", + 'image:delete:confirm' => "Willst Du das Bild wirklich löschen?", 'images:edited' => "Dein Bild wurde aktualisiert.", 'album:edited' => "Dein Album wurde aktualisiert.", 'album:saved' => "Dein Album wurde gespeichert.", - 'album:deleted' => "Dein Album wurde gelöscht.", - 'album:delete:confirm' => "Willst Du das Album wirklich löschen?", + 'album:deleted' => "Dein Album wurde gelöscht.", + 'album:delete:confirm' => "Willst Du das Album wirklich löschen?", 'album:created' => "Ihr neues Album ist hergestellt worden.", - 'tidypics:status:processing' => "Warten Sie bitte, whrend wir verarbeiten Ihre Abbildung....", + 'tidypics:status:processing' => "Warten Sie bitte, während wir verarbeiten Ihre Abbildung....", //Error messages 'image:none' => "Kein Bilder gefunden.", 'image:uploadfailed' => "Dateien konnten nicht hochgeladen werden:", - 'image:deletefailed' => "Bild konnte nicht gelöscht werden.", + 'image:deletefailed' => "Bild konnte nicht gelöscht werden.", 'image:downloadfailed' => "Dieses Bild ist nicht diesmal vorhanden.", - 'image:notimage' => 'Wir akzeptieren nur jpeg, gif, und png Dateien der erlaubten Dateigre an.', + 'image:notimage' => 'Wir akzeptieren nur jpeg, gif, und png Dateien der erlaubten Dateigröße an.', 'images:notedited' => 'Nicht alle Bilder konnten hochgeladen werden', 'album:none' => "Keine Alben gefunden.", 'album:uploadfailed' => "Sorry; Dein Album konnte nicht gespeichert werden.", - 'album:deletefailed' => "Dein Album konnte nicht gelöscht werden.", + 'album:deletefailed' => "Dein Album konnte nicht gelöscht werden.", 'album:blank' => "Geben Sie diesem Album einen Titel und eine Beschreibung bitte." ); -- cgit v1.2.3 From 1cfccdbc80a77a8c8713684758b24cd4c06ea136 Mon Sep 17 00:00:00 2001 From: alfalive Date: Wed, 25 Mar 2009 09:39:09 +0000 Subject: Some improvements for better understanding. v1.3 --- languages/de.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/languages/de.php b/languages/de.php index 5a2d57df5..08ba226cc 100644 --- a/languages/de.php +++ b/languages/de.php @@ -1,12 +1,13 @@ "Alben der Gruppe", 'item:object:image' => "Photos", 'item:object:album' => "Alben", - 'tidypics:settings:maxfilesize' => "Maximale Dateigröße in den Kilobytes (KB):", + 'tidypics:settings:maxfilesize' => "Maximale Dateigröße in Kilobytes (KB):", //actions @@ -40,7 +41,7 @@ 'image:edit' => "Bild bearbeiten", 'image:delete' => "Bild löschen", - 'image:download' => "Download Bild", + 'image:download' => "Bild herunterladen", //forms @@ -49,14 +50,14 @@ 'album:tags' => "Stichwörter", 'album:cover' => "Albumcover erstellen?", 'album:cover:yes' => "Ja", - 'image:access:note' => "(Zugriffsberechtigung wird vom Album übernommen)", + 'image:access:note' => "Info: Zugriffsberechtigung wird vom Album übernommen", //views 'image:total' => "Bilder im Album:", 'image:by' => "Bild hinzugefügt von", 'album:by' => "Album erstellt von:", - 'album:created:on' => "Verursacht", + 'album:created:on' => "Erstellt", 'image:none' => "Noch keine Bilder hinzugefügt.", 'image:back' => "Zurück", 'image:next' => "Weiter", @@ -86,13 +87,13 @@ 'image:saved' => "Dein Bild wurde gespeichert.", 'images:saved' => "Alle Bilder wurden gespeichert.", 'image:deleted' => "Dein Bild wurde gelöscht.", - 'image:delete:confirm' => "Willst Du das Bild wirklich löschen?", + 'image:delete:confirm' => "Willst du das Bild wirklich löschen?", 'images:edited' => "Dein Bild wurde aktualisiert.", 'album:edited' => "Dein Album wurde aktualisiert.", 'album:saved' => "Dein Album wurde gespeichert.", 'album:deleted' => "Dein Album wurde gelöscht.", - 'album:delete:confirm' => "Willst Du das Album wirklich löschen?", + 'album:delete:confirm' => "Willst du das Album wirklich löschen?", 'album:created' => "Ihr neues Album ist hergestellt worden.", 'tidypics:status:processing' => "Warten Sie bitte, während wir verarbeiten Ihre Abbildung....", @@ -107,9 +108,9 @@ 'images:notedited' => 'Nicht alle Bilder konnten hochgeladen werden', 'album:none' => "Keine Alben gefunden.", - 'album:uploadfailed' => "Sorry; Dein Album konnte nicht gespeichert werden.", + 'album:uploadfailed' => "Dein Album konnte nicht gespeichert werden.", 'album:deletefailed' => "Dein Album konnte nicht gelöscht werden.", - 'album:blank' => "Geben Sie diesem Album einen Titel und eine Beschreibung bitte." + 'album:blank' => "Gib diesem Album einen Titel und eine Beschreibung bitte." ); add_translation("de",$german); -- cgit v1.2.3 From ae5398025febddb796cefeff8075f520de42f00a Mon Sep 17 00:00:00 2001 From: alfalive Date: Wed, 25 Mar 2009 11:08:23 +0000 Subject: Issue 8: Fixed. Language Files updated --- edit_multi.php | 5 ++--- languages/de.php | 4 +++- languages/es.php | 4 +++- languages/pl.php | 2 ++ views/default/tidypics/forms/edit_multi.php | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/edit_multi.php b/edit_multi.php index dd58759fe..161822769 100644 --- a/edit_multi.php +++ b/edit_multi.php @@ -29,9 +29,8 @@ } } - - $title = elgg_echo('tidypics:editprops'); - $area2 .= elgg_view_title($title); + + $area2 .= elgg_view_title(elgg_echo('tidypics:editprops')); $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid)); $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); page_draw($title, $body); diff --git a/languages/de.php b/languages/de.php index 08ba226cc..ace7dcd6c 100644 --- a/languages/de.php +++ b/languages/de.php @@ -2,7 +2,7 @@ /** * Elgg tidypics plugin german language pack * - * @version 1.3 (Changes in this version: Improvements for better understanding) + * @version 1.2 * @author Modified and fixed by Dieter Konrad aka alfalive * @contact http://community.elgg.org/pg/profile/alfalive * @copyright Curverider Ltd 2008 @@ -30,6 +30,8 @@ 'item:object:image' => "Photos", 'item:object:album' => "Alben", 'tidypics:settings:maxfilesize' => "Maximale Dateigröße in Kilobytes (KB):", + + 'tidypics:editprops' => "Bildeigenschaften Bearbeiten", //actions diff --git a/languages/es.php b/languages/es.php index babb87068..11a787ae4 100644 --- a/languages/es.php +++ b/languages/es.php @@ -28,7 +28,9 @@ 'item:object:image' => "Fotos", 'item:object:album' => "Állbums", 'tidypics:settings:maxfilesize' => "Tamaño máximo en kilo bytes (KB):", - + + 'tidypics:editprops' => "Editar propiedades de imagen", + //actions 'album:create' => "Nuevo álbum", diff --git a/languages/pl.php b/languages/pl.php index 047b17220..280e3f859 100644 --- a/languages/pl.php +++ b/languages/pl.php @@ -28,6 +28,8 @@ 'item:object:image' => "Zdjęcia", 'item:object:album' => "Albumy", 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):", + + 'tidypics:editprops' => 'Edycja obrazu Właściwości', //actions diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php index ebd2ef11a..8b239b12e 100644 --- a/views/default/tidypics/forms/edit_multi.php +++ b/views/default/tidypics/forms/edit_multi.php @@ -33,7 +33,7 @@ echo '

'; echo '' . "\n"; echo ''; - echo elgg_view("input/multi_radio", array( "internalname" => "cover", "value" => $guid, 'options' => array('yes'), 'set' => $cover)); + echo elgg_view("input/multi_radio", array( "internalname" => "cover", "value" => $guid, 'options' => array(elgg_echo('album:cover:yes')), 'set' => $cover)); echo '
'; echo ''; -- cgit v1.2.3 From 8c059e6c1413d82b556aa54de3fc9c2ed6a0e01b Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 27 Mar 2009 11:10:40 +0000 Subject: fix for previous --- edit_multi.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/edit_multi.php b/edit_multi.php index 161822769..5b78e6691 100644 --- a/edit_multi.php +++ b/edit_multi.php @@ -30,8 +30,9 @@ } } - $area2 .= elgg_view_title(elgg_echo('tidypics:editprops')); - $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid)); + $title = elgg_echo('tidypics:editprops'); + $area2 .= elgg_view_title($title); + $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid)); $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); page_draw($title, $body); ?> \ No newline at end of file -- cgit v1.2.3 From 43b593441635366a0cc4ebc530a9d5ec43facc8f Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 27 Mar 2009 11:24:37 +0000 Subject: This will be 1.5 version --- contributions.txt | 11 ++++++++--- manifest.xml | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/contributions.txt b/contributions.txt index 65dd95c5a..0097069eb 100644 --- a/contributions.txt +++ b/contributions.txt @@ -11,17 +11,22 @@ See individual change logs for contributors to those builds ------------------------------------------------------------------------ -Version 1.09 Change List +Version 1.5 Change List Release Date: ??/??/2009 Contributors: * Gabriel Monge-Franco (http://gabriel.mongefranco.com) * Cash Costello + * alfalive (http://community.elgg.org/pg/profile/alfalive) ------------------------------------------------------------------------ -BEGIN VERSION 1.09 CHANGES +BEGIN VERSION 1.5 CHANGES ------------------------------------------------------------------------ * Fixed submenus on sidebar of album pages +* Fixed display issues for Elgg 1.5 +* Using default site access now +* Pushing new album creation to river +* Fixed German language file ------------------------------------------------------------------------ -END VERSION 1.09 CHANGES +END VERSION 1.5 CHANGES ------------------------------------------------------------------------ diff --git a/manifest.xml b/manifest.xml index 2cdfa8579..4778c13c6 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,7 +1,7 @@ - + -- cgit v1.2.3 From 569d4dce1dc656b90b5c5ac193785570c75dcecf Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 27 Mar 2009 11:43:18 +0000 Subject: not displaying readonly access levels on individual albums anymore (I think it was ugly) --- views/default/tidypics/forms/edit.php | 5 ----- views/default/tidypics/forms/edit_multi.php | 1 - views/default/tidypics/forms/upload.php | 3 --- 3 files changed, 9 deletions(-) diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php index bef87c64b..08fe5cc81 100644 --- a/views/default/tidypics/forms/edit.php +++ b/views/default/tidypics/forms/edit.php @@ -90,11 +90,6 @@ "cover", "value" => $cover, 'options' => array(elgg_echo('album:cover:yes')))); ?>

-

- - 'access_id','value' => $access_id)); ?> -

- '; } - echo elgg_echo('image:access:note'); ?>

diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php index be87c8697..8cc9af897 100644 --- a/views/default/tidypics/forms/upload.php +++ b/views/default/tidypics/forms/upload.php @@ -57,9 +57,6 @@ function showhide(layer_ref) {

- - 'access_id','value' => $access_id)); ?> -

Date: Fri, 27 Mar 2009 12:00:43 +0000 Subject: can now enable/disable photo albums for groups --- languages/en.php | 2 +- start.php | 9 ++++++--- views/default/tidypics/groupprofile_albums.php | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/languages/en.php b/languages/en.php index 90c2c8b5a..0ba223a8c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -20,7 +20,7 @@ 'item:object:image' => "Photos", 'item:object:album' => "Albums", 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):", - + 'tidypics:enablephotos' => 'Enable Group Photo Albums', 'tidypics:editprops' => 'Edit Image Properties', //actions diff --git a/start.php b/start.php index a0162319c..660e20de5 100644 --- a/start.php +++ b/start.php @@ -40,6 +40,7 @@ register_entity_type('object','image'); register_entity_type('object','album'); + add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true); } /** @@ -94,9 +95,11 @@ } if (isloggedin() && ($page_owner instanceof ElggGroup)) { - add_submenu_item(sprintf(elgg_echo("album:user"),$page_owner->name), - $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, - 'photo_albums'); + if ($page_owner->photos_enable != "no") { + add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, + 'photo_albums'); + } } } diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php index ea11006fa..ff63a38d1 100644 --- a/views/default/tidypics/groupprofile_albums.php +++ b/views/default/tidypics/groupprofile_albums.php @@ -1,4 +1,7 @@ photos_enable != 'no') { + //the number of files to display $number = (int) $vars['entity']->num_display; //if no number has been set, default to 5 @@ -57,4 +60,5 @@ } //close group_albums_widget div echo ""; +} ?> \ No newline at end of file -- cgit v1.2.3 From d17f91a236cd3008aa888736db894b1e898e91d5 Mon Sep 17 00:00:00 2001 From: alfalive Date: Fri, 27 Mar 2009 21:48:27 +0000 Subject: Added: string 'tidypics:enablephotos' => "Erlaube Gruppen-Galerie", --- languages/de.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/de.php b/languages/de.php index ace7dcd6c..c92bf7c0e 100644 --- a/languages/de.php +++ b/languages/de.php @@ -30,7 +30,7 @@ 'item:object:image' => "Photos", 'item:object:album' => "Alben", 'tidypics:settings:maxfilesize' => "Maximale Dateigröße in Kilobytes (KB):", - + 'tidypics:enablephotos' => "Erlaube Gruppen-Galerie", 'tidypics:editprops' => "Bildeigenschaften Bearbeiten", //actions -- cgit v1.2.3 From 4e5bdc632ed8d27d42b4213cdb654e759255c1a1 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 02:31:16 +0000 Subject: major cleanup of view album --- viewalbum.php | 50 +++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/viewalbum.php b/viewalbum.php index 2a5999379..092ad76a8 100644 --- a/viewalbum.php +++ b/viewalbum.php @@ -6,38 +6,26 @@ include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - // Get the GUID of the entity we want to view - $guid = (int) get_input('guid'); - - $context = get_input('context'); - if ($context) set_context($context); - - // Get the entity, if possible - if ($entity = get_entity($guid)) { - - if ($entity->container_guid) { - set_page_owner($entity->container_guid); - } else { - set_page_owner($entity->owner_guid); - } - - // Set the body to be the full view of the entity, and the title to be its title - if ($entity instanceof ElggObject) { - $title = $entity->title; - } else if ($entity instanceof ElggEntity) { - $title = $entity->name; - } - - $area2 = elgg_view_title($title); - - $area2 .= elgg_view_entity($entity, true); - - // Otherwise? - } else { - } - + // get the album entity + $album_guid = (int) get_input('guid'); + $album = get_entity($album_guid); + + // panic if we can't get it + if (!$album) forward(); + + // container should always be set, but just in case + if ($album->container_guid) + set_page_owner($album->container_guid); + else + set_page_owner($album->owner_guid); + + $owner = page_owner_entity(); + + // set title and body + $title = $album->title; + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity($album, true); $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - // Display the page page_draw($title, $body); ?> \ No newline at end of file -- cgit v1.2.3 From 8275ddfe8ebe821f1062f280696d475940461ba9 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 02:34:37 +0000 Subject: starting to work on group menus - what a mess --- start.php | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/start.php b/start.php index 660e20de5..16923787e 100644 --- a/start.php +++ b/start.php @@ -20,7 +20,7 @@ // Extend CSS extend_view('css', 'tidypics/css'); - // Extend hover-over and profile menu + // Extend hover-over and profile menu extend_view('profile/menu/links','tidypics/menu'); //group view ** psuedo widget view for group pages** @@ -52,8 +52,14 @@ $page_owner = page_owner_entity(); + if ($page_owner instanceof ElggGroup) { + if ($page_owner->photos_enable != "no") { + add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); + } + } // context is only set to photos on individual pages, not on group pages - if (get_context() == "photos") { + else if (get_context() == "photos") { // owner gets "your albumn", "your friends albums" if (get_loggedin_userid() == $page_owner->guid && get_loggedin_userid()) { @@ -67,7 +73,7 @@ add_submenu_item( elgg_echo('album:yours:friends'), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, - 'tidypics'); + 'tidypics'); } else if (isloggedin()) { // logged nut not owner gets "your albums", "page owners albums", "page owner's friends albums" add_submenu_item( elgg_echo("album:yours"), @@ -75,32 +81,25 @@ 'tidypics' ); add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name), $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, - 'tidypics' ); + 'tidypics' ); add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, - 'tidypics'); + 'tidypics'); } else if ($page_owner->guid) { // non logged in user gets "page owners albums", "page owner's friends albums" add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name), $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, - 'tidypics' ); + 'tidypics' ); add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username, - 'tidypics'); + 'tidypics'); } add_submenu_item( sprintf(elgg_echo('album:all'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/world/", - 'tidypics'); + 'tidypics'); } - if (isloggedin() && ($page_owner instanceof ElggGroup)) { - if ($page_owner->photos_enable != "no") { - add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), - $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username, - 'photo_albums'); - } - } } /** @@ -116,27 +115,27 @@ { switch($page[0]) { - case "owned": //view list of albums owned by container - if (isset($page[1])) set_input('username',$page[1]); - include($CONFIG->pluginspath . "tidypics/index.php"); + case "owned": //view list of albums owned by container + if (isset($page[1])) set_input('username',$page[1]); + include($CONFIG->pluginspath . "tidypics/index.php"); break; - case "view": //view an image individually + case "view": //view an image individually set_input('guid',$page[1]); - include($CONFIG->pluginspath . "tidypics/viewimage.php"); + include($CONFIG->pluginspath . "tidypics/viewimage.php"); break; - case "album": //view an album individually + case "album": //view an album individually set_input('guid',$page[1]); include($CONFIG->pluginspath . "tidypics/viewalbum.php"); break; - case "new": //create new album + case "new": //create new album if (isset($page[1])) set_input('username',$page[1]); include($CONFIG->pluginspath . "tidypics/newalbum.php"); break; - case "upload": //upload images to album + case "upload": //upload images to album if (isset($page[1])) set_input('container_guid',$page[1]); include($CONFIG->pluginspath . "tidypics/upload.php"); break; @@ -167,14 +166,14 @@ * @param ElggEntity $entity album/image entity * @return string File URL */ - function image_url($entity) { + function image_url($entity) { global $CONFIG; $title = $entity->title; $title = friendly_title($title); return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title; } - function album_url($entity) { + function album_url($entity) { global $CONFIG; $title = $entity->title; $title = friendly_title($title); -- cgit v1.2.3 From 09619e09ed4544a0529231bfc8dd81ec719f2810 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:01:00 +0000 Subject: moved edit and delete to page handler - need to update links --- actions/delete.php | 4 ++-- edit.php | 30 +++++++++++++++------------ start.php | 59 +++++++++++++++++++++++++++++++----------------------- viewalbum.php | 17 ++++++++++++++++ 4 files changed, 70 insertions(+), 40 deletions(-) diff --git a/actions/delete.php b/actions/delete.php index e142e9660..5c275003e 100644 --- a/actions/delete.php +++ b/actions/delete.php @@ -8,8 +8,8 @@ //if not logged in, see world pictures instead if (!isloggedin()) forward('pg/photos/world'); - $guid = (int) get_input('file'); - $forward_url = 'pg/photos/world'; //forward to world pictures if there is an unknown error + $guid = (int) get_input('guid'); + $forward_url = 'pg/photos/world'; //forward to world pictures if there is an unknown error if ($photoObject = get_entity($guid)) { if ($photoObject->canEdit()) { diff --git a/edit.php b/edit.php index 3e597cf05..b84d74724 100644 --- a/edit.php +++ b/edit.php @@ -1,39 +1,43 @@ canEdit()) + if (!$entity->canEdit()) forward(); - $subtype = $file->getSubtype(); + $subtype = $entity->getSubtype(); if ($subtype == 'album') { - if($container = $file->container_guid) - set_page_owner($container); - $title = elgg_echo('album:edit'); + + if ($container = $entity->container_guid) + set_page_owner($container); + } else if ($subtype == 'image') { - if ($container = get_entity($file->container_guid)->container_guid) - set_page_owner($container); - $title = elgg_echo('image:edit'); + + if ($container = get_entity($entity->container_guid)->container_guid) + set_page_owner($container); + } else { forward(); } $area2 .= elgg_view_title($title); - $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $file, 'subtype' => $subtype)); + $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype)); $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + page_draw($title, $body); ?> \ No newline at end of file diff --git a/start.php b/start.php index 16923787e..798becce4 100644 --- a/start.php +++ b/start.php @@ -113,48 +113,57 @@ if (isset($page[0])) { - switch($page[0]) - { + switch($page[0]) + { case "owned": //view list of albums owned by container if (isset($page[1])) set_input('username',$page[1]); include($CONFIG->pluginspath . "tidypics/index.php"); - break; - - case "view": //view an image individually - set_input('guid',$page[1]); + break; + + case "view": //view an image individually + if (isset($page[1])) set_input('guid',$page[1]); include($CONFIG->pluginspath . "tidypics/viewimage.php"); break; case "album": //view an album individually - set_input('guid',$page[1]); + if (isset($page[1])) set_input('guid',$page[1]); include($CONFIG->pluginspath . "tidypics/viewalbum.php"); break; case "new": //create new album if (isset($page[1])) set_input('username',$page[1]); - include($CONFIG->pluginspath . "tidypics/newalbum.php"); - break; - - case "upload": //upload images to album + include($CONFIG->pluginspath . "tidypics/newalbum.php"); + break; + + case "upload": //upload images to album if (isset($page[1])) set_input('container_guid',$page[1]); - include($CONFIG->pluginspath . "tidypics/upload.php"); - break; - - case "friends": + include($CONFIG->pluginspath . "tidypics/upload.php"); + break; + + case "edit": //edit image or album + if (isset($page[1])) set_input('guid',$page[1]); + include($CONFIG->pluginspath . "tidypics/edit.php"); + break; + + case "delete": //edit image or album + if (isset($page[1])) set_input('guid',$page[1]); + include($CONFIG->pluginspath . "tidypics/actions/delete.php"); + break; + + case "friends": if (isset($page[1])) set_input('username',$page[1]); - include($CONFIG->pluginspath . "tidypics/friends.php"); - break; - - case "world": - include($CONFIG->pluginspath . "tidypics/world.php"); - break; - - } + include($CONFIG->pluginspath . "tidypics/friends.php"); + break; + + case "world": + include($CONFIG->pluginspath . "tidypics/world.php"); + break; + + } } else { - // Include the standard profile index - if (isset($page[1])) set_input('username',$page[1]); + // going to the index because something is wrong with the page handler include($CONFIG->pluginspath . "tidypics/index.php"); } diff --git a/viewalbum.php b/viewalbum.php index 092ad76a8..d80a3d8e6 100644 --- a/viewalbum.php +++ b/viewalbum.php @@ -21,6 +21,23 @@ $owner = page_owner_entity(); + // setup group menu + if ($owner instanceof ElggGroup) { + add_submenu_item( elgg_echo('album:create'), + $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, + 'tidypics'); + add_submenu_item( elgg_echo('album:addpix'), + $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid, + 'tidypics'); + add_submenu_item( elgg_echo('album:edit'), + $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid, + 'tidypics'); + add_submenu_item( elgg_echo('album:delete'), + $CONFIG->wwwroot . 'pg/photos/delete/' . $album_guid, + 'tidypics', + true); + } + // set title and body $title = $album->title; $area2 = elgg_view_title($title); -- cgit v1.2.3 From c7b327cf230a19358e6bc78b9782627839f2d9f7 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:07:41 +0000 Subject: better menus for view album for both group and individuals --- viewalbum.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/viewalbum.php b/viewalbum.php index d80a3d8e6..c216273cd 100644 --- a/viewalbum.php +++ b/viewalbum.php @@ -25,19 +25,20 @@ if ($owner instanceof ElggGroup) { add_submenu_item( elgg_echo('album:create'), $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, - 'tidypics'); - add_submenu_item( elgg_echo('album:addpix'), - $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid, - 'tidypics'); - add_submenu_item( elgg_echo('album:edit'), - $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid, - 'tidypics'); - add_submenu_item( elgg_echo('album:delete'), - $CONFIG->wwwroot . 'pg/photos/delete/' . $album_guid, - 'tidypics', - true); + 'photos'); } + add_submenu_item( elgg_echo('album:addpix'), + $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid, + 'photos'); + add_submenu_item( elgg_echo('album:edit'), + $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid, + 'photos'); + add_submenu_item( elgg_echo('album:delete'), + $CONFIG->wwwroot . 'pg/photos/delete/' . $album_guid, + 'photos', + true); + // set title and body $title = $album->title; $area2 = elgg_view_title($title); -- cgit v1.2.3 From e0eebd803e76bae0d7aa6456427667c90b4e2368 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:11:11 +0000 Subject: better english string for add photos --- languages/en.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/en.php b/languages/en.php index 0ba223a8c..e076ee8de 100644 --- a/languages/en.php +++ b/languages/en.php @@ -27,8 +27,8 @@ 'album:create' => "Create new album", 'album:add' => "Add Photo Album", - 'album:addpix' => "Add photos to", - 'album:edit' => "Edit album", + 'album:addpix' => "Add photos to album", + 'album:edit' => "Edit album", 'album:delete' => "Delete album", 'image:edit' => "Edit image", -- cgit v1.2.3 From 5107faa7e96efd940ce28da9f46508298759c189 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:34:25 +0000 Subject: --- viewimage.php | 53 +++++++++++++------------- views/default/object/album.php | 17 --------- views/default/object/image.php | 13 +------ views/default/tidypics/css.php | 29 ++++++++++++++ views/default/tidypics/groupprofile_albums.php | 10 ++--- 5 files changed, 62 insertions(+), 60 deletions(-) diff --git a/viewimage.php b/viewimage.php index 85e8d8215..8231bef3d 100644 --- a/viewimage.php +++ b/viewimage.php @@ -9,34 +9,35 @@ // Load Elgg engine include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - // Get the GUID of the entity we want to view - $guid = (int) get_input('guid'); - - $context = get_input('context'); - if ($context) set_context($context); - - // Get the entity, if possible - if ($entity = get_entity($guid)) { - - //set "real" container - image container is the album , group/user is the album container - $top_container = get_entity($entity->container_guid)->container_guid; - - if ($top_container) { - set_page_owner($top_container); - } else { - set_page_owner($entity->owner_guid); - } - - $title = $entity->title; - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity($entity, true); - - } else { - $body = elgg_echo('notfound'); + // get the album entity + $photo_guid = (int) get_input('guid'); + $photo = get_entity($photo_guid); + + // panic if we can't get it + if (!$photo) forward(); + + // container of photo should always be set, but just in case + set_page_owner($photo->owner_guid); + $album = get_entity($photo->container_guid); + if ($album) { + $owner_guid = $album->container_guid; + if ($owner_guid) + set_page_owner($owner_guid); } - + + add_submenu_item( elgg_echo('image:edit'), + $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid, + 'photos'); + add_submenu_item( elgg_echo('image:delete'), + $CONFIG->wwwroot . 'pg/photos/delete/' . $photo_guid, + 'photos', + true); + + $title = $photo->title; + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity($photo, true); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - // Display the page page_draw($title, $body); ?> \ No newline at end of file diff --git a/views/default/object/album.php b/views/default/object/album.php index a1b238812..a94f12590 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -63,23 +63,6 @@ '.autop($desc).''; - if ($file->canEdit()) { // add controls - -?> -

- "> -   - - $vars['url'] . "action/tidypics/delete?file=" . $file->getGUID(), - 'text' => elgg_echo("album:delete"), - 'confirm' => elgg_echo("album:delete:confirm"), - )); - ?> -
-'; ?>
-   -canEdit()) { // add edit controls -?> -   - $vars['url'] . "action/tidypics/delete?file=" . $file->getGUID(), - 'text' => elgg_echo("image:delete"), - 'confirm' => elgg_echo("image:delete:confirm"), - )); - } - ?> +

diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php index c1957d5d9..3c935e8c5 100644 --- a/views/default/tidypics/css.php +++ b/views/default/tidypics/css.php @@ -27,6 +27,35 @@ margin:10px; } +#group_albums_widget { +-webkit-border-radius: 8px; +-moz-border-radius: 8px; +background:white none repeat scroll 0 0; +margin:0 0 20px; +padding:0 0 5px; +} + +.tidypics_download a { + font: 12px/100% Arial, Helvetica, sans-serif; + font-weight: bold; + color: white; + background:#4690d6; + border:none; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + width: auto; + height: 25px; + padding: 3px 6px 3px 6px; + margin:10px 0 10px 0; + cursor: pointer; +} +.tidypics_download a:hover { + background: black; + color:white; + text-decoration: none; +} + + /* independent album view only */ .album_images{ diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php index ff63a38d1..d975f5f99 100644 --- a/views/default/tidypics/groupprofile_albums.php +++ b/views/default/tidypics/groupprofile_albums.php @@ -11,7 +11,7 @@ if ($vars['entity']->photos_enable != 'no') { $owner = page_owner_entity(); $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false); - echo '
'; + echo '
'; echo '

' . elgg_echo('albums') . '

'; if ($owner_albums) { @@ -50,11 +50,11 @@ if ($vars['entity']->photos_enable != 'no') { echo "
"; } else { - echo '
'; - echo '

'.elgg_echo("album:none").'

'; + //echo '
'; + //echo '

'.elgg_echo("album:none").'

'; if ($owner && ($owner->canWriteToContainer($_SESSION['user']))){ - echo 'username.'>'.elgg_echo("album:add").''; - echo '
'; + //echo 'username.'>'.elgg_echo("album:add").''; + //echo '
'; } } -- cgit v1.2.3 From 9e4cce719aafe736f784a3b7a886e5b5ba3c9ae8 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:35:06 +0000 Subject: added a menu option to group album listing --- index.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 6b17e12e8..ac480b528 100644 --- a/index.php +++ b/index.php @@ -13,10 +13,19 @@ //if page owner cannot be found, forward to user's pictures instead (or world if not logged in) if (is_null($owner->username) || empty($owner->username)) { //if not logged in, see world pictures instead - if (!isloggedin()) forward('pg/photos/world'); + if (!isloggedin()) + forward('pg/photos/world'); + forward('pg/photos/owned/' . $_SESSION['user']->username); } + // setup group menu for album index + if ($owner instanceof ElggGroup) { + add_submenu_item( elgg_echo('album:create'), + $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, + 'tidypics'); + } + //set the title $title = sprintf(elgg_echo('album:user'), "$owner->name"); $area2 = elgg_view_title($title); -- cgit v1.2.3 From 6b8b1e26a6bc0e0ee0f0970f430e9240f23bd0d1 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:45:20 +0000 Subject: setting owner correctly for edit multi --- edit_multi.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/edit_multi.php b/edit_multi.php index 5b78e6691..501e23102 100644 --- a/edit_multi.php +++ b/edit_multi.php @@ -8,17 +8,26 @@ gatekeeper(); set_context('photos'); - - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } - + + // parse out photo guids $file_string = get_input('files'); $file_array_sent = explode('-', $file_string); $new_file_array = array(); - + + // set owner of page based on first photo guid + $photo_guid = (int)$file_array_sent[0]; + $photo = get_entity($photo_guid); + error_log($photo_guid); + + // set page owner based on owner of photo album + set_page_owner($photo->owner_guid); + $album = get_entity($photo->container_guid); + if ($album) { + $owner_guid = $album->container_guid; + if ($owner_guid) + set_page_owner($owner_guid); + } + foreach ($file_array_sent as $file_guid) { if ($entity = get_entity($file_guid)) { if ($entity->canEdit()){ -- cgit v1.2.3 From 770ba36d1a9c7aba5eb232f7b694e8a597dab33c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:48:30 +0000 Subject: updated comment --- viewimage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viewimage.php b/viewimage.php index 8231bef3d..6734fdffd 100644 --- a/viewimage.php +++ b/viewimage.php @@ -16,7 +16,7 @@ // panic if we can't get it if (!$photo) forward(); - // container of photo should always be set, but just in case + // set page owner based on owner of photo album set_page_owner($photo->owner_guid); $album = get_entity($photo->container_guid); if ($album) { -- cgit v1.2.3 From af9554060b79fbfecbc8583e4e4d6e69dd7ea06f Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 12:44:59 +0000 Subject: cleaned up upload page handler --- upload.php | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/upload.php b/upload.php index dda327ef8..48a8ea522 100644 --- a/upload.php +++ b/upload.php @@ -8,35 +8,30 @@ gatekeeper(); global $CONFIG; + $album_guid = (int) get_input('container_guid'); + if (!$album_guid) + forward(); + + $album = get_entity($album_guid); - // Get the current page's owner - if ($album = (int) get_input('container_guid')) - { - $album_entity = get_entity($album); - - //if album does not exist or user does not have access - if(!$album_entity || !$album_entity->canEdit()) - forward('pg/photos/owned/'); - - //set group to "real" container - $container = $album_entity->container_guid; - set_page_owner($container); + //if album does not exist or user does not have access + if (!$album || !$album->canEdit()) { + // throw warning and forward to previous page + forward($_SERVER['HTTP_REFERER']); } - else - forward('pg/photos/owned/'); - + + // set page owner based on container (user or group) + $container = $album->container_guid; + set_page_owner($container); + $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } - + set_context('photos'); - $title = elgg_echo('album:addpix') . ' ' . $album_entity->title; + $title = elgg_echo('album:addpix') . ': ' . $album->title; $area2 .= elgg_view_title($title); - $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album ) ); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2, $area3); + $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album_guid ) ); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); page_draw($title, $body); ?> \ No newline at end of file -- cgit v1.2.3 From 91f0c4a6d70d50de603b01ffb72b36e04122e29d Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 12:55:35 +0000 Subject: fixed access id bug on upload --- views/default/tidypics/forms/upload.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php index 8cc9af897..f430fb04f 100644 --- a/views/default/tidypics/forms/upload.php +++ b/views/default/tidypics/forms/upload.php @@ -5,6 +5,7 @@ $container_guid = get_input('container_guid'); $access_id = get_entity($vars['album'])->access_id; + if (get_plugin_setting('maxfilesize','tidypics')) { if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) { $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB @@ -60,8 +61,9 @@ function showhide(layer_ref) {

'; - + echo ''; + if ($access_id) + echo ''; ?> " onclick="showhide('tidypics_loader');" />

-- cgit v1.2.3 From d66faaf360f2f629fa96dd5e04ff0c6e38eb8213 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 13:03:15 +0000 Subject: changing name of edit action since it works for both images and albums --- actions/edit.php | 85 +++++++++++++++++++++++++++++++++++ actions/editalbum.php | 85 ----------------------------------- start.php | 2 +- views/default/tidypics/forms/edit.php | 2 +- 4 files changed, 87 insertions(+), 87 deletions(-) create mode 100644 actions/edit.php delete mode 100644 actions/editalbum.php diff --git a/actions/edit.php b/actions/edit.php new file mode 100644 index 000000000..78b1f1653 --- /dev/null +++ b/actions/edit.php @@ -0,0 +1,85 @@ +canEdit()) + { + + // Cache to the session + $_SESSION['albumtitle'] = $title; + $_SESSION['albumbody'] = $body; + $_SESSION['albumtags'] = $tags; + + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags); + + // Get owning user + $owner = get_entity($album->getOwner()); + + // edit access only if access is different from current + if ($album->access_id != $access) + { + $album->access_id = $access; + + //get images from album and update access on image entities + $images = get_entities("object","image", $guid, '', 999, '', false); + foreach ($images as $im) { + $im->access_id = $access; + $im->save(); + //new core updates all metadata access as well! + } + } + + + // Set its title and description appropriately + $album->title = $title; + $album->description = $body; + + // Before we can set metadata, we need to save the image + if (!$album->save()) { + register_error(elgg_echo("album:error")); + $album->delete(); + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page + } + + // Now let's add tags. We can pass an array directly to the object property! Easy. + $album->clearMetadata('tags'); + if (is_array($tagarray)) { + $album->tags = $tagarray; + } + + //if cover meta is sent from image save as metadata + if (get_input('cover') == elgg_echo('album:cover:yes')) { + $container = get_entity($album->container_guid); + $container->cover = $album->guid; + } + + // Success message + system_message(elgg_echo("album:edited")); + + // Remove the image cache + unset($_SESSION['albumtitle']); + unset($_SESSION['albumbody']); + unset($_SESSION['albumtags']); + + // Forward to the main blog page + forward($album->getURL()); + + } +?> \ No newline at end of file diff --git a/actions/editalbum.php b/actions/editalbum.php deleted file mode 100644 index 78b1f1653..000000000 --- a/actions/editalbum.php +++ /dev/null @@ -1,85 +0,0 @@ -canEdit()) - { - - // Cache to the session - $_SESSION['albumtitle'] = $title; - $_SESSION['albumbody'] = $body; - $_SESSION['albumtags'] = $tags; - - // Convert string of tags into a preformatted array - $tagarray = string_to_tag_array($tags); - - // Get owning user - $owner = get_entity($album->getOwner()); - - // edit access only if access is different from current - if ($album->access_id != $access) - { - $album->access_id = $access; - - //get images from album and update access on image entities - $images = get_entities("object","image", $guid, '', 999, '', false); - foreach ($images as $im) { - $im->access_id = $access; - $im->save(); - //new core updates all metadata access as well! - } - } - - - // Set its title and description appropriately - $album->title = $title; - $album->description = $body; - - // Before we can set metadata, we need to save the image - if (!$album->save()) { - register_error(elgg_echo("album:error")); - $album->delete(); - forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page - } - - // Now let's add tags. We can pass an array directly to the object property! Easy. - $album->clearMetadata('tags'); - if (is_array($tagarray)) { - $album->tags = $tagarray; - } - - //if cover meta is sent from image save as metadata - if (get_input('cover') == elgg_echo('album:cover:yes')) { - $container = get_entity($album->container_guid); - $container->cover = $album->guid; - } - - // Success message - system_message(elgg_echo("album:edited")); - - // Remove the image cache - unset($_SESSION['albumtitle']); - unset($_SESSION['albumbody']); - unset($_SESSION['albumtags']); - - // Forward to the main blog page - forward($album->getURL()); - - } -?> \ No newline at end of file diff --git a/start.php b/start.php index 798becce4..f9df12603 100644 --- a/start.php +++ b/start.php @@ -196,7 +196,7 @@ // Register actions register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypics/actions/upload.php"); register_action("tidypics/addalbum", false, $CONFIG->pluginspath. "tidypics/actions/addalbum.php"); - register_action("tidypics/editalbum", false, $CONFIG->pluginspath. "tidypics/actions/editalbum.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/icon", true, $CONFIG->pluginspath. "tidypics/actions/icon.php"); register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php"); diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php index 08fe5cc81..d59d029cc 100644 --- a/views/default/tidypics/forms/edit.php +++ b/views/default/tidypics/forms/edit.php @@ -10,7 +10,7 @@ //set stuff if we are editing existing album or image if (isset($vars['entity'])) { $title = sprintf(elgg_echo("album:edit"),$object->title); - $action = "tidypics/editalbum"; + $action = "tidypics/edit"; $title = $vars['entity']->title; $body = $vars['entity']->description; $tags = $vars['entity']->tags; -- cgit v1.2.3 From 871395b74470a70e37aeb684b820e289b0930cba Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 14:10:18 +0000 Subject: fixed bug with access levels and improved image and album editing --- actions/edit.php | 121 ++++++++++++++++------------------ views/default/tidypics/forms/edit.php | 82 ++++++++++------------- 2 files changed, 91 insertions(+), 112 deletions(-) diff --git a/actions/edit.php b/actions/edit.php index 78b1f1653..a5d84bc18 100644 --- a/actions/edit.php +++ b/actions/edit.php @@ -1,7 +1,7 @@ canEdit()) - { + $guid = (int) get_input('guid'); // guid of image or album + $title = get_input('title'); + $body = get_input('descript'); + $access = get_input('access_id'); + $tags = get_input('tags'); + $subtype = get_input('subtype'); - // Cache to the session - $_SESSION['albumtitle'] = $title; - $_SESSION['albumbody'] = $body; - $_SESSION['albumtags'] = $tags; - - // Convert string of tags into a preformatted array - $tagarray = string_to_tag_array($tags); - - // Get owning user - $owner = get_entity($album->getOwner()); - - // edit access only if access is different from current - if ($album->access_id != $access) - { - $album->access_id = $access; + $container_guid = get_input('container_guid'); + error_log('container_guid is ' . $container_guid); + + // Make sure we actually have permission to edit + $entity = get_entity($guid); + if (!$entity->canEdit()) { + forward(); + } + + // Get owning user/group + error_log("owning user is " . $entity->getOwner()); + $owner = get_entity($entity->getOwner()); + + // change access only if access is different from current + if ($subtype == 'album' && $entity->access_id != $access) { + $entity->access_id = $access; - //get images from album and update access on image entities - $images = get_entities("object","image", $guid, '', 999, '', false); - foreach ($images as $im) { - $im->access_id = $access; - $im->save(); - //new core updates all metadata access as well! - } + //get images from album and update access on image entities + $images = get_entities("object","image", $guid, '', 999, '', false); + foreach ($images as $im) { + $im->access_id = $access; + $im->save(); } + } - // Set its title and description appropriately - $album->title = $title; - $album->description = $body; + // Set its title and description appropriately + $entity->title = $title; + $entity->description = $body; - // Before we can set metadata, we need to save the image - if (!$album->save()) { - register_error(elgg_echo("album:error")); - $album->delete(); - forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page - } + // Before we can set metadata, we need to save the entity + if (!$entity->save()) { + register_error(elgg_echo("album:error")); + $entity->delete(); + forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page + } - // Now let's add tags. We can pass an array directly to the object property! Easy. - $album->clearMetadata('tags'); - if (is_array($tagarray)) { - $album->tags = $tagarray; - } - - //if cover meta is sent from image save as metadata - if (get_input('cover') == elgg_echo('album:cover:yes')) { - $container = get_entity($album->container_guid); - $container->cover = $album->guid; - } - - // Success message + // Now let's add tags + $tagarray = string_to_tag_array($tags); + $entity->clearMetadata('tags'); + if (is_array($tagarray)) { + $entity->tags = $tagarray; + } + + //if cover meta is sent from image save as metadata + if ($subtype == 'image' && get_input('cover') == elgg_echo('album:cover:yes')) { + $album = get_entity($container_guid); + $album->cover = $entity->guid; + } + + // Success message + if ($subtype == 'album') system_message(elgg_echo("album:edited")); - - // Remove the image cache - unset($_SESSION['albumtitle']); - unset($_SESSION['albumbody']); - unset($_SESSION['albumtags']); - - // Forward to the main blog page - forward($album->getURL()); + else + system_message(elgg_echo('images:edited')); - } + forward($entity->getURL()); ?> \ No newline at end of file diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php index d59d029cc..0ed8cffab 100644 --- a/views/default/tidypics/forms/edit.php +++ b/views/default/tidypics/forms/edit.php @@ -1,26 +1,24 @@ title); $action = "tidypics/edit"; $title = $vars['entity']->title; $body = $vars['entity']->description; $tags = $vars['entity']->tags; $access_id = $vars['entity']->access_id; $subtype = $vars['subtype']; - + // if nothing is sent, create new, but only new albums are sent here // new images are sent to upload.php } else { - $title = elgg_echo("album:add"); $action = "tidypics/addalbum"; $tags = ""; $title = ""; @@ -29,87 +27,77 @@ $access_id = ACCESS_DEFAULT; else $access_id = 0; + $subtype = 'album'; } - - // in case we have some cached details - if (isset($vars['albumtitle'])) { - $title = $vars['albumtitle']; - $body = $vars['albumbody']; - $tags = $vars['albumtags']; - } - - $container_guid = get_input('container_guid'); - if (!$container_guid) $container_guid = page_owner(); + + // group or individual + $container_guid = page_owner(); ?>

- "albumtitle", "value" => $title,)); ?> + "title", "value" => $title,)); ?>

-

- "albumbody","value" => $body,)); ?> + "descript","value" => $body,)); ?>

- "albumbody","value" => $body,)); ?> + "descript","value" => $body,)); ?>

- "albumtags","value" => $tags,)); ?> + "tags","value" => $tags,)); ?>

- guid; $container_guid = $vars['entity']->container_guid; $cover_guid = get_entity($container_guid)->cover; - if($cover_guid == $vars['entity']->guid) $cover = 'yes'; - ?> +?>

"cover", "value" => $cover, 'options' => array(elgg_echo('album:cover:yes')))); ?>

- +

- - 'access_id','value' => $access_id)); ?> -

- - + 'access_id','value' => $access_id)); ?> +

+ + - - + + - +?> + +

\ No newline at end of file -- cgit v1.2.3 From 2f94fa464bdc62e4e4a394f231df88ee84b33502 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 14:29:55 +0000 Subject: trying to make menus more consistent --- edit.php | 7 +++++++ index.php | 15 ++++++++++++++- newalbum.php | 5 +++++ start.php | 8 +++++--- upload.php | 4 ++++ viewalbum.php | 2 ++ viewimage.php | 6 ++++++ 7 files changed, 43 insertions(+), 4 deletions(-) diff --git a/edit.php b/edit.php index b84d74724..0f099a9ad 100644 --- a/edit.php +++ b/edit.php @@ -35,6 +35,13 @@ forward(); } + $page_owner = page_owner_entity(); + if ($page_owner instanceof ElggGroup) { + add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); + } + + $area2 .= elgg_view_title($title); $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype)); $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); diff --git a/index.php b/index.php index ac480b528..fb3e94dd4 100644 --- a/index.php +++ b/index.php @@ -10,6 +10,14 @@ //get the owner of the current page $owner = page_owner_entity(); + //$album + + if ($owner instanceof ElggGroup) { + + } + + error_log($owner->guid); + //if page owner cannot be found, forward to user's pictures instead (or world if not logged in) if (is_null($owner->username) || empty($owner->username)) { //if not logged in, see world pictures instead @@ -21,6 +29,8 @@ // setup group menu for album index if ($owner instanceof ElggGroup) { + add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username); add_submenu_item( elgg_echo('album:create'), $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, 'tidypics'); @@ -33,7 +43,10 @@ // Get objects set_context('search'); set_input('search_viewtype', 'gallery'); - $area2 .= list_entities("object", "album", page_owner(), 10); + if ($owner instanceof ElggGroup) + $area2 .= list_entities_groups("album", 0, $owner->guid, 10); + else + $area2 .= list_entities("object", "album", $owner->guid, 10); set_context('photos'); $body = elgg_view_layout('two_column_left_sidebar', '', $area2); diff --git a/newalbum.php b/newalbum.php index 95cdb7860..44e0e07a7 100644 --- a/newalbum.php +++ b/newalbum.php @@ -16,6 +16,11 @@ set_page_owner($_SESSION['guid']); } + if ($page_owner instanceof ElggGroup) { + add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); + } + $area2 = elgg_view_title(elgg_echo('album:add')); $area2 .= elgg_view("tidypics/forms/edit"); diff --git a/start.php b/start.php index f9df12603..e2fbbe15e 100644 --- a/start.php +++ b/start.php @@ -53,9 +53,11 @@ $page_owner = page_owner_entity(); if ($page_owner instanceof ElggGroup) { - if ($page_owner->photos_enable != "no") { - add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), - $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); + if (get_context() == "groups") { + if ($page_owner->photos_enable != "no") { + add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); + } } } // context is only set to photos on individual pages, not on group pages diff --git a/upload.php b/upload.php index 48a8ea522..71beb8752 100644 --- a/upload.php +++ b/upload.php @@ -25,6 +25,10 @@ set_page_owner($container); $page_owner = page_owner_entity(); + if ($page_owner instanceof ElggGroup) { + add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); + } set_context('photos'); $title = elgg_echo('album:addpix') . ': ' . $album->title; diff --git a/viewalbum.php b/viewalbum.php index c216273cd..2a89742a1 100644 --- a/viewalbum.php +++ b/viewalbum.php @@ -23,6 +23,8 @@ // setup group menu if ($owner instanceof ElggGroup) { + add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username); add_submenu_item( elgg_echo('album:create'), $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, 'photos'); diff --git a/viewimage.php b/viewimage.php index 6734fdffd..a303fbe3c 100644 --- a/viewimage.php +++ b/viewimage.php @@ -25,6 +25,12 @@ set_page_owner($owner_guid); } + $page_owner = page_owner_entity(); + if ($page_owner instanceof ElggGroup) { + add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); + } + add_submenu_item( elgg_echo('image:edit'), $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid, 'photos'); -- cgit v1.2.3 From bdf0d61336b878f2e26fc42f98327834423fb409 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 14:43:48 +0000 Subject: not including tag area if no tags --- views/default/object/image.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/views/default/object/image.php b/views/default/object/image.php index 79939bfbb..67fd87bfb 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -91,7 +91,13 @@
-
$tags));?>
+ +
$tags));?>
+ name; ?>
Date: Sat, 28 Mar 2009 14:46:35 +0000 Subject: not displaying edit menus for those without group membership --- index.php | 9 ++------- viewalbum.php | 30 +++++++++++++++++------------- viewimage.php | 16 +++++++++------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/index.php b/index.php index fb3e94dd4..0ba8a6c51 100644 --- a/index.php +++ b/index.php @@ -10,13 +10,6 @@ //get the owner of the current page $owner = page_owner_entity(); - //$album - - if ($owner instanceof ElggGroup) { - - } - - error_log($owner->guid); //if page owner cannot be found, forward to user's pictures instead (or world if not logged in) if (is_null($owner->username) || empty($owner->username)) { @@ -31,9 +24,11 @@ if ($owner instanceof ElggGroup) { add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name), $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username); + if (can_write_to_container(0, $owner->guid)) { add_submenu_item( elgg_echo('album:create'), $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, 'tidypics'); + } } //set the title diff --git a/viewalbum.php b/viewalbum.php index 2a89742a1..4bdd1a2c7 100644 --- a/viewalbum.php +++ b/viewalbum.php @@ -25,21 +25,25 @@ if ($owner instanceof ElggGroup) { add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name), $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username); - add_submenu_item( elgg_echo('album:create'), - $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, - 'photos'); } - add_submenu_item( elgg_echo('album:addpix'), - $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid, - 'photos'); - add_submenu_item( elgg_echo('album:edit'), - $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid, - 'photos'); - add_submenu_item( elgg_echo('album:delete'), - $CONFIG->wwwroot . 'pg/photos/delete/' . $album_guid, - 'photos', - true); + if (can_write_to_container(0, $album->container_guid)) { + if ($owner instanceof ElggGroup) { + add_submenu_item( elgg_echo('album:create'), + $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, + 'photos'); + } + add_submenu_item( elgg_echo('album:addpix'), + $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid, + 'photos'); + add_submenu_item( elgg_echo('album:edit'), + $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid, + 'photos'); + add_submenu_item( elgg_echo('album:delete'), + $CONFIG->wwwroot . 'pg/photos/delete/' . $album_guid, + 'photos', + true); + } // set title and body $title = $album->title; diff --git a/viewimage.php b/viewimage.php index a303fbe3c..fa05bda00 100644 --- a/viewimage.php +++ b/viewimage.php @@ -31,13 +31,15 @@ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); } - add_submenu_item( elgg_echo('image:edit'), - $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid, - 'photos'); - add_submenu_item( elgg_echo('image:delete'), - $CONFIG->wwwroot . 'pg/photos/delete/' . $photo_guid, - 'photos', - true); + if (can_write_to_container(0, $album->container_guid)) { + add_submenu_item( elgg_echo('image:edit'), + $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid, + 'photos'); + add_submenu_item( elgg_echo('image:delete'), + $CONFIG->wwwroot . 'pg/photos/delete/' . $photo_guid, + 'photos', + true); + } $title = $photo->title; $area2 = elgg_view_title($title); -- cgit v1.2.3 From a9010a793da35f76d01edbca97ec40079cc0a9e2 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 15:20:08 +0000 Subject: group members can now work with photo albums --- edit.php | 2 +- start.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/edit.php b/edit.php index 0f099a9ad..b61f6ba0f 100644 --- a/edit.php +++ b/edit.php @@ -6,7 +6,7 @@ include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); + gatekeeper(); // make sure the user is logged_in set_context('photos'); $guid = (int) get_input('guid'); diff --git a/start.php b/start.php index e2fbbe15e..dc1456a57 100644 --- a/start.php +++ b/start.php @@ -41,6 +41,8 @@ register_entity_type('object','album'); add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true); + + register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override'); } /** @@ -170,7 +172,29 @@ } } + + /** + * Override permissions for group albums and images + * + */ + function tidypics_permission_override($hook, $entity_type, $returnvalue, $params) + { + $entity = $params['entity']; + $user = $params['user']; + if ($entity->subtype == get_subtype_id('object', 'album')) { + // test that the user can edit the container + return can_write_to_container(0, $entity->container_guid); + } + + if ($entity->subtype == get_subtype_id('object', 'image')) { + // test that the user can edit the container + return can_write_to_container(0, $entity->container_guid); + } + + return false; + } + /** * Populates the ->getUrl() method for file objects * -- cgit v1.2.3 From 5ef1dd4c79fd5413a1983a4faf96cf3a44c024ba Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 16:31:12 +0000 Subject: removed unnecessary quotes --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 0ba8a6c51..721e91866 100644 --- a/index.php +++ b/index.php @@ -32,7 +32,7 @@ } //set the title - $title = sprintf(elgg_echo('album:user'), "$owner->name"); + $title = sprintf(elgg_echo('album:user'), $owner->name); $area2 = elgg_view_title($title); // Get objects -- cgit v1.2.3 From e45a654715c5db44e60527513d7d8255f8d20221 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 17:46:24 +0000 Subject: cleaned up and standardized the css markup --- views/default/object/album.php | 4 +- views/default/object/image.php | 8 +- views/default/tidypics/css.php | 198 +++++++++++-------------- views/default/tidypics/forms/edit_multi.php | 6 +- views/default/tidypics/forms/upload.php | 2 +- views/default/tidypics/groupprofile_albums.php | 12 +- views/default/widgets/album_view/view.php | 14 +- 7 files changed, 112 insertions(+), 132 deletions(-) diff --git a/views/default/object/album.php b/views/default/object/album.php index a94f12590..63e60a339 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -21,9 +21,9 @@ //get album cover if one was set if($file->cover) - $album_cover = 'thumbnail'; + $album_cover = 'thumbnail'; else - $album_cover = 'new album'; + $album_cover = 'new album'; ?> '; -} - -?> \ No newline at end of file -- cgit v1.2.3 From 3639cba1b20c4227def597e67274a184d1ea87d7 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 14 Jul 2012 14:46:00 -0400 Subject: removed old code --- views/default/tidypics/gallery.php | 71 -------- views/default/tidypics/image_menu.php | 50 ------ views/default/tidypics/js/slideshow.php | 2 - views/default/tidypics/js/tagging.php | 304 -------------------------------- views/default/tidypics/tagging.php | 88 --------- 5 files changed, 515 deletions(-) delete mode 100644 views/default/tidypics/gallery.php delete mode 100644 views/default/tidypics/image_menu.php delete mode 100644 views/default/tidypics/js/slideshow.php delete mode 100644 views/default/tidypics/js/tagging.php delete mode 100644 views/default/tidypics/tagging.php diff --git a/views/default/tidypics/gallery.php b/views/default/tidypics/gallery.php deleted file mode 100644 index ba6f7b11d..000000000 --- a/views/default/tidypics/gallery.php +++ /dev/null @@ -1,71 +0,0 @@ - 0 && $viewtypetoggle) { - $nav .= elgg_view('navigation/viewtype', array( - 'baseurl' => $baseurl, - 'offset' => $offset, - 'count' => $count, - 'viewtype' => $viewtype, - )); -} - -if ($pagination) { - $nav .= elgg_view('navigation/pagination',array( - 'baseurl' => $baseurl, - 'offset' => $offset, - 'count' => $count, - 'limit' => $limit, - )); -} - -$html .= $nav; - -if (is_array($entities) && sizeof($entities) > 0) { - $counter = 0; - foreach($entities as $entity) { - if ($counter % $num_wide == 0) { - $html .= "
"; - } - $html .= elgg_view_entity($entity, $fullview); - $counter++; - } -} - -$html .= '
'; - -if ($count) { - $html .= $nav; -} - -echo $html; \ No newline at end of file diff --git a/views/default/tidypics/image_menu.php b/views/default/tidypics/image_menu.php deleted file mode 100644 index 50ada2193..000000000 --- a/views/default/tidypics/image_menu.php +++ /dev/null @@ -1,50 +0,0 @@ -container_guid); - if ($container instanceof ElggGroup) { - $can_tag = $viewer && $container->isMember($viewer); - } else { - $can_tag = $viewer && $viewer->guid == $owner->guid || user_is_friend($owner->guid, $viewer->guid); - } - - // only owner and friends of owner can tag - if ($can_tag) { -?> -
  • -guid == $owner->guid) { -?> -
  • - -
  • -mod/tidypics/vendors/PicLensLite/piclens_optimized.js"> diff --git a/views/default/tidypics/js/tagging.php b/views/default/tidypics/js/tagging.php deleted file mode 100644 index 3ffa20cfb..000000000 --- a/views/default/tidypics/js/tagging.php +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - diff --git a/views/default/tidypics/tagging.php b/views/default/tidypics/tagging.php deleted file mode 100644 index 2993fe71b..000000000 --- a/views/default/tidypics/tagging.php +++ /dev/null @@ -1,88 +0,0 @@ -getPhotoTags(); - -// defining json text as "" makes sure the tagging javascript code doesn't throw errors if no tags -$photo_tags_json = "\"\""; -if ($tag_info) { - $photo_tags_json = $tag_info['json']; -} - -if ($tag_info) { -?> -
    -

    - -
    - -
    -
    -
    -
    -
    -

    - "; - $content .= ""; - $content .= ""; - $content .= ""; - $content .= ""; - - $content .= "
    "; - - $content .= "
    "; - - echo elgg_view('input/form', array('internalid' => 'quicksearch', 'internalname' => 'tidypics_phototag_form', 'class' => 'quicksearch', 'action' => "{$vars['url']}action/tidypics/addtag", 'method' => 'post', 'body' => $content)); - } - - ?> -
    -
    -
    -

    - - guid}' />"; - foreach ($tag_info['links'] as $id => $link) { - $text = htmlentities($link['text'], ENT_QUOTES, 'UTF-8'); - $content .= "
    "; - } - - $content .= ""; - $content .= ""; - - echo elgg_view('input/form', array('internalname' => 'phototag_deletetag_form', 'action' => "{$vars['url']}action/tidypics/deletetag", 'method' => 'post', 'body' => $content)); - - } -?> -
    - $photo_tags_json,) ); -- cgit v1.2.3 From 2893bbf881b1bdca005b4751fbb4e7e1c52f31f8 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 14 Jul 2012 14:53:40 -0400 Subject: removed deprecated functions --- actions/photos/image/untag.php | 2 +- classes/TidypicsImage.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/actions/photos/image/untag.php b/actions/photos/image/untag.php index 012f98930..11c433a61 100644 --- a/actions/photos/image/untag.php +++ b/actions/photos/image/untag.php @@ -3,7 +3,7 @@ * Remove photo tag action */ -$annotation = get_annotation(get_input('annotation_id')); +$annotation = elgg_get_annotation_from_id(get_input('annotation_id')); if (!$annotation instanceof ElggAnnotation || $annotation->name != 'phototag') { register_error(elgg_echo("tidypics:phototagging:delete:error")); diff --git a/classes/TidypicsImage.php b/classes/TidypicsImage.php index 9081bc1fe..672a0df20 100644 --- a/classes/TidypicsImage.php +++ b/classes/TidypicsImage.php @@ -380,21 +380,21 @@ class TidypicsImage extends ElggFile { //delete standard thumbnail image if ($thumbnail) { $delfile = new ElggFile(); - $delfile->owner_guid = $this->getOwner(); + $delfile->owner_guid = $this->getOwnerGUID(); $delfile->setFilename($thumbnail); $delfile->delete(); } //delete small thumbnail image if ($smallthumb) { $delfile = new ElggFile(); - $delfile->owner_guid = $this->getOwner(); + $delfile->owner_guid = $this->getOwnerGUID(); $delfile->setFilename($smallthumb); $delfile->delete(); } //delete large thumbnail image if ($largethumb) { $delfile = new ElggFile(); - $delfile->owner_guid = $this->getOwner(); + $delfile->owner_guid = $this->getOwnerGUID(); $delfile->setFilename($largethumb); $delfile->delete(); } -- cgit v1.2.3 From 2d8b04169dda48a5dba8503d9943bdeee2c64685 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 14 Jul 2012 15:15:30 -0400 Subject: watermarking returns --- lib/watermark.php | 10 +++++----- views/default/forms/photos/admin/settings.php | 4 ---- views/default/forms/photos/admin/settings/main.php | 8 ++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/watermark.php b/lib/watermark.php index a2aebffd9..f7c228af1 100644 --- a/lib/watermark.php +++ b/lib/watermark.php @@ -54,11 +54,11 @@ function tp_gd_watermark($image) { } // plugins can do their own watermark and return false to prevent this function from running - if (trigger_plugin_hook('tp_watermark', 'gd', $image, true) === false) { + if (elgg_trigger_plugin_hook('tp_watermark', 'gd', $image, true) === false) { return; } - $owner = elgg_get_logged_in_user_guid(); + $owner = elgg_get_logged_in_user_entity(); $watermark_text = tp_process_watermark_text($watermark_text, $owner); @@ -101,7 +101,7 @@ function tp_imagick_watermark($filename) { return true; } - $owner = get_loggedin_user(); + $owner = elgg_get_logged_in_user_entity(); $watermark_text = tp_process_watermark_text($watermark_text, $owner); @@ -144,7 +144,7 @@ function tp_im_cmdline_watermark($filename) { } // plugins can do their own watermark and return false to prevent this function from running - if (trigger_plugin_hook('tp_watermark', 'imagemagick', $filename, true) === false) { + if (elgg_trigger_plugin_hook('tp_watermark', 'imagemagick', $filename, true) === false) { return; } @@ -159,7 +159,7 @@ function tp_im_cmdline_watermark($filename) { } - $owner = get_loggedin_user(); + $owner = elgg_get_logged_in_user_entity(); $watermark_text = tp_process_watermark_text($watermark_text, $owner); diff --git a/views/default/forms/photos/admin/settings.php b/views/default/forms/photos/admin/settings.php index 2b6399a67..7e9c17ac2 100644 --- a/views/default/forms/photos/admin/settings.php +++ b/views/default/forms/photos/admin/settings.php @@ -28,10 +28,6 @@ echo elgg_view('input/submit', array('value' => elgg_echo("save"))); return true; -// Watermark Text -$form_body .= "

    " . elgg_echo('tidypics:settings:watermark') . "
    "; -$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "

    "; - // Quota Size $quota = $plugin->quota; if (!$quota) { diff --git a/views/default/forms/photos/admin/settings/main.php b/views/default/forms/photos/admin/settings/main.php index 349c951f9..352a9c5a1 100644 --- a/views/default/forms/photos/admin/settings/main.php +++ b/views/default/forms/photos/admin/settings/main.php @@ -26,3 +26,11 @@ echo elgg_view('input/text', array( 'value' => $plugin->maxfilesize, )); echo ''; + +// Watermark Text +echo '
    ' . elgg_echo('tidypics:settings:watermark'); +echo elgg_view("input/text", array( + 'name' => 'params[watermark_text]', + 'value' => $plugin->watermark_text, +)); +echo '
    '; -- cgit v1.2.3 From c7bd5fb64003c42f9299b7203af9a13bcd48948f Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 14 Jul 2012 15:50:06 -0400 Subject: added quota back --- classes/TidypicsImage.php | 6 ++++- languages/en.php | 5 ++-- lib/upload.php | 6 ++--- pages/photos/image/upload.php | 1 + views/default/forms/photos/admin/settings.php | 14 +---------- views/default/forms/photos/admin/settings/main.php | 12 ++++++++++ views/default/forms/photos/ajax_upload.php | 23 ++++-------------- views/default/forms/photos/basic_upload.php | 27 ---------------------- views/default/photos/sidebar.php | 6 +++++ views/default/photos/sidebar/quota.php | 27 ++++++++++++++++++++++ 10 files changed, 63 insertions(+), 64 deletions(-) create mode 100644 views/default/photos/sidebar/quota.php diff --git a/classes/TidypicsImage.php b/classes/TidypicsImage.php index 672a0df20..5a8d42ccc 100644 --- a/classes/TidypicsImage.php +++ b/classes/TidypicsImage.php @@ -217,11 +217,15 @@ class TidypicsImage extends ElggFile { } $owner = $this->getOwnerEntity(); - $owner->image_repo_size = (int)$owner->image_repo_size + $size; + $owner->image_repo_size = (int)$owner->image_repo_size + $this->size(); return true; } + /** + * Need to restore sanity to this function + * @param type $data + */ protected function checkUploadErrors($data) { // check for upload errors if ($data['error']) { diff --git a/languages/en.php b/languages/en.php index 0fe3996f1..007dc5785 100644 --- a/languages/en.php +++ b/languages/en.php @@ -71,7 +71,7 @@ $english = array( 'tidypics:settings:uploader' => "Use Flash uploader", 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums", 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):", - 'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota", + 'tidypics:settings:quota' => "User Quota (MB) - 0 equals no quota", 'tidypics:settings:watermark' => "Enter text to appear in the watermark", 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands", 'tidypics:settings:img_river_view' => "How many entries in activity river for each batch of uploaded images", @@ -153,12 +153,13 @@ $english = array( 'album:tags' => "Tags", 'album:cover' => "Make image album cover?", 'album:cover_link' => 'Set cover image', + 'tidypics:title:quota' => 'Quota', 'tidypics:quota' => "Quota usage:", 'tidypics:uploader:choose' => "Choose photos", 'tidypics:uploader:upload' => "Upload photos", 'tidypics:uploader:describe' => "Describe photos", '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:instructs' => 'There are three easy steps for adding photos to your album using this uploader: choosing, uploading, and describing them. There is a %s MB maximum per photo. 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.', 'tidypics:sort:no_images' => 'No images found to sort. Upload images using the link above.', diff --git a/lib/upload.php b/lib/upload.php index 0b034517c..a83323f16 100644 --- a/lib/upload.php +++ b/lib/upload.php @@ -111,9 +111,9 @@ function tp_upload_check_quota($image_size, $owner_guid) { // no quota return true; } - - $image_repo_size_md = get_metadata_byname($owner_guid, "image_repo_size"); - $image_repo_size = (int)$image_repo_size_md->value; + + $owner = get_entity($owner_guid); + $image_repo_size_md = (int)$owner->image_repo_size; return ($image_repo_size + $image_size) < $quota; } \ No newline at end of file diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php index 3d3e67b58..425d5689a 100644 --- a/pages/photos/image/upload.php +++ b/pages/photos/image/upload.php @@ -52,6 +52,7 @@ $body = elgg_view_layout('content', array( 'content' => $content, 'title' => $title, 'filter' => '', + 'sidebar' => elgg_view('photos/sidebar', array('page' => 'upload')), )); echo elgg_view_page($title, $body); diff --git a/views/default/forms/photos/admin/settings.php b/views/default/forms/photos/admin/settings.php index 7e9c17ac2..403203f69 100644 --- a/views/default/forms/photos/admin/settings.php +++ b/views/default/forms/photos/admin/settings.php @@ -2,7 +2,7 @@ /** * Tidypics admin settings form body * - * @todo watermark, quota, remove original image, group only upload not delete + * @todo remove original image, group only upload not delete */ $plugin = elgg_get_plugin_from_id('tidypics'); @@ -24,15 +24,3 @@ $content = elgg_view('forms/photos/admin/settings/thumbnails', array('plugin' => echo elgg_view_module('inline', $title, $content); echo elgg_view('input/submit', array('value' => elgg_echo("save"))); - -return true; - - -// Quota Size -$quota = $plugin->quota; -if (!$quota) { - $quota = 0; -} -$form_body .= "

    " . elgg_echo('tidypics:settings:quota') . "
    "; -$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "

    "; - diff --git a/views/default/forms/photos/admin/settings/main.php b/views/default/forms/photos/admin/settings/main.php index 352a9c5a1..c99b9d688 100644 --- a/views/default/forms/photos/admin/settings/main.php +++ b/views/default/forms/photos/admin/settings/main.php @@ -34,3 +34,15 @@ echo elgg_view("input/text", array( 'value' => $plugin->watermark_text, )); echo ''; + +// Quota Size +$quota = $plugin->quota; +if (!$quota) { + $quota = 0; +} +echo '
    ' . elgg_echo('tidypics:settings:quota'); +echo elgg_view('input/text', array( + 'name' => 'params[quota]', + 'value' => $quota, +)); +echo '
    '; diff --git a/views/default/forms/photos/ajax_upload.php b/views/default/forms/photos/ajax_upload.php index be25d628e..3ab578a38 100644 --- a/views/default/forms/photos/ajax_upload.php +++ b/views/default/forms/photos/ajax_upload.php @@ -17,26 +17,13 @@ if (!$maxfilesize) { $maxfilesize = 5; } -$quota = elgg_get_plugin_setting('quota', 'tidypics'); -if ($quota) { - $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size"); - $image_repo_size = (int)$image_repo_size_md->value; - $image_repo_size = $image_repo_size / 1024 / 1024; - $quote_percentage = round(100 * ($image_repo_size / $quota)); - // for small quotas, so one decimal place - if ($quota < 10) { - $image_repo_size = sprintf('%.1f', $image_repo_size); - } else { - $image_repo_size = round($image_repo_size); - } - if ($image_repo_size > $quota) { - $image_repo_size = $quota; - } -} - ?> -

    +

    + +

    • diff --git a/views/default/forms/photos/basic_upload.php b/views/default/forms/photos/basic_upload.php index e4535814b..ba849d1b4 100644 --- a/views/default/forms/photos/basic_upload.php +++ b/views/default/forms/photos/basic_upload.php @@ -15,33 +15,6 @@ $album = $vars['entity']; $access_id = $album->access_id; $maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics'); -$quota = elgg_get_plugin_setting('quota', 'tidypics'); -/* -if ($quota) { - $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size"); - $image_repo_size = (int)$image_repo_size_md->value; - $image_repo_size = $image_repo_size / 1024 / 1024; - $quote_percentage = round(100 * ($image_repo_size / $quota)); - // for small quotas, so one decimal place - if ($quota < 10) { - $image_repo_size = sprintf('%.1f', $image_repo_size); - } else { - $image_repo_size = round($image_repo_size); - } - if ($image_repo_size > $quota) { - $image_repo_size = $quota; - } -} - -
      - - - * -*/ $instructions = elgg_echo("tidypics:uploader:upload"); $max = elgg_echo('tidypics:uploader:basic', array($maxfilesize)); diff --git a/views/default/photos/sidebar.php b/views/default/photos/sidebar.php index 4c0feb72c..fd5202691 100644 --- a/views/default/photos/sidebar.php +++ b/views/default/photos/sidebar.php @@ -10,3 +10,9 @@ if ($image && $page == 'view') { echo elgg_view('photos/sidebar/exif', $vars); } } + +if ($page == 'upload') { + if (elgg_get_plugin_setting('quota', 'tidypics')) { + echo elgg_view('photos/sidebar/quota', $vars); + } +} \ No newline at end of file diff --git a/views/default/photos/sidebar/quota.php b/views/default/photos/sidebar/quota.php new file mode 100644 index 000000000..16b7885c4 --- /dev/null +++ b/views/default/photos/sidebar/quota.php @@ -0,0 +1,27 @@ +image_repo_size; + $image_repo_size = $image_repo_size / 1024 / 1024; + $quote_percentage = round(100 * ($image_repo_size / $quota)); + // for small quotas, so one decimal place + if ($quota < 10) { + $image_repo_size = sprintf('%.1f', $image_repo_size); + } else { + $image_repo_size = round($image_repo_size); + } + if ($image_repo_size > $quota) { + $image_repo_size = $quota; + } + + $title = elgg_echo('tidypics:title:quota'); + $body = elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; + echo elgg_view_module('aside', $title, $body); +} -- cgit v1.2.3 From 57b8fb7a439fb181d2c2fac4a06e178c17b3b4ca Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 14 Jul 2012 15:53:09 -0400 Subject: better language for setting album cover --- languages/en.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/en.php b/languages/en.php index 007dc5785..62b43673d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -151,8 +151,8 @@ $english = array( 'album:title' => "Title", 'album:desc' => "Description", 'album:tags' => "Tags", - 'album:cover' => "Make image album cover?", - 'album:cover_link' => 'Set cover image', + 'album:cover' => "Make this image the album cover?", + 'album:cover_link' => 'Make cover', 'tidypics:title:quota' => 'Quota', 'tidypics:quota' => "Quota usage:", 'tidypics:uploader:choose' => "Choose photos", -- cgit v1.2.3 From ad34c437251fe2194ea482b58fcaad4459bf6b37 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 14 Jul 2012 15:57:13 -0400 Subject: 1.8.0 Release Candidate 1 --- contributions.txt | 14 ++++++++++++++ manifest.xml | 2 +- version.php | 1 - 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/contributions.txt b/contributions.txt index 6ab7253f9..f12a4713b 100644 --- a/contributions.txt +++ b/contributions.txt @@ -1,5 +1,19 @@ Changelog and contributors list +------------------------------------------------------------------------ +Version 1.8.0 RC1 Change List +Release Date: 07/14/2012 +------------------------------------------------------------------------ +BEGIN VERSION 1.8.0 RC1 CHANGES +------------------------------------------------------------------------ + * Updated for Elgg 1.8 +Contributors: + * Cash Costello + * Brett Profitt +------------------------------------------------------------------------ +END VERSION 1.7.3 CHANGES +------------------------------------------------------------------------ + ------------------------------------------------------------------------ Version 1.7.3 Change List Release Date: 11/09/2011 diff --git a/manifest.xml b/manifest.xml index d3c884f2f..3f4025988 100644 --- a/manifest.xml +++ b/manifest.xml @@ -2,7 +2,7 @@ Tidypics Photo Gallery Cash Costello - 1.8.0-preview2 + 1.8.0-rc1 A photo gallery with albums, tagging, and a slideshow. content multimedia diff --git a/version.php b/version.php index f2817c5e9..68817c053 100644 --- a/version.php +++ b/version.php @@ -1,5 +1,4 @@ Date: Sun, 15 Jul 2012 03:27:30 +0300 Subject: Updated German language file: more or less completely new translation to mirror English language file of Tidypics 1.8.0-RC1, fixing of spelling errors, more consistent translation. --- languages/de.php | 354 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 221 insertions(+), 133 deletions(-) diff --git a/languages/de.php b/languages/de.php index 555c42058..1f439e981 100644 --- a/languages/de.php +++ b/languages/de.php @@ -1,9 +1,4 @@ "Bild", 'images' => "Bilder", 'caption' => "Beschreibung", - 'photos' => "Fotos", - 'images:upload' => "Fotos hochladen", - 'images:multiupload' => "Flash Multi-Upload Tool", - 'images:multiupload:todo' => "Ein oder mehrere Bilder zum Hochladen wählen!", - 'album' => "Fotoalbum", - 'albums' => "Fotoalben", + 'photos' => "Bilder", + 'album' => "Bilderalbum", + 'albums' => "Bilderalben", + 'tidypics:disabled' => 'Deaktiviert', + 'tidypics:enabled' => 'Aktiviert', + 'admin:settings:photos' => 'Tidypics', + + 'photos:add' => "Album hinzufügen", + 'images:upload' => "Bilder hochladen", + 'album:slideshow' => "Diashow ansehen", - 'album:yours' => "Deine Fotoalben", - 'album:yours:friends' => "Fotoalben deiner Freunde", - 'album:user' => "%s's Fotoalben", - 'album:friends' => "Fotoalben von %s's Freunden", - 'album:all' => "Alle Fotoalben", - 'album:group' => "Gruppen-Alben", - 'item:object:image' => "Fotos", + 'album:yours' => "Deine Bilderalben", + 'album:yours:friends' => "Bilderalben Deiner Freunde", + 'album:user' => "Bilderalben von %s", + 'album:friends' => "Bilderalben von Freunden", + 'album:all' => "Alle Bilderalben", + 'photos:group' => "Gruppen-Bilder", + 'item:object:image' => "Bilder", 'item:object:album' => "Alben", - 'tidypics:uploading:images' => "Die Bilder werden hochgeladen", - 'tidypics:enablephotos' => 'Schalte Gruppenalben frei', + 'tidypics:uploading:images' => "Die Bilder werden hochgeladen.", + 'tidypics:enablephotos' => 'Gruppen-Alben aktivieren', 'tidypics:editprops' => 'Bild bearbeiten', - 'tidypics:mostcommented' => 'meist kommentierte', - 'tidypics:mostcommentedthismonth' => 'Meist kommentierte des Monats', - 'tidypics:mostcommentedtoday' => 'Meist kommentierte des Tages', - 'tidypics:mostviewed' => 'Meist gesehene Bilder', - 'tidypics:mostvieweddashboard' => 'Meist gesehene dashboard', - 'tidypics:mostviewedthisyear' => 'Meist gesehene des Jahres', - 'tidypics:mostviewedthismonth' => 'Meist gesehene des Monats', - 'tidypics:mostviewedlastmonth' => 'Meist gesehen im letzten Monat', - 'tidypics:mostviewedtoday' => 'Am häufigsten gezeigte des Tages', - 'tidypics:recentlyviewed' => 'Zuletzt angezeigt', - 'tidypics:recentlycommented' => 'Zuletzt kommentiert', - 'tidypics:mostrecent' => 'Community neue Bilder', - 'tidypics:yourmostviewed' => 'Deine meist gesehene', - 'tidypics:yourmostrecent' => 'Zuletzt hochgeladen', - 'tidypics:friendmostviewed' => "%s's meist gesehene", - 'tidypics:friendmostrecent' => "Zuletzt hochgeladen von %s", - 'tidypics:highestrated' => "Am höchsten bewertet", - 'tidypics:views' => "Zugriffe: %s", - 'tidypics:viewsbyowner' => "Zugriffe: %s von %s Mitglieder (du ausgeschlossen)", - 'tidypics:viewsbyothers' => "Zugriffe: %s (%s deine)", - 'tidypics:administration' => 'Tidypics Administration', - 'tidypics:stats' => 'Statitik', + 'tidypics:mostcommented' => 'Meist kommentierte Bilder', + 'tidypics:mostcommentedthismonth' => 'Meist kommentierte Bilder des Monats', + 'tidypics:mostcommentedtoday' => 'Meist kommentierte Bilder des Tages', + 'tidypics:mostviewed' => 'Am häufigsten angesehene Bilder', + 'tidypics:mostvieweddashboard' => 'Am häufigsten angesehene Bilder auf Dashboard', + 'tidypics:mostviewedthisyear' => 'Am häufigsten angesehene Bilder des Jahres', + 'tidypics:mostviewedthismonth' => 'Am häufigsten angesehene Bilder des Monats', + 'tidypics:mostviewedlastmonth' => 'Am häufigsten angesehene Bilder im letzten Monat', + 'tidypics:mostviewedtoday' => 'Am häufigsten angesehene Bilder des Tages', + 'tidypics:recentlyviewed' => 'Zuletzt angesehene Bilder', + 'tidypics:recentlycommented' => 'Zuletzt kommentierte Bilder', + 'tidypics:mostrecent' => 'Neue Bilder der Community-Seite', + 'tidypics:yourmostviewed' => 'Deine am häufigsten angesehenen Bilder', + 'tidypics:yourmostrecent' => 'Zuletzt hochgeladene Bilder', + 'tidypics:friendmostviewed' => "Am häufigsten angesehene Bilder von %s", + 'tidypics:friendmostrecent' => "Zuletzt hochgeladene Bilder von %s", + 'tidypics:highestrated' => "Am höchsten bewertete Bilder", + 'tidypics:views' => "%s Zugriffe", + 'tidypics:viewsbyowner' => "Zugriffe: %s von %s Mitglieder (Dich nicht mitgerechnet)", + 'tidypics:viewsbyothers' => "Zugriffe: %s (%s von Dir)", + 'tidypics:administration' => 'Tidypics-Administration', + 'tidypics:stats' => 'Statistik', + 'tidypics:nophotosingroup' => 'Diese Gruppe hat noch keine Bilder.', + 'tidypics:upgrade' => 'Aktualisieren', + 'tidypics:sort' => 'Umsortieren des %s-Bilderalbums', + 'tidypics:none' => 'Keine Bilderalben vorhanden.', //settings 'tidypics:settings' => 'Einstellungen', - 'tidypics:admin:instructions' => 'Das sind die Tidypics Einstellungen', - 'tidypics:settings:image_lib' => "Image Library: ", - 'tidypics:settings:thumbnail' => "Thumbnail Creation", + 'tidypics:settings:main' => 'Grundeinstellungen', + 'tidypics:settings:image_lib' => "Image Library", + 'tidypics:settings:thumbnail' => "Erzeugung von Vorschaubildern", + 'tidypics:settings:help' => "Hilfe", 'tidypics:settings:download_link' => "Zeige Download-Link", - 'tidypics:settings:tagging' => "Erlaube Foto-Links", - 'tidypics:settings:photo_ratings' => "Erlaube Foto Bewertungen (benötigt rate plugin of Miguel Montes oder passendes)", - 'tidypics:settings:exif' => "Zeige EXIF data", - 'tidypics:settings:view_count' => "Zeige Zähler", - 'tidypics:settings:grp_perm_override' => "Erlaube den Gruppen-Mitgliedern unbeschränkten zugagn zur verwaltung von Gruppen-Alben", - 'tidypics:settings:maxfilesize' => "Maximale Bildgröße in Megabytes (MB):", - 'tidypics:settings:quota' => "Benutzer/Gruppen Speicherplatz in (MB) (0 = Kein Speicherplatz)", - 'tidypics:settings:watermark' => "Gib den Text für den Wasserzeichen ein - ImageMagick Cmdline muss ausgewählt sein für die Bildbibliothek", - 'tidypics:settings:im_path' => "Gib den Pfad zu ImageMagick Befehle (mit abschließendem Slasch)", - 'tidypics:settings:img_river_view' => "Wie viele Einträge in der aktivitäten Liste beim Upload von mehreren Bildern", - 'tidypics:settings:album_river_view' => "Zeige Albumcover oder ein Set von Fotos für neuen Album", - 'tidypics:settings:largesize' => "Bild-Größe", - 'tidypics:settings:smallsize' => "Album-Tumbnail Bild-Größe", - 'tidypics:settings:thumbsize' => "Thumbnail Bild-Größe", - 'tidypics:settings:im_id' => "Bild ID", + 'tidypics:settings:tagging' => "Tagging von Bildern erlauben", + 'tidypics:settings:photo_ratings' => "Bewerten von Bildern erlauben (benötigt das Elggx Fivestar-Plugin oder ein vergleichbares)", + 'tidypics:settings:exif' => "EXIF-Daten anzeigen", + 'tidypics:settings:view_count' => "Zugriffszähler anzeigen", + 'tidypics:settings:uploader' => "Flash-Uploader verwenden", + 'tidypics:settings:grp_perm_override' => "Gruppen-Mitgliedern unbeschränkten Zugriff auf die Verwaltung von Gruppen-Alben geben", + 'tidypics:settings:maxfilesize' => "Maximal erlaubte Bildgröße in Megabytes (MB):", + 'tidypics:settings:quota' => "Quota für Benutzer in Megabytes (MB) (0 = kein Quota)", + 'tidypics:settings:watermark' => "Gib den Text ein, der als Wasserzeichen eingefügt wird", + 'tidypics:settings:im_path' => "Der Pfad zu den ImageMagick-Kommandozeilentools auf dem Server", + 'tidypics:settings:img_river_view' => "Anzahl der Einträge im River beim gleichzeitigen Hochladen mehrerer Bilder", + 'tidypics:settings:album_river_view' => "Anzeige des Albumcovers oder eines Sets von Bildern für neue Alben", + 'tidypics:settings:largesize' => "Bildgröße in der Hauptansicht", + 'tidypics:settings:smallsize' => "Bildgröße in der Alben-Ansicht", + 'tidypics:settings:tinysize' => "Bildgröße von Vorschaubildern", + 'tidypics:settings:sizes:instructs' => 'Du mußt eventuell die CSS-Einstellungen anpassen, falls Du die vorgegebenen Standard-Bildgrößen änderst.', + 'tidypics:settings:im_id' => "Bilder-ID", + 'tidypics:settings:heading:img_lib' => "Image-Library-Einstellungen", + 'tidypics:settings:heading:main' => "Grundeinstellungen", + 'tidypics:settings:heading:river' => "Einstellungen für die River-Integration", + 'tidypics:settings:heading:sizes' => "Größe der Vorschaubilder", + 'tidypics:settings:heading:groups' => "Einstellungen für die Gruppen-Integration", + 'tidypics:option:all' => 'Alle', + 'tidypics:option:none' => 'Keine', + 'tidypics:option:cover' => 'Cover', + 'tidypics:option:set' => 'Set', + + // server analysis + 'tidypics:server_info' => 'Informationen über den Server', + 'tidypics:server_info:gd_desc' => 'Elgg setzt voraus, dass die GD-PHP-Erweiterung verfügbar ist.', + 'tidypics:server_info:exec_desc' => 'Benötigt für die ImageMagick-Kommandozeilentools.', + 'tidypics:server_info:memory_limit_desc' => 'Passe die PHP-Variable memory_limit an, um mehr Speicher zur Verfügung zu stellen.', + 'tidypics:server_info:peak_usage_desc' => 'Dies ist ungefähr der Mindest-Speicherbedarf pro Seite.', + 'tidypics:server_info:upload_max_filesize_desc' => 'Maximal erlaubte Dateigröße für ein einzelnes hochzuladendes Bild.', + 'tidypics:server_info:post_max_size_desc' => '"Max post size" abzüglich der Größe der HTML-Form = Maximal mögliche Gesamtgröße von gleichzeitig hochzuladenden Bildern.', + 'tidypics:server_info:max_input_time_desc' => 'Maximale erlaubte Dauer, in der das Hochladen von Daten auf den Server abgeschlossen sein muss.', + 'tidypics:server_info:max_execution_time_desc' => 'Maximal erlaubte Ausführdauer für ein Skript auf dem Server.', + 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions können den Flash-Uploader beeinträchtigen.', + 'tidypics:server_info:php_version' => 'PHP-Version', + 'tidypics:server_info:memory_limit' => 'Für PHP verfügbarer Speicher', + 'tidypics:server_info:peak_usage' => 'Genutzer Speicher, um diese Seite zu laden', + 'tidypics:server_info:upload_max_filesize' => 'PHP-Einstellung von upload_max_filesize', + 'tidypics:server_info:post_max_size' => 'PHP-Einstellung von post_max_size', + 'tidypics:server_info:max_input_time' => 'PHP-Einstellung von max_input_time', + 'tidypics:server_info:max_execution_time' => 'PHP-Einstellung von max_execution_time', + 'tidypics:server_info:use_only_cookies' => 'PHP-Einstellung von session.use_only_cookies', + + 'tidypics:server_config' => 'Server-Konfiguration', + 'tidypics:server_configuration_doc' => 'Dokumentation über die Konfigurierung des Servers', + + // ImageMagick test + 'tidypics:lib_tools:testing' => + 'Tidypics benötigt den Pfad auf dem Server zu den ImageMagick-Kommandozeilentools, falls Du diese als Image-Library verwenden willst. Dein Webhoster sollte Dir diese Information mitteilen können. Du kannst im folgenden prüfen, ob dieser Pfad korrekt ist. Wenn der Test erfolgreich ist, sollten Informationen über die auf dem Server installierte Version von ImageMagick angezeigt werden.', + + // thumbnail tool + 'tidypics:thumbnail_tool' => 'Vorschaubild-Erzeugung', + 'tidypics:thumbnail_tool_blurb' => + 'Im Folgenden kannst Du Vorschaubilder von Bildern erzeugen, falls dies beim Hochladen der Bilder fehlgeschlagen ist. Die Erzeugung der Vorschaubilder kann fehlschlagen, wenn die Image-Library nicht richtig eingerichtet ist oder falls für die GD-PHP-Erweiterung nicht genügend Arbeitsspeicher verfügbar ist, um das Bild zu laden und die Größe zu ändern. Falls die Mitglieder Deiner Seite bei der Erzeugung der Vorschaubilder für ihre hochgeladenen Bilder Probleme hatten, kannst Du im folgenden die Erzeugung der Vorschaubilder wiederholen, nachdem Du den Server bzw. Tidypics richtig konfiguriert hast. Bestimme die GUID des Bildes, für das Du Vorschaubilder erzeugen willst (dies ist die Nummer, die fast am Ende der URL enthalten ist, wenn Du dieses Bilder auf Deiner Seite anschaust) und gebe diese Nummer im folgenden Eingabefeld ein.', + 'tidypics:thumbnail_tool:unknown_image' => 'Das Originalbild kann nicht gefunden werden.', + 'tidypics:thumbnail_tool:invalid_image_info' => 'Beim Abrufen Bildinformationen ist ein Fehler aufgetreten.', + 'tidypics:thumbnail_tool:create_failed' => 'Die Erzeugung der Vorschaubilder ist fehlgeschlagen.', + 'tidypics:thumbnail_tool:created' => 'Die Vorschaubilder wurden erzeugt.', //actions - 'album:create' => "Album hinzufügen", + 'album:create' => "Neues Album hinzufügen", 'album:add' => "Neues Album hinzufügen", - 'album:addpix' => "Fotos hinzufügen", + 'album:addpix' => "Bilder hinzufügen", 'album:edit' => "Album bearbeiten", 'album:delete' => "Album löschen", + 'album:sort' => "Umsortieren", 'image:edit' => "Bild bearbeiten", 'image:delete' => "Bild löschen", 'image:download' => "Bild herunterladen", @@ -90,100 +142,136 @@ $german = array( //forms 'album:title' => "Titel", 'album:desc' => "Beschreibung", - 'album:tags' => "Stichwörter", - 'album:cover' => "Das bild als Albumcover nutzen", - 'tidypics:quota' => "Speicherplatz:", + 'album:tags' => "Tags", + 'album:cover' => "Dieses Bild als Albumcover verwenden?", + 'album:cover_link' => 'Zum Albumcover machen', + 'tidypics:title:quota' => 'Quota', + 'tidypics:quota' => "Quota-Ausnutzung:", + 'tidypics:uploader:choose' => "Wähle die Bilder aus", + 'tidypics:uploader:upload' => "Lade die Bilder hoch", + 'tidypics:uploader:describe' => "Gebe Beschreibungen für die Bilder ein", + 'tidypics:uploader:filedesc' => 'Bilddateien (jpeg, png, gif)', + 'tidypics:uploader:instructs' => 'Das Hochladen von Bilder erfolgt in drei einfachen Schritten: Bilder zum Hochladen auswählen, diese Bilder hochladen und dann Beschreibungen für diese Bilder eingeben. Pro Bilddatei gibt es eine Größenbeschränkung von %s MB. Falls Du auf Deinem Computer Flash nicht installiert hast, ist auch ein Alternativer Uploader verfügbar.', + 'tidypics:uploader:basic' => 'Du kannst bis zu 10 Bilder auf einmal hochladen (maximale Dteigröße %s MB pro Bild).', + 'tidypics:sort:instruct' => 'Sortiere die Bilder im Album durch Drag-and-Drop um. Dann speichere Deine Änderungen.', + 'tidypics:sort:no_images' => 'Es wurden keine Bilder gefunden, die umsortiert werden könnten. Lade Bilder hoch, indem Du dem obigen Link folgst.', + + // albums + 'album:num' => '%s Bilder', //views 'image:total' => "Bilder im Album:", 'image:by' => "Bild hinzugefügt von", - 'album:by' => "Album erstellt von:", + 'album:by' => "Album erstellt von", 'album:created:on' => "Erstellt", - 'image:none' => "Noch keine Bilder hinzugefügt.", + 'image:none' => "Es wurden noch keine Bilder hinzugefügt.", 'image:back' => "Vorheriges", 'image:next' => "Nächstes", + 'image:index' => "%u von %u", // tagging - 'tidypics:taginstruct' => 'Wähle ein Bereich auf dem Foto den du Verlinken willst', - 'tidypics:deltag_title' => 'Wähle zu löschende Links', - 'tidypics:finish_tagging' => 'Abbrechen', - 'tidypics:tagthisphoto' => 'Link zum Foto hinzufügen', - 'tidypics:deletetag' => 'Lösche Foto-Link', - 'tidypics:actiontag' => 'Link', - 'tidypics:actiondelete' => 'Löschen', + 'tidypics:taginstruct' => 'Wähle den Bereich auf dem Bild, für das Du ein Tag setzen willst, oder %s.', + 'tidypics:finish_tagging' => 'Taggen beenden', + 'tidypics:deltag_title' => 'Wähle die Tags, die gelöscht werden sollen', + 'tidypics:finish_tagging' => 'Tagging abbrechen', + 'tidypics:tagthisphoto' => 'Bild taggen', + 'tidypics:actiontag' => 'Tag setzen', 'tidypics:actioncancel' => 'Abbrechen', - 'tidypics:inthisphoto' => 'Links in dem Foto', - 'tidypics:usertag' => "Foto verlinkt mit Mitglied %s", - 'tidypics:phototagging:success' => 'Foto-Link erfolgreich hinzugefügt', - 'tidypics:phototagging:error' => 'Unerwarteter Fehler beim verlinken', - 'tidypics:deletetag:success' => 'Ausgewählte Links wurden erfolgreich gelöscht', - 'tidypics:tag:subject' => "Du wurdest in einem Foto verlinkt", - 'tidypics:tag:body' => "Du wurdest in diesem Foto verlinkt %s von %s. - -Das Foto kanns du hier sehen: %s", + 'tidypics:inthisphoto' => 'Tags in diesem Bild', + 'tidypics:usertag' => "Bilder mit Tags, die sich auf %s beziehen", + 'tidypics:phototagging:success' => 'Das Bild wurde getaggt.', + 'tidypics:phototagging:error' => 'Beim Hinzufügen des Tags ist ein Fehler aufgetreten.', + + 'tidypics:phototagging:delete:success' => 'Das Tag wurde entfernt.', + 'tidypics:phototagging:delete:error' => 'Beim Entfernen des Tags ist ein Fehler aufgetreten.', + 'tidypics:phototagging:delete:confirm' => 'Dieses Tag entfernen?', + + 'tidypics:tag:subject' => "Du wurdest in einem Bild getaggt", + 'tidypics:tag:body' => "Du wurdest im Bild %s von %s getaggt. + +Um das Bild zu sehen, folge diesem Link: %s", //rss - 'tidypics:posted' => 'Das Bild eingestellt:', + 'tidypics:posted' => 'hat ein Bild hinzugefügt:', //widgets - 'tidypics:widget:albums' => "Fotoalben", - 'tidypics:widget:album_descr' => "Zeige neuste Alben", - 'tidypics:widget:num_albums' => "Anzahl der Alben", - 'tidypics:widget:latest' => "Neuste Bilder", - 'tidypics:widget:latest_descr' => "Zeige neuste Bilder", - 'tidypics:widget:num_latest' => "Anzahl der Bilder", - 'album:more' => "Alle Alben ansehen", + 'tidypics:widget:albums' => "Bilderalben", + 'tidypics:widget:album_descr' => "Auflistung Deiner neuesten Bilderalben", + 'tidypics:widget:num_albums' => "Anzahl der anzuzeigenden Alben", + 'tidypics:widget:latest' => "Neueste Bilder", + 'tidypics:widget:latest_descr' => "Auflistung Deiner neuesten Bilder", + 'tidypics:widget:num_latest' => "Anzahl der anzuzeigenden Bilder", + 'album:more' => "Alle Alben anzeigen", //river - 'image:river:created' => "%s hat ein Bild %s zum Album %s hinzugefügt", + 'river:create:object:image' => "%s hat das Bild %s hochgeladen.", + 'image:river:created' => "%s hat ein Bild zum Album %s hinzugefügt.", + 'image:river:created:multiple' => "%s hat %u Bilder zum Album %s hinzugefügt.", 'image:river:item' => "ein Bild", 'image:river:annotate' => "einen Kommentar zum Bild", - 'image:river:tagged' => "war im Foto verlinkt", - 'album:river:created' => "%s hat ein neues Album erstellt", + 'image:river:tagged' => "%s hat %s im Bild %s getaggt.", + 'image:river:tagged:unknown' => "%s hat %s in einem Bild getaggt.", + 'river:create:object:album' => "%s hat das neue Bilderalbum %s hinzugefügt.", 'album:river:group' => "in der Gruppe", 'album:river:item' => "ein Album", - 'album:river:annotate' => "einen Kommentar zum Album", - - //notifications - 'tidypics:newalbum' => 'Neues Fotoalbum', + 'album:river:annotate' => "einen Kommentar zum Bilderalbum", + 'river:comment:object:image' => '%s hat einen Kommentar zum Bild %s geschrieben.', + 'river:comment:object:album' => '%s hat einen Kommentar zum Bilderalbum %s geschrieben.', + // notifications + 'tidypics:newalbum_subject' => 'Neues Bilderalbum', + 'tidypics:newalbum' => '%s hat ein neues Bilderalbum hinzugefügt.', + 'tidypics:updatealbum' => "%s hat neue Bilder zum Album %s hinzugefügt.", // Status messages - 'tidypics:upl_success' => "Die Bilder sind erfolgreich hochgeladen", - 'image:saved' => "Das Bild wurde gespeichert", - 'images:saved' => "Alle Bilder sind gespeichert", - 'image:deleted' => "Das Bild wurde gelöscht", - 'image:delete:confirm' => "Willst du das Bild wirklich löschen?", - 'images:edited' => "Das Bild wurde aktualisiert", - 'album:edited' => "Das Album wurde aktualisiert", - 'album:saved' => "Das Album wurde gespeichert", - 'album:deleted' => "Das Album wurde gelöscht", - 'album:delete:confirm' => "Willst du das Album wirklich löschen?", - 'album:created' => "Dein neues Album ist erstellt", - 'tidypics:settings:save:ok' => 'Tidypics Einstellungen erfolgreich gespeichert', - 'tidypics:upgrade:success' => 'Upgrade von Tidypics erfolgreich', + 'tidypics:upl_success' => "Deine Bilder wurden hochgeladen.", + 'image:saved' => "Das Bild wurde gespeichert.", + 'images:saved' => "Alle Bilder wurden gespeichert.", + 'image:deleted' => "Das Bild wurde gelöscht.", + 'image:delete:confirm' => "Bist Du sicher, dass Du das Bild löschen willst?", + 'images:edited' => "Die Einstellungen für Deine Bilder wurden aktualisiert.", + 'album:edited' => "Die Einstellungen für Dein Album wurden aktualisiert.", + 'album:saved' => "Das Album wurde hinzugefügt.", + 'album:deleted' => "Das Album wurde gelöscht.", + 'album:delete:confirm' => "Bist Du sicher, dass Du das Album löschen willst?", + 'album:created' => "Dein neues Album wurde hinzugefügt.", + 'album:save_cover_image' => 'Das Albumcover wurde gespeichert.', + 'tidypics:settings:save:ok' => 'Die Einstellungen für das Tidypics-Plugin wurden gespeichert.', + 'tidypics:album:sorted' => 'Das Bilderalbum %s wurde umsortiert.', + 'tidypics:album:could_not_sort' => 'Das Bilderalbum %s konnte nicht umsortiert werden. Vergewissere Dich, dass in diesem Album Bilder vorhanden sind und versuche es noch einmal.', + 'tidypics:upgrade:success' => 'Das Upgrade des Tidypics-Plugins war erfolgreich.', //Error messages - 'tidypics:partialuploadfailure' => "Es sind Fehler beim Hochladen einiger Bilder aufgetreten (%s von %s Bildern)", - 'tidypics:completeuploadfailure' => "Bilder-Upload fehlgeschlagen", - 'tidypics:exceedpostlimit' => "Zuviele große Bilder auf einmal - versuche weniger oder kleinere Bilder hochzuladen", - 'tidypics:noimages' => "Keine Bilder zum Upload ausgewählt", - 'tidypics:image_mem' => "Das Bild ist zu groß", - 'tidypics:image_pixels' => "Das Bild hat zuviele Pixel", - 'tidypics:unk_error' => "Unbekannte Fehler beim Upload ", - 'tidypics:save_error' => "Unbekanntes Fehler beim speichern des Bildes auf dem Server", - 'tidypics:not_image' => "Das Bild-Typ wurde nicht erkannt", - 'image:deletefailed' => "Dein Bild konnte nicht gelöscht werden", - 'image:downloadfailed' => "Fehler: Das Bild ist zur Zeit nicht verfügbar", - 'tidypics:nosettings' => "Admin dieser Seite hat keine Einstellungen für Fotoalben vorgenommen", - 'tidypics:exceed_quota' => "Dir zugewiesener Speicherplatz ist ausgeschöpft!", - 'images:notedited' => "Nicht alle Bilder konnten erfolgreich upgedated werden", - 'album:none' => "Bis jetzt keine Alben erstellt", - 'album:uploadfailed' => "Dein Album konnte nicht gespeichert werden", - 'album:deletefailed' => "Dein Album konnte nicht gelöscht werden", - 'album:blank' => "Bitte gib diesem Album einen Titel und eine Beschreibung", - 'tidypics:upgrade:failed' => "Upgrade von Tidypics gescheitert", -); - -add_translation("de", $german); + 'tidypics:baduploadform' => "Es gab ein unerwartetes Problem mit dem Uploader.", + 'tidypics:partialuploadfailure' => "Beim Hochladen einiger Bilder sind Fehler aufgetreten (bei %s von %s Bildern).", + 'tidypics:completeuploadfailure' => "Das Hochladen der Bilder ist fehlgeschlagen.", + 'tidypics:exceedpostlimit' => "Zu viele große Bilder auf einmal - versuche weniger Bilder auf einmal oder kleinere Bilder hochzuladen.", + 'tidypics:noimages' => "Es wurden keine Bilder zum Hochladen ausgewählt.", + 'tidypics:image_mem' => "Die Bilddatei ist zu groß.", + 'tidypics:image_pixels' => "Das Bild hat zu viele Pixel.", + 'tidypics:unk_error' => "Unbekannter Fehler beim Hochladen.", + 'tidypics:save_error' => "Unbekannter Fehler beim Speichern des Bildes auf dem Server.", + 'tidypics:not_image' => "Das Dateiformat des Bildes wurde nicht erkannt oder wird nicht unterstützt.", + 'tidypics:deletefailed' => "Beim Löschen ist ein Fehler aufgetreten.", + 'tidypics:deleted' => "Das Löschen war erfolgreich.", + 'tidypics:nosettings' => "Der Administrator dieser Community-Seite hat leider bisher keine Einstellungen für Bilderalben vorgenommen.", + 'tidypics:exceed_quota' => "Du hast die von Administrator dieser Community-Seite gesetze Quota für Bilder überschritten.", + 'tidypics:cannot_upload_exceeds_quota' => 'Das Bild wurde nicht hochgeladen. Die Dateigröße übersteigt die verfügbare Quota.', + + 'album:none' => "Es wurden noch keine Alben hinzugefügt.", + 'album:uploadfailed' => "Beim Hinzufügen des Bilderalbums ist ein Fehler aufgetreten.", + 'album:deletefailed' => "Beim Löschen des Bilderalbums ist ein Fehler aufgetreten.", + 'album:blank' => "Bitte gib diesem Album einen Titel.", + 'album:invalid_album' => 'Unzulässiges Bilderalbum.', + 'album:cannot_save_cover_image' => 'Das Albumcover kann nicht gespeichert werden.', + + 'image:downloadfailed' => "Entschuldigung. Das Bild ist nicht verfügbar.", + 'images:notedited' => "Es konnten nicht alle Bilder fehlerfrei hochgeladen werden.", + 'image:blank' => 'Bitte gib diesem Bild einen Titel.', + 'image:error' => 'Das Bild konnte nicht gespeichert werden.', + + 'tidypics:upgrade:failed' => "Das Upgrade des Tidypics-Plugins ist gescheitert", + ); + + add_translation("de",$german); -- cgit v1.2.3 From 3cc5e98299630bf2acae83ec964343309d16392e Mon Sep 17 00:00:00 2001 From: Sem Date: Sat, 28 Jul 2012 20:03:37 +0200 Subject: Removed watermark utility. --- languages/da.php | 1 - languages/de.php | 1 - languages/en.php | 1 - languages/es.php | 1 - languages/fr.php | 1 - languages/he.php | 1 - lib/resize.php | 17 +- lib/watermark.php | 193 --------------------- views/default/forms/photos/admin/settings/main.php | 8 - 9 files changed, 1 insertion(+), 223 deletions(-) delete mode 100644 lib/watermark.php diff --git a/languages/da.php b/languages/da.php index 78113d467..37ab3bfc6 100644 --- a/languages/da.php +++ b/languages/da.php @@ -63,7 +63,6 @@ $danish = array( 'tidypics:settings:grp_perm_override' => "Giv gruppens medlemmer fuld adgang til gruppe-album", 'tidypics:settings:maxfilesize' => "Maksimal billedstørrelse i megabytes (MB):", 'tidypics:settings:quota' => "Tildelt plads til brugere / grupper (MB) (0 = Ingen plads)", - 'tidypics:settings:watermark' => "Indtast teksten for vandmærke - ImageMagick cmdline skal vælges for billedbiblioteket", 'tidypics:settings:im_path' => "Angiv stien til ImageMagick kommandoer (som slutter med et Slash/)", 'tidypics:settings:img_river_view' => "Hvor mange poster i aktivitetslisten for hvert parti af uploadede billeder", 'tidypics:settings:album_river_view' => "Vis albumcover eller et sæt af fotos til nye album", diff --git a/languages/de.php b/languages/de.php index 1f439e981..a02f34f89 100644 --- a/languages/de.php +++ b/languages/de.php @@ -72,7 +72,6 @@ $german = array( 'tidypics:settings:grp_perm_override' => "Gruppen-Mitgliedern unbeschränkten Zugriff auf die Verwaltung von Gruppen-Alben geben", 'tidypics:settings:maxfilesize' => "Maximal erlaubte Bildgröße in Megabytes (MB):", 'tidypics:settings:quota' => "Quota für Benutzer in Megabytes (MB) (0 = kein Quota)", - 'tidypics:settings:watermark' => "Gib den Text ein, der als Wasserzeichen eingefügt wird", 'tidypics:settings:im_path' => "Der Pfad zu den ImageMagick-Kommandozeilentools auf dem Server", 'tidypics:settings:img_river_view' => "Anzahl der Einträge im River beim gleichzeitigen Hochladen mehrerer Bilder", 'tidypics:settings:album_river_view' => "Anzeige des Albumcovers oder eines Sets von Bildern für neue Alben", diff --git a/languages/en.php b/languages/en.php index 62b43673d..6f3f8a0d6 100644 --- a/languages/en.php +++ b/languages/en.php @@ -72,7 +72,6 @@ $english = array( 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums", 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):", 'tidypics:settings:quota' => "User Quota (MB) - 0 equals no quota", - 'tidypics:settings:watermark' => "Enter text to appear in the watermark", 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands", 'tidypics:settings:img_river_view' => "How many entries in activity river for each batch of uploaded images", 'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album", diff --git a/languages/es.php b/languages/es.php index 704f01979..b6cbf723c 100644 --- a/languages/es.php +++ b/languages/es.php @@ -59,7 +59,6 @@ $spanish = array( 'tidypics:settings:grp_perm_override' => "Permitir acceso completo a los miembros de este grupo al album de fotos", 'tidypics:settings:maxfilesize' => "Tamaño máximo de la imagen en megabytes (MB):", 'tidypics:settings:quota' => "Usuario/Grupo Cuota (MB) - 0 MB de cuota", - 'tidypics:settings:watermark' => "Introduce el texto que aparecerá en la marca de agua - ImageMagick Cmdline debe ser seleccionado para la libreria de imagenes", 'tidypics:settings:im_path' => "Ingresa la ruta de tu ImageMagick commands (incluye el slash)", 'tidypics:settings:img_river_view' => "¿Cuántas entradas deseas para cada grupo de imágenes cargadas?", 'tidypics:settings:album_river_view' => "Muestra la portada del álbum o el set de fotos para el álbum nuevo", diff --git a/languages/fr.php b/languages/fr.php index 375159e0b..0ca141ea2 100644 --- a/languages/fr.php +++ b/languages/fr.php @@ -59,7 +59,6 @@ $french = array( 'tidypics:settings:grp_perm_override' => "Autoriser l'acés total aux membres du groupe" , 'tidypics:settings:maxfilesize' => "Taille maximum des images en Mb:" , 'tidypics:settings:quota' => "Quota Utilisateur/Groupe (Mb) - O égal pas de quota" , - 'tidypics:settings:watermark' => "Entrez le texte qui doit figure sur le WaterMark - fonction non vraiment sure." , 'tidypics:settings:im_path' => "Chemin de l'exécutable ImageMagick, terminé par un slash" , 'tidypics:settings:img_river_view' => "Combien d'entrées dans le river pour chaque lot de traitement des fichiers chargés" , 'tidypics:settings:album_river_view' => "Montrer la couverture de l'album ou un ensemble de photos pour tout nouvel album" , diff --git a/languages/he.php b/languages/he.php index 5f232daf6..ebb3608aa 100644 --- a/languages/he.php +++ b/languages/he.php @@ -54,7 +54,6 @@ $hebrew = array( 'tidypics:settings:grp_perm_override' => "אפשר לחברי קבוצה גישה מלאה לאלבומים קבוצתיים" , 'tidypics:settings:maxfilesize' => "גודל תמונה מירבי בMB" , 'tidypics:settings:quota' => "מכסה בMB למשתמש/קבוצה - 0 שווה ללא מכסה" , - 'tidypics:settings:watermark' => "הזן טקסט אשר יופיע בסימן המים - יש לבחור ב ImageMagick Cmdline עבור ספריית התמונות" , 'tidypics:settings:im_path' => "הזן את הנטיב לפקודות ImageMagick ללא לוכסן בסוף" , 'tidypics:settings:img_river_view' => "כמה רשומות במה חדש עבור כל מקבץ תמונות אשר נוסף" , 'tidypics:settings:album_river_view' => "הצג תמונה אחת או מקבץ תמונות עבור אלבום חדש" , diff --git a/lib/resize.php b/lib/resize.php index b06f317ca..380e0c406 100644 --- a/lib/resize.php +++ b/lib/resize.php @@ -5,8 +5,6 @@ * @package TidypicsImageResize */ -include dirname(__FILE__) . "/watermark.php"; - /** * Create thumbnails using PHP GD Library @@ -37,7 +35,6 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) { $thumbname = $thumb->getFilenameOnFilestore(); $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(), $thumbname, - FALSE, $image_sizes['tiny_image_width'], $image_sizes['tiny_image_height'], TRUE); @@ -53,7 +50,6 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) { $thumbname = $thumb->getFilenameOnFilestore(); $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(), $thumbname, - FALSE, $image_sizes['small_image_width'], $image_sizes['small_image_height'], TRUE); @@ -68,7 +64,6 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) { $thumbname = $thumb->getFilenameOnFilestore(); $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(), $thumbname, - TRUE, $image_sizes['large_image_width'], $image_sizes['large_image_height'], FALSE); @@ -89,13 +84,12 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) { * * @param string $input_name The name of the file on the disk * @param string $output_name The name of the file to be written - * @param bool - watermark this image? * @param int $maxwidth The maximum width of the resized image * @param int $maxheight The maximum height of the resized image * @param TRUE|FALSE $square If set to TRUE, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped. * @return bool TRUE on success or FALSE on failure */ -function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheight, $square = FALSE, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) { +function tp_gd_resize($input_name, $output_name, $maxwidth, $maxheight, $square = FALSE, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) { // Get the size information from the image $imgsizearray = getimagesize($input_name); @@ -159,10 +153,6 @@ function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheig return $rtn_code; } - if ($watermark) { - tp_gd_watermark($newimage); - } - switch ($imgsizearray['mime']) { case 'image/jpeg': case 'image/pjpeg': @@ -243,8 +233,6 @@ function tp_create_imagick_thumbnails($file, $prefix, $filestorename) { } $file->largethumb = $prefix."largethumb".$filestorename; - tp_imagick_watermark($thumbname); - unset($thumb); return TRUE; @@ -370,9 +358,6 @@ function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) { } $file->largethumb = $prefix."largethumb".$filestorename; - - tp_im_cmdline_watermark($thumbname); - unset($thumb); return TRUE; diff --git a/lib/watermark.php b/lib/watermark.php deleted file mode 100644 index f7c228af1..000000000 --- a/lib/watermark.php +++ /dev/null @@ -1,193 +0,0 @@ -name, $text); - $text = str_replace("%sitename%", $CONFIG->sitename, $text); - - return $text; -} - -/** - * Create the watermark image filename - * - * @param string $text - * @param ElggUser $owner - * @return string - */ -function tp_get_watermark_filename($text, $owner) { - - $base = elgg_strtolower($text); - $base = preg_replace("/[^\w-]+/", "-", $base); - $base = trim($base, '-'); - - $filename = tp_get_img_dir(); - $filename .= elgg_strtolower($owner->username . "_" . $base . "_stamp"); - - return $filename; -} - -/** - * Use GD to apply watermark to image - * - * @param resource $image GD image resource - */ -function tp_gd_watermark($image) { - global $CONFIG; - - $watermark_text = elgg_get_plugin_setting('watermark_text', 'tidypics'); - if (!$watermark_text) { - return; - } - - // plugins can do their own watermark and return false to prevent this function from running - if (elgg_trigger_plugin_hook('tp_watermark', 'gd', $image, true) === false) { - return; - } - - $owner = elgg_get_logged_in_user_entity(); - - $watermark_text = tp_process_watermark_text($watermark_text, $owner); - - // transparent gray - imagealphablending($image, true); - $textcolor = imagecolorallocatealpha($image, 50, 50, 50, 60); - - // font and location - $font = $CONFIG->pluginspath . "tidypics/fonts/LiberationSerif-Regular.ttf"; - $bbox = imagettfbbox(20, 0, $font, $watermark_text); - - $text_width = $bbox[2] - $bbox[0]; - $text_height = $bbox[1] - $bbox[7]; - - $image_width = imagesx($image); - $image_height = imagesy($image); - - $left = $image_width / 2 - $text_width / 2; - $top = $image_height - 20; - - // write the text on the image - imagettftext($image, 20, 0, $left, $top, $textcolor, $font, $watermark_text); -} - -/** - * imagick watermarking - * - * @param string $filename - * @return bool - */ -function tp_imagick_watermark($filename) { - - $watermark_text = elgg_get_plugin_setting('watermark_text', 'tidypics'); - if (!$watermark_text) { - return false; - } - - // plugins can do their own watermark and return false to prevent this function from running - if (elgg_trigger_plugin_hook('tp_watermark', 'imagick', $filename, true) === false) { - return true; - } - - $owner = elgg_get_logged_in_user_entity(); - - $watermark_text = tp_process_watermark_text($watermark_text, $owner); - - $img = new Imagick($filename); - - $img->readImage($image); - - $draw = new ImagickDraw(); - - //$draw->setFont(""); - - $draw->setFontSize(28); - - $draw->setFillOpacity(0.5); - - $draw->setGravity(Imagick::GRAVITY_SOUTH); - - $img->annotateImage($draw, 0, 0, 0, $watermark_text); - - if ($img->writeImage($filename) != true) { - $img->destroy(); - return false; - } - - $img->destroy(); - - return true; -} - -/** - * ImageMagick watermarking - * - * @param string $filename - */ -function tp_im_cmdline_watermark($filename) { - - $watermark_text = elgg_get_plugin_setting('watermark_text', 'tidypics'); - if (!$watermark_text) { - return; - } - - // plugins can do their own watermark and return false to prevent this function from running - if (elgg_trigger_plugin_hook('tp_watermark', 'imagemagick', $filename, true) === false) { - return; - } - - $im_path = elgg_get_plugin_setting('im_path', 'tidypics'); - if (!$im_path) { - $im_path = "/usr/bin/"; - } - - // make sure end of path is / - if (substr($im_path, strlen($im_path)-1, 1) != "/") { - $im_path .= "/"; - } - - - $owner = elgg_get_logged_in_user_entity(); - - $watermark_text = tp_process_watermark_text($watermark_text, $owner); - - $ext = ".png"; - - $user_stamp_base = tp_get_watermark_filename($watermark_text, $owner); - - - if ( !file_exists( $user_stamp_base . $ext )) { - //create the watermark image if it doesn't exist - $commands = array(); - $commands[] = $im_path . 'convert -size 300x50 xc:grey30 -pointsize 20 -gravity center -draw "fill grey70 text 0,0 \''. $watermark_text . '\'" "'. $user_stamp_base . '_fgnd' . $ext . '"'; - $commands[] = $im_path . 'convert -size 300x50 xc:black -pointsize 20 -gravity center -draw "fill white text 1,1 \''. $watermark_text . '\' text 0,0 \''. $watermark_text . '\' fill black text -1,-1 \''. $watermark_text . '\'" +matte ' . $user_stamp_base . '_mask' . $ext; - $commands[] = $im_path . 'composite -compose CopyOpacity "' . $user_stamp_base . "_mask" . $ext . '" "' . $user_stamp_base . '_fgnd' . $ext . '" "' . $user_stamp_base . $ext . '"'; - $commands[] = $im_path . 'mogrify -trim +repage "' . $user_stamp_base . $ext . '"'; - $commands[] = 'rm "' . $user_stamp_base . '_mask' . $ext . '"'; - $commands[] = 'rm "' . $user_stamp_base . '_fgnd' . $ext . '"'; - - foreach( $commands as $command ) { - exec( $command ); - } - } - - //apply the watermark - $commands = array(); - $commands[] = $im_path . 'composite -gravity south -geometry +0+10 "' . $user_stamp_base . $ext . '" "' . $filename . '" "' . $filename . '_watermarked"'; - $commands[] = "mv \"$filename" . "_watermarked\" \"$filename\""; - foreach( $commands as $command ) { - exec( $command ); - } -} diff --git a/views/default/forms/photos/admin/settings/main.php b/views/default/forms/photos/admin/settings/main.php index c99b9d688..c2ae523c1 100644 --- a/views/default/forms/photos/admin/settings/main.php +++ b/views/default/forms/photos/admin/settings/main.php @@ -27,14 +27,6 @@ echo elgg_view('input/text', array( )); echo ''; -// Watermark Text -echo '
      ' . elgg_echo('tidypics:settings:watermark'); -echo elgg_view("input/text", array( - 'name' => 'params[watermark_text]', - 'value' => $plugin->watermark_text, -)); -echo '
      '; - // Quota Size $quota = $plugin->quota; if (!$quota) { -- cgit v1.2.3 From 0fa29b2fd0501a2fde5e086be5da22fe1f47f040 Mon Sep 17 00:00:00 2001 From: Sem Date: Sat, 28 Jul 2012 21:12:24 +0200 Subject: Removed flash uploader. --- actions/photos/image/ajax_upload.php | 57 ------------- actions/photos/image/ajax_upload_complete.php | 74 ----------------- languages/da.php | 1 - languages/de.php | 4 +- languages/en.php | 4 +- languages/es.php | 1 - languages/fr.php | 1 - languages/it.php | 1 - pages/photos/image/upload.php | 10 +-- start.php | 94 +--------------------- views/default/forms/photos/admin/settings/main.php | 2 +- views/default/forms/photos/ajax_upload.php | 54 ------------- views/default/js/photos/uploading.php | 94 ---------------------- views/default/photos/css.php | 59 -------------- 14 files changed, 5 insertions(+), 451 deletions(-) delete mode 100644 actions/photos/image/ajax_upload.php delete mode 100644 actions/photos/image/ajax_upload_complete.php delete mode 100644 views/default/forms/photos/ajax_upload.php delete mode 100644 views/default/js/photos/uploading.php diff --git a/actions/photos/image/ajax_upload.php b/actions/photos/image/ajax_upload.php deleted file mode 100644 index 312bc598c..000000000 --- a/actions/photos/image/ajax_upload.php +++ /dev/null @@ -1,57 +0,0 @@ -container_guid = $album->getGUID(); -$image->setMimeType($mime); -$image->access_id = $album->access_id; -$image->batch = $batch; - -try { - $image->save($file); - $album->prependImageList(array($image->guid)); - - if (elgg_get_plugin_setting('img_river_view', 'tidypics') === "all") { - add_to_river('river/object/image/create', 'create', $image->getOwnerGUID(), $image->getGUID()); - } - - echo elgg_echo('success'); -} catch (Exception $e) { - // remove the bits that were saved - $image->delete(); - echo $e->getMessage(); -} - -exit; \ No newline at end of file diff --git a/actions/photos/image/ajax_upload_complete.php b/actions/photos/image/ajax_upload_complete.php deleted file mode 100644 index 358a4fc6f..000000000 --- a/actions/photos/image/ajax_upload_complete.php +++ /dev/null @@ -1,74 +0,0 @@ - 'object', - 'subtype' => 'image', - 'metadata_names' => 'batch', - 'metadata_values' => $batch, - 'limit' => 0 -); - -$images = elgg_get_entities_from_metadata($params); -if ($images) { - // Create a new batch object to contain these photos - $batch = new ElggObject(); - $batch->subtype = "tidypics_batch"; - $batch->access_id = ACCESS_PUBLIC; - $batch->container_guid = $album->guid; - - if ($batch->save()) { - foreach ($images as $image) { - add_entity_relationship($image->guid, "belongs_to_batch", $batch->getGUID()); - } - } -} else { - // @todo some sort of message to edit them manually. - exit; -} - -// "added images to album" river -if ($img_river_view == "batch" && $album->new_album == false) { - add_to_river('river/object/tidypics_batch/create', 'create', $batch->getOwnerGUID(), $batch->getGUID()); -} - -// "created album" river -if ($album->new_album) { - $album->new_album = false; - $album->first_upload = true; - - add_to_river('river/object/album/create', 'create', $album->getOwnerGUID(), $album->getGUID()); - - // "created album" notifications - // we throw the notification manually here so users are not told about the new album until - // there are at least a few photos in it - if ($album->shouldNotify()) { - object_notifications('create', 'object', $album); - $album->last_notified = time(); - } -} else { - // "added image to album" notifications - if ($album->first_upload) { - $album->first_upload = false; - } - - if ($album->shouldNotify()) { - object_notifications('create', 'object', $album); - $album->last_notified = time(); - } -} - -echo json_encode(array('batch_guid' => $batch->getGUID())); -exit; \ No newline at end of file diff --git a/languages/da.php b/languages/da.php index 78113d467..c90e8f55d 100644 --- a/languages/da.php +++ b/languages/da.php @@ -92,7 +92,6 @@ $danish = array( 'tidypics:uploader:choose' => "Vælg fotos", 'tidypics:uploader:upload' => "Upload fotos", 'tidypics:uploader:describe' => "Beskriv fotos", - 'tidypics:uploader:instructs' => 'Med tre nemme trin kan du tilføje fotos i dit album ved hjælp af denne uploader: vælg, upload og beskriv fotos. Hvis du ikke har Flash, er der også en standard uploader til rådighed.', 'tidypics:uploader:basic' => 'Du kan uploade op til 10 fotos ad gangen (%s MB maksimum pr. foto)', 'tidypics:sort:instruct' => 'Sortér fotos i albummet ved hjælp af drag and drop. Klik derefter på knappen Gem.', diff --git a/languages/de.php b/languages/de.php index 1f439e981..b6817c589 100644 --- a/languages/de.php +++ b/languages/de.php @@ -68,7 +68,6 @@ $german = array( 'tidypics:settings:photo_ratings' => "Bewerten von Bildern erlauben (benötigt das Elggx Fivestar-Plugin oder ein vergleichbares)", 'tidypics:settings:exif' => "EXIF-Daten anzeigen", 'tidypics:settings:view_count' => "Zugriffszähler anzeigen", - 'tidypics:settings:uploader' => "Flash-Uploader verwenden", 'tidypics:settings:grp_perm_override' => "Gruppen-Mitgliedern unbeschränkten Zugriff auf die Verwaltung von Gruppen-Alben geben", 'tidypics:settings:maxfilesize' => "Maximal erlaubte Bildgröße in Megabytes (MB):", 'tidypics:settings:quota' => "Quota für Benutzer in Megabytes (MB) (0 = kein Quota)", @@ -101,8 +100,7 @@ $german = array( 'tidypics:server_info:post_max_size_desc' => '"Max post size" abzüglich der Größe der HTML-Form = Maximal mögliche Gesamtgröße von gleichzeitig hochzuladenden Bildern.', 'tidypics:server_info:max_input_time_desc' => 'Maximale erlaubte Dauer, in der das Hochladen von Daten auf den Server abgeschlossen sein muss.', 'tidypics:server_info:max_execution_time_desc' => 'Maximal erlaubte Ausführdauer für ein Skript auf dem Server.', - 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions können den Flash-Uploader beeinträchtigen.', - + 'tidypics:server_info:php_version' => 'PHP-Version', 'tidypics:server_info:memory_limit' => 'Für PHP verfügbarer Speicher', 'tidypics:server_info:peak_usage' => 'Genutzer Speicher, um diese Seite zu laden', diff --git a/languages/en.php b/languages/en.php index 62b43673d..1c40e5e0a 100644 --- a/languages/en.php +++ b/languages/en.php @@ -68,7 +68,6 @@ $english = array( 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)", 'tidypics:settings:exif' => "Display EXIF data", 'tidypics:settings:view_count' => "Display view count", - 'tidypics:settings:uploader' => "Use Flash uploader", 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums", 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):", 'tidypics:settings:quota' => "User Quota (MB) - 0 equals no quota", @@ -101,8 +100,7 @@ $english = array( 'tidypics:server_info:post_max_size_desc' => 'Max post size = sum of images + html form', 'tidypics:server_info:max_input_time_desc' => 'Time script waits for upload to finish', 'tidypics:server_info:max_execution_time_desc' => 'Max time a script will run', - 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions may affect the Flash uploader', - + 'tidypics:server_info:php_version' => 'PHP Version', 'tidypics:server_info:memory_limit' => 'Memory Available to PHP', 'tidypics:server_info:peak_usage' => 'Memory Used to Load This Page', diff --git a/languages/es.php b/languages/es.php index 704f01979..efe65d976 100644 --- a/languages/es.php +++ b/languages/es.php @@ -11,7 +11,6 @@ $spanish = array( 'caption' => "Título", 'photos' => "Fotos", 'images:upload' => "Cargar Imagenes", - 'images:multiupload' => "Herramienta MultiCarga de Flash", 'images:multiupload:todo' => "Selecciona uno a más archivos para cargar..", 'album' => "Álbum de Fotos", 'albums' => "Álbumnes de Fotos", diff --git a/languages/fr.php b/languages/fr.php index 375159e0b..1c653daa1 100644 --- a/languages/fr.php +++ b/languages/fr.php @@ -9,7 +9,6 @@ $french = array( 'caption' => "Légende" , 'photos' => "Photos" , 'images:upload' => "Charger des images" , - 'images:multiupload' => "Outil Flash de chargement multi fichiers" , 'images:multiupload:todo' => "Sélectionnez un ou plusieurs fichiers à charger." , 'album' => "Album photo" , 'albums' => "Albums photo" , diff --git a/languages/it.php b/languages/it.php index 764ecf5f7..27a9654a6 100644 --- a/languages/it.php +++ b/languages/it.php @@ -51,7 +51,6 @@ $italian = array( 'tidypics:uploader:choose' => "Scegli le Foto", 'tidypics:uploader:upload' => "Carica le Foto", 'tidypics:uploader:describe' => "Descrivi le Foto", - 'tidypics:uploader:instructs' => 'Ci sono tre semplici passaggi per aggiungere le Foto al tuo Album usando questo caricatore: la scelta, il caricamento e il descriverle. Se non hai Flash, è disponibile anche un caricatore di base.', 'tidypics:uploader:basic' => 'Puoi caricare fino a 10 Foto alla volta (%s MB massimo per foto)', 'tidypics:sort:instruct' => 'Ordina i Foto Album trascinando le immagini. Poi clicca il bottone salva.', diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php index 425d5689a..61be8523b 100644 --- a/pages/photos/image/upload.php +++ b/pages/photos/image/upload.php @@ -38,15 +38,7 @@ elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username"); elgg_push_breadcrumb($album->getTitle(), $album->getURL()); elgg_push_breadcrumb(elgg_echo('album:addpix')); -$uploader = get_input('uploader'); -if ($uploader == 'basic') { - $content = elgg_view('forms/photos/basic_upload', array('entity' => $album)); -} else { - elgg_load_js('swfobject'); - elgg_load_js('jquery.uploadify-tp'); - elgg_load_js('tidypics:uploading'); - $content = elgg_view('forms/photos/ajax_upload', array('entity' => $album)); -} +$content = elgg_view('forms/photos/basic_upload', array('entity' => $album)); $body = elgg_view_layout('content', array( 'content' => $content, diff --git a/start.php b/start.php index 1e851b8f3..45e9257f5 100644 --- a/start.php +++ b/start.php @@ -41,14 +41,9 @@ function tidypics_init() { $js = elgg_get_simplecache_url('js', 'photos/tagging'); elgg_register_simplecache_view('js/photos/tagging'); elgg_register_js('tidypics:tagging', $js, 'footer'); - $js = elgg_get_simplecache_url('js', 'photos/uploading'); - elgg_register_simplecache_view('js/photos/uploading'); - elgg_register_js('tidypics:uploading', $js, 'footer'); elgg_register_js('tidypics:slideshow', 'mod/tidypics/vendors/PicLensLite/piclens_optimized.js', 'footer'); - elgg_register_js('swfobject', 'mod/tidypics/vendors/uploadify/swfobject.js', 'footer'); - elgg_register_js('jquery.uploadify-tp', 'mod/tidypics/vendors/uploadify/jquery.uploadify.v2.1.1.min.js', 'footer'); - + // Add photos link to owner block/hover menus elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu'); @@ -81,12 +76,6 @@ function tidypics_init() { register_notification_object('object', 'album', elgg_echo('tidypics:newalbum_subject')); elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'tidypics_notify_message'); - // allow people in a walled garden to use flash uploader - elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'tidypics_walled_garden_override'); - - // flash session work around for uploads when use_only_cookies is set - elgg_register_plugin_hook_handler('forward', 'csrf', 'tidypics_ajax_session_handler'); - // Register actions $base_dir = elgg_get_plugins_path() . 'tidypics/actions/photos'; elgg_register_action("photos/delete", "$base_dir/delete.php"); @@ -439,87 +428,6 @@ function tidypics_notify_message($hook, $type, $result, $params) { return null; } -/** - * Allows the flash uploader actions through walled garden since - * they come without the session cookie - */ -function tidypics_walled_garden_override($hook, $type, $pages) { - $pages[] = 'action/photos/image/ajax_upload'; - $pages[] = 'action/photos/image/ajax_upload_complete'; - return $pages; -} - -/** - * Work around for Flash/session issues - * - * Catches Elgg attempting to forward the Flash uploader because it doesn't - * have a session cookie. Instead manually runs the action. - * - * @param string $hook The name of the hook - * @param string $type The type of the hook - * @param string $value Location being forwarded to - * @param array $params Parameters related to the forward() call - * @return void - */ -function tidypics_ajax_session_handler($hook, $type, $value, $params) { - $www_root = elgg_get_config('wwwroot'); - $url = $params['current_url']; - - if ($url !== "{$www_root}action/photos/image/ajax_upload") { - return; - } - - if (elgg_get_logged_in_user_guid() != 0) { - return; - } - - // action_gatekeeper rejected ajax call from Flash due to session issue - - // Validate token - $token = get_input('__elgg_token'); - $ts = get_input('__elgg_ts'); - $session_id = get_input('Elgg'); - $session_token = get_input('session_token'); - $tidypics_token = get_input('tidypics_token'); - $user_guid = get_input('user_guid'); - $user = get_user($user_guid); - $timeout = elgg_get_config('action_token_timeout'); - if (!$timeout) { - $timeout = 2; - } - - if (!$user) { - trigger_error('Tidypics warning: failed to get user in flash uploader', E_USER_WARNING); - return; - } - - if (!$token || !$ts || !$session_id || !$tidypics_token) { - trigger_error('Tidypics warning: token information missing in flash uploader', E_USER_WARNING); - return; - } - - $hour = 60*60; - $now = time(); - if ($ts < $now-$hour || $ts > $now+$hour) { - trigger_error('Tidypics warning: failed time check in flash uploader', E_USER_WARNING); - return; - } - - $generated_token = md5($session_id . get_site_secret() . $ts . $user->salt); - - if ($tidypics_token !== $generated_token) { - trigger_error('Tidypics warning: token check failed in flash uploader', E_USER_WARNING); - return; - } - - // passed token test, so login and process action - login($user); - $actions = elgg_get_config('actions'); - include $actions['photos/image/ajax_upload']['file']; - - exit; -} - /** * Sets up submenus for tidypics most viewed pages */ diff --git a/views/default/forms/photos/admin/settings/main.php b/views/default/forms/photos/admin/settings/main.php index c99b9d688..f7950a7ad 100644 --- a/views/default/forms/photos/admin/settings/main.php +++ b/views/default/forms/photos/admin/settings/main.php @@ -5,7 +5,7 @@ $plugin = $vars['plugin']; -$checkboxes = array('tagging', 'view_count', 'uploader', 'exif', 'download_link'); +$checkboxes = array('tagging', 'view_count', 'exif', 'download_link'); foreach ($checkboxes as $checkbox) { echo '
      '; $checked = $plugin->$checkbox ? 'checked' : false; diff --git a/views/default/forms/photos/ajax_upload.php b/views/default/forms/photos/ajax_upload.php deleted file mode 100644 index 3ab578a38..000000000 --- a/views/default/forms/photos/ajax_upload.php +++ /dev/null @@ -1,54 +0,0 @@ -salt); -$basic_uploader_url = current_page_url() . '/basic'; - -$maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics'); -if (!$maxfilesize) { - $maxfilesize = 5; -} - -?> - -

      - -

      - - diff --git a/views/default/js/photos/uploading.php b/views/default/js/photos/uploading.php deleted file mode 100644 index 465f937ab..000000000 --- a/views/default/js/photos/uploading.php +++ /dev/null @@ -1,94 +0,0 @@ - - -// - - - - - - -
      - -

      Cancel All Uploads

      - - diff --git a/vendors/uploadify/example/scripts/_notes/dwsync.xml b/vendors/uploadify/example/scripts/_notes/dwsync.xml deleted file mode 100644 index 13ca04347..000000000 --- a/vendors/uploadify/example/scripts/_notes/dwsync.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/vendors/uploadify/example/scripts/check.php b/vendors/uploadify/example/scripts/check.php deleted file mode 100644 index d7dc57177..000000000 --- a/vendors/uploadify/example/scripts/check.php +++ /dev/null @@ -1,35 +0,0 @@ - $value) { - if ($key != 'folder') { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) { - $fileArray[$key] = $value; - } - } -} -echo json_encode($fileArray); -?> \ No newline at end of file diff --git a/vendors/uploadify/example/scripts/expressInstall.swf b/vendors/uploadify/example/scripts/expressInstall.swf deleted file mode 100644 index 0fbf8fca9..000000000 Binary files a/vendors/uploadify/example/scripts/expressInstall.swf and /dev/null differ diff --git a/vendors/uploadify/example/scripts/jquery-1.3.2.min.js b/vendors/uploadify/example/scripts/jquery-1.3.2.min.js deleted file mode 100644 index b1ae21d8b..000000000 --- a/vendors/uploadify/example/scripts/jquery-1.3.2.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * jQuery JavaScript Library v1.3.2 - * http://jquery.com/ - * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License - * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 - */ -(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
      "]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
      ","
      "]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.3 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

      ";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
      ";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
      ").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
      ';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/vendors/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js b/vendors/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js deleted file mode 100644 index 04592ffec..000000000 --- a/vendors/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js +++ /dev/null @@ -1,26 +0,0 @@ -/* -Uploadify v2.1.0 -Release Date: August 24, 2009 - -Copyright (c) 2009 Ronnie Garcia, Travis Nickels - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('
      ');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('
      ')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('
      '+fileName+" ("+k+l+')
      ')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d - is released under the MIT License -*/ -var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab \ No newline at end of file diff --git a/vendors/uploadify/example/scripts/uploadify.swf b/vendors/uploadify/example/scripts/uploadify.swf deleted file mode 100644 index 4d27952f5..000000000 Binary files a/vendors/uploadify/example/scripts/uploadify.swf and /dev/null differ diff --git a/vendors/uploadify/expressInstall.swf b/vendors/uploadify/expressInstall.swf deleted file mode 100644 index 0fbf8fca9..000000000 Binary files a/vendors/uploadify/expressInstall.swf and /dev/null differ diff --git a/vendors/uploadify/jquery-1.3.2.min.js b/vendors/uploadify/jquery-1.3.2.min.js deleted file mode 100644 index b1ae21d8b..000000000 --- a/vendors/uploadify/jquery-1.3.2.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * jQuery JavaScript Library v1.3.2 - * http://jquery.com/ - * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License - * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 - */ -(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
      "]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
      ","
      "]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.3 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

      ";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
      ";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
      ").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
      ';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/vendors/uploadify/jquery.uploadify.v2.1.1.js b/vendors/uploadify/jquery.uploadify.v2.1.1.js deleted file mode 100644 index f2b1f8f6f..000000000 --- a/vendors/uploadify/jquery.uploadify.v2.1.1.js +++ /dev/null @@ -1,259 +0,0 @@ -/* -Uploadify v2.1.1 -Release Date: October 30, 2010 - -Copyright (c) 2010 Ronnie Garcia, Travis Nickels, Cash Costello - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -if(jQuery)( - function(jQuery){ - jQuery.extend(jQuery.fn,{ - uploadify:function(options) { - jQuery(this).each(function(){ - settings = jQuery.extend({ - id : jQuery(this).attr('id'), // The ID of the object being Uploadified - uploader : 'uploadify.swf', // The path to the uploadify swf file - script : 'uploadify.php', // The path to the uploadify backend upload script - expressInstall : null, // The path to the express install swf file - folder : '', // The path to the upload folder - height : 30, // The height of the flash button - width : 110, // The width of the flash button - cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container - wmode : 'opaque', // The wmode of the flash file - scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains - fileDataName : 'Filedata', // The name of the file collection object in the backend upload script - method : 'POST', // The method for sending variables to the backend upload script - queueSizeLimit : 999, // The maximum size of the file queue - simUploadLimit : 1, // The number of simultaneous uploads allowed - queueID : false, // The optional ID of the queue container - displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item - onInit : function() {}, // Function to run when uploadify is initialized - onEmbedFlash : function() {}, // Function to run after the flash object has been embedded - onSelect : function() {}, // Function to run when a file is selected - onQueueFull : function() {}, // Function to run when the queue reaches capacity - onCheck : function() {}, // Function to run when script checks for duplicate files on the server - onCancel : function() {}, // Function to run when an item is cleared from the queue - onError : function() {}, // Function to run when an upload item returns an error - onProgress : function() {}, // Function to run each time the upload progress is updated - onComplete : function() {}, // Function to run when an upload is completed - onAllComplete : function() {} // Functino to run when all uploads are completed - }, options); - var pagePath = location.pathname; - pagePath = pagePath.split('/'); - pagePath.pop(); - pagePath = pagePath.join('/') + '/'; - var data = {}; - data.uploadifyID = settings.id; - data.pagepath = pagePath; - if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg); - if (settings.buttonText) data.buttonText = escape(settings.buttonText); - if (settings.rollover) data.rollover = true; - data.script = settings.script; - data.folder = escape(settings.folder); - if (settings.scriptData) { - var scriptDataString = ''; - for (var name in settings.scriptData) { - scriptDataString += '&' + name + '=' + settings.scriptData[name]; - } - data.scriptData = escape(scriptDataString.substr(1)); - } - data.width = settings.width; - data.height = settings.height; - data.wmode = settings.wmode; - data.method = settings.method; - data.queueSizeLimit = settings.queueSizeLimit; - data.simUploadLimit = settings.simUploadLimit; - if (settings.hideButton) data.hideButton = true; - if (settings.fileDesc) data.fileDesc = settings.fileDesc; - if (settings.fileExt) data.fileExt = settings.fileExt; - if (settings.multi) data.multi = true; - if (settings.auto) data.auto = true; - if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit; - if (settings.checkScript) data.checkScript = settings.checkScript; - if (settings.fileDataName) data.fileDataName = settings.fileDataName; - if (settings.queueID) data.queueID = settings.queueID; - if (settings.onInit() !== false) { - jQuery(this).css('display','none'); - jQuery(this).after('
      '); - swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess}, {}, settings.onEmbedFlash); - if (settings.queueID == false) { - jQuery("#" + jQuery(this).attr('id') + "Uploader").after('
      '); - } - } - if (typeof(settings.onOpen) == 'function') { - jQuery(this).bind("uploadifyOpen", settings.onOpen); - } - jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) { - if (event.data.action(event, ID, fileObj) !== false) { - var byteSize = Math.round(fileObj.size / 1024 * 100) * .01; - var suffix = 'KB'; - if (byteSize > 1000) { - byteSize = Math.round(byteSize *.001 * 100) * .01; - suffix = 'MB'; - } - var sizeParts = byteSize.toString().split('.'); - if (sizeParts.length > 1) { - byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2); - } else { - byteSize = sizeParts[0]; - } - if (fileObj.name.length > 20) { - fileName = fileObj.name.substr(0,20) + '...'; - } else { - fileName = fileObj.name; - } - queue = '#' + jQuery(this).attr('id') + 'Queue'; - if (event.data.queueID) { - queue = '#' + event.data.queueID; - } - jQuery(queue).append('
      \ -
      \ - \ -
      \ - ' + fileName + ' (' + byteSize + suffix + ')\ -
      \ -
      \ -
      \ -
      '); - } - }); - if (typeof(settings.onSelectOnce) == 'function') { - jQuery(this).bind("uploadifySelectOnce", settings.onSelectOnce); - } - jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) { - if (event.data.action(event, queueSizeLimit) !== false) { - alert('The queue is full. The max size is ' + queueSizeLimit + '.'); - } - }); - jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) { - var postData = new Object(); - postData = fileQueueObj; - postData.folder = pagePath + folder; - if (single) { - for (var ID in fileQueueObj) { - var singleFileID = ID; - } - } - jQuery.post(checkScript, postData, function(data) { - for(var key in data) { - if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) { - var replaceFile = confirm("Do you want to replace the file " + data[key] + "?"); - if (!replaceFile) { - document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true,true); - } - } - } - if (single) { - document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true); - } else { - document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true); - } - }, "json"); - }); - jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, clearFast) { - if (event.data.action(event, ID, fileObj, data, clearFast) !== false) { - var fadeSpeed = (clearFast == true) ? 0 : 250; - jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() }); - } - }); - if (typeof(settings.onClearQueue) == 'function') { - jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue); - } - var errorArray = []; - jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) { - if (event.data.action(event, ID, fileObj, errorObj) !== false) { - var fileArray = new Array(ID, fileObj, errorObj); - errorArray.push(fileArray); - jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error"); - jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError'); - } - }); - jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) { - if (event.data.action(event, ID, fileObj, data) !== false) { - jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").css('width', data.percentage + '%'); - if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%'; - if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s'; - if (event.data.toDisplay == null) displayData = ' '; - jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(displayData); - } - }); - jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) { - if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) { - jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed'); - jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function() { jQuery(this).remove()}); - } - }); - if (typeof(settings.onAllComplete) == 'function') { - jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, uploadObj) { - if (event.data.action(event, uploadObj) !== false) { - errorArray = []; - } - }); - } - }); - }, - uploadifySettings:function(settingName, settingValue, resetObject) { - var returnValue = false; - jQuery(this).each(function() { - if (settingName == 'scriptData' && settingValue != null) { - if (resetObject) { - var scriptData = settingValue; - } else { - var scriptData = jQuery.extend(settings.scriptData, settingValue); - } - var scriptDataString = ''; - for (var name in scriptData) { - scriptDataString += '&' + name + '=' + escape(scriptData[name]); - } - settingValue = scriptDataString.substr(1); - } - returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue); - }); - if (settingValue == null) { - if (settingName == 'scriptData') { - var returnSplit = unescape(returnValue).split('&'); - var returnObj = new Object(); - for (var i = 0; i < returnSplit.length; i++) { - var iSplit = returnSplit[i].split('='); - returnObj[iSplit[0]] = iSplit[1]; - } - returnValue = returnObj; - } - return returnValue; - } - }, - uploadifyUpload:function(ID) { - jQuery(this).each(function() { - document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, false); - }); - }, - uploadifyCancel:function(ID) { - jQuery(this).each(function() { - document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, false); - }); - }, - uploadifyClearQueue:function() { - jQuery(this).each(function() { - document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false); - }); - } - }) -})(jQuery); \ No newline at end of file diff --git a/vendors/uploadify/jquery.uploadify.v2.1.1.min.js b/vendors/uploadify/jquery.uploadify.v2.1.1.min.js deleted file mode 100644 index 0a5ff7bea..000000000 --- a/vendors/uploadify/jquery.uploadify.v2.1.1.min.js +++ /dev/null @@ -1 +0,0 @@ -if(jQuery){(function(jQuery){jQuery.extend(jQuery.fn,{uploadify:function(options){jQuery(this).each(function(){settings=jQuery.extend({id:jQuery(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onEmbedFlash:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},options);var pagePath=location.pathname;pagePath=pagePath.split("/");pagePath.pop();pagePath=pagePath.join("/")+"/";var data={};data.uploadifyID=settings.id;data.pagepath=pagePath;if(settings.buttonImg){data.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){data.buttonText=escape(settings.buttonText)}if(settings.rollover){data.rollover=true}data.script=settings.script;data.folder=escape(settings.folder);if(settings.scriptData){var scriptDataString="";for(var name in settings.scriptData){scriptDataString+="&"+name+"="+settings.scriptData[name]}data.scriptData=escape(scriptDataString.substr(1))}data.width=settings.width;data.height=settings.height;data.wmode=settings.wmode;data.method=settings.method;data.queueSizeLimit=settings.queueSizeLimit;data.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){data.hideButton=true}if(settings.fileDesc){data.fileDesc=settings.fileDesc}if(settings.fileExt){data.fileExt=settings.fileExt}if(settings.multi){data.multi=true}if(settings.auto){data.auto=true}if(settings.sizeLimit){data.sizeLimit=settings.sizeLimit}if(settings.checkScript){data.checkScript=settings.checkScript}if(settings.fileDataName){data.fileDataName=settings.fileDataName}if(settings.queueID){data.queueID=settings.queueID}if(settings.onInit()!==false){jQuery(this).css("display","none");jQuery(this).after('
      ');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,data,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess},{},settings.onEmbedFlash);if(settings.queueID==false){jQuery("#"+jQuery(this).attr("id")+"Uploader").after('
      ')}}if(typeof(settings.onOpen)=="function"){jQuery(this).bind("uploadifyOpen",settings.onOpen)}jQuery(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(event,ID,fileObj){if(event.data.action(event,ID,fileObj)!==false){var byteSize=Math.round(fileObj.size/1024*100)*0.01;var suffix="KB";if(byteSize>1000){byteSize=Math.round(byteSize*0.001*100)*0.01;suffix="MB"}var sizeParts=byteSize.toString().split(".");if(sizeParts.length>1){byteSize=sizeParts[0]+"."+sizeParts[1].substr(0,2)}else{byteSize=sizeParts[0]}if(fileObj.name.length>20){fileName=fileObj.name.substr(0,20)+"..."}else{fileName=fileObj.name}queue="#"+jQuery(this).attr("id")+"Queue";if(event.data.queueID){queue="#"+event.data.queueID}jQuery(queue).append('
      '+fileName+" ("+byteSize+suffix+')
      ')}});if(typeof(settings.onSelectOnce)=="function"){jQuery(this).bind("uploadifySelectOnce",settings.onSelectOnce)}jQuery(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(event,queueSizeLimit){if(event.data.action(event,queueSizeLimit)!==false){alert("The queue is full. The max size is "+queueSizeLimit+".")}});jQuery(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(event,checkScript,fileQueueObj,folder,single){var postData=new Object();postData=fileQueueObj;postData.folder=pagePath+folder;if(single){for(var ID in fileQueueObj){var singleFileID=ID}}jQuery.post(checkScript,postData,function(data){for(var key in data){if(event.data.action(event,checkScript,fileQueueObj,folder,single)!==false){var replaceFile=confirm("Do you want to replace the file "+data[key]+"?");if(!replaceFile){document.getElementById(jQuery(event.target).attr("id")+"Uploader").cancelFileUpload(key,true,true)}}}if(single){document.getElementById(jQuery(event.target).attr("id")+"Uploader").startFileUpload(singleFileID,true)}else{document.getElementById(jQuery(event.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});jQuery(this).bind("uploadifyCancel",{action:settings.onCancel},function(event,ID,fileObj,data,clearFast){if(event.data.action(event,ID,fileObj,data,clearFast)!==false){var fadeSpeed=(clearFast==true)?0:250;jQuery("#"+jQuery(this).attr("id")+ID).fadeOut(fadeSpeed,function(){jQuery(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){jQuery(this).bind("uploadifyClearQueue",settings.onClearQueue)}var errorArray=[];jQuery(this).bind("uploadifyError",{action:settings.onError},function(event,ID,fileObj,errorObj){if(event.data.action(event,ID,fileObj,errorObj)!==false){var fileArray=new Array(ID,fileObj,errorObj);errorArray.push(fileArray);jQuery("#"+jQuery(this).attr("id")+ID+" .percentage").text(" - "+errorObj.type+" Error");jQuery("#"+jQuery(this).attr("id")+ID).addClass("uploadifyError")}});jQuery(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(event,ID,fileObj,data){if(event.data.action(event,ID,fileObj,data)!==false){jQuery("#"+jQuery(this).attr("id")+ID+"ProgressBar").css("width",data.percentage+"%");if(event.data.toDisplay=="percentage"){displayData=" - "+data.percentage+"%"}if(event.data.toDisplay=="speed"){displayData=" - "+data.speed+"KB/s"}if(event.data.toDisplay==null){displayData=" "}jQuery("#"+jQuery(this).attr("id")+ID+" .percentage").text(displayData)}});jQuery(this).bind("uploadifyComplete",{action:settings.onComplete},function(event,ID,fileObj,response,data){if(event.data.action(event,ID,fileObj,unescape(response),data)!==false){jQuery("#"+jQuery(this).attr("id")+ID+" .percentage").text(" - Completed");jQuery("#"+jQuery(this).attr("id")+ID).fadeOut(250,function(){jQuery(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){jQuery(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(event,uploadObj){if(event.data.action(event,uploadObj)!==false){errorArray=[]}})}})},uploadifySettings:function(settingName,settingValue,resetObject){var returnValue=false;jQuery(this).each(function(){if(settingName=="scriptData"&&settingValue!=null){if(resetObject){var scriptData=settingValue}else{var scriptData=jQuery.extend(settings.scriptData,settingValue)}var scriptDataString="";for(var name in scriptData){scriptDataString+="&"+name+"="+escape(scriptData[name])}settingValue=scriptDataString.substr(1)}returnValue=document.getElementById(jQuery(this).attr("id")+"Uploader").updateSettings(settingName,settingValue)});if(settingValue==null){if(settingName=="scriptData"){var returnSplit=unescape(returnValue).split("&");var returnObj=new Object();for(var i=0;i - is released under the MIT License -*/ -var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab \ No newline at end of file diff --git a/vendors/uploadify/uploadify.swf b/vendors/uploadify/uploadify.swf deleted file mode 100644 index 0385d9e6e..000000000 Binary files a/vendors/uploadify/uploadify.swf and /dev/null differ -- cgit v1.2.3 From 12a88208acec40e190b0729887e28c9d9add26c3 Mon Sep 17 00:00:00 2001 From: Sem Date: Sat, 28 Jul 2012 23:08:10 +0200 Subject: Removed photo-tagging feature. --- actions/photos/image/tag.php | 109 -------------- actions/photos/image/untag.php | 24 ---- languages/da.php | 19 --- languages/de.php | 28 +--- languages/en.php | 28 +--- languages/es.php | 18 --- languages/fr.php | 15 -- languages/he.php | 11 -- languages/it.php | 2 - lib/tidypics.php | 45 ------ pages/photos/image/view.php | 5 - pages/tagged.php | 48 ------- start.php | 26 +--- views/default/forms/photos/admin/settings/main.php | 2 +- views/default/forms/photos/image/tag.php | 33 ----- views/default/js/photos/tagging.php | 159 --------------------- views/default/object/image.php | 20 --- views/default/object/image/full.php | 3 - views/default/photos/css.php | 79 ---------- views/default/photos/tagging/help.php | 19 --- views/default/photos/tagging/select.php | 16 --- views/default/photos/tagging/tag.php | 50 ------- views/default/photos/tagging/tags.php | 14 -- views/default/river/object/image/tag.php | 26 ---- 24 files changed, 4 insertions(+), 795 deletions(-) delete mode 100644 actions/photos/image/tag.php delete mode 100644 actions/photos/image/untag.php delete mode 100644 pages/tagged.php delete mode 100644 views/default/forms/photos/image/tag.php delete mode 100644 views/default/js/photos/tagging.php delete mode 100644 views/default/photos/tagging/help.php delete mode 100644 views/default/photos/tagging/select.php delete mode 100644 views/default/photos/tagging/tag.php delete mode 100644 views/default/photos/tagging/tags.php delete mode 100644 views/default/river/object/image/tag.php diff --git a/actions/photos/image/tag.php b/actions/photos/image/tag.php deleted file mode 100644 index e623bd546..000000000 --- a/actions/photos/image/tag.php +++ /dev/null @@ -1,109 +0,0 @@ -guid; -} - -/* // not adding as plain tag yet -$new_word_tag = false; -if ($user_id != 0) { - $relationships_type = 'user'; - $value = $user_id; -} else { - $relationships_type = 'word'; - $value = $word; - - // check to see if the photo has this tag and add if not - if (!is_array($image->tags)) { - if ($image->tags != $word) { - $new_word_tag = true; - $tagarray = $image->tags . ',' . $word; - $tagarray = string_to_tag_array($tagarray); - } - } else { - if (!in_array($word, $image->tags)) { - $new_word_tag = true; - $tagarray = $image->tags; - $tagarray[] = $word; - } - } -} - -// add new tag now so it is available in search -if ($new_word_tag) { - $image->clearMetadata('tags'); - $image->tags = $tagarray; -} -*/ - -$tag = new stdClass(); -$tag->coords = $coordinates_str; -$tag->type = $relationships_type; -$tag->value = $value; -$access_id = $image->getAccessID(); - -$annotation_id = $image->annotate('phototag', serialize($tag), $access_id); -if ($annotation_id) { - // if tag is a user id, add relationship for searching (find all images with user x) - if ($tag->type === 'user') { - if (!check_entity_relationship($tag->value, 'phototag', $image_guid)) { - add_entity_relationship($tag->value, 'phototag', $image_guid); -/* - // also add this to the river - subject is image, object is the tagged user - add_to_river('river/object/image/tag', 'tag', $tagger->guid, $user_id, $access_id, 0, $annotation_id); - - // notify user of tagging as long as not self - if ($owner_id != $user_id) { - notify_user( - $user_id, - $owner_id, - elgg_echo('tidypics:tag:subject'), - sprintf( - elgg_echo('tidypics:tag:body'), - $image->getTitle(), - $tagger->name, - $image->getURL() - ) - ); - } - * - */ - } - } - - system_message(elgg_echo("tidypics:phototagging:success")); -} - -forward(REFERER); diff --git a/actions/photos/image/untag.php b/actions/photos/image/untag.php deleted file mode 100644 index 11c433a61..000000000 --- a/actions/photos/image/untag.php +++ /dev/null @@ -1,24 +0,0 @@ -name != 'phototag') { - register_error(elgg_echo("tidypics:phototagging:delete:error")); - forward(REFERER); -} - -if (!$annotation->canEdit()) { - register_error(elgg_echo("tidypics:phototagging:delete:error")); - forward(REFERER); -} - -if ($annotation->delete()) { - system_message(elgg_echo("tidypics:phototagging:delete:success")); -} else { - system_message(elgg_echo("tidypics:phototagging:delete:error")); -} - -forward(REFERER); diff --git a/languages/da.php b/languages/da.php index 78113d467..eb75e86f2 100644 --- a/languages/da.php +++ b/languages/da.php @@ -56,7 +56,6 @@ $danish = array( 'tidypics:admin:instructions' => 'Dette er de centrale Tidypics indstillinger. Tilpas dem til din opsætning og klik derefter på Gem.', 'tidypics:settings:image_lib' => "Foto arkiv: ", 'tidypics:settings:download_link' => "Vis download-link", - 'tidypics:settings:tagging' => "Tillad fotolinks", 'tidypics:settings:photo_ratings' => "Tillad karakterergivning af foto (kræver plugin af Miguel Montes eller andet kompatibelt plugin)", 'tidypics:settings:exif' => "Vis EXIF data", 'tidypics:settings:view_count' => "Vis tæller", @@ -105,22 +104,6 @@ $danish = array( 'image:back' => "Forrige", 'image:next' => "Næste", - // tagging - 'tidypics:taginstruct' => 'Vælg et område på billedet, som du ønsker at linke', - 'tidypics:deltag_title' => 'Vælg at slette links', - 'tidypics:finish_tagging' => 'Annuller', - 'tidypics:tagthisphoto' => 'Tilføj link til foto', - 'tidypics:deletetag' => 'Slet foto link', - 'tidypics:actiontag' => 'Link', - 'tidypics:actiondelete' => 'Slet', - 'tidypics:actioncancel' => 'Annuller', - 'tidypics:inthisphoto' => 'Links i billedet', - 'tidypics:usertag' => "Foto links til medlem %s", - 'tidypics:phototagging:success' => 'Foto link tilføjet', - 'tidypics:phototagging:error' => 'Uventet fejl ved linket', - 'tidypics:deletetag:success' => 'Udvalgte links er blevet fjernet', - - //rss 'tidypics:posted' => 'Billedet indstilles individuelt:', @@ -138,8 +121,6 @@ $danish = array( 'image:river:created:multiple' => "%s added %u photos to album %s", 'image:river:item' => "et billede", 'image:river:annotate' => "en kommentar til billedet", - 'image:river:tagged' => "%s tagged %s in the photo %s", - 'image:river:tagged:unknown' => "%s tagged %s in a photo", 'album:river:created' => "%s har tilføjet et nyt album", 'album:river:group' => "i gruppen", 'album:river:item' => "et album", diff --git a/languages/de.php b/languages/de.php index 1f439e981..e7b70d9c3 100644 --- a/languages/de.php +++ b/languages/de.php @@ -64,7 +64,6 @@ $german = array( 'tidypics:settings:thumbnail' => "Erzeugung von Vorschaubildern", 'tidypics:settings:help' => "Hilfe", 'tidypics:settings:download_link' => "Zeige Download-Link", - 'tidypics:settings:tagging' => "Tagging von Bildern erlauben", 'tidypics:settings:photo_ratings' => "Bewerten von Bildern erlauben (benötigt das Elggx Fivestar-Plugin oder ein vergleichbares)", 'tidypics:settings:exif' => "EXIF-Daten anzeigen", 'tidypics:settings:view_count' => "Zugriffszähler anzeigen", @@ -102,7 +101,7 @@ $german = array( 'tidypics:server_info:max_input_time_desc' => 'Maximale erlaubte Dauer, in der das Hochladen von Daten auf den Server abgeschlossen sein muss.', 'tidypics:server_info:max_execution_time_desc' => 'Maximal erlaubte Ausführdauer für ein Skript auf dem Server.', 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions können den Flash-Uploader beeinträchtigen.', - + 'tidypics:server_info:php_version' => 'PHP-Version', 'tidypics:server_info:memory_limit' => 'Für PHP verfügbarer Speicher', 'tidypics:server_info:peak_usage' => 'Genutzer Speicher, um diese Seite zu laden', @@ -169,29 +168,6 @@ $german = array( 'image:next' => "Nächstes", 'image:index' => "%u von %u", - // tagging - 'tidypics:taginstruct' => 'Wähle den Bereich auf dem Bild, für das Du ein Tag setzen willst, oder %s.', - 'tidypics:finish_tagging' => 'Taggen beenden', - 'tidypics:deltag_title' => 'Wähle die Tags, die gelöscht werden sollen', - 'tidypics:finish_tagging' => 'Tagging abbrechen', - 'tidypics:tagthisphoto' => 'Bild taggen', - 'tidypics:actiontag' => 'Tag setzen', - 'tidypics:actioncancel' => 'Abbrechen', - 'tidypics:inthisphoto' => 'Tags in diesem Bild', - 'tidypics:usertag' => "Bilder mit Tags, die sich auf %s beziehen", - 'tidypics:phototagging:success' => 'Das Bild wurde getaggt.', - 'tidypics:phototagging:error' => 'Beim Hinzufügen des Tags ist ein Fehler aufgetreten.', - - 'tidypics:phototagging:delete:success' => 'Das Tag wurde entfernt.', - 'tidypics:phototagging:delete:error' => 'Beim Entfernen des Tags ist ein Fehler aufgetreten.', - 'tidypics:phototagging:delete:confirm' => 'Dieses Tag entfernen?', - - 'tidypics:tag:subject' => "Du wurdest in einem Bild getaggt", - 'tidypics:tag:body' => "Du wurdest im Bild %s von %s getaggt. - -Um das Bild zu sehen, folge diesem Link: %s", - - //rss 'tidypics:posted' => 'hat ein Bild hinzugefügt:', @@ -210,8 +186,6 @@ Um das Bild zu sehen, folge diesem Link: %s", 'image:river:created:multiple' => "%s hat %u Bilder zum Album %s hinzugefügt.", 'image:river:item' => "ein Bild", 'image:river:annotate' => "einen Kommentar zum Bild", - 'image:river:tagged' => "%s hat %s im Bild %s getaggt.", - 'image:river:tagged:unknown' => "%s hat %s in einem Bild getaggt.", 'river:create:object:album' => "%s hat das neue Bilderalbum %s hinzugefügt.", 'album:river:group' => "in der Gruppe", 'album:river:item' => "ein Album", diff --git a/languages/en.php b/languages/en.php index 62b43673d..b51987315 100644 --- a/languages/en.php +++ b/languages/en.php @@ -64,7 +64,6 @@ $english = array( 'tidypics:settings:thumbnail' => "Thumbnail Creation", 'tidypics:settings:help' => "Help", 'tidypics:settings:download_link' => "Show download link", - 'tidypics:settings:tagging' => "Enable photo tagging", 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)", 'tidypics:settings:exif' => "Display EXIF data", 'tidypics:settings:view_count' => "Display view count", @@ -102,7 +101,7 @@ $english = array( 'tidypics:server_info:max_input_time_desc' => 'Time script waits for upload to finish', 'tidypics:server_info:max_execution_time_desc' => 'Max time a script will run', 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions may affect the Flash uploader', - + 'tidypics:server_info:php_version' => 'PHP Version', 'tidypics:server_info:memory_limit' => 'Memory Available to PHP', 'tidypics:server_info:peak_usage' => 'Memory Used to Load This Page', @@ -177,29 +176,6 @@ $english = array( 'image:next' => "Next", 'image:index' => "%u of %u", - // tagging - 'tidypics:taginstruct' => 'Select the area that you want to tag or %s', - 'tidypics:finish_tagging' => 'Stop tagging', - 'tidypics:tagthisphoto' => 'Tag this photo', - 'tidypics:actiontag' => 'Tag', - 'tidypics:actioncancel' => 'Cancel', - 'tidypics:inthisphoto' => 'In this photo', - 'tidypics:usertag' => "Photos tagged with user %s", - 'tidypics:phototagging:success' => 'Photo tag was successfully added', - 'tidypics:phototagging:error' => 'Unexpected error occurred during tagging', - - 'tidypics:phototagging:delete:success' => 'Photo tag was removed.', - 'tidypics:phototagging:delete:error' => 'Unexpceted error occurred when removing photo tag.', - 'tidypics:phototagging:delete:confirm' => 'Remove this tag?', - - - - 'tidypics:tag:subject' => "You have been tagged in a photo", - 'tidypics:tag:body' => "You have been tagged in the photo %s by %s. - -The photo can be viewed here: %s", - - //rss 'tidypics:posted' => 'posted a photo:', @@ -218,8 +194,6 @@ The photo can be viewed here: %s", 'image:river:created:multiple' => "%s added %u photos to the album %s", 'image:river:item' => "a photo", 'image:river:annotate' => "a comment on the photo", - 'image:river:tagged' => "%s tagged %s in the photo %s", - 'image:river:tagged:unknown' => "%s tagged %s in a photo", 'river:create:object:album' => "%s created a new photo album %s", 'album:river:group' => "in the group", 'album:river:item' => "an album", diff --git a/languages/es.php b/languages/es.php index 704f01979..7a2437889 100644 --- a/languages/es.php +++ b/languages/es.php @@ -52,7 +52,6 @@ $spanish = array( 'tidypics:admin:instructions' => 'Este es el corazón de las preferencias de Tidypics. Cambialas y luego guardalas.', 'tidypics:settings:image_lib' => "Libreria de Imagenes: ", 'tidypics:settings:download_link' => "Mostrar vinculo de descarga", - 'tidypics:settings:tagging' => "Habilitar etiquetas en las fotos", 'tidypics:settings:photo_ratings' => "Habilitar ratings de fotos(requiere instalar el e plugin de Miguel Montes o compatible)", 'tidypics:settings:exif' => "Mostrar data de EXIF", 'tidypics:settings:view_count' => "Ver contador", @@ -93,22 +92,6 @@ $spanish = array( 'image:back' => "Anterior", 'image:next' => "Siguiente", - // tagging - 'tidypics:taginstruct' => 'Seleccciona el área que deseas etiquetar', - 'tidypics:deltag_title' => 'Seleccionas las etiquetas a borrar', - 'tidypics:finish_tagging' => 'Detener etiquetado', - 'tidypics:tagthisphoto' => 'Etiquetar esta foto', - 'tidypics:deletetag' => 'Borrar etiqueta de la foto', - 'tidypics:actiontag' => 'Etiqueta', - 'tidypics:actiondelete' => 'Borrar', - 'tidypics:actioncancel' => 'Cancelar', - 'tidypics:inthisphoto' => 'En esta foto', - 'tidypics:usertag' => "Fotos etiquetadas con %s", - 'tidypics:phototagging:success' => 'La etiqueta de la foto fue añadida exitosamente', - 'tidypics:phototagging:error' => 'Ocurrió un error inesperado durante el etiquetado', - 'tidypics:deletetag:success' => 'Las etiquetas seleccionadas fueron borradas exitosamente', - - //rss 'tidypics:posted' => 'publicar una foto:', @@ -125,7 +108,6 @@ $spanish = array( 'image:river:created' => "%s añadio la foto %s al álbum %s", 'image:river:item' => "una foto", 'image:river:annotate' => "un comentario en la foto", - 'image:river:tagged' => "fue etiquetada en la foto", 'album:river:created' => "%s creo un nuevo álbum de fotos", 'album:river:group' => "en el grupo", 'album:river:item' => "un álbum", diff --git a/languages/fr.php b/languages/fr.php index 375159e0b..bb309c225 100644 --- a/languages/fr.php +++ b/languages/fr.php @@ -52,7 +52,6 @@ $french = array( 'tidypics:settings:image_lib' => "Librairie graphique" , 'tidypics:settings:thumbnail' => "Création des vignettes" , 'tidypics:settings:download_link' => "Voir le lien de download" , - 'tidypics:settings:tagging' => "Activer les tags sur les photos" , 'tidypics:settings:photo_ratings' => "Activer les notations des photos (nécessite le rate plugin de Miguel Montes ou compatible)" , 'tidypics:settings:exif' => "Voir les données EXIF" , 'tidypics:settings:view_count' => "Voir le compteur" , @@ -87,22 +86,9 @@ $french = array( 'image:none' => "Aucune image n'a encore été ajoutée" , 'image:back' => "Précédent" , 'image:next' => "Suivant" , - 'tidypics:taginstruct' => "Sélectionnez la zone que vous souhaitez tagger" , - 'tidypics:deltag_title' => "Sélectionnez le tag à supprimer" , - 'tidypics:finish_tagging' => "Arrêter de tagger" , - 'tidypics:tagthisphoto' => "Tagger cette photo" , - 'tidypics:deletetag' => "Supprimer le tag d'une photo" , - 'tidypics:actiontag' => "Tag" , 'tidypics:actiondelete' => "Supprimer" , 'tidypics:actioncancel' => "Annuler" , 'tidypics:inthisphoto' => "Dans cette photo" , - 'tidypics:usertag' => "Photo taggée par %s" , - 'tidypics:phototagging:success' => "La photo a été correctement taggée." , - 'tidypics:phototagging:error' => "Erreur innatendue durant le taggage" , - 'tidypics:deletetag:success' => "Les tags sélectionnés ont correctement été supprimés" , - 'tidypics:tag:subject' => "Vous avez été taggé dans une photo !!!" , - 'tidypics:tag:body' => "Vous avez été taggé dans la photo %s par %s !!! -La photo peut être consultée ici: %s" , 'tidypics:posted' => "a posté une photo" , 'tidypics:widget:albums' => "Albums photo" , 'tidypics:widget:album_descr' => "Échantillon de vos albums photo" , @@ -114,7 +100,6 @@ La photo peut être consultée ici: %s" , 'image:river:created' => "%s a ajouté la photo %s à l'album %s" , 'image:river:item' => "une photo" , 'image:river:annotate' => "commentaire sur la photo" , - 'image:river:tagged' => "a été taggé sur la photo" , 'album:river:created' => "%s a créé un nouvel album photo" , 'album:river:group' => "dans le groupe" , 'album:river:item' => "un album" , diff --git a/languages/he.php b/languages/he.php index 5f232daf6..af425ec49 100644 --- a/languages/he.php +++ b/languages/he.php @@ -47,7 +47,6 @@ $hebrew = array( 'tidypics:admin:instructions' => "אלה הגדרות הליבה של Tidypics. שנה אותן לפי הצורך ולחץ על שמור" , 'tidypics:settings:image_lib' => "ספריית תמונות:" , 'tidypics:settings:download_link' => "הצג לינק להורדה" , - 'tidypics:settings:tagging' => "אפשר תיוג תמונות" , 'tidypics:settings:photo_ratings' => "אפשר דירוג תמונות, דורש תוסף דירוג של Miguel Montes או דומה" , 'tidypics:settings:exif' => "הצג נתוני EXIF" , 'tidypics:settings:view_count' => "מונה צפיה" , @@ -81,19 +80,9 @@ $hebrew = array( 'image:none' => "טרם נוספו תמונות" , 'image:back' => "הקודם" , 'image:next' => "הבא" , - 'tidypics:taginstruct' => "בחר אזור להוספת תג" , - 'tidypics:deltag_title' => "בחר תגים למחיקה" , - 'tidypics:finish_tagging' => "הפסק לתייג" , - 'tidypics:tagthisphoto' => "תייג תמונה זו" , - 'tidypics:deletetag' => "מחק תג תמונה" , - 'tidypics:actiontag' => "תג" , 'tidypics:actiondelete' => "מחיקה" , 'tidypics:actioncancel' => "ביטול" , 'tidypics:inthisphoto' => "בתמונה זו" , - 'tidypics:usertag' => "תמונות המתוייגות במשתמש %s" , - 'tidypics:phototagging:success' => "התג נוסף בהצלחה" , - 'tidypics:phototagging:error' => "אירע שגיאה בתהליך התיוג" , - 'tidypics:deletetag:success' => "התגים נמחקו בהצלחה" , 'tidypics:posted' => "הוסיף/ה תמונה" , 'tidypics:widget:albums' => "אלבומי תמונות" , 'tidypics:widget:album_descr' => "הצג את האלבומים החדשים שלך" , diff --git a/languages/it.php b/languages/it.php index 764ecf5f7..dd10384fe 100644 --- a/languages/it.php +++ b/languages/it.php @@ -76,8 +76,6 @@ $italian = array( 'image:river:created:multiple' => "%s added %u photos to album %s", 'image:river:item' => "una immagine", 'image:river:annotate' => "a comment on the image", - 'image:river:tagged' => "%s tagged %s in the photo %s", - 'image:river:tagged:unknown' => "%s tagged %s in a photo", 'album:river:created' => "%s created a new photo album: ", 'album:river:item' => "an album", 'album:river:annotate' => "un commento nel foto album", diff --git a/lib/tidypics.php b/lib/tidypics.php index 9439bed39..953c68b76 100644 --- a/lib/tidypics.php +++ b/lib/tidypics.php @@ -351,51 +351,6 @@ function tp_is_person() { return false; } -/** - * get a list of people that can be tagged in an image - * - * @param $viewer entity - * @return array of guid->name for tagging - */ -function tp_get_tag_list($viewer) { - $friends = get_user_friends($viewer->getGUID(), '', 999, 0); - $friend_list = array(); - if ($friends) { - foreach($friends as $friend) { - //error_log("friend $friend->name"); - $friend_list[$friend->guid] = $friend->name; - } - } - - // is this a group - $is_group = tp_is_group_page(); - if ($is_group) { - $group_guid = page_owner(); - $viewer_guid = $viewer->guid; - $members = get_group_members($group_guid, 999); - if (is_array($members)) { - foreach ($members as $member) { - if ($viewer_guid != $member->guid) { - $group_list[$member->guid] = $member->name; - //error_log("group $member->name"); - } - } - - // combine group and friends list - $intersect = array_intersect_key($friend_list, $group_list); - $unique_friends = array_diff_key($friend_list, $group_list); - $unique_members = array_diff_key($group_list, $friend_list); - //$friend_list = array_merge($friend_list, $group_list); - //$friend_list = array_unique($friend_list); - $friend_list = $intersect + $unique_friends + $unique_members; - } - } - - asort($friend_list); - - return $friend_list; -} - /** * Convenience function for listing recent images * diff --git a/pages/photos/image/view.php b/pages/photos/image/view.php index fc4a01320..e30bed70a 100644 --- a/pages/photos/image/view.php +++ b/pages/photos/image/view.php @@ -19,11 +19,6 @@ if (!$photo) { $photo->addView(); -if (elgg_get_plugin_setting('tagging', 'tidypics')) { - elgg_load_js('tidypics:tagging'); - elgg_load_js('jquery.imgareaselect'); -} - // set page owner based on owner of photo album $album = $photo->getContainerEntity(); if ($album) { diff --git a/pages/tagged.php b/pages/tagged.php deleted file mode 100644 index 34ea8a709..000000000 --- a/pages/tagged.php +++ /dev/null @@ -1,48 +0,0 @@ -name); -} else { - $title = "User does not exist"; -} - - -// create main column -$body = elgg_view_title($title); - -set_context('search'); -set_input('search_viewtype', 'gallery'); // need to force gallery view -$body .= list_entities_from_relationship('phototag', $guid, false, 'object', 'image', 0, 10, false); - -// Set up submenus -if (isloggedin()) { - add_submenu_item( elgg_echo("album:yours"), - $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username, - 'tidypics-b' ); -} -add_submenu_item( elgg_echo('album:all'), - $CONFIG->wwwroot . "pg/photos/world/", - 'tidypics-z'); -add_submenu_item( elgg_echo('tidypics:mostrecent'), - $CONFIG->wwwroot . 'pg/photos/mostrecent', - 'tidypics-z'); - - - -$body = elgg_view_layout('two_column_left_sidebar', '', $body); - - -page_draw($title, $body); diff --git a/start.php b/start.php index 1e851b8f3..8c3dcf7b2 100644 --- a/start.php +++ b/start.php @@ -38,9 +38,6 @@ function tidypics_init() { $js = elgg_get_simplecache_url('js', 'photos/tidypics'); elgg_register_simplecache_view('js/photos/tidypics'); elgg_register_js('tidypics', $js, 'footer'); - $js = elgg_get_simplecache_url('js', 'photos/tagging'); - elgg_register_simplecache_view('js/photos/tagging'); - elgg_register_js('tidypics:tagging', $js, 'footer'); $js = elgg_get_simplecache_url('js', 'photos/uploading'); elgg_register_simplecache_view('js/photos/uploading'); elgg_register_js('tidypics:uploading', $js, 'footer'); @@ -48,7 +45,7 @@ function tidypics_init() { elgg_register_js('tidypics:slideshow', 'mod/tidypics/vendors/PicLensLite/piclens_optimized.js', 'footer'); elgg_register_js('swfobject', 'mod/tidypics/vendors/uploadify/swfobject.js', 'footer'); elgg_register_js('jquery.uploadify-tp', 'mod/tidypics/vendors/uploadify/jquery.uploadify.v2.1.1.min.js', 'footer'); - + // Add photos link to owner block/hover menus elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu'); @@ -99,8 +96,6 @@ function tidypics_init() { elgg_register_action("photos/image/save", "$base_dir/image/save.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"); @@ -216,13 +211,6 @@ function tidypics_page_handler($page) { include "$base/image/download.php"; break; - case "tagged": // all photos tagged with user - if (isset($page[1])) { - set_input('guid', $page[1]); - } - include($CONFIG->pluginspath . "tidypics/pages/tagged.php"); - break; - case "mostviewed": // images with the most views if (isset($page[1])) { set_input('username', $page[1]); @@ -329,18 +317,6 @@ function tidypics_entity_menu_setup($hook, $type, $return, $params) { ); $return[] = ElggMenuItem::factory($options); } - - if (elgg_get_plugin_setting('tagging', 'tidypics')) { - $options = array( - 'name' => 'tagging', - 'text' => elgg_echo('tidypics:actiontag'), - 'href' => '#', - 'title' => elgg_echo('tidypics:tagthisphoto'), - 'rel' => 'photo-tagging', - 'priority' => 80, - ); - $return[] = ElggMenuItem::factory($options); - } } // only show these options if there are images diff --git a/views/default/forms/photos/admin/settings/main.php b/views/default/forms/photos/admin/settings/main.php index c99b9d688..ab5e7e24a 100644 --- a/views/default/forms/photos/admin/settings/main.php +++ b/views/default/forms/photos/admin/settings/main.php @@ -5,7 +5,7 @@ $plugin = $vars['plugin']; -$checkboxes = array('tagging', 'view_count', 'uploader', 'exif', 'download_link'); +$checkboxes = array('view_count', 'uploader', 'exif', 'download_link'); foreach ($checkboxes as $checkbox) { echo '
      '; $checked = $plugin->$checkbox ? 'checked' : false; diff --git a/views/default/forms/photos/image/tag.php b/views/default/forms/photos/image/tag.php deleted file mode 100644 index 31869be9e..000000000 --- a/views/default/forms/photos/image/tag.php +++ /dev/null @@ -1,33 +0,0 @@ -'; - -echo elgg_view('input/autocomplete', array( - 'name' => 'username', - 'match_on' => 'friends', -)); - -echo elgg_view('input/hidden', array( - 'name' => 'guid', - 'value' => $vars['entity']->getGUID(), -)); - -echo elgg_view('input/hidden', array( - 'name' => 'coordinates', -)); - -echo '
      '; - -echo '
      '; -echo elgg_view('input/submit', array( - 'value' => elgg_echo('tidypics:actiontag'), -)); -echo '
      '; diff --git a/views/default/js/photos/tagging.php b/views/default/js/photos/tagging.php deleted file mode 100644 index f444aa44c..000000000 --- a/views/default/js/photos/tagging.php +++ /dev/null @@ -1,159 +0,0 @@ - -// + + + + + \ No newline at end of file diff --git a/vendors/jquery-file-upload/cors/result.html b/vendors/jquery-file-upload/cors/result.html new file mode 100644 index 000000000..7c9802684 --- /dev/null +++ b/vendors/jquery-file-upload/cors/result.html @@ -0,0 +1,20 @@ + + + + + +jQuery Iframe Transport Plugin Redirect Page + + + \ No newline at end of file diff --git a/vendors/jquery-file-upload/css/jquery.fileupload-ui.css b/vendors/jquery-file-upload/css/jquery.fileupload-ui.css new file mode 100644 index 000000000..bb706ff06 --- /dev/null +++ b/vendors/jquery-file-upload/css/jquery.fileupload-ui.css @@ -0,0 +1,107 @@ +@charset 'UTF-8'; +/* + * jQuery File Upload UI Plugin CSS 6.3 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +.fileinput-button { + position: relative; + overflow: hidden; + float: left; + margin-right: 5px; +} +.fileinput-button input { + position: absolute; + top: 0; + right: 0; + margin: 0; + border: solid transparent; + border-width: 0 0 100px 200px; + opacity: 0; + filter: alpha(opacity=0); + -moz-transform: translate(-300px, 0) scale(4); + direction: ltr; + cursor: pointer; +} +.fileupload-buttonbar .ui-button, +.fileupload-buttonbar .toggle { + margin-bottom: 5px; +} +.files .progress { + width: 200px; +} +.files .progress, +.fileupload-buttonbar .progress { + height: 20px; +} +.files .ui-progressbar-value, +.fileupload-buttonbar .ui-progressbar-value { + background: url(../img/progressbar.gif); +} +.fileupload-buttonbar .fade, +.files .fade { + display: none; +} +.fileupload-loading { + position: absolute; + left: 50%; + width: 128px; + height: 128px; + background: url(../img/loading.gif) center no-repeat; + display: none; +} +.fileupload-processing .fileupload-loading { + display: block; +} + +/* Fix for IE 6: */ +*html .fileinput-button { + margin-right: -2px; +} +*html .fileinput-button .ui-button-text { + line-height: 24px; +} +*html .fileupload-buttonbar .ui-button { + margin-left: 3px; +} + +/* Fix for IE 7: */ +*+html .fileinput-button { + margin-right: 1px; +} +*+html .fileinput-button .ui-button-text { + line-height: 24px; +} +*+html .fileupload-buttonbar .ui-button { + margin-left: 3px; +} + +@media (max-width: 480px) { + .files .preview * { + width: 40px; + } + .files .name * { + width: 80px; + display: inline-block; + word-wrap: break-word; + } + .files .progress { + width: 20px; + } + .files .delete { + width: 60px; + } +} + +/* Fix for Webkit (Safari, Chrome) */ +@media screen and (-webkit-min-device-pixel-ratio:0) { + .fileinput-button { + margin-top: 2px; + } +} diff --git a/vendors/jquery-file-upload/css/style.css b/vendors/jquery-file-upload/css/style.css new file mode 100644 index 000000000..6ed82e679 --- /dev/null +++ b/vendors/jquery-file-upload/css/style.css @@ -0,0 +1,92 @@ +@charset 'UTF-8'; +/* + * jQuery File Upload Plugin CSS Example 1.1 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + line-height: 18px; + width: 960px; + margin: 10px auto; +} +a { + color: #08C; + text-decoration: none; +} +a:hover, +.active a { + color: #005580; + text-decoration: underline; +} +td { + padding: 5px; +} +img { + border: 0; +} +.nav-collapse, +ul.nav, +ul.nav li { + display: inline-block; + margin-right: 10px; +} +.navbar .brand { + font-size: 16px; +} +.row { + zoom: 1; +} +.row:before, .row:after { + display: table; + content: ""; +} +.row:after { + clear: both; +} +.span5 { + width: 400px; + float: left; +} +.span7 { + width: 560px ; + float: left; +} + +/* Fix for IE 6: */ +*html .nav-collapse, +*html ul.nav, +*html ul.nav li { + display: inline; +} +*html .navbar-fixed-top { + margin-bottom: 35px; +} + +/* Fix for IE 7: */ +*+html .nav-collapse, +*+html ul.nav, +*+html ul.nav li { + display: inline; +} +*+html .navbar-fixed-top { + margin-bottom: 35px; +} + +@media (max-width: 980px) { + body { + width: auto; + padding: 10px; + } + .span5, + .span7 { + width: auto; + } +} diff --git a/vendors/jquery-file-upload/img/loading.gif b/vendors/jquery-file-upload/img/loading.gif new file mode 100644 index 000000000..90f28cbdb Binary files /dev/null and b/vendors/jquery-file-upload/img/loading.gif differ diff --git a/vendors/jquery-file-upload/img/progressbar.gif b/vendors/jquery-file-upload/img/progressbar.gif new file mode 100644 index 000000000..fbcce6bc9 Binary files /dev/null and b/vendors/jquery-file-upload/img/progressbar.gif differ diff --git a/vendors/jquery-file-upload/index.html b/vendors/jquery-file-upload/index.html new file mode 100644 index 000000000..a57d6fa55 --- /dev/null +++ b/vendors/jquery-file-upload/index.html @@ -0,0 +1,234 @@ + + + + + + + +jQuery File Upload Demo + + + + + + + + + + + + + + + +
      + +
      +

      File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery.
      + Supports cross-domain, chunked and resumable file uploads and client-side image resizing.
      + Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.

      +
      +
      + +
      + +
      +
      + + + + Add files... + + + + + + +
      + +
      + +
      +
      +
      + +
       
      +
      +
      + +
      +
      + + +
      +
      +
      +

      Demo Notes

      +
        +
      • The maximum file size for uploads in this demo is 5 MB (default file size is unlimited).
      • +
      • Only image files (JPG, GIF, PNG) are allowed in this demo (by default there is no file type restriction).
      • +
      • Uploaded files will be deleted automatically after 5 minutes (demo setting).
      • +
      • You can drag & drop files from your desktop on this webpage with Google Chrome, Mozilla Firefox and Apple Safari.
      • +
      • Please refer to the project website and documentation for more information.
      • +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendors/jquery-file-upload/js/cors/jquery.postmessage-transport.js b/vendors/jquery-file-upload/js/cors/jquery.postmessage-transport.js new file mode 100644 index 000000000..931b6352b --- /dev/null +++ b/vendors/jquery-file-upload/js/cors/jquery.postmessage-transport.js @@ -0,0 +1,117 @@ +/* + * jQuery postMessage Transport Plugin 1.1 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint unparam: true, nomen: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + var counter = 0, + names = [ + 'accepts', + 'cache', + 'contents', + 'contentType', + 'crossDomain', + 'data', + 'dataType', + 'headers', + 'ifModified', + 'mimeType', + 'password', + 'processData', + 'timeout', + 'traditional', + 'type', + 'url', + 'username' + ], + convert = function (p) { + return p; + }; + + $.ajaxSetup({ + converters: { + 'postmessage text': convert, + 'postmessage json': convert, + 'postmessage html': convert + } + }); + + $.ajaxTransport('postmessage', function (options) { + if (options.postMessage && window.postMessage) { + var iframe, + loc = $('').prop('href', options.postMessage)[0], + target = loc.protocol + '//' + loc.host, + xhrUpload = options.xhr().upload; + return { + send: function (_, completeCallback) { + var message = { + id: 'postmessage-transport-' + (counter += 1) + }, + eventName = 'message.' + message.id; + iframe = $( + '' + ).bind('load', function () { + $.each(names, function (i, name) { + message[name] = options[name]; + }); + message.dataType = message.dataType.replace('postmessage ', ''); + $(window).bind(eventName, function (e) { + e = e.originalEvent; + var data = e.data, + ev; + if (e.origin === target && data.id === message.id) { + if (data.type === 'progress') { + ev = document.createEvent('Event'); + ev.initEvent(data.type, false, true); + $.extend(ev, data); + xhrUpload.dispatchEvent(ev); + } else { + completeCallback( + data.status, + data.statusText, + {postmessage: data.result}, + data.headers + ); + iframe.remove(); + $(window).unbind(eventName); + } + } + }); + iframe[0].contentWindow.postMessage( + message, + target + ); + }).appendTo(document.body); + }, + abort: function () { + if (iframe) { + iframe.remove(); + } + } + }; + } + }); + +})); diff --git a/vendors/jquery-file-upload/js/cors/jquery.xdr-transport.js b/vendors/jquery-file-upload/js/cors/jquery.xdr-transport.js new file mode 100644 index 000000000..c42c54828 --- /dev/null +++ b/vendors/jquery-file-upload/js/cors/jquery.xdr-transport.js @@ -0,0 +1,85 @@ +/* + * jQuery XDomainRequest Transport Plugin 1.1.2 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + * + * Based on Julian Aubourg's ajaxHooks xdr.js: + * https://github.com/jaubourg/ajaxHooks/ + */ + +/*jslint unparam: true */ +/*global define, window, XDomainRequest */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + if (window.XDomainRequest && !$.support.cors) { + $.ajaxTransport(function (s) { + if (s.crossDomain && s.async) { + if (s.timeout) { + s.xdrTimeout = s.timeout; + delete s.timeout; + } + var xdr; + return { + send: function (headers, completeCallback) { + function callback(status, statusText, responses, responseHeaders) { + xdr.onload = xdr.onerror = xdr.ontimeout = $.noop; + xdr = null; + completeCallback(status, statusText, responses, responseHeaders); + } + xdr = new XDomainRequest(); + // XDomainRequest only supports GET and POST: + if (s.type === 'DELETE') { + s.url = s.url + (/\?/.test(s.url) ? '&' : '?') + + '_method=DELETE'; + s.type = 'POST'; + } else if (s.type === 'PUT') { + s.url = s.url + (/\?/.test(s.url) ? '&' : '?') + + '_method=PUT'; + s.type = 'POST'; + } + xdr.open(s.type, s.url); + xdr.onload = function () { + callback( + 200, + 'OK', + {text: xdr.responseText}, + 'Content-Type: ' + xdr.contentType + ); + }; + xdr.onerror = function () { + callback(404, 'Not Found'); + }; + if (s.xdrTimeout) { + xdr.ontimeout = function () { + callback(0, 'timeout'); + }; + xdr.timeout = s.xdrTimeout; + } + xdr.send((s.hasContent && s.data) || null); + }, + abort: function () { + if (xdr) { + xdr.onerror = $.noop(); + xdr.abort(); + } + } + }; + } + }); + } +})); diff --git a/vendors/jquery-file-upload/js/jquery.fileupload-fp.js b/vendors/jquery-file-upload/js/jquery.fileupload-fp.js new file mode 100644 index 000000000..634fb5e4e --- /dev/null +++ b/vendors/jquery-file-upload/js/jquery.fileupload-fp.js @@ -0,0 +1,219 @@ +/* + * jQuery File Upload File Processing Plugin 1.0 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + 'canvas-to-blob', + './jquery.fileupload' + ], factory); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // The File Upload IP version extends the basic fileupload widget + // with file processing functionality: + $.widget('blueimpFP.fileupload', $.blueimp.fileupload, { + + options: { + // The list of file processing actions: + process: [ + /* + { + action: 'load', + fileTypes: /^image\/(gif|jpeg|png)$/, + maxFileSize: 20000000 // 20MB + }, + { + action: 'resize', + maxWidth: 1920, + maxHeight: 1200, + minWidth: 800, + minHeight: 600 + }, + { + action: 'save' + } + */ + ], + + // The add callback is invoked as soon as files are added to the + // fileupload widget (via file input selection, drag & drop or add + // API call). See the basic file upload widget for more information: + add: function (e, data) { + $(this).fileupload('process', data).done(function () { + data.submit(); + }); + } + }, + + processActions: { + // Loads the image given via data.files and data.index + // as canvas element. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + load: function (data, options) { + var that = this, + file = data.files[data.index], + dfd = $.Deferred(); + if (window.HTMLCanvasElement && + window.HTMLCanvasElement.prototype.toBlob && + ($.type(options.maxFileSize) !== 'number' || + file.size < options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + loadImage( + file, + function (canvas) { + data.canvas = canvas; + dfd.resolveWith(that, [data]); + }, + {canvas: true} + ); + } else { + dfd.rejectWith(that, [data]); + } + return dfd.promise(); + }, + // Resizes the image given as data.canvas and updates + // data.canvas with the resized image. + // Accepts the options maxWidth, maxHeight, minWidth and + // minHeight to scale the given image: + resize: function (data, options) { + if (data.canvas) { + var canvas = loadImage.scale(data.canvas, options); + if (canvas.width !== data.canvas.width || + canvas.height !== data.canvas.height) { + data.canvas = canvas; + data.processed = true; + } + } + return data; + }, + // Saves the processed image given as data.canvas + // inplace at data.index of data.files: + save: function (data, options) { + // Do nothing if no processing has happened: + if (!data.canvas || !data.processed) { + return data; + } + var that = this, + file = data.files[data.index], + name = file.name, + dfd = $.Deferred(), + callback = function (blob) { + if (!blob.name) { + if (file.type === blob.type) { + blob.name = file.name; + } else if (file.name) { + blob.name = file.name.replace( + /\..+$/, + '.' + blob.type.substr(6) + ); + } + } + // Store the created blob at the position + // of the original file in the files list: + data.files[data.index] = blob; + dfd.resolveWith(that, [data]); + }; + // Use canvas.mozGetAsFile directly, to retain the filename, as + // Gecko doesn't support the filename option for FormData.append: + if (data.canvas.mozGetAsFile) { + callback(data.canvas.mozGetAsFile( + (/^image\/(jpeg|png)$/.test(file.type) && name) || + ((name && name.replace(/\..+$/, '')) || + 'blob') + '.png', + file.type + )); + } else { + data.canvas.toBlob(callback, file.type); + } + return dfd.promise(); + } + }, + + // Resizes the file at the given index and stores the created blob at + // the original position of the files list, returns a Promise object: + _processFile: function (files, index, options) { + var that = this, + dfd = $.Deferred().resolveWith(that, [{ + files: files, + index: index + }]), + chain = dfd.promise(); + that._processing += 1; + $.each(options.process, function (i, settings) { + chain = chain.pipe(function (data) { + return that.processActions[settings.action] + .call(this, data, settings); + }); + }); + chain.always(function () { + that._processing -= 1; + if (that._processing === 0) { + that.element + .removeClass('fileupload-processing'); + } + }); + if (that._processing === 1) { + that.element.addClass('fileupload-processing'); + } + return chain; + }, + + // Processes the files given as files property of the data parameter, + // returns a Promise object that allows to bind a done handler, which + // will be invoked after processing all files (inplace) is done: + process: function (data) { + var that = this, + options = $.extend({}, this.options, data); + if (options.process && options.process.length && + this._isXHRUpload(options)) { + $.each(data.files, function (index, file) { + that._processingQueue = that._processingQueue.pipe( + function () { + var dfd = $.Deferred(); + that._processFile(data.files, index, options) + .always(function () { + dfd.resolveWith(that); + }); + return dfd.promise(); + } + ); + }); + } + return this._processingQueue; + }, + + _create: function () { + $.blueimp.fileupload.prototype._create.call(this); + this._processing = 0; + this._processingQueue = $.Deferred().resolveWith(this) + .promise(); + } + + }); + +})); diff --git a/vendors/jquery-file-upload/js/jquery.fileupload-jui.js b/vendors/jquery-file-upload/js/jquery.fileupload-jui.js new file mode 100644 index 000000000..69736a4a4 --- /dev/null +++ b/vendors/jquery-file-upload/js/jquery.fileupload-jui.js @@ -0,0 +1,141 @@ +/* + * jQuery File Upload jQuery UI Plugin 1.2 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true */ +/*global define, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery', './jquery.fileupload-ui.js'], factory); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + $.widget('blueimpJUI.fileupload', $.blueimpUI.fileupload, { + options: { + sent: function (e, data) { + if (data.context && data.dataType && + data.dataType.substr(0, 6) === 'iframe') { + // Iframe Transport does not support progress events. + // In lack of an indeterminate progress bar, we set + // the progress to 100%, showing the full animated bar: + data.context + .find('.progress').progressbar( + 'option', + 'value', + 100 + ); + } + }, + progress: function (e, data) { + if (data.context) { + data.context.find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ); + } + }, + progressall: function (e, data) { + var $this = $(this); + $this.find('.fileupload-progress') + .find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ).end() + .find('.progress-extended').each(function () { + $(this).html( + $this.data('fileupload') + ._renderExtendedProgress(data) + ); + }); + } + }, + _renderUpload: function (func, files) { + var node = $.blueimpUI.fileupload.prototype + ._renderUpload.call(this, func, files), + showIconText = $(window).width() > 480; + node.find('.progress').empty().progressbar(); + node.find('.start button').button({ + icons: {primary: 'ui-icon-circle-arrow-e'}, + text: showIconText + }); + node.find('.cancel button').button({ + icons: {primary: 'ui-icon-cancel'}, + text: showIconText + }); + return node; + }, + _renderDownload: function (func, files) { + var node = $.blueimpUI.fileupload.prototype + ._renderDownload.call(this, func, files), + showIconText = $(window).width() > 480; + node.find('.delete button').button({ + icons: {primary: 'ui-icon-trash'}, + text: showIconText + }); + return node; + }, + _transition: function (node) { + var that = this, + deferred = $.Deferred(); + if (node.hasClass('fade')) { + node.fadeToggle(function () { + deferred.resolveWith(node); + }); + } else { + deferred.resolveWith(node); + } + return deferred; + }, + _create: function () { + $.blueimpUI.fileupload.prototype._create.call(this); + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button({icons: {primary: 'ui-icon-plusthick'}}) + .append(input); + }) + .end().find('.start') + .button({icons: {primary: 'ui-icon-circle-arrow-e'}}) + .end().find('.cancel') + .button({icons: {primary: 'ui-icon-cancel'}}) + .end().find('.delete') + .button({icons: {primary: 'ui-icon-trash'}}) + .end().find('.progress').empty().progressbar(); + }, + destroy: function () { + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button('destroy') + .append(input); + }) + .end().find('.start') + .button('destroy') + .end().find('.cancel') + .button('destroy') + .end().find('.delete') + .button('destroy') + .end().find('.progress').progressbar('destroy'); + $.blueimpUI.fileupload.prototype.destroy.call(this); + } + }); +})); diff --git a/vendors/jquery-file-upload/js/jquery.fileupload-ui.js b/vendors/jquery-file-upload/js/jquery.fileupload-ui.js new file mode 100644 index 000000000..4c36f0086 --- /dev/null +++ b/vendors/jquery-file-upload/js/jquery.fileupload-ui.js @@ -0,0 +1,736 @@ +/* + * jQuery File Upload User Interface Plugin 6.9.4 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global define, window, document, URL, webkitURL, FileReader */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'tmpl', + 'load-image', + './jquery.fileupload-fp' + ], factory); + } else { + // Browser globals: + factory( + window.jQuery, + window.tmpl, + window.loadImage + ); + } +}(function ($, tmpl, loadImage) { + 'use strict'; + + // The UI version extends the FP (file processing) version or the basic + // file upload widget and adds complete user interface interaction: + var parentWidget = ($.blueimpFP || $.blueimp).fileupload; + $.widget('blueimpUI.fileupload', parentWidget, { + + options: { + // By default, files added to the widget are uploaded as soon + // as the user clicks on the start buttons. To enable automatic + // uploads, set the following option to true: + autoUpload: false, + // The following option limits the number of files that are + // allowed to be uploaded using this widget: + maxNumberOfFiles: undefined, + // The maximum allowed file size: + maxFileSize: undefined, + // The minimum allowed file size: + minFileSize: undefined, + // The regular expression for allowed file types, matches + // against either file type or file name: + acceptFileTypes: /.+$/i, + // The regular expression to define for which files a preview + // image is shown, matched against the file type: + previewSourceFileTypes: /^image\/(gif|jpeg|png)$/, + // The maximum file size of images that are to be displayed as preview: + previewSourceMaxFileSize: 5000000, // 5MB + // The maximum width of the preview images: + previewMaxWidth: 80, + // The maximum height of the preview images: + previewMaxHeight: 80, + // By default, preview images are displayed as canvas elements + // if supported by the browser. Set the following option to false + // to always display preview images as img elements: + previewAsCanvas: true, + // The ID of the upload template: + uploadTemplateId: 'template-upload', + // The ID of the download template: + downloadTemplateId: 'template-download', + // The container for the list of files. If undefined, it is set to + // an element with class "files" inside of the widget element: + filesContainer: undefined, + // By default, files are appended to the files container. + // Set the following option to true, to prepend files instead: + prependFiles: false, + // The expected data type of the upload response, sets the dataType + // option of the $.ajax upload requests: + dataType: 'json', + + // The add callback is invoked as soon as files are added to the fileupload + // widget (via file input selection, drag & drop or add API call). + // See the basic file upload widget for more information: + add: function (e, data) { + var that = $(this).data('fileupload'), + options = that.options, + files = data.files; + $(this).fileupload('process', data).done(function () { + that._adjustMaxNumberOfFiles(-files.length); + data.maxNumberOfFilesAdjusted = true; + data.files.valid = data.isValidated = that._validate(files); + data.context = that._renderUpload(files).data('data', data); + options.filesContainer[ + options.prependFiles ? 'prepend' : 'append' + ](data.context); + that._renderPreviews(files, data.context); + that._forceReflow(data.context); + that._transition(data.context).done( + function () { + if ((that._trigger('added', e, data) !== false) && + (options.autoUpload || data.autoUpload) && + data.autoUpload !== false && data.isValidated) { + data.submit(); + } + } + ); + }); + }, + // Callback for the start of each file upload request: + send: function (e, data) { + var that = $(this).data('fileupload'); + if (!data.isValidated) { + if (!data.maxNumberOfFilesAdjusted) { + that._adjustMaxNumberOfFiles(-data.files.length); + data.maxNumberOfFilesAdjusted = true; + } + if (!that._validate(data.files)) { + return false; + } + } + if (data.context && data.dataType && + data.dataType.substr(0, 6) === 'iframe') { + // Iframe Transport does not support progress events. + // In lack of an indeterminate progress bar, we set + // the progress to 100%, showing the full animated bar: + data.context + .find('.progress').addClass( + !$.support.transition && 'progress-animated' + ) + .attr('aria-valuenow', 100) + .find('.bar').css( + 'width', + '100%' + ); + } + return that._trigger('sent', e, data); + }, + // Callback for successful uploads: + done: function (e, data) { + var that = $(this).data('fileupload'), + template; + if (data.context) { + data.context.each(function (index) { + var file = ($.isArray(data.result) && + data.result[index]) || {error: 'emptyResult'}; + if (file.error) { + that._adjustMaxNumberOfFiles(1); + } + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + } + ); + } + ); + }); + } else { + if ($.isArray(data.result)) { + $.each(data.result, function (index, file) { + if (data.maxNumberOfFilesAdjusted && file.error) { + that._adjustMaxNumberOfFiles(1); + } else if (!data.maxNumberOfFilesAdjusted && + !file.error) { + that._adjustMaxNumberOfFiles(-1); + } + }); + data.maxNumberOfFilesAdjusted = true; + } + template = that._renderDownload(data.result) + .appendTo(that.options.filesContainer); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + } + ); + } + }, + // Callback for failed (abort or error) uploads: + fail: function (e, data) { + var that = $(this).data('fileupload'), + template; + if (data.maxNumberOfFilesAdjusted) { + that._adjustMaxNumberOfFiles(data.files.length); + } + if (data.context) { + data.context.each(function (index) { + if (data.errorThrown !== 'abort') { + var file = data.files[index]; + file.error = file.error || data.errorThrown || + true; + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('failed', e, data); + } + ); + } + ); + } else { + that._transition($(this)).done( + function () { + $(this).remove(); + that._trigger('failed', e, data); + } + ); + } + }); + } else if (data.errorThrown !== 'abort') { + data.context = that._renderUpload(data.files) + .appendTo(that.options.filesContainer) + .data('data', data); + that._forceReflow(data.context); + that._transition(data.context).done( + function () { + data.context = $(this); + that._trigger('failed', e, data); + } + ); + } else { + that._trigger('failed', e, data); + } + }, + // Callback for upload progress events: + progress: function (e, data) { + if (data.context) { + var progress = parseInt(data.loaded / data.total * 100, 10); + data.context.find('.progress') + .attr('aria-valuenow', progress) + .find('.bar').css( + 'width', + progress + '%' + ); + } + }, + // Callback for global upload progress events: + progressall: function (e, data) { + var $this = $(this), + progress = parseInt(data.loaded / data.total * 100, 10), + globalProgressNode = $this.find('.fileupload-progress'), + extendedProgressNode = globalProgressNode + .find('.progress-extended'); + if (extendedProgressNode.length) { + extendedProgressNode.html( + $this.data('fileupload')._renderExtendedProgress(data) + ); + } + globalProgressNode + .find('.progress') + .attr('aria-valuenow', progress) + .find('.bar').css( + 'width', + progress + '%' + ); + }, + // Callback for uploads start, equivalent to the global ajaxStart event: + start: function (e) { + var that = $(this).data('fileupload'); + that._transition($(this).find('.fileupload-progress')).done( + function () { + that._trigger('started', e); + } + ); + }, + // Callback for uploads stop, equivalent to the global ajaxStop event: + stop: function (e) { + var that = $(this).data('fileupload'); + that._transition($(this).find('.fileupload-progress')).done( + function () { + $(this).find('.progress') + .attr('aria-valuenow', '0') + .find('.bar').css('width', '0%'); + $(this).find('.progress-extended').html(' '); + that._trigger('stopped', e); + } + ); + }, + // Callback for file deletion: + destroy: function (e, data) { + var that = $(this).data('fileupload'); + if (data.url) { + $.ajax(data); + that._adjustMaxNumberOfFiles(1); + } + that._transition(data.context).done( + function () { + $(this).remove(); + that._trigger('destroyed', e, data); + } + ); + } + }, + + // Link handler, that allows to download files + // by drag & drop of the links to the desktop: + _enableDragToDesktop: function () { + var link = $(this), + url = link.prop('href'), + name = link.prop('download'), + type = 'application/octet-stream'; + link.bind('dragstart', function (e) { + try { + e.originalEvent.dataTransfer.setData( + 'DownloadURL', + [type, name, url].join(':') + ); + } catch (err) {} + }); + }, + + _adjustMaxNumberOfFiles: function (operand) { + if (typeof this.options.maxNumberOfFiles === 'number') { + this.options.maxNumberOfFiles += operand; + if (this.options.maxNumberOfFiles < 1) { + this._disableFileInputButton(); + } else { + this._enableFileInputButton(); + } + } + }, + + _formatFileSize: function (bytes) { + if (typeof bytes !== 'number') { + return ''; + } + if (bytes >= 1000000000) { + return (bytes / 1000000000).toFixed(2) + ' GB'; + } + if (bytes >= 1000000) { + return (bytes / 1000000).toFixed(2) + ' MB'; + } + return (bytes / 1000).toFixed(2) + ' KB'; + }, + + _formatBitrate: function (bits) { + if (typeof bits !== 'number') { + return ''; + } + if (bits >= 1000000000) { + return (bits / 1000000000).toFixed(2) + ' Gbit/s'; + } + if (bits >= 1000000) { + return (bits / 1000000).toFixed(2) + ' Mbit/s'; + } + if (bits >= 1000) { + return (bits / 1000).toFixed(2) + ' kbit/s'; + } + return bits + ' bit/s'; + }, + + _formatTime: function (seconds) { + var date = new Date(seconds * 1000), + days = parseInt(seconds / 86400, 10); + days = days ? days + 'd ' : ''; + return days + + ('0' + date.getUTCHours()).slice(-2) + ':' + + ('0' + date.getUTCMinutes()).slice(-2) + ':' + + ('0' + date.getUTCSeconds()).slice(-2); + }, + + _formatPercentage: function (floatValue) { + return (floatValue * 100).toFixed(2) + ' %'; + }, + + _renderExtendedProgress: function (data) { + return this._formatBitrate(data.bitrate) + ' | ' + + this._formatTime( + (data.total - data.loaded) * 8 / data.bitrate + ) + ' | ' + + this._formatPercentage( + data.loaded / data.total + ) + ' | ' + + this._formatFileSize(data.loaded) + ' / ' + + this._formatFileSize(data.total); + }, + + _hasError: function (file) { + if (file.error) { + return file.error; + } + // The number of added files is subtracted from + // maxNumberOfFiles before validation, so we check if + // maxNumberOfFiles is below 0 (instead of below 1): + if (this.options.maxNumberOfFiles < 0) { + return 'maxNumberOfFiles'; + } + // Files are accepted if either the file type or the file name + // matches against the acceptFileTypes regular expression, as + // only browsers with support for the File API report the type: + if (!(this.options.acceptFileTypes.test(file.type) || + this.options.acceptFileTypes.test(file.name))) { + return 'acceptFileTypes'; + } + if (this.options.maxFileSize && + file.size > this.options.maxFileSize) { + return 'maxFileSize'; + } + if (typeof file.size === 'number' && + file.size < this.options.minFileSize) { + return 'minFileSize'; + } + return null; + }, + + _validate: function (files) { + var that = this, + valid = !!files.length; + $.each(files, function (index, file) { + file.error = that._hasError(file); + if (file.error) { + valid = false; + } + }); + return valid; + }, + + _renderTemplate: function (func, files) { + if (!func) { + return $(); + } + var result = func({ + files: files, + formatFileSize: this._formatFileSize, + options: this.options + }); + if (result instanceof $) { + return result; + } + return $(this.options.templatesContainer).html(result).children(); + }, + + _renderPreview: function (file, node) { + var that = this, + options = this.options, + dfd = $.Deferred(); + return ((loadImage && loadImage( + file, + function (img) { + node.append(img); + that._forceReflow(node); + that._transition(node).done(function () { + dfd.resolveWith(node); + }); + if (!$.contains(document.body, node[0])) { + // If the element is not part of the DOM, + // transition events are not triggered, + // so we have to resolve manually: + dfd.resolveWith(node); + } + }, + { + maxWidth: options.previewMaxWidth, + maxHeight: options.previewMaxHeight, + canvas: options.previewAsCanvas + } + )) || dfd.resolveWith(node)) && dfd; + }, + + _renderPreviews: function (files, nodes) { + var that = this, + options = this.options; + nodes.find('.preview span').each(function (index, element) { + var file = files[index]; + if (options.previewSourceFileTypes.test(file.type) && + ($.type(options.previewSourceMaxFileSize) !== 'number' || + file.size < options.previewSourceMaxFileSize)) { + that._processingQueue = that._processingQueue.pipe(function () { + var dfd = $.Deferred(); + that._renderPreview(file, $(element)).done( + function () { + dfd.resolveWith(that); + } + ); + return dfd.promise(); + }); + } + }); + return this._processingQueue; + }, + + _renderUpload: function (files) { + return this._renderTemplate( + this.options.uploadTemplate, + files + ); + }, + + _renderDownload: function (files) { + return this._renderTemplate( + this.options.downloadTemplate, + files + ).find('a[download]').each(this._enableDragToDesktop).end(); + }, + + _startHandler: function (e) { + e.preventDefault(); + var button = $(this), + template = button.closest('.template-upload'), + data = template.data('data'); + if (data && data.submit && !data.jqXHR && data.submit()) { + button.prop('disabled', true); + } + }, + + _cancelHandler: function (e) { + e.preventDefault(); + var template = $(this).closest('.template-upload'), + data = template.data('data') || {}; + if (!data.jqXHR) { + data.errorThrown = 'abort'; + e.data.fileupload._trigger('fail', e, data); + } else { + data.jqXHR.abort(); + } + }, + + _deleteHandler: function (e) { + e.preventDefault(); + var button = $(this); + e.data.fileupload._trigger('destroy', e, { + context: button.closest('.template-download'), + url: button.attr('data-url'), + type: button.attr('data-type') || 'DELETE', + dataType: e.data.fileupload.options.dataType + }); + }, + + _forceReflow: function (node) { + return $.support.transition && node.length && + node[0].offsetWidth; + }, + + _transition: function (node) { + var dfd = $.Deferred(); + if ($.support.transition && node.hasClass('fade')) { + node.bind( + $.support.transition.end, + function (e) { + // Make sure we don't respond to other transitions events + // in the container element, e.g. from button elements: + if (e.target === node[0]) { + node.unbind($.support.transition.end); + dfd.resolveWith(node); + } + } + ).toggleClass('in'); + } else { + node.toggleClass('in'); + dfd.resolveWith(node); + } + return dfd; + }, + + _initButtonBarEventHandlers: function () { + var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'), + filesList = this.options.filesContainer, + ns = this.options.namespace; + fileUploadButtonBar.find('.start') + .bind('click.' + ns, function (e) { + e.preventDefault(); + filesList.find('.start button').click(); + }); + fileUploadButtonBar.find('.cancel') + .bind('click.' + ns, function (e) { + e.preventDefault(); + filesList.find('.cancel button').click(); + }); + fileUploadButtonBar.find('.delete') + .bind('click.' + ns, function (e) { + e.preventDefault(); + filesList.find('.delete input:checked') + .siblings('button').click(); + fileUploadButtonBar.find('.toggle') + .prop('checked', false); + }); + fileUploadButtonBar.find('.toggle') + .bind('change.' + ns, function (e) { + filesList.find('.delete input').prop( + 'checked', + $(this).is(':checked') + ); + }); + }, + + _destroyButtonBarEventHandlers: function () { + this.element.find('.fileupload-buttonbar button') + .unbind('click.' + this.options.namespace); + this.element.find('.fileupload-buttonbar .toggle') + .unbind('change.' + this.options.namespace); + }, + + _initEventHandlers: function () { + parentWidget.prototype._initEventHandlers.call(this); + var eventData = {fileupload: this}; + this.options.filesContainer + .delegate( + '.start button', + 'click.' + this.options.namespace, + eventData, + this._startHandler + ) + .delegate( + '.cancel button', + 'click.' + this.options.namespace, + eventData, + this._cancelHandler + ) + .delegate( + '.delete button', + 'click.' + this.options.namespace, + eventData, + this._deleteHandler + ); + this._initButtonBarEventHandlers(); + }, + + _destroyEventHandlers: function () { + var options = this.options; + this._destroyButtonBarEventHandlers(); + options.filesContainer + .undelegate('.start button', 'click.' + options.namespace) + .undelegate('.cancel button', 'click.' + options.namespace) + .undelegate('.delete button', 'click.' + options.namespace); + parentWidget.prototype._destroyEventHandlers.call(this); + }, + + _enableFileInputButton: function () { + this.element.find('.fileinput-button input') + .prop('disabled', false) + .parent().removeClass('disabled'); + }, + + _disableFileInputButton: function () { + this.element.find('.fileinput-button input') + .prop('disabled', true) + .parent().addClass('disabled'); + }, + + _initTemplates: function () { + var options = this.options; + options.templatesContainer = document.createElement( + options.filesContainer.prop('nodeName') + ); + if (tmpl) { + if (options.uploadTemplateId) { + options.uploadTemplate = tmpl(options.uploadTemplateId); + } + if (options.downloadTemplateId) { + options.downloadTemplate = tmpl(options.downloadTemplateId); + } + } + }, + + _initFilesContainer: function () { + var options = this.options; + if (options.filesContainer === undefined) { + options.filesContainer = this.element.find('.files'); + } else if (!(options.filesContainer instanceof $)) { + options.filesContainer = $(options.filesContainer); + } + }, + + _stringToRegExp: function (str) { + var parts = str.split('/'), + modifiers = parts.pop(); + parts.shift(); + return new RegExp(parts.join('/'), modifiers); + }, + + _initRegExpOptions: function () { + var options = this.options; + if ($.type(options.acceptFileTypes) === 'string') { + options.acceptFileTypes = this._stringToRegExp( + options.acceptFileTypes + ); + } + if ($.type(options.previewSourceFileTypes) === 'string') { + options.previewSourceFileTypes = this._stringToRegExp( + options.previewSourceFileTypes + ); + } + }, + + _initSpecialOptions: function () { + parentWidget.prototype._initSpecialOptions.call(this); + this._initFilesContainer(); + this._initTemplates(); + this._initRegExpOptions(); + }, + + _create: function () { + parentWidget.prototype._create.call(this); + this._refreshOptionsList.push( + 'filesContainer', + 'uploadTemplateId', + 'downloadTemplateId' + ); + if (!$.blueimpFP) { + this._processingQueue = $.Deferred().resolveWith(this).promise(); + this.process = function () { + return this._processingQueue; + }; + } + }, + + enable: function () { + parentWidget.prototype.enable.call(this); + this.element.find('input, button').prop('disabled', false); + this._enableFileInputButton(); + }, + + disable: function () { + this.element.find('input, button').prop('disabled', true); + this._disableFileInputButton(); + parentWidget.prototype.disable.call(this); + } + + }); + +})); diff --git a/vendors/jquery-file-upload/js/jquery.fileupload.js b/vendors/jquery-file-upload/js/jquery.fileupload.js new file mode 100644 index 000000000..4bbd28729 --- /dev/null +++ b/vendors/jquery-file-upload/js/jquery.fileupload.js @@ -0,0 +1,972 @@ +/* + * jQuery File Upload Plugin 5.13 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global define, window, document, Blob, FormData, location */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'jquery.ui.widget' + ], factory); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + // The FileReader API is not actually used, but works as feature detection, + // as e.g. Safari supports XHR file uploads via the FormData API, + // but not non-multipart XHR file uploads: + $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader); + $.support.xhrFormDataFileUpload = !!window.FormData; + + // The fileupload widget listens for change events on file input fields defined + // via fileInput setting and paste or drop events of the given dropZone. + // In addition to the default jQuery Widget methods, the fileupload widget + // exposes the "add" and "send" methods, to add or directly send files using + // the fileupload API. + // By default, files added via file input selection, paste, drag & drop or + // "add" method are uploaded immediately, but it is possible to override + // the "add" callback option to queue file uploads. + $.widget('blueimp.fileupload', { + + options: { + // The namespace used for event handler binding on the dropZone and + // fileInput collections. + // If not set, the name of the widget ("fileupload") is used. + namespace: undefined, + // The drop target collection, by the default the complete document. + // Set to null or an empty collection to disable drag & drop support: + dropZone: $(document), + // The file input field collection, that is listened for change events. + // If undefined, it is set to the file input fields inside + // of the widget element on plugin initialization. + // Set to null or an empty collection to disable the change listener. + fileInput: undefined, + // By default, the file input field is replaced with a clone after + // each input field change event. This is required for iframe transport + // queues and allows change events to be fired for the same file + // selection, but can be disabled by setting the following option to false: + replaceFileInput: true, + // The parameter name for the file form data (the request argument name). + // If undefined or empty, the name property of the file input field is + // used, or "files[]" if the file input name property is also empty, + // can be a string or an array of strings: + paramName: undefined, + // By default, each file of a selection is uploaded using an individual + // request for XHR type uploads. Set to false to upload file + // selections in one request each: + singleFileUploads: true, + // To limit the number of files uploaded with one XHR request, + // set the following option to an integer greater than 0: + limitMultiFileUploads: undefined, + // Set the following option to true to issue all file upload requests + // in a sequential order: + sequentialUploads: false, + // To limit the number of concurrent uploads, + // set the following option to an integer greater than 0: + limitConcurrentUploads: undefined, + // Set the following option to true to force iframe transport uploads: + forceIframeTransport: false, + // Set the following option to the location of a redirect url on the + // origin server, for cross-domain iframe transport uploads: + redirect: undefined, + // The parameter name for the redirect url, sent as part of the form + // data and set to 'redirect' if this option is empty: + redirectParamName: undefined, + // Set the following option to the location of a postMessage window, + // to enable postMessage transport uploads: + postMessage: undefined, + // By default, XHR file uploads are sent as multipart/form-data. + // The iframe transport is always using multipart/form-data. + // Set to false to enable non-multipart XHR uploads: + multipart: true, + // To upload large files in smaller chunks, set the following option + // to a preferred maximum chunk size. If set to 0, null or undefined, + // or the browser does not support the required Blob API, files will + // be uploaded as a whole. + maxChunkSize: undefined, + // When a non-multipart upload or a chunked multipart upload has been + // aborted, this option can be used to resume the upload by setting + // it to the size of the already uploaded bytes. This option is most + // useful when modifying the options object inside of the "add" or + // "send" callbacks, as the options are cloned for each file upload. + uploadedBytes: undefined, + // By default, failed (abort or error) file uploads are removed from the + // global progress calculation. Set the following option to false to + // prevent recalculating the global progress data: + recalculateProgress: true, + // Interval in milliseconds to calculate and trigger progress events: + progressInterval: 100, + // Interval in milliseconds to calculate progress bitrate: + bitrateInterval: 500, + + // Additional form data to be sent along with the file uploads can be set + // using this option, which accepts an array of objects with name and + // value properties, a function returning such an array, a FormData + // object (for XHR file uploads), or a simple object. + // The form of the first fileInput is given as parameter to the function: + formData: function (form) { + return form.serializeArray(); + }, + + // The add callback is invoked as soon as files are added to the fileupload + // widget (via file input selection, drag & drop, paste or add API call). + // If the singleFileUploads option is enabled, this callback will be + // called once for each file in the selection for XHR file uplaods, else + // once for each file selection. + // The upload starts when the submit method is invoked on the data parameter. + // The data object contains a files property holding the added files + // and allows to override plugin options as well as define ajax settings. + // Listeners for this callback can also be bound the following way: + // .bind('fileuploadadd', func); + // data.submit() returns a Promise object and allows to attach additional + // handlers using jQuery's Deferred callbacks: + // data.submit().done(func).fail(func).always(func); + add: function (e, data) { + data.submit(); + }, + + // Other callbacks: + // Callback for the submit event of each file upload: + // submit: function (e, data) {}, // .bind('fileuploadsubmit', func); + // Callback for the start of each file upload request: + // send: function (e, data) {}, // .bind('fileuploadsend', func); + // Callback for successful uploads: + // done: function (e, data) {}, // .bind('fileuploaddone', func); + // Callback for failed (abort or error) uploads: + // fail: function (e, data) {}, // .bind('fileuploadfail', func); + // Callback for completed (success, abort or error) requests: + // always: function (e, data) {}, // .bind('fileuploadalways', func); + // Callback for upload progress events: + // progress: function (e, data) {}, // .bind('fileuploadprogress', func); + // Callback for global upload progress events: + // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func); + // Callback for uploads start, equivalent to the global ajaxStart event: + // start: function (e) {}, // .bind('fileuploadstart', func); + // Callback for uploads stop, equivalent to the global ajaxStop event: + // stop: function (e) {}, // .bind('fileuploadstop', func); + // Callback for change events of the fileInput collection: + // change: function (e, data) {}, // .bind('fileuploadchange', func); + // Callback for paste events to the dropZone collection: + // paste: function (e, data) {}, // .bind('fileuploadpaste', func); + // Callback for drop events of the dropZone collection: + // drop: function (e, data) {}, // .bind('fileuploaddrop', func); + // Callback for dragover events of the dropZone collection: + // dragover: function (e) {}, // .bind('fileuploaddragover', func); + + // The plugin options are used as settings object for the ajax calls. + // The following are jQuery ajax settings required for the file uploads: + processData: false, + contentType: false, + cache: false + }, + + // A list of options that require a refresh after assigning a new value: + _refreshOptionsList: [ + 'namespace', + 'dropZone', + 'fileInput', + 'multipart', + 'forceIframeTransport' + ], + + _BitrateTimer: function () { + this.timestamp = +(new Date()); + this.loaded = 0; + this.bitrate = 0; + this.getBitrate = function (now, loaded, interval) { + var timeDiff = now - this.timestamp; + if (!this.bitrate || !interval || timeDiff > interval) { + this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8; + this.loaded = loaded; + this.timestamp = now; + } + return this.bitrate; + }; + }, + + _isXHRUpload: function (options) { + return !options.forceIframeTransport && + ((!options.multipart && $.support.xhrFileUpload) || + $.support.xhrFormDataFileUpload); + }, + + _getFormData: function (options) { + var formData; + if (typeof options.formData === 'function') { + return options.formData(options.form); + } + if ($.isArray(options.formData)) { + return options.formData; + } + if (options.formData) { + formData = []; + $.each(options.formData, function (name, value) { + formData.push({name: name, value: value}); + }); + return formData; + } + return []; + }, + + _getTotal: function (files) { + var total = 0; + $.each(files, function (index, file) { + total += file.size || 1; + }); + return total; + }, + + _onProgress: function (e, data) { + if (e.lengthComputable) { + var now = +(new Date()), + total, + loaded; + if (data._time && data.progressInterval && + (now - data._time < data.progressInterval) && + e.loaded !== e.total) { + return; + } + data._time = now; + total = data.total || this._getTotal(data.files); + loaded = parseInt( + e.loaded / e.total * (data.chunkSize || total), + 10 + ) + (data.uploadedBytes || 0); + this._loaded += loaded - (data.loaded || data.uploadedBytes || 0); + data.lengthComputable = true; + data.loaded = loaded; + data.total = total; + data.bitrate = data._bitrateTimer.getBitrate( + now, + loaded, + data.bitrateInterval + ); + // Trigger a custom progress event with a total data property set + // to the file size(s) of the current upload and a loaded data + // property calculated accordingly: + this._trigger('progress', e, data); + // Trigger a global progress event for all current file uploads, + // including ajax calls queued for sequential file uploads: + this._trigger('progressall', e, { + lengthComputable: true, + loaded: this._loaded, + total: this._total, + bitrate: this._bitrateTimer.getBitrate( + now, + this._loaded, + data.bitrateInterval + ) + }); + } + }, + + _initProgressListener: function (options) { + var that = this, + xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); + // Accesss to the native XHR object is required to add event listeners + // for the upload progress event: + if (xhr.upload) { + $(xhr.upload).bind('progress', function (e) { + var oe = e.originalEvent; + // Make sure the progress event properties get copied over: + e.lengthComputable = oe.lengthComputable; + e.loaded = oe.loaded; + e.total = oe.total; + that._onProgress(e, options); + }); + options.xhr = function () { + return xhr; + }; + } + }, + + _initXHRData: function (options) { + var formData, + file = options.files[0], + // Ignore non-multipart setting if not supported: + multipart = options.multipart || !$.support.xhrFileUpload, + paramName = options.paramName[0]; + if (!multipart || options.blob) { + // For non-multipart uploads and chunked uploads, + // file meta data is not part of the request body, + // so we transmit this data as part of the HTTP headers. + // For cross domain requests, these headers must be allowed + // via Access-Control-Allow-Headers or removed using + // the beforeSend callback: + options.headers = $.extend(options.headers, { + 'X-File-Name': file.name, + 'X-File-Type': file.type, + 'X-File-Size': file.size + }); + if (!options.blob) { + // Non-chunked non-multipart upload: + options.contentType = file.type; + options.data = file; + } else if (!multipart) { + // Chunked non-multipart upload: + options.contentType = 'application/octet-stream'; + options.data = options.blob; + } + } + if (multipart && $.support.xhrFormDataFileUpload) { + if (options.postMessage) { + // window.postMessage does not allow sending FormData + // objects, so we just add the File/Blob objects to + // the formData array and let the postMessage window + // create the FormData object out of this array: + formData = this._getFormData(options); + if (options.blob) { + formData.push({ + name: paramName, + value: options.blob + }); + } else { + $.each(options.files, function (index, file) { + formData.push({ + name: options.paramName[index] || paramName, + value: file + }); + }); + } + } else { + if (options.formData instanceof FormData) { + formData = options.formData; + } else { + formData = new FormData(); + $.each(this._getFormData(options), function (index, field) { + formData.append(field.name, field.value); + }); + } + if (options.blob) { + formData.append(paramName, options.blob, file.name); + } else { + $.each(options.files, function (index, file) { + // File objects are also Blob instances. + // This check allows the tests to run with + // dummy objects: + if (file instanceof Blob) { + formData.append( + options.paramName[index] || paramName, + file, + file.name + ); + } + }); + } + } + options.data = formData; + } + // Blob reference is not needed anymore, free memory: + options.blob = null; + }, + + _initIframeSettings: function (options) { + // Setting the dataType to iframe enables the iframe transport: + options.dataType = 'iframe ' + (options.dataType || ''); + // The iframe transport accepts a serialized array as form data: + options.formData = this._getFormData(options); + // Add redirect url to form data on cross-domain uploads: + if (options.redirect && $('').prop('href', options.url) + .prop('host') !== location.host) { + options.formData.push({ + name: options.redirectParamName || 'redirect', + value: options.redirect + }); + } + }, + + _initDataSettings: function (options) { + if (this._isXHRUpload(options)) { + if (!this._chunkedUpload(options, true)) { + if (!options.data) { + this._initXHRData(options); + } + this._initProgressListener(options); + } + if (options.postMessage) { + // Setting the dataType to postmessage enables the + // postMessage transport: + options.dataType = 'postmessage ' + (options.dataType || ''); + } + } else { + this._initIframeSettings(options, 'iframe'); + } + }, + + _getParamName: function (options) { + var fileInput = $(options.fileInput), + paramName = options.paramName; + if (!paramName) { + paramName = []; + fileInput.each(function () { + var input = $(this), + name = input.prop('name') || 'files[]', + i = (input.prop('files') || [1]).length; + while (i) { + paramName.push(name); + i -= 1; + } + }); + if (!paramName.length) { + paramName = [fileInput.prop('name') || 'files[]']; + } + } else if (!$.isArray(paramName)) { + paramName = [paramName]; + } + return paramName; + }, + + _initFormSettings: function (options) { + // Retrieve missing options from the input field and the + // associated form, if available: + if (!options.form || !options.form.length) { + options.form = $(options.fileInput.prop('form')); + } + options.paramName = this._getParamName(options); + if (!options.url) { + options.url = options.form.prop('action') || location.href; + } + // The HTTP request method must be "POST" or "PUT": + options.type = (options.type || options.form.prop('method') || '') + .toUpperCase(); + if (options.type !== 'POST' && options.type !== 'PUT') { + options.type = 'POST'; + } + }, + + _getAJAXSettings: function (data) { + var options = $.extend({}, this.options, data); + this._initFormSettings(options); + this._initDataSettings(options); + return options; + }, + + // Maps jqXHR callbacks to the equivalent + // methods of the given Promise object: + _enhancePromise: function (promise) { + promise.success = promise.done; + promise.error = promise.fail; + promise.complete = promise.always; + return promise; + }, + + // Creates and returns a Promise object enhanced with + // the jqXHR methods abort, success, error and complete: + _getXHRPromise: function (resolveOrReject, context, args) { + var dfd = $.Deferred(), + promise = dfd.promise(); + context = context || this.options.context || promise; + if (resolveOrReject === true) { + dfd.resolveWith(context, args); + } else if (resolveOrReject === false) { + dfd.rejectWith(context, args); + } + promise.abort = dfd.promise; + return this._enhancePromise(promise); + }, + + // Uploads a file in multiple, sequential requests + // by splitting the file up in multiple blob chunks. + // If the second parameter is true, only tests if the file + // should be uploaded in chunks, but does not invoke any + // upload requests: + _chunkedUpload: function (options, testOnly) { + var that = this, + file = options.files[0], + fs = file.size, + ub = options.uploadedBytes = options.uploadedBytes || 0, + mcs = options.maxChunkSize || fs, + // Use the Blob methods with the slice implementation + // according to the W3C Blob API specification: + slice = file.webkitSlice || file.mozSlice || file.slice, + upload, + n, + jqXHR, + pipe; + if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) || + options.data) { + return false; + } + if (testOnly) { + return true; + } + if (ub >= fs) { + file.error = 'uploadedBytes'; + return this._getXHRPromise( + false, + options.context, + [null, 'error', file.error] + ); + } + // n is the number of blobs to upload, + // calculated via filesize, uploaded bytes and max chunk size: + n = Math.ceil((fs - ub) / mcs); + // The chunk upload method accepting the chunk number as parameter: + upload = function (i) { + if (!i) { + return that._getXHRPromise(true, options.context); + } + // Upload the blobs in sequential order: + return upload(i -= 1).pipe(function () { + // Clone the options object for each chunk upload: + var o = $.extend({}, options); + o.blob = slice.call( + file, + ub + i * mcs, + ub + (i + 1) * mcs + ); + // Expose the chunk index: + o.chunkIndex = i; + // Expose the number of chunks: + o.chunksNumber = n; + // Store the current chunk size, as the blob itself + // will be dereferenced after data processing: + o.chunkSize = o.blob.size; + // Process the upload data (the blob and potential form data): + that._initXHRData(o); + // Add progress listeners for this chunk upload: + that._initProgressListener(o); + jqXHR = ($.ajax(o) || that._getXHRPromise(false, o.context)) + .done(function () { + // Create a progress event if upload is done and + // no progress event has been invoked for this chunk: + if (!o.loaded) { + that._onProgress($.Event('progress', { + lengthComputable: true, + loaded: o.chunkSize, + total: o.chunkSize + }), o); + } + options.uploadedBytes = o.uploadedBytes += + o.chunkSize; + }); + return jqXHR; + }); + }; + // Return the piped Promise object, enhanced with an abort method, + // which is delegated to the jqXHR object of the current upload, + // and jqXHR callbacks mapped to the equivalent Promise methods: + pipe = upload(n); + pipe.abort = function () { + return jqXHR.abort(); + }; + return this._enhancePromise(pipe); + }, + + _beforeSend: function (e, data) { + if (this._active === 0) { + // the start callback is triggered when an upload starts + // and no other uploads are currently running, + // equivalent to the global ajaxStart event: + this._trigger('start'); + // Set timer for global bitrate progress calculation: + this._bitrateTimer = new this._BitrateTimer(); + } + this._active += 1; + // Initialize the global progress values: + this._loaded += data.uploadedBytes || 0; + this._total += this._getTotal(data.files); + }, + + _onDone: function (result, textStatus, jqXHR, options) { + if (!this._isXHRUpload(options)) { + // Create a progress event for each iframe load: + this._onProgress($.Event('progress', { + lengthComputable: true, + loaded: 1, + total: 1 + }), options); + } + options.result = result; + options.textStatus = textStatus; + options.jqXHR = jqXHR; + this._trigger('done', null, options); + }, + + _onFail: function (jqXHR, textStatus, errorThrown, options) { + options.jqXHR = jqXHR; + options.textStatus = textStatus; + options.errorThrown = errorThrown; + this._trigger('fail', null, options); + if (options.recalculateProgress) { + // Remove the failed (error or abort) file upload from + // the global progress calculation: + this._loaded -= options.loaded || options.uploadedBytes || 0; + this._total -= options.total || this._getTotal(options.files); + } + }, + + _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) { + this._active -= 1; + options.textStatus = textStatus; + if (jqXHRorError && jqXHRorError.always) { + options.jqXHR = jqXHRorError; + options.result = jqXHRorResult; + } else { + options.jqXHR = jqXHRorResult; + options.errorThrown = jqXHRorError; + } + this._trigger('always', null, options); + if (this._active === 0) { + // The stop callback is triggered when all uploads have + // been completed, equivalent to the global ajaxStop event: + this._trigger('stop'); + // Reset the global progress values: + this._loaded = this._total = 0; + this._bitrateTimer = null; + } + }, + + _onSend: function (e, data) { + var that = this, + jqXHR, + slot, + pipe, + options = that._getAJAXSettings(data), + send = function (resolve, args) { + that._sending += 1; + // Set timer for bitrate progress calculation: + options._bitrateTimer = new that._BitrateTimer(); + jqXHR = jqXHR || ( + (resolve !== false && + that._trigger('send', e, options) !== false && + (that._chunkedUpload(options) || $.ajax(options))) || + that._getXHRPromise(false, options.context, args) + ).done(function (result, textStatus, jqXHR) { + that._onDone(result, textStatus, jqXHR, options); + }).fail(function (jqXHR, textStatus, errorThrown) { + that._onFail(jqXHR, textStatus, errorThrown, options); + }).always(function (jqXHRorResult, textStatus, jqXHRorError) { + that._sending -= 1; + that._onAlways( + jqXHRorResult, + textStatus, + jqXHRorError, + options + ); + if (options.limitConcurrentUploads && + options.limitConcurrentUploads > that._sending) { + // Start the next queued upload, + // that has not been aborted: + var nextSlot = that._slots.shift(); + while (nextSlot) { + if (!nextSlot.isRejected()) { + nextSlot.resolve(); + break; + } + nextSlot = that._slots.shift(); + } + } + }); + return jqXHR; + }; + this._beforeSend(e, options); + if (this.options.sequentialUploads || + (this.options.limitConcurrentUploads && + this.options.limitConcurrentUploads <= this._sending)) { + if (this.options.limitConcurrentUploads > 1) { + slot = $.Deferred(); + this._slots.push(slot); + pipe = slot.pipe(send); + } else { + pipe = (this._sequence = this._sequence.pipe(send, send)); + } + // Return the piped Promise object, enhanced with an abort method, + // which is delegated to the jqXHR object of the current upload, + // and jqXHR callbacks mapped to the equivalent Promise methods: + pipe.abort = function () { + var args = [undefined, 'abort', 'abort']; + if (!jqXHR) { + if (slot) { + slot.rejectWith(args); + } + return send(false, args); + } + return jqXHR.abort(); + }; + return this._enhancePromise(pipe); + } + return send(); + }, + + _onAdd: function (e, data) { + var that = this, + result = true, + options = $.extend({}, this.options, data), + limit = options.limitMultiFileUploads, + paramName = this._getParamName(options), + paramNameSet, + paramNameSlice, + fileSet, + i; + if (!(options.singleFileUploads || limit) || + !this._isXHRUpload(options)) { + fileSet = [data.files]; + paramNameSet = [paramName]; + } else if (!options.singleFileUploads && limit) { + fileSet = []; + paramNameSet = []; + for (i = 0; i < data.files.length; i += limit) { + fileSet.push(data.files.slice(i, i + limit)); + paramNameSlice = paramName.slice(i, i + limit); + if (!paramNameSlice.length) { + paramNameSlice = paramName; + } + paramNameSet.push(paramNameSlice); + } + } else { + paramNameSet = paramName; + } + data.originalFiles = data.files; + $.each(fileSet || data.files, function (index, element) { + var newData = $.extend({}, data); + newData.files = fileSet ? element : [element]; + newData.paramName = paramNameSet[index]; + newData.submit = function () { + newData.jqXHR = this.jqXHR = + (that._trigger('submit', e, this) !== false) && + that._onSend(e, this); + return this.jqXHR; + }; + return (result = that._trigger('add', e, newData)); + }); + return result; + }, + + // File Normalization for Gecko 1.9.1 (Firefox 3.5) support: + _normalizeFile: function (index, file) { + if (file.name === undefined && file.size === undefined) { + file.name = file.fileName; + file.size = file.fileSize; + } + }, + + _replaceFileInput: function (input) { + var inputClone = input.clone(true); + $('
      ').append(inputClone)[0].reset(); + // Detaching allows to insert the fileInput on another form + // without loosing the file input value: + input.after(inputClone).detach(); + // Avoid memory leaks with the detached file input: + $.cleanData(input.unbind('remove')); + // Replace the original file input element in the fileInput + // collection with the clone, which has been copied including + // event handlers: + this.options.fileInput = this.options.fileInput.map(function (i, el) { + if (el === input[0]) { + return inputClone[0]; + } + return el; + }); + // If the widget has been initialized on the file input itself, + // override this.element with the file input clone: + if (input[0] === this.element[0]) { + this.element = inputClone; + } + }, + + _getFileInputFiles: function (fileInput) { + fileInput = $(fileInput); + var files = $.each($.makeArray(fileInput.prop('files')), this._normalizeFile), + value; + if (!files.length) { + value = fileInput.prop('value'); + if (!value) { + return []; + } + // If the files property is not available, the browser does not + // support the File API and we add a pseudo File object with + // the input value as name with path information removed: + files = [{name: value.replace(/^.*\\/, '')}]; + } + return files; + }, + + _onChange: function (e) { + var that = e.data.fileupload, + data = { + fileInput: $(e.target), + form: $(e.target.form) + }; + data.files = that._getFileInputFiles(data.fileInput); + if (that.options.replaceFileInput) { + that._replaceFileInput(data.fileInput); + } + if (that._trigger('change', e, data) === false || + that._onAdd(e, data) === false) { + return false; + } + }, + + _onPaste: function (e) { + var that = e.data.fileupload, + cbd = e.originalEvent.clipboardData, + items = (cbd && cbd.items) || [], + data = {files: []}; + $.each(items, function (index, item) { + var file = item.getAsFile && item.getAsFile(); + if (file) { + data.files.push(file); + } + }); + if (that._trigger('paste', e, data) === false || + that._onAdd(e, data) === false) { + return false; + } + }, + + _onDrop: function (e) { + var that = e.data.fileupload, + dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer, + data = { + files: $.each( + $.makeArray(dataTransfer && dataTransfer.files), + that._normalizeFile + ) + }; + if (that._trigger('drop', e, data) === false || + that._onAdd(e, data) === false) { + return false; + } + e.preventDefault(); + }, + + _onDragOver: function (e) { + var that = e.data.fileupload, + dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer; + if (that._trigger('dragover', e) === false) { + return false; + } + if (dataTransfer) { + dataTransfer.dropEffect = 'copy'; + } + e.preventDefault(); + }, + + _initEventHandlers: function () { + var ns = this.options.namespace; + if (this._isXHRUpload(this.options)) { + this.options.dropZone + .bind('dragover.' + ns, {fileupload: this}, this._onDragOver) + .bind('drop.' + ns, {fileupload: this}, this._onDrop) + .bind('paste.' + ns, {fileupload: this}, this._onPaste); + } + this.options.fileInput + .bind('change.' + ns, {fileupload: this}, this._onChange); + }, + + _destroyEventHandlers: function () { + var ns = this.options.namespace; + this.options.dropZone + .unbind('dragover.' + ns, this._onDragOver) + .unbind('drop.' + ns, this._onDrop) + .unbind('paste.' + ns, this._onPaste); + this.options.fileInput + .unbind('change.' + ns, this._onChange); + }, + + _setOption: function (key, value) { + var refresh = $.inArray(key, this._refreshOptionsList) !== -1; + if (refresh) { + this._destroyEventHandlers(); + } + $.Widget.prototype._setOption.call(this, key, value); + if (refresh) { + this._initSpecialOptions(); + this._initEventHandlers(); + } + }, + + _initSpecialOptions: function () { + var options = this.options; + if (options.fileInput === undefined) { + options.fileInput = this.element.is('input:file') ? + this.element : this.element.find('input:file'); + } else if (!(options.fileInput instanceof $)) { + options.fileInput = $(options.fileInput); + } + if (!(options.dropZone instanceof $)) { + options.dropZone = $(options.dropZone); + } + }, + + _create: function () { + var options = this.options; + // Initialize options set via HTML5 data-attributes: + $.extend(options, $(this.element[0].cloneNode(false)).data()); + options.namespace = options.namespace || this.widgetName; + this._initSpecialOptions(); + this._slots = []; + this._sequence = this._getXHRPromise(true); + this._sending = this._active = this._loaded = this._total = 0; + this._initEventHandlers(); + }, + + destroy: function () { + this._destroyEventHandlers(); + $.Widget.prototype.destroy.call(this); + }, + + enable: function () { + $.Widget.prototype.enable.call(this); + this._initEventHandlers(); + }, + + disable: function () { + this._destroyEventHandlers(); + $.Widget.prototype.disable.call(this); + }, + + // This method is exposed to the widget API and allows adding files + // using the fileupload API. The data parameter accepts an object which + // must have a files property and can contain additional options: + // .fileupload('add', {files: filesList}); + add: function (data) { + if (!data || this.options.disabled) { + return; + } + if (data.fileInput && !data.files) { + data.files = this._getFileInputFiles(data.fileInput); + } else { + data.files = $.each($.makeArray(data.files), this._normalizeFile); + } + this._onAdd(null, data); + }, + + // This method is exposed to the widget API and allows sending files + // using the fileupload API. The data parameter accepts an object which + // must have a files property and can contain additional options: + // .fileupload('send', {files: filesList}); + // The method returns a Promise object for the file upload call. + send: function (data) { + if (data && !this.options.disabled) { + if (data.fileInput && !data.files) { + data.files = this._getFileInputFiles(data.fileInput); + } else { + data.files = $.each($.makeArray(data.files), this._normalizeFile); + } + if (data.files.length) { + return this._onSend(null, data); + } + } + return this._getXHRPromise(false, data && data.context); + } + + }); + +})); diff --git a/vendors/jquery-file-upload/js/jquery.iframe-transport.js b/vendors/jquery-file-upload/js/jquery.iframe-transport.js new file mode 100644 index 000000000..04a566230 --- /dev/null +++ b/vendors/jquery-file-upload/js/jquery.iframe-transport.js @@ -0,0 +1,171 @@ +/* + * jQuery Iframe Transport Plugin 1.4 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint unparam: true, nomen: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + // Helper variable to create unique names for the transport iframes: + var counter = 0; + + // The iframe transport accepts three additional options: + // options.fileInput: a jQuery collection of file input fields + // options.paramName: the parameter name for the file form data, + // overrides the name property of the file input field(s), + // can be a string or an array of strings. + // options.formData: an array of objects with name and value properties, + // equivalent to the return data of .serializeArray(), e.g.: + // [{name: 'a', value: 1}, {name: 'b', value: 2}] + $.ajaxTransport('iframe', function (options) { + if (options.async && (options.type === 'POST' || options.type === 'GET')) { + var form, + iframe; + return { + send: function (_, completeCallback) { + form = $('
      '); + // javascript:false as initial iframe src + // prevents warning popups on HTTPS in IE6. + // IE versions below IE8 cannot set the name property of + // elements that have already been added to the DOM, + // so we set the name along with the iframe HTML markup: + iframe = $( + '' + ).bind('load', function () { + var fileInputClones, + paramNames = $.isArray(options.paramName) ? + options.paramName : [options.paramName]; + iframe + .unbind('load') + .bind('load', function () { + var response; + // Wrap in a try/catch block to catch exceptions thrown + // when trying to access cross-domain iframe contents: + try { + response = iframe.contents(); + // Google Chrome and Firefox do not throw an + // exception when calling iframe.contents() on + // cross-domain requests, so we unify the response: + if (!response.length || !response[0].firstChild) { + throw new Error(); + } + } catch (e) { + response = undefined; + } + // The complete callback returns the + // iframe content document as response object: + completeCallback( + 200, + 'success', + {'iframe': response} + ); + // Fix for IE endless progress bar activity bug + // (happens on form submits to iframe targets): + $('') + .appendTo(form); + form.remove(); + }); + form + .prop('target', iframe.prop('name')) + .prop('action', options.url) + .prop('method', options.type); + if (options.formData) { + $.each(options.formData, function (index, field) { + $('') + .prop('name', field.name) + .val(field.value) + .appendTo(form); + }); + } + if (options.fileInput && options.fileInput.length && + options.type === 'POST') { + fileInputClones = options.fileInput.clone(); + // Insert a clone for each file input field: + options.fileInput.after(function (index) { + return fileInputClones[index]; + }); + if (options.paramName) { + options.fileInput.each(function (index) { + $(this).prop( + 'name', + paramNames[index] || options.paramName + ); + }); + } + // Appending the file input fields to the hidden form + // removes them from their original location: + form + .append(options.fileInput) + .prop('enctype', 'multipart/form-data') + // enctype must be set as encoding for IE: + .prop('encoding', 'multipart/form-data'); + } + form.submit(); + // Insert the file input fields at their original location + // by replacing the clones with the originals: + if (fileInputClones && fileInputClones.length) { + options.fileInput.each(function (index, input) { + var clone = $(fileInputClones[index]); + $(input).prop('name', clone.prop('name')); + clone.replaceWith(input); + }); + } + }); + form.append(iframe).appendTo(document.body); + }, + abort: function () { + if (iframe) { + // javascript:false as iframe src aborts the request + // and prevents warning popups on HTTPS in IE6. + // concat is used to avoid the "Script URL" JSLint error: + iframe + .unbind('load') + .prop('src', 'javascript'.concat(':false;')); + } + if (form) { + form.remove(); + } + } + }; + } + }); + + // The iframe transport returns the iframe content document as response. + // The following adds converters from iframe to text, json, html, and script: + $.ajaxSetup({ + converters: { + 'iframe text': function (iframe) { + return $(iframe[0].body).text(); + }, + 'iframe json': function (iframe) { + return $.parseJSON($(iframe[0].body).text()); + }, + 'iframe html': function (iframe) { + return $(iframe[0].body).html(); + }, + 'iframe script': function (iframe) { + return $.globalEval($(iframe[0].body).text()); + } + } + }); + +})); diff --git a/vendors/jquery-file-upload/js/locale.js b/vendors/jquery-file-upload/js/locale.js new file mode 100644 index 000000000..ea64b0a87 --- /dev/null +++ b/vendors/jquery-file-upload/js/locale.js @@ -0,0 +1,29 @@ +/* + * jQuery File Upload Plugin Localization Example 6.5.1 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*global window */ + +window.locale = { + "fileupload": { + "errors": { + "maxFileSize": "File is too big", + "minFileSize": "File is too small", + "acceptFileTypes": "Filetype not allowed", + "maxNumberOfFiles": "Max number of files exceeded", + "uploadedBytes": "Uploaded bytes exceed file size", + "emptyResult": "Empty file upload result" + }, + "error": "Error", + "start": "Start", + "cancel": "Cancel", + "destroy": "Delete" + } +}; diff --git a/vendors/jquery-file-upload/js/main.js b/vendors/jquery-file-upload/js/main.js new file mode 100644 index 000000000..67109588d --- /dev/null +++ b/vendors/jquery-file-upload/js/main.js @@ -0,0 +1,93 @@ +/* + * jQuery File Upload Plugin JS Example 6.7 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global $, window, document */ + +$(function () { + 'use strict'; + + // Initialize the jQuery File Upload widget: + $('#fileupload').fileupload(); + + // Enable iframe cross-domain access via redirect option: + $('#fileupload').fileupload( + 'option', + 'redirect', + window.location.href.replace( + /\/[^\/]*$/, + '/cors/result.html?%s' + ) + ); + + if (window.location.hostname === 'blueimp.github.com') { + // Demo settings: + $('#fileupload').fileupload('option', { + url: '//jquery-file-upload.appspot.com/', + maxFileSize: 5000000, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + process: [ + { + action: 'load', + fileTypes: /^image\/(gif|jpeg|png)$/, + maxFileSize: 20000000 // 20MB + }, + { + action: 'resize', + maxWidth: 1440, + maxHeight: 900 + }, + { + action: 'save' + } + ] + }); + // Upload server status check for browsers with CORS support: + if ($.support.cors) { + $.ajax({ + url: '//jquery-file-upload.appspot.com/', + type: 'HEAD' + }).fail(function () { + $('') + .text('Upload server currently unavailable - ' + + new Date()) + .appendTo('#fileupload'); + }); + } + } else { + // Load existing files: + $('#fileupload').each(function () { + var that = this; + $.getJSON(this.action, function (result) { + if (result && result.length) { + $(that).fileupload('option', 'done') + .call(that, null, {result: result}); + } + }); + }); + } + + // Initialize the Image Gallery widget: + $('#fileupload .files').imagegallery(); + + // Initialize the theme switcher: + $('#theme-switcher').change(function () { + var theme = $('#theme'); + theme.prop( + 'href', + theme.prop('href').replace( + /[\w\-]+\/jquery-ui.css/, + $(this).val() + '/jquery-ui.css' + ) + ); + }); + +}); diff --git a/vendors/jquery-file-upload/js/vendor/jquery.ui.widget.js b/vendors/jquery-file-upload/js/vendor/jquery.ui.widget.js new file mode 100644 index 000000000..b980122a3 --- /dev/null +++ b/vendors/jquery-file-upload/js/vendor/jquery.ui.widget.js @@ -0,0 +1,282 @@ +/* + * jQuery UI Widget 1.8.22+amd + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Widget + */ + +(function (factory) { + if (typeof define === "function" && define.amd) { + // Register as an anonymous AMD module: + define(["jquery"], factory); + } else { + // Browser globals: + factory(jQuery); + } +}(function( $, undefined ) { + +// jQuery 1.4+ +if ( $.cleanData ) { + var _cleanData = $.cleanData; + $.cleanData = function( elems ) { + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + try { + $( elem ).triggerHandler( "remove" ); + // http://bugs.jquery.com/ticket/8235 + } catch( e ) {} + } + _cleanData( elems ); + }; +} else { + var _remove = $.fn.remove; + $.fn.remove = function( selector, keepData ) { + return this.each(function() { + if ( !keepData ) { + if ( !selector || $.filter( selector, [ this ] ).length ) { + $( "*", this ).add( [ this ] ).each(function() { + try { + $( this ).triggerHandler( "remove" ); + // http://bugs.jquery.com/ticket/8235 + } catch( e ) {} + }); + } + } + return _remove.call( $(this), selector, keepData ); + }); + }; +} + +$.widget = function( name, base, prototype ) { + var namespace = name.split( "." )[ 0 ], + fullName; + name = name.split( "." )[ 1 ]; + fullName = namespace + "-" + name; + + if ( !prototype ) { + prototype = base; + base = $.Widget; + } + + // create selector for plugin + $.expr[ ":" ][ fullName ] = function( elem ) { + return !!$.data( elem, name ); + }; + + $[ namespace ] = $[ namespace ] || {}; + $[ namespace ][ name ] = function( options, element ) { + // allow instantiation without initializing for simple inheritance + if ( arguments.length ) { + this._createWidget( options, element ); + } + }; + + var basePrototype = new base(); + // we need to make the options hash a property directly on the new instance + // otherwise we'll modify the options hash on the prototype that we're + // inheriting from +// $.each( basePrototype, function( key, val ) { +// if ( $.isPlainObject(val) ) { +// basePrototype[ key ] = $.extend( {}, val ); +// } +// }); + basePrototype.options = $.extend( true, {}, basePrototype.options ); + $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { + namespace: namespace, + widgetName: name, + widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, + widgetBaseClass: fullName + }, prototype ); + + $.widget.bridge( name, $[ namespace ][ name ] ); +}; + +$.widget.bridge = function( name, object ) { + $.fn[ name ] = function( options ) { + var isMethodCall = typeof options === "string", + args = Array.prototype.slice.call( arguments, 1 ), + returnValue = this; + + // allow multiple hashes to be passed on init + options = !isMethodCall && args.length ? + $.extend.apply( null, [ true, options ].concat(args) ) : + options; + + // prevent calls to internal methods + if ( isMethodCall && options.charAt( 0 ) === "_" ) { + return returnValue; + } + + if ( isMethodCall ) { + this.each(function() { + var instance = $.data( this, name ), + methodValue = instance && $.isFunction( instance[options] ) ? + instance[ options ].apply( instance, args ) : + instance; + // TODO: add this back in 1.9 and use $.error() (see #5972) +// if ( !instance ) { +// throw "cannot call methods on " + name + " prior to initialization; " + +// "attempted to call method '" + options + "'"; +// } +// if ( !$.isFunction( instance[options] ) ) { +// throw "no such method '" + options + "' for " + name + " widget instance"; +// } +// var methodValue = instance[ options ].apply( instance, args ); + if ( methodValue !== instance && methodValue !== undefined ) { + returnValue = methodValue; + return false; + } + }); + } else { + this.each(function() { + var instance = $.data( this, name ); + if ( instance ) { + instance.option( options || {} )._init(); + } else { + $.data( this, name, new object( options, this ) ); + } + }); + } + + return returnValue; + }; +}; + +$.Widget = function( options, element ) { + // allow instantiation without initializing for simple inheritance + if ( arguments.length ) { + this._createWidget( options, element ); + } +}; + +$.Widget.prototype = { + widgetName: "widget", + widgetEventPrefix: "", + options: { + disabled: false + }, + _createWidget: function( options, element ) { + // $.widget.bridge stores the plugin instance, but we do it anyway + // so that it's stored even before the _create function runs + $.data( element, this.widgetName, this ); + this.element = $( element ); + this.options = $.extend( true, {}, + this.options, + this._getCreateOptions(), + options ); + + var self = this; + this.element.bind( "remove." + this.widgetName, function() { + self.destroy(); + }); + + this._create(); + this._trigger( "create" ); + this._init(); + }, + _getCreateOptions: function() { + return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; + }, + _create: function() {}, + _init: function() {}, + + destroy: function() { + this.element + .unbind( "." + this.widgetName ) + .removeData( this.widgetName ); + this.widget() + .unbind( "." + this.widgetName ) + .removeAttr( "aria-disabled" ) + .removeClass( + this.widgetBaseClass + "-disabled " + + "ui-state-disabled" ); + }, + + widget: function() { + return this.element; + }, + + option: function( key, value ) { + var options = key; + + if ( arguments.length === 0 ) { + // don't return a reference to the internal hash + return $.extend( {}, this.options ); + } + + if (typeof key === "string" ) { + if ( value === undefined ) { + return this.options[ key ]; + } + options = {}; + options[ key ] = value; + } + + this._setOptions( options ); + + return this; + }, + _setOptions: function( options ) { + var self = this; + $.each( options, function( key, value ) { + self._setOption( key, value ); + }); + + return this; + }, + _setOption: function( key, value ) { + this.options[ key ] = value; + + if ( key === "disabled" ) { + this.widget() + [ value ? "addClass" : "removeClass"]( + this.widgetBaseClass + "-disabled" + " " + + "ui-state-disabled" ) + .attr( "aria-disabled", value ); + } + + return this; + }, + + enable: function() { + return this._setOption( "disabled", false ); + }, + disable: function() { + return this._setOption( "disabled", true ); + }, + + _trigger: function( type, event, data ) { + var prop, orig, + callback = this.options[ type ]; + + data = data || {}; + event = $.Event( event ); + event.type = ( type === this.widgetEventPrefix ? + type : + this.widgetEventPrefix + type ).toLowerCase(); + // the original event may come from any element + // so we need to reset the target on the new event + event.target = this.element[ 0 ]; + + // copy original event properties over to the new event + orig = event.originalEvent; + if ( orig ) { + for ( prop in orig ) { + if ( !( prop in event ) ) { + event[ prop ] = orig[ prop ]; + } + } + } + + this.element.trigger( event, data ); + + return !( $.isFunction(callback) && + callback.call( this.element[0], event, data ) === false || + event.isDefaultPrevented() ); + } +}; + +})); diff --git a/vendors/jquery-file-upload/package.json b/vendors/jquery-file-upload/package.json new file mode 100644 index 000000000..56f9d5f25 --- /dev/null +++ b/vendors/jquery-file-upload/package.json @@ -0,0 +1,56 @@ +{ + "name": "blueimp-file-upload-jquery-ui", + "version": "6.9.2", + "title": "jQuery File Upload - jQuery UI version", + "description": "File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.", + "keywords": [ + "jquery", + "file", + "upload", + "widget", + "multiple", + "selection", + "drag", + "drop", + "progress", + "preview", + "cross-domain", + "cross-site", + "chunk", + "resume", + "gae", + "go", + "python", + "php", + "ui" + ], + "homepage": "https://github.com/blueimp/jQuery-File-Upload", + "author": { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + }, + "maintainers": [ + { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/blueimp/jQuery-File-Upload.git" + }, + "bugs": "https://github.com/blueimp/jQuery-File-Upload/issues", + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], + "dependencies": { + "jquery": ">=1.6", + "jquery.ui": ">=1.8", + "blueimp-tmpl": ">=2.1.0", + "blueimp-load-image": ">=1.1.6", + "blueimp-canvas-to-blob": ">=2.0.0" + } +} diff --git a/vendors/jquery-file-upload/server/gae-go/app.yaml b/vendors/jquery-file-upload/server/gae-go/app.yaml new file mode 100644 index 000000000..2d09daa56 --- /dev/null +++ b/vendors/jquery-file-upload/server/gae-go/app.yaml @@ -0,0 +1,12 @@ +application: jquery-file-upload +version: 2 +runtime: go +api_version: go1 + +handlers: +- url: /(favicon\.ico|robots\.txt) + static_files: static/\1 + upload: static/(.*) + expiration: '1d' +- url: /.* + script: _go_app diff --git a/vendors/jquery-file-upload/server/gae-go/app/main.go b/vendors/jquery-file-upload/server/gae-go/app/main.go new file mode 100644 index 000000000..01dc2f204 --- /dev/null +++ b/vendors/jquery-file-upload/server/gae-go/app/main.go @@ -0,0 +1,361 @@ +/* + * jQuery File Upload Plugin GAE Go Example 2.0 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +package app + +import ( + "appengine" + "appengine/blobstore" + "appengine/memcache" + "appengine/taskqueue" + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "image" + "image/png" + "io" + "log" + "mime/multipart" + "net/http" + "net/url" + "regexp" + "resize" + "strings" + "time" +) + +import _ "image/gif" +import _ "image/jpeg" + +const ( + WEBSITE = "http://blueimp.github.com/jQuery-File-Upload/" + MIN_FILE_SIZE = 1 // bytes + MAX_FILE_SIZE = 5000000 // bytes + IMAGE_TYPES = "image/(gif|p?jpeg|(x-)?png)" + ACCEPT_FILE_TYPES = IMAGE_TYPES + EXPIRATION_TIME = 300 // seconds + THUMBNAIL_MAX_WIDTH = 80 + THUMBNAIL_MAX_HEIGHT = THUMBNAIL_MAX_WIDTH +) + +var ( + imageTypes = regexp.MustCompile(IMAGE_TYPES) + acceptFileTypes = regexp.MustCompile(ACCEPT_FILE_TYPES) +) + +type FileInfo struct { + Key appengine.BlobKey `json:"-"` + Url string `json:"url,omitempty"` + ThumbnailUrl string `json:"thumbnail_url,omitempty"` + Name string `json:"name"` + Type string `json:"type"` + Size int64 `json:"size"` + Error string `json:"error,omitempty"` + DeleteUrl string `json:"delete_url,omitempty"` + DeleteType string `json:"delete_type,omitempty"` +} + +func (fi *FileInfo) ValidateType() (valid bool) { + if acceptFileTypes.MatchString(fi.Type) { + return true + } + fi.Error = "acceptFileTypes" + return false +} + +func (fi *FileInfo) ValidateSize() (valid bool) { + if fi.Size < MIN_FILE_SIZE { + fi.Error = "minFileSize" + } else if fi.Size > MAX_FILE_SIZE { + fi.Error = "maxFileSize" + } else { + return true + } + return false +} + +func (fi *FileInfo) CreateUrls(r *http.Request, c appengine.Context) { + u := &url.URL{ + Scheme: r.URL.Scheme, + Host: appengine.DefaultVersionHostname(c), + Path: "/", + } + uString := u.String() + fi.Url = uString + escape(string(fi.Key)) + "/" + + escape(string(fi.Name)) + fi.DeleteUrl = fi.Url + fi.DeleteType = "DELETE" + if fi.ThumbnailUrl != "" && -1 == strings.Index( + r.Header.Get("Accept"), + "application/json", + ) { + fi.ThumbnailUrl = uString + "thumbnails/" + + escape(string(fi.Key)) + } +} + +func (fi *FileInfo) CreateThumbnail(r io.Reader, c appengine.Context) (data []byte, err error) { + defer func() { + if rec := recover(); rec != nil { + log.Println(rec) + // 1x1 pixel transparent GIf, bas64 encoded: + s := "R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" + data, _ = base64.StdEncoding.DecodeString(s) + fi.ThumbnailUrl = "data:image/gif;base64," + s + } + memcache.Add(c, &memcache.Item{ + Key: string(fi.Key), + Value: data, + Expiration: EXPIRATION_TIME, + }) + }() + img, _, err := image.Decode(r) + check(err) + if bounds := img.Bounds(); bounds.Dx() > THUMBNAIL_MAX_WIDTH || + bounds.Dy() > THUMBNAIL_MAX_HEIGHT { + w, h := THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_HEIGHT + if bounds.Dx() > bounds.Dy() { + h = bounds.Dy() * h / bounds.Dx() + } else { + w = bounds.Dx() * w / bounds.Dy() + } + img = resize.Resize(img, img.Bounds(), w, h) + } + var b bytes.Buffer + err = png.Encode(&b, img) + check(err) + data = b.Bytes() + fi.ThumbnailUrl = "data:image/png;base64," + + base64.StdEncoding.EncodeToString(data) + return +} + +func check(err error) { + if err != nil { + panic(err) + } +} + +func escape(s string) string { + return strings.Replace(url.QueryEscape(s), "+", "%20", -1) +} + +func delayedDelete(c appengine.Context, fi *FileInfo) { + if key := string(fi.Key); key != "" { + task := &taskqueue.Task{ + Path: "/" + escape(key) + "/-", + Method: "DELETE", + Delay: time.Duration(EXPIRATION_TIME) * time.Second, + } + taskqueue.Add(c, task, "") + } +} + +func handleUpload(r *http.Request, p *multipart.Part) (fi *FileInfo) { + fi = &FileInfo{ + Name: p.FileName(), + Type: p.Header.Get("Content-Type"), + } + if !fi.ValidateType() { + return + } + defer func() { + if rec := recover(); rec != nil { + log.Println(rec) + fi.Error = rec.(error).Error() + } + }() + var b bytes.Buffer + lr := &io.LimitedReader{R: p, N: MAX_FILE_SIZE + 1} + context := appengine.NewContext(r) + w, err := blobstore.Create(context, fi.Type) + defer func() { + w.Close() + fi.Size = MAX_FILE_SIZE + 1 - lr.N + fi.Key, err = w.Key() + check(err) + if !fi.ValidateSize() { + err := blobstore.Delete(context, fi.Key) + check(err) + return + } + delayedDelete(context, fi) + if b.Len() > 0 { + fi.CreateThumbnail(&b, context) + } + fi.CreateUrls(r, context) + }() + check(err) + var wr io.Writer = w + if imageTypes.MatchString(fi.Type) { + wr = io.MultiWriter(&b, w) + } + _, err = io.Copy(wr, lr) + return +} + +func getFormValue(p *multipart.Part) string { + var b bytes.Buffer + io.CopyN(&b, p, int64(1<<20)) // Copy max: 1 MiB + return b.String() +} + +func handleUploads(r *http.Request) (fileInfos []*FileInfo) { + fileInfos = make([]*FileInfo, 0) + mr, err := r.MultipartReader() + check(err) + r.Form, err = url.ParseQuery(r.URL.RawQuery) + check(err) + part, err := mr.NextPart() + for err == nil { + if name := part.FormName(); name != "" { + if part.FileName() != "" { + fileInfos = append(fileInfos, handleUpload(r, part)) + } else { + r.Form[name] = append(r.Form[name], getFormValue(part)) + } + } + part, err = mr.NextPart() + } + return +} + +func get(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/" { + http.Redirect(w, r, WEBSITE, http.StatusFound) + return + } + parts := strings.Split(r.URL.Path, "/") + if len(parts) == 3 { + if key := parts[1]; key != "" { + blobKey := appengine.BlobKey(key) + bi, err := blobstore.Stat(appengine.NewContext(r), blobKey) + if err == nil { + w.Header().Add( + "Cache-Control", + fmt.Sprintf("public,max-age=%d", EXPIRATION_TIME), + ) + if imageTypes.MatchString(bi.ContentType) { + w.Header().Add("X-Content-Type-Options", "nosniff") + } else { + w.Header().Add("Content-Type", "application/octet-stream") + w.Header().Add( + "Content-Disposition:", + fmt.Sprintf("attachment; filename=%s;", parts[2]), + ) + } + blobstore.Send(w, appengine.BlobKey(key)) + return + } + } + } + http.Error(w, "404 Not Found", http.StatusNotFound) +} + +func post(w http.ResponseWriter, r *http.Request) { + b, err := json.Marshal(handleUploads(r)) + check(err) + if redirect := r.FormValue("redirect"); redirect != "" { + http.Redirect(w, r, fmt.Sprintf( + redirect, + escape(string(b)), + ), http.StatusFound) + return + } + jsonType := "application/json" + if strings.Index(r.Header.Get("Accept"), jsonType) != -1 { + w.Header().Set("Content-Type", jsonType) + } + fmt.Fprintln(w, string(b)) +} + +func delete(w http.ResponseWriter, r *http.Request) { + parts := strings.Split(r.URL.Path, "/") + if len(parts) != 3 { + return + } + if key := parts[1]; key != "" { + c := appengine.NewContext(r) + blobstore.Delete(c, appengine.BlobKey(key)) + memcache.Delete(c, key) + } +} + +func serveThumbnail(w http.ResponseWriter, r *http.Request) { + parts := strings.Split(r.URL.Path, "/") + if len(parts) == 3 { + if key := parts[2]; key != "" { + var data []byte + c := appengine.NewContext(r) + item, err := memcache.Get(c, key) + if err == nil { + data = item.Value + } else { + blobKey := appengine.BlobKey(key) + if _, err = blobstore.Stat(c, blobKey); err == nil { + fi := FileInfo{Key: blobKey} + data, _ = fi.CreateThumbnail( + blobstore.NewReader(c, blobKey), + c, + ) + } + } + if err == nil && len(data) > 3 { + w.Header().Add( + "Cache-Control", + fmt.Sprintf("public,max-age=%d", EXPIRATION_TIME), + ) + contentType := "image/png" + if string(data[:3]) == "GIF" { + contentType = "image/gif" + } else if string(data[1:4]) != "PNG" { + contentType = "image/jpeg" + } + w.Header().Set("Content-Type", contentType) + fmt.Fprintln(w, string(data)) + return + } + } + } + http.Error(w, "404 Not Found", http.StatusNotFound) +} + +func handle(w http.ResponseWriter, r *http.Request) { + params, err := url.ParseQuery(r.URL.RawQuery) + check(err) + w.Header().Add("Access-Control-Allow-Origin", "*") + w.Header().Add( + "Access-Control-Allow-Methods", + "OPTIONS, HEAD, GET, POST, PUT, DELETE", + ) + switch r.Method { + case "OPTIONS": + case "HEAD": + case "GET": + get(w, r) + case "POST": + if len(params["_method"]) > 0 && params["_method"][0] == "DELETE" { + delete(w, r) + } else { + post(w, r) + } + case "DELETE": + delete(w, r) + default: + http.Error(w, "501 Not Implemented", http.StatusNotImplemented) + } +} + +func init() { + http.HandleFunc("/", handle) + http.HandleFunc("/thumbnails/", serveThumbnail) +} diff --git a/vendors/jquery-file-upload/server/gae-go/resize/resize.go b/vendors/jquery-file-upload/server/gae-go/resize/resize.go new file mode 100644 index 000000000..dcb627870 --- /dev/null +++ b/vendors/jquery-file-upload/server/gae-go/resize/resize.go @@ -0,0 +1,247 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package resize + +import ( + "image" + "image/color" +) + +// Resize returns a scaled copy of the image slice r of m. +// The returned image has width w and height h. +func Resize(m image.Image, r image.Rectangle, w, h int) image.Image { + if w < 0 || h < 0 { + return nil + } + if w == 0 || h == 0 || r.Dx() <= 0 || r.Dy() <= 0 { + return image.NewRGBA64(image.Rect(0, 0, w, h)) + } + switch m := m.(type) { + case *image.RGBA: + return resizeRGBA(m, r, w, h) + case *image.YCbCr: + if m, ok := resizeYCbCr(m, r, w, h); ok { + return m + } + } + ww, hh := uint64(w), uint64(h) + dx, dy := uint64(r.Dx()), uint64(r.Dy()) + // The scaling algorithm is to nearest-neighbor magnify the dx * dy source + // to a (ww*dx) * (hh*dy) intermediate image and then minify the intermediate + // image back down to a ww * hh destination with a simple box filter. + // The intermediate image is implied, we do not physically allocate a slice + // of length ww*dx*hh*dy. + // For example, consider a 4*3 source image. Label its pixels from a-l: + // abcd + // efgh + // ijkl + // To resize this to a 3*2 destination image, the intermediate is 12*6. + // Whitespace has been added to delineate the destination pixels: + // aaab bbcc cddd + // aaab bbcc cddd + // eeef ffgg ghhh + // + // eeef ffgg ghhh + // iiij jjkk klll + // iiij jjkk klll + // Thus, the 'b' source pixel contributes one third of its value to the + // (0, 0) destination pixel and two thirds to (1, 0). + // The implementation is a two-step process. First, the source pixels are + // iterated over and each source pixel's contribution to 1 or more + // destination pixels are summed. Second, the sums are divided by a scaling + // factor to yield the destination pixels. + // TODO: By interleaving the two steps, instead of doing all of + // step 1 first and all of step 2 second, we could allocate a smaller sum + // slice of length 4*w*2 instead of 4*w*h, although the resultant code + // would become more complicated. + n, sum := dx*dy, make([]uint64, 4*w*h) + for y := r.Min.Y; y < r.Max.Y; y++ { + for x := r.Min.X; x < r.Max.X; x++ { + // Get the source pixel. + r32, g32, b32, a32 := m.At(x, y).RGBA() + r64 := uint64(r32) + g64 := uint64(g32) + b64 := uint64(b32) + a64 := uint64(a32) + // Spread the source pixel over 1 or more destination rows. + py := uint64(y) * hh + for remy := hh; remy > 0; { + qy := dy - (py % dy) + if qy > remy { + qy = remy + } + // Spread the source pixel over 1 or more destination columns. + px := uint64(x) * ww + index := 4 * ((py/dy)*ww + (px / dx)) + for remx := ww; remx > 0; { + qx := dx - (px % dx) + if qx > remx { + qx = remx + } + sum[index+0] += r64 * qx * qy + sum[index+1] += g64 * qx * qy + sum[index+2] += b64 * qx * qy + sum[index+3] += a64 * qx * qy + index += 4 + px += qx + remx -= qx + } + py += qy + remy -= qy + } + } + } + return average(sum, w, h, n*0x0101) +} + +// average convert the sums to averages and returns the result. +func average(sum []uint64, w, h int, n uint64) image.Image { + ret := image.NewRGBA(image.Rect(0, 0, w, h)) + for y := 0; y < h; y++ { + for x := 0; x < w; x++ { + index := 4 * (y*w + x) + ret.SetRGBA(x, y, color.RGBA{ + uint8(sum[index+0] / n), + uint8(sum[index+1] / n), + uint8(sum[index+2] / n), + uint8(sum[index+3] / n), + }) + } + } + return ret +} + +// resizeYCbCr returns a scaled copy of the YCbCr image slice r of m. +// The returned image has width w and height h. +func resizeYCbCr(m *image.YCbCr, r image.Rectangle, w, h int) (image.Image, bool) { + var verticalRes int + switch m.SubsampleRatio { + case image.YCbCrSubsampleRatio420: + verticalRes = 2 + case image.YCbCrSubsampleRatio422: + verticalRes = 1 + default: + return nil, false + } + ww, hh := uint64(w), uint64(h) + dx, dy := uint64(r.Dx()), uint64(r.Dy()) + // See comment in Resize. + n, sum := dx*dy, make([]uint64, 4*w*h) + for y := r.Min.Y; y < r.Max.Y; y++ { + Y := m.Y[y*m.YStride:] + Cb := m.Cb[y/verticalRes*m.CStride:] + Cr := m.Cr[y/verticalRes*m.CStride:] + for x := r.Min.X; x < r.Max.X; x++ { + // Get the source pixel. + r8, g8, b8 := color.YCbCrToRGB(Y[x], Cb[x/2], Cr[x/2]) + r64 := uint64(r8) + g64 := uint64(g8) + b64 := uint64(b8) + // Spread the source pixel over 1 or more destination rows. + py := uint64(y) * hh + for remy := hh; remy > 0; { + qy := dy - (py % dy) + if qy > remy { + qy = remy + } + // Spread the source pixel over 1 or more destination columns. + px := uint64(x) * ww + index := 4 * ((py/dy)*ww + (px / dx)) + for remx := ww; remx > 0; { + qx := dx - (px % dx) + if qx > remx { + qx = remx + } + qxy := qx * qy + sum[index+0] += r64 * qxy + sum[index+1] += g64 * qxy + sum[index+2] += b64 * qxy + sum[index+3] += 0xFFFF * qxy + index += 4 + px += qx + remx -= qx + } + py += qy + remy -= qy + } + } + } + return average(sum, w, h, n), true +} + +// resizeRGBA returns a scaled copy of the RGBA image slice r of m. +// The returned image has width w and height h. +func resizeRGBA(m *image.RGBA, r image.Rectangle, w, h int) image.Image { + ww, hh := uint64(w), uint64(h) + dx, dy := uint64(r.Dx()), uint64(r.Dy()) + // See comment in Resize. + n, sum := dx*dy, make([]uint64, 4*w*h) + for y := r.Min.Y; y < r.Max.Y; y++ { + pixOffset := m.PixOffset(r.Min.X, y) + for x := r.Min.X; x < r.Max.X; x++ { + // Get the source pixel. + r64 := uint64(m.Pix[pixOffset+0]) + g64 := uint64(m.Pix[pixOffset+1]) + b64 := uint64(m.Pix[pixOffset+2]) + a64 := uint64(m.Pix[pixOffset+3]) + pixOffset += 4 + // Spread the source pixel over 1 or more destination rows. + py := uint64(y) * hh + for remy := hh; remy > 0; { + qy := dy - (py % dy) + if qy > remy { + qy = remy + } + // Spread the source pixel over 1 or more destination columns. + px := uint64(x) * ww + index := 4 * ((py/dy)*ww + (px / dx)) + for remx := ww; remx > 0; { + qx := dx - (px % dx) + if qx > remx { + qx = remx + } + qxy := qx * qy + sum[index+0] += r64 * qxy + sum[index+1] += g64 * qxy + sum[index+2] += b64 * qxy + sum[index+3] += a64 * qxy + index += 4 + px += qx + remx -= qx + } + py += qy + remy -= qy + } + } + } + return average(sum, w, h, n) +} + +// Resample returns a resampled copy of the image slice r of m. +// The returned image has width w and height h. +func Resample(m image.Image, r image.Rectangle, w, h int) image.Image { + if w < 0 || h < 0 { + return nil + } + if w == 0 || h == 0 || r.Dx() <= 0 || r.Dy() <= 0 { + return image.NewRGBA64(image.Rect(0, 0, w, h)) + } + curw, curh := r.Dx(), r.Dy() + img := image.NewRGBA(image.Rect(0, 0, w, h)) + for y := 0; y < h; y++ { + for x := 0; x < w; x++ { + // Get a source pixel. + subx := x * curw / w + suby := y * curh / h + r32, g32, b32, a32 := m.At(subx, suby).RGBA() + r := uint8(r32 >> 8) + g := uint8(g32 >> 8) + b := uint8(b32 >> 8) + a := uint8(a32 >> 8) + img.SetRGBA(x, y, color.RGBA{r, g, b, a}) + } + } + return img +} diff --git a/vendors/jquery-file-upload/server/gae-go/static/favicon.ico b/vendors/jquery-file-upload/server/gae-go/static/favicon.ico new file mode 100644 index 000000000..1a71ea772 Binary files /dev/null and b/vendors/jquery-file-upload/server/gae-go/static/favicon.ico differ diff --git a/vendors/jquery-file-upload/server/gae-go/static/robots.txt b/vendors/jquery-file-upload/server/gae-go/static/robots.txt new file mode 100644 index 000000000..eb0536286 --- /dev/null +++ b/vendors/jquery-file-upload/server/gae-go/static/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/vendors/jquery-file-upload/server/gae-python/app.yaml b/vendors/jquery-file-upload/server/gae-python/app.yaml new file mode 100644 index 000000000..5fe123f59 --- /dev/null +++ b/vendors/jquery-file-upload/server/gae-python/app.yaml @@ -0,0 +1,16 @@ +application: jquery-file-upload +version: 1 +runtime: python27 +api_version: 1 +threadsafe: true + +builtins: +- deferred: on + +handlers: +- url: /(favicon\.ico|robots\.txt) + static_files: static/\1 + upload: static/(.*) + expiration: '1d' +- url: /.* + script: main.app diff --git a/vendors/jquery-file-upload/server/gae-python/main.py b/vendors/jquery-file-upload/server/gae-python/main.py new file mode 100644 index 000000000..37218c827 --- /dev/null +++ b/vendors/jquery-file-upload/server/gae-python/main.py @@ -0,0 +1,149 @@ +# -*- coding: utf-8 -*- +# +# jQuery File Upload Plugin GAE Python Example 1.1.4 +# https://github.com/blueimp/jQuery-File-Upload +# +# Copyright 2011, Sebastian Tschan +# https://blueimp.net +# +# Licensed under the MIT license: +# http://www.opensource.org/licenses/MIT +# + +from __future__ import with_statement +from google.appengine.api import files, images +from google.appengine.ext import blobstore, deferred +from google.appengine.ext.webapp import blobstore_handlers +import json, re, urllib, webapp2 + +WEBSITE = 'http://blueimp.github.com/jQuery-File-Upload/' +MIN_FILE_SIZE = 1 # bytes +MAX_FILE_SIZE = 5000000 # bytes +IMAGE_TYPES = re.compile('image/(gif|p?jpeg|(x-)?png)') +ACCEPT_FILE_TYPES = IMAGE_TYPES +THUMBNAIL_MODIFICATOR = '=s80' # max width / height +EXPIRATION_TIME = 300 # seconds + +def cleanup(blob_keys): + blobstore.delete(blob_keys) + +class UploadHandler(webapp2.RequestHandler): + + def initialize(self, request, response): + super(UploadHandler, self).initialize(request, response) + self.response.headers['Access-Control-Allow-Origin'] = '*' + self.response.headers[ + 'Access-Control-Allow-Methods' + ] = 'OPTIONS, HEAD, GET, POST, PUT, DELETE' + + def validate(self, file): + if file['size'] < MIN_FILE_SIZE: + file['error'] = 'minFileSize' + elif file['size'] > MAX_FILE_SIZE: + file['error'] = 'maxFileSize' + elif not ACCEPT_FILE_TYPES.match(file['type']): + file['error'] = 'acceptFileTypes' + else: + return True + return False + + def get_file_size(self, file): + file.seek(0, 2) # Seek to the end of the file + size = file.tell() # Get the position of EOF + file.seek(0) # Reset the file position to the beginning + return size + + def write_blob(self, data, info): + blob = files.blobstore.create( + mime_type=info['type'], + _blobinfo_uploaded_filename=info['name'] + ) + with files.open(blob, 'a') as f: + f.write(data) + files.finalize(blob) + return files.blobstore.get_blob_key(blob) + + def handle_upload(self): + results = [] + blob_keys = [] + for name, fieldStorage in self.request.POST.items(): + if type(fieldStorage) is unicode: + continue + result = {} + result['name'] = re.sub(r'^.*\\', '', + fieldStorage.filename) + result['type'] = fieldStorage.type + result['size'] = self.get_file_size(fieldStorage.file) + if self.validate(result): + blob_key = str( + self.write_blob(fieldStorage.value, result) + ) + blob_keys.append(blob_key) + result['delete_type'] = 'DELETE' + result['delete_url'] = self.request.host_url +\ + '/?key=' + urllib.quote(blob_key, '') + if (IMAGE_TYPES.match(result['type'])): + try: + result['url'] = images.get_serving_url( + blob_key, + secure_url=self.request.host_url\ + .startswith('https') + ) + result['thumbnail_url'] = result['url'] +\ + THUMBNAIL_MODIFICATOR + except: # Could not get an image serving url + pass + if not 'url' in result: + result['url'] = self.request.host_url +\ + '/' + blob_key + '/' + urllib.quote( + result['name'].encode('utf-8'), '') + results.append(result) + deferred.defer( + cleanup, + blob_keys, + _countdown=EXPIRATION_TIME + ) + return results + + def options(self): + pass + + def head(self): + pass + + def get(self): + self.redirect(WEBSITE) + + def post(self): + if (self.request.get('_method') == 'DELETE'): + return self.delete() + s = json.dumps(self.handle_upload(), separators=(',',':')) + redirect = self.request.get('redirect') + if redirect: + return self.redirect(str( + redirect.replace('%s', urllib.quote(s, ''), 1) + )) + if 'application/json' in self.request.headers.get('Accept'): + self.response.headers['Content-Type'] = 'application/json' + self.response.write(s) + + def delete(self): + blobstore.delete(self.request.get('key') or '') + +class DownloadHandler(blobstore_handlers.BlobstoreDownloadHandler): + def get(self, key, filename): + if not blobstore.get(key): + self.error(404) + else: + # Cache for the expiration time: + self.response.headers['Cache-Control'] =\ + 'public,max-age=%d' % EXPIRATION_TIME + self.send_blob(key, save_as=filename) + +app = webapp2.WSGIApplication( + [ + ('/', UploadHandler), + ('/([^/]+)/([^/]+)', DownloadHandler) + ], + debug=True +) \ No newline at end of file diff --git a/vendors/jquery-file-upload/server/gae-python/static/favicon.ico b/vendors/jquery-file-upload/server/gae-python/static/favicon.ico new file mode 100644 index 000000000..1a71ea772 Binary files /dev/null and b/vendors/jquery-file-upload/server/gae-python/static/favicon.ico differ diff --git a/vendors/jquery-file-upload/server/gae-python/static/robots.txt b/vendors/jquery-file-upload/server/gae-python/static/robots.txt new file mode 100644 index 000000000..eb0536286 --- /dev/null +++ b/vendors/jquery-file-upload/server/gae-python/static/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/vendors/jquery-file-upload/server/node/.gitignore b/vendors/jquery-file-upload/server/node/.gitignore new file mode 100644 index 000000000..9daa8247d --- /dev/null +++ b/vendors/jquery-file-upload/server/node/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +node_modules diff --git a/vendors/jquery-file-upload/server/node/package.json b/vendors/jquery-file-upload/server/node/package.json new file mode 100644 index 000000000..0e0c1aaae --- /dev/null +++ b/vendors/jquery-file-upload/server/node/package.json @@ -0,0 +1,41 @@ +{ + "name": "blueimp-file-upload-node", + "version": "1.0.2", + "title": "jQuery File Upload Node.js example", + "description": "Node.js implementation example of a file upload handler for jQuery File Upload.", + "keywords": [ + "file", + "upload", + "cross-domain", + "cross-site", + "node" + ], + "homepage": "https://github.com/blueimp/jQuery-File-Upload", + "author": { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + }, + "maintainers": [ + { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/blueimp/jQuery-File-Upload.git" + }, + "bugs": "https://github.com/blueimp/jQuery-File-Upload/issues", + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], + "dependencies": { + "formidable": ">=1.0.8", + "node-static": ">=0.5.9", + "imagemagick": ">=0.1.2" + }, + "main": "server.js" +} diff --git a/vendors/jquery-file-upload/server/node/public/files/thumbnail/.gitignore b/vendors/jquery-file-upload/server/node/public/files/thumbnail/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/vendors/jquery-file-upload/server/node/server.js b/vendors/jquery-file-upload/server/node/server.js new file mode 100755 index 000000000..f1bec542b --- /dev/null +++ b/vendors/jquery-file-upload/server/node/server.js @@ -0,0 +1,285 @@ +#!/usr/bin/env node +/* + * jQuery File Upload Plugin Node.js Example 1.0.2 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, regexp: true, unparam: true */ +/*global require, __dirname, unescape */ + +(function (port) { + 'use strict'; + var path = require('path'), + fs = require('fs'), + // Since Node 0.8, .existsSync() moved from path to fs: + _existsSync = fs.existsSync || path.existsSync, + formidable = require('formidable'), + nodeStatic = require('node-static'), + imageMagick = require('imagemagick'), + options = { + tmpDir: __dirname + '/tmp', + publicDir: __dirname + '/public', + uploadDir: __dirname + '/public/files', + uploadUrl: '/files/', + maxPostSize: 500000000, // 500 MB + minFileSize: 1, + maxFileSize: 100000000, // 100 MB + acceptFileTypes: /.+/i, + // Files not matched by this regular expression force a download dialog, + // to prevent executing any scripts in the context of the service domain: + safeFileTypes: /\.(gif|jpe?g|png)$/i, + imageTypes: /\.(gif|jpe?g|png)$/i, + imageVersions: { + 'thumbnail': { + width: 80, + height: 80 + } + }, + accessControl: { + allowOrigin: '*', + allowMethods: 'OPTIONS, HEAD, GET, POST, PUT, DELETE' + }, + /* Uncomment and edit this section to provide the service via HTTPS: + ssl: { + key: fs.readFileSync('/Applications/XAMPP/etc/ssl.key/server.key'), + cert: fs.readFileSync('/Applications/XAMPP/etc/ssl.crt/server.crt') + }, + */ + nodeStatic: { + cache: 3600 // seconds to cache served files + } + }, + utf8encode = function (str) { + return unescape(encodeURIComponent(str)); + }, + fileServer = new nodeStatic.Server(options.publicDir, options.nodeStatic), + nameCountRegexp = /(?:(?: \(([\d]+)\))?(\.[^.]+))?$/, + nameCountFunc = function (s, index, ext) { + return ' (' + ((parseInt(index, 10) || 0) + 1) + ')' + (ext || ''); + }, + FileInfo = function (file) { + this.name = file.name; + this.size = file.size; + this.type = file.type; + this.delete_type = 'DELETE'; + }, + UploadHandler = function (req, res, callback) { + this.req = req; + this.res = res; + this.callback = callback; + }, + serve = function (req, res) { + res.setHeader( + 'Access-Control-Allow-Origin', + options.accessControl.allowOrigin + ); + res.setHeader( + 'Access-Control-Allow-Methods', + options.accessControl.allowMethods + ); + var handleResult = function (result, redirect) { + if (redirect) { + res.writeHead(302, { + 'Location': redirect.replace( + /%s/, + encodeURIComponent(JSON.stringify(result)) + ) + }); + res.end(); + } else { + res.writeHead(200, { + 'Content-Type': req.headers.accept + .indexOf('application/json') !== -1 ? + 'application/json' : 'text/plain' + }); + res.end(JSON.stringify(result)); + } + }, + setNoCacheHeaders = function () { + res.setHeader('Pragma', 'no-cache'); + res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate'); + res.setHeader('Content-Disposition', 'inline; filename="files.json"'); + }, + handler = new UploadHandler(req, res, handleResult); + switch (req.method) { + case 'OPTIONS': + res.end(); + break; + case 'HEAD': + case 'GET': + if (req.url === '/') { + setNoCacheHeaders(); + if (req.method === 'GET') { + handler.get(); + } else { + res.end(); + } + } else { + fileServer.serve(req, res); + } + break; + case 'POST': + setNoCacheHeaders(); + handler.post(); + break; + case 'DELETE': + handler.destroy(); + break; + default: + res.statusCode = 405; + res.end(); + } + }; + fileServer.respond = function (pathname, status, _headers, files, stat, req, res, finish) { + if (!options.safeFileTypes.test(files[0])) { + // Force a download dialog for unsafe file extensions: + res.setHeader( + 'Content-Disposition', + 'attachment; filename="' + utf8encode(path.basename(files[0])) + '"' + ); + } else { + // Prevent Internet Explorer from MIME-sniffing the content-type: + res.setHeader('X-Content-Type-Options', 'nosniff'); + } + nodeStatic.Server.prototype.respond + .call(this, pathname, status, _headers, files, stat, req, res, finish); + }; + FileInfo.prototype.validate = function () { + if (options.minFileSize && options.minFileSize > this.size) { + this.error = 'minFileSize'; + } else if (options.maxFileSize && options.maxFileSize < this.size) { + this.error = 'maxFileSize'; + } else if (!options.acceptFileTypes.test(this.name)) { + this.error = 'acceptFileTypes'; + } + return !this.error; + }; + FileInfo.prototype.safeName = function () { + // Prevent directory traversal and creating hidden system files: + this.name = path.basename(this.name).replace(/^\.+/, ''); + // Prevent overwriting existing files: + while (_existsSync(options.uploadDir + '/' + this.name)) { + this.name = this.name.replace(nameCountRegexp, nameCountFunc); + } + }; + FileInfo.prototype.initUrls = function (req) { + if (!this.error) { + var that = this, + baseUrl = (options.ssl ? 'https:' : 'http:') + + '//' + req.headers.host + options.uploadUrl; + this.url = this.delete_url = baseUrl + encodeURIComponent(this.name); + Object.keys(options.imageVersions).forEach(function (version) { + if (_existsSync( + options.uploadDir + '/' + version + '/' + that.name + )) { + that[version + '_url'] = baseUrl + version + '/' + + encodeURIComponent(that.name); + } + }); + } + }; + UploadHandler.prototype.get = function () { + var handler = this, + files = []; + fs.readdir(options.uploadDir, function (err, list) { + list.forEach(function (name) { + var stats = fs.statSync(options.uploadDir + '/' + name), + fileInfo; + if (stats.isFile()) { + fileInfo = new FileInfo({ + name: name, + size: stats.size + }); + fileInfo.initUrls(handler.req); + files.push(fileInfo); + } + }); + handler.callback(files); + }); + }; + UploadHandler.prototype.post = function () { + var handler = this, + form = new formidable.IncomingForm(), + tmpFiles = [], + files = [], + map = {}, + counter = 1, + redirect, + finish = function () { + counter -= 1; + if (!counter) { + files.forEach(function (fileInfo) { + fileInfo.initUrls(handler.req); + }); + handler.callback(files, redirect); + } + }; + form.uploadDir = options.tmpDir; + form.on('fileBegin', function (name, file) { + tmpFiles.push(file.path); + var fileInfo = new FileInfo(file, handler.req, true); + fileInfo.safeName(); + map[path.basename(file.path)] = fileInfo; + files.push(fileInfo); + }).on('field', function (name, value) { + if (name === 'redirect') { + redirect = value; + } + }).on('file', function (name, file) { + var fileInfo = map[path.basename(file.path)]; + fileInfo.size = file.size; + if (!fileInfo.validate()) { + fs.unlink(file.path); + return; + } + fs.renameSync(file.path, options.uploadDir + '/' + fileInfo.name); + if (options.imageTypes.test(fileInfo.name)) { + Object.keys(options.imageVersions).forEach(function (version) { + counter += 1; + var opts = options.imageVersions[version]; + imageMagick.resize({ + width: opts.width, + height: opts.height, + srcPath: options.uploadDir + '/' + fileInfo.name, + dstPath: options.uploadDir + '/' + version + '/' + + fileInfo.name + }, finish); + }); + } + }).on('aborted', function () { + tmpFiles.forEach(function (file) { + fs.unlink(file); + }); + }).on('progress', function (bytesReceived, bytesExpected) { + if (bytesReceived > options.maxPostSize) { + handler.req.connection.destroy(); + } + }).on('end', finish).parse(handler.req); + }; + UploadHandler.prototype.destroy = function () { + var handler = this, + fileName; + if (handler.req.url.slice(0, options.uploadUrl.length) === options.uploadUrl) { + fileName = path.basename(decodeURIComponent(handler.req.url)); + fs.unlink(options.uploadDir + '/' + fileName, function (ex) { + Object.keys(options.imageVersions).forEach(function (version) { + fs.unlink(options.uploadDir + '/' + version + '/' + fileName); + }); + handler.callback(!ex); + }); + } else { + handler.callback(false); + } + }; + if (options.ssl) { + require('https').createServer(options.ssl, serve).listen(port); + } else { + require('http').createServer(serve).listen(port); + } +}(8888)); diff --git a/vendors/jquery-file-upload/server/node/tmp/.gitignore b/vendors/jquery-file-upload/server/node/tmp/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/vendors/jquery-file-upload/server/php/files/.htaccess b/vendors/jquery-file-upload/server/php/files/.htaccess new file mode 100644 index 000000000..a6a9f6a75 --- /dev/null +++ b/vendors/jquery-file-upload/server/php/files/.htaccess @@ -0,0 +1,4 @@ +ForceType application/octet-stream + + ForceType none + \ No newline at end of file diff --git a/vendors/jquery-file-upload/server/php/index.php b/vendors/jquery-file-upload/server/php/index.php new file mode 100644 index 000000000..1601c76f3 --- /dev/null +++ b/vendors/jquery-file-upload/server/php/index.php @@ -0,0 +1,46 @@ +get(); + break; + case 'POST': + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { + $upload_handler->delete(); + } else { + $upload_handler->post(); + } + break; + case 'DELETE': + $upload_handler->delete(); + break; + default: + header('HTTP/1.1 405 Method Not Allowed'); +} diff --git a/vendors/jquery-file-upload/server/php/thumbnails/.htaccess b/vendors/jquery-file-upload/server/php/thumbnails/.htaccess new file mode 100644 index 000000000..e69de29bb diff --git a/vendors/jquery-file-upload/server/php/upload.class.php b/vendors/jquery-file-upload/server/php/upload.class.php new file mode 100644 index 000000000..c4efacbdb --- /dev/null +++ b/vendors/jquery-file-upload/server/php/upload.class.php @@ -0,0 +1,436 @@ +options = array( + 'script_url' => $this->getFullUrl().'/', + 'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/', + 'upload_url' => $this->getFullUrl().'/files/', + 'param_name' => 'files', + // Set the following option to 'POST', if your server does not support + // DELETE requests. This is a parameter sent to the client: + 'delete_type' => 'DELETE', + // The php.ini settings upload_max_filesize and post_max_size + // take precedence over the following max_file_size setting: + 'max_file_size' => null, + 'min_file_size' => 1, + 'accept_file_types' => '/.+$/i', + // The maximum number of files for the upload directory: + 'max_number_of_files' => null, + // Image resolution restrictions: + 'max_width' => null, + 'max_height' => null, + 'min_width' => 1, + 'min_height' => 1, + // Set the following option to false to enable resumable uploads: + 'discard_aborted_uploads' => true, + // Set to true to rotate images based on EXIF meta data, if available: + 'orient_image' => false, + 'image_versions' => array( + // Uncomment the following version to restrict the size of + // uploaded images. You can also add additional versions with + // their own upload directories: + /* + 'large' => array( + 'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/', + 'upload_url' => $this->getFullUrl().'/files/', + 'max_width' => 1920, + 'max_height' => 1200, + 'jpeg_quality' => 95 + ), + */ + 'thumbnail' => array( + 'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/thumbnails/', + 'upload_url' => $this->getFullUrl().'/thumbnails/', + 'max_width' => 80, + 'max_height' => 80 + ) + ) + ); + if ($options) { + $this->options = array_replace_recursive($this->options, $options); + } + } + + protected function getFullUrl() { + $https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; + return + ($https ? 'https://' : 'http://'). + (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : ''). + (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME']. + ($https && $_SERVER['SERVER_PORT'] === 443 || + $_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))). + substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/')); + } + + protected function set_file_delete_url($file) { + $file->delete_url = $this->options['script_url'] + .'?file='.rawurlencode($file->name); + $file->delete_type = $this->options['delete_type']; + if ($file->delete_type !== 'DELETE') { + $file->delete_url .= '&_method=DELETE'; + } + } + + protected function get_file_object($file_name) { + $file_path = $this->options['upload_dir'].$file_name; + if (is_file($file_path) && $file_name[0] !== '.') { + $file = new stdClass(); + $file->name = $file_name; + $file->size = filesize($file_path); + $file->url = $this->options['upload_url'].rawurlencode($file->name); + foreach($this->options['image_versions'] as $version => $options) { + if (is_file($options['upload_dir'].$file_name)) { + $file->{$version.'_url'} = $options['upload_url'] + .rawurlencode($file->name); + } + } + $this->set_file_delete_url($file); + return $file; + } + return null; + } + + protected function get_file_objects() { + return array_values(array_filter(array_map( + array($this, 'get_file_object'), + scandir($this->options['upload_dir']) + ))); + } + + protected function create_scaled_image($file_name, $options) { + $file_path = $this->options['upload_dir'].$file_name; + $new_file_path = $options['upload_dir'].$file_name; + list($img_width, $img_height) = @getimagesize($file_path); + if (!$img_width || !$img_height) { + return false; + } + $scale = min( + $options['max_width'] / $img_width, + $options['max_height'] / $img_height + ); + if ($scale >= 1) { + if ($file_path !== $new_file_path) { + return copy($file_path, $new_file_path); + } + return true; + } + $new_width = $img_width * $scale; + $new_height = $img_height * $scale; + $new_img = @imagecreatetruecolor($new_width, $new_height); + switch (strtolower(substr(strrchr($file_name, '.'), 1))) { + case 'jpg': + case 'jpeg': + $src_img = @imagecreatefromjpeg($file_path); + $write_image = 'imagejpeg'; + $image_quality = isset($options['jpeg_quality']) ? + $options['jpeg_quality'] : 75; + break; + case 'gif': + @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0)); + $src_img = @imagecreatefromgif($file_path); + $write_image = 'imagegif'; + $image_quality = null; + break; + case 'png': + @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0)); + @imagealphablending($new_img, false); + @imagesavealpha($new_img, true); + $src_img = @imagecreatefrompng($file_path); + $write_image = 'imagepng'; + $image_quality = isset($options['png_quality']) ? + $options['png_quality'] : 9; + break; + default: + $src_img = null; + } + $success = $src_img && @imagecopyresampled( + $new_img, + $src_img, + 0, 0, 0, 0, + $new_width, + $new_height, + $img_width, + $img_height + ) && $write_image($new_img, $new_file_path, $image_quality); + // Free up memory (imagedestroy does not delete files): + @imagedestroy($src_img); + @imagedestroy($new_img); + return $success; + } + + protected function validate($uploaded_file, $file, $error, $index) { + if ($error) { + $file->error = $error; + return false; + } + if (!$file->name) { + $file->error = 'missingFileName'; + return false; + } + if (!preg_match($this->options['accept_file_types'], $file->name)) { + $file->error = 'acceptFileTypes'; + return false; + } + if ($uploaded_file && is_uploaded_file($uploaded_file)) { + $file_size = filesize($uploaded_file); + } else { + $file_size = $_SERVER['CONTENT_LENGTH']; + } + if ($this->options['max_file_size'] && ( + $file_size > $this->options['max_file_size'] || + $file->size > $this->options['max_file_size']) + ) { + $file->error = 'maxFileSize'; + return false; + } + if ($this->options['min_file_size'] && + $file_size < $this->options['min_file_size']) { + $file->error = 'minFileSize'; + return false; + } + if (is_int($this->options['max_number_of_files']) && ( + count($this->get_file_objects()) >= $this->options['max_number_of_files']) + ) { + $file->error = 'maxNumberOfFiles'; + return false; + } + list($img_width, $img_height) = @getimagesize($uploaded_file); + if (is_int($img_width)) { + if ($this->options['max_width'] && $img_width > $this->options['max_width'] || + $this->options['max_height'] && $img_height > $this->options['max_height']) { + $file->error = 'maxResolution'; + return false; + } + if ($this->options['min_width'] && $img_width < $this->options['min_width'] || + $this->options['min_height'] && $img_height < $this->options['min_height']) { + $file->error = 'minResolution'; + return false; + } + } + return true; + } + + protected function upcount_name_callback($matches) { + $index = isset($matches[1]) ? intval($matches[1]) + 1 : 1; + $ext = isset($matches[2]) ? $matches[2] : ''; + return ' ('.$index.')'.$ext; + } + + protected function upcount_name($name) { + return preg_replace_callback( + '/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/', + array($this, 'upcount_name_callback'), + $name, + 1 + ); + } + + protected function trim_file_name($name, $type, $index) { + // Remove path information and dots around the filename, to prevent uploading + // into different directories or replacing hidden system files. + // Also remove control characters and spaces (\x00..\x20) around the filename: + $file_name = trim(basename(stripslashes($name)), ".\x00..\x20"); + // Add missing file extension for known image types: + if (strpos($file_name, '.') === false && + preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { + $file_name .= '.'.$matches[1]; + } + if ($this->options['discard_aborted_uploads']) { + while(is_file($this->options['upload_dir'].$file_name)) { + $file_name = $this->upcount_name($file_name); + } + } + return $file_name; + } + + protected function handle_form_data($file, $index) { + // Handle form data, e.g. $_REQUEST['description'][$index] + } + + protected function orient_image($file_path) { + $exif = @exif_read_data($file_path); + if ($exif === false) { + return false; + } + $orientation = intval(@$exif['Orientation']); + if (!in_array($orientation, array(3, 6, 8))) { + return false; + } + $image = @imagecreatefromjpeg($file_path); + switch ($orientation) { + case 3: + $image = @imagerotate($image, 180, 0); + break; + case 6: + $image = @imagerotate($image, 270, 0); + break; + case 8: + $image = @imagerotate($image, 90, 0); + break; + default: + return false; + } + $success = imagejpeg($image, $file_path); + // Free up memory (imagedestroy does not delete files): + @imagedestroy($image); + return $success; + } + + protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null) { + $file = new stdClass(); + $file->name = $this->trim_file_name($name, $type, $index); + $file->size = intval($size); + $file->type = $type; + if ($this->validate($uploaded_file, $file, $error, $index)) { + $this->handle_form_data($file, $index); + $file_path = $this->options['upload_dir'].$file->name; + $append_file = !$this->options['discard_aborted_uploads'] && + is_file($file_path) && $file->size > filesize($file_path); + clearstatcache(); + if ($uploaded_file && is_uploaded_file($uploaded_file)) { + // multipart/formdata uploads (POST method uploads) + if ($append_file) { + file_put_contents( + $file_path, + fopen($uploaded_file, 'r'), + FILE_APPEND + ); + } else { + move_uploaded_file($uploaded_file, $file_path); + } + } else { + // Non-multipart uploads (PUT method support) + file_put_contents( + $file_path, + fopen('php://input', 'r'), + $append_file ? FILE_APPEND : 0 + ); + } + $file_size = filesize($file_path); + if ($file_size === $file->size) { + if ($this->options['orient_image']) { + $this->orient_image($file_path); + } + $file->url = $this->options['upload_url'].rawurlencode($file->name); + foreach($this->options['image_versions'] as $version => $options) { + if ($this->create_scaled_image($file->name, $options)) { + if ($this->options['upload_dir'] !== $options['upload_dir']) { + $file->{$version.'_url'} = $options['upload_url'] + .rawurlencode($file->name); + } else { + clearstatcache(); + $file_size = filesize($file_path); + } + } + } + } else if ($this->options['discard_aborted_uploads']) { + unlink($file_path); + $file->error = 'abort'; + } + $file->size = $file_size; + $this->set_file_delete_url($file); + } + return $file; + } + + public function get() { + $file_name = isset($_REQUEST['file']) ? + basename(stripslashes($_REQUEST['file'])) : null; + if ($file_name) { + $info = $this->get_file_object($file_name); + } else { + $info = $this->get_file_objects(); + } + header('Content-type: application/json'); + echo json_encode($info); + } + + public function post() { + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { + return $this->delete(); + } + $upload = isset($_FILES[$this->options['param_name']]) ? + $_FILES[$this->options['param_name']] : null; + $info = array(); + if ($upload && is_array($upload['tmp_name'])) { + // param_name is an array identifier like "files[]", + // $_FILES is a multi-dimensional array: + foreach ($upload['tmp_name'] as $index => $value) { + $info[] = $this->handle_file_upload( + $upload['tmp_name'][$index], + isset($_SERVER['HTTP_X_FILE_NAME']) ? + $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index], + isset($_SERVER['HTTP_X_FILE_SIZE']) ? + $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index], + isset($_SERVER['HTTP_X_FILE_TYPE']) ? + $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index], + $upload['error'][$index], + $index + ); + } + } elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) { + // param_name is a single object identifier like "file", + // $_FILES is a one-dimensional array: + $info[] = $this->handle_file_upload( + isset($upload['tmp_name']) ? $upload['tmp_name'] : null, + isset($_SERVER['HTTP_X_FILE_NAME']) ? + $_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ? + $upload['name'] : null), + isset($_SERVER['HTTP_X_FILE_SIZE']) ? + $_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ? + $upload['size'] : null), + isset($_SERVER['HTTP_X_FILE_TYPE']) ? + $_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ? + $upload['type'] : null), + isset($upload['error']) ? $upload['error'] : null + ); + } + header('Vary: Accept'); + $json = json_encode($info); + $redirect = isset($_REQUEST['redirect']) ? + stripslashes($_REQUEST['redirect']) : null; + if ($redirect) { + header('Location: '.sprintf($redirect, rawurlencode($json))); + return; + } + if (isset($_SERVER['HTTP_ACCEPT']) && + (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) { + header('Content-type: application/json'); + } else { + header('Content-type: text/plain'); + } + echo $json; + } + + public function delete() { + $file_name = isset($_REQUEST['file']) ? + basename(stripslashes($_REQUEST['file'])) : null; + $file_path = $this->options['upload_dir'].$file_name; + $success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path); + if ($success) { + foreach($this->options['image_versions'] as $version => $options) { + $file = $options['upload_dir'].$file_name; + if (is_file($file)) { + unlink($file); + } + } + } + header('Content-type: application/json'); + echo json_encode($success); + } + +} diff --git a/vendors/jquery-file-upload/test/index.html b/vendors/jquery-file-upload/test/index.html new file mode 100644 index 000000000..8a8011d21 --- /dev/null +++ b/vendors/jquery-file-upload/test/index.html @@ -0,0 +1,146 @@ + + + + + + + +jQuery File Upload Plugin Test + + + + +

      jQuery File Upload Plugin Test

      +

      +
      +

      +
        +
        + +
        + +
        +
        + + + + Add files... + + + + + + +
        + +
        + +
        +
        +
        + +
         
        +
        +
        + +
        +
        + + +
        +
        + + + + + + + + + + + + + + + + + + + diff --git a/vendors/jquery-file-upload/test/test.js b/vendors/jquery-file-upload/test/test.js new file mode 100644 index 000000000..0f6d90afb --- /dev/null +++ b/vendors/jquery-file-upload/test/test.js @@ -0,0 +1,1279 @@ +/* + * jQuery File Upload Plugin Test 6.9.2 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true */ +/*global $, QUnit, document, expect, module, test, asyncTest, start, ok, strictEqual, notStrictEqual */ + +$(function () { + 'use strict'; + + QUnit.done = function () { + // Delete all uploaded files: + var url = $('#fileupload').find('form').prop('action'); + $.getJSON(url, function (files) { + $.each(files, function (index, file) { + $.ajax({ + url: url + '?file=' + encodeURIComponent(file.name), + type: 'DELETE' + }); + }); + }); + }; + + var lifecycle = { + setup: function () { + // Set the .fileupload method to the basic widget method: + $.widget('blueimp.fileupload', $.blueimp.fileupload, {}); + }, + teardown: function () { + // De-initialize the file input plugin: + $('#fileupload:blueimp-fileupload').fileupload('destroy'); + // Remove all remaining event listeners: + $('#fileupload input').unbind(); + $(document).unbind(); + } + }, + lifecycleUI = { + setup: function () { + // Set the .fileupload method to the JUI widget method: + $.widget('blueimpJUI.fileupload', $.blueimpJUI.fileupload, {}); + }, + teardown: function () { + // De-initialize the file input plugin: + $('#fileupload:blueimpJUI-fileupload').fileupload('destroy'); + // Remove all remaining event listeners: + $('#fileupload input, #fileupload button').unbind(); + $(document).unbind(); + } + }; + + module('Initialization', lifecycle); + + test('Widget initialization', function () { + ok($('#fileupload').fileupload().data('fileupload')); + }); + + test('Data attribute options', function () { + $('#fileupload').attr('data-url', 'http://example.org'); + $('#fileupload').fileupload(); + strictEqual( + $('#fileupload').fileupload('option', 'url'), + 'http://example.org' + ); + }); + + test('File input initialization', function () { + var fu = $('#fileupload').fileupload(); + ok( + fu.fileupload('option', 'fileInput').length, + 'File input field inside of the widget' + ); + ok( + fu.fileupload('option', 'fileInput').length, + 'Widget element as file input field' + ); + }); + + test('Drop zone initialization', function () { + ok($('#fileupload').fileupload() + .fileupload('option', 'dropZone').length); + }); + + test('Event listeners initialization', function () { + var fu = $('#fileupload').fileupload(); + ok( + fu.fileupload('option', 'fileInput') + .data('events').change.length, + 'Listens to file input change events' + ); + if ($.support.xhrFormDataFileUpload) { + ok( + fu.fileupload('option', 'dropZone') + .data('events').drop.length, + 'Listens to drop zone drop events' + ); + ok( + fu.fileupload('option', 'dropZone') + .data('events').dragover.length, + 'Listens to drop zone dragover events' + ); + } + }); + + module('API', lifecycle); + + test('destroy', function () { + var fu = $('#fileupload').fileupload(), + fileInput = fu.fileupload('option', 'fileInput'), + dropZone = fu.fileupload('option', 'dropZone'); + fileInput.change($.noop); + dropZone.bind('drop', $.noop); + dropZone.bind('dragover', $.noop); + fu.fileupload('destroy'); + strictEqual( + fileInput.data('events').change.length, + 1, + 'Removes own file input change event listener' + ); + if ($.support.xhrFormDataFileUpload) { + strictEqual( + dropZone.data('events').drop.length, + 1, + 'Removes own drop zone drop event listener' + ); + strictEqual( + dropZone.data('events').dragover.length, + 1, + 'Removes own drop zone dragover event listener' + ); + } + }); + + test('disable', function () { + var fu = $('#fileupload').fileupload(), + fileInput = fu.fileupload('option', 'fileInput'), + dropZone = fu.fileupload('option', 'dropZone'), + param = {files: [{name: 'test'}]}; + fileInput.change($.noop); + dropZone.bind('drop', $.noop); + dropZone.bind('dragover', $.noop); + fu.fileupload('disable'); + strictEqual( + fileInput.data('events').change.length, + 1, + 'Removes own file input change event listener' + ); + if ($.support.xhrFormDataFileUpload) { + strictEqual( + dropZone.data('events').drop.length, + 1, + 'Removes own drop zone drop event listener' + ); + strictEqual( + dropZone.data('events').dragover.length, + 1, + 'Removes own drop zone dragover event listener' + ); + } + fu.fileupload({ + add: function (e, data) { + ok(false); + } + }).fileupload('add', param); + }); + + test('enable', function () { + var fu = $('#fileupload').fileupload(), + param = {files: [{name: 'test'}]}; + fu.fileupload('disable'); + fu.fileupload('enable'); + ok( + fu.fileupload('option', 'fileInput') + .data('events').change.length, + 'Listens to file input change events' + ); + if ($.support.xhrFormDataFileUpload) { + ok( + fu.fileupload('option', 'dropZone') + .data('events').drop.length, + 'Listens to drop zone drop events' + ); + ok( + fu.fileupload('option', 'dropZone') + .data('events').dragover.length, + 'Listens to drop zone dragover events' + ); + } + $('#fileupload').fileupload({ + send: function (e, data) { + strictEqual( + data.files[0].name, + 'test', + 'Triggers send callback' + ); + return false; + } + }).fileupload('send', param); + }); + + test('option', function () { + var fu = $('#fileupload').fileupload(), + fileInput = fu.fileupload('option', 'fileInput'), + dropZone = fu.fileupload('option', 'dropZone'); + fu.fileupload('option', 'fileInput', null); + fu.fileupload('option', 'dropZone', null); + ok( + !fileInput.data('events'), + 'Removes event listener after changing fileInput option' + ); + if ($.support.xhrFormDataFileUpload) { + ok( + !dropZone.data('events'), + 'Removes event listeners after changing dropZone option' + ); + } + fu.fileupload('option', 'fileInput', fileInput); + fu.fileupload('option', 'dropZone', dropZone); + ok( + fileInput.data('events').change.length, + 'Adds change event listener after setting fileInput option' + ); + if ($.support.xhrFormDataFileUpload) { + ok( + dropZone.data('events').drop.length, + 'Adds drop event listener after setting dropZone option' + ); + ok( + dropZone.data('events').dragover.length, + 'Adds dragover event listener after setting dropZone option' + ); + } + fu.fileupload('option', 'dropZone', 'body'); + strictEqual( + fu.fileupload('option', 'dropZone')[0], + document.body, + 'Allow a query string as parameter for the dropZone option' + ); + fu.fileupload('option', 'dropZone', document); + strictEqual( + fu.fileupload('option', 'dropZone')[0], + document, + 'Allow a document element as parameter for the dropZone option' + ); + fu.fileupload('option', 'fileInput', ':file'); + strictEqual( + fu.fileupload('option', 'fileInput')[0], + $(':file')[0], + 'Allow a query string as parameter for the fileInput option' + ); + fu.fileupload('option', 'fileInput', $(':file')[0]); + strictEqual( + fu.fileupload('option', 'fileInput')[0], + $(':file')[0], + 'Allow a document element as parameter for the fileInput option' + ); + }); + + asyncTest('add', function () { + expect(4); + var param = {files: [{name: 'test'}]}, + param2 = {files: [{fileName: 'test', fileSize: 123}]}; + $('#fileupload').fileupload({ + add: function (e, data) { + strictEqual( + data.files[0].name, + param.files[0].name, + 'Triggers add callback' + ); + } + }).fileupload('add', param).fileupload( + 'option', + 'add', + function (e, data) { + strictEqual( + data.files[0].name, + param2.files[0].fileName, + 'Normalizes fileName' + ); + strictEqual( + data.files[0].size, + param2.files[0].fileSize, + 'Normalizes fileSize' + ); + data.submit().complete(function () { + ok(true, 'data.submit() Returns a jqXHR object'); + start(); + }); + } + ).fileupload('add', param2); + }); + + asyncTest('send', function () { + expect(3); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + send: function (e, data) { + strictEqual( + data.files[0].name, + 'test', + 'Triggers send callback' + ); + } + }).fileupload('send', param).fail(function () { + ok(true, 'Allows to abort the request'); + }).complete(function () { + ok(true, 'Returns a jqXHR object'); + start(); + }).abort(); + }); + + module('Callbacks', lifecycle); + + asyncTest('add', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + add: function (e, data) { + ok(true, 'Triggers add callback'); + start(); + } + }).fileupload('add', param); + }); + + asyncTest('submit', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + submit: function (e, data) { + ok(true, 'Triggers submit callback'); + start(); + return false; + } + }).fileupload('add', param); + }); + + asyncTest('send', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + send: function (e, data) { + ok(true, 'Triggers send callback'); + start(); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('done', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + done: function (e, data) { + ok(true, 'Triggers done callback'); + start(); + } + }).fileupload('send', param); + }); + + asyncTest('fail', function () { + expect(1); + var param = {files: [{name: 'test'}]}, + fu = $('#fileupload').fileupload({ + url: '404', + fail: function (e, data) { + ok(true, 'Triggers fail callback'); + start(); + } + }); + fu.data('fileupload')._isXHRUpload = function () { + return true; + }; + fu.fileupload('send', param); + }); + + asyncTest('always', function () { + expect(2); + var param = {files: [{name: 'test'}]}, + counter = 0, + fu = $('#fileupload').fileupload({ + always: function (e, data) { + ok(true, 'Triggers always callback'); + if (counter === 1) { + start(); + } else { + counter += 1; + } + } + }); + fu.data('fileupload')._isXHRUpload = function () { + return true; + }; + fu.fileupload('add', param).fileupload( + 'option', + 'url', + '404' + ).fileupload('add', param); + }); + + asyncTest('progress', function () { + expect(1); + var param = {files: [{name: 'test'}]}, + counter = 0; + $('#fileupload').fileupload({ + forceIframeTransport: true, + progress: function (e, data) { + ok(true, 'Triggers progress callback'); + if (counter === 0) { + start(); + } else { + counter += 1; + } + } + }).fileupload('send', param); + }); + + asyncTest('progressall', function () { + expect(1); + var param = {files: [{name: 'test'}]}, + counter = 0; + $('#fileupload').fileupload({ + forceIframeTransport: true, + progressall: function (e, data) { + ok(true, 'Triggers progressall callback'); + if (counter === 0) { + start(); + } else { + counter += 1; + } + } + }).fileupload('send', param); + }); + + asyncTest('start', function () { + expect(1); + var param = {files: [{name: '1'}, {name: '2'}]}, + active = 0; + $('#fileupload').fileupload({ + send: function (e, data) { + active += 1; + }, + start: function (e, data) { + ok(!active, 'Triggers start callback before uploads'); + start(); + } + }).fileupload('send', param); + }); + + asyncTest('stop', function () { + expect(1); + var param = {files: [{name: '1'}, {name: '2'}]}, + active = 0; + $('#fileupload').fileupload({ + send: function (e, data) { + active += 1; + }, + always: function (e, data) { + active -= 1; + }, + stop: function (e, data) { + ok(!active, 'Triggers stop callback after uploads'); + start(); + } + }).fileupload('send', param); + }); + + test('change', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('fileupload'), + fileInput = fu.fileupload('option', 'fileInput'); + expect(2); + fu.fileupload({ + change: function (e, data) { + ok(true, 'Triggers change callback'); + strictEqual( + data.files.length, + 0, + 'Returns empty files list' + ); + }, + add: $.noop + }); + fuo._onChange({ + data: {fileupload: fuo}, + target: fileInput[0] + }); + }); + + test('paste', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('fileupload'); + expect(1); + fu.fileupload({ + paste: function (e, data) { + ok(true, 'Triggers paste callback'); + }, + add: $.noop + }); + fuo._onPaste({ + data: {fileupload: fuo}, + originalEvent: {clipboardData: {}}, + preventDefault: $.noop + }); + }); + + test('drop', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('fileupload'); + expect(1); + fu.fileupload({ + drop: function (e, data) { + ok(true, 'Triggers drop callback'); + }, + add: $.noop + }); + fuo._onDrop({ + data: {fileupload: fuo}, + originalEvent: {dataTransfer: {}}, + preventDefault: $.noop + }); + }); + + test('dragover', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('fileupload'); + expect(1); + fu.fileupload({ + dragover: function (e, data) { + ok(true, 'Triggers dragover callback'); + }, + add: $.noop + }); + fuo._onDragOver({ + data: {fileupload: fuo}, + originalEvent: {dataTransfer: {}}, + preventDefault: $.noop + }); + }); + + module('Options', lifecycle); + + test('paramName', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + paramName: null, + send: function (e, data) { + strictEqual( + data.paramName[0], + data.fileInput.prop('name'), + 'Takes paramName from file input field if not set' + ); + return false; + } + }).fileupload('send', param); + }); + + test('url', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + url: null, + send: function (e, data) { + strictEqual( + data.url, + $(data.fileInput.prop('form')).prop('action'), + 'Takes url from form action if not set' + ); + return false; + } + }).fileupload('send', param); + }); + + test('type', function () { + expect(2); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + type: null, + send: function (e, data) { + strictEqual( + data.type, + 'POST', + 'Request type is "POST" if not set to "PUT"' + ); + return false; + } + }).fileupload('send', param); + $('#fileupload').fileupload({ + type: 'PUT', + send: function (e, data) { + strictEqual( + data.type, + 'PUT', + 'Request type is "PUT" if set to "PUT"' + ); + return false; + } + }).fileupload('send', param); + }); + + test('replaceFileInput', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('fileupload'), + fileInput = fu.fileupload('option', 'fileInput'), + fileInputElement = fileInput[0]; + expect(2); + fu.fileupload({ + replaceFileInput: false, + change: function (e, data) { + strictEqual( + fu.fileupload('option', 'fileInput')[0], + fileInputElement, + 'Keeps file input with replaceFileInput: false' + ); + }, + add: $.noop + }); + fuo._onChange({ + data: {fileupload: fuo}, + target: fileInput[0] + }); + fu.fileupload({ + replaceFileInput: true, + change: function (e, data) { + notStrictEqual( + fu.fileupload('option', 'fileInput')[0], + fileInputElement, + 'Replaces file input with replaceFileInput: true' + ); + }, + add: $.noop + }); + fuo._onChange({ + data: {fileupload: fuo}, + target: fileInput[0] + }); + }); + + asyncTest('forceIframeTransport', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + forceIframeTransport: true, + done: function (e, data) { + strictEqual( + data.dataType.substr(0, 6), + 'iframe', + 'Iframe Transport is used' + ); + start(); + } + }).fileupload('send', param); + }); + + test('singleFileUploads', function () { + expect(3); + var fu = $('#fileupload').fileupload(), + param = {files: [{name: '1'}, {name: '2'}]}, + index = 1; + fu.data('fileupload')._isXHRUpload = function () { + return true; + }; + $('#fileupload').fileupload({ + singleFileUploads: true, + add: function (e, data) { + ok(true, 'Triggers callback number ' + index.toString()); + index += 1; + } + }).fileupload('add', param).fileupload( + 'option', + 'singleFileUploads', + false + ).fileupload('add', param); + }); + + test('limitMultiFileUploads', function () { + expect(3); + var fu = $('#fileupload').fileupload(), + param = {files: [ + {name: '1'}, + {name: '2'}, + {name: '3'}, + {name: '4'}, + {name: '5'} + ]}, + index = 1; + fu.data('fileupload')._isXHRUpload = function () { + return true; + }; + $('#fileupload').fileupload({ + singleFileUploads: false, + limitMultiFileUploads: 2, + add: function (e, data) { + ok(true, 'Triggers callback number ' + index.toString()); + index += 1; + } + }).fileupload('add', param); + }); + + asyncTest('sequentialUploads', function () { + expect(6); + var param = {files: [ + {name: '1'}, + {name: '2'}, + {name: '3'}, + {name: '4'}, + {name: '5'}, + {name: '6'} + ]}, + addIndex = 0, + sendIndex = 0, + loadIndex = 0, + fu = $('#fileupload').fileupload({ + sequentialUploads: true, + add: function (e, data) { + addIndex += 1; + if (addIndex === 4) { + data.submit().abort(); + } else { + data.submit(); + } + }, + send: function (e, data) { + sendIndex += 1; + }, + done: function (e, data) { + loadIndex += 1; + strictEqual(sendIndex, loadIndex, 'upload in order'); + }, + fail: function (e, data) { + strictEqual(data.errorThrown, 'abort', 'upload aborted'); + }, + stop: function (e) { + start(); + } + }); + fu.data('fileupload')._isXHRUpload = function () { + return true; + }; + fu.fileupload('add', param); + }); + + asyncTest('limitConcurrentUploads', function () { + expect(12); + var param = {files: [ + {name: '1'}, + {name: '2'}, + {name: '3'}, + {name: '4'}, + {name: '5'}, + {name: '6'}, + {name: '7'}, + {name: '8'}, + {name: '9'}, + {name: '10'}, + {name: '11'}, + {name: '12'} + ]}, + addIndex = 0, + sendIndex = 0, + loadIndex = 0, + fu = $('#fileupload').fileupload({ + limitConcurrentUploads: 3, + add: function (e, data) { + addIndex += 1; + if (addIndex === 4) { + data.submit().abort(); + } else { + data.submit(); + } + }, + send: function (e, data) { + sendIndex += 1; + }, + done: function (e, data) { + loadIndex += 1; + ok(sendIndex - loadIndex < 3); + }, + fail: function (e, data) { + strictEqual(data.errorThrown, 'abort', 'upload aborted'); + }, + stop: function (e) { + start(); + } + }); + fu.data('fileupload')._isXHRUpload = function () { + return true; + }; + fu.fileupload('add', param); + }); + + if ($.support.xhrFileUpload) { + asyncTest('multipart', function () { + expect(4); + var param = {files: [{ + name: 'test.png', + size: 123, + type: 'image/png' + }]}, + fu = $('#fileupload').fileupload({ + multipart: false, + always: function (e, data) { + strictEqual( + data.contentType, + param.files[0].type, + 'non-multipart upload sets file type as contentType' + ); + strictEqual( + data.headers['X-File-Name'], + param.files[0].name, + 'non-multipart upload sets X-File-Name header' + ); + strictEqual( + data.headers['X-File-Type'], + param.files[0].type, + 'non-multipart upload sets X-File-Type header' + ); + strictEqual( + data.headers['X-File-Size'], + param.files[0].size, + 'non-multipart upload sets X-File-Size header' + ); + start(); + } + }); + fu.fileupload('send', param); + }); + } + + module('UI Initialization', lifecycleUI); + + test('Widget initialization', function () { + ok($('#fileupload').fileupload().data('fileupload')); + ok( + $('#fileupload').fileupload('option', 'uploadTemplate').length, + 'Initialized upload template' + ); + ok( + $('#fileupload').fileupload('option', 'downloadTemplate').length, + 'Initialized download template' + ); + }); + + test('Buttonbar event listeners', function () { + var buttonbar = $('#fileupload .fileupload-buttonbar'), + files = [{name: 'test'}]; + expect(7); + $('#fileupload').fileupload({ + send: function (e, data) { + ok(true, 'Started file upload via global start button'); + }, + fail: function (e, data) { + ok(true, 'Canceled file upload via global cancel button'); + data.context.remove(); + }, + destroy: function (e, data) { + ok(true, 'Delete action called via global delete button'); + } + }); + ok( + buttonbar.find('.start') + .data('events').click.length, + 'Listens to start button click events' + ); + ok( + buttonbar.find('.cancel') + .data('events').click.length, + 'Listens to cancel button click events' + ); + ok( + buttonbar.find('.delete') + .data('events').click.length, + 'Listens to delete button click events' + ); + $('#fileupload').fileupload('add', {files: files}); + buttonbar.find('.cancel').click(); + $('#fileupload').fileupload('add', {files: files}); + buttonbar.find('.start').click(); + buttonbar.find('.cancel').click(); + $('#fileupload').data('fileupload')._renderDownload(files) + .appendTo($('#fileupload .files')).show() + .find('.delete input').click(); + buttonbar.find('.delete').click(); + }); + + module('UI API', lifecycleUI); + + test('destroy', function () { + var buttonbar = $('#fileupload .fileupload-buttonbar'); + $('#fileupload').fileupload(); + buttonbar.find('button').click($.noop); + $('#fileupload').fileupload('destroy'); + strictEqual( + buttonbar.find('.start').data('events').click.length, + 1, + 'Removes own start button click event listener' + ); + strictEqual( + buttonbar.find('.cancel').data('events').click.length, + 1, + 'Removes own cancel button click event listener' + ); + strictEqual( + buttonbar.find('.delete').data('events').click.length, + 1, + 'Removes own delete button click event listener' + ); + }); + + test('disable', function () { + var buttonbar = $('#fileupload .fileupload-buttonbar'); + $('#fileupload').fileupload(); + $('#fileupload').fileupload('disable'); + strictEqual( + buttonbar.find('input[type=file], button').not(':disabled').length, + 0, + 'Disables the buttonbar buttons' + ); + }); + + test('enable', function () { + var buttonbar = $('#fileupload .fileupload-buttonbar'); + $('#fileupload') + .fileupload() + .fileupload('disable') + .fileupload('enable'); + strictEqual( + buttonbar.find('input[type=file], button').not(':disabled').length, + 4, + 'Enables the buttonbar buttons' + ); + }); + + module('UI Callbacks', lifecycleUI); + + test('destroy', function () { + expect(3); + $('#fileupload').fileupload({ + destroy: function (e, data) { + ok(true, 'Triggers destroy callback'); + strictEqual( + data.url, + 'test', + 'Passes over deletion url parameter' + ); + strictEqual( + data.type, + 'DELETE', + 'Passes over deletion request type parameter' + ); + } + }); + $('#fileupload').data('fileupload')._renderDownload([{ + name: 'test', + delete_url: 'test', + delete_type: 'DELETE' + }]).appendTo($('#fileupload .files')).show() + .find('.delete input').click(); + $('#fileupload .fileupload-buttonbar .delete').click(); + }); + + asyncTest('added', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + added: function (e, data) { + start(); + strictEqual( + data.files[0].name, + param.files[0].name, + 'Triggers added callback' + ); + }, + send: function () { + return false; + } + }).fileupload('add', param); + }); + + asyncTest('started', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + started: function (e) { + start(); + ok('Triggers started callback'); + return false; + }, + sent: function (e, data) { + return false; + } + }).fileupload('send', param); + }); + + asyncTest('sent', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + sent: function (e, data) { + start(); + strictEqual( + data.files[0].name, + param.files[0].name, + 'Triggers sent callback' + ); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('completed', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + completed: function (e, data) { + start(); + ok('Triggers completed callback'); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('failed', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + failed: function (e, data) { + start(); + ok('Triggers failed callback'); + return false; + } + }).fileupload('send', param).abort(); + }); + + asyncTest('stopped', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + stopped: function (e, data) { + start(); + ok('Triggers stopped callback'); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('destroyed', function () { + expect(1); + $('#fileupload').fileupload({ + destroyed: function (e, data) { + start(); + ok(true, 'Triggers destroyed callback'); + } + }); + $('#fileupload').data('fileupload')._renderDownload([{ + name: 'test', + delete_url: 'test', + delete_type: 'DELETE' + }]).appendTo($('#fileupload .files')).show() + .find('.delete input').click(); + $('#fileupload .fileupload-buttonbar .delete').click(); + }); + + module('UI Options', lifecycleUI); + + test('autoUpload', function () { + expect(1); + $('#fileupload') + .fileupload({ + autoUpload: true, + send: function (e, data) { + ok(true, 'Started file upload automatically'); + return false; + } + }) + .fileupload('add', {files: [{name: 'test'}]}) + .fileupload('option', 'autoUpload', false) + .fileupload('add', {files: [{name: 'test'}]}); + }); + + test('maxNumberOfFiles', function () { + expect(4); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + maxNumberOfFiles: 1, + singleFileUploads: false, + send: function (e, data) { + strictEqual( + sendIndex += 1, + addIndex + ); + }, + progress: $.noop, + progressall: $.noop, + done: $.noop, + stop: $.noop + }) + .fileupload('add', {files: [{name: (addIndex += 1)}]}) + .fileupload('add', {files: [{name: 'test'}]}) + .fileupload('option', 'maxNumberOfFiles', 1) + .fileupload('add', {files: [{name: 1}, {name: 2}]}) + .fileupload({ + maxNumberOfFiles: 1, + send: function (e, data) { + strictEqual( + sendIndex += 1, + addIndex + ); + return false; + } + }) + .fileupload('add', {files: [{name: (addIndex += 1)}]}) + .fileupload('add', {files: [{name: (addIndex += 1)}]}) + .fileupload({ + maxNumberOfFiles: 0, + send: function (e, data) { + ok( + !$.blueimpUI.fileupload.prototype.options + .send.call(this, e, data) + ); + return false; + } + }) + .fileupload('send', {files: [{name: 'test'}]}); + }); + + test('maxFileSize', function () { + expect(3); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + maxFileSize: 1000, + send: function (e, data) { + strictEqual( + sendIndex += 1, + addIndex + ); + return false; + } + }) + .fileupload('add', {files: [{ + name: (addIndex += 1) + }]}) + .fileupload('add', {files: [{ + name: (addIndex += 1), + size: 999 + }]}) + .fileupload('add', {files: [{ + name: 'test', + size: 1001 + }]}) + .fileupload({ + send: function (e, data) { + ok( + !$.blueimpUI.fileupload.prototype.options + .send.call(this, e, data) + ); + return false; + } + }) + .fileupload('send', {files: [{ + name: 'test', + size: 1001 + }]}); + }); + + test('minFileSize', function () { + expect(3); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + minFileSize: 1000, + send: function (e, data) { + strictEqual( + sendIndex += 1, + addIndex + ); + return false; + } + }) + .fileupload('add', {files: [{ + name: (addIndex += 1) + }]}) + .fileupload('add', {files: [{ + name: (addIndex += 1), + size: 1001 + }]}) + .fileupload('add', {files: [{ + name: 'test', + size: 999 + }]}) + .fileupload({ + send: function (e, data) { + ok( + !$.blueimpUI.fileupload.prototype.options + .send.call(this, e, data) + ); + return false; + } + }) + .fileupload('send', {files: [{ + name: 'test', + size: 999 + }]}); + }); + + test('acceptFileTypes', function () { + expect(3); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + previewFileTypes: /none/, + send: function (e, data) { + strictEqual( + sendIndex += 1, + addIndex + ); + return false; + } + }) + .fileupload('add', {files: [{ + name: (addIndex += 1) + '.jpg' + }]}) + .fileupload('add', {files: [{ + name: (addIndex += 1), + type: 'image/jpeg' + }]}) + .fileupload('add', {files: [{ + name: 'test.txt', + type: 'text/plain' + }]}) + .fileupload({ + send: function (e, data) { + ok( + !$.blueimpUI.fileupload.prototype.options + .send.call(this, e, data) + ); + return false; + } + }) + .fileupload('send', {files: [{ + name: 'test.txt', + type: 'text/plain' + }]}); + }); + + test('acceptFileTypes as HTML5 data attribute', function () { + expect(2); + var regExp = /(\.|\/)(gif|jpe?g|png)$/i; + $('#fileupload') + .attr('data-accept-file-types', regExp.toString()) + .fileupload(); + strictEqual( + $.type($('#fileupload').fileupload('option', 'acceptFileTypes')), + $.type(regExp) + ); + strictEqual( + $('#fileupload').fileupload('option', 'acceptFileTypes').toString(), + regExp.toString() + ); + }); + +}); -- cgit v1.2.3 From e0879bc60015ab6be470b6828da0e50a7399bb9b Mon Sep 17 00:00:00 2001 From: Sem Date: Tue, 31 Jul 2012 09:28:14 +0200 Subject: Added some depenences. --- vendors/jquery-file-upload/js/vendor/canvas-to-blob.min.js | 1 + vendors/jquery-file-upload/js/vendor/load-image.min.js | 1 + vendors/jquery-file-upload/js/vendor/tmpl.min.js | 1 + 3 files changed, 3 insertions(+) create mode 100644 vendors/jquery-file-upload/js/vendor/canvas-to-blob.min.js create mode 100644 vendors/jquery-file-upload/js/vendor/load-image.min.js create mode 100644 vendors/jquery-file-upload/js/vendor/tmpl.min.js diff --git a/vendors/jquery-file-upload/js/vendor/canvas-to-blob.min.js b/vendors/jquery-file-upload/js/vendor/canvas-to-blob.min.js new file mode 100644 index 000000000..9328aae30 --- /dev/null +++ b/vendors/jquery-file-upload/js/vendor/canvas-to-blob.min.js @@ -0,0 +1 @@ +(function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,d=c&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,d,e,f,g,h;a.split(",")[0].indexOf("base64")>=0?b=atob(a.split(",")[1]):b=decodeURIComponent(a.split(",")[1]),d=new ArrayBuffer(b.length),e=new Uint8Array(d);for(f=0;f1&&(d=parseInt(d*f,10),e=parseInt(e*f,10)),f=Math.min((b.maxWidth||d)/d,(b.maxHeight||e)/e),f<1&&(d=parseInt(d*f,10),e=parseInt(e*f,10)),a.getContext||b.canvas&&c.getContext?(c.width=d,c.height=e,c.getContext("2d").drawImage(a,0,0,d,e),c):(a.width=d,a.height=e,a)},b.createObjectURL=function(a){return c?c.createObjectURL(a):!1},b.revokeObjectURL=function(a){return c?c.revokeObjectURL(a):!1},b.readFile=function(a,b){if(window.FileReader&&FileReader.prototype.readAsDataURL){var c=new FileReader;return c.onload=function(a){b(a.target.result)},c.readAsDataURL(a),c}return!1},typeof define!="undefined"&&define.amd?define(function(){return b}):a.loadImage=b})(this); \ No newline at end of file diff --git a/vendors/jquery-file-upload/js/vendor/tmpl.min.js b/vendors/jquery-file-upload/js/vendor/tmpl.min.js new file mode 100644 index 000000000..065532e7c --- /dev/null +++ b/vendors/jquery-file-upload/js/vendor/tmpl.min.js @@ -0,0 +1 @@ +(function(a){"use strict";var b=function(a,c){var d=/[^\w\-\.:]/.test(a)?new Function(b.arg+",tmpl","var _e=tmpl.encode"+b.helper+",_s='"+a.replace(b.regexp,b.func)+"';return _s;"):b.cache[a]=b.cache[a]||b(b.load(a));return c?d(c,b):function(a){return d(a,b)}};b.cache={},b.load=function(a){return document.getElementById(a).innerHTML},b.regexp=/([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,b.func=function(a,b,c,d,e,f){if(b)return{"\n":"\\n","\r":"\\r","\t":"\\t"," ":" "}[a]||"\\"+a;if(c)return c==="="?"'+_e("+d+")+'":"'+("+d+"||'')+'";if(e)return"';";if(f)return"_s+='"},b.encReg=/[<>&"'\x00]/g,b.encMap={"<":"<",">":">","&":"&",'"':""","'":"'"},b.encode=function(a){return String(a||"").replace(b.encReg,function(a){return b.encMap[a]||""})},b.arg="o",b.helper=",print=function(s,e){_s+=e&&(s||'')||_e(s);},include=function(s,d){_s+=tmpl(s,d);}",typeof define=="function"&&define.amd?define(function(){return b}):a.tmpl=b})(this); \ No newline at end of file -- cgit v1.2.3 From 28b1669c4b1afaed7429da2cc9580340dcb13b6e Mon Sep 17 00:00:00 2001 From: Sem Date: Tue, 31 Jul 2012 10:09:51 +0200 Subject: New uploader based on javascript for Tidypics --- languages/en.php | 10 +++- pages/photos/image/upload.php | 16 +++++- start.php | 16 ++++++ views/default/forms/photos/basic_upload.php | 75 +++++++++++++++++------------ views/default/photos/css.php | 64 +++++++++++++++++++----- 5 files changed, 135 insertions(+), 46 deletions(-) diff --git a/languages/en.php b/languages/en.php index 1c40e5e0a..9d8773efd 100644 --- a/languages/en.php +++ b/languages/en.php @@ -57,6 +57,13 @@ $english = array( 'tidypics:sort' => 'Sorting the %s album', 'tidypics:none' => 'No photo albums', + //upload + 'tidypics:upload:error' => 'Error:', + 'tidypics:upload:maxfilesize' => 'File is too big', + 'tidypics:upload:minfilesize' => 'File is too small', + 'tidypics:upload:acceptfiletypes' => 'Filetype not allowed', + 'tidypics:upload:maxnumberoffiles' => 'Max number of files exceeded', + //settings 'tidypics:settings' => 'Settings', 'tidypics:settings:main' => 'Primary settings', @@ -157,8 +164,7 @@ $english = array( 'tidypics:uploader:upload' => "Upload photos", 'tidypics:uploader:describe' => "Describe photos", '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. There is a %s MB maximum per photo. 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:uploader:help' => 'Tip: use Ctrl or Shift keys to select more than one file. You also can drag&drop photos from desktop.', 'tidypics:sort:instruct' => 'Sort the album photos by dragging and dropping the images. Then click the save button.', 'tidypics:sort:no_images' => 'No images found to sort. Upload images using the link above.', diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php index 61be8523b..c8e57038c 100644 --- a/pages/photos/image/upload.php +++ b/pages/photos/image/upload.php @@ -38,7 +38,21 @@ elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username"); elgg_push_breadcrumb($album->getTitle(), $album->getURL()); elgg_push_breadcrumb(elgg_echo('album:addpix')); -$content = elgg_view('forms/photos/basic_upload', array('entity' => $album)); +// load javascript dependences +elgg_load_js('jquery-tmpl'); +elgg_load_js('jquery-load-image'); +elgg_load_js('jquery-canvas-to-blob'); +elgg_load_js('jquery-fileupload'); +elgg_load_js('jquery-fileupload-ui'); +elgg_load_js('tidypics:upload'); + +$form_vars = array( + 'id' => 'fileupload', + 'action' => 'action/photos/image/upload', + 'enctype' => 'multipart/form-data', +); + +$content = elgg_view_form('photos/basic_upload', $form_vars, array('entity' => $album)); $body = elgg_view_layout('content', array( 'content' => $content, diff --git a/start.php b/start.php index 45e9257f5..376c7985d 100644 --- a/start.php +++ b/start.php @@ -38,12 +38,28 @@ function tidypics_init() { $js = elgg_get_simplecache_url('js', 'photos/tidypics'); elgg_register_simplecache_view('js/photos/tidypics'); elgg_register_js('tidypics', $js, 'footer'); + $js = elgg_get_simplecache_url('js', 'photos/upload'); + elgg_register_simplecache_view('js/photos/upload'); + elgg_register_js('tidypics:upload', $js, 'footer'); $js = elgg_get_simplecache_url('js', 'photos/tagging'); elgg_register_simplecache_view('js/photos/tagging'); elgg_register_js('tidypics:tagging', $js, 'footer'); elgg_register_js('tidypics:slideshow', 'mod/tidypics/vendors/PicLensLite/piclens_optimized.js', 'footer'); + $js_base = 'mod/tidypics/vendors/jquery-file-upload/js'; + + elgg_register_js('jquery-tmpl', "http://blueimp.github.com/JavaScript-Templates/tmpl.js", 'footer'); + elgg_register_js('jquery-load-image', "$js_base/vendor/load-image.min.js", 'footer'); + elgg_register_js('jquery-canvas-to-blob', "$js_base/vendor/canvas-to-blob.min.js", 'footer'); + elgg_register_js('jquery-image-gallery', "$js_base/vendor/jquery.image-gallery.min.js", 'footer'); + elgg_register_js('jquery-iframe-transport', "$js_base/jquery.iframe-transport.js", 'footer'); + + elgg_register_js('jquery-fileupload', "$js_base/jquery.fileupload.js", 'footer'); + elgg_register_js('jquery-fileupload-fp', "$js_base/jquery.fileupload-fp.js", 'footer'); + elgg_register_js('jquery-fileupload-ui', "$js_base/jquery.fileupload-ui.js", 'footer'); + elgg_register_js('jquery-fileupload-jui', "$js_base/jquery.fileupload-jui.js", 'footer'); + // Add photos link to owner block/hover menus elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu'); diff --git a/views/default/forms/photos/basic_upload.php b/views/default/forms/photos/basic_upload.php index ba849d1b4..9e71cf59e 100644 --- a/views/default/forms/photos/basic_upload.php +++ b/views/default/forms/photos/basic_upload.php @@ -1,48 +1,63 @@ access_id; +$help = elgg_echo('tidypics:uploader:help'); -$maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics'); +$input = elgg_view('input/file', array( + 'name' => 'images[]', + 'multiple' => 'multiple', + 'class' => 'hidden-js', +)); -$instructions = elgg_echo("tidypics:uploader:upload"); -$max = elgg_echo('tidypics:uploader:basic', array($maxfilesize)); +$button = elgg_view('output/url', array( + 'text' => elgg_echo('tidypics:uploader:upload') . $input, + 'class' => 'elgg-button elgg-button-action fileinput-button', +)); -$list = ''; -for ($x = 0; $x < 10; $x++) { - $list .= '
      1. ' . elgg_view('input/file', array('name' => 'images[]')) . '
      2. '; -} +$reset = elgg_view('input/reset', array( + 'value' => elgg_echo('cancel'), + 'class' => 'hidden', +)); $foot = elgg_view('input/hidden', array('name' => 'guid', 'value' => $album->getGUID())); $foot .= elgg_view('input/submit', array('value' => elgg_echo("save"))); -$form_body = << $max -
        -
          - $list -
        +
        + $button + $reset +

        $help

        +
        +
        + + +
        $foot
        HTML; -echo elgg_view('input/form', array( - 'body' => $form_body, - 'action' => 'action/photos/image/upload', - 'enctype' => 'multipart/form-data', -)); +?> + + + + + + +