From 4c99d49ed29062f8a104f18f8e220c4992a9bcee Mon Sep 17 00:00:00 2001 From: rWatcher Date: Tue, 15 Mar 2011 18:40:07 -0400 Subject: [PATCH 1/2] Initial Commit of Tag Cloud Page module. --- .../controllers/tag_cloud_page.php | 66 ++++++++++++++ .../tag_cloud_page/css/tag_cloud_page.css | 73 +++++++++++++++ .../helpers/tag_cloud_page_block.php | 40 +++++++++ .../helpers/tag_cloud_page_theme.php | 30 +++++++ .../tag_cloud_page/js/tag_cloud_page.js | 89 +++++++++++++++++++ 3.0/modules/tag_cloud_page/module.info | 3 + .../views/tag_cloud_page_block.html.php | 2 + .../views/tag_cloud_page_cloud.html.php | 35 ++++++++ .../controllers/tag_cloud_page.php | 66 ++++++++++++++ .../tag_cloud_page/css/tag_cloud_page.css | 73 +++++++++++++++ .../helpers/tag_cloud_page_block.php | 40 +++++++++ .../helpers/tag_cloud_page_theme.php | 30 +++++++ .../tag_cloud_page/js/tag_cloud_page.js | 89 +++++++++++++++++++ 3.1/modules/tag_cloud_page/module.info | 3 + .../views/tag_cloud_page_block.html.php | 2 + .../views/tag_cloud_page_cloud.html.php | 35 ++++++++ 16 files changed, 676 insertions(+) create mode 100644 3.0/modules/tag_cloud_page/controllers/tag_cloud_page.php create mode 100644 3.0/modules/tag_cloud_page/css/tag_cloud_page.css create mode 100644 3.0/modules/tag_cloud_page/helpers/tag_cloud_page_block.php create mode 100644 3.0/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php create mode 100644 3.0/modules/tag_cloud_page/js/tag_cloud_page.js create mode 100644 3.0/modules/tag_cloud_page/module.info create mode 100644 3.0/modules/tag_cloud_page/views/tag_cloud_page_block.html.php create mode 100644 3.0/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php create mode 100644 3.1/modules/tag_cloud_page/controllers/tag_cloud_page.php create mode 100644 3.1/modules/tag_cloud_page/css/tag_cloud_page.css create mode 100644 3.1/modules/tag_cloud_page/helpers/tag_cloud_page_block.php create mode 100644 3.1/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php create mode 100644 3.1/modules/tag_cloud_page/js/tag_cloud_page.js create mode 100644 3.1/modules/tag_cloud_page/module.info create mode 100644 3.1/modules/tag_cloud_page/views/tag_cloud_page_block.html.php create mode 100644 3.1/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php diff --git a/3.0/modules/tag_cloud_page/controllers/tag_cloud_page.php b/3.0/modules/tag_cloud_page/controllers/tag_cloud_page.php new file mode 100644 index 00000000..2fc045df --- /dev/null +++ b/3.0/modules/tag_cloud_page/controllers/tag_cloud_page.php @@ -0,0 +1,66 @@ +content = new View("tag_cloud_page_cloud.html"); + $template->content->title = t("Tag Cloud"); + + // If the tag cloud module is active, load its settings from the database. + if (module::is_active("tag_cloud")) { + $options = array(); + foreach (array("tagcolor", "background_color", "mouseover", "transparent", "speed", "distribution") + as $option) { + $value = module::get_var("tag_cloud", $option, null); + if (!empty($value)) { + switch ($option) { + case "tagcolor": + $options["tcolor"] = $value; + break; + case "mouseover": + $options["hicolor"] = $value; + break; + case "background_color": + $options["bgColor"] = $value; + break; + case "transparent": + $options["wmode"] = "transparent"; + break; + case "speed": + $options["tspeed"] = $value; + break; + case "distribution": + $options["distr"] = "true"; + break; + } + } + } + $template->content->options = $options; + } + + // Display the page. + print $template; + } +} diff --git a/3.0/modules/tag_cloud_page/css/tag_cloud_page.css b/3.0/modules/tag_cloud_page/css/tag_cloud_page.css new file mode 100644 index 00000000..1eacad23 --- /dev/null +++ b/3.0/modules/tag_cloud_page/css/tag_cloud_page.css @@ -0,0 +1,73 @@ +/* Tag cloud page ~~~~~~~~~~~~~~~~~~~~~~~ */ + +#g-tag-cloud-page ul { + font-size: 1.2em; + text-align: justify; +} + +#g-tag-cloud-page ul li { + display: inline; + line-height: 1.5em; + text-align: justify; +} + +#g-tag-cloud-page ul li a { + text-decoration: none; +} + +#g-tag-cloud-page ul li span { + display: none; +} + +#g-tag-cloud-page ul li.size0 a { + color: #9cf; + font-size: 70%; + font-weight: 100; +} + +#g-tag-cloud-page ul li.size1 a { + color: #9cf; + font-size: 80%; + font-weight: 100; +} + +#g-tag-cloud-page ul li.size2 a { + color: #69f; + font-size: 90%; + font-weight: 300; +} + +#g-tag-cloud-page ul li.size3 a { + color: #69c; + font-size: 100%; + font-weight: 500; +} + +#g-tag-cloud-page ul li.size4 a { + color: #369; + font-size: 110%; + font-weight: 700; +} + +#g-tag-cloud-page ul li.size5 a { + color: #0e2b52; + font-size: 120%; + font-weight: 900; +} + +#g-tag-cloud-page ul li.size6 a { + color: #0e2b52; + font-size: 130%; + font-weight: 900; +} + +#g-tag-cloud-page ul li.size7 a { + color: #0e2b52; + font-size: 140%; + font-weight: 900; +} + +#g-tag-cloud-page ul li a:hover { + color: #f30; + text-decoration: underline; +} diff --git a/3.0/modules/tag_cloud_page/helpers/tag_cloud_page_block.php b/3.0/modules/tag_cloud_page/helpers/tag_cloud_page_block.php new file mode 100644 index 00000000..4ac5278b --- /dev/null +++ b/3.0/modules/tag_cloud_page/helpers/tag_cloud_page_block.php @@ -0,0 +1,40 @@ + t("Tag Cloud Page Link")); + } + + static function get($block_id, $theme) { + // Generate the sidebar block for linking to the tag cloud page. + $block = ""; + switch ($block_id) { + case "tag_cloud_page": + $block = new Block(); + $block->css_id = "g-tag-cloud-page"; + $block->title = t("Tag Cloud"); + $block->content = new View("tag_cloud_page_block.html"); + + break; + } + return $block; + } +} diff --git a/3.0/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php b/3.0/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php new file mode 100644 index 00000000..ede2d9f3 --- /dev/null +++ b/3.0/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php @@ -0,0 +1,30 @@ +script("tag_cloud_page.js"); + } + + // Load the tag cloud page's css code. + return $theme->css("tag_cloud_page.css"); + } +} diff --git a/3.0/modules/tag_cloud_page/js/tag_cloud_page.js b/3.0/modules/tag_cloud_page/js/tag_cloud_page.js new file mode 100644 index 00000000..66d1ddab --- /dev/null +++ b/3.0/modules/tag_cloud_page/js/tag_cloud_page.js @@ -0,0 +1,89 @@ +(function($) { + $.widget("ui.gallery_tag_cloud_page", { + _init: function() { + var self = this; + self._set_tag_cloud(); + this._ajax_form(); + this._autocomplete(); + }, + + _autocomplete: function() { + var url = $("#g-tag-cloud-page-animation").attr("ref") + "/autocomplete"; + $("#g-add-tag-form input:text").autocomplete( + url, { + max: 30, + multiple: true, + multipleSeparator: ',', + cacheLength: 1} + ); + }, + + _ajax_form: function() { + var self = this; + var form = $("#g-add-tag-form"); + form.ajaxForm({ + dataType: "json", + success: function(data) { + if (data.result == "success") { + $.get($("#g-tag-cloud-page-animation").attr("ref"), function(data, textStatus) { + $("#g-tag-cloud-movie-page").remove(); + $("#g-tag-cloud-page-animation").append("
" + data + "
"); + self._set_tag_cloud(); + }); + } + form.resetForm(); + $("#g-add-tag-form :text").blur(); + } + }); + }, + + _set_tag_cloud: function() { + var self = this; + var taglist = $("#g-tag-cloud-page-animation a"); + + if (taglist.length == 0) { + return; + } + var width = $("#g-tag-cloud-page-animation").width(); + var tags = document.createElement("tags"); + taglist.each(function(i) { + var addr = $(this).clone(); + $(addr).attr("style", "font-size: 14pt;"); + $(tags).append(addr); + }); + + var flashvars = { + tcolor: self.options.tcolor, + tcolor2: self.options.tcolor2, + mode: "tags", + distr: self.options.distr, + tspeed: self.options.tspeed, + hicolor: self.options.hicolor, + tagcloud: escape("" + $(tags).html() + "").toLowerCase() + }; + var params = { + bgcolor: self.options.bgColor, + wmode: self.options.wmode, + allowscriptaccess: self.options.scriptAccess + }; + + swfobject.embedSWF(self.options.movie, "g-tag-cloud-movie-page", width, .60 * width, "9", false, + flashvars, params); + } + }); + + $.extend($.ui.gallery_tag_cloud_page, { + defaults: { + bgColor: "0xFFFFFF", + wmode: "transparent", + scriptAccess: "always", + tcolor: "0x333333", + tcolor2: "0x009900", + hicolor: "0x000000", + tspeed: "100", + distr: "true", + mode: "tag" + } + }); + +})(jQuery); diff --git a/3.0/modules/tag_cloud_page/module.info b/3.0/modules/tag_cloud_page/module.info new file mode 100644 index 00000000..a6a83c7d --- /dev/null +++ b/3.0/modules/tag_cloud_page/module.info @@ -0,0 +1,3 @@ +name = "Tag Cloud Page" +description = "Displays a tag cloud of all tags used in the Gallery on a seperate page." +version = 1 diff --git a/3.0/modules/tag_cloud_page/views/tag_cloud_page_block.html.php b/3.0/modules/tag_cloud_page/views/tag_cloud_page_block.html.php new file mode 100644 index 00000000..46fd70ea --- /dev/null +++ b/3.0/modules/tag_cloud_page/views/tag_cloud_page_block.html.php @@ -0,0 +1,2 @@ + +">View cloud diff --git a/3.0/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php b/3.0/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php new file mode 100644 index 00000000..acd31ed4 --- /dev/null +++ b/3.0/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php @@ -0,0 +1,35 @@ + +
+
+ dynamic_top() ?> +
+

