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.
- data/Gemfile +15 -13
- data/README.textile +5 -4
- data/app/controllers/admin/api_contents_controller.rb +10 -1
- data/app/controllers/admin/base_controller.rb +2 -2
- data/app/controllers/admin/cross_domain_sessions_controller.rb +7 -4
- data/app/controllers/admin/current_sites_controller.rb +2 -0
- data/app/controllers/admin/imports_controller.rb +13 -19
- data/app/controllers/admin/installation_controller.rb +79 -0
- data/app/controllers/admin/pages_controller.rb +1 -1
- data/app/controllers/admin/passwords_controller.rb +2 -2
- data/app/controllers/admin/sessions_controller.rb +2 -2
- data/app/controllers/admin/sites_controller.rb +2 -0
- data/app/controllers/admin/theme_assets_controller.rb +1 -1
- data/app/controllers/application_controller.rb +1 -1
- data/app/helpers/admin/assets_helper.rb +0 -6
- data/app/helpers/admin/{login_helper.rb → box_helper.rb} +7 -3
- data/app/helpers/admin/custom_fields_helper.rb +2 -2
- data/app/models/asset_collection.rb +15 -3
- data/app/models/content_instance.rb +19 -0
- data/app/models/content_type.rb +21 -3
- data/app/models/extensions/page/tree.rb +63 -7
- data/app/models/page.rb +2 -0
- data/app/models/site.rb +15 -3
- data/app/uploaders/asset_uploader.rb +1 -1
- data/app/uploaders/theme_asset_uploader.rb +12 -1
- data/app/uploaders/theme_uploader.rb +19 -0
- data/app/views/admin/asset_collections/edit.html.haml +2 -2
- data/app/views/admin/asset_collections/new.html.haml +1 -1
- data/app/views/admin/assets/_form.html.haml +2 -2
- data/app/views/admin/content_types/_form.html.haml +2 -2
- data/app/views/admin/content_types/new.html.haml +1 -1
- data/app/views/admin/contents/_form.html.haml +2 -2
- data/app/views/admin/contents/index.html.haml +1 -1
- data/app/views/admin/cross_domain_sessions/new.html.haml +1 -1
- data/app/views/admin/current_sites/_form.html.haml +3 -3
- data/app/views/admin/current_sites/edit.html.haml +1 -1
- data/app/views/admin/errors/no_page.html.haml +1 -0
- data/app/views/admin/errors/no_site.html.haml +1 -0
- data/app/views/admin/imports/new.html.haml +11 -0
- data/app/views/admin/imports/show.html.haml +1 -1
- data/app/views/admin/installation/step_1.html.haml +24 -0
- data/app/views/admin/installation/step_2.html.haml +26 -0
- data/app/views/admin/installation/step_3.html.haml +23 -0
- data/app/views/{layouts/admin → admin/layouts}/application.html.haml +0 -0
- data/app/views/admin/layouts/box.html.haml +21 -0
- data/app/views/admin/layouts/error.html.haml +1 -0
- data/app/views/admin/my_accounts/edit.html.haml +1 -1
- data/app/views/admin/pages/_form.html.haml +2 -3
- data/app/views/admin/pages/_page.html.haml +4 -2
- data/app/views/admin/pages/index.html.haml +1 -1
- data/app/views/admin/passwords/edit.html.haml +2 -2
- data/app/views/admin/passwords/new.html.haml +2 -2
- data/app/views/admin/sessions/new.html.haml +2 -2
- data/app/views/admin/shared/_head.html.haml +4 -5
- data/app/views/admin/shared/menu/_contents.html.haml +1 -1
- data/app/views/admin/sites/_form.html.haml +3 -3
- data/app/views/admin/snippets/_form.html.haml +2 -2
- data/app/views/admin/theme_assets/_form.html.haml +2 -2
- data/app/views/admin/theme_assets/index.html.haml +1 -1
- data/config/application.rb +1 -3
- data/config/assets.yml +96 -0
- data/config/environments/development.rb +1 -6
- data/config/environments/production.rb +1 -1
- data/config/environments/test.rb +1 -5
- data/config/initializers/carrierwave.rb +17 -0
- data/config/initializers/locomotive.rb +14 -0
- data/config/locales/admin_ui_en.yml +33 -1
- data/config/locales/admin_ui_fr.yml +34 -1
- data/config/locales/default_en.yml +1 -0
- data/config/locales/default_fr.yml +1 -0
- data/config/locales/flash.en.yml +1 -0
- data/config/locales/flash.fr.yml +1 -0
- data/config/mongoid.yml +13 -5
- data/config/routes.rb +6 -1
- data/lib/generators/locomotive/install/install_generator.rb +18 -10
- data/lib/generators/locomotive/install/templates/README +23 -13
- data/lib/generators/locomotive/install/templates/locomotive.rb +15 -1
- data/lib/locomotive/carrierwave.rb +1 -0
- data/lib/locomotive/configuration.rb +3 -1
- data/lib/locomotive/custom_fields.rb +0 -1
- data/lib/locomotive/delayed_job.rb +1 -2
- data/lib/locomotive/engine.rb +24 -7
- data/lib/locomotive/heroku.rb +1 -0
- data/lib/locomotive/httparty/webservice.rb +12 -1
- data/lib/locomotive/import.rb +2 -0
- data/lib/locomotive/import/asset_collections.rb +40 -8
- data/lib/locomotive/import/assets.rb +20 -12
- data/lib/locomotive/import/base.rb +46 -0
- data/lib/locomotive/import/content_types.rb +51 -15
- data/lib/locomotive/import/job.rb +106 -11
- data/lib/locomotive/import/logger.rb +13 -0
- data/lib/locomotive/import/pages.rb +79 -26
- data/lib/locomotive/import/site.rb +3 -5
- data/lib/locomotive/import/snippets.rb +6 -8
- data/lib/locomotive/inherited_resources.rb +1 -0
- data/lib/locomotive/liquid/drops/asset_collections.rb +4 -4
- data/lib/locomotive/liquid/drops/contents.rb +21 -16
- data/lib/locomotive/liquid/drops/page.rb +4 -0
- data/lib/locomotive/liquid/filters/html.rb +15 -29
- data/lib/locomotive/liquid/tags/consume.rb +1 -1
- data/lib/locomotive/liquid/tags/nav.rb +48 -17
- data/lib/locomotive/liquid/tags/paginate.rb +3 -3
- data/lib/locomotive/middlewares/fonts.rb +3 -11
- data/lib/locomotive/misc_form_builder.rb +2 -7
- data/lib/locomotive/railties/tasks.rake +16 -0
- data/lib/locomotive/regexps.rb +1 -1
- data/lib/locomotive/render.rb +9 -3
- data/lib/locomotive/routing/site_dispatcher.rb +10 -6
- data/lib/locomotive/version.rb +1 -1
- data/public/images/admin/box/buttons/right_bg.png +0 -0
- data/public/javascripts/admin/aloha/VERSION.txt +1 -1
- data/public/javascripts/admin/aloha/aloha-nodeps.js +140 -101
- data/public/javascripts/admin/aloha/aloha.js +193 -105
- data/public/javascripts/admin/aloha/css/aloha.css +65 -4
- data/public/javascripts/admin/aloha/deps/prettyPhoto/resources/css/prettyPhoto.css +2 -2
- data/public/javascripts/admin/aloha/i18n/de.dict +2 -0
- data/public/javascripts/admin/aloha/i18n/en.dict +2 -0
- data/public/javascripts/admin/aloha/i18n/pl.dict +5 -0
- data/public/javascripts/admin/aloha/images/base.png +0 -0
- data/public/javascripts/admin/aloha/images/base_big.png +0 -0
- data/public/javascripts/admin/aloha/images/base_multi.png +0 -0
- data/public/javascripts/admin/aloha/images/fade_in.png +0 -0
- data/public/javascripts/admin/aloha/images/fade_out.png +0 -0
- data/public/javascripts/admin/aloha/images/gentics_logo.png +0 -0
- data/public/javascripts/admin/aloha/images/grabhandle.png +0 -0
- data/public/javascripts/admin/aloha/images/maximize.png +0 -0
- data/public/javascripts/admin/aloha/images/pin.png +0 -0
- data/public/javascripts/admin/aloha/images/removeformat.png +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.css +86 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.html +44 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/de.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/en.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/fr.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/plugin.js +1 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/product.js +1 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/2xu-wetsuit.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/asics-noosa.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/fivefingers-kso.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/kuota-kueen-k.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/mizuno-wave-musha2.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product.css +69 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product_button.gif +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/simplon-mrt.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trek-fuel-ex.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trisports.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/zoggs-predator.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/de.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/en.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fi.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fr.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/it.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/plugin.js +0 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.css +48 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.html +69 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/de.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/en.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/plugin.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/i18n/pl.dict +30 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.HighlightEditables/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/LinkList.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/delicious.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/i18n/pl.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/css/LinkChecker.css +14 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.css +49 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.html +82 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/i18n/en.dict +27 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/plugin.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/proxy.php +235 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.List/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/plugin.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/wordpastehandler.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/de.dict +1 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/en.dict +1 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/de.dict +2 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/en.dict +2 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/pl.dict +12 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/table.css +28 -110
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_green.png +0 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_red.png +0 -0
- data/public/javascripts/admin/asset_collections.js +11 -7
- data/public/javascripts/admin/contents.js +3 -1
- data/public/javascripts/admin/site.js +9 -3
- data/public/javascripts/admin/snippets.js +1 -1
- data/public/javascripts/admin/utils.js +5 -3
- data/public/stylesheets/admin/application.css +1 -1
- data/public/stylesheets/admin/box.css +5 -5
- data/public/stylesheets/admin/buttons.css +0 -5
- data/public/stylesheets/admin/formtastic_changes.css +5 -12
- data/public/stylesheets/admin/inline_editor.css +22 -5
- data/public/stylesheets/admin/installation.css +50 -0
- data/public/stylesheets/admin/layout.css +9 -4
- data/public/stylesheets/admin/safari.css +15 -0
- metadata +188 -131
- data/app/controllers/home_controller.rb +0 -7
- data/app/views/admin/snippets/index.html.haml +0 -15
- data/app/views/home/show.html.haml +0 -4
- data/app/views/layouts/admin/box.html.haml +0 -19
- data/app/views/layouts/application.html.haml +0 -7
- data/lib/generators/locomotive/copy_assets/copy_assets_generator.rb +0 -14
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/de.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/en.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/eo.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fi.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fr.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/it.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/plugin.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/de.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/en.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/eo.dict +0 -16
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fi.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fr.dict +0 -16
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/it.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/plugin.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/css/jquery.autocomplete.css +0 -48
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/deps/jquery.autocomplete.js +0 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressource.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourcedummy.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourceregistry.js +0 -7
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Loader/plugin.js +0 -1
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/en.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fi.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fr.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/person.css +0 -3
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/plugin.js +0 -1
- data/public/javascripts/admin/aloha/plugins/simpletable/plugin.js.deactivated +0 -2330
@@ -4,4 +4,4 @@
|
|
4
4
|
* aloha-sales@gentics.com
|
5
5
|
* Licensed unter the terms of http://www.aloha-editor.com/license.html
|
6
6
|
*/
|
7
|
-
GENTICS.Aloha.ListPlugin=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.List");GENTICS.Aloha.ListPlugin.languages=["en","de","fr","eo","fi","ru","it"];GENTICS.Aloha.ListPlugin.config=["ul","ol"];GENTICS.Aloha.ListPlugin.transformableElements={p:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,ul:true,ol:true};GENTICS.Aloha.ListPlugin.init=function(){var that=this;this.createUnorderedListButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_ul",size:"small",tooltip:this.i18n("button.createulist.tooltip"),toggle:true,onclick:function(element,event){that.transformList(false)}});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.createUnorderedListButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.format"),1);this.createOrderedListButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_ol",size:"small",tooltip:this.i18n("button.createolist.tooltip"),toggle:true,onclick:function(element,event){that.transformList(true)}});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.createOrderedListButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.format"),1);GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"selectionChanged",function(event,rangeObject){that.createUnorderedListButton.setPressed(false);that.createOrderedListButton.setPressed(false);for(var i=0;i<rangeObject.markupEffectiveAtStart.length;i++){var effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(GENTICS.Aloha.Selection.standardTextLevelSemanticsComparator(effectiveMarkup,jQuery("<ul></ul>"))){that.createUnorderedListButton.setPressed(true);break}if(GENTICS.Aloha.Selection.standardTextLevelSemanticsComparator(effectiveMarkup,jQuery("<ol></ol>"))){that.createOrderedListButton.setPressed(true);break}}if(GENTICS.Aloha.activeEditable){that.applyButtonConfig(GENTICS.Aloha.activeEditable.obj)}GENTICS.Aloha.FloatingMenu.doLayout()});GENTICS.Aloha.Markup.addKeyHandler(9,function(event){return that.processTab(event)})};GENTICS.Aloha.ListPlugin.applyButtonConfig=function(obj){var config=this.getEditableConfig(obj);if(jQuery.inArray("ul",config)!=-1&&GENTICS.Aloha.Selection.canTag1WrapTag2(GENTICS.Aloha.Selection.rangeObject.unmodifiableMarkupAtStart[0].nodeName,"ul")!=-1){this.createUnorderedListButton.show()}else{this.createUnorderedListButton.hide()}if(jQuery.inArray("ol",config)!=-1&&GENTICS.Aloha.Selection.canTag1WrapTag2(GENTICS.Aloha.Selection.rangeObject.unmodifiableMarkupAtStart[0].nodeName,"ol")!=-1){this.createOrderedListButton.show()}else{this.createOrderedListButton.hide()}};GENTICS.Aloha.ListPlugin.processTab=function(event){switch(event.keyCode){case 9:if(event.shiftKey){return this.outdentList()}else{return this.indentList()}}return true};GENTICS.Aloha.ListPlugin.getStartingDomObjectToTransform=function(){var rangeObject=GENTICS.Aloha.Selection.rangeObject;for(var i=0;i<rangeObject.markupEffectiveAtStart.length;i++){var effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(this.transformableElements[effectiveMarkup.nodeName.toLowerCase()]){return effectiveMarkup}}return false};GENTICS.Aloha.ListPlugin.getNearestSelectedListItem=function(){var rangeObject=GENTICS.Aloha.Selection.rangeObject;for(var i=0;i<rangeObject.markupEffectiveAtStart.length;i++){var effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(GENTICS.Utils.Dom.isListElement(effectiveMarkup)){return effectiveMarkup}}return false};GENTICS.Aloha.ListPlugin.transformList=function(ordered){var domToTransform=this.getStartingDomObjectToTransform();if(!domToTransform){GENTICS.Aloha.Selection.changeMarkupOnSelection(jQuery("<p></p>"));domToTransform=this.getStartingDomObjectToTransform();if(!domToTransform){GENTICS.Aloha.Log.error(this,"Could not transform selection into a list");return}}var nodeName=domToTransform.nodeName.toLowerCase();if(nodeName=="ul"&&!ordered){var jqList=jQuery(domToTransform);var jqParentList=jqList.parent();if(jqParentList.length>0&&GENTICS.Utils.Dom.isListElement(jqParentList.get(0))){jqList.children().unwrap()}else{var jqToTransform=jQuery(domToTransform);jQuery.each(jqToTransform.children("li"),function(index,li){var newPara=GENTICS.Aloha.Markup.transformDomObject(li,"p");newPara.after(newPara.children("ol,ul"))});jqToTransform.children().unwrap()}}else{if(nodeName=="ul"&&ordered){GENTICS.Aloha.Markup.transformDomObject(domToTransform,"ol");this.mergeAdjacentLists(jQuery(domToTransform))}else{if(nodeName=="ol"&&!ordered){GENTICS.Aloha.Markup.transformDomObject(domToTransform,"ul");this.mergeAdjacentLists(jQuery(domToTransform))}else{if(nodeName=="ol"&&ordered){var jqList=jQuery(domToTransform);var jqParentList=jqList.parent();if(jqParentList.length>0&&GENTICS.Utils.Dom.isListElement(jqParentList.get(0))){jqList.children().unwrap()}else{var jqToTransform=jQuery(domToTransform);jQuery.each(jqToTransform.children("li"),function(index,li){var newPara=GENTICS.Aloha.Markup.transformDomObject(li,"p");newPara.after(newPara.children("ol,ul"))});jqToTransform.children().unwrap()}}else{var selectedSiblings=GENTICS.Aloha.Selection.rangeObject.getSelectedSiblings(domToTransform);var jqList=ordered?jQuery("<ol></ol>"):jQuery("<ul></ul>");var jqNewLi=jQuery("<li></li>");jqList.append(jqNewLi);jQuery(domToTransform).contents().appendTo(jqNewLi);jQuery(domToTransform).replaceWith(jqList);if(selectedSiblings){var lastLi=false;for(var i=0;i<selectedSiblings.length;++i){if(GENTICS.Utils.Dom.isBlockLevelElement(selectedSiblings[i])){if(lastLi){lastLi=false}jqNewLi=GENTICS.Aloha.Markup.transformDomObject(selectedSiblings[i],"li");jqList.append(jqNewLi)}else{if(selectedSiblings[i].nodeType==3&&jQuery.trim(selectedSiblings[i].data).length==0){continue}if(!lastLi){lastLi=jQuery("<li></li>");jqList.append(lastLi)}lastLi.append(selectedSiblings[i])}}}this.mergeAdjacentLists(jqList)}}}}this.refreshSelection()};GENTICS.Aloha.ListPlugin.indentList=function(){var listItem=this.getNearestSelectedListItem();if(listItem){var jqItemBefore=jQuery(listItem).prev("li");if(jqItemBefore.length==0){return false}var jqOldList=jQuery(listItem).parent();var selectedSiblings=GENTICS.Aloha.Selection.rangeObject.getSelectedSiblings(listItem);var jqNewList=jQuery(listItem).parent().clone(false).empty();jqNewList.append(listItem);jqItemBefore.append(jqNewList);if(selectedSiblings){for(var i=0;i<selectedSiblings.length;++i){jqNewList.append(jQuery(selectedSiblings[i]))}}this.mergeAdjacentLists(jqNewList);this.refreshSelection();return false}return true};GENTICS.Aloha.ListPlugin.outdentList=function(){var listItem=this.getNearestSelectedListItem();if(listItem){var jqListItem=jQuery(listItem);var jqList=jqListItem.parent();var jqParentList=jqList.parents("ul,ol");var wrappingLi=jqList.parent("li");if(jqParentList.length>0&&GENTICS.Utils.Dom.isListElement(jqParentList.get(0))){var selectedSiblings=GENTICS.Aloha.Selection.rangeObject.getSelectedSiblings(listItem);if(selectedSiblings&&selectedSiblings.length>0){var lastSelected=jQuery(selectedSiblings[selectedSiblings.length-1])}else{var lastSelected=jqListItem}if(lastSelected.nextAll("li").length>0){var jqNewPostList=jqList.clone(false).empty();jqNewPostList.append(lastSelected.nextAll())}if(wrappingLi.length>0){if(typeof jqNewPostList!=="undefined"){jqListItem.append(jqNewPostList)}wrappingLi.after(jqListItem)}else{jqList.before(jqListItem)}if(selectedSiblings&&selectedSiblings.length>0){for(var i=selectedSiblings.length-1;i>=0;--i){jqListItem.after(jQuery(selectedSiblings[i]))}}if(jqList.contents("li").length==0){jqList.remove()}if(wrappingLi.length>0&&wrappingLi.contents().length==0){wrappingLi.remove()}this.refreshSelection()}return false}return true};GENTICS.Aloha.ListPlugin.refreshSelection=function(){if(GENTICS.Aloha.activeEditable){GENTICS.Aloha.activeEditable.obj[0].focus()}GENTICS.Aloha.Selection.rangeObject.update();GENTICS.Aloha.Selection.rangeObject.select();GENTICS.Aloha.Selection.updateSelection()};GENTICS.Aloha.ListPlugin.mergeAdjacentLists=function(jqList){var firstList=jqList.get(0);while(firstList.previousSibling&&firstList.previousSibling.nodeType==1&&firstList.previousSibling.nodeName==firstList.nodeName){firstList=firstList.previousSibling}jqList=jQuery(firstList);while(firstList.nextSibling&&((firstList.nextSibling.nodeType==1&&firstList.nextSibling.nodeName==firstList.nodeName)||(firstList.nextSibling.nodeType==3&&jQuery.trim(firstList.nextSibling.data).length==0))){var jqNextList=jQuery(firstList.nextSibling);if(firstList.nextSibling.nodeType==1){jqNextList.contents().appendTo(jqList)}jqNextList.remove()}};
|
7
|
+
GENTICS.Aloha.ListPlugin=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.List");GENTICS.Aloha.ListPlugin.languages=["en","de","fr","eo","fi","ru","it"];GENTICS.Aloha.ListPlugin.config=["ul","ol"];GENTICS.Aloha.ListPlugin.transformableElements={p:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,ul:true,ol:true};GENTICS.Aloha.ListPlugin.init=function(){var that=this;this.createUnorderedListButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_ul",size:"small",tooltip:this.i18n("button.createulist.tooltip"),toggle:true,onclick:function(element,event){that.transformList(false)}});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.createUnorderedListButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.format"),1);this.createOrderedListButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_ol",size:"small",tooltip:this.i18n("button.createolist.tooltip"),toggle:true,onclick:function(element,event){that.transformList(true)}});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.createOrderedListButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.format"),1);GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"selectionChanged",function(event,rangeObject){that.createUnorderedListButton.setPressed(false);that.createOrderedListButton.setPressed(false);for(var i=0;i<rangeObject.markupEffectiveAtStart.length;i++){var effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(GENTICS.Aloha.Selection.standardTextLevelSemanticsComparator(effectiveMarkup,jQuery("<ul></ul>"))){that.createUnorderedListButton.setPressed(true);break}if(GENTICS.Aloha.Selection.standardTextLevelSemanticsComparator(effectiveMarkup,jQuery("<ol></ol>"))){that.createOrderedListButton.setPressed(true);break}}if(GENTICS.Aloha.activeEditable){that.applyButtonConfig(GENTICS.Aloha.activeEditable.obj)}GENTICS.Aloha.FloatingMenu.doLayout()});GENTICS.Aloha.Markup.addKeyHandler(9,function(event){return that.processTab(event)})};GENTICS.Aloha.ListPlugin.applyButtonConfig=function(obj){var config=this.getEditableConfig(obj);if(GENTICS.Aloha.Selection.rangeObject.unmodifiableMarkupAtStart[0]){if(jQuery.inArray("ul",config)!=-1&&GENTICS.Aloha.Selection.canTag1WrapTag2(GENTICS.Aloha.Selection.rangeObject.unmodifiableMarkupAtStart[0].nodeName,"ul")!=-1){this.createUnorderedListButton.show()}else{this.createUnorderedListButton.hide()}if(jQuery.inArray("ol",config)!=-1&&GENTICS.Aloha.Selection.canTag1WrapTag2(GENTICS.Aloha.Selection.rangeObject.unmodifiableMarkupAtStart[0].nodeName,"ol")!=-1){this.createOrderedListButton.show()}else{this.createOrderedListButton.hide()}}};GENTICS.Aloha.ListPlugin.processTab=function(event){switch(event.keyCode){case 9:if(event.shiftKey){return this.outdentList()}else{return this.indentList()}}return true};GENTICS.Aloha.ListPlugin.getStartingDomObjectToTransform=function(){var rangeObject=GENTICS.Aloha.Selection.rangeObject;for(var i=0;i<rangeObject.markupEffectiveAtStart.length;i++){var effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(this.transformableElements[effectiveMarkup.nodeName.toLowerCase()]){return effectiveMarkup}}return false};GENTICS.Aloha.ListPlugin.getNearestSelectedListItem=function(){var rangeObject=GENTICS.Aloha.Selection.rangeObject;for(var i=0;i<rangeObject.markupEffectiveAtStart.length;i++){var effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(GENTICS.Utils.Dom.isListElement(effectiveMarkup)){return effectiveMarkup}}return false};GENTICS.Aloha.ListPlugin.transformList=function(ordered){var domToTransform=this.getStartingDomObjectToTransform();if(!domToTransform){GENTICS.Aloha.Selection.changeMarkupOnSelection(jQuery("<p></p>"));domToTransform=this.getStartingDomObjectToTransform();if(!domToTransform){GENTICS.Aloha.Log.error(this,"Could not transform selection into a list");return}}var nodeName=domToTransform.nodeName.toLowerCase();if(nodeName=="ul"&&!ordered){var jqList=jQuery(domToTransform);var jqParentList=jqList.parent();if(jqParentList.length>0&&GENTICS.Utils.Dom.isListElement(jqParentList.get(0))){jqList.children().unwrap()}else{var jqToTransform=jQuery(domToTransform);jQuery.each(jqToTransform.children("li"),function(index,li){var newPara=GENTICS.Aloha.Markup.transformDomObject(li,"p");newPara.after(newPara.children("ol,ul"))});jqToTransform.children().unwrap()}}else{if(nodeName=="ul"&&ordered){GENTICS.Aloha.Markup.transformDomObject(domToTransform,"ol");this.mergeAdjacentLists(jQuery(domToTransform))}else{if(nodeName=="ol"&&!ordered){GENTICS.Aloha.Markup.transformDomObject(domToTransform,"ul");this.mergeAdjacentLists(jQuery(domToTransform))}else{if(nodeName=="ol"&&ordered){var jqList=jQuery(domToTransform);var jqParentList=jqList.parent();if(jqParentList.length>0&&GENTICS.Utils.Dom.isListElement(jqParentList.get(0))){jqList.children().unwrap()}else{var jqToTransform=jQuery(domToTransform);jQuery.each(jqToTransform.children("li"),function(index,li){var newPara=GENTICS.Aloha.Markup.transformDomObject(li,"p");newPara.after(newPara.children("ol,ul"))});jqToTransform.children().unwrap()}}else{var selectedSiblings=GENTICS.Aloha.Selection.rangeObject.getSelectedSiblings(domToTransform);var jqList=ordered?jQuery("<ol></ol>"):jQuery("<ul></ul>");var jqNewLi=jQuery("<li></li>");jqList.append(jqNewLi);jQuery(domToTransform).contents().appendTo(jqNewLi);jQuery(domToTransform).replaceWith(jqList);if(selectedSiblings){var lastLi=false;for(var i=0;i<selectedSiblings.length;++i){if(GENTICS.Utils.Dom.isBlockLevelElement(selectedSiblings[i])){if(lastLi){lastLi=false}jqNewLi=GENTICS.Aloha.Markup.transformDomObject(selectedSiblings[i],"li");jqList.append(jqNewLi)}else{if(selectedSiblings[i].nodeType==3&&jQuery.trim(selectedSiblings[i].data).length==0){continue}if(!lastLi){lastLi=jQuery("<li></li>");jqList.append(lastLi)}lastLi.append(selectedSiblings[i])}}}this.mergeAdjacentLists(jqList)}}}}this.refreshSelection()};GENTICS.Aloha.ListPlugin.indentList=function(){var listItem=this.getNearestSelectedListItem();if(listItem){var jqItemBefore=jQuery(listItem).prev("li");if(jqItemBefore.length==0){return false}var jqOldList=jQuery(listItem).parent();var selectedSiblings=GENTICS.Aloha.Selection.rangeObject.getSelectedSiblings(listItem);var jqNewList=jQuery(listItem).parent().clone(false).empty();jqNewList.append(listItem);jqItemBefore.append(jqNewList);if(selectedSiblings){for(var i=0;i<selectedSiblings.length;++i){jqNewList.append(jQuery(selectedSiblings[i]))}}this.mergeAdjacentLists(jqNewList);this.refreshSelection();return false}return true};GENTICS.Aloha.ListPlugin.outdentList=function(){var listItem=this.getNearestSelectedListItem();if(listItem){var jqListItem=jQuery(listItem);var jqList=jqListItem.parent();var jqParentList=jqList.parents("ul,ol");var wrappingLi=jqList.parent("li");if(jqParentList.length>0&&GENTICS.Utils.Dom.isListElement(jqParentList.get(0))){var selectedSiblings=GENTICS.Aloha.Selection.rangeObject.getSelectedSiblings(listItem);if(selectedSiblings&&selectedSiblings.length>0){var lastSelected=jQuery(selectedSiblings[selectedSiblings.length-1])}else{var lastSelected=jqListItem}if(lastSelected.nextAll("li").length>0){var jqNewPostList=jqList.clone(false).empty();jqNewPostList.append(lastSelected.nextAll())}if(wrappingLi.length>0){if(typeof jqNewPostList!=="undefined"){jqListItem.append(jqNewPostList)}wrappingLi.after(jqListItem)}else{jqList.before(jqListItem)}if(selectedSiblings&&selectedSiblings.length>0){for(var i=selectedSiblings.length-1;i>=0;--i){jqListItem.after(jQuery(selectedSiblings[i]))}}if(jqList.contents("li").length==0){jqList.remove()}if(wrappingLi.length>0&&wrappingLi.contents().length==0){wrappingLi.remove()}this.refreshSelection()}return false}return true};GENTICS.Aloha.ListPlugin.refreshSelection=function(){if(GENTICS.Aloha.activeEditable){GENTICS.Aloha.activeEditable.obj[0].focus()}GENTICS.Aloha.Selection.rangeObject.update();GENTICS.Aloha.Selection.rangeObject.select();GENTICS.Aloha.Selection.updateSelection()};GENTICS.Aloha.ListPlugin.mergeAdjacentLists=function(jqList){var firstList=jqList.get(0);while(firstList.previousSibling&&firstList.previousSibling.nodeType==1&&firstList.previousSibling.nodeName==firstList.nodeName){firstList=firstList.previousSibling}jqList=jQuery(firstList);while(firstList.nextSibling&&((firstList.nextSibling.nodeType==1&&firstList.nextSibling.nodeName==firstList.nodeName)||(firstList.nextSibling.nodeType==3&&jQuery.trim(firstList.nextSibling.data).length==0))){var jqNextList=jQuery(firstList.nextSibling);if(firstList.nextSibling.nodeType==1){jqNextList.contents().appendTo(jqList)}jqNextList.remove()}};
|
@@ -0,0 +1,7 @@
|
|
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.PastePlugin=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.Paste");GENTICS.Aloha.PastePlugin.pasteHandlers=[];GENTICS.Aloha.PastePlugin.init=function(){var that=this;this.pasteDiv=jQuery('<div style="position:absolute; top:-100000px; left:-100000px"></div>');this.pasteDiv.attr("contentEditable","true");jQuery("body").append(this.pasteDiv);GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableCreated",function(event,editable){if(jQuery.browser.msie){editable.obj.bind("beforepaste",function(event){that.redirectPaste()})}else{editable.obj.bind("paste",function(event){that.redirectPaste();window.setTimeout(function(){that.getPastedContent()},10)})}});if(jQuery.browser.msie){this.pasteDiv.bind("paste",function(event){window.setTimeout(function(){that.getPastedContent()},10)})}};GENTICS.Aloha.PastePlugin.redirectPaste=function(){this.currentRange=new GENTICS.Utils.RangeObject(true);this.currentEditable=GENTICS.Aloha.activeEditable;this.pasteDiv.text("");if(this.currentEditable){this.currentEditable.blur()}GENTICS.Utils.Dom.setCursorInto(this.pasteDiv.get(0));this.pasteDiv.focus()};GENTICS.Aloha.PastePlugin.getPastedContent=function(){var that=this;for(var i=0;i<this.pasteHandlers.length;++i){this.pasteHandlers[i].handlePaste(this.pasteDiv)}if(this.currentRange&&this.currentEditable){var pasteDivContents=this.pasteDiv.contents();for(var i=pasteDivContents.length-1;i>=0;--i){GENTICS.Utils.Dom.insertIntoDOM(jQuery(pasteDivContents.get(i)),that.currentRange,that.currentEditable.obj,false)}this.currentEditable.activate();this.currentEditable.obj.focus();if(pasteDivContents.length>0){GENTICS.Utils.Dom.setCursorAfter(pasteDivContents.get(pasteDivContents.length-1))}else{this.currentRange.select()}}this.currentRange=false;this.currentEditable=false;this.pasteDiv.text("")};GENTICS.Aloha.PastePlugin.register=function(pasteHandler){this.pasteHandlers.push(pasteHandler)};GENTICS.Aloha.PastePlugin.PasteHandler=function(){GENTICS.Aloha.PastePlugin.register(this)};GENTICS.Aloha.PastePlugin.PasteHandler.prototype.handlePaste=function(jqPasteDiv){};
|
data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/wordpastehandler.js
ADDED
@@ -0,0 +1,7 @@
|
|
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.PastePlugin.WordPasteHandler=new GENTICS.Aloha.PastePlugin.PasteHandler();GENTICS.Aloha.PastePlugin.WordPasteHandler.handlePaste=function(jqPasteDiv){if(this.detectWordContent(jqPasteDiv)){this.transformWordContent(jqPasteDiv)}};GENTICS.Aloha.PastePlugin.WordPasteHandler.detectWordContent=function(jqPasteDiv){var wordDetected=false;jqPasteDiv.find("*").each(function(){var style=jQuery(this).attr("style");if(style){if(style.toLowerCase().indexOf("mso")>=0){wordDetected=true;return false}}var clazz=jQuery(this).attr("class");if(clazz){if(clazz.toLowerCase().indexOf("mso")>=0){wordDetected=true;return false}}});return wordDetected};GENTICS.Aloha.PastePlugin.WordPasteHandler.isOrderedList=function(listSpan){if(listSpan.css("fontFamily")=="Wingdings"||listSpan.css("fontFamily")=="Symbol"){return false}return listSpan.text().match(/^([0-9]{1,3}\.)|([0-9]{1,3}\)|([a-zA-Z]{1,5}\.)|([a-zA-Z]{1,5}\)))$/)?true:false};GENTICS.Aloha.PastePlugin.WordPasteHandler.transformListsFromWord=function(jqPasteDiv){var that=this;var listElementClass="aloha-list-element";var bulletClass="aloha-list-bullet";var detectionFilter="p.MsoListParagraphCxSpFirst,p.MsoListParagraph,p span";var paragraphs=jqPasteDiv.find(detectionFilter);paragraphs.each(function(){var jqElem=jQuery(this);if(jqElem.hasClass("MsoListParagraphCxSpFirst")||jqElem.hasClass("MsoListParagraph")){jqElem.addClass(listElementClass)}else{if(jqElem.css("font-family").indexOf("Symbol")>=0){jqElem.closest("p").addClass(listElementClass)}else{if(jqElem.css("mso-list")!=""){jqElem.closest("p").addClass(listElementClass)}}}});detectionFilter="p span span span";var spans=jqPasteDiv.find(detectionFilter);spans.each(function(){var jqElem=jQuery(this);var innerText=jqElem.text().trim().replace(/ /g,"");if(innerText.length==0){var outerText=jqElem.parent().parent().text().trim().replace(/ /g,"");if(outerText.match(/^([0-9]{1,3}\.)|([0-9]{1,3}\)|([a-zA-Z]{1,5}\.)|([a-zA-Z]{1,5}\)))$/)){jqElem.closest("p").addClass(listElementClass);jqElem.parent().parent().addClass(bulletClass)}}});detectionFilter="p."+listElementClass;var negateDetectionFilter=":not("+detectionFilter+")";paragraphs=jqPasteDiv.find(detectionFilter);if(paragraphs.length>0){paragraphs.each(function(){var jqElem=jQuery(this);jqElem.removeClass(listElementClass);jqElem.find("font").each(function(){jQuery(this).contents().unwrap()});var nestLevel=0;var margin=parseFloat(jqElem.css("marginLeft"));var lists=[];var following=jqElem.nextUntil(negateDetectionFilter);var firstSpan=jQuery(jqElem.find("span."+bulletClass));if(firstSpan.length==0){firstSpan=jQuery(jqElem.children("span:first"))}var ordered=that.isOrderedList(firstSpan);firstSpan.remove();var jqList=jQuery(ordered?"<ol></ol>":"<ul></ul>");lists.push(jqList);var jqNewLi=jQuery("<li></li>");jqList.append(jqNewLi);jqElem.contents().appendTo(jqNewLi);jqElem.replaceWith(jqList);following.each(function(){var jqElem=jQuery(this);jqElem.find("font").each(function(){jQuery(this).contents().unwrap()});var newMargin=parseFloat(jqElem.css("marginLeft"));firstSpan=jQuery(jqElem.find("span."+bulletClass));if(firstSpan.length==0){firstSpan=jQuery(jqElem.children("span:first"))}ordered=that.isOrderedList(firstSpan);firstSpan.remove();if(newMargin>margin){var jqNewList=jQuery(ordered?"<ol></ol>":"<ul></ul>");jqList.children(":last").append(jqNewList);jqList=jqNewList;lists.push(jqList);nestLevel++;margin=newMargin}else{if(newMargin<margin&&nestLevel>0){lists.pop();nestLevel--;jqList=lists[nestLevel];margin=newMargin}}jqNewLi=jQuery("<li></li>");jqList.append(jqNewLi);jqElem.contents().appendTo(jqNewLi);jqElem.remove()})})}};GENTICS.Aloha.PastePlugin.WordPasteHandler.transformTitles=function(jqPasteDiv){jqPasteDiv.find("p.MsoTitle").each(function(){GENTICS.Aloha.Markup.transformDomObject(jQuery(this),"h1")});jqPasteDiv.find("p.MsoSubtitle").each(function(){GENTICS.Aloha.Markup.transformDomObject(jQuery(this),"h2")})};GENTICS.Aloha.PastePlugin.WordPasteHandler.transformTables=function(jqPasteDiv){jqPasteDiv.find("table").each(function(){jQuery(this).removeAttr("border").removeAttr("cellspacing").removeAttr("cellpadding")});jqPasteDiv.find("td").each(function(){jQuery(this).removeAttr("width").removeAttr("height").removeAttr("valign")})};GENTICS.Aloha.PastePlugin.WordPasteHandler.transformFormattings=function(jqPasteDiv){jqPasteDiv.find("strong,em,s,u").each(function(){if(this.nodeName.toLowerCase()=="strong"){GENTICS.Aloha.Markup.transformDomObject(jQuery(this),"b")}else{if(this.nodeName.toLowerCase()=="em"){GENTICS.Aloha.Markup.transformDomObject(jQuery(this),"i")}else{if(this.nodeName.toLowerCase()=="s"){GENTICS.Aloha.Markup.transformDomObject(jQuery(this),"del")}else{if(this.nodeName.toLowerCase()=="u"){jQuery(this).contents().unwrap()}}}}})};GENTICS.Aloha.PastePlugin.WordPasteHandler.removeComments=function(jqPasteDiv){jqPasteDiv.contents().each(function(){if(this.nodeType==8){jQuery(this).remove()}})};GENTICS.Aloha.PastePlugin.WordPasteHandler.unwrapTags=function(jqPasteDiv){jqPasteDiv.find("span,font,div").each(function(){jQuery(this).contents().unwrap()})};GENTICS.Aloha.PastePlugin.WordPasteHandler.removeStyles=function(jqPasteDiv){jqPasteDiv.find("*").each(function(){jQuery(this).removeAttr("style").removeClass()})};GENTICS.Aloha.PastePlugin.WordPasteHandler.removeNamespacedElements=function(jqPasteDiv){jqPasteDiv.find("*").each(function(){var nsPrefix=this.prefix?this.prefix:(this.scopeName?this.scopeName:undefined);if(nsPrefix&&nsPrefix!="HTML"){jQuery(this).remove()}})};GENTICS.Aloha.PastePlugin.WordPasteHandler.transformWordContent=function(jqPasteDiv){this.transformListsFromWord(jqPasteDiv);this.transformTables(jqPasteDiv);this.transformTitles(jqPasteDiv);this.removeComments(jqPasteDiv);this.unwrapTags(jqPasteDiv);this.removeStyles(jqPasteDiv);this.removeNamespacedElements(jqPasteDiv);this.transformFormattings(jqPasteDiv)};
|
@@ -0,0 +1 @@
|
|
1
|
+
button.addtoc.tooltip=Inhaltsverzeichnis
|
@@ -0,0 +1 @@
|
|
1
|
+
button.addtoc.tooltip=Table of contents
|
@@ -1 +1 @@
|
|
1
|
-
(function(){var deps=GENTICS.Aloha.TOC||{jQuery:jQuery},$=deps.jQuery;function last(a){return a[a.length-1]}function head(a){return a[0]}function tail(a){return a.slice(1)}function indexOf(a,item){return detect(a,function(cmp){return cmp===item})}function detect(a,f){for(var i=0;i<a.length;i++){if(f(a[i])){return a[i]}}return null}function map(a,f){var result=[];for(var i=0;i<a.length;i++){result.push(f(a[i]))}return result}function each(a,f){map(a,f)}var namespace="com.gentics.aloha.plugins.TOC";var TOC=GENTICS.Aloha.TOC=new GENTICS.Aloha.Plugin(namespace);var $containers=null;var allTocs=[];TOC.init=function(){var s=TOC.settings;s.updateInterval=s.updateInterval||5000;TOC.initButtons()
|
1
|
+
(function(){var deps=GENTICS.Aloha.TOC||{jQuery:jQuery},$=deps.jQuery;function last(a){return a[a.length-1]}function head(a){return a[0]}function tail(a){return a.slice(1)}function indexOf(a,item){return detect(a,function(cmp){return cmp===item})}function detect(a,f){for(var i=0;i<a.length;i++){if(f(a[i])){return a[i]}}return null}function map(a,f){var result=[];for(var i=0;i<a.length;i++){result.push(f(a[i]))}return result}function each(a,f){map(a,f)}var namespace="com.gentics.aloha.plugins.TOC";var TOC=GENTICS.Aloha.TOC=new GENTICS.Aloha.Plugin(namespace);GENTICS.Aloha.TOC.languages=["en","de"];var $containers=null;var allTocs=[];TOC.init=function(){var s=TOC.settings;s.updateInterval=s.updateInterval||5000;s.minEntries=s.minEntries||0;TOC.initButtons();$(document).ready(function(){TOC.spawn()})};TOC.initButtons=function(){TOC.insertTocButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_ul",size:"small",onclick:function(){TOC.insertAtSelection($containers)},tooltip:this.i18n("button.addtoc.tooltip"),toggle:false});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.insertTocButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.insert"),1)};TOC.register=function($c){$containers=$c};TOC.generateId=function(elemOrText){var validId;if(typeof elemOrText=="object"){validId=$(elemOrText).text().replace(/[^a-zA-Z-]+/g,"-").replace(/^[^a-zA-Z]+/,"")}else{if(elemOrText){validId=elemOrText}}for(var uniquifier=0;;uniquifier++){var uniqueId=validId;if(uniquifier){uniqueId+="-"+uniquifier}var conflict=document.getElementById(uniqueId);if(!conflict||(typeof elemOrText=="object"&&conflict===elemOrText)){return uniqueId}}};TOC.outline=function(ctx){var rootNode=[$()];var potentialParents=[rootNode];TOC.headings(ctx).each(function(){var $heading=$(this);var nodeName=this.nodeName.toLowerCase();var hLevels=["h6","h5","h4","h3","h2","h1"];var currLevel=$.inArray(nodeName,hLevels);var higherEq=hLevels.slice(currLevel).join(",");var $section=$heading.nextUntil(higherEq).andSelf();var node=[$section];var parent=detect(potentialParents,function(parent){var parentSection=parent[0];return !parentSection.length||detect(parentSection,function(sectionElem){return $heading.get(0)===sectionElem||$.contains(sectionElem,$heading.get(0))})});parent.push(node);potentialParents.splice(0,indexOf(potentialParents,parent),node)});return rootNode};TOC.editableContainers=function(){return $(map(GENTICS.Aloha.editables,function(editable){return document.getElementById(editable.getId())}))};TOC.headings=function($ctx){return $ctx.find(":header").add($ctx.filter(":header"))};TOC.anchorFromLinkId=function($ctx,linkId){return linkId?$ctx.find('a[href $= "#'+linkId+'"]'):$()};TOC.linkIdFromAnchor=function($anchor){var href=$anchor.attr("href");return href?href.match(/#(.*?)$/)[1]:null};TOC.insertAtSelection=function($containers){$containers=$containers||TOC.editableContainers();var id=TOC.generateId("toc");var $tocElement=$("<ol class='toc_root'></ol>").attr("id",id).attr("contentEditable","false");var range=GENTICS.Aloha.Selection.getRangeObject();var tocEditable=GENTICS.Aloha.activeEditable;var $tocContainer=$(document.getElementById(tocEditable.getId()));GENTICS.Utils.Dom.insertIntoDOM($tocElement,range,$tocContainer);TOC.create(id).register($containers).update().tickTock()};TOC.spawn=function($ctx,$containers){$ctx=$ctx||$("body");$containers=$containers||TOC.editableContainers();$ctx.find("ol.toc_root").each(function(){var id=$(this).attr("id");if(!id){id=TOC.generateId("toc");$(this).attr("id",id)}TOC.create(id).register($containers).tickTock()})};TOC.create=function(id){allTocs.push(this);return{id:id,"$containers":$(),root:function(){return $(document.getElementById(this.id))},register:function($containers){var self=this;self.$containers=self.$containers.add($containers);self.$containers.filter(function(){return !$(this).data(namespace+"."+self.id+".listening")}).each(function(){var $container=$(this);$container.data(namespace+"."+self.id+".listening",true);$container.bind("blur",function(){self.cleanupIds($container.get(0));self.update($container)})});return self},tickTock:function(interval){var self=this;interval=interval||TOC.settings.updateInterval;if(!interval){return}window.setInterval(function(){self.register(TOC.editableContainers());self.update()},interval);return self},cleanupIds:function(ctx){var ids=[];TOC.headings(this.$containers).each(function(){var id=$(this).attr("id");if((id&&-1!=$.inArray(id,ids))||(ctx&&($.contains(ctx,this)||ctx===this))){$(this).attr("id",TOC.generateId(this))}ids.push(id)});return this},update:function($ctx){var self=this;$ctx=$ctx||self.$containers;var outline=TOC.outline(self.$containers);var ancestors=[self.root()];var prevSiblings=[];last(ancestors).empty();(function descend(outline){var prevSiblings=[];each(outline,function(node){var $section=head(node);var $entry=self.linkSection($section,ancestors,prevSiblings);ancestors.push($entry);descend(tail(node));ancestors.pop();prevSiblings.push($entry)})})(tail(outline));var minEntries=self.root().attr("data-TOC-minEntries")||TOC.settings.minEntries;if(self.root().find("li").length>=minEntries){self.root().show()}else{self.root().hide()}return this},linkSection:function($section,ancestors,prevSiblings){var linkId=$section.eq(0).attr("id");if(!linkId){linkId=TOC.generateId($section.get(0));$section.eq(0).attr("id",linkId)}var $root=this.root();var $entry=TOC.anchorFromLinkId($root,linkId);if(!$entry.length){$entry=$("<li><a/></li>")}$entry.find("a").attr("href","#"+linkId).text($section.eq(0).text());if(last(prevSiblings)){last(prevSiblings).after($entry)}else{if(last(ancestors).get(0)==$root.get(0)){$root.append($entry)}else{var $subToc=$("<ol/>").append($entry);last(ancestors).append($subToc)}}return $entry}}}}());
|
@@ -10,3 +10,5 @@ button.delcols.tooltip=Spalten löschen
|
|
10
10
|
button.addrowbefore.tooltip=Zeile darüber einfügen
|
11
11
|
button.addrowafter.tooltip=Zeile darunter einfügen
|
12
12
|
button.delrows.tooltip=Zeilen löschen
|
13
|
+
button.caption.tooltip=Tabellen Bezeichnung
|
14
|
+
empty.caption=Tabellen Bezeichnung
|
@@ -0,0 +1,12 @@
|
|
1
|
+
floatingmenu.tab.table=Tabela
|
2
|
+
deleterows.confirm=Czy na pewno chcesz usunąć zaznaczone wiersze?
|
3
|
+
deletecolumns.confirm=Czy na pewno chcesz usunąć zaznaczone kolumny?
|
4
|
+
deletetable.confirm=Czy na pewno chcesz usunąć tabelę?
|
5
|
+
Table=Tabela
|
6
|
+
button.createtable.tooltip=Wstaw tabelę
|
7
|
+
button.addcolleft.tooltip=Dodaj kolumnę na lewo
|
8
|
+
button.addcolright.tooltip=Dodaj kolumnę na prawo
|
9
|
+
button.delcols.tooltip=Usuń kolumny
|
10
|
+
button.addrowbefore.tooltip=Dodaj wiersz przed
|
11
|
+
button.addrowafter.tooltip=Dodaj wiersz po
|
12
|
+
button.delrows.tooltip=Usuń wiersze
|
@@ -4,4 +4,4 @@
|
|
4
4
|
* aloha-sales@gentics.com
|
5
5
|
* Licensed unter the terms of http://www.aloha-editor.com/license.html
|
6
6
|
*/
|
7
|
-
GENTICS.Aloha.TablePlugin=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.Table");GENTICS.Aloha.TablePlugin.createLayer=undefined;GENTICS.Aloha.TablePlugin.languages=["en","de","fr","eo","fi","ru","it"];GENTICS.Aloha.TablePlugin.config=["table"];GENTICS.Aloha.TablePlugin.TableRegistry=new Array();GENTICS.Aloha.TablePlugin.activeTable=undefined;GENTICS.Aloha.TablePlugin.parameters={className:"GENTICS_Aloha_Table",classSelectionRow:"GENTICS_Aloha_Table_selectColumn",classSelectionColumn:"GENTICS_Aloha_Table_selectRow",classLeftUpperCorner:"GENTICS_Aloha_Table_leftUpperCorner",classTableWrapper:"GENTICS_Aloha_Table_wrapper",classCellSelected:"GENTICS_Aloha_Cell_selected",selectionArea:10};GENTICS.Aloha.TablePlugin.config=new Object();GENTICS.Aloha.TablePlugin.init=function(){this.createLayer=new GENTICS.Aloha.Table.CreateLayer();var that=this;GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableCreated",function(event,editable){editable.obj.bind("mousedown",function(jqEvent){GENTICS.Aloha.TablePlugin.setFocusedTable(undefined)});editable.obj.find("table").each(function(){if(that.isEditableTable(this)){var table=new GENTICS.Aloha.Table(this);table.parentEditable=editable;table.activate();GENTICS.Aloha.TablePlugin.TableRegistry.push(table)}})});this.initTableButtons();GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"selectionChanged",function(event,properties){if(GENTICS.Aloha.activeEditable){var config=that.getEditableConfig(GENTICS.Aloha.activeEditable.obj);if(jQuery.inArray("table",config)!=-1&&GENTICS.Aloha.Selection.mayInsertTag("table")){that.createTableButton.show()}else{that.createTableButton.hide()}if(typeof GENTICS.Aloha.TableHelper.selectionType!=undefined){GENTICS.Aloha.FloatingMenu.setScope(that.getUID(GENTICS.Aloha.TableHelper.selectionType))}GENTICS.Aloha.FloatingMenu.doLayout()}});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableDeactivated",function(event,properties){GENTICS.Aloha.TablePlugin.setFocusedTable(undefined);GENTICS.Aloha.TableHelper.unselectCells()})};GENTICS.Aloha.TablePlugin.isEditableTable=function(table){var parent=jQuery(table.parentNode);if(parent.attr("contenteditable")=="true"){return true}else{return false}};GENTICS.Aloha.TablePlugin.initTableButtons=function(){var that=this;this.createTableButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_table",size:"small",tooltip:this.i18n("button.createtable.tooltip"),onclick:function(element,event){GENTICS.Aloha.TablePlugin.createDialog(element.btnEl.dom)}});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.createTableButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.insert"),1);GENTICS.Aloha.FloatingMenu.createScope(this.getUID("row"),"GENTICS.Aloha.global");GENTICS.Aloha.FloatingMenu.createScope(this.getUID("column"),"GENTICS.Aloha.global");GENTICS.Aloha.FloatingMenu.addButton(this.getUID("column"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addColumnLeft",size:"small",tooltip:this.i18n("button.addcolleft.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addColumnsLeft()}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("column"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addColumnRight",size:"small",tooltip:this.i18n("button.addcolright.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addColumnsRight()}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("column"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_deleteColumns",size:"small",tooltip:this.i18n("button.delcols.tooltip"),onclick:function(){if(that.activeTable){var aTable=that.activeTable;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(that,"Table"),text:GENTICS.Aloha.i18n(that,"deletecolumns.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){aTable.deleteColumns()}}}))}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("row"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addRowBefore",size:"small",tooltip:this.i18n("button.addrowbefore.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addRowsBefore(true)}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("row"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addRowAfter",size:"small",tooltip:this.i18n("button.addrowafter.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addRowsAfter(true)}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("row"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_deleteRows",size:"small",tooltip:this.i18n("button.delrows.tooltip"),onclick:function(){if(that.activeTable){var aTable=that.activeTable;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(that,"Table"),text:GENTICS.Aloha.i18n(that,"deleterows.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){aTable.deleteRows()}}}))}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1)};GENTICS.Aloha.TablePlugin.createDialog=function(callingElement){this.createLayer.set("target",callingElement);this.createLayer.show()};GENTICS.Aloha.TablePlugin.createTable=function(cols,rows){if(GENTICS.Aloha.activeEditable!=null&&typeof GENTICS.Aloha.activeEditable.obj!="undefined"){var table=document.createElement("table");var tableId=table.id=GENTICS.Aloha.TableHelper.getNewTableID();var tbody=document.createElement("tbody");for(var i=0;i<rows;i++){var tr=document.createElement("tr");for(var j=0;j<cols;j++){var text=document.createTextNode("\u00a0");var td=document.createElement("td");td.appendChild(text);tr.appendChild(td)}tbody.appendChild(tr)}table.appendChild(tbody);GENTICS.Utils.Dom.insertIntoDOM(jQuery(table),GENTICS.Aloha.Selection.getRangeObject(),jQuery(GENTICS.Aloha.activeEditable.obj));var tableReloadedFromDOM=document.getElementById(tableId);var tableObj=new GENTICS.Aloha.Table(tableReloadedFromDOM);tableObj.parentEditable=GENTICS.Aloha.activeEditable;tableObj.activate();if(jQuery.browser.msie){window.setTimeout(function(){tableObj.cells[0].wrapper.get(0).focus()},20)}else{tableObj.cells[0].wrapper.get(0).focus()}GENTICS.Aloha.TablePlugin.TableRegistry.push(tableObj)}else{this.error("There is no active Editable where the table can be inserted!")}};GENTICS.Aloha.TablePlugin.setFocusedTable=function(focusTable){for(var i=0;i<GENTICS.Aloha.TablePlugin.TableRegistry.length;i++){GENTICS.Aloha.TablePlugin.TableRegistry[i].hasFocus=false}if(typeof focusTable!="undefined"){focusTable.hasFocus=true}GENTICS.Aloha.TablePlugin.activeTable=focusTable};GENTICS.Aloha.TablePlugin.error=function(msg){GENTICS.Aloha.Log.error(this,msg)};GENTICS.Aloha.TablePlugin.debug=function(msg){GENTICS.Aloha.Log.debug(this,msg)};GENTICS.Aloha.TablePlugin.info=function(msg){GENTICS.Aloha.Log.info(this,msg)};GENTICS.Aloha.TablePlugin.log=function(msg){GENTICS.Aloha.log("log",this,msg)};GENTICS.Aloha.TablePlugin.get=function(property){if(this.config[property]){return this.config[property]}if(this.parameters[property]){return this.parameters[property]}return undefined};GENTICS.Aloha.TablePlugin.set=function(key,value){if(this.config[key]){this.config[key]=value}else{this.parameters[key]=value}};GENTICS.Aloha.TablePlugin.makeClean=function(obj){obj.find("table").each(function(){var table=new GENTICS.Aloha.Table(this);table.deactivate()})};GENTICS.Aloha.TablePlugin.toString=function(){return this.prefix};GENTICS.Aloha.Table=function(table){this.obj=jQuery(table);var rows=this.obj.find("tr");var firstRow=jQuery(rows.get(0));this.numCols=firstRow.children("td, th").length;this.numRows=rows.length;this.cells=new Array();var rows=this.obj.find("tr");for(var i=0;i<rows.length;i++){var row=jQuery(rows[i]);var cols=row.children();for(var j=0;j<cols.length;j++){var col=cols[j];var Cell=new GENTICS.Aloha.Table.Cell(col,this);this.cells.push(Cell)}}};GENTICS.Aloha.Table.prototype.obj=undefined;GENTICS.Aloha.Table.prototype.tableWrapper=undefined;GENTICS.Aloha.Table.prototype.cells=undefined;GENTICS.Aloha.Table.prototype.numRows=undefined;GENTICS.Aloha.Table.prototype.numCols=undefined;GENTICS.Aloha.Table.prototype.isActive=false;GENTICS.Aloha.Table.prototype.hasFocus=false;GENTICS.Aloha.Table.prototype.parentEditable=undefined;GENTICS.Aloha.Table.prototype.mousedown=false;GENTICS.Aloha.Table.prototype.clickedColumnId=-1;GENTICS.Aloha.Table.prototype.clickedRowId=-1;GENTICS.Aloha.Table.prototype.columnsToSelect=new Array();GENTICS.Aloha.Table.prototype.rowsToSelect=new Array();GENTICS.Aloha.Table.prototype.fmPluginId=undefined;GENTICS.Aloha.Table.prototype.get=function(property){return GENTICS.Aloha.TablePlugin.get(property)};GENTICS.Aloha.Table.prototype.set=function(key,value){GENTICS.Aloha.TablePlugin.set(key,value)};GENTICS.Aloha.Table.prototype.activate=function(){if(this.isActive){return}var that=this;this.obj.addClass(this.get("className"));this.obj.attr("contenteditable","false");if(this.obj.attr("id")==""){this.obj.attr("id",GENTICS.Aloha.TableHelper.getNewTableID())}GENTICS.Aloha.TableHelper.selectionType=undefined;this.obj.bind("keydown",function(jqEvent){if(!jqEvent.ctrlKey&&!jqEvent.shiftKey){if(GENTICS.Aloha.TableHelper.selectedCells.length>0&&GENTICS.Aloha.TableHelper.selectedCells[0].length>0){GENTICS.Aloha.TableHelper.selectedCells[0][0].firstChild.focus()}}});this.obj.bind("click",function(e){e.stopPropagation();return false});this.obj.bind("mousedown",function(jqEvent){if(!that.hasFocus){that.focus()}setTimeout(function(){var firstCell=that.obj.find("tr:nth-child(2) td:nth-child(2)").children("div[contenteditable=true]").get(0);GENTICS.Aloha.TableHelper.unselectCells();jQuery(firstCell).get(0).focus()},5);jqEvent.stopPropagation();jqEvent.preventDefault();return false});var tableWrapper=jQuery('<div class="'+this.get("classTableWrapper")+'" contenteditable="false"></div>');this.obj.wrap(tableWrapper);var htmlTableWrapper=this.obj.parents("."+this.get("classTableWrapper"));htmlTableWrapper.get(0).onresizestart=function(e){return false};htmlTableWrapper.get(0).oncontrolselect=function(e){return false};this.tableWrapper=this.obj.parents("."+this.get("classTableWrapper")).get(0);jQuery(this.cells).each(function(){this.activate()});this.attachSelectionColumn();this.attachSelectionRow();this.attachLastCellEvents();this.isActive=true;GENTICS.Aloha.EventRegistry.trigger(new GENTICS.Aloha.Event("tableActivated",GENTICS.Aloha,[this]))};GENTICS.Aloha.Table.prototype.attachSelectionColumn=function(){var emptyCell=jQuery("<td>");emptyCell.html("\u00a0");var that=this;var rows=this.obj.context.rows;for(var i=0;i<rows.length;i++){var rowObj=jQuery(rows[i]);var columnToInsert=emptyCell.clone();columnToInsert.addClass(this.get("classSelectionColumn"));columnToInsert.css("width",this.get("selectionArea")+"px");rowObj.find("td:first").before(columnToInsert);var rowIndex=i+1;this.attachRowSelectionEventsToCell(columnToInsert)}};GENTICS.Aloha.Table.prototype.attachRowSelectionEventsToCell=function(cell){var that=this;cell.unbind("mousedown");cell.unbind("mouseover");cell.get(0).onselectstart=function(){return false};cell.bind("mousedown",function(e){that.rowSelectionMouseDown(e);that.focus();e.stopPropagation()});cell.bind("mouseover",function(e){that.rowSelectionMouseOver(e);e.preventDefault()})};GENTICS.Aloha.Table.prototype.rowSelectionMouseDown=function(jqEvent){this.mousedown=true;if(GENTICS.Aloha.TableHelper.selectedCells.length==0){this.rowsToSelect=new Array()}this.clickedRowId=jqEvent.currentTarget.parentNode.rowIndex;if(jqEvent.ctrlKey){var arrayIndex=jQuery.inArray(this.clickedRowId,this.rowsToSelect);if(arrayIndex>=0){this.rowsToSelect.splice(arrayIndex,1)}else{this.rowsToSelect.push(this.clickedRowId)}}else{if(jqEvent.shiftKey){this.rowsToSelect.sort(function(a,b){return a-b});var start=this.rowsToSelect[0];var end=this.clickedRowId;if(start>end){start=end;end=this.rowsToSelect[0]}this.rowsToSelect=new Array();for(var i=start;i<=end;i++){this.rowsToSelect.push(i)}}else{this.rowsToSelect=[this.clickedRowId]}}this.selectRows();jqEvent.preventDefault()};GENTICS.Aloha.Table.prototype.rowSelectionMouseOver=function(jqEvent){var rowIndex=jqEvent.currentTarget.parentNode.rowIndex;if(this.mousedown&&this.clickedRowId>=0){var indexInArray=jQuery.inArray(rowIndex,this.rowsToSelect);var start=(rowIndex<this.clickedRowId)?rowIndex:this.clickedRowId;var end=(rowIndex<this.clickedRowId)?this.clickedRowId:rowIndex;this.rowsToSelect=new Array();for(var i=start;i<=end;i++){this.rowsToSelect.push(i)}this.selectRows()}};GENTICS.Aloha.Table.prototype.attachSelectionRow=function(){var that=this;var emptyCell=jQuery("<td>");emptyCell.html("\u00a0");var numColumns=this.obj.context.rows[0].cells.length;var selectionRow=jQuery("<tr>");selectionRow.addClass(this.get("classSelectionRow"));selectionRow.css("height",this.get("selectionArea")+"px");for(var i=0;i<numColumns;i++){var columnToInsert=emptyCell.clone();if(i>0){this.attachColumnSelectEventsToCell(columnToInsert)}selectionRow.append(columnToInsert)}jQuery(document).bind("mouseup",function(e){that.mousedown=false;that.clickedColumnId=-1;that.clickedRowId=-1});selectionRow.find("td:first").addClass(this.get("classLeftUpperCorner"));this.obj.find("tr:first").before(selectionRow)};GENTICS.Aloha.Table.prototype.attachColumnSelectEventsToCell=function(cell){var that=this;cell.unbind("mousedown");cell.unbind("mouseover");cell.get(0).onselectstart=function(){return false};cell.bind("mousedown",function(e){that.columnSelectionMouseDown(e);that.focus();e.stopPropagation();return false});cell.bind("mouseover",function(e){that.columnSelectionMouseOver(e)})};GENTICS.Aloha.Table.prototype.columnSelectionMouseDown=function(jqEvent){this.mousedown=true;if(GENTICS.Aloha.TableHelper.selectedCells.length==0){this.columnsToSelect=new Array()}this.clickedColumnId=jqEvent.currentTarget.cellIndex;if(jqEvent.ctrlKey){var arrayIndex=jQuery.inArray(this.clickedColumnId,this.columnsToSelect);if(arrayIndex>=0){this.columnsToSelect.splice(arrayIndex,1)}else{this.columnsToSelect.push(this.clickedColumnId)}}else{if(jqEvent.shiftKey){this.columnsToSelect.sort(function(a,b){return a-b});var start=this.columnsToSelect[0];var end=this.clickedColumnId;if(start>end){start=end;end=this.columnsToSelect[0]}this.columnsToSelect=new Array();for(var i=start;i<=end;i++){this.columnsToSelect.push(i)}}else{this.columnsToSelect=[this.clickedColumnId]}}this.selectColumns();jqEvent.preventDefault()};GENTICS.Aloha.Table.prototype.columnSelectionMouseOver=function(jqEvent){var colIndex=jqEvent.currentTarget.cellIndex;if(this.mousedown&&this.clickedColumnId>0){var indexInArray=jQuery.inArray(colIndex,this.columnsToSelect);var start=(colIndex<this.clickedColumnId)?colIndex:this.clickedColumnId;var end=(colIndex<this.clickedColumnId)?this.clickedColumnId:colIndex;this.columnsToSelect=new Array();for(var i=start;i<=end;i++){this.columnsToSelect.push(i)}this.selectColumns()}};GENTICS.Aloha.Table.prototype.releaseLastCellEvents=function(){this.obj.find("tr:last td:last").unbind()};GENTICS.Aloha.Table.prototype.attachLastCellEvents=function(){var that=this;this.obj.find("tr:last td:last").bind("keydown",function(jqEvent){that.lastCellKeyDown(jqEvent)})};GENTICS.Aloha.Table.prototype.lastCellKeyDown=function(jqEvent){var KEYCODE_TAB=9;if(KEYCODE_TAB==jqEvent.keyCode&&!jqEvent.altKey&&!jqEvent.shiftKey&&!jqEvent.ctrlKey){this.addRowsAfter(false);jqEvent.stopPropagation();if(jQuery.browser.msie){this.obj.find("tr:last td:nth-child(1) div.GENTICS_Table_Cell_editable").get(0).focus();return false}}};GENTICS.Aloha.Table.prototype.deleteRows=function(){var rowIDs=new Array();var deleteTable=false;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){for(var i=0;i<GENTICS.Aloha.TableHelper.selectedCells.length;i++){rowIDs.push(GENTICS.Aloha.TableHelper.selectedCells[i][0].parentNode.rowIndex)}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){rowIDs.push(GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.parentNode.rowIndex)}}if(rowIDs.length==this.numRows){deleteTable=true}if(deleteTable){var that=this;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"Table"),text:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"deletetable.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){that.deleteTable()}}}))}else{rowIDs.sort(function(a,b){return a-b});var focusRowId=rowIDs[0];if(focusRowId>(this.numRows-rowIDs.length)){focusRowId--}this.releaseLastCellEvents();var rows=this.obj.find("tr");var rows2delete=new Array();for(var i=0;i<rowIDs.length;i++){rows2delete.push(jQuery(rows[rowIDs[i]]))}for(var i=0;i<rows2delete.length;i++){var cols=rows2delete[i].children("td").toArray();for(var j=0;j<cols.length;j++){for(var m=0;m<this.cells.length;m++){if(cols[j]==this.cells[m].obj.get(0)){this.cells.splice(m,1);m=this.cells.length}}}}for(var i=0;i<rows2delete.length;i++){rows2delete[i].remove()}this.numRows-=rows2delete.length;if(jQuery.browser.msie){setTimeout(this.obj.find("tr:nth-child("+(focusRowId+1)+") td:nth-child(2) div.GENTICS_Table_Cell_editable").get(0).focus,5)}else{this.obj.find("tr:nth-child("+(focusRowId+1)+") td:nth-child(2) div.GENTICS_Table_Cell_editable").get(0).focus()}this.attachLastCellEvents();GENTICS.Aloha.TableHelper.unselectCells()}};GENTICS.Aloha.Table.prototype.deleteColumns=function(){var colIDs=new Array();var deleteTable=false;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){for(var i=0;i<GENTICS.Aloha.TableHelper.selectedCells[0].length;i++){colIDs.push(GENTICS.Aloha.TableHelper.selectedCells[0][i].cellIndex)}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){colIDs.push(GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.cellIndex)}}if(colIDs.length==this.numCols){deleteTable=true}if(deleteTable){var that=this;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"Table"),text:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"deletetable.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){that.deleteTable()}}}))}else{colIDs.sort(function(a,b){return a-b});var focusColID=colIDs[0];if(focusColID>(this.numCols-colIDs.length)){focusColID--}this.releaseLastCellEvents();var rows=this.obj.find("tr");var cols2delete=new Array();for(var i=0;i<rows.length;i++){var cells=jQuery(rows[i]).children("td").toArray();for(var j=0;j<colIDs.length;j++){cols2delete.push(cells[colIDs[j]])}}for(var i=0;i<cols2delete.length;i++){for(var j=0;j<this.cells.length;j++){if(cols2delete[i]==this.cells[j].obj.get(0)){this.cells.splice(j,1);j=this.cells.length}}}for(var i=0;i<cols2delete.length;i++){jQuery(cols2delete[i]).remove()}this.numCols-=colIDs.length;if(jQuery.browser.msie){setTimeout(this.obj.find("tr:nth-child(2) td:nth-child("+(focusColID+1)+") div.GENTICS_Table_Cell_editable").get(0).focus,5)}else{this.obj.find("tr:nth-child(2) td:nth-child("+(focusColID+1)+") div.GENTICS_Table_Cell_editable").get(0).focus()}this.attachLastCellEvents();GENTICS.Aloha.TableHelper.unselectCells()}};GENTICS.Aloha.Table.prototype.deleteTable=function(){var deleteIndex=-1;for(var i=0;i<GENTICS.Aloha.TablePlugin.TableRegistry.length;i++){if(GENTICS.Aloha.TablePlugin.TableRegistry[i].obj.attr("id")==this.obj.attr("id")){deleteIndex=i;break}}if(deleteIndex>=0){this.deactivate();GENTICS.Aloha.TableHelper.selectionType=undefined;GENTICS.Aloha.TablePlugin.TableRegistry.splice(i,1);var newRange=GENTICS.Aloha.Selection.rangeObject;newRange.startContainer=newRange.endContainer=this.obj.get(0).parentNode;newRange.startOffset=newRange.endOffset=GENTICS.Utils.Dom.getIndexInParent(this.obj.get(0).parentNode);newRange.clearCaches();this.obj.remove();this.parentEditable.obj.focus();newRange.correctRange();newRange.select()}};GENTICS.Aloha.Table.prototype.addRowsBefore=function(highlightNewRows){this.addRows("before",highlightNewRows)};GENTICS.Aloha.Table.prototype.addRowsAfter=function(highlightNewRows){this.addRows("after",highlightNewRows)};GENTICS.Aloha.Table.prototype.addRows=function(position,highlightNewRows){if(typeof GENTICS.Aloha.TablePlugin.activeTable!="undefined"){this.releaseLastCellEvents();var that=this;var numCols=this.numCols;var rowsToInsert=1;var rowId=1;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){rowsToInsert=GENTICS.Aloha.TableHelper.selectedCells.length;switch(position){case"before":if(GENTICS.Aloha.TableHelper.selectedCells[0].length){rowId=GENTICS.Aloha.TableHelper.selectedCells[0][0].parentNode.rowIndex}break;case"after":var lastRow=GENTICS.Aloha.TableHelper.selectedCells.length-1;if(GENTICS.Aloha.TableHelper.selectedCells[lastRow].length){rowId=GENTICS.Aloha.TableHelper.selectedCells[lastRow][0].parentNode.rowIndex}break}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){rowId=GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.parentNode.rowIndex}}var newRowIndex=rowId;if(position=="after"){newRowIndex+=1}var rowIdArray=new Array();for(var j=0;j<rowsToInsert;j++){rowIdArray.push(newRowIndex);var insertionRow=jQuery("<tr>");var selectionColumn=jQuery("<td>");selectionColumn.addClass(this.get("classSelectionColumn"));this.attachRowSelectionEventsToCell(selectionColumn);insertionRow.append(selectionColumn);for(i=0;i<numCols;i++){var newCol=jQuery("<td>");newCol.html("\u00a0");var cell=new GENTICS.Aloha.Table.Cell(newCol.get(0),GENTICS.Aloha.TablePlugin.activeTable);cell.activate();this.cells.push(cell);insertionRow.append(cell.obj)}var currentRow=jQuery(GENTICS.Aloha.TablePlugin.activeTable.obj.find("tr").get(rowId));switch(position){case"before":currentRow.before(insertionRow);break;case"after":currentRow.after(insertionRow);break;default:this.warn(this,"Wrong call of GENTICS.Aloha.Table.prototype.addRow!")}newRowIndex++;this.numRows++}GENTICS.Aloha.TableHelper.unselectCells();this.rowsToSelect=rowIdArray;if(highlightNewRows){this.selectRows()}this.attachLastCellEvents()}};GENTICS.Aloha.Table.prototype.addColumnsRight=function(){this.addColumns("right")};GENTICS.Aloha.Table.prototype.addColumnsLeft=function(){this.addColumns("left")};GENTICS.Aloha.Table.prototype.addColumns=function(position){if(typeof GENTICS.Aloha.TablePlugin.activeTable!="undefined"){this.releaseLastCellEvents();var that=this;var columnsToInsert=1;var colId=1;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){columnsToInsert=GENTICS.Aloha.TableHelper.selectedCells[0].length;switch(position){case"left":if(GENTICS.Aloha.TableHelper.selectedCells[0].length){colId=GENTICS.Aloha.TableHelper.selectedCells[0][0].cellIndex}break;case"right":var lastColumn=GENTICS.Aloha.TableHelper.selectedCells[0].length-1;if(GENTICS.Aloha.TableHelper.selectedCells[0].length){colId=GENTICS.Aloha.TableHelper.selectedCells[0][lastColumn].cellIndex}break}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){colId=GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.cellIndex}}var newColId=colId;var emptyCell=jQuery("<td>");var rows=this.obj.find("tr");var colIdArray=new Array();for(var i=0;i<rows.length;i++){var currentColId=newColId;var row=rows[i];for(var j=0;j<columnsToInsert;j++){var cell=emptyCell.clone();cell.html("\u00a0");if(i==0){this.attachColumnSelectEventsToCell(cell)}else{cellObj=new GENTICS.Aloha.Table.Cell(cell.get(0),GENTICS.Aloha.TablePlugin.activeTable);this.cells.push(cellObj);cellObj.activate();cell=cellObj.obj}var insertionColumn=jQuery(jQuery(row).find("td").get(newColId));switch(position){case"left":if(jQuery.inArray(currentColId,colIdArray)<0){colIdArray.push(currentColId)}insertionColumn.before(cell);break;case"right":if(jQuery.inArray((currentColId+1),colIdArray)<0){colIdArray.push(currentColId+1)}insertionColumn.after(cell);break}currentColId++}}this.numCols+=columnsToInsert;GENTICS.Aloha.TableHelper.unselectCells();this.columnsToSelect=colIdArray;this.selectColumns();this.attachLastCellEvents()}};GENTICS.Aloha.Table.prototype.focus=function(){if(!this.hasFocus){if(!this.parentEditable.isActive){this.parentEditable.obj.focus()}GENTICS.Aloha.TablePlugin.setFocusedTable(this)}setTimeout("GENTICS.Aloha.Selection.updateSelection(false, true)",50)};GENTICS.Aloha.Table.prototype.focusOut=function(){if(this.hasFocus){this.hasFocus=false;GENTICS.Aloha.TablePlugin.setFocusedTable(undefined)}};GENTICS.Aloha.Table.prototype.selectColumns=function(){var selectClass=this.get("classCellSelected");GENTICS.Aloha.TableHelper.unselectCells();GENTICS.Aloha.TableHelper.selectionType="column";this.columnsToSelect.sort(function(a,b){return a-b});var rows=this.obj.find("tr").toArray();rows.shift();var toSelect=new Array();for(var i=0;i<rows.length;i++){var rowCells=rows[i].cells;var selectedCellsInCol=new Array();for(var j=0;j<this.columnsToSelect.length;j++){var colIndex=this.columnsToSelect[j];var cell=rowCells[colIndex];toSelect.push(cell);selectedCellsInCol.push(cell)}GENTICS.Aloha.TableHelper.selectedCells.push(selectedCellsInCol)}this.obj.find("div.GENTICS_Table_Cell_editable").blur();jQuery(toSelect).addClass(selectClass)};GENTICS.Aloha.Table.prototype.selectRows=function(){var selectClass=this.get("classCellSelected");GENTICS.Aloha.TableHelper.unselectCells();this.rowsToSelect.sort(function(a,b){return a-b});for(var i=0;i<this.rowsToSelect.length;i++){var rowId=this.rowsToSelect[i];var rowCells=jQuery(this.obj.find("tr").get(rowId).cells).toArray();rowCells.shift();GENTICS.Aloha.TableHelper.selectedCells.push(rowCells);jQuery(rowCells).addClass(this.get("classCellSelected"))}GENTICS.Aloha.TableHelper.selectionType="row";this.obj.find("div.GENTICS_Table_Cell_editable").blur()};GENTICS.Aloha.Table.prototype.deactivate=function(){this.obj.removeClass(this.get("className"));if(GENTICS.Aloha.trim(this.obj.attr("class"))==""){this.obj.removeAttr("class")}this.obj.removeAttr("contenteditable");this.obj.removeAttr("id");if(this.obj.parents("."+this.get("classTableWrapper")).length){this.obj.unwrap()}this.obj.find("tr."+this.get("classSelectionRow")+":first").remove();var that=this;jQuery.each(this.obj.context.rows,function(){jQuery(this).children("td."+that.get("classSelectionColumn")).remove()});this.obj.find("td, th").removeClass(this.get("classCellSelected"));this.obj.unbind();for(var i=0;i<this.cells.length;i++){var Cell=this.cells[i];Cell.deactivate()}};GENTICS.Aloha.Table.prototype.toString=function(){return"GENTICS.Aloha.Table"};GENTICS.Aloha.Table.Cell=function(originalTd,tableObj){this.obj=jQuery(originalTd);this.tableObj=tableObj};GENTICS.Aloha.Table.Cell.prototype.tableObj=undefined;GENTICS.Aloha.Table.Cell.prototype.obj=undefined;GENTICS.Aloha.Table.Cell.prototype.wrapper=undefined;GENTICS.Aloha.Table.Cell.prototype.hasFocus=false;GENTICS.Aloha.Table.Cell.activeCell=undefined;GENTICS.Aloha.Table.Cell.lastActiveCell=undefined;GENTICS.Aloha.Table.Cell.prototype.editableFocus=function(e){if(!this.hasFocus){this.tableObj.focus();GENTICS.Aloha.Table.Cell.activeCell=this;GENTICS.Aloha.Table.Cell.lastActiveCell=this;this.obj.addClass("GENTICS_Table_Cell_active");this.hasFocus=true;this.selectAll(this.wrapper.get(0));GENTICS.Aloha.TableHelper.selectionType=undefined}};GENTICS.Aloha.Table.Cell.prototype.editableBlur=function(jqEvent){GENTICS.Aloha.Table.Cell.activeCell=undefined;this.hasFocus=false;this.obj.removeClass("GENTICS_Table_Cell_active")};GENTICS.Aloha.Table.Cell.prototype.activate=function(){this.obj.wrapInner("<div/>");var wrapper=this.obj.children("div").eq(0);wrapper.attr("contenteditable","true");wrapper.addClass("GENTICS_Table_Cell_editable");var that=this;wrapper.bind("focus",function(jqEvent){if(jqEvent.currentTarget){jqEvent.currentTarget.indexOf=function(){return -1}}that.editableFocus(jqEvent)});wrapper.bind("mousedown",function(jqEvent){if(jqEvent.currentTarget){jqEvent.currentTarget.indexOf=function(){return -1}}that.editableMouseDown(jqEvent)});wrapper.bind("blur",function(jqEvent){that.editableBlur(jqEvent)});wrapper.bind("keyup",function(jqEvent){that.editableKeyUp(jqEvent)});wrapper.bind("keydown",function(jqEvent){that.editableKeyDown(jqEvent)});wrapper.GENTICS_contentEditableSelectionChange(function(event){GENTICS.Aloha.Selection.onChange(wrapper,event);return wrapper});this.obj.bind("mousedown",function(jqEvent){setTimeout(function(){that.wrapper.trigger("focus")},1);GENTICS.Aloha.TableHelper.unselectCells();jqEvent.stopPropagation()});this.obj.get(0).onselectstart=function(jqEvent){return false};this.wrapper=this.obj.children();this.wrapper.get(0).onselectstart=function(){window.event.cancelBubble=true};return this};GENTICS.Aloha.Table.Cell.prototype.deactivate=function(){var wrapper=this.obj.children(".GENTICS_Table_Cell_editable");if(wrapper.length){var innerHtml=wrapper.html();wrapper.unbind();wrapper.remove();this.obj.unbind("click");if(GENTICS.Aloha.trim(this.obj.attr("class"))==""){this.obj.removeAttr("class")}this.obj.html(innerHtml)}};GENTICS.Aloha.Table.Cell.prototype.toString=function(){return"GENTICS.Aloha.Table.Cell"};GENTICS.Aloha.Table.Cell.prototype.selectAll=function(editableNode){var e=(editableNode.jquery)?editableNode.get(0):editableNode;if(!jQuery.browser.msie){var s=window.getSelection();if(s.setBaseAndExtent){s.setBaseAndExtent(e,0,e,e.innerText.length-1)}else{if(window.opera&&e.innerHTML.substring(e.innerHTML.length-4)=="<BR>"){e.innerHTML=e.innerHTML+" "}var r=document.createRange();r.selectNodeContents(e);s.removeAllRanges();s.addRange(r)}}else{if(document.getSelection){var s=document.getSelection();var r=document.createRange();r.selectNodeContents(e);s.removeAllRanges();s.addRange(r)}else{if(document.selection){var r=document.body.createTextRange();r.moveToElementText(e);r.select()}}}GENTICS.Aloha.Selection.updateSelection(editableNode)};GENTICS.Aloha.Table.Cell.prototype.editableMouseDown=function(jqEvent){GENTICS.Aloha.TableHelper.unselectCells();if(this.tableObj.hasFocus){jqEvent.stopPropagation()}};GENTICS.Aloha.Table.Cell.prototype.editableKeyUp=function(jqEvent){this.checkForEmptyEvent(jqEvent)};GENTICS.Aloha.Table.Cell.prototype.editableKeyDown=function(jqEvent){this.checkForEmptyEvent(jqEvent);if(!jqEvent.ctrlKey&&!jqEvent.shiftKey){if(GENTICS.Aloha.TableHelper.selectedCells.length>0&&GENTICS.Aloha.TableHelper.selectedCells[0].length>0){GENTICS.Aloha.TableHelper.selectedCells[0][0].firstChild.focus();GENTICS.Aloha.TableHelper.unselectCells();jqEvent.stopPropagation()}}else{if(jqEvent.shiftKey&&GENTICS.Aloha.TableHelper.selectedCells.length>0){var KEYCODE_ARROWLEFT=37;var KEYCODE_ARROWUP=38;var KEYCODE_ARROWRIGHT=39;var KEYCODE_ARROWDOWN=40;switch(GENTICS.Aloha.TableHelper.selectionType){case"row":switch(jqEvent.keyCode){case KEYCODE_ARROWUP:var firstSelectedRow=GENTICS.Aloha.TableHelper.selectedCells[0][0].parentNode.rowIndex;if(firstSelectedRow>1){this.tableObj.rowsToSelect.push(firstSelectedRow-1)}break;case KEYCODE_ARROWDOWN:var lastRowIndex=GENTICS.Aloha.TableHelper.selectedCells.length-1;var lastSelectedRow=GENTICS.Aloha.TableHelper.selectedCells[lastRowIndex][0].parentNode.rowIndex;if(lastSelectedRow<this.tableObj.numRows){this.tableObj.rowsToSelect.push(lastSelectedRow+1)}break}this.tableObj.selectRows();break;case"column":switch(jqEvent.keyCode){case KEYCODE_ARROWLEFT:var firstColSelected=GENTICS.Aloha.TableHelper.selectedCells[0][0].cellIndex;if(firstColSelected>1){this.tableObj.columnsToSelect.push(firstColSelected-1)}break;case KEYCODE_ARROWRIGHT:var lastColIndex=GENTICS.Aloha.TableHelper.selectedCells[0].length-1;var lastColSelected=GENTICS.Aloha.TableHelper.selectedCells[0][lastColIndex].cellIndex;if(lastColSelected<this.tableObj.numCols){this.tableObj.columnsToSelect.push(lastColSelected+1)}break}this.tableObj.selectColumns();break}jqEvent.stopPropagation();jqEvent.preventDefault();return false}}};GENTICS.Aloha.Table.Cell.prototype.checkForEmptyEvent=function(jqEvent){if(jQuery(this.wrapper).children().length>0){return}var text=this.wrapper.text();if(text==""){this.wrapper.text("\u00a0");this.wrapper.get(0).blur();this.wrapper.get(0).focus()}};GENTICS.Aloha.Table.CreateLayer=function(){};GENTICS.Aloha.Table.CreateLayer.prototype.parameters={elemId:"GENTICS_Aloha_Table_createLayer",className:"GENTICS_Table_Createdialog",numX:10,numY:10,layer:undefined,target:undefined};GENTICS.Aloha.Table.CreateLayer.prototype.config=new Object();GENTICS.Aloha.Table.CreateLayer.prototype.visible=false;GENTICS.Aloha.Table.CreateLayer.prototype.show=function(){var layer=this.get("layer");if(layer==null){this.create()}else{this.setPosition(layer);layer.find("td").removeClass("hover");layer.show()}this.visible=true};GENTICS.Aloha.Table.CreateLayer.prototype.create=function(){var that=this;var layer=jQuery("<div></div>");layer.id=this.get("elemId");layer.addClass(this.get("className"));var table=jQuery("<table></table>");table.css("width",(this.get("numX")+6)*15);var tr;var td;for(var i=0;i<this.get("numY");i++){tr=jQuery("<tr></tr>");for(var j=0;j<this.get("numX");j++){td=jQuery("<td>\u00a0</td>");if(i==0&&j==0){td.addClass("hover")}td.bind("mouseover",{rowId:i,colId:j},function(e){that.handleMouseOver(e,table)});td.bind("click",{rowId:i,colId:j},function(e){var rows=e.data.rowId+1;var cols=e.data.colId+1;GENTICS.Aloha.TablePlugin.createTable(cols,rows);that.hide()});tr.append(td)}table.append(tr)}layer.append(table);this.set("layer",layer);this.setPosition();layer.bind("click",function(e){e.stopPropagation()}).mousedown(function(e){e.stopPropagation()});jQuery("body").append(layer).bind("click",function(e){if(e.target!=that.get("target")&&that.visible){that.hide()}})};GENTICS.Aloha.Table.CreateLayer.prototype.handleMouseOver=function(e,table){var rowId=e.data.rowId;var colId=e.data.colId;var innerRows=table.find("tr");for(var n=0;n<=innerRows.length;n++){var innerCells=jQuery(innerRows[n]).find("td");for(var k=0;k<=innerCells.length;k++){if(n<=rowId&&k<=colId){jQuery(innerCells[k]).addClass("hover")}else{jQuery(innerCells[k]).removeClass("hover")}}}};GENTICS.Aloha.Table.CreateLayer.prototype.setPosition=function(){var targetObj=jQuery(this.get("target"));var pos=targetObj.offset();this.get("layer").css("left",pos.left+"px");this.get("layer").css("top",(pos.top+targetObj.height())+"px")};GENTICS.Aloha.Table.CreateLayer.prototype.hide=function(){this.get("layer").hide();this.visible=false};GENTICS.Aloha.Table.CreateLayer.prototype.get=function(property){if(this.config[property]){return this.config[property]}if(this.parameters[property]){return this.parameters[property]}return undefined};GENTICS.Aloha.Table.CreateLayer.prototype.set=function(key,value){if(this.config[key]){this.config[key]=value}else{this.parameters[key]=value}};GENTICS.Aloha.TableHelper=function(){};GENTICS.Aloha.TableHelper.prototype.selectionType=undefined;GENTICS.Aloha.TableHelper.prototype.selectedCells=new Array();GENTICS.Aloha.TableHelper.prototype.unselectCells=function(){if(this.selectedCells.length>0){for(var i=0;i<this.selectedCells.length;i++){jQuery(this.selectedCells[i]).removeClass(GENTICS.Aloha.TablePlugin.get("classCellSelected"))}this.selectedCells=new Array();this.selectionType=undefined}};GENTICS.Aloha.TableHelper.prototype.getNewTableID=function(){var idPrefix="GENTICS_Table_";var factor=1000000;for(this.tableCounter;true;this.tableCounter++){var id=idPrefix+(Math.ceil(Math.random()*factor));for(var j=id.length;j<idPrefix.length+factor.toString().length;j++){id+="0"}if(!jQuery("#"+id).length){return id}}};GENTICS.Aloha.TableHelper=new GENTICS.Aloha.TableHelper();
|
7
|
+
GENTICS.Aloha.TablePlugin=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.Table");GENTICS.Aloha.TablePlugin.createLayer=undefined;GENTICS.Aloha.TablePlugin.languages=["en","de","fr","eo","fi","ru","it","pl"];GENTICS.Aloha.TablePlugin.config=["table"];GENTICS.Aloha.TablePlugin.TableRegistry=new Array();GENTICS.Aloha.TablePlugin.activeTable=undefined;GENTICS.Aloha.TablePlugin.parameters={className:"GENTICS_Aloha_Table",classSelectionRow:"GENTICS_Aloha_Table_selectColumn",classSelectionColumn:"GENTICS_Aloha_Table_selectRow",classLeftUpperCorner:"GENTICS_Aloha_Table_leftUpperCorner",classTableWrapper:"GENTICS_Aloha_Table_wrapper",classCellSelected:"GENTICS_Aloha_Cell_selected",waiRed:"GENTICS_WAI_RED",waiGreen:"GENTICS_WAI_GREEN",selectionArea:10};GENTICS.Aloha.TablePlugin.init=function(){this.createLayer=new GENTICS.Aloha.Table.CreateLayer();var that=this;GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableCreated",function(event,editable){editable.obj.bind("mousedown",function(jqEvent){GENTICS.Aloha.TablePlugin.setFocusedTable(undefined)});editable.obj.find("table").each(function(){if(that.isEditableTable(this)){var table=new GENTICS.Aloha.Table(this);table.parentEditable=editable;GENTICS.Aloha.TablePlugin.TableRegistry.push(table)}})});this.initTableButtons();GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"selectionChanged",function(event,rangeObject){if(GENTICS.Aloha.activeEditable){var config=that.getEditableConfig(GENTICS.Aloha.activeEditable.obj);if(jQuery.inArray("table",config)!=-1&&GENTICS.Aloha.Selection.mayInsertTag("table")){that.createTableButton.show()}else{that.createTableButton.hide()}GENTICS.Aloha.TableHelper.unselectCells();var table=rangeObject.findMarkup(function(){return this.nodeName.toLowerCase()=="table"},GENTICS.Aloha.activeEditable.obj);if(table){GENTICS.Aloha.FloatingMenu.setScope(that.getUID(GENTICS.Aloha.TableHelper.selectionType))}else{if(that.activeTable){that.activeTable.focusOut()}}GENTICS.Aloha.FloatingMenu.doLayout()}});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableActivated",function(event,props){props.editable.obj.find("table").each(function(){var tr=GENTICS.Aloha.TablePlugin.TableRegistry;for(var i=0;i<tr.length;i++){if(tr[i].obj.attr("id")==jQuery(this).attr("id")){tr[i].activate();return true}}if(that.isEditableTable(this)){var table=new GENTICS.Aloha.Table(this);table.parentEditable=props.editable;table.activate();GENTICS.Aloha.TablePlugin.TableRegistry.push(table)}})});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableDeactivated",function(event,properties){GENTICS.Aloha.TablePlugin.setFocusedTable(undefined);GENTICS.Aloha.TableHelper.unselectCells();var tr=GENTICS.Aloha.TablePlugin.TableRegistry;for(var i=0;i<tr.length;i++){tr[i].deactivate()}})};GENTICS.Aloha.TablePlugin.isEditableTable=function(table){var parent=jQuery(table.parentNode);if(parent.contentEditable()=="true"){return true}else{return false}};GENTICS.Aloha.TablePlugin.initTableButtons=function(){var that=this;GENTICS.Aloha.FloatingMenu.createScope(this.getUID("row"),"GENTICS.Aloha.global");GENTICS.Aloha.FloatingMenu.createScope(this.getUID("column"),"GENTICS.Aloha.global");GENTICS.Aloha.FloatingMenu.createScope(this.getUID("cell"),"GENTICS.Aloha.continuoustext");this.createTableButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_table",size:"small",tooltip:this.i18n("button.createtable.tooltip"),onclick:function(element,event){GENTICS.Aloha.TablePlugin.createDialog(element.btnEl.dom)}});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.createTableButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.insert"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("column"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addColumnLeft",size:"small",tooltip:this.i18n("button.addcolleft.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addColumnsLeft()}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("column"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addColumnRight",size:"small",tooltip:this.i18n("button.addcolright.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addColumnsRight()}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("column"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_deleteColumns",size:"small",tooltip:this.i18n("button.delcols.tooltip"),onclick:function(){if(that.activeTable){var aTable=that.activeTable;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(that,"Table"),text:GENTICS.Aloha.i18n(that,"deletecolumns.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){aTable.deleteColumns()}}}))}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("row"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addRowBefore",size:"small",tooltip:this.i18n("button.addrowbefore.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addRowsBefore(true)}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("row"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_addRowAfter",size:"small",tooltip:this.i18n("button.addrowafter.tooltip"),onclick:function(){if(that.activeTable){that.activeTable.addRowsAfter(true)}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);GENTICS.Aloha.FloatingMenu.addButton(this.getUID("row"),new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_deleteRows",size:"small",tooltip:this.i18n("button.delrows.tooltip"),onclick:function(){if(that.activeTable){var aTable=that.activeTable;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(that,"Table"),text:GENTICS.Aloha.i18n(that,"deleterows.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){aTable.deleteRows()}}}))}}}),GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);this.captionButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_table_caption",size:"small",tooltip:this.i18n("button.caption.tooltip"),toggle:true,onclick:function(){if(that.activeTable){if(that.activeTable.obj.children("caption").is("caption")){that.activeTable.obj.children("caption").remove()}else{var captionText=that.i18n("empty.caption");var c=jQuery("<caption></caption>");that.activeTable.obj.append(c);that.makeCaptionEditable(c,captionText);var cDiv=c.find("div").eq(0);var captionContent=cDiv.contents().eq(0);if(captionContent.length>0){var newRange=new GENTICS.Utils.RangeObject();newRange.startContainer=newRange.endContainer=captionContent.get(0);newRange.startOffset=0;newRange.endOffset=captionContent.text().length;that.activeTable.obj.find("div.GENTICS_Table_Cell_editable").blur();cDiv.focus();newRange.select();GENTICS.Aloha.Selection.updateSelection()}}}}});GENTICS.Aloha.FloatingMenu.addButton(this.getUID("cell"),this.captionButton,GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1);this.summary=new GENTICS.Aloha.ui.AttributeField({width:350});this.summary.addListener("keyup",function(obj,event){that.activeTable.checkWai()});GENTICS.Aloha.FloatingMenu.addButton(this.getUID("cell"),this.summary,GENTICS.Aloha.i18n(this,"floatingmenu.tab.table"),1)};GENTICS.Aloha.TablePlugin.makeCaptionEditable=function(caption,captionText){var that=this;var cSpan=caption.children("div").eq(0);if(cSpan.length==0){cSpan=jQuery("<div></div>");if(caption.contents().length>0){caption.contents().wrap(cSpan)}else{if(captionText){cSpan.text(captionText)}caption.append(cSpan)}}cSpan.contentEditable(true);cSpan.unbind("mousedown");cSpan.bind("mousedown",function(jqEvent){cSpan.focus();jqEvent.preventDefault();jqEvent.stopPropagation();return false})};GENTICS.Aloha.TablePlugin.createDialog=function(callingElement){this.createLayer.set("target",callingElement);this.createLayer.show()};GENTICS.Aloha.TablePlugin.createTable=function(cols,rows){if(GENTICS.Aloha.activeEditable!=null&&typeof GENTICS.Aloha.activeEditable.obj!="undefined"){var table=document.createElement("table");var tableId=table.id=GENTICS.Aloha.TableHelper.getNewTableID();var tbody=document.createElement("tbody");for(var i=0;i<rows;i++){var tr=document.createElement("tr");for(var j=0;j<cols;j++){var text=document.createTextNode("\u00a0");var td=document.createElement("td");td.appendChild(text);tr.appendChild(td)}tbody.appendChild(tr)}table.appendChild(tbody);GENTICS.Utils.Dom.insertIntoDOM(jQuery(table),GENTICS.Aloha.Selection.getRangeObject(),jQuery(GENTICS.Aloha.activeEditable.obj));var tableReloadedFromDOM=document.getElementById(tableId);var tableObj=new GENTICS.Aloha.Table(tableReloadedFromDOM);tableObj.parentEditable=GENTICS.Aloha.activeEditable;tableObj.activate();if(jQuery.browser.msie){window.setTimeout(function(){tableObj.cells[0].wrapper.get(0).focus()},20)}else{tableObj.cells[0].wrapper.get(0).focus()}GENTICS.Aloha.TablePlugin.TableRegistry.push(tableObj)}else{this.error("There is no active Editable where the table can be inserted!")}};GENTICS.Aloha.TablePlugin.setFocusedTable=function(focusTable){var that=this;for(var i=0;i<GENTICS.Aloha.TablePlugin.TableRegistry.length;i++){GENTICS.Aloha.TablePlugin.TableRegistry[i].hasFocus=false}if(typeof focusTable!="undefined"){this.summary.setTargetObject(focusTable.obj,"summary");if(focusTable.obj.children("caption").is("caption")){that.captionButton.setPressed(true);var c=focusTable.obj.children("caption");that.makeCaptionEditable(c)}focusTable.hasFocus=true}GENTICS.Aloha.TablePlugin.activeTable=focusTable};GENTICS.Aloha.TablePlugin.error=function(msg){GENTICS.Aloha.Log.error(this,msg)};GENTICS.Aloha.TablePlugin.debug=function(msg){GENTICS.Aloha.Log.debug(this,msg)};GENTICS.Aloha.TablePlugin.info=function(msg){GENTICS.Aloha.Log.info(this,msg)};GENTICS.Aloha.TablePlugin.log=function(msg){GENTICS.Aloha.log("log",this,msg)};GENTICS.Aloha.TablePlugin.get=function(property){if(this.config[property]){return this.config[property]}if(this.parameters[property]){return this.parameters[property]}return undefined};GENTICS.Aloha.TablePlugin.set=function(key,value){if(this.config[key]){this.config[key]=value}else{this.parameters[key]=value}};GENTICS.Aloha.TablePlugin.makeClean=function(obj){obj.find("table").each(function(){var table=new GENTICS.Aloha.Table(this);table.deactivate()})};GENTICS.Aloha.TablePlugin.toString=function(){return this.prefix};GENTICS.Aloha.Table=function(table){this.obj=jQuery(table);if(!this.obj.attr("id")){this.obj.attr("id",GENTICS.Utils.guid())}var rows=this.obj.find("tr");var firstRow=jQuery(rows.get(0));this.numCols=firstRow.children("td, th").length;this.numRows=rows.length;this.cells=new Array();var rows=this.obj.find("tr");for(var i=0;i<rows.length;i++){var row=jQuery(rows[i]);var cols=row.children();for(var j=0;j<cols.length;j++){var col=cols[j];var Cell=new GENTICS.Aloha.Table.Cell(col,this);this.cells.push(Cell)}}};GENTICS.Aloha.Table.prototype.obj=undefined;GENTICS.Aloha.Table.prototype.tableWrapper=undefined;GENTICS.Aloha.Table.prototype.cells=undefined;GENTICS.Aloha.Table.prototype.numRows=undefined;GENTICS.Aloha.Table.prototype.numCols=undefined;GENTICS.Aloha.Table.prototype.isActive=false;GENTICS.Aloha.Table.prototype.hasFocus=false;GENTICS.Aloha.Table.prototype.parentEditable=undefined;GENTICS.Aloha.Table.prototype.mousedown=false;GENTICS.Aloha.Table.prototype.clickedColumnId=-1;GENTICS.Aloha.Table.prototype.clickedRowId=-1;GENTICS.Aloha.Table.prototype.columnsToSelect=new Array();GENTICS.Aloha.Table.prototype.rowsToSelect=new Array();GENTICS.Aloha.Table.prototype.fmPluginId=undefined;GENTICS.Aloha.Table.prototype.get=function(property){return GENTICS.Aloha.TablePlugin.get(property)};GENTICS.Aloha.Table.prototype.set=function(key,value){GENTICS.Aloha.TablePlugin.set(key,value)};GENTICS.Aloha.Table.prototype.activate=function(){if(this.isActive){return}var that=this;this.obj.addClass(this.get("className"));this.obj.contentEditable(false);if(this.obj.attr("id")==""){this.obj.attr("id",GENTICS.Aloha.TableHelper.getNewTableID())}GENTICS.Aloha.TableHelper.selectionType=undefined;this.obj.bind("keydown",function(jqEvent){if(!jqEvent.ctrlKey&&!jqEvent.shiftKey){if(GENTICS.Aloha.TableHelper.selectedCells.length>0&&GENTICS.Aloha.TableHelper.selectedCells[0].length>0){GENTICS.Aloha.TableHelper.selectedCells[0][0].firstChild.focus()}}});this.obj.bind("mousedown",function(jqEvent){if(!that.hasFocus){that.focus()}jqEvent.stopPropagation();jqEvent.preventDefault();return false});var tableWrapper=jQuery('<div class="'+this.get("classTableWrapper")+'"></div>');tableWrapper.contentEditable(false);this.obj.wrap(tableWrapper);var htmlTableWrapper=this.obj.parents("."+this.get("classTableWrapper"));htmlTableWrapper.get(0).onresizestart=function(e){return false};htmlTableWrapper.get(0).oncontrolselect=function(e){return false};this.tableWrapper=this.obj.parents("."+this.get("classTableWrapper")).get(0);jQuery(this.cells).each(function(){this.activate()});this.attachSelectionColumn();this.attachSelectionRow();this.attachLastCellEvents();this.makeCaptionEditable();this.checkWai();this.isActive=true;GENTICS.Aloha.EventRegistry.trigger(new GENTICS.Aloha.Event("tableActivated",GENTICS.Aloha,[this]))};GENTICS.Aloha.Table.prototype.makeCaptionEditable=function(){var caption=this.obj.find("caption").eq(0);if(caption){GENTICS.Aloha.TablePlugin.makeCaptionEditable(caption)}};GENTICS.Aloha.Table.prototype.checkWai=function(){var w=this.wai;w.removeClass(this.get("waiGreen"));w.removeClass(this.get("waiRed"));if(this.obj[0].summary.length>5){w.addClass(this.get("waiGreen"))}else{w.addClass(this.get("waiRed"))}};GENTICS.Aloha.Table.prototype.attachSelectionColumn=function(){var emptyCell=jQuery("<td>");emptyCell.html("\u00a0");var that=this;var rows=this.obj.context.rows;for(var i=0;i<rows.length;i++){var rowObj=jQuery(rows[i]);var columnToInsert=emptyCell.clone();columnToInsert.addClass(this.get("classSelectionColumn"));columnToInsert.css("width",this.get("selectionArea")+"px");rowObj.find("td:first").before(columnToInsert);var rowIndex=i+1;this.attachRowSelectionEventsToCell(columnToInsert)}};GENTICS.Aloha.Table.prototype.attachRowSelectionEventsToCell=function(cell){var that=this;cell.unbind("mousedown");cell.unbind("mouseover");cell.get(0).onselectstart=function(){return false};cell.bind("mousedown",function(e){that.mousedown=true;return that.rowSelectionMouseDown(e)});cell.bind("mouseover",function(e){if(that.mousedown){return that.rowSelectionMouseOver(e)}})};GENTICS.Aloha.Table.prototype.rowSelectionMouseDown=function(jqEvent){this.focus();if(GENTICS.Aloha.TableHelper.selectedCells.length==0){this.rowsToSelect=new Array()}this.clickedRowId=jqEvent.currentTarget.parentNode.rowIndex;if(jqEvent.metaKey){var arrayIndex=jQuery.inArray(this.clickedRowId,this.rowsToSelect);if(arrayIndex>=0){this.rowsToSelect.splice(arrayIndex,1)}else{this.rowsToSelect.push(this.clickedRowId)}}else{if(jqEvent.shiftKey){this.rowsToSelect.sort(function(a,b){return a-b});var start=this.rowsToSelect[0];var end=this.clickedRowId;if(start>end){start=end;end=this.rowsToSelect[0]}this.rowsToSelect=new Array();for(var i=start;i<=end;i++){this.rowsToSelect.push(i)}}else{this.rowsToSelect=[this.clickedRowId]}}this.selectRows();jqEvent.preventDefault();jqEvent.stopPropagation();return false};GENTICS.Aloha.Table.prototype.rowSelectionMouseOver=function(jqEvent){var rowIndex=jqEvent.currentTarget.parentNode.rowIndex;if(this.mousedown&&this.clickedRowId>=0){var indexInArray=jQuery.inArray(rowIndex,this.rowsToSelect);var start=(rowIndex<this.clickedRowId)?rowIndex:this.clickedRowId;var end=(rowIndex<this.clickedRowId)?this.clickedRowId:rowIndex;this.rowsToSelect=new Array();for(var i=start;i<=end;i++){this.rowsToSelect.push(i)}this.selectRows();jqEvent.preventDefault();jqEvent.stopPropagation();return false}};GENTICS.Aloha.Table.prototype.attachSelectionRow=function(){var that=this;var emptyCell=jQuery("<td>");emptyCell.html("\u00a0");var numColumns=this.obj.context.rows[0].cells.length;var selectionRow=jQuery("<tr>");selectionRow.addClass(this.get("classSelectionRow"));selectionRow.css("height",this.get("selectionArea")+"px");for(var i=0;i<numColumns;i++){var columnToInsert=emptyCell.clone();if(i>0){this.attachColumnSelectEventsToCell(columnToInsert)}else{var columnToInsert=jQuery("<td>").clone();columnToInsert.addClass(this.get("classLeftUpperCorner"));this.wai=jQuery("<div/>");this.wai.width(25);this.wai.height(12);this.wai.click(function(e){that.focus();GENTICS.Aloha.FloatingMenu.userActivatedTab=GENTICS.Aloha.TablePlugin.i18n("floatingmenu.tab.table");GENTICS.Aloha.FloatingMenu.doLayout();GENTICS.Aloha.TablePlugin.summary.focus();e.stopPropagation();e.preventDefault();return false});columnToInsert.append(this.wai)}selectionRow.append(columnToInsert)}jQuery(document).bind("mouseup",function(e){that.mousedown=false;that.clickedColumnId=-1;that.clickedRowId=-1});this.obj.find("tr:first").before(selectionRow)};GENTICS.Aloha.Table.prototype.attachColumnSelectEventsToCell=function(cell){var that=this;cell.unbind("mousedown");cell.unbind("mouseover");cell.get(0).onselectstart=function(){return false};cell.bind("mousedown",function(e){that.mousedown=true;that.columnSelectionMouseDown(e)});cell.bind("mouseover",function(e){if(that.mousedown){that.columnSelectionMouseOver(e)}})};GENTICS.Aloha.Table.prototype.columnSelectionMouseDown=function(jqEvent){this.focus();if(GENTICS.Aloha.TableHelper.selectedCells.length==0){this.columnsToSelect=new Array()}this.clickedColumnId=jqEvent.currentTarget.cellIndex;if(jqEvent.metaKey){var arrayIndex=jQuery.inArray(this.clickedColumnId,this.columnsToSelect);if(arrayIndex>=0){this.columnsToSelect.splice(arrayIndex,1)}else{this.columnsToSelect.push(this.clickedColumnId)}}else{if(jqEvent.shiftKey){this.columnsToSelect.sort(function(a,b){return a-b});var start=this.columnsToSelect[0];var end=this.clickedColumnId;if(start>end){start=end;end=this.columnsToSelect[0]}this.columnsToSelect=new Array();for(var i=start;i<=end;i++){this.columnsToSelect.push(i)}}else{this.columnsToSelect=[this.clickedColumnId]}}this.selectColumns();jqEvent.preventDefault();jqEvent.stopPropagation();return false};GENTICS.Aloha.Table.prototype.columnSelectionMouseOver=function(jqEvent){var colIndex=jqEvent.currentTarget.cellIndex;if(this.mousedown&&this.clickedColumnId>0){var indexInArray=jQuery.inArray(colIndex,this.columnsToSelect);var start=(colIndex<this.clickedColumnId)?colIndex:this.clickedColumnId;var end=(colIndex<this.clickedColumnId)?this.clickedColumnId:colIndex;this.columnsToSelect=new Array();for(var i=start;i<=end;i++){this.columnsToSelect.push(i)}this.selectColumns()}};GENTICS.Aloha.Table.prototype.releaseLastCellEvents=function(){this.obj.find("tr:last td:last").unbind()};GENTICS.Aloha.Table.prototype.attachLastCellEvents=function(){var that=this;this.obj.find("tr:last td:last").bind("keydown",function(jqEvent){that.lastCellKeyDown(jqEvent)})};GENTICS.Aloha.Table.prototype.lastCellKeyDown=function(jqEvent){var KEYCODE_TAB=9;if(KEYCODE_TAB==jqEvent.keyCode&&!jqEvent.altKey&&!jqEvent.shiftKey&&!jqEvent.ctrlKey){this.addRowsAfter(false);jqEvent.stopPropagation();if(jQuery.browser.msie){this.obj.find("tr:last td:nth-child(1) div.GENTICS_Table_Cell_editable").get(0).focus();return false}}};GENTICS.Aloha.Table.prototype.deleteRows=function(){var rowIDs=new Array();var deleteTable=false;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){for(var i=0;i<GENTICS.Aloha.TableHelper.selectedCells.length;i++){rowIDs.push(GENTICS.Aloha.TableHelper.selectedCells[i][0].parentNode.rowIndex)}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){rowIDs.push(GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.parentNode.rowIndex)}}if(rowIDs.length==this.numRows){deleteTable=true}if(deleteTable){var that=this;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"Table"),text:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"deletetable.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){that.deleteTable()}}}))}else{rowIDs.sort(function(a,b){return a-b});var focusRowId=rowIDs[0];if(focusRowId>(this.numRows-rowIDs.length)){focusRowId--}this.releaseLastCellEvents();var rows=this.obj.find("tr");var rows2delete=new Array();for(var i=0;i<rowIDs.length;i++){rows2delete.push(jQuery(rows[rowIDs[i]]))}for(var i=0;i<rows2delete.length;i++){var cols=rows2delete[i].children("td").toArray();for(var j=0;j<cols.length;j++){for(var m=0;m<this.cells.length;m++){if(cols[j]==this.cells[m].obj.get(0)){this.cells.splice(m,1);m=this.cells.length}}}}for(var i=0;i<rows2delete.length;i++){rows2delete[i].remove()}this.numRows-=rows2delete.length;if(jQuery.browser.msie){setTimeout(this.obj.find("tr:nth-child("+(focusRowId+1)+") td:nth-child(2) div.GENTICS_Table_Cell_editable").get(0).focus,5)}else{this.obj.find("tr:nth-child("+(focusRowId+1)+") td:nth-child(2) div.GENTICS_Table_Cell_editable").get(0).focus()}this.attachLastCellEvents();GENTICS.Aloha.TableHelper.unselectCells()}};GENTICS.Aloha.Table.prototype.deleteColumns=function(){var colIDs=new Array();var deleteTable=false;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){for(var i=0;i<GENTICS.Aloha.TableHelper.selectedCells[0].length;i++){colIDs.push(GENTICS.Aloha.TableHelper.selectedCells[0][i].cellIndex)}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){colIDs.push(GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.cellIndex)}}if(colIDs.length==this.numCols){deleteTable=true}if(deleteTable){var that=this;GENTICS.Aloha.showMessage(new GENTICS.Aloha.Message({title:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"Table"),text:GENTICS.Aloha.i18n(GENTICS.Aloha.TablePlugin,"deletetable.confirm"),type:GENTICS.Aloha.Message.Type.CONFIRM,callback:function(sel){if(sel=="yes"){that.deleteTable()}}}))}else{colIDs.sort(function(a,b){return a-b});var focusColID=colIDs[0];if(focusColID>(this.numCols-colIDs.length)){focusColID--}this.releaseLastCellEvents();var rows=this.obj.find("tr");var cols2delete=new Array();for(var i=0;i<rows.length;i++){var cells=jQuery(rows[i]).children("td").toArray();for(var j=0;j<colIDs.length;j++){cols2delete.push(cells[colIDs[j]])}}for(var i=0;i<cols2delete.length;i++){for(var j=0;j<this.cells.length;j++){if(cols2delete[i]==this.cells[j].obj.get(0)){this.cells.splice(j,1);j=this.cells.length}}}for(var i=0;i<cols2delete.length;i++){jQuery(cols2delete[i]).remove()}this.numCols-=colIDs.length;if(jQuery.browser.msie){setTimeout(this.obj.find("tr:nth-child(2) td:nth-child("+(focusColID+1)+") div.GENTICS_Table_Cell_editable").get(0).focus,5)}else{this.obj.find("tr:nth-child(2) td:nth-child("+(focusColID+1)+") div.GENTICS_Table_Cell_editable").get(0).focus()}this.attachLastCellEvents();GENTICS.Aloha.TableHelper.unselectCells()}};GENTICS.Aloha.Table.prototype.deleteTable=function(){var deleteIndex=-1;for(var i=0;i<GENTICS.Aloha.TablePlugin.TableRegistry.length;i++){if(GENTICS.Aloha.TablePlugin.TableRegistry[i].obj.attr("id")==this.obj.attr("id")){deleteIndex=i;break}}if(deleteIndex>=0){this.deactivate();GENTICS.Aloha.TableHelper.selectionType=undefined;GENTICS.Aloha.TablePlugin.TableRegistry.splice(i,1);var newRange=GENTICS.Aloha.Selection.rangeObject;newRange.startContainer=newRange.endContainer=this.obj.get(0).parentNode;newRange.startOffset=newRange.endOffset=GENTICS.Utils.Dom.getIndexInParent(this.obj.get(0).parentNode);newRange.clearCaches();this.obj.remove();this.parentEditable.obj.focus();newRange.correctRange();newRange.select()}};GENTICS.Aloha.Table.prototype.addRowsBefore=function(highlightNewRows){this.addRows("before",highlightNewRows)};GENTICS.Aloha.Table.prototype.addRowsAfter=function(highlightNewRows){this.addRows("after",highlightNewRows)};GENTICS.Aloha.Table.prototype.addRows=function(position,highlightNewRows){if(typeof GENTICS.Aloha.TablePlugin.activeTable!="undefined"){this.releaseLastCellEvents();var that=this;var numCols=this.numCols;var rowsToInsert=1;var rowId=1;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){rowsToInsert=GENTICS.Aloha.TableHelper.selectedCells.length;switch(position){case"before":if(GENTICS.Aloha.TableHelper.selectedCells[0].length){rowId=GENTICS.Aloha.TableHelper.selectedCells[0][0].parentNode.rowIndex}break;case"after":var lastRow=GENTICS.Aloha.TableHelper.selectedCells.length-1;if(GENTICS.Aloha.TableHelper.selectedCells[lastRow].length){rowId=GENTICS.Aloha.TableHelper.selectedCells[lastRow][0].parentNode.rowIndex}break}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){rowId=GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.parentNode.rowIndex}}var newRowIndex=rowId;if(position=="after"){newRowIndex+=1}var rowIdArray=new Array();for(var j=0;j<rowsToInsert;j++){rowIdArray.push(newRowIndex);var insertionRow=jQuery("<tr>");var selectionColumn=jQuery("<td>");selectionColumn.addClass(this.get("classSelectionColumn"));this.attachRowSelectionEventsToCell(selectionColumn);insertionRow.append(selectionColumn);for(i=0;i<numCols;i++){var newCol=jQuery("<td>");newCol.html("\u00a0");var cell=new GENTICS.Aloha.Table.Cell(newCol.get(0),GENTICS.Aloha.TablePlugin.activeTable);cell.activate();this.cells.push(cell);insertionRow.append(cell.obj)}var currentRow=jQuery(GENTICS.Aloha.TablePlugin.activeTable.obj.find("tr").get(rowId));switch(position){case"before":currentRow.before(insertionRow);break;case"after":currentRow.after(insertionRow);break;default:this.warn(this,"Wrong call of GENTICS.Aloha.Table.prototype.addRow!")}newRowIndex++;this.numRows++}GENTICS.Aloha.TableHelper.unselectCells();this.rowsToSelect=rowIdArray;if(highlightNewRows){this.selectRows()}this.attachLastCellEvents()}};GENTICS.Aloha.Table.prototype.addColumnsRight=function(){this.addColumns("right")};GENTICS.Aloha.Table.prototype.addColumnsLeft=function(){this.addColumns("left")};GENTICS.Aloha.Table.prototype.addColumns=function(position){if(typeof GENTICS.Aloha.TablePlugin.activeTable!="undefined"){this.releaseLastCellEvents();var that=this;var columnsToInsert=1;var colId=1;if(GENTICS.Aloha.TableHelper.selectedCells.length>0){columnsToInsert=GENTICS.Aloha.TableHelper.selectedCells[0].length;switch(position){case"left":if(GENTICS.Aloha.TableHelper.selectedCells[0].length){colId=GENTICS.Aloha.TableHelper.selectedCells[0][0].cellIndex}break;case"right":var lastColumn=GENTICS.Aloha.TableHelper.selectedCells[0].length-1;if(GENTICS.Aloha.TableHelper.selectedCells[0].length){colId=GENTICS.Aloha.TableHelper.selectedCells[0][lastColumn].cellIndex}break}}else{if(typeof GENTICS.Aloha.Table.Cell.lastActiveCell!="undefined"){colId=GENTICS.Aloha.Table.Cell.lastActiveCell.obj.context.cellIndex}}var newColId=colId;var emptyCell=jQuery("<td>");var rows=this.obj.find("tr");var colIdArray=new Array();for(var i=0;i<rows.length;i++){var currentColId=newColId;var row=rows[i];for(var j=0;j<columnsToInsert;j++){var cell=emptyCell.clone();cell.html("\u00a0");if(i==0){this.attachColumnSelectEventsToCell(cell)}else{cellObj=new GENTICS.Aloha.Table.Cell(cell.get(0),GENTICS.Aloha.TablePlugin.activeTable);this.cells.push(cellObj);cellObj.activate();cell=cellObj.obj}var insertionColumn=jQuery(jQuery(row).find("td").get(newColId));switch(position){case"left":if(jQuery.inArray(currentColId,colIdArray)<0){colIdArray.push(currentColId)}insertionColumn.before(cell);break;case"right":if(jQuery.inArray((currentColId+1),colIdArray)<0){colIdArray.push(currentColId+1)}insertionColumn.after(cell);break}currentColId++}}this.numCols+=columnsToInsert;GENTICS.Aloha.TableHelper.unselectCells();this.columnsToSelect=colIdArray;this.selectColumns();this.attachLastCellEvents()}};GENTICS.Aloha.Table.prototype.focus=function(){if(!this.hasFocus){if(!this.parentEditable.isActive){this.parentEditable.obj.focus()}GENTICS.Aloha.TablePlugin.setFocusedTable(this)}};GENTICS.Aloha.Table.prototype.focusOut=function(){if(this.hasFocus){GENTICS.Aloha.TablePlugin.setFocusedTable(undefined);GENTICS.Aloha.TableHelper.selectionType=undefined}};GENTICS.Aloha.Table.prototype.selectColumns=function(){var selectClass=this.get("classCellSelected");GENTICS.Aloha.TableHelper.unselectCells();GENTICS.Aloha.TableHelper.selectionType="column";GENTICS.Aloha.FloatingMenu.setScope(GENTICS.Aloha.TablePlugin.getUID("column"));this.columnsToSelect.sort(function(a,b){return a-b});var rows=this.obj.find("tr").toArray();rows.shift();var toSelect=new Array();for(var i=0;i<rows.length;i++){var rowCells=rows[i].cells;var selectedCellsInCol=new Array();for(var j=0;j<this.columnsToSelect.length;j++){var colIndex=this.columnsToSelect[j];var cell=rowCells[colIndex];toSelect.push(cell);selectedCellsInCol.push(cell)}GENTICS.Aloha.TableHelper.selectedCells.push(selectedCellsInCol)}this.obj.find("div.GENTICS_Table_Cell_editable").blur();jQuery(toSelect).addClass(selectClass)};GENTICS.Aloha.Table.prototype.selectRows=function(){var selectClass=this.get("classCellSelected");GENTICS.Aloha.TableHelper.unselectCells();this.rowsToSelect.sort(function(a,b){return a-b});for(var i=0;i<this.rowsToSelect.length;i++){var rowId=this.rowsToSelect[i];var rowCells=jQuery(this.obj.find("tr").get(rowId).cells).toArray();rowCells.shift();GENTICS.Aloha.TableHelper.selectedCells.push(rowCells);jQuery(rowCells).addClass(this.get("classCellSelected"))}GENTICS.Aloha.TableHelper.selectionType="row";GENTICS.Aloha.FloatingMenu.setScope(GENTICS.Aloha.TablePlugin.getUID("row"));this.obj.find("div.GENTICS_Table_Cell_editable").blur()};GENTICS.Aloha.Table.prototype.deactivate=function(){this.obj.removeClass(this.get("className"));if(GENTICS.Aloha.trim(this.obj.attr("class"))==""){this.obj.removeAttr("class")}if(this.obj.parents("."+this.get("classTableWrapper")).length){this.obj.unwrap()}this.obj.find("tr."+this.get("classSelectionRow")+":first").remove();var that=this;jQuery.each(this.obj.context.rows,function(){jQuery(this).children("td."+that.get("classSelectionColumn")).remove()});this.obj.find("td, th").removeClass(this.get("classCellSelected"));this.obj.unbind();for(var i=0;i<this.cells.length;i++){var Cell=this.cells[i];Cell.deactivate()}this.obj.find("caption div").each(function(){jQuery(this).contents().unwrap()});this.isActive=false};GENTICS.Aloha.Table.prototype.toString=function(){return"GENTICS.Aloha.Table"};GENTICS.Aloha.Table.Cell=function(originalTd,tableObj){this.obj=jQuery(originalTd);this.tableObj=tableObj};GENTICS.Aloha.Table.Cell.prototype.tableObj=undefined;GENTICS.Aloha.Table.Cell.prototype.obj=undefined;GENTICS.Aloha.Table.Cell.prototype.wrapper=undefined;GENTICS.Aloha.Table.Cell.prototype.hasFocus=false;GENTICS.Aloha.Table.Cell.activeCell=undefined;GENTICS.Aloha.Table.Cell.lastActiveCell=undefined;GENTICS.Aloha.Table.Cell.prototype.editableFocus=function(e){if(!this.hasFocus){this.tableObj.focus();GENTICS.Aloha.Table.Cell.activeCell=this;GENTICS.Aloha.Table.Cell.lastActiveCell=this;this.obj.addClass("GENTICS_Table_Cell_active");this.hasFocus=true;this.selectAll(this.wrapper.get(0));GENTICS.Aloha.TableHelper.selectionType="cell"}};GENTICS.Aloha.Table.Cell.prototype.editableBlur=function(jqEvent){GENTICS.Aloha.Table.Cell.activeCell=undefined;this.hasFocus=false;this.obj.removeClass("GENTICS_Table_Cell_active")};GENTICS.Aloha.Table.Cell.prototype.activate=function(){this.obj.wrapInner("<div/>");var wrapper=this.obj.children("div").eq(0);wrapper.contentEditable(true);wrapper.addClass("GENTICS_Table_Cell_editable");var that=this;wrapper.bind("focus",function(jqEvent){if(jqEvent.currentTarget){jqEvent.currentTarget.indexOf=function(){return -1}}that.editableFocus(jqEvent)});wrapper.bind("mousedown",function(jqEvent){if(jqEvent.currentTarget){jqEvent.currentTarget.indexOf=function(){return -1}}that.editableMouseDown(jqEvent)});wrapper.bind("blur",function(jqEvent){that.editableBlur(jqEvent)});wrapper.bind("keyup",function(jqEvent){that.editableKeyUp(jqEvent)});wrapper.bind("keydown",function(jqEvent){that.editableKeyDown(jqEvent)});wrapper.GENTICS_contentEditableSelectionChange(function(event){GENTICS.Aloha.Selection.onChange(wrapper,event);return wrapper});this.obj.bind("mousedown",function(jqEvent){setTimeout(function(){that.wrapper.trigger("focus")},1);GENTICS.Aloha.TableHelper.unselectCells();jqEvent.stopPropagation()});this.obj.get(0).onselectstart=function(jqEvent){return false};this.wrapper=this.obj.children();this.wrapper.get(0).onselectstart=function(){window.event.cancelBubble=true};return this};GENTICS.Aloha.Table.Cell.prototype.deactivate=function(){var wrapper=this.obj.children(".GENTICS_Table_Cell_editable");if(wrapper.length){var innerHtml=wrapper.html();wrapper.unbind();wrapper.remove();this.obj.unbind("click");if(GENTICS.Aloha.trim(this.obj.attr("class"))==""){this.obj.removeAttr("class")}this.obj.html(innerHtml)}};GENTICS.Aloha.Table.Cell.prototype.toString=function(){return"GENTICS.Aloha.Table.Cell"};GENTICS.Aloha.Table.Cell.prototype.selectAll=function(editableNode){var e=(editableNode.jquery)?editableNode.get(0):editableNode;if(!jQuery.browser.msie){var s=window.getSelection();if(s.setBaseAndExtent){s.setBaseAndExtent(e,0,e,e.innerText.length-1)}else{if(window.opera&&e.innerHTML.substring(e.innerHTML.length-4)=="<BR>"){e.innerHTML=e.innerHTML+" "}var r=document.createRange();r.selectNodeContents(e);s.removeAllRanges();s.addRange(r)}}else{if(document.getSelection){var s=document.getSelection();var r=document.createRange();r.selectNodeContents(e);s.removeAllRanges();s.addRange(r)}else{if(document.selection){var r=document.body.createTextRange();r.moveToElementText(e);r.select()}}}GENTICS.Aloha.Selection.updateSelection(editableNode)};GENTICS.Aloha.Table.Cell.prototype.editableMouseDown=function(jqEvent){GENTICS.Aloha.TableHelper.unselectCells();if(this.tableObj.hasFocus){jqEvent.stopPropagation()}};GENTICS.Aloha.Table.Cell.prototype.editableKeyUp=function(jqEvent){this.checkForEmptyEvent(jqEvent)};GENTICS.Aloha.Table.Cell.prototype.editableKeyDown=function(jqEvent){this.checkForEmptyEvent(jqEvent);if(!jqEvent.ctrlKey&&!jqEvent.shiftKey){if(GENTICS.Aloha.TableHelper.selectedCells.length>0&&GENTICS.Aloha.TableHelper.selectedCells[0].length>0){GENTICS.Aloha.TableHelper.selectedCells[0][0].firstChild.focus();GENTICS.Aloha.TableHelper.unselectCells();jqEvent.stopPropagation()}}else{if(jqEvent.shiftKey&&GENTICS.Aloha.TableHelper.selectedCells.length>0){var KEYCODE_ARROWLEFT=37;var KEYCODE_ARROWUP=38;var KEYCODE_ARROWRIGHT=39;var KEYCODE_ARROWDOWN=40;switch(GENTICS.Aloha.TableHelper.selectionType){case"row":switch(jqEvent.keyCode){case KEYCODE_ARROWUP:var firstSelectedRow=GENTICS.Aloha.TableHelper.selectedCells[0][0].parentNode.rowIndex;if(firstSelectedRow>1){this.tableObj.rowsToSelect.push(firstSelectedRow-1)}break;case KEYCODE_ARROWDOWN:var lastRowIndex=GENTICS.Aloha.TableHelper.selectedCells.length-1;var lastSelectedRow=GENTICS.Aloha.TableHelper.selectedCells[lastRowIndex][0].parentNode.rowIndex;if(lastSelectedRow<this.tableObj.numRows){this.tableObj.rowsToSelect.push(lastSelectedRow+1)}break}this.tableObj.selectRows();break;case"column":switch(jqEvent.keyCode){case KEYCODE_ARROWLEFT:var firstColSelected=GENTICS.Aloha.TableHelper.selectedCells[0][0].cellIndex;if(firstColSelected>1){this.tableObj.columnsToSelect.push(firstColSelected-1)}break;case KEYCODE_ARROWRIGHT:var lastColIndex=GENTICS.Aloha.TableHelper.selectedCells[0].length-1;var lastColSelected=GENTICS.Aloha.TableHelper.selectedCells[0][lastColIndex].cellIndex;if(lastColSelected<this.tableObj.numCols){this.tableObj.columnsToSelect.push(lastColSelected+1)}break}this.tableObj.selectColumns();break}jqEvent.stopPropagation();jqEvent.preventDefault();return false}}};GENTICS.Aloha.Table.Cell.prototype.checkForEmptyEvent=function(jqEvent){if(jQuery(this.wrapper).children().length>0){return}var text=this.wrapper.text();if(text==""){this.wrapper.text("\u00a0");this.wrapper.get(0).blur();this.wrapper.get(0).focus()}};GENTICS.Aloha.Table.CreateLayer=function(){};GENTICS.Aloha.Table.CreateLayer.prototype.parameters={elemId:"GENTICS_Aloha_Table_createLayer",className:"GENTICS_Table_Createdialog",numX:10,numY:10,layer:undefined,target:undefined};GENTICS.Aloha.Table.CreateLayer.prototype.config=new Object();GENTICS.Aloha.Table.CreateLayer.prototype.visible=false;GENTICS.Aloha.Table.CreateLayer.prototype.show=function(){var layer=this.get("layer");if(layer==null){this.create()}else{this.setPosition(layer);layer.find("td").removeClass("hover");layer.show()}this.visible=true};GENTICS.Aloha.Table.CreateLayer.prototype.create=function(){var that=this;var layer=jQuery("<div></div>");layer.id=this.get("elemId");layer.addClass(this.get("className"));var table=jQuery("<table></table>");table.css("width",(this.get("numX")+6)*15);var tr;var td;for(var i=0;i<this.get("numY");i++){tr=jQuery("<tr></tr>");for(var j=0;j<this.get("numX");j++){td=jQuery("<td>\u00a0</td>");if(i==0&&j==0){td.addClass("hover")}td.bind("mouseover",{rowId:i,colId:j},function(e){that.handleMouseOver(e,table)});td.bind("click",{rowId:i,colId:j},function(e){var rows=e.data.rowId+1;var cols=e.data.colId+1;GENTICS.Aloha.TablePlugin.createTable(cols,rows);that.hide()});tr.append(td)}table.append(tr)}layer.append(table);this.set("layer",layer);this.setPosition();layer.bind("click",function(e){e.stopPropagation()}).mousedown(function(e){e.stopPropagation()});jQuery("body").append(layer).bind("click",function(e){if(e.target!=that.get("target")&&that.visible){that.hide()}})};GENTICS.Aloha.Table.CreateLayer.prototype.handleMouseOver=function(e,table){var rowId=e.data.rowId;var colId=e.data.colId;var innerRows=table.find("tr");for(var n=0;n<=innerRows.length;n++){var innerCells=jQuery(innerRows[n]).find("td");for(var k=0;k<=innerCells.length;k++){if(n<=rowId&&k<=colId){jQuery(innerCells[k]).addClass("hover")}else{jQuery(innerCells[k]).removeClass("hover")}}}};GENTICS.Aloha.Table.CreateLayer.prototype.setPosition=function(){var targetObj=jQuery(this.get("target"));var pos=targetObj.offset();this.get("layer").css("left",pos.left+"px");this.get("layer").css("top",(pos.top+targetObj.height())+"px")};GENTICS.Aloha.Table.CreateLayer.prototype.hide=function(){this.get("layer").hide();this.visible=false};GENTICS.Aloha.Table.CreateLayer.prototype.get=function(property){if(this.config[property]){return this.config[property]}if(this.parameters[property]){return this.parameters[property]}return undefined};GENTICS.Aloha.Table.CreateLayer.prototype.set=function(key,value){if(this.config[key]){this.config[key]=value}else{this.parameters[key]=value}};GENTICS.Aloha.TableHelper=function(){};GENTICS.Aloha.TableHelper.prototype.selectionType=undefined;GENTICS.Aloha.TableHelper.prototype.selectedCells=new Array();GENTICS.Aloha.TableHelper.prototype.unselectCells=function(){if(this.selectedCells.length>0){for(var i=0;i<this.selectedCells.length;i++){jQuery(this.selectedCells[i]).removeClass(GENTICS.Aloha.TablePlugin.get("classCellSelected"))}this.selectedCells=new Array();this.selectionType=undefined}};GENTICS.Aloha.TableHelper.prototype.getNewTableID=function(){var idPrefix="GENTICS_Table_";var factor=1000000;for(this.tableCounter;true;this.tableCounter++){var id=idPrefix+(Math.ceil(Math.random()*factor));for(var j=id.length;j<idPrefix.length+factor.toString().length;j++){id+="0"}if(!jQuery("#"+id).length){return id}}};GENTICS.Aloha.TableHelper=new GENTICS.Aloha.TableHelper();
|
data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/table.css
CHANGED
@@ -1,23 +1,6 @@
|
|
1
|
-
.GENTICS_Aloha_Table {
|
2
|
-
border: 0px solid #AFAFAF;
|
3
|
-
width: 100%;
|
4
|
-
box-sizing : none !important;
|
5
|
-
cursor: default;
|
6
|
-
}
|
7
|
-
.GENTICS_Aloha_Table td {
|
8
|
-
border: 1px solid #AFAFAF;
|
9
|
-
padding: 1px;
|
10
|
-
margin: 0;
|
11
|
-
vertical-align: top;
|
12
|
-
cursor: text;
|
13
|
-
}
|
14
|
-
.GENTICS_Aloha_Table td .GENTICS_Table_Cell_editable {
|
15
|
-
cursor: text !important;
|
16
|
-
}
|
17
|
-
|
18
1
|
/**
|
19
2
|
* Hide the border for contenteditables
|
20
|
-
*/
|
3
|
+
*/
|
21
4
|
.GENTICS_Table_Cell_editable,
|
22
5
|
.GENTICS_Aloha_Table_wrapper {
|
23
6
|
outline: 0px solid transparent;
|
@@ -44,18 +27,36 @@ td.GENTICS_Aloha_Table_selectRow {
|
|
44
27
|
height: 10px;
|
45
28
|
}
|
46
29
|
|
30
|
+
.GENTICS_Aloha_Table td .GENTICS_Table_Cell_editable {
|
31
|
+
cursor: text !important;
|
32
|
+
}
|
33
|
+
|
47
34
|
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn td {
|
48
|
-
cursor: url(down.cur),
|
35
|
+
cursor: url(down.cur),default;
|
49
36
|
}
|
50
37
|
|
51
38
|
/* :TODO: make custom cursors visible in IE */
|
52
39
|
.GENTICS_Aloha_Table td.GENTICS_Aloha_Table_selectRow {
|
53
|
-
cursor: url(left.cur),
|
40
|
+
cursor: url(left.cur),default;
|
41
|
+
}
|
42
|
+
|
43
|
+
.GENTICS_WAI_RED {
|
44
|
+
background-image: url(wai_red.png);
|
45
|
+
}
|
46
|
+
|
47
|
+
.GENTICS_WAI_GREEN {
|
48
|
+
background-image: url(wai_green.png);
|
49
|
+
}
|
50
|
+
|
51
|
+
.GENTICS_Aloha_Table td.GENTICS_Aloha_Table_leftUpperCorner div {
|
52
|
+
cursor: pointer !important;
|
54
53
|
}
|
55
54
|
|
56
55
|
.GENTICS_Aloha_Table td.GENTICS_Aloha_Table_selectRow,
|
57
56
|
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn td {
|
58
57
|
border: 0;
|
58
|
+
margin:0;
|
59
|
+
padding:0;
|
59
60
|
background-color: #D0D0D0;
|
60
61
|
font-size: 0.01em;
|
61
62
|
}
|
@@ -73,9 +74,9 @@ td.GENTICS_Aloha_Table_selectRow {
|
|
73
74
|
position: absolute;
|
74
75
|
background-color: #F0F0F0;
|
75
76
|
border: 1px solid #cccccc;
|
76
|
-
-moz-border-radius:
|
77
|
-
-webkit-border-radius:
|
78
|
-
border-radius:
|
77
|
+
-moz-border-radius: 2px;
|
78
|
+
-webkit-border-radius: 2px;
|
79
|
+
border-radius: 2px;
|
79
80
|
}
|
80
81
|
.GENTICS_Table_Createdialog table {
|
81
82
|
padding: 0px;
|
@@ -84,111 +85,28 @@ td.GENTICS_Aloha_Table_selectRow {
|
|
84
85
|
.GENTICS_Table_Createdialog table td {
|
85
86
|
margin: 0px;
|
86
87
|
padding: 0px;
|
87
|
-
border:
|
88
|
+
border: 1px solid #AFAFAF;
|
88
89
|
font-size: 8px;
|
89
90
|
width: 15px;
|
90
91
|
height: 15px;
|
91
|
-
-moz-border-radius: 3px;
|
92
|
-
-webkit-border-radius: 3px;
|
93
|
-
border-radius: 3px;
|
94
92
|
}
|
95
93
|
.GENTICS_Table_Createdialog table td.hover {
|
96
|
-
|
94
|
+
background-color: #1c94c4;
|
97
95
|
}
|
98
96
|
.GENTICS_Table_Createdialog #table-size-info {
|
99
97
|
text-align: center;
|
100
98
|
font-size: 0.8em;
|
101
99
|
}
|
102
|
-
|
103
100
|
.GENTICS_Aloha_Cell_selected {
|
104
101
|
background-color: #3399FF !important;
|
105
102
|
color: #FFF;
|
106
103
|
}
|
107
|
-
|
108
|
-
table td {
|
109
|
-
height: 100%;
|
110
|
-
min-height: 100%;
|
111
|
-
}
|
112
104
|
div.GENTICS_Table_Cell_editable {
|
113
105
|
height: 100%;
|
114
106
|
min-height: 100%;
|
115
107
|
width: 100%;
|
116
108
|
z-index: 99999;
|
117
109
|
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
floating menu buttons
|
122
|
-
|
123
|
-
*/
|
124
|
-
.GENTICS_floatingmenu a.GENTICS_Aloha_addColumnLeft {
|
125
|
-
background-position: -540px 0;
|
126
|
-
}
|
127
|
-
|
128
|
-
.GENTICS_floatingmenu a:hover.GENTICS_Aloha_addColumnLeft {
|
129
|
-
background-position: -540px -20px;
|
130
|
-
}
|
131
|
-
|
132
|
-
.GENTICS_floatingmenu .pressed a.GENTICS_Aloha_addColumnLeft {
|
133
|
-
background-position: -540px -40px;
|
134
|
-
}
|
135
|
-
|
136
|
-
.GENTICS_floatingmenu a.GENTICS_Aloha_addColumnRight {
|
137
|
-
background-position: -560px 0;
|
138
|
-
}
|
139
|
-
|
140
|
-
.GENTICS_floatingmenu a:hover.GENTICS_Aloha_addColumnRight {
|
141
|
-
background-position: -560px -20px;
|
142
|
-
}
|
143
|
-
|
144
|
-
.GENTICS_floatingmenu .pressed a.GENTICS_Aloha_addColumnRight {
|
145
|
-
background-position: -560px -40px;
|
146
|
-
}
|
147
|
-
|
148
|
-
.GENTICS_floatingmenu a.GENTICS_Aloha_addRowBefore {
|
149
|
-
background-position: -580px 0;
|
150
|
-
}
|
151
|
-
|
152
|
-
.GENTICS_floatingmenu a:hover.GENTICS_Aloha_addRowBefore {
|
153
|
-
background-position: -580px -20px;
|
154
|
-
}
|
155
|
-
|
156
|
-
.GENTICS_floatingmenu .pressed a.GENTICS_Aloha_addRowBefore {
|
157
|
-
background-position: -580px -40px;
|
158
|
-
}
|
159
|
-
|
160
|
-
.GENTICS_floatingmenu a.GENTICS_Aloha_addRowAfter {
|
161
|
-
background-position: -600px 0;
|
162
|
-
}
|
163
|
-
|
164
|
-
.GENTICS_floatingmenu a:hover.GENTICS_Aloha_addRowAfter {
|
165
|
-
background-position: -600px -20px;
|
166
|
-
}
|
167
|
-
|
168
|
-
.GENTICS_floatingmenu .pressed a.GENTICS_Aloha_addRowAfter {
|
169
|
-
background-position: -600px -40px;
|
170
|
-
}
|
171
|
-
|
172
|
-
.GENTICS_floatingmenu a.GENTICS_Aloha_deleteRows {
|
173
|
-
background-position: -620px 0;
|
174
|
-
}
|
175
|
-
|
176
|
-
.GENTICS_floatingmenu a:hover.GENTICS_Aloha_deleteRows {
|
177
|
-
background-position: -620px -20px;
|
178
|
-
}
|
179
|
-
|
180
|
-
.GENTICS_floatingmenu .pressed a.GENTICS_Aloha_deleteRows {
|
181
|
-
background-position: -620px -40px;
|
182
|
-
}
|
183
|
-
|
184
|
-
.GENTICS_floatingmenu a.GENTICS_Aloha_deleteColumns {
|
185
|
-
background-position: -640px 0;
|
186
|
-
}
|
187
|
-
|
188
|
-
.GENTICS_floatingmenu a:hover.GENTICS_Aloha_deleteColumns {
|
189
|
-
background-position: -640px -20px;
|
190
|
-
}
|
191
|
-
|
192
|
-
.GENTICS_floatingmenu .pressed a.GENTICS_Aloha_deleteColumns {
|
193
|
-
background-position: -640px -40px;
|
110
|
+
button.GENTICS_button_table_caption {
|
111
|
+
background-position: -320px 0px !important;
|
194
112
|
}
|
data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_green.png
ADDED
Binary file
|
data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_red.png
ADDED
Binary file
|
@@ -24,9 +24,18 @@ $(document).ready(function() {
|
|
24
24
|
$('#asset_collection_assets_order').val(ids || '');
|
25
25
|
}
|
26
26
|
|
27
|
+
var setLastClassForAssets = function() {
|
28
|
+
$('ul.assets li.last').removeClass('last');
|
29
|
+
var i = parseInt($('ul.assets li.asset').size() / 6);
|
30
|
+
while (i > 0) {
|
31
|
+
$('ul.assets li.asset:eq(' + (i * 6 - 1) + ')').addClass('last');
|
32
|
+
i--;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
27
36
|
$('ul.assets.sortable').sortable({
|
28
37
|
items: 'li.asset',
|
29
|
-
stop: function(event, ui) { updateAssetsOrder(); }
|
38
|
+
stop: function(event, ui) { updateAssetsOrder(); setLastClassForAssets(); }
|
30
39
|
});
|
31
40
|
|
32
41
|
$('ul.assets.sortable li div.actions a.remove').click(function(e) {
|
@@ -37,12 +46,7 @@ $(document).ready(function() {
|
|
37
46
|
|
38
47
|
if ($('ul.assets li.asset').size() == 0) $('p.no-items').show();
|
39
48
|
|
40
|
-
|
41
|
-
var i = parseInt($('ul.assets li.asset').size() / 6);
|
42
|
-
while (i > 0) {
|
43
|
-
$('ul.assets li.asset:eq(' + (i * 6 - 1) + ')').addClass('last');
|
44
|
-
i--;
|
45
|
-
}
|
49
|
+
setLastClassForAssets();
|
46
50
|
}
|
47
51
|
e.preventDefault();
|
48
52
|
e.stopPropagation();
|
@@ -15,7 +15,9 @@ $(document).ready(function() {
|
|
15
15
|
stop: function(event, ui) { updateContentsOrder(); }
|
16
16
|
});
|
17
17
|
|
18
|
-
|
18
|
+
try {
|
19
|
+
$('textarea.html').tinymce(TinyMceDefaultSettings);
|
20
|
+
} catch (e) { /* tinymce not loaded */ }
|
19
21
|
|
20
22
|
$.datepicker.setDefaults($.datepicker.regional[I18nLocale]);
|
21
23
|
$('input[type=text].date').datepicker($.datepicker.regional[I18nLocale]);
|
@@ -17,12 +17,14 @@ $(document).ready(function() {
|
|
17
17
|
var newRow = lastRow.clone(true).removeClass('template').addClass('added').insertBefore(lastRow);
|
18
18
|
|
19
19
|
// should copy the value of the select box
|
20
|
-
var input_name = $('input#
|
20
|
+
var input_name = $('input#site_subdomain').attr('name').split('[')[0];
|
21
21
|
var input = newRow.find('input.label')
|
22
22
|
.attr('name', input_name + '[domains][]');
|
23
23
|
if (lastRow.find('input.label').val() == '') input.val("undefined");
|
24
24
|
|
25
|
-
// then reset the form
|
25
|
+
// then reset and clean the form
|
26
|
+
$('fieldset.editable-list input.empty-domains').remove();
|
27
|
+
|
26
28
|
lastRow.find('input').val(defaultValue).addClass('void');
|
27
29
|
lastRow.find('select').val('input');
|
28
30
|
});
|
@@ -30,12 +32,16 @@ $(document).ready(function() {
|
|
30
32
|
$('fieldset.editable-list li a.remove').click(function(e) {
|
31
33
|
if (confirm($(this).attr('data-confirm')))
|
32
34
|
$(this).parents('li').remove();
|
35
|
+
|
36
|
+
if ($('fieldset.editable-list .item.added').size() == 0)
|
37
|
+
$('fieldset.editable-list').append('<input name="site[domains]" type="hidden" value="" class="empty-domains" />');
|
38
|
+
|
33
39
|
e.preventDefault();
|
34
40
|
e.stopPropagation();
|
35
41
|
});
|
36
42
|
|
37
43
|
$.subscribe('form.saved.success', function(event, data) {
|
38
|
-
var value = $('#
|
44
|
+
var value = $('#site_name').val();
|
39
45
|
$('#header h1 a.single').html(value);
|
40
46
|
$('#header h1 a span.ui-selectmenu-status').html(value);
|
41
47
|
$('#site-selector-menu li.ui-selectmenu-item-selected a').html(value);
|
@@ -16,7 +16,7 @@ $(document).ready(function() {
|
|
16
16
|
|
17
17
|
$('a#image-picker-link').imagepicker({
|
18
18
|
insertFn: function(link) {
|
19
|
-
return "{{
|
19
|
+
return "{{ '" + link.attr('data-local-path') + "' | theme_image_url }}";
|
20
20
|
}
|
21
21
|
});
|
22
22
|
});
|
@@ -9,6 +9,8 @@ function makeSlug(val, sep) { // code largely inspired by http://www.thewebsitet
|
|
9
9
|
return val.toLowerCase();
|
10
10
|
}
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
(function() {
|
13
|
+
String.prototype.trim = function() {
|
14
|
+
return this.replace(/^\s+/g, '').replace(/\s+$/g, '');
|
15
|
+
}
|
16
|
+
})();
|
@@ -27,7 +27,7 @@ div.notice p {
|
|
27
27
|
|
28
28
|
p.no-items {
|
29
29
|
padding: 15px 0px;
|
30
|
-
background: transparent url(/images/admin/list/none.png) no-repeat
|
30
|
+
background: transparent url(/images/admin/list/none.png) no-repeat center 0;
|
31
31
|
text-align: center;
|
32
32
|
color: #9d8963 !important;
|
33
33
|
font-size: 1.1em !important;
|
@@ -65,6 +65,11 @@ body { background: #000 url(/images/admin/background/body.png) repeat 0 0; }
|
|
65
65
|
color: #222;
|
66
66
|
}
|
67
67
|
|
68
|
+
#panel fieldset ol li input[type=file] {
|
69
|
+
background: none;
|
70
|
+
padding: 0px;
|
71
|
+
}
|
72
|
+
|
68
73
|
#panel fieldset ol li p.inline-errors {
|
69
74
|
padding: 3px 5px;
|
70
75
|
margin: 5px 0px;
|
@@ -125,11 +130,6 @@ body { background: #000 url(/images/admin/background/body.png) repeat 0 0; }
|
|
125
130
|
line-height: 21px;
|
126
131
|
}
|
127
132
|
|
128
|
-
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
129
|
-
#panel div.footer .button { padding-left: 5px; }
|
130
|
-
#panel div.footer .button span { top: 0px; padding-right: 10px; }
|
131
|
-
}
|
132
|
-
|
133
133
|
/* ___ Messages ___ */
|
134
134
|
|
135
135
|
div.application-message {
|
@@ -21,11 +21,6 @@
|
|
21
21
|
outline: none;
|
22
22
|
}
|
23
23
|
|
24
|
-
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
25
|
-
.button { padding-left: 5px; }
|
26
|
-
.button span { top: 0px; }
|
27
|
-
}
|
28
|
-
|
29
24
|
.button.light {
|
30
25
|
background-image: url(/images/admin/buttons/light-gray-left.png);
|
31
26
|
color: #787a89;
|
@@ -65,11 +65,6 @@ form.formtastic fieldset.foldable ol {
|
|
65
65
|
|
66
66
|
form.formtastic fieldset.foldable.folded ol { display: none; }
|
67
67
|
|
68
|
-
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
69
|
-
form.formtastic fieldset.foldable legend span em { top: 0px; }
|
70
|
-
form.formtastic fieldset.foldable.folded legend span em { top: 0px; }
|
71
|
-
}
|
72
|
-
|
73
68
|
/* ___ inputs ___ */
|
74
69
|
|
75
70
|
form.formtastic fieldset.inputs { min-height: 30px; width: 100%; margin-bottom: 20px; }
|
@@ -83,12 +78,6 @@ form.formtastic fieldset.inputs ol {
|
|
83
78
|
border-top: 1px solid #ccced7;
|
84
79
|
}
|
85
80
|
|
86
|
-
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
87
|
-
form.formtastic fieldset.inputs ol {
|
88
|
-
margin-top: 30px;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
81
|
form.formtastic fieldset ol li { width: 100%; position: relative; margin-bottom: 1.3em; }
|
93
82
|
|
94
83
|
form.formtastic fieldset ol li label { text-align: left; padding: 0.3em 2em 0 20px; font-size: 0.8em; color: #17171b; width: 15%; }
|
@@ -175,7 +164,7 @@ form.formtastic div.actions p {
|
|
175
164
|
}
|
176
165
|
|
177
166
|
form.formtastic div.actions a {
|
178
|
-
color: #fff;
|
167
|
+
color: #fff !important;
|
179
168
|
text-decoration: none;
|
180
169
|
font-size: 0.8em;
|
181
170
|
position: relative;
|
@@ -299,6 +288,10 @@ form.formtastic fieldset.editable-list ol li.added input {
|
|
299
288
|
cursor: pointer;
|
300
289
|
}
|
301
290
|
|
291
|
+
form.formtastic fieldset.editable-list ol li.added input.domain {
|
292
|
+
width: 250px;
|
293
|
+
}
|
294
|
+
|
302
295
|
form.formtastic fieldset.editable-list ol li.added input:hover {
|
303
296
|
background: #fffbe5;
|
304
297
|
border: 1px dotted #efe4a5;
|