From e23418b733e284b5018c639ad088f58162730e78 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Fri, 27 Jan 2012 14:44:28 +0100 Subject: [PATCH] fonction tableau de garde --- Gemfile | 2 +- Gemfile.lock | 161 + app/assets/javascripts/admin/admin.js | 46 +- .../stylesheets/admin/portlets.css.scss | 12 +- app/assets/stylesheets/public/public.css.scss | 14 + .../portlet/garde_contents_controller.rb | 111 + app/helpers/admin/garde_line_helper.rb | 17 + app/models/portlets/garde_content.rb | 7 + app/models/portlets/garde_line.rb | 3 + .../portlet/garde_contents/_form.html.haml | 58 + .../garde_contents/_garde_content.html.haml | 16 + .../_garde_line_fields.html.haml | 6 + .../_table_content_edit_pane.html.haml | 33 + .../portlet/garde_contents/destroy_row.js.erb | 6 + app/views/portlet/shared/edit.html.haml | 7 - .../render_public/_gardecontent.html.haml | 16 + config/routes.rb | 6 + .../20111218163636_create_garde_contents.rb | 17 + .../20111218164254_create_garde_lines.rb | 16 + test/fixtures/garde_contents.yml | 13 + test/fixtures/garde_lines.yml | 9 + test/unit/garde_content_test.rb | 7 + test/unit/garde_line_test.rb | 7 + .../images/content_type/type_GardeContent.png | Bin 0 -> 3655 bytes .../assets/javascripts/tiny_mce/langs/en.js | 223 +- .../tiny_mce/plugins/advhr/langs/en_dlg.js | 8 +- .../plugins/advimage/editor_plugin.js | 2 +- .../plugins/advimage/editor_plugin_src.js | 2 +- .../tiny_mce/plugins/advimage/js/image.js | 41 +- .../tiny_mce/plugins/advimage/langs/en_dlg.js | 46 +- .../tiny_mce/plugins/advlink/js/advlink.js | 23 +- .../tiny_mce/plugins/advlink/langs/en_dlg.js | 55 +- .../tiny_mce/plugins/advlink/link.htm | 2 +- .../tiny_mce/plugins/advlist/editor_plugin.js | 2 +- .../plugins/advlist/editor_plugin_src.js | 38 +- .../plugins/autolink/editor_plugin.js | 2 +- .../plugins/autolink/editor_plugin_src.js | 9 +- .../plugins/autoresize/editor_plugin.js | 2 +- .../plugins/autoresize/editor_plugin_src.js | 28 +- .../plugins/autosave/editor_plugin.js | 2 +- .../plugins/autosave/editor_plugin_src.js | 2 +- .../plugins/contextmenu/editor_plugin.js | 2 +- .../plugins/contextmenu/editor_plugin_src.js | 32 +- .../tiny_mce/plugins/emotions/emotions.htm | 35 +- .../emotions/img/smiley-foot-in-mouth.gif | Bin 344 -> 342 bytes .../plugins/emotions/img/smiley-laughing.gif | Bin 344 -> 343 bytes .../plugins/emotions/img/smiley-sealed.gif | Bin 325 -> 323 bytes .../plugins/emotions/img/smiley-smile.gif | Bin 345 -> 344 bytes .../plugins/emotions/img/smiley-surprised.gif | Bin 342 -> 338 bytes .../plugins/emotions/img/smiley-wink.gif | Bin 351 -> 350 bytes .../tiny_mce/plugins/emotions/js/emotions.js | 21 + .../tiny_mce/plugins/emotions/langs/en_dlg.js | 21 +- .../example_dependency/editor_plugin.js | 1 + .../example_dependency/editor_plugin_src.js | 50 + .../plugins/fullpage/css/fullpage.css | 41 - .../plugins/fullpage/editor_plugin.js | 2 +- .../plugins/fullpage/editor_plugin_src.js | 437 ++- .../tiny_mce/plugins/fullpage/fullpage.htm | 346 +- .../tiny_mce/plugins/fullpage/js/fullpage.js | 627 +--- .../tiny_mce/plugins/fullpage/langs/en_dlg.js | 86 +- .../plugins/fullscreen/editor_plugin.js | 2 +- .../plugins/fullscreen/editor_plugin_src.js | 4 +- .../plugins/fullscreen/fullscreen.htm | 3 +- .../plugins/inlinepopups/editor_plugin.js | 2 +- .../plugins/inlinepopups/editor_plugin_src.js | 5 +- .../skins/clearlooks2/img/alert.gif | Bin 818 -> 810 bytes .../skins/clearlooks2/img/button.gif | Bin 280 -> 272 bytes .../skins/clearlooks2/img/confirm.gif | Bin 915 -> 907 bytes .../skins/clearlooks2/img/corners.gif | Bin 911 -> 909 bytes .../skins/clearlooks2/img/vertical.gif | Bin 92 -> 84 bytes .../tiny_mce/plugins/layer/editor_plugin.js | 2 +- .../plugins/layer/editor_plugin_src.js | 58 +- .../plugins/legacyoutput/editor_plugin.js | 2 +- .../plugins/legacyoutput/editor_plugin_src.js | 2 +- .../tiny_mce/plugins/lists/editor_plugin.js | 2 +- .../plugins/lists/editor_plugin_src.js | 536 ++- .../tiny_mce/plugins/media/editor_plugin.js | 2 +- .../plugins/media/editor_plugin_src.js | 182 +- .../tiny_mce/plugins/media/js/media.js | 172 +- .../tiny_mce/plugins/media/langs/en_dlg.js | 110 +- .../tiny_mce/plugins/media/media.htm | 146 +- .../tiny_mce/plugins/media/moxieplayer.swf | Bin 33931 -> 19980 bytes .../plugins/nonbreaking/editor_plugin.js | 2 +- .../plugins/nonbreaking/editor_plugin_src.js | 5 +- .../plugins/noneditable/editor_plugin.js | 2 +- .../plugins/noneditable/editor_plugin_src.js | 9 +- .../tiny_mce/plugins/paste/editor_plugin.js | 2 +- .../plugins/paste/editor_plugin_src.js | 189 +- .../tiny_mce/plugins/paste/langs/en_dlg.js | 6 +- .../plugins/searchreplace/langs/en_dlg.js | 17 +- .../plugins/spellchecker/editor_plugin.js | 2 +- .../plugins/spellchecker/editor_plugin_src.js | 69 +- .../tiny_mce/plugins/style/js/props.js | 2 +- .../tiny_mce/plugins/style/langs/en_dlg.js | 71 +- .../tiny_mce/plugins/style/props.htm | 4 +- .../plugins/tabfocus/editor_plugin.js | 2 +- .../plugins/tabfocus/editor_plugin_src.js | 236 +- .../tiny_mce/plugins/table/cell.htm | 6 +- .../tiny_mce/plugins/table/editor_plugin.js | 2 +- .../plugins/table/editor_plugin_src.js | 2606 +++++++------- .../tiny_mce/plugins/table/js/cell.js | 35 + .../tiny_mce/plugins/table/js/row.js | 5 + .../tiny_mce/plugins/table/js/table.js | 54 +- .../tiny_mce/plugins/table/langs/en_dlg.js | 75 +- .../tiny_mce/plugins/table/row.htm | 3 +- .../tiny_mce/plugins/table/table.htm | 6 +- .../tiny_mce/plugins/template/langs/en_dlg.js | 16 +- .../plugins/wordcount/editor_plugin.js | 2 +- .../plugins/wordcount/editor_plugin_src.js | 4 +- .../plugins/xhtmlxtras/editor_plugin.js | 2 +- .../plugins/xhtmlxtras/editor_plugin_src.js | 12 +- .../plugins/xhtmlxtras/js/attributes.js | 16 +- .../plugins/xhtmlxtras/langs/en_dlg.js | 33 +- .../tiny_mce/themes/advanced/charmap.htm | 6 +- .../themes/advanced/editor_template.js | 2 +- .../themes/advanced/editor_template_src.js | 24 +- .../themes/advanced/img/colorpicker.jpg | Bin 3189 -> 2584 bytes .../tiny_mce/themes/advanced/img/flash.gif | Bin 241 -> 239 bytes .../tiny_mce/themes/advanced/img/icons.gif | Bin 11794 -> 11790 bytes .../themes/advanced/img/quicktime.gif | Bin 303 -> 301 bytes .../themes/advanced/img/shockwave.gif | Bin 387 -> 384 bytes .../tiny_mce/themes/advanced/js/anchor.js | 5 +- .../tiny_mce/themes/advanced/js/charmap.js | 14 +- .../themes/advanced/js/color_picker.js | 8 +- .../tiny_mce/themes/advanced/js/image.js | 14 +- .../tiny_mce/themes/advanced/langs/en.js | 69 +- .../tiny_mce/themes/advanced/langs/en_dlg.js | 55 +- .../themes/advanced/skins/cirkuit/ui.css | 24 +- .../themes/advanced/skins/default/content.css | 7 +- .../advanced/skins/default/img/buttons.png | Bin 3274 -> 3133 bytes .../advanced/skins/default/img/items.gif | Bin 70 -> 64 bytes .../advanced/skins/default/img/tabs.gif | Bin 1326 -> 1322 bytes .../themes/advanced/skins/default/ui.css | 1 + .../advanced/skins/highcontrast/content.css | 3 +- .../themes/advanced/skins/highcontrast/ui.css | 1 + .../themes/advanced/skins/o2k7/content.css | 4 +- .../advanced/skins/o2k7/img/button_bg.png | Bin 5859 -> 2766 bytes .../skins/o2k7/img/button_bg_black.png | Bin 3736 -> 651 bytes .../skins/o2k7/img/button_bg_silver.png | Bin 5358 -> 2084 bytes .../themes/advanced/skins/o2k7/ui.css | 5 +- .../tiny_mce/themes/simple/img/icons.gif | Bin 1440 -> 806 bytes .../tiny_mce/themes/simple/langs/en.js | 12 +- .../assets/javascripts/tiny_mce/tiny_mce.js | 2 +- .../javascripts/tiny_mce/tiny_mce_src.js | 3147 +++++++++++------ .../tiny_mce/utils/editable_selects.js | 2 +- .../javascripts/tiny_mce/utils/validate.js | 2 +- 146 files changed, 6141 insertions(+), 4769 deletions(-) create mode 100644 Gemfile.lock create mode 100644 app/controllers/portlet/garde_contents_controller.rb create mode 100644 app/helpers/admin/garde_line_helper.rb create mode 100644 app/models/portlets/garde_content.rb create mode 100644 app/models/portlets/garde_line.rb create mode 100644 app/views/portlet/garde_contents/_form.html.haml create mode 100644 app/views/portlet/garde_contents/_garde_content.html.haml create mode 100644 app/views/portlet/garde_contents/_garde_line_fields.html.haml create mode 100644 app/views/portlet/garde_contents/_table_content_edit_pane.html.haml create mode 100644 app/views/portlet/garde_contents/destroy_row.js.erb create mode 100644 app/views/portlets/render_public/_gardecontent.html.haml create mode 100644 db/migrate/20111218163636_create_garde_contents.rb create mode 100644 db/migrate/20111218164254_create_garde_lines.rb create mode 100644 test/fixtures/garde_contents.yml create mode 100644 test/fixtures/garde_lines.yml create mode 100644 test/unit/garde_content_test.rb create mode 100644 test/unit/garde_line_test.rb create mode 100644 vendor/assets/images/content_type/type_GardeContent.png create mode 100644 vendor/assets/javascripts/tiny_mce/plugins/example_dependency/editor_plugin.js create mode 100644 vendor/assets/javascripts/tiny_mce/plugins/example_dependency/editor_plugin_src.js diff --git a/Gemfile b/Gemfile index 4c59247..f878194 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'http://rubygems.org' gem 'rails', '3.1.0' -gem "rake", "0.8.7" +#gem "rake", "0.8.7" # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..47d5653 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,161 @@ +GEM + remote: http://rubygems.org/ + specs: + actionmailer (3.1.0) + actionpack (= 3.1.0) + mail (~> 2.3.0) + actionpack (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + builder (~> 3.0.0) + erubis (~> 2.7.0) + i18n (~> 0.6) + rack (~> 1.3.2) + rack-cache (~> 1.0.3) + rack-mount (~> 0.8.2) + rack-test (~> 0.6.1) + sprockets (~> 2.0.0) + activemodel (3.1.0) + activesupport (= 3.1.0) + bcrypt-ruby (~> 3.0.0) + builder (~> 3.0.0) + i18n (~> 0.6) + activerecord (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + arel (~> 2.2.1) + tzinfo (~> 0.3.29) + activeresource (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + activesupport (3.1.0) + multi_json (~> 1.0) + acts_as_list (0.1.4) + acts_as_tree (0.1.1) + ansi (1.4.1) + arel (2.2.1) + bcrypt-ruby (3.0.1) + builder (3.0.0) + cancan (1.6.7) + carrierwave (0.5.8) + activesupport (~> 3.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.1.3) + devise (1.5.2) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.0.3) + warden (~> 1.1) + erubis (2.7.0) + execjs (1.2.12) + multi_json (~> 1.0) + formtastic (2.0.2) + rails (~> 3.0) + haml (3.1.4) + hike (1.2.1) + i18n (0.6.0) + jquery-rails (1.0.19) + railties (~> 3.0) + thor (~> 0.14) + json (1.6.3) + kaminari (0.12.4) + rails (>= 3.0.0) + libv8 (3.3.10.4) + mail (2.3.0) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + meta_search (1.1.1) + actionpack (~> 3.1.0) + activerecord (~> 3.1.0) + activesupport (~> 3.1.0) + polyamorous (~> 0.5.0) + mime-types (1.17.2) + mimetype-fu (0.1.2) + multi_json (1.0.4) + orm_adapter (0.0.5) + polyamorous (0.5.0) + activerecord (~> 3.0) + polyglot (0.3.3) + rack (1.3.5) + rack-cache (1.0.3) + rack (>= 0.4) + rack-mount (0.8.3) + rack (>= 1.0.0) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.1.0) + actionmailer (= 3.1.0) + actionpack (= 3.1.0) + activerecord (= 3.1.0) + activeresource (= 3.1.0) + activesupport (= 3.1.0) + bundler (~> 1.0) + railties (= 3.1.0) + railties (3.1.0) + actionpack (= 3.1.0) + activesupport (= 3.1.0) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2.2) + rdoc (3.12) + json (~> 1.4) + rmagick (2.13.1) + sass (3.1.12) + sass-rails (3.1.5) + actionpack (~> 3.1.0) + railties (~> 3.1.0) + sass (~> 3.1.10) + tilt (~> 1.3.2) + simple-navigation (3.6.0) + activesupport (>= 2.3.2) + sprockets (2.0.3) + hike (~> 1.2) + rack (~> 1.0) + tilt (!= 1.3.0, ~> 1.1) + sqlite3 (1.3.5) + therubyracer (0.9.9) + libv8 (~> 3.3.10) + thor (0.14.6) + tilt (1.3.3) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + turn (0.8.3) + ansi + tzinfo (0.3.31) + uglifier (1.2.0) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + warden (1.1.0) + rack (>= 1.0) + +PLATFORMS + ruby + +DEPENDENCIES + acts_as_list + acts_as_tree + cancan + carrierwave + coffee-script + devise + formtastic + haml (>= 3.0.0) + jquery-rails + kaminari + meta_search + mimetype-fu + rails (= 3.1.0) + rmagick + sass-rails (~> 3.1.0.rc) + simple-navigation + sqlite3 + therubyracer + turn + uglifier diff --git a/app/assets/javascripts/admin/admin.js b/app/assets/javascripts/admin/admin.js index 0ef437d..8d12b1e 100644 --- a/app/assets/javascripts/admin/admin.js +++ b/app/assets/javascripts/admin/admin.js @@ -15,6 +15,9 @@ + + + function auto_load_divs() { $('div[data-load]').live("resize",function () { @@ -145,7 +148,6 @@ function auto_tiny_mce(div) theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,forecolor,backcolor,sub,sup,|,charmap,|,removeformat", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", - theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : false, @@ -153,13 +155,53 @@ function auto_tiny_mce(div) theme_advanced_text_colors : "#D2232A,#40AF49,#00ADEF", theme_advanced_background_colors : "#D2232A,#40AF49,#00ADEF", - //theme_advanced_toolbar_location : "external", +// theme_advanced_toolbar_location : "external", }); } + + +function common_tiny_mce(div) +{ + + + div.css("width", "100%"); + div.css("height", "400px"); + div.tinymce({ + // Location of TinyMCE script + script_url : '/assets/tiny_mce/tiny_mce.js', + content_css : "/assets/admin/admin.css", + // General options + theme : "advanced", + skin: "cirkuit", + plugins : "pagebreak,style,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras", + + // Theme options + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,forecolor,backcolor,sub,sup,|,charmap,|,removeformat", + theme_advanced_buttons2 : "", + theme_advanced_buttons3 : "", +// theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_statusbar_location : false, + theme_advanced_resizing : false, + theme_advanced_text_colors : "#D2232A,#40AF49,#00ADEF", + theme_advanced_background_colors : "#D2232A,#40AF49,#00ADEF", + + theme_advanced_toolbar_location : "external", + + + + }); + +} + + + + + function set_prescriptions_big_container_size(){ diff --git a/app/assets/stylesheets/admin/portlets.css.scss b/app/assets/stylesheets/admin/portlets.css.scss index 211a173..18f08df 100644 --- a/app/assets/stylesheets/admin/portlets.css.scss +++ b/app/assets/stylesheets/admin/portlets.css.scss @@ -11,4 +11,14 @@ margin-left: 130px; } .title a, .description a { color: #604435; - text-decoration: none; } } \ No newline at end of file + text-decoration: none; } } + + +.garde_content td{ + + border:2px solid rgb(127,127,127); + vertical-align:top; + padding:5px; + + +} \ No newline at end of file diff --git a/app/assets/stylesheets/public/public.css.scss b/app/assets/stylesheets/public/public.css.scss index 510f302..bde34c8 100644 --- a/app/assets/stylesheets/public/public.css.scss +++ b/app/assets/stylesheets/public/public.css.scss @@ -362,8 +362,22 @@ text-align:center; border-collapse: collapse; td { border: 1px solid black; } } + + &.garde_content table { + width: 100%; + border-collapse: collapse; + td { + border: 1px solid black; +padding:5px; } } + &.block_content .two_column .column { float: left; width: 50%; .block { padding: 10px; } } } + + + + + + diff --git a/app/controllers/portlet/garde_contents_controller.rb b/app/controllers/portlet/garde_contents_controller.rb new file mode 100644 index 0000000..3bac8aa --- /dev/null +++ b/app/controllers/portlet/garde_contents_controller.rb @@ -0,0 +1,111 @@ +# -*- encoding : utf-8 -*- +class Portlet::GardeContentsController < ApplicationController + layout "admin" + + def new + @garde_content = GardeContent.new + + + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @garde_content = GardeContent.new(params[:garde_content]) + + respond_to do |format| + if @garde_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @garde_content) + + + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @garde_content = GardeContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @garde_content = GardeContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + + respond_to do |format| + if @garde_content.update_attributes(params[:garde_content]) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable]) } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @garde_content = GardeContent.find(params[:id]) + @garde_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/helpers/admin/garde_line_helper.rb b/app/helpers/admin/garde_line_helper.rb new file mode 100644 index 0000000..e857152 --- /dev/null +++ b/app/helpers/admin/garde_line_helper.rb @@ -0,0 +1,17 @@ +# -*- encoding : utf-8 -*- +module Admin::GardeLineHelper + + + def link_to_remove_fields(name, f) + f.hidden_field(:_destroy) + link_to(name, "#",:onclick => "if(confirm('Voulez-vous vraiment supprimer cette ligne ?')) {remove_fields(this);return false;}else{return false;}") + end + + def link_to_add_fields(name, f, association) + new_object = f.object.class.reflect_on_association(association).klass.new + fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| + render(association.to_s.singularize + "_fields", :f => builder) + end + link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")") + end + +end \ No newline at end of file diff --git a/app/models/portlets/garde_content.rb b/app/models/portlets/garde_content.rb new file mode 100644 index 0000000..898f734 --- /dev/null +++ b/app/models/portlets/garde_content.rb @@ -0,0 +1,7 @@ +class GardeContent < ActiveRecord::Base + has_one :portlet, :as => :content, :dependent => :destroy + has_many :garde_lines, :order => :position + accepts_nested_attributes_for :garde_lines, :allow_destroy => true + + +end diff --git a/app/models/portlets/garde_line.rb b/app/models/portlets/garde_line.rb new file mode 100644 index 0000000..d481625 --- /dev/null +++ b/app/models/portlets/garde_line.rb @@ -0,0 +1,3 @@ +class GardeLine < ActiveRecord::Base + belongs_to :garde_content +end diff --git a/app/views/portlet/garde_contents/_form.html.haml b/app/views/portlet/garde_contents/_form.html.haml new file mode 100644 index 0000000..7bcf54a --- /dev/null +++ b/app/views/portlet/garde_contents/_form.html.haml @@ -0,0 +1,58 @@ + +=form_for( [:portlet, @garde_content], :remote => true) do |f| + =hidden_field_tag "block_id", params[:block_id] + =hidden_field_tag "portlet_id", params[:portlet_id] + =hidden_field_tag "position", params[:position] + + + %table + %tr + %td=f.text_area :column_1, :class => "common_editor" + %td=f.text_area :column_2, :class => "common_editor" + %td=f.text_area :column_3, :class => "common_editor" + %td=f.text_area :column_4, :class => "common_editor" + %td + =f.fields_for :garde_lines do |f| + =render :partial => "portlet/garde_contents/garde_line_fields", :locals => {:f => f } + + + + + + + %p= link_to_add_fields "Ajouter une ligne", f, :garde_lines + =f.submit "Sauvegarder" + + + + + + +:javascript + + $("textarea.common_editor").each(function() { + + common_tiny_mce($(this)); + }); + + function remove_fields(link) { + $(link).prev("input[type=hidden]").val("1"); + $(link).closest(".field").hide(); + return false; + }; + + function add_fields(link, association, content) { + + var new_id = new Date().getTime(); + var regexp = new RegExp("new_" + association, "g") + $(link).closest("form").children('table').append(content.replace(regexp, new_id).replace(' "common_editor" + %td=f.text_area :column_2, :class => "common_editor" + %td=f.text_area :column_3, :class => "common_editor" + %td=f.text_area :column_4, :class => "common_editor" + %td= link_to_remove_fields i(:x_alt), f \ No newline at end of file diff --git a/app/views/portlet/garde_contents/_table_content_edit_pane.html.haml b/app/views/portlet/garde_contents/_table_content_edit_pane.html.haml new file mode 100644 index 0000000..7d42a41 --- /dev/null +++ b/app/views/portlet/garde_contents/_table_content_edit_pane.html.haml @@ -0,0 +1,33 @@ +%table.table_content + -table_rows = @table_content.table_rows + %tr + + + + + -table_rows.each do |table_row| + %tr + %td.row_left + .crl + %a{:href => "#", :onclick => "$('.table_row_menu').hide();$('#table_row_menu_"+table_row.id.to_s+"').toggle();return false;"}+ + + + + + .table_row_menu#table_row_menu{:id => table_row.id} + =link_to "ajouter un rang avant", portlet_table_rows_path(:table_row => {:table_content_id => @table_content.id, :position => (table_row.position)}), :method => :post + %br + =link_to "ajouter un rang après", portlet_table_rows_path(:table_row => {:table_content_id => @table_content.id, :position => (table_row.position+1)}), :method => :post + %br + =link_to "supprimer ce rang", [:portlet, table_row], :method => :delete, :confirm => "Voulez-vous vraiment supprimer ce rang ainsi que son contenu ?", :remote => true + + -table_row.cel_tables.each do |cel_table| + + %td.table_content_cel + =auto_load_div(admin_block_path(cel_table.block),"Page_"+"@page.id.to_s"+"_blocks_part") + + %td.add_col + %span + + -@table_content.nbr_cols.times do + %td.add_col + %span +f diff --git a/app/views/portlet/garde_contents/destroy_row.js.erb b/app/views/portlet/garde_contents/destroy_row.js.erb new file mode 100644 index 0000000..8fd1b2d --- /dev/null +++ b/app/views/portlet/garde_contents/destroy_row.js.erb @@ -0,0 +1,6 @@ + + + + +$("#table_content_edit_pane_<%= @table_content.id %>").html("<%= escape_javascript(render(:partial => "portlet/table_contents/table_content_edit_pane")) %>"); +<%= flash_notice() %> \ No newline at end of file diff --git a/app/views/portlet/shared/edit.html.haml b/app/views/portlet/shared/edit.html.haml index 40af0c4..69c7de2 100644 --- a/app/views/portlet/shared/edit.html.haml +++ b/app/views/portlet/shared/edit.html.haml @@ -1,8 +1 @@ #edit_portlet_content_form=render :partial => "form" -:javascript - - $("#edit_portlet_content_form .text_editor").each(function() { - auto_tiny_mce($(this)); - - }); - \ No newline at end of file diff --git a/app/views/portlets/render_public/_gardecontent.html.haml b/app/views/portlets/render_public/_gardecontent.html.haml new file mode 100644 index 0000000..38e52b0 --- /dev/null +++ b/app/views/portlets/render_public/_gardecontent.html.haml @@ -0,0 +1,16 @@ + +.portlet.garde_content + %table + %tr + %td=simple_format input.column_1 + %td=simple_format input.column_2 + %td=simple_format input.column_3 + %td=simple_format input.column_4 + + -input.garde_lines.each do |garde_line| + %tr + %td=simple_format garde_line.column_1 + %td=simple_format garde_line.column_2 + %td=simple_format garde_line.column_3 + %td=simple_format garde_line.column_4 + diff --git a/config/routes.rb b/config/routes.rb index 531f19f..d9f0a92 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -33,6 +33,12 @@ Pharma::Application.routes.draw do devise_for :admins, :controllers => {:sessions => "admins/sessions", :passwords => "admins/passwords"} namespace :portlet do + + resources :garde_contents do + collection do + get :reorder + end + end resources :break_contents resources :download_contents resources :dynamic_contents diff --git a/db/migrate/20111218163636_create_garde_contents.rb b/db/migrate/20111218163636_create_garde_contents.rb new file mode 100644 index 0000000..d49786d --- /dev/null +++ b/db/migrate/20111218163636_create_garde_contents.rb @@ -0,0 +1,17 @@ +class CreateGardeContents < ActiveRecord::Migration + def change + create_table :garde_contents do |t| + t.text :column_1 + t.text :column_2 + t.text :column_3 + t.text :column_4 + + + + t.timestamps + end + + ContentType.create(:slug => "GardeContent", :name => "Pharmacie de garde") + + end +end diff --git a/db/migrate/20111218164254_create_garde_lines.rb b/db/migrate/20111218164254_create_garde_lines.rb new file mode 100644 index 0000000..fd49819 --- /dev/null +++ b/db/migrate/20111218164254_create_garde_lines.rb @@ -0,0 +1,16 @@ +class CreateGardeLines < ActiveRecord::Migration + def change + create_table :garde_lines do |t| + t.references :garde_content + t.integer :position + t.text :column_1 + t.text :column_2 + t.text :column_3 + t.text :column_4 + + + t.timestamps + end + add_index :garde_lines, :garde_content_id + end +end diff --git a/test/fixtures/garde_contents.yml b/test/fixtures/garde_contents.yml new file mode 100644 index 0000000..4f72304 --- /dev/null +++ b/test/fixtures/garde_contents.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html + +one: + column_1: MyText + column_2: MyText + column_3: MyText + column_4: MyText + +two: + column_1: MyText + column_2: MyText + column_3: MyText + column_4: MyText diff --git a/test/fixtures/garde_lines.yml b/test/fixtures/garde_lines.yml new file mode 100644 index 0000000..dc6b622 --- /dev/null +++ b/test/fixtures/garde_lines.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html + +one: + garde_content: + position: 1 + +two: + garde_content: + position: 1 diff --git a/test/unit/garde_content_test.rb b/test/unit/garde_content_test.rb new file mode 100644 index 0000000..73c60a2 --- /dev/null +++ b/test/unit/garde_content_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GardeContentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/garde_line_test.rb b/test/unit/garde_line_test.rb new file mode 100644 index 0000000..5b28913 --- /dev/null +++ b/test/unit/garde_line_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GardeLineTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/vendor/assets/images/content_type/type_GardeContent.png b/vendor/assets/images/content_type/type_GardeContent.png new file mode 100644 index 0000000000000000000000000000000000000000..7ba9443790fe158c6ccbacae9fdeb8be90c56b67 GIT binary patch literal 3655 zcmV-N4!H4&P)Cxn>Ii*SHfoC&6k2nY&yb$5Z|%F^TT6dz~M#QO)K z5bh6A@j)O+f;@_ommuDuh~*0v5!93giA63-k;KHMz{E2lhT=kiWOuHAV`l8>?e6K> z7rSeIRZ~0J%+BM}-~INlXS#bGs;Z*?2u~>e2>N07!|sp3!Wro&=)fVfof-v|k0X-K zQ5LLhL|Oq{RoE7A9TxBNPF#&t@K*&k2eN|$Sw`)u;BPfjz=sXCBw&XCvco25)#AOd zLk|mV3bez_31g;Icctpi~_;&)o+@ck2QYXc&4=U(bE=iJ)HOSZv_gamj{&kaX_=| zB8~t`uN$u$HdLlhojPrHQc}{5g9Z)CQxql9&iQz~-mdQM?wZcd&SOW99y$2PBPDJM zszn#y+0xRoH#0NyiEx4jHn8Ah4$02WUWKh? z_qy`(4E?-V-#kVtYSc^q-U_y*Y=){83D6pBtmgUQRmb#XMPnH6Kkj9K>1+i%}Yfp!WkB_uXtnT6n1;qbit z{HLQy&8)!J@XW)D77b@WR(Q95Wz;RqMmVXSkDB|I0ga7~PvGYFUD2jyR^aCSuCZgs zuI$TBt`M1uhicwSr-F(f_ox-d9lW?#U)}qwP=F4Xn(4sTa`&D+yC)LjQUv$drPR$; zHt|8lLe&Fc!Oiej5)u-A9nET{jb+;O>9b-@&2&tiHf@$g`iK0o5sNMfJ{EHA zwbvHKGH8fVqejhTG-`O>9k8;QjT+pDNecA2VKfY&8Zcl$?xN!2VX~lkzAf8=WOfg` zXn5hF+bQsy8v_=0OsoIq`DZOH9* zBV3`P^z?L;c3m2pGiPo{VOLdEp_3<1qT6Q$R<-n9>p_dkk=J=s2pe&X-voW=(4mt> zA8c)HMLT!w&;UcYTrMA17|{~gw^JqUg9}}@`x)!&;&3{hzu?Vv$}O#2}}pP8A7L}Gw_ z$!x2Eaymy@*oWVqEre{fbGVSBM~-UiplF%O5LCW)%^IzM$avs^2ha_9dB%RrR@D*yD8Pc={g zJ#9>yRtTFnZ9?CF|2@jj&qvd5y%k;R?nZCD^_B^~er}bOm0BfTQc{94@xH5%A4hxk z>_M;X+ou(rjfS4BaM}gw&q2tjtf(;kU07JCDK{Y@!E~XZuqn4pK?mPEh`y|=!|OlY z5dhEtYCJAXJ-q|apmN=^AV#OAqQ{plGac{9k&m_4MGrr0SO@I;1kRQqYk|Vxsk^Lf zb?V~9k9}joCZKF2B=3Ckb1TRp>rV9^0;l{QRGkvQ@h~&dA8nJP|-aWkjlw7vPrwV*dR3 zhGjs3kgBwbO9EAr0q3^5tSk`Fsuft)Lj=VpXj3Qg-rnB-^6X<)UyBVYIhlM~he~?$ z#qNtz1fWud`26$FP49Phb{hKyi_*UpP^e^zC=>WvTNzALJKuCg5;Sv^RZmY(EAM^> zG>^d!;KH6+4OQ)6=w1Kl#L{^dReyiF};PgIcSrtI>f2Z)p36 zV{O^I+1N(Usb|cXp}lT=@kQ+zP#{{N;O$}I#g!{pzD4|zW~yz^2I+I|Sh04lo%q z+{FX6b^h=JbP+(QI3-KKEkC-|1`0cV?3lKW_p9aJWQ$SX58Y}cvl&n)90LjwQcBoo z2hQ0?j~=ZR3VE#NrY3D$2skImxyfzFs6BDw?=xo3d2#{>;a34i$^@YYE@OV+?Ng{RxDp$uyNC-_CCOukohS)-G|#YZ2HLz*@a=C4*k3D zzI!u1K0Z5^L1VwJ$KRwmeTwcOl&ym%m8}MnjgX^feFk#kulegJ#sgQZ>3x{!5 zvxu;e9!BLT)hkN2QKKTkIPm|}*6xf|RexDmw*#4nd3a>3L|WN`6i`9to~wqs&zw24 zYw+N~d9eh#udm+%Ld|4vR@*&U?J8SEzGK0)1^e2wv8L*e4 zd$Pu#I(2Hrh!G?H5(}W)+S+!H8#nGrLeXSiP3G6qVJMM*2%01jzXq=Ig5Z-1Fk zbT7v?c+=9^3Tb6q*ol{+ZsY5S^VO&7>+Amkb9_V!WH^_G`uY{Qxw%hK=i4jWh_O2b zhQBlEs1ndkK3-T@xNrNmZGXZ|;F<_%hS$Kk+=S1Gr z$wBwds;a7aIXO8?VH%-utGThU@i|=ZuOagsQLG$VXd(W0Lq#*(Am$E5!lLbbPH;F^+IsHr%U;XXD z2b1nyxbQZY%XRm_fdj_|6Y}NDmmAz}H_Yqz!R9SnIypk{2-3Ttf%Y3V$4(H(R!HEi zb)!&LKmYug88c_zmXeY(IWaLY->%Jog1fr9syoh|J9Y@iV@sBtp_J-D=I4g=64F^K zgEc)ULj38Og;Rne-#J;0f_m=RXUE`7CN(oFYjWR((xYj$lW%TnI^NLGa2CV;7K!Iy zWmSHn21{g24=M>P5vmA+I1+w3^OY zG?G>{>pKnIgV>MtR6!oC1`Be~lxBJ&zH&|!lu0i6fd&d4;?V*RTB##ki%kee)MJHMJ2 zF+bvV)nH44x2ta31B!lju>F8<_wHomTwAn^7+@8G8fC*B9R0t$9=_=Rb?ScDu^Imt ZU;sfWr6WNi^jiP`002ovPDHLkV1mAp8<_wA literal 0 HcmV?d00001 diff --git a/vendor/assets/javascripts/tiny_mce/langs/en.js b/vendor/assets/javascripts/tiny_mce/langs/en.js index 44a625e..6379b0d 100644 --- a/vendor/assets/javascripts/tiny_mce/langs/en.js +++ b/vendor/assets/javascripts/tiny_mce/langs/en.js @@ -1,222 +1 @@ -tinyMCE.addI18n({en:{ -common:{ -edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?", -apply:"Apply", -insert:"Insert", -update:"Update", -cancel:"Cancel", -close:"Close", -browse:"Browse", -class_name:"Class", -not_set:"-- Not set --", -clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?", -clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.", -popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.", -invalid_data:"{#field} is invalid", -invalid_data_number:"{#field} must be a number", -invalid_data_min:"{#field} must be a number greater than {#min}", -invalid_data_size:"{#field} must be a number or percentage", -more_colors:"More colors" -}, -colors:{ -'000000':'Black', -'993300':'Burnt orange', -'333300':'Dark olive', -'003300':'Dark green', -'003366':'Dark azure', -'000080':'Navy Blue', -'333399':'Indigo', -'333333':'Very dark gray', -'800000':'Maroon', -'FF6600':'Orange', -'808000':'Olive', -'008000':'Green', -'008080':'Teal', -'0000FF':'Blue', -'666699':'Grayish blue', -'808080':'Gray', -'FF0000':'Red', -'FF9900':'Amber', -'99CC00':'Yellow green', -'339966':'Sea green', -'33CCCC':'Turquoise', -'3366FF':'Royal blue', -'800080':'Purple', -'999999':'Medium gray', -'FF00FF':'Magenta', -'FFCC00':'Gold', -'FFFF00':'Yellow', -'00FF00':'Lime', -'00FFFF':'Aqua', -'00CCFF':'Sky blue', -'993366':'Brown', -'C0C0C0':'Silver', -'FF99CC':'Pink', -'FFCC99':'Peach', -'FFFF99':'Light yellow', -'CCFFCC':'Pale green', -'CCFFFF':'Pale cyan', -'99CCFF':'Light sky blue', -'CC99FF':'Plum', -'FFFFFF':'White' -}, -contextmenu:{ -align:"Alignment", -left:"Left", -center:"Center", -right:"Right", -full:"Full" -}, -insertdatetime:{ -date_fmt:"%Y-%m-%d", -time_fmt:"%H:%M:%S", -insertdate_desc:"Insert date", -inserttime_desc:"Insert time", -months_long:"January,February,March,April,May,June,July,August,September,October,November,December", -months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", -day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday", -day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun" -}, -print:{ -print_desc:"Print" -}, -preview:{ -preview_desc:"Preview" -}, -directionality:{ -ltr_desc:"Direction left to right", -rtl_desc:"Direction right to left" -}, -layer:{ -insertlayer_desc:"Insert new layer", -forward_desc:"Move forward", -backward_desc:"Move backward", -absolute_desc:"Toggle absolute positioning", -content:"New layer..." -}, -save:{ -save_desc:"Save", -cancel_desc:"Cancel all changes" -}, -nonbreaking:{ -nonbreaking_desc:"Insert non-breaking space character" -}, -iespell:{ -iespell_desc:"Run spell checking", -download:"ieSpell not detected. Do you want to install it now?" -}, -advhr:{ -advhr_desc:"Horizontal rule" -}, -emotions:{ -emotions_desc:"Emotions" -}, -searchreplace:{ -search_desc:"Find", -replace_desc:"Find/Replace" -}, -advimage:{ -image_desc:"Insert/edit image" -}, -advlink:{ -link_desc:"Insert/edit link" -}, -xhtmlxtras:{ -cite_desc:"Citation", -abbr_desc:"Abbreviation", -acronym_desc:"Acronym", -del_desc:"Deletion", -ins_desc:"Insertion", -attribs_desc:"Insert/Edit Attributes" -}, -style:{ -desc:"Edit CSS Style" -}, -paste:{ -paste_text_desc:"Paste as Plain Text", -paste_word_desc:"Paste from Word", -selectall_desc:"Select All", -plaintext_mode_sticky:"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.", -plaintext_mode:"Paste is now in plain text mode. Click again to toggle back to regular paste mode." -}, -paste_dlg:{ -text_title:"Use CTRL+V on your keyboard to paste the text into the window.", -text_linebreaks:"Keep linebreaks", -word_title:"Use CTRL+V on your keyboard to paste the text into the window." -}, -table:{ -desc:"Inserts a new table", -row_before_desc:"Insert row before", -row_after_desc:"Insert row after", -delete_row_desc:"Delete row", -col_before_desc:"Insert column before", -col_after_desc:"Insert column after", -delete_col_desc:"Remove column", -split_cells_desc:"Split merged table cells", -merge_cells_desc:"Merge table cells", -row_desc:"Table row properties", -cell_desc:"Table cell properties", -props_desc:"Table properties", -paste_row_before_desc:"Paste table row before", -paste_row_after_desc:"Paste table row after", -cut_row_desc:"Cut table row", -copy_row_desc:"Copy table row", -del:"Delete table", -row:"Row", -col:"Column", -cell:"Cell" -}, -autosave:{ -unload_msg:"The changes you made will be lost if you navigate away from this page.", -restore_content:"Restore auto-saved content.", -warning_message:"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?." -}, -fullscreen:{ -desc:"Toggle fullscreen mode" -}, -media:{ -desc:"Insert / edit embedded media", -edit:"Edit embedded media" -}, -fullpage:{ -desc:"Document properties" -}, -template:{ -desc:"Insert predefined template content" -}, -visualchars:{ -desc:"Visual control characters on/off." -}, -spellchecker:{ -desc:"Toggle spellchecker", -menu:"Spellchecker settings", -ignore_word:"Ignore word", -ignore_words:"Ignore all", -langs:"Languages", -wait:"Please wait...", -sug:"Suggestions", -no_sug:"No suggestions", -no_mpell:"No misspellings found." -}, -pagebreak:{ -desc:"Insert page break." -}, -advlist:{ -types:"Types", -def:"Default", -lower_alpha:"Lower alpha", -lower_greek:"Lower greek", -lower_roman:"Lower roman", -upper_alpha:"Upper alpha", -upper_roman:"Upper roman", -circle:"Circle", -disc:"Disc", -square:"Square" -}, -aria:{ -rich_text_area:"Rich Text Area" -}, -wordcount:{ -words: 'Words: ' -} -}}); \ No newline at end of file +tinyMCE.addI18n({en:{common:{"more_colors":"More Colors...","invalid_data":"Error: Invalid values entered, these are marked in red.","popup_blocked":"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.","clipboard_no_support":"Currently not supported by your browser, use keyboard shortcuts instead.","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","not_set":"-- Not Set --","class_name":"Class",browse:"Browse",close:"Close",cancel:"Cancel",update:"Update",insert:"Insert",apply:"Apply","edit_confirm":"Do you want to use the WYSIWYG mode for this textarea?","invalid_data_number":"{#field} must be a number","invalid_data_min":"{#field} must be a number greater than {#min}","invalid_data_size":"{#field} must be a number or percentage",value:"(value)"},contextmenu:{full:"Full",right:"Right",center:"Center",left:"Left",align:"Alignment"},insertdatetime:{"day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","inserttime_desc":"Insert Time","insertdate_desc":"Insert Date","time_fmt":"%H:%M:%S","date_fmt":"%Y-%m-%d"},print:{"print_desc":"Print"},preview:{"preview_desc":"Preview"},directionality:{"rtl_desc":"Direction Right to Left","ltr_desc":"Direction Left to Right"},layer:{content:"New layer...","absolute_desc":"Toggle Absolute Positioning","backward_desc":"Move Backward","forward_desc":"Move Forward","insertlayer_desc":"Insert New Layer"},save:{"save_desc":"Save","cancel_desc":"Cancel All Changes"},nonbreaking:{"nonbreaking_desc":"Insert Non-Breaking Space Character"},iespell:{download:"ieSpell not detected. Do you want to install it now?","iespell_desc":"Check Spelling"},advhr:{"delta_height":"","delta_width":"","advhr_desc":"Insert Horizontal Line"},emotions:{"delta_height":"","delta_width":"","emotions_desc":"Emotions"},searchreplace:{"replace_desc":"Find/Replace","delta_width":"","delta_height":"","search_desc":"Find"},advimage:{"delta_width":"","image_desc":"Insert/Edit Image","delta_height":""},advlink:{"delta_height":"","delta_width":"","link_desc":"Insert/Edit Link"},xhtmlxtras:{"attribs_delta_height":"","attribs_delta_width":"","ins_delta_height":"","ins_delta_width":"","del_delta_height":"","del_delta_width":"","acronym_delta_height":"","acronym_delta_width":"","abbr_delta_height":"","abbr_delta_width":"","cite_delta_height":"","cite_delta_width":"","attribs_desc":"Insert/Edit Attributes","ins_desc":"Insertion","del_desc":"Deletion","acronym_desc":"Acronym","abbr_desc":"Abbreviation","cite_desc":"Citation"},style:{"delta_height":"","delta_width":"",desc:"Edit CSS Style"},paste:{"plaintext_mode_stick":"Paste is now in plain text mode. Click again to toggle back to regular paste mode.","plaintext_mode":"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.","selectall_desc":"Select All","paste_word_desc":"Paste from Word","paste_text_desc":"Paste as Plain Text"},"paste_dlg":{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."},table:{"merge_cells_delta_height":"","merge_cells_delta_width":"","table_delta_height":"","table_delta_width":"","cellprops_delta_height":"","cellprops_delta_width":"","rowprops_delta_height":"","rowprops_delta_width":"",cell:"Cell",col:"Column",row:"Row",del:"Delete Table","copy_row_desc":"Copy Table Row","cut_row_desc":"Cut Table Row","paste_row_after_desc":"Paste Table Row After","paste_row_before_desc":"Paste Table Row Before","props_desc":"Table Properties","cell_desc":"Table Cell Properties","row_desc":"Table Row Properties","merge_cells_desc":"Merge Table Cells","split_cells_desc":"Split Merged Table Cells","delete_col_desc":"Delete Column","col_after_desc":"Insert Column After","col_before_desc":"Insert Column Before","delete_row_desc":"Delete Row","row_after_desc":"Insert Row After","row_before_desc":"Insert Row Before",desc:"Insert/Edit Table"},autosave:{"warning_message":"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?","restore_content":"Restore auto-saved content.","unload_msg":"The changes you made will be lost if you navigate away from this page."},fullscreen:{desc:"Toggle Full Screen Mode"},media:{"delta_height":"","delta_width":"",edit:"Edit Embedded Media",desc:"Insert/Edit Embedded Media"},fullpage:{desc:"Document Properties","delta_width":"","delta_height":""},template:{desc:"Insert Predefined Template Content"},visualchars:{desc:"Show/Hide Visual Control Characters"},spellchecker:{desc:"Toggle Spell Checker",menu:"Spell Checker Settings","ignore_word":"Ignore Word","ignore_words":"Ignore All",langs:"Languages",wait:"Please wait...",sug:"Suggestions","no_sug":"No Suggestions","no_mpell":"No misspellings found.","learn_word":"Learn word"},pagebreak:{desc:"Insert Page Break for Printing"},advlist:{types:"Types",def:"Default","lower_alpha":"Lower Alpha","lower_greek":"Lower Greek","lower_roman":"Lower Roman","upper_alpha":"Upper Alpha","upper_roman":"Upper Roman",circle:"Circle",disc:"Disc",square:"Square"},colors:{"333300":"Dark olive","993300":"Burnt orange","000000":"Black","003300":"Dark green","003366":"Dark azure","000080":"Navy Blue","333399":"Indigo","333333":"Very dark gray","800000":"Maroon",FF6600:"Orange","808000":"Olive","008000":"Green","008080":"Teal","0000FF":"Blue","666699":"Grayish blue","808080":"Gray",FF0000:"Red",FF9900:"Amber","99CC00":"Yellow green","339966":"Sea green","33CCCC":"Turquoise","3366FF":"Royal blue","800080":"Purple","999999":"Medium gray",FF00FF:"Magenta",FFCC00:"Gold",FFFF00:"Yellow","00FF00":"Lime","00FFFF":"Aqua","00CCFF":"Sky blue","993366":"Brown",C0C0C0:"Silver",FF99CC:"Pink",FFCC99:"Peach",FFFF99:"Light yellow",CCFFCC:"Pale green",CCFFFF:"Pale cyan","99CCFF":"Light sky blue",CC99FF:"Plum",FFFFFF:"White"},aria:{"rich_text_area":"Rich Text Area"},wordcount:{words:"Words:"}}}); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js b/vendor/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js index ad6a7b6..0c3bf15 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js @@ -1,7 +1 @@ -tinyMCE.addI18n('en.advhr_dlg',{ -normal:"Normal", -width:"Width", -widthunits:"Units", -size:"Height", -noshade:"No shadow" -}); \ No newline at end of file +tinyMCE.addI18n('en.advhr_dlg',{size:"Height",noshade:"No Shadow",width:"Width",normal:"Normal",widthunits:"Units"}); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin.js b/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin.js index 4c7a9c3..d613a61 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin.js @@ -1 +1 @@ -(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})(); \ No newline at end of file +(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})(); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js b/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js index 2625dd2..d2678cb 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js @@ -14,7 +14,7 @@ // Register commands ed.addCommand('mceAdvImage', function() { // Internal image object like a flash placeholder - if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1) return; ed.windowManager.open({ diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advimage/js/image.js b/vendor/assets/javascripts/tiny_mce/plugins/advimage/js/image.js index d1bca64..546b69c 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advimage/js/image.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advimage/js/image.js @@ -9,13 +9,13 @@ var ImageDialog = { }, init : function(ed) { - var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList'); tinyMCEPopup.resizeToInnerSize(); this.fillClassList('class_list'); - this.fillFileList('src_list', 'tinyMCEImageList'); - this.fillFileList('over_list', 'tinyMCEImageList'); - this.fillFileList('out_list', 'tinyMCEImageList'); + this.fillFileList('src_list', fl); + this.fillFileList('over_list', fl); + this.fillFileList('out_list', fl); TinyMCE_EditableSelects.init(); if (n.nodeName == 'IMG') { @@ -171,9 +171,13 @@ var ImageDialog = { if (el && el.nodeName == 'IMG') { ed.dom.setAttribs(el, args); } else { - ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); - ed.dom.setAttribs('__mce_tmp', args); - ed.dom.setAttrib('__mce_tmp', 'id', ''); + tinymce.each(args, function(value, name) { + if (value === "") { + delete args[name]; + } + }); + + ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1}); ed.undoManager.add(); } @@ -287,7 +291,7 @@ var ImageDialog = { fillFileList : function(id, l) { var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; - l = window[l]; + l = typeof(l) === 'function' ? l() : window[l]; lst.options.length = 0; if (l && l.length > 0) { @@ -361,7 +365,7 @@ var ImageDialog = { }, updateStyle : function(ty) { - var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value}); + var dom = tinyMCEPopup.dom, b, bStyle, bColor, v, isIE = tinymce.isIE, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value}); if (tinyMCEPopup.editor.settings.inline_styles) { // Handle align @@ -380,14 +384,27 @@ var ImageDialog = { // Handle border if (ty == 'border') { + b = img.style.border ? img.style.border.split(' ') : []; + bStyle = dom.getStyle(img, 'border-style'); + bColor = dom.getStyle(img, 'border-color'); + dom.setStyle(img, 'border', ''); v = f.border.value; if (v || v == '0') { if (v == '0') - img.style.border = '0 none none'; - else - img.style.border = v + 'px solid black'; + img.style.border = isIE ? '0' : '0 none none'; + else { + if (b.length == 3 && b[isIE ? 2 : 1]) + bStyle = b[isIE ? 2 : 1]; + else if (!bStyle || bStyle == 'none') + bStyle = 'solid'; + if (b.length == 3 && b[isIE ? 0 : 2]) + bColor = b[isIE ? 0 : 2]; + else if (!bColor || bColor == 'none') + bColor = 'black'; + img.style.border = v + 'px ' + bStyle + ' ' + bColor; + } } } diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js b/vendor/assets/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js index d8f11e0..5f122e2 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js @@ -1,45 +1 @@ -tinyMCE.addI18n('en.advimage_dlg',{ -tab_general:"General", -tab_appearance:"Appearance", -tab_advanced:"Advanced", -general:"General", -title:"Title", -preview:"Preview", -constrain_proportions:"Constrain proportions", -langdir:"Language direction", -langcode:"Language code", -long_desc:"Long description link", -style:"Style", -classes:"Classes", -ltr:"Left to right", -rtl:"Right to left", -id:"Id", -map:"Image map", -swap_image:"Swap image", -alt_image:"Alternative image", -mouseover:"for mouse over", -mouseout:"for mouse out", -misc:"Miscellaneous", -example_img:"Appearance preview image", -missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.", -dialog_title:"Insert/edit image", -src:"Image URL", -alt:"Image description", -list:"Image list", -border:"Border", -dimensions:"Dimensions", -width:"Width", -height:"Height", -vspace:"Vertical space", -hspace:"Horizontal space", -align:"Alignment", -align_baseline:"Baseline", -align_top:"Top", -align_middle:"Middle", -align_bottom:"Bottom", -align_texttop:"Text top", -align_textbottom:"Text bottom", -align_left:"Left", -align_right:"Right", -image_list:"Image list" -}); \ No newline at end of file +tinyMCE.addI18n('en.advimage_dlg',{"image_list":"Image List","align_right":"Right","align_left":"Left","align_textbottom":"Text Bottom","align_texttop":"Text Top","align_bottom":"Bottom","align_middle":"Middle","align_top":"Top","align_baseline":"Baseline",align:"Alignment",hspace:"Horizontal Space",vspace:"Vertical Space",dimensions:"Dimensions",border:"Border",list:"Image List",alt:"Image Description",src:"Image URL","dialog_title":"Insert/Edit Image","missing_alt":"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.","example_img":"Appearance Preview Image",misc:"Miscellaneous",mouseout:"For Mouse Out",mouseover:"For Mouse Over","alt_image":"Alternative Image","swap_image":"Swap Image",map:"Image Map",id:"ID",rtl:"Right to Left",ltr:"Left to Right",classes:"Classes",style:"Style","long_desc":"Long Description Link",langcode:"Language Code",langdir:"Language Direction","constrain_proportions":"Constrain Proportions",preview:"Preview",title:"Title",general:"General","tab_advanced":"Advanced","tab_appearance":"Appearance","tab_general":"General",width:"Width",height:"Height"}); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js b/vendor/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js index 5fd6d91..837c937 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js @@ -30,8 +30,6 @@ function init() { document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink'); document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink'); - document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href'); - document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href'); document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target'); // Link list @@ -41,6 +39,13 @@ function init() { else document.getElementById("linklisthrefcontainer").innerHTML = html; + // Anchor list + html = getAnchorListHTML('anchorlist','href'); + if (html == "") + document.getElementById("anchorlistrow").style.display = 'none'; + else + document.getElementById("anchorlistcontainer").innerHTML = html; + // Resize some elements if (isVisible('hrefbrowser')) document.getElementById('href').style.width = '260px'; @@ -362,16 +367,20 @@ function setAttrib(elm, attrib, value) { function getAnchorListHTML(id, target) { var ed = tinyMCEPopup.editor, nodes = ed.dom.select('a'), name, i, len, html = ""; - html += ''; + if (html == "") + return ""; + + html = ''; return html; } diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js b/vendor/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js index 19dff29..3169a56 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js @@ -1,54 +1 @@ -tinyMCE.addI18n('en.advlink_dlg',{ -title:"Insert/edit link", -url:"Link URL", -target:"Target", -titlefield:"Title", -is_email:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?", -is_external:"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?", -list:"Link list", -general_tab:"General", -popup_tab:"Popup", -events_tab:"Events", -advanced_tab:"Advanced", -general_props:"General properties", -popup_props:"Popup properties", -event_props:"Events", -advanced_props:"Advanced properties", -popup_opts:"Options", -anchor_names:"Anchors", -target_same:"Open in this window / frame", -target_parent:"Open in parent window / frame", -target_top:"Open in top frame (replaces all frames)", -target_blank:"Open in new window", -popup:"Javascript popup", -popup_url:"Popup URL", -popup_name:"Window name", -popup_return:"Insert 'return false'", -popup_scrollbars:"Show scrollbars", -popup_statusbar:"Show status bar", -popup_toolbar:"Show toolbars", -popup_menubar:"Show menu bar", -popup_location:"Show location bar", -popup_resizable:"Make window resizable", -popup_dependent:"Dependent (Mozilla/Firefox only)", -popup_size:"Size", -width:"Width", -height:"Height", -popup_position:"Position (X/Y)", -id:"Id", -style:"Style", -classes:"Classes", -target_name:"Target name", -langdir:"Language direction", -target_langcode:"Target language", -langcode:"Language code", -encoding:"Target character encoding", -mime:"Target MIME type", -rel:"Relationship page to target", -rev:"Relationship target to page", -tabindex:"Tabindex", -accesskey:"Accesskey", -ltr:"Left to right", -rtl:"Right to left", -link_list:"Link list" -}); \ No newline at end of file +tinyMCE.addI18n('en.advlink_dlg',{"target_name":"Target Name",classes:"Classes",style:"Style",id:"ID","popup_position":"Position (X/Y)",langdir:"Language Direction","popup_size":"Size","popup_dependent":"Dependent (Mozilla/Firefox Only)","popup_resizable":"Make Window Resizable","popup_location":"Show Location Bar","popup_menubar":"Show Menu Bar","popup_toolbar":"Show Toolbars","popup_statusbar":"Show Status Bar","popup_scrollbars":"Show Scrollbars","popup_return":"Insert \'return false\'","popup_name":"Window Name","popup_url":"Popup URL",popup:"JavaScript Popup","target_blank":"Open in New Window","target_top":"Open in Top Frame (Replaces All Frames)","target_parent":"Open in Parent Window/Frame","target_same":"Open in This Window/Frame","anchor_names":"Anchors","popup_opts":"Options","advanced_props":"Advanced Properties","event_props":"Events","popup_props":"Popup Properties","general_props":"General Properties","advanced_tab":"Advanced","events_tab":"Events","popup_tab":"Popup","general_tab":"General",list:"Link List","is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",titlefield:"Title",target:"Target",url:"Link URL",title:"Insert/Edit Link","link_list":"Link List",rtl:"Right to Left",ltr:"Left to Right",accesskey:"AccessKey",tabindex:"TabIndex",rev:"Relationship Target to Page",rel:"Relationship Page to Target",mime:"Target MIME Type",encoding:"Target Character Encoding",langcode:"Language Code","target_langcode":"Target Language",width:"Width",height:"Height"}); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advlink/link.htm b/vendor/assets/javascripts/tiny_mce/plugins/advlink/link.htm index 6c2d9a5..8ab7c2a 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advlink/link.htm +++ b/vendor/assets/javascripts/tiny_mce/plugins/advlink/link.htm @@ -40,7 +40,7 @@ - + diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js b/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js index e884b76..57ecce6 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js @@ -1 +1 @@ -(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square")},createControl:function(d,b){var f=this,e,h;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){h=f[d][0]}function c(i,k){var j=true;a(k.styles,function(m,l){if(f.editor.dom.getStyle(i,l)!=m){j=false;return false}});return j}function g(){var k,i=f.editor,l=i.dom,j=i.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,h)){i.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(h){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,h.styles);k.removeAttribute("data-mce-style")}}i.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){g()}});e.onRenderMenu.add(function(i,j){j.onShowMenu.add(function(){var m=f.editor.dom,l=m.getParent(f.editor.selection.getNode(),"ol,ul"),k;if(l||h){k=f[d];a(j.items,function(n){var o=true;n.setSelected(0);if(l&&!n.isDisabled()){a(k,function(p){if(p.id==n.id){if(!c(l,p)){o=false;return false}}});if(o){n.setSelected(1)}}});if(!l){j.items[h.id].setSelected(1)}}});j.add({id:f.editor.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(k){k.id=f.editor.dom.uniqueId();j.add({id:k.id,title:k.title,onclick:function(){h=k;g()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})(); \ No newline at end of file +(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square");if(tinymce.isIE&&/MSIE [2-7]/.test(navigator.userAgent)){d.isIE7=true}},createControl:function(d,b){var f=this,e,i,g=f.editor;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){i=f[d][0]}function c(j,l){var k=true;a(l.styles,function(n,m){if(g.dom.getStyle(j,m)!=n){k=false;return false}});return k}function h(){var k,l=g.dom,j=g.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,i)){g.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(i){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,i.styles);k.removeAttribute("data-mce-style")}}g.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){h()}});e.onRenderMenu.add(function(j,k){k.onHideMenu.add(function(){if(f.bookmark){g.selection.moveToBookmark(f.bookmark);f.bookmark=0}});k.onShowMenu.add(function(){var n=g.dom,m=n.getParent(g.selection.getNode(),"ol,ul"),l;if(m||i){l=f[d];a(k.items,function(o){var p=true;o.setSelected(0);if(m&&!o.isDisabled()){a(l,function(q){if(q.id==o.id){if(!c(m,q)){p=false;return false}}});if(p){o.setSelected(1)}}});if(!m){k.items[i.id].setSelected(1)}}g.focus();if(tinymce.isIE){f.bookmark=g.selection.getBookmark(1)}});k.add({id:g.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(l){if(f.isIE7&&l.styles.listStyleType=="lower-greek"){return}l.id=g.dom.uniqueId();k.add({id:l.id,title:l.title,onclick:function(){i=l;h()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})(); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js b/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js index e8ff208..a8f046b 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js @@ -35,10 +35,13 @@ // Setup number formats from config or default t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman"); t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square"); + + if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent)) + t.isIE7 = true; }, createControl: function(name, cm) { - var t = this, btn, format; + var t = this, btn, format, editor = t.editor; if (name == 'numlist' || name == 'bullist') { // Default to first item if it's a default item @@ -50,7 +53,7 @@ each(format.styles, function(value, name) { // Format doesn't match - if (t.editor.dom.getStyle(node, name) != value) { + if (editor.dom.getStyle(node, name) != value) { state = false; return false; } @@ -60,14 +63,14 @@ }; function applyListFormat() { - var list, ed = t.editor, dom = ed.dom, sel = ed.selection; + var list, dom = editor.dom, sel = editor.selection; // Check for existing list element list = dom.getParent(sel.getNode(), 'ol,ul'); // Switch/add list type if needed if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format)) - ed.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList'); + editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList'); // Append styles to new list element if (format) { @@ -77,7 +80,8 @@ list.removeAttribute('data-mce-style'); } } - ed.focus(); + + editor.focus(); }; btn = cm.createSplitButton(name, { @@ -89,8 +93,15 @@ }); btn.onRenderMenu.add(function(btn, menu) { + menu.onHideMenu.add(function() { + if (t.bookmark) { + editor.selection.moveToBookmark(t.bookmark); + t.bookmark = 0; + } + }); + menu.onShowMenu.add(function() { - var dom = t.editor.dom, list = dom.getParent(t.editor.selection.getNode(), 'ol,ul'), fmtList; + var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList; if (list || format) { fmtList = t[name]; @@ -120,12 +131,23 @@ if (!list) menu.items[format.id].setSelected(1); } + + editor.focus(); + + // IE looses it's selection so store it away and restore it later + if (tinymce.isIE) { + t.bookmark = editor.selection.getBookmark(1); + } }); - menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1); + menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1); each(t[name], function(item) { - item.id = t.editor.dom.uniqueId(); + // IE<8 doesn't support lower-greek, skip it + if (t.isIE7 && item.styles.listStyleType == 'lower-greek') + return; + + item.id = editor.dom.uniqueId(); menu.add({id : item.id, title : item.title, onclick : function() { format = item; diff --git a/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js b/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js index de56d96..fd293dc 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js @@ -1 +1 @@ -(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;if(tinyMCE.isIE){return}a.onKeyDown.add(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}if(f.shiftKey&&f.keyCode==48){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng().cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("mceInsertLink",false,h[1]+h[2]);i.selection.moveToBookmark(k);if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})(); \ No newline at end of file +(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;if(tinyMCE.isIE){return}a.onKeyDown.add(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});a.onKeyPress.add(function(d,f){if(f.which==41){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng().cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})(); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin_src.js b/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin_src.js index 4917edc..604da8b 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin_src.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin_src.js @@ -30,10 +30,13 @@ ed.onKeyDown.add(function(ed, e) { if (e.keyCode == 13) return t.handleEnter(ed); - if (e.shiftKey && e.keyCode == 48) - return t.handleEclipse(ed); }); + ed.onKeyPress.add(function(ed, e) { + if (e.which == 41) + return t.handleEclipse(ed); + }); + // Add a key up handler ed.onKeyUp.add(function(ed, e) { if (e.keyCode == 32) @@ -132,7 +135,7 @@ bookmark = ed.selection.getBookmark(); ed.selection.setRng(r); - tinyMCE.execCommand('mceInsertLink',false, matches[1] + matches[2]); + tinyMCE.execCommand('createlink',false, matches[1] + matches[2]); ed.selection.moveToBookmark(bookmark); // TODO: Determine if this is still needed. diff --git a/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js b/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js index 1676b15..6c4ff0d 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js @@ -1 +1 @@ -(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this;if(a.getParam("fullscreen_is_enabled")){return}function b(){var h=a.getDoc(),e=h.body,j=h.documentElement,g=tinymce.DOM,i=d.autoresize_min_height,f;f=tinymce.isIE?e.scrollHeight:j.offsetHeight;if(f>d.autoresize_min_height){i=f}g.setStyle(g.get(a.id+"_ifr"),"height",i+"px");if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=a.getElement().offsetHeight;a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(f,e){f.setProgressState(true);d.throbbing=true;f.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(f,e){b();setTimeout(function(){b();f.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})(); \ No newline at end of file +(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var i=a.getDoc(),f=i.body,k=i.documentElement,h=tinymce.DOM,j=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:i.body.offsetHeight;if(g>d.autoresize_min_height){j=g}if(d.autoresize_max_height&&g>d.autoresize_max_height){j=d.autoresize_max_height;a.getBody().style.overflowY="auto"}else{a.getBody().style.overflowY="hidden"}if(j!==e){h.setStyle(h.get(a.id+"_ifr"),"height",j+"px");e=j}if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight));d.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0));a.onInit.add(function(f){f.dom.setStyle(f.getBody(),"paddingBottom",f.getParam("autoresize_bottom_margin",50)+"px")});a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(g,f){g.setProgressState(true);d.throbbing=true;g.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(g,f){b();setTimeout(function(){b();g.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})(); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js b/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js index c260b7a..7d11341 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js @@ -26,7 +26,7 @@ * @param {string} url Absolute URL to where the plugin is located. */ init : function(ed, url) { - var t = this; + var t = this, oldSize = 0; if (ed.getParam('fullscreen_is_enabled')) return; @@ -38,14 +38,24 @@ var d = ed.getDoc(), b = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight; // Get height differently depending on the browser used - myHeight = tinymce.isIE ? b.scrollHeight : de.offsetHeight; + myHeight = tinymce.isIE ? b.scrollHeight : d.body.offsetHeight; // Don't make it smaller than the minimum height if (myHeight > t.autoresize_min_height) resizeHeight = myHeight; + // If a maximum height has been defined don't exceed this height + if (t.autoresize_max_height && myHeight > t.autoresize_max_height) { + resizeHeight = t.autoresize_max_height; + ed.getBody().style.overflowY = "auto"; + } else + ed.getBody().style.overflowY = "hidden"; + // Resize content element - DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px'); + if (resizeHeight !== oldSize) { + DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px'); + oldSize = resizeHeight; + } // if we're throbbing, we'll re-throb to match the new size if (t.throbbing) { @@ -57,7 +67,15 @@ t.editor = ed; // Define minimum height - t.autoresize_min_height = ed.getElement().offsetHeight; + t.autoresize_min_height = parseInt( ed.getParam('autoresize_min_height', ed.getElement().offsetHeight) ); + + // Define maximum height + t.autoresize_max_height = parseInt( ed.getParam('autoresize_max_height', 0) ); + + // Add padding at the bottom for better UX + ed.onInit.add(function(ed){ + ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px'); + }); // Add appropriate listeners for resizing content area ed.onChange.add(resize); @@ -116,4 +134,4 @@ // Register plugin tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin); -})(); \ No newline at end of file +})(); diff --git a/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin.js b/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin.js index 7f49107..f7d0576 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin.js @@ -1 +1 @@ -(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,i=h.storage;if(i){content=i.getItem(h.key);if(content){h.editor.setContent(content);h.onRestoreDraft.dispatch(h,{content:content})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()]*>|]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,j=h.storage,i;if(j){i=j.getItem(h.key);if(i){h.editor.setContent(i);h.onRestoreDraft.dispatch(h,{content:i})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()
{#emotions_dlg.title}:

- +
- - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + +
{#emotions_dlg.usage}
diff --git a/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif b/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif index 16f68cc1e91a9b8ec6cfa0ba4e0c86f94b177f1a..c7cf1011dad0e7500e29a278b0d395b253871109 100644 GIT binary patch delta 268 zcmV+n0rURY0@eZ$M@dFFIbjk25&-lc0J)nSkq}gWCJF-k?l%Ac03rDV1poja04x9i z000sI5&%F2)8HqHP-&K zLM9f)qQm8C1c`;hGBJ_}h73g_p=1mM^9RXLyb^bpf>AvH6dpB#1`P%p2?GxRIXezw z7zGP+3jz%k3l2poa}fvt8yf%!5pp93KMDvH92^x0V-7i+EDszR8Bewx4-y8WehLpR z33wR8E)NQeD=m2M7#-8v+{*T!alCd#3 z1p^Ir4Fi-428xUrkd&O950`xk9-RXQ4F(zs0}qJ@2n?ee0ving0HzHddj}8`MGLmU z8UhImO%o-q#)2Cf00I^Q4_>?<5El-{nhOg84HOFw7eOBf7YG&%hkqFs2p3Q(*Aoat UP6!j@HP+?<{sHjFeFy;nJK@hu1^@s6 diff --git a/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif b/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif index 1606c119e75678c4031f384e0d50849906e8f533..82c5b182e61d32bd394acae551eff180f1eebd26 100644 GIT binary patch delta 269 zcmV+o0rLLX0@nf%M@dFFIbjk25&-lc0K%p+kq}gWQaug+`&s}103rDV1poja04x9i z000sI5&%F2)ZizIQ)!l?Xh>A$7VskoPwh#@I9<*GEDONFahaqh2L%Pf;kcR*isE3L zI2Im3A3bNpK_?^9QN%xH_GCzT(kPR|yLU7KDX_2pAAJa~A*# z2^9-;8v_d!2?_v3DRU7A5(5Jg2N7~31{ezo9uTY$9)TD+oGcI(4STm0Q4*wpwG|r; zF2ODk2{(g0w~m91nJ)p)P~b0v=TXuJkV0)pK%`hRH&5(aq`SQQ0|4*~)Y zj~;||h6NmskCzV%0uYjV3kVjWqM-;FoP`G(WCRQW7Z(8x1b=r16AlX=0u2`oB@7o0 z3LXm%B?eNu8w9Vj0v=tq9}^cH3JDbp8v_d!2?`w-K_3Pe2MZcXM;Z$U7f&hF4hJ0z U3mpdz;x*Id4FABSjR*k%I|lSgp8x;= diff --git a/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif b/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif index b33d3cca1e7b8e62dc689880074d5c61f619520d..fe66220c24b4da4526818a5d68f75a06d9985a29 100644 GIT binary patch delta 249 zcmVc6jM@dFFIbjk25&-lc0Klpjkq}gWQauaR#xDQ>03rDV1poja04x9i z000sI5&%F2z~Co}Q)!l?s2E!2QdA zP6EM+V$0o5egPxNVelL@nuEvS5Py&l$*VJWNgmaeBy#Fc3>i3Y6%ZGOhlmgrZX^W= z8v_Gi8wdrADnAk!5DyO!7!pA_ZyYQc4;~&as7@LN99jl)E**3kv`;r%EDsR|k-xtS zxe5rp69ipb1YdXxI|zjY71PuN7Z3uIlM@dFFIbjk25&+Z_08%{*kq}gWz^WJ3#xDQ>03rDV0RR9W04x9i z000sI5&!@N!r&*0Q)!lCN*2gA3>#8RD(M*Bp=pO_IJA@^(ve^wj|T)J=|mKx31Xqy zL>`%J1fp3WXcLY>lX-YN*)vvS;FJ&#NtObb*E5pGS7DH60e65|cm@i5WOEb=0u&Si zj}nDqhYt}3FPE1Kk%oN{C!Z4r8Io|G1cs;z1QS;X3KIcN6RD}J9RVd52oM(p6~Dj) z7Z3;+U=_R<%FD|T6+s^g3=I$w7#0>7TMZ0QDH9g~2t-Z@0md~SvlqY>7q2NH06S3N BNLv5^ diff --git a/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif b/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif index e6a9e60d5ddd1243fbbf2197b4dc6cd9c1b58b93..fd27edfaaa29a70a8c4563c0eab9f18c74d374fd 100644 GIT binary patch delta 270 zcmV+p0rCFX0@wl&M@dFFIbjk25&-lc0C`{zkq}gWCJF+oiUI%t03rDV1poja04x9i z000sI5&%F2)!-+JP-&K7%&eE7zha(Mk#X<1{oe683qw@BL@`@2pbbn6B`H)6*`?PtqlrLxC~PZrGN+% zE&vU~#TXL^jVmoMhlVv1IR^#>3>*Rg2{s7;0vrr}2N2W=TMrHb0uEwT<0=*g4h65Q U1r7!lv`7aQ0sjH?nF;{_JD=x5hyVZp delta 271 zcmV+q0r39V0@(r(M@dFFIbjk25&+Z?0453okq}gWd0-BziUI%t03rDV0RR9W04x9i z000sI5&!@N*5D_KP-&K9N=8QJd6^MGDoHFCB1y=#5VX{x;y`RB48~-Ga8wQ>h#?`F zTrSD$M3OMjAdy9t(NHAIO37j-Eo?9tg#s>zZwlT+1~Gwm8h(Hn69^dx2V!s-3=a<+ z0|Oj(k{b($iHwq&l93aYdI$^y9-5LK0}m612L=TU90DB)k_jCG91M5|5EKp@jU52N z03D4R4iqJ;3BC^w0s;=jUAi9-78(f%i;WBz2niY%K_3Se1`Y*FM+FWB7EmeH6b2d& V4jKj&;x*Of0sjHsjr$M+06RN6NSOct diff --git a/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif b/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif index cb99cdd9136fa30462a9f57aa6a0adeb7e4124e7..0cc9bb71cca4cdeafbb248ce7e07c3708c1cbd64 100644 GIT binary patch delta 264 zcmV+j0r&pa0@4ByM@dFFIbjk25&-lc0Q=+`kq}gWC=3F`xI_Q|03rDV1poja04x9i z000sI5&%F2&)_GDP-&KpRzaw7*n2_6C!6#^a!K{=W%7!?bX615c=6B?o`2^cO2 zcoM=c7zsElEfNF+&d-7v$p#C7H3(h^g0}_-5C=(GGudGrRNg8V1`i7u92^)64+a;o OM+X-H`T_N$Apkpuj7YZt delta 268 zcmV+n0rURS0@eZ$M@dFFIbjk25&+Z?04NLskq}gW`{WwLxI_Q|03rDV0RR9W04x9i z000sI5&!@N)8HqHP-&K9N=AmpFq#oTDp_dDHci{26|~f$@kn?Cm5RWVcr*?ph(R$C zG%6BFr6HIo3^YhYGr?3AiY&T{^|8V7w7SrQHo z1RaiZ6q6i?idh5$nwygp7?wp6oeuy28l4>&4~Yf~qLT=v2%Qpp2M`ty9FQFur2rir z1RM_*B?nWxk+Q-ZU$-9+7Yzyt5(*g^X$cAq7eOBf7X}Xt7#tiJ3l9btP$|+D21HH< S7T-0|;sN{t?%*Fn0028#VNAdP diff --git a/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif b/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif index 9faf1aff8f4b28e02f4f414975fe1859c43b6b54..0631c7616ec8624ddeee02b633326f697ee72f80 100644 GIT binary patch delta 276 zcmV+v0qg$X0^R};M@dFFIbjk25&-lc0MWuJkq}gWC=CMr@j3ti03rDV1poja04x9i z000sI5&%F2+u$dPQfZc>h%k}mS_`xd!)9v?GD=uwG!#n1P{Bx25L@HjmHz$20{ z93>Ts1_E((z8wcwL#Z4|1qR^|i5v)w!ugXVXaI_D!lF>PGz3-%90v;n3^s`y30029B7)0Cv delta 277 zcmV+w0qXwV0^b4/i),j="",c,f=this.head.match(/]*?)>/i);if(h&&h[1]){p=h[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(p){for(d=0,g=p.length;d",a);i.head=f.substring(0,a+1);var k=0,g;i.css="";while((k=i.head.indexOf("",k)+1;if((g=i.head.indexOf("\n'}i.head+=d.getParam("fullpage_default_doctype",'');i.head+="\n\n\n";if(h=d.getParam("fullpage_default_title")){i.head+=""+h+"\n"}if(h=d.getParam("fullpage_default_encoding")){i.head+='\n'}if(h=d.getParam("fullpage_default_font_family")){j+="font-family: "+h+";"}if(h=d.getParam("fullpage_default_font_size")){j+="font-size: "+h+";"}if(h=d.getParam("fullpage_default_text_color")){j+="color: "+h+";"}i.head+="\n\n";i.foot="\n\n"}},_getContent:function(a,c){var b=this;if(!c.source_view||!a.getParam("fullpage_hide_in_source_view")){c.content=tinymce.trim(b.head)+"\n"+tinymce.trim(c.content)+"\n"+tinymce.trim(b.foot);if(b.css){b._setStyle(a,b.css)}}},_setStyle:function(a,b){a.dom.remove("injectedCSS");var d=a.dom.doc,c=d.createElement("style");c.type="text/css";c.id="injectedCSS";if(c.styleSheet){c.styleSheet.cssText=b}else{c.appendChild(d.createTextNode(b))}d.getElementsByTagName("head")[0].appendChild(c)}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})(); \ No newline at end of file +(function(){var b=tinymce.each,a=tinymce.html.Node;tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(c,d){var e=this;e.editor=c;c.addCommand("mceFullPageProperties",function(){c.windowManager.open({file:d+"/fullpage.htm",width:430+parseInt(c.getLang("fullpage.delta_width",0)),height:495+parseInt(c.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:d,data:e._htmlToData()})});c.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});c.onBeforeSetContent.add(e._setContent,e);c.onGetContent.add(e._getContent,e)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_htmlToData:function(){var f=this._parseHeader(),h={},c,i,g,e=this.editor;function d(l,j){var k=l.attr(j);return k||""}h.fontface=e.getParam("fullpage_default_fontface","");h.fontsize=e.getParam("fullpage_default_fontsize","");i=f.firstChild;if(i.type==7){h.xml_pi=true;g=/encoding="([^"]+)"/.exec(i.value);if(g){h.docencoding=g[1]}}i=f.getAll("#doctype")[0];if(i){h.doctype=""}i=f.getAll("title")[0];if(i&&i.firstChild){h.metatitle=i.firstChild.value}b(f.getAll("meta"),function(m){var k=m.attr("name"),j=m.attr("http-equiv"),l;if(k){h["meta"+k.toLowerCase()]=m.attr("content")}else{if(j=="Content-Type"){l=/charset\s*=\s*(.*)\s*/gi.exec(m.attr("content"));if(l){h.docencoding=l[1]}}}});i=f.getAll("html")[0];if(i){h.langcode=d(i,"lang")||d(i,"xml:lang")}i=f.getAll("link")[0];if(i&&i.attr("rel")=="stylesheet"){h.stylesheet=i.attr("href")}i=f.getAll("body")[0];if(i){h.langdir=d(i,"dir");h.style=d(i,"style");h.visited_color=d(i,"vlink");h.link_color=d(i,"link");h.active_color=d(i,"alink")}return h},_dataToHtml:function(g){var f,d,h,j,k,e=this.editor.dom;function c(n,l,m){n.attr(l,m?m:undefined)}function i(l){if(d.firstChild){d.insert(l,d.firstChild)}else{d.append(l)}}f=this._parseHeader();d=f.getAll("head")[0];if(!d){j=f.getAll("html")[0];d=new a("head",1);if(j.firstChild){j.insert(d,j.firstChild,true)}else{j.append(d)}}j=f.firstChild;if(g.xml_pi){k='version="1.0"';if(g.docencoding){k+=' encoding="'+g.docencoding+'"'}if(j.type!=7){j=new a("xml",7);f.insert(j,f.firstChild,true)}j.value=k}else{if(j&&j.type==7){j.remove()}}j=f.getAll("#doctype")[0];if(g.doctype){if(!j){j=new a("#doctype",10);if(g.xml_pi){f.insert(j,f.firstChild)}else{i(j)}}j.value=g.doctype.substring(9,g.doctype.length-1)}else{if(j){j.remove()}}j=f.getAll("title")[0];if(g.metatitle){if(!j){j=new a("title",1);j.append(new a("#text",3)).value=g.metatitle;i(j)}}if(g.docencoding){j=null;b(f.getAll("meta"),function(l){if(l.attr("http-equiv")=="Content-Type"){j=l}});if(!j){j=new a("meta",1);j.attr("http-equiv","Content-Type");j.shortEnded=true;i(j)}j.attr("content","text/html; charset="+g.docencoding)}b("keywords,description,author,copyright,robots".split(","),function(m){var l=f.getAll("meta"),n,p,o=g["meta"+m];for(n=0;n"))},_parseHeader:function(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(this.head)},_setContent:function(g,d){var m=this,i,c,h=d.content,f,l="",e=m.editor.dom,j;function k(n){return n.replace(/<\/?[A-Z]+/g,function(o){return o.toLowerCase()})}if(d.format=="raw"&&m.head){return}if(d.source_view&&g.getParam("fullpage_hide_in_source_view")){return}h=h.replace(/<(\/?)BODY/gi,"<$1body");i=h.indexOf("",i);m.head=k(h.substring(0,i+1));c=h.indexOf("\n"}f=m._parseHeader();b(f.getAll("style"),function(n){if(n.firstChild){l+=n.firstChild.value}});j=f.getAll("body")[0];if(j){e.setAttribs(m.editor.getBody(),{style:j.attr("style")||"",dir:j.attr("dir")||"",vLink:j.attr("vlink")||"",link:j.attr("link")||"",aLink:j.attr("alink")||""})}e.remove("fullpage_styles");if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l);j=e.get("fullpage_styles");if(j.styleSheet){j.styleSheet.cssText=l}}},_getDefaultHeader:function(){var f="",c=this.editor,e,d="";if(c.getParam("fullpage_default_xml_pi")){f+='\n'}f+=c.getParam("fullpage_default_doctype",'');f+="\n\n\n";if(e=c.getParam("fullpage_default_title")){f+=""+e+"\n"}if(e=c.getParam("fullpage_default_encoding")){f+='\n'}if(e=c.getParam("fullpage_default_font_family")){d+="font-family: "+e+";"}if(e=c.getParam("fullpage_default_font_size")){d+="font-size: "+e+";"}if(e=c.getParam("fullpage_default_text_color")){d+="color: "+e+";"}f+="\n\n";return f},_getContent:function(d,e){var c=this;if(!e.source_view||!d.getParam("fullpage_hide_in_source_view")){e.content=tinymce.trim(c.head)+"\n"+tinymce.trim(e.content)+"\n"+tinymce.trim(c.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})(); \ No newline at end of file diff --git a/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js b/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js index 09ee085..23de7c5 100644 --- a/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +++ b/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js @@ -9,6 +9,8 @@ */ (function() { + var each = tinymce.each, Node = tinymce.html.Node; + tinymce.create('tinymce.plugins.FullPagePlugin', { init : function(ed, url) { var t = this; @@ -24,7 +26,7 @@ inline : 1 }, { plugin_url : url, - head_html : t.head + data : t._htmlToData() }); }); @@ -32,7 +34,6 @@ ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'}); ed.onBeforeSetContent.add(t._setContent, t); - ed.onSetContent.add(t._setBodyAttribs, t); ed.onGetContent.add(t._getContent, t); }, @@ -48,149 +49,355 @@ // Private plugin internal methods - _setBodyAttribs : function(ed, o) { - var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i), bddir = '',htattr, hattr = this.head.match(/]*?)>/i); + _htmlToData : function() { + var headerFragment = this._parseHeader(), data = {}, nodes, elm, matches, editor = this.editor; - if (attr && attr[1]) { - bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g); + function getAttr(elm, name) { + var value = elm.attr(name); - if (bdattr) { - for(i = 0, len = bdattr.length; i < len; i++) { - kv = bdattr[i].split('='); - k = kv[0].replace(/\s/,''); - v = kv[1]; + return value || ''; + }; - if (v) { - v = v.replace(/^\s+/,'').replace(/\s+$/,''); - t = v.match(/^["'](.*)["']$/); + // Default some values + data.fontface = editor.getParam("fullpage_default_fontface", ""); + data.fontsize = editor.getParam("fullpage_default_fontsize", ""); - if (t) - v = t[1]; - if(k == 'dir') - bddir = v; - } else - v = k; + // Parse XML PI + elm = headerFragment.firstChild; + if (elm.type == 7) { + data.xml_pi = true; + matches = /encoding="([^"]+)"/.exec(elm.value); + if (matches) + data.docencoding = matches[1]; + } - ed.dom.setAttrib(ed.getBody(), 'style', v); - } + // Parse doctype + elm = headerFragment.getAll('#doctype')[0]; + if (elm) + data.doctype = '"; + + // Parse title element + elm = headerFragment.getAll('title')[0]; + if (elm && elm.firstChild) { + data.metatitle = elm.firstChild.value; + } + + // Parse meta elements + each(headerFragment.getAll('meta'), function(meta) { + var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches; + + if (name) + data['meta' + name.toLowerCase()] = meta.attr('content'); + else if (httpEquiv == "Content-Type") { + matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content')); + + if (matches) + data.docencoding = matches[1]; } + }); + + // Parse html attribs + elm = headerFragment.getAll('html')[0]; + if (elm) + data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang'); + + // Parse stylesheet + elm = headerFragment.getAll('link')[0]; + if (elm && elm.attr('rel') == 'stylesheet') + data.stylesheet = elm.attr('href'); + + // Parse body parts + elm = headerFragment.getAll('body')[0]; + if (elm) { + data.langdir = getAttr(elm, 'dir'); + data.style = getAttr(elm, 'style'); + data.visited_color = getAttr(elm, 'vlink'); + data.link_color = getAttr(elm, 'link'); + data.active_color = getAttr(elm, 'alink'); } - //if found fetch the dir-attribute from the html-tag and apply it to the editor-body - if(bddir == '' && hattr && hattr[1]){ - htattr = hattr[1].match(/dir\s*=\s*["']([^"']*)["']/i); - if (htattr && htattr[1]) - bddir = htattr[1]; - } - bd = ed.getBody(); - bd.setAttribute('dir', bddir); + + return data; }, - _createSerializer : function() { - return new tinymce.dom.Serializer({ - dom : this.editor.dom, - indent : true, - apply_source_formatting : true, - indent_before : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,title,meta,head', - indent_after : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,title,meta,head' + _dataToHtml : function(data) { + var headerFragment, headElement, html, elm, value, dom = this.editor.dom; + + function setAttr(elm, name, value) { + elm.attr(name, value ? value : undefined); + }; + + function addHeadNode(node) { + if (headElement.firstChild) + headElement.insert(node, headElement.firstChild); + else + headElement.append(node); + }; + + headerFragment = this._parseHeader(); + headElement = headerFragment.getAll('head')[0]; + if (!headElement) { + elm = headerFragment.getAll('html')[0]; + headElement = new Node('head', 1); + + if (elm.firstChild) + elm.insert(headElement, elm.firstChild, true); + else + elm.append(headElement); + } + + // Add/update/remove XML-PI + elm = headerFragment.firstChild; + if (data.xml_pi) { + value = 'version="1.0"'; + + if (data.docencoding) + value += ' encoding="' + data.docencoding + '"'; + + if (elm.type != 7) { + elm = new Node('xml', 7); + headerFragment.insert(elm, headerFragment.firstChild, true); + } + + elm.value = value; + } else if (elm && elm.type == 7) + elm.remove(); + + // Add/update/remove doctype + elm = headerFragment.getAll('#doctype')[0]; + if (data.doctype) { + if (!elm) { + elm = new Node('#doctype', 10); + + if (data.xml_pi) + headerFragment.insert(elm, headerFragment.firstChild); + else + addHeadNode(elm); + } + + elm.value = data.doctype.substring(9, data.doctype.length - 1); + } else if (elm) + elm.remove(); + + // Add/update/remove title + elm = headerFragment.getAll('title')[0]; + if (data.metatitle) { + if (!elm) { + elm = new Node('title', 1); + elm.append(new Node('#text', 3)).value = data.metatitle; + addHeadNode(elm); + } + } + + // Add meta encoding + if (data.docencoding) { + elm = null; + each(headerFragment.getAll('meta'), function(meta) { + if (meta.attr('http-equiv') == 'Content-Type') + elm = meta; + }); + + if (!elm) { + elm = new Node('meta', 1); + elm.attr('http-equiv', 'Content-Type'); + elm.shortEnded = true; + addHeadNode(elm); + } + + elm.attr('content', 'text/html; charset=' + data.docencoding); + } + + // Add/update/remove meta + each('keywords,description,author,copyright,robots'.split(','), function(name) { + var nodes = headerFragment.getAll('meta'), i, meta, value = data['meta' + name]; + + for (i = 0; i < nodes.length; i++) { + meta = nodes[i]; + + if (meta.attr('name') == name) { + if (value) + meta.attr('content', value); + else + meta.remove(); + + return; + } + } + + if (value) { + elm = new Node('meta', 1); + elm.attr('name', name); + elm.attr('content', value); + elm.shortEnded = true; + + addHeadNode(elm); + } }); + + // Add/update/delete link + elm = headerFragment.getAll('link')[0]; + if (elm && elm.attr('rel') == 'stylesheet') { + if (data.stylesheet) + elm.attr('href', data.stylesheet); + else + elm.remove(); + } else if (data.stylesheet) { + elm = new Node('link', 1); + elm.attr({ + rel : 'stylesheet', + text : 'text/css', + href : data.stylesheet + }); + elm.shortEnded = true; + + addHeadNode(elm); + } + + // Update body attributes + elm = headerFragment.getAll('body')[0]; + if (elm) { + setAttr(elm, 'dir', data.langdir); + setAttr(elm, 'style', data.style); + setAttr(elm, 'vlink', data.visited_color); + setAttr(elm, 'link', data.link_color); + setAttr(elm, 'alink', data.active_color); + + // Update iframe body as well + dom.setAttribs(this.editor.getBody(), { + style : data.style, + dir : data.dir, + vLink : data.visited_color, + link : data.link_color, + aLink : data.active_color + }); + } + + // Set html attributes + elm = headerFragment.getAll('html')[0]; + if (elm) { + setAttr(elm, 'lang', data.langcode); + setAttr(elm, 'xml:lang', data.langcode); + } + + // Serialize header fragment and crop away body part + html = new tinymce.html.Serializer({ + validate: false, + indent: true, + apply_source_formatting : true, + indent_before: 'head,html,body,meta,title,script,link,style', + indent_after: 'head,html,body,meta,title,script,link,style' + }).serialize(headerFragment); + + this.head = html.substring(0, html.indexOf('')); + }, + + _parseHeader : function() { + // Parse the contents with a DOM parser + return new tinymce.html.DomParser({ + validate: false, + root_name: '#document' + }).parse(this.head); }, _setContent : function(ed, o) { - var t = this, sp, ep, c = o.content, v, st = ''; + var self = this, startPos, endPos, content = o.content, headerFragment, styles = '', dom = self.editor.dom, elm; + + function low(s) { + return s.replace(/<\/?[A-Z]+/g, function(a) { + return a.toLowerCase(); + }) + }; // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate - if (o.format == 'raw' && t.head) + if (o.format == 'raw' && self.head) return; if (o.source_view && ed.getParam('fullpage_hide_in_source_view')) return; // Parse out head, body and footer - c = c.replace(/<(\/?)BODY/gi, '<$1body'); - sp = c.indexOf('', sp); - t.head = c.substring(0, sp + 1); + if (startPos != -1) { + startPos = content.indexOf('>', startPos); + self.head = low(content.substring(0, startPos + 1)); - // Concatenate all