Project

General

Profile

« Previous | Next » 

Revision 4005

Added by berkley over 16 years ago

got ajax calls working to display existing datasets in a paged table

View differences:

lib/style/skins/sms/resultset.xsl
1
<?xml version="1.0"?> 
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3

  
4
  <xsl:template match="/">
5
    <table>
6
      <xsl:apply-templates select="//document"/>
7
    </table>
8
    <div class="resultnavbar">
9
      <!--previous-->
10
      <xsl:choose>
11
        <xsl:when test="//pagestart = 0">
12
          &lt;
13
        </xsl:when>
14
        <xsl:otherwise>
15
          <a>
16
            <xsl:attribute name="href">
17
              javascript:reloadSearchContent('/sms/metacat?action=query&amp;anytext=%25&amp;qformat=sms&amp;pagesize=10&amp;pagestart=<xsl:value-of select="//previouspage"/>');
18
            </xsl:attribute>
19
            &lt;
20
          </a>
21
        </xsl:otherwise>
22
      </xsl:choose>
23
      
24
      <!--current page of num pages-->
25
      <!--next-->
26
      <xsl:choose>
27
        <xsl:when test="//lastpage = 'true'">
28
          &gt;
29
        </xsl:when>
30
        <xsl:otherwise>
31
          <a>
32
          <xsl:attribute name="href">
33
            javascript:reloadSearchContent('/sms/metacat?action=query&amp;anytext=%25&amp;qformat=sms&amp;pagesize=10&amp;pagestart=<xsl:value-of select="//nextpage"/>');
34
          </xsl:attribute>
35
          &gt;
36
          </a>
37
        </xsl:otherwise>
38
      </xsl:choose>
39
    </div>
40
  </xsl:template>
41
  
42
  <xsl:template match="document">
43
    <tr>
44
      <td>
45
        <a>
46
        <xsl:attribute name="href">
47
          /sms/metacat?action=read&amp;qformat=sms&amp;docid=<xsl:value-of select="docid"/>
48
        </xsl:attribute>
49
        <xsl:value-of select="docid"/>
50
        </a>
51
      </td>
52
      <td>
53
        <xsl:choose>
54
        <xsl:when test="doctype='eml://ecoinformatics.org/eml-2.0.1'">
55
          EML 2.0.1 Document
56
        </xsl:when>
57
        <xsl:otherwise>
58
          Unknown Document Type
59
        </xsl:otherwise>
60
        </xsl:choose>
61
      </td>
62
    </tr>
63
  </xsl:template>
64
  
65
  
66
  
67

  
68
</xsl:stylesheet>
0 69

  
lib/style/skins/sms/sms.xml
8 8
  </doctype>
9 9

  
10 10
  <doctype publicid="-//NCEAS//resultset//EN">
11
    <target publicid="-//W3C//HTML//EN">/style/common/resultset.xsl</target>
11
    <target publicid="-//W3C//HTML//EN">/style/skins/sms/resultset.xsl</target>
12 12
  </doctype>
13 13

  
14 14
<!-- added back login authentication for the registry workflow -->
lib/style/skins/sms/index.jsp
24 24
      <h1 style="text-align:center">SEEK Semantic Mediation Tools</h1>
25 25
    </div>
26 26
    <div style="width: 650px; border: 5px; margin: 0px auto; background: grey">
27
      <div id="loginheaderdiv">
27
      <div id="loginheaderdiv" style="padding: 3px;">
28 28
        <h2 style="text-align:center" id="loginheader">Please Login</h2>
29 29
      </div>
30
      <div id="loginformdiv">
30
      <div id="loginformdiv" style="padding:20px;">
31 31
      <form action="metacat" name="loginform" method="POST">
32 32
        <div style="width:300px; margin:0px auto; height: 150px;">
33 33
        <table>
......
49 49
      </div>
50 50
      </div>
51 51
      
52
      <div id="maindiv" style="display:none; width:625px; margin:0px auto;">
52
      <div id="maindiv" style="display:none; width:625px; margin:0px auto; padding: 10px;">
53 53
      <table style="width:625px">
54 54
        <tr valign="top">
55 55
          <td width="312px">
......
98 98
          </td>
99 99
        </tr>
100 100
      </table>
101
      
102
      <div id="searchresultdiv" style="border: 1px solid; padding: 10px; width: 600px;">
103
        <div id="searchresulttable">
104
        
105
        </div>
101 106
      </div>
102 107
      
108
      </div>
109
      
103 110
    </div>
104 111
  </div>
105 112
  <img id="bottomimg" src="style/skins/sms/sms-page-bottom.png" style="position:relative; bottom: 0px;"/>
lib/style/skins/sms/util.js
100 100
  if(getCookie("sms-login") == "true")
101 101
  {
102 102
    setLoginHeader(true);
103
    showDatasets();
103 104
  }
104 105
  else
105 106
  {
......
107 108
  }
108 109
}
109 110

  
111
function showDatasets()
112
{
113
  reloadSearchContent('/sms/metacat?action=query&anytext=%25&qformat=sms&pagesize=10&pagestart=0');
114
}
115

  
116
function reloadSearchContent(url)
117
{
118
  $("#searchresulttable").load(url);
119
}
120

  
110 121
function uploadfile()
111 122
{
112 123
  if(getCookie("sms-login") != "true")
......
114 125
    alert('You cannot upload.  You are not logged in.');
115 126
    return;
116 127
  }
117
  
118
  /*$.post("metacat", $("form").serialize(), 
119
    function(data)
120
    {
121
      alert($("form").serialize());
122
      alert(data);
123
    }, 
124
    "XML");*/
125 128
  $("form").submit();
126 129
}
127 130

  

Also available in: Unified diff