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) {
88 n = json[0][0].total/N;
91 s+=" <a href=\"<?php echo $webbase?>";
94 s+="/page/"+i+"\">"+i+"</a>";
96 d3.select(".index").html(s);
100 pics.selectAll("li").remove();
102 pics.selectAll("li").data(picdata)
103 .enter().append("li")
105 .attr("href",function(d) {
106 s= d.base_uri+'/'+d.filename;
107 s = s.replace('file:\/\/<?php echo "".str_replace("/","\/",$dbprefix); ?>','<?php echo $webbase; ?>/Photos-small/');
111 .attr("src",function(d) {
113 s= d.base_uri+'/'+d.filename;
114 s = s.replace('file:\/\/<?php echo "".str_replace("/","\/",$dbprefix); ?>','<?php echo $webbase?>/Photos-tiny/');
120 permalink="<?php echo $webbase ?>/page/"+page;
121 d3.select(".permalink").html("Permalink: <a href=\""+permalink+"\">"+permalink+"</a>");
125 if (page>=2) page=page-1;
134 function checkbutton() {
137 { d3.select("button.prev").attr("disabled","disabled");}
139 { d3.select("button.prev").attr("disabled", null);};
142 { d3.select("button.next").attr("disabled","disabled");}
144 { d3.select("button.next").attr("disabled",null);}