locomotive_cms 0.0.4 → 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. data/Gemfile +15 -13
  2. data/README.textile +5 -4
  3. data/app/controllers/admin/api_contents_controller.rb +10 -1
  4. data/app/controllers/admin/base_controller.rb +2 -2
  5. data/app/controllers/admin/cross_domain_sessions_controller.rb +7 -4
  6. data/app/controllers/admin/current_sites_controller.rb +2 -0
  7. data/app/controllers/admin/imports_controller.rb +13 -19
  8. data/app/controllers/admin/installation_controller.rb +79 -0
  9. data/app/controllers/admin/pages_controller.rb +1 -1
  10. data/app/controllers/admin/passwords_controller.rb +2 -2
  11. data/app/controllers/admin/sessions_controller.rb +2 -2
  12. data/app/controllers/admin/sites_controller.rb +2 -0
  13. data/app/controllers/admin/theme_assets_controller.rb +1 -1
  14. data/app/controllers/application_controller.rb +1 -1
  15. data/app/helpers/admin/assets_helper.rb +0 -6
  16. data/app/helpers/admin/{login_helper.rb → box_helper.rb} +7 -3
  17. data/app/helpers/admin/custom_fields_helper.rb +2 -2
  18. data/app/models/asset_collection.rb +15 -3
  19. data/app/models/content_instance.rb +19 -0
  20. data/app/models/content_type.rb +21 -3
  21. data/app/models/extensions/page/tree.rb +63 -7
  22. data/app/models/page.rb +2 -0
  23. data/app/models/site.rb +15 -3
  24. data/app/uploaders/asset_uploader.rb +1 -1
  25. data/app/uploaders/theme_asset_uploader.rb +12 -1
  26. data/app/uploaders/theme_uploader.rb +19 -0
  27. data/app/views/admin/asset_collections/edit.html.haml +2 -2
  28. data/app/views/admin/asset_collections/new.html.haml +1 -1
  29. data/app/views/admin/assets/_form.html.haml +2 -2
  30. data/app/views/admin/content_types/_form.html.haml +2 -2
  31. data/app/views/admin/content_types/new.html.haml +1 -1
  32. data/app/views/admin/contents/_form.html.haml +2 -2
  33. data/app/views/admin/contents/index.html.haml +1 -1
  34. data/app/views/admin/cross_domain_sessions/new.html.haml +1 -1
  35. data/app/views/admin/current_sites/_form.html.haml +3 -3
  36. data/app/views/admin/current_sites/edit.html.haml +1 -1
  37. data/app/views/admin/errors/no_page.html.haml +1 -0
  38. data/app/views/admin/errors/no_site.html.haml +1 -0
  39. data/app/views/admin/imports/new.html.haml +11 -0
  40. data/app/views/admin/imports/show.html.haml +1 -1
  41. data/app/views/admin/installation/step_1.html.haml +24 -0
  42. data/app/views/admin/installation/step_2.html.haml +26 -0
  43. data/app/views/admin/installation/step_3.html.haml +23 -0
  44. data/app/views/{layouts/admin → admin/layouts}/application.html.haml +0 -0
  45. data/app/views/admin/layouts/box.html.haml +21 -0
  46. data/app/views/admin/layouts/error.html.haml +1 -0
  47. data/app/views/admin/my_accounts/edit.html.haml +1 -1
  48. data/app/views/admin/pages/_form.html.haml +2 -3
  49. data/app/views/admin/pages/_page.html.haml +4 -2
  50. data/app/views/admin/pages/index.html.haml +1 -1
  51. data/app/views/admin/passwords/edit.html.haml +2 -2
  52. data/app/views/admin/passwords/new.html.haml +2 -2
  53. data/app/views/admin/sessions/new.html.haml +2 -2
  54. data/app/views/admin/shared/_head.html.haml +4 -5
  55. data/app/views/admin/shared/menu/_contents.html.haml +1 -1
  56. data/app/views/admin/sites/_form.html.haml +3 -3
  57. data/app/views/admin/snippets/_form.html.haml +2 -2
  58. data/app/views/admin/theme_assets/_form.html.haml +2 -2
  59. data/app/views/admin/theme_assets/index.html.haml +1 -1
  60. data/config/application.rb +1 -3
  61. data/config/assets.yml +96 -0
  62. data/config/environments/development.rb +1 -6
  63. data/config/environments/production.rb +1 -1
  64. data/config/environments/test.rb +1 -5
  65. data/config/initializers/carrierwave.rb +17 -0
  66. data/config/initializers/locomotive.rb +14 -0
  67. data/config/locales/admin_ui_en.yml +33 -1
  68. data/config/locales/admin_ui_fr.yml +34 -1
  69. data/config/locales/default_en.yml +1 -0
  70. data/config/locales/default_fr.yml +1 -0
  71. data/config/locales/flash.en.yml +1 -0
  72. data/config/locales/flash.fr.yml +1 -0
  73. data/config/mongoid.yml +13 -5
  74. data/config/routes.rb +6 -1
  75. data/lib/generators/locomotive/install/install_generator.rb +18 -10
  76. data/lib/generators/locomotive/install/templates/README +23 -13
  77. data/lib/generators/locomotive/install/templates/locomotive.rb +15 -1
  78. data/lib/locomotive/carrierwave.rb +1 -0
  79. data/lib/locomotive/configuration.rb +3 -1
  80. data/lib/locomotive/custom_fields.rb +0 -1
  81. data/lib/locomotive/delayed_job.rb +1 -2
  82. data/lib/locomotive/engine.rb +24 -7
  83. data/lib/locomotive/heroku.rb +1 -0
  84. data/lib/locomotive/httparty/webservice.rb +12 -1
  85. data/lib/locomotive/import.rb +2 -0
  86. data/lib/locomotive/import/asset_collections.rb +40 -8
  87. data/lib/locomotive/import/assets.rb +20 -12
  88. data/lib/locomotive/import/base.rb +46 -0
  89. data/lib/locomotive/import/content_types.rb +51 -15
  90. data/lib/locomotive/import/job.rb +106 -11
  91. data/lib/locomotive/import/logger.rb +13 -0
  92. data/lib/locomotive/import/pages.rb +79 -26
  93. data/lib/locomotive/import/site.rb +3 -5
  94. data/lib/locomotive/import/snippets.rb +6 -8
  95. data/lib/locomotive/inherited_resources.rb +1 -0
  96. data/lib/locomotive/liquid/drops/asset_collections.rb +4 -4
  97. data/lib/locomotive/liquid/drops/contents.rb +21 -16
  98. data/lib/locomotive/liquid/drops/page.rb +4 -0
  99. data/lib/locomotive/liquid/filters/html.rb +15 -29
  100. data/lib/locomotive/liquid/tags/consume.rb +1 -1
  101. data/lib/locomotive/liquid/tags/nav.rb +48 -17
  102. data/lib/locomotive/liquid/tags/paginate.rb +3 -3
  103. data/lib/locomotive/middlewares/fonts.rb +3 -11
  104. data/lib/locomotive/misc_form_builder.rb +2 -7
  105. data/lib/locomotive/railties/tasks.rake +16 -0
  106. data/lib/locomotive/regexps.rb +1 -1
  107. data/lib/locomotive/render.rb +9 -3
  108. data/lib/locomotive/routing/site_dispatcher.rb +10 -6
  109. data/lib/locomotive/version.rb +1 -1
  110. data/public/images/admin/box/buttons/right_bg.png +0 -0
  111. data/public/javascripts/admin/aloha/VERSION.txt +1 -1
  112. data/public/javascripts/admin/aloha/aloha-nodeps.js +140 -101
  113. data/public/javascripts/admin/aloha/aloha.js +193 -105
  114. data/public/javascripts/admin/aloha/css/aloha.css +65 -4
  115. data/public/javascripts/admin/aloha/deps/prettyPhoto/resources/css/prettyPhoto.css +2 -2
  116. data/public/javascripts/admin/aloha/i18n/de.dict +2 -0
  117. data/public/javascripts/admin/aloha/i18n/en.dict +2 -0
  118. data/public/javascripts/admin/aloha/i18n/pl.dict +5 -0
  119. data/public/javascripts/admin/aloha/images/base.png +0 -0
  120. data/public/javascripts/admin/aloha/images/base_big.png +0 -0
  121. data/public/javascripts/admin/aloha/images/base_multi.png +0 -0
  122. data/public/javascripts/admin/aloha/images/fade_in.png +0 -0
  123. data/public/javascripts/admin/aloha/images/fade_out.png +0 -0
  124. data/public/javascripts/admin/aloha/images/gentics_logo.png +0 -0
  125. data/public/javascripts/admin/aloha/images/grabhandle.png +0 -0
  126. data/public/javascripts/admin/aloha/images/maximize.png +0 -0
  127. data/public/javascripts/admin/aloha/images/pin.png +0 -0
  128. data/public/javascripts/admin/aloha/images/removeformat.png +0 -0
  129. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.css +86 -0
  130. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.html +44 -0
  131. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/de.dict +4 -0
  132. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/en.dict +4 -0
  133. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/fr.dict +4 -0
  134. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/plugin.js +1 -0
  135. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/product.js +1 -0
  136. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/2xu-wetsuit.jpg +0 -0
  137. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/asics-noosa.jpg +0 -0
  138. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/fivefingers-kso.jpg +0 -0
  139. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/kuota-kueen-k.jpg +0 -0
  140. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/mizuno-wave-musha2.jpg +0 -0
  141. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product.css +69 -0
  142. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product_button.gif +0 -0
  143. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/simplon-mrt.jpg +0 -0
  144. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trek-fuel-ex.jpg +0 -0
  145. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trisports.jpg +0 -0
  146. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/zoggs-predator.jpg +0 -0
  147. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/de.dict +0 -0
  148. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/en.dict +0 -0
  149. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fi.dict +0 -0
  150. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fr.dict +0 -0
  151. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/it.dict +0 -0
  152. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/plugin.js +0 -0
  153. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.css +48 -0
  154. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.html +69 -0
  155. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/de.dict +4 -0
  156. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/en.dict +4 -0
  157. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/plugin.js +7 -0
  158. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/i18n/pl.dict +30 -0
  159. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js +1 -1
  160. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.HighlightEditables/plugin.js +1 -1
  161. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/LinkList.js +7 -0
  162. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/delicious.js +7 -0
  163. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/i18n/pl.dict +4 -0
  164. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/plugin.js +1 -1
  165. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/css/LinkChecker.css +14 -0
  166. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.css +49 -0
  167. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.html +82 -0
  168. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/i18n/en.dict +27 -0
  169. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/plugin.js +7 -0
  170. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/proxy.php +235 -0
  171. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.List/plugin.js +1 -1
  172. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/plugin.js +7 -0
  173. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/wordpastehandler.js +7 -0
  174. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/de.dict +1 -0
  175. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/en.dict +1 -0
  176. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/plugin.js +1 -1
  177. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/de.dict +2 -0
  178. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/en.dict +2 -0
  179. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/pl.dict +12 -0
  180. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/plugin.js +1 -1
  181. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/table.css +28 -110
  182. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_green.png +0 -0
  183. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_red.png +0 -0
  184. data/public/javascripts/admin/asset_collections.js +11 -7
  185. data/public/javascripts/admin/contents.js +3 -1
  186. data/public/javascripts/admin/site.js +9 -3
  187. data/public/javascripts/admin/snippets.js +1 -1
  188. data/public/javascripts/admin/utils.js +5 -3
  189. data/public/stylesheets/admin/application.css +1 -1
  190. data/public/stylesheets/admin/box.css +5 -5
  191. data/public/stylesheets/admin/buttons.css +0 -5
  192. data/public/stylesheets/admin/formtastic_changes.css +5 -12
  193. data/public/stylesheets/admin/inline_editor.css +22 -5
  194. data/public/stylesheets/admin/installation.css +50 -0
  195. data/public/stylesheets/admin/layout.css +9 -4
  196. data/public/stylesheets/admin/safari.css +15 -0
  197. metadata +188 -131
  198. data/app/controllers/home_controller.rb +0 -7
  199. data/app/views/admin/snippets/index.html.haml +0 -15
  200. data/app/views/home/show.html.haml +0 -4
  201. data/app/views/layouts/admin/box.html.haml +0 -19
  202. data/app/views/layouts/application.html.haml +0 -7
  203. data/lib/generators/locomotive/copy_assets/copy_assets_generator.rb +0 -14
  204. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/de.dict +0 -2
  205. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/en.dict +0 -2
  206. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/eo.dict +0 -2
  207. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fi.dict +0 -2
  208. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fr.dict +0 -2
  209. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/it.dict +0 -2
  210. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/plugin.js +0 -7
  211. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/de.dict +0 -20
  212. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/en.dict +0 -20
  213. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/eo.dict +0 -16
  214. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fi.dict +0 -20
  215. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fr.dict +0 -16
  216. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/it.dict +0 -20
  217. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/plugin.js +0 -7
  218. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/css/jquery.autocomplete.css +0 -48
  219. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/deps/jquery.autocomplete.js +0 -1
  220. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressource.js +0 -7
  221. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourcedummy.js +0 -7
  222. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourceregistry.js +0 -7
  223. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Loader/plugin.js +0 -1
  224. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/en.dict +0 -2
  225. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fi.dict +0 -2
  226. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fr.dict +0 -2
  227. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/person.css +0 -3
  228. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/plugin.js +0 -1
  229. data/public/javascripts/admin/aloha/plugins/simpletable/plugin.js.deactivated +0 -2330
