diff --git a/modules/kbd_nav/changelog.txt b/modules/kbd_nav/changelog.txt
new file mode 100644
index 00000000..203fdea1
--- /dev/null
+++ b/modules/kbd_nav/changelog.txt
@@ -0,0 +1,20 @@
+Kbd Navigation Changelog
+
+version 1.5:
+- Fix for RTL detection
+- Added support for Wind theme
+
+version 1.4:
+- Added RTL detection
+
+version 1.3:
+- Internal revision
+
+version 1.2:
+- Added support for GreyDragon Photo Slideshow navigation - in Photo SB slideshow mode, key navigation is superseded by slideshow navigation.
+
+version 1.1:
+- Internal revision
+
+version 1.0:
+- Initial release
\ No newline at end of file
diff --git a/modules/kbd_nav/helpers/kbd_nav_theme.php b/modules/kbd_nav/helpers/kbd_nav_theme.php
new file mode 100644
index 00000000..6540f020
--- /dev/null
+++ b/modules/kbd_nav/helpers/kbd_nav_theme.php
@@ -0,0 +1,8 @@
+script("kbd_nav.js");
+ }
+}
\ No newline at end of file
diff --git a/modules/kbd_nav/js/kbd_nav.js b/modules/kbd_nav/js/kbd_nav.js
new file mode 100644
index 00000000..83c95969
--- /dev/null
+++ b/modules/kbd_nav/js/kbd_nav.js
@@ -0,0 +1,97 @@
+/**
+*
+* Copyright (c) 2010 Serguei Dosyukov, http://blog.dragonsoft.us
+*
+* 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.
+*
+*/
+
+$.fn.KbdNavigation = function(options, callback) {
+
+ this.options = options || {};
+ var opt = this.options;
+ this.callback = callback || null;
+ var clbk = this.callback;
+
+ $(this).bind("keydown", function(event) {
+ if ($('#sb-body-inner>img#sb-content').is(':visible')) {
+ return false;
+ }
+
+ var direction = "ltr";
+ if (document.body) {
+ if (window.getComputedStyle) {
+ direction = window.getComputedStyle(document.body, null).direction;
+ } else if (document.body.currentStyle) {
+ direction = document.body.currentStyle.direction;
+ }
+ }
+
+ var lnk = "";
+ var lnk_first, lnk_prev, lnk_parent, lnk_next, lnk_last;
+
+ if(opt.first) { lnk_first = opt.first; } else { lnk_first = $("#g-navi-first").attr("href"); }
+ if(opt.prev) { lnk_prev = opt.prev; } else { lnk_prev = $("#g-navi-prev").attr("href"); }
+ if(opt.parent) { lnk_parent = opt.parent; } else { lnk_parent = $("#g-navi-parent").attr("href"); }
+ if(opt.next) { lnk_next = opt.next; } else { lnk_next = $("#g-navi-next").attr("href"); }
+ if(opt.last) { lnk_last = opt.last; } else { lnk_last = $("#g-navi-last").attr("href"); }
+
+ // Support for standard Wind Theme tags
+ if(!lnk_first) { lnk_first = $(".g-paginator .ui-icon-seek-first").parent().attr("href"); }
+ if(!lnk_prev) { lnk_prev = $(".g-paginator .ui-icon-seek-prev").parent().attr("href"); }
+ if(!lnk_next) { lnk_next = $(".g-paginator .ui-icon-seek-next").parent().attr("href"); }
+ if(!lnk_last) { lnk_last = $(".g-paginator .ui-icon-seek-end").parent().attr("href"); }
+
+ var keyCode = event.keyCode;
+
+ if (direction == "rtl") {
+ switch(keyCode) {
+ case 0x25: // Left
+ keyCode = 0x27;
+ break;
+ case 0x27: // Right
+ keyCode = 0x25;
+ break;
+ }
+ }
+
+ switch(keyCode) {
+ case 0x25: // Ctr+Left/Left
+ if(event.ctrlKey) { lnk = lnk_first; } else { lnk = lnk_prev; }
+ break;
+ case 0x26: // Ctrl+Up
+ if(event.ctrlKey) { lnk = lnk_parent; }
+ break;
+ case 0x27: // Ctrl+Right/Right
+ if(event.ctrlKey) { lnk = lnk_last; } else { lnk = lnk_next; }
+ break;
+ }
+
+ if(lnk) {
+ if(typeof clbk == 'function') {
+ clbk();
+ return false;
+ } else {
+ window.location = lnk;
+ return true;
+ }
+ }
+
+ return true;
+ });
+}
+
+$(document).ready( function() {
+ $(document).KbdNavigation({});
+ if ($('#sb-content').is(':visible')) { return true; }
+});
\ No newline at end of file
diff --git a/modules/kbd_nav/module.info b/modules/kbd_nav/module.info
new file mode 100644
index 00000000..2eda7c73
--- /dev/null
+++ b/modules/kbd_nav/module.info
@@ -0,0 +1,3 @@
+name = "Kbd Navigation"
+description = "Adds keyboard navigation to the gallery. Version 1.5 | By Serguei Dosyukov | Visit plugin Site | Support "
+version = 5
diff --git a/modules/photoannotation/controllers/admin_photoannotation.php b/modules/photoannotation/controllers/admin_photoannotation.php
old mode 100644
new mode 100755
index 535c004a..bdcd71be
--- a/modules/photoannotation/controllers/admin_photoannotation.php
+++ b/modules/photoannotation/controllers/admin_photoannotation.php
@@ -48,17 +48,34 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
}
//Load all existing tag annotations
$tag_annotations = ORM::factory("items_face")->where("tag_id", "=", $sourcetag->id)->find_all();
-
+ //Disable user notifications so that users don't get flooded with mails
+ $old_notification_setting = module::get_var("photoannotation", "nonotifications", false);
+ module::set_var("photoannotation", "nonotifications", true, true);
foreach ($tag_annotations as $tag_annotation) {
photoannotation::saveuser($targetuser->id, $tag_annotation->item_id, $tag_annotation->x1, $tag_annotation->y1, $tag_annotation->x2, $tag_annotation->y2, $tag_annotation->description);
//Delete the old annotation
$tag_annotation->delete();
}
+ //Remove and delete old tag
+ if ($form->deletetag->value) {
+ $this->_remove_tag($sourcetag, true);
+ } elseif ($form->removetag->value) {
+ $this->_remove_tag($sourcetag, false);
+ }
+ module::set_var("photoannotation", "nonotifications", $old_notification_setting, true);
message::success(t("%count tag annotations (%tagname) have been converted to user annotations (%username)", array("count" => count($tag_annotations), "tagname" => $sourcetag->name, "username" => $targetuser->display_name())));
url::redirect("admin/photoannotation/converter");
}
print $this->_get_converter_view($form);
}
+
+ private function _remove_tag($tag, $delete) {
+ $name = $tag->name;
+ db::build()->delete("items_tags")->where("tag_id", "=", $tag->id)->execute();
+ if ($delete) {
+ $tag->delete();
+ }
+ }
public function handler() {
access::verify_csrf();
@@ -90,17 +107,19 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
module::set_var(
"photoannotation", "notificationoptout", $form->notifications->notificationoptout->value, true);
module::set_var(
- "photoannotation", "newtagsubject", $form->newtagmail->newtagsubject->value);
+ "photoannotation", "allowguestsearch", $form->notifications->allowguestsearch->value, true);
module::set_var(
- "photoannotation", "newtagbody", $form->newtagmail->newtagbody->value);
+ "photoannotation", "newtagsubject", strip_tags($form->newtagmail->newtagsubject->value));
module::set_var(
- "photoannotation", "newcommentsubject", $form->newcommentmail->newcommentsubject->value);
+ "photoannotation", "newtagbody", strip_tags($form->newtagmail->newtagbody->value));
module::set_var(
- "photoannotation", "newcommentbody", $form->newcommentmail->newcommentbody->value);
+ "photoannotation", "newcommentsubject", strip_tags($form->newcommentmail->newcommentsubject->value));
module::set_var(
- "photoannotation", "updatedcommentsubject", $form->updatedcommentmail->updatedcommentsubject->value);
+ "photoannotation", "newcommentbody", strip_tags($form->newcommentmail->newcommentbody->value));
module::set_var(
- "photoannotation", "updatedcommentbody", $form->updatedcommentmail->updatedcommentbody->value);
+ "photoannotation", "updatedcommentsubject", strip_tags($form->updatedcommentmail->updatedcommentsubject->value));
+ module::set_var(
+ "photoannotation", "updatedcommentbody", strip_tags($form->updatedcommentmail->updatedcommentbody->value));
module::set_var(
"photoannotation", "onuserdelete", $form->onuserdelete->onuserdelete->value);
message::success(t("Your settings have been saved."));
@@ -221,6 +240,8 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
->options($tag_array);
$form->dropdown("targetuser")->label(t("Select user"))
->options($user_array);
+ $form->checkbox("deletetag")->label(t("Delete the tag after conversion."));
+ $form->checkbox("removetag")->label(t("Remove the tag from photos after conversion."));
$form->submit("submit")->value(t("Convert"));
return $form;
}
@@ -251,19 +272,21 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
->value(module::get_var("photoannotation", "hovercolor", "990000"))
->rules("valid_alpha_numeric|length[6]");
$group = $form->group("legendsettings")->label(t("Legend settings"));
- $group->checkbox("showusers")->label(t("Show face annotation below photo."))
+ $group->checkbox("showusers")->label(t("Show user annotations below photo."))
->checked(module::get_var("photoannotation", "showusers", false));
- $group->checkbox("showfaces")->label(t("Show face annotation below photo."))
+ $group->checkbox("showfaces")->label(t("Show tag annotations below photo."))
->checked(module::get_var("photoannotation", "showfaces", false));
$group->checkbox("shownotes")->label(t("Show note annotations below photo."))
->checked(module::get_var("photoannotation", "shownotes", false));
$group->checkbox("fullname")->label(t("Show full name of a user instead of the username on annotations (username will be dispayed for users without a full name)."))
->checked(module::get_var("photoannotation", "fullname", false));
- $group = $form->group("notifications")->label(t("Notification settings"));
+ $group = $form->group("notifications")->label(t("Notification and user cloud settings"));
$group->checkbox("nonotifications")->label(t("Disable user notifications."))
->checked(module::get_var("photoannotation", "nonotifications", false));
$group->checkbox("notificationoptout")->label(t("Notify users by default (only applies to new users and user who have not saved their profile after installing this module)."))
->checked(module::get_var("photoannotation", "notificationoptout", false));
+ $group->checkbox("allowguestsearch")->label(t("Show user cloud and allow user search for guests."))
+ ->checked(module::get_var("photoannotation", "allowguestsearch", false));
$group = $form->group("newtagmail")->label(t("Customize the mail sent to users when a user annotation is created"));
$group->input("newtagsubject")->label(t("Subject"))
->value(module::get_var("photoannotation", "newtagsubject", "Someone tagged a photo of you"));
diff --git a/modules/photoannotation/controllers/photoannotation.php b/modules/photoannotation/controllers/photoannotation.php
index 0ba8a79c..1431a311 100644
--- a/modules/photoannotation/controllers/photoannotation.php
+++ b/modules/photoannotation/controllers/photoannotation.php
@@ -18,6 +18,55 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class photoannotation_Controller extends Controller {
+ public function showuser() {
+ if (identity::active_user()->guest && !module::get_var("photoannotation", "allowguestsearch", false)) {
+ message::error(t("You have to log in to perform a user search."));
+ url::redirect(url::site());
+ return;
+ }
+ $form = photoannotation::get_user_search_form("g-user-cloud-form");
+ $user_id = Input::instance()->get("name", "");
+ if ($user_id == "") {
+ $user_id = Input::instance()->post("name", "");
+ }
+ $getuser = photoannotation::getuser($user_id);
+ if ($getuser->found) {
+ url::redirect(user_profile::url($getuser->user->id));
+ return;
+ }
+ $page_size = module::get_var("gallery", "page_size", 9);
+ $page = Input::instance()->get("page", 1);
+ $offset = ($page - 1) * $page_size;
+
+ // Make sure that the page references a valid offset
+ if ($page < 1) {
+ $page = 1;
+ }
+ list ($count, $result) = photoannotation::search_user($user_id, $page_size, $offset);
+ $max_pages = max(ceil($count / $page_size), 1);
+ if ($page > 1) {
+ $previous_page_url = url::site("photoannotation/showuser?name=". $user_id ."&page=". ($page - 1));
+ }
+ if ($page < $max_pages) {
+ $next_page_url = url::site("photoannotation/showuser?name=". $user_id ."&page=". ($page + 1));
+ }
+ if ($user_id == "") {
+ $user_id = "*";
+ }
+ $template = new Theme_View("page.html", "other", "usersearch");
+ $template->set_global("position", $page);
+ $template->set_global("total", $max_pages);
+ $template->content = new View("photoannotation_user_search.html");
+ $template->content->search_form = photoannotation::get_user_search_form(g-user-search-form);
+ $template->content->users = $result;
+ $template->content->q = $user_id;
+ $template->content->count = $count;
+ $template->content->paginator = new View("paginator.html");
+ $template->content->paginator->previous_page_url = $previous_page_url;
+ $template->content->paginator->next_page_url = $next_page_url;
+ print $template;
+ }
+
public function save($item_id) {
// Prevent Cross Site Request Forgery
access::verify_csrf();
@@ -31,9 +80,26 @@ class photoannotation_Controller extends Controller {
$str_x2 = $_POST["width"] + $str_x1; //Annotation uses area size, tagfaces uses positions
$item_title = $_POST["text"];
$tag_data = $_POST["tagsList"];
+ $user_id = "";
$user_id = $_POST["userlist"];
$description = $_POST["desc"];
$redir_uri = url::abs_site("{$item->type}s/{$item->id}");
+ //If this is a user then get the id
+ if ($user_id != "") {
+ $getuser = photoannotation::getuser($user_id);
+ if (!$getuser->found) {
+ message::error(t("Could not find user %user.", array("user" => $user_id)));
+ url::redirect($redir_uri);
+ return;
+ }
+ if ($getuser->isguest) {
+ message::error(t("You cannot create an annotation for the guest user."));
+ url::redirect($redir_uri);
+ return;
+ }
+ $user_id = $getuser->user->id;
+ }
+
//Add tag to item, create tag if not exists
if ($tag_data != "") {
$tag = ORM::factory("tag")->where("name", "=", $tag_data)->find();
@@ -161,4 +227,22 @@ class photoannotation_Controller extends Controller {
message::success(t("Annotation deleted."));
url::redirect($redir_uri);
}
+
+ public function autocomplete() {
+ $users = array();
+ $user_parts = explode(",", Input::instance()->get("q"));
+ $limit = Input::instance()->get("limit");
+ $user_part = ltrim(end($user_parts));
+ $user_list = ORM::factory("user")
+ ->where("name", "LIKE", "{$user_part}%")
+ ->order_by("name", "ASC")
+ ->limit($limit)
+ ->find_all();
+ foreach ($user_list as $user) {
+ if ($user->name != "guest") {
+ $users[] = $user->display_name() ." (". $user->name .")";
+ }
+ }
+ print implode("\n", $users);
+ }
}
diff --git a/modules/photoannotation/css/photoannotation.css b/modules/photoannotation/css/photoannotation.css
index de3e6f87..90d7026b 100644
--- a/modules/photoannotation/css/photoannotation.css
+++ b/modules/photoannotation/css/photoannotation.css
@@ -1,3 +1,75 @@
+.photoannotation-user-search {
+ border-bottom-style:solid;
+ border-bottom-width:1px;
+ padding: 0.8em 0.8em !important;
+}
+
+#g-user-cloud ul {
+ font-size: 1.2em;
+ text-align: justify;
+}
+
+#g-user-cloud ul li {
+ display: inline;
+ line-height: 1.5em;
+ text-align: justify;
+}
+
+#g-user-cloud ul li a {
+ text-decoration: none;
+}
+
+#g-user-cloud ul li span {
+ display: none;
+}
+
+#g-user-cloud ul li.size1 a {
+ color: #9cf;
+ font-size: 80%;
+ font-weight: 100;
+}
+
+#g-user-cloud ul li.size2 a {
+ color: #69f;
+ font-size: 90%;
+ font-weight: 300;
+}
+
+#g-user-cloud ul li.size3 a {
+ color: #69c;
+ font-size: 100%;
+ font-weight: 500;
+}
+
+#g-user-cloud ul li.size4 a {
+ color: #369;
+ font-size: 110%;
+ font-weight: 700;
+}
+
+#g-user-cloud ul li.size5 a {
+ color: #0e2b52;
+ font-size: 120%;
+ font-weight: 900;
+}
+
+#g-user-cloud ul li.size6 a {
+ color: #0e2b52;
+ font-size: 130%;
+ font-weight: 900;
+}
+
+#g-user-cloud ul li.size7 a {
+ color: #0e2b52;
+ font-size: 140%;
+ font-weight: 900;
+}
+
+#g-user-cloud ul li a:hover {
+ color: #f30;
+ text-decoration: underline;
+}
+
.image-annotate-canvas {
background-position: left top;
background-repeat: no-repeat;
diff --git a/modules/photoannotation/helpers/photoannotation.php b/modules/photoannotation/helpers/photoannotation.php
index 3e45265f..13ec4078 100644
--- a/modules/photoannotation/helpers/photoannotation.php
+++ b/modules/photoannotation/helpers/photoannotation.php
@@ -18,6 +18,62 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class photoannotation_Core {
+ static function search_user($q, $page_size, $offset) {
+ $db = Database::instance();
+ $q = trim($q, "*");
+ $q = $db->escape($q) ."*";
+ if ($q == "*") {
+ $users = ORM::factory("user");
+ $count = $users->count_all();
+ $data = $users->order_by("name", "ASC")->find_all($page_size, $offset);
+ return array($count, $data);
+ } else {
+ $query =
+ "SELECT SQL_CALC_FOUND_ROWS {users}.*, " .
+ " MATCH({users}.`name`) AGAINST ('$q' IN BOOLEAN MODE) AS `score` " .
+ "FROM {users} " .
+ "WHERE MATCH({users}.`name`) AGAINST ('$q' IN BOOLEAN MODE) " .
+ "ORDER BY `score` DESC " .
+ "LIMIT $page_size OFFSET $offset";
+ $data = $db->query($query);
+ $count = $db->query("SELECT FOUND_ROWS() as c")->current()->c;
+ return array($count, new ORM_Iterator(ORM::factory("user"), $data));
+ }
+ }
+
+ static function get_user_search_form($form_id) {
+ $form = new Forge("photoannotation/showuser/{$item->id}", "", "post", array("id" => $form_id, "class" => "g-short-form"));
+ $label = t("Type user name");
+
+ $group = $form->group("showuser")->label("Search for a user");
+ $group->input("name")->label($label)->id("name");
+ $group->submit("")->value(t("Search"));
+ return $form;
+ }
+
+ public static function getuser($user_string) {
+ $user_parts = explode("(", $user_string);
+ $user_part = rtrim(ltrim(end($user_parts)), ")");
+ $user = ORM::factory("user")->where("name", "=", $user_part)->find();
+ $user_firstpart = trim(implode(array_slice($user_parts, 0, count($user_parts)-1)));
+ if (!$user->loaded() || strcasecmp($user_firstpart, $user->display_name()) <> 0) {
+ $result->found = false;
+ $result->isguest = false;
+ $result->user = "";
+ return $result;
+ }
+ if (identity::guest()->id == $user->id) {
+ $result->found = true;
+ $result->isguest = true;
+ $result->user = "";
+ return $result;
+ }
+ $result->found = true;
+ $result->isguest = false;
+ $result->user = $user;
+ return $result;
+ }
+
public static function saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description) {
//Since we are associating a user we will remove any old annotation of this user on this photo
$item_old_users = ORM::factory("items_user")
@@ -94,6 +150,10 @@ class photoannotation_Core {
}
//Only send mail if the notifications are switched on globally
if (!module::get_var("photoannotation", "nonotifications", false)) {
+ //Check if the use has a valid e-mail
+ if (!valid::email($recipient->email)) {
+ return false;
+ }
//Get the users settings
$notification_settings = self::get_user_notification_settings($recipient);
//Check which type of mail to send
@@ -111,6 +171,12 @@ class photoannotation_Core {
case "newcomment":
//Only send if user has this option enabled
if ($notification_settings->comment) {
+ //Don't send if the notification module is active and the user is watching this item
+ if (module::is_active("notification")) {
+ if (notification::is_watching($item, $recipient)) {
+ return false;
+ }
+ }
//Get subject and body and send the mail
$subject = module::get_var("photoannotation", "newcommentsubject", "Someone added a comment to photo of you");
$body = module::get_var("photoannotation", "newcommentbody", "Hello %name, please visit %url to read the comment.");
@@ -121,6 +187,12 @@ class photoannotation_Core {
case "updatecomment":
//Only send if user has this option enabled
if ($notification_settings->comment) {
+ //Don't send if the notification module is active and the user is watching this item
+ if (module::is_active("notification")) {
+ if (notification::is_watching($item, $recipient)) {
+ return false;
+ }
+ }
//Get subject and body and send the mail
$subject = module::get_var("photoannotation", "updatedcommentsubject", "Someone updated a comment to photo of you");
$body = module::get_var("photoannotation", "updatedcommentbody", "Hello %name, please visit %url to read the comment.");
@@ -134,6 +206,7 @@ class photoannotation_Core {
private static function _send_mail($mailto, $subject, $message) {
//Send the notification mail
+ $message = nl2br($message);
return Sendmail::factory()
->to($mailto)
->subject($subject)
@@ -168,4 +241,45 @@ class photoannotation_Core {
}
return $user_array;
}
+
+ static function cloud($count) {
+ $users = ORM::factory("user")->order_by("name", "ASC")->find_all();
+ if ($users) {
+ $cloud = new View("photoannotation_cloud.html");
+ $fullname = module::get_var("photoannotation", "fullname", false);
+ foreach ($users as $user) {
+ $annotations = ORM::factory("items_user")->where("user_id", "=", $user->id)->count_all();
+ if ($annotations > 0) {
+ if ($annotations > $maxcount) {
+ $maxcount = $annotations;
+ }
+ if ($fullname) {
+ $user_array[$user->name]->name = $user->display_name();
+ } else {
+ $user_array[$user->name]->name = $user->name;
+ }
+ $user_array[$user->name]->size = $annotations;
+ $user_array[$user->name]->url = user_profile::url($user->id);
+ }
+ }
+ $cloud->users = array_slice($user_array, 0, $count);
+ $cloud->max_count = $maxcount;
+ if (!$cloud->max_count) {
+ return;
+ }
+ return $cloud;
+ }
+ }
+
+ static function comment_count($user_id) {
+ if (module::is_active("comment")) {
+ return ORM::factory("comment")->where("author_id", "=", $user_id)->count_all();
+ } else {
+ return false;
+ }
+ }
+
+ static function annotation_count($user_id) {
+ return ORM::factory("items_user")->where("user_id", "=", $user_id)->count_all();
+ }
}
\ No newline at end of file
diff --git a/modules/photoannotation/helpers/photoannotation_block.php b/modules/photoannotation/helpers/photoannotation_block.php
new file mode 100644
index 00000000..6facc671
--- /dev/null
+++ b/modules/photoannotation/helpers/photoannotation_block.php
@@ -0,0 +1,40 @@
+ t("Users"));
+ }
+
+ static function get($block_id, $theme) {
+ $block = "";
+ if (!identity::active_user()->guest || module::get_var("photoannotation", "allowguestsearch", false)) {
+ switch ($block_id) {
+ case "photoannotation":
+ $block = new Block();
+ $block->css_id = "g-photoannotation";
+ $block->title = t("Users");
+ $block->content = new View("photoannotation_block.html");
+ $block->content->cloud = photoannotation::cloud(30);
+ $block->content->form = photoannotation::get_user_search_form("g-user-cloud-form");
+ }
+ }
+ return $block;
+ }
+}
\ No newline at end of file
diff --git a/modules/photoannotation/helpers/photoannotation_event.php b/modules/photoannotation/helpers/photoannotation_event.php
index cf841ac3..2d58af53 100644
--- a/modules/photoannotation/helpers/photoannotation_event.php
+++ b/modules/photoannotation/helpers/photoannotation_event.php
@@ -233,7 +233,7 @@ class photoannotation_event_Core {
$item_users = ORM::factory("items_user")->where("item_id", "=", $comment->item_id)->find_all();
if (count($item_users) > 0) {
foreach ($item_users as $item_user) {
- photoannotation::send_notifications($item_user->user_id, $comment->item_id, "updatecomment");
+ photoannotation::send_notifications($item_user->user_id, $comment->item_id, "updatedcomment");
}
}
}
diff --git a/modules/photoannotation/helpers/photoannotation_theme.php b/modules/photoannotation/helpers/photoannotation_theme.php
index dcc5daa3..e255b883 100644
--- a/modules/photoannotation/helpers/photoannotation_theme.php
+++ b/modules/photoannotation/helpers/photoannotation_theme.php
@@ -19,9 +19,9 @@
*/
class photoannotation_theme_Core {
static function head($theme) {
+ $theme->css("photoannotation.css");
if ($theme->page_subtype == "photo") {
- $theme->css("photoannotation.css");
- $theme->script("jquery.annotate.js");
+ $theme->script("jquery.annotate.min.js");
$noborder = module::get_var("photoannotation", "noborder", false);
$noclickablehover = module::get_var("photoannotation", "noclickablehover", false);
$nohover = module::get_var("photoannotation", "nohover", false);
@@ -74,7 +74,7 @@ class photoannotation_theme_Core {
static function admin_head($theme) {
if (strpos($theme->content->kohana_filename, "admin_photoannotation.html.php")) {
$theme->css("colorpicker.css");
- $theme->script("colorpicker.js");
+ $theme->script("jquery.colorpicker.min.js");
}
}
diff --git a/modules/photoannotation/js/jquery.annotate.js b/modules/photoannotation/js/jquery.annotate.js
index ba98339e..4125bbc0 100644
--- a/modules/photoannotation/js/jquery.annotate.js
+++ b/modules/photoannotation/js/jquery.annotate.js
@@ -25,7 +25,7 @@
this.csrf = opts.csrf;
this.cssaclass = opts.cssaclass;
this.rtlsupport = opts.rtlsupport;
- this.users = opts.users
+ this.users = opts.users;
// Add the canvas
this.canvas = $('
');
@@ -65,7 +65,7 @@
}
// Add the "Add a note" button
- if ($('#g-photoannotation-link').length != 0) {
+ if ($('#g-photoannotation-link').length !== 0) {
this.button = $('#g-photoannotation-link');
this.button.click(function() {
$.fn.annotateImage.add(image, opts.tags, opts.labels, opts.saveUrl, opts.csrf, opts.rtlsupport, opts.users);
@@ -156,7 +156,7 @@
ok.click(function() {
var form = $('#image-annotate-edit-form form');
var text = $('#image-annotate-text').val();
- $.fn.annotateImage.appendPosition(form, editable)
+ $.fn.annotateImage.appendPosition(form, editable);
image.mode = 'view';
form.submit();
@@ -214,6 +214,7 @@
newNote.text = "";
newNote.description = "";
newNote.notetype = "";
+ newNote.internaltext = "";
this.note = newNote;
}
@@ -236,41 +237,12 @@
var selecteduser = "";
if (this.note.notetype == "face") {
selectedtag = this.note.text;
- selecteduser = " selected=\"selected\"";
} else if (this.note.notetype == "user") {
- username = this.note.text;
+ username = this.note.internaltext;
} else {
notetitle = this.note.text;
- selecteduser = " selected=\"selected\"";
}
- var userdropdown = '' + labels[11] + ' ';
- for (var user in users)
- {
- var userval = users[user];
- selecteduser = "";
- if (userval.name == this.note.text && this.note.notetype == "user") {
- selecteduser = " selected=\"selected\"";
- }
- userdropdown += '' + userval.name + ' ';
- }
- userdropdown += ' ';
- var form = $('');
-
-
-
+ var form = $('');
this.form = form;
$('body').append(this.form);
$("#photoannotation-form").ready(function() {
@@ -282,13 +254,23 @@
cacheLength: 1
}
);
+ var urlusers = users;
+ $("input#photoannotation-user-list").autocomplete(
+ urlusers, {
+ max: 30,
+ multiple: false,
+ cacheLength: 1
+ }
+ );
});
- $("input#image-annotate-tag-text").change(function() {
+ $("input#image-annotate-tag-text").keyup(function() {
if ($("input#image-annotate-tag-text").val() != "") {
$("input#image-annotate-text").html("");
$("input#image-annotate-text").val("");
$("input#image-annotate-text").text("");
- $("select#photoannotation-user-list").val('-1');
+ $("input#photoannotation-user-list").html("");
+ $("input#photoannotation-user-list").val("");
+ $("input#photoannotation-user-list").text("");
}
});
$("input#image-annotate-text").keyup(function() {
@@ -296,10 +278,12 @@
$("input#image-annotate-tag-text").html("");
$("input#image-annotate-tag-text").val("");
$("input#image-annotate-tag-text").text("");
- $("select#photoannotation-user-list").val('-1');
+ $("input#photoannotation-user-list").html("");
+ $("input#photoannotation-user-list").val("");
+ $("input#photoannotation-user-list").text("");
}
});
- $("select#photoannotation-user-list").keyup(function() {
+ $("input#photoannotation-user-list").keyup(function() {
if ($("select#photoannotation-user-list").val() != "-1") {
$("input#image-annotate-tag-text").html("");
$("input#image-annotate-tag-text").val("");
@@ -352,7 +336,7 @@
this.area.css('left', '');
this.area.css('top', '');
this.form.remove();
- }
+ };
$.fn.annotateView = function(image, note, tags, labels, editable, csrf, deleteUrl, saveUrl, cssaclass, rtlsupport, users) {
///
@@ -394,7 +378,7 @@
close: function(event, ui) { location.reload(); },
buttons: btns
});
- })
+ });
var form = this;
this.editarea.bind('click',function () {
var alink = $(cssaclass);
@@ -402,7 +386,7 @@
alink.attr ('href', '#');
alink.removeAttr ('rel');
form.edit(tags, labels, saveUrl, csrf, rtlsupport, users);
- })
+ });
this.delarea.hide();
this.editarea.hide();
}
@@ -474,7 +458,7 @@
alink.attr ('href', '#');
alink.removeAttr ('rel');
window.location = note.url;
- })
+ });
}
};
@@ -533,7 +517,7 @@
///
this.area.remove();
this.form.remove();
- }
+ };
$.fn.annotateView.prototype.edit = function(tags, labels, saveUrl, csrf, rtlsupport, users) {
///
@@ -560,7 +544,7 @@
' ' +
' ');
form.append(areaFields);
- }
+ };
$.fn.annotateView.prototype.resetPosition = function(editable, text) {
///
diff --git a/modules/photoannotation/js/jquery.annotate.min.js b/modules/photoannotation/js/jquery.annotate.min.js
new file mode 100644
index 00000000..9c9cdd6b
--- /dev/null
+++ b/modules/photoannotation/js/jquery.annotate.min.js
@@ -0,0 +1 @@
+(function($){$.fn.annotateImage=function(options){var opts=$.extend({},$.fn.annotateImage.defaults,options);var image=this;this.image=this;this.mode='view';this.getUrl=opts.getUrl;this.saveUrl=opts.saveUrl;this.deleteUrl=opts.deleteUrl;this.deleteUrl=opts.deleteUrl;this.editable=opts.editable;this.useAjax=opts.useAjax;this.tags=opts.tags;this.notes=opts.notes;this.labels=opts.labels;this.csrf=opts.csrf;this.cssaclass=opts.cssaclass;this.rtlsupport=opts.rtlsupport;this.users=opts.users;this.canvas=$('');this.canvas.children('.image-annotate-edit').hide();this.canvas.children('.image-annotate-view').hide();this.image.after(this.canvas);this.canvas.height(this.height());this.canvas.width(this.width());this.canvas.css('background-image','url("'+this.attr('src')+'")');this.canvas.children('.image-annotate-view, .image-annotate-edit').height(this.height());this.canvas.children('.image-annotate-view, .image-annotate-edit').width(this.width());this.canvas.hover(function(){if($(this).children('.image-annotate-edit').css('display')=='none'){$(this).children('.image-annotate-view').show()}},function(){$(this).children('.image-annotate-view').hide();$(this).children('.image-annotate-note').hide()});this.canvas.children('.image-annotate-view').hover(function(){$(this).show()},function(){$(this).hide();$(this).children('.image-annotate-note').hide()});if(this.useAjax){$.fn.annotateImage.ajaxLoad(this)}else{$.fn.annotateImage.load(this,this.labels,this.editable,this.csrf,this.deleteUrl,this.tags,this.saveUrl,this.cssaclass,this.rtlsupport,this.users)}if($('#g-photoannotation-link').length!==0){this.button=$('#g-photoannotation-link');this.button.click(function(){$.fn.annotateImage.add(image,opts.tags,opts.labels,opts.saveUrl,opts.csrf,opts.rtlsupport,opts.users)})}this.hide();return this};$.fn.annotateImage.defaults={getUrl:'your-get.rails',saveUrl:'your-save.rails',deleteUrl:'your-delete.rails',editable:true,useAjax:true,tags:new Array(),notes:new Array()};$.fn.annotateImage.clear=function(image){for(var i=0;i'+labels[8]+'');ok.click(function(){var form=$('#image-annotate-edit-form form');var text=$('#image-annotate-text').val();$.fn.annotateImage.appendPosition(form,editable);image.mode='view';form.submit();editable.destroy()});editable.form.append(ok)};$.fn.annotateImage.createCancelButton=function(editable,image,rtlsupport,labels){var cancel=$(''+labels[9]+' ');cancel.click(function(){editable.destroy();image.mode='view';location.reload()});editable.form.append(cancel)};$.fn.annotateImage.saveAsHtml=function(image,target){var element=$(target);var html="";for(var i=0;i '};$.fn.annotateEdit=function(image,note,tags,labels,saveUrl,csrf,rtlsupport,users){this.image=image;if(note){this.note=note}else{var newNote=new Object();newNote.noteid="new";newNote.top=30;newNote.left=30;newNote.width=30;newNote.height=30;newNote.text="";newNote.description="";newNote.notetype="";newNote.internaltext="";this.note=newNote}var area=image.canvas.children('.image-annotate-edit').children('.image-annotate-edit-area');this.area=area;this.area.css('height',this.note.height+'px');this.area.css('width',this.note.width+'px');this.area.css('left',this.note.left+'px');this.area.css('top',this.note.top+'px');image.canvas.children('.image-annotate-view').hide();image.canvas.children('.image-annotate-edit').show();var selectedtag="";var notetitle="";var username="";var selecteduser="";if(this.note.notetype=="face"){selectedtag=this.note.text}else if(this.note.notetype=="user"){username=this.note.internaltext}else{notetitle=this.note.text}var form=$('');this.form=form;$('body').append(this.form);$("#photoannotation-form").ready(function(){var url=tags;$("input#image-annotate-tag-text").autocomplete(url,{max:30,multiple:false,cacheLength:1});var urlusers=users;$("input#photoannotation-user-list").autocomplete(urlusers,{max:30,multiple:false,cacheLength:1})});$("input#image-annotate-tag-text").keyup(function(){if($("input#image-annotate-tag-text").val()!=""){$("input#image-annotate-text").html("");$("input#image-annotate-text").val("");$("input#image-annotate-text").text("");$("input#photoannotation-user-list").html("");$("input#photoannotation-user-list").val("");$("input#photoannotation-user-list").text("")}});$("input#image-annotate-text").keyup(function(){if($("input#image-annotate-text").val()!=""){$("input#image-annotate-tag-text").html("");$("input#image-annotate-tag-text").val("");$("input#image-annotate-tag-text").text("");$("input#photoannotation-user-list").html("");$("input#photoannotation-user-list").val("");$("input#photoannotation-user-list").text("")}});$("input#photoannotation-user-list").keyup(function(){if($("select#photoannotation-user-list").val()!="-1"){$("input#image-annotate-tag-text").html("");$("input#image-annotate-tag-text").val("");$("input#image-annotate-tag-text").text("");$("input#image-annotate-text").html("");$("input#image-annotate-text").val("");$("input#image-annotate-text").text("")}});this.form.css('left',this.area.offset().left+'px');this.form.css('top',(parseInt(this.area.offset().top)+parseInt(this.area.height())+7)+'px');area.resizable({handles:'all',start:function(e,ui){form.hide()},stop:function(e,ui){form.css('left',area.offset().left+'px');form.css('top',(parseInt(area.offset().top)+parseInt(area.height())+7)+'px');form.show()}}).draggable({containment:image.canvas,drag:function(e,ui){form.hide()},stop:function(e,ui){form.css('left',area.offset().left+'px');form.css('top',(parseInt(area.offset().top)+parseInt(area.height())+7)+'px');form.show()}});return this};$.fn.annotateEdit.prototype.destroy=function(){this.image.canvas.children('.image-annotate-edit').hide();this.area.resizable('destroy');this.area.draggable('destroy');this.area.css('height','');this.area.css('width','');this.area.css('left','');this.area.css('top','');this.form.remove()};$.fn.annotateView=function(image,note,tags,labels,editable,csrf,deleteUrl,saveUrl,cssaclass,rtlsupport,users){this.image=image;this.note=note;this.area=$('');image.canvas.children('.image-annotate-view').prepend(this.area);if(editable){this.delarea=$('');this.editarea=$('');image.canvas.children('.image-annotate-view').prepend(this.delarea);image.canvas.children('.image-annotate-view').prepend(this.editarea);this.delarea.bind('click',function(){var alink=$(cssaclass);alink.unbind();alink.attr('href','#');alink.removeAttr('rel');var confdialog=''+labels[3]+'
';$('body').append(confdialog);var btns={};if(rtlsupport==""){diagclass="inmage-annotate-dialog"}else{diagclass="inmage-annotate-dialog-rtl"}btns[labels[5]]=function(){var delform=$(this).attr("rel");$("form#"+delform).submit()};btns[labels[6]]=function(){location.reload()};$('#image-annotate-conf-dialog').dialog({modal:true,resizable:false,dialogClass:diagclass,title:labels[7],close:function(event,ui){location.reload()},buttons:btns})});var form=this;this.editarea.bind('click',function(){var alink=$(cssaclass);alink.unbind();alink.attr('href','#');alink.removeAttr('rel');form.edit(tags,labels,saveUrl,csrf,rtlsupport,users)});this.delarea.hide();this.editarea.hide()}var notedescription="";if(note.description!=""){notedescription="
"+note.description}this.form=$('
'+note.text+notedescription+'
');this.form.hide();image.canvas.children('.image-annotate-view').append(this.form);this.form.children('span.actions').hide();this.setPosition(rtlsupport);var annotation=this;this.area.hover(function(){annotation.show();if(annotation.delarea!=undefined){annotation.delarea.show();annotation.editarea.show()}},function(){annotation.hide();if(annotation.delarea!=undefined){annotation.delarea.hide();annotation.editarea.hide()}});var legendspan="#photoannotation-legend-"+this.note.notetype+"-"+this.note.noteid;if($(legendspan).length>0){$(legendspan).hover(function(){var legendsarea="#photoannotation-area-"+note.notetype+"-"+note.noteid;$(legendsarea).children('.image-annotate-view').show();$(".image-annotate-view").show();$(legendsarea).show();annotation.show()},function(){var legendsarea="#photoannotation-area-"+note.notetype+"-"+note.noteid;annotation.hide();$(legendsarea).children('.image-annotate-view').hide();$(".image-annotate-view").hide()})}if(editable){this.delarea.hover(function(){annotation.delarea.show();annotation.editarea.show()},function(){annotation.delarea.hide();annotation.editarea.hide()});this.editarea.hover(function(){annotation.delarea.show();annotation.editarea.show()},function(){annotation.delarea.hide();annotation.editarea.hide()})}if(note.url!=""&¬e.url!=null){this.area.bind('click',function(){var alink=$(cssaclass);alink.unbind();alink.attr('href','#');alink.removeAttr('rel');window.location=note.url})}};$.fn.annotateView.prototype.setPosition=function(rtlsupport){this.area.children('div').height((parseInt(this.note.height)-2)+'px');this.area.children('div').width((parseInt(this.note.width)-2)+'px');this.area.css('left',(this.note.left)+'px');this.area.css('top',(this.note.top)+'px');this.form.css('left',(this.note.left)+'px');this.form.css('top',(parseInt(this.note.top)+parseInt(this.note.height)+7)+'px');if(this.delarea!=undefined){this.delarea.children('div').height('14px');this.delarea.children('div').width('14px');this.delarea.css('top',(this.note.top)+'px');this.editarea.children('div').height('14px');this.editarea.children('div').width('14px');if(rtlsupport==''){this.delarea.css('left',(this.note.left+parseInt(this.note.width))+'px');this.editarea.css('left',(this.note.left+parseInt(this.note.width))+'px')}else{this.delarea.css('left',(this.note.left-16)+'px');this.editarea.css('left',(this.note.left-16)+'px')}this.editarea.css('top',(this.note.top+16)+'px')}};$.fn.annotateView.prototype.show=function(){this.form.fadeIn(250);if(!this.note.editable){this.area.addClass('image-annotate-area-hover')}else{this.area.addClass('image-annotate-area-editable-hover')}};$.fn.annotateView.prototype.hide=function(){this.form.fadeOut(250);this.area.removeClass('image-annotate-area-hover');this.area.removeClass('image-annotate-area-editable-hover')};$.fn.annotateView.prototype.destroy=function(){this.area.remove();this.form.remove()};$.fn.annotateView.prototype.edit=function(tags,labels,saveUrl,csrf,rtlsupport,users){if(this.image.mode=='view'){this.image.mode='edit';var annotation=this;var editable=new $.fn.annotateEdit(this.image,this.note,tags,labels,saveUrl,csrf,rtlsupport,users);$.fn.annotateImage.createSaveButton(editable,this.image,annotation,rtlsupport,labels);$.fn.annotateImage.createCancelButton(editable,this.image,rtlsupport,labels)}};$.fn.annotateImage.appendPosition=function(form,editable){var areaFields=$('
'+'
'+'
'+'
'+'
');form.append(areaFields)};$.fn.annotateView.prototype.resetPosition=function(editable,text){this.form.html(text);this.form.hide();this.area.children('div').height(editable.area.height()+'px');this.area.children('div').width((editable.area.width()-2)+'px');this.area.css('left',(editable.area.position().left)+'px');this.area.css('top',(editable.area.position().top)+'px');this.form.css('left',(editable.area.position().left)+'px');this.form.css('top',(parseInt(editable.area.position().top)+parseInt(editable.area.height())+7)+'px');this.note.top=editable.area.position().top;this.note.left=editable.area.position().left;this.note.height=editable.area.height();this.note.width=editable.area.width();this.note.text=text;this.note.id=editable.note.id;this.editable=true}})(jQuery);
diff --git a/modules/photoannotation/js/colorpicker.js b/modules/photoannotation/js/jquery.colorpicker.js
similarity index 97%
rename from modules/photoannotation/js/colorpicker.js
rename to modules/photoannotation/js/jquery.colorpicker.js
index 0c51991c..802e7c18 100644
--- a/modules/photoannotation/js/colorpicker.js
+++ b/modules/photoannotation/js/jquery.colorpicker.js
@@ -1,484 +1,484 @@
-/**
- *
- * Color picker
- * Author: Stefan Petre www.eyecon.ro
- *
- * Dual licensed under the MIT and GPL licenses
- *
- */
-(function ($) {
- var ColorPicker = function () {
- var
- ids = {},
- inAction,
- charMin = 65,
- visible,
- tpl = '
',
- defaults = {
- eventName: 'click',
- onShow: function () {},
- onBeforeShow: function(){},
- onHide: function () {},
- onChange: function () {},
- onSubmit: function () {},
- color: 'ff0000',
- livePreview: true,
- flat: false
- },
- fillRGBFields = function (hsb, cal) {
- var rgb = HSBToRGB(hsb);
- $(cal).data('colorpicker').fields
- .eq(1).val(rgb.r).end()
- .eq(2).val(rgb.g).end()
- .eq(3).val(rgb.b).end();
- },
- fillHSBFields = function (hsb, cal) {
- $(cal).data('colorpicker').fields
- .eq(4).val(hsb.h).end()
- .eq(5).val(hsb.s).end()
- .eq(6).val(hsb.b).end();
- },
- fillHexFields = function (hsb, cal) {
- $(cal).data('colorpicker').fields
- .eq(0).val(HSBToHex(hsb)).end();
- },
- setSelector = function (hsb, cal) {
- $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
- $(cal).data('colorpicker').selectorIndic.css({
- left: parseInt(150 * hsb.s/100, 10),
- top: parseInt(150 * (100-hsb.b)/100, 10)
- });
- },
- setHue = function (hsb, cal) {
- $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
- },
- setCurrentColor = function (hsb, cal) {
- $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
- },
- setNewColor = function (hsb, cal) {
- $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
- },
- keyDown = function (ev) {
- var pressedKey = ev.charCode || ev.keyCode || -1;
- if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
- return false;
- }
- var cal = $(this).parent().parent();
- if (cal.data('colorpicker').livePreview === true) {
- change.apply(this);
- }
- },
- change = function (ev) {
- var cal = $(this).parent().parent(), col;
- if (this.parentNode.className.indexOf('_hex') > 0) {
- cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
- } else if (this.parentNode.className.indexOf('_hsb') > 0) {
- cal.data('colorpicker').color = col = fixHSB({
- h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
- s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
- b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
- });
- } else {
- cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
- r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
- g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
- b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
- }));
- }
- if (ev) {
- fillRGBFields(col, cal.get(0));
- fillHexFields(col, cal.get(0));
- fillHSBFields(col, cal.get(0));
- }
- setSelector(col, cal.get(0));
- setHue(col, cal.get(0));
- setNewColor(col, cal.get(0));
- cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
- },
- blur = function (ev) {
- var cal = $(this).parent().parent();
- cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
- },
- focus = function () {
- charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
- $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
- $(this).parent().addClass('colorpicker_focus');
- },
- downIncrement = function (ev) {
- var field = $(this).parent().find('input').focus();
- var current = {
- el: $(this).parent().addClass('colorpicker_slider'),
- max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
- y: ev.pageY,
- field: field,
- val: parseInt(field.val(), 10),
- preview: $(this).parent().parent().data('colorpicker').livePreview
- };
- $(document).bind('mouseup', current, upIncrement);
- $(document).bind('mousemove', current, moveIncrement);
- },
- moveIncrement = function (ev) {
- ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
- if (ev.data.preview) {
- change.apply(ev.data.field.get(0), [true]);
- }
- return false;
- },
- upIncrement = function (ev) {
- change.apply(ev.data.field.get(0), [true]);
- ev.data.el.removeClass('colorpicker_slider').find('input').focus();
- $(document).unbind('mouseup', upIncrement);
- $(document).unbind('mousemove', moveIncrement);
- return false;
- },
- downHue = function (ev) {
- var current = {
- cal: $(this).parent(),
- y: $(this).offset().top
- };
- current.preview = current.cal.data('colorpicker').livePreview;
- $(document).bind('mouseup', current, upHue);
- $(document).bind('mousemove', current, moveHue);
- },
- moveHue = function (ev) {
- change.apply(
- ev.data.cal.data('colorpicker')
- .fields
- .eq(4)
- .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
- .get(0),
- [ev.data.preview]
- );
- return false;
- },
- upHue = function (ev) {
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
- $(document).unbind('mouseup', upHue);
- $(document).unbind('mousemove', moveHue);
- return false;
- },
- downSelector = function (ev) {
- var current = {
- cal: $(this).parent(),
- pos: $(this).offset()
- };
- current.preview = current.cal.data('colorpicker').livePreview;
- $(document).bind('mouseup', current, upSelector);
- $(document).bind('mousemove', current, moveSelector);
- },
- moveSelector = function (ev) {
- change.apply(
- ev.data.cal.data('colorpicker')
- .fields
- .eq(6)
- .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
- .end()
- .eq(5)
- .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
- .get(0),
- [ev.data.preview]
- );
- return false;
- },
- upSelector = function (ev) {
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
- $(document).unbind('mouseup', upSelector);
- $(document).unbind('mousemove', moveSelector);
- return false;
- },
- enterSubmit = function (ev) {
- $(this).addClass('colorpicker_focus');
- },
- leaveSubmit = function (ev) {
- $(this).removeClass('colorpicker_focus');
- },
- clickSubmit = function (ev) {
- var cal = $(this).parent();
- var col = cal.data('colorpicker').color;
- cal.data('colorpicker').origColor = col;
- setCurrentColor(col, cal.get(0));
- cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
- },
- show = function (ev) {
- var cal = $('#' + $(this).data('colorpickerId'));
- cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
- var pos = $(this).offset();
- var viewPort = getViewport();
- var top = pos.top + this.offsetHeight;
- var left = pos.left;
- if (top + 176 > viewPort.t + viewPort.h) {
- top -= this.offsetHeight + 176;
- }
- if (left + 356 > viewPort.l + viewPort.w) {
- left -= 356;
- }
- cal.css({left: left + 'px', top: top + 'px'});
- if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
- cal.show();
- }
- $(document).bind('mousedown', {cal: cal}, hide);
- return false;
- },
- hide = function (ev) {
- if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
- if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
- ev.data.cal.hide();
- }
- $(document).unbind('mousedown', hide);
- }
- },
- isChildOf = function(parentEl, el, container) {
- if (parentEl == el) {
- return true;
- }
- if (parentEl.contains) {
- return parentEl.contains(el);
- }
- if ( parentEl.compareDocumentPosition ) {
- return !!(parentEl.compareDocumentPosition(el) & 16);
- }
- var prEl = el.parentNode;
- while(prEl && prEl != container) {
- if (prEl == parentEl)
- return true;
- prEl = prEl.parentNode;
- }
- return false;
- },
- getViewport = function () {
- var m = document.compatMode == 'CSS1Compat';
- return {
- l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
- t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
- w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
- h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
- };
- },
- fixHSB = function (hsb) {
- return {
- h: Math.min(360, Math.max(0, hsb.h)),
- s: Math.min(100, Math.max(0, hsb.s)),
- b: Math.min(100, Math.max(0, hsb.b))
- };
- },
- fixRGB = function (rgb) {
- return {
- r: Math.min(255, Math.max(0, rgb.r)),
- g: Math.min(255, Math.max(0, rgb.g)),
- b: Math.min(255, Math.max(0, rgb.b))
- };
- },
- fixHex = function (hex) {
- var len = 6 - hex.length;
- if (len > 0) {
- var o = [];
- for (var i=0; i
-1) ? hex.substring(1) : hex), 16);
- return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
- },
- HexToHSB = function (hex) {
- return RGBToHSB(HexToRGB(hex));
- },
- RGBToHSB = function (rgb) {
- var hsb = {
- h: 0,
- s: 0,
- b: 0
- };
- var min = Math.min(rgb.r, rgb.g, rgb.b);
- var max = Math.max(rgb.r, rgb.g, rgb.b);
- var delta = max - min;
- hsb.b = max;
- if (max != 0) {
-
- }
- hsb.s = max != 0 ? 255 * delta / max : 0;
- if (hsb.s != 0) {
- if (rgb.r == max) {
- hsb.h = (rgb.g - rgb.b) / delta;
- } else if (rgb.g == max) {
- hsb.h = 2 + (rgb.b - rgb.r) / delta;
- } else {
- hsb.h = 4 + (rgb.r - rgb.g) / delta;
- }
- } else {
- hsb.h = -1;
- }
- hsb.h *= 60;
- if (hsb.h < 0) {
- hsb.h += 360;
- }
- hsb.s *= 100/255;
- hsb.b *= 100/255;
- return hsb;
- },
- HSBToRGB = function (hsb) {
- var rgb = {};
- var h = Math.round(hsb.h);
- var s = Math.round(hsb.s*255/100);
- var v = Math.round(hsb.b*255/100);
- if(s == 0) {
- rgb.r = rgb.g = rgb.b = v;
- } else {
- var t1 = v;
- var t2 = (255-s)*v/255;
- var t3 = (t1-t2)*(h%60)/60;
- if(h==360) h = 0;
- if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
- else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
- else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
- else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
- else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
- else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
- else {rgb.r=0; rgb.g=0; rgb.b=0}
- }
- return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
- },
- RGBToHex = function (rgb) {
- var hex = [
- rgb.r.toString(16),
- rgb.g.toString(16),
- rgb.b.toString(16)
- ];
- $.each(hex, function (nr, val) {
- if (val.length == 1) {
- hex[nr] = '0' + val;
- }
- });
- return hex.join('');
- },
- HSBToHex = function (hsb) {
- return RGBToHex(HSBToRGB(hsb));
- },
- restoreOriginal = function () {
- var cal = $(this).parent();
- var col = cal.data('colorpicker').origColor;
- cal.data('colorpicker').color = col;
- fillRGBFields(col, cal.get(0));
- fillHexFields(col, cal.get(0));
- fillHSBFields(col, cal.get(0));
- setSelector(col, cal.get(0));
- setHue(col, cal.get(0));
- setNewColor(col, cal.get(0));
- };
- return {
- init: function (opt) {
- opt = $.extend({}, defaults, opt||{});
- if (typeof opt.color == 'string') {
- opt.color = HexToHSB(opt.color);
- } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
- opt.color = RGBToHSB(opt.color);
- } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
- opt.color = fixHSB(opt.color);
- } else {
- return this;
- }
- return this.each(function () {
- if (!$(this).data('colorpickerId')) {
- var options = $.extend({}, opt);
- options.origColor = opt.color;
- var id = 'collorpicker_' + parseInt(Math.random() * 1000);
- $(this).data('colorpickerId', id);
- var cal = $(tpl).attr('id', id);
- if (options.flat) {
- cal.appendTo(this).show();
- } else {
- cal.appendTo(document.body);
- }
- options.fields = cal
- .find('input')
- .bind('keyup', keyDown)
- .bind('change', change)
- .bind('blur', blur)
- .bind('focus', focus);
- cal
- .find('span').bind('mousedown', downIncrement).end()
- .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
- options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
- options.selectorIndic = options.selector.find('div div');
- options.el = this;
- options.hue = cal.find('div.colorpicker_hue div');
- cal.find('div.colorpicker_hue').bind('mousedown', downHue);
- options.newColor = cal.find('div.colorpicker_new_color');
- options.currentColor = cal.find('div.colorpicker_current_color');
- cal.data('colorpicker', options);
- cal.find('div.colorpicker_submit')
- .bind('mouseenter', enterSubmit)
- .bind('mouseleave', leaveSubmit)
- .bind('click', clickSubmit);
- fillRGBFields(options.color, cal.get(0));
- fillHSBFields(options.color, cal.get(0));
- fillHexFields(options.color, cal.get(0));
- setHue(options.color, cal.get(0));
- setSelector(options.color, cal.get(0));
- setCurrentColor(options.color, cal.get(0));
- setNewColor(options.color, cal.get(0));
- if (options.flat) {
- cal.css({
- position: 'relative',
- display: 'block'
- });
- } else {
- $(this).bind(options.eventName, show);
- }
- }
- });
- },
- showPicker: function() {
- return this.each( function () {
- if ($(this).data('colorpickerId')) {
- show.apply(this);
- }
- });
- },
- hidePicker: function() {
- return this.each( function () {
- if ($(this).data('colorpickerId')) {
- $('#' + $(this).data('colorpickerId')).hide();
- }
- });
- },
- setColor: function(col) {
- if (typeof col == 'string') {
- col = HexToHSB(col);
- } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
- col = RGBToHSB(col);
- } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
- col = fixHSB(col);
- } else {
- return this;
- }
- return this.each(function(){
- if ($(this).data('colorpickerId')) {
- var cal = $('#' + $(this).data('colorpickerId'));
- cal.data('colorpicker').color = col;
- cal.data('colorpicker').origColor = col;
- fillRGBFields(col, cal.get(0));
- fillHSBFields(col, cal.get(0));
- fillHexFields(col, cal.get(0));
- setHue(col, cal.get(0));
- setSelector(col, cal.get(0));
- setCurrentColor(col, cal.get(0));
- setNewColor(col, cal.get(0));
- }
- });
- }
- };
- }();
- $.fn.extend({
- ColorPicker: ColorPicker.init,
- ColorPickerHide: ColorPicker.hidePicker,
- ColorPickerShow: ColorPicker.showPicker,
- ColorPickerSetColor: ColorPicker.setColor
- });
-})(jQuery);
+/**
+ *
+ * Color picker
+ * Author: Stefan Petre www.eyecon.ro
+ *
+ * Dual licensed under the MIT and GPL licenses
+ *
+ */
+(function ($) {
+ var ColorPicker = function () {
+ var
+ ids = {},
+ inAction,
+ charMin = 65,
+ visible,
+ tpl = '',
+ defaults = {
+ eventName: 'click',
+ onShow: function () {},
+ onBeforeShow: function(){},
+ onHide: function () {},
+ onChange: function () {},
+ onSubmit: function () {},
+ color: 'ff0000',
+ livePreview: true,
+ flat: false
+ },
+ fillRGBFields = function (hsb, cal) {
+ var rgb = HSBToRGB(hsb);
+ $(cal).data('colorpicker').fields
+ .eq(1).val(rgb.r).end()
+ .eq(2).val(rgb.g).end()
+ .eq(3).val(rgb.b).end();
+ },
+ fillHSBFields = function (hsb, cal) {
+ $(cal).data('colorpicker').fields
+ .eq(4).val(hsb.h).end()
+ .eq(5).val(hsb.s).end()
+ .eq(6).val(hsb.b).end();
+ },
+ fillHexFields = function (hsb, cal) {
+ $(cal).data('colorpicker').fields
+ .eq(0).val(HSBToHex(hsb)).end();
+ },
+ setSelector = function (hsb, cal) {
+ $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
+ $(cal).data('colorpicker').selectorIndic.css({
+ left: parseInt(150 * hsb.s/100, 10),
+ top: parseInt(150 * (100-hsb.b)/100, 10)
+ });
+ },
+ setHue = function (hsb, cal) {
+ $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
+ },
+ setCurrentColor = function (hsb, cal) {
+ $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
+ },
+ setNewColor = function (hsb, cal) {
+ $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
+ },
+ keyDown = function (ev) {
+ var pressedKey = ev.charCode || ev.keyCode || -1;
+ if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
+ return false;
+ }
+ var cal = $(this).parent().parent();
+ if (cal.data('colorpicker').livePreview === true) {
+ change.apply(this);
+ }
+ },
+ change = function (ev) {
+ var cal = $(this).parent().parent(), col;
+ if (this.parentNode.className.indexOf('_hex') > 0) {
+ cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
+ } else if (this.parentNode.className.indexOf('_hsb') > 0) {
+ cal.data('colorpicker').color = col = fixHSB({
+ h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
+ s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
+ b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
+ });
+ } else {
+ cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
+ r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
+ g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
+ b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
+ }));
+ }
+ if (ev) {
+ fillRGBFields(col, cal.get(0));
+ fillHexFields(col, cal.get(0));
+ fillHSBFields(col, cal.get(0));
+ }
+ setSelector(col, cal.get(0));
+ setHue(col, cal.get(0));
+ setNewColor(col, cal.get(0));
+ cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
+ },
+ blur = function (ev) {
+ var cal = $(this).parent().parent();
+ cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
+ },
+ focus = function () {
+ charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
+ $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
+ $(this).parent().addClass('colorpicker_focus');
+ },
+ downIncrement = function (ev) {
+ var field = $(this).parent().find('input').focus();
+ var current = {
+ el: $(this).parent().addClass('colorpicker_slider'),
+ max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
+ y: ev.pageY,
+ field: field,
+ val: parseInt(field.val(), 10),
+ preview: $(this).parent().parent().data('colorpicker').livePreview
+ };
+ $(document).bind('mouseup', current, upIncrement);
+ $(document).bind('mousemove', current, moveIncrement);
+ },
+ moveIncrement = function (ev) {
+ ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
+ if (ev.data.preview) {
+ change.apply(ev.data.field.get(0), [true]);
+ }
+ return false;
+ },
+ upIncrement = function (ev) {
+ change.apply(ev.data.field.get(0), [true]);
+ ev.data.el.removeClass('colorpicker_slider').find('input').focus();
+ $(document).unbind('mouseup', upIncrement);
+ $(document).unbind('mousemove', moveIncrement);
+ return false;
+ },
+ downHue = function (ev) {
+ var current = {
+ cal: $(this).parent(),
+ y: $(this).offset().top
+ };
+ current.preview = current.cal.data('colorpicker').livePreview;
+ $(document).bind('mouseup', current, upHue);
+ $(document).bind('mousemove', current, moveHue);
+ },
+ moveHue = function (ev) {
+ change.apply(
+ ev.data.cal.data('colorpicker')
+ .fields
+ .eq(4)
+ .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
+ .get(0),
+ [ev.data.preview]
+ );
+ return false;
+ },
+ upHue = function (ev) {
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ $(document).unbind('mouseup', upHue);
+ $(document).unbind('mousemove', moveHue);
+ return false;
+ },
+ downSelector = function (ev) {
+ var current = {
+ cal: $(this).parent(),
+ pos: $(this).offset()
+ };
+ current.preview = current.cal.data('colorpicker').livePreview;
+ $(document).bind('mouseup', current, upSelector);
+ $(document).bind('mousemove', current, moveSelector);
+ },
+ moveSelector = function (ev) {
+ change.apply(
+ ev.data.cal.data('colorpicker')
+ .fields
+ .eq(6)
+ .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
+ .end()
+ .eq(5)
+ .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
+ .get(0),
+ [ev.data.preview]
+ );
+ return false;
+ },
+ upSelector = function (ev) {
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ $(document).unbind('mouseup', upSelector);
+ $(document).unbind('mousemove', moveSelector);
+ return false;
+ },
+ enterSubmit = function (ev) {
+ $(this).addClass('colorpicker_focus');
+ },
+ leaveSubmit = function (ev) {
+ $(this).removeClass('colorpicker_focus');
+ },
+ clickSubmit = function (ev) {
+ var cal = $(this).parent();
+ var col = cal.data('colorpicker').color;
+ cal.data('colorpicker').origColor = col;
+ setCurrentColor(col, cal.get(0));
+ cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
+ },
+ show = function (ev) {
+ var cal = $('#' + $(this).data('colorpickerId'));
+ cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
+ var pos = $(this).offset();
+ var viewPort = getViewport();
+ var top = pos.top + this.offsetHeight;
+ var left = pos.left;
+ if (top + 176 > viewPort.t + viewPort.h) {
+ top -= this.offsetHeight + 176;
+ }
+ if (left + 356 > viewPort.l + viewPort.w) {
+ left -= 356;
+ }
+ cal.css({left: left + 'px', top: top + 'px'});
+ if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
+ cal.show();
+ }
+ $(document).bind('mousedown', {cal: cal}, hide);
+ return false;
+ },
+ hide = function (ev) {
+ if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
+ if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
+ ev.data.cal.hide();
+ }
+ $(document).unbind('mousedown', hide);
+ }
+ },
+ isChildOf = function(parentEl, el, container) {
+ if (parentEl == el) {
+ return true;
+ }
+ if (parentEl.contains) {
+ return parentEl.contains(el);
+ }
+ if ( parentEl.compareDocumentPosition ) {
+ return !!(parentEl.compareDocumentPosition(el) & 16);
+ }
+ var prEl = el.parentNode;
+ while(prEl && prEl != container) {
+ if (prEl == parentEl)
+ return true;
+ prEl = prEl.parentNode;
+ }
+ return false;
+ },
+ getViewport = function () {
+ var m = document.compatMode == 'CSS1Compat';
+ return {
+ l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
+ t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
+ w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
+ h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
+ };
+ },
+ fixHSB = function (hsb) {
+ return {
+ h: Math.min(360, Math.max(0, hsb.h)),
+ s: Math.min(100, Math.max(0, hsb.s)),
+ b: Math.min(100, Math.max(0, hsb.b))
+ };
+ },
+ fixRGB = function (rgb) {
+ return {
+ r: Math.min(255, Math.max(0, rgb.r)),
+ g: Math.min(255, Math.max(0, rgb.g)),
+ b: Math.min(255, Math.max(0, rgb.b))
+ };
+ },
+ fixHex = function (hex) {
+ var len = 6 - hex.length;
+ if (len > 0) {
+ var o = [];
+ for (var i=0; i -1) ? hex.substring(1) : hex), 16);
+ return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
+ },
+ HexToHSB = function (hex) {
+ return RGBToHSB(HexToRGB(hex));
+ },
+ RGBToHSB = function (rgb) {
+ var hsb = {
+ h: 0,
+ s: 0,
+ b: 0
+ };
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
+ var delta = max - min;
+ hsb.b = max;
+ if (max != 0) {
+
+ }
+ hsb.s = max != 0 ? 255 * delta / max : 0;
+ if (hsb.s != 0) {
+ if (rgb.r == max) {
+ hsb.h = (rgb.g - rgb.b) / delta;
+ } else if (rgb.g == max) {
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
+ } else {
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
+ }
+ } else {
+ hsb.h = -1;
+ }
+ hsb.h *= 60;
+ if (hsb.h < 0) {
+ hsb.h += 360;
+ }
+ hsb.s *= 100/255;
+ hsb.b *= 100/255;
+ return hsb;
+ },
+ HSBToRGB = function (hsb) {
+ var rgb = {};
+ var h = Math.round(hsb.h);
+ var s = Math.round(hsb.s*255/100);
+ var v = Math.round(hsb.b*255/100);
+ if(s == 0) {
+ rgb.r = rgb.g = rgb.b = v;
+ } else {
+ var t1 = v;
+ var t2 = (255-s)*v/255;
+ var t3 = (t1-t2)*(h%60)/60;
+ if(h==360) h = 0;
+ if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
+ else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
+ else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
+ else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
+ else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
+ else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
+ else {rgb.r=0; rgb.g=0; rgb.b=0}
+ }
+ return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
+ },
+ RGBToHex = function (rgb) {
+ var hex = [
+ rgb.r.toString(16),
+ rgb.g.toString(16),
+ rgb.b.toString(16)
+ ];
+ $.each(hex, function (nr, val) {
+ if (val.length == 1) {
+ hex[nr] = '0' + val;
+ }
+ });
+ return hex.join('');
+ },
+ HSBToHex = function (hsb) {
+ return RGBToHex(HSBToRGB(hsb));
+ },
+ restoreOriginal = function () {
+ var cal = $(this).parent();
+ var col = cal.data('colorpicker').origColor;
+ cal.data('colorpicker').color = col;
+ fillRGBFields(col, cal.get(0));
+ fillHexFields(col, cal.get(0));
+ fillHSBFields(col, cal.get(0));
+ setSelector(col, cal.get(0));
+ setHue(col, cal.get(0));
+ setNewColor(col, cal.get(0));
+ };
+ return {
+ init: function (opt) {
+ opt = $.extend({}, defaults, opt||{});
+ if (typeof opt.color == 'string') {
+ opt.color = HexToHSB(opt.color);
+ } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
+ opt.color = RGBToHSB(opt.color);
+ } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
+ opt.color = fixHSB(opt.color);
+ } else {
+ return this;
+ }
+ return this.each(function () {
+ if (!$(this).data('colorpickerId')) {
+ var options = $.extend({}, opt);
+ options.origColor = opt.color;
+ var id = 'collorpicker_' + parseInt(Math.random() * 1000);
+ $(this).data('colorpickerId', id);
+ var cal = $(tpl).attr('id', id);
+ if (options.flat) {
+ cal.appendTo(this).show();
+ } else {
+ cal.appendTo(document.body);
+ }
+ options.fields = cal
+ .find('input')
+ .bind('keyup', keyDown)
+ .bind('change', change)
+ .bind('blur', blur)
+ .bind('focus', focus);
+ cal
+ .find('span').bind('mousedown', downIncrement).end()
+ .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
+ options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
+ options.selectorIndic = options.selector.find('div div');
+ options.el = this;
+ options.hue = cal.find('div.colorpicker_hue div');
+ cal.find('div.colorpicker_hue').bind('mousedown', downHue);
+ options.newColor = cal.find('div.colorpicker_new_color');
+ options.currentColor = cal.find('div.colorpicker_current_color');
+ cal.data('colorpicker', options);
+ cal.find('div.colorpicker_submit')
+ .bind('mouseenter', enterSubmit)
+ .bind('mouseleave', leaveSubmit)
+ .bind('click', clickSubmit);
+ fillRGBFields(options.color, cal.get(0));
+ fillHSBFields(options.color, cal.get(0));
+ fillHexFields(options.color, cal.get(0));
+ setHue(options.color, cal.get(0));
+ setSelector(options.color, cal.get(0));
+ setCurrentColor(options.color, cal.get(0));
+ setNewColor(options.color, cal.get(0));
+ if (options.flat) {
+ cal.css({
+ position: 'relative',
+ display: 'block'
+ });
+ } else {
+ $(this).bind(options.eventName, show);
+ }
+ }
+ });
+ },
+ showPicker: function() {
+ return this.each( function () {
+ if ($(this).data('colorpickerId')) {
+ show.apply(this);
+ }
+ });
+ },
+ hidePicker: function() {
+ return this.each( function () {
+ if ($(this).data('colorpickerId')) {
+ $('#' + $(this).data('colorpickerId')).hide();
+ }
+ });
+ },
+ setColor: function(col) {
+ if (typeof col == 'string') {
+ col = HexToHSB(col);
+ } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
+ col = RGBToHSB(col);
+ } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
+ col = fixHSB(col);
+ } else {
+ return this;
+ }
+ return this.each(function(){
+ if ($(this).data('colorpickerId')) {
+ var cal = $('#' + $(this).data('colorpickerId'));
+ cal.data('colorpicker').color = col;
+ cal.data('colorpicker').origColor = col;
+ fillRGBFields(col, cal.get(0));
+ fillHSBFields(col, cal.get(0));
+ fillHexFields(col, cal.get(0));
+ setHue(col, cal.get(0));
+ setSelector(col, cal.get(0));
+ setCurrentColor(col, cal.get(0));
+ setNewColor(col, cal.get(0));
+ }
+ });
+ }
+ };
+ }();
+ $.fn.extend({
+ ColorPicker: ColorPicker.init,
+ ColorPickerHide: ColorPicker.hidePicker,
+ ColorPickerShow: ColorPicker.showPicker,
+ ColorPickerSetColor: ColorPicker.setColor
+ });
+})(jQuery);
diff --git a/modules/photoannotation/js/jquery.colorpicker.min.js b/modules/photoannotation/js/jquery.colorpicker.min.js
new file mode 100644
index 00000000..36da9f98
--- /dev/null
+++ b/modules/photoannotation/js/jquery.colorpicker.min.js
@@ -0,0 +1 @@
+(function($){var ColorPicker=function(){var ids={},inAction,charMin=65,visible,tpl='',defaults={eventName:'click',onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},color:'ff0000',livePreview:true,flat:false},fillRGBFields=function(hsb,cal){var rgb=HSBToRGB(hsb);$(cal).data('colorpicker').fields.eq(1).val(rgb.r).end().eq(2).val(rgb.g).end().eq(3).val(rgb.b).end()},fillHSBFields=function(hsb,cal){$(cal).data('colorpicker').fields.eq(4).val(hsb.h).end().eq(5).val(hsb.s).end().eq(6).val(hsb.b).end()},fillHexFields=function(hsb,cal){$(cal).data('colorpicker').fields.eq(0).val(HSBToHex(hsb)).end()},setSelector=function(hsb,cal){$(cal).data('colorpicker').selector.css('backgroundColor','#'+HSBToHex({h:hsb.h,s:100,b:100}));$(cal).data('colorpicker').selectorIndic.css({left:parseInt(150*hsb.s/100,10),top:parseInt(150*(100-hsb.b)/100,10)})},setHue=function(hsb,cal){$(cal).data('colorpicker').hue.css('top',parseInt(150-150*hsb.h/360,10))},setCurrentColor=function(hsb,cal){$(cal).data('colorpicker').currentColor.css('backgroundColor','#'+HSBToHex(hsb))},setNewColor=function(hsb,cal){$(cal).data('colorpicker').newColor.css('backgroundColor','#'+HSBToHex(hsb))},keyDown=function(ev){var pressedKey=ev.charCode||ev.keyCode||-1;if((pressedKey>charMin&&pressedKey<=90)||pressedKey==32){return false}var cal=$(this).parent().parent();if(cal.data('colorpicker').livePreview===true){change.apply(this)}},change=function(ev){var cal=$(this).parent().parent(),col;if(this.parentNode.className.indexOf('_hex')>0){cal.data('colorpicker').color=col=HexToHSB(fixHex(this.value))}else if(this.parentNode.className.indexOf('_hsb')>0){cal.data('colorpicker').color=col=fixHSB({h:parseInt(cal.data('colorpicker').fields.eq(4).val(),10),s:parseInt(cal.data('colorpicker').fields.eq(5).val(),10),b:parseInt(cal.data('colorpicker').fields.eq(6).val(),10)})}else{cal.data('colorpicker').color=col=RGBToHSB(fixRGB({r:parseInt(cal.data('colorpicker').fields.eq(1).val(),10),g:parseInt(cal.data('colorpicker').fields.eq(2).val(),10),b:parseInt(cal.data('colorpicker').fields.eq(3).val(),10)}))}if(ev){fillRGBFields(col,cal.get(0));fillHexFields(col,cal.get(0));fillHSBFields(col,cal.get(0))}setSelector(col,cal.get(0));setHue(col,cal.get(0));setNewColor(col,cal.get(0));cal.data('colorpicker').onChange.apply(cal,[col,HSBToHex(col),HSBToRGB(col)])},blur=function(ev){var cal=$(this).parent().parent();cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus')},focus=function(){charMin=this.parentNode.className.indexOf('_hex')>0?70:65;$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');$(this).parent().addClass('colorpicker_focus')},downIncrement=function(ev){var field=$(this).parent().find('input').focus();var current={el:$(this).parent().addClass('colorpicker_slider'),max:this.parentNode.className.indexOf('_hsb_h')>0?360:(this.parentNode.className.indexOf('_hsb')>0?100:255),y:ev.pageY,field:field,val:parseInt(field.val(),10),preview:$(this).parent().parent().data('colorpicker').livePreview};$(document).bind('mouseup',current,upIncrement);$(document).bind('mousemove',current,moveIncrement)},moveIncrement=function(ev){ev.data.field.val(Math.max(0,Math.min(ev.data.max,parseInt(ev.data.val+ev.pageY-ev.data.y,10))));if(ev.data.preview){change.apply(ev.data.field.get(0),[true])}return false},upIncrement=function(ev){change.apply(ev.data.field.get(0),[true]);ev.data.el.removeClass('colorpicker_slider').find('input').focus();$(document).unbind('mouseup',upIncrement);$(document).unbind('mousemove',moveIncrement);return false},downHue=function(ev){var current={cal:$(this).parent(),y:$(this).offset().top};current.preview=current.cal.data('colorpicker').livePreview;$(document).bind('mouseup',current,upHue);$(document).bind('mousemove',current,moveHue)},moveHue=function(ev){change.apply(ev.data.cal.data('colorpicker').fields.eq(4).val(parseInt(360*(150-Math.max(0,Math.min(150,(ev.pageY-ev.data.y))))/150,10)).get(0),[ev.data.preview]);return false},upHue=function(ev){fillRGBFields(ev.data.cal.data('colorpicker').color,ev.data.cal.get(0));fillHexFields(ev.data.cal.data('colorpicker').color,ev.data.cal.get(0));$(document).unbind('mouseup',upHue);$(document).unbind('mousemove',moveHue);return false},downSelector=function(ev){var current={cal:$(this).parent(),pos:$(this).offset()};current.preview=current.cal.data('colorpicker').livePreview;$(document).bind('mouseup',current,upSelector);$(document).bind('mousemove',current,moveSelector)},moveSelector=function(ev){change.apply(ev.data.cal.data('colorpicker').fields.eq(6).val(parseInt(100*(150-Math.max(0,Math.min(150,(ev.pageY-ev.data.pos.top))))/150,10)).end().eq(5).val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX-ev.data.pos.left))))/150,10)).get(0),[ev.data.preview]);return false},upSelector=function(ev){fillRGBFields(ev.data.cal.data('colorpicker').color,ev.data.cal.get(0));fillHexFields(ev.data.cal.data('colorpicker').color,ev.data.cal.get(0));$(document).unbind('mouseup',upSelector);$(document).unbind('mousemove',moveSelector);return false},enterSubmit=function(ev){$(this).addClass('colorpicker_focus')},leaveSubmit=function(ev){$(this).removeClass('colorpicker_focus')},clickSubmit=function(ev){var cal=$(this).parent();var col=cal.data('colorpicker').color;cal.data('colorpicker').origColor=col;setCurrentColor(col,cal.get(0));cal.data('colorpicker').onSubmit(col,HSBToHex(col),HSBToRGB(col),cal.data('colorpicker').el)},show=function(ev){var cal=$('#'+$(this).data('colorpickerId'));cal.data('colorpicker').onBeforeShow.apply(this,[cal.get(0)]);var pos=$(this).offset();var viewPort=getViewport();var top=pos.top+this.offsetHeight;var left=pos.left;if(top+176>viewPort.t+viewPort.h){top-=this.offsetHeight+176}if(left+356>viewPort.l+viewPort.w){left-=356}cal.css({left:left+'px',top:top+'px'});if(cal.data('colorpicker').onShow.apply(this,[cal.get(0)])!=false){cal.show()}$(document).bind('mousedown',{cal:cal},hide);return false},hide=function(ev){if(!isChildOf(ev.data.cal.get(0),ev.target,ev.data.cal.get(0))){if(ev.data.cal.data('colorpicker').onHide.apply(this,[ev.data.cal.get(0)])!=false){ev.data.cal.hide()}$(document).unbind('mousedown',hide)}},isChildOf=function(parentEl,el,container){if(parentEl==el){return true}if(parentEl.contains){return parentEl.contains(el)}if(parentEl.compareDocumentPosition){return!!(parentEl.compareDocumentPosition(el)&16)}var prEl=el.parentNode;while(prEl&&prEl!=container){if(prEl==parentEl)return true;prEl=prEl.parentNode}return false},getViewport=function(){var m=document.compatMode=='CSS1Compat';return{l:window.pageXOffset||(m?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(m?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(m?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(m?document.documentElement.clientHeight:document.body.clientHeight)}},fixHSB=function(hsb){return{h:Math.min(360,Math.max(0,hsb.h)),s:Math.min(100,Math.max(0,hsb.s)),b:Math.min(100,Math.max(0,hsb.b))}},fixRGB=function(rgb){return{r:Math.min(255,Math.max(0,rgb.r)),g:Math.min(255,Math.max(0,rgb.g)),b:Math.min(255,Math.max(0,rgb.b))}},fixHex=function(hex){var len=6-hex.length;if(len>0){var o=[];for(var i=0;i-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}},HexToHSB=function(hex){return RGBToHSB(HexToRGB(hex))},RGBToHSB=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;if(max!=0){}hsb.s=max!=0?255*delta/max:0;if(hsb.s!=0){if(rgb.r==max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g==max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb},HSBToRGB=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s==0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h==360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}},RGBToHex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length==1){hex[nr]='0'+val}});return hex.join('')},HSBToHex=function(hsb){return RGBToHex(HSBToRGB(hsb))},restoreOriginal=function(){var cal=$(this).parent();var col=cal.data('colorpicker').origColor;cal.data('colorpicker').color=col;fillRGBFields(col,cal.get(0));fillHexFields(col,cal.get(0));fillHSBFields(col,cal.get(0));setSelector(col,cal.get(0));setHue(col,cal.get(0));setNewColor(col,cal.get(0))};return{init:function(opt){opt=$.extend({},defaults,opt||{});if(typeof opt.color=='string'){opt.color=HexToHSB(opt.color)}else if(opt.color.r!=undefined&&opt.color.g!=undefined&&opt.color.b!=undefined){opt.color=RGBToHSB(opt.color)}else if(opt.color.h!=undefined&&opt.color.s!=undefined&&opt.color.b!=undefined){opt.color=fixHSB(opt.color)}else{return this}return this.each(function(){if(!$(this).data('colorpickerId')){var options=$.extend({},opt);options.origColor=opt.color;var id='collorpicker_'+parseInt(Math.random()*1000);$(this).data('colorpickerId',id);var cal=$(tpl).attr('id',id);if(options.flat){cal.appendTo(this).show()}else{cal.appendTo(document.body)}options.fields=cal.find('input').bind('keyup',keyDown).bind('change',change).bind('blur',blur).bind('focus',focus);cal.find('span').bind('mousedown',downIncrement).end().find('>div.colorpicker_current_color').bind('click',restoreOriginal);options.selector=cal.find('div.colorpicker_color').bind('mousedown',downSelector);options.selectorIndic=options.selector.find('div div');options.el=this;options.hue=cal.find('div.colorpicker_hue div');cal.find('div.colorpicker_hue').bind('mousedown',downHue);options.newColor=cal.find('div.colorpicker_new_color');options.currentColor=cal.find('div.colorpicker_current_color');cal.data('colorpicker',options);cal.find('div.colorpicker_submit').bind('mouseenter',enterSubmit).bind('mouseleave',leaveSubmit).bind('click',clickSubmit);fillRGBFields(options.color,cal.get(0));fillHSBFields(options.color,cal.get(0));fillHexFields(options.color,cal.get(0));setHue(options.color,cal.get(0));setSelector(options.color,cal.get(0));setCurrentColor(options.color,cal.get(0));setNewColor(options.color,cal.get(0));if(options.flat){cal.css({position:'relative',display:'block'})}else{$(this).bind(options.eventName,show)}}})},showPicker:function(){return this.each(function(){if($(this).data('colorpickerId')){show.apply(this)}})},hidePicker:function(){return this.each(function(){if($(this).data('colorpickerId')){$('#'+$(this).data('colorpickerId')).hide()}})},setColor:function(col){if(typeof col=='string'){col=HexToHSB(col)}else if(col.r!=undefined&&col.g!=undefined&&col.b!=undefined){col=RGBToHSB(col)}else if(col.h!=undefined&&col.s!=undefined&&col.b!=undefined){col=fixHSB(col)}else{return this}return this.each(function(){if($(this).data('colorpickerId')){var cal=$('#'+$(this).data('colorpickerId'));cal.data('colorpicker').color=col;cal.data('colorpicker').origColor=col;fillRGBFields(col,cal.get(0));fillHSBFields(col,cal.get(0));fillHexFields(col,cal.get(0));setHue(col,cal.get(0));setSelector(col,cal.get(0));setCurrentColor(col,cal.get(0));setNewColor(col,cal.get(0))}})}}}();$.fn.extend({ColorPicker:ColorPicker.init,ColorPickerHide:ColorPicker.hidePicker,ColorPickerShow:ColorPicker.showPicker,ColorPickerSetColor:ColorPicker.setColor})})(jQuery);
diff --git a/modules/photoannotation/views/photoannotation_block.html.php b/modules/photoannotation/views/photoannotation_block.html.php
new file mode 100644
index 00000000..8861699a
--- /dev/null
+++ b/modules/photoannotation/views/photoannotation_block.html.php
@@ -0,0 +1,17 @@
+
+
+">
+ = $cloud ?>
+
+= $form ?>
\ No newline at end of file
diff --git a/modules/photoannotation/views/photoannotation_cloud.html.php b/modules/photoannotation/views/photoannotation_cloud.html.php
new file mode 100644
index 00000000..6f47b272
--- /dev/null
+++ b/modules/photoannotation/views/photoannotation_cloud.html.php
@@ -0,0 +1,9 @@
+
+
diff --git a/modules/photoannotation/views/photoannotation_highlight_block.html.php b/modules/photoannotation/views/photoannotation_highlight_block.html.php
index 1e61bda6..6e7b48e9 100644
--- a/modules/photoannotation/views/photoannotation_highlight_block.html.php
+++ b/modules/photoannotation/views/photoannotation_highlight_block.html.php
@@ -9,7 +9,6 @@
$existingNotes = ORM::factory("items_note")
->where("item_id", "=", $item->id)
->find_all();
- $users = ORM::factory("user")->order_by("name", "ASC")->find_all();
$fullname = module::get_var("photoannotation", "fullname", false);
$showusers = module::get_var("photoannotation", "showusers", false);
$showfaces = module::get_var("photoannotation", "showfaces", false);
@@ -37,8 +36,8 @@
foreach ($existingUsers as $oneUser) {
$oneTag = ORM::factory("user", $oneUser->user_id);
if ($oneTag->loaded()) {
- if ($fullname && ($oneTag->full_name != "")) {
- $user_text = $oneTag->full_name;
+ if ($fullname) {
+ $user_text = $oneTag->display_name();
} else {
$user_text = $oneTag->name;
}
@@ -50,6 +49,7 @@
$jscode .= "\"width\": ". ($oneUser->x2 - $oneUser->x1) .",\n";
$jscode .= "\"height\": ". ($oneUser->y2 - $oneUser->y1) .",\n";
$jscode .= "\"text\": \"". html::clean($user_text) ."\",\n";
+ $jscode .= "\"internaltext\": \"". $oneTag->display_name() ." (". $oneTag->name .")\",\n";
$jscode .= "\"description\": \"". html::clean($oneUser->description) ."\",\n";
$jscode .= "\"noteid\": ". $oneUser->id .",\n";
$jscode .= "\"notetype\": \"user\",\n";
@@ -110,19 +110,6 @@
$legend_display = $legend_users . " " . $legend_faces . " " . $legend_notes;
$legend_display = str_replace(" ", " ", $legend_display);
}
- $users_arraystring = "users: [ ";
- foreach ($users as $user) {
- if ($fullname && ($user->full_name != "")) {
- $user_text = $user->full_name;
- } else {
- $user_text = $user->name;
- }
- if ($user->name != "guest") {
- $users_arraystring .= "{'name':'". html::clean($user_text) ."','id':'". $user->id ."'},";
- }
- }
- $users_arraystring = trim($users_arraystring, ",");
- $users_arraystring .= " ],";
$labels_arraystring = "labels: [ '". t("Tag:") ."','". t("Note Title:") ."','". t("Description (optional)") ."','". t("Are you sure you want to delete this annotation?") ."','". t("or") ."','". t("Yes") ."','". t("No") ."','". t("Confirm deletion") ."','". t("Save") ."','". t("Cancel") ."','". t("User:") ."','". t("No user selected") ."','". t("Select one of the following") ."' ],";
?>
+
\ No newline at end of file