lims-core 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +5 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +2 -0
  5. data/.travis.yml +2 -0
  6. data/.vimrc +27 -0
  7. data/.yard_templates/default/layout/html/footer.erb +0 -0
  8. data/.yardopts +1 -0
  9. data/Gemfile +54 -0
  10. data/Gemfile.lock +197 -0
  11. data/Guardfile +21 -0
  12. data/Guardfile.tmux +28 -0
  13. data/README.markdown +67 -0
  14. data/Rakefile +16 -0
  15. data/config/database.yml +16 -0
  16. data/doc/Array.html +116 -0
  17. data/doc/Array/ArrayLoggerPersistor.html +152 -0
  18. data/doc/Lims.html +114 -0
  19. data/doc/Lims/Core.html +178 -0
  20. data/doc/Lims/Core/Action.html +91 -0
  21. data/doc/Lims/Core/Actions.html +116 -0
  22. data/doc/Lims/Core/Actions/Action.html +216 -0
  23. data/doc/Lims/Core/Actions/Action/AfterEval.html +853 -0
  24. data/doc/Lims/Core/Actions/Action/InvalidParameters.html +268 -0
  25. data/doc/Lims/Core/Actions/ActionGroup.html +196 -0
  26. data/doc/Lims/Core/Actions/ActionGroup/AfterEval.html +315 -0
  27. data/doc/Lims/Core/Actions/BulkAction.html +224 -0
  28. data/doc/Lims/Core/Actions/BulkAction/AfterEval.html +253 -0
  29. data/doc/Lims/Core/Actions/TestActionGroup.html +101 -0
  30. data/doc/Lims/Core/Actions/TestActionGroup/Action.html +133 -0
  31. data/doc/Lims/Core/Actions/TestActionGroup/ActionGroup.html +127 -0
  32. data/doc/Lims/Core/Base.html +287 -0
  33. data/doc/Lims/Core/Base/AccessibleViaSuper.html +252 -0
  34. data/doc/Lims/Core/Base/ClassMethod.html +177 -0
  35. data/doc/Lims/Core/Base/HashString.html +177 -0
  36. data/doc/Lims/Core/Base/IsArrayOf.html +606 -0
  37. data/doc/Lims/Core/Base/State.html +130 -0
  38. data/doc/Lims/Core/Organization.html +113 -0
  39. data/doc/Lims/Core/Organization/Batch.html +106 -0
  40. data/doc/Lims/Core/Persistence.html +267 -0
  41. data/doc/Lims/Core/Persistence/ComparisonFilter.html +318 -0
  42. data/doc/Lims/Core/Persistence/Filter.html +252 -0
  43. data/doc/Lims/Core/Persistence/IdentityMap.html +409 -0
  44. data/doc/Lims/Core/Persistence/IdentityMap/Class.html +144 -0
  45. data/doc/Lims/Core/Persistence/IdentityMap/DuplicateError.html +126 -0
  46. data/doc/Lims/Core/Persistence/IdentityMap/DuplicateIdError.html +136 -0
  47. data/doc/Lims/Core/Persistence/IdentityMap/DuplicateObjectError.html +136 -0
  48. data/doc/Lims/Core/Persistence/IdentityMapClass.html +133 -0
  49. data/doc/Lims/Core/Persistence/Logger.html +105 -0
  50. data/doc/Lims/Core/Persistence/Logger/Persistor.html +334 -0
  51. data/doc/Lims/Core/Persistence/Logger/Session.html +452 -0
  52. data/doc/Lims/Core/Persistence/Logger/Store.html +470 -0
  53. data/doc/Lims/Core/Persistence/MessageBus.html +871 -0
  54. data/doc/Lims/Core/Persistence/MessageBus/ConnectionError.html +123 -0
  55. data/doc/Lims/Core/Persistence/MessageBus/InvalidSettingsError.html +122 -0
  56. data/doc/Lims/Core/Persistence/MultiCriteriaFilter.html +293 -0
  57. data/doc/Lims/Core/Persistence/PersistAssociationTrait.html +91 -0
  58. data/doc/Lims/Core/Persistence/PersistableTrait.html +91 -0
  59. data/doc/Lims/Core/Persistence/Persistor.html +3072 -0
  60. data/doc/Lims/Core/Persistence/Persistor/DuplicateError.html +205 -0
  61. data/doc/Lims/Core/Persistence/Persistor/DuplicateIdError.html +147 -0
  62. data/doc/Lims/Core/Persistence/Persistor/DuplicateObjectError.html +147 -0
  63. data/doc/Lims/Core/Persistence/PersistorTrait.html +91 -0
  64. data/doc/Lims/Core/Persistence/ResourceState.html +1738 -0
  65. data/doc/Lims/Core/Persistence/Search.html +269 -0
  66. data/doc/Lims/Core/Persistence/Search/CreateSearch.html +251 -0
  67. data/doc/Lims/Core/Persistence/Search/SearchPersistor.html +240 -0
  68. data/doc/Lims/Core/Persistence/Search/SearchSequelPersistor.html +396 -0
  69. data/doc/Lims/Core/Persistence/Sequel.html +117 -0
  70. data/doc/Lims/Core/Persistence/Sequel/Filters.html +462 -0
  71. data/doc/Lims/Core/Persistence/Sequel/ForTest.html +101 -0
  72. data/doc/Lims/Core/Persistence/Sequel/ForTest/Name.html +137 -0
  73. data/doc/Lims/Core/Persistence/Sequel/ForTest/Name/NamePersitor.html +143 -0
  74. data/doc/Lims/Core/Persistence/Sequel/Migrations.html +266 -0
  75. data/doc/Lims/Core/Persistence/Sequel/Persistor.html +665 -0
  76. data/doc/Lims/Core/Persistence/Sequel/Session.html +501 -0
  77. data/doc/Lims/Core/Persistence/Sequel/Store.html +417 -0
  78. data/doc/Lims/Core/Persistence/Session.html +2751 -0
  79. data/doc/Lims/Core/Persistence/Session/UnmanagedObjectError.html +111 -0
  80. data/doc/Lims/Core/Persistence/StateGroup.html +696 -0
  81. data/doc/Lims/Core/Persistence/StateList.html +498 -0
  82. data/doc/Lims/Core/Persistence/Store.html +695 -0
  83. data/doc/Lims/Core/Persistence/UuidResource.html +1044 -0
  84. data/doc/Lims/Core/Persistence/UuidResource/InvalidUuidError.html +111 -0
  85. data/doc/Lims/Core/Persistence/UuidResource/UuidResourcePersistor.html +337 -0
  86. data/doc/Lims/Core/Persistence/Uuidable.html +799 -0
  87. data/doc/Lims/Core/Persistor.html +320 -0
  88. data/doc/Lims/Core/Resource.html +165 -0
  89. data/doc/Object.html +228 -0
  90. data/doc/SessionSpec.html +101 -0
  91. data/doc/SessionSpec/Model.html +279 -0
  92. data/doc/SessionSpec/Model/ModelPersistor.html +327 -0
  93. data/doc/_index.html +732 -0
  94. data/doc/class_list.html +47 -0
  95. data/doc/css/common.css +1 -0
  96. data/doc/css/full_list.css +55 -0
  97. data/doc/css/style.css +322 -0
  98. data/doc/file.README.html +127 -0
  99. data/doc/file_list.html +49 -0
  100. data/doc/frames.html +13 -0
  101. data/doc/index.html +127 -0
  102. data/doc/js/app.js +205 -0
  103. data/doc/js/full_list.js +167 -0
  104. data/doc/js/jquery.js +16 -0
  105. data/doc/method_list.html +1894 -0
  106. data/doc/top-level-namespace.html +100 -0
  107. data/lib/common.rb +18 -0
  108. data/lib/lims-core.rb +29 -0
  109. data/lib/lims-core/actions.rb +10 -0
  110. data/lib/lims-core/actions/action.rb +185 -0
  111. data/lib/lims-core/actions/action_group.rb +54 -0
  112. data/lib/lims-core/actions/bulk_action.rb +65 -0
  113. data/lib/lims-core/base.rb +132 -0
  114. data/lib/lims-core/helpers.rb +41 -0
  115. data/lib/lims-core/persistence.rb +15 -0
  116. data/lib/lims-core/persistence/comparison_filter.rb +54 -0
  117. data/lib/lims-core/persistence/filter.rb +23 -0
  118. data/lib/lims-core/persistence/identity_map.rb +55 -0
  119. data/lib/lims-core/persistence/logger/all.rb +5 -0
  120. data/lib/lims-core/persistence/logger/persistor.rb +35 -0
  121. data/lib/lims-core/persistence/logger/session.rb +30 -0
  122. data/lib/lims-core/persistence/logger/store.rb +37 -0
  123. data/lib/lims-core/persistence/message_bus.rb +131 -0
  124. data/lib/lims-core/persistence/multi_criteria_filter.rb +50 -0
  125. data/lib/lims-core/persistence/persist_association_trait.rb +96 -0
  126. data/lib/lims-core/persistence/persistable_trait.rb +150 -0
  127. data/lib/lims-core/persistence/persistor.rb +495 -0
  128. data/lib/lims-core/persistence/resource_state.rb +157 -0
  129. data/lib/lims-core/persistence/search.rb +3 -0
  130. data/lib/lims-core/persistence/search/all.rb +3 -0
  131. data/lib/lims-core/persistence/search/create_search.rb +55 -0
  132. data/lib/lims-core/persistence/search/search_persistor.rb +45 -0
  133. data/lib/lims-core/persistence/search/search_sequel_persistor.rb +40 -0
  134. data/lib/lims-core/persistence/sequel.rb +14 -0
  135. data/lib/lims-core/persistence/sequel/filters.rb +106 -0
  136. data/lib/lims-core/persistence/sequel/migrations.rb +14 -0
  137. data/lib/lims-core/persistence/sequel/migrations/add_audit_tables.rb +147 -0
  138. data/lib/lims-core/persistence/sequel/migrations/initial.rb +156 -0
  139. data/lib/lims-core/persistence/sequel/persistor.rb +200 -0
  140. data/lib/lims-core/persistence/sequel/session.rb +136 -0
  141. data/lib/lims-core/persistence/sequel/store.rb +37 -0
  142. data/lib/lims-core/persistence/session.rb +409 -0
  143. data/lib/lims-core/persistence/state_group.rb +97 -0
  144. data/lib/lims-core/persistence/state_list.rb +56 -0
  145. data/lib/lims-core/persistence/store.rb +73 -0
  146. data/lib/lims-core/persistence/uuid_resource.rb +115 -0
  147. data/lib/lims-core/persistence/uuid_resource_persistor.rb +43 -0
  148. data/lib/lims-core/persistence/uuidable.rb +107 -0
  149. data/lib/lims-core/resource.rb +21 -0
  150. data/lib/lims-core/subclass_tracker.rb +30 -0
  151. data/lib/lims-core/version.rb +5 -0
  152. data/lims-core.gemspec +40 -0
  153. data/makefile +52 -0
  154. data/showoff/core-2012-06-11/core/01_slide.md +237 -0
  155. data/showoff/core-2012-06-11/core/02_slide.md +110 -0
  156. data/showoff/core-2012-06-11/custom.css +44 -0
  157. data/showoff/core-2012-06-11/main/01_slide.md +53 -0
  158. data/showoff/core-2012-06-11/showoff.json +10 -0
  159. data/showoff/core-2012-06-11/tp1.tpl +1 -0
  160. data/spec/actions/action_group_spec.rb +39 -0
  161. data/spec/actions/spec_helper.rb +1 -0
  162. data/spec/persistence/identity_map_spec.rb +55 -0
  163. data/spec/persistence/logger/spec_helper.rb +7 -0
  164. data/spec/persistence/logger/store_spec.rb +48 -0
  165. data/spec/persistence/message_bus_spec.rb +76 -0
  166. data/spec/persistence/sequel/session_spec.rb +125 -0
  167. data/spec/persistence/sequel/spec_helper.rb +39 -0
  168. data/spec/persistence/sequel/store_shared.rb +25 -0
  169. data/spec/persistence/sequel/store_spec.rb +22 -0
  170. data/spec/persistence/session_spec.rb +199 -0
  171. data/spec/persistence/spec_helper.rb +2 -0
  172. data/spec/persistence/uuid_resource_spec.rb +80 -0
  173. data/spec/spec_helper.rb +10 -0
  174. data/spec/subclass_tracker_sperc.rb +62 -0
  175. data/utils/constant_tree.rb +29 -0
  176. data/utils/stack.rb +48 -0
  177. metadata +402 -0
