oddb.org 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/Guide.txt +23 -17
- data/{README → INSTALL_from_Source.txt} +64 -75
- data/Manifest.txt +110 -4
- data/README.txt +4 -2
- data/Rakefile +5 -0
- data/doc/favicon.ico +0 -0
- data/doc/index.rbx +15 -0
- data/doc/resources/anthroposophy/favicon.ico +0 -0
- data/doc/resources/anthroposophy/logo.png +0 -0
- data/doc/resources/atupri/logo.gif +0 -0
- data/doc/resources/desitin/logo.jpg +0 -0
- data/doc/resources/downloads/datadesc/analysis.csv.txt +57 -0
- data/doc/resources/downloads/datadesc/doctors.csv.txt +43 -0
- data/doc/resources/downloads/datadesc/doctors.yaml.txt +52 -0
- data/doc/resources/downloads/datadesc/fachinfo.yaml.txt +107 -0
- data/doc/resources/downloads/datadesc/generics.xls.txt +42 -0
- data/doc/resources/downloads/datadesc/index_therapeuticus.txt +38 -0
- data/doc/resources/downloads/datadesc/interactions.yaml.txt +78 -0
- data/doc/resources/downloads/datadesc/migel.csv.txt +84 -0
- data/doc/resources/downloads/datadesc/narcotics.csv.txt +49 -0
- data/doc/resources/downloads/datadesc/narcotics.yaml.txt +40 -0
- data/doc/resources/downloads/datadesc/oddb.csv.txt +98 -0
- data/doc/resources/downloads/datadesc/oddb.yaml.txt +255 -0
- data/doc/resources/downloads/datadesc/oddb2.csv.txt +94 -0
- data/doc/resources/downloads/datadesc/oddbdat.txt +228 -0
- data/doc/resources/downloads/datadesc/patents.xls.txt +29 -0
- data/doc/resources/downloads/datadesc/patinfo.yaml.txt +79 -0
- data/doc/resources/downloads/datadesc/price_history.csv.txt +43 -0
- data/doc/resources/downloads/datadesc/price_history.yaml.txt +55 -0
- data/doc/resources/downloads/datadesc/s31x.txt +40 -0
- data/doc/resources/downloads/datadesc/swissdrug-update.xls.txt +59 -0
- data/doc/resources/downloads/examples/Inderal.Preisvergleich.csv +19 -0
- data/doc/resources/downloads/examples/analysis.csv +35 -0
- data/doc/resources/downloads/examples/compendium_ch.oddb.org.firefox.epub +0 -0
- data/doc/resources/downloads/examples/compendium_ch.oddb.org.htc.prc +0 -0
- data/doc/resources/downloads/examples/compendium_ch.oddb.org.kindle.mobi +0 -0
- data/doc/resources/downloads/examples/compendium_ch.oddb.org.stanza.epub +0 -0
- data/doc/resources/downloads/examples/doctors.csv +13 -0
- data/doc/resources/downloads/examples/doctors.yaml +238 -0
- data/doc/resources/downloads/examples/fachinfo.yaml +1255 -0
- data/doc/resources/downloads/examples/fachinfos_de.pdf +51565 -0
- data/doc/resources/downloads/examples/fachinfos_fr.pdf +52072 -0
- data/doc/resources/downloads/examples/generics.xls +0 -0
- data/doc/resources/downloads/examples/index_therapeuticus.tar.gz +0 -0
- data/doc/resources/downloads/examples/interactions.yaml +161 -0
- data/doc/resources/downloads/examples/migel.csv +36 -0
- data/doc/resources/downloads/examples/narcotics.yaml +92 -0
- data/doc/resources/downloads/examples/oddb.csv +1378 -0
- data/doc/resources/downloads/examples/oddb.yaml +14976 -0
- data/doc/resources/downloads/examples/oddb2.csv +1566 -0
- data/doc/resources/downloads/examples/oddbdat.tar.gz +0 -0
- data/doc/resources/downloads/examples/patents.xls +0 -0
- data/doc/resources/downloads/examples/patinfo.yaml +2505 -0
- data/doc/resources/downloads/examples/price_history.csv +99 -0
- data/doc/resources/downloads/examples/price_history.yaml +431 -0
- data/doc/resources/downloads/examples/swissdrug-update.xls +0 -0
- data/doc/resources/errors/appdown.html +50 -0
- data/doc/resources/errors/logo.png +0 -0
- data/doc/resources/errors/logo_de.gif +0 -0
- data/doc/resources/gcc/banner.gif +0 -0
- data/doc/resources/gcc/logo.png +0 -0
- data/doc/resources/gcc/logo_de.gif +0 -0
- data/doc/resources/gcc/logo_doc.gif +0 -0
- data/doc/resources/gcc/logo_fr.gif +0 -0
- data/doc/resources/gcc/logo_rss.png +0 -0
- data/doc/resources/generika/favicon.ico +0 -0
- data/doc/resources/generika/logo.gif +0 -0
- data/doc/resources/generika/logo_de.gif +0 -0
- data/doc/resources/generika/logo_fr.gif +0 -0
- data/doc/resources/homeopathy/favicon.ico +0 -0
- data/doc/resources/homeopathy/logo.png +0 -0
- data/doc/resources/icon_twitter.gif +0 -0
- data/doc/resources/innova/logo.gif +0 -0
- data/doc/resources/innova/logo_de.gif +0 -0
- data/doc/resources/javascript/admin.js +14 -0
- data/doc/resources/javascript/autofill.js +21 -0
- data/doc/resources/javascript/bit.ly.js +29 -0
- data/doc/resources/javascript/company.js +22 -0
- data/doc/resources/javascript/dojo/Editor.js +219 -0
- data/doc/resources/javascript/dojo/HtmlEditorToolbar.html +163 -0
- data/doc/resources/javascript/dojo/sigma.gif +0 -0
- data/doc/resources/javascript/widget/SymbolPalette.js +162 -0
- data/doc/resources/javascript/widget/Tooltip.js +85 -0
- data/doc/resources/javascript/widget/__package__.js +2 -0
- data/doc/resources/livemarks16.png +0 -0
- data/doc/resources/mail.gif +0 -0
- data/doc/resources/mobile/logo.png +0 -0
- data/doc/resources/paypal_donate.gif +0 -0
- data/doc/resources/phyto-pharma/favicon.ico +0 -0
- data/doc/resources/phyto-pharma/logo.png +0 -0
- data/doc/resources/plugins/Generika.cc.gif +0 -0
- data/doc/resources/plugins/Generika.cc.html +34 -0
- data/doc/resources/plugins/Generika.cc.src +34 -0
- data/doc/resources/plugins/oddb.org.gif +0 -0
- data/doc/resources/plugins/oddb.org.html +34 -0
- data/doc/resources/plugins/oddb.org.src +34 -0
- data/doc/resources/print.css +33 -0
- data/doc/resources/provita/logo_de.gif +0 -0
- data/doc/resources/santesuisse/logo_de.gif +0 -0
- data/doc/resources/schoenenberger/logo_de.gif +0 -0
- data/doc/resources/swissmedic/logo.png +0 -0
- data/doc/resources/swissmedic/logo_de.gif +0 -0
- data/doc/resources/swissmedic/logo_doc.gif +0 -0
- data/doc/resources/swissmedic/logo_fr.gif +0 -0
- data/doc/resources/sympany/logo.gif +0 -0
- data/doc/robots.txt +29 -0
- data/ext/export/src/generics_xls.rb +29 -5
- data/ext/export/src/oddbdat.rb +1 -1
- data/ext/export/test/test_generics_xls.rb +216 -0
- data/ext/export/test/test_oddbdat.rb +880 -0
- data/lib/oddb.org.rb +1 -1
- data/src/model/package.rb +3 -2
- data/src/plugin/analysis.rb +2 -0
- data/src/plugin/bsv_xml.rb +1 -1
- data/src/plugin/hospitals.rb +1 -0
- data/src/plugin/oddbdat_export.rb +12 -2
- data/src/plugin/text_info.rb +16 -29
- data/src/util/exporter.rb +21 -1
- data/src/util/log.rb +3 -0
- data/src/util/oddbapp.rb +1 -1
- data/src/util/oddbconfig.rb +1 -1
- data/src/util/updater.rb +9 -1
- data/test/data/html/interaction/flockhart/prepared_table.asp +820 -0
- data/test/data/html/interaction/flockhart/table.asp +820 -0
- data/test/data/html/text_info/News.html +18 -93
- data/test/suite.rb +78 -4
- data/test/test_model/package.rb +38 -0
- data/test/test_plugin/bsv_xml.rb +4 -2
- data/test/test_plugin/flockhart.rb +1 -1
- data/test/test_plugin/oddbdat_export.rb +79 -658
- data/test/test_plugin/ouwerkerk.rb +2 -2
- data/test/test_plugin/suite.rb +8 -6
- data/test/test_plugin/text_info.rb +40 -52
- data/test/test_plugin/{doctors.rb → zdoctor.rb} +0 -0
- data/test/test_util/exporter.rb +500 -0
- data/test/test_util/suite.rb +8 -6
- data/test/test_util/{log.rb → zlog.rb} +19 -0
- data/test/test_view/{search.rb → asearch.rb} +0 -0
- data/test/test_view/suite.rb +8 -6
- metadata +143 -14
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>www.oddb.org - We are sorry</title>
|
|
4
|
+
<link href="/resources/gcc/oddb.css" rel="stylesheet" type="text/css">
|
|
5
|
+
<meta HTTP-EQUIV=Refresh CONTENT="60; URL=/">
|
|
6
|
+
</head>
|
|
7
|
+
<body class="appdown">
|
|
8
|
+
<img src="logo.png"><br><br>
|
|
9
|
+
<h1>Es tut uns leid</h1>
|
|
10
|
+
<p>Wegen eines Software-Updates ist www.oddb.org in den nächsten Minuten nicht erreichbar.<br>
|
|
11
|
+
Wir bitten Sie um Ihr Verständnis.<br>
|
|
12
|
+
Lesen Sie in der Zwischenzeit die <a href="http://wiki.oddb.org/wiki.php?pagename=ODDB.FragenUndAntworten">FAQ</a><br>
|
|
13
|
+
Lesen Sie auch unsere <a href="http://wiki.oddb.org/wiki.php?pagename=Swissmedic.Datendeklaration">Datendeklaration</a>.
|
|
14
|
+
</p>
|
|
15
|
+
<h1>Nous sommes désolés</h1>
|
|
16
|
+
<p>À cause d'une mise à jour du logiciel il n'est pas possible d'accéder www.oddb.org au cours des prochaines minutes.<br>
|
|
17
|
+
Nous vous demandons votre compréhension.<br>
|
|
18
|
+
Entre-temps lisez notres <a href="http://wiki.oddb.org/wiki.php?pagename=ODDB.QuestionsEtReponses">Questions et Reponses</a><br>
|
|
19
|
+
Lisez aussi notre <a href="http://wiki.oddb.org/wiki.php?pagename=Swissmedic.Datendeklaration">declaration des dates</a>.
|
|
20
|
+
</p>
|
|
21
|
+
<h1>We are sorry</h1>
|
|
22
|
+
<p>The application is currently down due to a software-update.<br>
|
|
23
|
+
Please come back in a few minutes.<br>
|
|
24
|
+
Read our <a href="http://wiki.oddb.org/wiki.php?pagename=ODDB.FrequentlyAskedQuestions">FAQ</a> in the mean time.<br>
|
|
25
|
+
Also read our <a href="http://wiki.oddb.org/wiki.php?pagename=Swissmedic.Datendeklaration">data declaration</a>.
|
|
26
|
+
</p>
|
|
27
|
+
<h1>Support ODDB.org to become even Faster and Better! Donate now via PayPal!</h1>
|
|
28
|
+
<FORM ACCEPT-CHARSET="ISO-8859-1" NAME="stdform" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded" ACTION="https://www.paypal.com/cgi-bin/webscr">
|
|
29
|
+
<TABLE cellspacing="0">
|
|
30
|
+
<TR>
|
|
31
|
+
<TD>
|
|
32
|
+
<INPUT name="submit" class="donate" type="image" src="/resources/paypal_donate.gif" border="0" value="" alt="Make payments with PayPal - it's fast, free and secure!">
|
|
33
|
+
</TD>
|
|
34
|
+
|
|
35
|
+
</TR>
|
|
36
|
+
</TABLE>
|
|
37
|
+
<SPAN>
|
|
38
|
+
<INPUT NAME="cmd" TYPE="hidden" VALUE="_xclick">
|
|
39
|
+
<INPUT NAME="business" TYPE="hidden" VALUE="zdavatz@ywesee.com">
|
|
40
|
+
<INPUT NAME="item_name" TYPE="hidden" VALUE="ODDB.org">
|
|
41
|
+
<INPUT NAME="image_url" TYPE="hidden" VALUE="https://www.generika.cc/images/oddb_paypal.jpg">
|
|
42
|
+
<INPUT NAME="no_note" TYPE="hidden" VALUE="1">
|
|
43
|
+
<INPUT NAME="return" TYPE="hidden" VALUE="http://www.oddb.org/de/gcc/paypal_thanks/">
|
|
44
|
+
<INPUT NAME="cancel_return" TYPE="hidden" VALUE="http://www.oddb.org/de/gcc">
|
|
45
|
+
<INPUT NAME="currency_code" TYPE="hidden" VALUE="EUR">
|
|
46
|
+
<INPUT NAME="tax" TYPE="hidden" VALUE="0">
|
|
47
|
+
</SPAN>
|
|
48
|
+
</FORM>
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function replace_element(id, url) {
|
|
2
|
+
document.body.style.cursor = 'wait';
|
|
3
|
+
dojo.xhrGet({
|
|
4
|
+
url: url,
|
|
5
|
+
load: function(data) {
|
|
6
|
+
var container;
|
|
7
|
+
if(container = document.getElementById(id))
|
|
8
|
+
{
|
|
9
|
+
container.parentNode.innerHTML = data;
|
|
10
|
+
}
|
|
11
|
+
document.body.style.cursor = 'auto';
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function autofill(form, key, url)
|
|
2
|
+
{
|
|
3
|
+
document.body.style.cursor = 'wait';
|
|
4
|
+
form.set_pass_2.disabled = false;
|
|
5
|
+
var val = form[key].value;
|
|
6
|
+
dojo.xhrGet({
|
|
7
|
+
url: url + val,
|
|
8
|
+
load: function(data) {
|
|
9
|
+
var retkey;
|
|
10
|
+
var retval;
|
|
11
|
+
for(retkey in data) {
|
|
12
|
+
if(retval = data[retkey])
|
|
13
|
+
form[retkey].value = retval;
|
|
14
|
+
}
|
|
15
|
+
if(data['email'])
|
|
16
|
+
form.set_pass_2.disabled = true;
|
|
17
|
+
document.body.style.cursor = 'auto';
|
|
18
|
+
},
|
|
19
|
+
handleAs: "json"
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var bitly_callback;
|
|
2
|
+
function bitly_for_twitter(url, tweet)
|
|
3
|
+
{
|
|
4
|
+
document.body.style.cursor = 'wait';
|
|
5
|
+
var bitly = "http://api.bit.ly/shorten?callback=bitly_callback&version=2.0.1&longUrl=";
|
|
6
|
+
bitly += url + "&login=oddb&apiKey=R_0e2f8d420324c59276c450b5253b4e3f";
|
|
7
|
+
bitly_callback = function(data) {
|
|
8
|
+
var result;
|
|
9
|
+
var redirect;
|
|
10
|
+
document.body.style.cursor = 'auto';
|
|
11
|
+
if(data.errorCode == '0') {
|
|
12
|
+
result = data.results[unescape(url)];
|
|
13
|
+
redirect = result.shortUrl;
|
|
14
|
+
document.location.href = tweet + redirect;
|
|
15
|
+
} else {
|
|
16
|
+
alert(data.errorMessage);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
dojo.io.script.get({
|
|
20
|
+
url: bitly,
|
|
21
|
+
checkString: 'bitly_callback',
|
|
22
|
+
error: function(error, ioargs) {
|
|
23
|
+
console.debug(error);
|
|
24
|
+
console.debug(ioargs);
|
|
25
|
+
document.location.href = tweet + url;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function sbsm_encode(value)
|
|
2
|
+
{
|
|
3
|
+
value = encodeURIComponent(value);
|
|
4
|
+
value = encodeURIComponent(value);
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function update_company(url)
|
|
9
|
+
{
|
|
10
|
+
document.body.style.cursor = 'wait';
|
|
11
|
+
dojo.xhrGet({
|
|
12
|
+
url: url,
|
|
13
|
+
load: function(data) {
|
|
14
|
+
var content;
|
|
15
|
+
if(content = document.getElementById('company-content'))
|
|
16
|
+
{
|
|
17
|
+
content.parentNode.innerHTML = data ;
|
|
18
|
+
}
|
|
19
|
+
document.body.style.cursor = 'auto';
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
dojo.debug("extending Editor2Toolbar");
|
|
2
|
+
dojo.require("dojo.widget.Editor2");
|
|
3
|
+
dojo.require("dojo.widget.Editor2Toolbar");
|
|
4
|
+
|
|
5
|
+
dojo.lang.extend(dojo.widget.html.Editor2Toolbar, {
|
|
6
|
+
superscriptButton: null,
|
|
7
|
+
superscriptClick: function() { this.exec("superscript"); },
|
|
8
|
+
subscriptButton: null,
|
|
9
|
+
subscriptClick: function() { this.exec("subscript"); },
|
|
10
|
+
|
|
11
|
+
symbolButton: null,
|
|
12
|
+
symbolDropDown: null,
|
|
13
|
+
symbolClick: function(e){
|
|
14
|
+
var type = 'symbol';
|
|
15
|
+
var h = dojo.render.html;
|
|
16
|
+
this.hideAllDropDowns();
|
|
17
|
+
// FIXME: if we've been "popped out", we need to set the height of the toolbar.
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
var dd = this[type+"DropDown"];
|
|
20
|
+
var pal = this[type+"Palette"];
|
|
21
|
+
dojo.style.toggleShowing(dd);
|
|
22
|
+
if(!pal){
|
|
23
|
+
pal = this[type+"Palette"] = dojo.widget.createWidget("SymbolPalette", {}, dd, "first");
|
|
24
|
+
var fcp = pal.domNode;
|
|
25
|
+
with(dd.style){
|
|
26
|
+
width = dojo.html.getOuterWidth(fcp) + "px";
|
|
27
|
+
height = dojo.html.getOuterHeight(fcp) + "px";
|
|
28
|
+
zIndex = 1002;
|
|
29
|
+
position = "absolute";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var cmd = (dojo.render.html.safari) ? "inserttext" : "inserthtml";
|
|
33
|
+
dojo.event.connect( "after",
|
|
34
|
+
pal, "onSymbolSelect",
|
|
35
|
+
this, "exec",
|
|
36
|
+
function(mi){ mi.args.unshift(cmd); return mi.proceed(); }
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
dojo.event.connect( "after",
|
|
40
|
+
pal, "onSymbolSelect",
|
|
41
|
+
dojo.style, "toggleShowing",
|
|
42
|
+
this, function(mi){ mi.args.unshift(dd); return mi.proceed(); }
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
var cid = this.clickInterceptDiv;
|
|
46
|
+
if(!cid){
|
|
47
|
+
cid = this.clickInterceptDiv = document.createElement("div");
|
|
48
|
+
document.body.appendChild(cid);
|
|
49
|
+
with(cid.style){
|
|
50
|
+
backgroundColor = "transparent";
|
|
51
|
+
top = left = "0px";
|
|
52
|
+
height = width = "100%";
|
|
53
|
+
position = "absolute";
|
|
54
|
+
border = "none";
|
|
55
|
+
display = "none";
|
|
56
|
+
zIndex = 1001;
|
|
57
|
+
}
|
|
58
|
+
dojo.event.connect(cid, "onclick", function(){ cid.style.display = "none"; });
|
|
59
|
+
}
|
|
60
|
+
dojo.event.connect(pal, "onSymbolSelect", function(){ cid.style.display = "none"; });
|
|
61
|
+
|
|
62
|
+
dojo.event.kwConnect({
|
|
63
|
+
srcObj: document.body,
|
|
64
|
+
srcFunc: "onclick",
|
|
65
|
+
targetObj: this,
|
|
66
|
+
targetFunc: "hideAllDropDowns",
|
|
67
|
+
once: true
|
|
68
|
+
});
|
|
69
|
+
document.body.appendChild(dd);
|
|
70
|
+
}
|
|
71
|
+
dojo.style.toggleShowing(this.clickInterceptDiv);
|
|
72
|
+
var pos = dojo.style.abs(this[type+"Button"]);
|
|
73
|
+
dojo.html.placeOnScreenPoint(dd, pos.x, pos.y, 0, false);
|
|
74
|
+
if(pal.bgIframe){
|
|
75
|
+
with(pal.bgIframe.style){
|
|
76
|
+
display = "block";
|
|
77
|
+
left = dd.style.left;
|
|
78
|
+
top = dd.style.top;
|
|
79
|
+
width = dojo.style.getOuterWidth(dd)+"px";
|
|
80
|
+
height = dojo.style.getOuterHeight(dd)+"px";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
hideAllDropDowns: function(){
|
|
86
|
+
this.domNode.style.height = "";
|
|
87
|
+
var node;
|
|
88
|
+
dojo.lang.forEach(dojo.widget.byType("Editor2Toolbar"), function(tb){
|
|
89
|
+
try{
|
|
90
|
+
if(node = tb.forecolorDropDown) dojo.style.hide(node);
|
|
91
|
+
if(node = tb.hilitecolorDropDown) dojo.style.hide(node);
|
|
92
|
+
if(node = tb.symbolDropDown) dojo.style.hide(node);
|
|
93
|
+
if(node = tb.styleDropdownContainer) dojo.style.hide(node);
|
|
94
|
+
if(node = tb.clickInterceptDiv) dojo.style.hide(node);
|
|
95
|
+
}catch(e){}
|
|
96
|
+
if(dojo.render.html.ie){
|
|
97
|
+
try{
|
|
98
|
+
dojo.style.hide(tb.forecolorPalette.bgIframe);
|
|
99
|
+
}catch(e){}
|
|
100
|
+
try{
|
|
101
|
+
dojo.style.hide(tb.hilitecolorPalette.bgIframe);
|
|
102
|
+
}catch(e){}
|
|
103
|
+
try{
|
|
104
|
+
dojo.style.hide(tb.symbolPalette.bgIframe);
|
|
105
|
+
}catch(e){}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
dojo.lang.extend(dojo.widget.html.Editor2, {
|
|
113
|
+
currentSelection: null,
|
|
114
|
+
editorOnLoad: function(){
|
|
115
|
+
var toolbars = dojo.widget.byType("Editor2Toolbar");
|
|
116
|
+
if((!toolbars.length)||(!this.shareToolbar)){
|
|
117
|
+
var tbOpts = {};
|
|
118
|
+
tbOpts.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlEditorToolbarOneline.html");
|
|
119
|
+
this.toolbarWidget = dojo.widget.createWidget("Editor2Toolbar",
|
|
120
|
+
tbOpts, this.domNode, "before");
|
|
121
|
+
dojo.event.connect(this, "destroy", this.toolbarWidget, "destroy");
|
|
122
|
+
this.toolbarWidget.hideUnusableButtons(this);
|
|
123
|
+
|
|
124
|
+
if(this.object){
|
|
125
|
+
this.tbBgIframe = new dojo.html.BackgroundIframe(this.toolbarWidget.domNode);
|
|
126
|
+
this.tbBgIframe.iframe.style.height = "30px";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}else{
|
|
130
|
+
// FIXME: should we try harder to explicitly manage focus in
|
|
131
|
+
// order to prevent too many editors from all querying
|
|
132
|
+
// for button status concurrently?
|
|
133
|
+
// FIXME: selecting in one shared toolbar doesn't clobber
|
|
134
|
+
// selection in the others. This is problematic.
|
|
135
|
+
this.toolbarWidget = toolbars[0];
|
|
136
|
+
this.toolbarWidget.hideUnusableButtons(this);
|
|
137
|
+
}
|
|
138
|
+
var src = document["documentElement"]||window;
|
|
139
|
+
this.scrollInterval = setInterval(dojo.lang.hitch(this, "globalOnScrollHandler"), 100);
|
|
140
|
+
// dojo.event.connect(src, "onscroll", this, "globalOnScrollHandler");
|
|
141
|
+
dojo.event.connect("before", this, "destroyRendering", this, "unhookScroller");
|
|
142
|
+
|
|
143
|
+
// firefox does not let us attach events to an iframe retrieved using
|
|
144
|
+
// getElementById. For Details see
|
|
145
|
+
// http://www.digitalmediaminute.com/article/1706/firefoxjavascript-challenge
|
|
146
|
+
// therefore we cannot defer setting up the handlers to when the iframe is
|
|
147
|
+
// loaded. Safari on the other hand does not like onFocus/onBlur for
|
|
148
|
+
// this.editNode (which is at this point undefined). We need to defer
|
|
149
|
+
// setting up the handlers, otherwise an OS-Level Application-Switch is
|
|
150
|
+
// needed to trigger onBlur/onFocus..
|
|
151
|
+
// also, it appears that onFocus/onBlur is actually non-standard behavior
|
|
152
|
+
// for this.editNode, which is a <body> - only form-elements are supposed
|
|
153
|
+
// to trigger onFocus-Events. In a couple of years, when support improves,
|
|
154
|
+
// we should use onDOMFocusIn and onDOMFocusOut. In the meantime, we work
|
|
155
|
+
// around this with onMouseDown
|
|
156
|
+
if(dojo.render.html.safari) {
|
|
157
|
+
dojo.event.connect("after", this, "onLoad", dojo.lang.hitch(this, function() {
|
|
158
|
+
dojo.event.topic.registerPublisher("Editor2.clobberFocus", this.editNode, "onmousedown");
|
|
159
|
+
dojo.event.topic.subscribe("Editor2.clobberFocus", this, "setBlur");
|
|
160
|
+
dojo.event.connect(this.editNode, "onmousedown", this, "setFocus");
|
|
161
|
+
|
|
162
|
+
// store selection for later
|
|
163
|
+
dojo.event.browser.addListener(this.editNode, "mouseup",
|
|
164
|
+
dojo.lang.hitch(this, function() {
|
|
165
|
+
var sel = this.window.getSelection();
|
|
166
|
+
this.currentSelection = {
|
|
167
|
+
baseNode: sel.baseNode,
|
|
168
|
+
baseOffset: sel.baseOffset,
|
|
169
|
+
extentNode: sel.extentNode,
|
|
170
|
+
extentOffset: sel.extentOffset
|
|
171
|
+
}
|
|
172
|
+
}));
|
|
173
|
+
}));
|
|
174
|
+
} else {
|
|
175
|
+
dojo.event.topic.registerPublisher("Editor2.clobberFocus", this.editNode, "onfocus");
|
|
176
|
+
dojo.event.topic.subscribe("Editor2.clobberFocus", this, "setBlur");
|
|
177
|
+
dojo.event.connect(this.editNode, "onfocus", this, "setFocus");
|
|
178
|
+
}
|
|
179
|
+
var node;
|
|
180
|
+
if(node = this.toolbarWidget.linkButton) {
|
|
181
|
+
dojo.event.connect(node, "onclick",
|
|
182
|
+
dojo.lang.hitch(this, function(){
|
|
183
|
+
var range;
|
|
184
|
+
if(this.document.selection){
|
|
185
|
+
range = this.document.selection.createRange().text;
|
|
186
|
+
}else if(dojo.render.html.mozilla){
|
|
187
|
+
range = this.window.getSelection().toString();
|
|
188
|
+
}
|
|
189
|
+
if(range.length){
|
|
190
|
+
this.toolbarWidget.exec("createlink",
|
|
191
|
+
prompt("Please enter the URL of the link:", "http://"));
|
|
192
|
+
}else{
|
|
193
|
+
alert("Please select text to link");
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
var focusFunc = dojo.lang.hitch(this, function(){
|
|
200
|
+
if(dojo.render.html.ie){
|
|
201
|
+
this.editNode.focus();
|
|
202
|
+
}else{
|
|
203
|
+
this.window.focus();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
dojo.event.connect(this.toolbarWidget, "formatSelectClick", focusFunc);
|
|
208
|
+
dojo.event.connect(this, "execCommand", focusFunc);
|
|
209
|
+
|
|
210
|
+
if(this.htmlEditing){
|
|
211
|
+
var tb = this.toolbarWidget.htmltoggleButton;
|
|
212
|
+
if(tb){
|
|
213
|
+
tb.style.display = "";
|
|
214
|
+
dojo.event.connect(this.toolbarWidget, "htmltoggleClick",
|
|
215
|
+
this, "toggleHtmlEditing");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
});
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<div class="EditorToolbarDomNode EditorToolbarSmallBg"
|
|
2
|
+
unselectable="on" dojoOnMouseDown="preventSelect">
|
|
3
|
+
<table cellpadding="1" cellspacing="0" border="0">
|
|
4
|
+
<!--
|
|
5
|
+
toobar options, in order:
|
|
6
|
+
|
|
7
|
+
* wikiword
|
|
8
|
+
* paste
|
|
9
|
+
* copy
|
|
10
|
+
* undo
|
|
11
|
+
* redo
|
|
12
|
+
* link
|
|
13
|
+
* insert image
|
|
14
|
+
* insert <hr>
|
|
15
|
+
* font-select
|
|
16
|
+
* bold
|
|
17
|
+
* italic
|
|
18
|
+
* underline
|
|
19
|
+
* strikethrough
|
|
20
|
+
* numlist
|
|
21
|
+
* dotlist
|
|
22
|
+
* indent
|
|
23
|
+
* outdent
|
|
24
|
+
* text color
|
|
25
|
+
* bg color
|
|
26
|
+
|
|
27
|
+
-->
|
|
28
|
+
<tbody>
|
|
29
|
+
<tr valign="top" align="left" dojoAttachPoint="oneLineTr">
|
|
30
|
+
<td>
|
|
31
|
+
<!-- htmltoggle -->
|
|
32
|
+
<span class="iconContainer" dojoAttachPoint="htmltoggleButton"
|
|
33
|
+
dojoOnClick="htmltoggleClick; buttonClick;" style="display: none;">
|
|
34
|
+
<span title="Toggle Rich Text and HTML Markup Editing Modes" class="icon"
|
|
35
|
+
style="background-image: none; width: 30px;"
|
|
36
|
+
unselectable="on"><h></span>
|
|
37
|
+
</span>
|
|
38
|
+
</td>
|
|
39
|
+
<td>
|
|
40
|
+
<!-- paste -->
|
|
41
|
+
<span class="iconContainer" dojoAttachPoint="copyButton"
|
|
42
|
+
unselectable="on" dojoOnClick="copyClick; buttonClick;">
|
|
43
|
+
<span title="Copy (Ctrl-C)" class="icon copy" unselectable="on"> </span>
|
|
44
|
+
</span>
|
|
45
|
+
</td>
|
|
46
|
+
<td>
|
|
47
|
+
<!-- copy -->
|
|
48
|
+
<span class="iconContainer" dojoAttachPoint="pasteButton"
|
|
49
|
+
dojoOnClick="pasteClick; buttonClick;" unselectable="on">
|
|
50
|
+
<span title="Paste (Ctrl-V)" class="icon paste" unselectable="on"> </span>
|
|
51
|
+
</span>
|
|
52
|
+
</td>
|
|
53
|
+
<td>
|
|
54
|
+
<!-- undo -->
|
|
55
|
+
<span class="iconContainer" dojoAttachPoint="undoButton"
|
|
56
|
+
dojoOnClick="undoClick; buttonClick;" unselectable="on">
|
|
57
|
+
<!-- FIXME: should we have the text "undo" here? -->
|
|
58
|
+
<span title="Undo (Ctrl-Z)" class="icon undo" unselectable="on"> </span>
|
|
59
|
+
</span>
|
|
60
|
+
</td>
|
|
61
|
+
<td>
|
|
62
|
+
<!-- redo -->
|
|
63
|
+
<span class="iconContainer" dojoAttachPoint="redoButton"
|
|
64
|
+
dojoOnClick="redoClick; buttonClick;" unselectable="on">
|
|
65
|
+
<span title="Redo (Ctrl-R)" class="icon redo" unselectable="on"> </span>
|
|
66
|
+
</span>
|
|
67
|
+
</td>
|
|
68
|
+
<td isSpacer="true">
|
|
69
|
+
<!-- spacer -->
|
|
70
|
+
<span class="iconContainer">
|
|
71
|
+
<span class="icon sep" unselectable="on"
|
|
72
|
+
style="width: 5px; min-width: 5px;"></span>
|
|
73
|
+
</span>
|
|
74
|
+
</td>
|
|
75
|
+
<!--
|
|
76
|
+
<td>
|
|
77
|
+
-->
|
|
78
|
+
<!-- link -->
|
|
79
|
+
<!--
|
|
80
|
+
<span class="iconContainer" dojoAttachPoint="linkButton"
|
|
81
|
+
unselectable="on" dojoOnClick="linkClick; buttonClick;">
|
|
82
|
+
<span title="Create Link" class="icon createlink" unselectable="on"> </span>
|
|
83
|
+
</span>
|
|
84
|
+
</td>
|
|
85
|
+
<td>
|
|
86
|
+
-->
|
|
87
|
+
<!-- insertimage -->
|
|
88
|
+
<!--
|
|
89
|
+
<span class="iconContainer"
|
|
90
|
+
style="display: none;"
|
|
91
|
+
dojoAttachPoint="insertimageButton"
|
|
92
|
+
unselectable="on" dojoOnClick="insertimageClick; buttonClick;">
|
|
93
|
+
<span title="Insert Image" class="icon insertimage" unselectable="on"> </span>
|
|
94
|
+
</span>
|
|
95
|
+
</td>
|
|
96
|
+
-->
|
|
97
|
+
<!--
|
|
98
|
+
<td>
|
|
99
|
+
-->
|
|
100
|
+
<!-- bold -->
|
|
101
|
+
<!--
|
|
102
|
+
<span class="iconContainer" dojoAttachPoint="boldButton"
|
|
103
|
+
unselectable="on" dojoOnClick="boldClick; buttonClick;">
|
|
104
|
+
<span title="Toggle Bold (Ctrl-B)" class="icon bold" unselectable="on"> </span>
|
|
105
|
+
</span>
|
|
106
|
+
</td>
|
|
107
|
+
-->
|
|
108
|
+
<td>
|
|
109
|
+
<!-- italic -->
|
|
110
|
+
<span class="iconContainer" dojoAttachPoint="italicButton"
|
|
111
|
+
dojoOnClick="italicClick; buttonClick;">
|
|
112
|
+
<span title="Toggle Italic (Ctrl-I)" class="icon italic" unselectable="on"> </span>
|
|
113
|
+
</span>
|
|
114
|
+
</td>
|
|
115
|
+
<td>
|
|
116
|
+
<!-- subscript -->
|
|
117
|
+
<span class="iconContainer" dojoAttachPoint="subscriptButton"
|
|
118
|
+
dojoOnClick="subscriptClick; buttonClick;">
|
|
119
|
+
<span title="Toggle subscript"
|
|
120
|
+
class="icon subscript" unselectable="on"> </span>
|
|
121
|
+
</span>
|
|
122
|
+
</td>
|
|
123
|
+
<td>
|
|
124
|
+
<!-- superscript -->
|
|
125
|
+
<span class="iconContainer" dojoAttachPoint="superscriptButton"
|
|
126
|
+
dojoOnClick="superscriptClick; buttonClick;">
|
|
127
|
+
<span title="Toggle Superscript"
|
|
128
|
+
class="icon superscript" unselectable="on"> </span>
|
|
129
|
+
</span>
|
|
130
|
+
</td>
|
|
131
|
+
<td isSpacer="true">
|
|
132
|
+
<!-- spacer -->
|
|
133
|
+
<span class="iconContainer">
|
|
134
|
+
<span class="icon sep" unselectable="on"
|
|
135
|
+
style="width: 5px; min-width: 5px;"></span>
|
|
136
|
+
</span>
|
|
137
|
+
</td>
|
|
138
|
+
<td>
|
|
139
|
+
<!-- symbols -->
|
|
140
|
+
<span class="iconContainer" dojoAttachPoint="symbolButton"
|
|
141
|
+
unselectable="on" dojoOnClick="symbolClick; buttonClick;">
|
|
142
|
+
<span title="Insert a Symbol" class="icon insertsymbol"
|
|
143
|
+
unselectable="on"> </span>
|
|
144
|
+
</span>
|
|
145
|
+
<div class="StyleDropdownContainer"
|
|
146
|
+
style="display: none; margin-top: 22px;"
|
|
147
|
+
dojoAttachPoint="symbolDropDown">
|
|
148
|
+
</div>
|
|
149
|
+
</td>
|
|
150
|
+
<td>
|
|
151
|
+
<!-- font select -->
|
|
152
|
+
<select dojoOnChange="formatSelectClick; buttonClick;"
|
|
153
|
+
dojoAttachPoint="formatSelectBox" unselectable="on">
|
|
154
|
+
<option value="">-- format --</option>
|
|
155
|
+
<option value="p">Normal</option>
|
|
156
|
+
<option value="pre">ASCII-Table</option>
|
|
157
|
+
</select>
|
|
158
|
+
</td>
|
|
159
|
+
<td width="*"> </td>
|
|
160
|
+
</tr>
|
|
161
|
+
</tbody>
|
|
162
|
+
</table>
|
|
163
|
+
</div>
|