+
+
+ + + +
+
"> +
+ count_all()); ?> +
+
+
+ + +
+ count_all()); ?> +
+ + +dynamic_bottom() ?> diff --git a/3.1/modules/tag_cloud_page/controllers/tag_cloud_page.php b/3.1/modules/tag_cloud_page/controllers/tag_cloud_page.php new file mode 100644 index 00000000..2fc045df --- /dev/null +++ b/3.1/modules/tag_cloud_page/controllers/tag_cloud_page.php @@ -0,0 +1,66 @@ +content = new View("tag_cloud_page_cloud.html"); + $template->content->title = t("Tag Cloud"); + + // If the tag cloud module is active, load its settings from the database. + if (module::is_active("tag_cloud")) { + $options = array(); + foreach (array("tagcolor", "background_color", "mouseover", "transparent", "speed", "distribution") + as $option) { + $value = module::get_var("tag_cloud", $option, null); + if (!empty($value)) { + switch ($option) { + case "tagcolor": + $options["tcolor"] = $value; + break; + case "mouseover": + $options["hicolor"] = $value; + break; + case "background_color": + $options["bgColor"] = $value; + break; + case "transparent": + $options["wmode"] = "transparent"; + break; + case "speed": + $options["tspeed"] = $value; + break; + case "distribution": + $options["distr"] = "true"; + break; + } + } + } + $template->content->options = $options; + } + + // Display the page. + print $template; + } +} diff --git a/3.1/modules/tag_cloud_page/css/tag_cloud_page.css b/3.1/modules/tag_cloud_page/css/tag_cloud_page.css new file mode 100644 index 00000000..1eacad23 --- /dev/null +++ b/3.1/modules/tag_cloud_page/css/tag_cloud_page.css @@ -0,0 +1,73 @@ +/* Tag cloud page ~~~~~~~~~~~~~~~~~~~~~~~ */ + +#g-tag-cloud-page ul { + font-size: 1.2em; + text-align: justify; +} + +#g-tag-cloud-page ul li { + display: inline; + line-height: 1.5em; + text-align: justify; +} + +#g-tag-cloud-page ul li a { + text-decoration: none; +} + +#g-tag-cloud-page ul li span { + display: none; +} + +#g-tag-cloud-page ul li.size0 a { + color: #9cf; + font-size: 70%; + font-weight: 100; +} + +#g-tag-cloud-page ul li.size1 a { + color: #9cf; + font-size: 80%; + font-weight: 100; +} + +#g-tag-cloud-page ul li.size2 a { + color: #69f; + font-size: 90%; + font-weight: 300; +} + +#g-tag-cloud-page ul li.size3 a { + color: #69c; + font-size: 100%; + font-weight: 500; +} + +#g-tag-cloud-page ul li.size4 a { + color: #369; + font-size: 110%; + font-weight: 700; +} + +#g-tag-cloud-page ul li.size5 a { + color: #0e2b52; + font-size: 120%; + font-weight: 900; +} + +#g-tag-cloud-page ul li.size6 a { + color: #0e2b52; + font-size: 130%; + font-weight: 900; +} + +#g-tag-cloud-page ul li.size7 a { + color: #0e2b52; + font-size: 140%; + font-weight: 900; +} + +#g-tag-cloud-page ul li a:hover { + color: #f30; + text-decoration: underline; +} diff --git a/3.1/modules/tag_cloud_page/helpers/tag_cloud_page_block.php b/3.1/modules/tag_cloud_page/helpers/tag_cloud_page_block.php new file mode 100644 index 00000000..4ac5278b --- /dev/null +++ b/3.1/modules/tag_cloud_page/helpers/tag_cloud_page_block.php @@ -0,0 +1,40 @@ + t("Tag Cloud Page Link")); + } + + static function get($block_id, $theme) { + // Generate the sidebar block for linking to the tag cloud page. + $block = ""; + switch ($block_id) { + case "tag_cloud_page": + $block = new Block(); + $block->css_id = "g-tag-cloud-page"; + $block->title = t("Tag Cloud"); + $block->content = new View("tag_cloud_page_block.html"); + + break; + } + return $block; + } +} diff --git a/3.1/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php b/3.1/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php new file mode 100644 index 00000000..ede2d9f3 --- /dev/null +++ b/3.1/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php @@ -0,0 +1,30 @@ +script("tag_cloud_page.js"); + } + + // Load the tag cloud page's css code. + return $theme->css("tag_cloud_page.css"); + } +} diff --git a/3.1/modules/tag_cloud_page/js/tag_cloud_page.js b/3.1/modules/tag_cloud_page/js/tag_cloud_page.js new file mode 100644 index 00000000..66d1ddab --- /dev/null +++ b/3.1/modules/tag_cloud_page/js/tag_cloud_page.js @@ -0,0 +1,89 @@ +(function($) { + $.widget("ui.gallery_tag_cloud_page", { + _init: function() { + var self = this; + self._set_tag_cloud(); + this._ajax_form(); + this._autocomplete(); + }, + + _autocomplete: function() { + var url = $("#g-tag-cloud-page-animation").attr("ref") + "/autocomplete"; + $("#g-add-tag-form input:text").autocomplete( + url, { + max: 30, + multiple: true, + multipleSeparator: ',', + cacheLength: 1} + ); + }, + + _ajax_form: function() { + var self = this; + var form = $("#g-add-tag-form"); + form.ajaxForm({ + dataType: "json", + success: function(data) { + if (data.result == "success") { + $.get($("#g-tag-cloud-page-animation").attr("ref"), function(data, textStatus) { + $("#g-tag-cloud-movie-page").remove(); + $("#g-tag-cloud-page-animation").append("
" + data + "
"); + self._set_tag_cloud(); + }); + } + form.resetForm(); + $("#g-add-tag-form :text").blur(); + } + }); + }, + + _set_tag_cloud: function() { + var self = this; + var taglist = $("#g-tag-cloud-page-animation a"); + + if (taglist.length == 0) { + return; + } + var width = $("#g-tag-cloud-page-animation").width(); + var tags = document.createElement("tags"); + taglist.each(function(i) { + var addr = $(this).clone(); + $(addr).attr("style", "font-size: 14pt;"); + $(tags).append(addr); + }); + + var flashvars = { + tcolor: self.options.tcolor, + tcolor2: self.options.tcolor2, + mode: "tags", + distr: self.options.distr, + tspeed: self.options.tspeed, + hicolor: self.options.hicolor, + tagcloud: escape("" + $(tags).html() + "").toLowerCase() + }; + var params = { + bgcolor: self.options.bgColor, + wmode: self.options.wmode, + allowscriptaccess: self.options.scriptAccess + }; + + swfobject.embedSWF(self.options.movie, "g-tag-cloud-movie-page", width, .60 * width, "9", false, + flashvars, params); + } + }); + + $.extend($.ui.gallery_tag_cloud_page, { + defaults: { + bgColor: "0xFFFFFF", + wmode: "transparent", + scriptAccess: "always", + tcolor: "0x333333", + tcolor2: "0x009900", + hicolor: "0x000000", + tspeed: "100", + distr: "true", + mode: "tag" + } + }); + +})(jQuery); diff --git a/3.1/modules/tag_cloud_page/module.info b/3.1/modules/tag_cloud_page/module.info new file mode 100644 index 00000000..a6a83c7d --- /dev/null +++ b/3.1/modules/tag_cloud_page/module.info @@ -0,0 +1,3 @@ +name = "Tag Cloud Page" +description = "Displays a tag cloud of all tags used in the Gallery on a seperate page." +version = 1 diff --git a/3.1/modules/tag_cloud_page/views/tag_cloud_page_block.html.php b/3.1/modules/tag_cloud_page/views/tag_cloud_page_block.html.php new file mode 100644 index 00000000..46fd70ea --- /dev/null +++ b/3.1/modules/tag_cloud_page/views/tag_cloud_page_block.html.php @@ -0,0 +1,2 @@ + +">View cloud diff --git a/3.1/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php b/3.1/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php new file mode 100644 index 00000000..acd31ed4 --- /dev/null +++ b/3.1/modules/tag_cloud_page/views/tag_cloud_page_cloud.html.php @@ -0,0 +1,35 @@ + +
+
+ dynamic_top() ?> +
+

+
+
+ + + +
+
"> +
+ count_all()); ?> +
+
+
+ + +
+ count_all()); ?> +
+ + +dynamic_bottom() ?> From 4493eb8953b221129a517d5e491b31e7467eba24 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Mon, 21 Mar 2011 21:23:30 -0400 Subject: [PATCH 2/2] Added a link to the photo or album that the contact link was clicked from into the email body by default. --- .../contactowner/controllers/contactowner.php | 19 +++++++++++++------ .../helpers/contactowner_block.php | 11 ++++++++--- .../contactowner/controllers/contactowner.php | 19 +++++++++++++------ .../helpers/contactowner_block.php | 11 ++++++++--- 4 files changed, 42 insertions(+), 18 deletions(-) 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; }