├── .gitignore
├── LICENSE
├── README.md
├── docs
├── .DS_Store
└── images
│ ├── Delegator_UML.png
│ └── Typical_Setup.png
├── src
├── basic.htm
├── citation.htm
├── css
│ ├── ceww_converted.css
│ ├── cwrc.css
│ ├── cwrc_converted.css
│ ├── cwrcstyle
│ │ ├── images
│ │ │ ├── ui-bg_flat_0_b3bbbe_40x100.png
│ │ │ ├── ui-bg_flat_55_ffffff_40x100.png
│ │ │ ├── ui-bg_flat_65_0c3e99_40x100.png
│ │ │ ├── ui-bg_flat_75_b3bbbe_40x100.png
│ │ │ ├── ui-bg_flat_75_ffffff_40x100.png
│ │ │ ├── ui-bg_flat_95_ffffff_40x100.png
│ │ │ ├── ui-icons_030303_256x240.png
│ │ │ ├── ui-icons_0c3e99_256x240.png
│ │ │ ├── ui-icons_cc0000_256x240.png
│ │ │ └── ui-icons_ffffff_256x240.png
│ │ ├── jquery-ui.css
│ │ └── jquery-ui.min.css
│ ├── editor.css
│ ├── islandora_style.css
│ ├── layout-default-latest.css
│ ├── orlando.css
│ ├── orlando_converted.css
│ ├── style.css
│ ├── tei.css
│ └── tei_converted.css
├── editor_dev.htm
├── img
│ ├── CWRC_logo_text_web.png
│ ├── CWRC_logo_text_web_small.png
│ ├── add.png
│ ├── arrow_down.gif
│ ├── arrow_left.gif
│ ├── arrow_right.gif
│ ├── arrow_up.gif
│ ├── book.png
│ ├── building.png
│ ├── cake.png
│ ├── calendar.png
│ ├── chart_org.png
│ ├── citation_inline_large.png
│ ├── citation_inline_large_highlight.png
│ ├── cross.png
│ ├── cwrc_logo_small.png
│ ├── delete.png
│ ├── editsource.gif
│ ├── en.png
│ ├── error.png
│ ├── folder_page.png
│ ├── group.png
│ ├── heading.png
│ ├── help.png
│ ├── html.png
│ ├── key.png
│ ├── keyword_inline_large.png
│ ├── keyword_inline_large_highlight.png
│ ├── link.png
│ ├── link_add.png
│ ├── loading.gif
│ ├── loading_large.gif
│ ├── menu_arrow.gif
│ ├── note.png
│ ├── note_inline_large.png
│ ├── note_inline_large_highlight.png
│ ├── orlando
│ │ ├── bibcit.gif
│ │ ├── book1.gif
│ │ ├── earth1.gif
│ │ ├── note.gif
│ │ ├── pen1.gif
│ │ ├── people1.gif
│ │ └── theorlandoproject.gif
│ ├── page_key.png
│ ├── page_white_code.png
│ ├── page_white_edit.png
│ ├── page_white_text.png
│ ├── para.gif
│ ├── para.png
│ ├── pencil.png
│ ├── quote.png
│ ├── s.gif
│ ├── save.png
│ ├── save_as.png
│ ├── save_exit.png
│ ├── script.png
│ ├── script_add.png
│ ├── script_delete.png
│ ├── tag.png
│ ├── tag_blue.png
│ ├── tag_blue_add.png
│ ├── tag_blue_copy.png
│ ├── tag_blue_delete.png
│ ├── tag_blue_edit.png
│ ├── tag_blue_paste.png
│ ├── tag_text.png
│ ├── text_italic.png
│ ├── time.png
│ ├── title.gif
│ ├── title.png
│ ├── user.png
│ ├── user_gray.png
│ ├── validate.png
│ ├── vcard.png
│ ├── viewsource.gif
│ └── world.png
├── index.htm
├── js
│ ├── annotationsManager.js
│ ├── config.js
│ ├── converter.js
│ ├── cwrcDialogs
│ │ ├── cD.js
│ │ ├── css
│ │ │ ├── cD.css
│ │ │ ├── cwrcDialogs.css
│ │ │ └── datepicker.css
│ │ ├── cwrc-api.js
│ │ └── schemas
│ │ │ └── entities.rng
│ ├── delegator.js
│ ├── dialogManager.js
│ ├── dialogs
│ │ ├── addEvent.js
│ │ ├── addSchema.js
│ │ ├── attributeWidget.js
│ │ ├── copyPaste.js
│ │ ├── cwrcCitation.js
│ │ ├── cwrcDialogBridge.js
│ │ ├── cwrcOrg.js
│ │ ├── cwrcPerson.js
│ │ ├── cwrcPlace.js
│ │ ├── cwrcTitle.js
│ │ ├── dialogForm.js
│ │ ├── fileManager.js
│ │ ├── header.js
│ │ ├── help.js
│ │ ├── message.js
│ │ ├── schemaTags.js
│ │ ├── searchWidget.js
│ │ ├── settings.js
│ │ └── triple.js
│ ├── docsMappings.js
│ ├── entitiesManager.js
│ ├── entity.js
│ ├── eventManager.js
│ ├── fileManager.js
│ ├── layout.js
│ ├── layout_reader.js
│ ├── lib
│ │ ├── bootstrap
│ │ │ ├── bootstrap-datepicker.js
│ │ │ ├── bootstrap.css
│ │ │ ├── bootstrap.js
│ │ │ └── bootstrap.min.js
│ │ ├── fonts
│ │ │ ├── font-awesome
│ │ │ │ ├── css
│ │ │ │ │ ├── font-awesome.css
│ │ │ │ │ └── font-awesome.min.css
│ │ │ │ └── fonts
│ │ │ │ │ ├── FontAwesome.otf
│ │ │ │ │ ├── fontawesome-webfont.eot
│ │ │ │ │ ├── fontawesome-webfont.svg
│ │ │ │ │ ├── fontawesome-webfont.ttf
│ │ │ │ │ └── fontawesome-webfont.woff
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.svg
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ └── glyphicons-halflings-regular.woff
│ │ ├── jquery
│ │ │ ├── jquery-1.8.3.js
│ │ │ ├── jquery-1.9.1.js
│ │ │ ├── jquery-migrate-1.2.1.js
│ │ │ ├── jquery-ui-1.10.3.custom.js
│ │ │ ├── jquery-ui-1.10.3.custom.min.js
│ │ │ ├── jquery-ui-1.10.4.custom.js
│ │ │ ├── jquery-ui-1.10.4.custom.min.js
│ │ │ ├── jquery-ui-1.10.4.min.js
│ │ │ ├── jquery-ui-1.11.1.min.js
│ │ │ ├── jquery.collapsiblepanel.css
│ │ │ ├── jquery.collapsiblepanel.js
│ │ │ ├── jquery.contextmenu.js
│ │ │ ├── jquery.layout-latest.min.js
│ │ │ ├── jquery.layout.resizeTabLayout-1.3.js
│ │ │ ├── jquery.tmpl.min.js
│ │ │ ├── jquery.watermark.min.js
│ │ │ └── jquery.xpath.js
│ │ ├── jstree
│ │ │ ├── jquery.hotkeys.js
│ │ │ ├── jquery.jstree.js
│ │ │ ├── jstree.3.0.0.js
│ │ │ └── themes
│ │ │ │ └── cwrc
│ │ │ │ ├── 32px.png
│ │ │ │ ├── 40px.png
│ │ │ │ ├── cwrc.css
│ │ │ │ ├── style.css
│ │ │ │ └── throbber.gif
│ │ ├── knockout
│ │ │ └── knockout-3.3.0.js
│ │ ├── moment
│ │ │ └── moment.min.js
│ │ ├── objtree
│ │ │ └── ObjTree.js
│ │ ├── octokit
│ │ │ └── octokit.js
│ │ ├── require
│ │ │ ├── require.js
│ │ │ └── text.js
│ │ ├── reworkcss
│ │ │ ├── parser
│ │ │ │ └── parser.js
│ │ │ └── stringify
│ │ │ │ ├── compiler.js
│ │ │ │ ├── compress.js
│ │ │ │ ├── identity.js
│ │ │ │ ├── inherits.js
│ │ │ │ └── stringify.js
│ │ ├── snippet
│ │ │ ├── jquery.snippet.css
│ │ │ └── jquery.snippet.min.js
│ │ └── tinymce4
│ │ │ ├── plugins
│ │ │ └── paste
│ │ │ │ ├── plugin.js
│ │ │ │ └── plugin.min.js
│ │ │ ├── skins
│ │ │ └── lightgray
│ │ │ │ ├── content.inline.min.css
│ │ │ │ ├── content.min.css
│ │ │ │ ├── fonts
│ │ │ │ ├── readme.md
│ │ │ │ ├── tinymce-small.eot
│ │ │ │ ├── tinymce-small.json
│ │ │ │ ├── tinymce-small.svg
│ │ │ │ ├── tinymce-small.ttf
│ │ │ │ ├── tinymce-small.woff
│ │ │ │ ├── tinymce.eot
│ │ │ │ ├── tinymce.json
│ │ │ │ ├── tinymce.svg
│ │ │ │ ├── tinymce.ttf
│ │ │ │ └── tinymce.woff
│ │ │ │ ├── img
│ │ │ │ ├── anchor.gif
│ │ │ │ ├── loader.gif
│ │ │ │ ├── object.gif
│ │ │ │ └── trans.gif
│ │ │ │ ├── skin.ie7.min.css
│ │ │ │ └── skin.min.css
│ │ │ ├── themes
│ │ │ ├── cwrc
│ │ │ │ └── theme.js
│ │ │ └── modern
│ │ │ │ ├── theme.js
│ │ │ │ └── theme.min.js
│ │ │ ├── tinymce.js
│ │ │ └── tinymce.min.js
│ ├── modules
│ │ ├── entitiesList.js
│ │ ├── relations.js
│ │ ├── selection.js
│ │ ├── structureTree.js
│ │ └── validation.js
│ ├── schema
│ │ ├── cwrcEntry
│ │ │ ├── dialogs
│ │ │ │ ├── citation.js
│ │ │ │ ├── correction.js
│ │ │ │ ├── date.js
│ │ │ │ ├── keyword.js
│ │ │ │ ├── link.js
│ │ │ │ ├── note.js
│ │ │ │ ├── org.js
│ │ │ │ ├── person.js
│ │ │ │ ├── place.js
│ │ │ │ └── title.js
│ │ │ └── mappings.js
│ │ ├── empty_mappings.js
│ │ ├── mapper.js
│ │ ├── orlando
│ │ │ ├── dialogs
│ │ │ │ ├── citation.js
│ │ │ │ ├── correction.js
│ │ │ │ ├── date.js
│ │ │ │ ├── keyword.js
│ │ │ │ ├── link.js
│ │ │ │ ├── note.js
│ │ │ │ ├── org.js
│ │ │ │ ├── person.js
│ │ │ │ ├── place.js
│ │ │ │ └── title.js
│ │ │ └── mappings.js
│ │ ├── schemaManager.js
│ │ └── tei
│ │ │ ├── dialogs
│ │ │ ├── citation.js
│ │ │ ├── correction.js
│ │ │ ├── date.js
│ │ │ ├── keyword.js
│ │ │ ├── link.js
│ │ │ ├── note.js
│ │ │ ├── org.js
│ │ │ ├── person.js
│ │ │ ├── place.js
│ │ │ └── title.js
│ │ │ └── mappings.js
│ ├── tagger.js
│ ├── tinymce_plugins
│ │ ├── currenttag4.js
│ │ ├── cwrc_contextmenu.js
│ │ ├── schematags4.js
│ │ ├── treepaste.js
│ │ └── viewsource.js
│ ├── utilities.js
│ ├── writer.js
│ └── writerConfig.js
├── note.htm
├── reader.htm
└── xml
│ ├── blank_tei.xml
│ ├── citation_tei.xml
│ ├── note_tei.xml
│ └── xsl
│ ├── all_attributes.xsl
│ ├── all_elements.xsl
│ ├── doc2internal.xsl
│ └── normalize.xsl
└── tests
├── config.js
├── delegator_tests.js
├── dialogManager_tests.js
├── entitiesModel_tests.js
├── eventManager_tests.js
├── fileManager_tests.js
├── schemaManager_tests.js
├── tagger_tests.js
├── test_template.html
├── utilities_tests.js
└── writer_tests.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /.project
2 | /.settings
3 | /.classpath
4 | /.tomcatplugin
5 | /WebContent
6 | .externalToolBuilders
7 | /src/js/lib/tinymce_src
8 | /docs
9 |
--------------------------------------------------------------------------------
/docs/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/docs/.DS_Store
--------------------------------------------------------------------------------
/docs/images/Delegator_UML.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/docs/images/Delegator_UML.png
--------------------------------------------------------------------------------
/docs/images/Typical_Setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/docs/images/Typical_Setup.png
--------------------------------------------------------------------------------
/src/basic.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
77 |
CWRC-Writer
78 |
an open-source editor for online digital scholarship
79 |
This is an early prototype for demonstration purposes:
80 | certain features are not yet functional and there are many bugs.
81 | The editor works best with the current version of the Firefox or Chrome browsers.
82 |
Testing instructions are here .
83 |
A short survey for testers is here . Please take 5 minutes to fill it out!
84 |
For more information on CWRC, visit here .
85 |
121 |
122 | ');
22 |
23 | var d = $('#addSchemaDialog');
24 | d.dialog({
25 | modal: true,
26 | resizable: false,
27 | closeOnEscape: false,
28 | open: function(event, ui) {
29 | $('#addSchemaDialog').parent().find('.ui-dialog-titlebar-close').hide();
30 | },
31 | title: 'Add Schema',
32 | height: 170,
33 | width: 300,
34 | autoOpen: false,
35 | buttons: {
36 | 'Add': function() {
37 | var info = {};
38 | $('#addSchemaDialog input').each(function(index, el) {
39 | info[el.getAttribute('name')] = $(el).val();
40 | });
41 | var id = w.schemaManager.addSchema(info);
42 | d.dialog('close');
43 | },
44 | 'Cancel': function() {
45 | d.dialog('close');
46 | }
47 | }
48 | });
49 |
50 | return {
51 | show: function(config) {
52 | $('#addSchemaDialog input').val('');
53 | d.dialog('open');
54 | },
55 | hide: function() {
56 | d.dialog('close');
57 | }
58 | };
59 | };
60 |
61 | });
--------------------------------------------------------------------------------
/src/js/dialogs/copyPaste.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui'], function($, jqueryUi) {
2 |
3 | return function(writer) {
4 | var w = writer;
5 |
6 | var firstCopy = true;
7 | var firstPaste = true;
8 |
9 | var cwrcCopy = false;
10 |
11 | var copyMsg = 'It looks like you\'re trying to copy content.").parent(),t=a(C.html().replace(/type=["']?password["']?/i,'type="text"'));t.data(d,i.data(d));t.data(f,i.data(f));t.data(g,1);t.attr(j,p.length);t.focus(function(){a.watermark._hide(t,c)}).bind(A,function(){a.watermark._hide(t)}).bind("dragend",function(){h.setTimeout(function(){t.blur()},1)});i.blur(function(){a.watermark._show(i)}).bind(B,function(){a.watermark._show(i)});t.data(e,i);i.data(e,t)}else i.focus(function(){i.data(q,1);a.watermark._hide(i,c)}).blur(function(){i.data(q,0);a.watermark._show(i)}).bind(A,function(){a.watermark._hide(i)}).bind(B,function(){a.watermark._show(i)}).bind("dragend",function(){h.setTimeout(function(){a.watermark._show(i)},1)}).bind("drop",function(e){var c=i[0],a=e.originalEvent.dataTransfer.getData("Text");if((c.value||b).replace(k,b).replace(a,b)===i.data(d))c.value=a;i.focus()});if(z.form){var w=z.form,y=a(w);if(!y.data(l)){y.submit(a.watermark.hideAll);if(w.submit){y.data(l,w.submit);w.submit=function(c,b){return function(){var d=b.data(l);a.watermark.hideAll();if(d.apply)d.apply(c,Array.prototype.slice.call(arguments));else d()}}(w,y)}else{y.data(l,1);w.submit=function(b){return function(){a.watermark.hideAll();delete b.submit;b.submit()}}(w)}}}}a.watermark._show(i)})};if(a.watermark.runOnce){a.watermark.runOnce=i;a.extend(a.expr[":"],{data:function(c,d,b){return!!a.data(c,b[3])}});(function(c){a.fn.val=function(){var e=this;if(!e.length)return arguments.length?e:y;if(!arguments.length)if(e.data(g)){var f=(e[0].value||b).replace(k,b);return f===(e.data(d)||b)?b:f}else return c.apply(e,arguments);else{c.apply(e,arguments);a.watermark.show(e);return e}}})(a.fn.val);p.length&&a(function(){for(var b,c,d=p.length-1;d>=0;d--){b=p[d];c=h[b];if(typeof c===w)h[b]=function(b){return function(){a.watermark.hideAll();return b.apply(null,Array.prototype.slice.call(arguments))}}(c)}});a(h).bind("beforeunload",function(){a.watermark.options.hideBeforeUnload&&a.watermark.hideAll()})}})(jQuery,window);
10 | });
--------------------------------------------------------------------------------
/src/js/lib/jstree/jquery.hotkeys.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery Hotkeys Plugin
3 | * Copyright 2010, John Resig
4 | * Dual licensed under the MIT or GPL Version 2 licenses.
5 | *
6 | * Based upon the plugin by Tzury Bar Yochay:
7 | * http://github.com/tzuryby/hotkeys
8 | *
9 | * Original idea by:
10 | * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
11 | */
12 |
13 | (function(jQuery){
14 |
15 | jQuery.hotkeys = {
16 | version: "0.8",
17 |
18 | specialKeys: {
19 | 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
20 | 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
21 | 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
22 | 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
23 | 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
24 | 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
25 | 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
26 | },
27 |
28 | shiftNums: {
29 | "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
30 | "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
31 | ".": ">", "/": "?", "\\": "|"
32 | }
33 | };
34 |
35 | function keyHandler( handleObj ) {
36 | // Only care when a possible input has been specified
37 | if ( typeof handleObj.data !== "string" ) {
38 | return;
39 | }
40 |
41 | var origHandler = handleObj.handler,
42 | keys = handleObj.data.toLowerCase().split(" ");
43 |
44 | handleObj.handler = function( event ) {
45 | // Don't fire in text-accepting inputs that we didn't directly bind to
46 | if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
47 | event.target.type === "text") ) {
48 | return;
49 | }
50 |
51 | // Keypress represents characters, not special keys
52 | var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
53 | character = String.fromCharCode( event.which ).toLowerCase(),
54 | key, modif = "", possible = {};
55 |
56 | // check combinations (alt|ctrl|shift+anything)
57 | if ( event.altKey && special !== "alt" ) {
58 | modif += "alt+";
59 | }
60 |
61 | if ( event.ctrlKey && special !== "ctrl" ) {
62 | modif += "ctrl+";
63 | }
64 |
65 | // TODO: Need to make sure this works consistently across platforms
66 | if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
67 | modif += "meta+";
68 | }
69 |
70 | if ( event.shiftKey && special !== "shift" ) {
71 | modif += "shift+";
72 | }
73 |
74 | if ( special ) {
75 | possible[ modif + special ] = true;
76 |
77 | } else {
78 | possible[ modif + character ] = true;
79 | possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
80 |
81 | // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
82 | if ( modif === "shift+" ) {
83 | possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
84 | }
85 | }
86 |
87 | for ( var i = 0, l = keys.length; i < l; i++ ) {
88 | if ( possible[ keys[i] ] ) {
89 | return origHandler.apply( this, arguments );
90 | }
91 | }
92 | };
93 | }
94 |
95 | jQuery.each([ "keydown", "keyup", "keypress" ], function() {
96 | jQuery.event.special[ this ] = { add: keyHandler };
97 | });
98 |
99 | })( jQuery );
--------------------------------------------------------------------------------
/src/js/lib/jstree/themes/cwrc/32px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/jstree/themes/cwrc/32px.png
--------------------------------------------------------------------------------
/src/js/lib/jstree/themes/cwrc/40px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/jstree/themes/cwrc/40px.png
--------------------------------------------------------------------------------
/src/js/lib/jstree/themes/cwrc/cwrc.css:
--------------------------------------------------------------------------------
1 | /* jstree overrides */
2 | #vakata-dragged {
3 | display: block;
4 | overflow: hidden;
5 | background-color: #fff;
6 | border: 1px solid #D4D0C8;
7 | border-radius: 4px;
8 | padding: 4px !important;
9 | }
10 |
11 | #vakata-dragged ins {
12 | background-image: url("../smoothness/images/ui-icons_ffffff_256x240.png") !important;
13 | background-repeat: no-repeat !important;
14 | position: relative !important;
15 | display: inline-block !important;
16 | margin-right: 4px !important;
17 | top: 0 !important;
18 | left: 0 !important;
19 | vertical-align: bottom;
20 | }
21 |
22 | #vakata-dragged ins.jstree-ok {
23 | background-position: -64px -144px;
24 | }
25 |
26 | #vakata-dragged ins.jstree-invalid {
27 | background-position: -96px -128px;
28 | }
29 |
30 | #vakata-dragged span.jstree-copy {
31 | background: url("../smoothness/images/ui-icons_222222_256x240.png") -16px -128px no-repeat !important;
32 | display: inline-block;
33 | width: 16px;
34 | height: 16px;
35 | margin-left: -2px;
36 | vertical-align: bottom;
37 | }
38 |
39 | #jstree-marker {
40 | background: url("../smoothness/images/ui-icons_222222_256x240.png") -32px -16px no-repeat !important;
41 | width: 16px !important;
42 | height: 16px !important;
43 | text-indent: -100px;
44 | }
45 |
46 | #vakata-contextmenu, #vakata-contextmenu ul li ul {
47 | border: 1px solid #D4D0C8 !important;
48 | background-color: #fff !important;
49 | box-shadow: 1px 1px 2px #ccc;
50 | }
51 | #vakata-contextmenu, #vakata-contextmenu ul {
52 | min-width: 165px !important;
53 | }
54 |
55 | #vakata-contextmenu li ins, #jqContextMenu li ins {
56 | margin: 2px 2px 0 2px !important;
57 | }
58 |
59 | #vakata-contextmenu .submenu > a span {
60 | background-image: url("../img/menu_arrow.gif");
61 | color: #fff;
62 | display: block;
63 | float: right;
64 | width: 20px;
65 | height: 20px;
66 | }
67 |
68 | #vakata-contextmenu .submenu .filterParent {
69 | position: absolute;
70 | display: none;
71 | background-color: #fff !important;
72 | border: 1px solid #D4D0C8 !important;
73 | box-shadow: 1px 1px 2px #CCCCCC;
74 | }
75 |
76 | #vakata-contextmenu .submenu .filterParent span {
77 | margin: 2px 3px;
78 | font-size: 11px;
79 | }
80 |
81 | #vakata-contextmenu .submenu .filterParent input {
82 | margin: 2px 3px 2px 0;
83 | width: 90px;
84 | position: relative;
85 | font-size: 11px;
86 | border: 1px solid #D4D0C8;
87 | }
88 |
89 | #jqContextMenu li.separator {
90 | border-top: 1px solid #DDDDDD !important;
91 | }
92 |
93 | #jqContextMenu li ins {
94 | float: left;
95 | height: 16px;
96 | margin-right: 2px;
97 | text-decoration: none;
98 | width: 16px;
99 | }
100 |
101 | #vakata-contextmenu li a {
102 | font-family: Tahoma,Verdana,Arial,Helvetica !important;
103 | font-size: 11px !important;
104 | color: #000 !important;
105 | line-height: 22px !important;
106 | padding: 0 !important;
107 | margin: 0 !important;
108 | }
109 |
110 | #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a {
111 | color: #000 !important;
112 | background-color: #DBECF3 !important;
113 | }
114 |
115 | #tree.jstree li.person {
116 | background-color: #FFCCCC;
117 | }
118 | #tree.jstree li.place {
119 | background-color: #A9D6D6;
120 | }
121 | #tree.jstree li.date {
122 | background-color: #FFD5B3;
123 | }
124 | #tree.jstree li.event {
125 | background-color: #9FDF9F;
126 | }
127 | #tree.jstree li.org {
128 | background-color: #BDB4D5;
129 | }
130 | #tree.jstree li.citation {
131 | background-color: #E6B3CF;
132 | }
133 | #tree.jstree li.note {
134 | background-color: #9CAFC4;
135 | }
136 | #tree.jstree li.title {
137 | background-color: #F6E78D;
138 | }
139 | #tree.jstree li.correction {
140 | background-color: #FFC2B3;
141 | }
142 | #tree.jstree li.keyword {
143 | background-color: #8EECBD;
144 | }
145 | #tree.jstree li.link {
146 | background-color: #94AFFF;
147 | }
--------------------------------------------------------------------------------
/src/js/lib/jstree/themes/cwrc/throbber.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/jstree/themes/cwrc/throbber.gif
--------------------------------------------------------------------------------
/src/js/lib/reworkcss/stringify/compiler.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | /**
4 | * Initialize a compiler.
5 | *
6 | * @param {Type} name
7 | * @return {Type}
8 | * @api public
9 | */
10 |
11 | function Compiler(opts) {
12 | this.options = opts || {};
13 | }
14 |
15 | /**
16 | * Emit `str`
17 | */
18 |
19 | Compiler.prototype.emit = function(str) {
20 | return str;
21 | };
22 |
23 | /**
24 | * Visit `node`.
25 | */
26 |
27 | Compiler.prototype.visit = function(node){
28 | return this[node.type](node);
29 | };
30 |
31 | /**
32 | * Map visit over array of `nodes`, optionally using a `delim`
33 | */
34 |
35 | Compiler.prototype.mapVisit = function(nodes, delim){
36 | var buf = '';
37 | delim = delim || '';
38 |
39 | for (var i = 0, length = nodes.length; i < length; i++) {
40 | buf += this.visit(nodes[i]);
41 | if (delim && i < length - 1) buf += this.emit(delim);
42 | }
43 |
44 | return buf;
45 | };
46 |
47 | /**
48 | * Expose `Compiler`.
49 | */
50 |
51 | return Compiler;
52 |
53 | });
--------------------------------------------------------------------------------
/src/js/lib/reworkcss/stringify/compress.js:
--------------------------------------------------------------------------------
1 | define(['css.compiler', 'inherits'], function(Base, inherits) {
2 |
3 | /**
4 | * Initialize a new `Compiler`.
5 | */
6 |
7 | function Compiler(options) {
8 | Base.call(this, options);
9 | }
10 |
11 | /**
12 | * Inherit from `Base.prototype`.
13 | */
14 |
15 | inherits(Compiler, Base);
16 |
17 | /**
18 | * Compile `node`.
19 | */
20 |
21 | Compiler.prototype.compile = function(node){
22 | return node.stylesheet
23 | .rules.map(this.visit, this)
24 | .join('');
25 | };
26 |
27 | /**
28 | * Visit comment node.
29 | */
30 |
31 | Compiler.prototype.comment = function(node){
32 | return this.emit('', node.position);
33 | };
34 |
35 | /**
36 | * Visit import node.
37 | */
38 |
39 | Compiler.prototype.import = function(node){
40 | return this.emit('@import ' + node.import + ';', node.position);
41 | };
42 |
43 | /**
44 | * Visit media node.
45 | */
46 |
47 | Compiler.prototype.media = function(node){
48 | return this.emit('@media ' + node.media, node.position)
49 | + this.emit('{')
50 | + this.mapVisit(node.rules)
51 | + this.emit('}');
52 | };
53 |
54 | /**
55 | * Visit document node.
56 | */
57 |
58 | Compiler.prototype.document = function(node){
59 | var doc = '@' + (node.vendor || '') + 'document ' + node.document;
60 |
61 | return this.emit(doc, node.position)
62 | + this.emit('{')
63 | + this.mapVisit(node.rules)
64 | + this.emit('}');
65 | };
66 |
67 | /**
68 | * Visit charset node.
69 | */
70 |
71 | Compiler.prototype.charset = function(node){
72 | return this.emit('@charset ' + node.charset + ';', node.position);
73 | };
74 |
75 | /**
76 | * Visit namespace node.
77 | */
78 |
79 | Compiler.prototype.namespace = function(node){
80 | return this.emit('@namespace ' + node.namespace + ';', node.position);
81 | };
82 |
83 | /**
84 | * Visit supports node.
85 | */
86 |
87 | Compiler.prototype.supports = function(node){
88 | return this.emit('@supports ' + node.supports, node.position)
89 | + this.emit('{')
90 | + this.mapVisit(node.rules)
91 | + this.emit('}');
92 | };
93 |
94 | /**
95 | * Visit keyframes node.
96 | */
97 |
98 | Compiler.prototype.keyframes = function(node){
99 | return this.emit('@'
100 | + (node.vendor || '')
101 | + 'keyframes '
102 | + node.name, node.position)
103 | + this.emit('{')
104 | + this.mapVisit(node.keyframes)
105 | + this.emit('}');
106 | };
107 |
108 | /**
109 | * Visit keyframe node.
110 | */
111 |
112 | Compiler.prototype.keyframe = function(node){
113 | var decls = node.declarations;
114 |
115 | return this.emit(node.values.join(','), node.position)
116 | + this.emit('{')
117 | + this.mapVisit(decls)
118 | + this.emit('}');
119 | };
120 |
121 | /**
122 | * Visit page node.
123 | */
124 |
125 | Compiler.prototype.page = function(node){
126 | var sel = node.selectors.length
127 | ? node.selectors.join(', ')
128 | : '';
129 |
130 | return this.emit('@page ' + sel, node.position)
131 | + this.emit('{')
132 | + this.mapVisit(node.declarations)
133 | + this.emit('}');
134 | };
135 |
136 | /**
137 | * Visit font-face node.
138 | */
139 |
140 | Compiler.prototype['font-face'] = function(node){
141 | return this.emit('@font-face', node.position)
142 | + this.emit('{')
143 | + this.mapVisit(node.declarations)
144 | + this.emit('}');
145 | };
146 |
147 | /**
148 | * Visit host node.
149 | */
150 |
151 | Compiler.prototype.host = function(node){
152 | return this.emit('@host', node.position)
153 | + this.emit('{')
154 | + this.mapVisit(node.rules)
155 | + this.emit('}');
156 | };
157 |
158 | /**
159 | * Visit custom-media node.
160 | */
161 |
162 | Compiler.prototype['custom-media'] = function(node){
163 | return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
164 | };
165 |
166 | /**
167 | * Visit rule node.
168 | */
169 |
170 | Compiler.prototype.rule = function(node){
171 | var decls = node.declarations;
172 | if (!decls.length) return '';
173 |
174 | return this.emit(node.selectors.join(','), node.position)
175 | + this.emit('{')
176 | + this.mapVisit(decls)
177 | + this.emit('}');
178 | };
179 |
180 | /**
181 | * Visit declaration node.
182 | */
183 |
184 | Compiler.prototype.declaration = function(node){
185 | return this.emit(node.property + ':' + node.value, node.position) + this.emit(';');
186 | };
187 |
188 | /**
189 | * Expose compiler.
190 | */
191 |
192 | return Compiler;
193 |
194 | });
--------------------------------------------------------------------------------
/src/js/lib/reworkcss/stringify/inherits.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | if (typeof Object.create === 'function') {
4 | // implementation from standard node.js 'util' module
5 | return function(ctor, superCtor) {
6 | ctor.super_ = superCtor
7 | ctor.prototype = Object.create(superCtor.prototype, {
8 | constructor: {
9 | value: ctor,
10 | enumerable: false,
11 | writable: true,
12 | configurable: true
13 | }
14 | });
15 | };
16 | } else {
17 | // old school shim for old browsers
18 | return function(ctor, superCtor) {
19 | ctor.super_ = superCtor
20 | var TempCtor = function () {}
21 | TempCtor.prototype = superCtor.prototype
22 | ctor.prototype = new TempCtor()
23 | ctor.prototype.constructor = ctor
24 | }
25 | }
26 |
27 | });
28 |
--------------------------------------------------------------------------------
/src/js/lib/reworkcss/stringify/stringify.js:
--------------------------------------------------------------------------------
1 | // adapted from: https://github.com/reworkcss/css
2 |
3 | define(['css.compress', 'css.identity'], function(Compressed, Identity) {
4 |
5 | /**
6 | * Stringfy the given AST `node`.
7 | *
8 | * Options:
9 | *
10 | * - `compress` space-optimized output
11 | * - `sourcemap` return an object with `.code` and `.map`
12 | *
13 | * @param {Object} node
14 | * @param {Object} [options]
15 | * @return {String}
16 | * @api public
17 | */
18 |
19 | return function(node, options){
20 | options = options || {};
21 |
22 | var compiler = options.compress
23 | ? new Compressed(options)
24 | : new Identity(options);
25 |
26 | // source maps
27 | if (options.sourcemap) {
28 | var sourcemaps = require('./source-map-support');
29 | sourcemaps(compiler);
30 |
31 | var code = compiler.compile(node);
32 | compiler.applySourceMaps();
33 |
34 | var map = options.sourcemap === 'generator'
35 | ? compiler.map
36 | : compiler.map.toJSON();
37 |
38 | return { code: code, map: map };
39 | }
40 |
41 | var code = compiler.compile(node);
42 | return code;
43 | };
44 |
45 | });
--------------------------------------------------------------------------------
/src/js/lib/snippet/jquery.snippet.css:
--------------------------------------------------------------------------------
1 | .sh_typical{background:none; padding:0; margin:0; border:0 none;}.sh_typical .sh_sourceCode{background-color:#fff;color:#000;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_keyword{color:#00f;font-weight:bold;font-style:normal;}.sh_typical .sh_sourceCode .sh_type{color:#00f;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_string{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_regexp{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_specialchar{color:#C42DA8;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_comment{color:#666;font-weight:normal;font-style:italic;}.sh_typical .sh_sourceCode .sh_number{color:#a900a9;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_preproc{color:#00b800;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_symbol{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_function{color:#000;font-weight:bold;font-style:normal;}.sh_typical .sh_sourceCode .sh_cbracket{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_url{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_date{color:#00f;font-weight:bold;font-style:normal;}.sh_typical .sh_sourceCode .sh_time{color:#00f;font-weight:bold;font-style:normal;}.sh_typical .sh_sourceCode .sh_file{color:#00f;font-weight:bold;font-style:normal;}.sh_typical .sh_sourceCode .sh_ip{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_name{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_variable{color:#ec7f15;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_oldfile{color:#C42DA8;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_newfile{color:#f00;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_difflines{color:#00f;font-weight:bold;font-style:normal;}.sh_typical .sh_sourceCode .sh_selector{color:#ec7f15;font-weight:normal;font-style:normal;}.sh_typical .sh_sourceCode .sh_property{color:#00f;font-weight:bold;font-style:normal;}.sh_typical .sh_sourceCode .sh_value{color:#f00;font-weight:normal;font-style:normal;}
2 |
3 | .snippet-wrap {position:relative;}
4 | *:first-child+html .snippet-wrap {display:inline-block;}
5 | * html .snippet-wrap {display:inline-block;}
6 | .snippet-reveal{text-decoration:underline;}
7 | .snippet-wrap .snippet-menu, .snippet-wrap .snippet-hide {position:absolute; top:10px; right:15px; font-size:.9em;z-index:1;background-color:transparent;}
8 | .snippet-wrap .snippet-hide {top:auto; bottom:10px;}
9 | *:first-child+html .snippet-wrap .snippet-hide {bottom:25px;}
10 | * html .snippet-wrap .snippet-hide {bottom:25px;}
11 | .snippet-wrap .snippet-menu pre, .snippet-wrap .snippet-hide pre {background-color:transparent; margin:0; padding:0;}
12 | .snippet-wrap .snippet-menu a, .snippet-wrap .snippet-hide a {padding:0 5px; text-decoration:underline;}
13 | .snippet-wrap pre.sh_sourceCode{
14 | line-height:1.8em;overflow:auto;position:relative;white-space:pre-wrap;
15 | }
16 | .snippet-wrap pre.snippet-textonly {padding:2em;}
17 | *:first-child+html .snippet-wrap pre.snippet-formatted {padding:2em 1em;}
18 | * html .snippet-wrap pre.snippet-formatted {padding:2em 1em;}
19 | .snippet-reveal pre.sh_sourceCode {padding:.5em 1em; text-align:right;}
20 | .snippet-wrap .snippet-num li{padding-left:1.5em;}
21 | .snippet-wrap .snippet-no-num{list-style:none; padding:0; margin:0;}
22 | .snippet-wrap .snippet-no-num li {list-style:none; padding-left:0;}
23 | .snippet-wrap .snippet-num {margin:1em 0 1em 1em; padding-left:3em;}
24 | .snippet-wrap .snippet-num li {list-style:decimal-leading-zero outside none;}
25 | .snippet-wrap .snippet-no-num li.box {padding:0 6px; margin-left:-6px;}
26 | .snippet-wrap .snippet-num li.box {border:1px solid; list-style-position:inside; margin-left:-3em; padding-left:6px;}
27 | *:first-child+html .snippet-wrap .snippet-num li.box {margin-left:-2.4em;}
28 | * html .snippet-wrap .snippet-num li.box {margin-left:-2.4em;}
29 | .snippet-wrap li.box-top {border-width:1px 1px 0 !important;}
30 | .snippet-wrap li.box-bot {border-width:0 1px 1px !important;}
31 | .snippet-wrap li.box-mid {border-width:0 1px !important;}
32 | .snippet-wrap .snippet-num li .box-sp {width:18px; display:inline-block;}
33 | *:first-child+html .snippet-wrap .snippet-num li .box-sp {width:27px;}
34 | * html .snippet-wrap .snippet-num li .box-sp {width:27px;}
35 | .snippet-wrap .snippet-no-num li.box {border:1px solid;}
36 | .snippet-wrap .snippet-no-num li .box-sp {display:none;}
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/content.inline.min.css:
--------------------------------------------------------------------------------
1 | .mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333}
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/content.min.css:
--------------------------------------------------------------------------------
1 | body{background-color:#FFF;color:#000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333}
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/fonts/readme.md:
--------------------------------------------------------------------------------
1 | Icons are generated and provided by the http://icomoon.io service.
2 |
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce-small.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce-small.eot
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce-small.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce-small.ttf
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce-small.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce-small.woff
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce.eot
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce.ttf
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/fonts/tinymce.woff
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/img/anchor.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/img/anchor.gif
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/img/loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/img/loader.gif
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/img/object.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/img/object.gif
--------------------------------------------------------------------------------
/src/js/lib/tinymce4/skins/lightgray/img/trans.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwrc/DEPRECATED-CWRC-Writer/e7614d1479b7c881d8522a06798d5598dbddb5b1/src/js/lib/tinymce4/skins/lightgray/img/trans.gif
--------------------------------------------------------------------------------
/src/js/modules/relations.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui'], function($, jqueryUi) {
2 |
3 | /**
4 | * @class Relations
5 | * @param {Object} config
6 | * @param {Writer} config.writer
7 | * @param {String} config.parentId
8 | */
9 | return function(config) {
10 |
11 | var w = config.writer;
12 |
13 | $('#'+config.parentId).append(''+
14 | '
'+
15 | '
'+
16 | 'Add Relation Remove Relation '+
17 | '
'+
18 | '
');
19 | $(document.body).append(''+
20 | ''
23 | );
24 |
25 | $('#relations div.ui-layout-south button:eq(0)').button().click(function() {
26 | w.dialogManager.show('triple');
27 | });
28 | $('#relations div.ui-layout-south button:eq(1)').button().click(function() {
29 | var selected = $('#relations ul li.selected');
30 | if (selected.length == 1) {
31 | var i = selected.data('index');
32 | w.triples.splice(i, 1);
33 | pm.update();
34 | } else {
35 | w.dialogManager.show('message', {
36 | title: 'No Relation Selected',
37 | msg: 'You must first select a relation to remove.',
38 | type: 'error'
39 | });
40 | }
41 | });
42 |
43 | w.event('documentLoaded').subscribe(function() {
44 | pm.update();
45 | });
46 | w.event('schemaLoaded').subscribe(function() {
47 | pm.update();
48 | });
49 |
50 | /**
51 | * @lends Relations.prototype
52 | */
53 | var pm = {
54 | currentlySelectedNode: null
55 | };
56 |
57 | pm.layout = $('#relations').layout({
58 | defaults: {
59 | resizable: false,
60 | slidable: false,
61 | closable: false
62 | },
63 | south: {
64 | size: 'auto',
65 | spacing_open: 0
66 | }
67 | });
68 |
69 | /**
70 | * Update the list of relations.
71 | */
72 | pm.update = function() {
73 | $('#relations ul').empty();
74 |
75 | var relationsString = '';
76 |
77 | for (var i = 0; i < w.triples.length; i++) {
78 | var triple = w.triples[i];
79 | relationsString += ''+triple.subject.text+' '+triple.predicate.text+' '+triple.object.text+' ';
80 | }
81 |
82 | $('#relations ul').html(relationsString);
83 |
84 | $('#relations ul li').each(function(index, el) {
85 | $(this).data('index', index);
86 | }).click(function() {
87 | $(this).addClass('selected').siblings().removeClass('selected');
88 | }).contextMenu('relationsMenu', {
89 | bindings: {
90 | 'removeRelation': function(r) {
91 | var i = $(r).data('index');
92 | w.triples.splice(i, 1);
93 | pm.update();
94 | }
95 | },
96 | shadow: false,
97 | menuStyle: {
98 | backgroundColor: '#FFFFFF',
99 | border: '1px solid #D4D0C8',
100 | boxShadow: '1px 1px 2px #CCCCCC',
101 | padding: '0px',
102 | width: '105px'
103 | },
104 | itemStyle: {
105 | fontFamily: 'Tahoma,Verdana,Arial,Helvetica',
106 | fontSize: '11px',
107 | color: '#000',
108 | lineHeight: '20px',
109 | padding: '0px',
110 | cursor: 'pointer',
111 | textDecoration: 'none',
112 | border: 'none'
113 | },
114 | itemHoverStyle: {
115 | color: '#000',
116 | backgroundColor: '#DBECF3',
117 | border: 'none'
118 | }
119 | });
120 | };
121 |
122 | // add to writer
123 | w.relations = pm;
124 |
125 | return pm;
126 | };
127 |
128 | });
--------------------------------------------------------------------------------
/src/js/modules/selection.js:
--------------------------------------------------------------------------------
1 | define(['jquery','jquery.snippet'], function($, snippet) {
2 |
3 | /**
4 | * @class Selection
5 | * @param {Object} config
6 | * @param {Writer} config.writer
7 | * @param {String} config.parentId
8 | */
9 | return function(config) {
10 |
11 | var w = config.writer;
12 |
13 | var lastUpdate = new Date().getTime();
14 |
15 | $('#'+config.parentId).append('
');
16 | $(document.body).append('
');
17 |
18 | w.event('nodeChanged').subscribe(function() {
19 | updateSelection(w.editor);
20 | });
21 | w.event('tagSelected').subscribe(function(tagId) {
22 | updateSelection(w.editor);
23 | });
24 |
25 | /**
26 | * @lends Selection.prototype
27 | */
28 | var selection = {};
29 |
30 | function updateSelection(ed) {
31 | var timestamp = new Date().getTime();
32 | var timeDiff = timestamp - lastUpdate; // track to avoid double update on nodeChanged/tagSelected combo
33 | if ($('#selection').is(':visible') && timeDiff > 250) {
34 | lastUpdate = new Date().getTime();
35 | var range = ed.selection.getRng(true);
36 | var contents = range.cloneContents();
37 | $('#selectionContents').html(contents);
38 | var xmlString = w.converter.buildXMLString($('#selectionContents'));
39 | var escapedContents = w.utilities.escapeHTMLString(xmlString); //$('#selectionContents')[0].innerHTML
40 | if (escapedContents.length < 100000 && escapedContents != '\uFEFF') {
41 | $('#selection').html(''+escapedContents+' ');
42 | $('#selection > pre').snippet('html', {
43 | style: 'typical',
44 | transparent: true,
45 | showNum: false,
46 | menu: false
47 | });
48 | } else {
49 | $('#selection').html('The selection is too large to display. ');
50 | }
51 | }
52 | }
53 |
54 | // add to writer
55 | w.selection = selection;
56 |
57 | return selection;
58 | };
59 |
60 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/citation.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | '
Citation
'+
10 | '
'+
11 | '
'+
12 | '
';
13 |
14 | var dialog = new DialogForm({
15 | writer: w,
16 | id: id,
17 | width: 385,
18 | height: 250,
19 | type: 'citation',
20 | title: 'Tag Citation',
21 | html: html
22 | });
23 |
24 | dialog.$el.on('beforeShow', function(e, config, dialog) {
25 | var cwrcInfo = dialog.currentData.cwrcInfo;
26 | if (cwrcInfo !== undefined) {
27 | $('#'+id+'_ref').val(cwrcInfo.id);
28 | }
29 | });
30 |
31 | return {
32 | show: function(config) {
33 | dialog.show(config);
34 | }
35 | };
36 | };
37 |
38 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/correction.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | '
Correction
'+
10 | '
'+
11 | '
';
12 |
13 | var dialog = new DialogForm({
14 | writer: w,
15 | id: id,
16 | width: 385,
17 | height: 250,
18 | type: 'correction',
19 | title: 'Tag Correction',
20 | html: html
21 | });
22 |
23 | return {
24 | show: function(config) {
25 | dialog.show(config);
26 | }
27 | };
28 | };
29 |
30 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/keyword.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm', 'jquery.watermark'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | ' '+
10 | '
'+
11 | '
';
12 |
13 | var dialog = new DialogForm({
14 | writer: w,
15 | id: id,
16 | type: 'keyword',
17 | title: 'Tag Keyword',
18 | height: 200,
19 | width: 275,
20 | html: html
21 | });
22 |
23 | return {
24 | show: function(config) {
25 | dialog.show(config);
26 | }
27 | };
28 | };
29 |
30 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/link.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | 'Hypertext link (URL or URI) '+
10 | ' '+
11 | 'Check Link '+
12 | '
'+
13 | '
';
14 |
15 | var dialog = new DialogForm({
16 | writer: w,
17 | id: id,
18 | width: 345,
19 | height: 125,
20 | type: 'link',
21 | title: 'Tag Link',
22 | html: html
23 | });
24 |
25 | $('#'+id+'Dialog button').button().click(function() {
26 | var src = $('#'+id+'_input').val();
27 | if (src != '') {
28 | if (src.match(/^https?:\/\//) == null) {
29 | src = 'http://'+src;
30 | }
31 | try {
32 | window.open(src, 'linkTestWindow');
33 | } catch(e) {
34 | alert(e);
35 | }
36 | }
37 | });
38 |
39 | return {
40 | show: function(config) {
41 | dialog.show(config);
42 | }
43 | };
44 | };
45 |
46 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/note.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'tinymce', 'dialogForm'], function($, jqueryUi, tinymce, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var iframe = null;
7 | var cwrcWriter = null;
8 |
9 | var html = ''+
10 | ''+
11 | '
'+
17 | '
'+
18 | ''+ // set src dynamically
19 | '
'+
20 | '
';
21 |
22 | var dialog = new DialogForm({
23 | writer: w,
24 | id: id,
25 | width: 850,
26 | height: 650,
27 | type: 'note',
28 | title: 'Tag Note',
29 | html: html
30 | });
31 |
32 | $('#'+id+'_type input').click(function() {
33 | var newTag = $(this).val();
34 | var allOtherTags = $(this).siblings('input').map(function(index, el) {
35 | return $(el).val();
36 | }).get();
37 | var tagsSelector = '';
38 | for (var i = 0, len = allOtherTags.length; i < len; i++) {
39 | tagsSelector += '*[_tag="'+allOtherTags[i]+'"]';
40 | if (len > 1 && i !== len-1) {
41 | tagsSelector += ',';
42 | }
43 | }
44 | var parentTag = $(tagsSelector, cwrcWriter.editor.getBody()).first();
45 | cwrcWriter.tagger.changeTagValue(parentTag, newTag);
46 | });
47 |
48 | dialog.$el.on('beforeShow', function(e, config) {
49 | iframe = dialog.$el.find('iframe')[0];
50 | iframe.src = 'note.htm';
51 |
52 | // hack to get the writer
53 | function getCwrcWriter() {
54 | cwrcWriter = iframe.contentWindow.writer;
55 | if (cwrcWriter == null) {
56 | setTimeout(getCwrcWriter, 50);
57 | } else {
58 | cwrcWriter.event('writerInitialized').subscribe(postSetup);
59 | }
60 | }
61 |
62 | function postSetup() {
63 | iframe.contentWindow.tinymce.DOM.counter = tinymce.DOM.counter + 1;
64 |
65 | cwrcWriter.event('documentLoaded').subscribe(function() {
66 | // TODO remove forced XML/no overlap
67 | cwrcWriter.mode = cwrcWriter.XML;
68 | cwrcWriter.allowOverlap = false;
69 |
70 | cwrcWriter.editor.focus();
71 | });
72 |
73 | // in case document is loaded before tree
74 | cwrcWriter.event('structureTreeInitialized').subscribe(function(tree) {
75 | setTimeout(tree.update, 50); // need slight delay to get indents working for some reason
76 | });
77 | cwrcWriter.event('entitiesListInitialized').subscribe(function(el) {
78 | setTimeout(el.update, 50);
79 | });
80 |
81 | var xmlDoc;
82 | if (dialog.mode === DialogForm.ADD) {
83 | xmlDoc = $.parseXML('<'+writer.root+'> '+writer.root+'>');
84 | } else {
85 | var parent = config.entry.getTag();
86 | xmlDoc = $.parseXML(config.entry.getCustomValue('content'));
87 | var annotation = $(parent, xmlDoc).first();
88 | // remove the annotationId attribute
89 | annotation.removeAttr('annotationId');
90 | // insert the appropriate wrapper tags
91 | var xml = $.parseXML('<'+writer.root+'><'+parent+'>'+parent+'>'+writer.root+'>');
92 | xmlDoc = $(xml).find(parent).append(annotation.contents()).end()[0];
93 | }
94 | cwrcWriter.fileManager.loadDocumentFromXml(xmlDoc);
95 | }
96 |
97 | getCwrcWriter();
98 | });
99 |
100 | dialog.$el.on('beforeClose', function() {
101 | try {
102 | cwrcWriter.editor.remove();
103 | cwrcWriter.editor.destroy();
104 | iframe.src = 'about:blank';
105 | } catch (e) {
106 | // editor wasn't fully initialized
107 | }
108 | });
109 |
110 | dialog.$el.on('beforeSave', function() {
111 | tinymce.DOM.counter = iframe.contentWindow.tinymce.DOM.counter + 1;
112 |
113 | var content = cwrcWriter.converter.getDocumentContent();
114 | dialog.currentData.customValues.content = content;
115 | });
116 |
117 | return {
118 | show: function(config) {
119 | dialog.show(config);
120 | }
121 | };
122 | };
123 |
124 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/org.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | '
'+
13 | 'Standard name '+
14 | ' '+
15 | '
'+
16 | '
'+
17 | '
Organization type:
'+
18 | '
'+
19 | ' '+
20 | 'labour '+
21 | 'club or society '+
22 | 'political '+
23 | 'academic '+
24 | 'research '+
25 | 'corporate '+
26 | 'activist '+
27 | 'governmental '+
28 | 'military '+
29 | 'law-enforcement '+
30 | 'professional '+
31 | 'sporting '+
32 | 'medical '+
33 | 'altruistic '+
34 | 'non-profit '+
35 | 'artistic '+
36 | 'dramatic '+
37 | 'ethnic '+
38 | 'literary '+
39 | 'musical '+
40 | 'religious '+
41 | 'publishing '+
42 | 'school '+
43 | ' '+
44 | '
'+
45 | '
'+
46 | '
';
47 |
48 | var dialog = new DialogForm({
49 | writer: w,
50 | id: id,
51 | width: 200,
52 | height: 200,
53 | type: 'org',
54 | title: 'Tag Organization',
55 | html: html
56 | });
57 |
58 | dialog.$el.on('beforeShow', function(e, config, dialog) {
59 | var cwrcInfo = dialog.currentData.cwrcInfo;
60 | if (cwrcInfo !== undefined) {
61 | $('#'+id+'_ref').val(cwrcInfo.id);
62 | }
63 | });
64 |
65 | return {
66 | show: function(config) {
67 | dialog.show(config);
68 | }
69 | };
70 | };
71 |
72 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/person.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | '
'+
13 | 'Standard name '+
14 | ' '+
15 | '
'+
16 | '
'+
17 | '
';
18 |
19 | var dialog = new DialogForm({
20 | writer: w,
21 | id: id,
22 | width: 200,
23 | height: 150,
24 | type: 'person',
25 | title: 'Tag Person',
26 | html: html
27 | });
28 |
29 | dialog.$el.on('beforeShow', function(e, config, dialog) {
30 | var cwrcInfo = dialog.currentData.cwrcInfo;
31 | if (cwrcInfo !== undefined) {
32 | $('#'+id+'_ref').val(cwrcInfo.id);
33 | }
34 | });
35 |
36 | return {
37 | show: function(config) {
38 | dialog.show(config);
39 | }
40 | };
41 | };
42 |
43 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/place.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | ' '+
13 | '
';
14 |
15 | var dialog = new DialogForm({
16 | writer: w,
17 | id: id,
18 | type: 'place',
19 | title: 'Tag Place',
20 | height: 150,
21 | width: 450,
22 | html: html
23 | });
24 |
25 | dialog.$el.on('beforeShow', function(e, config, dialog) {
26 | var cwrcInfo = dialog.currentData.cwrcInfo;
27 | if (cwrcInfo !== undefined) {
28 | $('#'+id+'_ref').val(cwrcInfo.id);
29 | }
30 | });
31 |
32 | return {
33 | show: function(config) {
34 | dialog.show(config);
35 | }
36 | };
37 | };
38 |
39 | });
--------------------------------------------------------------------------------
/src/js/schema/cwrcEntry/dialogs/title.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | 'Standard name '+
10 | ' '+
11 | '
'+
12 | '
'+
13 | '
This title is:
'+
14 | '
'+
15 | '
Analytic article, poem, or other item published as part of a larger item '+
16 | '
'+
17 | '
Monographic book, collection, single volume, or other item published as a distinct item '+
18 | '
'+
19 | '
Journal magazine, newspaper or other periodical publication '+
20 | '
'+
21 | '
Series book, radio, or other series '+
22 | '
'+
23 | '
Unpublished thesis, manuscript, letters or other unpublished material '+
24 | '
'+
25 | '
'+
26 | '
';
27 |
28 | var dialog = new DialogForm({
29 | writer: w,
30 | id: id,
31 | width: 430,
32 | height: 300,
33 | type: 'title',
34 | title: 'Tag Title',
35 | html: html
36 | });
37 |
38 | dialog.$el.on('beforeShow', function(e, config, dialog) {
39 | var cwrcInfo = dialog.currentData.cwrcInfo;
40 | if (cwrcInfo !== undefined) {
41 | $('#'+id+'_ref').val(cwrcInfo.id);
42 | }
43 | });
44 |
45 | return {
46 | show: function(config) {
47 | dialog.show(config);
48 | }
49 | };
50 | };
51 |
52 | });
--------------------------------------------------------------------------------
/src/js/schema/empty_mappings.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'mapper'], function($, Mapper) {
2 |
3 | return {
4 |
5 | // The name of the ID attribute
6 | id: '',
7 | // The name of the header tag
8 | header: '',
9 | // Additional block level elements that should be added to TinyMCE
10 | blockElements: [],
11 |
12 | listeners: {
13 | // Listeners to CWRC-Writer events can go here and will subscribe upon mappings load
14 | // e.g. tagAdded: function() {}
15 | },
16 |
17 | /**
18 | * The entries for each entity. Each entity entry needs the following members:
19 | * parentTag {String|Array}: the XML tag(s) that encapsulates the entity, also used to determine if an XML tag is associated with an entity
20 | * textTag {String}: the tag that contains the text content of the entity
21 | * mapping {Function}: a function which accepts an Entity and returns a string of XML to display in the Writer (see Mapper.getDefaultMapping)
22 | * reverseMapping {Function}: a function which accepts an XML fragment and returns a JSON object (see Mapper.getDefaultReverseMapping) with the following entries:
23 | * attributes: JSON representation of the XML attributes, see Entity.attributes
24 | * customValues: JSON object of additional values, see Entity.customValues
25 | * annotation {Function}: a function which accepts an Entity and a format string (either 'xml' or 'json') and returns an annotation in the specified format (see AnnotationsManager.commonAnnotation)
26 | *
27 | * Optional members:
28 | * isNote {Boolean}: boolean indicating the entity is a "note type" (default is false)
29 | * getNoteContent {Function}: if the entity is a note it requires this member. This is a function which accepts an Entity and a boolean, and which returns a string or XML, depending on the boolean.
30 | * It should return the content of the note (typically, what's inside the parentTag).
31 | * xpathSelector {String}: if the entity can have several different parentTags or if several entities share the same parentTag, this selector can help differentiate
32 | */
33 |
34 | entities: {
35 |
36 | person: {
37 | parentTag: '',
38 | textTag: '',
39 | mapping: function(entity) {
40 | },
41 | reverseMapping: function(xml) {
42 | },
43 | annotation: function(entity, format) {
44 | }
45 | },
46 |
47 | org: {
48 | parentTag: '',
49 | textTag: '',
50 | mapping: function(entity) {
51 | },
52 | reverseMapping: function(xml) {
53 | },
54 | annotation: function(entity, format) {
55 | }
56 | },
57 |
58 | place: {
59 | parentTag: '',
60 | textTag: '',
61 | mapping: function(entity) {
62 | },
63 | reverseMapping: function(xml) {
64 | },
65 | annotation: function(entity, format) {
66 | }
67 | },
68 |
69 | title: {
70 | parentTag: '',
71 | textTag: '',
72 | mapping: function(entity) {
73 | },
74 | reverseMapping: function(xml) {
75 | },
76 | annotation: function(entity, format) {
77 | }
78 | },
79 |
80 | correction: {
81 | parentTag: '',
82 | textTag: '',
83 | mapping: function(entity) {
84 | },
85 | reverseMapping: function(xml) {
86 | },
87 | annotation: function(entity, format) {
88 | }
89 | },
90 |
91 | link: {
92 | parentTag: '',
93 | textTag: '',
94 | mapping: function(entity) {
95 | },
96 | reverseMapping: function(xml) {
97 | },
98 | annotation: function(entity, format) {
99 | }
100 | },
101 |
102 | date: {
103 | parentTag: '',
104 | textTag: '',
105 | mapping: function(entity) {
106 | },
107 | reverseMapping: function(xml) {
108 | },
109 | annotation: function(entity, format) {
110 | }
111 | },
112 |
113 | note: {
114 | parentTag: '',
115 | textTag: '',
116 | mapping: function(entity) {
117 | },
118 | reverseMapping: function(xml) {
119 | },
120 | annotation: function(entity, format) {
121 | }
122 | },
123 |
124 | citation: {
125 | parentTag: '',
126 | textTag: '',
127 | mapping: function(entity) {
128 | },
129 | reverseMapping: function(xml) {
130 | },
131 | annotation: function(entity, format) {
132 | }
133 | },
134 |
135 | keyword: {
136 | parentTag: '',
137 | textTag: '',
138 | mapping: function(entity) {
139 | },
140 | reverseMapping: function(xml) {
141 | },
142 | annotation: function(entity, format) {
143 | }
144 | },
145 |
146 | event: {
147 | parentTag: '',
148 | textTag: '',
149 | mapping: function(entity) {
150 | },
151 | reverseMapping: function(xml) {
152 | },
153 | annotation: function(entity, format) {
154 | }
155 | }
156 |
157 | }
158 |
159 | };
160 |
161 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/citation.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | '
Citation
'+
10 | '
'+
11 | '
';
12 |
13 | var dialog = new DialogForm({
14 | writer: w,
15 | id: id,
16 | width: 385,
17 | height: 250,
18 | type: 'citation',
19 | title: 'Tag Citation',
20 | html: html
21 | });
22 |
23 | return {
24 | show: function(config) {
25 | dialog.show(config);
26 | }
27 | };
28 | };
29 |
30 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/correction.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | '
Correction
'+
10 | '
'+
11 | '
';
12 |
13 | var dialog = new DialogForm({
14 | writer: w,
15 | id: id,
16 | width: 385,
17 | height: 250,
18 | type: 'correction',
19 | title: 'Tag Correction',
20 | html: html
21 | });
22 |
23 | return {
24 | show: function(config) {
25 | dialog.show(config);
26 | }
27 | };
28 | };
29 |
30 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/keyword.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm', 'jquery.watermark'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | ' '+
10 | '
'+
11 | '
';
12 |
13 | var dialog = new DialogForm({
14 | writer: w,
15 | id: id,
16 | type: 'keyword',
17 | title: 'Tag Keyword',
18 | height: 200,
19 | width: 275,
20 | html: html
21 | });
22 |
23 | return {
24 | show: function(config) {
25 | dialog.show(config);
26 | }
27 | };
28 | };
29 |
30 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/link.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | 'Hypertext link (URL or URI) '+
10 | ' '+
11 | 'Check Link '+
12 | '
'+
13 | '
';
14 |
15 | var dialog = new DialogForm({
16 | writer: w,
17 | id: id,
18 | width: 345,
19 | height: 125,
20 | type: 'link',
21 | title: 'Tag Link',
22 | html: html
23 | });
24 |
25 | $('#'+id+'Dialog button').button().click(function() {
26 | var src = $('#'+id+'_input').val();
27 | if (src != '') {
28 | if (src.match(/^https?:\/\//) == null) {
29 | src = 'http://'+src;
30 | }
31 | try {
32 | window.open(src, 'linkTestWindow');
33 | } catch(e) {
34 | alert(e);
35 | }
36 | }
37 | });
38 |
39 | return {
40 | show: function(config) {
41 | dialog.show(config);
42 | }
43 | };
44 | };
45 |
46 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/note.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'tinymce', 'dialogForm'], function($, jqueryUi, tinymce, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var iframe = null;
7 | var cwrcWriter = null;
8 |
9 | var html = ''+
10 | ''+
11 | '
'+
17 | '
'+
18 | ''+ // set src dynamically
19 | '
'+
20 | '
';
21 |
22 | var dialog = new DialogForm({
23 | writer: w,
24 | id: id,
25 | width: 850,
26 | height: 650,
27 | type: 'note',
28 | title: 'Tag Note',
29 | html: html
30 | });
31 |
32 | $('#'+id+'_type input').click(function() {
33 | var newTag = $(this).val();
34 | var allOtherTags = $(this).siblings('input').map(function(index, el) {
35 | return $(el).val();
36 | }).get();
37 | var tagsSelector = '';
38 | for (var i = 0, len = allOtherTags.length; i < len; i++) {
39 | tagsSelector += '*[_tag="'+allOtherTags[i]+'"]';
40 | if (len > 1 && i !== len-1) {
41 | tagsSelector += ',';
42 | }
43 | }
44 | var parentTag = $(tagsSelector, cwrcWriter.editor.getBody()).first();
45 | cwrcWriter.tagger.changeTagValue(parentTag, newTag);
46 | });
47 |
48 | dialog.$el.on('beforeShow', function(e, config) {
49 | iframe = dialog.$el.find('iframe')[0];
50 | iframe.src = 'note.htm';
51 |
52 | // hack to get the writer
53 | function getCwrcWriter() {
54 | cwrcWriter = iframe.contentWindow.writer;
55 | if (cwrcWriter == null) {
56 | setTimeout(getCwrcWriter, 50);
57 | } else {
58 | cwrcWriter.event('writerInitialized').subscribe(postSetup);
59 | }
60 | }
61 |
62 | function postSetup() {
63 | iframe.contentWindow.tinymce.DOM.counter = tinymce.DOM.counter + 1;
64 |
65 | cwrcWriter.event('documentLoaded').subscribe(function() {
66 | // TODO remove forced XML/no overlap
67 | cwrcWriter.mode = cwrcWriter.XML;
68 | cwrcWriter.allowOverlap = false;
69 |
70 | cwrcWriter.editor.focus();
71 | });
72 |
73 | // in case document is loaded before tree
74 | cwrcWriter.event('structureTreeInitialized').subscribe(function(tree) {
75 | setTimeout(tree.update, 50); // need slight delay to get indents working for some reason
76 | });
77 | cwrcWriter.event('entitiesListInitialized').subscribe(function(el) {
78 | setTimeout(el.update, 50);
79 | });
80 |
81 | var xmlDoc;
82 | if (dialog.mode === DialogForm.ADD) {
83 | xmlDoc = $.parseXML('<'+writer.root+'> '+writer.root+'>');
84 | } else {
85 | var parent = config.entry.getTag();
86 | xmlDoc = $.parseXML(config.entry.getCustomValue('content'));
87 | var annotation = $(parent, xmlDoc).first();
88 | // remove the annotationId attribute
89 | annotation.removeAttr('annotationId');
90 | // insert the appropriate wrapper tags
91 | var xml = $.parseXML('<'+writer.root+'><'+parent+'>'+parent+'>'+writer.root+'>');
92 | xmlDoc = $(xml).find(parent).append(annotation.contents()).end()[0];
93 | }
94 | cwrcWriter.fileManager.loadDocumentFromXml(xmlDoc);
95 | }
96 |
97 | getCwrcWriter();
98 | });
99 |
100 | dialog.$el.on('beforeClose', function() {
101 | try {
102 | cwrcWriter.editor.remove();
103 | cwrcWriter.editor.destroy();
104 | iframe.src = 'about:blank';
105 | } catch (e) {
106 | // editor wasn't fully initialized
107 | }
108 | });
109 |
110 | dialog.$el.on('beforeSave', function() {
111 | tinymce.DOM.counter = iframe.contentWindow.tinymce.DOM.counter + 1;
112 |
113 | var content = cwrcWriter.converter.getDocumentContent();
114 | dialog.currentData.customValues.content = content;
115 | });
116 |
117 | return {
118 | show: function(config) {
119 | dialog.show(config);
120 | }
121 | };
122 | };
123 |
124 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/org.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | '
'+
13 | 'Standard name '+
14 | ' '+
15 | '
'+
16 | '
'+
17 | '
';
18 |
19 | var dialog = new DialogForm({
20 | writer: w,
21 | id: id,
22 | width: 200,
23 | height: 150,
24 | type: 'org',
25 | title: 'Tag Organization',
26 | html: html
27 | });
28 |
29 | dialog.$el.on('beforeShow', function(e, config, dialog) {
30 | var cwrcInfo = dialog.currentData.cwrcInfo;
31 | if (cwrcInfo !== undefined) {
32 | $('#'+id+'_ref').val(cwrcInfo.id);
33 | }
34 | });
35 |
36 | return {
37 | show: function(config) {
38 | dialog.show(config);
39 | }
40 | };
41 | };
42 |
43 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/person.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | '
'+
13 | 'Standard name '+
14 | ' '+
15 | '
'+
16 | '
'+
17 | '
';
18 |
19 | var dialog = new DialogForm({
20 | writer: w,
21 | id: id,
22 | width: 200,
23 | height: 150,
24 | type: 'person',
25 | title: 'Tag Person',
26 | html: html
27 | });
28 |
29 | dialog.$el.on('beforeShow', function(e, config, dialog) {
30 | var cwrcInfo = dialog.currentData.cwrcInfo;
31 | if (cwrcInfo !== undefined) {
32 | $('#'+id+'_ref').val(cwrcInfo.id);
33 | }
34 | });
35 |
36 | return {
37 | show: function(config) {
38 | dialog.show(config);
39 | }
40 | };
41 | };
42 |
43 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/place.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | '
'+
21 | '
'+
22 | '
';
23 |
24 | var dialog = new DialogForm({
25 | writer: w,
26 | id: id,
27 | type: 'place',
28 | title: 'Tag Place',
29 | height: 150,
30 | width: 450,
31 | html: html
32 | });
33 |
34 | dialog.$el.on('beforeShow', function(e, config, dialog) {
35 | var cwrcInfo = dialog.currentData.cwrcInfo;
36 | if (cwrcInfo !== undefined) {
37 | $('#'+id+'_ref').val(cwrcInfo.id);
38 | }
39 | });
40 |
41 | return {
42 | show: function(config) {
43 | dialog.show(config);
44 | }
45 | };
46 | };
47 |
48 | });
--------------------------------------------------------------------------------
/src/js/schema/orlando/dialogs/title.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | 'Standard name '+
10 | ' '+
11 | '
'+
12 | '
'+
13 | '
This title is:
'+
14 | '
'+
15 | '
Analytic article, poem, or other item published as part of a larger item '+
16 | '
'+
17 | '
Monographic book, collection, single volume, or other item published as a distinct item '+
18 | '
'+
19 | '
Journal magazine, newspaper or other periodical publication '+
20 | '
'+
21 | '
Series book, radio, or other series '+
22 | '
'+
23 | '
Unpublished thesis, manuscript, letters or other unpublished material '+
24 | '
'+
25 | '
'+
26 | '
';
27 |
28 | var dialog = new DialogForm({
29 | writer: w,
30 | id: id,
31 | width: 430,
32 | height: 300,
33 | type: 'title',
34 | title: 'Tag Title',
35 | html: html
36 | });
37 |
38 | dialog.$el.on('beforeShow', function(e, config, dialog) {
39 | var cwrcInfo = dialog.currentData.cwrcInfo;
40 | if (cwrcInfo !== undefined) {
41 | $('#'+id+'_ref').val(cwrcInfo.id);
42 | }
43 | });
44 |
45 | return {
46 | show: function(config) {
47 | dialog.show(config);
48 | }
49 | };
50 | };
51 |
52 | });
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/citation.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'tinymce', 'dialogForm'], function($, jqueryUi, tinymce, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var iframe = null;
7 | var cwrcWriter = null;
8 |
9 | var html = ''+
10 | ''+
11 | '
'+
12 | '
Selected source:
'+
13 | '
'+
14 | '
Text of citation:
'+
15 | '
'+
16 | '
'+
17 | ''+ // set src dynamically
18 | '
'+
19 | '
'+
20 | '
';
21 |
22 | var dialog = new DialogForm({
23 | writer: w,
24 | id: id,
25 | width: 850,
26 | height: 650,
27 | type: 'citation',
28 | title: 'Tag Citation',
29 | html: html
30 | });
31 |
32 | dialog.$el.on('beforeShow', function(e, config) {
33 | var cwrcInfo = dialog.currentData.cwrcInfo;
34 | if (cwrcInfo !== undefined) {
35 | $('#'+id+'_ref').val(cwrcInfo.id);
36 | }
37 |
38 | iframe = dialog.$el.find('iframe')[0];
39 | iframe.src = 'note.htm';
40 |
41 | // hack to get the writer
42 | function getCwrcWriter() {
43 | cwrcWriter = iframe.contentWindow.writer;
44 | if (cwrcWriter == null) {
45 | setTimeout(getCwrcWriter, 50);
46 | } else {
47 | cwrcWriter.event('writerInitialized').subscribe(postSetup);
48 | }
49 | }
50 |
51 | function postSetup() {
52 | var schemaId = w.schemaManager.schemaId;
53 | var schema = w.schemaManager.schemas[schemaId];
54 | var schemaMappingsId = schema.schemaMappingsId;
55 | if (schemaMappingsId == 'tei') {
56 | iframe.contentWindow.tinymce.DOM.counter = tinymce.DOM.counter + 1;
57 |
58 | cwrcWriter.event('documentLoaded').subscribe(function() {
59 | // TODO remove forced XML/no overlap
60 | cwrcWriter.mode = cwrcWriter.XML;
61 | cwrcWriter.allowOverlap = false;
62 |
63 | cwrcWriter.editor.focus();
64 | });
65 |
66 | // in case document is loaded before tree
67 | cwrcWriter.event('structureTreeInitialized').subscribe(function(tree) {
68 | setTimeout(tree.update, 50); // need slight delay to get indents working for some reason
69 | });
70 | cwrcWriter.event('entitiesListInitialized').subscribe(function(el) {
71 | setTimeout(el.update, 50);
72 | });
73 |
74 | if (dialog.mode === DialogForm.ADD) {
75 | var noteUrl = w.cwrcRootUrl+'xml/citation_tei.xml';
76 | cwrcWriter.fileManager.loadDocumentFromUrl(noteUrl);
77 | } else {
78 | var xmlDoc = $.parseXML(config.entry.getCustomValue('content'));
79 | if (xmlDoc.firstChild.nodeName === 'note') {
80 | // remove the annotationId attribute
81 | xmlDoc.firstChild.removeAttribute('annotationId');
82 | // insert the appropriate wrapper tags
83 | var xml = $.parseXML(' ');
84 | xmlDoc = $(xml).find('body').append(xmlDoc.firstChild).end()[0];
85 | }
86 | cwrcWriter.fileManager.loadDocumentFromXml(xmlDoc);
87 | }
88 | } else {
89 | alert('Current schema not supported yet!');
90 | }
91 | }
92 |
93 | getCwrcWriter();
94 | });
95 |
96 | dialog.$el.on('beforeClose', function() {
97 | try {
98 | cwrcWriter.editor.remove();
99 | cwrcWriter.editor.destroy();
100 | iframe.src = 'about:blank';
101 | } catch (e) {
102 | // editor wasn't fully initialized
103 | }
104 | });
105 |
106 | dialog.$el.on('beforeSave', function() {
107 | tinymce.DOM.counter = iframe.contentWindow.tinymce.DOM.counter + 1;
108 |
109 | var content = cwrcWriter.converter.getDocumentContent();
110 | dialog.currentData.customValues.content = content;
111 | });
112 |
113 | return {
114 | show: function(config) {
115 | dialog.show(config);
116 | }
117 | };
118 | };
119 |
120 | });
121 |
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/correction.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | '
Correction
'+
10 | '
'+
11 | '
';
12 |
13 | var dialog = new DialogForm({
14 | writer: w,
15 | id: id,
16 | width: 385,
17 | height: 250,
18 | type: 'correction',
19 | title: 'Tag Correction',
20 | html: html
21 | });
22 |
23 | dialog.$el.on('beforeShow', function(e, config, dialog) {
24 | var sicText;
25 | if (dialog.mode === DialogForm.ADD) {
26 | sicText = w.editor.currentBookmark.rng.toString();
27 | } else {
28 | sicText = config.entry.getCustomValue('sicText');
29 | }
30 | if (sicText !== undefined && sicText !== '') {
31 | dialog.currentData.customValues.sicText = sicText;
32 | }
33 | });
34 |
35 | dialog.$el.on('beforeSave', function(e, dialog) {
36 | var sicText = dialog.currentData.customValues.sicText;
37 | var corrText = dialog.currentData.customValues.corrText;
38 |
39 | // copy customValues to attributes so they display in entitiesList
40 | // we don't want to store them as just attributes because technically they aren't attributes of this tag
41 | dialog.currentData.attributes.sicText = sicText;
42 | dialog.currentData.attributes.corrText = corrText;
43 |
44 | if (dialog.mode === DialogForm.EDIT) {
45 | // TODO
46 | // if (sicText == undefined) {
47 | // // edit the correction text
48 | // var entityStart = $('[name="'+w.entitiesManager.getCurrentEntity()+'"]', writer.editor.getBody())[0];
49 | // var textNode = w.utilities.getNextTextNode(entityStart);
50 | // textNode.textContent = data.corrText;
51 | // }
52 | } else {
53 | if (sicText === undefined) {
54 | // insert the correction text so we can make an entity out of that
55 | w.editor.execCommand('mceInsertContent', false, corrText);
56 | }
57 | }
58 | });
59 |
60 | return {
61 | show: function(config) {
62 | dialog.show(config);
63 | }
64 | };
65 | };
66 |
67 | });
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/keyword.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm', 'jquery.watermark'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | '
'+
10 | '
';
11 |
12 | var dialog = new DialogForm({
13 | writer: w,
14 | id: id,
15 | type: 'keyword',
16 | title: 'Tag Keyword',
17 | height: 200,
18 | width: 275,
19 | html: html
20 | });
21 |
22 | function addRow(prevRow) {
23 | var newRow;
24 | // TODO add handling for multiple keywords, currently broken when loading a document
25 | var html = ' ';//Add Keyword ';
26 | if (prevRow == null) {
27 | html += '
';
28 | newRow = $('#'+id+'RowsParent').append(html).find('.keywordRow');
29 | } else {
30 | html += 'Remove This Keyword ';
31 | prevRow.after(html);
32 | newRow = prevRow.next();
33 | }
34 | newRow.find('button:first').button({
35 | icons: {primary: 'ui-icon-plusthick'},
36 | text: false
37 | }).click(function() {
38 | addRow($(this).parent());
39 | }).next('button').button({
40 | icons: {primary: 'ui-icon-minusthick'},
41 | text: false
42 | }).click(function() {
43 | removeRow($(this).parent());
44 | });
45 | newRow.find('input').watermark('Keyword');
46 | return newRow;
47 | }
48 |
49 | function removeRow(row) {
50 | row.remove();
51 | }
52 |
53 | dialog.$el.on('beforeSave', function(e, dialog) {
54 | dialog.currentData.customValues.keywords = [];
55 | $('#'+id+'Dialog .keywordRow').each(function(index, el) {
56 | var keyword = $('input', el).val();
57 | dialog.currentData.customValues.keywords.push(keyword);
58 | });
59 | });
60 |
61 | dialog.$el.on('beforeShow', function(e, config) {
62 | var keywordsParent = $('#'+id+'RowsParent');
63 | keywordsParent.find('.keywordRow').remove();
64 | if (dialog.mode === DialogForm.ADD) {
65 | addRow();
66 | } else {
67 | var keywords = config.entry.getCustomValue('keywords');
68 | var prevRow = null;
69 | $.each(keywords, function(index, val) {
70 | var row = addRow(prevRow);
71 | row.find('input').val(val);
72 | prevRow = row;
73 | });
74 | }
75 | });
76 |
77 | return {
78 | show: function(config) {
79 | dialog.show(config);
80 | }
81 | };
82 | };
83 |
84 | });
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/link.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | 'Hypertext link (URL or URI) '+
10 | ' '+
11 | 'Check Link '+
12 | '
'+
13 | '
';
14 |
15 | var dialog = new DialogForm({
16 | writer: w,
17 | id: id,
18 | width: 345,
19 | height: 125,
20 | type: 'link',
21 | title: 'Tag Link',
22 | html: html
23 | });
24 |
25 | $('#'+id+'Dialog button').button().click(function() {
26 | var src = $('#'+id+'_input').val();
27 | if (src != '') {
28 | if (src.match(/^https?:\/\//) == null) {
29 | src = 'http://'+src;
30 | }
31 | try {
32 | window.open(src, 'linkTestWindow');
33 | } catch(e) {
34 | alert(e);
35 | }
36 | }
37 | });
38 |
39 | return {
40 | show: function(config) {
41 | dialog.show(config);
42 | }
43 | };
44 | };
45 |
46 | });
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/note.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'tinymce', 'dialogForm'], function($, jqueryUi, tinymce, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var iframe = null;
7 | var cwrcWriter = null;
8 |
9 | var html = ''+
10 | ''+
11 | '
'+
18 | '
'+
19 | ''+ // set src dynamically
20 | '
'+
21 | '
';
22 |
23 | var dialog = new DialogForm({
24 | writer: w,
25 | id: id,
26 | width: 850,
27 | height: 650,
28 | type: 'note',
29 | title: 'Tag Note',
30 | html: html
31 | });
32 |
33 | dialog.$el.on('beforeShow', function(e, config) {
34 | iframe = dialog.$el.find('iframe')[0];
35 | iframe.src = 'note.htm';
36 |
37 | // hack to get the writer
38 | function getCwrcWriter() {
39 | cwrcWriter = iframe.contentWindow.writer;
40 | if (cwrcWriter == null) {
41 | setTimeout(getCwrcWriter, 50);
42 | } else {
43 | cwrcWriter.event('writerInitialized').subscribe(postSetup);
44 | }
45 | }
46 |
47 | function postSetup() {
48 | iframe.contentWindow.tinymce.DOM.counter = tinymce.DOM.counter + 1;
49 |
50 | cwrcWriter.event('documentLoaded').subscribe(function() {
51 | // TODO remove forced XML/no overlap
52 | cwrcWriter.mode = cwrcWriter.XML;
53 | cwrcWriter.allowOverlap = false;
54 |
55 | cwrcWriter.editor.focus();
56 | });
57 |
58 | // in case document is loaded before tree
59 | cwrcWriter.event('structureTreeInitialized').subscribe(function(tree) {
60 | setTimeout(tree.update, 50); // need slight delay to get indents working for some reason
61 | });
62 | cwrcWriter.event('entitiesListInitialized').subscribe(function(el) {
63 | setTimeout(el.update, 50);
64 | });
65 |
66 | if (dialog.mode === DialogForm.ADD) {
67 | var noteUrl = w.cwrcRootUrl+'xml/note_tei.xml';
68 | cwrcWriter.fileManager.loadDocumentFromUrl(noteUrl);
69 | } else {
70 | var xmlDoc = $.parseXML(config.entry.getCustomValue('content'));
71 | if (xmlDoc.firstChild.nodeName === 'note') {
72 | // remove the annotationId attribute
73 | xmlDoc.firstChild.removeAttribute('annotationId');
74 | // insert the appropriate wrapper tags
75 | var xml = $.parseXML(' ');
76 | xmlDoc = $(xml).find('body').append(xmlDoc.firstChild).end()[0];
77 | }
78 | cwrcWriter.fileManager.loadDocumentFromXml(xmlDoc);
79 | }
80 | }
81 |
82 | getCwrcWriter();
83 | });
84 |
85 | dialog.$el.on('beforeClose', function() {
86 | try {
87 | cwrcWriter.editor.remove();
88 | cwrcWriter.editor.destroy();
89 | iframe.src = 'about:blank';
90 | } catch (e) {
91 | // editor wasn't fully initialized
92 | }
93 | });
94 |
95 | dialog.$el.on('beforeSave', function() {
96 | tinymce.DOM.counter = iframe.contentWindow.tinymce.DOM.counter + 1;
97 |
98 | var content = cwrcWriter.converter.getDocumentContent();
99 | dialog.currentData.customValues.content = content;
100 | });
101 |
102 | return {
103 | show: function(config) {
104 | dialog.show(config);
105 | }
106 | };
107 | };
108 |
109 | });
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/org.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | '
'+
13 | '
Tag as:
'+
14 | '
'+
15 | '
'+
16 | '
'+
23 | '
'+
24 | '
Markup options '+
25 | '
'+
26 | '
'+
27 | '
'+
28 | '
'+
29 | '
';
30 |
31 | var dialog = new DialogForm({
32 | writer: w,
33 | id: id,
34 | width: 400,
35 | height: 450,
36 | type: 'org',
37 | tag: 'orgName',
38 | title: 'Tag Organization',
39 | html: html
40 | });
41 |
42 | dialog.$el.on('beforeShow', function(e, config, dialog) {
43 | var cwrcInfo = dialog.currentData.cwrcInfo;
44 | if (cwrcInfo !== undefined) {
45 | $('#'+id+'_ref').val(cwrcInfo.id);
46 | }
47 | });
48 |
49 | return {
50 | show: function(config) {
51 | dialog.show(config);
52 | }
53 | };
54 | };
55 |
56 | });
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/place.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery',
3 | 'jquery-ui',
4 | 'dialogForm'
5 | ], function($, jqueryUi, DialogForm) {
6 |
7 | return function(id, writer) {
8 | var w = writer;
9 |
10 | var html = ''+
11 | ''+
12 | '
'+
13 | '
Tag as:
'+
14 | '
'+
15 | '
'+
16 | '
'+
23 | '
'+
32 | '
'+
33 | '
';
34 |
35 | var dialog = new DialogForm({
36 | writer: w,
37 | id: id,
38 | type: 'place',
39 | title: 'Tag Place',
40 | height: 350,
41 | width: 400,
42 | html: html
43 | });
44 |
45 | dialog.$el.on('beforeShow', function(e, config, dialog) {
46 | var cwrcInfo = dialog.currentData.cwrcInfo;
47 | if (cwrcInfo !== undefined) {
48 | $('#'+id+'_ref').val(cwrcInfo.id);
49 | }
50 | });
51 |
52 | return {
53 | show: function(config) {
54 | dialog.show(config);
55 | }
56 | };
57 | };
58 |
59 | });
--------------------------------------------------------------------------------
/src/js/schema/tei/dialogs/title.js:
--------------------------------------------------------------------------------
1 | define(['jquery', 'jquery-ui', 'dialogForm'], function($, jqueryUi, DialogForm) {
2 |
3 | return function(id, writer) {
4 | var w = writer;
5 |
6 | var html = ''+
7 | ''+
8 | '
'+
9 | '
Tag as:
'+
10 | '
'+
11 | '
'+
12 | '
'+
13 | '
This title is:
'+
14 | '
'+
15 | '
Analytic article, poem, or other item published as part of a larger item '+
16 | '
'+
17 | '
Monographic book, collection, single volume, or other item published as a distinct item '+
18 | '
'+
19 | '
Journal magazine, newspaper or other periodical publication '+
20 | '
'+
21 | '
Series book, radio, or other series '+
22 | '
'+
23 | '
Unpublished thesis, manuscript, letters or other unpublished material '+
24 | '
'+
25 | '
'+
32 | '
'+
33 | '
Markup options '+
34 | '
'+
35 | '
'+
36 | '
'+
37 | '
'+
38 | '
';
39 |
40 | var dialog = new DialogForm({
41 | writer: w,
42 | id: id,
43 | width: 435,
44 | height: 630,
45 | type: 'title',
46 | tag: 'title',
47 | title: 'Tag Title',
48 | html: html
49 | });
50 |
51 | dialog.$el.on('beforeShow', function(e, config, dialog) {
52 | var cwrcInfo = dialog.currentData.cwrcInfo;
53 | if (cwrcInfo !== undefined) {
54 | $('#'+id+'_ref').val(cwrcInfo.id);
55 | }
56 | });
57 |
58 | return {
59 | show: function(config) {
60 | dialog.show(config);
61 | }
62 | };
63 | };
64 |
65 | });
--------------------------------------------------------------------------------
/src/js/tinymce_plugins/currenttag4.js:
--------------------------------------------------------------------------------
1 | tinymce.PluginManager.add('cwrcpath', function(editor) {
2 | tinymce.ui.CWRCPath = tinymce.ui.ElementPath.extend({
3 | postRender: function() {
4 | var self = this;
5 |
6 | function isHidden(elm) {
7 | if (elm.nodeType === 1) {
8 | if (elm.nodeName == "BR" || !!elm.getAttribute('data-mce-bogus')) {
9 | return true;
10 | }
11 |
12 | if (elm.getAttribute('data-mce-type') === 'bookmark') {
13 | return true;
14 | }
15 | }
16 |
17 | return false;
18 | }
19 |
20 | // if (editor.settings.elementpath !== false) {
21 | self.on('select', function(e) {
22 | // editor.focus();
23 | // editor.selection.select(this.row()[e.index].element);
24 | // editor.nodeChanged();
25 | var el = this.row()[e.index].element;
26 | var id = el.getAttribute('id');
27 | editor.writer.selectStructureTag(id, false);
28 | });
29 |
30 | editor.on('nodeChange', function(e) {
31 | var outParents = [], parents = e.parents, i = parents.length;
32 |
33 | while (i--) {
34 | var n = parents[i];
35 | if (n.nodeType == 1 && !isHidden(n)) {
36 | var tag = n.getAttribute('_tag');
37 | var id = n.getAttribute('id');
38 | if (id === 'entityHighlight') {
39 | var w = editor.writer;
40 | id = w.entitiesManager.getCurrentEntity();
41 | tag = w.entitiesManager.getEntity(id).getTag();
42 | }
43 | if (tag != null) {
44 | outParents.push({name: tag, element: n});
45 | }
46 | }
47 | }
48 |
49 | self.row(outParents);
50 | });
51 | // }
52 |
53 | return self._super();
54 | }
55 | });
56 |
57 |
58 | var path = new tinymce.ui.CWRCPath(editor);
59 | });
--------------------------------------------------------------------------------
/src/js/tinymce_plugins/viewsource.js:
--------------------------------------------------------------------------------
1 | (function(tinymce) {
2 | // make sure snippet is available
3 | var $ = require('jquery');
4 | require(['jquery.snippet']);
5 |
6 | tinymce.PluginManager.add('viewsource', function(editor) {
7 |
8 | function htmlEncode(str) {
9 | return str.replace(/[&<>"']/g, function($0) {
10 | return "&" + {"&":"amp", "<":"lt", ">":"gt", '"':"quot", "'":"#39"}[$0] + ";";
11 | });
12 | }
13 |
14 | $(document.body).append(''+
15 | ''+
16 | '
'
17 | );
18 |
19 | var d = $('#viewSourceDialog');
20 | d.dialog({
21 | title: 'View Source',
22 | modal: true,
23 | resizable: true,
24 | closeOnEscape: true,
25 | height: 480,
26 | width: 640,
27 | autoOpen: false,
28 | buttons: {
29 | 'Ok': function() {
30 | d.dialog('close');
31 | }
32 | }
33 | });
34 |
35 | editor.addCommand('viewSource', function() {
36 | var content = editor.writer.converter.getDocumentContent(false);
37 | var source = ''+htmlEncode(content)+' ';
38 | $('#viewSourceDialog').html(source);
39 | $('#viewSourceDialog > pre').snippet('html', {
40 | style: 'typical',
41 | transparent: true,
42 | showNum: false,
43 | menu: false
44 | });
45 | d.dialog('open');
46 | });
47 |
48 | editor.addButton('viewsource', {
49 | title: 'View Source',
50 | image: editor.writer.cwrcRootUrl+'img/page_white_code.png',
51 | onclick: function() {
52 | editor.execCommand('removeHighlights');
53 | editor.execCommand('viewSource');
54 | }
55 | });
56 | });
57 | })(tinymce);
--------------------------------------------------------------------------------
/src/js/writerConfig.js:
--------------------------------------------------------------------------------
1 | {
2 | "cwrcRootUrl": "",
3 | "cwrcDialogs": {
4 | "cwrcApiUrl": "http://apps.testing.cwrc.ca/islandora/cwrc_entities/v1/",
5 | "repositoryBaseObjectUrl": "http://commons.cwrc.ca/",
6 | "geonameUrl": "http://apps.testing.cwrc.ca/cwrc-mtp/geonames/",
7 | "viafUrl": "http://apps.testing.cwrc.ca/services/viaf/",
8 | "googleGeocodeUrl": "http://maps.googleapis.com/maps/api/geocode/xml",
9 | "schemas": {
10 | "person": "http://cwrc.ca/schemas/entities.rng",
11 | "organization": "http://cwrc.ca/schemas/entities.rng",
12 | "place": "http://cwrc.ca/schemas/entities.rng"
13 | }
14 | },
15 | "schemas": {
16 | "tei": {
17 | "name": "CWRC Basic TEI Schema",
18 | "url": "http://cwrc.ca/schemas/cwrc_tei_lite.rng",
19 | "cssUrl": "css/tei_converted.css",
20 | "schemaMappingsId": "tei"
21 | },
22 | "events": {
23 | "name": "Events Schema",
24 | "url": "http://cwrc.ca/schemas/orlando_event_v2.rng",
25 | "cssUrl": "css/orlando_converted.css",
26 | "schemaMappingsId": "orlando"
27 | },
28 | "biography": {
29 | "name": "Biography Schema",
30 | "url": "http://cwrc.ca/schemas/orlando_biography_v2.rng",
31 | "cssUrl": "css/orlando_converted.css",
32 | "schemaMappingsId": "orlando"
33 | },
34 | "writing": {
35 | "name": "Writing Schema",
36 | "url": "http://cwrc.ca/schemas/orlando_writing_v2.rng",
37 | "cssUrl": "css/orlando_converted.css",
38 | "schemaMappingsId": "orlando"
39 | },
40 | "cwrcEntry": {
41 | "name": "CWRC Entry Schema",
42 | "url": "http://cwrc.ca/schemas/cwrc_entry.rng",
43 | "cssUrl": "css/cwrc_converted.css",
44 | "schemaMappingsId": "cwrcEntry"
45 | }
46 | },
47 | "defaultDocument": "templates/blank_TEI_document"
48 | }
49 |
--------------------------------------------------------------------------------
/src/xml/blank_tei.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 0
8 |
9 |
10 |
11 |
12 |
13 | Blank Document
14 |
15 |
16 |
17 |
18 |
19 | Created from original research by members of CWRC/CSÉC unless otherwise noted.
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
Sample Letter - Bertrand Russell to Patricia Spence - October 21, 1935
28 |
29 |
30 |
31 | Bad writing due to shaky train
In train
32 | Oslo to Bergen
33 |
34 |
35 | 21.10.35
36 |
37 | Dearest -
38 | I have had no letter from you since I left Stockholm , but I had a nice one from John in an envelope you had sent him. I had sent him one addressed to Copenhagen but he hadn't used it.
When I reached Oslo yesterday evening, Brynjulf Bull should have been there to meet me, but wasn't. He is not on the telephone, so I took a taxi to his address, which turned out to be a students' club with no one about on Sundays, so I went to a hotel feeling rather non-plussed. But presently he turned up. He had got the time of my arrival wrong, and
39 | when
40 | he had found he had missed me he phoned to every hotel in Oslo till he hit on the right one. He left me at 10, and then I had to do a Sunday Referee article. Today my journey lasts from 9 till 9 - fortunately one of the most beautiful railway journeys in the world. Tomorrow I lecture at Bergen to the Anglo-Norwegian Society. Next day I go back to Oslo, lecture there Fri. and Sat. and then start for home via Bergen.
41 |
42 |
Bull is a nice young man but incompetent - can't quite stand the communists, but finds the socialists too mild.
I am unhappily wondering what you are feeling about me.
43 |
44 | I love you very much -
45 |
46 |
47 | B
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/src/xml/citation_tei.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/xml/note_tei.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/xml/xsl/all_attributes.xsl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | [ ]
10 |
11 |
12 | ' ',
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/xml/xsl/all_elements.xsl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | [ ]
10 |
11 |
12 | ' ',
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/xml/xsl/doc2internal.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/xml/xsl/normalize.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/tests/config.js:
--------------------------------------------------------------------------------
1 | var require = {
2 | baseUrl: '../src/js',
3 | paths: {
4 | 'jquery': 'lib/jquery/jquery-1.9.1',
5 | 'jquery-ui': 'lib/jquery/jquery-ui-1.10.3.custom',
6 | 'jquery.layout': 'lib/jquery/jquery.layout-latest.min',
7 | 'jquery.tablayout': 'lib/jquery/jquery.layout.resizeTabLayout-1.3',
8 | 'jquery.contextmenu': 'lib/jquery/jquery.contextmenu',
9 | 'jquery.tmpl': 'lib/jquery/jquery.tmpl.min',
10 | 'jquery.watermark': 'lib/jquery/jquery.watermark.min',
11 | 'jquery.hotkeys': 'lib/jstree/jquery.hotkeys',
12 | 'jquery.jstree': 'lib/jstree/jquery.jstree', // can't use jquery.jtree.min.js due to modification
13 | 'jquery.snippet': 'lib/snippet/jquery.snippet.min',
14 |
15 | 'QUnit': 'http://code.jquery.com/qunit/qunit-git',
16 |
17 | 'tinymce': 'lib/tinymce/tiny_mce_src',
18 | 'tinymce-copyevent': 'lib/tinymce/copy_event',
19 |
20 | 'objtree': 'lib/objtree/ObjTree',
21 | 'moment': 'lib/moment/moment.min',
22 |
23 | 'attributeWidget': 'dialogs/attributeWidget',
24 | 'searchWidget': 'dialogs/searchWidget'
25 | },
26 | shim: {
27 | 'jquery-ui': ['jquery'],
28 | 'jquery.layout': ['jquery'],
29 | 'jquery.tablayout': ['jquery.layout'],
30 | 'jquery.contextmenu': ['jquery'],
31 | 'jquery.tmpl': ['jquery'],
32 | 'jquery.watermark': ['jquery'],
33 | 'jquery.hotkeys': ['jquery'],
34 | 'jquery.jstree': ['jquery.hotkeys'],
35 | 'jquery.snippet': ['jquery'],
36 | 'QUnit' : {
37 | exports : 'QUnit',
38 | init : function() {
39 | QUnit.config.reorder = false;
40 | QUnit.config.autostart = false;
41 | }
42 | },
43 | 'tinymce': {
44 | exports: 'tinymce',
45 | init: function() {
46 | this.tinymce.DOM.events.domLoaded = true;
47 | return this.tinymce;
48 | }
49 | },
50 | 'tinymce-copyevent': ['tinymce']
51 | },
52 | // initial dependencies
53 | deps: ['jquery',
54 | 'writer',
55 | 'delegator',
56 | 'QUnit',
57 | 'jquery.layout',
58 | 'jquery.tablayout',
59 | 'jquery.snippet' // need to move to viewsource plugin
60 | ],
61 | callback: function($, Writer, Delegator, QUnit) {
62 | $(function() {
63 | cwrcWriterInit.call(window, Writer, Delegator);
64 | });
65 | }
66 | };
--------------------------------------------------------------------------------
/tests/delegator_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("delegator.js tests", {
4 | setup : function() {
5 | writer.currentDocId = null;
6 | var url = writer.cwrcRootUrl + 'xml/sample_letter.xml';
7 | $.ajax({
8 | url : url,
9 | dataType : 'xml',
10 | success : function(data, status, xhr) {
11 | window.location.hash = '#sample_letter';
12 | var rdf = data.createElement('rdf:RDF');
13 | var root;
14 | if (data.childNodes) {
15 | root = data.childNodes[data.childNodes.length - 1];
16 | } else {
17 | root = data.firstChild;
18 | }
19 | $(root).prepend(rdf);
20 | writer.fileManager.processDocument(data);
21 | },
22 | error : function(xhr, status, error) {
23 | if (console) {
24 | console.log(status);
25 | }
26 | }
27 | });
28 | },
29 | teardown : function() {
30 | writer.editor.setContent('');
31 | }
32 | });
33 |
34 | asyncTest('VIAF entity lookup', function() {
35 | function test() {
36 | writer.delegator.lookupEntity({
37 | lookupService: "viaf",
38 | query: "Miquel",
39 | type: "person"
40 | }, function(results) {
41 | start();
42 | ok(results !== null);
43 | });
44 |
45 | writer.event('documentLoaded').unsubscribe(test);
46 | }
47 | writer.event('documentLoaded').subscribe(test);
48 | });
49 |
50 | asyncTest('Validation', function() {
51 | function test() {
52 | writer.delegator.validate(function(isValid) {
53 | start();
54 | ok(isValid !== null);
55 | });
56 |
57 | writer.event('documentLoaded').unsubscribe(test);
58 | }
59 | writer.event('documentLoaded').subscribe(test);
60 | });
61 |
62 | });
--------------------------------------------------------------------------------
/tests/dialogManager_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("dialogManager.js tests", {
4 | setup : function() {
5 |
6 | },
7 | teardown : function() {
8 |
9 | }
10 | });
11 |
12 | test('Show message dialog', function() {
13 | var msgText = '$$$';
14 | writer.dialogManager.show('message', {
15 | title: 'QUnit test',
16 | msg: msgText
17 | });
18 | var messageContent = $('#messageDialog .message')[0].innerText;
19 | ok(messageContent === msgText);
20 | });
21 |
22 | test('Hide message dialog', function() {
23 | writer.dialogManager.message.hide();
24 | ok($('#messageDialog:visible').length === 0);
25 | });
26 |
27 | });
--------------------------------------------------------------------------------
/tests/entitiesModel_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("entitiesModel.js tests", {
4 | setup : function() {
5 | writer.currentDocId = null;
6 | var url = writer.cwrcRootUrl + 'xml/sample_letter.xml';
7 | $.ajax({
8 | url : url,
9 | dataType : 'xml',
10 | success : function(data, status, xhr) {
11 | window.location.hash = '#sample_letter';
12 | var rdf = data.createElement('rdf:RDF');
13 | var root;
14 | if (data.childNodes) {
15 | root = data.childNodes[data.childNodes.length - 1];
16 | } else {
17 | root = data.firstChild;
18 | }
19 | $(root).prepend(rdf);
20 | writer.fileManager.processDocument(data);
21 | },
22 | error : function(xhr, status, error) {
23 | if (console) {
24 | console.log(status);
25 | }
26 | }
27 | });
28 | },
29 | teardown : function() {
30 | writer.editor.setContent('');
31 | }
32 | });
33 |
34 | asyncTest('Entities type lookups', function() {
35 | function test() {
36 | start();
37 | ok(writer.entitiesModel.isEntity('person') === true, 'isEntity test');
38 | ok(writer.entitiesModel.getTitle('person') === 'Person', 'getTitle test');
39 | writer.event('documentLoaded').unsubscribe(test);
40 | }
41 | writer.event('documentLoaded').subscribe(test);
42 | });
43 |
44 | asyncTest('Mapping tags', function() {
45 | function test() {
46 | start();
47 |
48 | var entity = {
49 | info: {
50 | birthDate: "1909",
51 | deathDate: "2003",
52 | firstName: "Miquel",
53 | lastName: "Batllori",
54 | name: "Miquel Batllori"
55 | },
56 | props: {
57 | type: 'person'
58 | }
59 | };
60 | var tags = writer.entitiesModel.getMappingTags(entity, 'tei');
61 | ok(tags[0].indexOf('') !== -1);
62 | writer.event('documentLoaded').unsubscribe(test);
63 | }
64 | writer.event('documentLoaded').subscribe(test);
65 | });
66 |
67 | });
--------------------------------------------------------------------------------
/tests/eventManager_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("eventManager.js tests", {
4 | setup : function() {
5 |
6 | },
7 | teardown : function() {
8 |
9 | }
10 | });
11 |
12 | test('Create event', function() {
13 | var event = writer.event('testEvent');
14 | ok(event.event === 'testEvent');
15 | });
16 |
17 | test('Pub/Sub test', function() {
18 | function subTest(msg) {
19 | ok(msg === 'pubSubOk');
20 | }
21 | writer.event('testEvent').subscribe(subTest);
22 | writer.event('testEvent').publish('pubSubOk');
23 | });
24 |
25 | });
--------------------------------------------------------------------------------
/tests/fileManager_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("writer.js tests", {
4 | setup : function() {
5 | writer.currentDocId = null;
6 | var url = writer.cwrcRootUrl + 'xml/sample_letter.xml';
7 | $.ajax({
8 | url : url,
9 | dataType : 'xml',
10 | success : function(data, status, xhr) {
11 | window.location.hash = '#sample_letter';
12 | var rdf = data.createElement('rdf:RDF');
13 | var root;
14 | if (data.childNodes) {
15 | root = data.childNodes[data.childNodes.length - 1];
16 | } else {
17 | root = data.firstChild;
18 | }
19 | $(root).prepend(rdf);
20 | writer.fileManager.processDocument(data);
21 | },
22 | error : function(xhr, status, error) {
23 | if (console) {
24 | console.log(status);
25 | }
26 | }
27 | });
28 | },
29 | teardown : function() {
30 | writer.editor.setContent('');
31 | }
32 | });
33 |
34 | asyncTest('load file test1', function() {
35 | function test() {
36 | start();
37 | var content = writer.editor.getContent();
38 | ok(content.indexOf("Bull") !== -1, '"Bull" is present.');
39 | writer.event('documentLoaded').unsubscribe(test);
40 | }
41 | writer.event('documentLoaded').subscribe(test);
42 | });
43 |
44 | asyncTest('load file test2', function() {
45 | function test() {
46 | start();
47 | var content = writer.editor.getContent();
48 | ok(content.indexOf("train") !== -1, '"train" is present.');
49 | writer.event('documentLoaded').unsubscribe(test);
50 | }
51 | writer.event('documentLoaded').subscribe(test);
52 | });
53 |
54 | });
--------------------------------------------------------------------------------
/tests/schemaManager_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("writer.js tests", {
4 | setup : function() {
5 | writer.currentDocId = null;
6 | var url = writer.cwrcRootUrl + 'xml/sample_letter.xml';
7 | $.ajax({
8 | url : url,
9 | dataType : 'xml',
10 | success : function(data, status, xhr) {
11 | window.location.hash = '#sample_letter';
12 | var rdf = data.createElement('rdf:RDF');
13 | var root;
14 | if (data.childNodes) {
15 | root = data.childNodes[data.childNodes.length - 1];
16 | } else {
17 | root = data.firstChild;
18 | }
19 | $(root).prepend(rdf);
20 | writer.fileManager.processDocument(data);
21 | },
22 | error : function(xhr, status, error) {
23 | if (console) {
24 | console.log(status);
25 | }
26 | }
27 | });
28 | },
29 | teardown : function() {
30 | writer.editor.setContent('');
31 | }
32 | });
33 |
34 | asyncTest('load file test1', function() {
35 | function test() {
36 | start();
37 | var content = writer.editor.getContent();
38 | ok(content.indexOf("Bull") !== -1, '"Bull" is present.');
39 | writer.event('documentLoaded').unsubscribe(test);
40 | }
41 | writer.event('documentLoaded').subscribe(test);
42 | });
43 |
44 | asyncTest('load file test2', function() {
45 | function test() {
46 | start();
47 | var content = writer.editor.getContent();
48 | ok(content.indexOf("train") !== -1, '"train" is present.');
49 | writer.event('documentLoaded').unsubscribe(test);
50 | }
51 | writer.event('documentLoaded').subscribe(test);
52 | });
53 |
54 | });
--------------------------------------------------------------------------------
/tests/tagger_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("writer.js tests", {
4 | setup : function() {
5 | writer.currentDocId = null;
6 | var url = writer.cwrcRootUrl + 'xml/sample_letter.xml';
7 | $.ajax({
8 | url : url,
9 | dataType : 'xml',
10 | success : function(data, status, xhr) {
11 | window.location.hash = '#sample_letter';
12 | var rdf = data.createElement('rdf:RDF');
13 | var root;
14 | if (data.childNodes) {
15 | root = data.childNodes[data.childNodes.length - 1];
16 | } else {
17 | root = data.firstChild;
18 | }
19 | $(root).prepend(rdf);
20 | writer.fileManager.processDocument(data);
21 | },
22 | error : function(xhr, status, error) {
23 | if (console) {
24 | console.log(status);
25 | }
26 | }
27 | });
28 | },
29 | teardown : function() {
30 | writer.editor.setContent('');
31 | }
32 | });
33 |
34 | asyncTest('load file test1', function() {
35 | function test() {
36 | start();
37 | var content = writer.editor.getContent();
38 | ok(content.indexOf("Bull") !== -1, '"Bull" is present.');
39 | writer.event('documentLoaded').unsubscribe(test);
40 | }
41 | writer.event('documentLoaded').subscribe(test);
42 | });
43 |
44 | asyncTest('load file test2', function() {
45 | function test() {
46 | start();
47 | var content = writer.editor.getContent();
48 | ok(content.indexOf("train") !== -1, '"train" is present.');
49 | writer.event('documentLoaded').unsubscribe(test);
50 | }
51 | writer.event('documentLoaded').subscribe(test);
52 | });
53 |
54 | });
--------------------------------------------------------------------------------
/tests/test_template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Unit tests template
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
93 |
94 |
95 |
101 |
102 |
105 |
106 |
107 |
108 |
109 |
110 |
113 |
114 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/tests/utilities_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("writer.js tests", {
4 | setup : function() {
5 | writer.currentDocId = null;
6 | var url = writer.cwrcRootUrl + 'xml/sample_letter.xml';
7 | $.ajax({
8 | url : url,
9 | dataType : 'xml',
10 | success : function(data, status, xhr) {
11 | window.location.hash = '#sample_letter';
12 | var rdf = data.createElement('rdf:RDF');
13 | var root;
14 | if (data.childNodes) {
15 | root = data.childNodes[data.childNodes.length - 1];
16 | } else {
17 | root = data.firstChild;
18 | }
19 | $(root).prepend(rdf);
20 | writer.fileManager.processDocument(data);
21 | },
22 | error : function(xhr, status, error) {
23 | if (console) {
24 | console.log(status);
25 | }
26 | }
27 | });
28 | },
29 | teardown : function() {
30 | writer.editor.setContent('');
31 | }
32 | });
33 |
34 | asyncTest('load file test1', function() {
35 | function test() {
36 | start();
37 | var content = writer.editor.getContent();
38 | ok(content.indexOf("Bull") !== -1, '"Bull" is present.');
39 | writer.event('documentLoaded').unsubscribe(test);
40 | }
41 | writer.event('documentLoaded').subscribe(test);
42 | });
43 |
44 | asyncTest('load file test2', function() {
45 | function test() {
46 | start();
47 | var content = writer.editor.getContent();
48 | ok(content.indexOf("train") !== -1, '"train" is present.');
49 | writer.event('documentLoaded').unsubscribe(test);
50 | }
51 | writer.event('documentLoaded').subscribe(test);
52 | });
53 |
54 | });
--------------------------------------------------------------------------------
/tests/writer_tests.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | module("writer.js tests", {
4 | setup : function() {
5 | writer.currentDocId = null;
6 | var url = writer.cwrcRootUrl + 'xml/sample_letter.xml';
7 | $.ajax({
8 | url : url,
9 | dataType : 'xml',
10 | success : function(data, status, xhr) {
11 | window.location.hash = '#sample_letter';
12 | var rdf = data.createElement('rdf:RDF');
13 | var root;
14 | if (data.childNodes) {
15 | root = data.childNodes[data.childNodes.length - 1];
16 | } else {
17 | root = data.firstChild;
18 | }
19 | $(root).prepend(rdf);
20 | writer.fileManager.processDocument(data);
21 | },
22 | error : function(xhr, status, error) {
23 | if (console) {
24 | console.log(status);
25 | }
26 | }
27 | });
28 | },
29 | teardown : function() {
30 | writer.editor.setContent('');
31 | }
32 | });
33 |
34 | asyncTest('load file test1', function() {
35 | function test() {
36 | start();
37 | var content = writer.editor.getContent();
38 | ok(content.indexOf("Bull") !== -1, '"Bull" is present.');
39 | writer.event('documentLoaded').unsubscribe(test);
40 | }
41 | writer.event('documentLoaded').subscribe(test);
42 | });
43 |
44 | asyncTest('load file test2', function() {
45 | function test() {
46 | start();
47 | var content = writer.editor.getContent();
48 | ok(content.indexOf("train") !== -1, '"train" is present.');
49 | writer.event('documentLoaded').unsubscribe(test);
50 | }
51 | writer.event('documentLoaded').subscribe(test);
52 | });
53 |
54 | });
--------------------------------------------------------------------------------