Mercurial > hg > digilib-old
changeset 203:bf945fcf9105
restarting with version control of xul sidebar/toolbar
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/alcatraz.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,32 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > + +<tabbox flex="1"> + <tabs> + <tab label="Navigio" /> + <tab label="Imago" /> + <tab label="Annota" /> + </tabs> + <tabpanels flex="1"> + <tabpanel id="navigio_tab"> + <tabbox flex="1"> + <iframe id="navigio_frame" src="navigio.xul" flex="1" /> + </tabbox> + </tabpanel> + <tabpanel id="imago_tab" selected="true"> + <tabbox flex="1"> + <iframe id="imago_frame" src="imago.xul" flex="1" /> + </tabbox> + </tabpanel> + <tabpanel id="annota_tab" orient="vertical"> + <tabbox flex="1"> + <iframe id="annota_frame" src="annota.xul" flex="1" /> + </tabbox> + </tabpanel> + </tabpanels> + </tabbox> +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/alcatraz_ohne_annota.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,132 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + onload="setTreeDirectory()"> + +<script type="application/x-javascript" src="chrome://jslib/content/jslib.js" /> +<script type="application/x-javascript" src="chrome://alcatraz/content/alcatraz.js" /> +<script type="application/x-javascript" src="chrome://alcatraz/content/annota.js" /> +<script type="application/x-javascript" src="chrome://alcatraz/content/rdfds.js" /> + +<popupset> + <popup id="scale_popup" onpopupshowing="markCurrentScale()"> + <menuitem id="scale_07" label="0.7" type="checkbox" oncommand="window.content.scale(0.7);" /> + <menuitem id="scale_10" label="1" type="checkbox" oncommand="window.content.scale(1);" /> + <menuitem id="scale_15" label="1.5" type="checkbox" oncommand="window.content.scale(1.5);" /> + <menuitem id="scale_20" label="2" type="checkbox" oncommand="window.content.scale(2);" /> + <menuitem id="scale_25" label="2.5" type="checkbox" oncommand="window.content.scale(2.5);" /> + <menuitem id="scale_30" label="3" type="checkbox" oncommand="window.content.scale(3);" /> + <menuitem id="scale_pbp" label="pixel by pixel" type="checkbox" oncommand="window.content.pixelByPixel();" /> + <menuitem id="scale_os" label="original size" type="checkbox" oncommand="dialog_originalsize();" /> + </popup> +</popupset> + +<popupset> + <popup id="mirror_popup" onpopupshowing="markCurrentMirror()"> + <menuitem id="mirror_h" label="Horizontal" type="checkbox" oncommand="window.content.mirror('h');" /> + <menuitem id="mirror_v" label="Vertical" type="checkbox" oncommand="window.content.mirror('v');" /> + </popup> +</popupset> + +<hbox> + <vbox flex="1" /> + <vbox> + <spacer style="height: 10px" /> + <hbox> + <button id="button_annotate" label="annotate" onclick="dialog_annotate();" flex="1" /> + </hbox> + <spacer style="height: 15px" /> + </vbox> + <vbox flex="1" /> +</hbox> +<tabbox flex="1"> + <tabs> + <tab label="Imago" /> + <tab label="Annota" /> + <tab label="Search" /> + </tabs> + <tabpanels flex="1"> + <tabpanel id="imago_tab" selected="true"> + <vbox flex="1" /> + <vbox> + <button id="button_scale" label="scale" popup="scale_popup" /> + <button id="button_mirror" label="mirror" popup="mirror_popup" /> + <button id="button_rotate" label="rotate" onclick="dialog_rotate();" /> + <spacer flex="1" /> + <button id="button_brightnesscontrast" label="brightness/contrast" onclick="dialog_brightnesscontrast();" /> + <button id="button_colors" label="colors" onclick="dialog_colors();" /> + <spacer flex="100" /> + </vbox> + <vbox flex="1" /> + </tabpanel> + <tabpanel id="annota_tab" orient="vertical"> + <vbox flex="1"> + <hbox> + <toolbarbutton id="annota_file" type="menu" label="File"> + <menupopup id="file_popup"> + <menuitem label="Save" onclick="file_save()" /> + </menupopup> + </toolbarbutton> + <toolbarbutton id="annota_options" type="menu" label="Options"> + <menupopup id="options_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> + </toolbarbutton> + </hbox> + + <tree id="file_tree" flex="100" 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> + </tabpanel> + <tabpanel id="search_tab"> + <tabbox flex="1"> + + <tabs> + <tab id="search_tab" selected="true" label="search" /> + <tab id="tree_tab" label="tree" /> + </tabs> + + <tabpanels flex="1"> + <tabpanel orient="vertical"> + <iframe id="search_frame" src="search.xul" height="180" /> + <iframe id="result_frame" flex="1" /> + </tabpanel> + <tabpanel> + <iframe id="tree_frame" src="tree.xul" flex="1" /> + </tabpanel> + </tabpanels> + </tabbox> + </tabpanel> + </tabpanels> +</tabbox> +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/alcatraz_toolbar.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,128 @@ +/* +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.5 +*/ + + +function dialog_page() { + window.openDialog("chrome://alcatraz/content/dialog_page.xul", "dialog_page", "chrome,dialog,resizable=no", ""); +} + + +function dialog_options() { + window.openDialog("chrome://alcatraz/content/dialog_options.xul", "dialog_options", "chrome,dialog,resizable=no", ""); +} + + +function updatePageDisplay() { + if ( typeof(window.content.getParameter) == 'function' ) { + var actual = window.content.getParameter('pn'); + var total = window.content.getParameter('pt'); + + if ( (parseInt(actual) > 0) && (parseInt(total) > 0)) { + document.getElementById('button_page').setAttribute('label', actual + " of " + total); + } + } + + setTimeout('updatePageDisplay()', 200); +} +setTimeout('updatePageDisplay()', 200); + + +function page(value) { + + var keeparea = getSetting( 'keeparea' ); + + if ( keeparea == 'true' ) { + window.content.page(value, 2); + } else if ( keeparea == 'false' ) { + window.content.page(value, 1); + } else { + // no preferences saved + window.content.page(value, 1); + } + +} + + +function zoomIn() { + + var zoomkind = getSetting( 'zoomkind' ); + + if ( zoomkind == 'zoomarea' ) { + window.content.zoomArea(); + } else if ( zoomkind == 'zoompoint' ) { + window.content.zoomPoint(); + } else { + // no preferences saved + window.content.zoomArea(); + } + +} + + +function zoomOut() { + + var zoomkind = getSetting( 'zoomkind' ); + + if ( zoomkind == 'zoomarea' ) { + window.content.zoomExtends(); + } else if ( zoomkind == 'zoompoint' ) { + window.content.zoomOut(); + } else { + // no preferences saved + window.content.zoomExtends(); + } + +} + + +function change_help() { + + if ( document.getElementById('item_contexthelp').getAttribute('checked') == 'true' ) { + + document.getElementById('button_first').setAttribute('tooltiptext', 'Go to the first page of this document'); + document.getElementById('button_prev').setAttribute('tooltiptext', 'Go to the previous page of this document'); + document.getElementById('button_page').setAttribute('tooltiptext', 'Go to a specific page you enter'); + document.getElementById('button_next').setAttribute('tooltiptext', 'Go to the next page of this document'); + document.getElementById('button_last').setAttribute('tooltiptext', 'Go to the last page of this document'); + document.getElementById('button_mark').setAttribute('tooltiptext', 'Place marks on the picture. Left-click on the image to place a numbered mark'); + document.getElementById('button_ref').setAttribute('tooltiptext', 'Get a hyperlink eighter which can reproduce your selected area and marks'); + document.getElementById('button_thumbs').setAttribute('tooltiptext', 'Open a thumbnailview of the current document (image serie)'); + document.getElementById('button_zoomin').setAttribute('tooltiptext', 'Zoom into the picture (behaviour is selected under ? -> Options)'); + document.getElementById('button_zoomout').setAttribute('tooltiptext', 'Zooms out of the selected region'); + + document.getElementById('button_help').setAttribute('tooltiptext', 'Change default options or (de)select the context-help'); + + document.getElementById('button_scale').setAttribute('tooltiptext', 'Select the factor the picture will be scaled to (relative to the size of the working area)'); + document.getElementById('button_mirror').setAttribute('tooltiptext', 'Mirrors the image eighter horizontally or vertically'); + document.getElementById('button_rotate').setAttribute('tooltiptext', 'Rotate the image by the angle you specify'); + document.getElementById('button_brightnesscontrast').setAttribute('tooltiptext', 'Adjust the brightness and contrast of the picture'); + document.getElementById('button_colors').setAttribute('tooltiptext', 'Adjust the values of each RGB color-channel'); + + } else { + + var buttons = document.getElementsByTagName('button'); + + for ( i = 0; i < buttons.length; i++ ) { + buttons[i].removeAttribute('tooltiptext'); + } + + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/alcatraz_toolbar.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://alcatraz/skin/" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<overlay id="alcatraz_toolbar" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <script type="application/x-javascript" src="chrome://jslib/content/jslib.js" /> + <script type="application/x-javascript" src="chrome://alcatraz/content/settings.js" /> + <script type="application/x-javascript" src="chrome://alcatraz/content/alcatraz_toolbar.js" /> + + <toolbox id="navigator-toolbox"> + <toolbar id="alcatraz_bar" tbalign="stretch"> + <image id="image_echo" /> + <toolbarbutton id="button_first" onclick="page('1');" /> + <toolbarbutton id="button_prev" onclick="page('-1');" /> + <toolbarbutton id="button_page" label="x of y" onclick="dialog_page();" /> + <toolbarbutton id="button_next" onclick="page('+1');" /> + <toolbarbutton id="button_last" onclick="page(window.content.getParameter('pt'));" /> + <toolbarseparator /> + <toolbarbutton id="button_thumbs" label="thumbs" onclick="window.content.digicat();" /> + <toolbarseparator /> + <toolbarbutton id="button_mark" label="mark" onclick="window.content.mark();" /> + <toolbarbutton id="button_ref" type="menu" label="ref"> + <menupopup id="reference_popup"> + <menuitem label="LaTex" oncommand="window.content.ref(0);" /> + <menuitem label="HTML" oncommand="window.content.ref(1);" /> + <menuitem label="new HTML" oncommand="window.content.ref(2);" /> + </menupopup> + </toolbarbutton> + <toolbarseparator /> + <toolbarbutton id="button_zoomin" label="zoom +" onclick="zoomIn();" /> + <toolbarbutton id="button_zoomout" label="zoom -" onclick="zoomOut();" /> + <toolbarseparator /> + <spacer flex="1" /> + <toolbarseparator /> + <toolbarbutton id="button_help" type="menu" label="?"> + <menupopup id="help_popup" > + <menuitem id="item_contexthelp" label="Contexthelp" type="checkbox" oncommand="change_help();"/> + <menuitem id="item_options" label="Options" oncommand="dialog_options();"/> + </menupopup> + </toolbarbutton> + </toolbar> + </toolbox> + +</overlay>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/annota.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,439 @@ +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("datasources","file://"+directory+'test.rdf'); + //alert('datasource: '+ t.getAttribute("datasources")); + //alert('Directory: file://'+directory+'/test.rdf'); +} + +function refreshTree(){ + var t=document.getElementById("file_tree"); + t.builder.rebuild(); +} + +function getAttributeOfSelectedNode(attribute) { + var tree=document.getElementById("file_tree"); + try { + return tree.view.getCellText(tree.currentIndex,attribute); + } catch(e) { + return ''; + } +} + +/* +function createSequence(completeURN) { + if(completeURN.indexOf(slash) != -1) { + alert('Recursion: '+completeURN); + //lowest sequence + var seqNodeContainer = dataSource.getNode(completeURN.substring(0,completeURN.lastIndexOf(":"))); + seqNodeContainer.makeSeq(); + //lowest description + var rootNodeContainer = dataSource.getNode(completeURN.substring(0,completeURN.lastIndexOf(":"))); + var fnTemp = completeURN.substring(0,completeURN.lastIndexOf(":")); + rootNodeContainer.addTarget("http://echo.unibe.ch/digilib/rdf#fn",completeURN.substring( + fnTemp.lastIndexOf(":")+1,completeURN.lastIndexOf(":"))); + + completeURN = completeURN.replace(slash,':'); + + //next higher sequence + var seqNode = dataSource.getNode(completeURN.substring(0,completeURN.lastIndexOf(":"))); + seqNode.makeSeq(); + //next higher description + var rootNode = dataSource.getNode(completeURN.substring(0,completeURN.lastIndexOf(":"))); + fnTemp = completeURN.substring(0,completeURN.lastIndexOf(":")); + rootNode.addTarget("http://echo.unibe.ch/digilib/rdf#fn",completeURN.substring( + fnTemp.lastIndexOf(":")+1,completeURN.lastIndexOf(":"))); + seqNodeContainer.addChild(rootNode); + alert('Recursion end: '+completeURN); + + if(completeURN.lastIndexOf(slash) == -1) { + alert('Recursion finished : '+completeURN); + var node = dataSource.getNode(completeURN); + 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"); + seqNode.addChild(node); + } + this.createSequence(completeURN); + } +} +*/ + +/** + * @todo isn't complex yet... + */ +function createComplexRDFEntry(completeURN) { + var title = window.prompt("Please enter a title for this Annotation",this.getAttributeOfSelectedNode('name')); + alert('Title: '+title); + var echoContainer = dataSource.getNode("urn:echo"); + echoContainer.makeSeq(); + + echoContainer.addChild(completeURN); + var node = dataSource.getNode(completeURN); + 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"); + node.addTarget("http://purl.org/dc/elements/1.0/title",title); + node.addTarget("http://purl.org/dc/elements/1.0/creator",""); + node.addTarget("http://purl.org/dc/elements/1.0/date",""); + node.addTarget("http://www.w3.org/2000/10/annotation-ns#created",""); + node.addTarget("http://www.w3.org/2000/10/annotation-ns#Annotation","targetof"); + var node2 = dataSource.getNode("targetof"); + node2.addTarget("http://echo.unibe.ch/digilib/rdf#lv","1"); + /*ar subNode = dataSource.getNode('specialised'); + node.addChild(subNode,true);*/ +} + +function file_save(){ + + // get Digilib-Parameter form Browser + //alert(window.content.location.href); + + var documentpath=''; + try{ + documentpath=window.content.getParameter('fn'); + documentpath=documentpath.replace(':',';'); + }catch (e){ + documentpath=''; + } + if (documentpath != ''){ + //documentpath=documentpath.replace(slash,':'); + //alert(documentpath); + var docPath='urn:echo:'+documentpath; + + var t=document.getElementById("file_tree"); + dataSource = new RDFDataSource(t.getAttribute("datasources")); + this.createComplexRDFEntry(docPath); + +/* //Create new Node + var node = dataSource.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"); + //Add the node to the Seq + var seqNode = dataSource.getNode(docPath.substring(0,docPath.lastIndexOf(":"))); + if(seqNode.isContainer()) { + seqNode.addChild(node); + } else { + seqNode.makeSeq(); + seqNode.addChild(node); + } +*/ + dataSource.save(); + refreshTree(); +/* + 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); + } + alert(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(); + } else { + alert(str_Filename + " is not a file"); + } + return str; +} + + + +function send_annotation(rdf_file){ + rdf_file=rdf_file.replace(/^file:\/\//,""); + rdf_file=makePathCompatible(rdf_file); + digilib_path="http://pythia2.unibe.ch:8080/docuserver/digitallibrary"; + alert("Send Annotation: "+rdf_file); + strRdfFile=readFile(rdf_file); + if (strRdfFile!=""){ + var formid='mainform'; + alert(digilib_path+"/digilib.jsp"); + 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); +} + + +/* @beat: ich habe mich erfrecht, diese billige methode in dein + javascript zu verschieben, weil ich eigentlich jetzt zu + dir gehoert und nicht mehr in ein alcatraz.js (das gar + nicht mehr existiert). alcatraz.xul ist nur noch ein + container fuer andere xul-files und hat deshalb auch + keine eigenen funktionialitaeten mehr - christian +*/ +function dialog_annotate() { + window.openDialog("chrome://alcatraz/content/dialog_annotate.xul", "dialog_annotate", "chrome,dialog,resizable=no", ""); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/annota.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,65 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<overlay id="toverlay" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + +<script type="application/x-javascript" src="chrome://jslib/content/jslib.js" /> +<script type="application/x-javascript" src="chrome://alcatraz/content/alcatraz.js" /> +<script type="application/x-javascript" src="chrome://alcatraz/content/annota.js" /> +<script type="application/x-javascript" src="chrome://alcatraz/content/rdfds.js" /> + +<!-- ANNOTA --> + <tabpanel id="annota_tab" orient="vertical"> + <vbox flex="1"> + <hbox> + <toolbarbutton id="annota_file" type="menu" label="File"> + <menupopup id="file_popup"> + <menuitem label="Save" onclick="file_save()" /> + </menupopup> + </toolbarbutton> + <toolbarbutton id="annota_options" type="menu" label="Options"> + <menupopup id="options_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> + </toolbarbutton> + <toolbarbutton id="annota_annotation" type="menu" label="Annotation"> + <menupopup id="text_popup"> + <menuitem label="Text Annotation" onclick="dialog_annotate();" /> + </menupopup> + </toolbarbutton> + </hbox> + + <tree id="file_tree" flex="100" datasources="file:///home/halter/test.rdf" ref="urn:echo" 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://purl.org/dc/elements/1.0/title"/> + <treecell label="rdf:http://echo.unibe.ch/digilib/rdf#fn"/> + </treerow> + </treeitem> + </treechildren> + </rule> + + </template> + </tree> + + </vbox> + </tabpanel> +</overlay>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/annota_ohne_annota.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,319 @@ +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); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/astrosearch.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,32 @@ +var key=''; + +function start_search(){ + var target_iframe=document.getElementById('astro_resultframe'); + var boolIsManuscript=document.getElementById("manuscript").selected==true; + var strDocType="image"; + if (boolIsManuscript){ + strDocType="manuscript"; + } + var strLibrary=document.getElementById("bibliothek").label; + var strCentury=document.getElementById("century").label; + var strAuthor=document.getElementById('autorenkontext').label; + var strImageType=document.getElementById('bildtyp').label; + + //target_iframe.setAttribute('src','astro_search.jsp?key='+key+'&cat='+search_category+'&str='+search_string); + //target_iframe.setAttribute('src','result.htm'); + target_iframe.setAttribute('src','http://hera.unibe.ch:8080/alcatraz/xul/astro_search.jsp?doctype='+strDocType+'&lib='+strLibrary+'&aut='+strAuthor+'¢='+strCentury+'&type='+strImageType); +} + + +function changeRadioGroup(sel){ + key=sel.id; + if (key=="image"){ + document.getElementById("bildtyp").disabled=false; + document.getElementById("lblbildtyp").disabled=false; + document.getElementById("bildtyp").label="all"; + }else{ + document.getElementById("bildtyp").disabled=true; + document.getElementById("lblbildtyp").disabled=true; + document.getElementById("bildtyp").label=""; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/astrosearch.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,78 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?> + +<window + flex="1" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns= "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > + +<script language="JavaScript" src="astrosearch.js" /> + +<vbox flex="1"> + <radiogroup orient="horizontal" onclick="changeRadioGroup(event.target);" > + <radio id="manuscript" selected="true" label="Manuscript"/> + <radio id="image" label="Diagram"/> + </radiogroup> + + <html:b><label value="Library:" flex="1" /></html:b> + <menulist id="bibliothek" label="" type="menu" + datasources="http://hera.unibe.ch:8080/alcatraz/xul/astrowerkRDF.jsp" ref="urn:echonavigation:data" flex="1" editable="true"> + <template> + + <rule> + <menupopup id="menupop1" > + <menuitem label="all" selected="true" /> + <menuitem uri="rdf:*" label="rdf:http://www.echo.eu/rdf#name" /> + </menupopup> + </rule> + </template> + + </menulist> + + <html:b><label value="Century:" flex="1" /></html:b> + <menulist id="century" label="" flex="1" editable="true"> + <menupopup > + <menuitem label="all" selected="true" /> + <menuitem label="IX" /> + <menuitem label="X"/> + <menuitem label="XI" /> + <menuitem label="XII"/> + <menuitem label="XIII"/> + <menuitem label="XIV"/> + <menuitem label="XV"/> + </menupopup> + </menulist> + + <html:b><label value="Context Author:" flex="1" /></html:b> + <menulist id="autorenkontext" label="" type="menu" + datasources="http://hera.unibe.ch:8080/alcatraz/xul/astroautorenRDF.jsp" ref="urn:echonavigation:data" flex="1" editable="true"> + <template> + <rule> + <menupopup id="menupop1" > + <menuitem label="all" selected="true" /> + <menuitem uri="rdf:*" label="rdf:http://www.echo.eu/rdf#name" /> + </menupopup> + </rule> + </template> + </menulist> + + <html:b><label id="lblbildtyp" value="Type of Image:" flex="1" disabled="true" /></html:b> + <menulist id="bildtyp" label=" " type="menu" + datasources="http://hera.unibe.ch:8080/alcatraz/xul/astroartRDF.jsp" ref="urn:echonavigation:data" flex="1" editable="true" disabled="true"> + <template> + <rule> + <menupopup id="menupop1" > + <menuitem label="all" selected="true" /> + <menuitem uri="rdf:*" label="rdf:http://www.echo.eu/rdf#name" /> + </menupopup> + </rule> + </template> + </menulist> + <button id="start_search" label="Search" onclick="start_search()" flex="1" /> +</vbox> + <splitter id="navigio_splitter" state="opened" collapse="before" resizeafter="nearest"> + <grippy/> + </splitter> + <iframe id="astro_resultframe" src="blank.html" flex="1" /> +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/blank.html Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,6 @@ +<html> + <head> + </head> + <body> + </body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/contents.rdf Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,29 @@ +<?xml version="1.0"?> + +<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> + + <RDF:Description about="urn:mozilla:package:alcatraz" + chrome:displayName="alcatraz tool" + chrome:author="Daniel Engler:Christian Luginbuehl" + chrome:name="alcatraz"> + </RDF:Description> + + <RDF:Seq about="urn:mozilla:package:root"> + <RDF:li resource="urn:mozilla:package:alcatraz" /> + </RDF:Seq> + + <RDF:Seq about="urn:mozilla:overlays"> + <RDF:li resource="chrome://navigator/content/navigator.xul" /> + <RDF:li resource="chrome://browser/content/browser.xul" /> + </RDF:Seq> + + <RDF:Seq about="chrome://navigator/content/navigator.xul"> + <RDF:li>chrome://alcatraz/content/alcatraz_toolbar.xul</RDF:li> + </RDF:Seq> + + <RDF:Seq about="chrome://browser/content/browser.xul"> + <RDF:li>chrome://alcatraz/content/alcatraz_toolbar.xul</RDF:li> + </RDF:Seq> + +</RDF:RDF>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_annotate.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,37 @@ +/* +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.4 +*/ + +function accept() { + + var text = document.getElementById('annotation_value').value; + + opener.content.annotation(text); + + return true; + +} + + +function cancel() { + + // 'true' says closing the window + return true; + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_annotate.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,25 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialogs.css" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="DIGILIB annotate" + buttons="accept,cancel" + ondialogaccept="return accept();" + ondialogcancel="return cancel();" + onload="window.sizeToContent(); window.focus();"> + + <script src="chrome://alcatraz/content/dialog_annotate.js" /> + + <groupbox> + <caption label="DIGILIB annotate" /> + <description id="dialog_desc">Annotate the picture with its current parameters :</description> + <spacer style="height: 10px" /> + <hbox> + <textbox id="annotation_value" size="2000" multiline="true" rows="8" cols="72" onclick="this.select();" /> + <spacer flex="1" /> + </hbox> + + </groupbox> + +</dialog>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_brightnesscontrast.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,84 @@ +/* +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 markCurrentBrightnessContrast() { + + var brightness = opener.content.getParameter('brgt'); + + var items = document.getElementById('brightness_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(brightness) ) { + document.getElementById('brightness_list').selectedItem = items[i]; + } + + } + + + var contrast = opener.content.getParameter('cont'); + + items = document.getElementById('contrast_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(contrast) ) { + document.getElementById('contrast_list').selectedItem = items[i]; + } + } + +} + + +function change() { + + var brightness = 0.0; + var contrast = 0.0; + + var old_brightness = opener.content.getParameter('brgt'); + var old_contrast = opener.content.getParameter('cont'); + + var items = document.getElementById('brightness_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + brightness = items[i].getAttribute('value'); + } + } + + items = document.getElementById('contrast_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + contrast = items[i].getAttribute('value'); + } + } + + if ( (brightness != old_brightness) || (contrast != old_contrast) ) { + opener.content.brightnessContrast(brightness, contrast); + } + +} + + +function close_dialog() { + + close(); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_brightnesscontrast.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,74 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialogs.css" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="DIGILIB brightness/contrast" + onload="markCurrentBrightnessContrast(); window.sizeToContent(); window.focus();"> + + <script src="chrome://alcatraz/content/dialog_brightnesscontrast.js" /> + + <groupbox> + <caption label="DIGILIB brightness/contrast" /> + <description>Choose the brightness/contrast :</description> + <spacer style="height: 10px" /> + <groupbox> + <caption label="Brightness" /> + <menulist id="brightness_list"> + <menupopup id="brightness_popup"> + <menuitem value="255" label="+9" /> + <menuitem value="240" label="+8" /> + <menuitem value="210" label="+7" /> + <menuitem value="180" label="+6" /> + <menuitem value="150" label="+5" /> + <menuitem value="120" label="+4" /> + <menuitem value="90" label="+3" /> + <menuitem value="60" label="+2" /> + <menuitem value="30" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-30" label="-1" /> + <menuitem value="-60" label="-2" /> + <menuitem value="-90" label="-3" /> + <menuitem value="-120" label="-4" /> + <menuitem value="-150" label="-5" /> + <menuitem value="-180" label="-6" /> + <menuitem value="-210" label="-7" /> + <menuitem value="-240" label="-8" /> + <menuitem value="-255" label="-9" /> + </menupopup> + </menulist> + </groupbox> + <groupbox> + <caption label="Contrast" /> + <menulist id="contrast_list"> + <menupopup id="contrast_popup"> + <menuitem value="1.7" label="+9" /> + <menuitem value="1.3" label="+8" /> + <menuitem value="1.0" label="+7" /> + <menuitem value="0.7" label="+6" /> + <menuitem value="0.5" label="+5" /> + <menuitem value="0.3" label="+4" /> + <menuitem value="0.2" label="+3" /> + <menuitem value="0.1" label="+2" /> + <menuitem value="0.05" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-0.05" label="-1" /> + <menuitem value="-0.1" label="-2" /> + <menuitem value="-0.2" label="-3" /> + <menuitem value="-0.3" label="-4" /> + <menuitem value="-0.5" label="-5" /> + <menuitem value="-0.7" label="-6" /> + <menuitem value="-1.0" label="-7" /> + <menuitem value="-1.3" label="-8" /> + <menuitem value="-1.7" label="-9" /> + </menupopup> + </menulist> + </groupbox> + + <hbox flex="1" pack="end"> + <button label="Change" oncommand="change();" /> + <button label="Close" oncommand="close_dialog();" /> + </hbox> + </groupbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_colors.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,168 @@ +/* +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 markCurrentColors() { + + var add = opener.content.getParameter('rgba'); + var mult = opener.content.getParameter('rgbm'); + + if ( add == '' ) { + add = "0/0/0"; + } + + if ( mult == '' ) { + mult = "0/0/0"; + } + + add = add.split("/"); + mult = mult.split("/"); + + var items = document.getElementById('add_red_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(add[0]) ) { + document.getElementById('add_red_list').selectedItem = items[i]; + } + } + + items = document.getElementById('add_green_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(add[1]) ) { + document.getElementById('add_green_list').selectedItem = items[i]; + } + } + + items = document.getElementById('add_blue_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(add[2]) ) { + document.getElementById('add_blue_list').selectedItem = items[i]; + } + } + + items = document.getElementById('mult_red_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(mult[0]) ) { + document.getElementById('mult_red_list').selectedItem = items[i]; + } + } + + items = document.getElementById('mult_green_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(mult[1]) ) { + document.getElementById('mult_green_list').selectedItem = items[i]; + } + } + + items = document.getElementById('mult_blue_popup').childNodes; + + for ( i = 0; i < items.length; i++ ) { + if ( parseFloat(items[i].getAttribute('value')) == parseFloat(mult[2]) ) { + document.getElementById('mult_blue_list').selectedItem = items[i]; + } + } + + +} + + +function change() { + + var old_add = opener.content.getParameter('rgba'); + var old_mult = opener.content.getParameter('rgbm'); + + var add = new Array(); + var mult = new Array(); + + if ( old_add == '' ) { + old_add = "0/0/0"; + } + + if ( old_mult == '' ) { + old_mult = "0/0/0"; + } + + + var items = document.getElementById('add_red_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + add[0] = items[i].getAttribute('value'); + } + } + + items = document.getElementById('add_green_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + add[1] = items[i].getAttribute('value'); + } + } + + items = document.getElementById('add_blue_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + add[2] = items[i].getAttribute('value'); + } + } + + add = add.join("/"); + + items = document.getElementById('mult_red_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + mult[0] = items[i].getAttribute('value'); + } + } + + items = document.getElementById('mult_green_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + mult[1] = items[i].getAttribute('value'); + } + } + + items = document.getElementById('mult_blue_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + mult[2] = items[i].getAttribute('value'); + } + } + + mult = mult.join("/"); + + if ( (add != old_add) || (mult != old_mult) ) { + opener.content.colors(add, mult); + } +} + + +function close_dialog() { + + window.close(); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_colors.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,188 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialogs.css" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="DIGILIB colors" + onload="markCurrentColors(); window.sizeToContent(); window.focus();"> + + <script src="chrome://alcatraz/content/dialog_colors.js" /> + + <groupbox> + <caption label="DIGILIB colors" /> + <description>Color manipulation :</description> + <spacer style="height: 10px" /> + <groupbox> + <caption label="Additioner" /> + <hbox> + <vbox align="center"> + <description value="Red" /> + <menulist id="add_red_list"> + <menupopup id="add_red_popup"> + <menuitem value="255" label="+9" /> + <menuitem value="240" label="+8" /> + <menuitem value="210" label="+7" /> + <menuitem value="180" label="+6" /> + <menuitem value="150" label="+5" /> + <menuitem value="120" label="+4" /> + <menuitem value="90" label="+3" /> + <menuitem value="60" label="+2" /> + <menuitem value="30" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-30" label="-1" /> + <menuitem value="-60" label="-2" /> + <menuitem value="-90" label="-3" /> + <menuitem value="-120" label="-4" /> + <menuitem value="-150" label="-5" /> + <menuitem value="-180" label="-6" /> + <menuitem value="-210" label="-7" /> + <menuitem value="-240" label="-8" /> + <menuitem value="-255" label="-9" /> + </menupopup> + </menulist> + </vbox> + <vbox align="center"> + <description value="Green" /> + <menulist id="add_green_list"> + <menupopup id="add_green_popup"> + <menuitem value="255" label="+9" /> + <menuitem value="240" label="+8" /> + <menuitem value="210" label="+7" /> + <menuitem value="180" label="+6" /> + <menuitem value="150" label="+5" /> + <menuitem value="120" label="+4" /> + <menuitem value="90" label="+3" /> + <menuitem value="60" label="+2" /> + <menuitem value="30" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-30" label="-1" /> + <menuitem value="-60" label="-2" /> + <menuitem value="-90" label="-3" /> + <menuitem value="-120" label="-4" /> + <menuitem value="-150" label="-5" /> + <menuitem value="-180" label="-6" /> + <menuitem value="-210" label="-7" /> + <menuitem value="-240" label="-8" /> + <menuitem value="-255" label="-9" /> + </menupopup> + </menulist> + </vbox> + <vbox align="center"> + <description value="Blue" /> + <menulist id="add_blue_list"> + <menupopup id="add_blue_popup"> + <menuitem value="255" label="+9" /> + <menuitem value="240" label="+8" /> + <menuitem value="210" label="+7" /> + <menuitem value="180" label="+6" /> + <menuitem value="150" label="+5" /> + <menuitem value="120" label="+4" /> + <menuitem value="90" label="+3" /> + <menuitem value="60" label="+2" /> + <menuitem value="30" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-30" label="-1" /> + <menuitem value="-60" label="-2" /> + <menuitem value="-90" label="-3" /> + <menuitem value="-120" label="-4" /> + <menuitem value="-150" label="-5" /> + <menuitem value="-180" label="-6" /> + <menuitem value="-210" label="-7" /> + <menuitem value="-240" label="-8" /> + <menuitem value="-255" label="-9" /> + </menupopup> + </menulist> + </vbox> + </hbox> + </groupbox> + <groupbox> + <caption label="Multiplier" /> + <hbox> + <vbox align="center"> + <description value="Red" /> + <menulist id="mult_red_list"> + <menupopup id="mult_red_popup"> + <menuitem value="3.0" label="+9" /> + <menuitem value="2.0" label="+8" /> + <menuitem value="1.5" label="+7" /> + <menuitem value="1.0" label="+6" /> + <menuitem value="0.7" label="+5" /> + <menuitem value="0.5" label="+4" /> + <menuitem value="0.3" label="+3" /> + <menuitem value="0.2" label="+2" /> + <menuitem value="0.1" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-0.1" label="-1" /> + <menuitem value="-0.2" label="-2" /> + <menuitem value="-0.3" label="-3" /> + <menuitem value="-0.5" label="-4" /> + <menuitem value="-0.7" label="-5" /> + <menuitem value="-1.0" label="-6" /> + <menuitem value="-1.5" label="-7" /> + <menuitem value="-2.0" label="-8" /> + <menuitem value="-3.0" label="-9" /> + </menupopup> + </menulist> + </vbox> + <vbox align="center"> + <description value="Green" /> + <menulist id="mult_green_list"> + <menupopup id="mult_green_popup"> + <menuitem value="3.0" label="+9" /> + <menuitem value="2.0" label="+8" /> + <menuitem value="1.5" label="+7" /> + <menuitem value="1.0" label="+6" /> + <menuitem value="0.7" label="+5" /> + <menuitem value="0.5" label="+4" /> + <menuitem value="0.3" label="+3" /> + <menuitem value="0.2" label="+2" /> + <menuitem value="0.1" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-0.1" label="-1" /> + <menuitem value="-0.2" label="-2" /> + <menuitem value="-0.3" label="-3" /> + <menuitem value="-0.5" label="-4" /> + <menuitem value="-0.7" label="-5" /> + <menuitem value="-1.0" label="-6" /> + <menuitem value="-1.5" label="-7" /> + <menuitem value="-2.0" label="-8" /> + <menuitem value="-3.0" label="-9" /> + </menupopup> + </menulist> + </vbox> + <vbox align="center"> + <description value="Blue" /> + <menulist id="mult_blue_list"> + <menupopup id="mult_blue_popup"> + <menuitem value="3.0" label="+9" /> + <menuitem value="2.0" label="+8" /> + <menuitem value="1.5" label="+7" /> + <menuitem value="1.0" label="+6" /> + <menuitem value="0.7" label="+5" /> + <menuitem value="0.5" label="+4" /> + <menuitem value="0.3" label="+3" /> + <menuitem value="0.2" label="+2" /> + <menuitem value="0.1" label="+1" /> + <menuitem value="0" label="normal" /> + <menuitem value="-0.1" label="-1" /> + <menuitem value="-0.2" label="-2" /> + <menuitem value="-0.3" label="-3" /> + <menuitem value="-0.5" label="-4" /> + <menuitem value="-0.7" label="-5" /> + <menuitem value="-1.0" label="-6" /> + <menuitem value="-1.5" label="-7" /> + <menuitem value="-2.0" label="-8" /> + <menuitem value="-3.0" label="-9" /> + </menupopup> + </menulist> + </vbox> + </hbox> + </groupbox> + + <hbox flex="1" pack="end"> + <button label="Change" oncommand="change();" /> + <button label="Close" oncommand="close_dialog();" /> + </hbox> + </groupbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_options.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,71 @@ +/* +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, 23.01.2004 , Version Alcatraz 0.5 +*/ + + +function getCurrentOptions() { + + var keeparea = getSetting('keeparea'); + + if (keeparea != '') { + document.getElementById('keeparea_check').setAttribute('checked', keeparea); + } + + var items = document.getElementById('zoom_popup').childNodes; + var zoomkind = getSetting('zoomkind'); + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('value') == zoomkind ) { + document.getElementById('zoom_menu').selectedItem = items[i]; + } + } + +} + + +function apply() { + + var keeparea = document.getElementById('keeparea_check').getAttribute('checked'); + // beautify + if ( keeparea == '' ) { + keeparea = 'false'; + } + + saveSetting('keeparea', keeparea); + + var zoomkind; + var items = document.getElementById('zoom_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + zoomkind = items[i].getAttribute('value'); + } + } + saveSetting('zoomkind', zoomkind); + + close(); + +} + + +function cancel() { + + close(); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_options.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,44 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialogs.css" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="DIGILIB options" + onload="getCurrentOptions(); window.sizeToContent(); window.focus();"> + + <script src="chrome://jslib/content/jslib.js" /> + <script src="chrome://alcatraz/content/settings.js" /> + <script src="chrome://alcatraz/content/dialog_options.js" /> + + <groupbox> + <caption label="DIGILIB options" /> + <description>Change the default behaviour of your sidebar</description> + <spacer style="height: 10px" /> + <groupbox> + <caption label="Zooming" /> + <description>Choose eighter 'zoom area' or 'zoom point' as the behaviour of the + zooming functionality.</description> + <hbox> + <menulist id="zoom_menu"> + <menupopup id="zoom_popup"> + <menuitem label="Zoom area" value="zoomarea" selected="true" /> + <menuitem label="Zoom point" value="zoompoint" /> + </menupopup> + </menulist> + <spacer flex="1" /> + </hbox> + </groupbox> + <groupbox> + <caption label="Keep area" /> + <description>Choose 'keep area' in order to keep the zoomed part when + jumping to another page.</description> + <checkbox id="keeparea_check" value="keeparea" label="Keep area" /> + </groupbox> + + <hbox flex="1" pack="end"> + <button label="Apply" oncommand="apply();" /> + <button label="Cancel" oncommand="cancel();" /> + </hbox> + </groupbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_originalsize.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,108 @@ +/* +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 +*/ + +var VERTICAL_PIXELS = 500; +var HORIZONTAL_PIXELS = 500; + +function getCurrentOriginalSize() { + + var v_value = getSetting('originalsize_v_value'); + var v_unit = getSetting('originalsize_v_unit'); + var h_value = getSetting('originalsize_h_value'); + var h_unit = getSetting('originalsize_h_unit'); + + document.getElementById('vertical_value').setAttribute('value', v_value); + document.getElementById('horizontal_value').setAttribute('value', h_value); + + var items = document.getElementById('vertical_unit_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('value') == v_unit ) { + document.getElementById('vertical_unit_list').selectedItem = items[i]; + } + } + + items = document.getElementById('horizontal_unit_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('value') == h_unit ) { + document.getElementById('horizontal_unit_list').selectedItem = items[i]; + } + } + +} + + +function apply() { + + var v_value = document.getElementById('vertical_value').value; + var h_value = document.getElementById('horizontal_value').value; + + var v_unit; + var h_unit; + + var items = document.getElementById('vertical_unit_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + v_unit = items[i].getAttribute('value'); + } + } + + items = document.getElementById('vertical_unit_popup').childNodes; + + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + h_unit = items[i].getAttribute('value'); + } + } + + if ( (parseFloat(v_value) == v_value) && + (parseFloat(h_value) == h_value) ) { + + saveSetting('originalsize_v_value', v_value); + saveSetting('originalsize_v_unit', v_unit); + saveSetting('originalsize_h_value', h_value); + saveSetting('originalsize_h_unit', h_unit); + + var dpi_v = (v_unit == "inch") ? VERTICAL_PIXELS / v_value : + (v_unit == "cm") ? VERTICAL_PIXELS / (v_value/2.54) : + v_value; + + var dpi_h = (h_unit == "inch") ? VERTICAL_PIXELS / h_value : + (h_unit == "cm") ? VERTICAL_PIXELS / (h_value/2.54) : + h_value; + + opener.content.originalSize(dpi_v, dpi_h); + + close(); + + } else { + alert("Illegal value(s)!"); + } + +} + + +function cancel() { + + close(); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_originalsize.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,68 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialog_originalsize.css" type="text/css" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialogs.css" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="DIGILIB original size" + onload="getCurrentOriginalSize(); window.sizeToContent(); window.focus();"> + + <script src="chrome://jslib/content/jslib.js" /> + <script src="chrome://alcatraz/content/settings.js" /> + <script src="chrome://alcatraz/content/dialog_originalsize.js" /> + + <groupbox> + <caption label="DIGILIB original size" /> + <hbox> + <vbox> + <image id="vertical_bar" /> + </vbox> + <vbox> + <spacer flex="1" /> + <image id="horizontal_bar" /> + <spacer flex="1" /> + </vbox> + </hbox> + <groupbox> + <caption label="Original size" /> + <description>In order to see the images in original size, measure the bars and enter its values.</description> + <hbox> + <vbox> + <spacer width="10px" /> + <hbox align="center"> + <description value="Vertical" /> + <textbox id="vertical_value" size="8" flex="1" /> + <menulist id="vertical_unit_list"> + <menupopup id="vertical_unit_popup"> + <menuitem value="cm" label="cm" /> + <menuitem value="inch" label="inch" /> + <menuitem value="dpi" label="dpi" /> + </menupopup> + </menulist> + </hbox> + </vbox> + <vbox> + <spacer width="10px" /> + <hbox align="center"> + <spacer width="20px" /> + <description value="Horizontal" /> + <textbox id="horizontal_value" size="8" /> + <menulist id="horizontal_unit_list"> + <menupopup id="horizontal_unit_popup"> + <menuitem value="cm" label="cm" /> + <menuitem value="inch" label="inch" /> + <menuitem value="dpi" label="dpi" /> + </menupopup> + </menulist> + </hbox> + </vbox> + </hbox> + </groupbox> + + <hbox flex="1" pack="end"> + <button label="Apply" oncommand="apply();" /> + <button label="Cancel" oncommand="cancel();" /> + </hbox> + </groupbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_page.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,80 @@ +/* +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 markCurrentPage() { + + var current_page = opener.content.getParameter('pn'); + var total_pages = opener.content.getParameter('pt'); + + if ( total_pages ) { + document.getElementById('dialog_desc').setAttribute('value', "Choose the page to go (1 - " + total_pages + ") :"); + } + + document.getElementById('page_value').setAttribute('value', current_page); + +} + + +function go() { + + var old_current_page = opener.content.getParameter('pn'); + var total_pages = opener.content.getParameter('pt'); + + var page = document.getElementById('page_value').value; + + if ( parseInt(page) != page ) { + alert ("Illegal value!"); + } else if ( parseInt(page) < 1 ) { + alert ("Illegal value!"); + } else if ( total_pages && parseInt(page) > total_pages ) { + alert ("Illegal value!"); + } else { + var allcookies = opener.content.document.cookie; + + var pos = allcookies.indexOf('keeparea='); + + if ( pos > -1 ) { + var start = pos + 9; + var end = allcookies.indexOf(';', start); + if ( end == -1 ) { + end = allcookies.length; + } + + if ( allcookies.slice(start, end) == 'true' ) { + opener.content.page(page, 2); + } else { + opener.content.page(page, 1); + } + } else { + // default + opener.content.page(page, 2); + } + + close(); + } + +} + + +function cancel() { + + close(); + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_page.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,27 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialogs.css" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="DIGILIB brightness/contrast" + onload="markCurrentPage(); window.sizeToContent(); window.focus();"> + + <script src="chrome://alcatraz/content/dialog_page.js" /> + + <groupbox> + <caption label="DIGILIB page" /> + <description id="dialog_desc">Choose the page to go :</description> + <spacer style="height: 10px" /> + <hbox> + <textbox id="page_value" size="6" onclick="this.select();" /> + <spacer flex="1" /> + </hbox> + + + <hbox flex="1" pack="end"> + <button label="Go" oncommand="go();" /> + <button label="Cancel" oncommand="cancel();" /> + </hbox> + </groupbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_rotate.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,73 @@ +/* +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 markCurrentRotation() { + + var angle = opener.content.getParameter('rot'); + + if ( angle && (angle == 0.0 || angle == 90.0 || angle == 180.0 || angle == 270.0) ) { + var item = "rotation_" + parseInt(angle); + document.getElementById(item).setAttribute('selected', 'true'); + } else if ( angle && angle == parseFloat(angle) ) { + document.getElementById('rotation_custom').setAttribute('selected', 'true'); + document.getElementById('rotation_custom_value').setAttribute('value', angle); + } + +} + + +function input() { + + document.getElementById('rotation_custom').setAttribute('selected', 'true'); + +} + +function rotate() { + + var angle = 0.0; + + var items = document.getElementById('rotation_group').childNodes; + + if ( document.getElementById('rotation_custom').getAttribute('selected') == 'true' ) { + angle = document.getElementById('rotation_custom_value').value; + } else { + for ( i = 0; i <items.length; i++ ) { + if ( items[i].getAttribute('selected') == 'true' ) { + angle = items[i].getAttribute('value'); + } + } + } + + if ( angle != parseFloat(angle) ) { + alert ("Illegal value!" + angle); + } + + if ( angle != opener.content.getParameter('rot') ) { + opener.content.rotation(angle); + } + close(); +} + + +function cancel() { + + close(); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/dialog_rotate.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,31 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/dialogs.css" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="DIGILIB rotate" + onload="markCurrentRotation(); window.sizeToContent(); window.focus();"> + + <script src="chrome://alcatraz/content/dialog_rotate.js" /> + + <groupbox> + <caption label="DIGILIB rotate" /> + <description>Choose the rotation angle (clockwise orientation) :</description> + <radiogroup id="rotation_group"> + <radio id="rotation_0" value="0" label="0 degrees" /> + <radio id="rotation_90" value="90" label="90 degrees" /> + <radio id="rotation_180" value="180" label="180 degrees" /> + <radio id="rotation_270" value="270" label="270 degrees" /> + <hbox> + <radio id="rotation_custom" value="custom" label="Custom:" /> + <textbox id="rotation_custom_value" size="6" oninput="input();" /> + </hbox> + </radiogroup> + + <hbox flex="1" pack="end"> + <button label="Rotate" oncommand="rotate();" /> + <button label="Cancel" oncommand="cancel();" /> + </hbox> + </groupbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/imago.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,81 @@ +/* +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, 26.02.2004 , Version Alcatraz 0.6 +*/ + + +function markCurrentScale() { + + var menuitems = document.getElementById('scale_popup').childNodes; + + for ( i = 0; i < menuitems.length; i++ ) { + menuitems[i].setAttribute('checked', 'false'); + } + + if ( window.content.getParameter('mo').indexOf('clip') > -1 ) { + document.getElementById('scale_pbp').setAttribute('checked', 'true'); + } else if ( window.content.getParameter('mo').indexOf('osize') > -1 ) { + document.getElementById('scale_os').setAttribute('checked', 'true'); + } else { + var item = "scale_" + window.content.getParameter('ws').replace(/\./, ""); + + if ( document.getElementById(item) ) { + document.getElementById(item).setAttribute('checked', 'true'); + } + } + +} + + +function markCurrentMirror() { + + var menuitems = document.getElementById('mirror_popup').childNodes; + + for ( i = 0; i < menuitems.length; i++ ) { + menuitems[i].setAttribute('checked', 'false'); + } + + if ( window.content.getParameter('mo').indexOf('hmir') > -1 ) { + document.getElementById('mirror_h').setAttribute('checked', 'true'); + } + + if ( window.content.getParameter('mo').indexOf('vmir') > -1 ) { + document.getElementById('mirror_v').setAttribute('checked', 'true'); + } + +} + + +function dialog_originalsize() { + window.openDialog("chrome://alcatraz/content/dialog_originalsize.xul", "dialog_originalsize", "chrome,dialog,resizable=no", ""); +} + + +function dialog_rotate() { + window.openDialog("chrome://alcatraz/content/dialog_rotate.xul", "dialog_rotate", "chrome,dialog,resizable=no", ""); +} + + +function dialog_brightnesscontrast() { + window.openDialog("chrome://alcatraz/content/dialog_brightnesscontrast.xul", "dialog_brightnesscontrast", "chrome,dialog,resizable=no", ""); +} + + +function dialog_colors() { + window.openDialog("chrome://alcatraz/content/dialog_colors.xul", "dialog_colors", "chrome,dialog,resizable=no", ""); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/imago.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,42 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + +<script type="application/x-javascript" src="chrome://jslib/content/jslib.js" /> +<script type="application/x-javascript" src="chrome://alcatraz/content/imago.js" /> + + <popupset> + <popup id="scale_popup" onpopupshowing="markCurrentScale()"> + <menuitem id="scale_07" label="0.7" type="checkbox" oncommand="window.content.scale(0.7);" /> + <menuitem id="scale_10" label="1" type="checkbox" oncommand="window.content.scale(1);" /> + <menuitem id="scale_15" label="1.5" type="checkbox" oncommand="window.content.scale(1.5);" /> + <menuitem id="scale_20" label="2" type="checkbox" oncommand="window.content.scale(2);" /> + <menuitem id="scale_25" label="2.5" type="checkbox" oncommand="window.content.scale(2.5);" /> + <menuitem id="scale_30" label="3" type="checkbox" oncommand="window.content.scale(3);" /> + <menuitem id="scale_pbp" label="pixel by pixel" type="checkbox" oncommand="window.content.pixelByPixel();" /> + <menuitem id="scale_os" label="original size" type="checkbox" oncommand="dialog_originalsize();" /> + </popup> + </popupset> + + <popupset> + <popup id="mirror_popup" onpopupshowing="markCurrentMirror()"> + <menuitem id="mirror_h" label="Horizontal" type="checkbox" oncommand="window.content.mirror('h');" /> + <menuitem id="mirror_v" label="Vertical" type="checkbox" oncommand="window.content.mirror('v');" /> + </popup> + </popupset> + + <vbox> + <button id="button_scale" label="scale" popup="scale_popup" /> + <button id="button_mirror" label="mirror" popup="mirror_popup" /> + <button id="button_rotate" label="rotate" onclick="dialog_rotate();" /> + <spacer flex="1" /> + <button id="button_brightnesscontrast" label="brightness/contrast" onclick="dialog_brightnesscontrast();" /> + <button id="button_colors" label="colors" onclick="dialog_colors();" /> + <spacer flex="100" /> + </vbox> + <vbox flex="1" /> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/navigio.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,32 @@ +/* +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.5 +*/ + +function set_project(search,result){ + var navigio_frame=document.getElementById('navigio_frame'); + var navigio_result_frame=document.getElementById('resultframe'); + var navigio_splitter=document.getElementById('navigio_splitter'); + navigio_frame.setAttribute('src',search); + navigio_frame.setAttribute('flex','1'); + navigio_result_frame.setAttribute('src',result); + navigio_result_frame.setAttribute('flex','1'); + navigio_splitter.setAttribute('state','open'); + navigio_splitter.setAttribute('collapse','before'); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/navigio.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,21 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> +<script type="application/x-javascript" src="chrome://alcatraz/content/navigio.js" /> + <hbox> + <toolbarbutton id="navigio_project" type="menu" label="Project" datasources="http://hera.unibe.ch/navigo/navigio_project.rdf" ref="urn:echoproject:data" > + <template> + <rule> + <menupopup id="options_popup"> + <menuitem uri="rdf:*" label="rdf:http://echo.unibe.ch/echo/rdf/projects#name" type="radio" + onclick="set_project(' rdf:http://echo.unibe.ch/echo/rdf/projects#search ',' rdf:http://echo.unibe.ch/echo/rdf/projects#default ')"/> + </menupopup> + </rule> + </template> + </toolbarbutton> + </hbox> + <iframe id="navigio_frame" src="wtwg_bern.xul" flex="1"/> +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/navigio_tree.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,34 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> + +<window id="example-window" title="Example 6.8.2" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + +<script language="JavaScript" src="tree_nav.js" /> + +<tree id="menu_tree" onselect="open_link();" flex="1" width="200" height="200" + datasources="http://sophia.unibe.ch/~kausaman/navigio/meta.rdf http://sophia.unibe.ch/~kausaman/navigio/tree.rdf" ref="urn:echo:data"> + + <treecols> + <treecol id="name" label="Name" primary="true" flex="1"/> + </treecols> + + <template> + <rule> + <treechildren> + <treeitem uri="rdf:*"> + <treerow> + <treecell label="rdf:http://echo.unibe.ch/rdf#name" link="rdf:http://echo.unibe.ch/rdf#link"/> + </treerow> + </treeitem> + </treechildren> + </rule> + + </template> +</tree> + + +</window> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/rdfds.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,760 @@ +/* -*- 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; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/search.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,52 @@ +var key=''; + +function start_search(){ + var search_string=document.getElementById("search_value").value; + var search_category=document.getElementById("category").selectedItem.label; + var target_iframe=parent.document.getElementById('result_frame'); + if (search_string!='' || search_category=='none'){ + var level1=document.getElementById("level1"); + var level2=document.getElementById("level2"); + var level3=document.getElementById("level3"); + target_iframe.setAttribute('src','http://hera.unibe.ch:8080/alcatraz/xul/digilib_search.jsp?key='+key+'&cat='+search_category+'&str='+search_string); + //target_iframe.setAttribute('src','result.htm'); + }else{ + alert("Fehler: Kein Suchstring definiert!"); + } +} + + +function changeMenuList(){ + if (document.getElementById("category").selectedItem.label !='none'){ + document.getElementById("search_value").disabled=false; + document.getElementById("search_value").value=''; + }else{ + document.getElementById("search_value").disabled=true; + document.getElementById("search_value").value=''; + } +} + + +function changeCollection(sel){ + key=sel.value; + var levels=sel.label.split(";"); + var level1=document.getElementById("level1"); + var level2=document.getElementById("level2"); + var level3=document.getElementById("level3"); + if (levels.length>0){ + level1.setAttribute('value',levels[0]); + }else{ + level1.setAttribute('value',''); + } + if (levels.length>1){ + level2.setAttribute('value',' '+levels[1]); + } else{ + level2.setAttribute('value',''); + } + if (levels.length>2){ + level3.setAttribute('value',' '+levels[2]); + }else{ + level3.setAttribute('value',''); + } + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/search.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,46 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?> + +<window xmlns:html="http://www.w3.org/1999/xhtml" + xmlns= "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + flex="1" > + +<script type="application/x-javascript" src="chrome://alcatraz/content/search.js" /> + +<vbox> + +<button id="collection" label="Collections" type="menu" onclick="changeCollection(event.target); return false;" + datasources="http://hera.unibe.ch:8080/alcatraz/xul/digilibcollections.jsp" ref="urn:echonavigation:data" flex="1"> + + <template> + <rule> + <menupopup id="menupop1" > + <menuitem label="none" selected="true" /> + <menuitem uri="rdf:*" value="rdf:http://www.echo.eu/rdf#link" label="rdf:http://www.echo.eu/rdf#name" /> + </menupopup> + </rule> + </template> + +</button> + +<label id="level1" value="" flex="1" crop="end" /> +<label id="level2" value="" flex="1" crop="end" /> +<label id="level3" value="" flex="1" crop="end" /> +<label value="Category:" flex="1" /> +<menulist id="category" label="none" onclick="changeMenuList();" flex="1" > + <menupopup> + <menuitem label="none" selected="true" /> + <menuitem label="Author" /> + <menuitem label="Title"/> + <menuitem label="Year" /> + <menuitem label="Journal/Magazine"/> + <menuitem label="Keywords"/> + </menupopup> +</menulist> +<textbox id="search_value" disabled="true" flex="1" /> +<button id="start_search" label="Search" onclick="start_search()" flex="1" /> + +</vbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/settings.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,77 @@ +/* +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, 24.01.2004 , Version Alcatraz 0.5 +*/ + + +include(jslib_dirutils); +include(jslib_file); + +var du = new DirUtils(); +var f = new File('alcatraz.pref'); + +f.initPath(du.getPrefsDir()); +f.append('alcatraz.pref'); + +function getSetting(name) { + + if (f.exists()) { + + f.open(); + var content = f.read(); + f.close(); + + var lines = content.split(/\n/); + + for (i = 0; i <lines.length; i++) { + var line = lines[i].split('='); + if (line[0] == name) { + return line[1]; + } + } + } + + return null; +} + + +function saveSetting(name, value) { + + var content = ""; + + if (f.exists()) { + f.open(); + content = f.read(); + f.close(); + f.remove(); + } + + f.create(); + f.open('w'); + f.write(name + '=' + value + '\n'); + + var lines = content.split(/\n/); + + for (i = 0; i < lines.length; i++) { + var line = lines[i].split('='); + if (line[0] != name && line[0] != '') { + f.write(line[0] + '=' + line[1] + '\n'); + } + } + f.close(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/sidebar/install.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,27 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://communicator/skin/" type="text/css" ?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + xmlns:html="http://www.w3.org/1999/xhtml" + title="ALCATRAZ SIDEBAR INSTALLER" + orient="vertical"> + + <script src="chrome://alcatraz/content/sidebar/installer.js" /> + <script> + function install() { + var Installer = new MOZ_SidebarInstaller('Alcatraz', 'chrome://alcatraz/content/alcatraz.xul', ''); //no customization + Installer.setUp(); + } + </script> + + <groupbox style="-moz-box-align: center; -moz-box-pack: center;"> + <caption label="Alcatraz" /> + <description>Click the button to install the Alcatraz-Sidebar panel</description> + <button label="INSTALL Alcatraz Sidebar" + oncommand="install();" + flex="0" /> + <description>Alcatraz uses Mozilla Java Script Library:</description> + <description><html:a href='http://jslib.mozdev.org/installation.html' target='blank'> jslib http://jslib.mozdev.org/installation.html</html:a></description> + </groupbox> + +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/sidebar/installer.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,173 @@ +//@@@@@@@@@@@@@@@@ +function MOZ_SidebarInstaller //<c><a>public<d>Mozilla Sidebar installer class +( +_title, //<p>string<d>Sidebar title +_url, //<p>string<d>Sidebar URL +_customize //<p>string<d>Sidebar customization +){ +const +INTERFACES = Components.interfaces, +nsIRDFRemoteDataSource = INTERFACES.nsIRDFRemoteDataSource, +nsIRDFService = INTERFACES.nsIRDFService, RDF_CID = "@mozilla.org/rdf/rdf-service;1", +nsIRDFContainer = INTERFACES.nsIRDFContainer, CONTAINER_CID = "@mozilla.org/rdf/container;1", +nsIProperties = INTERFACES.nsIProperties, DIR_SERV_CID = "@mozilla.org/file/directory_service;1", +nsIIOService = INTERFACES.nsIIOService, IO_SERVICE_CID = '@mozilla.org/network/io-service;1', +NC_NAMESPACE = 'http://home.netscape.com/NC-rdf#', +SIDEBAR_PANEL_URN = NC_NAMESPACE + 'panel-list', +SIDEBAR_CUR_URN = 'urn:sidebar:current-panel-list', +SIDEBAR_3RD_URN = 'urn:sidebar:3rdparty-panel:', +PANELS_RDF_FILE = "UPnls"; //directory services property to find panels.rdf +const +MSG_PANEL_IN_LIST = ' panel is already in Sidebar list\nSelect it in the Tabs > Customize Sidebar... menu', +MSG_PANEL_REFRESHED = ' panel successfully refreshed', +MSG_PANEL_ADDED = ' panel has been successfully added to your sidebar', +MSG_PANEL_SOURCE = 'Sidebar datasource is busted', +MSG_NO_RDF_FILE = 'panels.rdf file does not exist in your profile\nInstallation aborted'; + + + +//================ +this.MOZ_SidebarInstaller = function //<m>void<a>private<d>class constructor +( +title, //<p>string<d>Sidebar panel title +url, //<p>string<d>Sidebar panel URL +customize //<p>string<d>Sidebar panel customization preferences +){ +this.className = 'MOZ_SidebarInstaller'; +this.title = title; +this.url = url; +this.customize = customize; +this.setIn(); +}//</m>MOZ_SidebarInstaller + + + +//================ +this.setIn = function //<m>void<a>private<d>Instance i12n +(){ +this.rdf = Components.classes[RDF_CID].getService(nsIRDFService); +this.container = Components.classes[CONTAINER_CID].createInstance(nsIRDFContainer); +this.source = this.rdf.GetDataSource(this.getSource()); +this.currentResource = this.rdf.GetResource(SIDEBAR_CUR_URN); +this.installResource = this.rdf.GetResource(SIDEBAR_3RD_URN + this.url); +}//</m>setIn + + + +//================ +this.setUp = function //<m>void<a>public<d>Installation execution method +(){ +if(!this.source) return; +this.container.Init(this.source, this.getPanelList()); +if (this.container.IndexOf(this.installResource) == -1) { + this.setPanelResource(this.installResource); + this.setPanelRefresh(); + this.setOutput(this.title + MSG_PANEL_ADDED); +} else { + this.setPanelRefresh(); + this.setOutput(this.title + MSG_PANEL_REFRESHED); +} +}//</m>setUp + + + +//================ +this.setPanelResource = function //<m>void<a>public<d>Create a resource for the new panel and add it to the sidebar panel list +( +resource //<p>Object<d>Sidebar panel RDF resource +){ +this.setRDFTriple(resource, 'title', this.title, true); +this.setRDFTriple(resource, 'content', this.url, true); +if(this.customize) this.setRDFTriple(resource, 'customize', this.customize, true); +this.container.AppendElement(resource); +}//</m>setPanelResource + + + +//================ +this.setPanelRefresh = function //<m>void<a>public<d>Refresh Sidebar panels +(){ +this.setRDFTriple(this.currentResource, 'refresh', 'true', true); +this.setRDFTriple(this.currentResource, 'refresh', 'false', false); +this.source.QueryInterface(nsIRDFRemoteDataSource).Flush(); +}//</m>setPanelRefresh<d>& +/* +We pass a "refresh" event to all sidebars observers watching for this assertion (in sidebarOverlay.js) +*/ + + + +//================ +this.getPanelList = function //<m>Object<a>public<d>Get Sidebar panel resource +(){ +var +panelList = this.source.GetTarget(this.currentResource, this.rdf.GetResource(SIDEBAR_PANEL_URN), true); +if(panelList) panelList.QueryInterface(INTERFACES.nsIRDFResource); +else this.setOutput(MSG_PANEL_SOURCE); +return panelList; +}//</m>getPanelList + + + +//================ +this.getSource = function //<m>string<a>private<d>Get the Sidebar panels.rdf datasource URL +(){ +try{ + var + dirService = Components.classes[DIR_SERV_CID].getService(); + dirService = dirService.QueryInterface(nsIProperties); + var + sidebarFile = dirService.get(PANELS_RDF_FILE, INTERFACES.nsIFile); + if(!sidebarFile.exists()) throw MSG_NO_RDF_FILE; + var + ioService = Components.classes[IO_SERVICE_CID].getService(nsIIOService), + fileURL = ioService.newFileURI(sidebarFile); + fileURL = fileURL.QueryInterface(INTERFACES.nsIFileURL); + return fileURL.spec; + } +catch(e){ + return this.setOutput(e); + } +}//</m>getSource<d>& +/* +panels.rdf file is located in the user profile directory +If the file does not exist already, it is copied from /bin/defaults/profile/panels.rdf +*/ + + + +//================ +this.setRDFTriple = function //<m>void<a>private<d>Setup an assertion in the RDF datasource member +( +subject, //<p>string<d>Assertion subject +property, //<p>string<d>Assertion property +object, //<p>string<d>Assertion object +asserting //<p>boolean<d>Set or remove Assertion +){ +this.source[asserting ? 'Assert' : 'Unassert'](subject, this.rdf.GetResource(NC_NAMESPACE + property), this.rdf.GetLiteral(object), true); +}//</m>setRDFTriple + + + +//================ +this.setOutput = function //<m>boolean<a>private<d>Dump message to output console +( +output //<p>string<d>Message to output +){ +var +/*string*/out = //'[' + this.className + ']\n' + + output + '\n'; +window.alert(out); //dump(output); +return null; +}//</m>setOutput<d>& +/* +Use either console or window alert output +*/ + + + +this.MOZ_SidebarInstaller(_title, _url, _customize); +}//</c>MOZ_SidebarInstaller + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/tools_dialog.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,29 @@ +<?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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/tree.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,16 @@ +function open_link() +{ +var t=document.getElementById("menu_tree"); //baum in variable t holen +var l=t.view.getItemAtIndex(t.currentIndex); //aus baum treeitem herausholen mit dem selected index (currentIndex) +var d=l.firstChild.firstChild.getAttribute("link"); //aus treeitem treecell (mit firstChild.firstChild) und dann dort wert von id herausholen (mit getAttribute) +if (d!=""){ + //alert(d); + var isHera=d.search(/pythia2\.unibe\.ch/); + if (isHera!=-1){ + window.content.location.href=d; + }else{ + // window.content.location.href="http://hera.unibe.ch:8080/alcatraz/xul/"+d; + window.content.location.href="http://pythia2.unibe.ch:8080/docuserver/digitallibrary/"+d; + } +} +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/tree.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,34 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> + +<window id="example-window" title="Example 6.8.2" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + +<script language="JavaScript" src="tree.js" /> + +<tree id="menu_tree" onselect="open_link();" flex="1" width="200" height="200" + datasources="http://hera.unibe.ch:8080/alcatraz/xul/echonavigation.jsp" ref="urn:echonavigation:data"> + + <treecols> + <treecol id="name" label="Name" primary="true" flex="1"/> + </treecols> + + <template> + <rule> + <treechildren> + <treeitem uri="rdf:*"> + <treerow> + <treecell label="rdf:http://www.echo.eu/rdf#name" link="rdf:http://www.echo.eu/rdf#link"/> + </treerow> + </treeitem> + </treechildren> + </rule> + + </template> +</tree> + + +</window> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/tree_nav.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,12 @@ +function open_link() +{ +var t=document.getElementById("menu_tree"); //baum in variable t holen +var l=t.view.getItemAtIndex(t.currentIndex); //aus baum treeitem herausholen mit dem selected index (currentIndex) +var d=l.firstChild.firstChild.getAttribute("link"); //aus treeitem treecell (mit firstChild.firstChild) und dann dort wert von id herausholen (mit getAttribute) +if (d!=""){ + //alert(d); + + window.content.location.href="http://pythia2.unibe.ch:8080/docuserver/digitallibrary/digilib.jsp?lv=1&fn="+d; + +} +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/content/wtwg_bern.xul Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,26 @@ +<?xml version="1.0" ?> +<?xml-stylesheet href="chrome://alcatraz/skin/" type="text/css" ?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> + +<window xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + onload="setTreeDirectory()"> + <tabbox flex="1"> + <tabs> + <tab id="search_tab" selected="true" label="search" /> + <tab id="tree_tab" label="tree" /> + </tabs> + <tabpanels flex="1"> + <tabpanel orient="vertical"> + <iframe id="search_frame" src="search.xul" height="180" /> + <splitter id="navigio_splitter" state="opened" collapse="before" resizeafter="nearest"> + <grippy/> + </splitter> + <iframe id="result_frame" src="blank.html" flex="1" /> + </tabpanel> + <tabpanel> + <iframe id="tree_frame" src="tree.xul" flex="1" /> + </tabpanel> + </tabpanels> + </tabbox> +</window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/install.html Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,52 @@ +<html> +<head> + +<title>Install Alcatraz</title> + +<script type="application/x-javascript"> + +function install() { + InstallTrigger.install ( {'alcatraz' : 'alcatraz.xpi'} ); +} + +</script> + +</head> +<body> + +<h3>Alcatraz XUL Package</h3> +<p>contains a sidebar and beta-verion of a toolbar</p> +<h4>Installation:</h4> +<p>(maybe it is a good idea to print this side or to set a bookmark because you will have to close the browser during the installation)</p> +<ol> + press the "install alcatraz" button<br><br> + <form> + <input type="button" name="install alcatraz" value="install alcatraz" onClick="install();"><br> + </form> + </li> + + <li>restart mozilla (and you will find the new toolbar installed)</li> + + <li>enter chrome://alcatraz/content/sidebar/install.xul in the input field of the URL bar</li> + + <li>a dialog is asking you to install the Alcatraz-Sidebar, open the Sidebar (F9) and press the button</li> + +</ol> + +<p><b>Beware :</b> Due to the very early stage of the toolbar and the missing tools to +easily remove it, the installation with toolbar is primarily for developers. If you +still installed the toolbar-version and now want to get rid of it, you have to delete the lines +in <pre>[loacal_chrome]/overlayinfo/browser/content/overlays.rdf</pre> and +<pre>[local_chrome]/overlayinfo/navigator/content/overlays.rdf</pre> containing +'alcatraz_toolbar'. Then restart mozilla and pray that the toolbar has disappeared ...</p> + +<hr> + +<address><a href="mailto:engler@philo.unibe.ch">Daniel Engler</a></address> +<address><a href="mailto:luginbuehl@student.unibe.ch">Christian Luginbuehl</a></address> +<!-- Created: Mon May 12 19:44:41 CEST 2003 --> +<!-- hhmts start --> +Last modified: Tue May 13 20:17:00 CEST 2003 +<!-- hhmts end --> + </body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/install.js Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,65 @@ +/* + +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, 22.05.2003 , Version Alcatraz 0.5 + +*/ + +var authorName = "ubern"; + + +var appName = "ALCATRAZ"; +var appVersion = "0.5.0"; +var appChromeName = "alcatraz"; +var appFile = "alcatraz.jar"; + +var jarAppPath = "content/"; +var jarSkinPath = "skin/"; +var jarLocalePath = "locale/en-US/"; + +var userChrome = getFolder("Profile", "chrome"); + +var successMessage = "The ALCATRAZ package has been successfully installed.\n\nRestart your browser to continue ..."; +var errorMessage = "Installation failed! Well, I have no idea what to do now ... sorry :-("; + + +initInstall(appName, authorName + appChromeName, appVersion); + +addFile(appName, appVersion, appFile, userChrome, '', true); + +registerChrome(Install.CONTENT | Install.PROFILE_CHROME, getFolder(userChrome, appFile), jarAppPath); +registerChrome(Install.SKIN | Install.PROFILE_CHROME, getFolder(userChrome, appFile), jarSkinPath); +registerChrome(Install.LOCALE | Install.PROFILE_CHROME, getFolder(userChrome, appFile), jarLocalePath); + +/** + * pretty simple error handling + */ +var code = getLastError(); + +if (code == SUCCESS) { + code = performInstall(); + + if (code == SUCCESS ||code == REBOOT_NEEDED) { + alert(successMessage); + } else { + alert(errorMessage); + cancelInstall(code) + } +} else { + cancelInstall(code); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/locale/en-US/contents.rdf Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,26 @@ +<?xml version="1.0"?> + +<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> + + <!-- list all the packages being supplied by this jar --> + <RDF:Seq RDF:about="urn:mozilla:locale:root"> + <RDF:li RDF:resource="urn:mozilla:locale:en-US"/> + </RDF:Seq> + + <!-- locale information --> + <RDF:Description RDF:about="urn:mozilla:locale:en-US" + chrome:displayName="English(US)" + chrome:author="Daniel Engler:Christian Luginbuehl" + chrome:name="en-US"> + <chrome:packages> + <RDF:Seq RDF:about="urn:mozilla:locale:en-US:packages"> + <RDF:li RDF:resource="urn:mozilla:locale:en-US:alcatraz"/> + </RDF:Seq> + </chrome:packages> + </RDF:Description> + + <!-- Version Information. --> + <RDF:Description RDF:about="urn:mozilla:locale:en-US:alcatraz" + chrome:localeVersion="1.0"/> +</RDF:RDF>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/make_alcatraz.sh Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,5 @@ +#!/bin/sh +jar -cf alcatraz.jar content skin locale +jar -cf alcatraz.xpi alcatraz.jar install.js +echo "alcatraz created ... trying to copy to pythia2 (password for user 'alcatraz' required)" +scp alcatraz.xpi install.html alcatraz@pythia2.unibe.ch:/data01/docuserver/www/digitallibrary/xul
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/skin/alcatraz.css Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,57 @@ +button { + margin: 1px; + min-width: 0px; +} + +.button-text { + margin: 0px !important; + font-size: 8pt; +} + +menuitem { + font-size: 8pt; +} + +.menu-iconic-icon { + width: 16px; + height: 10px; + list-style-image: inherit; +} + +.tab-text { + font-size: 9pt; +} + +tabpanels { + font-size: 8pt; +} + +toolbarbutton { + margin: 1px; + padding: 3px; + min-width: 1cm; +} + +#image_echo { + list-style-image: url('chrome://alcatraz/skin/images/echo.png'); +} + +#button_first { + min-width: 0px; + list-style-image: url('chrome://alcatraz/skin/images/first.png'); +} + +#button_prev { + min-width: 0px; + list-style-image: url('chrome://alcatraz/skin/images/prev.png'); +} + +#button_next { + min-width: 0px; + list-style-image: url(chrome://alcatraz/skin/images/next.png); +} + +#button_last { + min-width: 0px; + list-style-image: url(chrome://alcatraz/skin/images/last.png); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/skin/contents.rdf Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> + +<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> + + <RDF:Seq RDF:about="urn:mozilla:skin:root"> + <RDF:li RDF:resource="urn:mozilla:skin:classic/1.0" /> + </RDF:Seq> + + <RDF:Description RDF:about="urn:mozilla:skin:classic/1.0"> + <chrome:packages> + <RDF:Seq RDF:about="urn:mozilla:skin:classic/1.0:packages"> + <RDF:li RDF:resource="urn:mozilla:skin:classic/1.0:alcatraz" /> + </RDF:Seq> + </chrome:packages> + </RDF:Description> +</RDF:RDF> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xul/skin/dialog_originalsize.css Fri Feb 27 11:24:53 2004 +0100 @@ -0,0 +1,9 @@ +#vertical_bar { + list-style-image: url('chrome://alcatraz/skin/images/vertical_bar.png'); + margin: 5px; +} + +#horizontal_bar { + list-style-image: url('chrome://alcatraz/skin/images/horizontal_bar.png'); + margin: 5px; +} \ No newline at end of file