Changeset 582
- Timestamp:
- 07/12/10 12:46:30 (14 years ago)
- Location:
- MDService2/trunk/MDService2
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/WebContent/index.jsp
r572 r582 7 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 8 <title>MDService2</title> 9 10 9 <link rel="stylesheet" href="style/jquery/smoothness/jquery-ui-1.8.1.custom.css" type="text/css"> 11 10 <link href="style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet"> 12 11 <link href="style/metares.css" type="text/css" rel="stylesheet"> 13 12 <link href="style/cmdi.css" type="text/css" rel="stylesheet"> 14 13 <link href="style/jquery/jquery-autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css"> 15 14 16 15 <script src="scripts/jquery/js/jquery-1.4.2.js" type="text/javascript"></script> 17 16 <script src="scripts/jquery/js/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script> 18 17 <script src="scripts/jquery/jquery-treeview/jquery.treeview.js" type="text/javascript"></script> 19 <script src="scripts/jquery/jquery- checkboxtree/jquery.checkboxtree.js" type="text/javascript"></script>18 <script src="scripts/jquery/jquery-autocomplete/jquery.autocomplete.js" type="text/javascript"></script> 20 19 <script src="scripts/mdservice_model.js" type="text/javascript"></script> 21 20 <script src="scripts/mdservice2_ui.js" type="text/javascript"></script> … … 24 23 <body> 25 24 <h1>MDService2</h1> 26 27 25 <!-- 26 <input type="text" id="ccc" name="ccc"/> 27 --> 28 28 <div id="left-menu" > 29 29 <div> 30 <h2>Collections</h2>31 <div id="collections" class="block">32 </div>30 <h2>Collections</h2> 31 <div id="collections" class="block"> 32 </div> 33 33 </div> 34 34 <div> 35 <h2>Terms</h2> 36 <div id="terms" class="block"> 35 <h2>Terms</h2> 36 <div id="terms" class="block"> 37 <div id="tmp_profiles" visible="false"> 38 39 </div> 40 </div> 41 </div> 42 <!-- 43 <div> 44 <h2>TermsOld</h2> 45 <div id="termsOld" class="block"> 37 46 38 47 </div> 39 48 </div> 49 --> 50 40 51 <div> 41 52 <h2>Profiles/Components</h2> … … 60 71 </div> 61 72 <div id="search" class="block"> 73 62 74 <s:form action="searchretrieve"> 63 <s:textfield name="query" label="Query" size="50"/>75 <s:textfield id="srquery" name="query" label="Query" size="50"/> 64 76 <s:select label="Collections" size="1" 65 77 headerKey="-1" headerValue="" … … 99 111 </div> 100 112 113 101 114 </body> 102 115 </html> -
MDService2/trunk/MDService2/WebContent/scripts/mdservice2_ui.js
r581 r582 6 6 base_uri: "/MDService2/collections/", 7 7 current:'olac'}, 8 8 elements: { 9 base_uri: "/MDService2/element/", 10 current:''}, 9 11 terms: { 10 12 base_uri: "/MDService2/model/", 11 13 current:'CMD'}, 12 13 14 components: { 14 15 base_uri: "/MDService2/comp/", … … 120 121 $(this).find(".selection").each(function(){ 121 122 if (($(this).attr("checked")===true) && 122 ($(this).parent().parent().parent().children(".selection").attr("checked")===false) 123 (($(this).parent().parent().parent().children(".selection").attr("checked")===false) || 124 ($(this).parent().parent().parent().children(".treeview").size() == 1)) 123 125 ){ 124 126 $(this).attr("child","parent_selection"); … … 129 131 // update collection_selection 130 132 var $treeview = $(".treeview","#collections"); 131 var collection = $("li",$treeview).find("input:checked[child='parent_selection']").next().text();133 //var collection = $("li",$treeview).find("input:checked[child='parent_selection']").next().text(); 132 134 //console.log("collection:" + collection); 133 135 … … 135 137 if (collection_size == 0){ 136 138 $("#searchretrieve_collection_selection").attr("size",1); 137 $("#searchretrieve_collection_selection").html("<option value=' " + index + "'>all</option>");139 $("#searchretrieve_collection_selection").html("<option value='0'>all</option>"); 138 140 } else{ 139 141 $("#searchretrieve_collection_selection").attr("size",collection_size); … … 176 178 } 177 179 ); 178 180 // elements 181 $('#terms').load(link('elements','htmllist'), 182 function() { 183 184 $("#terms .treeview").treeview({ 185 animated: "fast", 186 collapsed: true 187 }); 188 189 // handle treeview click 190 // add into structure + render into 191 $(".treeview","#terms").find(".box_heading").click(function() { 192 // TODO 193 $('#srquery').attr('value',$(this).text()); 194 }); 195 196 }); 197 179 198 // MODEL queryModel 199 /* 180 200 $('#terms').load(link('terms', 'htmllist', actions.terms.current) ); 181 201 $('#query_terms').attr('value', actions.terms.current); … … 196 216 //update(event.currentTarget, '#terms', '#terms'); 197 217 }); 198 218 */ 219 220 199 221 // ISOCAT DCR 200 222 $('#dcr').load(link('isocat', 'htmllist', actions.isocat.current) ); … … 254 276 255 277 ///////// ADD functionality 256 278 /*var customarray = new Array('apple','pear','mango','pineapple', 279 'orange','banana','durian', 'jackfruit','etc'); 280 var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" "); 281 */ 282 283 $('#srquery').autocomplete("/MDService2/static/terms_autocomplete.txt"); 284 ///$('#ccc').autocomplete("/MDService2/static/test.txt"); 285 257 286 $('.cmd_filter').live('click', function(event) { 258 287 $('#searchretrieve_query').val($(this).parent().children('a').text()); 259 288 }); 289 260 290 261 291 -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/Cache.java
r521 r582 81 81 InputStream instream; 82 82 try { 83 instream = new FileInputStream(f); 83 instream = new FileInputStream(f); 84 84 85 return instream; 85 86 } catch (FileNotFoundException e) { -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/CompRegistryProxyAction.java
r519 r582 1 package eu.clarin.cmdi.mdservice.action;1 package eu.clarin.cmdi.mdservice.action; 2 2 3 import java.io.File; 4 import java.io.FileOutputStream; 3 5 import java.io.IOException; 4 6 import java.io.InputStream; 7 import java.io.OutputStream; 5 8 import java.net.MalformedURLException; 6 9 import java.net.URL; … … 36 39 public String getFullFormat() { 37 40 if (compid==null || compid.equals("")) { 38 return "complist2" + getFormat(); 41 if (getActionkey().equals("elements")){ 42 return "terms2" + getFormat(); 43 } else { 44 return "complist2" + getFormat(); 45 } 39 46 } else { 40 47 return "comp2" + getFormat(); … … 60 67 } 61 68 62 69 70 @SuppressWarnings("deprecation") 71 @Override 72 public void prepare() throws Exception { 73 74 Admin.notifyUser("CRPA.prepare"); 75 if (!getActionkey().equals("elements")) { 76 super.prepare(); 77 } else { 78 Admin.notifyUser("CRPA.prepareSourceStream - elements"); 79 String xcid; 80 InputStream _sourceStream; 81 InputStream __sourceStream; 82 InputStream _resultStream; 83 84 _sourceStream = Cache.getCache().getFromCache(getRequestKey()); 85 if (_sourceStream == null) { 86 Admin.notifyUser("CRPA.prepareSourceStream- profiles"); 87 setActionkey("profiles"); 88 setFormat("xmlresolved"); 89 __sourceStream = Cache.getCache().getFromCache(getRequestKey()); 90 if (__sourceStream == null) { 91 __sourceStream = getSourceStream(); 92 xcid = Cache.getCache().putInCache(getRequestKey(),__sourceStream); 93 Admin.notifyUser("CRPA-putting in cache: " + getRequestKey()); 94 __sourceStream = Cache.getCache().getFromCache(getRequestKey()); 95 } else{ 96 Admin.notifyUser("CRPA-reading from cache: " + getRequestKey()); 97 } 98 Admin.notifyUser("CCCRPA." + getTargetRequest()); 99 Admin.notifyUser("CCCRPA." + getFullFormat()); 100 MDTransformer.getMDTransformer().setSrcFile(getTargetRequest()); 101 _sourceStream = MDTransformer.getMDTransformer().transformXML(__sourceStream, getFullFormat()); 102 Admin.notifyUser("CRPA.- elements"); 103 setActionkey("elements"); 104 setFormat("htmllist"); 105 xcid = Cache.getCache().putInCache(getRequestKey(),_sourceStream); 106 Admin.notifyUser("CRPA-putting in cache: " + getRequestKey()); 107 _sourceStream = Cache.getCache().getFromCache(getRequestKey()); 108 } else { 109 Admin.notifyUser("CRPA-reading from cache: " + getRequestKey()); 110 } 111 /* 112 File file=new File(Cache.getCache().formPath(getRequestKey())); 113 Admin.notifyUser("File-absolutePath " + file.getAbsolutePath()); 114 URL url = null; 115 try{ 116 url = file.toURL(); 117 Admin.notifyUser("URL-tostring " + url.toString()); 118 } catch (MalformedURLException me){ 119 } 120 */ 121 122 MDTransformer.getMDTransformer().setSrcFile(getTargetRequest()); 123 _resultStream = MDTransformer.getMDTransformer().transformXML(_sourceStream, getFullFormat()); 124 125 setSourceStream(_sourceStream); 126 setResultStream(_resultStream); 127 128 if (getFormat().equals("txt")) { 129 File f=new File(Cache.getCache().formPath("terms_autocomplete.txt")); 130 OutputStream out=new FileOutputStream(f); 131 byte buf[]=new byte[1024]; 132 int len; 133 while((len=getResultStream().read(buf))>0) 134 out.write(buf,0,len); 135 out.close(); 136 Admin.notifyUser("terms_autocomplete.txt"); 137 } 138 139 140 } 141 142 } 143 144 63 145 /** 64 146 * uses base_url and (optionally) compid to form a url -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java
r535 r582 106 106 return resultStream; 107 107 } 108 108 public void setResultStream(InputStream _resultStream){ 109 resultStream = _resultStream; 110 } 111 public void setSourceStream(InputStream _sourceStream){ 112 sourceStream = _sourceStream; 113 } 114 109 115 /* 110 116 public InputStream getSourceStream() throws IOException { … … 150 156 } 151 157 158 152 159 public void prepare() throws Exception { 153 160 … … 156 163 157 164 // Caching 158 // does not work yet see Cache.java for details 159 160 String xcid; 165 String xcid; 166 Admin.notifyUser("GPA.prepareSourceStream"); 167 sourceStream = Cache.getCache().getFromCache(getRequestKey()); 168 if (sourceStream == null) { 169 //sourceStream = getTargetRequest().openStream(); 170 sourceStream = getSourceStream(); 171 xcid = Cache.getCache().putInCache(getRequestKey(),sourceStream); 172 Admin.notifyUser("putting in cache: " + getRequestKey()); 161 173 sourceStream = Cache.getCache().getFromCache(getRequestKey()); 162 if (sourceStream == null) { 163 //sourceStream = getTargetRequest().openStream(); 164 sourceStream = getSourceStream(); 165 xcid = Cache.getCache().putInCache(getRequestKey(),sourceStream); 166 Admin.notifyUser("putting in cache: " + getRequestKey()); 167 sourceStream = Cache.getCache().getFromCache(getRequestKey()); 168 } else { 169 Admin.notifyUser("reading from cache: " + getRequestKey()); 170 } 171 172 173 174 } else { 175 Admin.notifyUser("reading from cache: " + getRequestKey()); 176 } 177 174 178 if (format.equals("xml")) { 175 179 resultStream = sourceStream; -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDTransformer.java
r501 r582 114 114 Transformer transformer = tfactory.newTransformer( 115 115 getXSLStreamSource(transkey)); 116 117 transformer.setParameter("format", transkey); 118 119 if (srcFile!=null) { 116 120 117 transformer.setParameter("format", transkey);118 119 if (srcFile!=null) {120 121 File f = new File(srcFile.getPath()); 121 122 122 123 //Admin.notifyUser("src:" + srcFile.getFile()); 123 124 //Admin.notifyUser("fpath:" + f.getAbsolutePath()); … … 138 139 StreamSource src =new StreamSource(); 139 140 src.setInputStream(in); 140 141 141 // Transform the source XML to out-stream 142 142 transformer.transform(src, stream ); -
MDService2/trunk/MDService2/src/mdservice.properties
r555 r582 7 7 //scripts.path = C:/Users/master/3lingua/clarin/CMDI/scripts/ 8 8 scripts.path = xsl/ 9 cache.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/10 //cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/9 //cache.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/ 10 cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/ 11 11 xml.comp = 12 12 xsl.XCQL2XPATH = XCQL2Xpath.xsl … … 24 24 xsl.dc2htmllist = dcif2view.xsl 25 25 xsl.collection2html = collection2view.xsl 26 xsl.complist2xmlresolved = complist_resolved.xsl 27 xsl.terms2htmllist = complist2terms.xsl 28 xsl.terms2txt = complist2termstxt.xsl -
MDService2/trunk/MDService2/src/struts.xml
r580 r582 81 81 </result> 82 82 </action> 83 <action name="element/*/*" class="eu.clarin.cmdi.mdservice.action.CompRegistryProxyAction" method="execute"> 84 <param name="format">{1}</param> 85 <param name="compid">{2}</param> 86 <param name="actionkey">elements</param> 87 <result type="stream"> 88 <param name="contentType">text/xml</param> 89 <param name="inputName">resultStream</param> 90 </result> 91 </action> 92 83 93 84 94 <action name="isocat/*" class="eu.clarin.cmdi.mdservice.action.DCRProxyAction" method="execute"> -
MDService2/trunk/MDService2/src/xsl/complist2terms.xsl
r579 r582 47 47 48 48 <xsl:template name="continue-root"> 49 <ul class="treeview"> 49 50 <xsl:call-template name="list-terms" /> 51 </ul> 50 52 </xsl:template> 51 53 -
MDService2/trunk/MDService2/src/xsl/complist_resolved.xsl
r579 r582 31 31 32 32 <xsl:param name="title" select="'ComplistResolved'" /> 33 <xsl:param name=" format" select="'default'"/> <!-- table|list -->33 <xsl:param name="_format" select="'default'"/> <!-- table|list --> 34 34 35 35 … … 37 37 <xsl:apply-templates mode="include"/> 38 38 <!-- Resolve all includes --> 39 <!-- <xsl:variable name="tree"> 40 41 </xsl:variable>--> 39 <!-- <xsl:variable name="tree"> </xsl:variable> --> 42 40 </xsl:template> 43 41 </xsl:stylesheet>
Note: See TracChangeset
for help on using the changeset viewer.