1
0

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:
hukoeth 2010-09-12 02:44:29 +08:00 committed by Bharat Mediratta
parent 295dae2176
commit 4b13015a76
8 changed files with 36 additions and 35 deletions

View File

@ -43,7 +43,7 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
//Load the target user
$targetuser = ORM::factory("user", $form->targetuser->value);
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");
}
//Load all existing tag annotations
@ -280,12 +280,12 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
->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 and user cloud settings"));
$group = $form->group("notifications")->label(t("Notification and people 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."))
$group->checkbox("allowguestsearch")->label(t("Show people cloud and allow people 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"))

View File

@ -20,7 +20,7 @@
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."));
message::error(t("You have to log in to perform a people search."));
url::redirect(url::site());
return;
}
@ -88,7 +88,7 @@ class photoannotation_Controller extends Controller {
if ($user_id != "") {
$getuser = photoannotation::getuser($user_id);
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);
return;
}
@ -112,18 +112,18 @@ class photoannotation_Controller extends Controller {
$tag->save();
$tag_data = $tag->id;
} else {
$tag_data = -1;
$tag_data = "";
}
//Save 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);
} elseif ($tag_data > -1) { //Conversion user -> face
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
} elseif ($item_title != "") { //Conversion user -> note
} elseif ($tag_data != "") { //Save face
photoannotation::saveface($tag_data, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
} elseif ($item_title != "") { //Save note
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
} else { //Somethings wrong
message::error(t("Please select a User or Tag or specify a Title."));
} else { //Something's wrong
message::error(t("Please select a person or tag or specify a title."));
url::redirect($redir_uri);
return;
}
@ -133,16 +133,16 @@ class photoannotation_Controller extends Controller {
$updateduser = ORM::factory("items_user") //load the existing user
->where("id", "=", $annotate_id)
->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);
} 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);
$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);
$updateduser->delete(); //delete old user
} 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);
return;
}
@ -151,16 +151,16 @@ class photoannotation_Controller extends Controller {
$updatedface = ORM::factory("items_face") //load the existing user
->where("id", "=", $annotate_id)
->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);
$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);
} elseif ($item_title != "") { //Conversion face -> note
photoannotation::savenote($item_title, $item_id, $str_x1, $str_y1, $str_x2, $str_y2, $description);
$updatedface->delete(); //delete old face
} 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);
return;
}
@ -169,22 +169,22 @@ class photoannotation_Controller extends Controller {
$updatednote = ORM::factory("items_note") //load the existing user
->where("id", "=", $annotate_id)
->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);
$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);
$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);
} 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);
return;
}
break;
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);
return;
}
@ -235,7 +235,8 @@ class photoannotation_Controller extends Controller {
$user_part = ltrim(end($user_parts));
$user_list = ORM::factory("user")
->where("name", "LIKE", "{$user_part}%")
->order_by("name", "ASC")
->or_where("full_name", "LIKE", "{$user_part}%")
->order_by("full_name", "ASC")
->limit($limit)
->find_all();
foreach ($user_list as $user) {

View File

@ -43,9 +43,9 @@ class photoannotation_Core {
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");
$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->submit("")->value(t("Search"));
return $form;
@ -282,4 +282,4 @@ class photoannotation_Core {
static function annotation_count($user_id) {
return ORM::factory("items_user")->where("user_id", "=", $user_id)->count_all();
}
}
}

View File

@ -29,7 +29,7 @@ class photoannotation_block_Core {
case "photoannotation":
$block = new Block();
$block->css_id = "g-photoannotation";
$block->title = t("Users");
$block->title = t("People");
$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");
@ -37,4 +37,4 @@ class photoannotation_block_Core {
}
return $block;
}
}
}

View File

@ -209,8 +209,8 @@
newNote.noteid = "new";
newNote.top = 30;
newNote.left = 30;
newNote.width = 30;
newNote.height = 30;
newNote.width = 60;
newNote.height = 60;
newNote.text = "";
newNote.description = "";
newNote.notetype = "";

File diff suppressed because one or more lines are too long

View File

@ -59,7 +59,7 @@
}
if ($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) {
$oneTag = ORM::factory("tag", $oneFace->tag_id);
@ -110,7 +110,7 @@
$legend_display = $legend_users . "<br />" . $legend_faces . "<br />" . $legend_notes;
$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">
$(document).ready(function() {

View File

@ -16,7 +16,7 @@
<?= $search_form ?>
<? if (count($users)): ?>
<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>
<? foreach ($users as $user): ?>
<? $profile_link = "<a href=\"". user_profile::url($user->id) ."\">" ?>
@ -52,4 +52,4 @@
<?= t("No users found for <b>%term</b>", array("term" => $q)) ?>
</div>
<? endif; ?>
</div>
</div>