Version 4:
- Bugfix: Tag annotation weren't saved - admin option: disable user search for guest user - Removed the term "user" from frontend - Autocomplete now works for username and user's full name - Increased initial size of annotation
This commit is contained in:
parent
295dae2176
commit
4b13015a76
@ -43,7 +43,7 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
|
|||||||
//Load the target user
|
//Load the target user
|
||||||
$targetuser = ORM::factory("user", $form->targetuser->value);
|
$targetuser = ORM::factory("user", $form->targetuser->value);
|
||||||
if (!$targetuser->loaded()) {
|
if (!$targetuser->loaded()) {
|
||||||
message::error(t("The specified user could not be found"));
|
message::error(t("The specified person could not be found"));
|
||||||
url::redirect("admin/photoannotation/converter");
|
url::redirect("admin/photoannotation/converter");
|
||||||
}
|
}
|
||||||
//Load all existing tag annotations
|
//Load all existing tag annotations
|
||||||
@ -280,12 +280,12 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
|
|||||||
->checked(module::get_var("photoannotation", "shownotes", false));
|
->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)."))
|
$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));
|
->checked(module::get_var("photoannotation", "fullname", false));
|
||||||
$group = $form->group("notifications")->label(t("Notification and user cloud settings"));
|
$group = $form->group("notifications")->label(t("Notification and people cloud settings"));
|
||||||
$group->checkbox("nonotifications")->label(t("Disable user notifications."))
|
$group->checkbox("nonotifications")->label(t("Disable user notifications."))
|
||||||
->checked(module::get_var("photoannotation", "nonotifications", false));
|
->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)."))
|
$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));
|
->checked(module::get_var("photoannotation", "notificationoptout", false));
|
||||||
$group->checkbox("allowguestsearch")->label(t("Show user cloud and allow user search for guests."))
|
$group->checkbox("allowguestsearch")->label(t("Show people cloud and allow people search for guests."))
|
||||||
->checked(module::get_var("photoannotation", "allowguestsearch", false));
|
->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 = $form->group("newtagmail")->label(t("Customize the mail sent to users when a user annotation is created"));
|
||||||
$group->input("newtagsubject")->label(t("Subject"))
|
$group->input("newtagsubject")->label(t("Subject"))
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
class photoannotation_Controller extends Controller {
|
class photoannotation_Controller extends Controller {
|
||||||
public function showuser() {
|
public function showuser() {
|
||||||
if (identity::active_user()->guest && !module::get_var("photoannotation", "allowguestsearch", false)) {
|
if (identity::active_user()->guest && !module::get_var("photoannotation", "allowguestsearch", false)) {
|
||||||
message::error(t("You have to log in to perform a user search."));
|
message::error(t("You have to log in to perform a people search."));
|
||||||
url::redirect(url::site());
|
url::redirect(url::site());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ class photoannotation_Controller extends Controller {
|
|||||||
if ($user_id != "") {
|
if ($user_id != "") {
|
||||||
$getuser = photoannotation::getuser($user_id);
|
$getuser = photoannotation::getuser($user_id);
|
||||||
if (!$getuser->found) {
|
if (!$getuser->found) {
|
||||||
message::error(t("Could not find user %user.", array("user" => $user_id)));
|
message::error(t("Could not find anyone with the name %user.", array("user" => $user_id)));
|
||||||
url::redirect($redir_uri);
|
url::redirect($redir_uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -112,18 +112,18 @@ class photoannotation_Controller extends Controller {
|
|||||||
$tag->save();
|
$tag->save();
|
||||||
$tag_data = $tag->id;
|
$tag_data = $tag->id;
|
||||||
} else {
|
} else {
|
||||||
$tag_data = -1;
|
$tag_data = "";
|
||||||
}
|
}
|
||||||
//Save annotation
|
//Save annotation
|
||||||
if ($annotate_id == "new") { //This is a new annotation
|
if ($annotate_id == "new") { //This is a new annotation
|
||||||
if ($user_id > -1) { //Save user
|
if ($user_id != "") { //Save user
|
||||||
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
} elseif ($tag_data > -1) { //Conversion user -> face
|
} elseif ($tag_data != "") { //Save face
|
||||||
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
} elseif ($item_title != "") { //Conversion user -> note
|
} elseif ($item_title != "") { //Save note
|
||||||
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
} else { //Somethings wrong
|
} else { //Something's wrong
|
||||||
message::error(t("Please select a User or Tag or specify a Title."));
|
message::error(t("Please select a person or tag or specify a title."));
|
||||||
url::redirect($redir_uri);
|
url::redirect($redir_uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -133,16 +133,16 @@ class photoannotation_Controller extends Controller {
|
|||||||
$updateduser = ORM::factory("items_user") //load the existing user
|
$updateduser = ORM::factory("items_user") //load the existing user
|
||||||
->where("id", "=", $annotate_id)
|
->where("id", "=", $annotate_id)
|
||||||
->find();
|
->find();
|
||||||
if ($user_id > -1) { //Conversion user -> user
|
if ($user_id != "") { //Conversion user -> user
|
||||||
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
} elseif ($tag_data > -1) { //Conversion user -> face
|
} elseif ($tag_data != "") { //Conversion user -> face
|
||||||
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
$updateduser->delete(); //delete old user
|
$updateduser->delete(); //delete old user
|
||||||
} elseif ($item_title != "") { //Conversion user -> note
|
} elseif ($item_title != "") { //Conversion user -> note
|
||||||
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
$updateduser->delete(); //delete old user
|
$updateduser->delete(); //delete old user
|
||||||
} else { //Somethings wrong
|
} else { //Somethings wrong
|
||||||
message::error(t("Please select a User or Tag or specify a Title."));
|
message::error(t("Please select a person or tag or specify a title."));
|
||||||
url::redirect($redir_uri);
|
url::redirect($redir_uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -151,16 +151,16 @@ class photoannotation_Controller extends Controller {
|
|||||||
$updatedface = ORM::factory("items_face") //load the existing user
|
$updatedface = ORM::factory("items_face") //load the existing user
|
||||||
->where("id", "=", $annotate_id)
|
->where("id", "=", $annotate_id)
|
||||||
->find();
|
->find();
|
||||||
if ($user_id > -1) { //Conversion face -> user
|
if ($user_id != "") { //Conversion face -> user
|
||||||
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
$updatedface->delete(); //delete old face
|
$updatedface->delete(); //delete old face
|
||||||
} elseif ($tag_data > -1) { //Conversion face -> face
|
} elseif ($tag_data != "") { //Conversion face -> face
|
||||||
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
|
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
|
||||||
} elseif ($item_title != "") { //Conversion face -> note
|
} elseif ($item_title != "") { //Conversion face -> note
|
||||||
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
$updatedface->delete(); //delete old face
|
$updatedface->delete(); //delete old face
|
||||||
} else { //Somethings wrong
|
} else { //Somethings wrong
|
||||||
message::error(t("Please select a User or Tag or specify a Title."));
|
message::error(t("Please select a person or tag or specify a title."));
|
||||||
url::redirect($redir_uri);
|
url::redirect($redir_uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -169,22 +169,22 @@ class photoannotation_Controller extends Controller {
|
|||||||
$updatednote = ORM::factory("items_note") //load the existing user
|
$updatednote = ORM::factory("items_note") //load the existing user
|
||||||
->where("id", "=", $annotate_id)
|
->where("id", "=", $annotate_id)
|
||||||
->find();
|
->find();
|
||||||
if ($user_id > -1) { //Conversion note -> user
|
if ($user_id != "") { //Conversion note -> user
|
||||||
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::saveuser($user_id, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
$updatednote->delete(); //delete old note
|
$updatednote->delete(); //delete old note
|
||||||
} elseif ($tag_data > -1) { //Conversion note -> face
|
} elseif ($tag_data != "") { //Conversion note -> face
|
||||||
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
|
||||||
$updatednote->delete(); //delete old note
|
$updatednote->delete(); //delete old note
|
||||||
} elseif ($item_title != "") { //Conversion note -> note
|
} elseif ($item_title != "") { //Conversion note -> note
|
||||||
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
|
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description, $annotate_id);
|
||||||
} else { //Somethings wrong
|
} else { //Somethings wrong
|
||||||
message::error(t("Please select a User or Tag or specify a Title."));
|
message::error(t("Please select a person or tag or specify a title."));
|
||||||
url::redirect($redir_uri);
|
url::redirect($redir_uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
message::error(t("Please select a User or Tag or specify a Title."));
|
message::error(t("Please select a person or tag or specify a title."));
|
||||||
url::redirect($redir_uri);
|
url::redirect($redir_uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -235,7 +235,8 @@ class photoannotation_Controller extends Controller {
|
|||||||
$user_part = ltrim(end($user_parts));
|
$user_part = ltrim(end($user_parts));
|
||||||
$user_list = ORM::factory("user")
|
$user_list = ORM::factory("user")
|
||||||
->where("name", "LIKE", "{$user_part}%")
|
->where("name", "LIKE", "{$user_part}%")
|
||||||
->order_by("name", "ASC")
|
->or_where("full_name", "LIKE", "{$user_part}%")
|
||||||
|
->order_by("full_name", "ASC")
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->find_all();
|
->find_all();
|
||||||
foreach ($user_list as $user) {
|
foreach ($user_list as $user) {
|
||||||
|
@ -43,9 +43,9 @@ class photoannotation_Core {
|
|||||||
|
|
||||||
static function get_user_search_form($form_id) {
|
static function get_user_search_form($form_id) {
|
||||||
$form = new Forge("photoannotation/showuser/{$item->id}", "", "post", array("id" => $form_id, "class" => "g-short-form"));
|
$form = new Forge("photoannotation/showuser/{$item->id}", "", "post", array("id" => $form_id, "class" => "g-short-form"));
|
||||||
$label = t("Type user name");
|
$label = t("Search for a person");
|
||||||
|
|
||||||
$group = $form->group("showuser")->label("Search for a user");
|
$group = $form->group("showuser")->label("Search for a person");
|
||||||
$group->input("name")->label($label)->id("name");
|
$group->input("name")->label($label)->id("name");
|
||||||
$group->submit("")->value(t("Search"));
|
$group->submit("")->value(t("Search"));
|
||||||
return $form;
|
return $form;
|
||||||
|
@ -29,7 +29,7 @@ class photoannotation_block_Core {
|
|||||||
case "photoannotation":
|
case "photoannotation":
|
||||||
$block = new Block();
|
$block = new Block();
|
||||||
$block->css_id = "g-photoannotation";
|
$block->css_id = "g-photoannotation";
|
||||||
$block->title = t("Users");
|
$block->title = t("People");
|
||||||
$block->content = new View("photoannotation_block.html");
|
$block->content = new View("photoannotation_block.html");
|
||||||
$block->content->cloud = photoannotation::cloud(30);
|
$block->content->cloud = photoannotation::cloud(30);
|
||||||
$block->content->form = photoannotation::get_user_search_form("g-user-cloud-form");
|
$block->content->form = photoannotation::get_user_search_form("g-user-cloud-form");
|
||||||
|
@ -209,8 +209,8 @@
|
|||||||
newNote.noteid = "new";
|
newNote.noteid = "new";
|
||||||
newNote.top = 30;
|
newNote.top = 30;
|
||||||
newNote.left = 30;
|
newNote.left = 30;
|
||||||
newNote.width = 30;
|
newNote.width = 60;
|
||||||
newNote.height = 30;
|
newNote.height = 60;
|
||||||
newNote.text = "";
|
newNote.text = "";
|
||||||
newNote.description = "";
|
newNote.description = "";
|
||||||
newNote.notetype = "";
|
newNote.notetype = "";
|
||||||
|
File diff suppressed because one or more lines are too long
@ -59,7 +59,7 @@
|
|||||||
}
|
}
|
||||||
if ($legend_users != "") {
|
if ($legend_users != "") {
|
||||||
$legend_users = trim($legend_users, ", ");
|
$legend_users = trim($legend_users, ", ");
|
||||||
$legend_users = t("Users on this photo: ") . $legend_users;
|
$legend_users = t("People on this photo: ") . $legend_users;
|
||||||
}
|
}
|
||||||
foreach ($existingFaces as $oneFace) {
|
foreach ($existingFaces as $oneFace) {
|
||||||
$oneTag = ORM::factory("tag", $oneFace->tag_id);
|
$oneTag = ORM::factory("tag", $oneFace->tag_id);
|
||||||
@ -110,7 +110,7 @@
|
|||||||
$legend_display = $legend_users . "<br />" . $legend_faces . "<br />" . $legend_notes;
|
$legend_display = $legend_users . "<br />" . $legend_faces . "<br />" . $legend_notes;
|
||||||
$legend_display = str_replace("<br /><br />", "<br />", $legend_display);
|
$legend_display = str_replace("<br /><br />", "<br />", $legend_display);
|
||||||
}
|
}
|
||||||
$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") ."' ],";
|
$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") ."' ],";
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<?= $search_form ?>
|
<?= $search_form ?>
|
||||||
<? if (count($users)): ?>
|
<? if (count($users)): ?>
|
||||||
<div class="g-message photoannotation-user-search">
|
<div class="g-message photoannotation-user-search">
|
||||||
<?= t("%count users found for <b>%term</b>", array("count" => $count, "term" => $q)) ?>
|
<?= t("%count people found for <b>%term</b>", array("count" => $count, "term" => $q)) ?>
|
||||||
</div>
|
</div>
|
||||||
<? foreach ($users as $user): ?>
|
<? foreach ($users as $user): ?>
|
||||||
<? $profile_link = "<a href=\"". user_profile::url($user->id) ."\">" ?>
|
<? $profile_link = "<a href=\"". user_profile::url($user->id) ."\">" ?>
|
||||||
|
Reference in New Issue
Block a user