talia_core 0.4.22 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/VERSION.yml +2 -2
  2. data/config/database.yml +9 -9
  3. data/config/rdfstore.yml +4 -4
  4. data/config/talia_core.yml +5 -2
  5. data/generators/generator_helpers.rb +66 -25
  6. data/generators/talia_admin/talia_admin_generator.rb +9 -9
  7. data/generators/talia_admin/templates/app/controllers/admin/admin_site_controller.rb +5 -0
  8. data/generators/talia_admin/templates/app/controllers/admin/custom_templates_controller.rb +7 -0
  9. data/generators/talia_admin/templates/app/controllers/admin/front_controller.rb +19 -0
  10. data/generators/talia_admin/templates/app/controllers/admin/talia_collections_controller.rb +7 -0
  11. data/generators/talia_admin/templates/app/controllers/admin/talia_sources_controller.rb +17 -0
  12. data/generators/talia_admin/templates/app/controllers/admin/users_controller.rb +7 -0
  13. data/generators/talia_admin/templates/app/controllers/users_controller.rb +7 -0
  14. data/generators/talia_admin/templates/app/helpers/admin/front_helper.rb +2 -0
  15. data/generators/talia_admin/templates/app/helpers/admin/talia_sources_helper.rb +7 -0
  16. data/generators/talia_admin/templates/app/helpers/users_helper.rb +2 -0
  17. data/generators/talia_admin/templates/app/models/guest.rb +7 -0
  18. data/generators/talia_admin/templates/app/models/talia_collection.rb +56 -0
  19. data/generators/talia_admin/templates/app/models/talia_source.rb +43 -0
  20. data/generators/talia_admin/templates/app/models/user.rb +59 -0
  21. data/generators/talia_admin/templates/app/models/user_mailer.rb +14 -0
  22. data/generators/talia_admin/templates/app/viewhints/talia_source_hints.rb +3 -0
  23. data/generators/talia_admin/templates/app/views/admin/custom_templates/index.dryml +7 -0
  24. data/generators/talia_admin/templates/app/views/admin/front/index.dryml +29 -0
  25. data/generators/talia_admin/templates/app/views/admin/front/summary.dryml +103 -0
  26. data/generators/talia_admin/templates/app/views/admin/talia_collections/index.dryml +7 -0
  27. data/generators/talia_admin/templates/app/views/admin/talia_sources/index.dryml +17 -0
  28. data/generators/talia_admin/templates/app/views/admin/talia_sources/show.dryml +8 -0
  29. data/generators/talia_admin/templates/app/views/admin/users/index.dryml +7 -0
  30. data/generators/talia_admin/templates/app/views/taglibs/admin_site.dryml +91 -0
  31. data/generators/talia_admin/templates/app/views/taglibs/application.dryml +9 -0
  32. data/generators/talia_admin/templates/app/views/taglibs/auto/admin/rapid/cards.dryml +34 -0
  33. data/generators/talia_admin/templates/app/views/taglibs/auto/admin/rapid/forms.dryml +71 -0
  34. data/generators/talia_admin/templates/app/views/taglibs/auto/admin/rapid/pages.dryml +543 -0
  35. data/generators/talia_admin/templates/app/views/taglibs/auto/rapid/cards.dryml +37 -0
  36. data/generators/talia_admin/templates/app/views/taglibs/auto/rapid/forms.dryml +35 -0
  37. data/generators/talia_admin/templates/app/views/taglibs/auto/rapid/pages.dryml +175 -0
  38. data/generators/talia_admin/templates/app/views/taglibs/front_site.dryml +1 -0
  39. data/generators/talia_admin/templates/app/views/taglibs/themes/clean/clean.dryml +10 -0
  40. data/generators/talia_admin/templates/app/views/user_mailer/forgot_password.erb +10 -0
  41. data/generators/talia_admin/templates/config/hobo_initializer.rb +1 -0
  42. data/generators/talia_admin/templates/migrations/create_users.rb +22 -0
  43. data/generators/talia_admin/templates/public/hobothemes/clean/images/101-3B5F87-ACD3E6.png +0 -0
  44. data/generators/talia_admin/templates/public/hobothemes/clean/images/30-3E547A-242E42.png +0 -0
  45. data/generators/talia_admin/templates/public/hobothemes/clean/images/30-DBE1E5-FCFEF5.png +0 -0
  46. data/generators/talia_admin/templates/public/hobothemes/clean/images/300-ACD3E6-fff.png +0 -0
  47. data/generators/talia_admin/templates/public/hobothemes/clean/images/50-ACD3E6-fff.png +0 -0
  48. data/generators/talia_admin/templates/public/hobothemes/clean/images/fieldbg.gif +0 -0
  49. data/generators/talia_admin/templates/public/hobothemes/clean/images/pencil.png +0 -0
  50. data/generators/talia_admin/templates/public/hobothemes/clean/images/small_close.png +0 -0
  51. data/generators/talia_admin/templates/public/hobothemes/clean/images/spinner.gif +0 -0
  52. data/generators/talia_admin/templates/public/hobothemes/clean/stylesheets/clean.css +326 -0
  53. data/generators/talia_admin/templates/public/hobothemes/clean/stylesheets/rapid-ui.css +100 -0
  54. data/generators/talia_admin/templates/public/javascripts/IE7.js +2 -0
  55. data/generators/talia_admin/templates/public/javascripts/blank.gif +0 -0
  56. data/generators/talia_admin/templates/public/javascripts/dryml-support.js +132 -0
  57. data/generators/talia_admin/templates/public/javascripts/hobo-rapid.js +937 -0
  58. data/generators/talia_admin/templates/public/javascripts/ie7-recalc.js +166 -0
  59. data/generators/talia_admin/templates/public/javascripts/lowpro.js +43 -25
  60. data/generators/talia_admin/templates/public/stylesheets/application.css +0 -0
  61. data/generators/talia_admin/templates/public/stylesheets/hobo-rapid.css +94 -0
  62. data/generators/talia_admin/templates/public/stylesheets/reset.css +95 -0
  63. data/generators/talia_admin/templates/test/fixtures/users.yml +7 -0
  64. data/generators/talia_admin/templates/test/functional/admin/{custom_templates_controller_test.rb → front_controller_test.rb} +1 -1
  65. data/generators/talia_admin/templates/test/functional/users_controller_test.rb +8 -0
  66. data/generators/talia_admin/templates/test/unit/user_test.rb +8 -0
  67. data/generators/talia_base/talia_base_generator.rb +24 -17
  68. data/generators/talia_oai/USAGE +0 -0
  69. data/generators/talia_oai/talia_oai_generator.rb +19 -0
  70. data/generators/talia_oai/templates/oai_controller.rb +9 -0
  71. data/generators/talia_oai/templates/oai_initializer.rb +16 -0
  72. data/lib/custom_template.rb +24 -0
  73. data/lib/talia_core/active_source_parts/class_methods.rb +1 -1
  74. data/lib/talia_core/active_source_parts/finders.rb +4 -0
  75. data/lib/talia_core/collection.rb +4 -0
  76. data/lib/talia_core/oai/active_source_model.rb +113 -0
  77. data/lib/talia_core/oai/active_source_oai_adapter/class_methods.rb +17 -0
  78. data/lib/talia_core/oai/active_source_oai_adapter.rb +106 -0
  79. data/lib/talia_core/semantic_property.rb +1 -0
  80. data/lib/talia_core/semantic_relation.rb +1 -0
  81. data/test/talia_core/active_source_test.rb +13 -0
  82. metadata +71 -59
  83. data/generators/talia_admin/templates/controllers/admin/background_controller.rb +0 -52
  84. data/generators/talia_admin/templates/controllers/admin/custom_templates_controller.rb +0 -25
  85. data/generators/talia_admin/templates/controllers/admin/locales_controller.rb +0 -15
  86. data/generators/talia_admin/templates/controllers/admin/roles_controller.rb +0 -8
  87. data/generators/talia_admin/templates/controllers/admin/sources_controller.rb +0 -9
  88. data/generators/talia_admin/templates/controllers/admin/translations_controller.rb +0 -61
  89. data/generators/talia_admin/templates/controllers/admin/users_controller.rb +0 -10
  90. data/generators/talia_admin/templates/controllers/admin_controller.rb +0 -7
  91. data/generators/talia_admin/templates/helpers/admin/background_helper.rb +0 -60
  92. data/generators/talia_admin/templates/helpers/admin/custom_templates_helper.rb +0 -5
  93. data/generators/talia_admin/templates/helpers/admin/locales_helper.rb +0 -2
  94. data/generators/talia_admin/templates/helpers/admin/roles_helper.rb +0 -2
  95. data/generators/talia_admin/templates/helpers/admin/sources_helper.rb +0 -65
  96. data/generators/talia_admin/templates/helpers/admin/translations_helper.rb +0 -51
  97. data/generators/talia_admin/templates/helpers/admin/users_helper.rb +0 -11
  98. data/generators/talia_admin/templates/helpers/admin_helper.rb +0 -30
  99. data/generators/talia_admin/templates/migrations/populate_users.rb +0 -14
  100. data/generators/talia_admin/templates/models/role.rb +0 -3
  101. data/generators/talia_admin/templates/public/javascripts/backend.js +0 -24
  102. data/generators/talia_admin/templates/public/stylesheets/talia_core/backend.css +0 -463
  103. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/body_bg.gif +0 -0
  104. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/footer_bg.gif +0 -0
  105. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/header.jpg +0 -0
  106. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/header_bg.gif +0 -0
  107. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/menu.jpg +0 -0
  108. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/menu_bg.gif +0 -0
  109. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/opednid.gif +0 -0
  110. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/page_bg.jpg +0 -0
  111. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/triangolino.gif +0 -0
  112. data/generators/talia_admin/templates/public/stylesheets/talia_core/images/backend/triangolino_full.gif +0 -0
  113. data/generators/talia_admin/templates/test/functional/admin/locales_controller_test.rb +0 -35
  114. data/generators/talia_admin/templates/test/functional/admin/sources_controller_test.rb +0 -109
  115. data/generators/talia_admin/templates/test/functional/admin/translations_controller_test.rb +0 -93
  116. data/generators/talia_admin/templates/test/functional/admin/users_controller_test.rb +0 -67
  117. data/generators/talia_admin/templates/test/functional/admin_controller_test.rb +0 -15
  118. data/generators/talia_admin/templates/views/admin/background/_finished.html.erb +0 -9
  119. data/generators/talia_admin/templates/views/admin/background/_pending.html.erb +0 -1
  120. data/generators/talia_admin/templates/views/admin/background/_progress.html.erb +0 -15
  121. data/generators/talia_admin/templates/views/admin/background/_running.html.erb +0 -11
  122. data/generators/talia_admin/templates/views/admin/background/environment.html.erb +0 -12
  123. data/generators/talia_admin/templates/views/admin/background/show.html.erb +0 -17
  124. data/generators/talia_admin/templates/views/admin/background/stderr.html.erb +0 -6
  125. data/generators/talia_admin/templates/views/admin/background/stdin.html.erb +0 -6
  126. data/generators/talia_admin/templates/views/admin/background/stdout.html.erb +0 -6
  127. data/generators/talia_admin/templates/views/admin/custom_templates/_content_form_column.rhtml +0 -2
  128. data/generators/talia_admin/templates/views/admin/custom_templates/_template_type_form_column.rhtml +0 -2
  129. data/generators/talia_admin/templates/views/admin/index.html.erb +0 -5
  130. data/generators/talia_admin/templates/views/admin/locales/new.html.erb +0 -9
  131. data/generators/talia_admin/templates/views/admin/sources/_show.html.erb +0 -13
  132. data/generators/talia_admin/templates/views/admin/translations/_new_translation.html.erb +0 -7
  133. data/generators/talia_admin/templates/views/admin/translations/_translation.html.erb +0 -10
  134. data/generators/talia_admin/templates/views/admin/translations/edit.html.erb +0 -16
  135. data/generators/talia_admin/templates/views/layouts/admin.html.erb +0 -56
  136. data/generators/talia_base/templates/script/setup_talia_backend +0 -43
