--- /dev/null
+@import url(chrome://global/skin/);
+
+/* No groupbox border in Linux:
+ https://developer.mozilla.org/en/XUL/groupbox
+ */
+/* groupbox {border-style:solid; border-color:black; border:1px;} */
--- /dev/null
+/* Useful helper functions */
+
+function tree_selection(id) {
+ var tree = document.getElementById(id);
+ var name = tree.columns.getPrimaryColumn();
+ var i = tree.currentIndex;
+ var path = new Array();
+ while (i >= 0) {
+ path.splice(0, 0, tree.view.getCellText(i, name));
+ i = tree.view.getParentIndex(i);
+ }
+ return path;
+}
+
+/* Functions driving the CherryPy backend */
+
+function new_tag(path) {
+ alert('Adding tag: '+path.toString());
+ /* https://developer.mozilla.org/en/RDF_in_Mozilla_FAQ */
+}
+
+function add_tag(path, tag) {
+ alert('Add tag '+path.toString()+' to '+tag);
+}
+
+function remove_tag(path, tag) {
+ alert('Remove tag '+path.toString()+' from '+tag);
+}
+
+/* The bindings themselves */
+
+function initialize() {
+ element = document.getElementById('element').file_path = 'UNDEFINED';
+}
+
+function new_tag_button() {
+ var text = document.getElementById('new-tag-text').value;
+ new_tag(text.split('/'));
+}
+
+function set_selected_element(path) {
+ element = document.getElementById('element');
+ element.file_path = path;
+ alert(path.toString());
+}
+
+function raw_tree_select() {
+ set_selected_element(tree_selection('raw-tree'));
+}
+
+function tag_tree_select() {
+ set_selected_element(tree_selection('tag-tree'));
+}
+
+function tag_check(event) {
+ var path = document.getElementById('element').file_path;
+ if (event.target.checked) {
+ add_tag(path, event.target.id);
+ } else {
+ remove_tag(path, event.target.id);
+ }
+}
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet href="dirtag.css" type="text/css"?>
+
+<!-- Firefox doesn't load external DTDs for web-served XML,
+ https://developer.mozilla.org/en/XML_in_Mozilla#DTDs_and_Other_External_Entities
+ so we use and internal DOCTYPE. This does make localization a bit
+ more annoying. -->
+<!DOCTYPE window [
+ <!ENTITY window.title "TODO: Title">
+ <!ENTITY XUL_note.text.pre_XUL "DirTag uses ">
+ <!ENTITY XUL_note.text.XUL_to_Firefox ", an XML user interface markup language developed by the Mozilla project. You probably need to view this page using ">
+ <!ENTITY XUL_note.text.post_Firefox ".">
+ <!ENTITY new_tag.caption "Add a new tag">
+ <!ENTITY new_tag_button.label "Add">
+ <!ENTITY new_tag_button.key "a">
+ <!ENTITY browser.caption "Browser">
+ <!ENTITY raw_browser.tab "Raw">
+ <!ENTITY tag_browser.tab "Tags">
+ <!ENTITY path_column.label "Path">
+ <!ENTITY tag_column.label "Tags">
+ <!ENTITY tags.caption "Tags">
+ <!ENTITY selected.caption "Selected">
+]>
+
+<window id="window" title="&window.title;"
+ onload="initialize();"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ >
+
+ <script src="dirtag.js"/>
+ <groupbox id="new-tag">
+ <caption label="&new_tag.caption;"/>
+ <hbox>
+ <textbox id="new-tag-text"/>
+ <button
+ id="new-tag-button"
+ class="dialog"
+ disabled="false"
+ label="&new_tag_button.label;"
+ accesskey="&new_tag_button.key;"
+ oncommand="new_tag_button();"/>
+ </hbox>
+ </groupbox>
+ <hbox flex="1">
+ <groupbox id="browser" flex="1">
+ <caption label="&browser.caption;"/>
+ <tabbox id="browser-tabbox" flex="1">
+ <tabs>
+ <tab label="&raw_browser.tab;"/>
+ <tab label="&tag_browser.tab;"/>
+ </tabs>
+ <tabpanels flex="1">
+ <tabpanel flex="1">
+ <tree id="raw-tree" rows="2" seltype="single" flex="1"
+ datasources="raw-tree.rdf" ref="http://dirtag.com/raw/files"
+ flags="dont-build-content" onselect="raw_tree_select();">
+ <treecols>
+ <treecol id="tab-tree-path-column" label="&path_column.label;" primary="true"
+ sort="rdf:http://dirtag.com/rdf#name" flex="1"/>
+ <splitter class="tree-splitter"/>
+ <treecol id="tab-tree-tag-column" label="&tag_column.label;"
+ sort="rdf:http://dirtag.com/rdf#tags" flex="1"/>
+ </treecols>
+ <template>
+ <rule>
+ <treechildren>
+ <treeitem uri="rdf:*">
+ <treerow>
+ <treecell label="rdf:http://dirtag.com/rdf#name"/>
+ <treecell label="rdf:http://dirtag.com/rdf#tags"/>
+ </treerow>
+ </treeitem>
+ </treechildren>
+ </rule>
+ </template>
+ </tree>
+ </tabpanel>
+ <tabpanel flex="1">
+ <tree id="tag-tree" rows="2" seltype="single" flex="1"
+ datasources="tag-tree.rdf raw-tree.rdf"
+ ref="http://dirtag.com/tag/files"
+ flags="dont-build-content" onselect="tag_tree_select();">
+ <treecols>
+ <treecol id="tab-tree-path-column" label="&path_column.label;" primary="true"
+ sort="rdf:http://dirtag.com/rdf#name" flex="1"/>
+ <splitter class="tree-splitter"/>
+ <treecol id="tab-tree-tag-column" label="&tag_column.label;"
+ sort="rdf:http://dirtag.com/rdf#tags" flex="1"/>
+ </treecols>
+ <template>
+ <rule>
+ <treechildren>
+ <treeitem uri="rdf:*">
+ <treerow>
+ <treecell label="rdf:http://dirtag.com/rdf#name"/>
+ <treecell label="rdf:http://dirtag.com/rdf#tags"/>
+ </treerow>
+ </treeitem>
+ </treechildren>
+ </rule>
+ </template>
+ </tree>
+ </tabpanel>
+ </tabpanels>
+ </tabbox>
+ </groupbox>
+ <splitter collapse="before"><grippy/></splitter>
+ <groupbox id="selected" flex="1" orient="horizontal">
+ <caption label="&selected.caption;"/>
+ <groupbox id="tags" oncommand="tag_check(event);">
+ <caption label="&tags.caption;"/>
+ <checkbox id="tag-X" checked="true" label="tag-X" accesskey="1"/>
+ <checkbox id="tag-Y" checked="true" label="tag-Y" accesskey="2"/>
+ <checkbox id="tag-Z" checked="false" label="tag-Z" accesskey="3"/>
+ </groupbox>
+ <iframe id="element" src="" flex="1"/>
+ </groupbox>
+ </hbox>
+<!-- <description id="XUL_note">
+ <html:p>
+ &XUL_note.text.pre_XUL;<html:a
+ href="http://en.wikipedia.org/wiki/XUL">XUL</html:a
+ >&XUL_note.text.XUL_to_Firefox;<html:a
+ href="http://www.firefox.com/">Firefox</html:a
+ >&XUL_note.text.post_Firefox;
+ </html:p>
+ </description>-->
+</window>
--- /dev/null
+<?xml version="1.0"?>
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:FILES="http://dirtag.com/rdf#">
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/a">
+ <FILES:name>a</FILES:name>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/a/a1.dat">
+ <FILES:name>a1.dat</FILES:name>
+ <FILES:tags>1</FILES:tags>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/a/a2.dat">
+ <FILES:name>a2.dat</FILES:name>
+ <FILES:tags>x</FILES:tags>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/a/a3.dat">
+ <FILES:name>a3.dat</FILES:name>
+ <FILES:tags></FILES:tags>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/b">
+ <FILES:name>b</FILES:name>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/b/b1.dat">
+ <FILES:name>b1.dat</FILES:name>
+ <FILES:tags>1,x/y</FILES:tags>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/b/b2.dat">
+ <FILES:name>b2.dat</FILES:name>
+ <FILES:tags></FILES:tags>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/raw/b/b3.dat">
+ <FILES:name>b3.dat</FILES:name>
+ <FILES:tags>x</FILES:tags>
+ </RDF:Description>
+
+ <RDF:Seq RDF:about="http://dirtag.com/raw/files">
+ <RDF:li>
+ <RDF:Seq RDF:about="http://dirtag.com/raw/a">
+ <RDF:li RDF:resource="http://dirtag.com/raw/a/a1.dat"/>
+ <RDF:li RDF:resource="http://dirtag.com/raw/a/a2.dat"/>
+ <RDF:li RDF:resource="http://dirtag.com/raw/a/a3.dat"/>
+ </RDF:Seq>
+ </RDF:li>
+ <RDF:li>
+ <RDF:Seq RDF:about="http://dirtag.com/raw/b">
+ <RDF:li RDF:resource="http://dirtag.com/raw/b/b1.dat"/>
+ <RDF:li RDF:resource="http://dirtag.com/raw/b/b2.dat"/>
+ <RDF:li RDF:resource="http://dirtag.com/raw/b/b3.dat"/>
+ </RDF:Seq>
+ </RDF:li>
+ </RDF:Seq>
+
+</RDF:RDF>
--- /dev/null
+<?xml version="1.0"?>
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:FILES="http://dirtag.com/rdf#">
+
+ <RDF:Description RDF:about="http://dirtag.com/tag/1">
+ <FILES:name>1</FILES:name>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/tag/x">
+ <FILES:name>x</FILES:name>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="http://dirtag.com/tag/x/y">
+ <FILES:name>y</FILES:name>
+ </RDF:Description>
+
+ <RDF:Seq RDF:about="http://dirtag.com/tag/files">
+ <RDF:li>
+ <RDF:Seq RDF:about="http://dirtag.com/tag/1">
+ <RDF:li RDF:resource="http://dirtag.com/raw/a/a1.dat"/>
+ <RDF:li RDF:resource="http://dirtag.com/raw/b/b1.dat"/>
+ </RDF:Seq>
+ </RDF:li>
+ <RDF:li>
+ <RDF:Seq RDF:about="http://dirtag.com/tag/x">
+ <RDF:li RDF:resource="http://dirtag.com/raw/a/a2.dat"/>
+ <RDF:li RDF:resource="http://dirtag.com/raw/b/b3.dat"/>
+ <RDF:li>
+ <RDF:Seq RDF:about="http://dirtag.com/tag/x/y">
+ <RDF:li RDF:resource="http://dirtag.com/raw/b/b1.dat"/>
+ </RDF:Seq>
+ </RDF:li>
+ </RDF:Seq>
+ </RDF:li>
+ </RDF:Seq>
+
+</RDF:RDF>