Project

General

Profile

« Previous | Next » 

Revision 3996

Added by berkley over 16 years ago

you can now upload xml documents with the sms skin

View differences:

lib/style/skins/knb/sms.xml
2 2
<style-set name="sms">
3 3
<!-- general login & search -->
4 4
  <default-style>/style/common/ascii-treeview.xsl</default-style>
5
  
6
  <doctype publicid="message">
7
    <target publicid="-//W3C//HTML//EN">/style/skins/sms/redirect.xsl</target>
8
  </doctype>
5 9

  
6 10
  <doctype publicid="-//NCEAS//resultset//EN">
7 11
    <target publicid="-//W3C//HTML//EN">/style/common/resultset.xsl</target>
lib/style/skins/knb/index.jsp
1
<%
2
  String docid = request.getParameter("docid");
3
  String status = request.getParameter("status");
4
%>
1 5
<html>
2 6
<head>
3 7
  <link rel="stylesheet" type="text/css" href="style/skins/sms/sms.css"/>
......
7 11
    
8 12
  </script>
9 13
  
14
  
10 15
  <title>Semantic Mediation System</title>
16
  
11 17
</head>
12 18
<body onload="checkLogin()">
13 19
  
......
34 40
          <tr>
35 41
            <td>Password:</td><td><input id="pw" type="password" name="password"/></td>
36 42
          </tr>
43
          <tr>
44
            <td><a href="javascript:" onclick="login()">[Login]</a></td>
45
          </tr>
37 46
        </table>
38
        <a onclick="login()">[Login]</a>
47
        
39 48
      </form>
40 49
      </div>
41 50
      </div>
42 51
      
43
      <!--<div id="maindiv" style="width:625px; margin:0px auto;">
44
        <div id="leftspan" style="display:inline; background:grey; border:1px solid">
45
          <p>span1</p>
46
        </div>
47
        <div id="rightspan" style="display:inline; background:grey; border:1px solid">
48
          <p>span2</p>
49
        </div>
50
      </div>-->
51
      
52 52
      <div id="maindiv" style="display:none; width:625px; margin:0px auto;">
53 53
      <table style="width:625px">
54
        <tr>
55
          <td>
54
        <tr valign="top">
55
          <td width="312px">
56 56
            <div id="leftspan" style="background:grey; border:1px solid">
57
              <p>span1</p>
57
              <h4 style="text-align:center">Semantic Search</h4>
58 58
            </div>
59 59
          </td>
60 60
          
61
          <td>
62
            <div id="rightspan" style="background:grey; border:1px solid">
63
              <p>span2</p>
61
          <td width="312px">
62
            <div id="rightspan" style="background:grey; border:1px solid; padding:10px;">
63
              <h4 style="text-align:center">Upload an ontology or data package</h4>
64
              <form action="metacat" name="uploadform" method="POST" enctype="multipart/form-data">
65
                <input type="hidden" name="action" value="insertmultipart"/>
66
                <input type="hidden" name="qformat" value="sms"/>
67
                <table>
68
                  <tr>
69
                    <td>File:</td><td><input type="file" id="datafile" name="datafile"/></td>
70
                  </tr>
71
                  <tr>
72
                    <td>DocId:</td><td><input id="docidtextfield" type="text" name="docid" readonly="true"/></td>
73
                  </tr>
74
                  <tr>
75
                    <td><a href="javascript:" onclick="uploadfile()">[Upload]</a>
76
                    <!--<input type="submit"/></td>-->
77
                  </tr>
78
                </table>
79
              </form>
80
              <div id="uploadstatus">
81
              <%
82
                if(status != null && status.equals("success"))
83
                {
84
                  out.print("Your file was successfully uploaded.  The url to " +
85
                  "your file is <a href=\"http://linus.nceas.ucsb.edu/sms/metacat?docid=" + docid 
86
                  + "&action=read&qformat=sms\">http://linus.nceas.ucsb.edu/sms/metacat?action=read&qformat=sms&docid=" + docid +
87
                  "</a>");
88
                }
89
                else
90
                {
91
                  if(docid != null)
92
                  {
93
                    out.print("Sorry, your file upload failed.  Try logging in again.");
94
                  }
95
                }
96
                
97
                %>
98
              </div>
64 99
            </div>
65 100
          </td>
66 101
        </tr>
lib/style/skins/knb/redirect.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="/success">
5
    <html>
6
      <script type="text/javascript">
7
        function redirect()
8
        {
9
          var url = "/sms/?docid=" + "<xsl:value-of select="./docid"/>" + "&amp;status=success";
10
          window.location = url;
11
        }
12
      </script>
13
      <body onload="javascript:redirect()">
14
      <!--  <p>File uploaded successfully with docid <xsl:value-of select="./docid"/>.  
15
        <a href="redirect.php?docid="/>-->
16
      </body>
17
    </html>
18
  </xsl:template>
19
  
20
  <xsl:template match="/error">
21
    <html>
22
      <script type="text/javascript">
23
        function redirect()
24
        {
25
          var url = "/sms/?status=fail";
26
          window.location = url;
27
        } 
28
      </script>
29
      <body onload="javascript:redirect()">
30
      <!--  <p>File uploaded successfully with docid <xsl:value-of select="./docid"/>.  
31
        <a href="redirect.php?docid="/>-->
32
      </body>
33
    </html>
34
  </xsl:template>
35

  
36
</xsl:stylesheet>
0 37

  
lib/style/skins/knb/util.js
32 32
  {
33 33
    var user = getCookie("sms-user");
34 34
    $('#loginheader').replaceWith("<h2 style=\"text-align:center\" id=\"loginheader\">" 
35
      + user + " Logged In <a onclick=\"logout()\" style=\"font-size:70%\">[logout]</a></h2>");
35
      + user + " Logged In <a href=\"javascript:\" onclick=\"logout()\" style=\"font-size:70%\">[logout]</a></h2>");
36 36
    slideUp("#loginformdiv");
37 37
    $('#maindiv').css("display", "block");
38 38
    $('#bottomimg').css("bottom", "0px");
39
    $.get("metacat", {action:"getlastdocid", scope:"sms"}, 
40
      function(data)
41
      {
42
        var docid = data.substring(data.indexOf("<docid>") + 7, data.indexOf("</docid>"));
43
        var nextid;
44
        if(docid == 'null')
45
        {
46
          nextid = "sms.1.1";
47
        }
48
        else
49
        {
50
          nextid = docid.substring(docid.indexOf(".") + 1, docid.lastIndexOf("."));
51
          nextid++;
52
          nextid = "sms." + nextid + ".1";
53
        }
54
        $('#docidtextfield').val(nextid); 
55
      }, 
56
      "XML");
39 57
  }
40 58
  else
41 59
  {
......
66 84
  }
67 85
}
68 86

  
87
function uploadfile()
88
{
89
  if(getCookie("sms-login") != "true")
90
  {
91
    alert('You cannot upload.  You are not logged in.');
92
    return;
93
  }
94
  
95
  /*$.post("metacat", $("form").serialize(), 
96
    function(data)
97
    {
98
      alert($("form").serialize());
99
      alert(data);
100
    }, 
101
    "XML");*/
102
  $("form").submit();
103
}
104

  
69 105
function slideUp(id)
70 106
{
71 107
  $(id).slideUp("slow");
......
138 174
	{
139 175
		return null;
140 176
	}
141
}				
177
}		
lib/style/skins/knb/sms.css
35 35
{
36 36
  color:#e7bd59;
37 37
}
38

  
39
a
40
{
41
  text-decoration:none;
42
  color:white;
43
  font-size: 70%;
44
}

Also available in: Unified diff