@@ -0,0 +1,166 @@
1
+
2
+ // =========================================================================
3
+ // ie7-recalc.js
4
+ // =========================================================================
5
+
6
+ (function() {
7
+ /* ---------------------------------------------------------------------
8
+
9
+ This allows refreshing of IE7 style rules. If you modify the DOM
10
+ you can update IE7 by calling document.recalc().
11
+
12
+ This should be the LAST module included.
13
+
14
+ --------------------------------------------------------------------- */
15
+
16
+ if (!IE7.loaded) return;
17
+
18
+ // remove all IE7 classes from an element
19
+ CLASSES = /\sie7_class\d+/g;
20
+
21
+ IE7.CSS.extend({
22
+ // store for elements that have style properties calculated
23
+ elements: {},
24
+ handlers: [],
25
+
26
+ // clear IE7 classes and styles
27
+ reset: function() {
28
+ this.removeEventHandlers();
29
+ // reset IE7 classes here
30
+ var elements = this.elements;
31
+ for (var i in elements) elements[i].runtimeStyle.cssText = "";
32
+ this.elements = {};
33
+ // reset runtimeStyle here
34
+ var elements = IE7.Rule.elements;
35
+ for (var i in elements) {
36
+ with (elements[i]) className = className.replace(CLASSES, "");
37
+ }
38
+ IE7.Rule.elements = {};
39
+ },
40
+
41
+ reload: function() {
42
+ this.rules = [];
43
+ this.getInlineStyles();
44
+ this.screen.load();
45
+ if (this.print) this.print.load();
46
+ this.refresh();
47
+ this.trash();
48
+ },
49
+
50
+ addRecalc: function(propertyName, test, handler, replacement) {
51
+ // call the ancestor method to add a wrapped recalc method
52
+ this.base(propertyName, test, function(element) {
53
+ // execute the original recalc method
54
+ handler(element);
55
+ // store a reference to this element so we can clear its style later
56
+ IE7.CSS.elements[element.uniqueID] = element;
57
+ }, replacement);
58
+ },
59
+
60
+ recalc: function() {
61
+ // clear IE7 styles and classes
62
+ this.reset();
63
+ // execute the ancestor method to perform recalculations
64
+ this.base();
65
+ },
66
+
67
+ addEventHandler: function(element, type, handler) {
68
+ element.attachEvent(type, handler);
69
+ // store the handler so it can be detached later
70
+ this.handlers.push(arguments);
71
+ },
72
+
73
+ removeEventHandlers: function() {
74
+ var handler;
75
+ while (handler = this.handlers.pop()) {
76
+ handler[0].detachEvent(handler[1], handler[2]);
77
+ }
78
+ },
79
+
80
+ getInlineStyles: function() {
81
+ // load inline styles
82
+ var styleSheets = document.getElementsByTagName("style"), styleSheet;
83
+ for (var i = styleSheets.length - 1; (styleSheet = styleSheets[i]); i--) {
84
+ if (!styleSheet.disabled && !styleSheet.ie7) {
85
+ var cssText = styleSheet.cssText || styleSheet.innerHTML;
86
+ this.styles.push(cssText);
87
+ styleSheet.cssText = cssText;
88
+ }
89
+ }
90
+ },
91
+
92
+ trash: function() {
93
+ // trash the old style sheets
94
+ var styleSheets = document.styleSheets, styleSheet, i;
95
+ for (i = 0; i < styleSheets.length; i++) {
96
+ styleSheet = styleSheets[i];
97
+ if (!styleSheet.ie7 && !styleSheet.cssText && styleSheet.cssText != '') {
98
+ styleSheet.cssText = styleSheet.cssText;
99
+ }
100
+ }
101
+ this.base();
102
+ },
103
+
104
+ getText: function(styleSheet) {
105
+ return styleSheet.cssText || this.base(styleSheet);
106
+ }
107
+ });
108
+
109
+ // remove event handlers (they eat memory)
110
+ IE7.CSS.addEventHandler(window, "onunload", function() {
111
+ IE7.CSS.removeEventHandlers();
112
+ });
113
+
114
+ // store all elements with an IE7 class assigned
115
+ IE7.Rule.elements = {};
116
+
117
+ IE7.Rule.prototype.extend({
118
+ add: function(element) {
119
+ // execute the ancestor "add" method
120
+ this.base(element);
121
+ // store a reference to this element so we can clear its classes later
122
+ IE7.Rule.elements[element.uniqueID] = element;
123
+ }
124
+ });
125
+
126
+ // store created pseudo elements
127
+ if (IE7.PseudoElement) {
128
+ IE7.PseudoElement.hash = {};
129
+
130
+ IE7.PseudoElement.prototype.extend({
131
+ create: function(target) {
132
+ var key = this.selector + ":" + target.uniqueID;
133
+ if (!IE7.PseudoElement.hash[key]) {
134
+ IE7.PseudoElement.hash[key] = true;
135
+ this.base(target);
136
+ }
137
+ }
138
+ });
139
+ }
140
+
141
+ IE7.HTML.extend({
142
+ elements: {},
143
+
144
+ addRecalc: function(selector, handler) {
145
+ // call the ancestor method to add a wrapped recalc method
146
+ this.base(selector, function(element) {
147
+ if (!this.elements[element.uniqueID]) {
148
+ // execute the original recalc method
149
+ handler(element);
150
+ // store a reference to this element so that
151
+ // it is not "fixed" again
152
+ this.elements[element.uniqueID] = element;
153
+ }
154
+ });
155
+ }
156
+ });
157
+
158
+ // allow refreshing of IE7 fixes
159
+ document.recalc = function(reload) {
160
+ if (IE7.CSS.screen) {
161
+ if (reload) IE7.CSS.reload();
162
+ IE7.recalc();
163
+ }
164
+ };
165
+
166
+ })();
@@ -1,10 +1,8 @@
1
- //= require <prototype>
2
-
3
1
  LowPro = {};
