diff --git a/3.0/modules/contactowner/controllers/contactowner.php b/3.0/modules/contactowner/controllers/contactowner.php
index bc2c24d4..0a302c91 100644
--- a/3.0/modules/contactowner/controllers/contactowner.php
+++ b/3.0/modules/contactowner/controllers/contactowner.php
@@ -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 type}s/{$item->id}") . "\">this page.";
+ }
+
// 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;
}
diff --git a/3.0/modules/contactowner/helpers/contactowner_block.php b/3.0/modules/contactowner/helpers/contactowner_block.php
index f280631e..b2c31500 100644
--- a/3.0/modules/contactowner/helpers/contactowner_block.php
+++ b/3.0/modules/contactowner/helpers/contactowner_block.php
@@ -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 = "item->owner_id) . "\">" . t("Contact") . " " .
+ $theme->item->owner_id) . "/" . $theme->item->id . "\">" . t("Contact") . " " .
$userDetails[0]->name . "";
$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 = "" . t(module::get_var("contactowner", "contact_button_text")) . "";
+ if ($theme->item()) {
+ $block->content->ownerLink = "item->id .
+ "\">" . t(module::get_var("contactowner", "contact_button_text")) . "";
+ } else {
+ $block->content->ownerLink = "" . t(module::get_var("contactowner", "contact_button_text")) . "";
+ }
$displayBlock = true;
}
diff --git a/3.1/modules/contactowner/controllers/contactowner.php b/3.1/modules/contactowner/controllers/contactowner.php
index bc2c24d4..0a302c91 100644
--- a/3.1/modules/contactowner/controllers/contactowner.php
+++ b/3.1/modules/contactowner/controllers/contactowner.php
@@ -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 type}s/{$item->id}") . "\">this page.";
+ }
+
// 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;
}
diff --git a/3.1/modules/contactowner/helpers/contactowner_block.php b/3.1/modules/contactowner/helpers/contactowner_block.php
index f280631e..b2c31500 100644
--- a/3.1/modules/contactowner/helpers/contactowner_block.php
+++ b/3.1/modules/contactowner/helpers/contactowner_block.php
@@ -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 = "item->owner_id) . "\">" . t("Contact") . " " .
+ $theme->item->owner_id) . "/" . $theme->item->id . "\">" . t("Contact") . " " .
$userDetails[0]->name . "";
$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 = "" . t(module::get_var("contactowner", "contact_button_text")) . "";
+ if ($theme->item()) {
+ $block->content->ownerLink = "item->id .
+ "\">" . t(module::get_var("contactowner", "contact_button_text")) . "";
+ } else {
+ $block->content->ownerLink = "" . t(module::get_var("contactowner", "contact_button_text")) . "";
+ }
$displayBlock = true;
}