ai4r 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. data/README.rdoc +48 -0
  2. data/examples/decision_trees/data_set.csv +121 -0
  3. data/examples/decision_trees/id3_example.rb +31 -0
  4. data/examples/decision_trees/results.txt +29 -0
  5. data/examples/genetic_algorithm/genetic_algorithm_example.rb +39 -0
  6. data/examples/genetic_algorithm/travel_cost.csv +16 -0
  7. data/examples/neural_network/backpropagation_example.rb +65 -0
  8. data/examples/neural_network/patterns_with_base_noise.rb +68 -0
  9. data/examples/neural_network/patterns_with_noise.rb +66 -0
  10. data/examples/neural_network/training_patterns.rb +68 -0
  11. data/lib/decision_tree/id3.rb +354 -0
  12. data/lib/genetic_algorithm/genetic_algorithm.rb +268 -0
  13. data/lib/neural_network/backpropagation.rb +259 -0
  14. data/site/build/site/en/broken-links.xml +2 -0
  15. data/site/build/site/en/downloads.html +187 -0
  16. data/site/build/site/en/downloads.pdf +151 -0
  17. data/site/build/site/en/geneticAlgorithms.html +564 -0
  18. data/site/build/site/en/geneticAlgorithms.pdf +911 -0
  19. data/site/build/site/en/images/ai4r-logo.png +0 -0
  20. data/site/build/site/en/images/built-with-forrest-button.png +0 -0
  21. data/site/build/site/en/images/c.png +0 -0
  22. data/site/build/site/en/images/c_wbn.png +0 -0
  23. data/site/build/site/en/images/c_wn.png +0 -0
  24. data/site/build/site/en/images/ero.gif +0 -0
  25. data/site/build/site/en/images/europe2.png +0 -0
  26. data/site/build/site/en/images/europe3.png +0 -0
  27. data/site/build/site/en/images/fitness.png +0 -0
  28. data/site/build/site/en/images/instruction_arrow.png +0 -0
  29. data/site/build/site/en/images/my_email.png +0 -0
  30. data/site/build/site/en/images/rubyforge.png +0 -0
  31. data/site/build/site/en/images/s.png +0 -0
  32. data/site/build/site/en/images/s_wbn.png +0 -0
  33. data/site/build/site/en/images/s_wn.png +0 -0
  34. data/site/build/site/en/images/sigmoid.png +0 -0
  35. data/site/build/site/en/images/t.png +0 -0
  36. data/site/build/site/en/images/t_wbn.png +0 -0
  37. data/site/build/site/en/images/t_wn.png +0 -0
  38. data/site/build/site/en/index.html +258 -0
  39. data/site/build/site/en/index.pdf +306 -0
  40. data/site/build/site/en/linkmap.html +231 -0
  41. data/site/build/site/en/linkmap.pdf +94 -0
  42. data/site/build/site/en/locationmap.xml +72 -0
  43. data/site/build/site/en/machineLearning.html +325 -0
  44. data/site/build/site/en/machineLearning.pdf +337 -0
  45. data/site/build/site/en/neuralNetworks.html +446 -0
  46. data/site/build/site/en/neuralNetworks.pdf +604 -0
  47. data/site/build/site/en/skin/CommonMessages_de.xml +23 -0
  48. data/site/build/site/en/skin/CommonMessages_en_US.xml +23 -0
  49. data/site/build/site/en/skin/CommonMessages_es.xml +23 -0
  50. data/site/build/site/en/skin/CommonMessages_fr.xml +23 -0
  51. data/site/build/site/en/skin/basic.css +166 -0
  52. data/site/build/site/en/skin/breadcrumbs-optimized.js +90 -0
  53. data/site/build/site/en/skin/breadcrumbs.js +237 -0
  54. data/site/build/site/en/skin/fontsize.js +166 -0
  55. data/site/build/site/en/skin/getBlank.js +40 -0
  56. data/site/build/site/en/skin/getMenu.js +45 -0
  57. data/site/build/site/en/skin/images/README.txt +1 -0
  58. data/site/build/site/en/skin/images/add.jpg +0 -0
  59. data/site/build/site/en/skin/images/built-with-forrest-button.png +0 -0
  60. data/site/build/site/en/skin/images/chapter.gif +0 -0
  61. data/site/build/site/en/skin/images/chapter_open.gif +0 -0
  62. data/site/build/site/en/skin/images/current.gif +0 -0
  63. data/site/build/site/en/skin/images/error.png +0 -0
  64. data/site/build/site/en/skin/images/external-link.gif +0 -0
  65. data/site/build/site/en/skin/images/fix.jpg +0 -0
  66. data/site/build/site/en/skin/images/forrest-credit-logo.png +0 -0
  67. data/site/build/site/en/skin/images/hack.jpg +0 -0
  68. data/site/build/site/en/skin/images/header_white_line.gif +0 -0
  69. data/site/build/site/en/skin/images/info.png +0 -0
  70. data/site/build/site/en/skin/images/instruction_arrow.png +0 -0
  71. data/site/build/site/en/skin/images/label.gif +0 -0
  72. data/site/build/site/en/skin/images/page.gif +0 -0
  73. data/site/build/site/en/skin/images/pdfdoc.gif +0 -0
  74. data/site/build/site/en/skin/images/poddoc.png +0 -0
  75. data/site/build/site/en/skin/images/printer.gif +0 -0
  76. data/site/build/site/en/skin/images/rc-b-l-15-1body-2menu-3menu.png +0 -0
  77. data/site/build/site/en/skin/images/rc-b-r-15-1body-2menu-3menu.png +0 -0
  78. data/site/build/site/en/skin/images/rc-b-r-5-1header-2tab-selected-3tab-selected.png +0 -0
  79. data/site/build/site/en/skin/images/rc-t-l-5-1header-2searchbox-3searchbox.png +0 -0
  80. data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-selected-3tab-selected.png +0 -0
  81. data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-unselected-3tab-unselected.png +0 -0
  82. data/site/build/site/en/skin/images/rc-t-r-15-1body-2menu-3menu.png +0 -0
  83. data/site/build/site/en/skin/images/rc-t-r-5-1header-2searchbox-3searchbox.png +0 -0
  84. data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-selected-3tab-selected.png +0 -0
  85. data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-unselected-3tab-unselected.png +0 -0
  86. data/site/build/site/en/skin/images/remove.jpg +0 -0
  87. data/site/build/site/en/skin/images/rss.png +0 -0
  88. data/site/build/site/en/skin/images/spacer.gif +0 -0
  89. data/site/build/site/en/skin/images/success.png +0 -0
  90. data/site/build/site/en/skin/images/txtdoc.png +0 -0
  91. data/site/build/site/en/skin/images/update.jpg +0 -0
  92. data/site/build/site/en/skin/images/valid-html401.png +0 -0
  93. data/site/build/site/en/skin/images/vcss.png +0 -0
  94. data/site/build/site/en/skin/images/warning.png +0 -0
  95. data/site/build/site/en/skin/images/xmldoc.gif +0 -0
  96. data/site/build/site/en/skin/menu.js +48 -0
  97. data/site/build/site/en/skin/note.txt +50 -0
  98. data/site/build/site/en/skin/print.css +54 -0
  99. data/site/build/site/en/skin/profile.css +163 -0
  100. data/site/build/site/en/skin/prototype.js +1257 -0
  101. data/site/build/site/en/skin/screen.css +587 -0
  102. data/site/build/site/en/svn.html +223 -0
  103. data/site/build/site/en/svn.pdf +239 -0
  104. data/site/build/site/en/wholesite.pdf +1686 -0
  105. data/site/build/tmp/brokenlinks.xml +2 -0
  106. data/site/build/tmp/build-info.xml +5 -0
  107. data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.data +0 -0
  108. data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.index +0 -0
  109. data/site/build/tmp/input.xmap +32 -0
  110. data/site/build/tmp/internal.xmap +32 -0
  111. data/site/build/tmp/locationmap.xml +29 -0
  112. data/site/build/tmp/output.xmap +38 -0
  113. data/site/build/tmp/pluginlist2fetchbuild.xml +144 -0
  114. data/site/build/tmp/plugins-1.xml +212 -0
  115. data/site/build/tmp/plugins-2.xml +347 -0
  116. data/site/build/tmp/projfilters.properties +41 -0
  117. data/site/build/tmp/resources.xmap +32 -0
  118. data/site/build/webapp/WEB-INF/logs/access.log +0 -0
  119. data/site/build/webapp/WEB-INF/logs/core.log +788 -0
  120. data/site/build/webapp/WEB-INF/logs/debug.log +0 -0
  121. data/site/build/webapp/WEB-INF/logs/error.log +248 -0
  122. data/site/build/webapp/WEB-INF/logs/flow.log +0 -0
  123. data/site/build/webapp/WEB-INF/logs/idgen.log +0 -0
  124. data/site/build/webapp/WEB-INF/logs/linkrewriter.log +0 -0
  125. data/site/build/webapp/WEB-INF/logs/locationmap.log +0 -0
  126. data/site/build/webapp/WEB-INF/logs/sitemap.log +0 -0
  127. data/site/build/webapp/WEB-INF/logs/xmlform.log +0 -0
  128. data/site/forrest.properties +152 -0
  129. data/site/forrest.properties.dispatcher.properties +25 -0
  130. data/site/forrest.properties.xml +29 -0
  131. data/site/src/documentation/README.txt +7 -0
  132. data/site/src/documentation/classes/CatalogManager.properties +62 -0
  133. data/site/src/documentation/content/locationmap.xml +72 -0
  134. data/site/src/documentation/content/xdocs/downloads.html +9 -0
  135. data/site/src/documentation/content/xdocs/geneticAlgorithms.xml +280 -0
  136. data/site/src/documentation/content/xdocs/index.xml +73 -0
  137. data/site/src/documentation/content/xdocs/machineLearning.xml +129 -0
  138. data/site/src/documentation/content/xdocs/neuralNetworks.xml +218 -0
  139. data/site/src/documentation/content/xdocs/site.xml +51 -0
  140. data/site/src/documentation/content/xdocs/svn.xml +31 -0
  141. data/site/src/documentation/content/xdocs/tabs.xml +35 -0
  142. data/site/src/documentation/resources/images/ai4r-logo.png +0 -0
  143. data/site/src/documentation/resources/images/c.png +0 -0
  144. data/site/src/documentation/resources/images/c_wbn.png +0 -0
  145. data/site/src/documentation/resources/images/c_wn.png +0 -0
  146. data/site/src/documentation/resources/images/ellipse-2.svg +30 -0
  147. data/site/src/documentation/resources/images/ero.gif +0 -0
  148. data/site/src/documentation/resources/images/europe2.png +0 -0
  149. data/site/src/documentation/resources/images/europe3.png +0 -0
  150. data/site/src/documentation/resources/images/fitness.png +0 -0
  151. data/site/src/documentation/resources/images/icon-a.png +0 -0
  152. data/site/src/documentation/resources/images/icon-b.png +0 -0
  153. data/site/src/documentation/resources/images/icon.png +0 -0
  154. data/site/src/documentation/resources/images/my_email.png +0 -0
  155. data/site/src/documentation/resources/images/project-logo.png +0 -0
  156. data/site/src/documentation/resources/images/rubyforge.png +0 -0
  157. data/site/src/documentation/resources/images/s.png +0 -0
  158. data/site/src/documentation/resources/images/s_wbn.png +0 -0
  159. data/site/src/documentation/resources/images/s_wn.png +0 -0
  160. data/site/src/documentation/resources/images/sigmoid.png +0 -0
  161. data/site/src/documentation/resources/images/sub-dir/icon-c.png +0 -0
  162. data/site/src/documentation/resources/images/t.png +0 -0
  163. data/site/src/documentation/resources/images/t_wbn.png +0 -0
  164. data/site/src/documentation/resources/images/t_wn.png +0 -0
  165. data/site/src/documentation/resources/schema/catalog.xcat +29 -0
  166. data/site/src/documentation/resources/schema/hello-v10.dtd +51 -0
  167. data/site/src/documentation/resources/schema/symbols-project-v10.ent +26 -0
  168. data/site/src/documentation/resources/stylesheets/hello2document.xsl +33 -0
  169. data/site/src/documentation/sitemap.xmap +66 -0
  170. data/site/src/documentation/skinconf.xml +418 -0
  171. data/site/src/documentation/translations/langcode.xml +29 -0
  172. data/site/src/documentation/translations/languages_de.xml +24 -0
  173. data/site/src/documentation/translations/languages_en.xml +24 -0
  174. data/site/src/documentation/translations/languages_es.xml +22 -0
  175. data/site/src/documentation/translations/languages_fr.xml +24 -0
  176. data/site/src/documentation/translations/languages_nl.xml +24 -0
  177. data/site/src/documentation/translations/menu.xml +33 -0
  178. data/site/src/documentation/translations/menu_af.xml +33 -0
  179. data/site/src/documentation/translations/menu_de.xml +33 -0
  180. data/site/src/documentation/translations/menu_es.xml +33 -0
  181. data/site/src/documentation/translations/menu_fr.xml +33 -0
  182. data/site/src/documentation/translations/menu_it.xml +33 -0
  183. data/site/src/documentation/translations/menu_nl.xml +33 -0
  184. data/site/src/documentation/translations/menu_no.xml +33 -0
  185. data/site/src/documentation/translations/menu_ru.xml +33 -0
  186. data/site/src/documentation/translations/menu_sk.xml +33 -0
  187. data/site/src/documentation/translations/tabs.xml +22 -0
  188. data/site/src/documentation/translations/tabs_de.xml +22 -0
  189. data/site/src/documentation/translations/tabs_es.xml +22 -0
  190. data/site/src/documentation/translations/tabs_fr.xml +22 -0
  191. data/site/src/documentation/translations/tabs_nl.xml +22 -0
  192. data/test/decision_tree/id3_test.rb +209 -0
  193. data/test/genetic_algorithm/chromosome_test.rb +55 -0
  194. data/test/genetic_algorithm/genetic_algorithm_test.rb +78 -0
  195. data/test/neural_network/backpropagation_test.rb +44 -0
  196. metadata +274 -0
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <catalogue>
19
+ <message key="Font size:">Schriftgr�sse:</message>
20
+ <message key="Last Published:">Zuletzt ver�ffentlicht:</message>
21
+ <message key="Search">Suche:</message>
22
+ <message key="Search the site with">Suche auf der Seite mit</message>
23
+ </catalogue>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <catalogue>
19
+ <message key="Font size:">Font size:</message>
20
+ <message key="Last Published:">Last Published:</message>
21
+ <message key="Search">Search</message>
22
+ <message key="Search the site with">Search site with</message>
23
+ </catalogue>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <catalogue>
19
+ <message key="Font size:">Tama�o del texto:</message>
20
+ <message key="Last Published:">Fecha de publicaci�n:</message>
21
+ <message key="Search">Buscar</message>
22
+ <message key="Search the site with">Buscar en</message>
23
+ </catalogue>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <catalogue>
19
+ <message key="Font size:">Taille :</message>
20
+ <message key="Last Published:">Derni�re publication :</message>
21
+ <message key="Search">Rechercher</message>
22
+ <message key="Search the site with">Rechercher sur le site avec</message>
23
+ </catalogue>
@@ -0,0 +1,166 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * General
19
+ */
20
+
21
+ img { border: 0; }
22
+
23
+ #content table {
24
+ border: 0;
25
+ width: 100%;
26
+ }
27
+ /*Hack to get IE to render the table at 100%*/
28
+ * html #content table { margin-left: -3px; }
29
+
30
+ #content th,
31
+ #content td {
32
+ margin: 0;
33
+ padding: 0;
34
+ vertical-align: top;
35
+ }
36
+
37
+ .clearboth {
38
+ clear: both;
39
+ }
40
+
41
+ .note, .warning, .fixme {
42
+ border: solid black 1px;
43
+ margin: 1em 3em;
44
+ }
45
+
46
+ .note .label {
47
+ background: #369;
48
+ color: white;
49
+ font-weight: bold;
50
+ padding: 5px 10px;
51
+ }
52
+ .note .content {
53
+ background: #F0F0FF;
54
+ color: black;
55
+ line-height: 120%;
56
+ font-size: 90%;
57
+ padding: 5px 10px;
58
+ }
59
+ .warning .label {
60
+ background: #C00;
61
+ color: white;
62
+ font-weight: bold;
63
+ padding: 5px 10px;
64
+ }
65
+ .warning .content {
66
+ background: #FFF0F0;
67
+ color: black;
68
+ line-height: 120%;
69
+ font-size: 90%;
70
+ padding: 5px 10px;
71
+ }
72
+ .fixme .label {
73
+ background: #C6C600;
74
+ color: black;
75
+ font-weight: bold;
76
+ padding: 5px 10px;
77
+ }
78
+ .fixme .content {
79
+ padding: 5px 10px;
80
+ }
81
+
82
+ /**
83
+ * Typography
84
+ */
85
+
86
+ body {
87
+ font-family: verdana, "Trebuchet MS", arial, helvetica, sans-serif;
88
+ font-size: 100%;
89
+ }
90
+
91
+ #content {
92
+ font-family: Georgia, Palatino, Times, serif;
93
+ font-size: 95%;
94
+ }
95
+ #tabs {
96
+ font-size: 70%;
97
+ }
98
+ #menu {
99
+ font-size: 80%;
100
+ }
101
+ #footer {
102
+ font-size: 70%;
103
+ }
104
+
105
+ h1, h2, h3, h4, h5, h6 {
106
+ font-family: "Trebuchet MS", verdana, arial, helvetica, sans-serif;
107
+ font-weight: bold;
108
+ margin-top: 1em;
109
+ margin-bottom: .5em;
110
+ }
111
+
112
+ h1 {
113
+ margin-top: 0;
114
+ margin-bottom: 1em;
115
+ font-size: 1.4em;
116
+ }
117
+ #content h1 {
118
+ font-size: 160%;
119
+ margin-bottom: .5em;
120
+ }
121
+ #menu h1 {
122
+ margin: 0;
123
+ padding: 10px;
124
+ background: #336699;
125
+ color: white;
126
+ }
127
+ h2 { font-size: 120%; }
128
+ h3 { font-size: 100%; }
129
+ h4 { font-size: 90%; }
130
+ h5 { font-size: 80%; }
131
+ h6 { font-size: 75%; }
132
+
133
+ p {
134
+ line-height: 120%;
135
+ text-align: left;
136
+ margin-top: .5em;
137
+ margin-bottom: 1em;
138
+ }
139
+
140
+ #content li,
141
+ #content th,
142
+ #content td,
143
+ #content li ul,
144
+ #content li ol{
145
+ margin-top: .5em;
146
+ margin-bottom: .5em;
147
+ }
148
+
149
+
150
+ #content li li,
151
+ #minitoc-area li{
152
+ margin-top: 0em;
153
+ margin-bottom: 0em;
154
+ }
155
+
156
+ #content .attribution {
157
+ text-align: right;
158
+ font-style: italic;
159
+ font-size: 85%;
160
+ margin-top: 1em;
161
+ }
162
+
163
+ .codefrag {
164
+ font-family: "Courier New", Courier, monospace;
165
+ font-size: 110%;
166
+ }
@@ -0,0 +1,90 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var PREPREND_CRUMBS=new Array();
18
+ var link1="@skinconfig.trail.link1.name@";
19
+ var link2="@skinconfig.trail.link2.name@";
20
+ var link3="@skinconfig.trail.link3.name@";
21
+ if(!(link1=="")&&!link1.indexOf( "@" ) == 0){
22
+ PREPREND_CRUMBS.push( new Array( link1, @skinconfig.trail.link1.href@ ) ); }
23
+ if(!(link2=="")&&!link2.indexOf( "@" ) == 0){
24
+ PREPREND_CRUMBS.push( new Array( link2, @skinconfig.trail.link2.href@ ) ); }
25
+ if(!(link3=="")&&!link3.indexOf( "@" ) == 0){
26
+ PREPREND_CRUMBS.push( new Array( link3, @skinconfig.trail.link3.href@ ) ); }
27
+ var DISPLAY_SEPARATOR=" &gt; ";
28
+ var DISPLAY_PREPREND=" &gt; ";
29
+ var DISPLAY_POSTPREND=":";
30
+ var CSS_CLASS_CRUMB="breadcrumb";
31
+ var CSS_CLASS_TRAIL="breadcrumbTrail";
32
+ var CSS_CLASS_SEPARATOR="crumbSeparator";
33
+ var FILE_EXTENSIONS=new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" );
34
+ var PATH_SEPARATOR="/";
35
+
36
+ function sc(s) {
37
+ var l=s.toLowerCase();
38
+ return l.substr(0,1).toUpperCase()+l.substr(1);
39
+ }
40
+ function getdirs() {
41
+ var t=document.location.pathname.split(PATH_SEPARATOR);
42
+ var lc=t[t.length-1];
43
+ for(var i=0;i < FILE_EXTENSIONS.length;i++)
44
+ {
45
+ if(lc.indexOf(FILE_EXTENSIONS[i]))
46
+ return t.slice(1,t.length-1); }
47
+ return t.slice(1,t.length);
48
+ }
49
+ function getcrumbs( d )
50
+ {
51
+ var pre = "/";
52
+ var post = "/";
53
+ var c = new Array();
54
+ if( d != null )
55
+ {
56
+ for(var i=0;i < d.length;i++) {
57
+ pre+=d[i]+postfix;
58
+ c.push(new Array(d[i],pre)); }
59
+ }
60
+ if(PREPREND_CRUMBS.length > 0 )
61
+ return PREPREND_CRUMBS.concat( c );
62
+ return c;
63
+ }
64
+ function gettrail( c )
65
+ {
66
+ var h=DISPLAY_PREPREND;
67
+ for(var i=0;i < c.length;i++)
68
+ {
69
+ h+='<a href="'+c[i][1]+'" >'+sc(c[i][0])+'</a>';
70
+ if(i!=(c.length-1))
71
+ h+=DISPLAY_SEPARATOR; }
72
+ return h+DISPLAY_POSTPREND;
73
+ }
74
+
75
+ function gettrailXHTML( c )
76
+ {
77
+ var h='<span class="'+CSS_CLASS_TRAIL+'">'+DISPLAY_PREPREND;
78
+ for(var i=0;i < c.length;i++)
79
+ {
80
+ h+='<a href="'+c[i][1]+'" class="'+CSS_CLASS_CRUMB+'">'+sc(c[i][0])+'</a>';
81
+ if(i!=(c.length-1))
82
+ h+='<span class="'+CSS_CLASS_SEPARATOR+'">'+DISPLAY_SEPARATOR+'</span>'; }
83
+ return h+DISPLAY_POSTPREND+'</span>';
84
+ }
85
+
86
+ if(document.location.href.toLowerCase().indexOf("http://")==-1)
87
+ document.write(gettrail(getcrumbs()));
88
+ else
89
+ document.write(gettrail(getcrumbs(getdirs())));
90
+
@@ -0,0 +1,237 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * This script, when included in a html file, builds a neat breadcrumb trail
19
+ * based on its url. That is, if it doesn't contains bugs (I'm relatively
20
+ * sure it does).
21
+ *
22
+ * Typical usage:
23
+ * <script type="text/javascript" language="JavaScript" src="breadcrumbs.js"></script>
24
+ */
25
+
26
+ /**
27
+ * IE 5 on Mac doesn't know Array.push.
28
+ *
29
+ * Implement it - courtesy to fritz.
30
+ */
31
+ var abc = new Array();
32
+ if (!abc.push) {
33
+ Array.prototype.push = function(what){this[this.length]=what}
34
+ }
35
+
36
+ /* ========================================================================
37
+ CONSTANTS
38
+ ======================================================================== */
39
+
40
+ /**
41
+ * Two-dimensional array containing extra crumbs to place at the front of
42
+ * the trail. Specify first the name of the crumb, then the URI that belongs
43
+ * to it. You'll need to modify this for every domain or subdomain where
44
+ * you use this script (you can leave it as an empty array if you wish)
45
+ */
46
+ var PREPREND_CRUMBS = new Array();
47
+
48
+ var link1 = "@skinconfig.trail.link1.name@";
49
+ var link2 = "@skinconfig.trail.link2.name@";
50
+ var link3 = "@skinconfig.trail.link3.name@";
51
+
52
+ var href1 = "@skinconfig.trail.link1.href@";
53
+ var href2 = "@skinconfig.trail.link2.href@";
54
+ var href3 = "@skinconfig.trail.link3.href@";
55
+
56
+ if(!(link1=="")&&!link1.indexOf( "@" ) == 0){
57
+ PREPREND_CRUMBS.push( new Array( link1, href1 ) );
58
+ }
59
+ if(!(link2=="")&&!link2.indexOf( "@" ) == 0){
60
+ PREPREND_CRUMBS.push( new Array( link2, href2 ) );
61
+ }
62
+ if(!(link3=="")&&!link3.indexOf( "@" ) == 0){
63
+ PREPREND_CRUMBS.push( new Array( link3, href3 ) );
64
+ }
65
+
66
+ /**
67
+ * String to include between crumbs:
68
+ */
69
+ var DISPLAY_SEPARATOR = " &gt; ";
70
+ /**
71
+ * String to include at the beginning of the trail
72
+ */
73
+ var DISPLAY_PREPREND = " &gt; ";
74
+ /**
75
+ * String to include at the end of the trail
76
+ */
77
+ var DISPLAY_POSTPREND = "";
78
+
79
+ /**
80
+ * CSS Class to use for a single crumb:
81
+ */
82
+ var CSS_CLASS_CRUMB = "breadcrumb";
83
+
84
+ /**
85
+ * CSS Class to use for the complete trail:
86
+ */
87
+ var CSS_CLASS_TRAIL = "breadcrumbTrail";
88
+
89
+ /**
90
+ * CSS Class to use for crumb separator:
91
+ */
92
+ var CSS_CLASS_SEPARATOR = "crumbSeparator";
93
+
94
+ /**
95
+ * Array of strings containing common file extensions. We use this to
96
+ * determine what part of the url to ignore (if it contains one of the
97
+ * string specified here, we ignore it).
98
+ */
99
+ var FILE_EXTENSIONS = new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" );
100
+
101
+ /**
102
+ * String that separates parts of the breadcrumb trail from each other.
103
+ * When this is no longer a slash, I'm sure I'll be old and grey.
104
+ */
105
+ var PATH_SEPARATOR = "/";
106
+
107
+ /* ========================================================================
108
+ UTILITY FUNCTIONS
109
+ ======================================================================== */
110
+ /**
111
+ * Capitalize first letter of the provided string and return the modified
112
+ * string.
113
+ */
114
+ function sentenceCase( string )
115
+ { return string;
116
+ //var lower = string.toLowerCase();
117
+ //return lower.substr(0,1).toUpperCase() + lower.substr(1);
118
+ }
119
+
120
+ /**
121
+ * Returns an array containing the names of all the directories in the
122
+ * current document URL
123
+ */
124
+ function getDirectoriesInURL()
125
+ {
126
+ var trail = document.location.pathname.split( PATH_SEPARATOR );
127
+
128
+ // check whether last section is a file or a directory
129
+ var lastcrumb = trail[trail.length-1];
130
+ for( var i = 0; i < FILE_EXTENSIONS.length; i++ )
131
+ {
132
+ if( lastcrumb.indexOf( FILE_EXTENSIONS[i] ) )
133
+ {
134
+ // it is, remove it and send results
135
+ return trail.slice( 1, trail.length-1 );
136
+ }
137
+ }
138
+
139
+ // it's not; send the trail unmodified
140
+ return trail.slice( 1, trail.length );
141
+ }
142
+
143
+ /* ========================================================================
144
+ BREADCRUMB FUNCTIONALITY
145
+ ======================================================================== */
146
+ /**
147
+ * Return a two-dimensional array describing the breadcrumbs based on the
148
+ * array of directories passed in.
149
+ */
150
+ function getBreadcrumbs( dirs )
151
+ {
152
+ var prefix = "/";
153
+ var postfix = "/";
154
+
155
+ // the array we will return
156
+ var crumbs = new Array();
157
+
158
+ if( dirs != null )
159
+ {
160
+ for( var i = 0; i < dirs.length; i++ )
161
+ {
162
+ prefix += dirs[i] + postfix;
163
+ crumbs.push( new Array( dirs[i], prefix ) );
164
+ }
165
+ }
166
+
167
+ // preprend the PREPREND_CRUMBS
168
+ if(PREPREND_CRUMBS.length > 0 )
169
+ {
170
+ return PREPREND_CRUMBS.concat( crumbs );
171
+ }
172
+
173
+ return crumbs;
174
+ }
175
+
176
+ /**
177
+ * Return a string containing a simple text breadcrumb trail based on the
178
+ * two-dimensional array passed in.
179
+ */
180
+ function getCrumbTrail( crumbs )
181
+ {
182
+ var xhtml = DISPLAY_PREPREND;
183
+
184
+ for( var i = 0; i < crumbs.length; i++ )
185
+ {
186
+ xhtml += '<a href="' + crumbs[i][1] + '" >';
187
+ xhtml += unescape( crumbs[i][0] ) + '</a>';
188
+ if( i != (crumbs.length-1) )
189
+ {
190
+ xhtml += DISPLAY_SEPARATOR;
191
+ }
192
+ }
193
+
194
+ xhtml += DISPLAY_POSTPREND;
195
+
196
+ return xhtml;
197
+ }
198
+
199
+ /**
200
+ * Return a string containing an XHTML breadcrumb trail based on the
201
+ * two-dimensional array passed in.
202
+ */
203
+ function getCrumbTrailXHTML( crumbs )
204
+ {
205
+ var xhtml = '<span class="' + CSS_CLASS_TRAIL + '">';
206
+ xhtml += DISPLAY_PREPREND;
207
+
208
+ for( var i = 0; i < crumbs.length; i++ )
209
+ {
210
+ xhtml += '<a href="' + crumbs[i][1] + '" class="' + CSS_CLASS_CRUMB + '">';
211
+ xhtml += unescape( crumbs[i][0] ) + '</a>';
212
+ if( i != (crumbs.length-1) )
213
+ {
214
+ xhtml += '<span class="' + CSS_CLASS_SEPARATOR + '">' + DISPLAY_SEPARATOR + '</span>';
215
+ }
216
+ }
217
+
218
+ xhtml += DISPLAY_POSTPREND;
219
+ xhtml += '</span>';
220
+
221
+ return xhtml;
222
+ }
223
+
224
+ /* ========================================================================
225
+ PRINT BREADCRUMB TRAIL
226
+ ======================================================================== */
227
+
228
+ // check if we're local; if so, only print the PREPREND_CRUMBS
229
+ if( document.location.href.toLowerCase().indexOf( "http://" ) == -1 )
230
+ {
231
+ document.write( getCrumbTrail( getBreadcrumbs() ) );
232
+ }
233
+ else
234
+ {
235
+ document.write( getCrumbTrail( getBreadcrumbs( getDirectoriesInURL() ) ) );
236
+ }
237
+