4
2
  LowPro.Version = '0.5';
5
3
  LowPro.CompatibleWithPrototype = '1.6';
6
4
 
7
- if (Prototype.Version.indexOf(LowPro.CompatibleWithPrototype) != 0 && console && console.warn)
5
+ if (Prototype.Version.indexOf(LowPro.CompatibleWithPrototype) != 0 && window.console && window.console.warn)
8
6
  console.warn("This version of Low Pro is tested with Prototype " + LowPro.CompatibleWithPrototype +
9
7
  " it may not work as expected with this version (" + Prototype.Version + ")");
10
8
 
@@ -17,19 +15,19 @@ DOM = {};
17
15
  // DOMBuilder for prototype
18
16
  DOM.Builder = {
19
17
  tagFunc : function(tag) {
20
- return function() {
21
- var attrs, children;
22
- if (arguments.length>0) {
23
- if (arguments[0].nodeName ||
24
- typeof arguments[0] == "string")
25
- children = arguments;
26
- else {
27
- attrs = arguments[0];
28
- children = Array.prototype.slice.call(arguments, 1);
29
- };
30
- }
31
- return DOM.Builder.create(tag, attrs, children);
32
- };
18
+ return function() {
19
+ var attrs, children;
20
+ if (arguments.length>0) {
21
+ if (arguments[0].constructor == Object) {
22
+ attrs = arguments[0];
23
+ children = Array.prototype.slice.call(arguments, 1);
24
+ } else {
25
+ children = arguments;
26
+ };
27
+ children = $A(children).flatten()
28
+ }
29
+ return DOM.Builder.create(tag, attrs, children);
30
+ };
33
31
  },
34
32
  create : function(tag, attrs, children) {
35
33
  attrs = attrs || {}; children = children || []; tag = tag.toLowerCase();
@@ -111,6 +109,14 @@ Event.addBehavior = function(rules) {
111
109
 
112
110
  };
113
111
 
112
+ Event.delegate = function(rules) {
113
+ return function(e) {
114
+ var element = $(e.element());
115
+ for (var selector in rules)
116
+ if (element.match(selector)) return rules[selector].apply(this, $A(arguments));
117
+ }
118
+ }
119
+
114
120
  Object.extend(Event.addBehavior, {
115
121
  rules : {}, cache : [],
116
122
  reassignAfterAjax : false,
@@ -121,12 +127,12 @@ Object.extend(Event.addBehavior, {
121
127
  var observer = rules[selector];
122
128
  var sels = selector.split(',');
123
129
  sels.each(function(sel) {
124
- var parts = sel.split(/:(?=[a-z]+$)/), css = parts[0], event = parts[1];
130
+ var match = sel.match(/^([^:]*)(?::(.*)$)?/), css = match[1], event = match[2];
125
131
  $$(css).each(function(element) {
126
132
  if (event) {
127
- observer = Event.addBehavior._wrapObserver(observer);
128
- $(element).observe(event, observer);
129
- Event.addBehavior.cache.push([element, event, observer]);
133
+ var wrappedObserver = Event.addBehavior._wrapObserver(observer);
134
+ $(element).observe(event, wrappedObserver);
135
+ Event.addBehavior.cache.push([element, event, wrappedObserver]);
130
136
  } else {
131
137
  if (!element.$$assigned || !element.$$assigned.include(observer)) {
132
138
  if (observer.attach) observer.attach(element);
@@ -200,7 +206,6 @@ var Behavior = {
200
206
  parent = properties.shift();
201
207
 
202
208
  var behavior = function() {
203
- var behavior = arguments.callee;
204
209
  if (!this.initialize) {
205
210
  var args = $A(arguments);
206
211
 
@@ -247,13 +252,17 @@ var Behavior = {
247
252
  return new this(element, Array.prototype.slice.call(arguments, 1));
248
253
  },
249
254
  _bindEvents : function(bound) {
250
- for (var member in bound)
251
- if (member.match(/^on(.+)/) && typeof bound[member] == 'function')
252
- bound.element.observe(RegExp.$1, Event.addBehavior._wrapObserver(bound[member].bindAsEventListener(bound)));
255
+ for (var member in bound) {
256
+ var matches = member.match(/^on(.+)/);
257
+ if (matches && typeof bound[member] == 'function')
258
+ bound.element.observe(matches[1], Event.addBehavior._wrapObserver(bound[member].bindAsEventListener(bound)));
259
+ }
253
260
  }
254
261
  }
255
262
  };
256
263
 
264
+
265
+
257
266
  Remote = Behavior.create({
258
267
  initialize: function(options) {
259
268
  if (this.element.nodeName == 'FORM') new Remote.Form(this.element, options);
@@ -266,11 +275,19 @@ Remote.Base = {
266
275
  this.options = Object.extend({
267
276
  evaluateScripts : true
268
277
  }, options || {});
278
+
279
+ this._bindCallbacks();
269
280
  },
270
281
  _makeRequest : function(options) {
271
282
  if (options.update) new Ajax.Updater(options.update, options.url, options);
272
283
  else new Ajax.Request(options.url, options);
273
284
  return false;
285
+ },
286
+ _bindCallbacks: function() {
287
+ $w('onCreate onComplete onException onFailure onInteractive onLoading onLoaded onSuccess').each(function(cb) {
288
+ if (Object.isFunction(this.options[cb]))
289
+ this.options[cb] = this.options[cb].bind(this);
290
+ }.bind(this));
274
291
  }
275
292
  }
276
293
 
@@ -318,4 +335,5 @@ Observed = Behavior.create({
318
335
  return (this.options.frequency) ? new Form.Element.Observer(this.element, this.options.frequency, this.callback) :
319
336
  new Form.Element.EventObserver(this.element, this.callback);
320
337
  }
321
- });
338
+ });
339
+
@@ -0,0 +1,94 @@
1
+ /**** Default styling for Rapid ****/
2
+
3
+ #ajax_progress {
4
+ color: gray;
5
+ float: right;
6
+ margin: 20px;
7
+ position: fixed;
8
+ background: white;
9
+ font-family: tahoma, sans-serif;
10
+ display: none;
11
+ z-index: 10;
12
+ }
13
+
14
+ #ajax_progress div {
15
+ margin: 10px;
16
+ padding: 3px;
17
+ /* padding-top: -15px;*/
18
+ }
19
+
20
+ #ajax_progress img {
21
+ padding-left: 6px;
22
+ vertical-align: middle;
23
+ }
24
+
25
+
26
+ /* Scriptaculous Autocompleter ---*/
27
+
28
+ div.completions_popup {
29
+ position:absolute;
30
+ width:250px;
31
+ background-color:white;
32
+ border:1px solid #888;
33
+ margin:0px;
34
+ padding:0px;
35
+ z-index:100;
36
+ }
37
+ div.completions_popup ul {
38
+ list-style-type:none;
39
+ margin:0px;
40
+ padding:0px;
41
+ }
42
+ div.completions_popup ul li.selected { background-color: #ffb;}
43
+ div.completions_popup ul li {
44
+ list-style-type:none;
45
+ display:block;
46
+ margin:0;
47
+ padding:2px;
48
+ cursor:pointer;
49
+ }
50
+
51
+
52
+ .field_list { width:95%; }
53
+ .field_list td { padding: 5px; vertical-align: middle; }
54
+ .field_list td.field_label {
55
+ text-align: left; width: 1px; white-space: nowrap; vertical-align: top;
56
+ padding-top: 10px; padding-bottom: 10px;
57
+ }
58
+ .field_list input[type=text] { width: 100%; }
59
+ .field_list input, .field_list textarea { margin: -2px 0 0 0; }
60
+ .field_list textarea { width: 100%; margin: 0; }
61
+ /*
62
+ td span.in_place_textfield_bhv, td span.in_place_textarea_bhv, td span.in_place_html_textarea_bhv {
63
+ display: block; border: 1px solid #ddd;
64
+ padding: 4px; background: #fafafa;
65
+ }
66
+ */
67
+ table.login-table, table.login-table td {border: none;}
68
+ .login_table td.field_label { vertical-align: middle; }
69
+ /*table.login-table input {font-size: 16px; color: black;}*/
70
+
71
+ input[type=text].wide { width: 100%; }
72
+ textarea { height: 200px; }
73
+ textarea.wide { width: 100%; }
74
+ textarea.tall { height: 350px; }
75
+
76
+ .field_list input.percentage {width: 25px; display: inline; margin-right: 5px; padding: 1px 3px;}
77
+
78
+ /* rails error message */
79
+ .error_messages {
80
+ font-family: "Lucida Grande", arial, sans-serif;
81
+ background: #9d0018;
82
+ border: 1px solid #7a0013;
83
+ padding: 20px;
84
+ color: white;
85
+ margin-bottom: 20px;
86
+ }
87
+ .error_messages h2 {
88
+ text-transform: none;
89
+ letter-spacing: normal;
90
+ color: white;
91
+ }
92
+ .error_messages li {
93
+ margin-left: 20px;
94
+ }
@@ -0,0 +1,95 @@
1
+ /******** Reset default browser CSS styles. *********/
2
+ /* Based on Blueprint */
3
+
4
+ html, body, div, span, applet, object, iframe,
5
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
6
+ a, abbr, acronym, address, big, cite,
7
+ del, dfn, font, img, ins, kbd, q, s, samp,
8
+ small, strike, sub, sup, tt, var,
9
+ dl, dt, dd, ol, ul, li,
10
+ fieldset, form, label, legend,
11
+ table, caption, tbody, tfoot, thead, tr, th, td {
12
+ margin: 0;
13
+ padding: 0;
14
+ border: 0;
15
+ outline: 0;
16
+ font-weight: inherit;
17
+ font-style: inherit;
18
+ font-size: 100%;
19
+ font-family: inherit;
20
+ vertical-align: baseline;
21
+ }
22
+
23
+ code {
24
+ margin: 0;
25
+ padding: 0;
26
+ border: 0;
27
+ outline: 0;
28
+ font-weight: inherit;
29
+ font-style: inherit;
30
+ font-size: 100%;
31
+ vertical-align: baseline;
32
+ }
33
+
34
+ em {
35
+ margin: 0;
36
+ padding: 0;
37
+ border: 0;
38
+ outline: 0;
39
+ font-weight: inherit;
40
+ font-size: 100%;
41
+ font-family: inherit;
42
+ vertical-align: baseline;
43
+ }
44
+
45
+ strong {
46
+ margin: 0;
47
+ padding: 0;
48
+ border: 0;
49
+ outline: 0;
50
+ font-style: inherit;
51
+ font-size: 100%;
52
+ font-family: inherit;
53
+ vertical-align: baseline;
54
+ }
55
+
56
+ /* Remember to define focus styles! */
57
+ :focus {
58
+ outline: 0;
59
+ }
60
+ body {
61
+ line-height: 1;
62
+ color: black;
63
+ background: white;
64
+ }
65
+
66
+ /* Tables still need 'cellspacing="0"' in the markup. */
67
+ table {
68
+ border-collapse: separate;
69
+ border-spacing: 0;
70
+ }
71
+ caption, th, td {
72
+ text-align: left;
73
+ font-weight: normal;
74
+ }
75
+
76
+ /* Remove possible quote marks (") from <q>, <blockquote>. */
77
+ blockquote:before, blockquote:after,
78
+ q:before, q:after {
79
+ content: "";
80
+ }
81
+ blockquote, q {
82
+ quotes: "" "";
83
+ }
84
+
85
+ body {
86
+ font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
87
+ font-size: 12px;
88
+ }
89
+ h1,h2,h3,h4,h5,h6 { font-weight: bold; }
90
+ h1 { font-size: 36px;}
91
+ h2 { font-size: 28px;}
92
+ h3 { font-size: 18px;}
93
+ h4 { font-size: 14px;}
94
+ h5 { font-size: 12px;}
95
+ h6 { font-size: 10px;}
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ # one:
4
+ # column: value
5
+ #
6
+ # two:
7
+ # column: value
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../../test_helper'
2
2
 
3
- class Admin::CustomTemplatesControllerTest < ActionController::TestCase
3
+ class Admin::FrontControllerTest < ActionController::TestCase
4
4
  # Replace this with your real tests.
5
5
  def test_truth
6
6
  assert true
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class UsersControllerTest < ActionController::TestCase
4
+ # Replace this with your real tests.
5
+ def test_truth
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ def test_truth
6
+ assert true
7
+ end
8
+ end
@@ -4,15 +4,23 @@ class TaliaBaseGenerator < Rails::Generator::Base
4
4
 
5
5
  include GeneratorHelpers
6
6
 
7
- def manifest
8
- install_plugin("git://github.com/activescaffold/active_scaffold.git")
9
- install_plugin("git://github.com/timcharper/role_requirement.git")
7
+ def manifest
10
8
 
11
9
  record do |m|
10
+ # Write the routes. Remember that these end up in the file in the reverse order of the calls
11
+ m.rewrite_file 'config/routes.rb', "map.connect ':controller/:action/:id.:format'", "# map.connect ':controller/:action/:id.:format'"
12
+ m.route "# Default semantic dispatch\n map.connect ':dispatch_uri.:format', :controller => 'sources', :action => 'dispatch',\n :requirements => { :dispatch_uri => /[^\\.]+/ }"
13
+ m.route "# Routes for the sources\n map.resources :sources, :requirements => { :id => /.+/ }"
14
+ m.route "# Routes for types\n map.resources :types"
15
+ m.route "map.resources :data_records, :controller => 'source_data'"
16
+ m.route "map.connect 'source_data/:type/:location', :controller => 'source_data',\n :action => 'show_tloc',\n :requirements => { :location => /[^\\/]+/ } # Force the location to match also filenames with points etc."
17
+ m.route "# Routes for the source data\n map.connect 'source_data/:id', :controller => 'source_data',\n :action => 'show'"
18
+ m.route "# Ontologies\n map.resources :ontologies"
19
+ m.route "# Autocomplete on URI\n map.connect 'sources/auto_complete_for_uri', :controller => 'sources', :action => 'auto_complete_for_uri'"
20
+
12
21
  # Some initialization stuff
13
22
  m.directory 'config/initializers'
14
23
  m.file "config/talia_initializer.rb", "config/initializers/talia.rb"
15
- m.file "config/routes.rb", "config/routes.rb", :collision => :ask
16
24
  m.file "talia.sh", "talia.sh", :shebang => '/bin/sh', :chmod => 0755
17
25
  m.file "config/warble.rb", "config/warble.rb"
18
26
 
@@ -20,16 +28,15 @@ class TaliaBaseGenerator < Rails::Generator::Base
20
28
  m.directory 'script'
21
29
  m.file 'script/configure_talia', 'script/configure_talia', :shebang => DEFAULT_SHEBANG, :chmod => 0755
22
30
  m.file 'script/prepare_images', 'script/prepare_images', :shebang => DEFAULT_SHEBANG, :chmod => 0755
23
- m.file 'script/setup_talia_backend', 'script/setup_talia_backend', :shebang => DEFAULT_SHEBANG, :chmod => 0755
24
31
 
25
32
  # The whole app shebang of files
26
- files_in m, 'app'
33
+ m.files_in 'app'
27
34
 
28
35
  # The default ontologies
29
- files_in m, 'ontologies'
36
+ m.files_in 'ontologies'
30
37
 
31
38
  # The whole public dir
32
- files_in m, 'public'
39
+ m.files_in 'public'
33
40
 
34
41
  # Set up the rake tasks, only if we come from a gem
35
42
  if(Gem.source_index.find_name('talia_core').first)
@@ -40,15 +47,15 @@ class TaliaBaseGenerator < Rails::Generator::Base
40
47
  # Add the migrations
41
48
  m.directory 'db/migrate'
42
49
  m.file "migrations/constraint_migration.rb", "db/migrate/constraint_migration.rb"
43
- make_migration m, "create_active_sources.rb"
44
- make_migration m, "create_semantic_relations.rb"
45
- make_migration m, "create_semantic_properties.rb"
46
- make_migration m, "create_data_records.rb"
47
- make_migration m, "create_workflows.rb"
48
- make_migration m, "create_custom_templates.rb"
49
- make_migration m, "upgrade_relations.rb"
50
- make_migration m, "create_progress_jobs.rb"
51
- make_migration m, "bj_migration.rb"
50
+ m.make_migration "create_active_sources.rb"
51
+ m.make_migration "create_semantic_relations.rb"
52
+ m.make_migration "create_semantic_properties.rb"
53
+ m.make_migration "create_data_records.rb"
54
+ m.make_migration "create_workflows.rb"
55
+ m.make_migration "create_custom_templates.rb"
56
+ m.make_migration "upgrade_relations.rb"
57
+ m.make_migration "create_progress_jobs.rb"
58
+ m.make_migration "bj_migration.rb"
52
59
 
53
60
  m.readme 'README'
54
61
  end
File without changes
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/../generator_helpers'
2
+
3
+ class TaliaOaiGenerator < Rails::Generator::Base
4
+
5
+ include GeneratorHelpers
6
+
7
+ def self_dir ; File.dirname(__FILE__) ; end
8
+
9
+ def manifest
10
+ record do |m|
11
+ m.directory 'config/initializers'
12
+ m.file "oai_initializer.rb", "config/initializers/talia_oai.rb"
13
+ m.directory 'app/controllers'
14
+ m.file 'oai_controller.rb', 'app/controllers/oai_controller.rb'
15
+ m.route "map.resources :oai"
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,9 @@
1
+ class OaiController < ApplicationController
2
+ def index
3
+ # Remove controller and action from the options. Rails adds them automatically.
4
+ options = params.delete_if { |k,v| %w{controller action}.include?(k) }
5
+ provider = TaliaOaiProvider.new
6
+ response = provider.process_request(options)
7
+ render :text => response, :content_type => 'text/xml'
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ begin
2
+ require 'oai'
3
+ rescue LoadError
4
+ puts "ERROR: You have enabled the Talia OAI interface, but the OAI library was not found."
5
+ puts "Please do 'gem install oai_talia' to fix this. (Gem is hosted on gemcutter.org)"
6
+ puts
7
+ raise
8
+ end
9
+
10
+ class TaliaOaiProvider < OAI::Provider::Base
11
+ repository_name 'Talia OAI Interface'
12
+ repository_url N::LOCAL.oai.to_s
13
+ record_prefix 'oai:talia'
14
+ admin_email 'root@localhost'
15
+ source_model TaliaCore::Oai::ActiveSourceModel.new
16
+ end
@@ -1,4 +1,28 @@
1
1
  class CustomTemplate < ActiveRecord::Base
2
+ hobo_model # Don't put anything above this
3
+
2
4
  validates_presence_of :name, :content
3
5
  validates_format_of :template_type, :with => /css|xslt/
6
+
7
+ fields do
8
+ name :string
9
+ template_type :string
10
+ content :text
11
+ end
12
+
13
+ def create_permitted?
14
+ acting_user.administrator?
15
+ end
16
+
17
+ def destroy_permitted?
18
+ acting_user.administrator?
19
+ end
20
+
21
+ def update_permitted?
22
+ acting_user.administrator?
23
+ end
24
+
25
+ def view_permitted?(field)
26
+ true
27
+ end
4
28
  end