Added a link to the photo or album that the contact link was clicked from into the email body by default.
This commit is contained in:
parent
7eedf4c26c
commit
4493eb8953
@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class ContactOwner_Controller extends Controller {
|
||||
static function get_email_form($user_id) {
|
||||
static function get_email_form($user_id, $item_id) {
|
||||
// Determine name of the person the message is going to.
|
||||
$str_to_name = "";
|
||||
if ($user_id == -1) {
|
||||
@ -32,6 +32,13 @@ class ContactOwner_Controller extends Controller {
|
||||
$str_to_name = $userDetails[0]->name;
|
||||
}
|
||||
|
||||
// If item_id is set, include a link to the item.
|
||||
$email_body = "";
|
||||
if ($item_id <> "") {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
$email_body = "This message refers to <a href=\"" . url::abs_site("{$item->type}s/{$item->id}") . "\">this page</a>.";
|
||||
}
|
||||
|
||||
// Make a new form with a couple of text boxes.
|
||||
$form = new Forge("contactowner/sendemail/{$user_id}", "", "post",
|
||||
array("id" => "g-contact-owner-send-form"));
|
||||
@ -53,7 +60,7 @@ class ContactOwner_Controller extends Controller {
|
||||
->error_messages("required", t("You must enter a subject"));
|
||||
$sendmail_fields->textarea("email_body")
|
||||
->label(t("Message:"))
|
||||
->value("")
|
||||
->value($email_body)
|
||||
->id("g-contactowner-email-body")
|
||||
->rules('required')
|
||||
->error_messages("required", t("You must enter a message"));
|
||||
@ -67,7 +74,7 @@ class ContactOwner_Controller extends Controller {
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function emailowner() {
|
||||
public function emailowner($item_id) {
|
||||
// Display a form that a vistor can use to contact the site owner.
|
||||
|
||||
// If this page is disabled, show a 404 error.
|
||||
@ -78,11 +85,11 @@ class ContactOwner_Controller extends Controller {
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = $this->get_email_form("-1");
|
||||
$template->content->sendmail_form = $this->get_email_form("-1", $item_id);
|
||||
print $template;
|
||||
}
|
||||
|
||||
public function emailid($user_id) {
|
||||
public function emailid($user_id, $item_id) {
|
||||
// Display a form that a vistor can use to contact a registered user.
|
||||
|
||||
// If this page is disabled, show a 404 error.
|
||||
@ -93,7 +100,7 @@ class ContactOwner_Controller extends Controller {
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = $this->get_email_form($user_id);
|
||||
$template->content->sendmail_form = $this->get_email_form($user_id, $item_id);
|
||||
print $template;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class contactowner_block_Core {
|
||||
if ((count($userDetails) > 0) && ($userDetails[0]->email != "") &&
|
||||
(module::get_var("contactowner", "contact_user_link") == true)) {
|
||||
$block->content->userLink = "<a href=\"" . url::site("contactowner/emailid/" .
|
||||
$theme->item->owner_id) . "\">" . t("Contact") . " " .
|
||||
$theme->item->owner_id) . "/" . $theme->item->id . "\">" . t("Contact") . " " .
|
||||
$userDetails[0]->name . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
@ -61,8 +61,13 @@ class contactowner_block_Core {
|
||||
|
||||
// Figure out if the contact site owner link should be displayed.
|
||||
if (module::get_var("contactowner", "contact_owner_link")) {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
if ($theme->item()) {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") . "/" . $theme->item->id .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
} else {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
}
|
||||
$displayBlock = true;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class ContactOwner_Controller extends Controller {
|
||||
static function get_email_form($user_id) {
|
||||
static function get_email_form($user_id, $item_id) {
|
||||
// Determine name of the person the message is going to.
|
||||
$str_to_name = "";
|
||||
if ($user_id == -1) {
|
||||
@ -32,6 +32,13 @@ class ContactOwner_Controller extends Controller {
|
||||
$str_to_name = $userDetails[0]->name;
|
||||
}
|
||||
|
||||
// If item_id is set, include a link to the item.
|
||||
$email_body = "";
|
||||
if ($item_id <> "") {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
$email_body = "This message refers to <a href=\"" . url::abs_site("{$item->type}s/{$item->id}") . "\">this page</a>.";
|
||||
}
|
||||
|
||||
// Make a new form with a couple of text boxes.
|
||||
$form = new Forge("contactowner/sendemail/{$user_id}", "", "post",
|
||||
array("id" => "g-contact-owner-send-form"));
|
||||
@ -53,7 +60,7 @@ class ContactOwner_Controller extends Controller {
|
||||
->error_messages("required", t("You must enter a subject"));
|
||||
$sendmail_fields->textarea("email_body")
|
||||
->label(t("Message:"))
|
||||
->value("")
|
||||
->value($email_body)
|
||||
->id("g-contactowner-email-body")
|
||||
->rules('required')
|
||||
->error_messages("required", t("You must enter a message"));
|
||||
@ -67,7 +74,7 @@ class ContactOwner_Controller extends Controller {
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function emailowner() {
|
||||
public function emailowner($item_id) {
|
||||
// Display a form that a vistor can use to contact the site owner.
|
||||
|
||||
// If this page is disabled, show a 404 error.
|
||||
@ -78,11 +85,11 @@ class ContactOwner_Controller extends Controller {
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = $this->get_email_form("-1");
|
||||
$template->content->sendmail_form = $this->get_email_form("-1", $item_id);
|
||||
print $template;
|
||||
}
|
||||
|
||||
public function emailid($user_id) {
|
||||
public function emailid($user_id, $item_id) {
|
||||
// Display a form that a vistor can use to contact a registered user.
|
||||
|
||||
// If this page is disabled, show a 404 error.
|
||||
@ -93,7 +100,7 @@ class ContactOwner_Controller extends Controller {
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = $this->get_email_form($user_id);
|
||||
$template->content->sendmail_form = $this->get_email_form($user_id, $item_id);
|
||||
print $template;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class contactowner_block_Core {
|
||||
if ((count($userDetails) > 0) && ($userDetails[0]->email != "") &&
|
||||
(module::get_var("contactowner", "contact_user_link") == true)) {
|
||||
$block->content->userLink = "<a href=\"" . url::site("contactowner/emailid/" .
|
||||
$theme->item->owner_id) . "\">" . t("Contact") . " " .
|
||||
$theme->item->owner_id) . "/" . $theme->item->id . "\">" . t("Contact") . " " .
|
||||
$userDetails[0]->name . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
@ -61,8 +61,13 @@ class contactowner_block_Core {
|
||||
|
||||
// Figure out if the contact site owner link should be displayed.
|
||||
if (module::get_var("contactowner", "contact_owner_link")) {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
if ($theme->item()) {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") . "/" . $theme->item->id .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
} else {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
}
|
||||
$displayBlock = true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user