@@ -1,7 +0,0 @@
1
- class HomeController < ApplicationController
2
-
3
- def show; end
4
-
5
- def unknown; end
6
-
7
- end
@@ -1,15 +0,0 @@
1
- - title t('.title')
2
-
3
- - content_for :submenu do
4
- = render 'admin/shared/menu/settings'
5
-
6
- - content_for :buttons do
7
- = admin_button_tag :new, new_admin_snippet_url, :class => 'new'
8
-
9
- %p!= t('.help')
10
-
11
- - if @snippets.empty?
12
- %p.no-items!= t('.no_items', :url => new_admin_snippet_url)
13
- - else
14
- %ul#snippets-list.list
15
- = render @snippets
@@ -1,4 +0,0 @@
1
- %h2 Locomotive rocks !!!
2
-
3
- %p
4
- = flash[:error]
@@ -1,19 +0,0 @@
1
- !!! XML
2
- !!!
3
- %html{ :xmlns => 'http://www.w3.org/1999/xhtml' }
4
- %head
5
- %title= escape_once("#{Locomotive.config.name} &mdash; #{current_site.name}")
6
-
7
- = javascript_include_tag 'admin/jquery'
8
-
9
- = stylesheet_link_tag 'admin/blueprint/screen', 'admin/box', :media => 'screen', :cache => Rails.env.production? && !Locomotive.config.heroku
10
- / [if IE]
11
- = stylesheet_link_tag('admin/blueprint/ie', :media => 'screen')
12
-
13
- %body
14
- #wrapper
15
- #light.container
16
- #panel.container
17
- %h1= title
18
-
19
- = yield
@@ -1,7 +0,0 @@
1
- !!! XML
2
- !!!
3
- %html{ :xmlns => 'http://www.w3.org/1999/xhtml' }
4
- %head
5
- %body
6
- %h1 Welcome to Locomotive
7
- = yield
@@ -1,14 +0,0 @@
1
- module Locomotive
2
- class CopyAssetsGenerator < Rails::Generators::Base
3
-
4
- def self.source_root
5
- @_locomotive_source_root ||= File.expand_path('../../../../../', __FILE__)
6
- @_locomotive_source_root
7
- end
8
-
9
- def copy_public_files
10
- directory 'public', 'public', :recursive => true
11
- end
12
-
13
- end
14
- end
@@ -1,2 +0,0 @@
1
- button.person.tooltip=Person hinzufügen
2
- button.event.tooltip=Event hinzufügen
@@ -1,2 +0,0 @@
1
- button.person.tooltip=Add Person
2
- button.event.tooltip=Add Event
@@ -1,2 +0,0 @@
1
- button.person.tooltip=Aldoni personon
2
- button.event.tooltip=Aldoni eventon
@@ -1,2 +0,0 @@
1
- button.person.tooltip=Lisää henkilö
2
- button.event.tooltip=Lisää tapahtuma
@@ -1,2 +0,0 @@
1
- button.person.tooltip=Ajouter une personne
2
- button.event.tooltip=Ajouter un événement
@@ -1,2 +0,0 @@
1
- button.person.tooltip=Aggiungi persona
2
- button.event.tooltip=Aggiungi evento
@@ -1,7 +0,0 @@
1
- /*
2
- * Aloha Editor
3
- * Author & Copyright (c) 2010 Gentics Software GmbH
4
- * aloha-sales@gentics.com
5
- * Licensed unter the terms of http://www.aloha-editor.com/license.html
6
- */
7
- if(typeof EXAMPLE=="undefined"||!EXAMPLE){var EXAMPLE={}}EXAMPLE.DummyDCPlugin=new GENTICS.Aloha.Plugin("com.example.aloha.DummyDC");EXAMPLE.DummyDCPlugin.languages=["en","de","eo","fi","fr","it"];EXAMPLE.DummyDCPlugin.init=function(){GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addPerson",size:"small",tooltip:this.i18n("button.person.tooltip")}),GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.insert"),1);GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addEvent",size:"small",tooltip:this.i18n("button.event.tooltip")}),GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.insert"),1)};
@@ -1,20 +0,0 @@
1
- restcall.savepage = Seite speichern
2
- restcall.savepage.error = Beim Speichern der Seite ist ein Fehler aufgetreten!
3
- button.language = Sprache
4
- button.page=Seite
5
- button.preview=Vorschau
6
- button.edit=Bearbeiten
7
- button.livepreview=Live Vorschau
8
- button.properties=Eigenschaften
9
- button.objectproperties=Objekt Eigenschaften
10
- button.timemanagement=Zeitmanagement
11
- button.cancel=Abbrechen
12
- button.quit=Beenden
13
- button.save=Speichern
14
- button.publish=Veröffentlichen
15
- button.publishat=Veröffentlichen am...
16
- insert_tag=Tag einfügen
17
- restcall.createtag.error = Beim Erstellen eines neuen Tags ist ein Fehler aufgetreten!
18
- restcall.reloadtag.error = Beim Aktualisieren eines Tags ist ein Fehler aufgetreten!
19
- confirm.editable.modified = Die Seite wurde geändert! Möchten Sie die Änderungen jetzt speichern?
20
- save.progress = Bitte warten, Änderungen werden gespeichert!
@@ -1,20 +0,0 @@
1
- restcall.savepage = Save page
2
- restcall.savepage.error = An error occurred while saving the page!
3
- button.language = Language
4
- button.page=Page
5
- button.preview=Preview
6
- button.edit=Edit
7
- button.livepreview=Live Preview
8
- button.properties=Properties
9
- button.objectproperties=Object Properties
10
- button.timemanagement=Timemanagement
11
- button.cancel=Cancel
12
- button.quit=Quit
13
- button.save=Save
14
- button.publish=Publish
15
- button.publishat=Publish at...
16
- insert_tag=Insert tag
17
- restcall.createtag.error = An error occurred while creating a new tag!
18
- restcall.reloadtag.error = An error occurred while reloading a tag!
19
- confirm.editable.modified = The page has been modified! Do you want to save the changes now?
20
- save.progress = Please wait while changes are saved!
@@ -1,16 +0,0 @@
1
- restcall.savepage = Konservi la pa�on
2
- restcall.savepage.error = Eraro okazis dum konservado de la pa�o
3
- button.language = Lingvo
4
- button.page=Pa�o
5
- button.preview=Anta�vidi
6
- button.edit=Redakti
7
- button.livepreview=Anta�vidi realtempe
8
- button.properties=Propra�oj
9
- button.objectproperties=Propra�oj de la objekto
10
- button.timemanagement=Tempa prizorgado
11
- button.cancel=Nuligi
12
- button.quit=Eliri
13
- button.save=Konservi
14
- button.publish=Publikigi
15
- button.publishat=Publikigi en...
16
- insert_tag=Enmeti etikedon
@@ -1,20 +0,0 @@
1
- restcall.savepage = Tallenna sivu
2
- restcall.savepage.error = Sivun tallennuksessa tapahtui virhe!
3
- button.language = Kieli
4
- button.page=Sivu
5
- button.preview=Esikatselu
6
- button.edit=Muokkaus
7
- button.livepreview=Päivittyvä esikatselu
8
- button.properties=Ominaisuudet
9
- button.objectproperties=Olion ominaisuudet
10
- button.timemanagement=Ajanhallinta
11
- button.cancel=Peruuta
12
- button.quit=Sulje
13
- button.save=Tallenna
14
- button.publish=Julkaise
15
- button.publishat=Julkaise aikaan...
16
- insert_tag=Lisää merkki
17
- restcall.createtag.error = Uuden merkin luonnissa tapahtui virhe!
18
- restcall.reloadtag.error = Merkin uudelleenlatauksessa tapahtui virhe!
19
- confirm.editable.modified = Sivua on muokattu! Haluatko tallentaa muutokset?
20
- save.progress = Odota, muutoksia tallennetaan!
@@ -1,16 +0,0 @@
1
- restcall.savepage = Sauvegarder la page
2
- restcall.savepage.error = Une erreur s'est produite lors de l'enregistrement de la page!
3
- button.language = Langue
4
- button.page=Page
5
- button.preview=Prévisualisé
6
- button.edit=Editer
7
- button.livepreview=Prévisualisation en direct
8
- button.properties=Propriétés
9
- button.objectproperties=Propriétés de l'objet
10
- button.timemanagement=La gestion du temps
11
- button.cancel=Annuler
12
- button.quit=Quitter
13
- button.save=Sauvegarder
14
- button.publish=Publier
15
- button.publishat=Publier sur ...
16
- insert_tag=Insert tag
@@ -1,20 +0,0 @@
1
- restcall.savepage = Salva pagina
2
- restcall.savepage.error = C'è stato un errore durante il salvataggio!
3
- button.language = Lingua
4
- button.page=Pagina
5
- button.preview=Anteprima
6
- button.edit=Modifica
7
- button.livepreview=Anteprima Live
8
- button.properties=Proprietà
9
- button.objectproperties=Properties dell'oggetto
10
- button.timemanagement=Pianificazione tempo
11
- button.cancel=Annulla
12
- button.quit=Esci
13
- button.save=Salva
14
- button.publish=Pubblica
15
- button.publishat=Pubblica alle..
16
- insert_tag=Inserisci tag
17
- restcall.createtag.error = C'è stato un errore durante la creazione del tag!
18
- restcall.reloadtag.error = C'è stato un errore durante il caricamento del tag!
19
- confirm.editable.modified = La pagina è stata modificata! Salvare le modifiche?
20
- save.progress = Attendere il termine del salvataggio!
@@ -1,7 +0,0 @@
1
- /*
2
- * Aloha Editor
3
- * Author & Copyright (c) 2010 Gentics Software GmbH
4
- * aloha-sales@gentics.com
5
- * Licensed unter the terms of http://www.aloha-editor.com/license.html
6
- */
7
- GENTICS.Aloha.GCN=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.GCN");GENTICS.Aloha.GCN.languages=["en","de","fr","eo","fi","it"];GENTICS.Aloha.GCN.maximized=false;GENTICS.Aloha.GCN.buttons={};GENTICS.Aloha.GCN.lastActiveEditable={};GENTICS.Aloha.GCN.backendUrl="../CNPortletapp/";GENTICS.Aloha.GCN.restUrl=GENTICS.Aloha.GCN.backendUrl+"rest";GENTICS.Aloha.GCN.closeLightbox=function(){jQuery.prettyPhoto.close();GENTICS.Aloha.Ribbon.show();if(GENTICS.Aloha.GCN.lastActiveEditable!=undefined){GENTICS.Aloha.GCN.lastActiveEditable.activate();GENTICS.Aloha.GCN.lastActiveEditable.obj.focus()}};GENTICS.Aloha.GCN.init=function(){var that=this;jQuery().prettyPhoto({theme:"light_square",opacity:0.4,markup:'<div class="pp_pic_holder"> <div class="pp_top"> <div class="pp_left"></div> <div class="pp_middle"></div> <div class="pp_right"></div> </div> <div class="pp_content_container"> <div class="pp_left"> <div class="pp_right"> <div class="pp_content"> <div class="pp_fade"> <a href="#" class="pp_expand" title="Expand the image">Expand</a> <div class="pp_loaderIcon"></div> <div class="pp_hoverContainer"> <a class="pp_next" href="#">next</a> <a class="pp_previous" href="#">previous</a> </div> <div id="pp_full_res"></div> <div class="pp_details"> </div> </div> </div> </div> </div> </div> <div class="pp_bottom"> <div class="pp_left"></div> <div class="pp_middle"></div> <div class="pp_right"></div> </div> </div> <div class="pp_overlay"></div> <div class="ppt"></div>'});var maximizeOptions=null;if(this.isGCNFrame()){GENTICS.Aloha.settings.ribbon=false;jQuery("head").append('<link type="text/css" href="'+this.createGCNURL({url:that.settings.stag_prefix,params:{"do":20,url:"lib/css/gui.css"}})+'" rel="stylesheet">');jQuery("body").append('<div style="z-index: 999999; position: absolute; visibility: hidden" class="gentics_submenu" id="nodesubmenu1"> </div>');jQuery("head").append('<script type="text/javascript" src="'+this.createGCNURL({url:this.settings.stag_prefix,params:{"do":20,url:"lib/js/layer.js"}})+'"><\/script>');jQuery("head").append('<script type="text/javascript" src="'+this.createGCNURL({url:this.settings.stag_prefix,params:{"do":20,url:"lib/js/tools.js"}})+'"><\/script>');jQuery("head").append('<script type="text/javascript" src="'+this.createGCNURL({url:this.settings.stag_prefix,params:{"do":20,url:"lib/js/menu1.js"}})+'"><\/script>');if(top.menu){top.menu.location=this.createGCNURL({url:this.settings.stag_prefix,params:{"do":14004,MENU_LAYER:0,ass_pre_flapped:0,aloha:true}})}jQuery("html").click(function(){hide_layer(get_layer("nodesubmenu1"));if(top.menu){top.menu.nodesubmenu1_clicked=false}});jQuery("html").mouseover(function(){if(top.tree&&top.tree.frame_small){top.tree.frame_small()}})}GENTICS.Aloha.GCN.updateFrameUI();jQuery(window).unload(function(){that.restoreFrameUI();if(GENTICS.Aloha.isModified()){if(confirm(GENTICS.Aloha.i18n(GENTICS.Aloha,"confirm_editable_modified"))){that.savePage({silent:true,async:false});return false}}});this.alohaEditables(this.settings.editables);this.alohaBlocks(this.settings.blocks);if(this.settings.welcomeMessages){jQuery.each(this.settings.welcomeMessages,function(index,message){GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:"Gentics Content.Node",text:message.message,type:GENTICS.Aloha.Message.Type.ALERT}))})}if(GENTICS.Aloha.Log.isDebugEnabled()){var editables=0;var blocks=0;if(this.settings.editables){editables=this.settings.editables.length}if(this.settings.blocks){blocks=this.settings.blocks.length}GENTICS.Aloha.Log.debug(this,"Loaded page with id { "+this.settings.id+" }.");GENTICS.Aloha.Log.debug(this,"Found "+editables+" editables and "+blocks+" blocks.")}var pageMenu=new Array();pageMenu.push(new GENTICS.Aloha.ui.Button({label:this.i18n("button.preview"),onclick:function(){that.previewPage()}}));pageMenu.push(new GENTICS.Aloha.ui.Button({label:this.i18n("button.edit"),onclick:function(){that.editPage()}}));pageMenu.push(new GENTICS.Aloha.ui.Button({label:this.i18n("button.livepreview"),onclick:function(){that.savePage({onsuccess:function(){that.openGCNURL({url:that.settings.stag_prefix,popup:true,params:{live:that.settings.id,"do":14001}})},onfailure:function(){},silent:true})}}));var propsBackParam=this.isGCNFrame()?"":'a:3:{s:4:"REDO";s:5:"14012";s:6:"realid";s:'+String(this.settings.id).length+':"'+this.settings.id+'";s:4:"real";s:4:"edit";}';pageMenu.push(new GENTICS.Aloha.ui.Button({label:this.i18n("button.properties"),onclick:function(){that.openGCNURL({url:that.settings.stag_prefix,params:{"do":14000,PAGE_ID:that.settings.id,FOLDER_ID:that.settings.folderId,back:propsBackParam}})}}));var pageButton=new GENTICS.Aloha.ui.Button({label:this.i18n("button.page"),menu:pageMenu});GENTICS.Aloha.Ribbon.addButton(pageButton);if(this.settings.languageMenu&&this.settings.languageMenu.length>0){var menu=Array();jQuery.each(this.settings.languageMenu,function(index,language){menu.push(new GENTICS.Aloha.ui.Button({label:language.name,icon:that.createGCNURL({url:that.settings.stag_prefix,params:{"do":14203,base:"doc_hi.png",lang:language.code,module:"content"}}),onclick:function(){that.openGCNURL({url:that.settings.stag_prefix,params:{"do":14015,t_type:10007,redo:14001,CONTENTGROUP_ID:language.id}})}}))});GENTICS.Aloha.Ribbon.addButton(new GENTICS.Aloha.ui.Button({label:this.i18n("button.language"),menu:menu}))}var publishParams=this.isGCNFrame()?{"do":14003,cmd:"pub"}:{"do":14012,realid:this.settings.id,real:"pub"};var publishAtParams=this.isGCNFrame()?{"do":14021}:{"do":14021,PAGE_ID:this.settings.id,FOLDER_ID:this.settings.folderId,back:propsBackParam};var saveButtonMenu=Array();saveButtonMenu.push(new GENTICS.Aloha.ui.Button({label:this.i18n("button.publish"),onclick:function(){that.openGCNURL({url:that.settings.stag_prefix,params:publishParams})}}));if(this.isGCNFrame()){saveButtonMenu.push(new GENTICS.Aloha.ui.Button({label:this.i18n("button.publishat"),onclick:function(){that.openGCNURL({url:that.settings.stag_prefix,params:publishAtParams})}}))}var saveButton=new GENTICS.Aloha.ui.Button({label:this.i18n("button.save"),onclick:function(){that.savePage()},menu:saveButtonMenu});GENTICS.Aloha.Ribbon.addButton(saveButton);if(GENTICS.Aloha.settings.readonly){GENTICS.Aloha.Ribbon.addButton(new GENTICS.Aloha.ui.Button({label:this.i18n("button.quit"),onclick:function(){that.quitEdit()}}))}else{var cancelButton=new GENTICS.Aloha.ui.Button({label:this.i18n("button.cancel"),onclick:function(){that.cancelEdit(function(){that.previewPage()})},menu:[new GENTICS.Aloha.ui.Button({label:this.i18n("button.quit"),onclick:function(){that.quitEdit()}})]});GENTICS.Aloha.Ribbon.addButton(cancelButton)}if(this.isGCNFrame()){GENTICS.Aloha.Ribbon.hide()}GENTICS.Aloha.Ribbon.setIcon("GENTICS_logo");var contentTagsMenu=new Array();var constructs=new Array();if(this.settings.constructCategories){for(var i=0;i<this.settings.constructCategories.length;i++){constructs=new Array();for(var j=0;j<this.settings.constructCategories[i].constructs.length;j++){constructs.push(new GENTICS.Aloha.ui.Button({label:this.settings.constructCategories[i].constructs[j].name,icon:this.createGCNURL({url:that.settings.stag_prefix,params:{"do":11,img:"constr/"+this.settings.constructCategories[i].constructs[j].icon,module:"content"}}),constructId:this.settings.constructCategories[i].constructs[j].id,onclick:function(){that.createTag(this.constructId)}}))}contentTagsMenu.push(new GENTICS.Aloha.ui.Button({label:this.settings.constructCategories[i].name,icon:this.createGCNURL({url:that.settings.stag_prefix,params:{"do":11,img:"constructopen.gif",module:"content"}}),menu:constructs,onclick:function(){}}))}if(contentTagsMenu.length>0){GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",new GENTICS.Aloha.ui.Button({tooltip:this.i18n("insert_tag"),icon:this.createGCNURL({url:that.settings.stag_prefix,params:{"do":11,img:"constructopen.gif",module:"content"}}),menu:contentTagsMenu,size:"medium"}),GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.insert"),1)}}GENTICS.Utils.Position.addMouseMoveCallback(function(){if(GENTICS.Aloha.activeEditable){jQuery(".GENTICS_editable_active .GENTICS_editicon:not(.GENTICS_editicon_hover)").fadeIn("fast")}else{jQuery(".GENTICS_editicon:not(.GENTICS_editicon_hover)").show()}});GENTICS.Utils.Position.addMouseStopCallback(function(){if(GENTICS.Aloha.activeEditable){jQuery(".GENTICS_editable_active .GENTICS_editicon:not(.GENTICS_editicon_hover)").fadeOut("normal")}else{jQuery(".GENTICS_editicon:not(.GENTICS_editicon_hover)").fadeOut("normal")}});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableActivated",function(){jQuery(".GENTICS_editicon").fadeOut("normal")})};GENTICS.Aloha.GCN.alohaEditables=function(editables){if(editables){jQuery.each(editables,function(index,editable){jQuery("#"+editable.id).aloha()})}};GENTICS.Aloha.GCN.alohaBlocks=function(blocks){if(blocks){jQuery.each(blocks,function(index,block){jQuery("#"+block.id).addClass("GENTICS_block").attr("contenteditable",false);if(!GENTICS.Aloha.settings.readonly){var imgTag=jQuery("<img>");imgTag.attr("border",0);imgTag.attr("src",block.iconurl);var buttonTag=jQuery("<button>");buttonTag.click(function(){GENTICS.Aloha.GCN.openTagFill(block.tagid)});buttonTag.attr("alt",block.icontitle).attr("title",block.icontitle).addClass("GENTICS_editicon").mouseover(function(){jQuery(this).addClass("GENTICS_editicon_hover")}).mouseout(function(){jQuery(this).removeClass("GENTICS_editicon_hover")}).prepend(imgTag);jQuery("#"+block.id).prepend(buttonTag)}})}};GENTICS.Aloha.GCN.maximizeOptions={fsContent_cols:"0,*,0",frameset0_cols:"315,*",frameset2_rows:"101,*"};GENTICS.Aloha.GCN.toggleEditFrame=function(){if(!top.main){return}if(this.isEditFrameMaximized()){this.normalizeEditFrame()}else{this.maximizeEditFrame()}};GENTICS.Aloha.GCN.normalizeEditFrame=function(){top.main.document.getElementById("fsContent").cols=this.maximizeOptions.fsContent_cols;top.document.getElementsByTagName("frameset")[0].cols=this.maximizeOptions.frameset0_cols;top.document.getElementsByTagName("frameset")[2].rows=this.maximizeOptions.frameset2_rows;this.buttons.maximizeButton.setPressed(false)};GENTICS.Aloha.GCN.maximizeEditFrame=function(){this.maximizeOptions.fsContent_cols=top.main.document.getElementById("fsContent").cols;this.maximizeOptions.frameset0_cols=top.document.getElementsByTagName("frameset")[0].cols;this.maximizeOptions.frameset2_rows=top.document.getElementsByTagName("frameset")[2].rows;top.main.document.getElementById("fsContent").cols="0,*,0";top.document.getElementsByTagName("frameset")[0].cols="0,*";top.document.getElementsByTagName("frameset")[2].rows="0,*";this.buttons.maximizeButton.setPressed(true)};GENTICS.Aloha.GCN.isEditFrameMaximized=function(){if(!this.isGCNFrame()){return false}if(top.document.getElementsByTagName("frameset")[0].cols=="0,*"){return true}else{return false}};GENTICS.Aloha.GCN.isGCNFrame=function(){if(!window.parent){return false}var assistant=jQuery("frame",window.parent.document).eq(0);if(assistant.attr("name")==="ass"){return true}assistant=jQuery("frame",window.parent.document).eq(2);if(assistant.attr("name")==="ass"){return true}return false};GENTICS.Aloha.GCN.updateFrameUI=function(){if(this.isGCNFrame()){var assistantFrameset=jQuery("frameset",window.parent.document);this.originalColumns=assistantFrameset.attr("cols");this.originalRows=assistantFrameset.attr("rows");if(this.originalColumns){assistantFrameset.attr("cols","0,*,0")}if(this.originalRows){assistantFrameset.attr("rows","*,0,0")}var menuFrame=jQuery(window.parent.parent.frames[2].document);menuFrame.find("#ProgressStatusInfo_0").hide()}};GENTICS.Aloha.GCN.restoreFrameUI=function(){if(this.isGCNFrame()){var assistantFrameset=jQuery("frameset",window.parent.document);if(this.originalColumns){assistantFrameset.attr("cols",this.originalColumns)}if(this.originalRows){assistantFrameset.attr("rows",this.originalRows)}}};GENTICS.Aloha.GCN.cancelEdit=function(callback){var that=this;for(var i in GENTICS.Aloha.editables){if(GENTICS.Aloha.editables[i].setUnmodified){GENTICS.Aloha.editables[i].setUnmodified()}}this.performRESTRequest({url:this.settings.stag_prefix+this.restUrl+"/page/cancel/"+this.settings.id,description:"restcall.cancelpage",success:callback,error:function(data){GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:"Gentics Content.Node",text:that.i18n("restcall.cancelpage.error"),type:GENTICS.Aloha.Message.Type.ALERT}))}})};GENTICS.Aloha.GCN.quitEdit=function(){var that=this;if(this.isEditFrameMaximized()){this.normalizeEditFrame()}this.cancelEdit(function(){if(that.settings.backurl){document.location.href=that.settings.backurl}else{if(that.isGCNFrame()){that.openGCNURL({url:that.settings.stag_prefix,params:{"do":13011}})}else{that.openGCNURL({url:that.settings.stag_prefix,params:{"do":14300,close:true}})}}})};GENTICS.Aloha.GCN.previewPage=function(){var that=this;this.openGCNURL({url:this.settings.stag_prefix+this.backendUrl+"/alohapage",params:{realid:that.settings.id,language:that.settings.languageid,real:"view",links:that.settings.links}})};GENTICS.Aloha.GCN.editPage=function(){var that=this;this.openGCNURL({url:this.settings.stag_prefix+this.backendUrl+"/alohapage",params:{realid:that.settings.id,language:that.settings.languageid,real:"edit",links:that.settings.links}})};GENTICS.Aloha.GCN.savePage=function(data){var that=this;if(typeof data=="undefined"){data={}}if(typeof data.async=="undefined"){data.async=true}if(!data.async){var saveProgress=new GENTICS.Aloha.Message({title:"Gentics Content.Node",text:GENTICS.Aloha.i18n(that,"save.progress"),type:GENTICS.Aloha.Message.Type.WAIT});GENTICS.Aloha.showMessage(saveProgress)}var requestBody={unlock:data.closeAfterSave?true:false,page:{id:this.settings.id,templateId:this.settings.templateId,folderId:this.settings.folderId,name:this.settings.name,fileName:this.settings.fileName,description:this.settings.description,priority:this.settings.priority}};requestBody.page.tags={};for(var i=0;i<GENTICS.Aloha.editables.length;++i){var editable=GENTICS.Aloha.editables[i];var gcnEditable=this.findLoadedEditable(editable.getId());if(gcnEditable){var content=editable.getContents();content=content.replace(/<span class=\"GENTICS_block\" id=\"(\w+)\">x<\/span>/g,"<node $1>");if(gcnEditable.metaproperty){if(gcnEditable.metaproperty.indexOf("page.")!=0){continue}var prop=gcnEditable.metaproperty.replace(/^page\./,"");requestBody.page[prop]=content}else{var properties={};if(!requestBody.page.tags[gcnEditable.tagname]){requestBody.page.tags[gcnEditable.tagname]={name:gcnEditable.tagname,active:true,properties:{}}}requestBody.page.tags[gcnEditable.tagname].properties[gcnEditable.partname]={type:"RICHTEXT",stringValue:content}}}else{}}var onsuccess=data?data.onsuccess:undefined;var onfailure=data?data.onfailure:undefined;if(typeof onfailure!="function"){onfailure=function(data){GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:"Gentics Content.Node",text:that.i18n("restcall.savepage.error"),type:GENTICS.Aloha.Message.Type.ALERT}))}}var showMessages=data&&data.silent?false:true;this.performRESTRequest({url:this.settings.stag_prefix+this.restUrl+"/page/save/"+this.settings.id,body:requestBody,description:"restcall.savepage",success:function(data){for(var i in GENTICS.Aloha.editables){if(GENTICS.Aloha.editables[i].setUnmodified){GENTICS.Aloha.editables[i].setUnmodified()}}if(typeof saveProgress!="undefined"){GENTICS.Aloha.hideMessage(saveProgress)}if(showMessages&&data.messages){jQuery.each(data.messages,function(index,message){GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:"Gentics Content.Node",text:message.message,type:GENTICS.Aloha.Message.Type.ALERT}))})}if(onsuccess){onsuccess(data)}},error:function(data){if(typeof saveProgress!="undefined"){GENTICS.Aloha.hideMessage(saveProgress)}if(onfailure){onfailure(data)}},async:data.async})};GENTICS.Aloha.GCN.publishPage=function(success){var that=this;this.savePage({onsuccess:function(){var publishParams=success?{"do":14022,page_id:that.settings.id}:(that.isGCNFrame()?{"do":14003,cmd:"pub",PAGE_ID:that.settings.id}:{"do":14012,realid:that.settings.id,real:"pub"});if(success){that.performRESTRequest({url:that.settings.stag_prefix,params:publishParams,success:function(){success.apply()}})}else{that.openGCNURL({url:that.settings.stag_prefix,params:publishParams})}},onfailure:function(){},silent:success?true:false})};GENTICS.Aloha.GCN.publishPageAt=function(){var that=this;this.savePage({onsuccess:function(){var propsBackParam=that.isGCNFrame()?"":'a:3:{s:4:"REDO";s:5:"14012";s:6:"realid";s:'+String(that.settings.id).length+':"'+that.settings.id+'";s:4:"real";s:4:"edit";}';var publishAtParams=that.isGCNFrame()?{"do":14021}:{"do":14021,PAGE_ID:that.settings.id,FOLDER_ID:that.settings.folderId,back:propsBackParam};that.openGCNURL({url:that.settings.stag_prefix,params:publishAtParams})},onfailure:function(){}})};GENTICS.Aloha.GCN.findLoadedEditable=function(id){if(this.settings.editables){for(var i=0;i<this.settings.editables.length;++i){if(this.settings.editables[i].id==id){return this.settings.editables[i]}}}};GENTICS.Aloha.GCN.makeClean=function(obj){if(this.settings.blocks){jQuery.each(this.settings.blocks,function(index,block){obj.find("#"+block.id).replaceWith('<span class="GENTICS_block" id="'+block.tagname+'">x</span>')})}};GENTICS.Aloha.GCN.performRESTRequest=function(data){var that=this;if(!data.type){data.type="POST"}var ajaxObject={type:data.type,dataType:"json",timeout:10000,contentType:"application/json; charset=utf-8",data:jQuery.toJSON(data.body)};ajaxObject.url=data.url+"?sid="+this.settings.sid+"&time="+(new Date()).getTime();if(data.params){for(var paramName in data.params){ajaxObject.url+="&"+paramName+"="+encodeURI(data.params[paramName])}}if(typeof data.async!="undefined"){ajaxObject.async=data.async}if(data.success){ajaxObject.success=data.success}if(data.error){ajaxObject.error=data.error}jQuery.ajax(ajaxObject)};GENTICS.Aloha.GCN.createGCNURL=function(data){var url=data.url+"?sid="+this.settings.sid+"&time="+(new Date()).getTime();for(var paramName in data.params){url+="&"+paramName+"="+encodeURI(data.params[paramName])}return url};GENTICS.Aloha.GCN.openGCNURL=function(data){var url=this.createGCNURL(data);var popup=data.popup;if(this.isEditFrameMaximized()){this.normalizeEditFrame()}this.openURL(url,popup)};GENTICS.Aloha.GCN.openURL=function(url,popup){if(GENTICS.Aloha.isModified()){this.savePage({unlock:false,onsuccess:function(){if(GENTICS.Aloha.Log.isDebugEnabled()){this.log("debug","opening url: "+url)}if(popup){window.open(url)}else{document.location.href=url}},silent:true,async:false})}else{if(GENTICS.Aloha.Log.isDebugEnabled()){this.log("debug","opening url: "+url)}if(popup){window.open(url)}else{document.location.href=url}}};GENTICS.Aloha.GCN.openTagFill=function(tagid){var that=this;GENTICS.Aloha.FloatingMenu.setScope("GENTICS.Aloha.empty");if(GENTICS.Aloha.activeEditable){GENTICS.Aloha.activeEditable.blur();GENTICS.Aloha.Ribbon.hide()}var editdo=10008;var block=this.getBlock(tagid);if(block&&block.editdo){editdo=block.editdo}var tagfillBackParam=this.isGCNFrame()?"":"realid|"+this.settings.id;var editLink=this.createGCNURL({url:this.settings.stag_prefix,params:{"do":editdo,id:tagid,type:"page",keepsid:1,backparam:tagfillBackParam}});if(GENTICS.Aloha.isModified()){this.savePage({onsuccess:function(){GENTICS.Aloha.Ribbon.hide();try{GENTICS.Aloha.activeEditable.blur();GENTICS.Aloha.GCN.lastActiveEditable=GENTICS.Aloha.activeEditable}catch(e){GENTICS.Aloha.GCN.lastActiveEditable=undefined}jQuery.prettyPhoto.open(new Array(editLink+"&iframe=true&width=100%&height=100%"))},unlock:false,silent:true,async:false})}else{GENTICS.Aloha.Ribbon.hide();try{GENTICS.Aloha.activeEditable.blur();GENTICS.Aloha.GCN.lastActiveEditable=GENTICS.Aloha.activeEditable}catch(e){GENTICS.Aloha.GCN.lastActiveEditable=undefined}jQuery.prettyPhoto.open(new Array(editLink+"&iframe=true&width=100%&height=100%"))}};GENTICS.Aloha.GCN.createTag=function(constructId){var that=this;this.performRESTRequest({url:this.settings.stag_prefix+this.restUrl+"/page/newtag/"+this.settings.id,params:{constructId:constructId},description:"restcall.createtag",success:function(data){that.performRESTRequest({url:that.settings.stag_prefix+that.backendUrl+"/alohatag",type:"GET",params:{realid:that.settings.id,real:"edit",template:"<node "+data.tag.name+">",language:that.settings.languageid,links:that.settings.links},success:function(data){that.handleBlock(data,true)},error:function(){GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:"Gentics Content.Node",text:GENTICS.Aloha.i18n(that,"restcall.createtag.error"),type:GENTICS.Aloha.Message.Type.ALERT}))}})}})};GENTICS.Aloha.GCN.getBlock=function(tagid){if(!this.settings.blocks){return false}for(var i=0;i<this.settings.blocks.length;++i){if(this.settings.blocks[i].tagid==tagid){return this.settings.blocks[i]}}return false};GENTICS.Aloha.GCN.reloadBlock=function(tagid){var block=this.getBlock(tagid);var that=this;if(!block){return}this.performRESTRequest({url:this.settings.stag_prefix+this.backendUrl+"/alohatag",type:"GET",params:{realid:that.settings.id,real:"edit",template:"<node "+block.tagname+">",language:that.settings.languageid,links:that.settings.links},success:function(data){that.handleBlock(data,false)},error:function(){GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:"Gentics Content.Node",text:GENTICS.Aloha.i18n(that,"restcall.reloadtag.error"),type:GENTICS.Aloha.Message.Type.ALERT}))}})};GENTICS.Aloha.GCN.handleBlock=function(data,insert){if(this.settings.renderBlockContentURL){data.content=this.renderBlockContent(data.content)}var blockObj=jQuery(data.content);jQuery("#"+blockObj.attr("id")).replaceWith(data.content);if(insert){GENTICS.Aloha.Markup.insertHTMLCode(data.content)}if(data.editables){if(!this.settings.editables){this.settings.editables=new Array()}for(var i=0;i<data.editables.length;++i){this.settings.editables.push(data.editables[i])}this.alohaEditables(data.editables)}if(data.blocks){if(!this.settings.blocks){this.settings.blocks=new Array()}for(var i=0;i<data.blocks.length;++i){this.settings.blocks.push(data.blocks[i])}this.alohaBlocks(data.blocks)}};GENTICS.Aloha.GCN.renderBlockContent=function(content){var that=this;var newContent=content;jQuery.ajax({url:this.settings.renderBlockContentURL,type:"POST",timeout:10000,data:{content:content},dataType:"text",async:false,success:function(data){newContent=data}});return newContent};function cn3_go_list(url){GENTICS.Aloha.GCN.openURL(url)};
@@ -1,48 +0,0 @@
1
- .ac_results {
2
- padding: 0px;
3
- border: 1px solid gray;
4
- background-color: white;
5
- overflow: hidden;
6
- z-index: 99999;
7
- }
8
-
9
- .ac_results ul {
10
- width: 100%;
11
- list-style-position: outside;
12
- list-style: none;
13
- padding: 0;
14
- margin: 0;
15
- }
16
-
17
- .ac_results li {
18
- margin: 0px;
19
- padding: 2px 5px;
20
- cursor: default;
21
- display: block;
22
- /*
23
- if width will be 100% horizontal scrollbar will apear
24
- when scroll mode will be used
25
- */
26
- /*width: 100%;*/
27
- font: menu;
28
- font-size: 12px;
29
- /*
30
- it is very important, if line-height not setted or setted
31
- in relative units scroll will be broken in firefox
32
- */
33
- line-height: 16px;
34
- overflow: hidden;
35
- }
36
-
37
- .ac_loading {
38
- background: white url('indicator.gif') right center no-repeat;
39
- }
40
-
41
- .ac_odd {
42
- background-color: #eee;
43
- }
44
-
45
- .ac_over {
46
- background-color: #B7D6FA;
47
- color: white;
48
- }
@@ -1 +0,0 @@
1
- (function($){$.fn.extend({autocomplete:function(urlOrData,options){var isUrl=typeof urlOrData=="string";options=$.extend({},$.Autocompleter.defaults,{url:isUrl?urlOrData:null,data:isUrl?null:urlOrData,delay:isUrl?$.Autocompleter.defaults.delay:10,max:options&&!options.scroll?10:150},options);options.highlight=options.highlight||function(value){return value};options.formatMatch=options.formatMatch||options.formatItem;return this.each(function(){new $.Autocompleter(this,options)})},result:function(handler){return this.bind("result",handler)},search:function(handler){return this.trigger("search",[handler])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(options){return this.trigger("setOptions",[options])},unautocomplete:function(){return this.trigger("unautocomplete")}});$.Autocompleter=function(input,options){var KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var $input=$(input).attr("autocomplete","off").addClass(options.inputClass);var timeout;var previousValue="";var cache=$.Autocompleter.Cache(options);var hasFocus=0;var lastKeyPressCode;var config={mouseDownOnSelect:false};var select=$.Autocompleter.Select(options,input,selectCurrent,config);var blockSubmit;$.browser.opera&&$(input.form).bind("submit.autocomplete",function(){if(blockSubmit){blockSubmit=false;return false}});$input.bind(($.browser.opera?"keypress":"keydown")+".autocomplete",function(event){hasFocus=1;lastKeyPressCode=event.keyCode;switch(event.keyCode){case KEY.UP:event.preventDefault();if(select.visible()){select.prev()}else{onChange(0,true)}break;case KEY.DOWN:event.preventDefault();if(select.visible()){select.next()}else{onChange(0,true)}break;case KEY.PAGEUP:event.preventDefault();if(select.visible()){select.pageUp()}else{onChange(0,true)}break;case KEY.PAGEDOWN:event.preventDefault();if(select.visible()){select.pageDown()}else{onChange(0,true)}break;case options.multiple&&$.trim(options.multipleSeparator)==","&&KEY.COMMA:case KEY.TAB:case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=true;return false}break;case KEY.ESC:select.hide();break;default:clearTimeout(timeout);timeout=setTimeout(onChange,options.delay);break}}).focus(function(){hasFocus++}).blur(function(){hasFocus=0;if(!config.mouseDownOnSelect){hideResults()}}).click(function(){if(hasFocus++>1&&!select.visible()){onChange(0,true)}}).bind("search",function(){var fn=(arguments.length>1)?arguments[1]:null;function findValueCallback(q,data){var result;if(data&&data.length){for(var i=0;i<data.length;i++){if(data[i].result.toLowerCase()==q.toLowerCase()){result=data[i];break}}}if(typeof fn=="function"){fn(result)}else{$input.trigger("result",result&&[result.data,result.value])}}$.each(trimWords($input.val()),function(i,value){request(value,findValueCallback,findValueCallback)})}).bind("flushCache",function(){cache.flush()}).bind("setOptions",function(){$.extend(options,arguments[1]);if("data" in arguments[1]){cache.populate()}}).bind("unautocomplete",function(){select.unbind();$input.unbind();$(input.form).unbind(".autocomplete")});function selectCurrent(){var selected=select.selected();if(!selected){return false}var v=selected.result;previousValue=v;if(options.multiple){var words=trimWords($input.val());if(words.length>1){var seperator=options.multipleSeparator.length;var cursorAt=$(input).selection().start;var wordAt,progress=0;$.each(words,function(i,word){progress+=word.length;if(cursorAt<=progress){wordAt=i;return false}progress+=seperator});words[wordAt]=v;v=words.join(options.multipleSeparator)}v+=options.multipleSeparator}$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true}function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL){select.hide();return}var currentValue=$input.val();if(!skipPrevCheck&&currentValue==previousValue){return}previousValue=currentValue;currentValue=lastWord(currentValue);if(currentValue.length>=options.minChars){$input.addClass(options.loadingClass);if(!options.matchCase){currentValue=currentValue.toLowerCase()}request(currentValue,receiveData,hideResultsNow)}else{stopLoading();select.hide()}}function trimWords(value){if(!value){return[""]}if(!options.multiple){return[$.trim(value)]}return $.map(value.split(options.multipleSeparator),function(word){return $.trim(value).length?$.trim(word):null})}function lastWord(value){if(!options.multiple){return value}var words=trimWords(value);if(words.length==1){return words[0]}var cursorAt=$(input).selection().start;if(cursorAt==value.length){words=trimWords(value)}else{words=trimWords(value.replace(value.substring(cursorAt),""))}return words[words.length-1]}function autoFill(q,sValue){if(options.autoFill&&(lastWord($input.val()).toLowerCase()==q.toLowerCase())&&lastKeyPressCode!=KEY.BACKSPACE){$input.val($input.val()+sValue.substring(lastWord(previousValue).length));$(input).selection(previousValue.length,previousValue.length+sValue.length)}}function hideResults(){clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200)}function hideResultsNow(){var wasVisible=select.visible();select.hide();clearTimeout(timeout);stopLoading();if(options.mustMatch){$input.search(function(result){if(!result){if(options.multiple){var words=trimWords($input.val()).slice(0,-1);$input.val(words.join(options.multipleSeparator)+(words.length?options.multipleSeparator:""))}else{$input.val("");$input.trigger("result",null)}}})}}function receiveData(q,data){if(data&&data.length&&hasFocus){stopLoading();select.display(data,q);autoFill(q,data[0].value);select.show()}else{hideResultsNow()}}function request(term,success,failure){if(!options.matchCase){term=term.toLowerCase()}var data=cache.load(term);if(data&&data.length){success(term,data)}else{if((typeof options.url=="string")&&(options.url.length>0)){var extraParams={timestamp:+new Date()};$.each(options.extraParams,function(key,param){extraParams[key]=typeof param=="function"?param():param});$.ajax({mode:"abort",port:"autocomplete"+input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max},extraParams),success:function(data){var parsed=options.parse&&options.parse(data)||parse(data);cache.add(term,parsed);success(term,parsed)}})}else{select.emptyList();failure(term)}}}function parse(data){var parsed=[];var rows=data.split("\n");for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){row=row.split("|");parsed[parsed.length]={data:row,value:row[0],result:options.formatResult&&options.formatResult(row,row[0])||row[0]}}}return parsed}function stopLoading(){$input.removeClass(options.loadingClass)}};$.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row){return row[0]},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};$.Autocompleter.Cache=function(options){var data={};var length=0;function matchSubset(s,sub){if(!options.matchCase){s=s.toLowerCase()}var i=s.indexOf(sub);if(options.matchContains=="word"){i=s.toLowerCase().search("\\b"+sub.toLowerCase())}if(i==-1){return false}return i==0||options.matchContains}function add(q,value){if(length>options.cacheLength){flush()}if(!data[q]){length++}data[q]=value}function populate(){if(!options.data){return false}var stMatchSets={},nullData=0;if(!options.url){options.cacheLength=1}stMatchSets[""]=[];for(var i=0,ol=options.data.length;i<ol;i++){var rawValue=options.data[i];rawValue=(typeof rawValue=="string")?[rawValue]:rawValue;var value=options.formatMatch(rawValue,i+1,options.data.length);if(value===false){continue}var firstChar=value.charAt(0).toLowerCase();if(!stMatchSets[firstChar]){stMatchSets[firstChar]=[]}var row={value:value,data:rawValue,result:options.formatResult&&options.formatResult(rawValue)||value};stMatchSets[firstChar].push(row);if(nullData++<options.max){stMatchSets[""].push(row)}}$.each(stMatchSets,function(i,value){options.cacheLength++;add(i,value)})}setTimeout(populate,25);function flush(){data={};length=0}return{flush:flush,add:add,populate:populate,load:function(q){if(!options.cacheLength||!length){return null}if(!options.url&&options.matchContains){var csub=[];for(var k in data){if(k.length>0){var c=data[k];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub.push(x)}})}}return csub}else{if(data[q]){return data[q]}else{if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var c=data[q.substr(0,i)];if(c){var csub=[];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub[csub.length]=x}});return csub}}}}}return null}}};$.Autocompleter.Select=function(options,input,select,config){var CLASSES={ACTIVE:"ac_over"};var listItems,active=-1,data,term="",needsInit=true,element,list;function init(){if(!needsInit){return}element=$("<div/>").hide().addClass(options.resultsClass).css("position","absolute").appendTo(document.body);list=$("<ul/>").appendTo(element).mouseover(function(event){if(target(event).nodeName&&target(event).nodeName.toUpperCase()=="LI"){active=$("li",list).removeClass(CLASSES.ACTIVE).index(target(event));$(target(event)).addClass(CLASSES.ACTIVE)}}).click(function(event){$(target(event)).addClass(CLASSES.ACTIVE);select();input.focus();return false}).mousedown(function(){config.mouseDownOnSelect=true}).mouseup(function(){config.mouseDownOnSelect=false});if(options.width>0){element.css("width",options.width)}needsInit=false}function target(event){var element=event.target;while(element&&element.tagName!="LI"){element=element.parentNode}if(!element){return[]}return element}function moveSelect(step){listItems.slice(active,active+1).removeClass(CLASSES.ACTIVE);movePosition(step);var activeItem=listItems.slice(active,active+1).addClass(CLASSES.ACTIVE);if(options.scroll){var offset=0;listItems.slice(0,active).each(function(){offset+=this.offsetHeight});if((offset+activeItem[0].offsetHeight-list.scrollTop())>list[0].clientHeight){list.scrollTop(offset+activeItem[0].offsetHeight-list.innerHeight())}else{if(offset<list.scrollTop()){list.scrollTop(offset)}}}}function movePosition(step){active+=step;if(active<0){active=listItems.size()-1}else{if(active>=listItems.size()){active=0}}}function limitNumberOfItems(available){return options.max&&options.max<available?options.max:available}function fillList(){list.empty();var max=limitNumberOfItems(data.length);for(var i=0;i<max;i++){if(!data[i]){continue}var formatted=options.formatItem(data[i].data,i+1,max,data[i].value,term);if(formatted===false){continue}var li=$("<li/>").html(options.highlight(formatted,term)).addClass(i%2==0?"ac_even":"ac_odd").appendTo(list)[0];$.data(li,"ac_data",data[i])}listItems=list.find("li");if(options.selectFirst){listItems.slice(0,1).addClass(CLASSES.ACTIVE);active=0}if($.fn.bgiframe){list.bgiframe()}}return{display:function(d,q){init();data=d;term=q;fillList()},next:function(){moveSelect(1)},prev:function(){moveSelect(-1)},pageUp:function(){if(active!=0&&active-8<0){moveSelect(-active)}else{moveSelect(-8)}},pageDown:function(){if(active!=listItems.size()-1&&active+8>listItems.size()){moveSelect(listItems.size()-1-active)}else{moveSelect(8)}},hide:function(){element&&element.hide();listItems&&listItems.removeClass(CLASSES.ACTIVE);active=-1},visible:function(){return element&&element.is(":visible")},current:function(){return this.visible()&&(listItems.filter("."+CLASSES.ACTIVE)[0]||options.selectFirst&&listItems[0])},show:function(){var offset=$(input).offset();element.css({width:typeof options.width=="string"||options.width>0?options.width:$(input).width(),top:offset.top+input.offsetHeight,left:offset.left}).show();if(options.scroll){list.scrollTop(0);list.css({maxHeight:options.scrollHeight,overflow:"auto"});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;listItems.each(function(){listHeight+=this.offsetHeight});var scrollbarsVisible=listHeight>options.scrollHeight;list.css("height",scrollbarsVisible?options.scrollHeight:listHeight);if(!scrollbarsVisible){listItems.width(list.width()-parseInt(listItems.css("padding-left"))-parseInt(listItems.css("padding-right")))}}}},selected:function(){var selected=listItems&&listItems.filter("."+CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);return selected&&selected.length&&$.data(selected[0],"ac_data")},emptyList:function(){list&&list.empty()},unbind:function(){element&&element.remove()}}};$.fn.selection=function(start,end){if(start!==undefined){return this.each(function(){if(this.createTextRange){var selRange=this.createTextRange();if(end===undefined||start==end){selRange.move("character",start);selRange.select()}else{selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select()}}else{if(this.setSelectionRange){this.setSelectionRange(start,end)}else{if(this.selectionStart){this.selectionStart=start;this.selectionEnd=end}}}})}var field=this[0];if(field.createTextRange){var range=document.selection.createRange(),orig=field.value,teststring="<->",textLength=range.text.length;range.text=teststring;var caretAt=field.value.indexOf(teststring);field.value=orig;this.selection(caretAt,caretAt+textLength);return{start:caretAt,end:caretAt+textLength}}else{if(field.selectionStart!==undefined){return{start:field.selectionStart,end:field.selectionEnd}}}}})(jQuery);
@@ -1,7 +0,0 @@
1
- /*
2
- * Aloha Editor
3
- * Author & Copyright (c) 2010 Gentics Software GmbH
4
- * aloha-sales@gentics.com
5
- * Licensed unter the terms of http://www.aloha-editor.com/license.html
6
- */
7
- GENTICS.Aloha.Ressource=function(ressourcePrefix,basePath){this.prefix=ressourcePrefix;this.basePath=basePath?basePath:ressourcePrefix;GENTICS.Aloha.RessourceRegistry.register(this)};GENTICS.Aloha.Ressource.prototype.settings=null;GENTICS.Aloha.Ressource.prototype.init=function(){};GENTICS.Aloha.Ressource.prototype.query=function(attrs){return null};GENTICS.Aloha.Ressource.prototype.resolveRessource=function(obj){return null};
@@ -1,7 +0,0 @@
1
- /*
2
- * Aloha Editor
3
- * Author & Copyright (c) 2010 Gentics Software GmbH
4
- * aloha-sales@gentics.com
5
- * Licensed unter the terms of http://www.aloha-editor.com/license.html
6
- */
7
- GENTICS.Aloha.Ressources.Dummy=new GENTICS.Aloha.Ressource("com.gentics.aloha.resources.Dummy");GENTICS.Aloha.Ressources.Dummy.init=function(){var data=[{id:1,text:"Link A",url:"/page1"},{id:2,text:"Link B",url:"/page2"},{id:3,text:"Link C",url:"/page3"},{id:4,text:"Link D",url:"/page4"}]};GENTICS.Aloha.Ressources.Dummy.query=function(attrs){return this.data};GENTICS.Aloha.Ressources.Dummy.resolve=function(obj){return null};
@@ -1,7 +0,0 @@
1
- /*
2
- * Aloha Editor
3
- * Author & Copyright (c) 2010 Gentics Software GmbH
4
- * aloha-sales@gentics.com
5
- * Licensed unter the terms of http://www.aloha-editor.com/license.html
6
- */
7
- GENTICS.Aloha.RessourceRegistry=function(){this.ressources=new Array()};GENTICS.Aloha.RessourceRegistry.prototype.register=function(ressource){if(ressource instanceof GENTICS.Aloha.Ressource){this.ressources.push(ressource)}};GENTICS.Aloha.RessourceRegistry.prototype.init=function(){for(var i=0;i<this.ressources.length;i++){var ressource=this.ressources[i];if(GENTICS.Aloha.settings.ressources==undefined){GENTICS.Aloha.settings.ressources={}}ressource.settings=GENTICS.Aloha.settings.ressources[ressource.prefix];if(ressource.settings==undefined){ressource.settings={}}if(ressource.settings.enabled==undefined){ressource.settings.enabled=true}if(ressource.settings.enabled==true){this.ressources[i].init()}}};GENTICS.Aloha.RessourceRegistry.toString=function(){return"com.gentics.aloha.RessourceRegistry"};GENTICS.Aloha.RessourceRegistry=new GENTICS.Aloha.RessourceRegistry();GENTICS.Aloha.Ressources={};
@@ -1 +0,0 @@
1
- if(typeof eu=="undefined"){var eu={};if(typeof eu.iksproject=="undefined"){eu.iksproject={}}}eu.iksproject.LoaderPlugin=new GENTICS.Aloha.Plugin("eu.iksproject.plugins.Loader");eu.iksproject.LoaderPlugin.loadedAssets={};eu.iksproject.LoaderPlugin.init=function(){var that=this};eu.iksproject.LoaderPlugin.load=function(pluginNamespace){var pluginPath=""+GENTICS_Aloha_base+"/plugins/"+pluginNamespace+"/plugin.js";jQuery('<script type="text/javascript" />').attr("src",pluginPath).appendTo("head")};eu.iksproject.LoaderPlugin.loadAsset=function(pluginNamespace,assetName,assetType){if(typeof assetType=="undefined"){assetType="js"}var assetPath=""+GENTICS_Aloha_base+"/plugins/"+pluginNamespace+"/"+assetName+"."+assetType;if(this.loadedAssets[assetPath]){return}this.loadedAssets[assetPath]=true;if(assetType=="js"){jQuery('<script type="text/javascript" />').attr("src",assetPath).appendTo("head")}else{if(assetType=="css"){jQuery('<link rel="stylesheet" />').attr("href",assetPath).appendTo("head")}}};
@@ -1,2 +0,0 @@
1
- tab.annotations=Annotations
2
- button.person.tooltip=Person
@@ -1,2 +0,0 @@
1
- tab.annotations=Merkinnät
2
- button.person.tooltip=Henkilö
@@ -1,2 +0,0 @@
1
- tab.annotations=Annotations
2
- button.person.tooltip=Personne
@@ -1,3 +0,0 @@
1
- span[typeof="v:Person"] {
2
- background-color: yellow;
3
- }
@@ -1 +0,0 @@
1
- if(typeof eu=="undefined"){var eu={};if(typeof eu.iksproject=="undefined"){eu.iksproject={}}}eu.iksproject.PersonPlugin=new GENTICS.Aloha.Plugin("eu.iksproject.plugins.Person");eu.iksproject.LoaderPlugin.loadAsset("eu.iksproject.plugins.Person","person","css");eu.iksproject.PersonPlugin.languages=["en","fi","fr"];eu.iksproject.PersonPlugin.init=function(){var that=this;this.initButtons()};eu.iksproject.PersonPlugin.initButtons=function(){this.createPersonButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addPerson",size:"small",tooltip:this.i18n("button.person.tooltip"),onclick:function(element,event){if(GENTICS.Aloha.activeEditable){GENTICS.Aloha.activeEditable.obj[0].focus()}var markup=jQuery("<span />").attr({"xmlns:v":"http://rdf.data-vocabulary.org/#","typeof":"v:Person",property:"v:name"});var rangeObject=GENTICS.Aloha.Selection.rangeObject;GENTICS.Utils.Dom.addMarkup(rangeObject,markup);rangeObject.select();return false}});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.createPersonButton,this.i18n("tab.annotations"),1)};
@@ -1,2330 +0,0 @@
1
- /**
2
- * Gentics Aloha Simple Table Plugin
3
- *
4
- * !!! PROOF OF CONCEPT !!!
5
- *
6
- */
7
- /**
8
- * Register the SimpleTablePlugin as GENTICS.Aloha.Plugin
9
- */
10
- GENTICS.Aloha.SimpleTablePlugin = new GENTICS.Aloha.Plugin('com.gentics.aloha.plugins.SimpleTable', 'table');
11
-
12
- //
13
- //
14
- // I M P O R T A N T
15
- //
16
- // if you want to disable ff table resize handles this has to be executed onload
17
- //
18
- // document.execCommand( 'enableInlineTableEditing', false, false );
19
- //
20
- // the call will fail if used outside of onload, and has to be surrounded by try/catch
21
- // but it's proven to work!
22
- //
23
- //
24
-
25
-
26
- /* -- ATTRIBUTES -- */
27
- /**
28
- * The Create-Layer Object of the SimpleTablePlugin
29
- *
30
- * @see GENTICS.Aloha.Table.CreateLayer
31
- */
32
- GENTICS.Aloha.SimpleTablePlugin.createLayer = undefined;
33
-
34
- /**
35
- * Configure the available languages
36
- */
37
- GENTICS.Aloha.SimpleTablePlugin.languages = ['en', 'de'];
38
-
39
- /**
40
- * An Array which holds all newly created tables contains DOM-Nodes of
41
- * table-objects
42
- */
43
- GENTICS.Aloha.SimpleTablePlugin.TableRegistry = new Array();
44
-
45
- /**
46
- * Holds the active table-object
47
- */
48
- GENTICS.Aloha.SimpleTablePlugin.activeTable = undefined;
49
-
50
- /**
51
- * parameters-objects for tables
52
- *
53
- * @param className
54
- * The class of activated tables
55
- */
56
- GENTICS.Aloha.SimpleTablePlugin.parameters = {
57
- className : 'GENTICS_Aloha_SimpleTable', // class of editable tables
58
- classSelectionRow : 'GENTICS_Aloha_SimpleTable_selectColumn', // class for the upper table-row to select columns
59
- classSelectionColumn : 'GENTICS_Aloha_SimpleTable_selectRow', // class for the left bound table-cells to select rows
60
- classLeftUpperCorner : 'GENTICS_Aloha_SimpleTable_leftUpperCorner', // class for the left upper corner cell
61
- classTableWrapper : 'GENTICS_Aloha_SimpleTable_wrapper', // class of the outest table-wrapping div
62
- classCellSelected : 'GENTICS_Aloha_Cell_selected', // class of cell which are selected (row/column selection)
63
- selectionArea : 10 // width/height of the selection rows (in pixel)
64
- };
65
-
66
- /**
67
- * The configuration-object for the implementer of the plugin. All keys of the
68
- * "parameters" object could be overwritten within this object and will simply
69
- * be used instead.
70
- */
71
- GENTICS.Aloha.SimpleTablePlugin.config = new Object();
72
- /* -- END ATTRIBUTES -- */
73
-
74
- /* -- METHODS -- */
75
- /**
76
- * Init method of the Table-plugin transforms all tables in the document and
77
- * sets the initialized flag to true
78
- *
79
- * @return void
80
- */
81
- GENTICS.Aloha.SimpleTablePlugin.init = function() {
82
-
83
- // disable this plugin
84
- return;
85
-
86
- // add reference to the create layer object
87
- this.createLayer = new GENTICS.Aloha.Table.CreateLayer();
88
-
89
- var that = this;
90
-
91
- // subscribe for the 'editableActivated' event to activate all tables in the editable
92
- GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha, 'editableCreated', function(event, editable) {
93
- // add a mousedown event to all created editables to check if
94
- editable.obj.bind('mousedown', function(jqEvent) {
95
- GENTICS.Aloha.SimpleTablePlugin.setFocusedTable(undefined);
96
- if (!editable.floatingMenu.isActive) {
97
- editable.floatingMenu.call();
98
- }
99
- });
100
-
101
- editable.obj.find('table').each(function() {
102
- // instantiate a new table-object
103
- var table = new GENTICS.Aloha.Table(this);
104
-
105
- table.parentEditable = editable;
106
-
107
- // activate the table
108
- table.activate();
109
-
110
- // add the activated table to the TableRegistry
111
- GENTICS.Aloha.SimpleTablePlugin.TableRegistry.push(table);
112
- });
113
- });
114
-
115
- // call initButtons when event enableCreated is triggered
116
- GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha, 'editableCreated', this.initCreateTableButton);
117
-
118
- // disable advanced table handles in firefox
119
- // try/catch since opera won't like this
120
- $(document).ready(function () {
121
- // document.execCommand( 'enableInlineTableEditing', false, false );
122
- });
123
-
124
- this.initialized = true;
125
- };
126
-
127
-
128
- /**
129
- * initialize the buttons and register them on floating menu
130
- * @param event event object
131
- * @param editable current editable object
132
- */
133
- GENTICS.Aloha.SimpleTablePlugin.initCreateTableButton = function (event, editable) {
134
-
135
- var buttons = new Array();
136
-
137
- var sep = new GENTICS.Aloha.OldFloatingMenu.Button({
138
- name : 'separator',
139
- title : 'Separator',
140
- cssClass : 'GENTICS_separator',
141
- onClick : function(){}
142
- });
143
-
144
- buttons.push(sep);
145
-
146
- var table = new GENTICS.Aloha.OldFloatingMenu.Button({
147
- name : 'table',
148
- status : 'released',
149
- title : 'Insert table',
150
- cssClass : 'GENTICS_button_table',
151
- onClick : function() {
152
- GENTICS.Aloha.SimpleTablePlugin.createDialog(this.html.children("a.GENTICS_button_table").get(0));
153
- }
154
- });
155
-
156
- buttons.push(table);
157
-
158
- editable.floatingMenu.registerButtons(GENTICS.Aloha.SimpleTablePlugin, buttons);
159
- };
160
-
161
- /**
162
- * This function adds the createDialog to the calling element
163
- *
164
- * @param callingElement
165
- * The element, which was clicked. It's needed to set the right
166
- * position to the create-table-dialog.
167
- */
168
- GENTICS.Aloha.SimpleTablePlugin.createDialog = function(callingElement) {
169
- // set the calling element to the layer the calling element mostly will be
170
- // the element which was clicked on it is used to position the createLayer
171
- this.createLayer.set('target', callingElement);
172
-
173
- // show the createLayer
174
- this.createLayer.show();
175
-
176
- };
177
-
178
- /**
179
- * Creates a normal html-table, "activates" this table and inserts it into the
180
- * active Editable
181
- *
182
- * @param cols
183
- * number of colums for the created table
184
- * @param cols
185
- * number of rows for the created table
186
- * @return void
187
- */
188
- GENTICS.Aloha.SimpleTablePlugin.createTable = function(cols, rows) {
189
- // Check if there is an active Editable and that it contains an element (= .obj)
190
- if (GENTICS.Aloha.activeEditable != null && typeof GENTICS.Aloha.activeEditable.obj != 'undefined') {
191
- // create a dom-table object
192
- var table = document.createElement('table');
193
- var tableId = table.id = GENTICS.Aloha.TableHelper.getNewTableID();
194
- var tbody = document.createElement('tbody');
195
-
196
- // create "rows"-number of rows
197
- for (var i = 0; i < rows; i++) {
198
- var tr = document.createElement('tr');
199
- // create "cols"-number of columns
200
- for (var j = 0; j < cols; j++) {
201
- var text = document.createTextNode('\u00a0');
202
- var td = document.createElement('td');
203
- td.appendChild(text);
204
- tr.appendChild(td);
205
- }
206
- tbody.appendChild(tr);
207
- }
208
- table.appendChild(tbody);
209
-
210
- // insert at current cursor position
211
- this.insertAtCursorPos(table);
212
-
213
- // if the table is inserted
214
- var tableReloadedFromDOM = document.getElementById(tableId);
215
-
216
- var tableObj = new GENTICS.Aloha.Table(tableReloadedFromDOM);
217
-
218
- tableObj.parentEditable = GENTICS.Aloha.activeEditable;
219
-
220
- // transform the table to be editable
221
- // tableObj.activate();
222
-
223
- // after creating the table, trigger a click into the first cell to
224
- // focus the content
225
- // for IE set a timeout of 10ms to focus the first cell, other wise it
226
- // won't work
227
- // if (jQuery.browser.msie) {
228
- // window.setTimeout(function() { tableObj.cells[0].wrapper.get(0).focus(); }, 20);
229
- // } else {
230
- // tableObj.cells[0].wrapper.get(0).focus();
231
- // }
232
-
233
- GENTICS.Aloha.SimpleTablePlugin.TableRegistry.push(tableObj);
234
-
235
- // no active editable => error
236
- } else {
237
- this.error('There is no active Editable where the table can be inserted!');
238
- }
239
- };
240
-
241
- /**
242
- * Inserts the given element at the cursor position of the current active Editable
243
- *
244
- * @param elementThe element which should be inserted (a DOM-object)
245
- */
246
- GENTICS.Aloha.SimpleTablePlugin.insertAtCursorPos = function(element) {
247
- // check if the element-parameter is set
248
- if (typeof element != 'undefined') {
249
- // check if there is an active editable
250
- if (typeof GENTICS.Aloha.activeEditable.obj != 'undefined'){
251
- var range, html;
252
- // insertion for IE
253
- if (jQuery.browser.msie) {
254
- range = GENTICS.Aloha.Editable.range;
255
- html = (element.nodeType == 3) ? element.data : element.outerHTML;
256
- range.pasteHTML(html);
257
-
258
- // insertion for other browser
259
- } else if (window.getSelection && window.getSelection().getRangeAt){
260
- range = GENTICS.Aloha.Editable.range;
261
- range.insertNode(element);
262
-
263
- // insertion didn't work trigger ERROR to user!
264
- } else {
265
- this.error("Table couldn't be inserted");
266
- }
267
- }else{
268
- this.warn('No active Editable => do nothing.');
269
- }
270
- }else{
271
- this.error('This method didn\'t get an element to insert!');
272
- }
273
- };
274
-
275
- GENTICS.Aloha.SimpleTablePlugin.setFocusedTable = function(focusTable) {
276
- for (var i = 0; i < GENTICS.Aloha.SimpleTablePlugin.TableRegistry.length; i++) {
277
- GENTICS.Aloha.SimpleTablePlugin.TableRegistry[i].hasFocus = false;
278
- }
279
- if (typeof focusTable != 'undefined') {
280
- focusTable.hasFocus = true;
281
- }
282
- GENTICS.Aloha.SimpleTablePlugin.activeTable = focusTable;
283
- };
284
-
285
- /**
286
- * Calls the GENTICS.Aloha.log function with 'error' level
287
- *
288
- * @see GENTICS.Aloha.log
289
- * @param msg
290
- * The message to display
291
- * @return void
292
- */
293
- GENTICS.Aloha.SimpleTablePlugin.error = function(msg) {
294
- GENTICS.Aloha.Log.error(this, msg);
295
- };
296
-
297
- /**
298
- * Calls the GENTICS.Aloha.log function with 'debug' level
299
- *
300
- * @see GENTICS.Aloha.log
301
- * @param msg
302
- * The message to display
303
- * @return void
304
- */
305
- GENTICS.Aloha.SimpleTablePlugin.debug = function(msg) {
306
- GENTICS.Aloha.Log.debug(this, msg);
307
- };
308
-
309
- /**
310
- * Calls the GENTICS.Aloha.log function with 'info' level
311
- *
312
- * @see GENTICS.Aloha.log
313
- * @param msg
314
- * The message to display
315
- * @return void
316
- */
317
- GENTICS.Aloha.SimpleTablePlugin.info = function(msg) {
318
- GENTICS.Aloha.Log.info(this, msg);
319
- };
320
-
321
- /**
322
- * Calls the GENTICS.Aloha.log function with 'info' level
323
- *
324
- * @see GENTICS.Aloha.log
325
- * @param msg
326
- * The message to display
327
- * @return void
328
- */
329
- GENTICS.Aloha.SimpleTablePlugin.log = function(msg) {
330
- GENTICS.Aloha.log('log', this, msg);
331
- };
332
-
333
- /**
334
- * The "get"-method returns the value of the given key.
335
- * First it searches in the config for the property.
336
- * If there is no property with the given name in the
337
- * "config"-object it returns the entry associated with
338
- * in the parameters-object
339
- *
340
- * @param property
341
- * @return void
342
- *
343
- */
344
- GENTICS.Aloha.SimpleTablePlugin.get = function (property) {
345
- if (this.config[property]) {
346
- return this.config[property];
347
- }
348
- if (this.parameters[property]) {
349
- return this.parameters[property];
350
- }
351
- return undefined;
352
- };
353
-
354
- /**
355
- * The "set"-method takes a key and a value. It checks if there is a
356
- * key-value pair in the config-object. If so it saves the data in the
357
- * config-object. If not it saves the data in the parameters-object.
358
- *
359
- * @param key the key which should be set
360
- * @param value the value which should be set for the associated key
361
- */
362
- GENTICS.Aloha.SimpleTablePlugin.set = function (key, value) {
363
- if (this.config[key]) {
364
- this.config[key] = value;
365
- }else{
366
- this.parameters[key] = value;
367
- }
368
- };
369
-
370
- /**
371
- * Make the given jQuery object (representing an editable) clean for saving
372
- * Find all tables and deactivate them
373
- * @param obj jQuery object to make clean
374
- * @return void
375
- */
376
- GENTICS.Aloha.SimpleTablePlugin.makeClean = function (obj) {
377
- // find all table tags
378
- obj.find('table').each(function() {
379
- // instantiate a new table-object
380
- var table = new GENTICS.Aloha.Table(this);
381
-
382
- // deactivate the table
383
- table.deactivate();
384
- });
385
- };
386
-
387
- /**
388
- * String representation of the Table-object
389
- *
390
- * @return The plugins namespace (string)
391
- */
392
- GENTICS.Aloha.SimpleTablePlugin.toString = function() {
393
- return this.prefix;
394
- };
395
- /* -- END METHODS -- */
396
-
397
-
398
- /**************************
399
- +---------------------+
400
- | GENTICS.Aloha.Table |
401
- +---------------------+
402
- ***************************/
403
- /**
404
- * Constructor of the table object
405
- *
406
- * @param table
407
- * the dom-representation of the held table
408
- * @return void
409
- */
410
- GENTICS.Aloha.Table = function(table) {
411
- // set the table attribut "obj" as a jquery represenation of the dom-table
412
- this.obj = jQuery(table);
413
-
414
- // find the dimensions of the table
415
- var rows = this.obj.find("tr");
416
- var firstRow = jQuery(rows.get(0));
417
- this.numCols = firstRow.children("td, th").length;
418
- this.numRows = rows.length;
419
-
420
- // init the cell-attribute with an empty array
421
- this.cells = new Array();
422
-
423
- // iterate over table cells and create Cell-objects
424
- var rows = this.obj.find('tr');
425
- for (var i = 0; i < rows.length; i++) {
426
- var row = jQuery(rows[i]);
427
- var cols = row.children();
428
- for (var j = 0; j < cols.length; j++) {
429
- var col = cols[j];
430
- var Cell = new GENTICS.Aloha.Table.Cell(col, this);
431
- this.cells.push(Cell);
432
- }
433
- }
434
- };
435
- /* -- ATTRIBUTES -- */
436
- /**
437
- * Attribute holding the jQuery-table-represenation
438
- */
439
- GENTICS.Aloha.Table.prototype.obj = undefined;
440
-
441
- /**
442
- * The DOM-element of the outest div-container wrapped around the cell
443
- */
444
- GENTICS.Aloha.Table.prototype.tableWrapper = undefined;
445
-
446
- /**
447
- * An array of all Cells contained in the Table
448
- *
449
- * @see GENTICS.Aloha.Table.Cell
450
- */
451
- GENTICS.Aloha.Table.prototype.cells = undefined;
452
-
453
- /**
454
- * Number of rows of the table
455
- */
456
- GENTICS.Aloha.Table.prototype.numRows = undefined;
457
-
458
- /**
459
- * Number of rows of the table
460
- */
461
- GENTICS.Aloha.Table.prototype.numCols = undefined;
462
-
463
- /**
464
- * This attribute holds the floatingMenu of the table-object
465
- */
466
- GENTICS.Aloha.Table.prototype.floatingMenu = undefined;
467
-
468
- /**
469
- * Flag wether the table is active or not
470
- */
471
- GENTICS.Aloha.Table.prototype.isActive = false;
472
-
473
- /**
474
- * Flag wether the table is focused or not
475
- */
476
- GENTICS.Aloha.Table.prototype.hasFocus = false;
477
-
478
- /**
479
- * The editable which contains the table
480
- */
481
- GENTICS.Aloha.Table.prototype.parentEditable = undefined;
482
-
483
- /**
484
- * Flag to check if the mouse was pressed. For row- and column-selection.
485
- */
486
- GENTICS.Aloha.Table.prototype.mousedown = false;
487
-
488
- /**
489
- * ID of the column which was pressed when selecting columns
490
- */
491
- GENTICS.Aloha.Table.prototype.clickedColumnId = -1;
492
-
493
- /**
494
- * ID of the row which was pressed when selecting rows
495
- */
496
- GENTICS.Aloha.Table.prototype.clickedRowId = -1;
497
-
498
- /**
499
- * collection of columnindexes of the columns which should be selected
500
- */
501
- GENTICS.Aloha.Table.prototype.columnsToSelect = new Array();
502
-
503
- /**
504
- * collection of rowindexes of the rows which should be selected
505
- */
506
- GENTICS.Aloha.Table.prototype.rowsToSelect = new Array();
507
-
508
- /**
509
- * contains the plugin id used for interaction with the floating menu
510
- */
511
- GENTICS.Aloha.Table.prototype.fmPluginId = undefined;
512
-
513
- /* -- END ATTRIBUTES -- */
514
-
515
- /* -- METHODS -- */
516
- /**
517
- * Wrapper-Mehotd to return a property of GENTICS.Aloha.SimpleTablePlugin.get
518
- *
519
- * @see GENTICS.Aloha.SimpleTablePlugin.get
520
- * @param property
521
- * the property whichs value should be return
522
- * @return the value associated with the property
523
- */
524
- GENTICS.Aloha.Table.prototype.get = function(property) {
525
- return GENTICS.Aloha.SimpleTablePlugin.get(property);
526
- };
527
-
528
- /**
529
- * Wrapper-Method for GENTICS.Aloha.SimpleTablePlugin.set
530
- *
531
- * @see GENTICS.Aloha.SimpleTablePlugin.set
532
- * @param key
533
- * the key whichs value should be set
534
- * @param value
535
- * the value for the key
536
- * @return void
537
- */
538
- GENTICS.Aloha.Table.prototype.set = function(key, value) {
539
- GENTICS.Aloha.SimpleTablePlugin.set(key, value);
540
- };
541
-
542
- /**
543
- * Transforms the existing dom-table into an editable aloha-table. In fact it
544
- * replaces the td-elements with equivalent GENTICS.Aloha.Table.Cell-elements
545
- * with attached events.
546
- * Furthermore it creates wrapping divs to realize a click-area for row- and
547
- * column selection and also attaches events.
548
- *
549
- * @return void
550
- */
551
- GENTICS.Aloha.Table.prototype.activate = function() {
552
- if (this.isActive) {
553
- return;
554
- }
555
- var that = this;
556
-
557
- // alter the table attributes
558
- this.obj.addClass(this.get('className'));
559
-
560
- // set an id to the table if not already set
561
- if (this.obj.attr('id') == '') {
562
- this.obj.attr('id', GENTICS.Aloha.TableHelper.getNewTableID());
563
- }
564
-
565
- // add the floating menu to the table
566
- this.attachFloatingMenu();
567
-
568
- // this.obj.bind('keydown', function(jqEvent){
569
- // if (!jqEvent.ctrlKey && !jqEvent.shiftKey) {
570
- // if (GENTICS.Aloha.TableHelper.selectedCells.length > 0 && GENTICS.Aloha.TableHelper.selectedCells[0].length > 0) {
571
- // GENTICS.Aloha.TableHelper.selectedCells[0][0].firstChild.focus();
572
- // }
573
- // }
574
- // });
575
-
576
- // handle click event of the table
577
- this.obj.bind('click', function(e){
578
- // stop bubbling the event to the outer divs, a click in the table
579
- // should only be handled in the table
580
- e.stopPropagation();
581
- return false;
582
- });
583
-
584
- this.obj.bind('mousedown', function(jqEvent) {
585
- // focus the table if not already done
586
- if (!that.hasFocus) {
587
- that.focus();
588
- }
589
-
590
- // // if a mousedown is done on the table, just focus the first cell of the table
591
- // setTimeout(function() {
592
- // var firstCell = that.obj.find('tr:nth-child(2) td:nth-child(2)').children('div[contentEditable=true]').get(0);
593
- // GENTICS.Aloha.TableHelper.unselectCells();
594
- // jQuery(firstCell).get(0).focus();
595
- // }, 5);
596
-
597
- // stop bubbling and default-behaviour
598
- jqEvent.stopPropagation();
599
- jqEvent.preventDefault();
600
- return false;
601
- });
602
-
603
- // ### create a wrapper for the table (@see HINT below)
604
- // wrapping div for the table to suppress the display of the resize-controls of
605
- // the editable divs within the cells
606
- // var tableWrapper = jQuery('<div class="' + this.get('classTableWrapper') + '" contentEditable="false"></div>');
607
-
608
- // wrap the tableWrapper around the table
609
- // this.obj.wrap(tableWrapper);
610
-
611
- // :HINT The outest div (Editable) of the table is still in an editable
612
- // div. So IE will surround the the wrapper div with a resize-border
613
- // Workaround => just disable the handles so hopefully won't happen any ugly stuff.
614
- // Disable resize and selection of the controls (only IE)
615
- // Events only can be set to elements which are loaded from the DOM (if they
616
- // were created dynamically before) ;)
617
- // var htmlTableWrapper = this.obj.parents('.' + this.get('classTableWrapper'));
618
- // htmlTableWrapper.get(0).onresizestart = function(e) { return false; };
619
- // htmlTableWrapper.get(0).oncontrolselect = function(e) { return false; };
620
- //
621
- // this.tableWrapper = this.obj.parents('.' + this.get('classTableWrapper')).get(0);
622
-
623
- jQuery(this.cells).each(function () {
624
- this.activate();
625
- });
626
-
627
- // after the cells where replaced with contentEditables ... add selection cells
628
- // first add the additional columns on the left side
629
- // this.attachSelectionColumn();
630
- // // then add the additional row at the top
631
- // this.attachSelectionRow();
632
- //
633
- // // attach events for the last cell
634
- // this.attachLastCellEvents();
635
-
636
- // set flag, that the table is activated
637
- this.isActive = true;
638
-
639
- // this.lastCellLastCaretPos = 0;
640
-
641
- // handle cursor moves in first and last table cell
642
- // e.keyCode: left = 37, up = 38, right = 39, down = 40
643
- // this.obj.find('tr:nth-child(2) td:nth-child(2)').css('background', 'blue');
644
- // this.obj.find('tr:last td:last div.GENTICS_Table_Cell_editable').bind('keyup', function (e) {
645
- // GENTICS.Aloha.Log.debug(that, 'last caret pos: ' + that.lastCellLastCaretPos + ' new: '
646
- // + GENTICS.Aloha.Selection.rangeObject.endOffset);
647
- //
648
- // // bei den richtigen keys letze pos mit aktueller pos vergleichen
649
- // if (that.lastCellLastCaretPos == GENTICS.Aloha.Selection.rangeObject.endOffset
650
- // && (e.keyCode == 39 || e.keyCode == 40)) {
651
- // alert('jump out');
652
- // }
653
- //
654
- // that.lastCellLastCaretPos = GENTICS.Aloha.Selection.rangeObject.endOffset;
655
- // });
656
-
657
- // throw a new event when the table has been activated
658
- GENTICS.Aloha.EventRegistry.trigger(
659
- new GENTICS.Aloha.Event(
660
- 'tableActivated',
661
- GENTICS.Aloha,
662
- [ this ]
663
- )
664
- );
665
- };
666
-
667
- /**
668
- * Creates a new floatingMenu with the defined buttons and attaches it to the
669
- * Table-object
670
- *
671
- * @return void
672
- */
673
- GENTICS.Aloha.Table.prototype.attachFloatingMenu = function() {
674
- // create a floating menu for the table and set it as attribute
675
- this.floatingMenu = new GENTICS.Aloha.OldFloatingMenu(this.obj);
676
- this.fmPluginId = this + this.obj.attr('id');
677
-
678
- var that = this;
679
- // register the fm buttons
680
- var buttons = [
681
- // add column (left) button
682
- new GENTICS.Aloha.OldFloatingMenu.Button({
683
- name : 'addColumnLeft',
684
- title : 'Add column left',
685
- cssClass : 'GENTICS_Aloha_addColumnLeft',
686
- onClick : function(){
687
- that.addColumnsLeft();
688
- }
689
- }),
690
- // add column (right) button
691
- new GENTICS.Aloha.OldFloatingMenu.Button({
692
- name : 'addColumnRight',
693
- title : 'Add column right',
694
- cssClass : 'GENTICS_Aloha_addColumnRight',
695
- onClick : function(){
696
- that.addColumnsRight();
697
- }
698
- }),
699
- // insert row before button
700
- new GENTICS.Aloha.OldFloatingMenu.Button({
701
- name : 'addRowBefore',
702
- title : 'Insert row before',
703
- cssClass : 'GENTICS_Aloha_addRowBefore',
704
- onClick : function(){
705
- that.addRowsBefore(true);
706
- }
707
- }),
708
- // insert row after button
709
- new GENTICS.Aloha.OldFloatingMenu.Button({
710
- name : 'addRowAfter',
711
- title : 'Insert row after',
712
- cssClass : 'GENTICS_Aloha_addRowAfter',
713
- onClick : function(){
714
- that.addRowsAfter(true);
715
- }
716
- }),
717
- // delete selected rows
718
- new GENTICS.Aloha.OldFloatingMenu.Button({
719
- name : 'deleteRows',
720
- title : 'Delete selected row(s)',
721
- cssClass : 'GENTICS_Aloha_deleteRows',
722
- onClick : function(){
723
- var bool = window.confirm('You are going to delete the selected rows?\nContinue?');
724
- if (bool) {
725
- that.deleteRows();
726
- }
727
- }
728
- }),
729
- // delete selected columns
730
- new GENTICS.Aloha.OldFloatingMenu.Button({
731
- name : 'deleteColumns',
732
- title : 'Delete selected column(s)',
733
- cssClass : 'GENTICS_Aloha_deleteColumns',
734
- onClick : function(){
735
- var bool = window.confirm('You are going to delete the selected columns?\nContinue?');
736
- if (bool) {
737
- that.deleteColumns();
738
- }
739
- }
740
- })
741
- ];
742
-
743
- // register the buttons for the floating menu
744
- this.floatingMenu.registerButtons(this.fmPluginId, buttons);
745
-
746
- // hide the buttons for deleting rows and columns
747
- };
748
-
749
- /**
750
- * Add the selection-column to the left side of the table and attach the events
751
- * for selection rows
752
- *
753
- * @return void
754
- */
755
- GENTICS.Aloha.Table.prototype.attachSelectionColumn = function() {
756
- // create an empty cell
757
- var emptyCell = jQuery('<td>');
758
- // set the unicode '&nbsp;' code
759
- emptyCell.html('\u00a0');
760
-
761
- var that = this;
762
- var rows = this.obj.context.rows;
763
- // add a column before each first cell of each row
764
- for (var i = 0; i < rows.length; i++) {
765
- var rowObj = jQuery(rows[i]);
766
- var columnToInsert = emptyCell.clone();
767
- columnToInsert.addClass(this.get('classSelectionColumn'));
768
- columnToInsert.css('width', this.get('selectionArea') + 'px');
769
- rowObj.find('td:first').before(columnToInsert);
770
-
771
- // rowIndex + 1 because an addtional row is still added
772
- var rowIndex = i + 1;
773
-
774
- // this method sets the selection-events to the cell
775
- this.attachRowSelectionEventsToCell(columnToInsert);
776
- }
777
- };
778
-
779
- /**
780
- * Binds the needed selection-mouse events to the given cell
781
- *
782
- * @param cell
783
- * The jquery object of the table-data field
784
- * @return void
785
- */
786
- GENTICS.Aloha.Table.prototype.attachRowSelectionEventsToCell = function(cell){
787
- var that = this;
788
-
789
- // unbind eventually existing events of this cell
790
- cell.unbind('mousedown');
791
- cell.unbind('mouseover');
792
-
793
- // prevent ie from selecting the contents of the table
794
- cell.get(0).onselectstart = function() { return false; };
795
-
796
- cell.bind('mousedown', function(e){
797
- that.rowSelectionMouseDown(e);
798
-
799
- // focus the table (if not already done)
800
- that.focus();
801
-
802
- // stop bubble, otherwise the mousedown of the table is called ...
803
- e.stopPropagation();
804
-
805
- // prevent ff/chrome/safare from selecting the contents of the table
806
- //return false;
807
- });
808
-
809
- cell.bind('mouseover', function(e) { that.rowSelectionMouseOver(e); e.preventDefault(); });
810
- };
811
-
812
- /**
813
- * Mouse-Down event for the selection-cells on the left side of the table
814
- *
815
- * @param jqEvent
816
- * the jquery-event object
817
- * @return void
818
- */
819
- GENTICS.Aloha.Table.prototype.rowSelectionMouseDown = function (jqEvent) {
820
- // set flag that the mouse is pressed
821
- this.mousedown = true;
822
-
823
- // if no cells are selected, reset the selection-array
824
- if (GENTICS.Aloha.TableHelper.selectedCells.length == 0) {
825
- this.rowsToSelect = new Array();
826
- }
827
-
828
- // set the origin-rowId of the mouse-click
829
- this.clickedRowId = jqEvent.currentTarget.parentNode.rowIndex;
830
-
831
- // set the array of to-be-selected columns
832
- if (jqEvent.ctrlKey) {
833
- var arrayIndex = jQuery.inArray(this.clickedRowId, this.rowsToSelect);
834
- if (arrayIndex >= 0) {
835
- this.rowsToSelect.splice(arrayIndex, 1);
836
- }else{
837
- this.rowsToSelect.push(this.clickedRowId);
838
- }
839
- }else if (jqEvent.shiftKey) {
840
- this.rowsToSelect.sort(function(a,b){return a - b;});
841
- var start = this.rowsToSelect[0];
842
- var end = this.clickedRowId;
843
- if (start > end) {
844
- start = end;
845
- end = this.rowsToSelect[0];
846
- }
847
- this.rowsToSelect = new Array();
848
- for (var i = start; i <= end; i++) {
849
- this.rowsToSelect.push(i);
850
- }
851
- }else{
852
- this.rowsToSelect = [this.clickedRowId];
853
- }
854
-
855
- // do the selection
856
- this.selectRows();
857
-
858
- // prevent browser from selecting the table
859
- jqEvent.preventDefault();
860
- };
861
-
862
- /**
863
- * The mouse-over event for the selection-cells on the left side of the table.
864
- * On mouse-over check which column was clicked, calculate the span between
865
- * clicked and mouse-overed cell and mark them as selected
866
- *
867
- * @param jqEvent
868
- * the jquery-event object
869
- * @return void
870
- */
871
- GENTICS.Aloha.Table.prototype.rowSelectionMouseOver = function (jqEvent) {
872
- var rowIndex = jqEvent.currentTarget.parentNode.rowIndex;
873
-
874
- // only select the row if the mouse was clicked and the clickedRowId isn't
875
- // from the selection-row (row-id = 0)
876
- if (this.mousedown && this.clickedRowId >= 0) {
877
- var indexInArray = jQuery.inArray(rowIndex, this.rowsToSelect);
878
-
879
- var start = (rowIndex < this.clickedRowId) ? rowIndex : this.clickedRowId;
880
- var end = (rowIndex < this.clickedRowId) ? this.clickedRowId : rowIndex;
881
-
882
- this.rowsToSelect = new Array();
883
- for (var i = start; i <= end; i++) {
884
- this.rowsToSelect.push(i);
885
- }
886
-
887
- // this actually selects the rows
888
- this.selectRows();
889
- }
890
- };
891
-
892
- /**
893
- * Binds the needed selection-mouse events to the given cell
894
- *
895
- * @param cell
896
- * The jquery object of the table-data field
897
- * @return void
898
- */
899
- GENTICS.Aloha.Table.prototype.attachSelectionRow = function() {
900
- var that = this;
901
-
902
- // create an empty td
903
- var emptyCell = jQuery('<td>');
904
- emptyCell.html('\u00a0');
905
-
906
- // get the number of columns in the table (length of the cells in the first row)
907
- var numColumns = this.obj.context.rows[0].cells.length;
908
- var selectionRow = jQuery('<tr>');
909
- selectionRow.addClass(this.get('classSelectionRow'));
910
- selectionRow.css('height', this.get('selectionArea') + 'px');
911
- for (var i = 0; i < numColumns; i++) {
912
- var columnToInsert = emptyCell.clone();
913
-
914
- // the first cell should have no function, so only attach the events for
915
- // the rest
916
- if (i > 0) {
917
- // bind all mouse-events to the cell
918
- this.attachColumnSelectEventsToCell(columnToInsert);
919
- }
920
- // add the cell to the row
921
- selectionRow.append(columnToInsert);
922
- }
923
- // global mouseup event to reset the selection properties
924
- jQuery(document).bind('mouseup', function(e) {
925
- that.mousedown = false;
926
- that.clickedColumnId = -1;
927
- that.clickedRowId = -1;
928
- });
929
-
930
- selectionRow.find('td:first').addClass(this.get('classLeftUpperCorner'));
931
- this.obj.find('tr:first').before(selectionRow);
932
- };
933
-
934
- /**
935
- * Binds the events for the column selection to the given cell.
936
- *
937
- * @param cell
938
- * the jquery object of the td-field
939
- * @return void
940
- */
941
- GENTICS.Aloha.Table.prototype.attachColumnSelectEventsToCell = function (cell) {
942
- var that = this;
943
-
944
- // unbind eventually existing events of this cell
945
- cell.unbind('mousedown');
946
- cell.unbind('mouseover');
947
-
948
- // prevent ie from selecting the contents of the table
949
- cell.get(0).onselectstart = function() { return false; };
950
-
951
- cell.bind('mousedown', function(e) {
952
- that.columnSelectionMouseDown(e);
953
-
954
- // focus the table
955
- that.focus();
956
-
957
- // stop bubble, otherwise the mousedown of the table is called ...
958
- e.stopPropagation();
959
-
960
- return false;
961
- });
962
-
963
- cell.bind('mouseover', function (e) {
964
- that.columnSelectionMouseOver(e);
965
- });
966
- };
967
-
968
- /**
969
- * Mouse-down event for a columns-selection cell. It adds the index of the
970
- * clicked column to the "columnsToSelect"-Array and calls the method which
971
- * selects the column.
972
- *
973
- * @param jqEvent
974
- * the jquery event-object
975
- * @return void
976
- */
977
- GENTICS.Aloha.Table.prototype.columnSelectionMouseDown = function (jqEvent) {
978
- // set the mousedown flag
979
- this.mousedown = true;
980
-
981
- // if no cells are selected, reset the selection-array
982
- if (GENTICS.Aloha.TableHelper.selectedCells.length == 0) {
983
- this.columnsToSelect = new Array();
984
- }
985
-
986
- // store the id of the column which has been originally clicked
987
- this.clickedColumnId = jqEvent.currentTarget.cellIndex;
988
- if (jqEvent.ctrlKey) {
989
- var arrayIndex = jQuery.inArray(this.clickedColumnId, this.columnsToSelect);
990
- if (arrayIndex >= 0) {
991
- this.columnsToSelect.splice(arrayIndex, 1);
992
- }else{
993
- this.columnsToSelect.push(this.clickedColumnId);
994
- }
995
- }else if (jqEvent.shiftKey) {
996
- this.columnsToSelect.sort(function(a,b){return a - b;});
997
- var start = this.columnsToSelect[0];
998
- var end = this.clickedColumnId;
999
- if (start > end) {
1000
- start = end;
1001
- end = this.columnsToSelect[0];
1002
- }
1003
- this.columnsToSelect = new Array();
1004
- for (var i = start; i <= end; i++) {
1005
- this.columnsToSelect.push(i);
1006
- }
1007
- }else{
1008
- this.columnsToSelect = [this.clickedColumnId];
1009
- }
1010
-
1011
- // this does actually the column-selection.
1012
- // it reads the columns which should be selected from "columnsToSelect"
1013
- this.selectColumns();
1014
-
1015
- // prevent browser from selecting the table
1016
- jqEvent.preventDefault();
1017
- };
1018
-
1019
- /**
1020
- * Mouseover-event for the column-selection cell. This method calcluates the
1021
- * span between the clicked column and the mouse-overed cell and selects the
1022
- * columns inbetween. and mark them as selected
1023
- *
1024
- * @param jqEvent
1025
- * the jquery-event object
1026
- * @return void
1027
- */
1028
- GENTICS.Aloha.Table.prototype.columnSelectionMouseOver = function (jqEvent) {
1029
- var colIndex = jqEvent.currentTarget.cellIndex;
1030
- if (this.mousedown && this.clickedColumnId > 0) {
1031
- var indexInArray = jQuery.inArray(colIndex, this.columnsToSelect);
1032
-
1033
- var start = (colIndex < this.clickedColumnId) ? colIndex : this.clickedColumnId;
1034
- var end = (colIndex < this.clickedColumnId) ? this.clickedColumnId : colIndex;
1035
-
1036
- this.columnsToSelect = new Array();
1037
- for (var i = start; i <= end; i++) {
1038
- this.columnsToSelect.push(i);
1039
- }
1040
-
1041
- this.selectColumns();
1042
- }
1043
- };
1044
-
1045
- /**
1046
- * Unbinds all events of the last cell
1047
- *
1048
- * @return void
1049
- */
1050
- GENTICS.Aloha.Table.prototype.releaseLastCellEvents = function() {
1051
- this.obj.find('tr:last td:last').unbind();
1052
- };
1053
-
1054
- /**
1055
- * Attach a keydown-event for the last cell
1056
- *
1057
- * @see GENTICS.Aloha.Table.lastCellKeyDown
1058
- * @return void
1059
- */
1060
- GENTICS.Aloha.Table.prototype.attachLastCellEvents = function() {
1061
- var that = this;
1062
- this.obj.find('tr:last td:last').bind('keydown', function(jqEvent) {
1063
- that.lastCellKeyDown(jqEvent);
1064
- });
1065
- };
1066
-
1067
- /**
1068
- * If the tab-key was pressed in the last cell create a new row and jump into
1069
- * the first cell of the next row.
1070
- * Only add a new row if no addtional key was pressed (shift, alt, ctrl)
1071
- *
1072
- * @param jqEvent
1073
- * the jquery-event object
1074
- * @return
1075
- */
1076
- GENTICS.Aloha.Table.prototype.lastCellKeyDown = function(jqEvent) {
1077
- var KEYCODE_TAB = 9;
1078
-
1079
- // only add a row on a single key-press of tab (so check if alt-, shift- or
1080
- // ctrl-key are NOT pressed)
1081
- if (KEYCODE_TAB == jqEvent.keyCode && !jqEvent.altKey && !jqEvent.shiftKey && !jqEvent.ctrlKey) {
1082
- // add a row after the current row (false stands for not highlighting the new row)
1083
- this.addRowsAfter(false);
1084
-
1085
- // stop propagation because this should overwrite all other events
1086
- jqEvent.stopPropagation();
1087
-
1088
- // for ie make a special case ... focus the first cell of the new row
1089
- if (jQuery.browser.msie) {
1090
- this.obj.find('tr:last td:nth-child(1) div.GENTICS_Table_Cell_editable').get(0).focus();
1091
- return false;
1092
- }
1093
- }
1094
- };
1095
-
1096
- /**
1097
- * Deletes the selected rows. If no row are selected, delete the row, where the
1098
- * cursor is positioned. If all rows of the table should be deleted, the whole
1099
- * table is deletet and removed from the tableRegistry.
1100
- *
1101
- * @return void
1102
- */
1103
- GENTICS.Aloha.Table.prototype.deleteRows = function() {
1104
- var rowIDs = new Array();
1105
-
1106
- // flag if the table should be deleted
1107
- var deleteTable = false;
1108
-
1109
- // if a selection was made, delete the selected cells
1110
- if (GENTICS.Aloha.TableHelper.selectedCells.length > 0) {
1111
- for (var i = 0; i < GENTICS.Aloha.TableHelper.selectedCells.length; i++) {
1112
- rowIDs.push(GENTICS.Aloha.TableHelper.selectedCells[i][0].parentNode.rowIndex);
1113
- }
1114
-
1115
- // if no rows were selected, delete the row, where the cursor is placed in
1116
- }else if (typeof GENTICS.Aloha.Table.Cell.lastActiveCell != 'undefined') {
1117
- rowIDs.push(GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.parentNode.rowIndex);
1118
- }
1119
-
1120
- // if all rows should be deleted, set flag to remove the WHOLE table
1121
- if (rowIDs.length == this.numRows) {
1122
- deleteTable = true;
1123
- }
1124
-
1125
- // delete the whole table
1126
- if (deleteTable) {
1127
- if (window.confirm('You have selected all rows to be deleted. This will delete the table.\nContinue?')) {
1128
- this.deleteTable();
1129
- }
1130
-
1131
- }else{
1132
- rowIDs.sort(function(a,b){return a - b;});
1133
- // check which cell should be focused after the deletion
1134
- var focusRowId = rowIDs[0];
1135
- if (focusRowId > (this.numRows - rowIDs.length)) {
1136
- focusRowId --;
1137
- }
1138
-
1139
- // release the events of the last cell
1140
- this.releaseLastCellEvents();
1141
-
1142
- // get all rows
1143
- var rows = this.obj.find('tr');
1144
- var rows2delete = new Array();
1145
-
1146
- // build the array with the row-ids of th rows which should be deleted
1147
- for (var i = 0; i < rowIDs.length; i++) {
1148
- rows2delete.push(jQuery(rows[rowIDs[i]]));
1149
- }
1150
-
1151
- // delete cells from cells-array
1152
- for (var i = 0; i < rows2delete.length; i ++) {
1153
- var cols = rows2delete[i].children("td").toArray();
1154
- for (var j = 0; j < cols.length; j++) {
1155
- for (var m = 0; m < this.cells.length; m ++) {
1156
- if (cols[j] == this.cells[m].obj.get(0)) {
1157
- this.cells.splice(m, 1);
1158
- m = this.cells.length;
1159
- }
1160
- }
1161
- }
1162
- }
1163
-
1164
- // remove the rows
1165
- for (var i = 0; i < rows2delete.length; i++) {
1166
- rows2delete[i].remove();
1167
- }
1168
-
1169
- // reduce the attribute storing the number of rows in the table
1170
- this.numRows -= rows2delete.length;
1171
-
1172
- if (jQuery.browser.msie){
1173
- setTimeout(this.obj.find('tr:nth-child(' + (focusRowId + 1) + ') td:nth-child(2) div.GENTICS_Table_Cell_editable').get(0).focus, 5);
1174
- }else{
1175
- this.obj.find('tr:nth-child(' + (focusRowId + 1) + ') td:nth-child(2) div.GENTICS_Table_Cell_editable').get(0).focus();
1176
- }
1177
-
1178
- // re-attach the events for the last cell
1179
- this.attachLastCellEvents();
1180
-
1181
- // finally unselect the marked cells
1182
- GENTICS.Aloha.TableHelper.unselectCells();
1183
- }
1184
- };
1185
-
1186
- /**
1187
- * Deletes the selected columns. If no columns are selected, delete the column, where the
1188
- * cursor is positioned. If all columns of the table should be deleted, the whole
1189
- * table is deleted from the dom and removed from the tableRegistry.
1190
- *
1191
- * @return void
1192
- */
1193
- GENTICS.Aloha.Table.prototype.deleteColumns = function() {
1194
- var colIDs = new Array();
1195
-
1196
- // flag if the table should be deleted
1197
- var deleteTable = false;
1198
-
1199
- // if a selection was made, delete the selected cells
1200
- if (GENTICS.Aloha.TableHelper.selectedCells.length > 0) {
1201
- for (var i = 0; i < GENTICS.Aloha.TableHelper.selectedCells[0].length; i++) {
1202
- colIDs.push(GENTICS.Aloha.TableHelper.selectedCells[0][i].cellIndex);
1203
- }
1204
-
1205
- // if no columns were selected, delete the column, where the cursor is placed in
1206
- }else if (typeof GENTICS.Aloha.Table.Cell.lastActiveCell != 'undefined') {
1207
- colIDs.push(GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.cellIndex);
1208
- }
1209
-
1210
- // if all columns should be deleted, set flag to remove the WHOLE table
1211
- if (colIDs.length == this.numCols) {
1212
- deleteTable = true;
1213
- }
1214
-
1215
- // delete the whole table
1216
- if (deleteTable) {
1217
- if (window.confirm('You have selected all columns to be deleted. This will delete the table.\nContinue?')) {
1218
- this.deleteTable();
1219
- }
1220
-
1221
- }else{
1222
- colIDs.sort(function(a,b){return a - b;});
1223
- // check which cell should be focused after the deletion
1224
- var focusColID = colIDs[0];
1225
- if (focusColID > (this.numCols - colIDs.length)) {
1226
- focusColID --;
1227
- }
1228
-
1229
- // release the events of the last cell
1230
- this.releaseLastCellEvents();
1231
-
1232
- // get all rows to iterate
1233
- var rows = this.obj.find('tr');
1234
- var cols2delete = new Array();
1235
-
1236
- // build the array with the row-ids of th rows which should be deleted
1237
- for (var i = 0; i < rows.length; i++) {
1238
- var cells = jQuery(rows[i]).children("td").toArray();
1239
- for (var j = 0; j < colIDs.length; j++) {
1240
- cols2delete.push(cells[colIDs[j]]);
1241
- }
1242
- }
1243
-
1244
- // delete cells from cells-array
1245
- for (var i = 0; i < cols2delete.length; i ++) {
1246
- for (var j = 0; j < this.cells.length; j++) {
1247
- if (cols2delete[i] == this.cells[j].obj.get(0)) {
1248
- this.cells.splice(j, 1);
1249
- j = this.cells.length;
1250
- }
1251
- }
1252
- }
1253
-
1254
- // remove the columns
1255
- for (var i = 0; i < cols2delete.length; i++) {
1256
- jQuery(cols2delete[i]).remove();
1257
- }
1258
-
1259
- // reduce the attribute storing the number of rows in the table
1260
- this.numCols -= colIDs.length;
1261
-
1262
- if (jQuery.browser.msie){
1263
- setTimeout(this.obj.find('tr:nth-child(2) td:nth-child(' + (focusColID + 1) + ') div.GENTICS_Table_Cell_editable').get(0).focus, 5);
1264
- }else{
1265
- this.obj.find('tr:nth-child(2) td:nth-child(' + (focusColID + 1) + ') div.GENTICS_Table_Cell_editable').get(0).focus();
1266
- }
1267
-
1268
- // re-attach the events for the last cell
1269
- this.attachLastCellEvents();
1270
-
1271
- GENTICS.Aloha.TableHelper.unselectCells();
1272
- }
1273
- };
1274
-
1275
- /**
1276
- * Deletes the table from the dom and remove it from the tableRegistry.
1277
- *
1278
- * @return void
1279
- */
1280
- GENTICS.Aloha.Table.prototype.deleteTable = function() {
1281
- var deleteIndex = -1;
1282
- for (var i = 0; i < GENTICS.Aloha.SimpleTablePlugin.TableRegistry.length; i++){
1283
- if (GENTICS.Aloha.SimpleTablePlugin.TableRegistry[i].obj.attr('id') == this.obj.attr('id')) {
1284
- deleteIndex = i;
1285
- break;
1286
- }
1287
- }
1288
- if (deleteIndex >= 0) {
1289
- GENTICS.Aloha.SimpleTablePlugin.TableRegistry.splice(i, 1);
1290
- this.obj.remove();
1291
- this.parentEditable.obj.focus();
1292
- this.parentEditable.floatingMenu.call();
1293
- delete this;
1294
- }
1295
- };
1296
-
1297
- /**
1298
- * Wrapper function for this.addRow to add a row before the active row
1299
- *
1300
- * @param highlightNewRows flag if the newly created rows should be marked as selected
1301
- * @see GENTICS.Aloha.Table.prototype.addRow
1302
- * @return
1303
- */
1304
- GENTICS.Aloha.Table.prototype.addRowsBefore = function(highlightNewRows) {
1305
- this.addRows('before', highlightNewRows);
1306
- };
1307
-
1308
- /**
1309
- * Wrapper function for this.addRow to add a row after the active row
1310
- *
1311
- * @param highlightNewRows flag if the newly created rows should be marked as selected
1312
- * @see GENTICS.Aloha.Table.prototype.addRow
1313
- * @return
1314
- */
1315
- GENTICS.Aloha.Table.prototype.addRowsAfter = function(highlightNewRows) {
1316
- this.addRows('after', highlightNewRows);
1317
- };
1318
-
1319
- /**
1320
- * Adds new rows to the table. If rows were selected, the new rows will be
1321
- * inserted before/after the first/last selected row. If no rows are selected, a
1322
- * new row will be inserted before/after the row of the currently selected cell.
1323
- * As well the row-selection events have to be bound again.
1324
- *
1325
- * @param position
1326
- * could be 'after' or 'before'. defines the position where the new
1327
- * rows should be inserted
1328
- * @param highlightNewRows
1329
- * flag if the newly created rows should be marked as selected
1330
- * @return void
1331
- */
1332
- GENTICS.Aloha.Table.prototype.addRows = function(position, highlightNewRows) {
1333
- if (typeof GENTICS.Aloha.SimpleTablePlugin.activeTable != 'undefined') {
1334
- // release listening events of the last cell
1335
- this.releaseLastCellEvents();
1336
-
1337
- var that = this;
1338
- var numCols = this.numCols;
1339
-
1340
- // number of rows to insert
1341
- var rowsToInsert = 1;
1342
- // index where new rows should be inserted
1343
- var rowId = 1;
1344
-
1345
- // if rows were selected take the amount of selected cells for the new rows
1346
- if (GENTICS.Aloha.TableHelper.selectedCells.length > 0) {
1347
- rowsToInsert = GENTICS.Aloha.TableHelper.selectedCells.length;
1348
-
1349
- // get the index where the new rows should be inserted
1350
- switch (position) {
1351
- case 'before':
1352
- if (GENTICS.Aloha.TableHelper.selectedCells[0].length){
1353
- rowId = GENTICS.Aloha.TableHelper.selectedCells[0][0].parentNode.rowIndex;
1354
- }
1355
- break;
1356
- case 'after':
1357
- var lastRow = GENTICS.Aloha.TableHelper.selectedCells.length - 1;
1358
- if (GENTICS.Aloha.TableHelper.selectedCells[lastRow].length){
1359
- rowId = GENTICS.Aloha.TableHelper.selectedCells[lastRow][0].parentNode.rowIndex;
1360
- }
1361
- break;
1362
- }
1363
-
1364
- // no rows selected, insert 1 new row before/after the row of the last active cell
1365
- }else if (typeof GENTICS.Aloha.Table.Cell.lastActiveCell != 'undefined') {
1366
- rowId = GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.parentNode.rowIndex;
1367
- }
1368
-
1369
- // the new row index for the created row
1370
- var newRowIndex = rowId;
1371
- // if the new rows should be inserted after the last selected row
1372
- // increase the rowindex will be one more than the actual row
1373
- if (position == 'after') {
1374
- newRowIndex += 1;
1375
- }
1376
-
1377
- var rowIdArray = new Array();
1378
- for (var j = 0; j < rowsToInsert; j++) {
1379
- rowIdArray.push(newRowIndex);
1380
- var insertionRow = jQuery('<tr>');
1381
-
1382
- // create the first column, the "select row" column
1383
- var selectionColumn = jQuery('<td>');
1384
- selectionColumn.addClass(this.get('classSelectionColumn'));
1385
- this.attachRowSelectionEventsToCell(selectionColumn);
1386
- insertionRow.append(selectionColumn);
1387
-
1388
- for (i = 0; i < numCols; i++) {
1389
- var newCol = jQuery('<td>');
1390
- newCol.html('\u00a0');
1391
- var cell = new GENTICS.Aloha.Table.Cell(newCol.get(0), GENTICS.Aloha.SimpleTablePlugin.activeTable);
1392
- cell.activate();
1393
- this.cells.push(cell);
1394
-
1395
- insertionRow.append(cell.obj);
1396
- }
1397
-
1398
-
1399
- var currentRow = jQuery(GENTICS.Aloha.SimpleTablePlugin.activeTable.obj.find("tr").get(rowId));
1400
-
1401
- switch (position) {
1402
- case 'before':
1403
- currentRow.before(insertionRow);
1404
- break;
1405
- case 'after':
1406
- currentRow.after(insertionRow);
1407
- break;
1408
- default:
1409
- this.warn(this, 'Wrong call of GENTICS.Aloha.Table.prototype.addRow!');
1410
- }
1411
- newRowIndex ++;
1412
- this.numRows ++;
1413
- }
1414
- GENTICS.Aloha.TableHelper.unselectCells();
1415
-
1416
- this.rowsToSelect = rowIdArray;
1417
- if (highlightNewRows) {
1418
- this.selectRows();
1419
- }
1420
-
1421
- // re-attach events of the last cell
1422
- this.attachLastCellEvents();
1423
- }
1424
- };
1425
-
1426
- /**
1427
- * Wrapper method to add columns on the right side
1428
- *
1429
- * @see GENTICS.Aloha.Table.addColumns
1430
- * @return void
1431
- */
1432
- GENTICS.Aloha.Table.prototype.addColumnsRight = function () {
1433
- this.addColumns('right');
1434
- };
1435
-
1436
- /**
1437
- * Wrapper method to add columns on the left side
1438
- *
1439
- * @see GENTICS.Aloha.Table.addColumns
1440
- * @return void
1441
- */
1442
- GENTICS.Aloha.Table.prototype.addColumnsLeft = function() {
1443
- this.addColumns('left');
1444
- };
1445
-
1446
- /**
1447
- * Inserts new columns into the table. Either on the right or left side. If
1448
- * columns are selected, the amount of selected columns will be inserted on the
1449
- * 'right' or 'left' side. If no cells are selected, 1 new column will be
1450
- * inserted before/after the column of the last active cell.
1451
- * As well all column-selection events must be bound to the firsts row-cell.
1452
- *
1453
- * @param position
1454
- * could be 'left' or 'right'. defines the position where the new
1455
- * columns should be inserted
1456
- * @return void
1457
- */
1458
- GENTICS.Aloha.Table.prototype.addColumns = function (position) {
1459
- if (typeof GENTICS.Aloha.SimpleTablePlugin.activeTable != 'undefined') {
1460
- // release listening events of the last cell
1461
- this.releaseLastCellEvents();
1462
-
1463
- var that = this;
1464
-
1465
- // amount of columns to insert
1466
- var columnsToInsert = 1;
1467
- // index of the column from where the new columns should be inserted
1468
- var colId = 1;
1469
-
1470
- // if columns are selected, get the column-index of the column on the left/right selected end
1471
- if (GENTICS.Aloha.TableHelper.selectedCells.length > 0) {
1472
- columnsToInsert = GENTICS.Aloha.TableHelper.selectedCells[0].length;
1473
- switch (position) {
1474
- case 'left':
1475
- if (GENTICS.Aloha.TableHelper.selectedCells[0].length){
1476
- colId = GENTICS.Aloha.TableHelper.selectedCells[0][0].cellIndex;
1477
- }
1478
- break;
1479
- case 'right':
1480
- var lastColumn = GENTICS.Aloha.TableHelper.selectedCells[0].length - 1;
1481
- if (GENTICS.Aloha.TableHelper.selectedCells[0].length){
1482
- colId = GENTICS.Aloha.TableHelper.selectedCells[0][lastColumn].cellIndex;
1483
- }
1484
- break;
1485
- }
1486
- // otherwise take the column-index of the last active cell
1487
- }else if (typeof GENTICS.Aloha.Table.Cell.lastActiveCell != 'undefined') {
1488
- colId = GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.cellIndex;
1489
- }
1490
-
1491
- // the new col index for the created column
1492
- var newColId = colId;
1493
-
1494
- var emptyCell = jQuery('<td>');
1495
- var rows = this.obj.find('tr');
1496
- var colIdArray = new Array();
1497
- for (var i = 0; i < rows.length; i++){
1498
- var currentColId = newColId;
1499
- var row = rows[i];
1500
-
1501
- for (var j = 0; j < columnsToInsert; j++) {
1502
- var cell = emptyCell.clone();
1503
- cell.html('\u00a0');
1504
- // this is the first row, so make a column-selection cell
1505
- if (i == 0) {
1506
- this.attachColumnSelectEventsToCell(cell);
1507
-
1508
- }else{
1509
- cellObj = new GENTICS.Aloha.Table.Cell(cell.get(0), GENTICS.Aloha.SimpleTablePlugin.activeTable);
1510
- this.cells.push(cellObj);
1511
- cellObj.activate();
1512
- cell = cellObj.obj;
1513
- }
1514
-
1515
- var insertionColumn = jQuery(jQuery(row).find("td").get(newColId));
1516
- switch (position) {
1517
- case 'left':
1518
- if (jQuery.inArray(currentColId, colIdArray) < 0) {
1519
- colIdArray.push(currentColId);
1520
- }
1521
- insertionColumn.before(cell);
1522
- break;
1523
- case 'right':
1524
- if (jQuery.inArray((currentColId + 1), colIdArray) < 0) {
1525
- colIdArray.push(currentColId + 1);
1526
- }
1527
- insertionColumn.after(cell);
1528
- break;
1529
- }
1530
- currentColId ++;
1531
- }
1532
- }
1533
- this.numCols += columnsToInsert;
1534
- GENTICS.Aloha.TableHelper.unselectCells();
1535
- this.columnsToSelect = colIdArray;
1536
- this.selectColumns();
1537
-
1538
- // re-attach events of the last cell
1539
- this.attachLastCellEvents();
1540
- }
1541
- };
1542
-
1543
- /**
1544
- * Helper method to set the focus-attribute of the table to true
1545
- *
1546
- * @return void
1547
- */
1548
- GENTICS.Aloha.Table.prototype.focus = function() {
1549
- if (!this.hasFocus) {
1550
- if (!this.parentEditable.isActive) {
1551
- this.parentEditable.obj.focus();
1552
- }
1553
-
1554
- GENTICS.Aloha.SimpleTablePlugin.setFocusedTable(this);
1555
- this.floatingMenu.call();
1556
- }
1557
-
1558
- // TODO workaround - fix this. the selection is updated later on by the browser
1559
- // using setTimeout here is hideous, but a simple execution-time call will fail
1560
- setTimeout('GENTICS.Aloha.Selection.updateSelection(false, true)', 50);
1561
-
1562
- };
1563
-
1564
- /**
1565
- * Helper method to set the focus-attribute of the table to false
1566
- *
1567
- * @return void
1568
- */
1569
- GENTICS.Aloha.Table.prototype.focusOut = function() {
1570
- if (this.hasFocus) {
1571
- this.hasFocus = false;
1572
- GENTICS.Aloha.SimpleTablePlugin.setFocusedTable(undefined);
1573
- }
1574
- };
1575
-
1576
- /**
1577
- * Marks all cells of the specified column as marked (adds a special class)
1578
- *
1579
- * @return void
1580
- */
1581
- GENTICS.Aloha.Table.prototype.selectColumns = function() {
1582
- // get the class which selected cells should have
1583
- var selectClass = this.get('classCellSelected');
1584
-
1585
- // unselect selected cells
1586
- GENTICS.Aloha.TableHelper.unselectCells();
1587
-
1588
- GENTICS.Aloha.TableHelper.selectionType = 'col';
1589
-
1590
- this.columnsToSelect.sort(function(a,b){return a - b;});
1591
-
1592
- var rows = this.obj.find("tr").toArray();
1593
- // first row is the selection row (dump it => not needed)
1594
- rows.shift();
1595
- var toSelect = new Array();
1596
- for (var i = 0; i < rows.length; i++){
1597
- var rowCells = rows[i].cells;
1598
-
1599
- var selectedCellsInCol = new Array();
1600
- for (var j = 0; j < this.columnsToSelect.length; j++) {
1601
- var colIndex = this.columnsToSelect[j];
1602
- var cell = rowCells[colIndex];
1603
- toSelect.push(cell);
1604
- if (i == 0 && j == 0) {
1605
- if (jQuery.browser.msie) {
1606
- // setTimeout(jQuery(cell).children('div.GENTICS_Table_Cell_editable').get(0).focus, 5);
1607
- }else{
1608
- jQuery(cell).children('div.GENTICS_Table_Cell_editable').get(0).focus();
1609
- }
1610
- }
1611
- selectedCellsInCol.push(cell);
1612
- }
1613
- GENTICS.Aloha.TableHelper.selectedCells.push(selectedCellsInCol);
1614
- };
1615
- jQuery(toSelect).addClass(selectClass);
1616
- };
1617
-
1618
-
1619
- /**
1620
- * Marks all cells of the specified row as marked (adds a special class)
1621
- *
1622
- * @return void
1623
- */
1624
- GENTICS.Aloha.Table.prototype.selectRows = function() {
1625
- // get the class which selected cells should have
1626
- var selectClass = this.get('classCellSelected');
1627
-
1628
- // unselect selected cells
1629
- GENTICS.Aloha.TableHelper.unselectCells();
1630
- this.rowsToSelect.sort(function(a,b){return a - b;});
1631
-
1632
- for (var i = 0; i < this.rowsToSelect.length; i++) {
1633
- var rowId = this.rowsToSelect[i];
1634
- var rowCells = jQuery(this.obj.find('tr').get(rowId).cells).toArray();
1635
-
1636
- // shift the first element (which is a selection-helper cell)
1637
- rowCells.shift();
1638
-
1639
- GENTICS.Aloha.TableHelper.selectedCells.push(rowCells);
1640
- if (i == 0) {
1641
- if (jQuery.browser.msie) {
1642
- // setTimeout(jQuery(rowCells[0]).children('div.GENTICS_Table_Cell_editable').get(0).focus, 5);
1643
- }else{
1644
- jQuery(rowCells[0]).children('div.GENTICS_Table_Cell_editable').get(0).focus();
1645
- }
1646
- }
1647
- jQuery(rowCells).addClass(this.get('classCellSelected'));
1648
- }
1649
- GENTICS.Aloha.TableHelper.selectionType = 'row';
1650
- };
1651
-
1652
-
1653
- /**
1654
- * Deactivation of a Aloha-Table. Clean up ... remove the wrapping div and the
1655
- * selection-helper divs
1656
- *
1657
- * @return void
1658
- */
1659
- GENTICS.Aloha.Table.prototype.deactivate = function() {
1660
- this.obj.removeClass(this.get('className'));
1661
- if (GENTICS.Aloha.trim(this.obj.attr('class')) == '') {
1662
- this.obj.removeAttr('class');
1663
- }
1664
- this.obj.removeAttr('contenteditable');
1665
- this.obj.removeAttr('id');
1666
-
1667
- // unwrap the selectionLeft-div if available
1668
- if (this.obj.parents('.' + this.get('classTableWrapper')).length){
1669
- this.obj.unwrap();
1670
- }
1671
-
1672
- // remove the selection row
1673
- this.obj.find('tr.' + this.get('classSelectionRow') + ':first').remove();
1674
- // remove the selection column (first column left)
1675
- var that = this;
1676
- jQuery.each(this.obj.context.rows, function(){
1677
- jQuery(this).children('td.' + that.get('classSelectionColumn')).remove();
1678
- });
1679
-
1680
- // remove the "selection class" from all td and th in the table
1681
- this.obj.find('td, th').removeClass(this.get('classCellSelected'));
1682
- this.obj.unbind();
1683
- // wrap the inner html of the contentEditable div to its outer html
1684
- for (var i = 0; i < this.cells.length; i++) {
1685
- var Cell = this.cells[i];
1686
- Cell.deactivate();
1687
- }
1688
- };
1689
-
1690
- /**
1691
- * toString-method for GENTICS.Aloha.Table object
1692
- *
1693
- * @return void
1694
- */
1695
- GENTICS.Aloha.Table.prototype.toString = function() {
1696
- return 'GENTICS.Aloha.Table';
1697
- };
1698
- /* -- END METHODS -- */
1699
-
1700
-
1701
- /*****************************
1702
- +--------------------------+
1703
- | GENTICS.Aloha.Table.Cell |
1704
- +--------------------------+
1705
- ******************************/
1706
-
1707
- /**
1708
- * The constructor for the Cell-Objects takes a DOM td-object, attaches
1709
- * events, adds an wrapper into the cell and returns the modified td-object as
1710
- * DOM representation
1711
- *
1712
- * @param originalTd
1713
- * The original td-field which should will be transformed
1714
- * @param colId
1715
- * the internal id of the corresponding col (begin with 0)
1716
- * @param rowId
1717
- * the internal id of the corresponding row (begin with 0)
1718
- * @param tableObj
1719
- * GENTICS.Aloha.Table-Object which contains the cell
1720
- *
1721
- * @return the created table-data field as DOM-representation
1722
- */
1723
- GENTICS.Aloha.Table.Cell = function(originalTd, tableObj) {
1724
- this.obj = jQuery(originalTd);
1725
- this.tableObj = tableObj;
1726
- };
1727
- /* -- ATTRIBUTES -- */
1728
- /**
1729
- * Reference to the jQuery-representation of the wrapping table
1730
- *
1731
- * @see GENTICS.Aloha.Table.Cell.table
1732
- */
1733
- GENTICS.Aloha.Table.Cell.prototype.tableObj = undefined;
1734
-
1735
- /**
1736
- * Reference to the jQuery td-Object of the cell
1737
- */
1738
- GENTICS.Aloha.Table.Cell.prototype.obj = undefined;
1739
-
1740
- /**
1741
- * The jQuery wrapper of the cell
1742
- */
1743
- GENTICS.Aloha.Table.Cell.prototype.wrapper = undefined;
1744
-
1745
- /**
1746
- * Flag if the cell has focus
1747
- */
1748
- GENTICS.Aloha.Table.Cell.prototype.hasFocus = false;
1749
-
1750
- /**
1751
- * The jQuery wrapper of the cell
1752
- */
1753
- GENTICS.Aloha.Table.Cell.activeCell = undefined;
1754
-
1755
- /**
1756
- * The jQuery wrapper of the cell
1757
- */
1758
- GENTICS.Aloha.Table.Cell.lastActiveCell = undefined;
1759
- /* -- END ATTRIBUTES -- */
1760
-
1761
-
1762
- /**
1763
- * Focus method for the contentediable div within a table data-field. The method
1764
- * requires the event-property Cell as a GENTICS.Aloha.Table.Cell object. If the
1765
- * Cell wasn't activated yet it does all relevant actions to activate the cell.
1766
- *
1767
- * @param e
1768
- * the jquery event object
1769
- * @return void
1770
- */
1771
- GENTICS.Aloha.Table.Cell.prototype.editableFocus = function(e) {
1772
- // only do activation stuff if the cell don't has the focus
1773
- if (!this.hasFocus) {
1774
- // set an internal flag to focus the table
1775
- this.tableObj.focus();
1776
-
1777
- // set the clicked cell active as the active cell
1778
- GENTICS.Aloha.Table.Cell.activeCell = this;
1779
-
1780
- // set the clicked cell active as the last active cell (the difference
1781
- // to activeCell is that lastActiveCell won't be reset on blur)
1782
- GENTICS.Aloha.Table.Cell.lastActiveCell = this;
1783
-
1784
- // add an active-class
1785
- this.obj.addClass('GENTICS_Table_Cell_active');
1786
-
1787
- // set the focus flag
1788
- this.hasFocus = true;
1789
-
1790
- // select the whole content in the table-data field
1791
- this.selectAll(this.wrapper.get(0));
1792
- }
1793
- };
1794
-
1795
- /**
1796
- * Blur event for the contenteditable div within a table-data field. The method
1797
- * requires the event-property Cell as a GENTICS.Aloha.Table.Cell object. It
1798
- * sets the hasFocus flag of the cell to false and removes the "active"
1799
- * css-class.
1800
- *
1801
- * @param jqEvent
1802
- * the jquery event object
1803
- * @return void
1804
- */
1805
- GENTICS.Aloha.Table.Cell.prototype.editableBlur = function(jqEvent){
1806
- // no active cell
1807
- GENTICS.Aloha.Table.Cell.activeCell = undefined;
1808
-
1809
- // reset the focus of the cell
1810
- this.hasFocus = false;
1811
-
1812
- // remove "active class"
1813
- this.obj.removeClass('GENTICS_Table_Cell_active');
1814
- };
1815
-
1816
- GENTICS.Aloha.Table.Cell.prototype.activate = function() {
1817
- // create the editable wrapper for the cells
1818
- // var wrapper = jQuery('<div>');
1819
- // wrapper.attr('contentEditable', 'true');
1820
- // wrapper.addClass('GENTICS_Table_Cell_editable');
1821
- //
1822
- // var that = this;
1823
- // // attach events to the editable div-object
1824
- // wrapper.bind('focus', function(jqEvent) { that.editableFocus(jqEvent); });
1825
- // wrapper.bind('mousedown', function(jqEvent) { that.editableMouseDown(jqEvent); });
1826
- // wrapper.bind('blur', function(jqEvent) { that.editableBlur(jqEvent); });
1827
- // wrapper.bind('keyup', function(jqEvent) { that.editableKeyUp(jqEvent); });
1828
- // wrapper.bind('keydown', function(jqEvent) { that.editableKeyDown(jqEvent); });
1829
- //
1830
- // this.obj.bind('mousedown', function(jqEvent) {
1831
- // setTimeout(function() {
1832
- // that.wrapper.trigger('focus');
1833
- // }, 1);
1834
- //
1835
- // // unselect cells
1836
- // GENTICS.Aloha.TableHelper.unselectCells();
1837
- //
1838
- // jqEvent.stopPropagation();
1839
- // });
1840
- // this.obj.get(0).onselectstart = function (jqEvent) { return false; };
1841
- //
1842
- // // wrap the created div into the contents of the cell
1843
- // this.obj.wrapInner(wrapper);
1844
- //
1845
- // // set contenteditable wrapper div
1846
- // this.wrapper = this.obj.children();
1847
- // this.wrapper.get(0).onselectstart = function() {
1848
- // window.event.cancelBubble = true;
1849
- // };
1850
-
1851
- return this;
1852
- };
1853
-
1854
- /**
1855
- * The deactivate method removes the contenteditable helper div within the
1856
- * table-data field and wraps the innerHtml to the outerHTML
1857
- *
1858
- * @return void
1859
- */
1860
- GENTICS.Aloha.Table.Cell.prototype.deactivate = function() {
1861
- var wrapper = this.obj.children('.GENTICS_Table_Cell_editable');
1862
-
1863
- if (wrapper.length) {
1864
- // get the inner html of the contenteditable div
1865
- var innerHtml = wrapper.html();
1866
-
1867
- // remove the contenteditable div and its attached events
1868
- wrapper.unbind();
1869
- wrapper.remove();
1870
-
1871
- // remove the click event of the
1872
- this.obj.unbind('click');
1873
-
1874
- if (GENTICS.Aloha.trim(this.obj.attr('class')) == '') {
1875
- this.obj.removeAttr('class');
1876
- }
1877
-
1878
- // set the inner html of the contenteditable div as html for the table-data
1879
- // field
1880
- this.obj.html(innerHtml);
1881
- }
1882
- };
1883
-
1884
- /**
1885
- * Native toString-method
1886
- *
1887
- * @return string name of the namespace
1888
- */
1889
- GENTICS.Aloha.Table.Cell.prototype.toString = function() {
1890
- return 'GENTICS.Aloha.Table.Cell';
1891
- };
1892
-
1893
- /**
1894
- * Selects all inner-contens of an contentEditable-object
1895
- *
1896
- * @param editableNode dom-representation of the editable node (div-element)
1897
- * @return void
1898
- */
1899
- GENTICS.Aloha.Table.Cell.prototype.selectAll = function(editableNode) {
1900
- var e = (editableNode.jquery) ? editableNode.get(0) : editableNode;
1901
-
1902
- // Not IE
1903
- if (!jQuery.browser.msie) {
1904
- var s = window.getSelection();
1905
- // Safari
1906
- if (s.setBaseAndExtent) {
1907
- s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
1908
- }
1909
- // Firefox and Opera
1910
- else {
1911
- // workaround for bug # 42885
1912
- if (window.opera
1913
- && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>') {
1914
- e.innerHTML = e.innerHTML + '&nbsp;';
1915
- }
1916
-
1917
- var r = document.createRange();
1918
- r.selectNodeContents(e);
1919
- s.removeAllRanges();
1920
- s.addRange(r);
1921
- }
1922
- }
1923
- // Some older browsers
1924
- else if (document.getSelection) {
1925
- var s = document.getSelection();
1926
- var r = document.createRange();
1927
- r.selectNodeContents(e);
1928
- s.removeAllRanges();
1929
- s.addRange(r);
1930
- }
1931
- // IE
1932
- else if (document.selection) {
1933
- var r = document.body.createTextRange();
1934
- r.moveToElementText(e);
1935
- r.select();
1936
- }
1937
-
1938
- GENTICS.Aloha.Selection.updateSelection(editableNode);
1939
- };
1940
-
1941
- /**
1942
- * The mouse-down event for the editable-div in the thd-field. Unselect all
1943
- * cells when clicking on the editable-div.
1944
- *
1945
- * @param jqEvent
1946
- * the jquery-event object
1947
- * @return void
1948
- */
1949
- GENTICS.Aloha.Table.Cell.prototype.editableMouseDown = function(jqEvent) {
1950
- // deselect all highlighted cells registred in the TableHelper object
1951
- GENTICS.Aloha.TableHelper.unselectCells();
1952
-
1953
- if (this.tableObj.hasFocus) {
1954
- jqEvent.stopPropagation();
1955
- }
1956
- };
1957
-
1958
- /**
1959
- * The key-up event for the editable-div in the td-field. Just check if the div
1960
- * is empty and insert an &nbsp;
1961
- *
1962
- * @param jqEvent
1963
- * the jquery-event object
1964
- * @return void
1965
- */
1966
- GENTICS.Aloha.Table.Cell.prototype.editableKeyUp = function(jqEvent) {
1967
- this.checkForEmptyEvent(jqEvent);
1968
- };
1969
-
1970
- /**
1971
- * The key-down event for the ediable-div in the td-field. Check if the the div
1972
- * is empty and insert an &nbsp. Furthermore if cells are selected, unselect
1973
- * them.
1974
- *
1975
- * @param jqEvent
1976
- * the jquery-event object
1977
- * @return void
1978
- */
1979
- GENTICS.Aloha.Table.Cell.prototype.editableKeyDown = function(jqEvent) {
1980
- this.checkForEmptyEvent(jqEvent);
1981
- if (!jqEvent.ctrlKey && !jqEvent.shiftKey) {
1982
- if (GENTICS.Aloha.TableHelper.selectedCells.length > 0 && GENTICS.Aloha.TableHelper.selectedCells[0].length > 0) {
1983
- GENTICS.Aloha.TableHelper.selectedCells[0][0].firstChild.focus();
1984
- GENTICS.Aloha.TableHelper.unselectCells();
1985
- jqEvent.stopPropagation();
1986
- }
1987
- }else if(jqEvent.shiftKey && GENTICS.Aloha.TableHelper.selectedCells.length > 0){
1988
- var KEYCODE_ARROWLEFT = 37;
1989
- var KEYCODE_ARROWUP = 38;
1990
- var KEYCODE_ARROWRIGHT = 39;
1991
- var KEYCODE_ARROWDOWN = 40;
1992
- switch (GENTICS.Aloha.TableHelper.selectionType) {
1993
- case 'row':
1994
- switch(jqEvent.keyCode) {
1995
- case KEYCODE_ARROWUP:
1996
- var firstSelectedRow = GENTICS.Aloha.TableHelper.selectedCells[0][0].parentNode.rowIndex;
1997
- if (firstSelectedRow > 1) {
1998
- this.tableObj.rowsToSelect.push(firstSelectedRow - 1);
1999
- }
2000
- break;
2001
- case KEYCODE_ARROWDOWN:
2002
- var lastRowIndex = GENTICS.Aloha.TableHelper.selectedCells.length - 1;
2003
- var lastSelectedRow = GENTICS.Aloha.TableHelper.selectedCells[lastRowIndex][0].parentNode.rowIndex;
2004
- if (lastSelectedRow < this.tableObj.numRows) {
2005
- this.tableObj.rowsToSelect.push(lastSelectedRow + 1);
2006
- }
2007
- break;
2008
- }
2009
- this.tableObj.selectRows();
2010
-
2011
- break;
2012
- case 'col':
2013
- switch(jqEvent.keyCode) {
2014
- case KEYCODE_ARROWLEFT:
2015
- var firstColSelected = GENTICS.Aloha.TableHelper.selectedCells[0][0].cellIndex;
2016
- if (firstColSelected > 1) {
2017
- this.tableObj.columnsToSelect.push(firstColSelected - 1);
2018
- }
2019
- break;
2020
- case KEYCODE_ARROWRIGHT:
2021
- var lastColIndex = GENTICS.Aloha.TableHelper.selectedCells[0].length - 1;
2022
- var lastColSelected = GENTICS.Aloha.TableHelper.selectedCells[0][lastColIndex].cellIndex;
2023
- if (lastColSelected < this.tableObj.numCols) {
2024
- this.tableObj.columnsToSelect.push(lastColSelected + 1);
2025
- }
2026
- break;
2027
- }
2028
- this.tableObj.selectColumns();
2029
-
2030
- break;
2031
- }
2032
- jqEvent.stopPropagation();
2033
- jqEvent.preventDefault();
2034
- return false;
2035
- }
2036
- };
2037
-
2038
- /**
2039
- * The custom keyup event for a table-cell Checks if the cell is empty and
2040
- * inserts a space (\u00a0)
2041
- *
2042
- * @param e
2043
- * the event object which is given by jquery
2044
- * @return void
2045
- */
2046
- GENTICS.Aloha.Table.Cell.prototype.checkForEmptyEvent = function(jqEvent) {
2047
- // get the editable contents
2048
- var text = this.wrapper.text();
2049
-
2050
- // if empty insert a blank space and blur and focus the wrapper
2051
- if (text == ''){
2052
- this.wrapper.text('\u00a0');
2053
- this.wrapper.get(0).blur();
2054
- this.wrapper.get(0).focus();
2055
- }
2056
- };
2057
- /* -- END METHODS -- */
2058
-
2059
-
2060
- /**************************************
2061
- +---------------------------------+
2062
- | GENTICS.Aloha.Table.CreateLayer |
2063
- +---------------------------------+
2064
- ***************************************/
2065
- /**
2066
- * Dummy initialize of the CreateLayer object
2067
- */
2068
- GENTICS.Aloha.Table.CreateLayer = function(){};
2069
-
2070
- /* -- ATTRIBUTES -- */
2071
- /**
2072
- * Internal configuration of the create-table panel
2073
- */
2074
- GENTICS.Aloha.Table.CreateLayer.prototype.parameters = {
2075
- elemId: 'GENTICS_Aloha_SimpleTable_createLayer', // id of the create-table panel
2076
- className: 'GENTICS_Table_Createdialog', // class-name of the create-table panel
2077
- numX: 10, // Number of cols in the create-layer
2078
- numY: 10, // Number of rows in the create-layer vertically
2079
- layer: undefined, // Attribute holding the create-layer
2080
- target: undefined // the clicktarget which was clicked on (mostly the button of the floatingmenu)
2081
- };
2082
-
2083
- /**
2084
- * The configuration-object for the implementer of the plugin. All keys of
2085
- * the "parameters" object could be overwritten within this object and will
2086
- * simply be used instead.
2087
- */
2088
- GENTICS.Aloha.Table.CreateLayer.prototype.config = new Object();
2089
-
2090
- /**
2091
- * Flag wether the CreateLayer is currently visble or not
2092
- */
2093
- GENTICS.Aloha.Table.CreateLayer.prototype.visible = false;
2094
- /* -- END ATTRIBUTES -- */
2095
-
2096
- /* -- METHODS -- */
2097
- /**
2098
- * This function checks if there is an create-table-layer. If no layer exists, it creates one and puts it into the configuration.
2099
- * If the layer was already created it sets the position of the panel and shows it.
2100
- *
2101
- * @return void
2102
- */
2103
- GENTICS.Aloha.Table.CreateLayer.prototype.show = function(){
2104
- var layer = this.get('layer');
2105
-
2106
- // create the panel if the layer doesn't exist
2107
- if (layer == null) {
2108
- this.create();
2109
- }else {
2110
- // or reposition, cleanup and show the layer
2111
- this.setPosition(layer);
2112
- layer.find('td').removeClass('hover');
2113
- layer.show();
2114
- }
2115
- this.visible = true;
2116
- };
2117
- /**
2118
- * Creates the div-layer which holds a table with the given number of rows and cols.
2119
- * It sets click and mouseover-events to the table data fields
2120
- *
2121
- * @return void
2122
- */
2123
- GENTICS.Aloha.Table.CreateLayer.prototype.create = function () {
2124
- var that = this;
2125
- var layer = jQuery('<div></div>');
2126
- layer.id = this.get('elemId');
2127
- layer.addClass(this.get('className'));
2128
-
2129
- var table = jQuery('<table></table>');
2130
- table.css('width', (this.get('numX') + 6) * 15);
2131
- var tr;
2132
- var td;
2133
-
2134
- for (var i = 0; i < this.get('numY'); i++) {
2135
- tr = jQuery('<tr></tr>');
2136
-
2137
- for (var j = 0; j < this.get('numX'); j++) {
2138
- td = jQuery('<td>\u00a0</td>');
2139
-
2140
- if (i == 0 && j == 0) {
2141
- td.addClass('hover');
2142
- }
2143
-
2144
- td.bind('mouseover', {rowId: i, colId: j}, function(e) {
2145
- that.handleMouseOver(e, table);
2146
- });
2147
-
2148
- td.bind('click', {rowId: i, colId: j}, function(e){
2149
- var rows = e.data.rowId + 1;
2150
- var cols = e.data.colId + 1;
2151
-
2152
- GENTICS.Aloha.SimpleTablePlugin.createTable(cols, rows);
2153
- that.hide();
2154
- });
2155
-
2156
- tr.append(td);
2157
- }
2158
- table.append(tr);
2159
- }
2160
- layer.append(table);
2161
-
2162
- // set attributes
2163
- this.set('layer', layer);
2164
- this.setPosition();
2165
-
2166
- // stop bubbling the click on the create-dialog up to the body event
2167
- layer.bind('click', function(e) {
2168
- e.stopPropagation();
2169
- });
2170
-
2171
- // append layer to body and
2172
- // hide the create layer if user clicks anywhere in the body
2173
- jQuery('body').append(layer).bind('click', function(e) {
2174
- if (e.target != that.get('target') && that.visible) {
2175
- that.hide();
2176
- }
2177
- });
2178
- };
2179
-
2180
- /**
2181
- * handles the mose over state for a cell
2182
- * @param e event object
2183
- * @param table the aeffected table
2184
- * @return void
2185
- */
2186
- GENTICS.Aloha.Table.CreateLayer.prototype.handleMouseOver = function(e, table) {
2187
- var rowId = e.data.rowId;
2188
- var colId = e.data.colId;
2189
- var innerRows = table.find('tr');
2190
-
2191
- for (var n = 0; n <= innerRows.length; n++) {
2192
- var innerCells = jQuery(innerRows[n]).find('td');
2193
-
2194
- for (var k = 0; k <= innerCells.length; k++) {
2195
- if (n <= rowId && k <= colId) {
2196
- jQuery(innerCells[k]).addClass('hover');
2197
- } else {
2198
- jQuery(innerCells[k]).removeClass('hover');
2199
- }
2200
- }
2201
- }
2202
- };
2203
-
2204
- /**
2205
- * Sets the "left" and "top" style-attributes according to the clicked target-button
2206
- *
2207
- * @return void
2208
- */
2209
- GENTICS.Aloha.Table.CreateLayer.prototype.setPosition = function() {
2210
- var targetObj = jQuery(this.get('target'));
2211
- var pos = targetObj.offset();
2212
- this.get('layer').css('left', pos.left + 'px');
2213
- this.get('layer').css('top', (pos.top + targetObj.height()) + 'px');
2214
- };
2215
-
2216
-
2217
- /**
2218
- * Hides the create-table panel width the jQuery-method hide()
2219
- *
2220
- * @see jQuery().hide()
2221
- * @return void
2222
- */
2223
- GENTICS.Aloha.Table.CreateLayer.prototype.hide = function() {
2224
- this.get('layer').hide();
2225
- this.visible = false;
2226
- };
2227
-
2228
- /**
2229
- * The "get"-method returns the value of the given key. First it searches in the
2230
- * config for the property. If there is no property with the given name in the
2231
- * "config"-object it returns the entry associated with in the parameters-object
2232
- *
2233
- * @param property
2234
- * @return void
2235
- */
2236
- GENTICS.Aloha.Table.CreateLayer.prototype.get = function(property) {
2237
- // return param from the config
2238
- if (this.config[property]) {
2239
- return this.config[property];
2240
- }
2241
- // if config-param was not found return param from the parameters-object
2242
- if (this.parameters[property]) {
2243
- return this.parameters[property];
2244
- }
2245
- return undefined;
2246
- };
2247
-
2248
- /**
2249
- * The "set"-method takes a key and a value. It checks if there is a key-value
2250
- * pair in the config-object. If so it saves the data in the config-object. If
2251
- * not it saves the data in the parameters-object.
2252
- *
2253
- * @param key
2254
- * the key which should be set
2255
- * @param value
2256
- * the value which should be set for the associated key
2257
- */
2258
- GENTICS.Aloha.Table.CreateLayer.prototype.set = function (key, value) {
2259
- // if the key already exists in the config-object, set it to the config-object
2260
- if (this.config[key]) {
2261
- this.config[key] = value;
2262
-
2263
- // otherwise "add" it to the parameters-object
2264
- }else{
2265
- this.parameters[key] = value;
2266
- }
2267
- };
2268
- /* -- END METHODS -- */
2269
-
2270
-
2271
-
2272
- /********************************
2273
- +---------------------------+
2274
- | GENTICS.Aloha.TableHelper |
2275
- +---------------------------+
2276
- *********************************/
2277
- /**
2278
- * The TableHelper object is a helper-object which consists of static/global attributes and functions
2279
- */
2280
- GENTICS.Aloha.TableHelper = function(){};
2281
-
2282
- /* -- ATTRIBUTES -- */
2283
- /**
2284
- * Gives the type of the cell-selection
2285
- * possible values are "row" or "col"
2286
- */
2287
- GENTICS.Aloha.TableHelper.prototype.selectionType = undefined;
2288
-
2289
- /**
2290
- * Holds all currently selected table cells as an array of DOM "td" representations
2291
- */
2292
- GENTICS.Aloha.TableHelper.prototype.selectedCells = new Array();
2293
- /* -- END ATTRIBUTES -- */
2294
-
2295
- /* -- METHODS -- */
2296
- /**
2297
- * This method removes the "selected" class from all selected cells
2298
- *
2299
- * @return void
2300
- */
2301
- GENTICS.Aloha.TableHelper.prototype.unselectCells = function(){
2302
- if (this.selectedCells.length > 0) {
2303
- for (var i = 0; i < this.selectedCells.length; i++) {
2304
- jQuery(this.selectedCells[i]).removeClass(GENTICS.Aloha.SimpleTablePlugin.get('classCellSelected'));
2305
- }
2306
- this.selectedCells = new Array();
2307
- this.selectionType = undefined;
2308
- }
2309
- };
2310
-
2311
- GENTICS.Aloha.TableHelper.prototype.getNewTableID = function() {
2312
- var idPrefix = 'GENTICS_Table_';
2313
- var factor = 1000000;
2314
- for (this.tableCounter; true; this.tableCounter ++) {
2315
- var id = idPrefix + (Math.ceil(Math.random() * factor));
2316
- // fill up the id with zeros
2317
- for (var j = id.length; j < idPrefix.length + factor.toString().length; j++) {
2318
- id += '0';
2319
- }
2320
- if (!jQuery('#' + id).length) {
2321
- return id;
2322
- }
2323
- }
2324
- };
2325
- /* -- END METHODS -- */
2326
-
2327
- /**
2328
- * Initialize a new Object from the same object to get access to the prototype methods
2329
- */
2330
- GENTICS.Aloha.TableHelper = new GENTICS.Aloha.TableHelper();