$this->tmpl->assign('searchfor', $_SESSION['searchfor']);
$this->tmpl->assign('page_title', $this->cfg->page_title);
$this->tmpl->assign('current_condition', $_SESSION['tag_condition']);
+ $this->tmpl->assign('from_date', $this->get_calendar());
+ $this->tmpl->assign('to_date', $this->get_calendar());
switch($_GET['mode']) {
case 'showpi':
if($previous_img) {
$this->tmpl->assign('previous_url', "javascript:showImage(". $previous_img .");");
+ $this->tmpl->assign('prev_img', $previous_img);
}
if($next_img) {
$this->tmpl->assign('next_url', "javascript:showImage(". $next_img .");");
+ $this->tmpl->assign('next_img', $next_img);
}
+ $this->tmpl->assign('mini_width', $this->cfg->mini_width);
$this->tmpl->show("single_photo.tpl");
{
// return all selected tags
if(isset($_SESSION['selected_tags']) && in_array($tag, $_SESSION['selected_tags'])) {
- print "<a href=\"javascript:Tags('del', ". $tag .");\" class=\"tag\">". $this->tags[$tag] ."</a> ";
+ print "<a href=\"javascript:Tags('del', ". $tag .");\" class=\"tag\">". $this->tags[$tag] ."</a>, ";
}
}
}
elseif($_SESSION['tag_condition'] == 'and') {
+ if(count($_SESSION['selected_tags']) >= 32) {
+ print "A SQLite limit of 32 tables within a JOIN SELECT avoids to<br />\n";
+ print "evaluate your tag selection. Please remove some tags from your selection.\n";
+ return Array();
+ }
+
/* Join together a table looking like
pt1.photo_id pt1.tag_id pt2.photo_id pt2.tag_id ...
if(isset($_SESSION['searchfor']) && $_SESSION['searchfor'] != '')
$this->tmpl->assign('searchfor', $_SESSION['searchfor']);
+ /* do we have to display the page selector ? */
if($this->cfg->rows_per_page != 0) {
/* calculate the page switchers */
if($end_with < $count)
$this->tmpl->assign("next_url", "javascript:showPhotoIndex(". $next_start .");");
- /* page selector */
$photo_per_page = $this->cfg->rows_per_page * $this->cfg->thumbs_per_row;
-
- /* until 6 pages we show the selector from 1-6
- everything large will be
- 1 ... 2 3 4 (5) 6 7 ... 9
- */
$last_page = ceil($count / $photo_per_page);
+ /* get the current selected page */
if($begin_with == 0) {
$current_page = 1;
- }
- else {
+ } else {
$current_page = 0;
for($i = $begin_with; $i >= 0; $i-=$photo_per_page) {
$current_page++;
else
$style = "";
- $page_select.= "<a href=\"javascript:showPhotoIndex(". (($i*$photo_per_page)-$photo_per_page) .");\"";
- if($style != "")
- $page_select.= $style;
- $page_select.= ">". $i ."</a> ";
+ $select = "<a href=\"javascript:showPhotoIndex(". (($i*$photo_per_page)-$photo_per_page) .");\"";
+ if($style != "")
+ $select.= $style;
+ $select.= ">". $i ."</a> ";
+
+ // until 9 pages we show the selector from 1-9
+ if($last_page <= 9) {
+ $page_select.= $select;
+ continue;
+ } else {
+ if($i == 1 /* first page */ ||
+ $i == $last_page /* last page */ ||
+ $i == $current_page /* current page */ ||
+ $i == ceil($last_page * 0.25) /* first quater */ ||
+ $i == ceil($last_page * 0.5) /* half */ ||
+ $i == ceil($last_page * 0.75) /* third quater */ ||
+ (in_array($i, array(1,2,3,4,5,6)) && $current_page <= 4) /* the first 6 */ ||
+ (in_array($i, array($last_page, $last_page-1, $last_page-2, $last_page-3, $last_page-4, $last_page-5)) && $current_page >= $last_page-4) /* the last 6 */ ||
+ $i == $current_page-3 || $i == $current_page-2 || $i == $current_page-1 /* three before */ ||
+ $i == $current_page+3 || $i == $current_page+2 || $i == $current_page+1 /* three after */) {
+
+ $page_select.= $select;
+ continue;
+
+ }
+ }
+ $page_select.= ".";
}
/* only show the page selector if we have more then one page */
$this->cfg->thumb_width,
$this->cfg->bubble_width,
$this->cfg->photo_width,
+ $this->cfg->mini_width,
);
/* get details from F-Spot's database */
/* Check for HTML_AJAX PEAR package, lent from Horde project */
ini_set('track_errors', 1);
@include_once 'HTML/AJAX/Server.php';
- if(isset($php_errormsg)) {
+ if(isset($php_errormsg) && preg_match('/Failed opening.*for inclusion/i', $php_errormsg)) {
print "PEAR HTML_AJAX package is missing<br />\n";
$missing = true;
}
+ @include_once 'Calendar/Calendar.php';
+ if(isset($php_errormsg) && preg_match('/Failed opening.*for inclusion/i', $php_errormsg)) {
+ print "PEAR Calendar package is missing<br />\n";
+ $missing = true;
+ }
ini_restore('track_errors');
if(isset($missing))
} // _warning()
+ private function get_calendar()
+ {
+// require_once CALENDAR_ROOT.'Year.php';
+// require_once CALENDAR_ROOT.'Month.php';
+// require_once CALENDAR_ROOT.'Day.php';
+
+// $Year = new Calendar_Year();
+// $Month = new Calendar_Month();
+// $Day = new Calendar_Day();
+
+ $output = "<select name=\"year\">\n";
+ for($year = 1990; $year <= date("Y"); $year++) {
+ $output.= "<option value=\"". $year ."\">". $year ."</option>\n";
+ }
+ $output.= "</select>\n";
+
+ $output.= "<select name=\"month\">\n";
+ for($month = 1; $month <= 12; $month++) {
+ $output.= "<option value=\"". $month ."\">". $month ."</option>\n";
+ }
+ $output.= "</select>\n";
+
+ $output.= "<select name=\"day\">\n";
+ for($day = 1; $day <= 31; $day++) {
+ $output.= "<option value=\"". $day ."\">". $day ."</option>\n";
+ }
+ $output.= "</select>\n";
+
+ return $output;
+
+ } // get_calendar()
+
}
?>