Mercurial > hg > digilib-old
changeset 202:7501034e54e1
restart xul version control - first delete everything
author | luginbue |
---|---|
date | Fri, 27 Feb 2004 11:12:44 +0100 |
parents | 73ef1b15f392 |
children | bf945fcf9105 |
files | xul/annota/annota.js xul/annota/annota.xul xul/annota/rdfds.js xul/annota/tools_dialog.xul xul/install_sidebar.jsp xul/menu.js |
diffstat | 6 files changed, 0 insertions(+), 1456 deletions(-) [+] |
line wrap: on
line diff
--- a/xul/annota/annota.js Fri Feb 27 11:06:54 2004 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ -include ('chrome://jslib/content/io/dir.js'); -include ('chrome://jslib/content/io/file.js'); -include ('chrome://jslib/content/io/rdfBase.js'); -include ('chrome://jslib/content/io/rdfResource.js'); -include ('chrome://jslib/content/io/rdfContainer.js'); -include ('chrome://jslib/content/io/rdf.js'); -include ('chrome://jslib/content/io/rdfFile.js'); -include('chrome://jslib/content/io/fileUtils.js'); - -var slash='/'; -if (navigator.platform=="Win32"){ - slash='\\'; -} - -var directory=slash; -var digilib_path=slash; - -getProfile(); - -function makePathCompatible(path){ - if (navigator.platform=="Win32"){ - // slash durch backslash ersetzten - path=path.replace(/\//g,"\\"); - // nur 2 backslashs am anfang - path=path.replace(/^\\{3}/,"\\\\"); - // vor Laufwerkbuchstaben kein Backslash - if (path.indexOf(":")>0){ - path=path.replace(/^\\/g,""); - } - // nur ein Slash gibt Absturz - path=path.replace(/^\\$/,"c:\\"); - //alert(path); - } - return path; -} - -function file_open(){ - var nsIFilePicker = Components.interfaces.nsIFilePicker; - var fp = Components.classes["@mozilla.org/filepicker;1"] - .createInstance(nsIFilePicker); - fp.init(window, "Select a Directory", nsIFilePicker.modeGetFolder); - - // set default direcotry - var aLocalFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); - directory=makePathCompatible(directory); - aLocalFile.initWithPath(directory); - fp.displayDirectory=aLocalFile; - - var res=fp.show(); - if (res==nsIFilePicker.returnOK){ - directory=fp.fileURL.path; - directory=makePathCompatible(directory); - setTreeDirectory(); - } -} - -function setTreeDirectory(){ - var t=document.getElementById("file_tree"); - t.setAttribute("ref","file://"+directory); -} - -function refreshTree(){ - var t=document.getElementById("file_tree"); - t.builder.rebuild(); -} - -function file_save(){ - - // get Digilib-Parameter form Browser - // alert(window.content.location.href); - - var documentpath=''; - try{ - documentpath=window.content.getParameter('fn'); - }catch (e){ - documentpath=''; - } - if (documentpath != ''){ - var docPath='urn:echo:'+documentpath; - - var rdfString='<?xml version="1.0"?>' + - '<RDF:RDF xmlns:NS1="http://echo.unibe.ch/digilib/rdf#"' + - ' xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' + - ' xmlns:d="http://purl.org/dc/elements/1.0/"' + - ' xmlns:a="http://www.w3.org/2000/10/annotation-ns#">' + - ' <RDF:Seq RDF:about="urn:echo">' + - ' <RDF:li RDF:resource="'+docPath+'"/>' + - ' </RDF:Seq>' + - ' <RDF:Description RDF:about="'+docPath+'" NS1:page=0"/>'+ - '</RDF:RDF>'; - - var ds=new RDFDataSource(); - ds.parseFromString(rdfString,"http://echo.unibe.ch/digilib/rdf/digilib.rdf"); - var node=ds.getNode(docPath); - var arrayParams=window.content.listParameters(); - for (i=0; i< arrayParams.length; i++){ - var value=window.content.getParameter(arrayParams[i]); - //alert(arrayParams[i]+":"+value); - node.addTarget("http://echo.unibe.ch/digilib/rdf#"+arrayParams[i],value); - } - node.addTarget("http://echo.unibe.ch/digilib/rdf#lv","1"); - //alert(ds.serializeToString()); - var nsIFilePicker = Components.interfaces.nsIFilePicker; - var fp = Components.classes["@mozilla.org/filepicker;1"] - .createInstance(nsIFilePicker); - fp.init(window, "Select a File", nsIFilePicker.modeSave); - - // set default direcotry - var aLocalFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); - directory=makePathCompatible(directory); - aLocalFile.initWithPath(directory); - fp.displayDirectory=aLocalFile; - - fp.appendFilter("Annotations","*.rdf; *.RDF"); - var res=fp.show(); - if (res==nsIFilePicker.returnOK){ - var thefile=fp.file; - // --- do something with the file here --- - //alert(fp.file); - //alert(fp.fileURL.path); - - var strFilePath=fp.file.path; - strFilePath=strFilePath.toLowerCase(); - if (strFilePath.indexOf('.rdf')<0){ - strFilePath=fp.fileURL.path+".rdf"; - }else{ - strFilePath=fp.fileURL.path; - } - strFilePath=makePathCompatible(strFilePath); - var f=new File(strFilePath); - //var boolFileExists=f.exists(); - //alert(boolFileExists); - f.create(); - f.open('w'); - f.write(ds.serializeToString()); - f.close(); - refreshTree(); - } - }else{ - alert("Error: no alcatraz component. can't create an annotation."); - } -} - -function file_local(){ - // noch nicht programmiert -} - -function file_annotaDB(){ - alert("At the moment it is not possible to use the annota DB! This feature is not yet programmed."); - var menu_item=document.getElementById('local'); - menu_item.setAttribute('checked','true'); -} - -function tree_click(){ - var t=document.getElementById("file_tree"); //tree element - var l=t.view.getItemAtIndex(t.currentIndex); //aus baum treeitem herausholen mit dem selected index (currentIndex) - //l.firstChild ist treeitem - var d=l.firstChild.firstChild; //treecell - var firstLabel=d.getAttribute("label"); - var cols=document.getElementById("cols"); - var col=cols.childNodes; - var nodes=l.firstChild.childNodes; - var rdf_file=""; - for (var i=0;i<nodes.length;i++){ - if (col[i].getAttribute("label")=="URL"){ - rdf_file=nodes[i].getAttribute("label"); - } - } - if (rdf_file!=""){ - send_annotation(rdf_file); - } - return rdf_file; -} - - -/*** -* Diese Funktion wird gebraucht um im Dialog den Pfad zu digilib zu setzen -* -***/ -function setDigilibPath(digilibPathValue){ - digilib_path=digilibPathValue; -} - -/*** -* Dialog tools momentan kann man nur den Pfad zu digilib setzen -* -***/ -function show_dialog(dialog){ - if (dialog=="tool path"){ - window.openDialog("tools_dialog.xul","funny dialog", - "chrome",digilib_path,setDigilibPath); - } -} - - -/*** -* Gibt den Inhalt eines Files als String zurueck -* -***/ -function readFile(str_Filename){ - var f=new File(str_Filename); - var str=""; - if (f.isFile()){ - f.open(); - str=f.read(); - f.close(); - } - return str; -} - - - -function send_annotation(rdf_file){ - rdf_file=rdf_file.replace(/^file:\/\//,""); - rdf_file=makePathCompatible(rdf_file); - strRdfFile=readFile(rdf_file); - if (strRdfFile!=""){ - var formid='mainform'; - var form = createForm(formid, digilib_path+"/digilib.jsp", "post", "_content"); - //var form = createForm(formid, "http://sophia.unibe.ch:8080/examples/servlet/RequestRDF", "post", "_content"); - //var form = createForm(formid, "http://hera.unibe.ch:8080/examples/servlet/RequestRDF", "post", "_content"); - setFormData(form, formid, strRdfFile); - form.submit(); - } -} - -function createForm(formid, action, method, target) -{ - var form = document.getElementById(formid); - if(form != null) - document.documentElement.removeChild(form); - - var form = document.createElementNS("http://www.w3.org/1999/xhtml", "form"); - form.setAttribute("id", formid); - form.setAttribute("action", action); - form.setAttribute("method", method); - form.setAttribute("target", target); - document.documentElement.appendChild(form); - return form; -} - -function setFormData(form, formid, rdf) -{ - var val1 = document.createElementNS("http://www.w3.org/1999/xhtml", "input"); - val1.setAttribute('type', 'hidden'); - val1.setAttribute('name', 'rdf'); - val1.setAttribute('value', rdf); - form.appendChild(val1); -} - - -function getProfileDirectory(){ - // First get the directory service and query interface it to - // nsIProperties - var dirService = Components. - classes['@mozilla.org/file/directory_service;1']. - getService(Components.interfaces.nsIProperties); - - // Next get the "ProfD" property of type nsIFile from the directory - // service, FYI this constant is defined in - // mozilla/xpcom/io/nsAppDirectoryServiceDefs.h - - const NS_APP_USER_PROFILE_50_DIR = "ProfD"; - profileDir = dirService.get(NS_APP_USER_PROFILE_50_DIR, - Components.interfaces.nsIFile); - - // Now that we have it we can show it's path. See nsIFile for the - // other things you that can be done with profileDir - //alert(profileDir.path); - return profileDir.path; -} - -function getProfile(){ - var strProfile=readFile(getProfileDirectory()+slash+"annota.dat"); - if (strProfile==""){ - directory=slash; - digilib_path="http://hera.unibe.ch:8080/alcatraz"; - setProfile(); - }else{ - var params=strProfile.split("\n"); - for (var i=0;i<params.length;i++){ - var key_value=params[i].split("|"); - if (key_value[0]=='directory'){ - directory=key_value[1]; - } - if (key_value[0]=='tool path'){ - digilib_path=key_value[1]; - } - } - } -} - -function setProfile(){ - var f=new File(getProfileDirectory()+slash+'annota.dat'); - f.create(); - f.open('w'); - f.write('directory|'+directory+'\n'+'tool path|'+digilib_path+'\n'); - f.close(); -} - -function traverse(node){ - if (node.hasChildNodes){ - var arr_nodes=node.childNodes; - for (var i=0;i<arr_nodes.length;i++){ - if (arr_nodes[i].getAttribute("open")){ - //alert(arr_nodes[i].getAttribute("open")); - if (arr_nodes[i].hasChildNodes && arr_nodes[i].firstChild.hasChildNodes){ - alert(arr_nodes[i].firstChild.firstChild.getAttribute("label")); - } - } - traverse(arr_nodes[i]); - } - } -} - -function traverseTree(){ - var t=document.getElementById("file_tree"); - traverse(t); -}
--- a/xul/annota/annota.xul Fri Feb 27 11:06:54 2004 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -<?xml version="1.0"?> - -<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> - -<window id="example-window" title="Example 5.1.1" - xmlns:html="http://www.w3.org/1999/xhtml" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onload="setTreeDirectory()"> -<toolbox flex="1"> - <script type="application/x-javascript" src="chrome://jslib/content/jslib.js" /> - <script language="JavaScript" src="annota.js"/> - <script language="JavaScript" src="rdfds.js"/> - <menubar id="sample-menubar"> - <menu id="file-menu" label="File"> - <menupopup id="file-popup"> - <menuitem label="Save" onclick="file_save()" /> - </menupopup> - </menu> - <menu id="edit-menu" label="Options"> - <menupopup id="edit-popup"> - <menuitem id="local" label="Local" type="radio" name="location" checked="true" onclick="file_local()" /> - <menuitem id="annotaDB" label="Annota DB" type="radio" name="location" onclick="file_annotaDB()" /> - <menuseparator/> - <menuitem id="tool_path" label="Tool URL" onclick="show_dialog('tool path')" /> - <menuitem id="annotations_path" label="Path to annotations" onclick="file_open()" /> - <menuseparator/> - <menuitem id="save_options" label="Save Options" onclick="setProfile()" /> - </menupopup> - </menu> - </menubar> -</toolbox> -<vbox flex="100"> - <tree id="file_tree" flex="1" datasources="rdf:files" ref="file:///" ondblclick="tree_click()"> - - <treecols id="cols"> - <treecol id="name" label="Name" primary="true" flex="1"/> - <treecol id="url" label="URL" hidden="true" flex="1"/> - </treecols> - - <template> - - <rule> - <treechildren flex="1" > - <treeitem uri="rdf:*" persist="open"> - <treerow> - <treecell label="rdf:http://home.netscape.com/NC-rdf#Name"/> - <treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/> - </treerow> - </treeitem> - </treechildren> - </rule> - - </template> - </tree> - -</vbox> -</window>
--- a/xul/annota/rdfds.js Fri Feb 27 11:06:54 2004 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,760 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is rdfds - * - * The Initial Developer of the Original Code is Neil Deakin - * Portions created by Neil Deakin are Copyright (C) 2002 Neil Deakin. - * All Rights Reserved. - * - * Contributor(s): - */ - -/* This is a library for easier access to RDF datasources and resources. - * It contains four objects, RDFDataSource, RDFNode, RDFLiteral. and - * RDFEnumerator. - * - * An RDF DataSource is a graph of nodes and literals. The constructor - * for RDFDataSource takes one argument, a URI of an RDF file to use. - * If the URI exists, the contents of the RDF file are loaded. If it - * does not exist, resources can be added to it and then written using - * this save method. If the URL argument is null, a blank datasource - * is created. - * - * This library is designed for convenience not for efficiency. - * - * The API is documented at: - * http://www.xulplanet.com/tutorials/xultu/rdfds/ - * - * Example: - * - * var ds=new RDFDataSource("file:///main/mozilla/mimtest.rdf"); - * var node=ds.getNode("urn:xpimaker:packlist"); - * var child=ds.getNode("urn:xpimaker:packlist:appinfo"); - * child=node.addChild(child); - * child.addTarget("http://www.xulplanet.com/rdf/xpimaker#appname","Find Files"); - * ds.save(); - * - */ - -var RDFService = "@mozilla.org/rdf/rdf-service;1"; -RDFService = Components.classes[RDFService].getService(); -RDFService = RDFService.QueryInterface(Components.interfaces.nsIRDFService); - -var RDFContainerUtilsService = "@mozilla.org/rdf/container-utils;1"; -RDFContainerUtilsService = Components.classes[RDFContainerUtilsService].getService(); -RDFContainerUtilsService = RDFContainerUtilsService.QueryInterface(Components.interfaces.nsIRDFContainerUtils); - -/* RDFLoadObserver - * this object is necessary to listen to RDF files being loaded. The Init - * function should be called to initialize the callback when the RDF file is - * loaded. - */ -function RDFLoadObserver(){} - -RDFLoadObserver.prototype = -{ - callback: null, - callbackDataSource: null, - - Init: function(c,cDS){ - this.callback=c; - this.callbackDataSource=cDS; - }, - - QueryInterface: function(iid){ - if (iid.equals(Components.interfaces.nsIRDFXMLSinkObserver)) return this; - else throw Components.results.NS_ERROR_NO_INTERFACE; - }, - - onBeginLoad : function(sink){}, - onInterrupt : function(sink){}, - onResume : function(sink){}, - onError : function(sink,status,msg){}, - - onEndLoad : function(sink){ - if (this.callback!=null) this.callback(this.callbackDataSource); - } -}; - -function RDFDataSource(uri,callbackFn) -{ - if (uri==null) this.datasource=null; - else this.load(uri,callbackFn); -} - -RDFDataSource.prototype.load= - function(uri,callbackFn) -{ - if (uri.indexOf(":") == -1){ - var docurl=document.location.href; - if (document.location.pathname == null) uri=docurl+"/"+uri; - else uri=docurl.substring(0,docurl.lastIndexOf("/")+1)+uri; - } - - if (callbackFn == null){ - this.datasource=RDFService.GetDataSourceBlocking(uri); - } - else { - this.datasource=RDFService.GetDataSource(uri); - var ds; - try { - var ds=this.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); - } - catch (ex){ - callbackFn(this); - return; - } - if (ds.loaded){ - callbackFn(this); - return; - } - - var packObserver=new RDFLoadObserver(); - packObserver.Init(callbackFn,this); - - var rawsource=this.datasource; - rawsource=rawsource.QueryInterface(Components.interfaces.nsIRDFXMLSink); - rawsource.addXMLSinkObserver(packObserver); - } -} - -RDFDataSource.prototype.Init= - function (dsource) -{ - this.datasource=dsource; -} - -RDFDataSource.prototype.parseFromString= - function (str,baseUri) -{ - if (this.datasource==null) this.makeemptyds(); - var ios=Components.classes["@mozilla.org/network/io-service;1"] - .getService(Components.interfaces.nsIIOService); - baseUri=ios.newURI(baseUri,null,null); - var xmlParser=Components.classes["@mozilla.org/rdf/xml-parser;1"] - .createInstance(Components.interfaces.nsIRDFXMLParser); - xmlParser.parseString(this.datasource,baseUri,str); -} - -RDFDataSource.prototype.serializeToString= - function () -{ - var outputStream = { - data: "", - close : function(){}, - flush : function(){}, - write : function (buffer,count){ - this.data += buffer; - return count; - }, - writeFrom : function (stream,count){}, - isNonBlocking: false - } - this.serializeToStream(outputStream); - return outputStream.data; -} - -RDFDataSource.prototype.serializeToStream= - function (outputStream) -{ - var ser=Components.classes["@mozilla.org/rdf/xml-serializer;1"] - .createInstance(Components.interfaces.nsIRDFXMLSerializer); - ser.init(this.datasource); - ser.QueryInterface(Components.interfaces.nsIRDFXMLSource).Serialize(outputStream); -} - -RDFDataSource.prototype.makeemptyds= - function (uri) -{ - this.datasource=Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"] - .createInstance(Components.interfaces.nsIRDFDataSource); -} - -RDFDataSource.prototype.getAllResources= - function () -{ - if (this.datasource==null) return null; - return new RDFEnumerator(this.datasource.GetAllResources(),this.datasource); -} - -RDFDataSource.prototype.getRawDataSource= - function () -{ - if (this.datasource==null) this.makeemptyds(); - return this.datasource; -} - -RDFDataSource.prototype.getNode= - function (uri) -{ - if (this.datasource==null) this.makeemptyds(); - var node=new RDFNode(uri,this); - return node; -} - -RDFDataSource.prototype.getAnonymousNode= - function () -{ - if (this.datasource==null) this.makeemptyds(); - - var anon=RDFService.GetAnonymousResource(); - var node=new RDFNode(); - node.Init(anon,this.datasource); - return node; -} - -RDFDataSource.prototype.getLiteral= - function (uri) -{ - if (this.datasource==null) this.makeemptyds(); - - return new RDFLiteral(uri,this); -} - -RDFDataSource.prototype.refresh= - function (sync) -{ - try { - var ds=this.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); - ds.Refresh(sync); - return true; - } - catch (ex){ - return false; - } -} - -RDFDataSource.prototype.save= - function () -{ - try { - var ds=this.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); - ds.Flush(); - return true; - } - catch (ex){ - return false; - } -} - -RDFDataSource.prototype.copyAllToDataSource= - function (dsource2) -{ - if (this.datasource==null) this.makeemptyds(); - if (dsource2.datasource==null) dsource2.makeemptyds(); - - var dsource1=this.datasource; - dsource2=dsource2.datasource; - - var sourcelist=dsource1.GetAllResources(); - while(sourcelist.hasMoreElements()){ - var source=sourcelist.getNext(); - var props=dsource1.ArcLabelsOut(source); - while(props.hasMoreElements()){ - var prop=props.getNext(); - prop=prop.QueryInterface(Components.interfaces.nsIRDFResource); - var target=dsource1.GetTarget(source,prop,true); - if (target!=null) dsource2.Assert(source,prop,target,true); - } - } -} - -RDFDataSource.prototype.deleteRecursive= - function (val) -{ - var node; - var dsource=this.datasource; - - if (dsource==null) return; - - if (typeof val == "string") node=RDFService.GetResource(val); - else node=val.source; - - this.deleteRecursiveH(dsource,node); // remove descendants - - // remove the node itself - var props=dsource.ArcLabelsIn(node); - while(props.hasMoreElements()){ - var prop=props.getNext(); - var source=dsource.GetSource(prop,node,true); - dsource.Unassert(source,prop,node); - } -} - -RDFDataSource.prototype.deleteRecursiveH= - function (dsource,node) -{ - var props=dsource.ArcLabelsOut(node); - while(props.hasMoreElements()){ - var prop=props.getNext(); - var target=dsource.GetTarget(node,prop,true); - try { - target=target.QueryInterface(Components.interfaces.nsIRDFResource); - this.deleteRecursiveH(dsource,target); - } - catch (e){} - dsource.Unassert(node,prop,target) - } -} - -function RDFNode(uri,dsource) -{ - if (uri==null) this.source=null; - else this.source=RDFService.GetResource(uri); - - if (dsource==null) this.datasource=null; - else this.datasource=dsource.datasource; - - this.container=null; -} - -RDFNode.prototype.Init= - function (source,dsource) -{ - this.source=source; - this.datasource=dsource; - this.container=null; -} - -RDFNode.prototype.getValue= - function () -{ - return this.source.Value; -} - -RDFNode.prototype.rlify= - function (val) -{ - var res=null; - - if (val!=null){ - try { - val=val.QueryInterface(Components.interfaces.nsIRDFResource); - res=new RDFNode(); - res.Init(val,this.datasource); - } - catch (ex){ - try { - val=val.QueryInterface(Components.interfaces.nsIRDFLiteral); - res=new RDFLiteral(); - res.Init(val,this.datasource); - } - catch (ex2){ - } - } - } - return res; -} - -RDFNode.prototype.makeres= - function (val) -{ - if (typeof val == "string") return RDFService.GetResource(val); - else return val.source; -} - -RDFNode.prototype.makelit= - function (val) -{ - if (typeof val == "string") return RDFService.GetLiteral(val); - else return val.source; -} - -RDFNode.prototype.makecontain= - function () -{ - if (this.container!=null) return true; - - var RDFContainer = '@mozilla.org/rdf/container;1'; - RDFContainer = Components.classes[RDFContainer].createInstance(); - RDFContainer = RDFContainer.QueryInterface(Components.interfaces.nsIRDFContainer); - - try { - RDFContainer.Init(this.datasource,this.source); - this.container=RDFContainer; - return true; - } - catch (ex){ - return false; - } -} - -RDFNode.prototype.addTarget= - function (prop,target) -{ - prop=this.makeres(prop); - target=this.makelit(target); - this.datasource.Assert(this.source,prop,target,true); -} - -RDFNode.prototype.addTargetOnce= - function (prop,target) -{ - prop=this.makeres(prop); - target=this.makelit(target); - - var oldtarget=this.datasource.GetTarget(this.source,prop,true); - if (oldtarget!=null){ - this.datasource.Change(this.source,prop,oldtarget,target); - } - else { - this.datasource.Assert(this.source,prop,target,true); - } -} - -RDFNode.prototype.modifyTarget= - function (prop,oldtarget,newtarget) -{ - prop=this.makeres(prop); - oldtarget=this.makelit(oldtarget); - newtarget=this.makelit(newtarget); - this.datasource.Change(this.source,prop,oldtarget,newtarget); -} - -RDFNode.prototype.modifySource= - function (prop,oldsource,newsource) -{ - prop=this.makeres(prop); - oldsource=this.makeres(oldsource); - newsource=this.makeres(newsource); - this.datasource.Move(oldsource,newsource,prop,this.source); -} - -RDFNode.prototype.targetExists= - function (prop,target) -{ - prop=this.makeres(prop); - target=this.makelit(target); - return this.datasource.HasAssertion(this.source,prop,target,true); -} - -RDFNode.prototype.removeTarget= - function (prop,target) -{ - prop=this.makeres(prop); - target=this.makelit(target); - this.datasource.Unassert(this.source,prop,target); -} - -RDFNode.prototype.getProperties= - function () -{ - return new RDFEnumerator(this.datasource.ArcLabelsOut(this.source),this.datasource); -} - -RDFNode.prototype.getInProperties= - function () -{ - return new RDFEnumerator(this.datasource.ArcLabelsIn(this.source),this.datasource); -} - -RDFNode.prototype.propertyExists= - function (prop) -{ - prop=this.makeres(prop); - return this.datasource.hasArcOut(this.source,prop); -} - -RDFNode.prototype.inPropertyExists= - function (prop) -{ - prop=this.makeres(prop); - return this.datasource.hasArcIn(this.source,prop); -} - -RDFNode.prototype.getTarget= - function (prop) -{ - prop=this.makeres(prop); - return this.rlify(this.datasource.GetTarget(this.source,prop,true)); -} - -RDFNode.prototype.getSource= - function (prop) -{ - prop=this.makeres(prop); - var src=this.datasource.GetSource(prop,this.source,true); - if (src==null) return null; - var res=new RDFNode(); - res.Init(src,this.datasource); - return res; -} - -RDFNode.prototype.getTargets= - function (prop) -{ - prop=this.makeres(prop); - return new RDFEnumerator( - this.datasource.GetTargets(this.source,prop,true),this.datasource); -} - -RDFNode.prototype.getSources= - function (prop) -{ - prop=this.makeres(prop); - return new RDFEnumerator( - this.datasource.GetSources(prop,this.source,true),this.datasource); -} - -RDFNode.prototype.makeBag= - function () -{ - this.container=RDFContainerUtilsService.MakeBag(this.datasource,this.source); -} - -RDFNode.prototype.makeSeq= - function () -{ - this.container=RDFContainerUtilsService.MakeSeq(this.datasource,this.source); -} - -RDFNode.prototype.makeAlt= - function () -{ - this.container=RDFContainerUtilsService.MakeAlt(this.datasource,this.source); -} - -RDFNode.prototype.isBag= - function () -{ - return RDFContainerUtilsService.isBag(this.datasource,this.source); -} - -RDFNode.prototype.isSeq= - function () -{ - return RDFContainerUtilsService.isSeq(this.datasource,this.source); -} - -RDFNode.prototype.isAlt= - function () -{ - return RDFContainerUtilsService.isAlt(dsource,this.source); -} - -RDFNode.prototype.isContainer= - function () -{ - return RDFContainerUtilsService.IsContainer(this.datasource,this.source); -} - -RDFNode.prototype.getChildCount= - function () -{ - if (this.makecontain()){ - return this.container.GetCount(); - } - return -1; -} - -RDFNode.prototype.getChildren= - function () -{ - if (this.makecontain()){ - return new RDFEnumerator(this.container.GetElements(),this.datasource); - } - else return null; -} - -RDFNode.prototype.addChild= - function (child,exists) -{ - if (this.makecontain()){ - var childres=null; - if (typeof child == "string"){ - childres=RDFService.GetResource(child); - child=new RDFNode(); - child.Init(childres,this.datasource); - } - else childres=child.source; - - if (!exists && this.container.IndexOf(childres)>=0) return child; - - this.container.AppendElement(childres); - return child; - } - else return null; -} - -RDFNode.prototype.addChildAt= - function (child,idx) -{ - if (this.makecontain()){ - var childres=null; - if (typeof child == "string"){ - childres=RDFService.GetResource(child); - child=new RDFNode(); - child.Init(childres,this.datasource); - } - else childres=child.source; - this.container.InsertElementAt(childres,idx,true); - return child; - } - else return null; -} - -RDFNode.prototype.removeChild= - function (child) -{ - if (this.makecontain()){ - var childres=null; - if (typeof child == "string"){ - childres=RDFService.GetResource(child); - child=new RDFNode(); - child.Init(childres,this.datasource); - } - else childres=child.source; - this.container.RemoveElement(childres,true); - return child; - } - else return null; -} - -RDFNode.prototype.removeChildAt= - function (idx) -{ - if (this.makecontain()){ - var childres=this.container.RemoveElementAt(idx,true); - return this.rlify(childres); - } - else return null; -} - -RDFNode.prototype.getChildIndex= - function (child) -{ - if (this.makecontain()){ - return this.container.IndexOf(child.source); - } - else return -1; -} - -RDFNode.prototype.type="Node"; - - -function RDFLiteral(val,dsource) -{ - if (val==null) this.source=null; - else this.source=RDFService.GetLiteral(val); - - if (dsource==null) this.datasource=null; - else this.datasource=dsource.datasource; -} - -RDFLiteral.prototype.Init= - function (source,dsource) -{ - this.source=source; - this.datasource=dsource; -} - -RDFLiteral.prototype.getValue= - function () -{ - return this.source.Value; -} - -RDFLiteral.prototype.makeres= - function (val) -{ - if (typeof val == "string") return RDFService.GetResource(val); - else return val.source; -} - -RDFLiteral.prototype.makelit= - function (val) -{ - if (typeof val == "string") return RDFService.GetLiteral(val); - else return val.source; -} - -RDFLiteral.prototype.modifySource= - function (prop,oldsource,newsource) -{ - prop=this.makeres(prop); - oldsource=this.makeres(oldsource); - newsource=this.makeres(newsource); - this.datasource.Move(oldsource,newsource,prop,this.source); -} - -RDFLiteral.prototype.getInProperties= - function (prop) -{ - return new RDFEnumerator(this.datasource.ArcLabelsIn(this.source),this.datasource); -} - -RDFLiteral.prototype.inPropertyExists= - function (prop) -{ - prop=this.makeres(prop); - return this.datasource.hasArcIn(this.source,prop); -} - -RDFLiteral.prototype.getSource= - function (prop) -{ - prop=this.makeres(prop); - var src=this.datasource.GetSource(prop,this.source,true); - if (src==null) return null; - var res=new RDFNode(); - res.Init(src,this.datasource); - return res; -} - -RDFLiteral.prototype.getSources= - function (prop) -{ - prop=this.makeres(prop); - return new RDFEnumerator( - this.datasource.GetSources(prop,this.source,true),this.datasource); -} - -RDFLiteral.prototype.type="Literal"; - - -function RDFEnumerator(enumeration,dsource) -{ - this.enumeration=enumeration; - this.datasource=dsource; -} - -RDFEnumerator.prototype.hasMoreElements= - function () -{ - return this.enumeration.hasMoreElements(); -} - -RDFEnumerator.prototype.getNext= - function () -{ - var res=null; - var val=this.enumeration.getNext(); - - if (val!=null){ - try { - val=val.QueryInterface(Components.interfaces.nsIRDFResource); - res=new RDFNode(); - res.Init(val,this.datasource); - } - catch (ex){ - try { - val=val.QueryInterface(Components.interfaces.nsIRDFLiteral); - res=new RDFLiteral(); - res.Init(val,this.datasource); - } - catch (ex2){ - } - } - } - return res; -} -
--- a/xul/annota/tools_dialog.xul Fri Feb 27 11:06:54 2004 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -<?xml version="1.0"?> - -<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> - -<dialog id="donothing" title="tool path" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - buttons="accept,cancel" - ondialogaccept="return doOK();" - ondialogcancel="return doCancel();"> - -<label control="digilib_path" value="tool path (where you can find digilib.jsp)"/> -<textbox id="digilib_path"/> -<script> -document.getElementById('digilib_path').value=window.arguments[0]; - -function doOK() -{ - window.arguments[1](document.getElementById('digilib_path').value); - return true; -} - -function doCancel() -{ - return true; -} - -</script> - -</dialog>
--- a/xul/install_sidebar.jsp Fri Feb 27 11:06:54 2004 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -<%@page contentType="text/html" import="java.util.*"%> -<% - String serverName = request.getServerName(); - int serverPort = request.getServerPort(); - String serverPATH = request.getRequestURI(); - int lastSlash = serverPATH.lastIndexOf("/"); - serverPATH=serverPATH.substring(0, lastSlash); -%> -<html> -<head> -<title>Alcatraz-XUL-Sidebars</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - -<script language="JavaScript"> -<!-- simple one-line side-bar-installer , addPanel("title in sidebar","url","url to customize tab. is optional") - - -// deluxe sidebar installer with browser testing - - function addSidebarPanel(name, url) { - if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) - { - window.sidebar.addPanel (name,url,""); - } - else - { - alert ("To use this functionality a Netscape 6+ or Mozilla browser is needed !"); - } - } ---> -</script> - - -</head> - -<body bgcolor="#FFFFFF" text="#000000"> -<div align=center> - -<br> <br> - -<h3>Alcatraz-XUL-Sidebars</h3> -<!-- installing tab into sidebar with javascript inside form--> - - Digilib-Buttons im Sidebar - <br> - <input type="submit" name="Abschicken" value="Install Button-List into Sidebar!" onClick="javascript:sidebar.addPanel('DIGILIB-Buttons', 'http://<%=serverName%>:<%=serverPort%><%=serverPATH%>/buttons.xul','');"> - <br><br> - -</div> -</body> - -</html>
--- a/xul/menu.js Fri Feb 27 11:06:54 2004 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* -Copyright (C) 2003 WTWG, Uni Bern - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3 -*/ -function rotate() { - value = prompt("Enter absolute rotation angle in degrees (clockwise orientation) :"); - - if (value) { - window.content.rotation(value); - } -} - -function color_add() { - - value = prompt("Enter the values you like to add to the red, green and blue color channel.\n\nFormat is R/G/B, where R,G,B are floating numbers between -255 and +255."); - - if (value) { - - values = value.split("/"); - - if (values.length != 3) alert("Illegal format"); - else if ((values[0] < -255) || (values[0] > 255)) alert("Illegal value for red"); - else if ((values[1] < -255) || (values[1] > 255)) alert("Illegal value for green"); - else if ((values[2] < -255) || (values[2] > 255)) alert("Illegal value for blue"); - - else window.content.rgba(value); - - } -} - -function color_multiply() { - - value = prompt("Enter the values you like to multiply with the different color channels.\n\nFormat is R/G/B, where R,G,B are floating numbers bigger than 0."); - - if (value) { - - values = value.split("/"); - - if (values.length != 3) alert("Illegal format"); - else if (values[0] < 0) alert("Illegal value for red"); - else if (values[1] < 0) alert("Illegal value for green"); - else if (values[2] < 0) alert("Illegal value for blue"); - - else window.content.rgbm(value); - - } -} - -function showMetadata(myurl){ - var arrUrl=myurl.split("?"); - var strDigilib=arrUrl[0]; - var strParams=arrUrl[1]; - var strArguments=strParams.split("&"); - var strDocDir=""; - for (i=0;i<strArguments.length;i++){ - var strArg=strArguments[i]; - var intPos=strArg.indexOf("fn="); - if (intPos>=0){ - strDocDir=strArg.substr(intPos+3); - } - } - if (strDocDir == ""){ - alert("no metadata available"); - }else{ - window.open("showMetadata.jsp?docdir="+strDocDir,"Metadata "+strDocDir,"menubar=no scrollbars=yes height=400 width=600"); - } -} - - -function checkBrowser() { - - this.ua = navigator.userAgent; - this.ver = navigator.appVersion; - this.dom = ( document.getElementById ); - this.opera = ( this.dom ) && ( this.ua.toLowerCase().indexOf("opera") > -1 ); - this.ie4 = ( document.all ) && ( !this.dom ); - this.ie5 = ( this.ver.indexOf("MSIE 5") > -1 ) && ( this.dom ); - this.ie6 = ( this.ver.indexOf("MSIE 6") > -1 ) && ( this.dom ); - this.ns4 = ( document.layers ) && ( !this.dom ); - this.ns6 = ( this.dom ) && ( parseInt(this.ver) >= 5 ) && ( !this.opera ); - this.ns = this.ns4 || this.ns6; - this.ie = this.ie4 || this.ie5 || this.ie6; - - return this; -} - -browser = new checkBrowser(); - -function overButton(n) { - if (showHelp) contextHelp(n); -} - - -// just to be sure, that no buffer overflow can arrive -var semaphor = true; - -function contextHelp(n) { - - if (helpWindow.closed) { - changeHelp(); - return; - } - - if ((navigator.appVersion.indexOf("Macintosh") < 0) && semaphor) { - semaphor = false; - - var tmpHelp = helpText[n]; - tmpHelp = tmpHelp.replace(/\(br\)/,"<br>"); - var help = tmpHelp.split("|"); - - helpWindow.focus(); - helpWindow.document.open(); - helpWindow.document.write('<html><head><title>Context Help</title>'); - helpWindow.document.write('<style type="text/css">'); - helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}'); - helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}'); - helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7" onload="opener.semaphor = true;">'); - helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3"><tr><td bgcolor="#666666" class="title">'); - helpWindow.document.write(help[0] + '</tr><tr><td class="text">'); - helpWindow.document.write(help[1] + '</tr></td></table></body></html>'); - helpWindow.document.close(); - - - // stupid workaround because of netscape 6, that doesen't know the opener property - // this workaround is still ok because netscape 6 has eventbuffer checks so no overflow - if (browser.ns6) { - semaphor = true; - } - - // next stupid workaround because of opera 6, that somehow don't start the 'onLoad'- - // attribute in the body tag (the helpwindow does not finish loading) - if (browser.opera) { - setTimeout("semaphor = true;", 50); - } - - } - -} - -function openContextHelp() { - if (navigator.appVersion.indexOf("Macintosh") > -1) { - openContextHelpMac(); - return; - } - - semaphor = false; - - var winWidth = 270; - var winHeight = 130; - - var xScreen = 0.9*(screen.width-winWidth); - var yScreen = 0.8*(screen.height-winHeight); - - helpWindow = window.open("", "ContextHelp", "width=" + winWidth + ",height=" + winHeight + ",screenX=" + xScreen + ",screenY=" + yScreen + ",left=" + xScreen + ",top=" + yScreen); - - helpWindow.focus(); - helpWindow.document.open(); - helpWindow.document.write('<html><head><title>Context Help</title>'); - helpWindow.document.write('<style type="text/css">'); - helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}'); - helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}'); - helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7">'); - helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3"><tr><td bgcolor="#666666" class="title">'); - helpWindow.document.write('Context Help</tr><tr><td class="text">'); - helpWindow.document.write('Move over any button to get some more information about its function</tr></td></table></body></html>'); - helpWindow.document.close(); - - // for some safety reason help-requests have to be blocked while opening the window - setTimeout("semaphor = true;", 200); -} - -// because macs have a strange window focus behaviour we have to go a special - -// way for them - just opening a window that contains all button-descriptions - -function openContextHelpMac() { - - var winWidth = 270; - var winHeight = 600; - - var xScreen = 0.9*(screen.width-winWidth); - var yScreen = 0.8*(screen.height-winHeight); - - helpWindow = window.open("", "ContextHelp", "width=" + winWidth + ",height=" + winHeight + ",screenX=" + xScreen + ",screenY=" + yScreen + ",left=" + xScreen + ",top=" + yScreen + ",scrollbars"); - - helpWindow.focus(); - helpWindow.document.open(); - helpWindow.document.write('<html><head><title>Context Help Macintosh</title>'); - helpWindow.document.write('<style type="text/css">'); - helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}'); - helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}'); - helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7">'); - helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3">'); - - for (n = 0; n < helpText.length; n++) { - - help = helpText[n].split("|"); - helpWindow.document.write('<tr><td bgcolor="#666666" class="title">'); - helpWindow.document.write(help[0] + '</tr><tr><td class="text">'); - helpWindow.document.write('<p>' + help[1] + '<br> </p></tr></td>'); - } - - helpWindow.document.write('</table></body></html>'); - helpWindow.document.close(); -} - -function closeContextHelp() { - if (helpWindow != '' && !helpWindow.closed) { - helpWindow.close(); - } - - helpWindow = ''; - -} - -function changeHelp() { - showHelp = !showHelp; - showHelp ? openContextHelp() : closeContextHelp(); -} - - -// variable containing the contextwindow - -var helpWindow = ''; \ No newline at end of file