3 $iniarray=parse_ini_file("config.ini");
4 $webbase=$iniarray["webbase"];
5 $dbprefix=$iniarray["dbprefix"];
6 $admin=$iniarray["admin"];
7 $title=$iniarray["title"];
8 $N=$iniarray["pics_per_page"];
9 /* end parse ini-file */
12 if(isset($_REQUEST["page"]))
13 $page = intval($_REQUEST["page"]);
17 if(isset($_REQUEST["tag"]))
18 $tags = $_REQUEST["tag"];
24 <title><?php echo htmlspecialchars($title) ?></title>
25 <script src="<?php echo $webbase?>/d3.min.js"></script>
26 <link rel="stylesheet" type="text/css" href="<?php echo $webbase?>/normalize.css" />
27 <link rel="stylesheet" type="text/css" href="<?php echo $webbase?>/style.css" />
31 <div class="debug">test</div>
32 <h1><?php echo htmlspecialchars($title) ?></h1>
34 <button class="prev" disabled="disabled" onclick="left()"> prev </button>
35 <button class="next" onclick="right()">next </button>
37 <div class="permalink"></div>
39 <div class="tagsearch">
40 <form method="get" action="">
41 Tags: <input list="MyTags" id="MyTagsInput" type="text" value="" />
42 <datalist id="MyTags">
47 <div class="index"></div>
48 <div class="pics"> </div>
51 This gallery belongs to <?php echo htmlspecialchars($admin) ?>.
52 <div class="copyright"> code: copyright 2011 Arun Persaud arun@nubati.net, code available at nubati.net/git/f-spot-gallery</div>
56 <script type="text/javascript" >
58 var pics = d3.select(".pics").append("ul");
60 var page=<?php echo $page ?>;
61 var N=<?php echo $N ?>;
62 var T="<?php echo $tags ?>";
65 /* populate data list with tags*/
66 d3.json("<?php echo $webbase?>/getjson.php?S", function(json) {
67 d3.select("#MyTags").selectAll("option").data(json)
68 .enter().append("option").attr("value",function(d) {return d.name});
71 /* update form to point to new link */
72 d3.select("input").on("keyup", function(d) {
73 d3.select('form').attr("action","<?php echo $webbase?>/tag/"+document.getElementById('MyTagsInput').value);
76 function myreload(a) {
77 d3.select(".debug").text("T,P,N ="+T+" "+a+" "+N);
80 url = "<?php echo $webbase?>/getjson.php?T="+T+"&P="+a;
82 url = "<?php echo $webbase?>/getjson.php?P="+a;
84 d3.json(url, function(json) {
86 /* update index, show only page +-5 pages max */
88 n = Math.floor(json[0][0].total/N);
92 s+=" <a href=\"<?php echo $webbase?>";
95 s+="/page/1\">1</a>...";
101 for(i=start;i<=Math.min(n+1,a+5);i++)
107 s+=" <a href=\"<?php echo $webbase?>";
110 s+="/page/"+i+"\">"+i+"</a>";
116 s+="... <a href=\"<?php echo $webbase?>";
119 s+="/page/"+(n+1)+"\">"+(n+1)+"</a>";
123 s+=" <a href=\"<?php echo $webbase?>";
126 s+="/page/"+(n+1)+"\">"+(n+1)+"</a>";
130 d3.select(".index").html(s);
134 pics.selectAll("li").remove();
136 pics.selectAll("li").data(picdata)
137 .enter().append("li")
139 .attr("href",function(d) {
140 s= d.base_uri+'/'+d.filename;
141 s = s.replace('file:\/\/<?php echo "".str_replace("/","\/",$dbprefix); ?>','<?php echo $webbase; ?>/Photos-small/');
145 .attr("src",function(d) {
147 s= d.base_uri+'/'+d.filename;
148 s = s.replace('file:\/\/<?php echo "".str_replace("/","\/",$dbprefix); ?>','<?php echo $webbase?>/Photos-tiny/');
154 permalink="<?php echo $webbase ?>/page/"+page;
155 d3.select(".permalink").html("Permalink: <a href=\""+permalink+"\">"+permalink+"</a>");
159 if (page>=2) page=page-1;
168 function checkbutton() {
171 { d3.select("button.prev").attr("disabled","disabled");}
173 { d3.select("button.prev").attr("disabled", null);};
176 { d3.select("button.next").attr("disabled","disabled");}
178 { d3.select("button.next").attr("disabled",null);}