diff --git a/modules/tag_cloud/helpers/tag_cloud_theme.php b/modules/tag_cloud/helpers/tag_cloud_theme.php new file mode 100644 index 00000000..f9907925 --- /dev/null +++ b/modules/tag_cloud/helpers/tag_cloud_theme.php @@ -0,0 +1,25 @@ +script("tag_cloud.js"); + // return html::script("modules/tag_cloud/js/tag_cloud.js"); + } +} \ No newline at end of file diff --git a/modules/tag_cloud/js/tag_cloud.js b/modules/tag_cloud/js/tag_cloud.js new file mode 100644 index 00000000..243bc1d6 --- /dev/null +++ b/modules/tag_cloud/js/tag_cloud.js @@ -0,0 +1,81 @@ +(function($) { + $.widget("ui.gallery_tag_cloud", { + _init: function() { + var self = this; + self._set_tag_cloud(); + this._ajax_form(); + this._autocomplete(); + }, + + _autocomplete: function() { + var url = $("#gTagCloud3D").attr("title") + "/autocomplete"; + $("#gAddTagForm input:text").autocomplete( + url, { + max: 30, + multiple: true, + multipleSeparator: ',', + cacheLength: 1} + ); + }, + + _ajax_form: function() { + var self = this; + var form = $("#gAddTagForm"); + form.ajaxForm({ + dataType: "json", + success: function(data) { + if (data.result == "success") { + $.get($("#gTagCloud3D").attr("title"), function(data, textStatus) { + $("#gTagCloud3D").html(data); + self._set_tag_cloud(); + }); + } + form.resetForm(); + } + }); + }, + + _set_tag_cloud: function() { + var self = this; + var width = $("#gTagCloud3D").width(); + var tags = document.createElement("tags"); + $("#gTagCloud3D a").each(function(i) { + var addr = $(this).clone(); + $(addr).attr("style", "font-size:" + $(this).css("fontSize") + ";"); + $(tags).append(addr); + }); + var object = document.createElement("object"); + $(object).attr({ + type: "application/x-shockwave-flash", + data: self.options.movie, + width: width, + height: .75 * width + }); + var value = "tcolor=" + self.options.tcolor + "&tcolor2=" + self.options.tcolor2 + + "&hicolor=" + self.options.hicolor + "&tspeed=" + self.options.tspeed + + "&distr=" + self.options.distr + "&mode=" + self.options.mode + + "&tagcloud=" + escape("" + $(tags).html() + ""); + $(object).append("") + .append("") + .append("") + .append("") + .append(""); + $("#gTagCloud3D").html(object); + } + }); + + $.extend($.ui.gallery_tag_cloud, { + defaults: { + bgColor: false, + wmode: "transparent", + scriptAccess: "always", + tcolor: "0x333333", + tcolor2: "0x009900", + hicolor: "0x000000", + tspeed: 100, + distr: "true", + mode: "tag" + } + }); + +})(jQuery); diff --git a/modules/tag_cloud/views/tag_cloud_block.html.php b/modules/tag_cloud/views/tag_cloud_block.html.php index b2b75c79..620b62c6 100644 --- a/modules/tag_cloud/views/tag_cloud_block.html.php +++ b/modules/tag_cloud/views/tag_cloud_block.html.php @@ -1,58 +1,10 @@
">