diff --git a/modules/photoannotation/controllers/photoannotation.php b/modules/photoannotation/controllers/photoannotation.php
index 79f4c1bd..bc41ba15 100644
--- a/modules/photoannotation/controllers/photoannotation.php
+++ b/modules/photoannotation/controllers/photoannotation.php
@@ -115,12 +115,16 @@ class photoannotation_Controller extends Controller {
}
//Save annotation
if ($annotate_id == "new") { //This is a new annotation
+ $annotate_id = -1;
if ($user_id != "") { //Save user
- photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "user";
} elseif ($tag_data != "") { //Save face
- photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "face";
} elseif ($item_title != "") { //Save note
- photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "note";
} else { //Something's wrong
json::reply(array("result" => "error", "message" => (string)$error_noselection));
return;
@@ -132,12 +136,15 @@ class photoannotation_Controller extends Controller {
->where("id", "=", $annotate_id)
->find();
if ($user_id != "") { //Conversion user -> user
- photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "user";
} elseif ($tag_data != "") { //Conversion user -> face
- photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "face";
$updateduser->delete(); //delete old user
} elseif ($item_title != "") { //Conversion user -> note
- photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "note";
$updateduser->delete(); //delete old user
} else { //Somethings wrong
json::reply(array("result" => "error", "message" => (string)$error_noselection));
@@ -149,12 +156,15 @@ class photoannotation_Controller extends Controller {
->where("id", "=", $annotate_id)
->find();
if ($user_id != "") { //Conversion face -> user
- photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "user";
$updatedface->delete(); //delete old face
} elseif ($tag_data != "") { //Conversion face -> face
- photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
+ $new_id = photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
+ $dest_type = "face";
} elseif ($item_title != "") { //Conversion face -> note
- photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "note";
$updatedface->delete(); //delete old face
} else { //Somethings wrong
json::reply(array("result" => "error", "message" => (string)$error_noselection));
@@ -166,13 +176,16 @@ class photoannotation_Controller extends Controller {
->where("id", "=", $annotate_id)
->find();
if ($user_id != "") { //Conversion note -> user
- photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "user";
$updatednote->delete(); //delete old note
} elseif ($tag_data != "") { //Conversion note -> face
- photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $new_id = photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
+ $dest_type = "face";
$updatednote->delete(); //delete old note
} elseif ($item_title != "") { //Conversion note -> note
- photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
+ $new_id = photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
+ $dest_type = "note";
} else { //Somethings wrong
json::reply(array("result" => "error", "message" => (string)$error_noselection));
return;
@@ -184,8 +197,47 @@ class photoannotation_Controller extends Controller {
}
}
//@todo: add needed data to the json reply
- json::reply(array("result" => "success"));
- return;
+ $int_text = "";
+ $editable = true;
+ switch ($dest_type) {
+ case "user":
+ $fullname = module::get_var("photoannotation", "fullname", false);
+ $int_text = $getuser->user->display_name() ." (". $getuser->user->name .")";
+ if ($fullname) {
+ $note_text = $getuser->user->display_name();
+ } else {
+ $note_text = $getuser->user->name;
+ }
+ $note_url = user_profile::url($getuser->user->id);
+ break;
+ case "face":
+ $note_text = $tag->name;
+ $note_url = $tag->url();
+ break;
+ case "note":
+ $note_text = $item_title;
+ $note_url = "";
+ $editable = false;
+ }
+ if ($annotate_id == -1) {
+ $annotation_id = "";
+ } else {
+ $annotation_id = "photoannotation-area-". $notetype ."-". $annotate_id;
+ }
+ $reply = array("result" => "success",
+ "notetype" => (string)$dest_type,
+ "description" => (string)$description,
+ "height" => (integer)$_POST["height"],
+ "internaltext" => (string)$int_text,
+ "left" => (integer)$str_x1,
+ "noteid" => (integer)$new_id,
+ "text" => (string)$note_text,
+ "top" => (integer)$str_y1,
+ "url" => (string)$note_url,
+ "width" => (integer)$_POST["width"],
+ "editable" => (boolean)$editable,
+ "annotationid" => (string)$annotation_id);
+ json::reply($reply);
}
public function delete($item_data) {
diff --git a/modules/photoannotation/css/photoannotation.css b/modules/photoannotation/css/photoannotation.css
index a2443d74..696ae734 100644
--- a/modules/photoannotation/css/photoannotation.css
+++ b/modules/photoannotation/css/photoannotation.css
@@ -69,7 +69,6 @@
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 749f7778..696056e5 100644
--- a/modules/photoannotation/helpers/photoannotation.php
+++ b/modules/photoannotation/helpers/photoannotation.php
@@ -99,6 +99,7 @@ class photoannotation_Core {
$item_user->y2 = $str_y2;
$item_user->description = $description;
$item_user->save();
+ return $item_user->id;
}
public static function saveface($tag_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id = "") {
@@ -117,6 +118,7 @@ class photoannotation_Core {
$item_face->y2 = $str_y2;
$item_face->description = $description;
$item_face->save();
+ return $item_face->id;
}
public static function savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id = "") {
@@ -135,6 +137,7 @@ class photoannotation_Core {
$item_note->title = $item_title;
$item_note->description = $description;
$item_note->save();
+ return $item_note->id;
}
public static function send_notifications($recipient_id, $item_id, $mailtype) {
diff --git a/modules/photoannotation/helpers/photoannotation_theme.php b/modules/photoannotation/helpers/photoannotation_theme.php
index df4b4099..15f584f8 100644
--- a/modules/photoannotation/helpers/photoannotation_theme.php
+++ b/modules/photoannotation/helpers/photoannotation_theme.php
@@ -21,7 +21,7 @@ class photoannotation_theme_Core {
static function head($theme) {
$theme->css("photoannotation.css");
if ($theme->page_subtype == "photo") {
- //$theme->script("jquery.annotate.min.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);
@@ -60,7 +60,7 @@ class photoannotation_theme_Core {
}\n";
}
}
- $v .= "\n";
+ $v .= "\n";
return $v;
}
}
diff --git a/modules/photoannotation/js/jquery.annotate.js b/modules/photoannotation/js/jquery.annotate.js
index 4058b3c6..56c78b39 100644
--- a/modules/photoannotation/js/jquery.annotate.js
+++ b/modules/photoannotation/js/jquery.annotate.js
@@ -26,13 +26,13 @@
this.cssaclass = opts.cssaclass;
this.rtlsupport = opts.rtlsupport;
this.users = opts.users;
+ anchor = $('.g-fullsize-link');
// Add the canvas
- this.canvas = $('
');
+ this.canvas = $('');
this.canvas.children('.image-annotate-edit').hide();
this.canvas.children('.image-annotate-view').hide();
$('#g-photo').after(this.canvas);
- //this.image.after(this.canvas);
// Give the canvas and the container their size and background
this.canvas.height(this.height());
@@ -45,10 +45,12 @@
this.canvas.hover(function() {
if ($(this).children('.image-annotate-edit').css('display') == 'none') {
$(this).children('.image-annotate-view').show();
+ $("#photoannotation-fullsize").show();
}
}, function() {
$(this).children('.image-annotate-view').hide();
$(this).children('.image-annotate-note').hide();
+ $("#photoannotation-fullsize").hide();
});
this.canvas.children('.image-annotate-view').hover(function() {
@@ -76,7 +78,11 @@
// Hide the original
this.hide();
-
+ $('#g-photo').hide();
+ $('.image-annotate-canvas').show();
+ $(".g-resize").remove();
+ $("#photoannotation-fullsize").append($('.g-fullsize-link:first'));
+ $('.g-fullsize-link').append($('.g-fullsize-link:first').attr('title'));
return this;
};
@@ -156,7 +162,7 @@
ok.click(function() {
var form = $('#image-annotate-edit-form form');
- $.fn.annotateImage.appendPosition(form, editable)
+ $.fn.annotateImage.appendPosition(form, editable);
$.ajax({
url: saveUrl,
type: 'POST',
@@ -206,20 +212,25 @@
buttons: btns
});
} else {
- var test = saveUrl;
- var newnote = new array();
- newnote.description = data.description;
- newnote.editable = true;
- newnote.height = data.height;
- newnote.internaltext = data.internaltext;
- newnote.left = data.left;
- newnote.noteid = data.noteid;
- newnote.notetype = data.notetype;
- newnote.text = data.text;
- newnote.top = data.top;
- newnote.url = data.url;
- newnote.width = data.width;
- $.fn.annotateView(!image, newnote, !image.tags, !image.labels, !image.editable, !image.csrf, !image.deleteUrl, !image.saveUrl, !image.cssaclass, !image.rtlsupport, !image.users);
+ if (data.annotationid != "") {
+ $("#" + data.annotationid).remove();
+ $("#" + data.annotationid + "-edit").remove();
+ $("#" + data.annotationid + "-delete").remove();
+ $("#" + data.annotationid + "-note").remove();
+ }
+ editable.description = data.description;
+ editable.editable = data.editable;
+ editable.height = data.height;
+ editable.internaltext = data.internaltext;
+ editable.left = data.left;
+ editable.noteid = data.noteid;
+ editable.notetype = data.notetype;
+ editable.text = data.text;
+ editable.top = data.top;
+ editable.url = data.url;
+ editable.width = data.width;
+ note = new $.fn.annotateView(image, editable, image.tags, image.labels, image.editable, image.csrf, image.deleteUrl, image.saveUrl, image.cssaclass, image.rtlsupport, image.users);
+
//@todo: save new annotation / update existing annotation
//success
}
@@ -421,8 +432,8 @@
image.canvas.children('.image-annotate-view').prepend(this.area);
if (editable) {
- this.delarea = $('');
- this.editarea = $('');
+ 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 () {
@@ -465,6 +476,9 @@
success: function(data) {
if (data.result == "success") {
$("#" + data.annotationid).remove();
+ $("#" + data.annotationid + "-edit").remove();
+ $("#" + data.annotationid + "-delete").remove();
+ $("#" + data.annotationid + "-note").remove();
}
},
dataType: "json"
@@ -494,7 +508,7 @@
if (note.description != "") {
notedescription = "
" + note.description;
}
- this.form = $('' + note.text + notedescription + '
');
+ this.form = $('' + note.text + notedescription + '
');
this.form.hide();
image.canvas.children('.image-annotate-view').append(this.form);
this.form.children('span.actions').hide();
@@ -573,6 +587,7 @@
this.delarea.css('top', (this.note.top) + 'px');
this.editarea.children('div').height('14px');
this.editarea.children('div').width('14px');
+ this.editarea.css('top', (this.note.top + 16) + 'px');
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');
@@ -580,7 +595,6 @@
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');
}
};
@@ -663,6 +677,6 @@
'' +
'');
form.append(areaFields);
- }
+ };
})(jQuery);
diff --git a/modules/photoannotation/js/jquery.annotate.min.js b/modules/photoannotation/js/jquery.annotate.min.js
index 97746cf4..d05f8a25 100644
--- a/modules/photoannotation/js/jquery.annotate.min.js
+++ b/modules/photoannotation/js/jquery.annotate.min.js
@@ -1 +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=60;newNote.height=60;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);
+(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;anchor=$('.g-fullsize-link');this.canvas=$('
');this.canvas.children('.image-annotate-edit').hide();this.canvas.children('.image-annotate-view').hide();$('#g-photo').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();$("#photoannotation-fullsize").show()}},function(){$(this).children('.image-annotate-view').hide();$(this).children('.image-annotate-note').hide();$("#photoannotation-fullsize").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();$('#g-photo').hide();$('.image-annotate-canvas').show();$(".g-resize").remove();$("#photoannotation-fullsize").append($('.g-fullsize-link:first'));$('.g-fullsize-link').append($('.g-fullsize-link:first').attr('title'));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');$.fn.annotateImage.appendPosition(form,editable);$.ajax({url:saveUrl,type:'POST',data:form.serialize(),error:function(e){var errordialog=''+labels[13]+'
';$('body').append(errordialog);var btns={};if(rtlsupport==""){diagclass="inmage-annotate-dialog"}else{diagclass="inmage-annotate-dialog-rtl"}btns[labels[14]]=function(){$('#image-annotate-error-dialog').remove()};$('#image-annotate-error-dialog').dialog({modal:true,resizable:false,dialogClass:diagclass,title:labels[13],close:function(event,ui){$('#image-annotate-error-dialog').remove()},width:450,buttons:btns})},success:function(data){if(data.result=="error"){var errordialog='
'+data.message+'
';$('body').append(errordialog);var btns={};if(rtlsupport==""){diagclass="inmage-annotate-dialog"}else{diagclass="inmage-annotate-dialog-rtl"}btns[labels[14]]=function(){$('#image-annotate-error-dialog').remove()};$('#image-annotate-error-dialog').dialog({modal:true,resizable:false,dialogClass:diagclass,title:labels[13],close:function(event,ui){$('#image-annotate-error-dialog').remove()},width:450,buttons:btns})}else{if(data.annotationid!=""){$("#"+data.annotationid).remove();$("#"+data.annotationid+"-edit").remove();$("#"+data.annotationid+"-delete").remove();$("#"+data.annotationid+"-note").remove()}editable.description=data.description;editable.editable=data.editable;editable.height=data.height;editable.internaltext=data.internaltext;editable.left=data.left;editable.noteid=data.noteid;editable.notetype=data.notetype;editable.text=data.text;editable.top=data.top;editable.url=data.url;editable.width=data.width;note=new $.fn.annotateView(image,editable,image.tags,image.labels,image.editable,image.csrf,image.deleteUrl,image.saveUrl,image.cssaclass,image.rtlsupport,image.users)}},dataType:"json"});image.mode='view';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'});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=60;newNote.height=60;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 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")+"-del-form");$.ajax({url:deleteUrl,type:'POST',data:delform.serialize(),error:function(e){var errordialog='
'+labels[15]+'
';$('body').append(errordialog);var btns={};if(rtlsupport==""){diagclass="inmage-annotate-dialog"}else{diagclass="inmage-annotate-dialog-rtl"}btns[labels[14]]=function(){$('#image-annotate-error-dialog').remove()};$('#image-annotate-error-dialog').dialog({modal:true,resizable:false,dialogClass:diagclass,title:labels[13],close:function(event,ui){$('#image-annotate-error-dialog').remove()},width:450,buttons:btns})},success:function(data){if(data.result=="success"){$("#"+data.annotationid).remove();$("#"+data.annotationid+"-edit").remove();$("#"+data.annotationid+"-delete").remove();$("#"+data.annotationid+"-note").remove()}},dataType:"json"});$('#image-annotate-conf-dialog').remove()};btns[labels[6]]=function(){$('#image-annotate-conf-dialog').remove()};$('#image-annotate-conf-dialog').dialog({modal:true,resizable:false,dialogClass:diagclass,title:labels[7],close:function(event,ui){$('#image-annotate-conf-dialog').remove()},buttons:btns})});var form=this;this.editarea.bind('click',function(){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(){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');this.editarea.css('top',(this.note.top+16)+'px');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')}}};$.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,saveUrl);$.fn.annotateImage.createCancelButton(editable,this.image,rtlsupport,labels)}};$.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};$.fn.annotateImage.appendPosition=function(form,editable){var areaFields=$('
'+'
'+'
'+'
'+'
');form.append(areaFields)}})(jQuery);
\ No newline at end of file
diff --git a/modules/photoannotation/views/photoannotation_highlight_block.html.php b/modules/photoannotation/views/photoannotation_highlight_block.html.php
index aafe8e12..9b200d95 100644
--- a/modules/photoannotation/views/photoannotation_highlight_block.html.php
+++ b/modules/photoannotation/views/photoannotation_highlight_block.html.php
@@ -107,7 +107,7 @@
}
}
$legend_display = $legend_users . $legend_faces . $legend_notes;
- $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("Person:") ."','". t("No user selected") ."','". t("Select one of the following") ."','". t("An error ocurred while saving annotation") ."','". t("OK") ."','". t("An error ocurred while deleting annotation") ."' ],";
+ $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("Person:") ."','". t("No user selected") ."','". t("Select one of the following") ."','". t("An error ocurred while saving annotation") ."','". t("OK") ."','". t("An error ocurred while deleting annotation") ."','". t("View fullsize") ."' ],";
?>