@@ -0,0 +1,49 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <base id="base_target" target="_parent" />
19
+ </head>
20
+ <body>
21
+ <script type="text/javascript" charset="utf-8">
22
+ if (window.top.frames.main) {
23
+ document.getElementById('base_target').target = 'main';
24
+ document.body.className = 'frames';
25
+ }
26
+ </script>
27
+ <div id="content">
28
+ <h1 id="full_list_header">File List</h1>
29
+ <div id="nav">
30
+
31
+ <a target="_self" href="class_list.html">Classes</a>
32
+
33
+ <a target="_self" href="method_list.html">Methods</a>
34
+
35
+ <a target="_self" href="file_list.html">Files</a>
36
+
37
+ </div>
38
+ <div id="search">Search: <input type="text" /></div>
39
+
40
+ <ul id="full_list" class="files">
41
+
42
+
43
+ <li class="r1"><a href="index.html" title="README">README</a></li>
44
+
45
+
46
+ </ul>
47
+ </div>
48
+ </body>
49
+ </html>
data/doc/frames.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Documentation by YARD 0.7.3</title>
8
+ </head>
9
+ <frameset cols="20%,*">
10
+ <frame name="list" src="class_list.html" />
11
+ <frame name="main" src="index.html" />
12
+ </frameset>
13
+ </html>
data/doc/index.html ADDED
@@ -0,0 +1,127 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: README</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'><!-- vim: spell:spelllang=en tw=80
58
+ Yard markup
59
+ # @markup markdown
60
+ # @title README
61
+ -->
62
+
63
+
64
+ <h1>Overview </h1>
65
+
66
+ <p>This gem implements the core functionalities of the LIMS (Laboratory Information Management System).
67
+ It's not meant to be a stand alone application but the core library of the LIMS
68
+ server.</p>
69
+
70
+ <p>For more information consult the documentation.</p>
71
+
72
+ <h1>Installation</h1>
73
+
74
+ <pre class="code"><span class='id gem'>gem</span> <span class='id install'>install</span> <span class='id lims'>lims</span><span class='op'>-</span><span class='id core'>core</span>
75
+ </pre>
76
+
77
+ <p>Or, if you are using <a href="http://gembundler.com/">bundler</a> , add the following line</p>
78
+
79
+ <pre class="code"> <span class='id gem'>gem</span> <span class='symbol'>:lims</span><span class='op'>-</span><span class='id core'>core</span><span class='comma'>,</span> <span class='symbol'>:git</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>git+ssh://git@github.com/sanger/lims-core.git'
80
+ </span></span></pre>
81
+
82
+ <p>in your <code>Gemfile</code>.</p>
83
+
84
+ <h1>Documentation</h1>
85
+
86
+ <p>The documentation is generated using <a href="http://yardoc.org/index.html">yard</a> and can
87
+ be found under the <code>doc/</code> directory or using a <code>yard server</code></p>
88
+
89
+ <h1>Developers Guide</h1>
90
+
91
+ <h2>Gem requirements</h2>
92
+
93
+ <p>Ideally each should be loadable on its own. This mean that every file should
94
+ require everything it needs. The exception is for gems re-opening ruby basic
95
+ classes as facet do. The common requirements are grouped in the <code>lib/common.rb</code>
96
+ file.</p>
97
+
98
+ <p>For the user convenience, requiring a directory should requires everything
99
+ underneath. However, requiring <code>lims-core</code> will require <code>Persistence</code>, but not
100
+ the subdirectories of it (specific to each different stores like <code>Sequel</code>, or
101
+ <code>Logger</code>). This to not force to install all the dependencies specific to each
102
+ store.</p>
103
+
104
+ <h2>Documentation Guide</h2>
105
+
106
+ <p>The documentation is written using <a href="http://yardoc.org/index.html">yard</a>.
107
+ It allows to write documentation within the doc and add <em>typing</em> hints/
108
+ expectations.
109
+ The recommended format for stand alone documentation files is
110
+ <a href="http://daringfireball.net/projects/markdown/">markdown</a>, however
111
+ it's easier to keep the native markup language used by <strong>yard</strong>, i.e. the
112
+ <a href="http://rdoc.sourceforge.net/">rdoc</a> one.
113
+ This allows the code to be parsed via <strong>rdoc</strong> and doesn't need the extra spaces at
114
+ the end of a line needed by <strong>markdown</strong>.</p>
115
+
116
+ <p>However, when the usage of pure <strong>markdown</strong> seems appropriate, it's still
117
+ possible to the use <code>@markup</code> switch.</p>
118
+
119
+ <p>Some documentation can also be added in the specs.</p>
120
+
121
+ <h2>Tests</h2>
122
+
123
+ <p>We are using <a href="http://rspec.info/">rspec</a>.</p></div></div>
124
+
125
+
126
+ </body>
127
+ </html>
data/doc/js/app.js ADDED
@@ -0,0 +1,205 @@
1
+ function createSourceLinks() {
2
+ $('.method_details_list .source_code').
3
+ before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
4
+ $('.toggleSource').toggle(function() {
5
+ $(this).parent().next().slideDown(100);
6
+ $(this).text("Hide source");
7
+ },
8
+ function() {
9
+ $(this).parent().next().slideUp(100);
10
+ $(this).text("View source");
11
+ });
12
+ }
13
+
14
+ function createDefineLinks() {
15
+ var tHeight = 0;
16
+ $('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
17
+ $('.toggleDefines').toggle(function() {
18
+ tHeight = $(this).parent().prev().height();
19
+ $(this).prev().show();
20
+ $(this).parent().prev().height($(this).parent().height());
21
+ $(this).text("(less)");
22
+ },
23
+ function() {
24
+ $(this).prev().hide();
25
+ $(this).parent().prev().height(tHeight);
26
+ $(this).text("more...");
27
+ });
28
+ }
29
+
30
+ function createFullTreeLinks() {
31
+ var tHeight = 0;
32
+ $('.inheritanceTree').toggle(function() {
33
+ tHeight = $(this).parent().prev().height();
34
+ $(this).parent().toggleClass('showAll');
35
+ $(this).text("(hide)");
36
+ $(this).parent().prev().height($(this).parent().height());
37
+ },
38
+ function() {
39
+ $(this).parent().toggleClass('showAll');
40
+ $(this).parent().prev().height(tHeight);
41
+ $(this).text("show all");
42
+ });
43
+ }
44
+
45
+ function fixBoxInfoHeights() {
46
+ $('dl.box dd.r1, dl.box dd.r2').each(function() {
47
+ $(this).prev().height($(this).height());
48
+ });
49
+ }
50
+
51
+ function searchFrameLinks() {
52
+ $('#method_list_link').click(function() {
53
+ toggleSearchFrame(this, relpath + 'method_list.html');
54
+ });
55
+
56
+ $('#class_list_link').click(function() {
57
+ toggleSearchFrame(this, relpath + 'class_list.html');
58
+ });
59
+
60
+ $('#file_list_link').click(function() {
61
+ toggleSearchFrame(this, relpath + 'file_list.html');
62
+ });
63
+ }
64
+
65
+ function toggleSearchFrame(id, link) {
66
+ var frame = $('#search_frame');
67
+ $('#search a').removeClass('active').addClass('inactive');
68
+ if (frame.attr('src') == link && frame.css('display') != "none") {
69
+ frame.slideUp(100);
70
+ $('#search a').removeClass('active inactive');
71
+ }
72
+ else {
73
+ $(id).addClass('active').removeClass('inactive');
74
+ frame.attr('src', link).slideDown(100);
75
+ }
76
+ }
77
+
78
+ function linkSummaries() {
79
+ $('.summary_signature').click(function() {
80
+ document.location = $(this).find('a').attr('href');
81
+ });
82
+ }
83
+
84
+ function framesInit() {
85
+ if (window.top.frames.main) {
86
+ document.body.className = 'frames';
87
+ $('#menu .noframes a').attr('href', document.location);
88
+ $('html head title', window.parent.document).text($('html head title').text());
89
+ }
90
+ }
91
+
92
+ function keyboardShortcuts() {
93
+ if (window.top.frames.main) return;
94
+ $(document).keypress(function(evt) {
95
+ if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
96
+ if (typeof evt.target !== "undefined" &&
97
+ (evt.target.nodeName == "INPUT" ||
98
+ evt.target.nodeName == "TEXTAREA")) return;
99
+ switch (evt.charCode) {
100
+ case 67: case 99: $('#class_list_link').click(); break; // 'c'
101
+ case 77: case 109: $('#method_list_link').click(); break; // 'm'
102
+ case 70: case 102: $('#file_list_link').click(); break; // 'f'
103
+ default: break;
104
+ }
105
+ });
106
+ }
107
+
108
+ function summaryToggle() {
109
+ $('.summary_toggle').click(function() {
110
+ localStorage.summaryCollapsed = $(this).text();
111
+ $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
112
+ var next = $(this).parent().parent().next();
113
+ if (next.hasClass('compact')) {
114
+ next.toggle();
115
+ next.next().toggle();
116
+ }
117
+ else if (next.hasClass('summary')) {
118
+ var list = $('<ul class="summary compact" />');
119
+ list.html(next.html());
120
+ list.find('.summary_desc, .note').remove();
121
+ list.find('a').each(function() {
122
+ $(this).html($(this).find('strong').html());
123
+ $(this).parent().html($(this)[0].outerHTML);
124
+ });
125
+ next.before(list);
126
+ next.toggle();
127
+ }
128
+ return false;
129
+ });
130
+ if (localStorage) {
131
+ if (localStorage.summaryCollapsed == "collapse") $('.summary_toggle').click();
132
+ else localStorage.summaryCollapsed = "expand";
133
+ }
134
+ }
135
+
136
+ function fixOutsideWorldLinks() {
137
+ $('a').each(function() {
138
+ if (window.location.host != this.host) this.target = '_parent';
139
+ });
140
+ }
141
+
142
+ function generateTOC() {
143
+ if ($('#filecontents').length === 0) return;
144
+ var _toc = $('<ol class="top"></ol>');
145
+ var show = false;
146
+ var toc = _toc;
147
+ var counter = 0;
148
+ var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
149
+ var i;
150
+ if ($('#filecontents h1').length > 1) tags.unshift('h1');
151
+ for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
152
+ var lastTag = parseInt(tags[0][1], 10);
153
+ $(tags.join(', ')).each(function() {
154
+ if (this.id == "filecontents") return;
155
+ show = true;
156
+ var thisTag = parseInt(this.tagName[1], 10);
157
+ if (this.id.length === 0) {
158
+ var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
159
+ if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
160
+ this.id = proposedId;
161
+ }
162
+ if (thisTag > lastTag) {
163
+ for (i = 0; i < thisTag - lastTag; i++) {
164
+ var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
165
+ }
166
+ }
167
+ if (thisTag < lastTag) {
168
+ for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
169
+ }
170
+ toc.append('<li><a href="#' + this.id + '">' + $(this).text() + '</a></li>');
171
+ lastTag = thisTag;
172
+ });
173
+ if (!show) return;
174
+ html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
175
+ $('#content').prepend(html);
176
+ $('#toc').append(_toc);
177
+ $('#toc .hide_toc').toggle(function() {
178
+ $('#toc .top').slideUp('fast');
179
+ $('#toc').toggleClass('hidden');
180
+ $('#toc .title small').toggle();
181
+ }, function() {
182
+ $('#toc .top').slideDown('fast');
183
+ $('#toc').toggleClass('hidden');
184
+ $('#toc .title small').toggle();
185
+ });
186
+ $('#toc .float_toc').toggle(function() {
187
+ $(this).text('float');
188
+ $('#toc').toggleClass('nofloat');
189
+ }, function() {
190
+ $(this).text('left');
191
+ $('#toc').toggleClass('nofloat');
192
+ });
193
+ }
194
+
195
+ $(framesInit);
196
+ $(createSourceLinks);
197
+ $(createDefineLinks);
198
+ $(createFullTreeLinks);
199
+ $(fixBoxInfoHeights);
200
+ $(searchFrameLinks);
201
+ $(linkSummaries);
202
+ $(keyboardShortcuts);
203
+ $(summaryToggle);
204
+ $(fixOutsideWorldLinks);
205
+ $(generateTOC);
@@ -0,0 +1,167 @@
1
+ var inSearch = null;
2
+ var searchIndex = 0;
3
+ var searchCache = [];
4
+ var searchString = '';
5
+ var regexSearchString = '';
6
+ var caseSensitiveMatch = false;
7
+
8
+ RegExp.escape = function(text) {
9
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
10
+ }
11
+
12
+ function fullListSearch() {
13
+ // generate cache
14
+ searchCache = [];
15
+ $('#full_list li').each(function() {
16
+ var link = $(this).find('.object_link a');
17
+ var fullName = link.attr('title').split(' ')[0];
18
+ searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link});
19
+ });
20
+
21
+ $('#search input').keyup(function() {
22
+ searchString = this.value;
23
+ caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
24
+ regexSearchString = RegExp.escape(searchString);
25
+ if (caseSensitiveMatch) {
26
+ regexSearchString += "|" +
27
+ $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
28
+ join('.+?');
29
+ }
30
+ if (searchString === "") {
31
+ clearTimeout(inSearch);
32
+ inSearch = null;
33
+ $('ul .search_uncollapsed').removeClass('search_uncollapsed');
34
+ $('#full_list, #content').removeClass('insearch');
35
+ $('#full_list li').removeClass('found').each(function() {
36
+
37
+ var link = $(this).find('.object_link a');
38
+ link.text(link.text());
39
+ });
40
+ if (clicked) {
41
+ clicked.parents('ul').each(function() {
42
+ $(this).removeClass('collapsed').prev().removeClass('collapsed');
43
+ });
44
+ }
45
+ highlight();
46
+ }
47
+ else {
48
+ if (inSearch) clearTimeout(inSearch);
49
+ searchIndex = 0;
50
+ lastRowClass = '';
51
+ $('#full_list, #content').addClass('insearch');
52
+ $('#noresults').text('');
53
+ searchItem();
54
+ }
55
+ });
56
+
57
+ $('#search input').focus();
58
+ $('#full_list').after("<div id='noresults'></div>");
59
+ }
60
+
61
+ var lastRowClass = '';
62
+ function searchItem() {
63
+ for (var i = 0; i < searchCache.length / 50; i++) {
64
+ var item = searchCache[searchIndex];
65
+ var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
66
+ var matchString = regexSearchString;
67
+ var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
68
+ if (searchName.match(matchRegexp) == null) {
69
+ item.node.removeClass('found');
70
+ }
71
+ else {
72
+ item.node.css('padding-left', '10px').addClass('found');
73
+ item.node.parents().addClass('search_uncollapsed');
74
+ item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
75
+ lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
76
+ item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
77
+ }
78
+
79
+ if (searchCache.length === searchIndex + 1) {
80
+ searchDone();
81
+ return;
82
+ }
83
+ else {
84
+ searchIndex++;
85
+ }
86
+ }
87
+ inSearch = setTimeout('searchItem()', 0);
88
+ }
89
+
90
+ function searchDone() {
91
+ highlight(true);
92
+ if ($('#full_list li:visible').size() === 0) {
93
+ $('#noresults').text('No results were found.').hide().fadeIn();
94
+ }
95
+ else {
96
+ $('#noresults').text('');
97
+ }
98
+ $('#content').removeClass('insearch');
99
+ clearTimeout(inSearch);
100
+ inSearch = null;
101
+ }
102
+
103
+ clicked = null;
104
+ function linkList() {
105
+ $('#full_list li, #full_list li a:last').click(function(evt) {
106
+ if ($(this).hasClass('toggle')) return true;
107
+ if (this.tagName.toLowerCase() == "li") {
108
+ var toggle = $(this).children('a.toggle');
109
+ if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
110
+ toggle.click();
111
+ return false;
112
+ }
113
+ }
114
+ if (clicked) clicked.removeClass('clicked');
115
+ var win = window.top.frames.main ? window.top.frames.main : window.parent;
116
+ if (this.tagName.toLowerCase() == "a") {
117
+ clicked = $(this).parent('li').addClass('clicked');
118
+ win.location = this.href;
119
+ }
120
+ else {
121
+ clicked = $(this).addClass('clicked');
122
+ win.location = $(this).find('a:last').attr('href');
123
+ }
124
+ return false;
125
+ });
126
+ }
127
+
128
+ function collapse() {
129
+ if (!$('#full_list').hasClass('class')) return;
130
+ $('#full_list.class a.toggle').click(function() {
131
+ $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed');
132
+ highlight();
133
+ return false;
134
+ });
135
+ $('#full_list.class ul').each(function() {
136
+ $(this).addClass('collapsed').prev().addClass('collapsed');
137
+ });
138
+ $('#full_list.class').children().removeClass('collapsed');
139
+ highlight();
140
+ }
141
+
142
+ function highlight(no_padding) {
143
+ var n = 1;
144
+ $('#full_list li:visible').each(function() {
145
+ var next = n == 1 ? 2 : 1;
146
+ $(this).removeClass("r" + next).addClass("r" + n);
147
+ if (!no_padding && $('#full_list').hasClass('class')) {
148
+ $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px');
149
+ }
150
+ n = next;
151
+ });
152
+ }
153
+
154
+ function escapeShortcut() {
155
+ $(document).keydown(function(evt) {
156
+ if (evt.which == 27) {
157
+ $('#search_frame', window.top.document).slideUp(100);
158
+ $('#search a', window.top.document).removeClass('active inactive');
159
+ $(window.top).focus();
160
+ }
161
+ });
162
+ }
163
+
164
+ $(escapeShortcut);
165
+ $(fullListSearch);
166
+ $(linkList);
167
+ $(collapse);