commit
ed52f1e9fe
@ -45,27 +45,9 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
|
||||
module::set_var("exif_gps", "sidebar_mapformat", $form->Sidebar->sidebar_mapformat->value);
|
||||
module::set_var("exif_gps", "sidebar_maptype", $form->Sidebar->sidebar_maptype->value);
|
||||
module::set_var("exif_gps", "largemap_maptype", $form->LargeMap->largemap_maptype->value);
|
||||
$checkbox_album = false;
|
||||
$checkbox_user = false;
|
||||
$checkbox_restriction = false;
|
||||
for ($i = 0; $i < count($form->Global->toolbar_map_album); $i++) {
|
||||
if ($form->Global->toolbar_map_album->value[$i] == "checkbox_album") {
|
||||
$checkbox_album = true;
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < count($form->Global->toolbar_map_user); $i++) {
|
||||
if ($form->Global->toolbar_map_user->value[$i] == "checkbox_user") {
|
||||
$checkbox_user = true;
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < count($form->Global->restrict_maps); $i++) {
|
||||
if ($form->Global->restrict_maps->value[$i] == "checkbox_restriction") {
|
||||
$checkbox_restriction = true;
|
||||
}
|
||||
}
|
||||
module::set_var("exif_gps", "toolbar_map_album", $checkbox_album);
|
||||
module::set_var("exif_gps", "toolbar_map_user", $checkbox_user);
|
||||
module::set_var("exif_gps", "restrict_maps", $checkbox_restriction);
|
||||
module::set_var("exif_gps", "toolbar_map_album", $form->Global->toolbar_map_album->value);
|
||||
module::set_var("exif_gps", "toolbar_map_user", $form->Global->toolbar_map_user->value);
|
||||
module::set_var("exif_gps", "restrict_maps", $form->Global->restrict_maps->value);
|
||||
|
||||
// Display a success message and redirect back to the TagsMap admin page.
|
||||
message::success(t("Your settings have been saved."));
|
||||
@ -93,15 +75,12 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
|
||||
$gps_global_group->input("max_auto_zoom_level")
|
||||
->label(t("Maximum Auto-Zoom Level:"))
|
||||
->value(module::get_var("exif_gps", "googlemap_max_autozoom"));
|
||||
$checkbox_user["checkbox_user"] = array(t("Show \"Map this user\" icon?"), module::get_var("exif_gps", "toolbar_map_user"));
|
||||
$checkbox_album["checkbox_album"] = array(t("Show \"Map this album\" icon?"), module::get_var("exif_gps", "toolbar_map_album"));
|
||||
$checkbox_restriction["checkbox_restriction"] = array(t("Restrict maps to registered users?"), module::get_var("exif_gps", "restrict_maps"));
|
||||
$gps_global_group->checklist("toolbar_map_album")
|
||||
->options($checkbox_album);
|
||||
$gps_global_group->checklist("toolbar_map_user")
|
||||
->options($checkbox_user);
|
||||
$gps_global_group->checklist("restrict_maps")
|
||||
->options($checkbox_restriction);
|
||||
$gps_global_group->checkbox("toolbar_map_album")->label(t("Show \"Map this album\" icon?"))
|
||||
->checked(module::get_var("exif_gps", "toolbar_map_album", false));
|
||||
$gps_global_group->checkbox("toolbar_map_user")->label(t("Show \"Map this user\" icon?"))
|
||||
->checked(module::get_var("exif_gps", "toolbar_map_user", false));
|
||||
$gps_global_group->checkbox("restrict_maps")->label(t("Restrict maps to registered users?"))
|
||||
->checked(module::get_var("exif_gps", "restrict_maps", false));
|
||||
|
||||
// Create a group for marker cluster settings
|
||||
$gps_markercluster = $form->group("markercluster")
|
||||
|
@ -18,6 +18,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class EXIF_GPS_Controller extends Controller {
|
||||
public static $xml_records_limit = 1000;
|
||||
|
||||
public function item($item_id) {
|
||||
// Make sure the context callback is set to album when linking to photos from map pages.
|
||||
$item = ORM::factory("item", $item_id);
|
||||
@ -26,7 +28,7 @@ class EXIF_GPS_Controller extends Controller {
|
||||
url::redirect($item->abs_url());
|
||||
}
|
||||
|
||||
public function xml($query_type, $query_id) {
|
||||
public function xml($query_type, $query_id, $offset) {
|
||||
// Generate an xml output of the photos to be mapped.
|
||||
// $query_type can be either "album" or "user", $query_id is the id# of the album or user to map.
|
||||
|
||||
@ -42,13 +44,13 @@ class EXIF_GPS_Controller extends Controller {
|
||||
->where("items.owner_id", "=", $query_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->find_all();
|
||||
->find_all(EXIF_GPS_Controller::$xml_records_limit, $offset);
|
||||
} elseif ($query_type == "album") {
|
||||
$items = ORM::factory("item", $query_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants();
|
||||
->descendants(EXIF_GPS_Controller::$xml_records_limit, $offset);
|
||||
}
|
||||
|
||||
$v = new View("exif_gps_coordinates_xml.html");
|
||||
@ -67,14 +69,26 @@ class EXIF_GPS_Controller extends Controller {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Figure out what to display for the page title.
|
||||
// Figure out what to display for the page title and how many items to display.
|
||||
$map_title = "";
|
||||
$items_count = 0;
|
||||
if ($map_type == "album") {
|
||||
$curr_album = ORM::factory("item")->where("id", "=", $type_id)->find_all();
|
||||
$map_title = $curr_album[0]->title;
|
||||
$items_count = ORM::factory("item", $type_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
} elseif ($map_type == "user") {
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $type_id)->find_all();
|
||||
$map_title = $curr_user[0]->full_name . "'s " . t("Photos");
|
||||
$items_count = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $type_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
}
|
||||
|
||||
// Set up breadcrumbs.
|
||||
@ -105,6 +119,7 @@ class EXIF_GPS_Controller extends Controller {
|
||||
} else {
|
||||
$template->content->title = t("Map of") . " " . $map_title;
|
||||
}
|
||||
|
||||
// Figure out default map type.
|
||||
$int_map_type = module::get_var("exif_gps", "largemap_maptype");
|
||||
if ($int_map_type == 0) $map_display_type = "ROADMAP";
|
||||
@ -116,9 +131,9 @@ class EXIF_GPS_Controller extends Controller {
|
||||
// These are used to set up the URL to the xml file.
|
||||
$template->content->query_type = $map_type;
|
||||
$template->content->query_id = $type_id;
|
||||
$template->content->items_count = $items_count;
|
||||
|
||||
// Load in module preferences.
|
||||
$template->content->items = $items;
|
||||
$template->content->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
|
||||
|
||||
// Display the page.
|
||||
|
@ -37,6 +37,7 @@ class exif_gps_block_Core {
|
||||
// a map of the current user.
|
||||
if ($theme->item()) {
|
||||
$album_id = "";
|
||||
$user_name = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
@ -44,7 +45,9 @@ class exif_gps_block_Core {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
if (count($curr_user) > 0) {
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
}
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
@ -120,6 +123,7 @@ class exif_gps_block_Core {
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 1) $block->content->sidebar_map_type = "SATELLITE";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 2) $block->content->sidebar_map_type = "HYBRID";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 3) $block->content->sidebar_map_type = "TERRAIN";
|
||||
$block->content->items_count = 1;
|
||||
} else {
|
||||
$block->content = new View("exif_gps_static_sidebar.html");
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 0) $block->content->sidebar_map_type = "roadmap";
|
||||
@ -131,12 +135,12 @@ class exif_gps_block_Core {
|
||||
$block->content->longitude = $longitude;
|
||||
} elseif (($theme->item()) && ($theme->item->is_album() && (module::get_var("exif_gps", "sidebar_mapformat") == 1))) {
|
||||
// If coordinates were NOT found, and this is an album with a dynamic map, then map the contents of the album.
|
||||
$items = ORM::factory("item", $theme->item->id)
|
||||
$items_count = ORM::factory("item", $theme->item->id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants(1);
|
||||
if (count($items) > 0) {
|
||||
->descendants_count();
|
||||
if ($items_count > 0) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-location";
|
||||
$block->title = t("Location");
|
||||
@ -148,6 +152,7 @@ class exif_gps_block_Core {
|
||||
$block->content->album_id = $theme->item->id;
|
||||
$block->content->latitude = 0;
|
||||
$block->content->longitude = 0;
|
||||
$block->content->items_count = $items_count;
|
||||
$block->content->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ class exif_gps_event_Core {
|
||||
->css_id("g-exif-gps-user-link"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static function album_menu($menu, $theme) {
|
||||
// Adds album and user map icons to album pages.
|
||||
|
||||
@ -248,12 +248,13 @@ class exif_gps_event_Core {
|
||||
}
|
||||
|
||||
// If there's nothing to map, hide the map.
|
||||
$items = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $data->user->id)
|
||||
->viewable()
|
||||
->find_all(1);
|
||||
if (count($items) == 0) {
|
||||
$items_count = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $data->user->id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
if ($items_count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -266,6 +267,7 @@ class exif_gps_event_Core {
|
||||
if ($int_map_type == 3) $map_type = "TERRAIN";
|
||||
$v->map_type = $map_type;
|
||||
$v->user_id = $data->user->id;
|
||||
$v->items_count = $items_count;
|
||||
$v->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
|
||||
$data->content[] = (object) array("title" => t("Photo Map"), "view" => $v);
|
||||
}
|
||||
|
@ -8,9 +8,6 @@
|
||||
print "google.load(\"maps\", \"3\", {other_params:\"sensor=false\"});";
|
||||
}
|
||||
?>
|
||||
|
||||
var google_zoom_hack = false;
|
||||
var map = null;
|
||||
<?
|
||||
if (isset($album_id)) {
|
||||
print " var album_id = " . $album_id . ";\n";
|
||||
@ -19,14 +16,18 @@
|
||||
}
|
||||
?>
|
||||
|
||||
var google_zoom_hack = false;
|
||||
var map = null;
|
||||
|
||||
$.ajaxSetup({
|
||||
error: function(xhr, status, error) {
|
||||
var status_text = document.getElementById('exif-gps-status');
|
||||
status_text.innerHTML = "<font size=\"4\" color=\"white\"><strong>An AJAX error occured: " + status + "<br />\nError: " + error + "</strong></font>";
|
||||
$('p.exif-gps-status').html("<font size=\"4\" color=\"white\"><strong>An AJAX error occured: " +
|
||||
status + "<br />\nError: " + error + "</strong></font>");
|
||||
}
|
||||
});
|
||||
|
||||
function initialize() {
|
||||
// Set up some initial variables and make a new map.
|
||||
var myLatlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
|
||||
var myOptions = {
|
||||
zoom: 1,
|
||||
@ -35,32 +36,25 @@
|
||||
}
|
||||
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
||||
|
||||
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
|
||||
// This is so we can auto-center and zoom the map.
|
||||
// We will grow this each time a new set of coordinates is added onto the map
|
||||
var glatlngbounds = new google.maps.LatLngBounds( );
|
||||
|
||||
// Set up some initial variables for looping through the coordinates in the xml files.
|
||||
var map_markers = []; // Array of all unique coordinates.
|
||||
var current_latlng = null; // Current coordinates. Used for merging duplicate coordinates together.
|
||||
var item_counter = 0; // Current number of XML records that have been processed.
|
||||
var int_max_items = <?= $items_count; ?>; // Total number of XML records to process.
|
||||
var int_offset = 0; // Number of XML records to skip. Sent as a URL parameter when retrieving XML data.
|
||||
|
||||
var map_markers = [];
|
||||
var current_latlng = null;
|
||||
if (album_id > 0) {
|
||||
jQuery.get("<?=url::abs_site("exif_gps/xml/album/{$album_id}"); ?>", {}, function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
current_latlng = latlng;
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
});
|
||||
|
||||
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
|
||||
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
document.getElementById('over_map').style.display = 'none';
|
||||
});
|
||||
// Retrieve the first batch of XML records.
|
||||
// This function runs recursively until item_counter equals int_max_items.
|
||||
// We're using recursion instead of a normal looping control, because normal
|
||||
// loops would prevent the web browser from responding until the loop is finished.
|
||||
get_xml();
|
||||
} else {
|
||||
// Only display a single marker.
|
||||
var latlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
|
||||
var marker = new google.maps.Marker({
|
||||
position: latlng,
|
||||
@ -70,6 +64,61 @@
|
||||
document.getElementById('over_map').style.display = 'none';
|
||||
}
|
||||
|
||||
function get_xml() {
|
||||
// This function uses ajax requests to download and process a chunck of records, in XML format.
|
||||
jQuery.ajax({
|
||||
url: '<?=url::abs_site("exif_gps/xml/album/{$album_id}/"); ?>/' + int_offset,
|
||||
success: function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
// Loop through the retrieved records and add each one to the map.
|
||||
|
||||
// Process the current record.
|
||||
item_counter++;
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
|
||||
// Group multiple records with the same lat and lng coordinates together into
|
||||
// the same marker.
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
|
||||
// ... then set up a new marker for this record.
|
||||
current_latlng = latlng;
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
});
|
||||
|
||||
// Display a status message telling the user what percentage of records have been processed.
|
||||
$('p.exif-gps-status').html("<font size=\"4\" color=\"white\"><strong><?= t("Loading..."); ?> " +
|
||||
parseInt((item_counter / int_max_items) * 100) + "%</strong></font>" +
|
||||
"<br /><br /><img src=\"<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>\"" +
|
||||
" style=\"vertical-align: middle;\"></img>");
|
||||
|
||||
// If item counter is less then max items, get the next batch of records.
|
||||
// If item counter is equal to max items, then finish setting up the map and exit.
|
||||
if (item_counter < int_max_items) {
|
||||
int_offset += <?= EXIF_GPS_Controller::$xml_records_limit; ?>;
|
||||
get_xml();
|
||||
} else {
|
||||
// Add the coordinates to the map, grouping clusters of similar coordinates together.
|
||||
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
|
||||
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
|
||||
|
||||
// Auto zoom and center the map around the coordinates.
|
||||
// Set google_zoom_hack to true, to when the zoom changed function triggers
|
||||
// we can re-zoom to the admin specified auto-zoom value, if necessary.
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
|
||||
// Hide the loading message and exit.
|
||||
document.getElementById('over_map').style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
|
||||
// If there is a maximum auto-zoom value, then set up an event to check the zoom
|
||||
// level the first time it is changed, and adjust it if necessary.
|
||||
@ -84,6 +133,23 @@
|
||||
<? endif ?>
|
||||
}
|
||||
|
||||
// Set up an info window at the specified coordinates
|
||||
// to display the specified html.
|
||||
markerClickFunction = function(str_thumb_html, latlng) {
|
||||
return function(e) {
|
||||
e.cancelBubble = true;
|
||||
e.returnValue = false;
|
||||
if (e.stopPropagation) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
infoWindow.setContent(str_thumb_html);
|
||||
infoWindow.setPosition(latlng);
|
||||
infoWindow.open(map);
|
||||
};
|
||||
};
|
||||
|
||||
google.setOnLoadCallback(initialize);
|
||||
</script>
|
||||
|
||||
@ -95,7 +161,7 @@
|
||||
<div id="wrapper">
|
||||
<div id="map_canvas" style="width:205px; height:214px"></div>
|
||||
<div id="over_map" style="width:205px; height:214px">
|
||||
<p id="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width:205px; height:214px">
|
||||
<p id="exif-gps-status" class="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width:205px; height:214px">
|
||||
<font size="4" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
|
||||
<img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
|
||||
</p>
|
||||
|
@ -15,12 +15,13 @@
|
||||
|
||||
$.ajaxSetup({
|
||||
error: function(xhr, status, error) {
|
||||
var status_text = document.getElementById('exif-gps-status');
|
||||
status_text.innerHTML = "<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " + status + "<br />\nError: " + error + "</strong></font>";
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " +
|
||||
status + "<br />\nError: " + error + "</strong></font>");
|
||||
}
|
||||
});
|
||||
|
||||
function initialize() {
|
||||
// Set up some initial variables and make a new map.
|
||||
var myLatlng = new google.maps.LatLng(0, 0);
|
||||
var myOptions = {
|
||||
zoom: 1,
|
||||
@ -29,54 +30,106 @@
|
||||
}
|
||||
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
||||
|
||||
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
|
||||
// This is so we can auto-center and zoom the map.
|
||||
// We will grow this each time a new set of coordinates is added onto the map
|
||||
var glatlngbounds = new google.maps.LatLngBounds( );
|
||||
|
||||
// Initialize the infoWindow.
|
||||
infoWindow = new google.maps.InfoWindow();
|
||||
|
||||
var map_markers = [];
|
||||
var str_marker_html = "";
|
||||
var current_latlng = null;
|
||||
// Set up some initial variables for looping through the coordinates in the xml files.
|
||||
var map_markers = []; // Array of all unique coordinates.
|
||||
var str_marker_html = ""; // infoWindow HTML for the current set of coordinates.
|
||||
var current_latlng = null; // Current coordinates. Used for merging duplicate coordinates together.
|
||||
var item_counter = 0; // Current number of XML records that have been processed.
|
||||
var int_max_items = <?= $items_count; ?>; // Total number of XML records to process.
|
||||
var int_offset = 0; // Number of XML records to skip. Sent as a URL parameter when retrieving XML data.
|
||||
|
||||
jQuery.get("<?=url::abs_site("exif_gps/xml/{$query_type}/{$query_id}"); ?>", {}, function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
// Retrieve the first batch of XML records.
|
||||
// This function runs recursively until item_counter equals int_max_items.
|
||||
// We're using recursion instead of a normal looping control, because normal
|
||||
// loops would prevent the web browser from responding until the loop is finished.
|
||||
get_xml();
|
||||
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
if (current_latlng != null) {
|
||||
function get_xml() {
|
||||
// This function uses ajax requests to download and process a chunck of records, in XML format.
|
||||
jQuery.ajax({
|
||||
url: '<?=url::abs_site("exif_gps/xml/{$query_type}/{$query_id}/"); ?>/' + int_offset,
|
||||
success: function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
// Loop through the retrieved records and add each one to the map.
|
||||
|
||||
// Process the current record.
|
||||
item_counter++;
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
|
||||
// Group multiple records with the same lat and lng coordinates together into
|
||||
// the same marker and info window.
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
// If the latest record has different coordinates then the previous record
|
||||
// and this is not the first record (!=null) then set up the click function
|
||||
// for the previous marker...
|
||||
if (current_latlng != null) {
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
}
|
||||
|
||||
// ... then set up a new marker for this record.
|
||||
current_latlng = latlng;
|
||||
str_marker_html = "";
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
|
||||
// Convert any XML escape characters in this record to regular text.
|
||||
var str_thumb_html = String(xmlmarker.attr("thumb"));
|
||||
str_thumb_html = str_thumb_html.replace("<", "<");
|
||||
str_thumb_html = str_thumb_html.replace(">", ">");
|
||||
str_thumb_html = str_thumb_html.replace("'", "\'");
|
||||
str_thumb_html = str_thumb_html.replace(""", "\"");
|
||||
str_thumb_html = str_thumb_html.replace("&", "&");
|
||||
|
||||
// Set up the HTML for this record and append it to the bottom of the info window.
|
||||
str_thumb_html = "<div class=\"g-exif-gps-thumb\"><a href=\"" +
|
||||
String(xmlmarker.attr("url")) + "\">" + str_thumb_html + "</a></div>";
|
||||
str_marker_html += str_thumb_html;
|
||||
});
|
||||
|
||||
// Display a status message telling the user what percentage of records have been processed.
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong><?= t("Loading..."); ?> " +
|
||||
parseInt((item_counter / int_max_items) * 100) + "%</strong></font>" +
|
||||
"<br /><br /><img src=\"<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>\"" +
|
||||
" style=\"vertical-align: middle;\"></img>");
|
||||
|
||||
// If item counter is less then max items, get the next batch of records.
|
||||
// If item counter is equal to max items, then finish setting up the map and exit.
|
||||
if (item_counter < int_max_items) {
|
||||
int_offset += <?= EXIF_GPS_Controller::$xml_records_limit; ?>;
|
||||
get_xml();
|
||||
} else {
|
||||
// Set up the click function for the last coordinate.
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
|
||||
// Add the coordinates to the map, grouping clusters of similar coordinates together.
|
||||
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
|
||||
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
|
||||
|
||||
// Auto zoom and center the map around the coordinates.
|
||||
// Set google_zoom_hack to true, to when the zoom changed function triggers
|
||||
// we can re-zoom to the admin specified auto-zoom value, if necessary.
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
|
||||
// Hide the loading message and exit.
|
||||
document.getElementById('over_map').style.display = 'none';
|
||||
}
|
||||
|
||||
current_latlng = latlng;
|
||||
str_marker_html = "";
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
|
||||
var str_thumb_html = String(xmlmarker.attr("thumb"));
|
||||
str_thumb_html = str_thumb_html.replace("<", "<");
|
||||
str_thumb_html = str_thumb_html.replace(">", ">");
|
||||
str_thumb_html = str_thumb_html.replace("'", "\'");
|
||||
str_thumb_html = str_thumb_html.replace(""", "\"");
|
||||
str_thumb_html = str_thumb_html.replace("&", "&");
|
||||
|
||||
str_thumb_html = "<div class=\"g-exif-gps-thumb\"><a href=\"" +
|
||||
String(xmlmarker.attr("url")) + "\">" + str_thumb_html + "</a></div>";
|
||||
str_marker_html += str_thumb_html;
|
||||
|
||||
});
|
||||
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
|
||||
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
|
||||
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
document.getElementById('over_map').style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
|
||||
// If there is a maximum auto-zoom value, then set up an event to check the zoom
|
||||
@ -92,6 +145,8 @@
|
||||
<? endif ?>
|
||||
}
|
||||
|
||||
// Set up an info window at the specified coordinates
|
||||
// to display the specified html.
|
||||
markerClickFunction = function(str_thumb_html, latlng) {
|
||||
return function(e) {
|
||||
e.cancelBubble = true;
|
||||
@ -125,7 +180,7 @@
|
||||
<div id="wrapper">
|
||||
<div id="map_canvas" style="width:690px; height:480px;"></div>
|
||||
<div id="over_map" style="width:690px; height:480px;">
|
||||
<p id="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width: 690px; height: 480px;">
|
||||
<p id="exif-gps-status" class="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width: 690px; height: 480px;">
|
||||
<font size="6" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
|
||||
<img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
|
||||
</p>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul>
|
||||
<? if ($album_items > 0): ?>
|
||||
<? if (isset($album_items) && ($album_items > 0)): ?>
|
||||
<li><a href="<?=url::site("exif_gps/map/album/" . $album_id) ?>"><?=t("Map this album"); ?></a></li>
|
||||
<? endif ?>
|
||||
<? if ($user_items > 0): ?>
|
||||
<? if (isset($user_items) && ($user_items > 0)): ?>
|
||||
<li><a href="<?=url::site("exif_gps/map/user/" . $user_id) ?>"><?=t("Map"); ?> <?=$user_name; ?><?=t("'s photos"); ?></a></li>
|
||||
<? endif ?>
|
||||
</ul>
|
||||
|
@ -15,12 +15,13 @@
|
||||
|
||||
$.ajaxSetup({
|
||||
error: function(xhr, status, error) {
|
||||
var status_text = document.getElementById('exif-gps-status');
|
||||
status_text.innerHTML = "<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " + status + "<br />\nError: " + error + "</strong></font>";
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " +
|
||||
status + "<br />\nError: " + error + "</strong></font>");
|
||||
}
|
||||
});
|
||||
|
||||
function initialize() {
|
||||
// Set up some initial variables and make a new map.
|
||||
var myLatlng = new google.maps.LatLng(0, 0);
|
||||
var myOptions = {
|
||||
zoom: 1,
|
||||
@ -29,54 +30,106 @@
|
||||
}
|
||||
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
||||
|
||||
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
|
||||
// This is so we can auto-center and zoom the map.
|
||||
// We will grow this each time a new set of coordinates is added onto the map
|
||||
var glatlngbounds = new google.maps.LatLngBounds( );
|
||||
|
||||
// Initialize the infoWindow.
|
||||
infoWindow = new google.maps.InfoWindow();
|
||||
|
||||
var map_markers = [];
|
||||
var str_marker_html = "";
|
||||
var current_latlng = null;
|
||||
// Set up some initial variables for looping through the coordinates in the xml files.
|
||||
var map_markers = []; // Array of all unique coordinates.
|
||||
var str_marker_html = ""; // infoWindow HTML for the current set of coordinates.
|
||||
var current_latlng = null; // Current coordinates. Used for merging duplicate coordinates together.
|
||||
var item_counter = 0; // Current number of XML records that have been processed.
|
||||
var int_max_items = <?= $items_count; ?>; // Total number of XML records to process.
|
||||
var int_offset = 0; // Number of XML records to skip. Sent as a URL parameter when retrieving XML data.
|
||||
|
||||
jQuery.get("<?=url::abs_site("exif_gps/xml/user/{$user_id}"); ?>", {}, function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
// Retrieve the first batch of XML records.
|
||||
// This function runs recursively until item_counter equals int_max_items.
|
||||
// We're using recursion instead of a normal looping control, because normal
|
||||
// loops would prevent the web browser from responding until the loop is finished.
|
||||
get_xml();
|
||||
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
if (current_latlng != null) {
|
||||
function get_xml() {
|
||||
// This function uses ajax requests to download and process a chunck of records, in XML format.
|
||||
jQuery.ajax({
|
||||
url: '<?=url::abs_site("exif_gps/xml/user/{$user_id}/"); ?>/' + int_offset,
|
||||
success: function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
// Loop through the retrieved records and add each one to the map.
|
||||
|
||||
// Process the current record.
|
||||
item_counter++;
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
|
||||
// Group multiple records with the same lat and lng coordinates together into
|
||||
// the same marker and info window.
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
// If the latest record has different coordinates then the previous record
|
||||
// and this is not the first record (!=null) then set up the click function
|
||||
// for the previous marker...
|
||||
if (current_latlng != null) {
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
}
|
||||
|
||||
// ... then set up a new marker for this record.
|
||||
current_latlng = latlng;
|
||||
str_marker_html = "";
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
|
||||
// Convert any XML escape characters in this record to regular text.
|
||||
var str_thumb_html = String(xmlmarker.attr("thumb"));
|
||||
str_thumb_html = str_thumb_html.replace("<", "<");
|
||||
str_thumb_html = str_thumb_html.replace(">", ">");
|
||||
str_thumb_html = str_thumb_html.replace("'", "\'");
|
||||
str_thumb_html = str_thumb_html.replace(""", "\"");
|
||||
str_thumb_html = str_thumb_html.replace("&", "&");
|
||||
|
||||
// Set up the HTML for this record and append it to the bottom of the info window.
|
||||
str_thumb_html = "<div class=\"g-exif-gps-thumb\"><a href=\"" +
|
||||
String(xmlmarker.attr("url")) + "\">" + str_thumb_html + "</a></div>";
|
||||
str_marker_html += str_thumb_html;
|
||||
});
|
||||
|
||||
// Display a status message telling the user what percentage of records have been processed.
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong><?= t("Loading..."); ?> " +
|
||||
parseInt((item_counter / int_max_items) * 100) + "%</strong></font>" +
|
||||
"<br /><br /><img src=\"<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>\"" +
|
||||
" style=\"vertical-align: middle;\"></img>");
|
||||
|
||||
// If item counter is less then max items, get the next batch of records.
|
||||
// If item counter is equal to max items, then finish setting up the map and exit.
|
||||
if (item_counter < int_max_items) {
|
||||
int_offset += <?= EXIF_GPS_Controller::$xml_records_limit; ?>;
|
||||
get_xml();
|
||||
} else {
|
||||
// Set up the click function for the last coordinate.
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
|
||||
// Add the coordinates to the map, grouping clusters of similar coordinates together.
|
||||
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
|
||||
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
|
||||
|
||||
// Auto zoom and center the map around the coordinates.
|
||||
// Set google_zoom_hack to true, to when the zoom changed function triggers
|
||||
// we can re-zoom to the admin specified auto-zoom value, if necessary.
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
|
||||
// Hide the loading message and exit.
|
||||
document.getElementById('over_map').style.display = 'none';
|
||||
}
|
||||
|
||||
current_latlng = latlng;
|
||||
str_marker_html = "";
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
|
||||
var str_thumb_html = String(xmlmarker.attr("thumb"));
|
||||
str_thumb_html = str_thumb_html.replace("<", "<");
|
||||
str_thumb_html = str_thumb_html.replace(">", ">");
|
||||
str_thumb_html = str_thumb_html.replace("'", "\'");
|
||||
str_thumb_html = str_thumb_html.replace(""", "\"");
|
||||
str_thumb_html = str_thumb_html.replace("&", "&");
|
||||
|
||||
str_thumb_html = "<div class=\"g-exif-gps-thumb\"><a href=\"" +
|
||||
String(xmlmarker.attr("url")) + "\">" + str_thumb_html + "</a></div>";
|
||||
str_marker_html += str_thumb_html;
|
||||
|
||||
});
|
||||
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
|
||||
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
|
||||
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
document.getElementById('over_map').style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
|
||||
// If there is a maximum auto-zoom value, then set up an event to check the zoom
|
||||
@ -92,6 +145,8 @@
|
||||
<? endif ?>
|
||||
}
|
||||
|
||||
// Set up an info window at the specified coordinates
|
||||
// to display the specified html.
|
||||
markerClickFunction = function(str_thumb_html, latlng) {
|
||||
return function(e) {
|
||||
e.cancelBubble = true;
|
||||
@ -118,7 +173,7 @@
|
||||
<div id="wrapper">
|
||||
<div id="map_canvas" style="width:690px; height:480px;"></div>
|
||||
<div id="over_map" style="width:690px; height:480px;">
|
||||
<p id="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width: 690px; height: 480px;">
|
||||
<p id="exif-gps-status" class="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width: 690px; height: 480px;">
|
||||
<font size="6" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
|
||||
<img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
|
||||
</p>
|
||||
|
@ -147,7 +147,7 @@ class rwinfo_block_Core {
|
||||
}
|
||||
|
||||
// This came from modules/gallery/controllers/user_profile.php.
|
||||
private function _can_view_profile_pages($user) {
|
||||
static private function _can_view_profile_pages($user) {
|
||||
if (!$user->loaded()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -44,14 +44,15 @@ class rwinfo_theme_Core {
|
||||
}
|
||||
// rWatcher End Edit
|
||||
|
||||
// rWatcher Edit: Display profile instead of web site, if viewable.
|
||||
$str_owner_url = $item->owner->url;
|
||||
if (rwinfo_theme_Core::_can_view_profile_pages(identity::lookup_user($item->owner->id))) {
|
||||
$str_owner_url = user_profile::url($item->owner->id);
|
||||
}
|
||||
// rWatcher End Edit
|
||||
|
||||
if ($item->owner) {
|
||||
// rWatcher Edit: Display profile instead of web site, if viewable.
|
||||
$str_owner_url = $item->owner->url;
|
||||
if (rwinfo_theme_Core::_can_view_profile_pages(identity::lookup_user($item->owner->id))) {
|
||||
$str_owner_url = user_profile::url($item->owner->id);
|
||||
}
|
||||
// rWatcher End Edit
|
||||
|
||||
$results .= "<li>";
|
||||
if ($str_owner_url) { //rW Edit str_owner_url
|
||||
$results .= t("By: <a href=\"%owner_url\">%owner_name</a>",
|
||||
@ -66,7 +67,7 @@ class rwinfo_theme_Core {
|
||||
}
|
||||
|
||||
// This came from modules/gallery/controllers/user_profile.php.
|
||||
private function _can_view_profile_pages($user) {
|
||||
static private function _can_view_profile_pages($user) {
|
||||
if (!$user->loaded()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,298 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Grey Dragon Theme - a custom theme for Gallery 3
|
||||
* This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
|
||||
* Copyright (C) 2009-2011 Serguei Dosyukov
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<? $theme->load_sessioninfo(); ?>
|
||||
<!-- <?= $theme->themename ?> v.<?= $theme->themeversion ?> (<?= $theme->colorpack ?> : <?= $theme->framepack ?>) - Copyright (c) 2009-2011 Serguei Dosyukov - All Rights Reserved -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en" <?= ($theme->is_rtl)? "dir=rtl" : null; ?> >
|
||||
<?
|
||||
$item = $theme->item();
|
||||
if (($theme->enable_pagecache) and (isset($item))):
|
||||
// Page will expire in 60 seconds
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60).'GMT');
|
||||
header("Cache-Control: public");
|
||||
header("Cache-Control: post-check=3600, pre-check=43200", false);
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
endif;
|
||||
?>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<? $theme->start_combining("script,css") ?>
|
||||
<? if ($page_title): ?>
|
||||
<? $_title = $page_title ?>
|
||||
<? else: ?>
|
||||
<? if ($theme->item()): ?>
|
||||
<? $_title = $theme->bb2html($theme->item()->title, 2); ?>
|
||||
<? elseif ($theme->tag()): ?>
|
||||
<? $_title = t("Photos tagged with %tag_title", array("tag_title" => $theme->bb2html($theme->tag()->name, 2))) ?>
|
||||
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
||||
<? $_title = $theme->bb2html(item::root()->title, 2); ?>
|
||||
<? endif ?>
|
||||
<? endif ?>
|
||||
<title><?= $_title ?></title>
|
||||
<? if ($theme->disable_seosupport): ?>
|
||||
<meta name="robots" content="noindex, nofollow, noarchive" />
|
||||
<meta name="googlebot" content="noindex, nofollow, noarchive, nosnippet, noodp, noimageindex, notranslate" />
|
||||
<meta name="slurp" content="noindex, nofollow, noarchive, nosnippet, noodp, noydir" />
|
||||
<meta name="msnbot" content="noindex, nofollow, noarchive, nosnippet, noodp" />
|
||||
<meta name="teoma" content="noindex, nofollow, noarchive" />
|
||||
<? endif; ?>
|
||||
<!-- Internet Explorer 9 Meta tags : Start -->
|
||||
<meta name="application-name" content="<?= $_title; ?>" />
|
||||
<meta name="msapplication-tooltip" content="<?= t("Start"); ?> <?= $_title; ?>" />
|
||||
<meta name="msapplication-starturl" content="<?= item::root()->url() ?>" />
|
||||
<? if ($theme->allow_root_page): ?>
|
||||
<meta name="msapplication-task" content="name=<?= t("Gallery") ?>: <?= t("Root Page") ?>; action-uri=<?= item::root()->url(); ?>?root=yes; icon-uri=favicon.ico" />
|
||||
<meta name="msapplication-task" content="name=<?= t("Gallery") ?>: <?= t("Root Album") ?>; action-uri=<?= item::root()->url(); ?>?root=no; icon-uri=favicon.ico" />
|
||||
<? else: ?>
|
||||
<meta name="msapplication-task" content="name=<?= t("Gallery") ?>: <?= t("Root Album") ?>; action-uri=<?= item::root()->url(); ?>; icon-uri=favicon.ico" />
|
||||
<? endif; ?>
|
||||
<? if (identity::active_user()->admin): ?>
|
||||
<meta name="msapplication-task-separator" content="gallery3-greydragon" />
|
||||
<meta name="msapplication-task" content="name=<?= t("Admin") ?>: <?= t("Dashboard") ?>; action-uri=<?= url::site("admin"); ?>; icon-uri=favicon.ico" />
|
||||
<? endif; ?>
|
||||
<!-- Internet Explorer 9 Meta tags : End -->
|
||||
<link rel="shortcut icon" href="<?= $theme->favicon ?>" type="image/x-icon" />
|
||||
<? if ($theme->appletouchicon): ?>
|
||||
<link rel="apple-touch-icon" href="<?= $theme->appletouchicon; ?>"/>
|
||||
<? endif; ?>
|
||||
<?= $theme->script("json2-min.js") ?>
|
||||
<?= $theme->script("jquery.js") ?>
|
||||
<?= $theme->script("jquery.form.js") ?>
|
||||
<?= $theme->script("jquery-ui.js") ?>
|
||||
<?= $theme->script("gallery.common.js") ?>
|
||||
<? /* MSG_CANCEL is required by gallery.dialog.js */ ?>
|
||||
<script type="text/javascript">
|
||||
var MSG_CANCEL = <?= t('Cancel')->for_js() ?>;
|
||||
</script>
|
||||
<?= $theme->script("gallery.ajax.js"); ?>
|
||||
<?= $theme->script("gallery.dialog.js"); ?>
|
||||
|
||||
<? /* These are page specific but they get combined */ ?>
|
||||
<? if ($theme->page_subtype == "photo"): ?>
|
||||
<?= $theme->script("jquery.scrollTo.js"); ?>
|
||||
<? elseif ($theme->page_subtype == "movie"): ?>
|
||||
<?= $theme->script("flowplayer.js") ?>
|
||||
<? endif ?>
|
||||
|
||||
<?= $theme->head() ?>
|
||||
|
||||
<? // Theme specific CSS/JS goes last so that it can override module CSS/JS ?>
|
||||
<?= $theme->theme_js_inject(); ?>
|
||||
<?= $theme->theme_css_inject(); ?>
|
||||
<?= $theme->get_combined("css"); // LOOKING FOR YOUR CSS? It's all been combined into the link ?>
|
||||
<?= $theme->custom_css_inject(TRUE); ?>
|
||||
<?= $theme->get_combined("script") // LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link ?>
|
||||
|
||||
<!--[if IE 6]>
|
||||
<link rel="stylesheet" href="<?= $theme->url("css/old_ie.css") ?>" type="text/css" media="screen,print,projection" />
|
||||
<![endif]-->
|
||||
<? if ($theme->thumb_inpage): ?>
|
||||
<style type="text/css"> #g-column-bottom #g-thumbnav-block, #g-column-top #g-thumbnav-block { display: none; } </style>
|
||||
<? endif; ?>
|
||||
</head>
|
||||
<? if ($theme->item()):
|
||||
$item = $theme->item();
|
||||
else:
|
||||
$item = item::root();
|
||||
endif; ?>
|
||||
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= $theme->get_bodyclass(); ?>>
|
||||
<div class="QOverlay" style="left: 0px; top: 0px; width: 100%; height: 100%; position: fixed;">
|
||||
</div>
|
||||
<?= $theme->page_top() ?>
|
||||
<?= $theme->site_status() ?>
|
||||
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position == "bar")): ?>
|
||||
<style type="text/css"> html { margin-top: 30px !important; } </style>
|
||||
<div id="g-site-menu" class="g-<?= $theme->mainmenu_position; ?>">
|
||||
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
<div id="g-header">
|
||||
<?= $theme->header_top() ?>
|
||||
<? if ($theme->viewmode != "mini"): ?>
|
||||
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
|
||||
<span id="g-header-text"><?= $theme->bb2html($header_text, 1) ?></span>
|
||||
<? else: ?>
|
||||
<a id="g-logo" href="<?= item::root()->url() ?><?= ($theme->allow_root_page)? "?root=yes" : null; ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
|
||||
<img alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= $theme->logopath ?>" />
|
||||
</a>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position != "bar")): ?>
|
||||
<div id="g-site-menu" class="g-<?= $theme->mainmenu_position; ?>">
|
||||
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<?= $theme->messages() ?>
|
||||
<?= $theme->header_bottom() ?>
|
||||
|
||||
<? if ($theme->loginmenu_position == "header"): ?>
|
||||
<?= $theme->user_menu() ?>
|
||||
<? endif ?>
|
||||
|
||||
<?
|
||||
// Custom rWatcher code, based on the breadcrumb menu function.
|
||||
// The rest of this file is the original page.html.php file from the Grey Dragon theme.
|
||||
?>
|
||||
<? if (empty($breadcrumbs)): ?>
|
||||
|
||||
<? // This block is the original breadcrumb code ?>
|
||||
<? if (empty($parents)): ?>
|
||||
<?= $theme->breadcrumb_menu($theme, null); ?>
|
||||
<? else: ?>
|
||||
<?= $theme->breadcrumb_menu($theme, $parents); ?>
|
||||
<? endif; ?>
|
||||
<? // End Original Breadcrumb code, begin modified code. ?>
|
||||
|
||||
<? else: ?>
|
||||
<?
|
||||
// This is based on the libraries/My_Theme_View.php -> breadcrumb_menu function.
|
||||
$breadcrumb_content = "";
|
||||
if ($this->breadcrumbs_position == "hide"):
|
||||
else:
|
||||
$limit_title_length = module::get_var("gallery", "visible_title_length", 999);
|
||||
|
||||
$breadcrumb_content .= '<ul class="g-breadcrumbs g-' . $this->breadcrumbs_position . '">';
|
||||
$i = 0;
|
||||
foreach ($breadcrumbs as $breadcrumb):
|
||||
if ($breadcrumb->url):
|
||||
$breadcrumb_content .= '<li ' . (($i == 0)? " class=\"g-first\"" : null) . '>';
|
||||
$breadcrumb_content .= (($i > 0)? " :: " : null );
|
||||
$breadcrumb_content .= '<a href="' . $breadcrumb->url . '">';
|
||||
$breadcrumb_content .= text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length);
|
||||
$breadcrumb_content .= '</a></li>';
|
||||
else:
|
||||
$breadcrumb_content .= '<li class="g-active ' . (($i == 0)? " g-first" : null) . '"> '. (($i > 0)? " :: " : null ) . text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length) . '</li>';
|
||||
endif;
|
||||
$i++;
|
||||
endforeach;
|
||||
$breadcrumb_content .= '</ul>';
|
||||
endif;
|
||||
|
||||
print $breadcrumb_content;
|
||||
?>
|
||||
<? endif; // End Edit. ?>
|
||||
|
||||
|
||||
<?= $theme->custom_header(); ?>
|
||||
</div>
|
||||
<? if (($theme->page_subtype != "login") and ($theme->page_subtype != "reauthenticate") and ($theme->sidebarvisible == "top")): ?>
|
||||
<div id="g-column-top">
|
||||
<?= new View("sidebar.html") ?>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
<div id="g-main">
|
||||
<div id="g-main-in">
|
||||
<? if (!$theme->show_root_page): ?>
|
||||
<?= $theme->sidebar_menu($item->url()) ?>
|
||||
<div id="g-view-menu" class="g-buttonset<?= ($theme->sidebarallowed != "any")? " g-buttonset-shift" : null; ?>">
|
||||
<? if ($page_subtype == "album"): ?>
|
||||
<?= $theme->album_menu() ?>
|
||||
<? elseif ($page_subtype == "photo") : ?>
|
||||
<?= $theme->photo_menu() ?>
|
||||
<? elseif ($page_subtype == "movie") : ?>
|
||||
<?= $theme->movie_menu() ?>
|
||||
<? elseif ($page_subtype == "tag") : ?>
|
||||
<?= $theme->tag_menu() ?>
|
||||
<? endif ?>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
<? switch ($theme->sidebarvisible):
|
||||
case "left":
|
||||
echo '<div id="g-column-left">';
|
||||
$closediv = TRUE;
|
||||
break;
|
||||
case "none":
|
||||
case "top":
|
||||
case "bottom":
|
||||
if (($theme->thumb_inpage) and ($page_subtype == "photo")):
|
||||
echo '<div id="g-column-right">';
|
||||
$closediv = TRUE;
|
||||
else:
|
||||
$closediv = FALSE;
|
||||
endif;
|
||||
break;
|
||||
default:
|
||||
echo '<div id="g-column-right">';
|
||||
$closediv = TRUE;
|
||||
break;
|
||||
endswitch; ?>
|
||||
<? if (($theme->page_subtype != "login") and ($theme->page_subtype != "reauthenticate")): ?>
|
||||
<? if (($theme->sidebarvisible == "none") or ($theme->sidebarvisible == "bottom") or ($theme->sidebarvisible == "top")): ?>
|
||||
<? if (($theme->thumb_inpage) and ($page_subtype == "photo")): ?>
|
||||
<?= '<div class="g-toolbar"><h1> </h1></div>'; ?>
|
||||
<?= $theme->get_block_html("thumbnav"); ?>
|
||||
<? endif; ?>
|
||||
<? else: ?>
|
||||
<?= new View("sidebar.html") ?>
|
||||
<? endif; ?>
|
||||
<? endif ?>
|
||||
<?= ($closediv)? "</div>" : null; ?>
|
||||
|
||||
<? switch ($theme->sidebarvisible):
|
||||
case "left":
|
||||
echo '<div id="g-column-centerright">';
|
||||
break;
|
||||
case "none":
|
||||
case "top":
|
||||
case "bottom":
|
||||
if (($theme->thumb_inpage) and ($page_subtype == "photo")):
|
||||
echo '<div id="g-column-centerleft">';
|
||||
else:
|
||||
echo '<div id="g-column-centerfull">';
|
||||
endif;
|
||||
break;
|
||||
default:
|
||||
echo '<div id="g-column-centerleft">';
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
if ($theme->show_root_page):
|
||||
echo new View("rootpage.html");
|
||||
else:
|
||||
echo $content;
|
||||
endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? if (($theme->page_subtype != "login") and ($theme->page_subtype != "reauthenticate") and ($theme->sidebarvisible == "bottom")): ?>
|
||||
<div id="g-column-bottom">
|
||||
<?= new View("sidebar.html") ?>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
<div id="g-footer">
|
||||
<? if ($theme->viewmode != "mini"): ?>
|
||||
<?= $theme->footer() ?>
|
||||
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
|
||||
<span id="g-footer-text"><?= $theme->bb2html($footer_text, 1) ?></span>
|
||||
<? endif ?>
|
||||
<?= $theme->credits() ?>
|
||||
<ul id="g-footer-rightside"><li><?= $theme->copyright ?></li></ul>
|
||||
<? if ($theme->loginmenu_position == "default"): ?>
|
||||
<?= $theme->user_menu() ?>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
<?= $theme->custom_footer(); ?>
|
||||
</div>
|
||||
<?= $theme->page_bottom() ?>
|
||||
</body>
|
||||
</html>
|
@ -1,210 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Grey Dragon Theme - a custom theme for Gallery 3
|
||||
* This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
|
||||
* Copyright (C) 2009-2011 Serguei Dosyukov
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
// This is a generic paginator for album, photo and movie pages. Depending on the page type,
|
||||
// there are different sets of variables available. With this data, you can make a paginator
|
||||
// that lets you say "You're viewing photo 5 of 35", or "You're viewing photos 10 - 18 of 37"
|
||||
// for album views.
|
||||
//
|
||||
// Available variables for all page types:
|
||||
// $page_type - "collection", "item", or "other"
|
||||
// $page_subtype - "album", "movie", "photo", "tag", etc.
|
||||
// $previous_page_url - the url to the previous page, if there is one
|
||||
// $next_page_url - the url to the next page, if there is one
|
||||
// $total - the total number of photos in this album
|
||||
//
|
||||
// Available for the "collection" page types:
|
||||
// $page - what page number we're on
|
||||
// $max_pages - the maximum page number
|
||||
// $page_size - the page size
|
||||
// $first_page_url - the url to the first page, or null if we're on the first page
|
||||
// $last_page_url - the url to the last page, or null if we're on the last page
|
||||
// $first_visible_position - the position number of the first visible photo on this page
|
||||
// $last_visible_position - the position number of the last visible photo on this page
|
||||
//
|
||||
// Available for "item" page types:
|
||||
// $position - the position number of this photo
|
||||
//
|
||||
?>
|
||||
|
||||
<?
|
||||
$_pagelist = array();
|
||||
|
||||
// rWatcher Mod
|
||||
if (isset($dynamic_siblings)):
|
||||
$current_page = $position;
|
||||
$total_pages = count($dynamic_siblings);
|
||||
$siblings = $dynamic_siblings;
|
||||
for ($i = 1; $i <= $total_pages; $i++):
|
||||
if ($page_type == "item") {
|
||||
$_pagelist[$i] = url::site("tag_albums/show/" . $siblings[$i-1]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($siblings[$i-1]->name));
|
||||
} elseif ($page_type == "") {
|
||||
}
|
||||
endfor;
|
||||
else:
|
||||
// End rWatcher Mod.
|
||||
|
||||
switch ($page_type) {
|
||||
case "collection":
|
||||
if (isset($item)):
|
||||
$parent = $item->parent();
|
||||
endif;
|
||||
$current_page = $page;
|
||||
$total_pages = $max_pages;
|
||||
// Prepare page url list
|
||||
for ($i = 1; $i <= $total_pages; $i++):
|
||||
$_pagelist[$i] = url::site(url::merge(array("page" => $i)));
|
||||
endfor;
|
||||
break;
|
||||
case "item":
|
||||
if (isset($item)):
|
||||
$parent = $item->parent();
|
||||
endif;
|
||||
$current_page = $position;
|
||||
$total_pages = $total;
|
||||
if (isset($parent)):
|
||||
$siblings = $parent->children();
|
||||
for ($i = 1; $i <= $total; $i++):
|
||||
$_pagelist[$i] = $siblings[$i-1]->url();
|
||||
endfor;
|
||||
endif;
|
||||
break;
|
||||
default:
|
||||
$current_page = 1;
|
||||
$total_pages = 1;
|
||||
$_pagelist[1] = url::site();
|
||||
break;
|
||||
}
|
||||
|
||||
// rWatcher Mod
|
||||
endif;
|
||||
// End rWatcher Mod.
|
||||
|
||||
if ($total_pages <= 1):
|
||||
$pagination_msg = " ";
|
||||
else:
|
||||
$pagination_msg = t("Page:") . ' ';
|
||||
if ($total_pages < 13):
|
||||
for ($i = 1; $i <= $total_pages; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < $total_pages):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
elseif ($current_page < 9):
|
||||
for ($i = 1; $i <= 10; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < 10):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$pagination_msg .= '…';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages - 1] . '" title="' . t("Page") . ' ' . t($total_pages - 1) . '">' . t($total_pages - 1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages] . '" title="' . t("Page") . ' ' . t($total_pages) . '">' . t($total_pages) . '</a></span>';
|
||||
|
||||
elseif ($current_page > $total_pages - 8):
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[1] . '" title="' . t("Page") . ' ' . t(1) . '">' . t(1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[2] . '" title="' . t("Page") . ' ' . t(2) . '">' . t(2) . '</a></span>';
|
||||
$pagination_msg .= '…';
|
||||
|
||||
for ($i = $total_pages - 9; $i <= $total_pages; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < $total_pages):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[1] . '" title="' . t("Page") . ' ' . t(1) . '">' . t(1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[2] . '" title="' . t("Page") . ' ' . t(2) . '">' . t(2) . '</a></span>';
|
||||
$pagination_msg .= '…';
|
||||
|
||||
for ($i = $current_page - 5; $i <= $current_page + 5; $i++):
|
||||
if ($i == $current_page):
|
||||
$pagination_msg .= '<span>' . t($i) . '</span>';
|
||||
else:
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$i] . '" title="' . t("Page") . ' ' . t($i) . '">' . t($i) . '</a></span>';
|
||||
endif;
|
||||
if ($i < $current_page + 5):
|
||||
$pagination_msg .= '·';
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$pagination_msg .= '…';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages - 1] . '" title="' . t("Page") . ' ' . t($total_pages - 1) . '">' . t($total_pages - 1) . '</a></span>';
|
||||
$pagination_msg .= '·';
|
||||
$pagination_msg .= '<span><a href="' . $_pagelist[$total_pages] . '" title="' . t("Page") . ' ' . t($total_pages) . '">' . t($total_pages) . '</a></span>';
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<ul class="g-paginator">
|
||||
<li class="g-pagination"><?= $pagination_msg ?></li>
|
||||
<li class="g-navigation">
|
||||
<? if ($current_page > 1): ?>
|
||||
<a title="<?= t("first") ?>" id="g-navi-first" href="<?= $_pagelist[1] ?>"><span class="ui-icon ui-icon-first"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-first-d"> </span>
|
||||
<? endif ?>
|
||||
|
||||
<? if (isset($previous_page_url)): ?>
|
||||
<a title="<?= t("previous") ?>" id="g-navi-prev" href="<?= $previous_page_url ?>"><span class="ui-icon ui-icon-prev"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-prev-d"> </span>
|
||||
<? endif ?>
|
||||
|
||||
<? // rWatcher Mod. ?>
|
||||
<? if (isset($parent_url)): ?>
|
||||
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent_url ?>"><span class="ui-icon ui-icon-parent"> </span></a>
|
||||
<? elseif (isset($parent)): ?>
|
||||
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent->url("show={$item->id}"); ?>"><span class="ui-icon ui-icon-parent"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-parent-d"> </span>
|
||||
<? endif ?>
|
||||
<? // End rWatcher Mod. ?>
|
||||
|
||||
<? if (isset($next_page_url)): ?>
|
||||
<a title="<?= t("next") ?>" class="ui-right" id="g-navi-next" href="<?= $next_page_url ?>"><span class="ui-icon ui-icon-next"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-next-d"> </span>
|
||||
<? endif ?>
|
||||
|
||||
<? if ($current_page < $total_pages): ?>
|
||||
<a title="<?= t("last") ?>" class="ui-right" id="g-navi-last" href="<?= $_pagelist[$total_pages] ?>"><span class="ui-icon ui-icon-last"> </span></a>
|
||||
<? else: ?>
|
||||
<span class="ui-icon ui-icon-last-d"> </span>
|
||||
<? endif ?>
|
||||
</li>
|
||||
</ul>
|
@ -1,122 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Grey Dragon Theme - a custom theme for Gallery 3
|
||||
* This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
|
||||
* Copyright (C) 2009-2011 Serguei Dosyukov
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
if ($theme->desc_allowbbcode):
|
||||
$_description = $theme->bb2html($item->description, 1);
|
||||
else:
|
||||
$_description = nl2br(html::purify($item->description));
|
||||
endif;
|
||||
|
||||
if ($theme->is_photometa_visible):
|
||||
$_description .= '<ul class="g-metadata">' . $theme->thumb_info($item) . '</ul>';
|
||||
endif;
|
||||
|
||||
switch ($theme->photo_popupbox):
|
||||
case "preview":
|
||||
$include_list = FALSE;
|
||||
$include_single = TRUE;
|
||||
break;
|
||||
case "none":
|
||||
$include_list = FALSE;
|
||||
$include_single = FALSE;
|
||||
break;
|
||||
default:
|
||||
$include_list = TRUE;
|
||||
$include_single = TRUE;
|
||||
break;
|
||||
endswitch;
|
||||
?>
|
||||
|
||||
<div id="g-item">
|
||||
<? $_title = $theme->bb2html(html::purify($item->title), 1); ?>
|
||||
<div id="g-info">
|
||||
<h1><?= $_title ?></h1>
|
||||
</div>
|
||||
<?= $theme->add_paginator("top", FALSE); ?>
|
||||
<?= $theme->photo_top() ?>
|
||||
<? if (($theme->photo_descmode == "top") and ($_description)): ?>
|
||||
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
|
||||
<? endif; ?>
|
||||
<div id="g-photo">
|
||||
<?= $theme->resize_top($item) ?>
|
||||
<? $_resizewidth = $item->resize_width;
|
||||
// rWatcher Modification.
|
||||
//ORIGINAL LINE $siblings = $item->parent()->children();
|
||||
$siblings = "";
|
||||
if (isset($dynamic_siblings)) {
|
||||
$siblings = $dynamic_siblings;
|
||||
} else {
|
||||
$siblings = $item->parent()->children();
|
||||
}
|
||||
// End rWatcher Modification
|
||||
?>
|
||||
|
||||
<div class="g-resize" style="margin-left: -<?= intval($_resizewidth / 2); ?>px; ">
|
||||
<? $script = "<script type=\"text/javascript\">\n";
|
||||
$script .= " if (document.images) {\n";
|
||||
for ($i = 0; ($i <= count($siblings) - 1); $i++):
|
||||
if ($siblings[$i]->rand_key == $item->rand_key): ?>
|
||||
<a style="<?= ($siblings[$i]->rand_key == $item->rand_key)? "display: static;" : "display: none;"; ?>" title="<?= $theme->bb2html(html::purify($item->title), 2) ?>" <?= ($include_single)? "class=\"g-sb-preview\"" : "target=_blank;"; ?> <?= ($include_list)? "rel=\"g-preview\"" : null; ?> href="<?= (access::can("view_full", $item))? $item->file_url() : $item->resize_url(); ?>">
|
||||
<?= $item->resize_img(array("id" => "g-photo-id-{$item->id}", "class" => "g-resize", "alt" => $_title)) ?>
|
||||
</a>
|
||||
<? if ($i < count($siblings) - 1):
|
||||
$script .= " var image_preload_n = new Image();\n image_preload_n.src = \"" . $siblings[$i+1]->resize_url() . "\";\n";
|
||||
endif;
|
||||
if ($i > 0):
|
||||
$script .= " var image_preload_p = new Image();\n image_preload_p.src = \"" . $siblings[$i-1]->resize_url() . "\";\n";
|
||||
endif;
|
||||
else:
|
||||
if ($include_list): ?>
|
||||
<? if (!$siblings[$i]->is_album()): ?>
|
||||
<a title="<?= $theme->bb2html(html::purify($siblings[$i]->title), 2) ?>" class="g-sb-preview g-hide" rel="g-preview" href="<?= (access::can("view_full", $siblings[$i]))? $siblings[$i]->file_url() : $siblings[$i]->resize_url(); ?>"> </a>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
<? endfor; ?>
|
||||
<? $script .= " }\n</script>\n"; ?>
|
||||
<? $_align = "";
|
||||
if ($_description):
|
||||
switch ($theme->photo_descmode):
|
||||
case "overlay_top":
|
||||
$_align = "g-align-top";
|
||||
break;
|
||||
case "overlay_bottom":
|
||||
$_align = "g-align-bottom";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
endswitch;
|
||||
endif; ?>
|
||||
<? if ($_align): ?>
|
||||
<span class="g-more <?= $_align ?>"><?= t("More") ?></span>
|
||||
<div class="g-description <?= $_align; ?>" style="width: <?= $_resizewidth - 20; ?>px;" >
|
||||
<strong><?= $_title ?></strong>
|
||||
<?= $_description ?>
|
||||
</div>
|
||||
<? endif ?>
|
||||
</div>
|
||||
<?= $theme->resize_bottom($item) ?>
|
||||
</div>
|
||||
<? if (($theme->photo_descmode == "bottom") and ($_description)): ?>
|
||||
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
|
||||
<? endif; ?>
|
||||
<?= $theme->add_paginator("bottom", FALSE); ?>
|
||||
<?= $theme->photo_bottom() ?>
|
||||
</div>
|
||||
<?= $script ?>
|
@ -1,239 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access."); ?>
|
||||
<?
|
||||
// Used album.html.php as starting point.
|
||||
// The g-info block was taken from album.html.php and $theme->album_top() was changed to $theme->dynamic_top().
|
||||
// $item->title and $item->description have been changed to $title and $description.
|
||||
//
|
||||
// The g-album-grid block was also taken from album.html.php. The section for uploading new photos to an empty album
|
||||
// has been removed. Also, $theme->context_menu has been removed as well (it was crashing the page).
|
||||
?>
|
||||
|
||||
<div id="g-album-header">
|
||||
<?= $theme->dynamic_top() ?>
|
||||
<h1><?= $theme->bb2html(html::purify($title), 1) ?></h1>
|
||||
</div>
|
||||
|
||||
<?= $theme->add_paginator("top"); ?>
|
||||
|
||||
<? if (($theme->album_descmode == "top") and ($description)): ?>
|
||||
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
|
||||
<? endif; ?>
|
||||
|
||||
<? if (isset($filter_text) && (module::get_var("tag_albums", "tag_index_filter"))): ?>
|
||||
<div id="g-tags-filter">
|
||||
<br/ >
|
||||
<center><?= $filter_text; ?></center>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<div class="g-album-grid-container">
|
||||
<ul id="g-album-grid" class="<?= $theme->get_grid_column_class(); ?>">
|
||||
<?
|
||||
if (count($children)):
|
||||
$siblings = $all_siblings;
|
||||
if (($theme->disablephotopage) && (count($siblings) > count($children))):
|
||||
$j = 0;
|
||||
foreach ($siblings as $i => $sibling):
|
||||
//if ($sibling->rand_key == $children[$j]->rand_key):
|
||||
if ($sibling->id == $children[$j]->item_id):
|
||||
//echo $theme->get_thumb_element($sibling, !$theme->hidecontextmenu);
|
||||
echo rw_get_thumb_element($children[$j], $theme);
|
||||
if ($j + 1 < count($children)):
|
||||
$j++;
|
||||
endif;
|
||||
else:
|
||||
echo $theme->get_thumb_link($sibling);
|
||||
//echo rw_get_thumb_link($sibling, $theme);
|
||||
endif;
|
||||
endforeach;
|
||||
else:
|
||||
foreach ($children as $i => $child):
|
||||
//echo $theme->get_thumb_element($child, !$theme->hidecontextmenu);
|
||||
echo rw_get_thumb_element($child, $theme);
|
||||
endforeach;
|
||||
endif;
|
||||
else: ?>
|
||||
<li><?= t("There aren't any photos here yet!") ?></li>
|
||||
<? endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?= $theme->dynamic_bottom() ?>
|
||||
|
||||
<? if (($theme->album_descmode == "bottom") and ($description)): ?>
|
||||
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
|
||||
<? endif; ?>
|
||||
|
||||
<?= $theme->add_paginator("bottom"); ?>
|
||||
|
||||
<?
|
||||
function rw_get_thumb_link($item, $theme) {
|
||||
// This code is based on grey dragon's get_thumb_link function.
|
||||
// Change all $this to $theme
|
||||
if ($item->is_album()):
|
||||
return "";
|
||||
endif;
|
||||
|
||||
/*
|
||||
if (access::can("view_full", $item)):
|
||||
$direct_link = $item->file_url();
|
||||
else:
|
||||
$direct_link = $item->resize_url();
|
||||
endif;*/
|
||||
$direct_link = $child->full_or_resize_url();
|
||||
|
||||
return '<a title="' . $theme->bb2html(html::purify($item->title), 2) . '" style="display: none;" class="g-sb-preview" rel="g-preview" href="' . $direct_link . '"> </a>';
|
||||
}
|
||||
|
||||
function rw_get_thumb_element($child, $theme) {
|
||||
// This code is based on grey dragon's get_thumb_element function.
|
||||
// Change all $item to $child
|
||||
// Change all $this to $theme
|
||||
$thumb_item = $child;
|
||||
if ($theme->thumb_random):
|
||||
if ($child->is_album() && ($rnd = item::random_query()->where("parent_id", "=", $child->id)->find()) && $rnd->loaded()):
|
||||
$thumb_item = $rnd;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$item_class = $child->is_album() ? "g-album" : "g-photo";
|
||||
$content = '<li id="g-item-id-' . $child->id . '" class="g-item ' . $item_class . ' ' . $theme->thumb_type;
|
||||
if ($child->is_album()):
|
||||
$_thumb_descmode = $theme->thumb_descmode_a;
|
||||
else:
|
||||
$_thumb_descmode = $theme->thumb_descmode;
|
||||
endif;
|
||||
|
||||
$content .= ($_thumb_descmode == "bottom")? " g-expanded" : " g-default";
|
||||
|
||||
if ($thumb_item->has_thumb()):
|
||||
$is_portrait = ($thumb_item->thumb_height > $thumb_item->thumb_width);
|
||||
$_shift = "";
|
||||
switch ($theme->thumb_imgalign):
|
||||
case "center":
|
||||
if (($theme->crop_factor == 1) and (!$is_portrait)):
|
||||
$_shift = 'style="margin-top: ' . intval(($theme->_thumb_size_y - $thumb_item->thumb_height) / 2) . 'px;"';
|
||||
elseif ($theme->crop_factor > 0):
|
||||
$_shift = 'style="margin-top: -' . intval(($thumb_item->thumb_height - $theme->_thumb_size_y) / 2) . 'px;"';
|
||||
endif;
|
||||
break;
|
||||
case "bottom":
|
||||
if (($theme->crop_factor == 1) and (!$is_portrait)):
|
||||
$_shift = 'style="margin-top: ' . intval($theme->_thumb_size_y - $thumb_item->thumb_height) . 'px;"';
|
||||
elseif ($theme->crop_factor > 0):
|
||||
$_shift = 'style="margin-top: -' . intval($thumb_item->thumb_height - $theme->_thumb_size_y) . 'px;"';
|
||||
endif;
|
||||
break;
|
||||
case "fit":
|
||||
break;
|
||||
case "top":
|
||||
default:
|
||||
break;
|
||||
endswitch;
|
||||
else:
|
||||
$is_portrait = FALSE;
|
||||
$_shift = 'style="margin-top: 0px;"';
|
||||
endif;
|
||||
|
||||
$content .= ($is_portrait)? " g-portrait" : " g-landscape";
|
||||
$content .= '">' . $theme->thumb_top($child);
|
||||
|
||||
$content .= '<div class="g-thumbslide">';
|
||||
$thumb_content = '<p class="g-thumbcrop">';
|
||||
|
||||
$use_direct_link = (($theme->disablephotopage) && (!$child->is_album()));
|
||||
$class_name = "g-thumblink";
|
||||
if ($use_direct_link):
|
||||
$class_name .= ' g-sb-preview" rel="g-preview';
|
||||
//if (access::can("view_full", $child)):
|
||||
//$direct_link = $child->file_url();
|
||||
//else:
|
||||
$direct_link = $child->full_or_resize_url();
|
||||
//endif;
|
||||
else:
|
||||
$direct_link = $child->url();
|
||||
endif;
|
||||
|
||||
if ($use_direct_link && module::is_active("exif") && module::info("exif")):
|
||||
$thumb_content .= '<a class="g-meta-exif-link g-dialog-link" href="' . url::site("exif/show/{$child->id}") . '" title="' . t("Photo details")->for_html_attr() . '"> </a>';
|
||||
endif;
|
||||
|
||||
$thumb_content .= '<a title="' . $theme->bb2html(html::purify($child->title), 2) . '" '. $_shift . ' class="' . $class_name . '" href="' . $direct_link . '">';
|
||||
if ($thumb_item->has_thumb()):
|
||||
if (($theme->crop_factor > 1) && ($theme->thumb_imgalign == "fit")):
|
||||
if ($thumb_item->thumb_height > $theme->_thumb_size_y):
|
||||
if ($is_portrait):
|
||||
$_max = $theme->_thumb_size_y;
|
||||
else:
|
||||
$_max = intval($theme->_thumb_size_x * ($theme->_thumb_size_y / $thumb_item->thumb_height));
|
||||
endif;
|
||||
else:
|
||||
$_max = $theme->_thumb_size_x;
|
||||
endif;
|
||||
$_max = min($thumb_item->thumb_width, $_max);
|
||||
$thumb_content .= $thumb_item->thumb_img(array(), $_max);
|
||||
else:
|
||||
$thumb_content .= $thumb_item->thumb_img();
|
||||
endif;
|
||||
else:
|
||||
$thumb_content .= '<img title="No Image" alt="No Image" src="' . $theme->url("images/missing-img.png") . '"/>';
|
||||
endif;
|
||||
$thumb_content .= '</a></p>';
|
||||
|
||||
if (($theme->thumb_metamode != "hide") and ($_thumb_descmode == "overlay_bottom")):
|
||||
$_thumb_metamode = "merged";
|
||||
else:
|
||||
$_thumb_metamode = $theme->thumb_metamode;
|
||||
endif;
|
||||
|
||||
if (($_thumb_descmode == "overlay") or ($_thumb_descmode == "overlay_top") or ($_thumb_descmode == "overlay_bottom")):
|
||||
$thumb_content .= '<ul class="g-description ';
|
||||
if ($_thumb_descmode == "overlay_top"):
|
||||
$thumb_content .= 'g-overlay-top';
|
||||
endif;
|
||||
if ($_thumb_descmode == "overlay_bottom"):
|
||||
$thumb_content .= 'g-overlay-bottom';
|
||||
endif;
|
||||
$thumb_content .= '"><li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
|
||||
if ($_thumb_metamode == "merged"):
|
||||
$thumb_content .= $theme->thumb_info($child);
|
||||
endif;
|
||||
$thumb_content .= '</ul>';
|
||||
endif;
|
||||
|
||||
if (($_thumb_metamode == "default") and ($_thumb_descmode != "overlay_bottom")):
|
||||
$thumb_content .= '<ul class="g-metadata">' . $theme->thumb_info($child) . '</ul>';
|
||||
endif;
|
||||
|
||||
if ($_thumb_descmode == "bottom"):
|
||||
$thumb_content .= '<ul class="g-description">';
|
||||
$thumb_content .= '<li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
|
||||
if ($_thumb_metamode == "merged"):
|
||||
$thumb_content .= $theme->thumb_info($item);
|
||||
endif;
|
||||
$thumb_content .= '</ul>';
|
||||
endif;
|
||||
|
||||
/*
|
||||
if ($addcontext):
|
||||
$_text = $this->context_menu($item, "#g-item-id-{$item->id} .g-thumbnail");
|
||||
$thumb_content .= (stripos($_text, '<li>'))? $_text : null;
|
||||
endif;
|
||||
*/
|
||||
try {
|
||||
$view = new View("frame.html");
|
||||
$view->thumb_content = $thumb_content;
|
||||
$content .= $view;
|
||||
} catch (Exception $e) {
|
||||
$content .= $thumb_content;
|
||||
}
|
||||
|
||||
$content .= '</div>';
|
||||
$content .= $theme->thumb_bottom($child);
|
||||
$content .= '</li>';
|
||||
|
||||
return $content;
|
||||
//print $content;
|
||||
// End of modified function code.
|
||||
}
|
||||
?>
|
@ -1,204 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<? $theme->start_combining("script,css") ?>
|
||||
<title>
|
||||
<? if ($page_title): ?>
|
||||
<?= $page_title ?>
|
||||
<? else: ?>
|
||||
<? if ($theme->item()): ?>
|
||||
<?= $theme->item()->title ?>
|
||||
<? elseif ($theme->tag()): ?>
|
||||
<?= t("Photos tagged with %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
||||
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
||||
<?= item::root()->title ?>
|
||||
<? endif ?>
|
||||
<? endif ?>
|
||||
</title>
|
||||
<link rel="shortcut icon"
|
||||
href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>"
|
||||
type="image/x-icon" />
|
||||
|
||||
<? if ($theme->page_type == "collection"): ?>
|
||||
<? if ($thumb_proportion != 1): ?>
|
||||
<? $new_width = round($thumb_proportion * 213) ?>
|
||||
<? $new_height = round($thumb_proportion * 240) ?>
|
||||
<style type="text/css">
|
||||
.g-view #g-content #g-album-grid .g-item {
|
||||
width: <?= $new_width ?>px;
|
||||
height: <?= $new_height ?>px;
|
||||
/* <?= $thumb_proportion ?> */
|
||||
}
|
||||
</style>
|
||||
<? endif ?>
|
||||
<? endif ?>
|
||||
|
||||
<?= $theme->script("json2-min.js") ?>
|
||||
<?= $theme->script("jquery.js") ?>
|
||||
<?= $theme->script("jquery.form.js") ?>
|
||||
<?= $theme->script("jquery-ui.js") ?>
|
||||
<?= $theme->script("gallery.common.js") ?>
|
||||
<? /* MSG_CANCEL is required by gallery.dialog.js */ ?>
|
||||
<script type="text/javascript">
|
||||
var MSG_CANCEL = <?= t('Cancel')->for_js() ?>;
|
||||
</script>
|
||||
<?= $theme->script("gallery.ajax.js") ?>
|
||||
<?= $theme->script("gallery.dialog.js") ?>
|
||||
<?= $theme->script("superfish/js/superfish.js") ?>
|
||||
<?= $theme->script("jquery.localscroll.js") ?>
|
||||
|
||||
<? /* These are page specific but they get combined */ ?>
|
||||
<? if ($theme->page_subtype == "photo"): ?>
|
||||
<?= $theme->script("jquery.scrollTo.js") ?>
|
||||
<?= $theme->script("gallery.show_full_size.js") ?>
|
||||
<? elseif ($theme->page_subtype == "movie"): ?>
|
||||
<?= $theme->script("flowplayer.js") ?>
|
||||
<? endif ?>
|
||||
|
||||
<?= $theme->head() ?>
|
||||
|
||||
<? /* Theme specific CSS/JS goes last so that it can override module CSS/JS */ ?>
|
||||
<?= $theme->script("ui.init.js") ?>
|
||||
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
||||
<?= $theme->css("superfish/css/superfish.css") ?>
|
||||
<? if (module::get_var("theme_clean_canvas", "color_variant") == "dark" ): ?>
|
||||
<?= $theme->css("dark/themeroller/ui.base.css") ?>
|
||||
<?= $theme->css("dark/screen_colors.css") ?>
|
||||
<?= $theme->css("dark/screen_candy.css") ?>
|
||||
<? else: ?>
|
||||
<?= $theme->css("clean/themeroller/ui.base.css") ?>
|
||||
<?= $theme->css("clean/screen_colors.css") ?>
|
||||
<?= $theme->css("clean/screen_candy.css") ?>
|
||||
<? endif ?>
|
||||
<?= $theme->css("screen_layout_base.css") ?>
|
||||
<?= $theme->css("screen_fonts.css") ?>
|
||||
<? if (module::get_var("theme_clean_canvas", "wide")): ?>
|
||||
<?= $theme->css("screen_layout_wide.css") ?>
|
||||
<? else: ?>
|
||||
<?= $theme->css("screen_layout_fixed.css") ?>
|
||||
<? endif ?>
|
||||
<!--[if lte IE 8]>
|
||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
||||
media="screen,print,projection" />
|
||||
<![endif]-->
|
||||
|
||||
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
|
||||
<?= $theme->get_combined("script") ?>
|
||||
|
||||
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
|
||||
<?= $theme->get_combined("css") ?>
|
||||
</head>
|
||||
|
||||
<body <?= $theme->body_attributes() ?>>
|
||||
<?= $theme->page_top() ?>
|
||||
<? if (module::get_var("theme_clean_canvas", "wide")): ?>
|
||||
<div id="doc3" class="yui-t5 g-view">
|
||||
<? else: ?>
|
||||
<div id="doc4" class="yui-t5 g-view">
|
||||
<? endif ?>
|
||||
<?= $theme->site_status() ?>
|
||||
<div id="g-header" class="ui-helper-clearfix">
|
||||
<div id="g-banner">
|
||||
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
|
||||
<?= $header_text ?>
|
||||
<? else: ?>
|
||||
<a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
|
||||
<img width="128" height="44" alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= $theme->url("images/canvaslogo.png") ?>" />
|
||||
</a>
|
||||
<? endif ?>
|
||||
<?= $theme->user_menu() ?>
|
||||
<?= $theme->header_top() ?>
|
||||
<div id="g-banner-languages">
|
||||
<? $locales = locales::installed(); ?>
|
||||
<? if (count($locales) > 1 ) { ?>
|
||||
<? foreach ($locales as $locale => $display_name) { ?>
|
||||
<? $locales[$locale] = SafeString::of_safe_html($display_name); ?>
|
||||
<? } ?>
|
||||
<? $lang_content = new View("user_languages_block.html"); ?>
|
||||
<? $lang_content->installed_locales = array_merge(array("" => t("« none »")), $locales); ?>
|
||||
<? $lang_content->selected = (string) locales::cookie_locale(); ?>
|
||||
<?= $lang_content ?>
|
||||
<? } ?>
|
||||
</div>
|
||||
|
||||
<!-- hide the menu until after the page has loaded, to minimize menu flicker -->
|
||||
<div id="g-site-menu" style="visibility: hidden">
|
||||
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
|
||||
</div>
|
||||
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
||||
<?= $theme->header_bottom() ?>
|
||||
</div>
|
||||
|
||||
<? // rWatcher EDIT: The following code was modifed to allow module-defined breadcrumbs.
|
||||
// Everything else in this file is a copy of the default page.html.php file.
|
||||
?>
|
||||
<? if (!empty($breadcrumbs)): ?>
|
||||
<ul class="g-breadcrumbs">
|
||||
<? $i = 0 ?>
|
||||
<? foreach ($breadcrumbs as $breadcrumb): ?>
|
||||
<li<? if ($i == 0) print " class=\"g-first\"" ?>>
|
||||
<!-- Adding ?show=<id> causes Gallery3 to display the page
|
||||
containing that photo. For now, we just do it for
|
||||
the immediate parent so that when you go back up a
|
||||
level you're on the right page. -->
|
||||
<? if ($breadcrumb->url) : ?>
|
||||
<a href="<?= $breadcrumb->url ?>">
|
||||
<? // limit the title length to something reasonable (defaults to 15) ?>
|
||||
<?= html::purify(text::limit_chars($breadcrumb->title,
|
||||
module::get_var("gallery", "visible_title_length"))) ?>
|
||||
</a>
|
||||
<? else : ?>
|
||||
<?= html::purify(text::limit_chars($breadcrumb->title,
|
||||
module::get_var("gallery", "visible_title_length"))) ?>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<? $i++ ?>
|
||||
<? endforeach ?>
|
||||
</ul>
|
||||
<? endif ?>
|
||||
<? // End modified code ?>
|
||||
|
||||
</div>
|
||||
<div id="bd">
|
||||
<div id="yui-main">
|
||||
<div class="yui-b">
|
||||
<div id="g-content" class="yui-g">
|
||||
<?= $theme->messages() ?>
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? if (!($theme->item() && !empty($parents))): ?>
|
||||
<style type="text/css">
|
||||
/* No breadcrums, position adaption for sidebar needed */
|
||||
#g-sidebar
|
||||
{
|
||||
top: 6px;
|
||||
}
|
||||
</style>
|
||||
<? endif ?>
|
||||
<div id="g-sidebar" class="yui-b">
|
||||
<? if ($theme->page_subtype != "login"): ?>
|
||||
<?= new View("sidebar.html") ?>
|
||||
<? endif ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="g-footer" class="ui-helper-clearfix">
|
||||
<?= $theme->footer() ?>
|
||||
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
|
||||
<?= $footer_text ?>
|
||||
<? endif ?>
|
||||
|
||||
<? if (module::get_var("gallery", "show_credits")): ?>
|
||||
<ul id="g-credits" class="g-inline">
|
||||
<?= $theme->credits() ?>
|
||||
</ul>
|
||||
<? endif ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= $theme->page_bottom() ?>
|
||||
</body>
|
||||
</html>
|
@ -65,9 +65,13 @@ class Admin_Tag_Albums_Controller extends Admin_Controller {
|
||||
$tag_albums_tagsort_group->checklist("tag_index_scope")
|
||||
->options($tag_index_scope_options);
|
||||
|
||||
$tag_index_filter_options["tag_index_filter"] = Array(t("Display filter links on \"All Tags\" album pages?"), module::get_var("tag_albums", "tag_index_filter"));
|
||||
$tag_albums_tagsort_group->checklist("tag_index_filter")
|
||||
->options($tag_index_filter_options);
|
||||
$tag_index_filter_top_options["tag_index_filter_top"] = Array(t("Display filter links on the top of \"All Tags\" album pages?"), module::get_var("tag_albums", "tag_index_filter_top"));
|
||||
$tag_albums_tagsort_group->checklist("tag_index_filter_top")
|
||||
->options($tag_index_filter_top_options);
|
||||
|
||||
$tag_index_filter_bottom_options["tag_index_filter_bottom"] = Array(t("Display filter links on the bottom of \"All Tags\" album pages?"), module::get_var("tag_albums", "tag_index_filter_bottom"));
|
||||
$tag_albums_tagsort_group->checklist("tag_index_filter_bottom")
|
||||
->options($tag_index_filter_bottom_options);
|
||||
|
||||
$tag_albums_tagitemsort_group = $form->group("Tag_Albums_Tag_Item_Sort")->label(t("\"All Tags\" Sub-Album Preferences"));
|
||||
$tag_albums_tagitemsort_group->dropdown("subalbum_sort_by")
|
||||
@ -104,7 +108,8 @@ class Admin_Tag_Albums_Controller extends Admin_Controller {
|
||||
module::set_var("tag_albums", "tag_page_title", $form->Tag_Albums_Tag_Sort->tag_page_title->value);
|
||||
module::set_var("tag_albums", "tag_index", $form->Tag_Albums_Tag_Sort->tag_index->value);
|
||||
module::set_var("tag_albums", "tag_index_scope", count($form->Tag_Albums_Tag_Sort->tag_index_scope->value));
|
||||
module::set_var("tag_albums", "tag_index_filter", count($form->Tag_Albums_Tag_Sort->tag_index_filter->value));
|
||||
module::set_var("tag_albums", "tag_index_filter_top", count($form->Tag_Albums_Tag_Sort->tag_index_filter_top->value));
|
||||
module::set_var("tag_albums", "tag_index_filter_bottom", count($form->Tag_Albums_Tag_Sort->tag_index_filter_bottom->value));
|
||||
module::set_var("tag_albums", "tag_sort_by", $form->Tag_Albums_Tag_Sort->tag_sort_by->value);
|
||||
module::set_var("tag_albums", "tag_sort_direction", $form->Tag_Albums_Tag_Sort->tag_sort_direction->value);
|
||||
module::set_var("tag_albums", "subalbum_sort_by", $form->Tag_Albums_Tag_Item_Sort->subalbum_sort_by->value);
|
||||
|
@ -18,284 +18,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class tag_albums_Controller extends Controller {
|
||||
public function make_tag_album_cover($id, $tag_id, $album_id) {
|
||||
if (!identity::active_user()->admin) {
|
||||
message::error(t("You do not have sufficient privileges to do this"));
|
||||
url::redirect("tag_albums/show/" . $id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($item->name));
|
||||
}
|
||||
|
||||
$item = ORM::factory("item", $id);
|
||||
|
||||
if (($album_id > 0) && ($tag_id == 0)) {
|
||||
// If we are dealing with a dynamic album, set it's thumbnail to this pics.
|
||||
// Based on modules/gallery/helpers/item.php
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
if (count($album_tags) > 0) {
|
||||
$parent = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$parent->album_cover_item_id = $item->id;
|
||||
$parent->thumb_dirty = 1;
|
||||
graphics::generate($parent);
|
||||
$parent->save();
|
||||
|
||||
$grand_parent = $parent->parent();
|
||||
if ($grand_parent && access::can("edit", $grand_parent) &&
|
||||
$grand_parent->album_cover_item_id == null) {
|
||||
item::make_album_cover($parent);
|
||||
}
|
||||
}
|
||||
message::success(t("Made " . $item->title . " this album's cover"));
|
||||
url::redirect("tag_albums/show/" . $id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($item->name));
|
||||
} else {
|
||||
// If setting a thumbnail for an auto-generated all tags->tag album.
|
||||
$record = ORM::factory("tags_album_tag_cover")->where("tag_id", "=", $tag_id)->find();
|
||||
if (!$record->loaded()) {
|
||||
$record->tag_id = $tag_id;
|
||||
}
|
||||
$record->photo_id = $id;
|
||||
$record->save();
|
||||
message::success(t("Made " . $item->title . " this album's cover"));
|
||||
url::redirect("tag_albums/show/" . $id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($item->name));
|
||||
}
|
||||
}
|
||||
|
||||
public function album($id) {
|
||||
// Displays a dynamic page containing items that have been
|
||||
// tagged with one or more tags.
|
||||
|
||||
// Load the specified ID to make sure it exists.
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $id)
|
||||
->find_all();
|
||||
|
||||
// If it doesn't exist, redirect to the modules root page.
|
||||
if (count($album_tags) == 0) {
|
||||
url::redirect("tag_albums/");
|
||||
}
|
||||
|
||||
// If it does exist, and is set to *, load a list of all tags.
|
||||
if ($album_tags[0]->tags == "*") {
|
||||
$this->index($id, "");
|
||||
} else {
|
||||
// Otherwise, populate this page with the specified items.
|
||||
|
||||
// Inherit permissions, title and description from the album that linked to this page.
|
||||
$album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
access::required("view", $album);
|
||||
$page_title = $album->title;
|
||||
$page_description = $album->description;
|
||||
|
||||
// URL to this page
|
||||
$str_page_url = "tag_albums/album/" . $id . "/" . urlencode($album->name);
|
||||
|
||||
// Determine page sort order.
|
||||
$sort_page_field = $album->sort_column;
|
||||
$sort_page_direction = $album->sort_order;
|
||||
|
||||
// Determine search type (AND/OR) and generate an array of the tag ids.
|
||||
$tag_ids = Array();
|
||||
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
|
||||
$tag = ORM::factory("tag")->where("name", "=", trim($tag_name))->find();
|
||||
if ($tag->loaded()) {
|
||||
$tag_ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$album_tags_search_type = $album_tags[0]->search_type;
|
||||
|
||||
// Figure out how many items to display on each page.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
|
||||
// If this page was reached from a breadcrumb, figure out what page to load from the show id.
|
||||
$show = Input::instance()->get("show");
|
||||
if ($show) {
|
||||
$child = ORM::factory("item", $show);
|
||||
$index = $this->_get_position($child->$sort_page_field, $child->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
|
||||
if ($index) {
|
||||
$page = ceil($index / $page_size);
|
||||
if ($page == 1) {
|
||||
url::redirect($str_page_url);
|
||||
} else {
|
||||
url::redirect($str_page_url . "?page=$page");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out how many items are in this "virtual album"
|
||||
$count = $this->_count_records($tag_ids, $album_tags_search_type, true);
|
||||
|
||||
// Figure out which page # the visitor is on and
|
||||
// don't allow the visitor to go below page 1.
|
||||
$page = Input::instance()->get("page", 1);
|
||||
if ($page < 1) {
|
||||
url::redirect($str_page_url);
|
||||
}
|
||||
|
||||
// First item to display.
|
||||
$offset = ($page - 1) * $page_size;
|
||||
|
||||
// Figure out what the highest page number is.
|
||||
$max_pages = ceil($count / $page_size);
|
||||
|
||||
// Don't let the visitor go past the last page.
|
||||
if ($max_pages && $page > $max_pages) {
|
||||
url::redirect($str_page_url . "/?page=$max_pages");
|
||||
}
|
||||
|
||||
// Figure out which items to display on this page and store their details in $children.
|
||||
$tag_children = $this->_get_records($tag_ids, $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
|
||||
|
||||
// Set up the previous and next page buttons.
|
||||
if ($page > 1) {
|
||||
$previous_page = $page - 1;
|
||||
$view->previous_page_link = url::site($str_page_url . "/?page={$previous_page}");
|
||||
}
|
||||
if ($page < $max_pages) {
|
||||
$next_page = $page + 1;
|
||||
$view->next_page_link = url::site($str_page_url . "/?page={$next_page}");
|
||||
}
|
||||
|
||||
// Set up breadcrumbs.
|
||||
$tag_album_breadcrumbs = array();
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($album->title, $album->url())->set_last();
|
||||
$parent_item = ORM::factory("item", $album->parent_id);
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $album->id;
|
||||
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
|
||||
// Set up and display the actual page.
|
||||
$parent_album = ORM::factory("item", $album->parent_id);
|
||||
//$template = new Theme_View("calpage.html", "collection", "Tag Albums");
|
||||
$template = new Theme_View("page.html", "collection", "Tag Albums");
|
||||
$template->set_global(
|
||||
array("page" => $page,
|
||||
"max_pages" => $max_pages,
|
||||
"page_size" => $page_size,
|
||||
"children" => $tag_children,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs,
|
||||
"children_count" => $count));
|
||||
$template->page_title = $page_title;
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = $page_title;
|
||||
$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
|
||||
$template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
|
||||
print $template;
|
||||
|
||||
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||
item::set_display_context_callback("tag_albums_Controller::get_display_context", 0, $id);
|
||||
}
|
||||
}
|
||||
|
||||
static function get_display_context($item, $tag_id, $album_id) {
|
||||
// Make sure #album_id is valid, clear it out if it isn't.
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
if (count($album_tags) == 0) {
|
||||
$album_id = 0;
|
||||
}
|
||||
|
||||
// Load the tag and item, make sure the user has access to the item.
|
||||
$display_tag = ORM::factory("tag", $tag_id);
|
||||
|
||||
// Figure out sort order from module preferences.
|
||||
$sort_page_field = "";
|
||||
$sort_page_direction = "";
|
||||
if (($tag_id > 0) || (count($album_tags) == 0)) {
|
||||
$sort_page_field = module::get_var("tag_albums", "subalbum_sort_by", "title");
|
||||
$sort_page_direction = module::get_var("tag_albums", "subalbum_sort_direction", "ASC");
|
||||
} else {
|
||||
$parent_album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$sort_page_field = $parent_album->sort_column;
|
||||
$sort_page_direction = $parent_album->sort_order;
|
||||
}
|
||||
|
||||
// Load the number of items in the parent album, and determine previous and next items.
|
||||
$sibling_count = "";
|
||||
$tag_children = "";
|
||||
$previous_item = "";
|
||||
$next_item = "";
|
||||
$position = 0;
|
||||
if ($tag_id > 0) {
|
||||
$sibling_count = tag_albums_Controller::_count_records(Array($tag_id), "OR", false);
|
||||
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, Array($tag_id), "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = tag_albums_Controller::_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = $previous_item_object[0];
|
||||
}
|
||||
}
|
||||
$next_item_object = tag_albums_Controller::_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
} else {
|
||||
$tag_ids = Array();
|
||||
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
|
||||
$tag = ORM::factory("tag")->where("name", "=", trim($tag_name))->find();
|
||||
if ($tag->loaded()) {
|
||||
$tag_ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$album_tags_search_type = $album_tags[0]->search_type;
|
||||
$sibling_count = tag_albums_Controller::_count_records($tag_ids, $album_tags_search_type, false);
|
||||
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = tag_albums_Controller::_get_records($tag_ids, 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = $previous_item_object[0];
|
||||
}
|
||||
}
|
||||
$next_item_object = tag_albums_Controller::_get_records($tag_ids, 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
$tag_album_breadcrumbs = Array();
|
||||
if ($album_id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($item->title, $item->url())->set_last();
|
||||
if ($album_tags[0]->tags == "*") {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name)));
|
||||
}
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)));
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $item->id;
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name)) . "?show=" . $item->id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($item->title, $item->url())->set_last();
|
||||
}
|
||||
|
||||
return array("position" => $position,
|
||||
"previous_item" => $previous_item,
|
||||
"next_item" => $next_item,
|
||||
"tag_id" => $tag_id,
|
||||
"album_id" => $album_id,
|
||||
"is_tagalbum_page" => true,
|
||||
"sibling_count" => $sibling_count,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs);
|
||||
}
|
||||
|
||||
public function filter($id, $filter) {
|
||||
// Display the index page, but only show albums for
|
||||
// tags whose name begins with $filter.
|
||||
@ -625,7 +347,6 @@ class tag_albums_Controller extends Controller {
|
||||
$parent_url = "";
|
||||
if ($album_id > 0) {
|
||||
$counter = 0;
|
||||
//$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, "");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, $str_page_url)->set_last();
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
if ($album_tags[0]->tags != "*") {
|
||||
@ -633,35 +354,21 @@ class tag_albums_Controller extends Controller {
|
||||
}
|
||||
$parent_url = $parent_item->url(); // Used by Grey Dragon.
|
||||
while ($parent_item->id != 1) {
|
||||
//$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
//$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
/*
|
||||
if ((module::get_var("tag_albums", "tag_index_scope", "false")) && (module::get_var("tag_albums", "tag_index", "default") != "default")) {
|
||||
$tag_album_breadcrumbs[1]->url = url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name));
|
||||
} else {
|
||||
$tag_album_breadcrumbs[1]->url = url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)) . "?show=" . $id;
|
||||
}
|
||||
*/
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $id;
|
||||
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$parent_url = url::site("tag_albums/");
|
||||
//$tag_album_breadcrumbs[0] = new Tag_Albums_Breadcrumb(item::root()->title, item::root()->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
if (module::get_var("tag_albums", "tag_index", "default") == "default") {
|
||||
//$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/") . "?show=" . $id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/") . "?show=" . $id);
|
||||
} else {
|
||||
//$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
}
|
||||
//$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, "");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, $str_page_url)->set_last();
|
||||
}
|
||||
|
||||
@ -677,7 +384,7 @@ class tag_albums_Controller extends Controller {
|
||||
$template->page_title = $display_tag->name;
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = $display_tag->name;
|
||||
//$template->content->description = $page_description;
|
||||
$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("all_siblings", $this->_get_records(Array($id), $count, 0, "items." . $sort_page_field, $sort_page_direction, "OR", false));
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
@ -687,12 +394,292 @@ class tag_albums_Controller extends Controller {
|
||||
item::set_display_context_callback("tag_albums_Controller::get_display_context", $id, $album_id);
|
||||
}
|
||||
|
||||
public function album($id) {
|
||||
// Displays a dynamic page containing items that have been
|
||||
// tagged with one or more tags.
|
||||
|
||||
// Load the specified ID to make sure it exists.
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $id)
|
||||
->find_all();
|
||||
|
||||
// If it doesn't exist, redirect to the modules root page.
|
||||
if (count($album_tags) == 0) {
|
||||
url::redirect("tag_albums/");
|
||||
}
|
||||
|
||||
// If it does exist, and is set to *, load a list of all tags.
|
||||
if ($album_tags[0]->tags == "*") {
|
||||
$this->index($id, "");
|
||||
} else {
|
||||
// Otherwise, populate this page with the specified items.
|
||||
|
||||
// Inherit permissions, title and description from the album that linked to this page.
|
||||
$album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
access::required("view", $album);
|
||||
$page_title = $album->title;
|
||||
$page_description = $album->description;
|
||||
|
||||
// URL to this page
|
||||
$str_page_url = "tag_albums/album/" . $id . "/" . urlencode($album->name);
|
||||
|
||||
// Determine page sort order.
|
||||
$sort_page_field = $album->sort_column;
|
||||
$sort_page_direction = $album->sort_order;
|
||||
|
||||
// Determine search type (AND/OR) and generate an array of the tag ids.
|
||||
$tag_ids = Array();
|
||||
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
|
||||
$tag = ORM::factory("tag")->where("name", "=", trim($tag_name))->find();
|
||||
if ($tag->loaded()) {
|
||||
$tag_ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$album_tags_search_type = $album_tags[0]->search_type;
|
||||
|
||||
// Figure out how many items to display on each page.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
|
||||
// If this page was reached from a breadcrumb, figure out what page to load from the show id.
|
||||
$show = Input::instance()->get("show");
|
||||
if ($show) {
|
||||
$child = ORM::factory("item", $show);
|
||||
$index = $this->_get_position($child->$sort_page_field, $child->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
|
||||
if ($index) {
|
||||
$page = ceil($index / $page_size);
|
||||
if ($page == 1) {
|
||||
url::redirect($str_page_url);
|
||||
} else {
|
||||
url::redirect($str_page_url . "?page=$page");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out how many items are in this "virtual album"
|
||||
$count = $this->_count_records($tag_ids, $album_tags_search_type, true);
|
||||
|
||||
// Figure out which page # the visitor is on and
|
||||
// don't allow the visitor to go below page 1.
|
||||
$page = Input::instance()->get("page", 1);
|
||||
if ($page < 1) {
|
||||
url::redirect($str_page_url);
|
||||
}
|
||||
|
||||
// First item to display.
|
||||
$offset = ($page - 1) * $page_size;
|
||||
|
||||
// Figure out what the highest page number is.
|
||||
$max_pages = ceil($count / $page_size);
|
||||
|
||||
// Don't let the visitor go past the last page.
|
||||
if ($max_pages && $page > $max_pages) {
|
||||
url::redirect($str_page_url . "/?page=$max_pages");
|
||||
}
|
||||
|
||||
// Figure out which items to display on this page and store their details in $children.
|
||||
$tag_children = $this->_get_records($tag_ids, $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
|
||||
|
||||
// Set up the previous and next page buttons.
|
||||
if ($page > 1) {
|
||||
$previous_page = $page - 1;
|
||||
$view->previous_page_link = url::site($str_page_url . "/?page={$previous_page}");
|
||||
}
|
||||
if ($page < $max_pages) {
|
||||
$next_page = $page + 1;
|
||||
$view->next_page_link = url::site($str_page_url . "/?page={$next_page}");
|
||||
}
|
||||
|
||||
// Set up breadcrumbs.
|
||||
$tag_album_breadcrumbs = array();
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($album->title, $album->url())->set_last();
|
||||
$parent_item = ORM::factory("item", $album->parent_id);
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $album->id;
|
||||
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("page.html", "collection", "Tag Albums");
|
||||
$template->set_global(
|
||||
array("page" => $page,
|
||||
"max_pages" => $max_pages,
|
||||
"page_size" => $page_size,
|
||||
"children" => $tag_children,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs,
|
||||
"children_count" => $count));
|
||||
$template->page_title = $page_title;
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = $page_title;
|
||||
$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
|
||||
$parent_album = ORM::factory("item", $album->parent_id);
|
||||
$template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
|
||||
print $template;
|
||||
|
||||
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||
item::set_display_context_callback("tag_albums_Controller::get_display_context", 0, $id);
|
||||
}
|
||||
}
|
||||
|
||||
public function show($item_id, $tag_id, $album_id) {
|
||||
// This function used to be responsible for displaying photos.
|
||||
// As of Gallery 3.0.3, it is no longer needed, now it just
|
||||
// redirects to the photo's primary URL to avoid breaking older links.
|
||||
item::set_display_context_callback("tag_albums_Controller::get_display_context", $tag_id, $album_id);
|
||||
$item = ORM::factory("item", $item_id);
|
||||
url::redirect(url::abs_site("{$item->type}s/{$item->id}"));
|
||||
}
|
||||
|
||||
public function make_tag_album_cover($id, $tag_id, $album_id) {
|
||||
if (!identity::active_user()->admin) {
|
||||
message::error(t("You do not have sufficient privileges to do this"));
|
||||
url::redirect("tag_albums/show/" . $id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($item->name));
|
||||
}
|
||||
|
||||
$item = ORM::factory("item", $id);
|
||||
|
||||
if (($album_id > 0) && ($tag_id == 0)) {
|
||||
// If we are dealing with a dynamic album, set it's thumbnail to this pics.
|
||||
// Based on modules/gallery/helpers/item.php
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
if (count($album_tags) > 0) {
|
||||
$parent = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$parent->album_cover_item_id = $item->id;
|
||||
$parent->thumb_dirty = 1;
|
||||
graphics::generate($parent);
|
||||
$parent->save();
|
||||
|
||||
$grand_parent = $parent->parent();
|
||||
if ($grand_parent && access::can("edit", $grand_parent) &&
|
||||
$grand_parent->album_cover_item_id == null) {
|
||||
item::make_album_cover($parent);
|
||||
}
|
||||
}
|
||||
message::success(t("Made " . $item->title . " this album's cover"));
|
||||
url::redirect("tag_albums/show/" . $id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($item->name));
|
||||
} else {
|
||||
// If setting a thumbnail for an auto-generated all tags->tag album.
|
||||
$record = ORM::factory("tags_album_tag_cover")->where("tag_id", "=", $tag_id)->find();
|
||||
if (!$record->loaded()) {
|
||||
$record->tag_id = $tag_id;
|
||||
}
|
||||
$record->photo_id = $id;
|
||||
$record->save();
|
||||
message::success(t("Made " . $item->title . " this album's cover"));
|
||||
url::redirect("tag_albums/show/" . $id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($item->name));
|
||||
}
|
||||
}
|
||||
|
||||
static function get_display_context($item, $tag_id, $album_id) {
|
||||
// Make sure #album_id is valid, clear it out if it isn't.
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
if (count($album_tags) == 0) {
|
||||
$album_id = 0;
|
||||
}
|
||||
|
||||
// Load the tag and item, make sure the user has access to the item.
|
||||
$display_tag = ORM::factory("tag", $tag_id);
|
||||
|
||||
// Figure out sort order from module preferences.
|
||||
$sort_page_field = "";
|
||||
$sort_page_direction = "";
|
||||
if (($tag_id > 0) || (count($album_tags) == 0)) {
|
||||
$sort_page_field = module::get_var("tag_albums", "subalbum_sort_by", "title");
|
||||
$sort_page_direction = module::get_var("tag_albums", "subalbum_sort_direction", "ASC");
|
||||
} else {
|
||||
$parent_album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$sort_page_field = $parent_album->sort_column;
|
||||
$sort_page_direction = $parent_album->sort_order;
|
||||
}
|
||||
|
||||
// Load the number of items in the parent album, and determine previous and next items.
|
||||
$sibling_count = "";
|
||||
$tag_children = "";
|
||||
$previous_item = "";
|
||||
$next_item = "";
|
||||
$position = 0;
|
||||
if ($tag_id > 0) {
|
||||
$sibling_count = tag_albums_Controller::_count_records(Array($tag_id), "OR", false);
|
||||
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, Array($tag_id), "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = tag_albums_Controller::_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = $previous_item_object[0];
|
||||
}
|
||||
}
|
||||
$next_item_object = tag_albums_Controller::_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
} else {
|
||||
$tag_ids = Array();
|
||||
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
|
||||
$tag = ORM::factory("tag")->where("name", "=", trim($tag_name))->find();
|
||||
if ($tag->loaded()) {
|
||||
$tag_ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$album_tags_search_type = $album_tags[0]->search_type;
|
||||
$sibling_count = tag_albums_Controller::_count_records($tag_ids, $album_tags_search_type, false);
|
||||
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = tag_albums_Controller::_get_records($tag_ids, 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = $previous_item_object[0];
|
||||
}
|
||||
}
|
||||
$next_item_object = tag_albums_Controller::_get_records($tag_ids, 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
$tag_album_breadcrumbs = Array();
|
||||
if ($album_id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($item->title, $item->url())->set_last();
|
||||
if ($album_tags[0]->tags == "*") {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name)));
|
||||
}
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)));
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $item->id;
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name)) . "?show=" . $item->id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($item->title, $item->url())->set_last();
|
||||
}
|
||||
|
||||
return array("position" => $position,
|
||||
"previous_item" => $previous_item,
|
||||
"next_item" => $next_item,
|
||||
"tag_id" => $tag_id,
|
||||
"album_id" => $album_id,
|
||||
"is_tagalbum_page" => true,
|
||||
"sibling_count" => $sibling_count,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs);
|
||||
}
|
||||
|
||||
private function _get_position($item_title, $item_id, $tag_ids, $sort_field, $sort_direction, $search_type, $include_albums) {
|
||||
// Determine an item's position within a virtual album.
|
||||
|
||||
@ -790,6 +777,7 @@ class tag_albums_Controller extends Controller {
|
||||
$items_model->select("items.left_ptr");
|
||||
$items_model->select("items.right_ptr");
|
||||
$items_model->select("items.relative_path_cache");
|
||||
$items_model->select("items.relative_url_cache");
|
||||
$items_model->select('COUNT("*") AS result_count');
|
||||
}
|
||||
$items_model->viewable();
|
||||
@ -813,45 +801,6 @@ class tag_albums_Controller extends Controller {
|
||||
return $items_model->find_all($page_size, $offset);
|
||||
}
|
||||
|
||||
private function _get_filter_html($album_id, $str_filter) {
|
||||
// Generate HTML to display filter links on the index page.
|
||||
|
||||
// Make sure $album_id is set.
|
||||
if ($album_id == "") {
|
||||
$album_id = 0;
|
||||
}
|
||||
|
||||
// Generate the links.
|
||||
$str_html = "Filter: ";
|
||||
if ($str_filter != "") {
|
||||
if ($album_id > 0) {
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
$album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/album/" . $album_id . "/" . urlencode($album->name)) . "\">(All)</a> ";
|
||||
} else {
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/") . "\">(All)</a> ";
|
||||
}
|
||||
}
|
||||
if ($str_filter == "NUM") {
|
||||
$str_html .= "# ";
|
||||
} else {
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/filter/" . $album_id . "/NUM") . "\">#</a> ";
|
||||
}
|
||||
foreach(range('A','Z') as $letter) {
|
||||
if ($letter == $str_filter) {
|
||||
$str_html .= $letter . " ";
|
||||
} else {
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/filter/" . $album_id . "/" . $letter) . "\">";
|
||||
$str_html .= $letter . "</a> ";
|
||||
}
|
||||
}
|
||||
|
||||
// Return the HTML.
|
||||
return $str_html;
|
||||
}
|
||||
|
||||
private function _count_records($tag_ids, $search_type, $include_albums) {
|
||||
// Count the number of viewable items for the designated tag(s)
|
||||
// and return that number.
|
||||
@ -899,4 +848,43 @@ class tag_albums_Controller extends Controller {
|
||||
return count($items_model->find_all());
|
||||
}
|
||||
}
|
||||
|
||||
private function _get_filter_html($album_id, $str_filter) {
|
||||
// Generate HTML to display filter links on the index page.
|
||||
|
||||
// Make sure $album_id is set.
|
||||
if ($album_id == "") {
|
||||
$album_id = 0;
|
||||
}
|
||||
|
||||
// Generate the links.
|
||||
$str_html = "Filter: ";
|
||||
if ($str_filter != "") {
|
||||
if ($album_id > 0) {
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
$album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/album/" . $album_id . "/" . urlencode($album->name)) . "\">(All)</a> ";
|
||||
} else {
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/") . "\">(All)</a> ";
|
||||
}
|
||||
}
|
||||
if ($str_filter == "NUM") {
|
||||
$str_html .= "# ";
|
||||
} else {
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/filter/" . $album_id . "/NUM") . "\">#</a> ";
|
||||
}
|
||||
foreach(range('A','Z') as $letter) {
|
||||
if ($letter == $str_filter) {
|
||||
$str_html .= $letter . " ";
|
||||
} else {
|
||||
$str_html .= "<a href=\"" . url::site("tag_albums/filter/" . $album_id . "/" . $letter) . "\">";
|
||||
$str_html .= $letter . "</a> ";
|
||||
}
|
||||
}
|
||||
|
||||
// Return the HTML.
|
||||
return $str_html;
|
||||
}
|
||||
}
|
||||
|
@ -44,10 +44,11 @@ class tag_albums_installer {
|
||||
module::set_var("tag_albums", "subalbum_sort_direction", "ASC");
|
||||
module::set_var("tag_albums", "tag_index", "default");
|
||||
module::set_var("tag_albums", "tag_index_scope", "0");
|
||||
module::set_var("tag_albums", "tag_index_filter", "0");
|
||||
module::set_var("tag_albums", "tag_index_filter_top", "0");
|
||||
module::set_var("tag_albums", "tag_index_filter_bottom", "0");
|
||||
|
||||
// Set the module's version number.
|
||||
module::set_version("tag_albums", 2);
|
||||
module::set_version("tag_albums", 4);
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
@ -69,6 +70,13 @@ class tag_albums_installer {
|
||||
DEFAULT CHARSET=utf8;");
|
||||
module::set_version("tag_albums", 3);
|
||||
}
|
||||
|
||||
if ($version == 3) {
|
||||
module::set_var("tag_albums", "tag_index_filter_top", module::get_var("tag_albums", "tag_index_filter", "0"));
|
||||
module::set_var("tag_albums", "tag_index_filter_bottom", module::get_var("tag_albums", "tag_index_filter", "0"));
|
||||
module::clear_var("tag_albums", "tag_index_filter");
|
||||
module::set_version("tag_albums", 4);
|
||||
}
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
|
@ -31,4 +31,22 @@ class tag_albums_theme_Core {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static function dynamic_top($theme) {
|
||||
// If this page is the "all tags" dynamic page, display filter link text.
|
||||
if (isset($theme->content->filter_text) && module::get_var("tag_albums", "tag_index_filter_top", "0")) {
|
||||
$view = new View("tag_albums_filter.html");
|
||||
$view->filter_text = $theme->content->filter_text;
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
||||
static function dynamic_bottom($theme) {
|
||||
// If this page is the "all tags" dynamic page, display filter link text.
|
||||
if (isset($theme->content->filter_text) && module::get_var("tag_albums", "tag_index_filter_bottom", "0")) {
|
||||
$view = new View("tag_albums_filter.html");
|
||||
$view->filter_text = $theme->content->filter_text;
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,35 +33,39 @@ class Tag_Model_Core extends ORM {
|
||||
* Return all viewable items associated with this tag.
|
||||
* @param integer $limit number of rows to limit result to
|
||||
* @param integer $offset offset in result to start returning rows from
|
||||
* @param string $type the type of item (album, photo)
|
||||
* @param string $where an array of arrays, each compatible with ORM::where()
|
||||
* @return ORM_Iterator
|
||||
*/
|
||||
public function items($limit=null, $offset=null, $type=null) {
|
||||
$model = ORM::factory("item")
|
||||
public function items($limit=null, $offset=null, $where=array()) {
|
||||
if (is_scalar($where)) {
|
||||
// backwards compatibility
|
||||
$where = array(array("items.type", "=", $where));
|
||||
}
|
||||
return ORM::factory("item")
|
||||
->viewable()
|
||||
->join("items_tags", "items.id", "items_tags.item_id")
|
||||
->where("items_tags.tag_id", "=", $this->id);
|
||||
if ($type) {
|
||||
$model->where("items.type", "=", $type);
|
||||
}
|
||||
return $model->find_all($limit, $offset);
|
||||
->where("items_tags.tag_id", "=", $this->id)
|
||||
->merge_where($where)
|
||||
->order_by("items.id")
|
||||
->find_all($limit, $offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the count of all viewable items associated with this tag.
|
||||
* @param string $type the type of item (album, photo)
|
||||
* @param string $where an array of arrays, each compatible with ORM::where()
|
||||
* @return integer
|
||||
*/
|
||||
public function items_count($type=null) {
|
||||
$model = ORM::factory("item")
|
||||
public function items_count($where=array()) {
|
||||
if (is_scalar($where)) {
|
||||
// backwards compatibility
|
||||
$where = array(array("items.type", "=", $where));
|
||||
}
|
||||
return $model = ORM::factory("item")
|
||||
->viewable()
|
||||
->join("items_tags", "items.id", "items_tags.item_id")
|
||||
->where("items_tags.tag_id", "=", $this->id);
|
||||
|
||||
if ($type) {
|
||||
$model->where("items.type", "=", $type);
|
||||
}
|
||||
return $model->count_all();
|
||||
->where("items_tags.tag_id", "=", $this->id)
|
||||
->merge_where($where)
|
||||
->count_all();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,13 +73,23 @@ class Tag_Model_Core extends ORM {
|
||||
* to this tag.
|
||||
*/
|
||||
public function save() {
|
||||
$related_item_ids = array();
|
||||
foreach (db::build()
|
||||
->select("item_id")
|
||||
->from("items_tags")
|
||||
->where("tag_id", "=", $this->id)
|
||||
->execute() as $row) {
|
||||
$related_item_ids[$row->item_id] = 1;
|
||||
// Check to see if another tag exists with the same name
|
||||
$duplicate_tag = ORM::factory("tag")
|
||||
->where("name", "=", $this->name)
|
||||
->where("id", "!=", $this->id)
|
||||
->find();
|
||||
if ($duplicate_tag->loaded()) {
|
||||
// If so, tag its items with this tag so as to merge it
|
||||
$duplicate_tag_items = ORM::factory("item")
|
||||
->join("items_tags", "items.id", "items_tags.item_id")
|
||||
->where("items_tags.tag_id", "=", $duplicate_tag->id)
|
||||
->find_all();
|
||||
foreach ($duplicate_tag_items as $item) {
|
||||
$this->add($item);
|
||||
}
|
||||
|
||||
// ... and remove the duplicate tag
|
||||
$duplicate_tag->delete();
|
||||
}
|
||||
|
||||
if (isset($this->object_relations["items"])) {
|
||||
@ -132,6 +146,7 @@ class Tag_Model_Core extends ORM {
|
||||
* @param string $query the query string (eg "page=3")
|
||||
*/
|
||||
public function url($query=null) {
|
||||
// rWatcher Edit: Modify URL function to point users to tag_albums instead of tag.
|
||||
$album_id = Input::instance()->get("album");
|
||||
if (!($album_id)) {
|
||||
$album_id = 0;
|
||||
@ -142,4 +157,4 @@ class Tag_Model_Core extends ORM {
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
name = "Tag Albums"
|
||||
description = "Creates dynamic albums based on tags."
|
||||
version = 3
|
||||
version = 4
|
||||
author_name = "rWatcher"
|
||||
author_url = "http://codex.gallery2.org/User:RWatcher"
|
||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:tag_albums"
|
||||
|
4
3.0/modules/tag_albums/views/tag_albums_filter.html.php
Normal file
4
3.0/modules/tag_albums/views/tag_albums_filter.html.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-tags-filter">
|
||||
<center><?= $filter_text; ?></center>
|
||||
</div>
|
Reference in New Issue
Block a user