Initial Commit of Tag Cloud Page module.
This commit is contained in:
parent
6022bc45d4
commit
4c99d49ed2
66
3.0/modules/tag_cloud_page/controllers/tag_cloud_page.php
Normal file
66
3.0/modules/tag_cloud_page/controllers/tag_cloud_page.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
class Tag_Cloud_Page_Controller extends Controller {
|
||||||
|
public function index() {
|
||||||
|
// Require view permission for the root album for security purposes.
|
||||||
|
$album = ORM::factory("item", 1);
|
||||||
|
access::required("view", $album);
|
||||||
|
|
||||||
|
// Set up and display the actual page.
|
||||||
|
$template = new Theme_View("page.html", "other", "Tag Cloud");
|
||||||
|
$template->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;
|
||||||
|
}
|
||||||
|
}
|
73
3.0/modules/tag_cloud_page/css/tag_cloud_page.css
Normal file
73
3.0/modules/tag_cloud_page/css/tag_cloud_page.css
Normal file
@ -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;
|
||||||
|
}
|
40
3.0/modules/tag_cloud_page/helpers/tag_cloud_page_block.php
Normal file
40
3.0/modules/tag_cloud_page/helpers/tag_cloud_page_block.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
class tag_cloud_page_block_Core {
|
||||||
|
static function get_site_list() {
|
||||||
|
// Create a sidebar block to link to the cloud page.
|
||||||
|
return array("tag_cloud_page" => 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;
|
||||||
|
}
|
||||||
|
}
|
30
3.0/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php
Normal file
30
3.0/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
class tag_cloud_page_theme_Core {
|
||||||
|
static function head($theme) {
|
||||||
|
// If the tag cloud module is active, load additional javascript code.
|
||||||
|
if (module::is_active("tag_cloud")) {
|
||||||
|
$theme->script("tag_cloud_page.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the tag cloud page's css code.
|
||||||
|
return $theme->css("tag_cloud_page.css");
|
||||||
|
}
|
||||||
|
}
|
89
3.0/modules/tag_cloud_page/js/tag_cloud_page.js
Normal file
89
3.0/modules/tag_cloud_page/js/tag_cloud_page.js
Normal file
@ -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("<div id='g-tag-cloud-movie-page'>" + data + "</div>");
|
||||||
|
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>" + $(tags).html() + "</tags>").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);
|
3
3.0/modules/tag_cloud_page/module.info
Normal file
3
3.0/modules/tag_cloud_page/module.info
Normal file
@ -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
|
@ -0,0 +1,2 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<a href="<?= url::site("tag_cloud_page"); ?>">View cloud</a>
|
@ -0,0 +1,35 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<div id="g-tag-cloud-page-header">
|
||||||
|
<div id="g-tag-cloud-page-buttons">
|
||||||
|
<?= $theme->dynamic_top() ?>
|
||||||
|
</div>
|
||||||
|
<h1><?= html::clean($title) ?></h1>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<? if (module::is_active("tag_cloud")) { ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("document").ready(function() {
|
||||||
|
$("#g-tag-cloud-page").gallery_tag_cloud_page({
|
||||||
|
movie: "<?= url::file("modules/tag_cloud/lib/tagcloud.swf") ?>"
|
||||||
|
<? foreach ($options as $option => $value) : ?>
|
||||||
|
, <?= $option ?> : "<?= $value ?>"
|
||||||
|
<? endforeach ?>
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div id="g-tag-cloud-page">
|
||||||
|
<div id="g-tag-cloud-page-animation" ref="<?= url::site("tag_cloud_page") ?>">
|
||||||
|
<div id="g-tag-cloud-movie-page">
|
||||||
|
<?= tag::cloud(ORM::factory("tag")->count_all()); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<? } else { ?>
|
||||||
|
<div id="g-tag-cloud-page">
|
||||||
|
<?= tag::cloud(ORM::factory("tag")->count_all()); ?>
|
||||||
|
</div>
|
||||||
|
<? } ?>
|
||||||
|
|
||||||
|
<?= $theme->dynamic_bottom() ?>
|
66
3.1/modules/tag_cloud_page/controllers/tag_cloud_page.php
Normal file
66
3.1/modules/tag_cloud_page/controllers/tag_cloud_page.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
class Tag_Cloud_Page_Controller extends Controller {
|
||||||
|
public function index() {
|
||||||
|
// Require view permission for the root album for security purposes.
|
||||||
|
$album = ORM::factory("item", 1);
|
||||||
|
access::required("view", $album);
|
||||||
|
|
||||||
|
// Set up and display the actual page.
|
||||||
|
$template = new Theme_View("page.html", "other", "Tag Cloud");
|
||||||
|
$template->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;
|
||||||
|
}
|
||||||
|
}
|
73
3.1/modules/tag_cloud_page/css/tag_cloud_page.css
Normal file
73
3.1/modules/tag_cloud_page/css/tag_cloud_page.css
Normal file
@ -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;
|
||||||
|
}
|
40
3.1/modules/tag_cloud_page/helpers/tag_cloud_page_block.php
Normal file
40
3.1/modules/tag_cloud_page/helpers/tag_cloud_page_block.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
class tag_cloud_page_block_Core {
|
||||||
|
static function get_site_list() {
|
||||||
|
// Create a sidebar block to link to the cloud page.
|
||||||
|
return array("tag_cloud_page" => 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;
|
||||||
|
}
|
||||||
|
}
|
30
3.1/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php
Normal file
30
3.1/modules/tag_cloud_page/helpers/tag_cloud_page_theme.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
class tag_cloud_page_theme_Core {
|
||||||
|
static function head($theme) {
|
||||||
|
// If the tag cloud module is active, load additional javascript code.
|
||||||
|
if (module::is_active("tag_cloud")) {
|
||||||
|
$theme->script("tag_cloud_page.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the tag cloud page's css code.
|
||||||
|
return $theme->css("tag_cloud_page.css");
|
||||||
|
}
|
||||||
|
}
|
89
3.1/modules/tag_cloud_page/js/tag_cloud_page.js
Normal file
89
3.1/modules/tag_cloud_page/js/tag_cloud_page.js
Normal file
@ -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("<div id='g-tag-cloud-movie-page'>" + data + "</div>");
|
||||||
|
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>" + $(tags).html() + "</tags>").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);
|
3
3.1/modules/tag_cloud_page/module.info
Normal file
3
3.1/modules/tag_cloud_page/module.info
Normal file
@ -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
|
@ -0,0 +1,2 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<a href="<?= url::site("tag_cloud_page"); ?>">View cloud</a>
|
@ -0,0 +1,35 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<div id="g-tag-cloud-page-header">
|
||||||
|
<div id="g-tag-cloud-page-buttons">
|
||||||
|
<?= $theme->dynamic_top() ?>
|
||||||
|
</div>
|
||||||
|
<h1><?= html::clean($title) ?></h1>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<? if (module::is_active("tag_cloud")) { ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("document").ready(function() {
|
||||||
|
$("#g-tag-cloud-page").gallery_tag_cloud_page({
|
||||||
|
movie: "<?= url::file("modules/tag_cloud/lib/tagcloud.swf") ?>"
|
||||||
|
<? foreach ($options as $option => $value) : ?>
|
||||||
|
, <?= $option ?> : "<?= $value ?>"
|
||||||
|
<? endforeach ?>
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div id="g-tag-cloud-page">
|
||||||
|
<div id="g-tag-cloud-page-animation" ref="<?= url::site("tag_cloud_page") ?>">
|
||||||
|
<div id="g-tag-cloud-movie-page">
|
||||||
|
<?= tag::cloud(ORM::factory("tag")->count_all()); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<? } else { ?>
|
||||||
|
<div id="g-tag-cloud-page">
|
||||||
|
<?= tag::cloud(ORM::factory("tag")->count_all()); ?>
|
||||||
|
</div>
|
||||||
|
<? } ?>
|
||||||
|
|
||||||
|
<?= $theme->dynamic_bottom() ?>
|
Reference in New Issue
Block a user