Debian Codegraph @

gavo/resources/templates/defaultresponse.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml"
5 xmlns:n="http://nevow.com/ns/nevow/0.1">
6 <head n:render="commonhead">
7 <title n:render="meta">title</title>
8
9 <script type="text/javascript" src="/static/js/samp.js"/>
10 <script type="text/javascript">
11 var sourceTable = '<n:invisible n:render="string" n:data="tableName"/>';
12
13 //<![CDATA[
14 function watchKey(ev) {
15 if (ev.which==13 && ev.ctrlKey) {
16 ev.stopPropagation();
17 if (ev.cancelable) {
18 ev.preventDefault();
19 }
20 document.getElementById("genForm-action-submit").click();
21 }
22 }
23 if (document.addEventListener) {
24 // the keydown lets us swallow mozilla's textbox events. Other browsers?
25 document.addEventListener("keydown", watchKey, true);
26 }
27
28 function sendSAMP(conn, tableSource) {
29 var tableURL = getFormQuery(tableSource,
30 {'_FORMAT': 1})+"&_FORMAT=VOTable&VERB=3";
31 var msg = new samp.Message("table.load.votable", {
32 "table-id": sourceTable+"-"+(Date.now()%86400).toString(),
33 "url": tableURL,
34 // produce halfway unique strings at least for a day,
35 // or TOPCAT will refuse repeated transfers.
36 "name": sourceTable});
37 conn.notifyAll([msg]);
38 }
39
40 $(document).ready(function() {
41 $("#plotbuttonsholder").append(
42 renderTemplate("tmpl_plotbuttons", {}));
43
44 var sampButton = $('#sendViaSAMP');
45 var tableSource = document.getElementById('genForm');
46 var connector = new samp.Connector("DaCHS Web", {
47 "samp.name": "DaCHS Web",
48 "samp.description": "A form in a web interface at "+document.URL,
49 "samp.icon.url": completeURL("/favicon.png")
50 });
51 $(document).on("beforeunload", function() {
52 connector.unregister();
53 });
54 connector.onHubAvailability(function(hubPresent) {
55 sampButton[0].disabled = !hubPresent;
56 }, 2000);
57
58 sampButton.click(function (e) {
59 connector.runWithConnection(
60 function(conn) {sendSAMP(conn, tableSource);});
61 });
62
63 });
64 //]]></script>
65 <style type="text/css" n:render="servicestyle"/>
66 </head>
67
68
69 <body n:render="withsidebar">
70 <h1 n:render="meta">title</h1>
71
72 <div class="querypars" n:data="queryseq" n:render="ifdata">
73 <h2 id="qf-parameters"><a href="#_queryForm">Parameters</a></h2>
74 <ul n:render="sequence">
75 <li n:pattern="item" n:render="parpair"/>
76 </ul>
77 </div>
78
79 <div class="result" n:render="ifdata" n:data="result">
80 <h2 id="qf-result">Result</h2>
81 <div class="resmeta" n:data="resultmeta" n:render="mapping">
82 <p>Matched: <n:slot name="itemsMatched"/></p>
83 </div>
84 <div id="plotbuttonsholder"/>
85 <div class="result" n:render="ifresult">
86 <n:invisible n:render="resulttable"/>
87 </div>
88 <div class="warning" n:render="ifnoresult">
89 <p n:render="metahtml">_noresultwarning</p>
90 </div>
91 <h2 id="qf-qf"><a name="_queryForm">Query Form</a></h2>
92 </div>
93
94 <div id="intro" n:render="intro" class="intro"/>
95 <n:invisible n:render="form genForm"/>
96 <div id="bottominfo" n:render="metahtml">_bottominfo</div>
97 <div class="rights" n:render="metahtml">copyright</div>
98
99 <script type="text/html" id="tmpl_plotbuttons">
100 <p class="plotbuttons">
101 <n:invisible n:render="iflinkable">
102 <button id="sendViaSAMP" title="Broadcasts this table to all
103 SAMP clients on your desktop." disabled="True">Send via SAMP</button>
104 </n:invisible>
105 <button n:render="flotplot">Quick Plot</button>
106 </p>
107 </script>
108
109 </body>
110 </html>
111