diff --git a/.gitignore b/.gitignore index 0facca209..998341198 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ config/database.yml config/backgroundrb.yml db/schema.rb public/blank.html +public/robots.txt public/images/active_scaffold/DO_NOT_EDIT public/javascripts/cache/ public/stylesheets/active_scaffold/DO_NOT_EDIT diff --git a/UPGRADE b/UPGRADE index 05e41201c..2d37db0cb 100644 --- a/UPGRADE +++ b/UPGRADE @@ -33,6 +33,21 @@ GENERAL NOTE: if you are upgrading your production Kete instance rather than dev GENERAL NOTE: if you are running in production mode, you may also want to do a "rake tmp:cache:clear" as your last step to any of these. However, if you updated your code via a Capistrano deploy, this is probably not necessary. +== 2008/10/01 - Private files need to be copied to system folder + +Due to a missing configuration in the Capistrano deployment recipes, private files were archived every time the site was deploy. +A fix has been committed which resolves the problem for future deployments. But you need to manually copy the old private files +from the releases/[timestamp]/private directory to the new system folder at shared/system/private + +== 2008/09/26 - Backgroundrb configuration yml file updated + +1. Stop your Backgroundrb processes +2. Update packet by running + sudo gem update packet +3. Open up background.yml and add the following line to the :backgroundrb: section and save + :persistent_disabled: true +2. Start your Backgroundrb processes + == 2008/09/17 - CSS "tags" Identifier Changed To fix an IE6 specific printing bug, the CSS identifier "tags" has been changed to "tags-box". If you are running Kete with a custom theme, be sure to update your theme templates and CSS files to refer to the new "tags-box" CSS identifier, and not the older "tags". diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 82e887cec..6baaf9351 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -158,7 +158,7 @@ def show @extended_fields = @user.xml_attributes else flash[:notice] = "You must be logged in to view user profiles." - redirect_to :action => 'index' + redirect_to :action => 'login' end end diff --git a/app/controllers/application.rb b/app/controllers/application.rb index befb1f4ea..bdf40a42b 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -306,7 +306,7 @@ def expire_show_caches if caches_controllers.include?(params[:controller]) # James - 2008-07-01 # Ensure caches are expired in the context of privacy. - item = item_from_controller_and_id + item = item_from_controller_and_id(false) item.private_version! if item.respond_to?(:private) && item.latest_version_is_private? expire_show_caches_for(item) @@ -853,7 +853,7 @@ def rss_tag(options = { }) if auto_detect tag += "\" />" else - tag += "\">" # A tag has a closing + tag += "tabindex='1' \">" # A tag has a closing end end diff --git a/app/controllers/baskets_controller.rb b/app/controllers/baskets_controller.rb index c59c44255..54d53d303 100644 --- a/app/controllers/baskets_controller.rb +++ b/app/controllers/baskets_controller.rb @@ -1,33 +1,13 @@ class BasketsController < ApplicationController ### TinyMCE WYSIWYG editor stuff - uses_tiny_mce(:options => { :theme => 'advanced', - :mode => "textareas", - :convert_urls => false, - :content_css => "/stylesheets/base.css", - :remove_script_host => true, - :theme_advanced_toolbar_location => "top", - :theme_advanced_toolbar_align => "left", - :theme_advanced_resizing => true, - :theme_advanced_resize_horizontal => false, - :theme_advanced_buttons1 => %w{ bold italic underline strikethrough separator justifyleft justifycenter justifyright indent outdent separator bullist numlist forecolor backcolor separator link unlink image undo redo code}, - :theme_advanced_buttons2 => %w{ formatselect fontselect fontsizeselect pastetext pasteword selectall }, - :theme_advanced_buttons3_add => %w{ tablecontrols fullscreen}, - :editor_selector => 'mceEditor', - :paste_create_paragraphs => true, - :paste_create_linebreaks => true, - :paste_use_dialog => true, - :paste_auto_cleanup_on_paste => true, - :paste_convert_middot_lists => false, - :paste_unindented_list_class => "unindentedList", - :paste_convert_headers_to_strong => true, - :paste_insert_word_content_callback => "convertWord", - :plugins => %w{ contextmenu paste table fullscreen} }, - :only => [:new, :pick, :create, :edit, :update, :homepage_options]) + uses_tiny_mce :options => DEFAULT_TINYMCE_SETTINGS, + :only => VALID_TINYMCE_ACTIONS ### end TinyMCE WYSIWYG editor stuff permit "site_admin or admin of :current_basket", :except => [:index, :list, :show, :choose_type, :permission_denied] after_filter :repopulate_basket_permissions, :only => [:create, :destroy] + after_filter :remove_robots_txt_cache, :only => [:create, :update, :destroy] def index list @@ -267,4 +247,11 @@ def repopulate_basket_permissions session[:has_access_on_baskets] = current_user.get_basket_permissions end + # Kieran Pilkington, 2008/10/01 + # When a basket is created, edited, or deleted, we have to clear + # the robots txt file caches to the new settings take effect + def remove_robots_txt_cache + expire_page "/robots.txt" + end + end diff --git a/app/controllers/importers_controller.rb b/app/controllers/importers_controller.rb index 446bb6fbc..a4268d5ce 100644 --- a/app/controllers/importers_controller.rb +++ b/app/controllers/importers_controller.rb @@ -13,29 +13,8 @@ class ImportersController < ApplicationController permit "site_admin or admin of :current_basket or tech_admin of :site or member of :current_basket or moderater of :current_basket", :only => [:new_related_set_from_archive_file, :create] ### TinyMCE WYSIWYG editor stuff - uses_tiny_mce(:options => { :theme => 'advanced', - :mode => "textareas", - :convert_urls => false, - :content_css => "/stylesheets/kete.css", - :remove_script_host => true, - :theme_advanced_toolbar_location => "top", - :theme_advanced_toolbar_align => "left", - :theme_advanced_resizing => true, - :theme_advanced_resize_horizontal => false, - :theme_advanced_buttons1 => %w{ bold italic underline strikethrough separator justifyleft justifycenter justifyright indent outdent separator bullist numlist forecolor backcolor separator link unlink image undo redo code}, - :theme_advanced_buttons2 => %w{ formatselect fontselect fontsizeselect pastetext pasteword selectall }, - :theme_advanced_buttons3_add => %w{ tablecontrols fullscreen}, - :editor_selector => 'mceEditor', - :paste_create_paragraphs => true, - :paste_create_linebreaks => true, - :paste_use_dialog => true, - :paste_auto_cleanup_on_paste => true, - :paste_convert_middot_lists => false, - :paste_unindented_list_class => "unindentedList", - :paste_convert_headers_to_strong => true, - :paste_insert_word_content_callback => "convertWord", - :plugins => %w{ contextmenu paste table fullscreen} }, - :only => [:new, :new_related_set_from_archive_file]) + uses_tiny_mce :options => DEFAULT_TINYMCE_SETTINGS, + :only => VALID_TINYMCE_ACTIONS ### end TinyMCE WYSIWYG editor stuff # Get the Privacy Controls helper diff --git a/app/controllers/index_page_controller.rb b/app/controllers/index_page_controller.rb index 2f11a22da..39e9dd45f 100644 --- a/app/controllers/index_page_controller.rb +++ b/app/controllers/index_page_controller.rb @@ -1,4 +1,6 @@ class IndexPageController < ApplicationController + caches_page :robots + def index if !@current_basket.index_page_redirect_to_all.blank? redirect_to_all_for(@current_basket.index_page_redirect_to_all) @@ -61,13 +63,10 @@ def index stats_by_type_for(@current_basket) end - # prepare blog list of most recent topics # replace limit with param from basket - @recent_topics_limit = @current_basket.index_page_number_of_recent_topics - if @recent_topics_limit.blank? - @recent_topics_limit = 0 - end + @recent_topics_limit = @current_basket.index_page_number_of_recent_topics.blank? ? 0 : @current_basket.index_page_number_of_recent_topics + # exclude index_topic if @recent_topics_limit > 0 recent_query_hash = { :limit => @recent_topics_limit, :order => 'created_at desc'} @@ -242,4 +241,12 @@ def validate_kete_net_link render(:xml => { :url => SITE_URL, :datetime => "#{Time.new.utc.xmlschema}" }) end + # page that tells search engines where not to go + # search forms, rss feeds, user comments etc + def robots + @baskets = Basket.all + @controller_names = ZOOM_CLASSES.collect { |name| zoom_class_controller(name) } + render :action => 'robots', :layout => false + end + end diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 1fbe51c91..f70a8ff33 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -22,7 +22,7 @@ def list @rss_tag_link = rss_tag(:auto_detect => false, :replace_page_with_rss => true) # list people who have all other roles - @current_basket.accepted_roles.each do |role| + @current_basket.accepted_roles(true).each do |role| role_plural = role.name.pluralize # we cover members above if role_plural != 'members' diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 5da4a4bb9..0778c2db8 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -134,7 +134,7 @@ def search @contributor = params[:contributor] ? User.find(params[:contributor]) : nil # calculate where to start and end based on page - @current_page = params[:page] ? params[:page].to_i : 1 + @current_page = (params[:page] && params[:page].to_i > 0) ? params[:page].to_i : 1 @next_page = @current_page + 1 @previous_page = @current_page - 1 @@ -221,17 +221,17 @@ def rss def load_results(from_result_set) @results = Array.new + # protect against malformed requests + # for a start record that is more than the numbers of matching records, return a 404 + # since it only seems to be bots that make the malformed request @end_record = from_result_set.size if from_result_set.size < @end_record + if @start_record > @end_record + rescue_404 + return false + end if from_result_set.size > 0 still_image_results = Array.new - # protect against malformed requests - # for a start record that is more than the numbers of matching records - # not handling adjust @start_record in view - # since it only seems to be bots that make the malformed request - if @start_record > @end_record - @start_record = 0 - end # get the raw xml results from zoom raw_results = Module.class_eval(@current_class).records_from_zoom_result_set( :result_set => from_result_set, @@ -447,22 +447,34 @@ def terms_to_page_url_redirect end if !params[:search_terms].blank? + # we are searching location_hash.merge!({ :search_terms_slug => to_search_terms_slug(params[:search_terms]), :search_terms => params[:search_terms], :action => 'for' }) else + # we are viewing all location_hash.merge!({ :action => 'all' }) end + # If we're searching by tag, this will be set if !params[:tag].blank? location_hash.merge!({ :tag => params[:tag] }) end + # If we're searching by contributor, this will be set if !params[:contributor].blank? location_hash.merge!({ :contributor => params[:contributor] }) end - logger.info("terms_to_page_url_redirect hash: " + location_hash.inspect) + # If we're searching by relation, these will be set + if !params[:source_controller_singular].blank? + location_hash.merge!({ :source_controller_singular => params[:source_controller_singular] }) + end + if !params[:source_item].blank? + location_hash.merge!({ :source_item => params[:source_item] }) + end + + logger.debug("terms_to_page_url_redirect hash: " + location_hash.inspect) redirect_to url_for(location_hash) end @@ -876,7 +888,7 @@ def store_results_for_slideshow # if @results_sets is emtpy, then @result_sets[@current_class] is nil so we have # to stop here if thats the case, or we get a 500 error calling .size below - return if @result_sets[@current_class].nil? + return if @result_sets[@current_class].nil? or @displaying_error results = @results.map{ |r| r['url'] } diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 06138ee60..58cfc2a4c 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -19,29 +19,8 @@ class TopicsController < ApplicationController # the code should easily transferred to something else if we decide to drop it ### TinyMCE WYSIWYG editor stuff - uses_tiny_mce(:options => { :theme => 'advanced', - :mode => "textareas", - :convert_urls => false, - :content_css => "/stylesheets/base.css", - :remove_script_host => true, - :theme_advanced_toolbar_location => "top", - :theme_advanced_toolbar_align => "left", - :theme_advanced_resizing => true, - :theme_advanced_resize_horizontal => false, - :theme_advanced_buttons1 => %w{ bold italic underline strikethrough separator justifyleft justifycenter justifyright indent outdent separator bullist numlist forecolor backcolor separator link unlink image undo redo code}, - :theme_advanced_buttons2 => %w{ formatselect fontselect fontsizeselect pastetext pasteword selectall }, - :theme_advanced_buttons3_add => %w{ tablecontrols fullscreen}, - :editor_selector => 'mceEditor', - :paste_create_paragraphs => true, - :paste_create_linebreaks => true, - :paste_use_dialog => true, - :paste_auto_cleanup_on_paste => true, - :paste_convert_middot_lists => false, - :paste_unindented_list_class => "unindentedList", - :paste_convert_headers_to_strong => true, - :paste_insert_word_content_callback => "convertWord", - :plugins => %w{ contextmenu paste table fullscreen} }, - :only => [:new, :pick, :create, :edit, :update, :pick_topic_type]) + uses_tiny_mce :options => DEFAULT_TINYMCE_SETTINGS, + :only => VALID_TINYMCE_ACTIONS ### end TinyMCE WYSIWYG editor stuff # stuff related to flagging and moderation diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9117f1e6d..607b152b3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -31,7 +31,7 @@ def header_links_to_baskets if baskets_limit < total_baskets_count html += '
  • ' + link_to_unless_current('more...', url_for(:urlified_name => @site_basket.urlified_name, - :controller => 'baskets' )) + '
  • ' + :controller => 'baskets' ), {:tabindex => '2'}) + '' end html += '' @@ -44,7 +44,7 @@ def header_links_to_baskets def header_link_to_current_basket html = String.new - html += ': ' + link_to_index_for(@current_basket, { :class => 'basket' }) if @current_basket != @site_basket + html += ': ' + link_to_index_for(@current_basket, { :class => 'basket', :tabindex => '2' }) if @current_basket != @site_basket end def search_link_to_searched_basket @@ -67,22 +67,22 @@ def header_browse_links site_link_text = @site_basket.name privacy_type = (@current_basket.private_default_with_inheritance? && permitted_to_view_private_items?) ? 'private' : nil current_basket_html = " or " + link_to_unless_current( @current_basket.name, - :controller => 'search', + {:controller => 'search', :action => 'all', :urlified_name => @current_basket.urlified_name, :controller_name_for_zoom_class => 'topics', :trailing_slash => true, - :privacy_type => privacy_type ) + :privacy_type => privacy_type}, {:tabindex => '2'} ) else site_link_text = 'Browse' end html += pre_text + link_to_unless_current( site_link_text, - :controller => 'search', + {:controller => 'search', :action => 'all', :urlified_name => @site_basket.urlified_name, :controller_name_for_zoom_class => 'topics', - :trailing_slash => true ) + current_basket_html + '' + :trailing_slash => true}, {:tabindex => '2'} ) + current_basket_html + '' end def header_add_links @@ -97,17 +97,19 @@ def header_add_links pre_text = 'Add item to ' site_link_text = @site_basket.name current_basket_html = " or " + link_to_unless_current( @current_basket.name, - :controller => 'baskets', + {:controller => 'baskets', :action => 'choose_type', - :urlified_name => @current_basket.urlified_name) + :urlified_name => @current_basket.urlified_name}, + {:tabindex => '2'}) else site_link_text = 'Add item' end html += pre_text + link_to_unless_current( site_link_text, - :controller => 'baskets', + {:controller => 'baskets', :action => 'choose_type', - :urlified_name => @site_basket.urlified_name) + current_basket_html + '' + :urlified_name => @site_basket.urlified_name}, + {:tabindex => '2'}) + current_basket_html + '' end @@ -164,10 +166,11 @@ def render_baskets_as_menu if basket.topics.count > basket_topic_count && basket_topic_count > 0 html += content_tag("li", link_to("More..", - :controller => 'search', + {:controller => 'search', :action => 'all', :urlified_name => basket.urlified_name, - :controller_name_for_zoom_class => 'topics')) + :controller_name_for_zoom_class => 'topics'}, + {:tabindex => '2'})) end html += '' @@ -228,9 +231,9 @@ def link_to_last_stored_location def link_to_cancel if session[:return_to].blank? - return link_to("Cancel", :action => 'list') + return link_to("Cancel", :action => 'list', :tabindex => '1') else - return link_to("Cancel", url_for(session[:return_to])) + return link_to("Cancel", url_for(session[:return_to]), :tabindex => '1') end end @@ -281,7 +284,7 @@ def link_to_add_item(options={}) phrase += ' in ' + @current_basket.name end - return link_to(phrase, :controller => zoom_class_controller(item_class), :action => :new) + return link_to(phrase, {:controller => zoom_class_controller(item_class), :action => :new}, :tabindex => '1') end def link_to_add_related_item(options={}) @@ -305,7 +308,7 @@ def link_to_link_related_item(options={}) :related_class => options[:related_class], :relate_to_topic => options[:relate_to_topic], :function => "add" }, - :popup => ['links', 'height=500,width=500,scrollbars=yes,top=100,left=100,resizable=yes']) + {:popup => ['links', 'height=500,width=500,scrollbars=yes,top=100,left=100,resizable=yes']}) end def link_to_unlink_related_item(options={}) @@ -438,7 +441,7 @@ def tags_for(item) def tags_input_field(form,label_for) "
    - #{form.text_field :tag_list}
    " + #{form.text_field :tag_list, :tabindex => '1'}" end #---- related to extended_fields for either topic_types or content_types diff --git a/app/helpers/baskets_helper.rb b/app/helpers/baskets_helper.rb index d3cf462cb..ea454c944 100644 --- a/app/helpers/baskets_helper.rb +++ b/app/helpers/baskets_helper.rb @@ -5,11 +5,11 @@ def link_to_link_index_topic(options={}) :action => :find_index, :current_basket_id => options[:current_basket_id], :current_homepage_id => options[:current_homepage_id] }, - :popup => ['links', 'height=500,width=500,scrollbars=yes,top=100,left=100'] + :popup => ['links', 'height=500,width=500,scrollbars=yes,top=100,left=100'], :tabindex => '1' end def link_to_add_index_topic(options={}) - link_to options[:phrase], :controller => 'topics', :action => :new, :index_for_basket => options[:index_for_basket] + link_to options[:phrase], {:controller => 'topics', :action => :new, :index_for_basket => options[:index_for_basket]}, :tabindex => '1' end def toggle_elements_applicable(listenToThisElementID, whenElementValueCondition, whenElementValueThis, toggleThisElementID, listenToElementIsCheckbox=false) diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 8bf642c14..4b245b00f 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -6,11 +6,11 @@ module SearchHelper def link_to_zoom_class_results(zoom_class,results_count) if params[:action] == 'all' link_to("#{zoom_class_plural_humanize(zoom_class)} (#{number_with_delimiter(results_count)})", - :overwrite_params => {:controller_name_for_zoom_class => zoom_class_controller(zoom_class), :page => nil}, - :trailing_slash => true) + {:overwrite_params => {:controller_name_for_zoom_class => zoom_class_controller(zoom_class), :page => nil}, + :trailing_slash => true}, :tabindex => '1') else link_to("#{zoom_class_plural_humanize(zoom_class)} (#{number_with_delimiter(results_count)})", - :overwrite_params => {:controller_name_for_zoom_class => zoom_class_controller(zoom_class), :page => nil}) + {:overwrite_params => {:controller_name_for_zoom_class => zoom_class_controller(zoom_class), :page => nil}}, :tabindex => '1') end end diff --git a/app/views/account/_userForm.rhtml b/app/views/account/_userForm.rhtml index 4368b30c9..ad1ab04b9 100644 --- a/app/views/account/_userForm.rhtml +++ b/app/views/account/_userForm.rhtml @@ -2,6 +2,6 @@


    -<%= text_field 'user', 'email' %> +<%= text_field 'user', 'email', :tabindex => '1' %> <%=

    diff --git a/app/views/account/activate.rhtml b/app/views/account/activate.rhtml index be114b0e5..ffa553b0e 100644 --- a/app/views/account/activate.rhtml +++ b/app/views/account/activate.rhtml @@ -7,12 +7,12 @@
    - <%= text_field_tag(:activation_code, params[:activation_code], :size=>50 ) %> + <%= text_field_tag(:activation_code, params[:activation_code], {:size=>50, :tabindex => '1'} ) %>
    - <%= submit_tag 'Activate' %> + <%= submit_tag 'Activate', :tabindex => '1' %> <% end %> diff --git a/app/views/account/change_password.rhtml b/app/views/account/change_password.rhtml index 04cc2e8c3..f934b5101 100644 --- a/app/views/account/change_password.rhtml +++ b/app/views/account/change_password.rhtml @@ -6,17 +6,17 @@


    -<%= password_field_tag 'old_password', @old_password %>

    +<%= password_field_tag 'old_password', @old_password, :tabindex => '1' %>


    -<%= password_field_tag 'password' %>

    +<%= password_field_tag 'password', nil, :tabindex => '1' %>


    -<%= password_field_tag 'password_confirmation' %>

    +<%= password_field_tag 'password_confirmation', nil, :tabindex => '1' %>

    -

    <%= submit_tag 'Change password' %>

    +

    <%= submit_tag 'Change password', :tabindex => '1' %>

    <% end %> <%= render(:partial => "topics/content_wrapper_end" ) %> \ No newline at end of file diff --git a/app/views/account/edit.rhtml b/app/views/account/edit.rhtml index 449157d6a..fca2f25ea 100644 --- a/app/views/account/edit.rhtml +++ b/app/views/account/edit.rhtml @@ -9,11 +9,11 @@ <%= error_messages_for :user %>
    - <%= f.text_field :login %> + <%= f.text_field :login, :tabindex => '1' %>
    Your username must be unique and contain no spaces. You will be asked for this and your password everytime you login. If your names is "John Smith" then you could use "jsmith" as your login.
    - <%= f.text_field :email %> + <%= f.text_field :email, :tabindex => '1' %>
    @@ -34,13 +34,13 @@ -
    <%= submit_tag 'Save' %>
    +
    <%= submit_tag 'Save', :tabindex => '1' %>
    <% end -%>
    diff --git a/app/views/account/forgot_password.rhtml b/app/views/account/forgot_password.rhtml index 9262de919..b405502e6 100644 --- a/app/views/account/forgot_password.rhtml +++ b/app/views/account/forgot_password.rhtml @@ -7,12 +7,12 @@
    - <%= form.text_field :email, :size => 50 %> + <%= form.text_field :email, {:size => 50, :tabindex => '1'} %>

     

    -
    <%= submit_tag "Request Password" %>
    +
    <%= submit_tag "Request Password", :tabindex => '1' %>
    <% end %> <%= render(:partial => "topics/content_wrapper_end" ) %> \ No newline at end of file diff --git a/app/views/account/login.rhtml b/app/views/account/login.rhtml index 5cd1318d4..6915f21ae 100644 --- a/app/views/account/login.rhtml +++ b/app/views/account/login.rhtml @@ -31,9 +31,9 @@ <% if IS_CONFIGURED -%>

    Are you registered? You will need to <%= link_to("register", - :controller => 'account', + {:controller => 'account', :action => 'signup', - :urlified_name => 'site') -%> first before you can login.

    + :urlified_name => 'site'}, :tabindex => '1') -%> first before you can login.

    <% else -%>

    Please enter the default administrator account login and password to continue to configuration of the site.

    @@ -41,25 +41,25 @@
    - <%= text_field_tag 'login' %> + <%= text_field_tag 'login', nil, :tabindex => '1' %>
    - <%= password_field_tag 'password' %> + <%= password_field_tag 'password', nil, :tabindex => '1' %>
    <% if IS_CONFIGURED -%>
    - <%= check_box_tag 'remember_me' %> + <%= check_box_tag 'remember_me', "1", false, :tabindex => '1' %>
    -

    Forgot your password? <%= link_to('Click here', :controller => 'account', :action => 'forgot_password', :urlified_name => 'site') -%>

    +

    Forgot your password? <%= link_to('Click here', {:controller => 'account', :action => 'forgot_password', :urlified_name => 'site'}, :tabindex => '1') -%>

    <% end -%> -
    <%= submit_tag 'Log in',:class => "login-button" %>
    +
    <%= submit_tag 'Log in',{:class => "login-button", :tabindex => '1'} %>
    <% end -%> <% end -%> diff --git a/app/views/account/reset_password.rhtml b/app/views/account/reset_password.rhtml index 7c51cb774..c432fdb12 100644 --- a/app/views/account/reset_password.rhtml +++ b/app/views/account/reset_password.rhtml @@ -7,13 +7,13 @@
    - <%= form.password_field :password %> + <%= form.password_field :password, :tabindex => '1' %>
    - <%= form.password_field :password_confirmation %> + <%= form.password_field :password_confirmation, :tabindex => '1' %>
    - <%= submit_tag "Reset Your Password" %> + <%= submit_tag "Reset Your Password", :tabindex => '1' %> <% end %> diff --git a/app/views/account/signup.rhtml b/app/views/account/signup.rhtml index 76d527e42..c3409af9e 100644 --- a/app/views/account/signup.rhtml +++ b/app/views/account/signup.rhtml @@ -8,17 +8,17 @@ <%= error_messages_for :user %>
    - <%= f.text_field :login %> + <%= f.text_field :login, :tabindex => '1' %>
    Your login needs to be unique and contain no spaces. You will be asked for this and your password everytime you login. If your names is "John Smith" then you could use "jsmith" as your login.
    - <%= f.text_field :email %> + <%= f.text_field :email, :tabindex => '1' %>
    - <%= f.password_field :password %> + <%= f.password_field :password, :tabindex => '1' %>
    - <%= f.password_field :password_confirmation %> + <%= f.password_field :password_confirmation, :tabindex => '1' %>
    <% form_fields = @content_type.content_type_to_field_mappings -%> @@ -36,39 +36,37 @@ <%= render :partial => 'topics/license_chooser_or_agreement',:locals => {:item => @user} %>
    -<%= hidden_field_tag "captcha_type", @captcha_type %> +<%= hidden_field_tag "captcha_type", @captcha_type, :tabindex => '1' %>
    <% if @captcha_type == 'image' -%> - - -
    <%= f.text_field :security_code, :size => '8' %>
    -<% id = generate_captcha() -%> -<% session[:captcha_id] = id -%> -security image -
    Text is case sensitive -<% if CAPTCHA_TYPE == 'all' -%> -

    or use a <%= link_to 'non-image security question', :captcha_type => 'question' -%>

    -
    -<% end -%> -
    + +
    <%= f.text_field :security_code, {:size => '8', :tabindex => '1'} %>
    + <% id = generate_captcha() -%> + <% session[:captcha_id] = id -%> + security image +
    + Text is case sensitive + <% if CAPTCHA_TYPE == 'all' -%> +

    or use a <%= link_to 'non-image security question', {:captcha_type => 'question'}, :tabindex => '1' -%>

    + <% end -%> +
    <% elsif @captcha_type == 'question' -%> -<%= render :partial => '/captcha' %> + <%= render :partial => '/captcha' %> <% end -%>
    -
    -<%= f.check_box :agree_to_terms %> I agree that I have read and accept the -<%= link_to_remote("Terms and conditions", :update => 'disclaimer', :url => { :action => :disclaimer, :id => 4 }) %>, -<%= link_to_remote("Privacy policy", :update => 'disclaimer', :url => { :action => :disclaimer, :id => 5 }) %>, and -<%= link_to_remote("House Rules", :update => 'disclaimer', :url => { :action => :disclaimer, :id => 2 }) %>. +<%= f.check_box :agree_to_terms, :tabindex => '1' %> I agree that I have read and accept the +<%= link_to_remote("Terms and conditions", :update => 'disclaimer', :url => { :action => :disclaimer, :id => 4 }, :html => {:tabindex => '1'}) %>, +<%= link_to_remote("Privacy policy", :update => 'disclaimer', :url => { :action => :disclaimer, :id => 5 }, :html => {:tabindex => '1'}) %>, and +<%= link_to_remote("House Rules", :update => 'disclaimer', :url => { :action => :disclaimer, :id => 2 }, :html => {:tabindex => '1'}) %>.
    -
    <%= submit_tag 'Sign up', :class => "save-button" %>
    +
    <%= submit_tag 'Sign up', {:class => "save-button", :tabindex => '1'} %>
    <% end -%> diff --git a/app/views/audio/_form.rhtml b/app/views/audio/_form.rhtml index 2ad049ed6..4c345fed6 100644 --- a/app/views/audio/_form.rhtml +++ b/app/views/audio/_form.rhtml @@ -14,7 +14,7 @@ <% if edit and @site_admin %>
    - <%= form.select 'basket_id', @baskets %> + <%= form.select 'basket_id', @baskets, {}, :tabindex => '1' %>
    <% end -%> @@ -23,11 +23,11 @@ @@ -41,11 +41,11 @@ <% end %>
    - <%= form.text_field :title %>
    + <%= form.text_field :title, :tabindex => '1' %>
    - <%= form.text_area :description, :class => "mceEditor", :cols => 120 %> + <%= form.text_area :description, {:class => "mceEditor", :cols => 120, :tabindex => '1'} %>
    Note: forms and javascript are not allowed for security reasons. @@ -58,11 +58,11 @@ <% if @site_admin -%>
    - <%= form.check_box :do_not_sanitize %>
    + <%= form.check_box :do_not_sanitize, :tabindex => '1' %>
    <% end -%> <% if show_privacy_controls_for?(@audio_recording) %> -
    <%= form.radio_button :file_private, false, file_private_radio_options(@audio_recording) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@audio_recording) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    +
    <%= form.radio_button :file_private, false, file_private_radio_options(@audio_recording).merge({:tabindex => '1'}) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@audio_recording).merge({:tabindex => '1'}) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    Please note that once public, an attached audio recording cannot be made private.
    <% else %> <%# Use the default %> @@ -76,7 +76,7 @@ # we'll likely re-enable this -%> <% if !edit -%>
    - <%= form.file_field :uploaded_data %>
    + <%= form.file_field :uploaded_data, :tabindex => '1' %>
    <% end -%> <% form_fields = @content_type.content_type_to_field_mappings -%> @@ -93,7 +93,7 @@ <% # delete the last version_comment's value @audio_recording.version_comment = nil -%> - <%= form.text_field :version_comment %> + <%= form.text_field :version_comment, :tabindex => '1' %>
    <% end -%> <%= render :partial => 'topics/license_chooser_or_agreement',:locals => {:item => @audio_recording} %> diff --git a/app/views/audio/edit.rhtml b/app/views/audio/edit.rhtml index b01a3bf6e..953ad9700 100644 --- a/app/views/audio/edit.rhtml +++ b/app/views/audio/edit.rhtml @@ -8,7 +8,7 @@ :id => @audio_recording }, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag 'Save' , :class => "save-button" %>
    +
    <%= submit_tag 'Save' , {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/audio/new.rhtml b/app/views/audio/new.rhtml index 5bbad1d99..8307012a9 100644 --- a/app/views/audio/new.rhtml +++ b/app/views/audio/new.rhtml @@ -6,7 +6,7 @@ :url => { :action => 'create'}, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag "Create", :class => "save-button" %>
    +
    <%= submit_tag "Create", {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/baskets/_actions_menu.rhtml b/app/views/baskets/_actions_menu.rhtml index b0de8199c..f861923c6 100644 --- a/app/views/baskets/_actions_menu.rhtml +++ b/app/views/baskets/_actions_menu.rhtml @@ -20,22 +20,22 @@
  • <% end -%> <%= link_to "#{tab_label}", - :action => tab_action, + {:action => tab_action, :controller => tab_controller, - :id => item %>
  • + :id => item}, :tabindex => '1' %> <% tab_count += 1 -%> <% end -%> <% if @tech_admin -%>
  • <%= link_to "Importers", - :action => :list, - :controller => 'importers' %>
  • + {:action => :list, + :controller => 'importers'}, :tabindex => '1' %> <% end -%> <% if @current_basket != @site_basket -%>
  • <%= link_to "Delete", {:action => :destroy, :id => item}, :method => :post, - :confirm => 'Are you sure? All items in this basket will be deleted forever!'%>
  • + :confirm => 'Are you sure? All items in this basket will be deleted forever!', :tabindex => '1' %> <% end -%> diff --git a/app/views/baskets/_form.rhtml b/app/views/baskets/_form.rhtml index f49c5c933..12424e46c 100644 --- a/app/views/baskets/_form.rhtml +++ b/app/views/baskets/_form.rhtml @@ -4,13 +4,13 @@
    - <%= form.text_field :name %> + <%= form.text_field :name, :tabindex => '1' %>
    - <%= select_tag 'settings[fully_moderated]', @basket.moderation_select_options, "id" => "settings_fully_moderated" %> + <%= select_tag 'settings[fully_moderated]', @basket.moderation_select_options, {"id" => "settings_fully_moderated", :tabindex => '1'} %>
    <% # make hidden and disabled to start @@ -22,7 +22,7 @@ <% ZOOM_CLASSES.each do |zoom_class| -%> /> + ' checked="checked"' if !@basket.settings[:moderated_except].blank? && @basket.settings[:moderated_except].include?(zoom_class) -%> tabindex="1" /> <%= zoom_class_plural_humanize(zoom_class) %>
    <% end -%> @@ -35,7 +35,7 @@
    - <%= form.radio_button :show_privacy_controls, 'true' %> + <%= form.radio_button :show_privacy_controls, 'true', :tabindex => '1' %>
    Enable Privacy Controls if members of this basket can have @@ -45,7 +45,7 @@
    - <%= form.radio_button :show_privacy_controls, 'false' %> + <%= form.radio_button :show_privacy_controls, 'false', :tabindex => '1' %>
    @@ -60,7 +60,7 @@ <% if @basket != @site_basket %>
    - <%= form.radio_button :show_privacy_controls, '' %> + <%= form.radio_button :show_privacy_controls, '', :tabindex => '1' %>
    Inherit this setting from the Site basket.
    @@ -82,20 +82,20 @@
    - <%= form.radio_button :private_default, 'false' %> + <%= form.radio_button :private_default, 'false', :tabindex => '1' %>
    Can be viewed by everyone
    - <%= form.radio_button :private_default, 'true' %> + <%= form.radio_button :private_default, 'true', :tabindex => '1' %>
    Can be viewed only by basket members
    <% if @basket != @site_basket %>
    - <%= form.radio_button :private_default, '' %> + <%= form.radio_button :private_default, '', :tabindex => '1' %>
    Inherit this setting from the Site basket.
    @@ -119,20 +119,20 @@
    - <%= form.radio_button :file_private_default, 'false' %> + <%= form.radio_button :file_private_default, 'false', :tabindex => '1' %>
    Can be downloaded by everyone
    - <%= form.radio_button :file_private_default, 'true' %> + <%= form.radio_button :file_private_default, 'true', :tabindex => '1' %>
    Can be downloaded only by authorized basket members
    <% if @basket != @site_basket %>
    - <%= form.radio_button :file_private_default, '' %> + <%= form.radio_button :file_private_default, '', :tabindex => '1' %>
    Inherit this setting from the Site basket.
    @@ -163,7 +163,7 @@
    -
    <%= select_tag 'settings[private_file_visibility]', @basket.private_file_visibility_as_options(@site_basket), "id" => "settings_private_file_visibility" %>
    +
    <%= select_tag 'settings[private_file_visibility]', @basket.private_file_visibility_as_options(@site_basket), {"id" => "settings_private_file_visibility", :tabindex => '1'} %>
    @@ -177,18 +177,18 @@
    - <%= form.radio_button :allow_non_member_comments, 'true' %> + <%= form.radio_button :allow_non_member_comments, 'true', :tabindex => '1' %>
    - <%= form.radio_button :allow_non_member_comments, 'false' %> + <%= form.radio_button :allow_non_member_comments, 'false', :tabindex => '1' %>
    <% if @basket != @site_basket %>
    - <%= form.radio_button :allow_non_member_comments, '' %> + <%= form.radio_button :allow_non_member_comments, '', :tabindex => '1' %>
    Inherit this setting from the Site basket.
    @@ -221,11 +221,11 @@
    -
    <%= select_tag 'settings[sort_order_default]', "#{Search.all_sort_types((@basket.settings[:sort_order_default] || 'default'), 'all')}", "id" => "settings_sort_order_default" %>
    +
    <%= select_tag 'settings[sort_order_default]', "#{Search.all_sort_types((@basket.settings[:sort_order_default] || 'default'), 'all')}", {"id" => "settings_sort_order_default", :tabindex => '1'} %>
    - <%= check_box 'settings', 'sort_direction_reversed_default', {:checked => (@basket.settings[:sort_direction_reversed_default] == 'reverse')}, 'reverse', '' %> + <%= check_box 'settings', 'sort_direction_reversed_default', {:checked => (@basket.settings[:sort_direction_reversed_default] == 'reverse'), :tabindex => '1'}, 'reverse', '' %>
    diff --git a/app/views/baskets/_homepage_form.html.erb b/app/views/baskets/_homepage_form.html.erb index 6dfa57509..3b1535e0e 100644 --- a/app/views/baskets/_homepage_form.html.erb +++ b/app/views/baskets/_homepage_form.html.erb @@ -7,7 +7,7 @@
    - <%= homepage_form.select :index_page_redirect_to_all, zoom_controllers_as_options([["Don't redirect", '']]) %> + <%= homepage_form.select :index_page_redirect_to_all, zoom_controllers_as_options([["Don't redirect", '']]), {}, :tabindex => '1' %>
    @@ -18,12 +18,12 @@
    <% options = @index_topic.blank? ? { :disabled => true } : {} %> - <%= homepage_form.check_box :index_page_topic_is_entire_page, options %> + <%= homepage_form.check_box :index_page_topic_is_entire_page, options.merge({:tabindex => '1'}) %>
    >
    - <%= homepage_form.select :index_page_link_to_index_topic_as, Basket.link_to_index_topic_as_options %> + <%= homepage_form.select :index_page_link_to_index_topic_as, Basket.link_to_index_topic_as_options, {}, :tabindex => '1' %>
    @@ -37,11 +37,11 @@
    - <%= homepage_form.text_field :index_page_number_of_recent_topics, :size => '3' %> + <%= homepage_form.text_field :index_page_number_of_recent_topics, {:size => '3', :tabindex => '1'} %>
    0 %>> - <%= homepage_form.select :index_page_recent_topics_as, Basket.recent_topics_as_options %> + <%= homepage_form.select :index_page_recent_topics_as, Basket.recent_topics_as_options, :tabindex => '1' %>
    @@ -49,7 +49,7 @@
    - <%= homepage_form.check_box :index_page_basket_search %> + <%= homepage_form.check_box :index_page_basket_search, :tabindex => '1' %>
    @@ -58,7 +58,7 @@
    - <%= homepage_form.text_area :index_page_extra_side_bar_html, :class => "mceEditor", :cols => 120, :rows => 10 %> + <%= homepage_form.text_area :index_page_extra_side_bar_html, {:class => "mceEditor", :cols => 120, :rows => 10, :tabindex => '1'} %>
    Note: forms and javascript are not allowed for security reasons. @@ -66,7 +66,7 @@
    <% if @site_admin -%>
    - <%= homepage_form.check_box :do_not_sanitize %> + <%= homepage_form.check_box :do_not_sanitize, :tabindex => '1' %>
    @@ -79,7 +79,7 @@
    - <%= homepage_form.select :index_page_image_as, Basket.image_as_options %> + <%= homepage_form.select :index_page_image_as, Basket.image_as_options, {}, :tabindex => '1' %>
    @@ -88,7 +88,7 @@
    - <%= homepage_form.select :index_page_archives_as, Basket.archives_as_options %> + <%= homepage_form.select :index_page_archives_as, Basket.archives_as_options, {}, :tabindex => '1' %>
    @@ -97,16 +97,16 @@
    - <%= homepage_form.text_field :index_page_number_of_tags, :size => '3' %> + <%= homepage_form.text_field :index_page_number_of_tags, {:size => '3', :tabindex => '1'} %>
    0 %>>
    - <%= homepage_form.select :index_page_tags_as, Basket.tags_as_options %> + <%= homepage_form.select :index_page_tags_as, Basket.tags_as_options, :tabindex => '1' %>
    - <%= homepage_form.select :index_page_order_tags_by, Basket.order_tags_by_options %> + <%= homepage_form.select :index_page_order_tags_by, Basket.order_tags_by_options, :tabindex => '1' %>
    diff --git a/app/views/baskets/appearance.html.erb b/app/views/baskets/appearance.html.erb index f8de943fa..b12f85c03 100644 --- a/app/views/baskets/appearance.html.erb +++ b/app/views/baskets/appearance.html.erb @@ -13,14 +13,14 @@
    - <%= select_tag 'settings[theme_font_family]', @basket.font_family_select_options, "id" => "settings_theme_font_family" %> + <%= select_tag 'settings[theme_font_family]', @basket.font_family_select_options, {"id" => "settings_theme_font_family", :tabindex => '1'} %>
    <%= image_tag @basket.settings[:header_image] if !@basket.settings[:header_image].blank? -%> - <%= text_field 'settings', 'header_image', "id" => "settings_header_image" %> + <%= text_field 'settings', 'header_image', {"id" => "settings_header_image", :tabindex => '1'} %>
    @@ -31,7 +31,7 @@
    <%= image_tag "/themes/#{theme}/images/sample.jpg" -%>
    - <%= radio_button_tag 'settings[theme]', theme, (@basket.settings[:theme] == theme), "id" => "settings_theme" %> + <%= radio_button_tag 'settings[theme]', theme, (@basket.settings[:theme] == theme), {"id" => "settings_theme", :tabindex => '1'} %> <%= theme.humanize %>
    @@ -44,7 +44,7 @@ <% if @site_admin -%>
      -
    • <%= link_to "Add new theme", :action => 'new', :controller => 'documents', :is_theme => true -%>
    • +
    • <%= link_to "Add new theme", {:action => 'new', :controller => 'documents', :is_theme => true}, :tabindex => '1' -%>
    <% end -%> @@ -59,26 +59,26 @@
    - <%= select_tag 'settings[show_action_menu]', @basket.show_action_menu_as_options(@site_basket), "id" => "settings_show_action_menu" %>
    + <%= select_tag 'settings[show_action_menu]', @basket.show_action_menu_as_options(@site_basket), {"id" => "settings_show_action_menu", :tabindex => '1'} %>
    (who can see the view, edit, history and other links)
    - <%= select_tag 'settings[show_discussion]', @basket.show_discussion_as_options(@site_basket), "id" => "settings_show_discussion" %>
    + <%= select_tag 'settings[show_discussion]', @basket.show_discussion_as_options(@site_basket), {"id" => "settings_show_discussion", :tabindex => '1'} %>
    (who can see and add comments)
    - <%= select_tag 'settings[show_flagging]', @basket.show_flagging_as_options(@site_basket), "id" => "settings_show_flagging" %>
    + <%= select_tag 'settings[show_flagging]', @basket.show_flagging_as_options(@site_basket), {"id" => "settings_show_flagging", :tabindex => '1'} %>
    (who can flag items)
    - <%= select_tag 'settings[show_add_links]', @basket.show_add_links_as_options(@site_basket), "id" => "settings_show_add_links" %>
    + <%= select_tag 'settings[show_add_links]', @basket.show_add_links_as_options(@site_basket), {"id" => "settings_show_add_links", :tabindex => '1'} %>
    (who can relate or link items together)
    @@ -95,16 +95,16 @@
    - <%= text_field_tag 'settings[side_menu_number_of_topics]', @basket.settings[:side_menu_number_of_topics], :size => 3, "id" => "settings_side_menu_number_of_topics" %> + <%= text_field_tag 'settings[side_menu_number_of_topics]', @basket.settings[:side_menu_number_of_topics], {:size => 3, "id" => "settings_side_menu_number_of_topics", :tabindex => '1'} %>
    -
    <%= select_tag 'settings[side_menu_ordering_of_topics]', @basket.side_menu_ordering_of_topics_as_options(@site_basket), "id" => "side_menu_ordering_of_topics" %>
    +
    <%= select_tag 'settings[side_menu_ordering_of_topics]', @basket.side_menu_ordering_of_topics_as_options(@site_basket), {"id" => "side_menu_ordering_of_topics", :tabindex => '1'} %>
    - <%= check_box 'settings', 'side_menu_direction_of_topics', {:checked => (@basket.settings[:side_menu_direction_of_topics] == 'reverse')}, 'reverse', '' %> + <%= check_box 'settings', 'side_menu_direction_of_topics', {:checked => (@basket.settings[:side_menu_direction_of_topics] == 'reverse'), :tabindex => '1'}, 'reverse', '' %>
    @@ -116,7 +116,7 @@
    -
    <%= submit_tag 'Save' , :class => "save-button" %>
    +
    <%= submit_tag 'Save' , {:class => "save-button", :tabindex => '1'} %>
    <% end %> diff --git a/app/views/baskets/choose_type.html.erb b/app/views/baskets/choose_type.html.erb index d3461fd53..f80af474b 100644 --- a/app/views/baskets/choose_type.html.erb +++ b/app/views/baskets/choose_type.html.erb @@ -11,9 +11,9 @@ end -%>
    - <%= select_tag 'new_controller', @type_options %> + <%= select_tag 'new_controller', @type_options, :tabindex => '1' %>
    -<%= submit_tag "Choose" , :class => "save-button" %> +<%= submit_tag "Choose" , {:class => "save-button", :tabindex => '1'} %> <% end %> diff --git a/app/views/baskets/edit.rhtml b/app/views/baskets/edit.rhtml index f94940089..39b0cdd58 100644 --- a/app/views/baskets/edit.rhtml +++ b/app/views/baskets/edit.rhtml @@ -9,7 +9,7 @@ <% form_for :basket, :url => {:action => 'update', :id => @basket} do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag 'Save' , :class => "save-button" %>
    +
    <%= submit_tag 'Save' , {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/baskets/homepage_options.html.erb b/app/views/baskets/homepage_options.html.erb index cdfccfd94..a5c142e0c 100644 --- a/app/views/baskets/homepage_options.html.erb +++ b/app/views/baskets/homepage_options.html.erb @@ -9,7 +9,7 @@
      <% if !@index_topic.blank? -%> -
    • Current homepage topic: <%= link_to h(@index_topic.title), :controller => 'topics', :action => 'show', :id => @index_topic, :urlified_name => @index_topic.basket.urlified_name -%>
    • +
    • Current homepage topic: <%= link_to h(@index_topic.title), {:controller => 'topics', :action => 'show', :id => @index_topic, :urlified_name => @index_topic.basket.urlified_name}, :tabindex => '1' -%>
    • <% end -%>
    • <%= link_to_add_index_topic(:index_for_basket => @basket, :phrase => 'Add new basket homepage topic') -%>
    • @@ -22,7 +22,7 @@ <% form_for :basket, :url => {:action => 'update', :id => @basket} do |form| %> <%= render :partial => 'homepage_form', :object => form %> -
      <%= submit_tag 'Save' , :class => "save-button" %>
      +
      <%= submit_tag 'Save' , {:class => "save-button", :tabindex => '1'} %>
      <% end %> <%= link_to_cancel %> diff --git a/app/views/baskets/new.rhtml b/app/views/baskets/new.rhtml index 0a9cc799d..4defe6375 100644 --- a/app/views/baskets/new.rhtml +++ b/app/views/baskets/new.rhtml @@ -4,7 +4,7 @@ <% form_for :basket, :url => {:action => 'create'} do |form| %> <%= render :partial => 'form', :object => form %> -
      <%= submit_tag "Create", :class => "save-button" %>
      +
      <%= submit_tag "Create", {:class => "save-button", :tabindex => '1'} %>
      <% end %> <%= render(:partial => "topics/content_wrapper_end" ) %> \ No newline at end of file diff --git a/app/views/comments/_form.rhtml b/app/views/comments/_form.rhtml index e235e423a..f6af0cb53 100644 --- a/app/views/comments/_form.rhtml +++ b/app/views/comments/_form.rhtml @@ -15,12 +15,12 @@
      - <%= form.text_field :title %> + <%= form.text_field :title, :tabindex => '1' %>
      - <%= form.text_area :description, :class => "mceEditor", :cols => 120 %> + <%= form.text_area :description, {:class => "mceEditor", :cols => 120, :tabindex => '1'} %>
      Note: forms and javascript are not allowed for security reasons. @@ -33,7 +33,7 @@ <% if @site_admin -%>
      - <%= form.check_box :do_not_sanitize %>
      + <%= form.check_box :do_not_sanitize, :tabindex => '1' %>
      <% end -%> <%= tags_input_field(form,"comment_tag_list") %> @@ -52,7 +52,7 @@ <% # delete the last version_comment's value @comment.version_comment = nil -%> - <%= form.text_field :version_comment %> + <%= form.text_field :version_comment, :tabindex => '1' %>
      <% end -%> diff --git a/app/views/comments/edit.rhtml b/app/views/comments/edit.rhtml index f49bdb5d5..58ecb65d2 100644 --- a/app/views/comments/edit.rhtml +++ b/app/views/comments/edit.rhtml @@ -7,7 +7,7 @@ :id => @comment }, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
      <%= submit_tag 'Save', :class => "save-button" %>
      +
      <%= submit_tag 'Save', {:class => "save-button", :tabindex => '1'} %>
      <% end %> <%= link_to_cancel %> diff --git a/app/views/comments/new.rhtml b/app/views/comments/new.rhtml index 2a0854f3e..95b27f4e8 100644 --- a/app/views/comments/new.rhtml +++ b/app/views/comments/new.rhtml @@ -6,7 +6,7 @@ :url => { :action => 'create'}, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
      <%= submit_tag "Save", :class => "save-button" %>
      +
      <%= submit_tag "Save", {:class => "save-button", :tabindex => '1'} %>
      <% end %> <%= link_to_cancel %> diff --git a/app/views/documents/_form.rhtml b/app/views/documents/_form.rhtml index 0ea6afd2a..b17511204 100644 --- a/app/views/documents/_form.rhtml +++ b/app/views/documents/_form.rhtml @@ -18,7 +18,7 @@ <% if edit && @site_admin %>
      - <%= form.select 'basket_id', @baskets %> + <%= form.select 'basket_id', @baskets, {}, :tabindex => '1' %>
      <% end -%> @@ -27,11 +27,11 @@
      • - <%= form.radio_button :private, false, :id => "document_private_false" %> + <%= form.radio_button :private, false, {:id => "document_private_false", :tabindex => '1'} %> (Can be viewed by everyone)
      • - <%= form.radio_button :private, true, :id => "document_private_true" %> + <%= form.radio_button :private, true, {:id => "document_private_true", :tabindex => '1'} %> (Can be viewed only by basket members)
      @@ -45,13 +45,13 @@ <% end %>
      - <%= form.text_field :title %>
      + <%= form.text_field :title, :tabindex => '1' %>
    - <%= form.text_area :short_summary, {:class => "text-area", :cols => 120, :rows => 2 } %>
    + <%= form.text_area :short_summary, {:class => "text-area", :cols => 120, :rows => 2, :tabindex => '1' } %>
    - <%= form.text_area :description, :class => "mceEditor", :cols => 120 %> + <%= form.text_area :description, {:class => "mceEditor", :cols => 120, :tabindex => '1'} %>
    Note: forms and javascript are not allowed for security reasons. @@ -64,11 +64,11 @@ <% if @site_admin -%>
    - <%= form.check_box :do_not_sanitize %>
    + <%= form.check_box :do_not_sanitize, :tabindex => '1' %>
    <% end -%> <% if show_privacy_controls_for?(@document) %> -
    <%= form.radio_button :file_private, false, file_private_radio_options(@document) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@document) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    +
    <%= form.radio_button :file_private, false, file_private_radio_options(@document).merge({:tabindex => '1'}) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@document).merge({:tabindex => '1'}) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    Please note that once public, an attached document cannot be made private.
    <% else %> <%# Use the default %> @@ -82,7 +82,7 @@ # we'll likely re-enable this -%> <% if !edit -%>

    - <%= form.file_field :uploaded_data %>
    + <%= form.file_field :uploaded_data, :tabindex => '1' %>
    <% end -%> <% form_fields = @content_type.content_type_to_field_mappings -%> @@ -99,7 +99,7 @@ <% # delete the last version_comment's value @document.version_comment = nil -%> - <%= form.text_field :version_comment %> + <%= form.text_field :version_comment, :tabindex => '1' %>
    <% end -%> <%= render :partial => 'topics/license_chooser_or_agreement',:locals => {:item => @document} %> diff --git a/app/views/documents/edit.rhtml b/app/views/documents/edit.rhtml index 21718bf53..0e3042348 100644 --- a/app/views/documents/edit.rhtml +++ b/app/views/documents/edit.rhtml @@ -7,7 +7,7 @@ :id => @document }, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag 'Save', :class => "save-button" %>
    +
    <%= submit_tag 'Save', {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> <% else %> diff --git a/app/views/documents/new.rhtml b/app/views/documents/new.rhtml index a47c78cce..4f81dbb34 100644 --- a/app/views/documents/new.rhtml +++ b/app/views/documents/new.rhtml @@ -6,7 +6,7 @@ :url => { :action => 'create'}, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag "Create" %>
    +
    <%= submit_tag "Create", :tabindex => '1' %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/images/_form.rhtml b/app/views/images/_form.rhtml index 83a41ca0d..77170f5fe 100644 --- a/app/views/images/_form.rhtml +++ b/app/views/images/_form.rhtml @@ -18,7 +18,7 @@ <% if edit and @site_admin %>
    - <%= form.select 'basket_id', @baskets %> + <%= form.select 'basket_id', @baskets, {}, :tabindex => '1' %>
    <% end -%> @@ -27,11 +27,11 @@
    • - <%= form.radio_button :private, false, :id => "still_image_private_false" %> + <%= form.radio_button :private, false, {:id => "still_image_private_false", :tabindex => '1'} %> ( Can be viewed by everyone)
    • - <%= form.radio_button :private, true, :id => "still_image_private_true" %> + <%= form.radio_button :private, true, {:id => "still_image_private_true", :tabindex => '1'} %> (Can be viewed only by basket members)
    @@ -45,10 +45,10 @@ <% end %>
    - <%= form.text_field :title %>
    + <%= form.text_field :title, :tabindex => '1' %>

    - <%= form.text_area :description, :class => "mceEditor", :cols => 120 %> + <%= form.text_area :description, {:class => "mceEditor", :cols => 120, :tabindex => '1'} %>
    Note: forms and javascript are not allowed for security reasons. @@ -62,11 +62,11 @@ <% if @site_admin -%>
    - <%= form.check_box :do_not_sanitize %>
    + <%= form.check_box :do_not_sanitize, :tabindex => '1' %>
    <% end -%> <% if show_privacy_controls_for?(@still_image) %> -
    <%= form.radio_button :file_private, false, file_private_radio_options(@still_image) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@still_image) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    +
    <%= form.radio_button :file_private, false, file_private_radio_options(@still_image).merge({:tabindex => '1'}) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@still_image).merge({:tabindex => '1'}) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    Image originals can be private, however once public, an image original cannot be made private. Image thumbnails are always public.
    <% else %> <%# Use the default %> @@ -80,7 +80,7 @@ # we'll likely re-enable this -%> <% if !edit -%>

    - <%= file_field_tag 'image_file[uploaded_data]', :id => 'image_file_uploaded_data' %>
    + <%= file_field_tag 'image_file[uploaded_data]', {:id => 'image_file_uploaded_data', :tabindex => '1'} %>
    <% end -%> <% form_fields = @content_type.content_type_to_field_mappings -%> @@ -98,7 +98,7 @@ <% # delete the last version_comment's value @still_image.version_comment = nil -%> - <%= form.text_field :version_comment %> + <%= form.text_field :version_comment, :tabindex => '1' %>
    <% end -%> diff --git a/app/views/images/edit.rhtml b/app/views/images/edit.rhtml index ba2b3764c..4807fed02 100644 --- a/app/views/images/edit.rhtml +++ b/app/views/images/edit.rhtml @@ -8,7 +8,7 @@ :id => @still_image }, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag 'Save', :class => "save-button" %>
    +
    <%= submit_tag 'Save', {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/images/new.rhtml b/app/views/images/new.rhtml index 02d83753e..ddb0dc2e1 100644 --- a/app/views/images/new.rhtml +++ b/app/views/images/new.rhtml @@ -6,7 +6,7 @@ :url => { :action => 'create'}, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag "Create" , :class => "save-button" %>
    +
    <%= submit_tag "Create" , {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/index_page/robots.html.erb b/app/views/index_page/robots.html.erb new file mode 100644 index 000000000..f72fbcf51 --- /dev/null +++ b/app/views/index_page/robots.html.erb @@ -0,0 +1,36 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +User-agent: * +<% @baskets.each do |basket| -%> + +# +# <%= basket.name %> +# +<% @controller_names.each do |controller| -%> +# <%= controller %> +Disallow: /<%= basket.urlified_name -%>/<%= controller -%>/new +Disallow: /<%= basket.urlified_name -%>/<%= controller -%>/edit +Disallow: /<%= basket.urlified_name -%>/<%= controller -%>/flag_version +Disallow: /<%= basket.urlified_name -%>/<%= controller -%>/history +Disallow: /<%= basket.urlified_name -%>/<%= controller -%>/preview +Disallow: /<%= basket.urlified_name -%>/all/<%= controller -%>/rss +Disallow: /<%= basket.urlified_name -%>/all/<%= controller -%>/rss.xml +Disallow: /<%= basket.urlified_name -%>/all/<%= controller -%>/contributed_by +Disallow: /<%= basket.urlified_name -%>/all/<%= controller -%>/tagged +Disallow: /<%= basket.urlified_name -%>/all/<%= controller -%>/related_to +<% end -%> +<% end -%> + +# +# Miscellaneous +# +Disallow: /site/index_page/help_file +Disallow: /site/account +Disallow: /site/baskets +Disallow: /site/members +Disallow: /site/extended_fields +Disallow: /site/topic_types +Disallow: /site/content_types +Disallow: /site/zoom_dbs +Disallow: /site/importers +Disallow: /site/search +Disallow: /site/search/ \ No newline at end of file diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index c38b18fda..2a0ef516c 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -14,34 +14,14 @@ <%= h(@title) %> <% end -%> - <% # logic for which javascript to load -%> - <% as_controllers = ACTIVE_SCAFFOLD_CONTROLLERS -%> - <% none_tinymce_controllers = as_controllers + ['members', 'topic_types', 'content_types'] -%> - <% tinymce_actions = ['new', 'create', 'edit', 'update', - 'pick_topic_type', 'homepage_options', 'new_related_set_from_archive_file'] -%> - <% @do_not_use_tiny_mce ||= !(!none_tinymce_controllers.include?(params[:controller]) && tinymce_actions.include?(params[:action])) -%> - <% unless @do_not_use_tiny_mce -%> - <% # Include TinyMCE before other JS to avoid problems, - # tinymce not compatible with bundle_fu -%> - <%= javascript_include_tiny_mce_if_used %> - <%# point tinymce at the correct css file %> - <% @tiny_mce_options[:content_css] = "/stylesheets/cache/#{@theme}_theme.css" if using_tiny_mce? %> - <% @tiny_mce_options[:extended_valid_elements] = EXTENDED_VALID_ELEMENTS if @site_admin and using_tiny_mce? %> - <%= tiny_mce if using_tiny_mce? %> - + <% if using_tiny_mce? -%> + <% # Include TinyMCE before other JS to avoid problems, + # tinymce not compatible with bundle_fu -%> + <%= include_tiny_mce_js -%> + <% # point tinymce at the correct css file -%> + <% @tiny_mce_options[:content_css] = "/stylesheets/cache/#{@theme}_theme.css" -%> + <% @tiny_mce_options[:extended_valid_elements] = EXTENDED_VALID_ELEMENTS if @site_admin -%> + <%= tiny_mce_init -%> <% end -%> <%= stylesheet_link_tag 'kete-print', :media => 'print' %> @@ -77,7 +57,7 @@ <% end %> <% end -%> - <% if as_controllers.include?(params[:controller]) -%> + <% if ACTIVE_SCAFFOLD_CONTROLLERS.include?(params[:controller]) -%> <% bundle :name => "active_scaffold" do -%> <%= active_scaffold_includes %> <% end -%> @@ -96,7 +76,7 @@
    <%= header_links_to_baskets %> @@ -117,30 +97,30 @@
    @@ -162,6 +142,7 @@ <% if render_full_width_content_wrapper? and !@displaying_error %> <%= render(:partial => "topics/content_wrapper_start" , :locals => { :style_classes =>"full-width notabs" }) %> <% end %> +
     
    <%= @content_for_layout %>
     
    @@ -176,27 +157,32 @@

    Tools for basket: <%= h(@current_basket.name) -%>

    • <%= link_to_unless_current "basket preferences", - :id => @current_basket, + {:id => @current_basket, :controller => '/baskets', - :action => :edit -%>
    • + :action => :edit}, + :tabindex => '2' -%>
    • <%= link_to_unless_current "moderate basket contents", - :controller => '/moderate', - :action => :list -%>
    • + {:controller => '/moderate', + :action => :list}, + :tabindex => '2' -%>
    • <%= link_to_unless_current "basket members", - :controller => '/members', - :action => :list -%>
    • + {:controller => '/members', + :action => :list}, + :tabindex => '2' -%> <% # when this is more refined, may open this up to non-tech-admins -%> <% if @tech_admin -%>
    • <%= link_to_unless_current "import content into basket", - :controller => '/importers', - :action => :list -%>
    • + {:controller => '/importers', + :action => :list}, + :tabindex => '2' -%> <% end %> <% if @current_basket.urlified_name != 'site' -%>
    • <%= link_to_unless_current "delete this basket", { :id => @current_basket, :controller => '/baskets', :action => :destroy }, - :confirm => 'Are you sure? All items in this basket will be deleted forever!', :method => :post -%>
    • + :confirm => 'Are you sure? All items in this basket will be deleted forever!', :method => :post, + :tabindex => '2' -%> <% end %>
    @@ -207,58 +193,92 @@

    Administrator's Toolbox

    Controls: - <%= link_to_unless_current("add basket", :urlified_name => @site_basket.urlified_name, + <%= link_to_unless_current("add basket", {:urlified_name => @site_basket.urlified_name, :controller => 'baskets', - :action => :new) %> + :action => :new}, + :tabindex => '2') %> | - <%= link_to_unless_current "topic types", :controller => '/topic_types', + <%= link_to_unless_current "topic types", {:controller => '/topic_types', :action => :list, - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "content types", :controller => '/content_types', + <%= link_to_unless_current "content types", {:controller => '/content_types', :action => :list, - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "extended fields", :controller => '/extended_fields', + <%= link_to_unless_current "extended fields", {:controller => '/extended_fields', :action => :list, - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "site members", :controller => '/members', + <%= link_to_unless_current "site members", {:controller => '/members', :action => :list, - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "administer licenses", :controller => '/licenses', - :action => :index, :urlified_name => @site_basket.urlified_name -%> + <%= link_to_unless_current "administer licenses", {:controller => '/licenses', + :action => :index, :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "List site on Kete.net.nz", :controller => '/configure', + <%= link_to_unless_current "List site on Kete.net.nz", {:controller => '/configure', :action => 'add_link_from_kete_net', - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> <% if @tech_admin -%> | - <%= link_to_unless_current "reconfigure site", :controller => '/configure', + <%= link_to_unless_current "reconfigure site", {:controller => '/configure', :action => :index, - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "OAI PMH Sets", :controller => '/oai_pmh_repository_sets', + <%= link_to_unless_current "OAI PMH Sets", {:controller => '/oai_pmh_repository_sets', :action => :index, - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "Z39.50 search databases", :controller => '/zoom_dbs', + <%= link_to_unless_current "Z39.50 search databases", {:controller => '/zoom_dbs', :action => :list, - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> | - <%= link_to_unless_current "Rebuild search databases", :controller => '/search', + <%= link_to_unless_current "Rebuild search databases", {:controller => '/search', :action => 'setup_rebuild', - :urlified_name => @site_basket.urlified_name -%> + :urlified_name => @site_basket.urlified_name}, + :tabindex => '2' -%> <% end -%>

    Support: - <%= link_to_unless_current("documentation", basket_index_url(:urlified_name => @documentation_basket.urlified_name)) %> + <%= link_to_unless_current("documentation", basket_index_url(:urlified_name => @documentation_basket.urlified_name), :tabindex => '2') %>

    <% end %> + + diff --git a/app/views/search/_extended_field_mapping.rhtml b/app/views/search/_extended_field_mapping.rhtml index b4b1aecd2..10270d8b8 100644 --- a/app/views/search/_extended_field_mapping.rhtml +++ b/app/views/search/_extended_field_mapping.rhtml @@ -33,19 +33,19 @@ <% if @field_types[the_field_type] and @field_types[the_field_type] != 'date_select_tag' %> <% z = @field_types[the_field_type] + '("' %> <% z = z + "#{item_key}[#{f_id}][#{input_count}]" %> - <% z = z + '", temp_hash[input_count.to_s][f_id], {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}"})' %> + <% z = z + '", temp_hash[input_count.to_s][f_id], {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}", :tabindex => "1"})' %> <%= eval(z) %> <% else %> - <%= text_field_tag("#{item_key}[#{f_id}][#{input_count}]", temp_hash[input_count.to_s][f_id], {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}"}) %> + <%= text_field_tag("#{item_key}[#{f_id}][#{input_count}]", temp_hash[input_count.to_s][f_id], {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}", :tabindex => '1'}) %> <% end %> <% else %> <% if @field_types[the_field_type] and @field_types[the_field_type] != 'date_select_tag' %> <% z = @field_types[the_field_type] + '("' %> <% z = z + "#{item_key}[#{f_id}][#{input_count}]" %> - <% z = z + '", nil, {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}"})' %> + <% z = z + '", nil, {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}", :tabindex => "1"})' %> <%= eval(z) %> <% else %> - <%= text_field_tag("#{item_key}[#{f_id}][#{input_count}]", nil, {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}"}) %> + <%= text_field_tag("#{item_key}[#{f_id}][#{input_count}]", nil, {:class => "text-input", :id => "#{item_key}_#{f_id}_#{input_count}", :tabindex => "1"}) %> <% end %> <% end %> <% input_count += 1 -%> @@ -60,10 +60,10 @@ <% else %> <% z = z + '", item_extended_xml[f_id],' %> <% end %> - <% z = z + '{:class => "text-input", :id => "#{item_key}_#{f_id}"})' %> + <% z = z + '{:class => "text-input", :id => "#{item_key}_#{f_id}", :tabindex => "1"})' %> <%= eval(z) %> <% else %> - <%= text_field_tag("#{item_key}[#{f_id}]", item_extended_xml[f_id], {:class => "text-input", :id => "#{item_key}_#{f_id}"}) %> + <%= text_field_tag("#{item_key}[#{f_id}]", item_extended_xml[f_id], {:class => "text-input", :id => "#{item_key}_#{f_id}", :tabindex => "1"}) %> <% end %> <% else %> <% if @field_types[the_field_type] and @field_types[the_field_type] != 'date_select_tag' %> @@ -74,10 +74,10 @@ <% else %> <% z = z + '", nil,' %> <% end %> - <% z = z + '{:class => "text-input", :id => "#{item_key}_#{f_id}"})' %> + <% z = z + '{:class => "text-input", :id => "#{item_key}_#{f_id}", :tabindex => "1"})' %> <%= eval(z) %> <% else %> - <%= text_field_tag("#{item_key}[#{f_id}]", nil, {:class => "text-input", :id => "#{item_key}_#{f_id}"}) %> + <%= text_field_tag("#{item_key}[#{f_id}]", nil, {:class => "text-input", :id => "#{item_key}_#{f_id}", :tabindex => "1"}) %> <% end %> <% end %> <% end %> diff --git a/app/views/search/_form.rhtml b/app/views/search/_form.rhtml index 34a663a10..92046d0d1 100644 --- a/app/views/search/_form.rhtml +++ b/app/views/search/_form.rhtml @@ -21,19 +21,19 @@

    Options

    <% sort_type = (params[:sort_type].blank? and !@current_basket.settings[:sort_order_default].blank?) ? @current_basket.settings[:sort_order_default] : params[:sort_type] %> - <%= select_tag 'sort_type', @search.sort_type_options_for(sort_type, params[:action]) %> + <%= select_tag 'sort_type', @search.sort_type_options_for(sort_type, params[:action]), :tabindex => '1' %>
    > <% currently_reversed = ((!params[:sort_direction].blank? && params[:sort_direction] == 'reverse') or (params[:sort_type].blank? && @current_basket.settings[:sort_direction_reversed_default] == 'reverse')) %> <% currently_disabled = (params[:action] == 'for' && (params[:sort_type].blank? || params[:sort_type] == 'none')) %> - <%= ' checked="checked"' if currently_reversed -%> /> + <%= ' checked="checked"' if currently_reversed -%> tabindex="1" />
    <% # Only show private search control if allowed and we aren't relating something to a topic. %> <% if params[:relate_to_topic].blank? && show_privacy_search_controls? && permitted_to_view_private_items? -%> - <%= select_tag 'privacy_type', options_for_select({ 'Private' => 'private', 'Public' => 'public' }, params[:privacy_type] || 'public') %> + <%= select_tag 'privacy_type', options_for_select({ 'Private' => 'private', 'Public' => 'public' }, params[:privacy_type] || 'public'), :tabindex => '1' %> <% end -%> - + @@ -49,7 +49,7 @@

    <%= headline -%>

    <% end -%>
    - <%= text_field_tag 'search_terms', @search_terms, :class => 'searchheader-search', :size => '30' %> + <%= text_field_tag 'search_terms', @search_terms, {:class => 'searchheader-search', :size => '30', :tabindex => '1'} %> <% if !params[:relate_to_topic].nil? or (!params[:related_class].nil? and params[:related_class] == 'Topic')-%> <% if !params[:relate_to_topic].nil? -%> <%= hidden_field_tag "relate_to_topic", params[:relate_to_topic] %> @@ -68,7 +68,7 @@ <% end -%> - <%= submit_tag "Search", :class => 'searchbutton' %> + <%= submit_tag "Search", {:class => 'searchbutton', :tabindex => '1'} %>
    <% if !simple_layout -%> diff --git a/app/views/search/_generic.rhtml b/app/views/search/_generic.rhtml index 8f87cdb72..38b831c30 100644 --- a/app/views/search/_generic.rhtml +++ b/app/views/search/_generic.rhtml @@ -40,11 +40,11 @@ <% end %> <% else %> -

    <%= link_to h(title), "#{source_url}" %>

    +

    <%= link_to h(title), "#{source_url}", :tabindex => '1' %>

    <%= strip_tags(short_summary) %>
    - <%= link_to("more >>", "#{source_url}", { :title => "More information on #{title}" })%> + <%= link_to("more >>", "#{source_url}", { :title => "More information on #{title}", :tabindex => '1' })%>
    <% end %> diff --git a/app/views/search/_image.rhtml b/app/views/search/_image.rhtml index 621cfb2c7..8e1da1131 100644 --- a/app/views/search/_image.rhtml +++ b/app/views/search/_image.rhtml @@ -33,11 +33,11 @@ check_box_tag("topic_#{result}",'yes',false,{:style => 'float:left', <% end %>
    -

    <%= link_to h(title), "#{source_url}" %>

    +

    <%= link_to h(title), "#{source_url}", :tabindex => '1' %>

    <%= strip_tags(short_summary) %>
    - <%= link_to("more >>", "#{source_url}", { :title => "More information on #{title}" })%> + <%= link_to("more >>", "#{source_url}", { :title => "More information on #{title}", :tabindex => '1' })%>
    <% end %> diff --git a/app/views/search/_results.rhtml b/app/views/search/_results.rhtml index 734f97b38..c09e310a9 100644 --- a/app/views/search/_results.rhtml +++ b/app/views/search/_results.rhtml @@ -15,7 +15,7 @@ <% ZOOM_CLASSES.each do |zoom_class| %> <% if zoom_class == @current_class %>
  • - <%= zoom_class_plural_humanize(zoom_class) %> (<%= number_with_delimiter(@result_sets[zoom_class].size) %>)
  • + <%= zoom_class_plural_humanize(zoom_class) %> (<%= number_with_delimiter(@result_sets[zoom_class].size) %>) <% else %> <% if !results_as_form %>
  • <%= link_to_zoom_class_results(zoom_class,@result_sets[zoom_class].size) -%>
  • @@ -84,7 +84,7 @@ <% # TODO: a helper? %> <% RECORDS_PER_PAGE_CHOICES.each do |choice| %> <% if @number_per_page != choice %> - <%= link_to(choice, :overwrite_params => { :number_of_results_per_page => choice, :page => 1 }) %> + <%= link_to(choice, :overwrite_params => { :number_of_results_per_page => choice, :page => 1 }, :tabindex => '1') %> <% else %> <%= choice %> <% end %> diff --git a/app/views/search/oai_record.rxml b/app/views/search/oai_record.rxml index e1bbc3da9..fac4113f5 100644 --- a/app/views/search/oai_record.rxml +++ b/app/views/search/oai_record.rxml @@ -6,7 +6,7 @@ xml.tag!("OAI-PMH", "xmlns:xsi".to_sym => "http://www.w3.org/2001/XMLSchema-inst xml.record do xml.header do oai_dc_xml_oai_identifier(xml,item) - xml.datestamp(item.updated_at.utc.xmlschema) + oai_dc_xml_oai_datestamp(xml, item) oai_dc_xml_oai_set_specs(xml,item) end xml.metadata do diff --git a/app/views/topics/_actions_menu.rhtml b/app/views/topics/_actions_menu.rhtml index 16d9491d5..8db64a32d 100644 --- a/app/views/topics/_actions_menu.rhtml +++ b/app/views/topics/_actions_menu.rhtml @@ -1,18 +1,18 @@
    -
    <%= submit_tag @submit_text %>
    +
    <%= submit_tag @submit_text, :tabindex => '1' %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/topics/new.rhtml b/app/views/topics/new.rhtml index 50eca0777..de2110f3a 100644 --- a/app/views/topics/new.rhtml +++ b/app/views/topics/new.rhtml @@ -4,10 +4,10 @@ <% form_tag :action => 'pick_topic_type' do %> <%= render :partial => 'pick_form' %> -
    <%= submit_tag "Choose" , :class => "save-button" %>
    +
    <%= submit_tag "Choose" , {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> | -<%= link_to("help", { :controller => 'index_page', :action => :help_file }, :popup => ['help', 'height=500,width=780,scrollbars=yes,top=100,left=100']) %> +<%= link_to("help", { :controller => 'index_page', :action => :help_file }, :popup => ['help', 'height=500,width=780,scrollbars=yes,top=100,left=100'], :tabindex => '1') %> <%= render(:partial => "content_wrapper_end" ) %> diff --git a/app/views/topics/pick_topic_type.rhtml b/app/views/topics/pick_topic_type.rhtml index 0125cab90..19b2458f0 100644 --- a/app/views/topics/pick_topic_type.rhtml +++ b/app/views/topics/pick_topic_type.rhtml @@ -5,7 +5,7 @@ <% form_tag :action => 'create' do %> <%= render :partial => 'form' %> -
    <%= submit_tag "Create", :class => "save-button" %>
    +
    <%= submit_tag "Create", {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/video/_form.rhtml b/app/views/video/_form.rhtml index 072919812..85c94f47f 100644 --- a/app/views/video/_form.rhtml +++ b/app/views/video/_form.rhtml @@ -16,7 +16,7 @@ <% if edit and @site_admin %>
    - <%= form.select 'basket_id', @baskets %> + <%= form.select 'basket_id', @baskets, {}, :tabindex => '1' %>
    <% end -%> @@ -26,11 +26,11 @@ @@ -44,10 +44,10 @@ <% end %>
    - <%= form.text_field :title %>
    + <%= form.text_field :title, :tabindex => '1' %>
    - <%= form.text_area :description, :class => "mceEditor", :cols => 120 %> + <%= form.text_area :description, {:class => "mceEditor", :cols => 120, :tabindex => '1'} %>
    Note: forms and javascript are not allowed for security reasons. @@ -60,11 +60,11 @@ <% if @site_admin -%>
    - <%= form.check_box :do_not_sanitize %>
    + <%= form.check_box :do_not_sanitize, :tabindex => '1' %>
    <% end -%> <% if show_privacy_controls_for?(@video) %> -
    <%= form.radio_button :file_private, false, file_private_radio_options(@video) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@video) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    +
    <%= form.radio_button :file_private, false, file_private_radio_options(@video).merge({:tabindex => '1'}) %> Can be downloaded by everyone <%= form.radio_button :file_private, true, file_private_radio_options(@video).merge({:tabindex => '1'}) %> Can only be downloaded by people who have <%= @current_basket.private_file_visibility -%> access.
    Please note that once public, an attached video cannot be made private.
    <% else %> <%# Use the default %> @@ -80,7 +80,7 @@ # we'll likely re-enable this -%> <% if !edit -%>
    - <%= form.file_field :uploaded_data %>
    + <%= form.file_field :uploaded_data, :tabindex => '1' %>
    <% end -%> <% form_fields = @content_type.content_type_to_field_mappings -%> @@ -97,7 +97,7 @@ <% # delete the last version_comment's value @video.version_comment = nil -%> - <%= form.text_field :version_comment %> + <%= form.text_field :version_comment, :tabindex => '1' %>
    <% end -%> diff --git a/app/views/video/edit.rhtml b/app/views/video/edit.rhtml index c9dba6a7f..a13e5a12e 100644 --- a/app/views/video/edit.rhtml +++ b/app/views/video/edit.rhtml @@ -8,7 +8,7 @@ :id => @video }, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag 'Save' , :class => "save-button" %>
    +
    <%= submit_tag 'Save' , {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/video/new.rhtml b/app/views/video/new.rhtml index 353945079..3bdb58b2d 100644 --- a/app/views/video/new.rhtml +++ b/app/views/video/new.rhtml @@ -6,7 +6,7 @@ :url => { :action => 'create'}, :html => { :multipart => true } do |form| %> <%= render :partial => 'form', :object => form %> -
    <%= submit_tag "Create" %>
    +
    <%= submit_tag "Create", :tabindex => '1' %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/web_links/_form.rhtml b/app/views/web_links/_form.rhtml index 03673b871..98437b297 100644 --- a/app/views/web_links/_form.rhtml +++ b/app/views/web_links/_form.rhtml @@ -14,7 +14,7 @@
    <% # TODO: ugly hack till we move this to form.select -%> - <%= collection_select('web_link', 'basket_id', Basket.find(:all), :id, :name) %> + <%= collection_select('web_link', 'basket_id', Basket.find(:all), :id, :name, {}, {:tabindex => '1'}) %>
    <% end -%> @@ -23,11 +23,11 @@ @@ -43,12 +43,12 @@
    - <%= text_field 'web_link', 'title' , {:class=>"text-input"} %> + <%= text_field 'web_link', 'title' , {:class=>"text-input", :tabindex => '1'} %>
    - <%= text_area 'web_link', 'description', :class => "mceEditor", :cols => 120 %> + <%= text_area 'web_link', 'description', {:class => "mceEditor", :cols => 120, :tabindex => '1'} %>
    Note: forms and javascript are not allowed for security reasons. @@ -61,11 +61,11 @@ <% if @site_admin -%>
    - <%= check_box 'web_link', 'do_not_sanitize' %>
    + <%= check_box 'web_link', 'do_not_sanitize', :tabindex => '1' %>
    <% end -%> <% if show_privacy_controls_for?(@web_link) %> -
    <%= radio_button 'web_link', 'file_private', false, file_private_radio_options(@web_link) %> Can be accessed by everyone <%= radio_button 'web_link', 'file_private', true, file_private_radio_options(@web_link) %> Can only be accessed by people who have <%= @current_basket.private_file_visibility -%> access.
    +
    <%= radio_button 'web_link', 'file_private', false, file_private_radio_options(@web_link).merge({:tabindex => '1'}) %> Can be accessed by everyone <%= radio_button 'web_link', 'file_private', true, file_private_radio_options(@web_link).merge({:tabindex => '1'}) %> Can only be accessed by people who have <%= @current_basket.private_file_visibility -%> access.
    Please note that once public, a web link cannot be made private.
    <% else %> <%# Use the default %> @@ -74,13 +74,13 @@
    - <%= text_field 'web_link', 'tag_list', {:class => "text-input"} %> + <%= text_field 'web_link', 'tag_list', {:class => "text-input", :tabindex => '1'} %>
    <% if show_privacy_controls_for?(@web_link) || !edit %>
    - <%= text_field 'web_link', 'url', {:class=>"text-input"} %> + <%= text_field 'web_link', 'url', {:class=>"text-input", :tabindex => '1'} %>
    <% end %> @@ -98,7 +98,7 @@ <% # delete the last version_comment's value @web_link.version_comment = nil -%> - <%= text_field 'web_link', 'version_comment', {:class => "text-input"} %> + <%= text_field 'web_link', 'version_comment', {:class => "text-input", :tabindex => '1'} %>
    <% end -%> diff --git a/app/views/web_links/edit.rhtml b/app/views/web_links/edit.rhtml index 03418be83..6e0807c76 100644 --- a/app/views/web_links/edit.rhtml +++ b/app/views/web_links/edit.rhtml @@ -5,7 +5,7 @@ <% form_tag :action => 'update', :id => @web_link do %> <%= render :partial => 'form' %> -
    <%= submit_tag 'Save',:class => "save-button" %>
    +
    <%= submit_tag 'Save',{:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/app/views/web_links/new.rhtml b/app/views/web_links/new.rhtml index ddda4d724..faa262050 100644 --- a/app/views/web_links/new.rhtml +++ b/app/views/web_links/new.rhtml @@ -5,7 +5,7 @@ <% form_tag :action => 'create' do %> <%= render :partial => 'form' %> -
    <%= submit_tag "Create", :class => "save-button" %>
    +
    <%= submit_tag "Create", {:class => "save-button", :tabindex => '1'} %>
    <% end %> <%= link_to_cancel %> diff --git a/config/backgroundrb.yml.example b/config/backgroundrb.yml.example index 153dca91c..533c2c10a 100644 --- a/config/backgroundrb.yml.example +++ b/config/backgroundrb.yml.example @@ -3,6 +3,7 @@ :port: 11006 :ip: 127.0.0.1 :environment: production + :persistent_disabled: true :result_storage: memcache - + :memcache: "127.0.0.1:11211" \ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb index d496e3aed..1cdb0ca1f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -39,7 +39,9 @@ # Specify gems that this application depends on. # They can then be installed with "rake gems:install" on new installations. - + # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" + # config.gem "aws-s3", :lib => "aws/s3" + # Walter McGinnis, 2008-07-02 # we currently use a hacked version of oai gem # and place it under vendor/gems @@ -48,14 +50,11 @@ # Kieran, 2008-07-22 # specify the specific versions we need to run Kete - # (currently causes problems, will investigate) - # lib-xml 0.8.0 causes errors in acts_as_zoom - #config.gem "libxml-ruby", :version => '< 0.8.0' - # packet 0.1.8 causes imports to fail silently - #config.gem "packet", :version => '0.1.7' - - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "aws-s3", :lib => "aws/s3" + # libxml-ruby 0.8.0 causes errors in acts_as_zoom + config.gem 'libxml-ruby', :lib => 'libxml', :version => '< 0.8.0' + # backgroundrb 1.1 requires packet 0.1.14 + config.gem 'packet', :version => '>= 0.1.14' + # Only load the plugins named here, in the order given. By default, all plugins # in vendor/plugins are loaded in alphabetical order. diff --git a/config/initializers/tinymce.rb b/config/initializers/tinymce.rb index e83350c77..13a0b6e83 100644 --- a/config/initializers/tinymce.rb +++ b/config/initializers/tinymce.rb @@ -1 +1,28 @@ EXTENDED_VALID_ELEMENTS = 'code[class|dir 'advanced', + :theme_advanced_toolbar_location => "top", + :theme_advanced_toolbar_align => "left", + :theme_advanced_statusbar_location => "bottom", + :theme_advanced_buttons1 => %w{ bold italic underline strikethrough separator justifyleft justifycenter justifyright justifyfull separator indent outdent separator bullist numlist forecolor backcolor separator link unlink image separator undo redo separator code}, + :theme_advanced_buttons2 => %w{ formatselect fontselect fontsizeselect separator pastetext pasteword selectall }, + :theme_advanced_buttons3_add => %w{ tablecontrols fullscreen }, + :theme_advanced_resizing => true, + :theme_advanced_resize_horizontal => false, + + # link / image path conversions + :convert_urls => false, + :content_css => "/stylesheets/base.css", + + # paste plugin specific settings + :paste_auto_cleanup_on_paste => true, + :paste_convert_middot_lists => false, + :paste_convert_headers_to_strong => true, + + # which plugins we are enabling + :plugins => %w{ contextmenu paste table fullscreen } +} \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 469444a95..f4459ad27 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -136,6 +136,8 @@ map.connect 'zebra_uptime.txt', :controller => "index_page", :action => 'zebra_uptime' # to make sure that registration is valid map.connect 'validate_kete_net_link.xml', :controller => "index_page", :action => 'validate_kete_net_link' + # for search engines, ask them not to go to certain places + map.connect 'robots.txt', :controller => "index_page", :action => 'robots' map.connect '*path', :controller => 'application', :action => 'rescue_404' unless ActionController::Base.consider_all_requests_local end diff --git a/db/bootstrap/contributions.yml b/db/bootstrap/contributions.yml index 65a777be5..757d553d6 100755 --- a/db/bootstrap/contributions.yml +++ b/db/bootstrap/contributions.yml @@ -134,3 +134,12 @@ contributions_015: contributed_item_id: "14" created_at: <%= Time.now.utc.to_s :db %> updated_at: <%= Time.now.utc.to_s :db %> +contributions_016: + contributed_item_type: Topic + id: "16" + version: "1" + contributor_role: creator + user_id: "1" + contributed_item_id: "15" + created_at: <%= Time.now.utc.to_s :db %> + updated_at: <%= Time.now.utc.to_s :db %> diff --git a/db/bootstrap/system_settings.yml b/db/bootstrap/system_settings.yml index df130c6f3..31bf391ea 100644 --- a/db/bootstrap/system_settings.yml +++ b/db/bootstrap/system_settings.yml @@ -470,3 +470,11 @@ system_settings_053: id: "53" value: "[]" section: System +systsystem_settings_054: + name: Government Website + technically_advanced: true + required_to_be_configured: false + explanation: "Your local/countries government website. Opening [ and closing ] are required. Format: ['name', 'url']" + id: "54" + value: "['newzealand.govt.nz', 'http://newzealand.govt.nz/']" + section: System \ No newline at end of file diff --git a/db/bootstrap/topic_versions.yml b/db/bootstrap/topic_versions.yml index ea606c503..f2c95e7ba 100644 --- a/db/bootstrap/topic_versions.yml +++ b/db/bootstrap/topic_versions.yml @@ -458,3 +458,118 @@ topics_014:

    Lastly you will want to edit this topic using the edit link below. You can also replace it, either with another topic or by redirecting users to results for all topics, images, audio, video, web links, documents, or discussion via the site basket edit page.

    Credits

    This topic was originally written by Walter McGinnis at Katipo Communications and Russel Garlick at Liblime.

    +topics_015: + title: Accessibility + short_summary: Accessibility features of this website + raw_tag_list: "" + id: "15" + topic_id: "15" + version: "1" + basket_id: "2" + topic_type_id: "1" + index_for_basket_id: + created_at: <%= Time.now.utc.to_s :db %> + updated_at: <%= Time.now.utc.to_s :db %> + description: |+ +

    Standards

    +

    This site was produced to meet New Zealand Government Web Standards and Recommendations v 1.0

    +

    Access keys

    +

    Access keys help you to navigate to commonly used pages in the site without needing to use a mouse or other pointing device. To activate an access key, hold down the ALT key (for PCs) or CONTROL key (for Apple Macintosh) plus the relevant access key shown below (at the same time). For some browsers you may need to press enter to confirm your choice.

    +

    The available keyboard shortcuts are:

    +

    0 = Accessibility help page

    +

    1 = Home page

    +

    2 = Site map

    +

    3 = Search

    +

    9 = Contact us

    +

    [ = jump to content beginning

    +

    / = link to govt.nz website

    +

    To use the keyboard Accesskeys:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    BrowserVersionActivate Accesskey
    Internet ExplorerIE 5+ (Windows)Alt + Accesskey, then Enter
    Internet ExplorerIE 5, 6 (Mac)Ctrl+ Accesskey
    FirefoxFF <= 1.5 (Windows) Alt + Accesskey
    FirefoxFF 2 (Windows)Alt + Shift + Accesskey
    FirefoxFF 2 (Mac)Ctrl+ Accesskey
    FirefoxFF 3 (Windows)Alt + Shift + Accesskey
    OperaEarly versionsAccesskey not supported
    Operav7+ (Windows or Mac)Shift + Escape, (release) then Accesskey
    Mozilla(Windows)Alt + Accesskey
    Mozilla(Mac)Ctrl+ Accesskey
    Safariv1.2+ (Mac)Ctrl+ Accesskey
    NetscapeNN 6-8 (Windows)Alt + Accesskey
    NetscapeNN 9 (Windows)Alt + Shift + Accesskey
    NetscapeNN 6+ (Mac)Ctrl+ Accesskey
    +

    Note: Some browers do not support the numbers on the Number Pad being used as Accesskeys. Use the numbers at the top of the keyboard.

    +

    Text size

    +

    You can make the text on this site bigger or smaller to suit you if your browser supports text resizing (i.e. recent versions of Internet Explorer, Firefox, Safari or Opera).

    +

    To resize your fonts:

    + diff --git a/db/bootstrap/topics.yml b/db/bootstrap/topics.yml index 141d9519c..bb164b5de 100644 --- a/db/bootstrap/topics.yml +++ b/db/bootstrap/topics.yml @@ -456,3 +456,118 @@ topics_014:

    Lastly you will want to edit this topic using the edit link below. You can also replace it, either with another topic or by redirecting users to results for all topics, images, audio, video, web links, documents, or discussion via the site basket edit page.

    Credits

    This topic was originally written by Walter McGinnis at Katipo Communications and Russel Garlick at Liblime.

    + +topics_015: + title: Accessibility + short_summary: Accessibility features of this website + raw_tag_list: "" + id: "15" + version: "1" + basket_id: "2" + topic_type_id: "1" + index_for_basket_id: + created_at: <%= Time.now.utc.to_s :db %> + updated_at: <%= Time.now.utc.to_s :db %> + description: |+ +

    Standards

    +

    This site was produced to meet New Zealand Government Web Standards and Recommendations v 1.0

    +

    Access keys

    +

    Access keys help you to navigate to commonly used pages in the site without needing to use a mouse or other pointing device. To activate an access key, hold down the ALT key (for PCs) or CONTROL key (for Apple Macintosh) plus the relevant access key shown below (at the same time). For some browsers you may need to press enter to confirm your choice.

    +

    The available keyboard shortcuts are:

    +

    0 = Accessibility help page

    +

    1 = Home page

    +

    2 = Site map

    +

    3 = Search

    +

    9 = Contact us

    +

    [ = jump to content beginning

    +

    / = link to govt.nz website

    +

    To use the keyboard Accesskeys:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    BrowserVersionActivate Accesskey
    Internet ExplorerIE 5+ (Windows)Alt + Accesskey, then Enter
    Internet ExplorerIE 5, 6 (Mac)Ctrl+ Accesskey
    FirefoxFF <= 1.5 (Windows) Alt + Accesskey
    FirefoxFF 2 (Windows)Alt + Shift + Accesskey
    FirefoxFF 2 (Mac)Ctrl+ Accesskey
    FirefoxFF 3 (Windows)Alt + Shift + Accesskey
    OperaEarly versionsAccesskey not supported
    Operav7+ (Windows or Mac)Shift + Escape, (release) then Accesskey
    Mozilla(Windows)Alt + Accesskey
    Mozilla(Mac)Ctrl+ Accesskey
    Safariv1.2+ (Mac)Ctrl+ Accesskey
    NetscapeNN 6-8 (Windows)Alt + Accesskey
    NetscapeNN 9 (Windows)Alt + Shift + Accesskey
    NetscapeNN 6+ (Mac)Ctrl+ Accesskey
    +

    Note: Some browers do not support the numbers on the Number Pad being used as Accesskeys. Use the numbers at the top of the keyboard.

    +

    Text size

    +

    You can make the text on this site bigger or smaller to suit you if your browser supports text resizing (i.e. recent versions of Internet Explorer, Firefox, Safari or Opera).

    +

    To resize your fonts:

    + \ No newline at end of file diff --git a/db/migrate/20081005210917_add_scheduled_at_to_bdrb_job_queues.rb b/db/migrate/20081005210917_add_scheduled_at_to_bdrb_job_queues.rb new file mode 100644 index 000000000..a04150ae8 --- /dev/null +++ b/db/migrate/20081005210917_add_scheduled_at_to_bdrb_job_queues.rb @@ -0,0 +1,9 @@ +class AddScheduledAtToBdrbJobQueues < ActiveRecord::Migration + def self.up + add_column :bdrb_job_queues, :scheduled_at, :datetime + end + + def self.down + remove_column :bdrb_job_queues, :scheduled_at + end +end diff --git a/lib/extended_content_controller.rb b/lib/extended_content_controller.rb index e835139a9..fcadd82d1 100644 --- a/lib/extended_content_controller.rb +++ b/lib/extended_content_controller.rb @@ -24,29 +24,8 @@ def self.included(klass) klass.send :protect_from_forgery, :secret => KETE_SECRET, :except => ['new', 'destroy'] ### TinyMCE WYSIWYG editor stuff - klass.send :uses_tiny_mce, :options => { :theme => 'advanced', - :mode => "textareas", - :convert_urls => false, - :content_css => "/stylesheets/base.css", - :remove_script_host => true, - :theme_advanced_toolbar_location => "top", - :theme_advanced_toolbar_align => "left", - :theme_advanced_resizing => true, - :theme_advanced_resize_horizontal => false, - :theme_advanced_buttons1 => %w{ bold italic underline strikethrough separator justifyleft justifycenter justifyright indent outdent separator bullist numlist forecolor backcolor separator link unlink image undo redo code}, - :theme_advanced_buttons2 => %w{ formatselect fontselect fontsizeselect pastetext pasteword selectall }, - :theme_advanced_buttons3_add => %w{ tablecontrols fullscreen}, - :editor_selector => 'mceEditor', - :paste_create_paragraphs => true, - :paste_create_linebreaks => true, - :paste_use_dialog => true, - :paste_auto_cleanup_on_paste => true, - :paste_convert_middot_lists => false, - :paste_unindented_list_class => "unindentedList", - :paste_convert_headers_to_strong => true, - :paste_insert_word_content_callback => "convertWord", - :plugins => %w{ contextmenu paste table fullscreen} }, - :only => [:new, :pick, :create, :edit, :update, :pick_topic_type] + klass.send :uses_tiny_mce, :options => DEFAULT_TINYMCE_SETTINGS, + :only => VALID_TINYMCE_ACTIONS ### end TinyMCE WYSIWYG editor stuff def load_content_type diff --git a/lib/importer.rb b/lib/importer.rb index 725625713..8ce3f5161 100644 --- a/lib/importer.rb +++ b/lib/importer.rb @@ -362,13 +362,25 @@ def importer_process(record, params) # switching to pulling record to a hash # and grabbing the specific fields # we need to check - def importer_xml_record_to_hash(record) + def importer_xml_record_to_hash(record, upcase = false) record_hash = Hash.from_xml(record.to_s) # HACK to go down one more level record_hash.keys.each do |record_field| record_hash = record_hash[record_field] end + + # move all hash keys to upcase + # we use this to smooth some legacy code in past perfect import + if upcase + new_record_hash = Hash.new + record_hash.each do |key, value| + key = key.upcase if key.is_a?(String) + new_record_hash[key] = value + end + record_hash = new_record_hash + end + logger.info("record_hash inspect: " + record_hash.inspect) record_hash end @@ -384,13 +396,13 @@ def importer_trim_fat_from_xml_import_file(path_to_original_file,path_to_output, fatty_re = Regexp.new("\/\>.*") - accessno_re = Regexp.new("ACCESSNO>(.*)<") + accessno_re = Regexp.new(/ACCESSNO>(.*) or line, so that it can be replaced + # putting in both styles of records + if line.include?("ACCESSNO") || line.include?("accessno") || + line.include?("DESCRIP") || line.include?("descrip") || + line.include?("\/Record") || line.include?("\/export") || + line.include?("Information") || + line.include?("Root") || line.include?("VFPData") + if line.include?("accessno") || line.include?("ACCESSNO") accessno = line.match(accessno_re)[1] - new_start_record_line = "\n" + if @root_element_name == 'Root' + new_start_record_line = "\n" + else + new_start_record_line = "\n" + end + fat_free_file << new_start_record_line else fat_free_file << line diff --git a/lib/importer_zoom.rb b/lib/importer_zoom.rb index 0eac40b5f..e86bc4ac4 100644 --- a/lib/importer_zoom.rb +++ b/lib/importer_zoom.rb @@ -24,7 +24,7 @@ def importer_oai_record_xml(options = { }) xml.record do xml.header do oai_dc_xml_oai_identifier(xml,item) - xml.datestamp(Time.now.utc.xmlschema) + oai_dc_xml_oai_datestamp(xml, item) oai_dc_xml_oai_set_specs(xml,item) end xml.metadata do diff --git a/lib/oai_dc_helpers.rb b/lib/oai_dc_helpers.rb index e582950c4..409158897 100644 --- a/lib/oai_dc_helpers.rb +++ b/lib/oai_dc_helpers.rb @@ -30,6 +30,37 @@ def oai_dc_xml_oai_identifier(xml, item) xml.identifier("#{ZoomDb.zoom_id_stub}#{item.basket.urlified_name}:#{item.class.name}:#{item.id}") end + # Walter McGinnis, 2008-10-05 + # adding better logic for determining last time the item was changed + # we want the datestamp to reflect the most recent change to the item + # that can be either when it is created/edited + # or when a relationship has been added + # note that if a relation is removed, this may result in rolling back in time + # of datestamp, which may be counterintuitive, however that is a rare case + def oai_dc_xml_oai_datestamp(xml, item) + most_recent_updated_at = item.updated_at + + if item.class.name == 'Topic' + # topics can be on either side of the content_item_relation join model + # so to get all possible relations, you have to combine them + all_relations = item.content_item_relations + item.child_content_item_relations + + if all_relations.size > 0 + all_relations.sort! { |a,b| a.updated_at <=> b.updated_at } + + last_relation = all_relations.last + if last_relation.updated_at > most_recent_updated_at + most_recent_updated_at = last_relation.updated_at + end + end + elsif item.content_item_relations.count > 0 && + item.content_item_relations.last.updated_at > most_recent_updated_at + most_recent_updated_at = item.content_item_relations.last.updated_at + end + + xml.datestamp(most_recent_updated_at.utc.xmlschema) + end + # Walter McGinnis, 2008-06-16 # adding oai pmh set support # assumes public zoom_db diff --git a/lib/recipes/kete.rb b/lib/recipes/kete.rb index 5dc05e15e..c9559876c 100644 --- a/lib/recipes/kete.rb +++ b/lib/recipes/kete.rb @@ -20,6 +20,7 @@ deploy.update_code deploy.prepare.setup_zebra deploy.prepare.setup_imports + deploy.prepare.setup_private deploy.prepare.setup_themes deploy.symlink deploy.prepare.default @@ -52,6 +53,11 @@ run "cp -r #{latest_release}/imports #{shared_path}/system/" end + desc "The directory that holds everything related to private items needs to live under share/system/private" + task :setup_private, :roles => :app do + run "cp -r #{latest_release}/private #{shared_path}/system/" + end + desc "The directory that holds everything related to themes needs to live under share/system/themes" task :setup_themes, :roles => :app do run "cp -r #{latest_release}/public/themes #{shared_path}/system/" @@ -100,6 +106,12 @@ run "rm -rf #{current_path}/imports" run "ln -nfs #{shared_path}/system/imports #{current_path}/" + # handle our private directory and all the stuff that lives in it + # make system/private if it doesn't exist already + run "mkdir -p #{shared_path}/system/private" + run "rm -rf #{current_path}/private" + run "ln -nfs #{shared_path}/system/private #{current_path}/" + # handle our themes directory and all the stuff that lives in it # make system/themes if it doesn't exist already run "mkdir -p #{shared_path}/system/themes" diff --git a/lib/tasks/tools.rake b/lib/tasks/tools.rake new file mode 100644 index 000000000..e24af93de --- /dev/null +++ b/lib/tasks/tools.rake @@ -0,0 +1,15 @@ +# lib/tasks/tools.rake +# +# miscellaneous tools for kete (clearing robots.txt file) +# +# Kieran Pilkington, 2008-10-01 +# +namespace :kete do + namespace :tools do + desc 'Remove /robots.txt (will rebuild next time a bot visits the page)' + task :remove_robots_txt => :environment do + path = "#{RAILS_ROOT}/public/robots.txt" + File.delete(path) if File.exist?(path) + end + end +end diff --git a/lib/tasks/upgrade.rake b/lib/tasks/upgrade.rake index f1b9559c3..a1364990a 100644 --- a/lib/tasks/upgrade.rake +++ b/lib/tasks/upgrade.rake @@ -10,12 +10,14 @@ namespace :kete do task :upgrade => ['kete:upgrade:add_new_baskets', 'kete:upgrade:add_tech_admin', 'kete:upgrade:add_new_system_settings', + 'kete:upgrade:add_new_default_topics', 'kete:upgrade:change_zebra_password', 'kete:upgrade:check_required_software', 'kete:upgrade:add_missing_mime_types', 'kete:upgrade:correct_basket_defaults', 'zebra:load_initial_records', - 'kete:upgrade:update_existing_comments_commentable_private'] + 'kete:upgrade:update_existing_comments_commentable_private', + 'kete:tools:remove_robots_txt'] namespace :upgrade do desc 'Privacy Controls require that Comment#commentable_private be set. Update existing comments to have this data.' task :update_existing_comments_commentable_private => :environment do @@ -51,6 +53,31 @@ namespace :kete do end end + desc 'Add the new default topics that are missing from our Kete installation.' + task :add_new_default_topics => :environment do + topics_from_yml = YAML.load_file("#{RAILS_ROOT}/db/bootstrap/topics.yml") + + # for each topic from yml + # check if it's in the db + # if not, add it + # system settings have unique names + topics_from_yml.each do |topic_array| + topic_hash = topic_array[1] + + # if there are existing topics + # drop id from hash, as we want to determine it dynamically + # else we want to use the bootstap versions + topic_hash.delete('id') if Topic.count > 0 + + if !Topic.find_by_title_and_basket_id(topic_hash['title'], topic_hash['basket_id']) + topic = Topic.create!(topic_hash) + topic.creator = User.first + topic.save + p "added topic: " + topic_hash['title'] + end + end + end + desc 'Add any new default baskets that are missing from our system.' task :add_new_baskets => :environment do baskets_from_yml = YAML.load_file("#{RAILS_ROOT}/db/bootstrap/baskets.yml") diff --git a/lib/workers/past_perfect4_importer_worker.rb b/lib/workers/past_perfect4_importer_worker.rb index 7c44d44eb..d91978f2c 100644 --- a/lib/workers/past_perfect4_importer_worker.rb +++ b/lib/workers/past_perfect4_importer_worker.rb @@ -59,6 +59,12 @@ def do_work(args = nil) logger.info("params: " + params.inspect) @import_photos_file_path = "#{@import_dir_path}/records.xml" + + # this sets the instance vars that tell us what xml element paths we are using + # old style or new style + determine_elements_used(@import_photos_file_path) + + # this gets rid of xml elements that have empty values @path_to_trimmed_photos = importer_trim_fat_from_xml_import_file(@import_photos_file_path,"#{RAILS_ROOT}/tmp/trimmed_photos_pp4.xml") @import_photos_xml = REXML::Document.new File.open(@path_to_trimmed_photos) @@ -81,7 +87,7 @@ def do_work(args = nil) # and grab information from the accessions file # bases on ACCESSNO as a kind of forein key # as we need it - @import_photos_xml.elements.each("Root/Information/Record") do |record| + @import_photos_xml.elements.each(@root_element_name + '/' + @record_element_path) do |record| # we override this locally for our customizations importer_process(record, params) end @@ -104,7 +110,7 @@ def importer_process(record, params) image_objectid = nil objectid = nil - record_hash = importer_xml_record_to_hash(record) + record_hash = importer_xml_record_to_hash(record, true) # make sure there is a imagefile value # if not, log record to skipped photos file with reason skipped @@ -176,7 +182,7 @@ def importer_process(record, params) # file may time out related_accession_record = nil - related_accession_record = @import_accessions_xml_root.elements["Information/Record[@ACCESSNO=\'#{related_topic_pp4_objectid}\']"] + related_accession_record = @import_accessions_xml_root.elements["#{@record_element_path}[@ACCESSNO=\'#{related_topic_pp4_objectid}\']"] # we have some accesion record's that are mangled # by being three sections # rather than two @@ -199,13 +205,13 @@ def importer_process(record, params) end if related_topic.nil? - related_accession_record = @import_accessions_xml_root.elements["Information/Record[@ACCESSNO=\'#{cleaned_up_accessno}\']"] + related_accession_record = @import_accessions_xml_root.elements["#{@record_element_path}[@ACCESSNO=\'#{cleaned_up_accessno}\']"] end related_topic_pp4_objectid = cleaned_up_accessno end if !related_accession_record.blank? and related_topic.nil? - accession_record_hash = importer_xml_record_to_hash(related_accession_record) + accession_record_hash = importer_xml_record_to_hash(related_accession_record, true) # create a new topic from related_accession_record # prepare user_reference for extended_content @@ -484,4 +490,25 @@ def create_new_item_from_record(record, zoom_class, options = {}) logger.info("new_record: " + new_record.inspect) return new_record end + + # set up the correct xml paths to use + # based on what is in the source file + def determine_elements_used(in_file) + # assume original style root element and paths + @root_element_name = 'Root' + @record_element_path = 'Information/Record' + # this should tell us what we need to know by around the second line + IO.foreach(in_file) do |line| + # if exported directly from Past Perfect, should match this + # empty means no match + if line.include?("") + @root_element_name = 'VFPData' + @record_element_path = 'export' + return + else + # we have matched the previous style, return without resetting vars + return if line.include?("") + end + end + end end diff --git a/public/javascripts/redbox.js b/public/javascripts/redbox.js index bce499a84..0d9ebca39 100644 --- a/public/javascripts/redbox.js +++ b/public/javascripts/redbox.js @@ -11,17 +11,21 @@ var RedBox = { loading: function() { this.showOverlay(); - Element.show('RB_loading'); - this.setWindowPosition(); + Element.show('RB_window'); + this.setWindowPositions(); }, addHiddenContent: function(id) { this.removeChildrenFromNode($('RB_window')); this.moveChildren($(id), $('RB_window')); + this.activateRBWindow(); + }, + + activateRBWindow: function() + { Element.hide('RB_loading'); - new Effect.Appear('RB_window', {duration: 0.4, queue: 'end'}); - this.setWindowPosition(); + this.setWindowPositions(); }, close: function() @@ -33,16 +37,16 @@ var RedBox = { showOverlay: function() { + var inside_redbox = '' if ($('RB_redbox')) { Element.update('RB_redbox', ""); - new Insertion.Top($('RB_redbox'), ''); + new Insertion.Top($('RB_redbox'), inside_redbox); } else { - new Insertion.Top(document.body, '
    '); + new Insertion.Top(document.body, '
    ' + inside_redbox + '
    '); } - new Insertion.Bottom('RB_redbox', ''); this.setOverlaySize(); this.hideSelectBoxes(); @@ -66,29 +70,109 @@ var RedBox = { $("RB_overlay").style['height'] = yScroll +"px"; }, - setWindowPosition: function() + setWindowPositions: function() { - var pagesize = this.getPageSize(); - - $("RB_window").style['width'] = 'auto'; - $("RB_window").style['height'] = 'auto'; - - var dimensions = Element.getDimensions($("RB_window")); - var width = dimensions.width; - var height = dimensions.height; - - $("RB_window").style['left'] = ((pagesize[0] - width)/2) + "px"; - $("RB_window").style['top'] = ((pagesize[1] - height)/2) + "px"; + this.setWindowPosition('RB_window'); }, + setWindowPosition: function(window_id) + { + var arrayPageSize = this.getPageSize(); + var arrayPageScroll = this.getPageScroll(); + + var boxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10); + var boxLeft = arrayPageScroll[0]; + Element.setTop(window_id, boxTop); + Element.setLeft(window_id, boxLeft); + }, + + // + // getPageScroll() + // Returns array with x,y page scroll values. + // Stolen by from lightbox.js, by Lokesh Dhakar - http://www.huddletogether.com + // Core code from - quirksmode.com + // + getPageScroll: function(){ + + var xScroll, yScroll; + + if (self.pageYOffset) { + yScroll = self.pageYOffset; + xScroll = self.pageXOffset; + } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict + yScroll = document.documentElement.scrollTop; + xScroll = document.documentElement.scrollLeft; + } else if (document.body) {// all other Explorers + yScroll = document.body.scrollTop; + xScroll = document.body.scrollLeft; + } - getPageSize: function() { - var de = document.documentElement; - var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; - var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; + arrayPageScroll = new Array(xScroll,yScroll) + return arrayPageScroll; + }, - arrayPageSize = new Array(w,h) - return arrayPageSize; + // + // getPageSize() + // Returns array with page width, height and window width, height + // Stolen by from lightbox.js, by Lokesh Dhakar - http://www.huddletogether.com + // Core code from - quirksmode.com + // Edit for Firefox by pHaez + // + getPageSize: function() { + + var xScroll, yScroll; + + if (window.innerHeight && window.scrollMaxY) { + xScroll = window.innerWidth + window.scrollMaxX; + yScroll = window.innerHeight + window.scrollMaxY; + } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac + xScroll = document.body.scrollWidth; + yScroll = document.body.scrollHeight; + } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari + xScroll = document.body.offsetWidth; + yScroll = document.body.offsetHeight; + } + + var windowWidth, windowHeight; + + // console.log(self.innerWidth); + // console.log(document.documentElement.clientWidth); + + if (self.innerHeight) { // all except Explorer + if(document.documentElement.clientWidth){ + windowWidth = document.documentElement.clientWidth; + } else { + windowWidth = self.innerWidth; + } + windowHeight = self.innerHeight; + } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode + windowWidth = document.documentElement.clientWidth; + windowHeight = document.documentElement.clientHeight; + } else if (document.body) { // other Explorers + windowWidth = document.body.clientWidth; + windowHeight = document.body.clientHeight; + } + + // for small pages with total height less then height of the viewport + if(yScroll < windowHeight){ + pageHeight = windowHeight; + } else { + pageHeight = yScroll; + } + + // console.log("xScroll " + xScroll) + // console.log("windowWidth " + windowWidth) + + // for small pages with total width less then width of the viewport + if(xScroll < windowWidth){ + pageWidth = xScroll; + } else { + pageWidth = windowWidth; + } + // console.log("pageWidth " + pageWidth) + + arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) + return arrayPageSize; }, removeChildrenFromNode: function(node) @@ -113,7 +197,7 @@ var RedBox = { content.style['display'] = 'block'; $('RB_window').appendChild(content); - this.setWindowPosition(); + this.setWindowPositions(); }, hideSelectBoxes: function() diff --git a/public/javascripts/tiny_mce/plugins/advimage/js/image.js b/public/javascripts/tiny_mce/plugins/advimage/js/image.js index 0db894ca3..64fc6f677 100755 --- a/public/javascripts/tiny_mce/plugins/advimage/js/image.js +++ b/public/javascripts/tiny_mce/plugins/advimage/js/image.js @@ -103,7 +103,7 @@ var ImageDialog = { if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { if (!f.alt.value) { - tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { + tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { if (s) t.insertAndClose(); }); diff --git a/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js b/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js index 2efc1b731..a89625014 100755 --- a/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js +++ b/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js @@ -428,7 +428,6 @@ function setAllAttribs(elm) { var target = getSelectValue(formObj, 'targetlist'); setAttrib(elm, 'href', href); - setAttrib(elm, 'mce_href', href); setAttrib(elm, 'title'); setAttrib(elm, 'target', target == '_self' ? '' : target); setAttrib(elm, 'id'); @@ -464,7 +463,7 @@ function setAllAttribs(elm) { function getSelectValue(form_obj, field_name) { var elm = form_obj.elements[field_name]; - if (elm == null || elm.options == null) + if (!elm || elm.options == null || elm.selectedIndex == -1) return ""; return elm.options[elm.selectedIndex].value; diff --git a/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js b/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js index 31423da17..727beb574 100755 --- a/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +++ b/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js @@ -1 +1 @@ -(function(){tinymce.create('tinymce.plugins.FullPagePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceFullPageProperties',function(){ed.windowManager.open({file:url+'/fullpage.htm',width:430+parseInt(ed.getLang('fullpage.delta_width',0)),height:495+parseInt(ed.getLang('fullpage.delta_height',0)),inline:1},{plugin_url:url,head_html:t.head});});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);},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};},_setBodyAttribs:function(ed,o){var bdattr,i,len,kv,k,v,t,attr=this.head.match(/body(.*?)>/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);for(i=0,len=bdattr.length;i',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('\n';t.head+=ed.getParam('fullpage_default_doctype','');t.head+='\n\n\n'+ed.getParam('fullpage_default_title','Untitled document')+'\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='\n\n';t.foot='\n\n';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})(); \ No newline at end of file +(function(){tinymce.create('tinymce.plugins.FullPagePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceFullPageProperties',function(){ed.windowManager.open({file:url+'/fullpage.htm',width:430+parseInt(ed.getLang('fullpage.delta_width',0)),height:495+parseInt(ed.getLang('fullpage.delta_height',0)),inline:1},{plugin_url:url,head_html:t.head});});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);},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};},_setBodyAttribs:function(ed,o){var bdattr,i,len,kv,k,v,t,attr=this.head.match(/body(.*?)>/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(bdattr){for(i=0,len=bdattr.length;i',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('\n';t.head+=ed.getParam('fullpage_default_doctype','');t.head+='\n\n\n'+ed.getParam('fullpage_default_title','Untitled document')+'\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='\n\n';t.foot='\n\n';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})(); \ No newline at end of file diff --git a/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js index b91fb2975..019682d69 100755 --- a/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +++ b/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 827 2008-04-29 15:02:42Z spocke $ + * $Id: editor_plugin_src.js 920 2008-09-09 14:05:33Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -51,21 +51,23 @@ if (attr && attr[1]) { bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g); - for(i = 0, len = bdattr.length; i < len; i++) { - kv = bdattr[i].split('='); - k = kv[0].replace(/\s/,''); - v = kv[1]; + if (bdattr) { + for(i = 0, len = bdattr.length; i < len; i++) { + kv = bdattr[i].split('='); + k = kv[0].replace(/\s/,''); + v = kv[1]; - if (v) { - v = v.replace(/^\s+/,'').replace(/\s+$/,''); - t = v.match(/^["'](.*)["']$/); + if (v) { + v = v.replace(/^\s+/,'').replace(/\s+$/,''); + t = v.match(/^["'](.*)["']$/); - if (t) - v = t[1]; - } else - v = k; + if (t) + v = t[1]; + } else + v = k; - ed.dom.setAttrib(ed.getBody(), 'style', v); + ed.dom.setAttrib(ed.getBody(), 'style', v); + } } } }, diff --git a/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js b/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js index b22d28800..89059ef66 100755 --- a/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +++ b/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js @@ -143,7 +143,7 @@ function init() { switch (eq.toLowerCase()) { case "content-type": - tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, value, 1); + tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1); // Override XML encoding if (tmp != "") @@ -374,7 +374,6 @@ function updateAction() { } function changedStyleField(field) { - //alert(field.id); } function setMeta(he, k, v) { diff --git a/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js b/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js index 7b848f1e9..fbcec59e8 100755 --- a/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +++ b/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js @@ -1 +1 @@ -(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})(); \ No newline at end of file +(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(tinymce.isIE&&(s.fullscreen_html_overflow=='visible'||s.fullscreen_html_overflow=='scroll'))s.fullscreen_html_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:'+(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel)?'absolute':'fixed')+';top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})(); \ No newline at end of file diff --git a/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js index ba43f27d5..77a8c3b9a 100755 --- a/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +++ b/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 766 2008-04-03 20:37:06Z spocke $ + * $Id: editor_plugin_src.js 923 2008-09-09 16:45:29Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -60,6 +60,10 @@ if (tinymce.isIE && s.fullscreen_overflow == 'scroll') s.fullscreen_overflow = 'auto'; + // Fixes an IE bug where the scrollbars doesn't reappear + if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll')) + s.fullscreen_html_overflow = 'auto'; + if (s.fullscreen_overflow == '0px') s.fullscreen_overflow = ''; @@ -71,7 +75,7 @@ if (tinymce.isIE) vp.h -= 1; - n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:absolute;top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'}); + n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'}); DOM.add(n, 'div', {id : 'mce_fullscreen'}); tinymce.each(ed.settings, function(v, n) { diff --git a/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js b/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js index 2ddf43ba9..b4fffe5a2 100755 --- a/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +++ b/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js @@ -1 +1 @@ -(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','
    '));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&&t.editor.getParam('dialog_type')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{left:vp.x,top:vp.y,zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;iix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(w,ti){var e;w=this._findId(w);if(e=DOM.get(w+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_findId:function(w){var t=this;if(typeof(w)=='string')return w;each(t.windows,function(wo){var ifr=DOM.get(wo.id+'_ifr');if(ifr&&w==ifr.contentWindow){w=wo.id;return false;}});return w;},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})(); \ No newline at end of file +(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;t.windows={};},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','
    '));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&&t.editor.getParam('dialog_type','modal')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);if(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel))DOM.setStyles('mceModalBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w;if(w=t.windows[id]){w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;}},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;iix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(w,ti){var e;w=this._findId(w);if(e=DOM.get(w+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_findId:function(w){var t=this;if(typeof(w)=='string')return w;each(t.windows,function(wo){var ifr=DOM.get(wo.id+'_ifr');if(ifr&&w==ifr.contentWindow){w=wo.id;return false;}});return w;},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})(); \ No newline at end of file diff --git a/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js index 1d77c943f..0ae223b63 100755 --- a/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +++ b/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 809 2008-04-17 14:41:31Z spocke $ + * $Id: editor_plugin_src.js 917 2008-09-03 19:08:38Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -35,6 +35,7 @@ t.parent(ed); t.zIndex = 300000; t.count = 0; + t.windows = {}; }, open : function(f, p) { @@ -237,7 +238,6 @@ }); // Add window - t.windows = t.windows || {}; w = t.windows[id] = { id : id, mousedown_func : mdf, @@ -254,17 +254,20 @@ }); // Setup blocker - if (t.count == 0 && t.editor.getParam('dialog_type') == 'modal') { + if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') { DOM.add(DOM.doc.body, 'div', { id : 'mceModalBlocker', 'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker', - style : {left : vp.x, top : vp.y, zIndex : t.zIndex - 1} + style : {zIndex : t.zIndex - 1} }); DOM.show('mceModalBlocker'); // Reduces flicker in IE } else DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1); + if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel)) + DOM.setStyles('mceModalBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2}); + t.focus(id); t._fixIELayout(id, 1); @@ -278,16 +281,18 @@ }, focus : function(id) { - var t = this, w = t.windows[id]; - - w.zIndex = this.zIndex++; - w.element.setStyle('zIndex', w.zIndex); - w.element.update(); + var t = this, w; - id = id + '_wrapper'; - DOM.removeClass(t.lastId, 'mceFocus'); - DOM.addClass(id, 'mceFocus'); - t.lastId = id; + if (w = t.windows[id]) { + w.zIndex = this.zIndex++; + w.element.setStyle('zIndex', w.zIndex); + w.element.update(); + + id = id + '_wrapper'; + DOM.removeClass(t.lastId, 'mceFocus'); + DOM.addClass(id, 'mceFocus'); + t.lastId = id; + } }, _addAll : function(te, ne) { @@ -349,8 +354,12 @@ DOM.add(d.body, 'div', { id : 'mceEventBlocker', 'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'), - style : {left : vp.x, top : vp.y, zIndex : t.zIndex + 1} + style : {zIndex : t.zIndex + 1} }); + + if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel)) + DOM.setStyles('mceEventBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2}); + eb = new Element('mceEventBlocker'); eb.update(); @@ -470,17 +479,17 @@ id = t._findId(id || win); - t.count--; - - if (t.count == 0) - DOM.remove('mceModalBlocker'); - // Probably not inline - if (!id && win) { + if (!t.windows[id]) { t.parent(win); return; } + t.count--; + + if (t.count == 0) + DOM.remove('mceModalBlocker'); + if (w = t.windows[id]) { t.onClose.dispatch(t); Event.remove(d, 'mousedown', w.mousedownFunc); diff --git a/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css b/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css index 403692283..f844aba0d 100755 --- a/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +++ b/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css @@ -6,9 +6,9 @@ /* General */ .clearlooks2 {position:absolute; direction:ltr} .clearlooks2 .mceWrapper {position:static} -.mceEventBlocker {position:absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} +.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} .clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50)} -.clearlooks2_modalBlocker {position:absolute; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none} +.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none} /* Top */ .clearlooks2 .mceTop, .clearlooks2 .mceTop div {top:0; width:100%; height:23px} diff --git a/public/javascripts/tiny_mce/plugins/media/editor_plugin.js b/public/javascripts/tiny_mce/plugins/media/editor_plugin.js index 9c2c4bbf9..598649352 100755 --- a/public/javascripts/tiny_mce/plugins/media/editor_plugin.js +++ b/public/javascripts/tiny_mce/plugins/media/editor_plugin.js @@ -1 +1 @@ -(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.onPreInit.add(function(){ed.serializer.addRules('param[name|value|_value]');});ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return''});h=h.replace(/]*)>/gi,'');h=h.replace(/]*)\/>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/(object|embed)([^>]*)>/gi,'');h=h.replace(/]*)>/gi,function(a,b){return''});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam">');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.onPreInit.add(function(){ed.serializer.addRules('param[name|value|_value]');});ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};ed.selection.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.selection.onBeforeSetContent.add(t._objectsToSpans,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(t._objectsToSpans,t);ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_objectsToSpans:function(ed,o){var t=this,h=o.content;h=h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return''});h=h.replace(/]*)>/gi,'');h=h.replace(/]*)\/?>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/(object)([^>]*)>/gi,'');h=h.replace(/<\/embed>/gi,'');h=h.replace(/]*)>/gi,function(a,b){return''});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam">');o.content=h;},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';if(v)dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode','allowfullscreen','quality'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file diff --git a/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js index ebedd1273..8ed663e10 100755 --- a/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +++ b/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 870 2008-06-13 09:25:41Z spocke $ + * $Id: editor_plugin_src.js 906 2008-08-24 16:47:29Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -52,6 +52,12 @@ mceItemRealMedia : 'realmedia' }; + ed.selection.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.selection.onBeforeSetContent.add(t._objectsToSpans, t); + if (ed.settings.content_css !== false) ed.dom.loadCSS(url + "/css/content.css"); @@ -78,24 +84,7 @@ } }); - ed.onBeforeSetContent.add(function(ed, o) { - var h = o.content; - - h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { - var o = t._parse(c); - - return '' - }); - - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)\/>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/<\/(object|embed)([^>]*)>/gi, ''); - h = h.replace(/]*)>/gi, function(a, b) {return ''}); - h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam">'); - - o.content = h; - }); + ed.onBeforeSetContent.add(t._objectsToSpans, t); ed.onSetContent.add(function() { t._spansToImgs(ed.getBody()); @@ -211,6 +200,25 @@ }, // Private methods + _objectsToSpans : function(ed, o) { + var t = this, h = o.content; + + h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { + var o = t._parse(c); + + return '' + }); + + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)\/?>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/<\/(object)([^>]*)>/gi, ''); + h = h.replace(/<\/embed>/gi, ''); + h = h.replace(/]*)>/gi, function(a, b) {return ''}); + h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam">'); + + o.content = h; + }, _buildObj : function(o, n) { var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title); @@ -230,12 +238,13 @@ p.src = ed.convertURL(p.src, 'src', n); each (p, function(v, k) { - if (!/^(width|height|codebase|classid)$/.test(k)) { + if (!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)) { // Use url instead of src in IE for Windows media if (o.type == 'application/x-mplayer2' && k == 'src') k = 'url'; - dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v}); + if (v) + dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v}); } }); @@ -324,7 +333,7 @@ }); // Setup base parameters - each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode'], function(na) { + each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality'], function(na) { var v = dom.getAttrib(n, na); if (v) diff --git a/public/javascripts/tiny_mce/plugins/media/js/media.js b/public/javascripts/tiny_mce/plugins/media/js/media.js index f04d5d9c3..28816d1e1 100755 --- a/public/javascripts/tiny_mce/plugins/media/js/media.js +++ b/public/javascripts/tiny_mce/plugins/media/js/media.js @@ -183,7 +183,7 @@ function insertMedia() { tinyMCEPopup.restoreSelection(); if (!AutoValidator.validate(f)) { - alert(ed.getLang('invalid_data')); + tinyMCEPopup.alert(ed.getLang('invalid_data')); return false; } diff --git a/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js b/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js index 4a35002b4..eeeebd5bb 100755 --- a/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js +++ b/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js @@ -1 +1 @@ -(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

    ');content=content.replace(/\r\r/g,'

    ');content=content.replace(/\n\n/g,'

    ');if((pos=content.indexOf('

    '))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

    ";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

    ";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
    ');content=content.replace(/\r/g,'
    ');content=content.replace(/\n/g,'
    ');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

    $1

    ');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
    ","gi"),"

    "+middot+"$1

    ");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
    ]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

     <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

    ','

    ','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

      

    ');content=content.replace(//gi,'

    ');content=content.replace(/<\/h[1-6]>/gi,'

    ');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(!this.editor.selection.isCollapsed())this.editor.execCommand("Delete");if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

    ');content=content.replace(/\r\r/g,'

    ');content=content.replace(/\n\n/g,'

    ');if((pos=content.indexOf('

    '))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

    ";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

    ";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
    ');content=content.replace(/\r/g,'
    ');content=content.replace(/\n/g,'
    ');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

    $1

    ');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
    ","gi"),"

    "+middot+"$1

    ");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
    ]+>/g,"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

     <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

    ','

    ','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

      

    ');content=content.replace(//gi,'

    ');content=content.replace(/<\/h[1-6]>/gi,'

    ');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i 0) { + // Delete any highlighted text before pasting + if (!this.editor.selection.isCollapsed()) + this.editor.execCommand("Delete"); + if (bLinebreaks) { // Special paragraph treatment if (this.editor.getParam("paste_create_paragraphs", true)) { @@ -172,7 +176,7 @@ if (ed.getParam('paste_insert_word_content_callback')) content = ed.execCallback('paste_insert_word_content_callback', 'before', content); - var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); for (var i=0; i', 'gi'), "" + bull); // Covert to bull list content = content.replace(/<\/o:p>/gi, ""); content = content.replace(new RegExp('
    |';});}h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'<':return'<';case'>':return'>';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.doc.getElementById(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE)u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
    ');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='
    '+o.content+'
    ';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(

    ( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
    ');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
    ']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fz=tinymce.explode(s.font_size_style_values),fzc=tinymce.explode(s.font_size_classes),h,bm;each(ed.dom.select('font'),function(e){e.style.fontSize='';});ed.getDoc().execCommand('FontSize',false,v);if(s.inline_styles){each(ed.dom.select('font'),function(e){if(e.parentNode.nodeName=='FONT'&&e.size==e.parentNode.size){if(!bm)bm=ed.selection.getBookmark();ed.dom.remove(e,1);return;}if(v=e.size){if(fzc&&fzc.length>0)ed.dom.setAttrib(e,'class',fzc[parseInt(v)-1]);else ed.dom.setStyle(e,'fontSize',fz[parseInt(v)-1]);}});}ed.selection.moveToBookmark(bm);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
    ');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

    '):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),dom.isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

    <\\\/p>||

    \\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

    [\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

    ( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
    \\s*<\\\/p>|

    \\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
    ');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
    ');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
    ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
    ');aft=ed.dom.add(sn,se.element,null,'
    ');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
    ';if(isEmpty(aft))aft.innerHTML=isOpera?' ':'
    ';if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(aft):aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y=items.length){for(i=0,l=base.length;i=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0,l=base.length-(bp-1);i=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);function ready(){if(!o.async||x.readyState==4||c++>10000){if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}else w.setTimeout(ready,10);};if(!o.async)return ready();t=w.setTimeout(ready,10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value"},DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,sr;e=t.get(e);p=t.getPos(e);sr=t.getSize(e);return{x:p.x,y:p.y,w:sr.w,h:sr.h};},getSize:function(e){var t=this,w,h;e=t.get(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName.toUpperCase()==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n,xp;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(!t.selectorRe)t.selectorRe=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;;if(tinymce.isAir){each(tinymce.explode(pa),function(v){if(!(xp=t.cache[v])){xp='';each(v.split(' '),function(v){v=t.selectorRe.exec(v);xp+=v[1]?'//'+v[1]:'//*';if(v[2])xp+="[@id='"+v[2]+"']";if(v[3]){each(v[3].split('.'),function(n){xp+="[@class = '"+n+"' or contains(concat(' ', @class, ' '), ' "+n+" ')]";});}});t.cache[v]=xp;}xp=t.doc.evaluate(xp,s,null,4,null);while(n=xp.iterateNext())o.push(n);});return o;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;t.setAttribs(e,a);if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(!e||!n)return;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(!is(v,'string')){each(v,function(v,n){t.setStyle(e,n,v);});return;}if(s.keep_values){if(v&&!t._isRes(v))e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;case"shape":e.setAttribute('mce_style',v);break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv='';if(/^(src|href|style|coords|shape)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}if(isIE&&t.props[n]){v=e[t.props[n]];v=v&&v.nodeValue?v.nodeValue:v;}if(!v)v=e.getAttribute(n,2);if(n==='style'){v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&!t._isRes(v))e.setAttribute('mce_style',v);}}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0'||v===20)v='';break;case'width':case'height':case'vspace':if(v===0)v='';break;case'hspace':if(v===-1)v='';break;case'maxlength':case'tabindex':if(v===32768||v===2147483647)v='';break;case'compact':case'noshade':if(v===65535)return n;return dv;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v!==undefined&&v!==null&&v!=='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};st=st.replace(/&(#?[a-z0-9]+);/g,'&$1_MCE_SEMI_');each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/_MCE_SEMI_/g,';');v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null)+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){if(tinymce.isGecko&&k.indexOf('-moz-')===0)return;switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='
    '+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='
    '+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/

    <\/p>|]+)><\/p>|/gi,' 

    ');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/]+)>|

    /g,'');h=h.replace(/<\/p>/g,'

    ');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x|]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|]+)>/gi,'<$1i$2>');}else if(isIE)h=h.replace(/'/g,''');h=h.replace(/]+)\/>|/gi,'');if(s.keep_values){h=h.replace(//g,'');if(/|\/\/\s*-->|\]\]>|-->)\s*$/g,'');return s;};h=h.replace(/]+|)>([\s\S]*?)<\/script>/g,function(v,a,b){b=trim(b);if(!a)a=' type="text/javascript"';if(b)b='';return''+b+'';});h=h.replace(/]+|)>([\s\S]*?)<\/style>/g,function(v,a,b){b=trim(b);return''+b+'';});}h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'<':return'<';case'>':return'>';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.get(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE||(tinymce.isOpera&&parseFloat(opera.version())>=9.5))u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',tabindex:'1',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{if(!s.readonly)d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);if(!s.readonly)b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,element_format:s.element_format,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;if(!s.readonly)t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
    ');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='
    '+o.content+'
    ';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(

    ( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,'');});}if(isGecko&&!s.readonly){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language||'en',i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[(this.settings.language||'en')+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
    ');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko&&!s.readonly){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){var c=e.keyCode;if((c>=33&&c<=36)||(c>=37&&c<=40)||c==13||c==45||c==46||c==8||(tinymce.isMac&&(c==91||c==93))||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
    ']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;function isBlock(n){return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName);};tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else{if(ed.settings.convert_fonts_to_spans)t._applyInlineStyle('span',{style:{fontFamily:v}});else ed.getDoc().execCommand('FontName',false,v);}},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fc,fs;if(s.convert_fonts_to_spans&&v>=1&&v<=7){fs=tinymce.explode(s.font_size_style_values);fc=tinymce.explode(s.font_size_classes);if(fc)v=fc[v-1]||v;else v=fs[v-1]||v;}if(v>=1&&v<=7)ed.getDoc().execCommand('FontSize',false,v);else this._applyInlineStyle('span',{style:{fontSize:v}});},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontSize;if(!v&&(isOpera||isWebKit)){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return v||this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontFamily.replace(/, /g,',').replace(/[\'\"]/g,'').toLowerCase();if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(bl||n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(bl&&/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(bl||n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
    ');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if((e=t.getSelectedElement())&&!ed.settings.force_span_wrappers)set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(ed.settings.force_span_wrappers&&p.nodeName!='SPAN')return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},ForeColor:function(ui,v){var ed=this.editor;if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{color:v}});return;}else ed.getDoc().execCommand('ForeColor',false,v);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{backgroundColor:val}});return;}function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

    '):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!ed.settings.inline_styles&&!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE'));},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),isBlock);eb=dom.getParent(s.getEnd(),isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_applyInlineStyle:function(na,at,op){var t=this,ed=t.editor,dom=ed.dom,bm,lo={},kh;na=na.toUpperCase();if(op&&op.check_classes&&at['class'])op.check_classes.push(at['class']);function replaceFonts(){var bm;each(dom.select(tinymce.isWebKit?'span':'font'),function(n){if(n.style.fontFamily=='mceinline'||n.face=='mceinline'){if(!bm)bm=ed.selection.getBookmark();at._mce_new='1';dom.replace(dom.create(na,at),n,1);}});each(dom.select(na),function(n){if(n.getAttribute('_mce_new')){function removeStyle(n){if(n.nodeType==1){each(at.style,function(v,k){dom.setStyle(n,k,'');});if(at['class']&&n.className&&op){each(op.check_classes,function(c){if(dom.hasClass(n,c))dom.removeClass(n,c);});}}};each(dom.select(na,n),removeStyle);if(n.parentNode&&n.parentNode.nodeType==1&&n.parentNode.childNodes.length==1)removeStyle(n.parentNode);dom.getParent(n.parentNode,function(pn){if(pn.nodeType==1){if(at.style){each(at.style,function(v,k){var sv;if(!lo[k]&&(sv=dom.getStyle(pn,k))){if(sv===v)dom.setStyle(n,k,'');lo[k]=1;}});}if(at['class']&&pn.className&&op){each(op.check_classes,function(c){if(dom.hasClass(pn,c))dom.removeClass(n,c);});}}return false;});n.removeAttribute('_mce_new');}});each(dom.select(na).reverse(),function(n){var c=0;each(dom.getAttribs(n),function(an){if(an.nodeName.substring(0,1)!='_'&&dom.getAttrib(n,an.nodeName)!=''){c++;}});if(c==0)dom.remove(n,1);});ed.selection.moveToBookmark(bm);return!!bm;};ed.focus();ed.getDoc().execCommand('FontName',false,'mceinline');replaceFonts();if(kh=t._applyInlineStyle.keyhandler){ed.onKeyUp.remove(kh);ed.onKeyPress.remove(kh);ed.onKeyDown.remove(kh);ed.onSetContent.remove(t._applyInlineStyle.chandler);}if(ed.selection.isCollapsed()){t._pendingStyles=tinymce.extend(t._pendingStyles||{},at.style);t._applyInlineStyle.chandler=ed.onSetContent.add(function(){delete t._pendingStyles;});t._applyInlineStyle.keyhandler=kh=function(e){if(t._pendingStyles){at.style=t._pendingStyles;delete t._pendingStyles;}if(replaceFonts()){ed.onKeyDown.remove(t._applyInlineStyle.keyhandler);ed.onKeyPress.remove(t._applyInlineStyle.keyhandler);}if(e.type=='keyup')ed.onKeyUp.remove(t._applyInlineStyle.keyhandler);};ed.onKeyDown.add(kh);ed.onKeyPress.add(kh);ed.onKeyUp.add(kh);}else t._pendingStyles=0;},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),isBlock);eb=dom.getParent(en||s.getEnd(),isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

    <\\\/p>||

    \\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

    [\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

    ( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
    \\s*<\\\/p>|

    \\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
    ');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
    ');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
    ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i,n;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(r.startContainer.nodeType==1&&(n=r.startContainer.childNodes[r.startOffset])&&n.nodeType==1){n.setAttribute("id","__mce");}else{if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}else if(!isIE&&(n=ed.dom.get('__mce'))){n.removeAttribute('id');r=d.createRange();r.setStartBefore(n);r.setEndBefore(n);se.setRng(r);}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch,car;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
    ');aft=ed.dom.add(sn,se.element,null,'
    ');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
    ';function appendStyles(e,en){var nl=[],nn,n,i;e.innerHTML='';if(se.keep_styles){n=en;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)){nn=n.cloneNode(false);dom.setAttrib(nn,'id','');nl.push(nn);}}while(n=n.parentNode);}if(nl.length>0){for(i=nl.length-1,nn=e;i>=0;i--)nn=nn.appendChild(nl[i]);nl[0].innerHTML=isOpera?' ':'
    ';return nl[0];}else e.innerHTML=isOpera?' ':'
    ';};if(isEmpty(aft))car=appendStyles(aft,en);if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(car||aft):car||aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y]+)/gi, ' $1="$2"') + // Replace a=x with a="x" in IE + if (tinymce.isIE) + h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') + + document.dir = t.editor.getParam('directionality',''); + + if ((nv = t.editor.translate(h)) && nv != h) + document.body.innerHTML = nv; + + if ((nv = t.editor.translate(ti)) && nv != ti) + document.title = ti = nv; + } - document.dir = t.editor.getParam('directionality',''); - document.body.innerHTML = t.editor.translate(h); - document.title = ti = t.editor.translate(ti); document.body.style.display = ''; // Restore selection in IE when focus is placed on a non textarea or input element of the type text diff --git a/public/javascripts/tiny_mce/tiny_mce_src.js b/public/javascripts/tiny_mce/tiny_mce_src.js index eeaab3b1e..b0fd59327 100755 --- a/public/javascripts/tiny_mce/tiny_mce_src.js +++ b/public/javascripts/tiny_mce/tiny_mce_src.js @@ -3,8 +3,8 @@ var tinymce = { majorVersion : '3', - minorVersion : '1.0.1', - releaseDate : '2008-06-18', + minorVersion : '2.0.2', + releaseDate : '2008-10-02', _init : function() { var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v; @@ -17,6 +17,7 @@ var tinymce = { t.isIE6 = t.isIE && /MSIE [56]/.test(ua); t.isGecko = !t.isWebKit && /Gecko/.test(ua); t.isMac = ua.indexOf('Mac') != -1; + t.isAir = /adobeair/i.test(ua); // TinyMCE .NET webcontrol might be setting the values for TinyMCE if (w.tinyMCEPreInit) { @@ -511,7 +512,7 @@ tinymce.create('tinymce.util.Dispatcher', { u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u; // Relative path - if (u.indexOf('://') === -1 && u.indexOf('//') !== 0) + if (u.indexOf(':/') === -1 && u.indexOf('//') !== 0) u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u); // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) @@ -564,6 +565,9 @@ tinymce.create('tinymce.util.Dispatcher', { toRelative : function(u) { var t = this, o; + if (u === "./") + return u; + u = new tinymce.util.URI(u, {base_uri : t}); // Not on same domain/port or protocol @@ -590,7 +594,7 @@ tinymce.create('tinymce.util.Dispatcher', { }, toRelPath : function(base, path) { - var items, bp = 0, out = '', i; + var items, bp = 0, out = '', i, l; // Split the paths base = base.substring(0, base.lastIndexOf('/')); @@ -598,7 +602,7 @@ tinymce.create('tinymce.util.Dispatcher', { items = path.split('/'); if (base.length >= items.length) { - for (i = 0; i < base.length; i++) { + for (i = 0, l = base.length; i < l; i++) { if (i >= items.length || base[i] != items[i]) { bp = i + 1; break; @@ -607,7 +611,7 @@ tinymce.create('tinymce.util.Dispatcher', { } if (base.length < items.length) { - for (i = 0; i < items.length; i++) { + for (i = 0, l = items.length; i < l; i++) { if (i >= base.length || base[i] != items[i]) { bp = i + 1; break; @@ -618,10 +622,10 @@ tinymce.create('tinymce.util.Dispatcher', { if (bp == 1) return path; - for (i = 0; i < base.length - (bp - 1); i++) + for (i = 0, l = base.length - (bp - 1); i < l; i++) out += "../"; - for (i = bp - 1; i < items.length; i++) { + for (i = bp - 1, l = items.length; i < l; i++) { if (i != bp - 1) out += "/" + items[i]; else @@ -803,7 +807,7 @@ tinymce.create('static tinymce.util.JSON', { if (t == 'string') { v = '\bb\tt\nn\ff\rr\""\'\'\\\\'; - return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g, function(a, b) { + return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) { i = v.indexOf(b); if (i + 1) @@ -977,6 +981,17 @@ tinymce.create('static tinymce.util.XHR', { idPattern : /^#[\w]+$/, elmPattern : /^[\w_*]+$/, elmClassPattern : /^([\w_]*)\.([\w_]+)$/, + props : { + "for" : "htmlFor", + "class" : "className", + className : "className", + checked : "checked", + disabled : "disabled", + maxlength : "maxLength", + readonly : "readOnly", + selected : "selected", + value : "value" + }, DOMUtils : function(d, s) { var t = this; @@ -1030,10 +1045,24 @@ tinymce.create('static tinymce.util.XHR', { }, getRect : function(e) { - var p, t = this, w, h; + var p, t = this, sr; e = t.get(e); p = t.getPos(e); + sr = t.getSize(e); + + return { + x : p.x, + y : p.y, + w : sr.w, + h : sr.h + }; + }, + + getSize : function(e) { + var t = this, w, h; + + e = t.get(e); w = t.getStyle(e, 'width'); h = t.getStyle(e, 'height'); @@ -1046,8 +1075,6 @@ tinymce.create('static tinymce.util.XHR', { h = 0; return { - x : p.x, - y : p.y, w : parseInt(w) || e.offsetWidth || e.clientWidth, h : parseInt(h) || e.offsetHeight || e.clientHeight }; @@ -1116,7 +1143,7 @@ tinymce.create('static tinymce.util.XHR', { // #if !jquery select : function(pa, s) { - var t = this, cs, c, pl, o = [], x, i, l, n; + var t = this, cs, c, pl, o = [], x, i, l, n, xp; s = t.get(s) || t.doc; @@ -1140,6 +1167,44 @@ tinymce.create('static tinymce.util.XHR', { return l; } + if (!t.selectorRe) + t.selectorRe = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;; + + // Air doesn't support eval due to security sandboxing and querySelectorAll isn't supported yet + if (tinymce.isAir) { + each(tinymce.explode(pa), function(v) { + if (!(xp = t.cache[v])) { + xp = ''; + + each(v.split(' '), function(v) { + v = t.selectorRe.exec(v); + + xp += v[1] ? '//' + v[1] : '//*'; + + // Id + if (v[2]) + xp += "[@id='" + v[2] + "']"; + + // Class + if (v[3]) { + each(v[3].split('.'), function(n) { + xp += "[@class = '" + n + "' or contains(concat(' ', @class, ' '), ' " + n + " ')]"; + }); + } + }); + + t.cache[v] = xp; + } + + xp = t.doc.evaluate(xp, s, null, 4, null); + + while (n = xp.iterateNext()) + o.push(n); + }); + + return o; + } + if (t.settings.strict) { function get(s, n) { return s.getElementsByTagName(n.toLowerCase()); @@ -1226,7 +1291,7 @@ tinymce.create('static tinymce.util.XHR', { pl = v.split(' '); each(pl, function(v) { - var p = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v); + var p = t.selectorRe.exec(v); // Find elements p[1] = p[1] || '*'; @@ -1284,19 +1349,7 @@ tinymce.create('static tinymce.util.XHR', { var e, k; e = is(n, 'string') ? t.doc.createElement(n) : n; - - if (a) { - for (k in a) { - if (a.hasOwnProperty(k) && !is(a[k], 'object')) - t.setAttrib(e, k, '' + a[k]); - } - - if (a.style && !is(a.style, 'string')) { - each(a.style, function(v, n) { - t.setStyle(e, n, v); - }); - } - } + t.setAttribs(e, a); if (h) { if (h.nodeType) @@ -1458,6 +1511,10 @@ tinymce.create('static tinymce.util.XHR', { setAttrib : function(e, n, v) { var t = this; + // Whats the point + if (!e || !n) + return; + // Strict XML mode if (t.settings.strict) n = n.toLowerCase(); @@ -1467,6 +1524,14 @@ tinymce.create('static tinymce.util.XHR', { switch (n) { case "style": + if (!is(v, 'string')) { + each(v, function(v, n) { + t.setStyle(e, n, v); + }); + + return; + } + // No mce_style for elements with these since they might get resized by the user if (s.keep_values) { if (v && !t._isRes(v)) @@ -1526,7 +1591,7 @@ tinymce.create('static tinymce.util.XHR', { return false; if (!is(dv)) - dv = ""; + dv = ''; // Try the mce variant for these if (/^(src|href|style|coords|shape)$/.test(n)) { @@ -1536,38 +1601,23 @@ tinymce.create('static tinymce.util.XHR', { return v; } - v = e.getAttribute(n, 2); - - if (!v) { - switch (n) { - case 'class': - v = e.className; - break; - - default: - // Fix for IE crash Bug: #1884376 probably due to invalid DOM structure - if (isIE && n === 'name' && e.nodeName === 'A') { - v = e.name; - break; - } - - v = e.attributes[n]; - v = v && is(v.nodeValue) ? v.nodeValue : v; - } + if (isIE && t.props[n]) { + v = e[t.props[n]]; + v = v && v.nodeValue ? v.nodeValue : v; } - switch (n) { - case 'style': - v = v || e.style.cssText; + if (!v) + v = e.getAttribute(n, 2); - if (v) { - v = t.serializeStyle(t.parseStyle(v)); + if (n === 'style') { + v = v || e.style.cssText; - if (t.settings.keep_values && !t._isRes(v)) - e.setAttribute('mce_style', v); - } + if (v) { + v = t.serializeStyle(t.parseStyle(v)); - break; + if (t.settings.keep_values && !t._isRes(v)) + e.setAttribute('mce_style', v); + } } // Remove Apple and WebKit stuff @@ -1587,7 +1637,15 @@ tinymce.create('static tinymce.util.XHR', { case 'size': // IE returns +0 as default value for size - if (v === '+0') + if (v === '+0' || v === 20) + v = ''; + + break; + + case 'width': + case 'height': + case 'vspace': + if (v === 0) v = ''; break; @@ -1599,19 +1657,20 @@ tinymce.create('static tinymce.util.XHR', { break; + case 'maxlength': case 'tabindex': // IE returns default value - if (v === 32768) + if (v === 32768 || v === 2147483647) v = ''; break; - case 'maxlength': - // IE returns default value - if (v === 2147483647) - v = ''; + case 'compact': + case 'noshade': + if (v === 65535) + return n; - break; + return dv; case 'shape': v = v.toLowerCase(); @@ -1624,7 +1683,7 @@ tinymce.create('static tinymce.util.XHR', { } } - return (v && v != '') ? '' + v : dv; + return (v !== undefined && v !== null && v !== '') ? '' + v : dv; }, getPos : function(n) { @@ -2002,6 +2061,8 @@ tinymce.create('static tinymce.util.XHR', { // Store away src and href in mce_src and mce_href since browsers mess them up if (s.keep_values) { + h = h.replace(//g, ''); + // Wrap scripts and styles in comments for serialization purposes if (/_')); - t.select(t.dom.get('__caret')); - t.getRng().deleteContents(); - return; - } + // Make caret marker since insertNode places the caret in the beginning of text after insert + h += '_'; - // Use insert HTML if it exists (places cursor after content) - try { - // This might fail with an exception see bug #1893736 - if (d.queryCommandEnabled('InsertHTML')) - return d.execCommand('InsertHTML', false, h); - } catch (ex) { - // Use old school method - r.deleteContents(); - r.insertNode(t.getRng().createContextualFragment(h)); - } + // Delete and insert new node + r.deleteContents(); + r.insertNode(t.getRng().createContextualFragment(h)); + + // Move to caret marker + c = t.dom.get('__caret'); + + // Make sure we wrap it compleatly, Opera fails with a simple select call + r = d.createRange(); + r.setStartBefore(c); + r.setEndAfter(c); + t.setRng(r); + + // Delete the marker, and hopefully the caret gets placed in the right location + d.execCommand('Delete', false, null); + + // In case it's still there + t.dom.remove('__caret'); } else { if (r.item) { // Delete content and get caret text selection @@ -2875,6 +2955,9 @@ tinymce.create('static tinymce.util.XHR', { r.pasteHTML(h); } + + // Dispatch set content event + t.onSetContent.dispatch(t, s); }, getStart : function() { @@ -3235,7 +3318,7 @@ tinymce.create('static tinymce.util.XHR', { if (!r || r.item) return false; - return !s || r.boundingWidth == 0 || s.isCollapsed; + return !s || r.boundingWidth == 0 || r.collapsed; }, collapse : function(b) { @@ -3316,8 +3399,12 @@ tinymce.create('static tinymce.util.XHR', { // Handle selection a image or other control like element such as anchors if (!r.collapsed) { - if (r.startContainer == r.endContainer || (tinymce.isWebKit && r.startContainer == r.endContainer.parentNode)) { - if (r.startOffset - r.endOffset < 2 || tinymce.isWebKit) { + // If the anchor node is a element instead of a text node then return this element + if (tinymce.isWebKit && s.anchorNode && s.anchorNode.nodeType == 1) + return s.anchorNode.childNodes[s.anchorOffset]; + + if (r.startContainer == r.endContainer) { + if (r.startOffset - r.endOffset < 2) { if (r.startContainer.hasChildNodes()) e = r.startContainer.childNodes[r.startOffset]; } @@ -3417,6 +3504,10 @@ tinymce.create('static tinymce.util.XHR', { }, writeComment : function(v) { + // Fix for bug #2035694 + if (tinymce.isIE) + v = v.replace(/^\-|\-$/g, ' '); + this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' '))); }, @@ -3635,11 +3726,27 @@ tinymce.create('static tinymce.util.XHR', { indent_mode : 'simple', indent_char : '\t', indent_levels : 1, - remove_linebreaks : 1 + remove_linebreaks : 1, + remove_redundant_brs : 1, + element_format : 'xhtml' }, s); t.dom = s.dom; + if (s.remove_redundant_brs) { + t.onPostProcess.add(function(se, o) { + // Remove BR elements at end of list elements since they get rendered in IE + o.content = o.content.replace(/
    (\s*<\/li>)/g, '$1'); + }); + } + + // Remove XHTML element endings i.e. produce crap :) XHTML is better + if (s.element_format == 'html') { + t.onPostProcess.add(function(se, o) { + o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>'); + }); + } + if (s.fix_list_elements) { t.onPreProcess.add(function(se, o) { var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np; @@ -4076,7 +4183,8 @@ tinymce.create('static tinymce.util.XHR', { patterns : [ {pattern : /(]*>)(.*?)(<\/script>)/g}, {pattern : /(]*>)(.*?)(<\/style>)/g}, - {pattern : /(]*>)(.*?)(<\/pre>)/g, encode : 1} + {pattern : /(]*>)(.*?)(<\/pre>)/g, encode : 1}, + {pattern : /()/g} ] }); @@ -4120,6 +4228,9 @@ tinymce.create('static tinymce.util.XHR', { h = t._unprotect(h, p); + // Restore CDATA sections + h = h.replace(//g, ''); + // Restore the \u00a0 character if raw mode is enabled if (s.entity_encoding == 'raw') h = h.replace(/

     <\/p>|]+)> <\/p>/g, '\u00a0

    '); @@ -4247,8 +4358,14 @@ tinymce.create('static tinymce.util.XHR', { } // Padd empty nodes with a   - if (!hc && ru.padd) - w.writeText('\u00a0'); + if (ru.padd) { + // If it has only one bogus child, padd it anyway workaround for
    bug + if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) { + if (cn.hasAttribute ? cn.hasAttribute('mce_bogus') : cn.getAttribute('mce_bogus')) + w.writeText('\u00a0'); + } else if (!hc) + w.writeText('\u00a0'); // No children then padd it + } break; @@ -5341,34 +5458,58 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { t.classPrefix = 'mceListBox'; }, - select : function(v) { - var t = this, e, fv; + select : function(va) { + var t = this, fv, f; - // Do we need to do something? - if (v != t.selectedValue) { - e = DOM.get(t.id + '_text'); - t.selectedValue = v; + if (va == undefined) + return t.selectByIndex(-1); + + // Is string or number make function selector + if (va && va.call) + f = va; + else { + f = function(v) { + return v == va; + }; + } + // Do we need to do something? + if (va != t.selectedValue) { // Find item - each(t.items, function(o) { - if (o.value == v) { - DOM.setHTML(e, DOM.encode(o.title)); + each(t.items, function(o, i) { + if (f(o.value)) { fv = 1; + t.selectByIndex(i); return false; } }); - // If no item was found then present title - if (!fv) { + if (!fv) + t.selectByIndex(-1); + } + }, + + selectByIndex : function(idx) { + var t = this, e, o; + + if (idx != t.selectedIndex) { + e = DOM.get(t.id + '_text'); + o = t.items[idx]; + + if (o) { + t.selectedValue = o.value; + t.selectedIndex = idx; + DOM.setHTML(e, DOM.encode(o.title)); + DOM.removeClass(e, 'mceTitle'); + } else { DOM.setHTML(e, DOM.encode(t.settings.title)); DOM.addClass(e, 'mceTitle'); - e = 0; - return; - } else - DOM.removeClass(e, 'mceTitle'); - } + t.selectedValue = t.selectedIndex = null; + } - e = 0; + e = 0; + } else + t.selectedValue = t.selectedIndex = null; }, add : function(n, v, o) { @@ -5573,18 +5714,40 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return DOM.get(this.id).disabled; }, - select : function(v) { - var e = DOM.get(this.id), ol = e.options; + select : function(va) { + var t = this, fv, f; - v = '' + (v || ''); + if (va == undefined) + return t.selectByIndex(-1); - e.selectedIndex = 0; - each(ol, function(o, i) { - if (o.value == v) { - e.selectedIndex = i; - return false; - } - }); + // Is string or number make function selector + if (va && va.call) + f = va; + else { + f = function(v) { + return v == va; + }; + } + + // Do we need to do something? + if (va != t.selectedValue) { + // Find item + each(t.items, function(o, i) { + if (f(o.value)) { + fv = 1; + t.selectByIndex(i); + return false; + } + }); + + if (!fv) + t.selectByIndex(-1); + } + }, + + selectByIndex : function(idx) { + DOM.get(this.id).selectedIndex = idx + 1; + this.selectedValue = this.items[idx] ? this.items[idx].value : null; }, add : function(n, v, a) { @@ -5630,12 +5793,14 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { t.rendered = true; function onChange(e) { - var v = e.target.options[e.target.selectedIndex].value; + var v = t.items[e.target.selectedIndex - 1]; - t.onChange.dispatch(t, v); + if (v = v.value) { + t.onChange.dispatch(t, v); - if (t.settings.onselect) - t.settings.onselect(v); + if (t.settings.onselect) + t.settings.onselect(v); + } }; Event.add(t.id, 'change', onChange); @@ -6073,18 +6238,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }, requireLangPack : function(n) { - var u, s; + var u, s = tinymce.EditorManager.settings; - if (tinymce.EditorManager.settings) { - u = this.urls[n] + '/langs/' + tinymce.EditorManager.settings.language + '.js'; - s = tinymce.EditorManager.settings; + if (s && s.language) { + u = this.urls[n] + '/langs/' + s.language + '.js'; - if (s) { - if (!tinymce.dom.Event.domLoaded && !s.strict_mode) - tinymce.ScriptLoader.load(u); - else - tinymce.ScriptLoader.add(u); - } + if (!tinymce.dom.Event.domLoaded && !s.strict_mode) + tinymce.ScriptLoader.load(u); + else + tinymce.ScriptLoader.add(u); } }, @@ -6137,8 +6299,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL); tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL); - // Setup document domain - if (tinymce.EditorManager.baseURI.host != lo.hostname && lo.hostname) + // User already specified a document.domain value + if (document.domain && lo.hostname != document.domain) + tinymce.relaxedDomain = document.domain; + + // Setup document domain if tinymce is loaded from other domain + if (!tinymce.relaxedDomain && tinymce.EditorManager.baseURI.host != lo.hostname && lo.hostname) document.domain = tinymce.relaxedDomain = lo.hostname.replace(/.*\.(.+\..+)$/, '$1'); // Add before unload listener @@ -6153,7 +6319,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }, init : function(s) { - var t = this, pl, sl = tinymce.ScriptLoader, c, e; + var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed; function execCallback(se, n, s) { var f = se[n]; @@ -6259,9 +6425,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if(l.length > 0) { each(explode(l), function(v) { - if (DOM.get(v)) - new tinymce.Editor(v, s).render(1); - else { + if (DOM.get(v)) { + ed = new tinymce.Editor(v, s); + el.push(ed); + ed.render(1); + } else { c = 0; each(document.forms, function(f) { @@ -6269,7 +6437,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (e.name === v) { v = 'mce_editor_' + c; DOM.setAttrib(e, 'id', v); - new tinymce.Editor(v, s).render(1); + + ed = new tinymce.Editor(v, s); + el.push(ed); + ed.render(1); } }); }); @@ -6298,7 +6469,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (!v.id || t.get(v.id)) v.id = DOM.uniqueId(); - new tinymce.Editor(v.id, s).render(1); + ed = new tinymce.Editor(v.id, s); + el.push(ed); + ed.render(1); } }); break; @@ -6308,7 +6481,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (s.oninit) { l = co = 0; - each (t.editors, function(ed) { + each (el, function(ed) { co++; if (!ed.initialized) { @@ -6414,7 +6587,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { case "mceRemoveEditor": case "mceRemoveControl": - ed.remove(); + if (ed) + ed.remove(); + return true; case 'mceToggleEditor': @@ -6582,13 +6757,14 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; apply_source_formatting : 1, directionality : 'ltr', forced_root_block : 'p', - valid_elements : '@[id|class|style|title|dir= 9.5)) u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'; else if (tinymce.isOpera) u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()'; @@ -6888,6 +7066,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; id : t.id + "_ifr", src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7 frameBorder : '0', + tabindex : '1', style : { width : '100%', height : h @@ -6923,7 +7102,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; // Design mode needs to be added here Ctrl+A will fail otherwise if (!isIE) { try { - d.designMode = 'On'; + if (!s.readonly) + d.designMode = 'On'; } catch (ex) { // Will fail on Gecko if the editor is placed in an hidden container element // The design mode will be set ones the editor is focused @@ -6935,7 +7115,10 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; // It will not steal focus if we hide it while setting contentEditable b = t.getBody(); DOM.hide(b); - b.contentEditable = true; + + if (!s.readonly) + b.contentEditable = true; + DOM.show(b); } @@ -6965,6 +7148,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; font_size_style_values : s.font_size_style_values, apply_source_formatting : s.apply_source_formatting, remove_linebreaks : s.remove_linebreaks, + element_format : s.element_format, dom : t.dom }); @@ -6988,7 +7172,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (!s.gecko_spellcheck) t.getBody().spellcheck = 0; - t._addEvents(); + if (!s.readonly) + t._addEvents(); t.controlManager.onPostRender.dispatch(t, t.controlManager); t.onPostRender.dispatch(t); @@ -7153,7 +7338,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }); } - if (isGecko) { + if (isGecko && !s.readonly) { try { // Design mode must be set here once again to fix a bug where // Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again @@ -7250,7 +7435,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }, translate : function(s) { - var c = this.settings.language, i18n = EditorManager.i18n; + var c = this.settings.language || 'en', i18n = EditorManager.i18n; if (!s) return ''; @@ -7261,7 +7446,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }, getLang : function(n, dv) { - return EditorManager.i18n[this.settings.language + '.' + n] || (is(dv) ? dv : '{#' + n + '}'); + return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}'); }, getParam : function(n, dv, ty) { @@ -7936,7 +8121,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; function setOpts() { var t = this, d = t.getDoc(), s = t.settings; - if (isGecko) { + if (isGecko && !s.readonly) { if (t._isHidden()) { try { if (!s.content_editable) @@ -7971,7 +8156,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; t.onMouseUp.add(t.nodeChanged); t.onClick.add(t.nodeChanged); t.onKeyUp.add(function(ed, e) { - if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.keyCode == 46 || e.keyCode == 8 || e.ctrlKey) + var c = e.keyCode; + + if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey) t.nodeChanged(); }); @@ -8328,7 +8515,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (cl = s.font_size_classes) cl = explode(cl); - +/* function convertToFonts(no) { var n, f, nl, x, i, v, st; @@ -8391,7 +8578,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; t.onSetContent.add(function(ed, o) { convertToFonts(ed.getBody()); }); - +*/ // Run on cleanup t.onPreProcess.add(function(ed, o) { var n, sp, nl, x; @@ -8500,6 +8687,10 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; (function() { var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit; + function isBlock(n) { + return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName); + }; + tinymce.create('tinymce.EditorCommands', { EditorCommands : function(ed) { this.editor = ed; @@ -8676,44 +8867,32 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; s.select(s.getNode()); t.RemoveFormat(); - } else - ed.getDoc().execCommand('FontName', false, v); + } else { + if (ed.settings.convert_fonts_to_spans) + t._applyInlineStyle('span', {style : {fontFamily : v}}); + else + ed.getDoc().execCommand('FontName', false, v); + } }, FontSize : function(u, v) { - var ed = this.editor, s = ed.settings, fz = tinymce.explode(s.font_size_style_values), fzc = tinymce.explode(s.font_size_classes), h, bm; - - // Remove style sizes - each(ed.dom.select('font'), function(e) { - e.style.fontSize = ''; - }); - - // Let the browser add new size it will remove unneded ones in some browsers - ed.getDoc().execCommand('FontSize', false, v); + var ed = this.editor, s = ed.settings, fc, fs; - // Add style values - if (s.inline_styles) { - each(ed.dom.select('font'), function(e) { - // Try remove redundant font elements - if (e.parentNode.nodeName == 'FONT' && e.size == e.parentNode.size) { - if (!bm) - bm = ed.selection.getBookmark(); - - ed.dom.remove(e, 1); - return; - } + // Use style options instead + if (s.convert_fonts_to_spans && v >= 1 && v <= 7) { + fs = tinymce.explode(s.font_size_style_values); + fc = tinymce.explode(s.font_size_classes); - // Setup font size based on font size value - if (v = e.size) { - if (fzc && fzc.length > 0) - ed.dom.setAttrib(e, 'class', fzc[parseInt(v) - 1]); - else - ed.dom.setStyle(e, 'fontSize', fz[parseInt(v) - 1]); - } - }); + if (fc) + v = fc[v - 1] || v; + else + v = fs[v - 1] || v; } - ed.selection.moveToBookmark(bm); + if (v >= 1 && v <= 7) + ed.getDoc().execCommand('FontSize', false, v); + else + this._applyInlineStyle('span', {style : {fontSize : v}}); }, queryCommandValue : function(c) { @@ -8763,14 +8942,17 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; queryValueFontSize : function() { var ed = this.editor, v = 0, p; - if (isOpera || isWebKit) { + if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN')) + v = p.style.fontSize; + + if (!v && (isOpera || isWebKit)) { if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT')) v = p.size; return v; } - return this._queryVal('FontSize'); + return v || this._queryVal('FontSize'); }, queryValueFontName : function() { @@ -8779,6 +8961,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT')) v = p.face; + if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN')) + v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); + if (!v) v = this._queryVal('FontName'); @@ -8799,7 +8984,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (rm) { if (v == 'center') - dom.setStyle(n.parentNode, 'textAlign', ''); + dom.setStyle(bl || n.parentNode, 'textAlign', ''); dom.setStyle(n, 'float', ''); this.mceRepaint(); @@ -8808,7 +8993,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (v == 'center') { // Do not change table elements - if (/^(TD|TH)$/.test(bl.nodeName)) + if (bl && /^(TD|TH)$/.test(bl.nodeName)) bl = 0; if (!bl || bl.childNodes.length > 1) { @@ -8829,7 +9014,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; dom.setStyle(n, 'float', ''); } else { dom.setStyle(n, 'float', v); - dom.setStyle(n.parentNode, 'textAlign', ''); + dom.setStyle(bl || n.parentNode, 'textAlign', ''); } this.mceRepaint(); @@ -9015,7 +9200,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; re = new RegExp(re, 'i'); // Set style info on selected element - if (e = t.getSelectedElement()) + if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers) set(e, 1); else { // Generate wrappers and set styles on them @@ -9060,6 +9245,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (!p || !dom.getAttrib(n, 'mce_new')) return; + if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN') + return; + // Has parent of the same type and only child if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1) return dom.remove(p, 1); @@ -9107,9 +9295,24 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; return this._queryState(c); }, + ForeColor : function(ui, v) { + var ed = this.editor; + + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {color : v}}); + return; + } else + ed.getDoc().execCommand('ForeColor', false, v); + }, + HiliteColor : function(ui, val) { var t = this, ed = t.editor, d = ed.getDoc(); + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {backgroundColor : val}}); + return; + } + function set(s) { if (!isGecko) return; @@ -9275,10 +9478,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0) return true; - } else - return !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE'); + } - return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList(); + return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE')); }, queryStateInsertUnorderedList : function() { @@ -9301,8 +9503,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }; // Get start/end block - sb = dom.getParent(s.getStart(), dom.isBlock); - eb = dom.getParent(s.getEnd(), dom.isBlock); + sb = dom.getParent(s.getStart(), isBlock); + eb = dom.getParent(s.getEnd(), isBlock); // Remove blockquote(s) if (bq = getBQ(sb)) { @@ -9347,7 +9549,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; s.collapse(0); // IE misses the empty block some times element so we must move back the caret - if (dom.getParent(s.getStart(), dom.isBlock) != sb) { + if (dom.getParent(s.getStart(), isBlock) != sb) { r = s.getRng(); r.move('character', -1); r.select(); @@ -9419,6 +9621,151 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; } else s.moveToBookmark(bm); }, + + _applyInlineStyle : function(na, at, op) { + var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh; + + na = na.toUpperCase(); + + if (op && op.check_classes && at['class']) + op.check_classes.push(at['class']); + + function replaceFonts() { + var bm; + + each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') { + if (!bm) + bm = ed.selection.getBookmark(); + + at._mce_new = '1'; + dom.replace(dom.create(na, at), n, 1); + } + }); + + // Remove redundant elements + each(dom.select(na), function(n) { + if (n.getAttribute('_mce_new')) { + function removeStyle(n) { + if (n.nodeType == 1) { + each(at.style, function(v, k) { + dom.setStyle(n, k, ''); + }); + + // Remove spans with the same class or marked classes + if (at['class'] && n.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(n, c)) + dom.removeClass(n, c); + }); + } + } + }; + + // Remove specified style information from child elements + each(dom.select(na, n), removeStyle); + + // Remove the specified style information on parent if current node is only child (IE) + if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1) + removeStyle(n.parentNode); + + // Remove the child elements style info if a parent already has it + dom.getParent(n.parentNode, function(pn) { + if (pn.nodeType == 1) { + if (at.style) { + each(at.style, function(v, k) { + var sv; + + if (!lo[k] && (sv = dom.getStyle(pn, k))) { + if (sv === v) + dom.setStyle(n, k, ''); + + lo[k] = 1; + } + }); + } + + // Remove spans with the same class or marked classes + if (at['class'] && pn.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(pn, c)) + dom.removeClass(n, c); + }); + } + } + + return false; + }); + + n.removeAttribute('_mce_new'); + } + }); + + // Remove empty span elements + each(dom.select(na).reverse(), function(n) { + var c = 0; + + // Check if there is any attributes + each(dom.getAttribs(n), function(an) { + if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') { + //console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName)); + c++; + } + }); + + // No attributes then remove the element and keep the children + if (c == 0) + dom.remove(n, 1); + }); + + ed.selection.moveToBookmark(bm); + + return !!bm; + }; + + // Create inline elements + ed.focus(); + ed.getDoc().execCommand('FontName', false, 'mceinline'); + replaceFonts(); + + if (kh = t._applyInlineStyle.keyhandler) { + ed.onKeyUp.remove(kh); + ed.onKeyPress.remove(kh); + ed.onKeyDown.remove(kh); + ed.onSetContent.remove(t._applyInlineStyle.chandler); + } + + if (ed.selection.isCollapsed()) { + // Start collecting styles + t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style); + + t._applyInlineStyle.chandler = ed.onSetContent.add(function() { + delete t._pendingStyles; + }); + + t._applyInlineStyle.keyhandler = kh = function(e) { + // Use pending styles + if (t._pendingStyles) { + at.style = t._pendingStyles; + delete t._pendingStyles; + } + + if (replaceFonts()) { + ed.onKeyDown.remove(t._applyInlineStyle.keyhandler); + ed.onKeyPress.remove(t._applyInlineStyle.keyhandler); + } + + if (e.type == 'keyup') + ed.onKeyUp.remove(t._applyInlineStyle.keyhandler); + }; + + ed.onKeyDown.add(kh); + ed.onKeyPress.add(kh); + ed.onKeyUp.add(kh); + } else + t._pendingStyles = 0; + }, + /* _mceBlockQuote : function() { var t = this, s = t.editor.selection, b = s.getBookmark(), bq, dom = t.editor.dom; @@ -9478,8 +9825,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; _getSelectedBlocks : function(st, en) { var ed = this.editor, dom = ed.dom, s = ed.selection, sb, eb, n, bl = []; - sb = dom.getParent(st || s.getStart(), dom.isBlock); - eb = dom.getParent(en || s.getEnd(), dom.isBlock); + sb = dom.getParent(st || s.getStart(), isBlock); + eb = dom.getParent(en || s.getEnd(), isBlock); if (sb) bl.push(sb); @@ -9488,7 +9835,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; n = sb; while ((n = n.nextSibling) && n != eb) { - if (dom.isBlock(n)) + if (isBlock(n)) bl.push(n); } } @@ -9810,11 +10157,11 @@ tinymce.create('tinymce.UndoManager', { forceRoots : function(ed, e) { var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF; - var nx, bl, bp, sp, le, nl = b.childNodes, i; + var nx, bl, bp, sp, le, nl = b.childNodes, i, n; // Fix for bug #1863847 - if (e && e.keyCode == 13) - return true; + //if (e && e.keyCode == 13) + // return true; // Wrap non blocks into blocks for (i = nl.length - 1; i >= 0; i--) { @@ -9828,12 +10175,17 @@ tinymce.create('tinymce.UndoManager', { // Store selection if (si == -2 && r) { if (!isIE) { - // If element is inside body, might not be the case in contentEdiable mode - if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) { - so = r.startOffset; - eo = r.endOffset; - si = t.find(b, 0, r.startContainer); - ei = t.find(b, 0, r.endContainer); + // If selection is element then mark it + if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) { + n.setAttribute("id", "__mce"); + } else { + // If element is inside body, might not be the case in contentEdiable mode + if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) { + so = r.startOffset; + eo = r.endOffset; + si = t.find(b, 0, r.startContainer); + ei = t.find(b, 0, r.endContainer); + } } } else { tr = d.body.createTextRange(); @@ -9902,6 +10254,13 @@ tinymce.create('tinymce.UndoManager', { // Ignore } } + } else if (!isIE && (n = ed.dom.get('__mce'))) { + // Move caret before selected element + n.removeAttribute('id'); + r = d.createRange(); + r.setStartBefore(n); + r.setEndBefore(n); + se.setRng(r); } }, @@ -9913,7 +10272,7 @@ tinymce.create('tinymce.UndoManager', { insertPara : function(e) { var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body; - var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch; + var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car; function isEmpty(n) { n = n.innerHTML; @@ -10090,8 +10449,39 @@ tinymce.create('tinymce.UndoManager', { if (isEmpty(bef)) bef.innerHTML = '
    '; + function appendStyles(e, en) { + var nl = [], nn, n, i; + + e.innerHTML = ''; + + // Make clones of style elements + if (se.keep_styles) { + n = en; + do { + // We only want style specific elements + if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) { + nn = n.cloneNode(false); + dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique + nl.push(nn); + } + } while (n = n.parentNode); + } + + // Append style elements to aft + if (nl.length > 0) { + for (i = nl.length - 1, nn = e; i >= 0; i--) + nn = nn.appendChild(nl[i]); + + // Padd most inner style element + nl[0].innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + return nl[0]; // Move caret to most inner element + } else + e.innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + }; + + // Fill empty afterblook with current style if (isEmpty(aft)) - aft.innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + car = appendStyles(aft, en); // Opera needs this one backwards for older versions if (isOpera && parseFloat(opera.version()) < 9.5) { @@ -10112,7 +10502,7 @@ tinymce.create('tinymce.UndoManager', { // Move cursor and scroll into view r = d.createRange(); - r.selectNodeContents(isGecko ? first(aft) : aft); + r.selectNodeContents(isGecko ? first(car || aft) : car || aft); r.collapse(1); s.removeAllRanges(); s.addRange(r); @@ -10123,7 +10513,7 @@ tinymce.create('tinymce.UndoManager', { // Is element within viewport if (y < vp.y || y + ch > vp.y + vp.h) { - ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + ch); + ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks //console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight)); } @@ -10165,12 +10555,21 @@ tinymce.create('tinymce.UndoManager', { // Gecko generates BR elements here and there, we don't like those so lets remove them function handler(e) { + var pr; + e = e.target; // A new BR was created in a block element, remove it if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) { + pr = e.previousSibling; + Event.remove(b, 'DOMNodeInserted', handler); + // Is there whitespace at the end of the node before then we might need the pesky BR + // to place the caret at a correct location see bug: #2013943 + if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue)) + return; + // Only remove BR elements that got inserted in the middle of the text if (e.previousSibling || e.nextSibling) ed.dom.remove(e); @@ -10409,11 +10808,11 @@ tinymce.create('tinymce.UndoManager', { return t.add(c); }, - createMenuButton : function(id, s) { + createMenuButton : function(id, s, cc) { s = s || {}; s.menu_button = 1; - return this.createButton(id, s); + return this.createButton(id, s, cc); }, createSplitButton : function(id, s, cc) { @@ -10635,14 +11034,17 @@ tinymce.create('tinymce.UndoManager', { return new f(a, b, c, d, e); }, - confirm : function(t, cb, s) { - cb.call(s || this, confirm(this._decode(this.editor.getLang(t, t)))); + confirm : function(t, cb, s, w) { + w = w || window; + + cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t)))); }, - alert : function(tx, cb, s) { + alert : function(tx, cb, s, w) { var t = this; - - alert(t._decode(t.editor.getLang(tx, tx))); + + w = w || window; + w.alert(t._decode(t.editor.getLang(tx, tx))); if (cb) cb.call(s || t); diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index f28aa7086..000000000 --- a/public/robots.txt +++ /dev/null @@ -1,162 +0,0 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file -User-agent: * -Disallow: /site/comments -Disallow: /site/comments/ -Disallow: /site/comments/new -Disallow: /site/comments/edit -Disallow: /site/comments/flag_version -Disallow: /site/comments/history -Disallow: /site/comments/preview -Disallow: /site/web_links/history -Disallow: /site/audio/history -Disallow: /site/video/history -Disallow: /site/topics/history -Disallow: /site/documents/history -Disallow: /site/images/history -Disallow: /site/web_links/flag_version -Disallow: /site/audio/flag_version -Disallow: /site/video/flag_version -Disallow: /site/topics/flag_version -Disallow: /site/documents/flag_version -Disallow: /site/images/flag_version -Disallow: /site/web_links/preview -Disallow: /site/audio/preview -Disallow: /site/video/preview -Disallow: /site/topics/preview -Disallow: /site/documents/preview -Disallow: /site/images/preview -Disallow: /site/index_page/help_file -Disallow: /site/web_links/new -Disallow: /site/audio/new -Disallow: /site/video/new -Disallow: /site/topics/new -Disallow: /site/documents/new -Disallow: /site/images/new -Disallow: /site/web_links/edit -Disallow: /site/audio/edit -Disallow: /site/video/edit -Disallow: /site/topics/edit -Disallow: /site/documents/edit -Disallow: /site/images/edit -Disallow: /site/account -Disallow: /site/baskets -Disallow: /site/members -Disallow: /site/extended_fields -Disallow: /site/topic_types -Disallow: /site/content_types -Disallow: /site/zoom_dbs -Disallow: /site/importers -Disallow: /site/all/comments/rss -Disallow: /site/all/topics/rss -Disallow: /site/all/images/rss -Disallow: /site/all/documents/rss -Disallow: /site/all/audio/rss -Disallow: /site/all/video/rss -Disallow: /site/all/web_links/rss -Disallow: /site/all/comments/rss.xml -Disallow: /site/all/topics/rss.xml -Disallow: /site/all/images/rss.xml -Disallow: /site/all/documents/rss.xml -Disallow: /site/all/audio/rss.xml -Disallow: /site/all/video/rss.xml -Disallow: /site/all/web_links/rss.xml -Disallow: /site/all/topics/contributed_by -Disallow: /site/all/images/contributed_by -Disallow: /site/all/documents/contributed_by -Disallow: /site/all/audio/contributed_by -Disallow: /site/all/video/contributed_by -Disallow: /site/all/web_links/contributed_by -Disallow: /site/all/topics/tagged -Disallow: /site/all/images/tagged -Disallow: /site/all/documents/tagged -Disallow: /site/all/audio/tagged -Disallow: /site/all/video/tagged -Disallow: /site/all/web_links/tagged -Disallow: /site/all/topics/related_to -Disallow: /site/all/images/related_to -Disallow: /site/all/documents/related_to -Disallow: /site/all/audio/related_to -Disallow: /site/all/video/related_to -Disallow: /site/all/web_links/related_to -Disallow: /site/search -Disallow: /site/search/ -Disallow: /adopt_an_anzac/comments -Disallow: /adopt_an_anzac/comments/ -Disallow: /adopt_an_anzac/comments/new -Disallow: /adopt_an_anzac/comments/edit -Disallow: /adopt_an_anzac/comments/flag_version -Disallow: /adopt_an_anzac/comments/history -Disallow: /adopt_an_anzac/comments/preview -Disallow: /adopt_an_anzac/web_links/history -Disallow: /adopt_an_anzac/audio/history -Disallow: /adopt_an_anzac/video/history -Disallow: /adopt_an_anzac/topics/history -Disallow: /adopt_an_anzac/documents/history -Disallow: /adopt_an_anzac/images/history -Disallow: /adopt_an_anzac/web_links/flag_version -Disallow: /adopt_an_anzac/audio/flag_version -Disallow: /adopt_an_anzac/video/flag_version -Disallow: /adopt_an_anzac/topics/flag_version -Disallow: /adopt_an_anzac/documents/flag_version -Disallow: /adopt_an_anzac/images/flag_version -Disallow: /adopt_an_anzac/web_links/preview -Disallow: /adopt_an_anzac/audio/preview -Disallow: /adopt_an_anzac/video/preview -Disallow: /adopt_an_anzac/topics/preview -Disallow: /adopt_an_anzac/documents/preview -Disallow: /adopt_an_anzac/images/preview -Disallow: /adopt_an_anzac/index_page/help_file -Disallow: /adopt_an_anzac/web_links/new -Disallow: /adopt_an_anzac/audio/new -Disallow: /adopt_an_anzac/video/new -Disallow: /adopt_an_anzac/topics/new -Disallow: /adopt_an_anzac/documents/new -Disallow: /adopt_an_anzac/images/new -Disallow: /adopt_an_anzac/web_links/edit -Disallow: /adopt_an_anzac/audio/edit -Disallow: /adopt_an_anzac/video/edit -Disallow: /adopt_an_anzac/topics/edit -Disallow: /adopt_an_anzac/documents/edit -Disallow: /adopt_an_anzac/images/edit -Disallow: /adopt_an_anzac/account -Disallow: /adopt_an_anzac/baskets -Disallow: /adopt_an_anzac/members -Disallow: /adopt_an_anzac/extended_fields -Disallow: /adopt_an_anzac/topic_types -Disallow: /adopt_an_anzac/content_types -Disallow: /adopt_an_anzac/zoom_dbs -Disallow: /adopt_an_anzac/importers -Disallow: /adopt_an_anzac/all/comments/rss -Disallow: /adopt_an_anzac/all/topics/rss -Disallow: /adopt_an_anzac/all/images/rss -Disallow: /adopt_an_anzac/all/documents/rss -Disallow: /adopt_an_anzac/all/audio/rss -Disallow: /adopt_an_anzac/all/video/rss -Disallow: /adopt_an_anzac/all/web_links/rss -Disallow: /adopt_an_anzac/all/comments/rss.xml -Disallow: /adopt_an_anzac/all/topics/rss.xml -Disallow: /adopt_an_anzac/all/images/rss.xml -Disallow: /adopt_an_anzac/all/documents/rss.xml -Disallow: /adopt_an_anzac/all/audio/rss.xml -Disallow: /adopt_an_anzac/all/video/rss.xml -Disallow: /adopt_an_anzac/all/web_links/rss.xml -Disallow: /adopt_an_anzac/all/topics/contributed_by -Disallow: /adopt_an_anzac/all/images/contributed_by -Disallow: /adopt_an_anzac/all/documents/contributed_by -Disallow: /adopt_an_anzac/all/audio/contributed_by -Disallow: /adopt_an_anzac/all/video/contributed_by -Disallow: /adopt_an_anzac/all/web_links/contributed_by -Disallow: /adopt_an_anzac/all/topics/tagged -Disallow: /adopt_an_anzac/all/images/tagged -Disallow: /adopt_an_anzac/all/documents/tagged -Disallow: /adopt_an_anzac/all/audio/tagged -Disallow: /adopt_an_anzac/all/video/tagged -Disallow: /adopt_an_anzac/all/web_links/tagged -Disallow: /adopt_an_anzac/all/topics/related_to -Disallow: /adopt_an_anzac/all/images/related_to -Disallow: /adopt_an_anzac/all/documents/related_to -Disallow: /adopt_an_anzac/all/audio/related_to -Disallow: /adopt_an_anzac/all/video/related_to -Disallow: /adopt_an_anzac/all/web_links/related_to -Disallow: /adopt_an_anzac/search -Disallow: /adopt_an_anzac/search/ diff --git a/public/stylesheets/base.css b/public/stylesheets/base.css index 1254f2060..c6e7e36bb 100644 --- a/public/stylesheets/base.css +++ b/public/stylesheets/base.css @@ -563,6 +563,23 @@ span.next-active { padding: 1em; padding-bottom: 2em; } +#footer_links ul { + list-style-type: none; + height: 30px; + text-align: center; + margin: 30px auto 0 auto; + padding: 10px 0 0 0; + width: 460px; +} +#footer_links ul li { + border-right: 1px solid #000; + display: inline; + padding: 3px 15px; + margin: 0; +} +#footer_links ul li.last { + border-right: 0px; +} #linkToRSS{ background-image: url(../images/icon-feed.gif); diff --git a/public/stylesheets/redbox.css b/public/stylesheets/redbox.css index 489a8b6df..08697b675 100644 --- a/public/stylesheets/redbox.css +++ b/public/stylesheets/redbox.css @@ -1,60 +1,72 @@ +#RB_redbox { + width: 100%; + position: absolute; + top: 0px; + left: 0px; + z-index: 1000; +} + #RB_overlay { position: absolute; - z-index:100; + z-index: 1001; width: 100%; height: 100%; top: 0; left: 0; right: 0; bottom: 0; - min-height:100%; + min-height: 100%; background-color: #000; opacity: .6; filter: alpha(opacity=60); } -#RB_redbox { - width: 100%; - position: absolute; - top: 0px; +/* original +#RB_window { + position: absolute; + left: 0; + width: 100%; + z-index: 102; + line-height: 0; +} +*/ +#RB_window { + position: absolute; + width: 70%; + z-index: 1002; + line-height: 1; + top: 20px; + left: 15%; + right: 15%; + text-align: left; + background-color: #FFFFFF; + border: 2px solid black; +} +#RB_window fieldset { + margin-right: 0; + border: 0; } +/* original #RB_loading { - position: relative; - top: 200px; - z-index: 101; - width: 70px; - height: 70px; - margin: 0 auto; + margin: 0 auto 0 auto; + width: 250px; + height: 250px; + text-align: center; + background: #FFF url(../images/redbox_spinner.gif) no-repeat center center; +} +*/ +#RB_loading { + margin: 100px auto 100px auto; + width: 70px; + height: 70px; text-align: center; background: #666 url(../images/redbox_spinner.gif) no-repeat center center; border: 2px solid black; + z-index: 1003; } -/* original -#RB_window { - z-index: 102; - background-color: #FFFFFF; - display: block; - text-align: left; - overflow: hidden; - margin: 20px auto 0 auto; - position: absolute; -} - */ - -/* modified */ -#RB_window { - z-index: 102; - background-color: #FFFFFF; - border: 2px solid black; - display: block; +.redbox_contents { + margin: 0 auto; text-align: left; - overflow: hidden; - margin: 20px auto 0 auto; - padding: 4px; - position: absolute; - top:15%; - left:15%; - right:15%; } diff --git a/script/backgroundrb b/script/backgroundrb index dabf80bd4..9be048a3f 100755 --- a/script/backgroundrb +++ b/script/backgroundrb @@ -26,45 +26,14 @@ require RAILS_HOME + "/config/environment" require "bdrb_job_queue" require "backgroundrb_server" -pid_file = "#{RAILS_HOME}/tmp/pids/backgroundrb_#{BDRB_CONFIG[:backgroundrb][:port]}.pid" +PID_FILE = "#{RAILS_HOME}/tmp/pids/backgroundrb_#{BDRB_CONFIG[:backgroundrb][:port]}.pid" SERVER_LOGGER = "#{RAILS_HOME}/log/backgroundrb_debug_#{BDRB_CONFIG[:backgroundrb][:port]}.log" -case ARGV[0] -when 'start' - if fork - sleep(5) - exit - else - op = File.open(pid_file, "w") - op.write(Process.pid().to_s) - op.close - if BDRB_CONFIG[:backgroundrb][:log].nil? or BDRB_CONFIG[:backgroundrb][:log] != 'foreground' - log_file = File.open(SERVER_LOGGER,"w+") - [STDIN, STDOUT, STDERR].each {|desc| desc.reopen(log_file)} - end +daemon = BackgrounDRb::StartStop.new - BackgrounDRb::MasterProxy.new() - end -when 'stop' - def kill_process arg_pid_file - pid = nil - File.open(arg_pid_file, "r") { |pid_handle| pid = pid_handle.gets.strip.chomp.to_i } - begin - pgid = Process.getpgid(pid) - Process.kill('TERM', pid) - Process.kill('-TERM', pgid) - Process.kill('KILL', pid) - rescue Errno::ESRCH => e - puts "Deleting pid file" - rescue - puts $! - ensure - File.delete(arg_pid_file) if File.exists?(arg_pid_file) - end - end - pid_files = Dir["#{RAILS_HOME}/tmp/pids/backgroundrb_*.pid"] - pid_files.each { |x| kill_process(x) } -else - BackgrounDRb::MasterProxy.new() +case ARGV[0] +when 'start'; daemon.start +when 'stop'; daemon.stop() +else; BackgrounDRb::MasterProxy.new() end diff --git a/vendor/plugins/acts_as_licensed/.piston.yml b/vendor/plugins/acts_as_licensed/.piston.yml index 13a0c215b..5bf162122 100644 --- a/vendor/plugins/acts_as_licensed/.piston.yml +++ b/vendor/plugins/acts_as_licensed/.piston.yml @@ -1,8 +1,8 @@ --- format: 1 handler: - commit: 0039ff54fa227a75dde61cf7f739686596bb609f + commit: 0b1404141f1c4ff20731d797442fcad8866d1a51 branch: HEAD +lock: false repository_url: git://github.com/kete/acts_as_licensed.git -lock: repository_class: Piston::Git::Repository diff --git a/vendor/plugins/acts_as_licensed/README b/vendor/plugins/acts_as_licensed/README index 31c549567..0d980d4b5 100644 --- a/vendor/plugins/acts_as_licensed/README +++ b/vendor/plugins/acts_as_licensed/README @@ -3,20 +3,97 @@ ActsAsLicenced Some portions (rails generator) based on work by Rob Sanheim in the BrainBuster rails plugin. -ActsAsLicensed relies on three methods within the class you add acts_as_licensed to. They are title_for_license, author_for_license, and author_url_for_license + +INSTALL +======= + +Install the plugin by running + + script/plugin install git://github.com/kete/acts_as_licensed.git + +Add the migration and update your database by running + + ./script/generate acts_as_licensed_migration + rake db:migrate + +Install the licenses you want to assign to content. See a list of them by running + + rake -D acts_as_licensed + +Finally, add the following line to the controller which you want to add the licensed plugin to + + acts_as_licensed + + +ADDITIONAL INSTALLATION +======================= + +ActsAsLicensed relies on three methods within the class you add acts_as_licensed to. + +They are title_for_license, author_for_license, and author_url_for_license The defaults are usually similar to the following (adjust to suit your application): -def title_for_license - title -end -def author_for_license - self.author.name -end -def author_url_for_license - "/site/account/show/#{author_id}" -end + def title_for_license + title + end + def author_for_license + self.author.name + end + def author_url_for_license + "/site/account/show/#{author_id}" + end You can also define a default license by setting DEFAULT_CONTENT_LICENSE somewhere in your initializers (the constant contains the id of a license in the license table). + +USAGE +===== + +Class Methods +------------- + +You can get a list of all available licenses by using + + License.find_available + +Instance Methods +---------------- + +Check whether the object has a license by using + + object.has_license? + +Update the license, which raises an error if the object already have a license, by using + + object.license_id = id_of_new_license + +Retrieve the metadata, html indicating the license type of the object, by using + + object.license_metadata + +Helper Methods +-------------- + +Check whether licenses are available through + + licenses_are_available? + +Get the default license if configured else nil through + + configured_default_license + +Iterate over each license using + + available_licenses do |license| + puts license.name + end + +Helper methods for license selection in forms include: + + radio_button_for_license_selection(object_name, license) + radio_button_with_label_and_image(object_name, method, tag_value, label, image_url = nil, options = {}, options_for_label = {}) + radio_button_with_label(object_name, method, tag_value, label, options = {}, options_for_label = {}) + + Copyright (c) 2008 Katipo Communications LTD, released under the MIT license. diff --git a/vendor/plugins/acts_as_licensed/lib/acts_as_licensed_helper.rb b/vendor/plugins/acts_as_licensed/lib/acts_as_licensed_helper.rb index 3cf532476..cf7a26c11 100755 --- a/vendor/plugins/acts_as_licensed/lib/acts_as_licensed_helper.rb +++ b/vendor/plugins/acts_as_licensed/lib/acts_as_licensed_helper.rb @@ -1,8 +1,8 @@ module ActsAsLicensedHelper - def radio_button_for_license_selection(object_name, license) - radio_button_with_label_and_image(object_name, 'license_id', license.id, license.name, license.image_url) + + def radio_button_for_license_selection(object_name, license, options = {}, options_for_label = {}) + radio_button_with_label_and_image(object_name, 'license_id', license.id, license.name, license.image_url, options, options_for_label) + link_to("View license", url_for(license.url), "target" => "_new") end @@ -24,7 +24,7 @@ def radio_button_with_label(object_name, method, tag_value, label, options = {}, end # Iterate over license, i.e.: - # available_licences do |license| + # available_licenses do |license| # puts license.name # end def available_licenses(&block) diff --git a/vendor/plugins/backgroundrb/.gitignore b/vendor/plugins/backgroundrb/.gitignore new file mode 100644 index 000000000..83cc42141 --- /dev/null +++ b/vendor/plugins/backgroundrb/.gitignore @@ -0,0 +1,13 @@ +rdoc +TAGS +doc/output/advanced +doc/output/bugs +doc/output/community +doc/output/manual +doc/output/rails +doc/output/scheduling +doc/output/workers +doc/output/faq +doc/output/index.html +coverage +.dotest diff --git a/vendor/plugins/backgroundrb/.piston.yml b/vendor/plugins/backgroundrb/.piston.yml index a5c9b9754..95c585075 100644 --- a/vendor/plugins/backgroundrb/.piston.yml +++ b/vendor/plugins/backgroundrb/.piston.yml @@ -1,8 +1,8 @@ --- format: 1 handler: - commit: ca7d4cb7ff1b6c283601683adf3fce18f94a75a4 + commit: b28425508e90bb3a475877d2e2f739fd02a5c5bd branch: HEAD -lock: +lock: false repository_url: git://github.com/gnufied/backgroundrb.git repository_class: Piston::Git::Repository diff --git a/vendor/plugins/backgroundrb/ChangeLog b/vendor/plugins/backgroundrb/ChangeLog index 1573e5702..eb5c72058 100644 --- a/vendor/plugins/backgroundrb/ChangeLog +++ b/vendor/plugins/backgroundrb/ChangeLog @@ -1,3 +1,13 @@ +2008-09-07 hemant kumar + + * Fix environment loading issues. + + * Patch by Kieran P for disabling persistent job queue and its polling. + + * Commit patch by P Baker, related to scheduling a persistent task at specified time. For example: + MiddleMan(:hello_worker).enq_some_task(:arg => "hello_world", + :job_key => "boy",:scheduled_at => (Time.now + 1.hour)) + 2008-06-19 hemant kumar * Make binary parser iterative and hence won't blow your stack diff --git a/vendor/plugins/backgroundrb/README b/vendor/plugins/backgroundrb/README index f8d1533c1..620606f83 100644 --- a/vendor/plugins/backgroundrb/README +++ b/vendor/plugins/backgroundrb/README @@ -13,11 +13,8 @@ Copyright (c) 2006 Ezra Zygmuntowicz,skaar[at]waste[dot]org, Copyright (c) 2007 Hemant Kumar (gethemant [at] gmail.com ) -== Notes - - If you are using UNIX styled scheduler and using activesupport helpers in yaml file, please note that, - that will not work currently, because activesupport gem is not loaded before reading yaml file. - == Usage -Please look into http://backgroundrb.rubyforge.org \ No newline at end of file +Please look into http://backgroundrb.rubyforge.org + +Something else here. diff --git a/vendor/plugins/backgroundrb/Rakefile b/vendor/plugins/backgroundrb/Rakefile index 29c30ca97..1792815f6 100644 --- a/vendor/plugins/backgroundrb/Rakefile +++ b/vendor/plugins/backgroundrb/Rakefile @@ -4,6 +4,7 @@ require 'rake/testtask' require 'rake/rdoctask' require 'spec/rake/spectask' require 'rake/contrib/sshpublisher' +require "darkfish-rdoc" desc 'Default: run unit tests.' task :default => :test @@ -31,14 +32,21 @@ desc 'Generate documentation for the backgroundrb plugin.' Rake::RDocTask.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'doc/output/manual' rdoc.title = 'Backgroundrb' - rdoc.options << '--line-numbers' << '--inline-source' + #rdoc.options << '--line-numbers' << '--inline-source' rdoc.rdoc_files.include('README') rdoc.rdoc_files.include('LICENSE') rdoc.rdoc_files.include('lib/*.rb') rdoc.rdoc_files.include('lib/backgroundrb/*.rb') rdoc.rdoc_files.include('server/*.rb') rdoc.rdoc_files.include('server/lib/*.rb') - rdoc.template = 'jamis' + #rdoc.template = 'jamis' + rdoc.options += [ + '-w', '4', + '-SHN', + '-f', 'darkfish', # This bit + '-m', 'README', + ] + end module Rake diff --git a/vendor/plugins/backgroundrb/TODO.org b/vendor/plugins/backgroundrb/TODO.org index 0755b0832..e5e03a49a 100644 --- a/vendor/plugins/backgroundrb/TODO.org +++ b/vendor/plugins/backgroundrb/TODO.org @@ -1,7 +1,5 @@ * Todo related with new version * -** Implement environment loading more granular. - Worker, should be able to specify whether it wants the environment loaded or not. -** Write test cases for meta worker and master worker classes. -** Check for missing constant errors while doing Marshal.load and - see if it can load scoped classes as well. - +- write docs for new :schedule_at +- docs for disabling job queue checks +- more documentation for job queue +- Check for job table migration (need internet) diff --git a/vendor/plugins/backgroundrb/doc/content/content.txt b/vendor/plugins/backgroundrb/doc/content/content.txt index 6474ec431..5e2e89ac3 100644 --- a/vendor/plugins/backgroundrb/doc/content/content.txt +++ b/vendor/plugins/backgroundrb/doc/content/content.txt @@ -33,14 +33,7 @@ you can install the plugin from git:
     git clone git://github.com/gnufied/backgroundrb.git 
    -Also for running git version of BackgrounDRb you will need, git version of packet. - -
    -git clone git://github.com/gnufied/packet.git
    -cd packet;rake gem
    -cd pkg; sudo gem install --local *.gem
    - -If you are getting some error while building the gem, probably you need to install RSpec gem. +

    Also for running git version of BackgrounDRb you will need, git version of packet.

    p(sub-title). Installation using Piston @@ -48,10 +41,12 @@ p(sub-title). Installation using Piston %(entry-title) Configuration % -After getting the plugin, you must configure it for use. _BackgrounDRb_ comes with a rake task -for automating plugin configuration. Before running rake task, remove if any old 'backgroundrb' -script is there in script folder of your rails app after that run, following command from -root directory of your rails application, after installation: +After getting the plugin, you must copy it into your vendor/rails and +then configure it for use. _BackgrounDRb_ comes with a rake task for +automating plugin configuration. Before running rake task, remove if +any old @backgroundrb@ or @load_worker_env.rb@ script is there in script folder of your rails +app after that run, following command from root directory of your +rails application:
    rake backgroundrb:setup 
    @@ -60,7 +55,11 @@ Above Command does following things : *(content_list) Creates a config file @backgroundrb.yml@ in config directory of your rails application. * Creates @RAILS_ROOT/lib/workers@ directory for keeping BackgrounDRb workers in one place. * Creates @RAILS_ROOT/test/bdrb_test_helper.rb@ as a test helper for your workers -* Creates table required for use as persistent job queue. +* Creates migration required for creating persistent job queue table. + +After above make sure, that generated migration is ran using: + +
    rake db:migrate 
    p(sub-title). Configuration Options @@ -91,6 +90,8 @@ Following file demonstrates other available configuration options: :environment: production # rails environment to load :log: foreground # foreground mode,print log messages on console :debug_log: false # disable log workers and other logging + :persistent_disabled: false # turn this off if your application doesn't use backgroundrb's persistent/enqueued tasks system + :persistent_delay: 10 # the time (seconds) between each time backgroundrb checks the database for enqueued tasks :schedules: # optional task scheduling : # look in scheduling section diff --git a/vendor/plugins/backgroundrb/doc/content/faq/faq.txt b/vendor/plugins/backgroundrb/doc/content/faq/faq.txt new file mode 100644 index 000000000..655b3f2dc --- /dev/null +++ b/vendor/plugins/backgroundrb/doc/content/faq/faq.txt @@ -0,0 +1,41 @@ +
    + +%(entry-title) Frequently asked Questions % + +*(content_list) *How does it work with ActiveRecord in multi-threaded environment?*
    +You can use _BackgrounDRb_'s inbuilt thread pool for executing tasks +concurrently. We are using @allow_concurrency = true@ for @ActiveRecord@ +models, which is known to create problem with Oracle database adapters, if +you are using Oracle db, you can turn it off, by removing @allow_concurrency = true@. +* *Whats the deal with persistent job queues?*
    +Well, its used for persisting tasks to the table, so as later +then can be inspected for status and results. Before using this feature.You should +run @rake backgroundrb:setup@ and run @rake db:migrate@ for creation of required +table. +* *My worker dies silently*
    +First,make sure you have logging enabled (Meaning, you are not using @:debug_log false@ +in your config file).Second, if a worker dies, the backtrace should be written to the +file @RAILS_ROOT/log/backgroundrb_debug_xxxx.log@. Third, You should not pass +entire @ActiveRecord@ model's around, this could cause hard to debug problems.AR objects +don't serialize well across tcp sockets. If none of this helps, hit us on the mailing list. +* *Master server died silently*
    +If _BackgrounDRb_ master server dies, its definetely a bug in _BackgrounDRb_, exception +should be still logged in same @RAILS_ROOT/log/backgroundrb_debug_xxxx.log@ file. Copy +the exception and file a bug report. +* *Where do I file bug reports?*
    +You can submit bug reports at: "http://backgroundrb.devjavu.com/report/":http://backgroundrb.devjavu.com/report/. +* *Result caching is not working properly*
    +Switch to memcache for storing results. More information "here:"http://localhost:3000/workers/#result_caching. +* *Dynamically started workers through @new_worker@ are not working*
    +Use, the worker key that was used for accessing dynamically started workers. +* *BackgrounDRb server is not starting*
    +Make sure, you have latest version of chronic and packet gems installed.After +that, clone the git repository (or download a snapshot from github) and run +@rake backgroundrb:setup@. If you are upgrading make sure, that older +autogenerated scripts namely, @load_worker_env.rb@ and @backgroundrb@ +are removed from script directory of your rails application before running +rake task.If you are upgrading to 1.1, check if @scheduled_at@ column +is there in @bdrb_job_queues@ table. + +
    + diff --git a/vendor/plugins/backgroundrb/doc/content/faq/faq.yaml b/vendor/plugins/backgroundrb/doc/content/faq/faq.yaml new file mode 100644 index 000000000..07e2ece02 --- /dev/null +++ b/vendor/plugins/backgroundrb/doc/content/faq/faq.yaml @@ -0,0 +1,5 @@ +# Built-in +filters_pre: [ "redcloth" ] +# Custom +title: "FAQs" +sidebar_items: [["Trac", "#trac"], ["KnownBugs", "#known_bugs"]] diff --git a/vendor/plugins/backgroundrb/doc/content/rails/rails.txt b/vendor/plugins/backgroundrb/doc/content/rails/rails.txt index d4fe8b51d..5ea094db9 100644 --- a/vendor/plugins/backgroundrb/doc/content/rails/rails.txt +++ b/vendor/plugins/backgroundrb/doc/content/rails/rails.txt @@ -6,9 +6,7 @@ BackgrounDRb offers seamless integration with rails. You can invoke random tasks workers from rails. You can pass arguments, collect results, monitor status of workers and other stuff. -%(entry-title) BackgrounDRb Client API % - -p(sub-title). Invoke an asynchronous task on a worker : +%(entry-title) Invoke a task asynchronously on a worker % Let's say, you have following worker code: @@ -45,7 +43,7 @@ one as follows: Above snippet also demonstrates that, if your worker was started with a @worker_key@ you can use it to get correct worker proxy. -p(sub-title). Invoke a method on worker and get results : +%(entry-title) Synchronous Task invocation (Invoke task and wait for results) % Following snippet will invoke method @some_task@ with argument @data@ in @foo_worker@. Also, method will block until BackgrounDRb server returns a result. @@ -70,16 +68,43 @@ end As illustrated above, you can use @worker_key@ or make them in single line too. -p(sub-title). Fetch Status/Result Objects of a worker : +%(entry-title) Retrieve Cached Worker results % If you are using @cache@ in your worker code to store result objects, you can retrieve them from rails using:
    status_obj = MiddleMan.worker(:foo_worker).ask_result(cache_key) 
    -You can as usual use @worker_key@ if *worker was started with a worker_key*. +You must use @worker_key@ if *worker was started with a worker_key*. + +From controller, you can also reset result stored for a particular worker, with particular cache key. +This is only applicable, if you are using memcache for storing results. + +
    +MiddleMan.worker(:foo_worker).reset_memcache_result(cache_key) # or
    +MiddleMan.worker(:foo_worker,"worker_key").reset_memcache_result(cache_key)
    +
    + +%(entry-title) Enqueue task to the persistent job queue : % + +Jobs executed via synchronous and asynchronous APIs are fine, but these tasks are usually +kept in memory(and hence they are fast) and hence aren't entirely failsafe. + +To solve this _BackgrounDRb_ also lets you add jobs to a persistent job queue, which is +automatically picked by responsible worker and invoked. To use this: + +
    MiddleMan(:hello_worker).enq_some_task(:arg => "hello_world",:job_key => "boy")
    + +With _BackgrounDRb_ version >= 1.1, you can also schedule a persistent task to be executed at a particular time, + +
    MiddleMan(:hello_worker).enq_some_task(:arg => "hello_world",
    +                      :job_key => "boy",:scheduled_at => (Time.now + 1.hour))
    + +Above line will add specified task to the job queue and set to be invoked at specified time. For more information +about scheduling see scheduling section. + -p(sub-title). Start a Worker : +%(entry-title) Start a new worker from controller % To start a worker from rails: @@ -93,7 +118,7 @@ Important thing to be kept in mind is, when you are creating a worker using abov must use a unique @worker_key@ while starting the worker. Also, while invoking any of the other methods like @ask_result@, @worker_info@ or one of the worker methods, you must user same @worker_key@. -p(sub-title). Worker Statistics: +%(entry-title) Worker Info % You can get worker specific information using: @@ -113,7 +138,7 @@ Return value will look like: [{:worker_key=>"", :status=>:running, :worker=>:log_worker}, {:worker_key=>"", :status=>:running, :worker=>:foo_worker}]} -%(entry-title) BackgrounDRb Clustering % +%(entry-title) BackgrounDRb Clustering % By using following option in your @backgroundrb.yml@ you can cluster more than one backgroundrb server. diff --git a/vendor/plugins/backgroundrb/doc/content/rails/rails.yaml b/vendor/plugins/backgroundrb/doc/content/rails/rails.yaml index 0e8e32613..d202a053d 100644 --- a/vendor/plugins/backgroundrb/doc/content/rails/rails.yaml +++ b/vendor/plugins/backgroundrb/doc/content/rails/rails.yaml @@ -2,4 +2,4 @@ filters_pre: [ "redcloth" ] # Custom title: "Rails Integration of BackgrounDRb" -sidebar_items: [["Introduction", "#introduction"], ["Task Invocation", "#task_invocation"], ["Worker Results", "#worker_results"], ["Worker Info", "#worker_info"], ["Advanced", "#advanced"]] +sidebar_items: [["Introduction", "#introduction"], ["Async Task", "#async_task"], ["Sync Task", "#sync_task"], ["Worker Results", "#worker_results"], ["Persistent Tasks", "#persistent_task"], ["New Worker", "#new_worker"], ["Worker Info", "#worker_info"], ["Clustering", "#clustering"]] diff --git a/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.txt b/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.txt index d803d493b..2390ce045 100644 --- a/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.txt +++ b/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.txt @@ -1,6 +1,6 @@
    -%(entry-title) Timer Based Scheduling % +%(entry-title) Timer Based Scheduling % Simple tasks in the workers can be scheduled using @add_timer@ or @add_periodic_timer@ methods. For example: @@ -20,7 +20,7 @@ end Similarly one can use @add_timer@ to fire oneshot task execution. -%(entry-title) Unix Scheduler % +%(entry-title) Unix Scheduler % _BackgrounDRb_ supports normal unix styled schedules which can be configured from @backgroundrb.yml@ file. A sample configuration looks like: @@ -128,7 +128,7 @@ from the 28th second plus the 59th second: Note that if you specify an asterisk in the first field (seconds) it will trigger every second for the subsequent match. -p(sub-title). Restarting Workers on Scheduled Time +%(entry-title) Restart worker on schedule % Usually when your worker is scheduled to execute at longer intervals, it doesn't make sense to have worker around, when its doing nothing. Since, scheduling @@ -151,4 +151,16 @@ end In above worker @reload_on_schedule true@ makes sure that your worker is restarted on scheduled time. This feature is only available in version 1.0.3 onwards. +%(entry-title) Schedule one shot execution of task at specified time % + +

    Only available for tasks persisted to database table

    + +If you are using job queue table and want one shot execution of a task scheduled at a particular time. You can use: + +
    MiddleMan(:hello_worker).enq_some_task(:arg => "hello_world",
    +   :job_key => "boy",:scheduled_at => Time.now + 30.minutes)
    + +Which will schedule specified task to be executed after 30 minutes from now. + +
    diff --git a/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.yaml b/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.yaml index a1df5c628..ce8d3fc97 100644 --- a/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.yaml +++ b/vendor/plugins/backgroundrb/doc/content/scheduling/scheduling.yaml @@ -2,4 +2,4 @@ filters_pre: [ "redcloth" ] # Custom title: "Scheduling Tasks using BackgrounDRb" -sidebar_items: [["Timers", "#timer_scheduling"], ["Unix Scheduler", "#unix_scheduling"], ["Cron Scheduler", "#cron_scheduling"]] +sidebar_items: [["Timers", "#timer_scheduling"], ["Unix Scheduler", "#unix_scheduling"], ["Cron Scheduler", "#cron_scheduling"], ["Restart on Schedule", "#restart_on_schedule"], ["Schedule At", "#schedule_at"]] diff --git a/vendor/plugins/backgroundrb/doc/content/workers/workers.txt b/vendor/plugins/backgroundrb/doc/content/workers/workers.txt index 76e832508..ec6711bf2 100644 --- a/vendor/plugins/backgroundrb/doc/content/workers/workers.txt +++ b/vendor/plugins/backgroundrb/doc/content/workers/workers.txt @@ -66,7 +66,7 @@ end When @reload_on_schedule@ is true, worker won't be loaded while _BackgrounDRb_ starts and hence you don't need @set_no_auto_load@ option there. -p(sub-title). Using Thread Pool +%(entry-title) Using Thread Pool % Remember _BackgrounDRb_ follows event model of network programming, but sad truth of life is not all networking libraries follow this model and hence they make use of blocking IO and threads. BackgrounDRb allows you to run @@ -81,7 +81,12 @@ So whatever code you write within @scrap_wikipedia@ method is going to run concu *WARNING*: Many of the Ruby libraries out there aren't thread safe and they may not work as advertised when used from threads(example: Mechanize,Scrubyt) -p(sub-title). Storing result/status objects +%(entry-title) Result Caching % + +Update : Using MemCache to store result objects is strongly recommended. Inbuilt cache works, but may give +unpredictable results. Also, using Memcache serves as an out of process cache, which can be queried at any time. +If your worker is doing some processing, inbuilt cache may not return result until worker picks up that request. + All workers can cache results using @cache@ attribute. This result object can be then queried from rails using @ask_result@. For example: @@ -117,7 +122,7 @@ You need to change @backgroundrb.yml@ file like this, for using memcache for obj Everything else remains the same. -%(entry-title)Persistent Task Queue % +%(entry-title)Persistent Task Queue % BackgrounDRb now have out of box support for persistent job queues which are persisted to the database. API to add a task in the job_queue is pretty simple: @@ -149,7 +154,8 @@ class HelloWorker end end -%(entry-title)Testing Workers % + +%(entry-title)Testing Workers % _BackgrounDRb_ comes with a baked in mechanism to write test cases. First make sure that you have bdrb_test_helper.rb in the test directory of your rails app (run @rake backgroundrb:setup@, if you dont have one). diff --git a/vendor/plugins/backgroundrb/doc/content/workers/workers.yaml b/vendor/plugins/backgroundrb/doc/content/workers/workers.yaml index 5dd24f2ce..fdbf0e4c2 100644 --- a/vendor/plugins/backgroundrb/doc/content/workers/workers.yaml +++ b/vendor/plugins/backgroundrb/doc/content/workers/workers.yaml @@ -2,4 +2,4 @@ filters_pre: [ "redcloth" ] # Custom title: "Using BackgrounDRb workers" -sidebar_items: [["Introduction", "#introduction"], ["Thread Pool", "#thread_pool"], ["Options", "#options"]] +sidebar_items: [["Introduction", "#introduction"], ["Thread Pool", "#thread_pool"], ["Result Caching", "#result_caching"], ["Persistent Jobs", "#persistent_job"], ["Worker Testing", "#worker_testing"]] diff --git a/vendor/plugins/backgroundrb/doc/layouts/default.erb b/vendor/plugins/backgroundrb/doc/layouts/default/default.erb similarity index 93% rename from vendor/plugins/backgroundrb/doc/layouts/default.erb rename to vendor/plugins/backgroundrb/doc/layouts/default/default.erb index 33f2d5919..75f0919bb 100644 --- a/vendor/plugins/backgroundrb/doc/layouts/default.erb +++ b/vendor/plugins/backgroundrb/doc/layouts/default/default.erb @@ -20,9 +20,9 @@
  • Workers
  • Rails Integration
  • Advanced
  • -
  • Manual
  • +
  • Manual
  • Community
  • -
  • Bugs
  • +
  • FAQs
  • diff --git a/vendor/plugins/backgroundrb/doc/layouts/default/default.yaml b/vendor/plugins/backgroundrb/doc/layouts/default/default.yaml new file mode 100644 index 000000000..9ab71ccea --- /dev/null +++ b/vendor/plugins/backgroundrb/doc/layouts/default/default.yaml @@ -0,0 +1,4 @@ +# Built-in + +# Custom +filter: erb diff --git a/vendor/plugins/backgroundrb/doc/meta.yaml b/vendor/plugins/backgroundrb/doc/page_defaults.yaml similarity index 100% rename from vendor/plugins/backgroundrb/doc/meta.yaml rename to vendor/plugins/backgroundrb/doc/page_defaults.yaml diff --git a/vendor/plugins/backgroundrb/examples/backgroundrb.yml b/vendor/plugins/backgroundrb/examples/backgroundrb.yml index 1761e6ff4..ee987ebd9 100644 --- a/vendor/plugins/backgroundrb/examples/backgroundrb.yml +++ b/vendor/plugins/backgroundrb/examples/backgroundrb.yml @@ -7,6 +7,8 @@ :debug_log: true # whether to print debug logs to a seperate worker, defaults to true :log: foreground # will print log messages to STDOUT, defaults to seperate log worker :result_storage: memcache # store results in a mecache cluster, you also need to specify location of your memcache clusters in next section + :persistent_disabled: false # turn this off if your application doesn't use backgroundrb's persistent/enqueued tasks system + :persistent_delay: 10 # the time (seconds) between each time backgroundrb checks the database for enqueued tasks :memcache: "10.0.0.1:11211,10.0.0.2:11211" #=> location of mecache clusters seperated by comma diff --git a/vendor/plugins/backgroundrb/generators/bdrb_migration/USAGE b/vendor/plugins/backgroundrb/generators/bdrb_migration/USAGE new file mode 100644 index 000000000..f2f84f52d --- /dev/null +++ b/vendor/plugins/backgroundrb/generators/bdrb_migration/USAGE @@ -0,0 +1,12 @@ +Description: + Creates a migration to add the job queue table used by BackgrounDRb. + Pass the migration name, either CamelCased or under_scored, as an argument. + +Example: + ./script/generate bdrb_migration CreateBackgroundrbQueue + + Assuming this is run at 09:00:15h on 12 September, 2008, this will create the + CreateBackgroundrbQueue migration in: + + db/migrate/20080912090015_create_backgroundrb_queue.rb + diff --git a/vendor/plugins/backgroundrb/generators/bdrb_migration/bdrb_migration_generator.rb b/vendor/plugins/backgroundrb/generators/bdrb_migration/bdrb_migration_generator.rb new file mode 100644 index 000000000..20d592141 --- /dev/null +++ b/vendor/plugins/backgroundrb/generators/bdrb_migration/bdrb_migration_generator.rb @@ -0,0 +1,19 @@ +class BdrbMigrationGenerator < Rails::Generator::NamedBase + def initialize(runtime_args, runtime_options = {}) + runtime_args << 'CreateBackgroundrbQueueTable' if runtime_args.empty? + super + end + + def manifest + record do |m| + m.migration_template 'migration.rb', 'db/migrate', + :assigns => { :bdrb_table_name => default_bdrb_table_name } + end + end + + protected + + def default_bdrb_table_name + ActiveRecord::Base.pluralize_table_names ? 'bdrb_job_queue'.pluralize : 'bdrb_job_queue' + end +end diff --git a/vendor/plugins/backgroundrb/generators/bdrb_migration/templates/migration.rb b/vendor/plugins/backgroundrb/generators/bdrb_migration/templates/migration.rb new file mode 100644 index 000000000..8639d6646 --- /dev/null +++ b/vendor/plugins/backgroundrb/generators/bdrb_migration/templates/migration.rb @@ -0,0 +1,27 @@ +class <%= class_name %> < ActiveRecord::Migration + def self.up + create_table :<%= bdrb_table_name %> do |t| + t.column :args, :binary + t.column :worker_name, :string + t.column :worker_method, :string + t.column :job_key, :string + t.column :taken, :int + t.column :finished, :int + t.column :timeout, :int + t.column :priority, :int + t.column :submitted_at, :datetime + t.column :started_at, :datetime + t.column :finished_at, :datetime + t.column :archived_at, :datetime + t.column :tag, :string + t.column :submitter_info, :string + t.column :runner_info, :string + t.column :worker_key, :string + t.column :scheduled_at, :datetime + end + end + + def self.down + drop_table :<%= bdrb_table_name %> + end +end diff --git a/vendor/plugins/backgroundrb/lib/backgroundrb.rb b/vendor/plugins/backgroundrb/lib/backgroundrb.rb index 4ad7ea504..fa9acb249 100644 --- a/vendor/plugins/backgroundrb/lib/backgroundrb.rb +++ b/vendor/plugins/backgroundrb/lib/backgroundrb.rb @@ -16,7 +16,7 @@ require "backgroundrb/rails_worker_proxy" require "backgroundrb/bdrb_connection" require "backgroundrb/bdrb_cluster_connection" - +require "backgroundrb/bdrb_start_stop" MiddleMan = BackgrounDRb::ClusterConnection.new diff --git a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_cluster_connection.rb b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_cluster_connection.rb index e15535c71..7adbe0e08 100644 --- a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_cluster_connection.rb +++ b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_cluster_connection.rb @@ -136,6 +136,7 @@ def new_worker(options = {}) rescue BdrbConnError; end end raise NoServerAvailable.new("No BackgrounDRb server is found running") unless succeeded + return options[:worker_key] end # choose a server in round robin manner. diff --git a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_config.rb b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_config.rb index 734c16d77..adde8b955 100644 --- a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_config.rb +++ b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_config.rb @@ -15,7 +15,7 @@ def self.parse_cmd_options(argv) "Show this help message.") { $stderr.puts opts; exit } opts.separator "" opts.on("-v","--version", - "Show version.") { $stderr.puts "1.0.4"; exit } + "Show version.") { $stderr.puts "1.1"; exit } end.parse!(argv) ENV["RAILS_ENV"] = options[:environment] if options[:environment] @@ -24,7 +24,15 @@ def self.parse_cmd_options(argv) def self.read_config(config_file) config = YAML.load(ERB.new(IO.read(config_file)).result) environment = ENV["RAILS_ENV"] || config[:backgroundrb][:environment] || "development" - Object.const_set("RAILS_ENV",environment) unless defined?(RAILS_ENV) + + if respond_to?(:silence_warnings) + silence_warnings do + Object.const_set("RAILS_ENV",environment) + end + else + Object.const_set("RAILS_ENV",environment) + end + ENV["RAILS_ENV"] = environment config end diff --git a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_conn_error.rb b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_conn_error.rb index 18d305d22..45db425e7 100644 --- a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_conn_error.rb +++ b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_conn_error.rb @@ -1,10 +1,13 @@ +# Exception class for BackgrounDRb connection errors module BackgrounDRb + # raised when connection to a particular server failed class BdrbConnError < RuntimeError attr_accessor :message def initialize(message) @message = message end end + # raised when connection to all of the available servers failed class NoServerAvailable < RuntimeError attr_accessor :message def initialize(message) @@ -12,5 +15,7 @@ def initialize(message) end end + # raised, when said task was submitted without a job key, whereas + # nature of the task requires a job key class NoJobKey < RuntimeError; end end diff --git a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_job_queue.rb b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_job_queue.rb index e40ab769b..ce2d51d46 100644 --- a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_job_queue.rb +++ b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_job_queue.rb @@ -1,16 +1,20 @@ +# Model for storing jobs/tasks persisted to the database + class BdrbJobQueue < ActiveRecord::Base validates_uniqueness_of :job_key,:scope => [:worker_name,:worker_key] + # find next task from the table def self.find_next(worker_name,worker_key = nil) returned_job = nil transaction do unless worker_key - t_job = find(:first,:conditions => { :worker_name => worker_name,:taken => 0},:lock => true) + #use ruby time stamps for time calculations as db might have different times than what is calculated by ruby/rails + t_job = find(:first,:conditions => [" worker_name = ? AND taken = ? AND scheduled_at <= ? ", worker_name, 0, Time.now.utc ],:lock => true) else - t_job = find(:first,:conditions => { :worker_name => worker_name,:taken => 0,:worker_key => worker_key },:lock => true) + t_job = find(:first,:conditions => [" worker_name = ? AND taken = ? AND worker_key = ? AND scheduled_at <= ? ", worker_name, 0, worker_key, Time.now.utc ],:lock => true) end if t_job t_job.taken = 1 - t_job.started_at = Time.now + t_job.started_at = Time.now.utc t_job.save returned_job = t_job end @@ -18,6 +22,8 @@ def self.find_next(worker_name,worker_key = nil) returned_job end + # release a job and mark it to be unfinished and free. + # useful, if inside a worker, processing of this job failed and you want it to process later def release_job self.class.transaction do self.taken = 0 @@ -26,20 +32,34 @@ def release_job end end + # insert a new job for processing. jobs added will be automatically picked by the appropriate worker def self.insert_job(options = { }) transaction do - options.merge!(:submitted_at => Time.now,:finished => 0,:taken => 0) + options.merge!(:submitted_at => Time.now.utc,:finished => 0,:taken => 0) t_job = new(options) t_job.save end end + # remove a job from table + def self.remove_job(options = { }) + transaction do + t_job_id = find(:first, :conditions => options.merge(:finished => 0,:taken => 0),:lock => true) + delete(t_job_id) + end + end + + # Mark a job as finished def finish! self.class.transaction do self.finished = 1 - self.finished_at = Time.now + self.finished_at = Time.now.utc + self.job_key = "finished_#{Time.now.utc.to_i}_#{job_key}" self.save end + Thread.current[:persistent_job_id] = nil + Thread.current[:job_key] = nil + nil end end diff --git a/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb new file mode 100644 index 000000000..064cda2c3 --- /dev/null +++ b/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb @@ -0,0 +1,59 @@ +module BackgrounDRb + class StartStop + def kill_process arg_pid_file + pid = nil + pid = File.open(arg_pid_file, "r") { |pid_handle| pid_handle.gets.strip.chomp.to_i } + pgid = Process.getpgid(pid) + puts "Stopping BackgrounDRb with pid #{pid}...." + Process.kill('-TERM', pgid) + File.delete(arg_pid_file) if File.exists?(arg_pid_file) + puts "Success!" + end + + + def running?; File.exists?(PID_FILE); end + + def really_running? pid + begin + Process.kill(0,pid) + true + rescue Errno::ESRCH + puts "pid file exists but process doesn't seem to be running restarting now" + false + end + end + + def try_restart + pid = nil + pid = File.open(PID_FILE, "r") { |pid_handle| pid_handle.gets.strip.chomp.to_i } + if really_running? pid + puts "pid file already exists, exiting..." + exit(-1) + end + end + + def start + if fork + sleep(5) + exit(0) + else + try_restart if running? + puts "Starting BackgrounDRb .... " + op = File.open(PID_FILE, "w") + op.write(Process.pid().to_s) + op.close + if BDRB_CONFIG[:backgroundrb][:log].nil? or BDRB_CONFIG[:backgroundrb][:log] != 'foreground' + log_file = File.open(SERVER_LOGGER,"w+") + [STDIN, STDOUT, STDERR].each {|desc| desc.reopen(log_file)} + end + + BackgrounDRb::MasterProxy.new() + end + end + + def stop + pid_files = Dir["#{RAILS_HOME}/tmp/pids/backgroundrb_*.pid"] + pid_files.each { |x| kill_process(x) } + end + end +end diff --git a/vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb b/vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb index 98ad13c0f..3d639a321 100644 --- a/vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb +++ b/vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb @@ -1,7 +1,9 @@ module BackgrounDRb + # A Worker proxy, which uses +method_missing+ for delegating method calls to the workers class RailsWorkerProxy attr_accessor :worker_name, :worker_method, :data, :worker_key,:middle_man + # create new worker proxy def initialize(p_worker_name,p_worker_key = nil,p_middle_man = nil) @worker_name = p_worker_name @middle_man = p_middle_man @@ -13,20 +15,26 @@ def method_missing(method_id,*args) worker_method = method_id.to_s arguments = args.first - arg,job_key,host_info = arguments && arguments.values_at(:arg,:job_key,:host) + arg,job_key,host_info,scheduled_at = arguments && arguments.values_at(:arg,:job_key,:host,:scheduled_at) + new_schedule = (scheduled_at && scheduled_at.respond_to?(:utc)) ? scheduled_at.utc : Time.now.utc if worker_method =~ /^async_(\w+)/ method_name = $1 - wokrer_options = compact(:worker => worker_name,:worker_key => worker_key, + worker_options = compact(:worker => worker_name,:worker_key => worker_key, :worker_method => method_name,:job_key => job_key, :arg => arg) - run_method(host_info,:ask_work,wokrer_options) + run_method(host_info,:ask_work,worker_options) elsif worker_method =~ /^enq_(\w+)/i raise NoJobKey.new("Must specify a job key with enqueued tasks") if job_key.blank? method_name = $1 marshalled_args = Marshal.dump(arg) enqueue_task(compact(:worker_name => worker_name.to_s,:worker_key => worker_key.to_s, :worker_method => method_name.to_s,:job_key => job_key.to_s, - :args => marshalled_args,:timeout => arguments ? arguments[:timeout] : nil)) + :args => marshalled_args,:timeout => arguments ? arguments[:timeout] : nil,:scheduled_at => new_schedule)) + elsif worker_method =~ /^deq_(\w+)/i + raise NoJobKey.new("Must specify a job key to dequeue tasks") if job_key.blank? + method_name = $1 + dequeue_task(compact(:worker_name => worker_name.to_s,:worker_key => worker_key.to_s, + :worker_method => method_name.to_s,:job_key => job_key.to_s)) else worker_options = compact(:worker => worker_name,:worker_key => worker_key, :worker_method => worker_method,:job_key => job_key,:arg => arg) @@ -34,10 +42,17 @@ def method_missing(method_id,*args) end end + # enqueue tasks to the worker pool def enqueue_task options = {} BdrbJobQueue.insert_job(options) end + # remove tasks from the worker pool + def dequeue_task options = {} + BdrbJobQueue.remove_job(options) + end + + # invoke method on worker def run_method host_info,method_name,worker_options = {} result = [] connection = choose_connection(host_info) @@ -47,7 +62,7 @@ def run_method host_info,method_name,worker_options = {} elsif host_info == :all succeeded = false begin - connection.each { |conn| result << invoke_on_connection(connection,method_name,worker_options) } + connection.each { |conn| result << invoke_on_connection(conn,method_name,worker_options) } succeeded = true rescue BdrbConnError; end raise NoServerAvailable.new("No BackgrounDRb server is found running") unless succeeded @@ -65,11 +80,14 @@ def run_method host_info,method_name,worker_options = {} return_result(result) end + # choose a backgroundrb server connection and invoke worker method on it. def invoke_on_connection connection,method_name,options = {} raise NoServerAvailable.new("No BackgrounDRb is found running") unless connection connection.send(method_name,options) end + # get results back from the cache. Cache can be in-memory worker cache or memcache + # based cache def ask_result job_key options = compact(:worker => worker_name,:worker_key => worker_key,:job_key => job_key) if BDRB_CONFIG[:backgroundrb][:result_storage] == 'memcache' @@ -80,26 +98,39 @@ def ask_result job_key end end + # return runtime information about worker def worker_info t_connections = middle_man.backend_connections result = t_connections.map { |conn| conn.worker_info(compact(:worker => worker_name,:worker_key => worker_key)) } return_result(result) end + # generate worker key def gen_key options key = [options[:worker],options[:worker_key],options[:job_key]].compact.join('_') key end + # return result from memcache def return_result_from_memcache options = {} middle_man.cache[gen_key(options)] end + # reset result within memcache for given key + def reset_memcache_result(job_key,value) + options = compact(:worker => worker_name,:worker_key => worker_key,\ + :job_key => job_key) + key = gen_key(options) + middle_man.cache[key] = value + value + end + def return_result result result = Array(result) result.size <= 1 ? result[0] : result end + # delete a worker def delete middle_man.backend_connections.each do |connection| connection.delete_worker(compact(:worker => worker_name, :worker_key => worker_key)) @@ -107,6 +138,7 @@ def delete return worker_key end + # choose a worker def choose_connection host_info case host_info when :all; middle_man.backend_connections @@ -116,6 +148,7 @@ def choose_connection host_info end end + # helper method to compact a hash and for getting rid of nil parameters def compact(options = { }) options.delete_if { |key,value| value.nil? } options diff --git a/vendor/plugins/backgroundrb/script/backgroundrb b/vendor/plugins/backgroundrb/script/backgroundrb index dabf80bd4..9be048a3f 100755 --- a/vendor/plugins/backgroundrb/script/backgroundrb +++ b/vendor/plugins/backgroundrb/script/backgroundrb @@ -26,45 +26,14 @@ require RAILS_HOME + "/config/environment" require "bdrb_job_queue" require "backgroundrb_server" -pid_file = "#{RAILS_HOME}/tmp/pids/backgroundrb_#{BDRB_CONFIG[:backgroundrb][:port]}.pid" +PID_FILE = "#{RAILS_HOME}/tmp/pids/backgroundrb_#{BDRB_CONFIG[:backgroundrb][:port]}.pid" SERVER_LOGGER = "#{RAILS_HOME}/log/backgroundrb_debug_#{BDRB_CONFIG[:backgroundrb][:port]}.log" -case ARGV[0] -when 'start' - if fork - sleep(5) - exit - else - op = File.open(pid_file, "w") - op.write(Process.pid().to_s) - op.close - if BDRB_CONFIG[:backgroundrb][:log].nil? or BDRB_CONFIG[:backgroundrb][:log] != 'foreground' - log_file = File.open(SERVER_LOGGER,"w+") - [STDIN, STDOUT, STDERR].each {|desc| desc.reopen(log_file)} - end +daemon = BackgrounDRb::StartStop.new - BackgrounDRb::MasterProxy.new() - end -when 'stop' - def kill_process arg_pid_file - pid = nil - File.open(arg_pid_file, "r") { |pid_handle| pid = pid_handle.gets.strip.chomp.to_i } - begin - pgid = Process.getpgid(pid) - Process.kill('TERM', pid) - Process.kill('-TERM', pgid) - Process.kill('KILL', pid) - rescue Errno::ESRCH => e - puts "Deleting pid file" - rescue - puts $! - ensure - File.delete(arg_pid_file) if File.exists?(arg_pid_file) - end - end - pid_files = Dir["#{RAILS_HOME}/tmp/pids/backgroundrb_*.pid"] - pid_files.each { |x| kill_process(x) } -else - BackgrounDRb::MasterProxy.new() +case ARGV[0] +when 'start'; daemon.start +when 'stop'; daemon.stop() +else; BackgrounDRb::MasterProxy.new() end diff --git a/vendor/plugins/backgroundrb/script/bdrb_test_helper.rb b/vendor/plugins/backgroundrb/script/bdrb_test_helper.rb index cf56af65c..a20cd6566 100644 --- a/vendor/plugins/backgroundrb/script/bdrb_test_helper.rb +++ b/vendor/plugins/backgroundrb/script/bdrb_test_helper.rb @@ -1,7 +1,6 @@ -require File.dirname(__FILE__) + '/test_helper' +require File.join(File.dirname(__FILE__) + "/../config/environment") WORKER_ROOT = RAILS_ROOT + "/lib/workers" $LOAD_PATH.unshift(WORKER_ROOT) -require "mocha" class Object def self.metaclass; class << self; self; end; end @@ -31,32 +30,69 @@ def self.iattr_accessor *args module BackgrounDRb class WorkerDummyLogger - def info(data) - end - def debug(data) + %w(info debug fatal error warn).each do |x| + define_method(x) do |log_data| + end end - def error(data) + end + + class WorkData + attr_accessor :args,:block,:job_method,:persistent_job_id,:job_key + def initialize(args,job_key,job_method,persistent_job_id) + @args = args + @job_key = job_key + @job_method = job_method + @persistent_job_id = persistent_job_id end end + + class ThreadPool + attr_accessor :size,:threads,:work_queue,:logger + attr_accessor :result_queue,:master + + def initialize(master,size) + @master = master + @logger = logger + @size = size + @threads = [] + end + + def defer(method_name,args = nil) + job_key = Thread.current[:job_key] + persistent_job_id = Thread.current[:persistent_job_id] + t = WorkData.new(args,job_key,method_name,persistent_job_id) + result = run_task(t) + result + end + + # run tasks popped out of queue + def run_task task + block_arity = master.method(task.job_method).arity + begin + t_data = task.args + result = nil + if block_arity != 0 + result = master.send(task.job_method,task.args) + else + result = master.send(task.job_method) + end + return result + rescue + puts($!.to_s) + puts($!.backtrace.join("\n")) + return nil + end + end + end #end of class ThreadPool + class MetaWorker - attr_accessor :logger - attr_accessor :thread_pool + attr_accessor :logger,:thread_pool iattr_accessor :worker_name iattr_accessor :no_auto_load def initialize @logger = WorkerDummyLogger.new - @thread_pool = ThreadPool.new - end - - def register_status(arg) - @status = arg - end - end - - class ThreadPool - def defer(args,&block) - yield args + @thread_pool = ThreadPool.new(self,10) end end end diff --git a/vendor/plugins/backgroundrb/script/monitrc b/vendor/plugins/backgroundrb/script/monitrc new file mode 100644 index 000000000..501fc80c3 --- /dev/null +++ b/vendor/plugins/backgroundrb/script/monitrc @@ -0,0 +1,25 @@ +set daemon 60 +set mailserver localhost +set mail-format { + from: sample@foobar.com + subject: Alert from Backgroundrb +} +set alert hemant@gmail.com + +set httpd port 3000 and + use address localhost # only accept connection from localhost + allow localhost # allow localhost to connect to the server and + +check process backgroundrb + with pidfile /home/hemant/rails_sandbox/tmp/pids/backgroundrb_11008.pid + start program = "/usr/bin/ruby /home/hemant/rails_sandbox/script/backgroundrb start" + stop program = "/usr/bin/ruby /home/hemant/rails_sandbox/script/backgroundrb stop" + if totalmem > 50.0 MB for 5 cycles then restart + if cpu usage > 95% for 3 cycles then restart + + if failed port 11008 type tcp + with timeout 30 seconds + for 5 cycles + then restart + group backgroundrb + diff --git a/vendor/plugins/backgroundrb/server/lib/master_proxy.rb b/vendor/plugins/backgroundrb/server/lib/master_proxy.rb index 579d55195..85586cad6 100644 --- a/vendor/plugins/backgroundrb/server/lib/master_proxy.rb +++ b/vendor/plugins/backgroundrb/server/lib/master_proxy.rb @@ -98,7 +98,7 @@ def load_and_invoke(worker_name,p_method,data) begin require worker_name.to_s worker_key = Packet::Guid.hexdigest - @reactor.start_worker(:worker => worker_name,:worker_key => worker_key) + @reactor.start_worker(:worker => worker_name,:worker_key => worker_key,:disable_log => true) worker_name_key = gen_worker_key(worker_name,worker_key) data_request = {:data => { :worker_method => p_method,:arg => data[:data]}, :type => :request, :result => false diff --git a/vendor/plugins/backgroundrb/server/lib/master_worker.rb b/vendor/plugins/backgroundrb/server/lib/master_worker.rb index c4662a9c3..1be1455c9 100644 --- a/vendor/plugins/backgroundrb/server/lib/master_worker.rb +++ b/vendor/plugins/backgroundrb/server/lib/master_worker.rb @@ -30,21 +30,27 @@ class MasterWorker # receives requests from rails and based on request type invoke appropriate method def receive_data p_data @tokenizer.extract(p_data) do |b_data| - t_data = load_data b_data - if t_data - case t_data[:type] - # async method invocation - when :async_invoke: async_method_invoke(t_data) - # get status/result - when :get_result: get_result_object(t_data) - # sync method invocation - when :sync_invoke: method_invoke(t_data) - when :start_worker: start_worker_request(t_data) - when :delete_worker: delete_drb_worker(t_data) - when :worker_info: pass_worker_info(t_data) - when :all_worker_info: all_worker_info(t_data) - else; debug_logger.info("Invalid request") + begin + t_data = load_data b_data + if t_data + case t_data[:type] + # async method invocation + when :async_invoke: async_method_invoke(t_data) + # get status/result + when :get_result: get_result_object(t_data) + # sync method invocation + when :sync_invoke: method_invoke(t_data) + when :start_worker: start_worker_request(t_data) + when :delete_worker: delete_drb_worker(t_data) + when :worker_info: pass_worker_info(t_data) + when :all_worker_info: all_worker_info(t_data) + else; debug_logger.info("Invalid request") + end end + rescue Exception => e + debug_logger.info(e) + debug_logger.info(e.backtrace.join("\n")) + send_object(nil) end end end @@ -152,9 +158,7 @@ def worker_receive p_data send_object(p_data) end - def unbind - debug_logger.info("Client disconected") - end + def unbind; end # called whenever a new connection is made.Initializes binary data parser def post_init diff --git a/vendor/plugins/backgroundrb/server/lib/meta_worker.rb b/vendor/plugins/backgroundrb/server/lib/meta_worker.rb index 3066adaff..def8e63bf 100644 --- a/vendor/plugins/backgroundrb/server/lib/meta_worker.rb +++ b/vendor/plugins/backgroundrb/server/lib/meta_worker.rb @@ -5,20 +5,15 @@ class PacketLogger def initialize(worker,log_flag = true) @log_flag = log_flag @worker = worker + @log_mutex = Mutex.new end - def info(p_data) - return unless @log_flag - @worker.send_request(:worker => :log_worker, :data => p_data) - end - - def debug(p_data) - return unless @log_flag - @worker.send_request(:worker => :log_worker, :data => p_data) - end - - def error(p_data) - return unless @log_flag - @worker.send_request(:worker => :log_worker, :data => p_data) + [:info,:debug,:warn,:error,:fatal].each do |m| + define_method(m) do |log_data| + return unless @log_flag + @log_mutex.synchronize do + @worker.send_request(:worker => :log_worker, :data => log_data) + end + end end end # == MetaWorker class @@ -133,7 +128,9 @@ def worker_init create_arity = method(:create).arity (create_arity == 0) ? create : create(worker_options[:data]) end - #add_periodic_timer(5) { check_for_enqueued_tasks } + return if BDRB_CONFIG[:backgroundrb][:persistent_disabled] + delay = BDRB_CONFIG[:backgroundrb][:persistent_delay] || 5 + add_periodic_timer(delay.to_i) { check_for_enqueued_tasks } end # return job key from thread global variable diff --git a/vendor/plugins/backgroundrb/tasks/backgroundrb_tasks.rake b/vendor/plugins/backgroundrb/tasks/backgroundrb_tasks.rake index e121c8a28..1b968182e 100644 --- a/vendor/plugins/backgroundrb/tasks/backgroundrb_tasks.rake +++ b/vendor/plugins/backgroundrb/tasks/backgroundrb_tasks.rake @@ -1,41 +1,4 @@ namespace :backgroundrb do - def setup_queue_migration - config_file = "#{RAILS_ROOT}/config/database.yml" - require "erb" - require "active_record" - config = YAML.load(ERB.new(IO.read(config_file)).result) - env = ENV["RAILS_ENV"] || ENV["env"] || 'development' - - ActiveRecord::Base.establish_connection(config[env]) - migration_klass = Class.new(ActiveRecord::Migration) do - def self.up - create_table :bdrb_job_queues do |t| - t.column :args, :binary - t.column :worker_name, :string - t.column :worker_method, :string - t.column :job_key, :string - t.column :taken, :int - t.column :finished, :int - t.column :timeout, :int - t.column :priority, :int - t.column :submitted_at, :datetime - t.column :started_at, :datetime - t.column :finished_at, :datetime - t.column :archived_at, :datetime - t.column :tag, :string - t.column :submitter_info, :string - t.column :runner_info, :string - t.column :worker_key, :string - end - end - - def self.down - drop_table :bdrb_job_queues - end - end - migration_klass.up - end - require 'yaml' desc 'Setup backgroundrb in your rails application' task :setup do @@ -77,17 +40,13 @@ namespace :backgroundrb do puts "Copying Worker envionment loader file #{worker_env_loader_dest}" FileUtils.cp_r(worker_env_loader_src,worker_env_loader_dest) end - begin - setup_queue_migration - rescue - error_msg = $!.message - puts error_msg.first(85) - end + + # Generate the migration + Rake::Task['backgroundrb:queue_migration'].invoke end - desc "Create backgroundrb queue table" - task :create_queue do - setup_queue_migration + desc "Drops and recreate backgroundrb queue table" + task :redo_queue => :queue_migration do end desc 'update backgroundrb config files from your rails application' @@ -106,6 +65,15 @@ namespace :backgroundrb do end end + desc 'Generate a migration for the backgroundrb queue table. The migration name can be ' + + 'specified with the MIGRATION environment variable.' + task :queue_migration => :environment do + raise "Task unavailable to this database (no migration support)" unless ActiveRecord::Base.connection.supports_migrations? + require 'rails_generator' + require 'rails_generator/scripts/generate' + Rails::Generator::Scripts::Generate.new.run(['bdrb_migration', ENV['MIGRATION'] || 'CreateBackgroundrbQueueTable']) + end + desc 'Remove backgroundrb from your rails application' task :remove do script_src = "#{RAILS_ROOT}/script/backgroundrb" diff --git a/vendor/plugins/backgroundrb/test/client/backgroundrb.yml b/vendor/plugins/backgroundrb/test/client/backgroundrb.yml new file mode 100644 index 000000000..9d10c7015 --- /dev/null +++ b/vendor/plugins/backgroundrb/test/client/backgroundrb.yml @@ -0,0 +1,17 @@ +--- +:backgroundrb: + :ip: 0.0.0.0 + :port: 11008 + :log: foreground + :environment: development + :result_storage: memcache + +:memcache: "localhost:11211" + +# :client: "0.0.0.0:11006,0.0.0.0:11008" + +:schedules: + :wow_worker: + :foo: + :trigger_args: */60 * * * * * * + diff --git a/vendor/plugins/backgroundrb/test/client/test_bdrb_cluster_connection.rb b/vendor/plugins/backgroundrb/test/client/test_bdrb_cluster_connection.rb index b870720f3..1537896af 100644 --- a/vendor/plugins/backgroundrb/test/client/test_bdrb_cluster_connection.rb +++ b/vendor/plugins/backgroundrb/test/client/test_bdrb_cluster_connection.rb @@ -88,7 +88,8 @@ def iset(var,value) @cluster_connection.backend_connections.each do |t_conn| t_conn.expects(:new_worker).with(:worker => :hello_worker,:worker_key => "boy",:data => "boy").returns(true) end - @cluster_connection.new_worker(:worker => :hello_worker,:worker_key => "boy",:data => "boy") + a = @cluster_connection.new_worker(:worker => :hello_worker,:worker_key => "boy",:data => "boy") + a.should == "boy" end specify "should work with all worker info methods" do diff --git a/vendor/plugins/backgroundrb/test/client/test_bdrb_config.rb b/vendor/plugins/backgroundrb/test/client/test_bdrb_config.rb new file mode 100644 index 000000000..0d357d799 --- /dev/null +++ b/vendor/plugins/backgroundrb/test/client/test_bdrb_config.rb @@ -0,0 +1,20 @@ +require File.join(File.dirname(__FILE__) + "/../bdrb_test_helper") +require File.join(File.dirname(__FILE__) + "/../bdrb_client_test_helper") + +context "For BackgrounDRb config" do + conf_file = File.join(File.dirname(__FILE__),"backgroundrb.yml") + specify "should setup correct environment from cmd options" do + BackgrounDRb::Config.parse_cmd_options(["-e", "production"]) + BackgrounDRb::Config.read_config(conf_file) + ENV["RAILS_ENV"].should == "production" + RAILS_ENV.should == "production" + end + + specify "should setup correct environment from conf file" do + ENV["RAILS_ENV"] = nil + BackgrounDRb::Config.parse_cmd_options([]) + BackgrounDRb::Config.read_config(conf_file) + ENV["RAILS_ENV"].should == "development" + RAILS_ENV.should == "development" + end +end diff --git a/vendor/plugins/backgroundrb/test/client/test_bdrb_job_queue.rb b/vendor/plugins/backgroundrb/test/client/test_bdrb_job_queue.rb index 7ddbc76de..531ff18f1 100644 --- a/vendor/plugins/backgroundrb/test/client/test_bdrb_job_queue.rb +++ b/vendor/plugins/backgroundrb/test/client/test_bdrb_job_queue.rb @@ -3,5 +3,44 @@ require "bdrb_job_queue" context "For BackgrounDRb job Queues" do + setup do + db_config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/config/database.yml")).result) + ActiveRecord::Base.establish_connection(db_config_file["test"]) + BdrbJobQueue.destroy_all + end + specify "should insert job with proper params" do + BdrbJobQueue.insert_job(:worker_name => "hello_world",:worker_method => "foovar",:job_key => "cats",:args => "hello_world",:scheduled_at => Time.now.utc) + next_job = BdrbJobQueue.find_next("hello_world") + next_job.taken.should == 1 + next_job.started_at.should.not.be nil + next_job.job_key.should == "cats" + next_job.worker_name.should == "hello_world" + next_job.worker_method.should == "foovar" + end + + specify "release_job should worker properly" do + BdrbJobQueue.insert_job(:worker_name => "hello_world",:worker_method => "foovar",:job_key => "cats",:args => "hello_world",:scheduled_at => Time.now.utc) + next_job = BdrbJobQueue.find_next("hello_world") + next_job.release_job + t = BdrbJobQueue.find_by_job_key("cats") + t.taken.should == 0 + t.started_at.should == nil + end + + specify "remove job should work properly" do + BdrbJobQueue.insert_job(:worker_name => "hello_world",:worker_method => "foovar",:job_key => "cats",:args => "hello_world",:scheduled_at => Time.now.utc) + BdrbJobQueue.remove_job(:worker_name => "hello_world",:worker_method => "foovar",:job_key => "cats") + t = BdrbJobQueue.find_by_job_key("cats") + t.should == nil + end + + specify "finish should work properly" do + BdrbJobQueue.insert_job(:worker_name => "hello_world",:worker_method => "foovar",:job_key => "cats",:args => "hello_world",:scheduled_at => Time.now.utc) + t = BdrbJobQueue.find_next("hello_world") + t.finish! + t.finished.should == 1 + t.finished_at.should.not == nil + t.job_key.should.match(/finished_\d+_cats/i) + end end diff --git a/vendor/plugins/backgroundrb/test/client/test_worker_proxy.rb b/vendor/plugins/backgroundrb/test/client/test_worker_proxy.rb index e7231429f..43337e1d5 100644 --- a/vendor/plugins/backgroundrb/test/client/test_worker_proxy.rb +++ b/vendor/plugins/backgroundrb/test/client/test_worker_proxy.rb @@ -11,6 +11,7 @@ @cluster_conn = mock @worker_proxy = BackgrounDRb::RailsWorkerProxy.new(:hello_worker,nil,@cluster_conn) end + specify "should let you fetch results" do @cluster_conn.expects(:backend_connections).returns([]) foo = @worker_proxy.ask_result(:foobar) @@ -34,6 +35,13 @@ end specify "delete method should run on all nodes" do + conn_array = (0..3).map do |i| + t = mock() + t.expects(:delete_worker).with(:worker => :hello_worker).returns(nil) + t + end + @cluster_conn.expects(:backend_connections).returns(conn_array) + @worker_proxy.delete end specify "should let you invoke worker_info method" do @@ -54,6 +62,40 @@ @cluster_conn.expects(:find_connection).returns(actual_conn) @worker_proxy.async_foobar(:arg => :hello,:job_key => "boy", :host => "192.168.2.100:100") + end + + specify "for enqueued tasks" do + BdrbJobQueue = mock() unless Object.const_defined?(:BdrbJobQueue) + BdrbJobQueue.expects(:insert_job).with() { |value| + value[:worker_name].should == "hello_worker" + value[:worker_method].should == "foobar" + value[:scheduled_at].should.not == nil + value[:job_key] == "catz" + } + @worker_proxy.enq_foobar(:arg => :hello,:job_key => "catz") + end + + specify "for removing tasks from the queue" do + BdrbJobQueue = mock() unless Object.const_defined?(:BdrbJobQueue) + BdrbJobQueue.expects(:remove_job).with() do |value| + value[:worker_name] == "hello_worker" + value[:worker_method] == "foobar" + value[:job_key] == "catz" + end + @worker_proxy.deq_foobar(:job_key => "catz") + end + + specify "should run task on all servers if asked" do + backend_connections = [] + 2.times { |i| + actual_conn = mock() + actual_conn.expects(:ask_work).with(:worker => :hello_worker,:worker_method => 'foobar',:job_key => 'hello') + backend_connections << actual_conn + } + @cluster_conn.expects(:backend_connections).returns(backend_connections) + a = @worker_proxy.async_foobar(:job_key => "hello",:host => :all) + end + specify "should switch connections if invoke fails on chosen one" do end end diff --git a/vendor/plugins/brain_buster/views/brain_busters/_captcha.rhtml b/vendor/plugins/brain_buster/views/brain_busters/_captcha.rhtml index 82c63c6bc..1140faa80 100644 --- a/vendor/plugins/brain_buster/views/brain_busters/_captcha.rhtml +++ b/vendor/plugins/brain_buster/views/brain_busters/_captcha.rhtml @@ -7,7 +7,7 @@ Security Code: <%= @captcha.question %> - <%= text_field_tag :captcha_answer, params[:captcha_answer], :size => 10, :maxlength => 40 %> + <%= text_field_tag :captcha_answer, params[:captcha_answer], :size => 10, :maxlength => 40, :tabindex => '1' %>
    <% end %> diff --git a/vendor/plugins/redbox/.piston.yml b/vendor/plugins/redbox/.piston.yml new file mode 100644 index 000000000..1c7f96d0f --- /dev/null +++ b/vendor/plugins/redbox/.piston.yml @@ -0,0 +1,8 @@ +--- +format: 1 +handler: + commit: 22fa6eb7e7a31ead2621d370b826f12c84f673d9 + branch: HEAD +lock: +repository_url: git://github.com/jebw/redbox.git +repository_class: Piston::Git::Repository diff --git a/vendor/plugins/tiny_mce/.piston.yml b/vendor/plugins/tiny_mce/.piston.yml index d03f25dbf..6fdadc1c1 100644 --- a/vendor/plugins/tiny_mce/.piston.yml +++ b/vendor/plugins/tiny_mce/.piston.yml @@ -1,8 +1,8 @@ --- format: 1 handler: - commit: a2d3b12205d24867ca03f9ff00a93a5afe233a6f + commit: d77961a291d900fa0bd05d6ca15b66f084425ae0 branch: HEAD +lock: false repository_url: git://github.com/kete/tiny_mce.git -lock: repository_class: Piston::Git::Repository diff --git a/vendor/plugins/tiny_mce/CHANGELOG_PLUGIN b/vendor/plugins/tiny_mce/CHANGELOG_PLUGIN new file mode 100644 index 000000000..aa68cc360 --- /dev/null +++ b/vendor/plugins/tiny_mce/CHANGELOG_PLUGIN @@ -0,0 +1,13 @@ += Plugin Changelog + +== Version 3.2.0.2 (2008-10-04) +* Updated TinyMCE to 3.2.0.2 +* Formated README file with RDoc syntax for easier reading on Github +* Added separate TinyMCE changelog (starting from 3.0 alphas through to now) +* Rake task refactored (now uses cp_r instead of custom method), and new update task +* Edited TinyMCE helper methods (single "include_tiny_mce_if_needed" method includes Javascript and initializes TinyMCE) +* Updated TinyMCE configuration options file (tiny_mce_options.yml) + +== Version 3.1.0.1 (2008-07-02) +* Updated TinyMCE +* Replaced old documentation with readme file containing link to online documentation \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/CHANGELOG_TINYMCE b/vendor/plugins/tiny_mce/CHANGELOG_TINYMCE new file mode 100644 index 000000000..f02517293 --- /dev/null +++ b/vendor/plugins/tiny_mce/CHANGELOG_TINYMCE @@ -0,0 +1,727 @@ +Version 3.2.0.2 (2008-10-02) + Fixed bug where the SelectBox and NativeSelectBox wasn't updated correctly if undefined was passed to them. + Fixed bug where the style dropdown wasn't correctly changed back to it's original state when element had no class. + Fixed bug where multiple pending font styles wasn't handled correctly. + Fixed so you can disable all auto css loading for dialogs by setting the popups_css option to false. +Version 3.2.0.1 (2008-09-17) + Fixed bug where font sizes and faces wouldn't be changed correctly when there was a parent with a different style. + Fixed bug where adding fonts to the same selection would produce redundant spans. +Version 3.2 (2008-09-11) + Added new text style support, it will now use span elements internally instead of font elements. + Added new improved support for the theme_advanced_font_sizes option, check the Wiki for details. + Added new keep_style setting that maintains the text style on return/enter on non IE browsers, enabled by default. + Added new onBeforeSetContent/onBeforeGetContent/onSetContent/onGetContent events to the Selection class. + Added new selectByIndex method to ListBox class. This enables you to select list items by an index instead of a value. + Added new possibility to the select method of the ListBox class. This can now have a selector function as it's value argument. + Added new possibility to skip the loading of popups css by setting the feature popup_css to the value false. + Added new possibility to skip translation of popups by setting the translate_i18n feature to false. + Added new element_format option enables you to produce HTML element endings instead of XHTML. But we are still in the XHTML is better camp. + Added missing allowfullscreen and quality options for flash elements, this will now get correctly stored. + Fixed bug where table cell dialog didn't close properly unless the accessibility_warnings option was set to false. + Fixed bug where the modal dialog blocker element for inlinepopups wasn't placed at a correct location if the page had scroll. + Fixed bug where non inline dialogs didn't close correctly if the inlinepopups plugin was used. + Fixed bug where non inline dialogs could make the modal dialog blocker to work incorrectly. + Fixed bug where style select wasn't populated correctly if you pressed the arrow. Patch by Hari Karam Singh. + Fixed bug where toggling the fullscreen mode didn't restore scrollbars on IE when the editor was inside a frame. Patch by Jacob Barrett. + Fixed bug where inserting flash contents using the template plugin didn't work correctly. + Fixed bug where inserting flash contents using the selection.setContent or mceInsertContent command didn't work correctly. + Fixed bug where IE would produce an exception if a comment started with -. + Fixed bug where the blockquote button would wrap lists incorrectly on non IE browsers. + Fixed bug where Opera would display BR elements in the element path. + Fixed bug where xhtmlxtras didn't insert elements correctly on IE. + Fixed bug where the buttons wasn't activated correctly in the xhtmlxtras plugin. + Fixed bug where adding an object as the style attribute for the dom setAttribs method wouldn't work. + Fixed bug where the background color would bleed out to parent container element in Gecko. + Fixed bug where the insert column actions for tables would fail if you did it in a thead or tfoot. Patch contributed by T Andersen (tan73). + Fixed bug where event blocker element wasn't positioned correctly for the inlinepopups plugin. + Fixed bug where pasting from Office 2007 would produce an odd comment in the contents. + Fixed bug where the paste as plain text could remove an extra character. Patch contributed by Speednet. + Fixed bug where some characters where missing for the paste_replace_list option. Patch contributed by Speednet. + Fixed bug where removing non existing editor instances by the mceRemoveControl command would produce an error. + Fixed bug where meta elements with the name description would produce errors in IE. + Fixed bug where color and background colors wouldn't be updated properly. + Fixed bug where the createMenuButton of tinymce.ControlManager didn't implement the last class argument. + Fixed bug where the editor_css option was relative from the TinyMCE installation directory not the current page. + Fixed bug where elements wouldn't be padded if the element contained bogus br elements. For example TD elements. + Fixed bug where parsing of in fullpage plugin would produce an error. + Fixed bug where relative urls with just ./ would become an empty string. + Fixed bug where outdent button would be disabled if inline_styles where set to false. + Fixed bug where replace with an empty search string would produce an error on IE. + Fixed bug where restoring the overflow state of the body in fullscreen plugin running on IE would produce vertical scrollbars. + Fixed bug where pressing return/enter in list items would sometimes move the caret the to top of the content area in FF. + Fixed bug where the style listbox wouldn't be updated correctly if you used the use_native_selects option. + Fixed bug where WebKit browsers would produce a div element when ending list elements using return. + Fixed so translation of popup contents only occurs if it's needed. + Optimized the URI object in regards or converting absolute URIs to relative URIs. +Version 3.1.1 (2008-08-18) + Added new getSize method to DOMUtils it will return the dimensions only of an element. + Added new alert/confirm methods to the tinyMCEPopup class to prevent focus problems and also to shorten method calls. + Added new plugin_preview_inline option to preview plugin to enable/disable native/inline dialogs. + Added new readonly option. If this is set the editor will only display the contents for the user. + Added missing tabindex and accesskey to input elements in the default valid_elements setup. + Updated firebug lite to 1.2, to enable it use the tiny_mce_dev.js?debug=1 on the development package. + Fixed so the preview dialog in the preview plugin uses inline dialogs/popups. + Fixed so CDATA sections remains intact through the serialization process of the DOM tree. + Fixed various issues with the getAttrib command. It will now return more correct values. + Fixed bug where the embed element wasn't properly parsed in the media plugin it now supports 3 formats. + Fixed bug where the noshade attribute was serialized incorrectly on IE. + Fixed bug where editing an existing link element didn't force it relative. + Fixed bug where image link creation fails on Safari if the image is aligned. + Fixed bug where it was possible to scroll the fullscreen mode in Opera 9.50. + Fixed bug where removal of center image alignment would fail. Patch contributed by Andrew Ozz. + Fixed bug where inlinedialogs didn't work properly if the doctype was incorrect in IE. + Fixed bug where cross domain loading didn't work correctly in Opera 9.50. + Fixed bug where breaking huge text blocks with return/enter key would scroll to end of block. + Fixed bug where replace button kept inserting the replacement text even if there is no more matches. + Fixed bug with fullpage plugin where value wasn't set correctly. Patch contributed by Pascal Chantelois. + Fixed bug where the dom utils setAttrib method call could produce an exception if the input was null/false. + Fixed bug where pressing backspace would sometimes remove one extra character in Gecko browsers. + Fixed bug where the native confirm/alert boxes would move focus to parent document if fired in dialogs. + Fixed bug where Opera 9.50 was telling you that the selection is collapsed even when it isn't. + Fixed bug where mceInsertContent would break up existing elements in Opera and Gecko. + Fixed bug where TinyMCE fails to detect some keyboard combos on Mac, contributed by MattyRob. + Fixed bug where replace all didn't move the caret to beginning of text before searching. + Fixed bug where the oninit callback wasn't executed correctly when the strict_loading_mode option was used, thanks goes to Nicholas Oxhoej. + Fixed bug where a access denied exception was thrown if some other script specified document.domain before loading TinyMCE. + Fixed so setting language to empty string will skip language loading if translations are made by some backend. + Fixed so dialog_type is automatically modal if you use the inlinepopups plugin use dialog_type : "window" to re-enable the old behavior. +Version 3.1.0.1 (2008-06-18) + Fixed bug where the Opera line break fix didn't work correctly on Mac OS X and Unix. + Fixed bug where IE was producing the default value the maxlength attribute of input elements. +Version 3.1.0 (2008-06-17) + Fixed bug where the paste as text didn't work correctly it encoded produced paragraphs and br elements. + Fixed bug where embed element in XHTML style didn't work correctly in the media plugin. + Fixed bug where style elements was forced empty in IE. The will now be wrapped in a comment just like script elements. + Fixed bug where some script elements wrapped in CDATA could fail to be serialized correctly. + Fixed bug where FF 3 produced -moz- internal styles in some style attributes. + Fixed bug where query strings and external URLs didn't work correctly in style attributes. + Fixed bug where shape attribute of area elements got serialized as rect regardless of it's initial value in IE 6. + Fixed bug where selection of elements inside layers would fail in IE since focus was moved to the document body. + Fixed bug where pressing enter/return in an editable select box would produce an __mce_add_custom__ class value. + Fixed bug where changing font size of text placed inside a colored text chunk would remove the parent node. + Fixed bug where Opera 9.5 final produced a strange line break behavior due to a workaround for previous Opera versions. + Fixed bug where text/background color would produce a strange focus problem when you tried to click on the body in IE. + Fixed issue where selecting the title of an listbox equals the old 2.x behavior of changing the value to an empty string. + Fixed issue where it was common for the media plugin to break if the _value attribute wasn't added for the param element. + Fixed issue where the wrong parent editor instance might be updated if you use fullscreen mode in an incorrect way. + Fixed issue where Safari was producing a warning about the base element not being closed correctly. + Removed redundant form element name matching from regexp in the DOMUtils class. +Version 3.0.9 (2008-06-02) + Added new contextmenu_offset_x/contextmenu_offset_y options for the contextmenu plugin. + Added cite attribute to the default rule for the blockquote element. + Added support for using arrow keys for selection of items in listboxes. + Added support for using arrow keys for selection of items in dropmenus. + Fixed bug where blockformat change on elements with BR inside them didn't change correctly on Firefox. + Fixed bug where removing table rows inside thead or tfoot would remove the whole table if it was the last one. + Fixed bug where XHR synchronous mode didn't execute the callback handlers synchronously. + Fixed bug where setting border to 0 didn't add border: 0 to the style attribute when using the advimage dialog. + Fixed bug where the selection of images and table cells didn't work correctly when the editor is placed in a frame and running on IE. + Fixed bug where the store/restore of a selection didn't work correctly in non IE browsers. + Fixed bug where only the first element would be invalid for the invalid_elements option. + Fixed bug where paste as plain text didn't encode the characters correctly when they where inserted. + Fixed bug where HTML source window couldn't be maximized on Gecko when the maximizable feature was enabled. + Fixed bug where color selection using the color picker could produce exception in IE. + Fixed bug where font size changes could produce produce extra redundant elements. + Fixed bug where IE could produce unknown runtime error if you replaced a image with another image from a separate frame. + Fixed bug where the domLoaded state for the Event class wasn't set correctly if the editor was loaded dynamically using the gzip compressor. + Fixed bug where handling of the base element for a page would produce incorrect urls. Based on a patch contributed by John LeSueur. + Fixed bug where table constraint alert boxes was presented with an empty value and wasn't the skinned inline ones. + Fixed bug where the onChange event wasn't fired when the form was submitted. It's now also triggered when the save method is called. + Fixed bug where encoding set to xml didn't work as expected. It now encodes the contents into XML entities. + Fixed bug where numrows didn't work correctly for the merge cells dialog of the table plugin. + Fixed bug where the onGetContent event was fired even when the no_events flag was set. + Fixed bug where the preview panels for the advimage and the media plugin could overflow on Safari and FF 3. + Fixed bug where the editing and removal of abbr elements using the xhtmlxtras plugin working correctly on IE. + Fixed bug where save button in the save plugin didn't work correctly on IE. + Fixed bug where dragging layers didn't work as expected since it would snap back to it's original location if you saved. + Fixed bug where the description of the template plugin dialog wasn't updated correctly. + Fixed bug where the values for frame and rules in the table dialogs where swapped. + Fixed bug where the elements like ins, del, cite, acronym and abbr didn't have the default editing style as the old 2.x branch. + Fixed bug where ask mode would lock the focused textarea if you pressed cancel in the confirm dialog on FF 3. + Fixed bug where ask mode would produce contents for empty textareas if you reloaded the page. + Fixed so the onGetContent event gets the full pass through object just like the other events. + Fixed so attributes for block elements remains the same when you change format of a element. +Version 3.0.8 (2008-04-30) + Fixed bug where IE would produce an error if textareas without names where converted. + Fixed bug where editor wasn't forced empty when there was only a single br or empty paragraph left. + Fixed bug where IE would produce an warning message if object elements where produced in the media plugins preview running on https. + Fixed bug where new addVer function didn't handle hash items correctly. Patch contributed by Mirek Burkon. + Fixed bug where font_size_style_values option wasn't applied correctly to fonts inside the editor. + Fixed bug where image selection could be lost if a image was edited using context menu on IE. + Fixed bug where style values wasn't updated properly due to an invalid regexp. + Fixed bug where IE 6 where displaying warning message about insecure items when inserting an image while using https. Patch contributed by Norifumi Sunaoka. + Fixed bug where IE was producing an auto save message if you selected a color from the color split button. + Fixed bug where backspace sometimes would move the caret to the end of the previous block in Gecko. + Fixed bug where the rowlayout manager didn't work as described in the documentation. + Fixed bug where the default options for the fullpage plugin wasn't applied correctly. + Fixed bug where selection would jump one character if you applied a styles to a words in non IE browsers. + Fixed bug where undo levels wasn't added correctly if you went back in undo history and added a new event. + Fixed bug where font size dropdown didn't mark the selected size in IE. + Fixed bug where the size of the editor was determined using clientWidth instead of offsetWidth. + Fixed so the onchange event doesn't fire on the initial undo level, it will also fire when the editor is blurred. + Fixed so the advhr plugin produces XHTML valid output instead of non standard attributes. + Fixed so blockquote gets converted into [quote] in when the bbcode plugin is enabled. + Fixed so theme_advanced_font_sizes can be named for example Font 1=1, Font 2=2 etc. + Fixed so editor_selector/editor_deselector can be regexps. By default only strings are allowed not part regexps like before. + Fixed so that the version suffix is optional. It still requires the build process so you need to export it manually. + Fixed so it's possible to tab to table cells in non Gecko browsers and also produce new rows if you tab at the end of a table. Contributed by Josh Peek. +Version 3.0.7 (2008-04-14) + Added new version suffix to all internal GET requests to make sure that the users cache gets cleared correctly. + Fixed issue with isDirty returning true event if it wasn't dirty on IE due to changes in tables during initialization. + Fixed memory leak in IE where if a page was unloaded before all images on the page was loaded it would leak. + Fixed bug in IE where underline and strikethrough could produce an exception error message. + Fixed bug where inserting paragraphs in totally empty table cells would produce odd effects. + Fixed bug where layer style data wasn't updated correctly due to some performance enhancements with the DOM serializer. + Fixed bug where it would convert the wrong element if there was two elements with the same name and id on the page. + Fixed bug where it was possible to add style information to the body element using the style plugin. + Fixed bug where Gecko would add an extra undo level some times due to the blur event. + Fixed bug where the underline icon would get active if the caret was inside a link element. + Fixed bug where merging th cells not working correctly. Patch contributed by AndrŽ R. + Fixed bug where forecolorpicker and backcolorpicker buttons where rendered incorrectly when the o2k7 skin was used. + Fixed bug where comment couldn't contain -- since it's invalid markup. It will now at least not break on those invalid comments. + Fixed bug where apos wasn't handled correctly in IE. It will now convert apos to ' on IE since that browser doesn't support that entity. + Fixed bug where entities wasn't encoded correctly inside pre elements since they where protected from whitespace removal. + Fixed bug where color split buttons where rendered incorrectly on IE6 when using the non default theme. + Fixed so caret is placed after links ones they are created, to improve usability of the editor. + Fixed so you can select tables by clicking on it's borders in non IE browsers to normalize the behavior. + Fixed so the menus can be toggled by clicking once more on the icon in listboxes, menubuttons and splitbuttons based on code contributed by Josh Peek. + Fixed so buttons can be labeled, currently only works with the default skin, so it's kind of experimental. Patch contributed by Daniel Insley. + Fixed so forecolorpicker and backcolorpicker remembers the last selected color. Patch contributed by Shane Tomlinson. + Fixed so that you can only execute the mceAddEditor command once for the same instance name. + Fixed so command functions added with addCommand can pass though the call to default handles if it returns true. +Version 3.0.6.2 (2008-04-07) + Fixed bug where empty tables couldn't be edited correctly on non IE browsers if they where loaded into the editor. + Fixed bug where it was impossible to resize layers correctly in IE since it thought it was an image. + Fixed bug where an editor instance was stealing focus in IE resulting in a scroll to the editor on page reloads. + Fixed bug where Safari was crashing on Mac OS X if you closed dialogs using the Esc key. +Version 3.0.6.1 (2008-04-04) + Added support for the missing mceAddFrameControl command. The input for this command has changed so consult the Wiki. + Fixed bug where sub menus for the drop menus would leave an empty element behind. + Fixed memory leak in IE if the editor was placed in a frame or iframe. +Version 3.0.6 (2008-04-03) + Added elements to the default value of valid_elements option. It now contains all XHTML strict elements and a few transitional. + Added more accessibility fixes, it's now possible to navigate and close list boxes and split button menus with the keyboard. + Added missing getInfo method to the contextmenu and safari plugin, this caused problems for the Drupal module. + Added new inlinepopups_zindex option to the inlinepopups plugin so that you can configure the default start z-index. + Added new setControlType method to the tinymce.ControlManager class. This method enables you to override the default classes. + Added ability to specific an optional control class to use instead of the default one for the ControlManager methods. Based on concept by Josh Peek. + Fixed bug where attribute rules for the DOM Serializer couldn't contain - or _ characters in their names. + Fixed bug where inlinepopups event blocker and modal dialog blocker elements produced vertical scrollbars. + Fixed bug where there was a rendering issue with quirks mode in Safari moving the resize handle to an incorrect position. + Fixed bug with forecolor/backcolor controls on IE. Sometimes elements positioned relative will generate display errors. + Fixed bug where a p2 was leaking out in the global name space when you selected a color from the forecolor/backcolor controls. + Fixed bug where empty paragraphs didn't work as expected in browsers other than IE. + Fixed bug where the load method of the tinymce.dom.ScriptLoader didn't check if the file was already loaded. + Fixed bug where the load method for the PluginManager and ThemeManager didn't check if a plugin/theme by a specific name was all ready loaded. + Fixed bug where the theme_advanced_link_targets option didn't work correctly with the advanced themes link dialog. Patch contributed by Arnold B. + Fixed bug where the style command would merge classes into empty span elements. + Fixed bug where the style command would remove empty span elements outside the current selection. + Fixed bug where the fix for the Safari backspace bug removed all editor contents if it was filled with empty paragraphs. + Fixed bug where alert and confirm boxes opened by the inlinepopups plugin would produce an exception if domain relaxing was used. + Fixed bug where Safari was adding style attributes to all elements when you paste them into the editor. + Fixed bug where the spellchecker menus was visually incorrect since the space for the non existing icon was still there. + Fixed bug where remove_linebreaks option didn't remove line breaks inside the text contents of a element. + Fixed bug where Safari 3.1 was introducing _mc_tmp into paragraphs due to the new querySelectorAll and a TinyMCE specific workaround. + Fixed bug where getParam method in the Editor class was returning incorrect objects and would mess up the font drop down. Patch contributed by speednet. + Fixed bug where the table dialog would produce an exception in IE when you edited tables since it tried to place focus in a disabled field. + Fixed bug where class attribute on some span elements was removed on cleanup. + Fixed bug where resizing the editor in IE could produce an exception if the editor width/height got to be a negative value. + Fixed bug where wmv files wouldn't play since the src param was used instead of the url param. + Fixed bug where br elements would be added here and there in Gecko. Geckos internal _moz_dirty br elements where serialized as well. + Fixed bug where editing named anchors would produce two anchors instead of one updated one. + Fixed bug where arrow and function keys didn't work when an noneditable element was focused within the editor. + Fixed bug where the dispatcher could produce an exception if the listener list was altered inside an event callback. + Fixed bug where it was impossible to totally empty the editor contents on Safari due to an mistreatment of nbsp as whitespace. Patch contributed by Andrew Ozz. + Fixed bug where TinyMCE would not convert textareas with the same name attribute value. It will now generate an unique id for those textareas. + Fixed bug where backspace/delete key was deleting td elements inside tables while running on Gecko. + Fixed bug where Firefox 3.0b4 and Opera 9.26 where scrolling to the top of document when pressing return/enter. + Fixed bug where the template plugin wasn't just inserting the mceTmpl tagged element. + Fixed bug where the alert method of the default WindowManager implementation didn't translate input language strings like the inlinepopups dialog does. + Fixed bugs with the backspace behavior in Gecko. The caret was placed on incorrect locations in the DOM sometimes. + Fixed so advimage dialog and table dialogs has support for editable select boxes for the class value. + Fixed so the media, pagebreak and spellchecker doesn't load it's default content.css file if the content_css option is set to false. + Fixed so the paste_use_dialog option works again it's enabled by default but can be disabled on IE. Patch contributed by Speednet. + Fixed so that the fullscreen editor is focused when switching fullscreen editing on. + Fixed so it's possible to edit images and links inside tables using the context menu. + Fixed so table dialogs and the advanced image dialog doesn't loose selection in IE if the dialogs where navigated/submitted with the keyboard. + Fixed so the theme_advanced_blockformats options can have named items for example title 1=h1;title 2=h2. + Fixed so it's possible to add a custom editor_css for the simple theme. + Fixed quirks with directionality rtl, patch contributed by Andrew Ozz. + Fixed so the inlinepopups default start zIndex is 300000. + Fixed typo in media plugin Shockware is now replaced with Shockwave. + Fixed psuedo memory leak in IE with the replaceChild method inside the DOMUtils.replace method. + Fixed so memory is released when an editor instance is removed from page. + Optimized the color split button menus so that they use less event handlers. + Removed the util/mclayer.js file since it's no longer used by any of the TinyMCE dialogs and is considered deprecated. +Version 3.0.5 (2008-03-12) + Added new black skin variant to the o2k7 skin contributed by Stefan Moonen. + Added new explode method to the tinymce core class. This does a split but removed whitespace it also defaults to a , delimiter. + Added new detection logic for IE 8 standards mode into the DOMUtils class strMode can now be checked to see if that mode is on/off. + Added new noscale option value for the scale select box for Flash in the media plugin. + Fixed bug where the menu for the ColorSplitButton wasn't removed when the editor was removed. + Fixed bug where font colors couldn't be edited correctly since the style of the element didn't get updated correctly. + Fixed bug where class of elements would get lost when TinyMCE was fixing incorrect HTML markup. + Fixed bug where table editing would produce double height values. + Fixed bug where width style value wouldn't be removed if you switched width unit from cm/em to pixels or percent. + Fixed bug where the search/replace input box wasn't auto focused like the other dialogs. + Fixed bug where the old mceAddControl command would use the fullscreen settings next time it created an instance. + Fixed bug where multiple lines where added to the target cell if you merged multiple empty cells. + Fixed bug where drop down menus would be incorrectly positioned inside scrollable divs. + Fixed bug where the separators of the silver skin variant didn't display correctly in IE 6. + Fixed bug where createStyleSheet seems to load scripts at opposite order in some IE versions. + Fixed bug where directionality could produce odd results for the UI and the dialogs. + Fixed bug where the DOM serializer wouldn't serialize custom namespaced attributes in IE 6 using the *[*] valid elements rule. + Fixed bug where table caption would be inserted after the thead element if you swapped a tr to be inside the thead. + Fixed bug where the youtube detection logic for the media plugin was to generic. + Fixed so the deprecated and undocumented theme_advanced_path_location set to none won't hide the whole statusbar. + Fixed so most input lists can have whitespace in them they are now split using the new tinymce.explode method. + Fixed so the popup_css and popup_css_add URLs are relative to where the current document is located. + Fixed various bugs and quirks with the store/restore selection logic. + Fixed so the editor starts in IE 8 standards mode but still that browser is very very buggy. + Fixed so dialog_type set to modal will block the background and other inline windows and only give access to the front most window. +Version 3.0.4.1 (2008-03-08) + Fixed critical bug where it was impossible to edit images when inlinepopups where used due to lost selection in IE. +Version 3.0.4 (2008-03-07) + Added new option constrain_menus, this enables you to force view port constraints on all menus. Contributed by Shane Tomlinson. + Fixed bug where table background wasn't visible inside the editor due to a default CSS rule overriding the style attribute. + Fixed bug where links would get a null class added if no styles was used in IE. + Fixed bug where spellchecker was auto focusing the editor in IE. + Fixed bug where document.domain would produce invalid argument if the editor was loaded in IE6 over a network UNC path. + Fixed bug where table height attribute was used, this is deprecated in XHTML so it now adds it as an style. + Fixed bug where textareas with style values would produce error in IE. + Fixed so the first element in each dialog is focused by default to enhance keyboard usage. + Fixed so you can add a mceFocus class to elements to make it auto focused. + Fixed so you can close dialogs using the esc key. + Fixed so you can press return/enter to submit the action of each dialog. + Fixed so tabbing inside an inline popups wont focus the resize anchor elements. + Fixed so you can press ok in inline alert messages using the return/enter key. + Fixed so textareas can be set to non px or % sizes for example em, cm, pt etc. + Fixed so non pixel values can be used in width/height properties for tables. + Fixed so the custom context menu can be disabled by holding down ctrl key while clicking. + Fixed so the layout for the o2k7 skin looks better if you don't have separators before and after list boxes. + Fixed so the sub classes get a copy of the super class constructor function to ease up type checking. + Fixed so font sizes for the format block previews are normalized according to http://www.w3.org/TR/CSS21/sample.html (it can be overridden). + Fixed so font sizes for h1-h6 in the default content.css is normalized according to http://www.w3.org/TR/CSS21/sample.html (it can be overridden). +Version 3.0.3 (2008-03-03) + Fixed bug where an error about document.domain would be thrown if TinyMCE was loaded using a different port. + Fixed bug where mode exact would convert textareas without id or name if the elements option was omitted. + Fixed bug where the caret could be placed at an incorrect location when backspace was used in Gecko. + Fixed bug where local file:// URLs where converted into absolute domain URLs. + Fixed bug where an error was produced if a editor was removed inside an editor command. + Fixed bug where force_p_newlines didn't effect the paste plugin correctly. + Fixed bug where the paste plugin was producing an exception on IE if you pasted contents with middots. + Fixed bug where delete key could produce exceptions in Gecko sometimes due to the fix for the table cell bug. + Fixed bug where the layer plugin would produce an visual add class called mceVisualAid this one is now renamed to mceItemVisualAid to mark it internal. + Fixed bug where TinyMCE wouldn't initialize properly if ActiveX controls was disabled in IE. + Fixed bug where tables and other elements that had visual aids on them would produce an extra space after any custom class names. + Fixed bug where search with an empty string would produce some odd "invalid pointer" error in IE. + Fixed bug where elements like menus where placed at incorrect positions in Opera 9.26. + Fixed bug where IE was loosing focus of the editor when you clicked some dropmenu and if it was placed in a frame or iframe. + Fixed bug where focus of images could be lost in IE if you focused the accessibility confirm dialog in the advimage plugin. + Fixed bug where nestled font elements would produce odd output like missing font elements. + Fixed bug where text colors and styles got removed if invalid_elements included the font element. + Fixed bug where text-decoration set to underline or line-through would remove other styles from span elements. + Fixed bug where editor contents like \n\n would be incorrectly handled and processed as real line feeds. + Fixed bug where incorrectly encoded urls with ampersands in them would be decoded incorrectly. + Optimized the DOMUtils decode method to be a lot faster if the string doesn't have any entities to decode. +Version 3.0.2.1 (2008-02-26) + Fixed alert/confirm dialogs so they display correctly. +Version 3.0.2 (2008-02-26) + Added new body_id option that enables you to specify the id of the body inside the editor iframe based on ideas by David Bildstršm (ChronoZ). + Added new body_class option that enables you to set the class for the body of the editor iframe based on ideas by David Bildstršm (ChronoZ). + Added new CSS class to the default content.css files mceForceColors that forces white background and black text can be used with the body_class option. + Added new type parameter to the Editor.getParam function to reduce redundant logic for parsing hash tables. + Added new isDone method to the ScriptLoaded class, this enables you to check if a script has been loaded or not. + Added new resizeTo and resizeBy methods for the advanced theme. Can be called using tinyMCE.activeEditor.theme.resizeTo(w, h); + Added new skin_variant option this can be used to extend existing skins with slight modifications like color. + Added new variant of the o2k7 skin called "silver" based on a contribution made by Stefan Moonen. + Fixed bug where the template plugin might produce errors if the template_mdate_classes wasn't configured. + Fixed bug where the media plugin didn't convert the URLs for movies once they where inserted. + Fixed bug where the style field for the advlink dialog didn't work correctly if you edited an existing link. + Fixed bug where alignment of toolbars would fail in editor was uses in a quirks mode on IE, fix contributed by Peter Wood & Art Lawry. + Fixed bug where initialization of multiple editors at the same time using the mceAddControl method would produce errors. + Fixed bug where initialization of editors using mceAddControl command or new tinymce.Editor calls would fail during page load. + Fixed bug where the check for domain relaxing could fail if the document.domain property was changed by another script. + Fixed bug where textareas couldn't be named description or any other name that matches the meta elements in IE and Opera. + Fixed bug where the element path would fail sometimes in IE due to "unknown runtime error" on innerHTML. + Fixed bug where Safari would crash if you was hiding the editor before serializing the contents. + Fixed bug where the editor wasn't scaled propertly in fullscreen mode using the old fullscreen_new_window option. + Fixed bug where render method didn't load language packs in IE and Opera if you rendered an editor during page load. + Fixed bug where resizing the browser window in fullscreen didn't resize the editor. + Fixed bug where the blockquote command didn't move the caret inside the new empty blockquote if you used it on an empty document. + Fixed bug where auto in a style width/height for the textarea would produce an editor with the size value of 100. Fix contributed by Shane Tomlinson. + Fixed bug where restoration of selection at the beginning of an element could fail in Gecko. + Fixed bug where caret restoration after a cleanup could place the it at an incorrect location. + Fixed bug where delete key inside td elements would delete the cell in Gecko. + Fixed so the blockquote button toggles individual lines. This behavior is a bit more like the old indentation behavior in the 2.x branch. + Fixed so the dialog language packs only gets loaded the first time you open a dialog. + Fixed so all classes in the whole UI is prefixed with "mce" to avoid collisions, use the skin converter to update your existing skins. + Fixed so all classes in the inlinepopups logic is prefixed with "mce" to avoid collisions, use the skin converter to update your existing skins. + Fixed so that the window in fullscreen mode can be resized when fullscreen_new_window option is enabled. + Fixed so blockquote elements are formatted in the source output with an linefeed before and after it. + Optimized the editor initialization by reducing the number of calls to getBookmark/moveToBookmark. +Version 3.0.1 (2008-02-21) + Added spellchecker plugin into the main package, but without any backend can be specified with the spellchecker_rpc_url option. + Added src attribute for script elements to the default valid_elements option value. + Added extra parameter to the class_filter callback it can now also filter out classes based on the whole CSS rule. + Added support for domain relaxing, TinyMCE can now be loaded from an remote domain as long as they are on the same root domain. + Added support for custom elements the new custom_elements option enables you to add non HTML elements to the editor. + Added support for the W3C Selectors API that was added to latest nightly build of WebKit. + Fixed bug where some object param element wasn't stored correctly using the media plugin. + Fixed bug where Opera was scrolling to top of page is drop menus on list boxes where displayed. + Fixed bug where IE6 was crashing if a format block was used on a container with anchor elements. + Fixed bug where spans with font sizes wasn't handled correctly when editor was loading contents. + Fixed bug where mode exact couldn't convert editors with name only. Id is no longer required but recommended. + Fixed bug where the mceInsertRawHTML command produced an extra undo level. + Fixed bug where the specific_textareas mode didn't work correctly this is the same thing as textareas now. + Fixed bug where the values of input elements in the HTML page of dialogs pages where changed in IE. + Fixed bug where fullscreen and fullpage plugins didn't work well together. + Fixed bug where embed elements wasn't handled properly in the media plugin. + Fixed bug where style information on span elements gets munged when fonts are converted to spans. + Fixed bug where some entities in element attributes where encoded incorrectly in the latest WebKit build. + Fixed bug where initialization would fail in IE if there where two input elements with the name submit in the form. + Fixed bug where fullscreen mode didn't work correctly in IE when the fullscreen_new_window option was used. + Fixed bug where invalid contents like an ul inside a p element would produce odd results in IE. + Fixed bug where Opera 9.2x was placing the drop menus at incorrect locations if the editor was placed in a table. + Fixed bug where Opera was producing odd results if enter/return was pressed while having forced_root_blocks disabled. + Fixed bug where layer plugin was stealing focus in IE on initialization. + Fixed bug where body attributes wasn't set properly in the fullpage plugin, fix contributed by Hiroaki Kawai. + Fixed bug where insert image and insert link dialogs where producing an extra level in the undo history. + Fixed bug where Gecko would produce an error if empty elements like
    where inserted using mceInsertContent. + Fixed bug where center alignment of images produced odd results inside table cells. + Fixed bug where center alignment of images couldn't be toggled correctly. + Fixed bug where alignment of images inside tables would produce double float style items in IE if the fix_table_elements option was enabled. + Fixed bug where a variable called 'v' was polluting the global namespace. Objects tinymce and tinyMCE are the only ones allowed to be global. + Fixed bug where insert table from context menu couldn't insert new tables inside existing tables. + Fixed bug where Safari wouldn't produce br elements on enter when the force_br_newlines option was enabled. + Fixed bug where switching cell type in table cell dialog would produce odd attributes in IE. + Fixed bug where Gecko was outputting internal attributes if valid_elements where set to "*[*]". + Fixed bug where the style plugin would produce non hex colors inside the dialog when running on Gecko. + Fixed bug where an empty src value for insert image would remove the currently selected image if it wasn't and image element. + Fixed bug where hidden input elements would break the logic for the tab_focus option. + Fixed bug where save button wasn't working correctly in fullscreen mode. + Fixed bug where the editor was forced to be placed in a form element if the save_onsavecallback option was used. + Fixed bug where upper case param attributes wasn't parsed correctly in the media plugin. + Fixed bug where render method of tinymce.Editor class would produce an exception if the strict_loading_mode option was omitted. + Fixed bug where nodeChanged event could be fired while the editor was loading and there for produce an exception in FF. + Fixed bug where no undo levels where added if the user created new table rows using the tab key on Gecko. + Fixed bug where tables would be broken if you selected a different block format for contents withing an table cell. + Fixed bug where the render method of the tinymce.Editor class didn't setup the tinymce.EditorManager.settings object correctly. + Fixed bug where the advanced image dialog would go to the first tab if the alternative image was changed using the file browser link. + Fixed bug where the forced_root_block option would produce BR elements inside empty blocks if the block wasn't a paragraph. + Fixed bug where the forced_root_block doesn't work correctly on IE if the specified element was something else than paragraphs. + Fixed bug where selection of images would get lost if user selected something from the context menu in IE. + Fixed bug where the context menu plugin would pollute the global namespace with two variables p1 and p2. + Fixed compatibility issue with Mootools, it is destroying document.getElementById on unload in IE. (Mantra: You don't own the internal objects). + Fixed bugs where dialogs/tabs and other UI elements where rendered incorrectly in Firefox 3. + Fixed so the auto CSS class importer is compatible with 2.x. + Fixed so the editor UI and inlinedialogs works correctly with the YUI CSS reset package. + Fixed so header and footer elements are forced to lower case when the fullpage plugin is used. + Fixed so load prefixes "-" for plugins and themes isn't required if the plugin/theme was loaded by the ThemeManager/PluginManager. + Fixed so the JSONRequest uses application/json content type to make Ruby on rails happy. + Fixed so the CSS rule is more exact for the body in the default content.css files. Body is now defined as "body.mceContentBody" instead of just "body". + Fixed so the tiny_mce_dev.js uses XHR instead of document.write to load scripts to resolve an issue with Opera 9.50. + Fixed so language pack loading can be disabled by setting the language option to false. Can be useful for systems with their own language pack management. +Version 3.0 (2008-01-30) + Added map and area elements to the default valid_elements list and also some indentation rules. + Fixed bug where empty paragraphs wasn't padded when loading contents. + Fixed bug where the RowLayout manager didn't work at all. + Fixed bug where style attribute data would get messed up in advimage dialog. + Fixed bug where the table dialogs class select wasn't updated correctly. + Fixed bug where elements would get extra whitespace around on insert when body was present in valid_elements. + Fixed bug where coords attribute of the area element wasn't handled properly in IE. + Fixed bug where Safari didn't produce BR elements on shift+return. + Fixed bug where force blocks would cast odd invalid attribute exception in IE. + Fixed bug where media plugin would produce extra whitespace before and after objects. + Fixed bug where cleanup_callback could break the contents of the editor. But use the new event system instead of this option. + Fixed bug where the tab_focus option didn't work between editor instanced. You can now tab between editors. + Fixed bug where the load function of the ScriptLoader class didn't load single files without the load que as it was supposed to. + Fixed bug where the execcommand_callback parameter order was incorrect. Recommendation use the new addCommand method. + Fixed bug where range.select calls sometimes failed on some IE versions. + Fixed bug where Safari was scrolling to top of document when enter/returned was pressed. + Fixed bug where fullscreen_new_window option didn't work correctly. + Fixed bug where the nonbreaking plugin inserted an space instead of an non breaking space the first time. + Fixed bug where the visualization of non breaking spaces where visual in element path. + Fixed so the focus is restored to the editor after inserting an custom character. + Fixed so the isNotDirty state is set to false if a new undo level is added. + Fixed so pointless style information for borders gets removed in IE. + Fixed so the resize button has a se-resize cursor css value. +Version 3.0rc2 (2008-01-18) + Added new fix_nesting option to fix bug #1867292, this is disabled by default. + Added new indentation option enables you to specify how much each indent/outdent call will add/remove. + Added easier support for enabling/disabling icon columns on drop menues. + Added new menu button control class. This control is very similar to the splitbutton but without any onclick action. + Added support for previous tab focus (shift+tab). The tab_focus setting now takes two items next and previous element. + Fixed bug where iframes inside the editor got removed in Firefox on initial load. + Fixed bug where the CSS for abbr elements wasn't applied correctly in IE. + Fixed bug where mceAddControl on element inside a hidden container produced errors. + Fixed bug where closed anchors like produced strange results. + Fixed bug where caret would jump to the top of the editor if enter was pressed a the end of a list. + Fixed bug where remove editor failed if the editor wasn't properly initialized. + Fixed bug where render call on for a non existing element produced exception. + Fixed bug where parent window was hidden when the color picker was used in a non inlinepopups setup. + Fixed bug where onchange event wasn't fired correctly on IE when color picker was used in dialogs. + Fixed bug where save plugin could not save contents if the converted element wasn't an textarea. + Fixed bug where events might be fired even after an editor instance was removed such as blur events. + Fixed bug where an exception about undefined undo levels could be throwed sometimes. + Fixed bug where the plugin_preview_pageurl option didn't work. + Fixed bug where adding/removing an editor instance very fast could produce problems. + Fixed bug where the link button was highlighted when an anchor element was selected. + Fixed bug where the selected contents where removed if a new anchor element was added. + Fixed bug where splitbuttons where rendered one pixel down in the default theme. + Fixed bug where some buttons where placed at incorrect positions in the o2k7 theme. + Fixed bug that made it impossible to visually disable a custom button that used an image instead of CSS sprites. + Fixed bug where it wasn't possible to press delete/backspace if the editor was added+removed and re-added due to a FF bug. + Fixed bug where an entities option with only 38,amp,60,lt,62,gt would fail in IE. + Fixed bug where innerHTML sometimes generated unknown runtime error on IE. + Fixed bug where content_css files wasn't loaded in the template preview iframe. + Fixed bug where scroll position was incorrect when toggling fullscreen mode. + Fixed bug where restoration of overflow didn't work correctly when disabling fullscreen mode in Opera. + Fixed bug where drop menus where places at incorrect locations if the editor was placed in a scrollable container element. + Fixed bug where hideMenu didn't hide sub menus correctly. It will now hide all menus recursively. + Fixed so theme_advanced_path_location can be used in init options for compatibility reasons. + Fixed so the drop menu colors matches the rest of o2k7 theme. + Fixed so the preview example.html file is updated to the new 3.x API. + Fixed so the margins are the same by default inside the editable area between IE and other browsers. + Fixed so editor contents gets stored before it the onSubmit event is fired. +Version 3.0rc1 (2008-01-08) + Added new classes for toolbar rows in advanced theme mceToolbarRow1..n enabled you to change appearance of individual rows. + Added auto detection for the strict_loading_mode option when running in application/xhtml+xml mode on Gecko. + Optimized the HTML serializer by bundling some post process methods together. + Fixed so that the toolbars have unique IDs, enables you to alter the toolbars using the ControlManager and the DOM. + Fixed bug where delta values for dialog sizes in language packs didn't work correctly due to missing string to number casting. + Fixed bug where paragraph generation logic didn't handle hr or table elements correctly if they where the only element. + Fixed bug where some elements got extra linebreaks added after or before it in HTML output. + Fixed bug where it was hard to modify existing style data on table rows and table cells. + Fixed bug where the dom.getRect method didn't handle non pixel values correctly. + Fixed bug where strikethrough and underline couldn't be toggled on existing span elements. + Fixed bug where the postprocessor searched for nsbp instead of nbsp entities. + Fixed bug where it was impossible to edit links that had child elements within them. + Fixed bug where it was possible to click on the parent item of a submenu. + Fixed bug where mouseover/mouseout images couldn't be removed in advimage dialog. + Fixed bug where drop menus didn't work when running in application/xhtml+xml mode. + Fixed bug where Opera added doctype to output in application/xhtml+xml mode. + Fixed bug where some DOM methods didn't work correctly in the application/xhtml+xml mode. + Fixed bug where the inlinepopups didn't work correctly in the application/xhtml+xml mode. + Fixed bug where the ColorSplitButton didn't display correctly in the application/xhtml+xml mode. + Fixed bug where the UI layout was incorrect on Gecko browsers when running in application/xhtml+xml mode. + Fixed bug where the word paste plugin produced exception while running in application/xhtml+xml mode. + Fixed bug where there wasn't any hidden input element generated for divs while running in application/xhtml+xml mode. + Fixed bug where indentation of script/style/pre elements where incorrect. + Fixed bug where script element contents was removed in IE. + Fixed bug where script element contents got entity encoded. + Fixed bug where you couldn't edit existing element styles using the styles plugin. + Fixed bug where styles wasn't updated properly sometimes due to an performance enhancement. + Fixed bug where font sizes couldn't be changed using the style plugin. + Fixed bug where an error was produced in Gecko browsers when switching back from fullscreen mode. + Fixed bug where Opera was producing br elements after elements like h3. + Fixed bug where TinyMCE couldn't be loaded on a page using - characters in it's URL. + Fixed bug where the editor container element was forced to have a specific name. + Fixed bug with force_br_newlines option on Firefox, even though it should never be used (Read FAQ). + Fixed bug where onclick event had an return true; prefix added when creating an popup. + Fixed bug where the theme_advanced_statusbar_location option couldn't handle the value "none". + Fixed issue with URLs with multiple at characters for example an Zope URI. + Fixed so simple and advanced themes doesn't collide. + Fixed so a elements gets removed when the href field is left empty, the href attribute is required in a link after all. + Fixed so img elements gets removed when the src field is left empty, the src attribute is required for all images after all. + Removed the indent and encode methods from the tinymce.dom.Serializer class due to performance enhancement and reduction of the API size. +Version 3.0b3 (2007-12-14) + Added new getElement method to Editor class, returns the element that was replaced with the editor instance. + Added new unavailable prefix for disabled controls for accessibility reasons. + Fixed bug where regexp patterns couldn't be used for the editor_selector/editor_deselector options. + Fixed bug where the DOM wasn't properly initialized before the onInit event was executed in popups. + Fixed bug where font sizes where reduced by font size actions on previous spans in Safari. + Fixed bug where HR elements got places at the wrong location in IE. + Fixed bug where align/justify didn't work correctly on multiple paragraphs. + Fixed bug with missing translation for cell scope settings. + Fixed bug where selection/caret position was lost on some table actions. + Fixed bug where editor instances couldn't be added to hidden div elements. + Fixed bug where list elements in Safari would get an odd ID attribute. + Fixed bug where IE would return when the editor was completely empty. + Fixed bug where accessibility title attribute for access keys wasn't setup properly. + Fixed bug where forecolorpicker and backcolorpicker control names wasn't working. + Fixed bug where inserting template content didn't work in Safari due to selection exception. + Fixed bug where absolute URLs to remote hosts couldn't be used for background images. + Fixed bug where mysterious span elements where produced in Safari when injecting HTML contents. + Fixed bug where the media plugin didn't work correctly on the latest Opera 9.24. + Fixed bug where indentation of HTML output wasn't applied to all block elements. + Fixed bug where Safari was production DOM exception if you pressed enter in an empty editor. + Fixed bug where media plugin didn't parse script tags correctly patch contributed by Mathieu Campagna. + Fixed bug where the drop menus of list boxes like blockformat could produce scrolling of the page. + Fixed bug where the drop menus where placed at an incorrect location if TinyMCE was placed in a scrollable div. + Fixed bug where submit buttons couldn't be named submit, it's not recommended to name submit buttons submit anyway. + Fixed bug where the stylelistbox produced an exception if there was only one class in the list box. + Fixed bug where the stylelistbox wasn't updated correctly when the current class was removed. + Fixed bug where the formatblock command sometimes removed the body element. + Fixed bug where fullscreen switching in IE sometimes produced an exception when the spellchecker plugin was enabled. + Fixed issue where FF produced an empty paragraph when the editor was completely empty. + Fixed issue with size of image dialog in the advanced theme. + Fixed issues with the bbcode plugin it now also handles spans and the [font] rule. + Fixed so the style compression feature is a bit smarter to resolve issues with Opera. + Reintroduced the remove_linebreaks option, this is enabled by default. +Version 3.0b2 (2007-11-29) + Added type and compact attributes to the default valid_elements list for the ul and ol elements. + Added missing accessibility support to native list boxes in both the toolbar and dialogs. + Added missing access key for the element path for accessibility reasons. + Fixed support for loading themes from external URLs. + Fixed bug where setOuterHTML didn't work correctly when multiple elements where passed to it. + Fixed bug with visualchars plugin was moving elements around in the DOM. + Fixed bug with DIV elements that got converted into editors on IE. + Fixed bug with paste plugin using the old event API. + Fixed bug where the spellchecker was removing the word when it was ignored. + Fixed bug where fullscreen wasn't working properly. + Fixed bug where the base href element and attribute was ignored. + Fixed bug where redo function didn't work in IE. + Fixed bug where content_css didn't work as previous 2.x branch. + Fixed bug where preview dialog was throwing errors if the content_css wasn't defined. + Fixed bug where the theme_advanced_path option didn't work like the 2.x branch. + Fixed bug where the theme_advanced_statusbar_location was called theme_advanced_status_location. + Fixed bug where the strict_loading_mode option didn't work if you created editors dynamically without using the EditorManager. + Fixed bug where some language values wasn't translated such as insert and update in dialogs. + Fixed bug where some image attributes wasn't stored correctly when inserting an image. + Fixed bug where fullscreen mode didn't restore scrollbars when disabled. + Fixed bug where there was no visual representation for tab focus in toolbars on IE. + Fixed bug where HR elements wasn't treated as block elements so forced_root_block would fail on these. + Fixed bug where autosave presented warning message even when the form was submitted normally. + Fixed typo of openBrower it's now openBrowser in form_utils.js. + Fixed various HTML problems like missing TD elements and duplicated doctypes. + Fixed default values for theme_advanced_resize_horizontal, theme_advanced_resizing_use_cookie to be 2.x compatible. + Moved spellchecker JS files into the development package. + Removed support for theme_advanced_path_location since the theme_advanced_statusbar_location is the correct option name. +Version 3.0b1 (2007-11-21) + Added new tab_focus option, that enables you to specify a element id or that the next element to be focused on tab key down. + Added new addQueryValueHandler method to the tinymce.Editor class. + Added new class_filter option, this enables you to specify a function that can filter out CSS classes for the styles list box. + Added support form [url=url]title[/url] to the bbcode plugin. + Renamed the addCommandQueryState method in the tinymce.Editor class to addQueryStateHandler. + Renamed loadQue to loadQueue, to correct spelling. + Removed the createDOM method from the window manager and replace it with a createInstance method. + Removed the add to beginning of class attribute parameter of the DOMUtils.addClass method. + Fixed bug with the forced_root_block option, didn't work correctly with multiple inline elements. + Fixed bug where image dialogs replaced the current image element with a new one even when it was updated. + Fixed bug where the submit trigger wasn't executed when divs where converted into editor instances. + Fixed bug where div elements that got converted into editors didn't get a hidden input element generated for them. + Fixed bug where the the media_use_script option for the media plugin wasn't working correctly. + Fixed bug where the font size and font family listboxes wasn't updated correctly on Safari. + Fixed bug where the height of the fieldset in default image dialog for the advanced theme was to small. + Fixed bug where the font sizes behaved incorrectly after a cleanup on Safari. + Fixed bug where formatblock didn't work correctly in Safari on some elements. + Fixed bug where template plugin didn't insert content correctly unless some options where specified. + Fixed bug where charmap on Safari produced scrollbars. + Fixed bug where there was white artifacts in some dialogs due to missing background color. + Fixed bug where port was added to all external URLs if the editor was loaded from a custom port. + Fixed bug where the context menus got duplicated on Safari 3.0.4 on Mac OS X. + Fixed bug where dialogs like paste from word was huge on Firefox. + Fixed bug with media plugin not working with windows media objects. + Fixed bug where a forever loop was created if multiple instances where submitted using form.submit. + Fixed bug with editing a table produce error in IE when inlinepopups where used. + Fixed bug where the style plugin generated ugly looking style information in IE. + Fixed bug where the inline dialogs that got opened while in fullscreen mode wasn't visible. + Fixed bug where it was difficult to place the caret inside the word paste dialog. + Fixed bug where Opera produced strange border in the word paste dialog. + Fixed bug where viewport constraints could move a inlinepopup to a negative x, y position if the viewport was to small. + Fixed bug where template plugin was producing an error due to a deprecated API call. + Fixed bug where drag drop of images failed in Gecko if a document_base_url was specified. + Fixed bug where Firefox 3 failed to apply block formats like H1-H6 it still breaks on DIVs this has been reported to bugzilla. + Fixed bug where IE was producing a warning dialog about non secure items when running TinyMCE over HTTPS. + Fixed bug where the onbeforeunload event was triggered when menus or dialogs where opened. + Fixed bug where the fullscreen mode of the HTML view source box threw an error. + Fixed bug where the mceFocus command didn't work correctly. + Fixed bug where the selection could get lost in IE using inlinepopups. + Fixed so the body of the editor area has the mceContentBody class just like the 2.x branch. + Fixed so the media icon gets active when a media element is selected. +Version 3.0a3 (2007-11-13) + Added new experimental jQuery and Prototype framework adapters to the development package. + Added new translation.html file for the development package. Helps with the internationalization of TinyMCE. + Added new setup callback option, use this callback to add events to TinyMCE. This method is recommended over the old callbacks. + Added new API documetation to all classes, functions, events, properties to the Wiki with examples etc. + Added new init method to all plugins and themes, since it's shorter to write and it mimics interface capable languages better. + Fixed various CSS issues in the default skin such as alignment of split buttons and separators. + Fixed issues with mod_security. It didn't like that a content type of text/javascript was forced in a XHR. + Fixed all events so that they now pass the sender object as it's first argument. + Fixed some DOM methods so they now can take an array as input. + Fixed so addButton and the methods of the ControlManager uses less arguments and it now uses a settings object instead. + Fixed various issues with the tinymce.util.URI class. + Fixed bug in IE and Safari and the on demand gzip loading feature. + Fixed bug with moving inline windows sometimes failed in IE6. + Fixed bug where save_callback function wasn't executed at all. + Fixed bug where inlinepopups produces scrollbars if windows where moved to the corners of the browser. + Fixed bug where view HTML source failed when inserting a embedded media object. + Fixed bug where the listbox menus didn't display correctly on IE6. + Fixed bug where undo level wasn't added when editor was blurred. + Fixed bug where spellchecker wasn't disabled when fullscreen mode was enabled. + Fixed bug where Firefox could crash some times when the user switched to fullscreen mode. + Fixed bug where tinymce.ui.DropMenu didn't remove all item data when an item was removed from the menu. + Fixed bug where anchor list in advlink dialog wasn't populated correctly in Safari. + Fixed bug where it wasn't possible to edit tables in IE when inlinepopups was enabled. + Fixed bug where it wasn't possible to change the table width of an existing table. + Fixed bug where xhtmlxtras like abbr didn't work correctly on IE. + Fixed bug where IE6 had some graphics rendering issues with the inlinepopups. + Fixed bug where inlinepopup windows where moved incorrectly when they were boundary checked for min width. + Fixed bug where textareas without id or name couldn't be converted into editor instances. + Fixed bug where TinyMCE was stealing element focus on IE. + Fixed bug where the getParam method didn't handle false values correctly. + Fixed bug where inlinepopups was clipped by other TinyMCE instances or relative elements in IE. + Fixed bug where the contextmenu was clipped by other TinyMCE instances or relative elements in IE. + Fixed bug where listbox menus was clipped by other TinyMCE instances or relative elements in IE. + Fixed bug where listboxes wasn't updated correctly when the a value wasn't found by select. + Fixed various CSS issues that produced odd rendering bugs in IE. + Fixed issues with tinymce.ui.DropMenu class, it required some optional settings to be specified. + Fixed so multiple blockquotes can be removed with a easier method than before. + Optimized some of the core API to boost performance. + Removed some functions from the core API that wasn't needed. +Version 3.0a2 (2007-11-02) + Fixed critical bug where IE generaded an error on a hasAttribute call in the serialization engine. + Fixed critical bug where some dialogs didn't open in the non dev package. + Fixed bug when using the theme_advanced_styles option. Error was thrown in some dialogs. + Fixed bug where the close buttons produced an error when native windows where used. + Fixed bug in default skin so that split buttons gets activated correctly. + Fixed so plugins can be loaded from external urls outsite the plugins directory. +Version 3.0a1 (2007-11-01) + Rewrote the core and most of the plugins and themes from scratch. + Added new and improved serialization engine, faster and more powerful. + Added new internal event system, things like editor.onClick.add(func). + Added new inlinepopups plugin, the dialogs are now skinnable and uses clearlooks2 as default. + Added new contextmenu plugin, context menus can now have submenus and plugins can add items on the fly. + Added new skin support for the simple and advanced themes you can alter the whole UI using CSS. + Added new o2k7 skin for the simple and advanced themes. + Added new custom list boxes for font size/format/style etc with preview support. + Added new UI management, enabled plugins to create controls like splitbuttons or menus easier. + Added new JSON parser/serializer and JSON-RPC class to the core API. + Added new cookie utility class to the core API. + Added new Unit testing class to the core API only available in dev mode. + Added new firebug lite integration when loading the dev version of TinyMCE. + Added new Safari plugin, fixes lots compatibility of issues with Safari 3.x. + Added new URI/URL parsing it now handles the hole RFC and even some exceptions. + Added new pagebreak plugin, enables you to insert pagebreak comments like + Added new on demand loading of plugins and themes. Enables you to load and init TinyMCE at any time. + Added new throbber/progress visualization a plugin can show/hide this when it's needed. + Added new blockquote button. Enables you to wrap paragraphs in blockquotes. + Added new compat2x plugin. Will provide a TinyMCE 2.x API for older plugins. + Added new theme_advanced_resizing_min_width, theme_advanced_resizing_min_height options. + Added new theme_advanced_resizing_max_height, theme_advanced_resizing_max_height options. + Added new use_native_selects option. Enables you to toggle native listboxes on and off. + Added new docs_url option enables you to specify where the TinyMCE user documentation is located. + Added new frame and rules options for the table dialog. + Added new global rule for valid_elements/extended_valid_elements enables you to specify global attributes for all elements. + Added new deny attribute rule characher so it's possible to deny global attribute rules on specific elements. + Added new unit tests in the dev package of TinyMCE. Runs tests on the core API, commands and settings of the editor. + Readded the inline_styles option and enabled it by default so deprecated attributes are no longer used. + Removed all button images and replaced them with CSS sprite images. Reduces the number of requests needed. + Removed lots of language files and merged them into the base language files. Reduces the number of requests needed. + Removed lots of unnecessary files and merged many of them together to reduce requests and improve loading speed. + Reduced the over all script size by 33% and the number of files/requests by 75% so it loads a lot faster. + Fixed so convert_fonts_to_spans are enabled by default. So no more font tags. + Fixed so underline and strikethrough uses spans instread of deprecated U and STRIKE elements. + Fixed so indent/outdent adds/removed margin-left instead of blockquotes. + Fixed so alignment of paragraphs results in a text-align style value instead of the deprecated align attribute. + Fixed so alignment of images uses float or vertical-align style values instead of the deprecated align attribute. + Fixed so all classes from @import stylesheets gets imported into the editor. + Fixed so the directionality can toggle the dir attribute on and off. + Fixed so the fullscreen_settings can be used for all types of fullscreen modes. + Fixed so the advanced HR dialog gets displayed when inserting a HR not only on edit. + Fixed bug where word wrap didn't work in the source editor on Safari. + Fixed so non HTML elements can be used within the editor such as + Fixed various memory leaks in IE and reduced the unload cleanups needed. + Fixed so the preformatted option adds an invisible container pre tag inside the editor. + Renamed the _template plugin to example and updated it to use the new 3.x API. diff --git a/vendor/plugins/tiny_mce/README b/vendor/plugins/tiny_mce/README deleted file mode 100644 index 8d59c38ca..000000000 --- a/vendor/plugins/tiny_mce/README +++ /dev/null @@ -1,72 +0,0 @@ -TinyMCE -======= - -This plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications. TinyMCE is a WYSIWYG HTML editing component -released under the GNU Public License (GPL) by Moxiecode Systems (http://tinymce.moxiecode.com/). - - -INSTALL -======= - -Install the plugin by running - - script/plugin install git://github.com/kete/tiny_mce.git - -Then install the necessary files into your public directory by running - - rake tiny_mce:scripts:install - - -USAGE -===== - -Add something like the following to the controller of the view you want to add TinyMCE to. - - ### TinyMCE WYSIWYG editor stuff - uses_tiny_mce(:options => { :theme => 'advanced', - :mode => "textareas", - :convert_urls => false, - :content_css => "/stylesheets/base.css", - :remove_script_host => true, - :theme_advanced_toolbar_location => "top", - :theme_advanced_toolbar_align => "left", - :theme_advanced_resizing => true, - :theme_advanced_resize_horizontal => false, - :theme_advanced_buttons1 => %w{ bold italic underline strikethrough separator justifyleft justifycenter justifyright indent outdent separator bullist numlist forecolor backcolor separator link unlink image undo redo code}, - :theme_advanced_buttons2 => %w{ formatselect fontselect fontsizeselect pastetext pasteword selectall }, - :theme_advanced_buttons3_add => %w{ tablecontrols fullscreen}, - :editor_selector => 'mceEditor', - :paste_create_paragraphs => true, - :paste_create_linebreaks => true, - :paste_use_dialog => true, - :paste_auto_cleanup_on_paste => true, - :paste_convert_middot_lists => false, - :paste_unindented_list_class => "unindentedList", - :paste_convert_headers_to_strong => true, - :paste_insert_word_content_callback => "convertWord", - :plugins => %w{ contextmenu paste table fullscreen} }, - :only => [:new, :pick, :create, :edit, :update, :homepage_options]) - ### end TinyMCE WYSIWYG editor stuff - -Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name by editing the 'editor_selector' param in the controller code. - - :class => "mceEditor" - -And you're all set! - - -OPTIONS -======= - -You can change the options or add new ones based on what available in tiny_mce_options.yml - - -CREDITS -======= - -This plugin is maintained by Blake Watters -Updated by Kieran Pilkington - -Bundled TinyMCE version: 3.1.0.1 -Documentation from the TinyMCE distribution is available online at -http://tinymce.moxiecode.com/documentation.php \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/README.rdoc b/vendor/plugins/tiny_mce/README.rdoc new file mode 100644 index 000000000..8d6416222 --- /dev/null +++ b/vendor/plugins/tiny_mce/README.rdoc @@ -0,0 +1,66 @@ += TinyMCE for Rails + +This plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications. + +TinyMCE is a WYSIWYG HTML editing component released under the GNU Public License 2.1 (GPL 2.1) by Moxiecode Systems (http://tinymce.moxiecode.com/). + + +== Installation + +Installing TinyMCE for Rails takes no more than a few minutes to install. + +=== Step 1 + +Open a console, and in the root of you Rails application, install the plugin by running + + script/plugin install git://github.com/kete/tiny_mce.git + +=== Step 2 + +Then install the necessary files into your public directory by running + + rake tiny_mce:install + +or, if you are updating a previously installed version + + rake tiny_mce:update + +=== Step 3 + +Add the following to the controller of the page you want to add TinyMCE to. + + uses_tiny_mce(:options => {}, + :only => [:new, :create, :edit, :update]) + +Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name by editing the 'editor_selector' param in the controller code options. + + :class => "mceEditor" + +Lastly, add the following line(s) to the element of your application view: + + <%= include_tiny_mce_if_needed %> + +Or if you need to move things around because of javascript conflicts: + + <%= include_tiny_mce_js_if_needed -%> + <%= tiny_mce_init_if_needed -%> + +Now you're all set! + + +== Configuration + +You can change the options hash by adding new settings based on the available options in tiny_mce_options.yml + +If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing. + + += Credits + +This plugin was created by Blake Watters + +This plugin is currently maintained by Kieran Pilkington + +Bundled TinyMCE version: 3.2.0.2 +Documentation from the TinyMCE distribution is available online at +http://tinymce.moxiecode.com/documentation.php \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/TODO b/vendor/plugins/tiny_mce/TODO deleted file mode 100644 index 14eac8988..000000000 --- a/vendor/plugins/tiny_mce/TODO +++ /dev/null @@ -1,2 +0,0 @@ -- Update task for scripts that won't clobber customizations to TinyMCE via plugins, etc. -- Generator for TinyMCE Plugins \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/changelog b/vendor/plugins/tiny_mce/changelog deleted file mode 100644 index ca6aed982..000000000 --- a/vendor/plugins/tiny_mce/changelog +++ /dev/null @@ -1,1020 +0,0 @@ -Version 3.1.0.1 (2008-07-02) - Updated TinyMCE - Replaced old documentation with readme file containing link to online documentation -Version 2.0.5.1 (2005-03-22) - Fixed bug where emtpy paragraphs sometimes got removed in MSIE. - Fixed bug where autosave plugin was running even in fullscreen mode. - Fixed bug where browse and color image button urls in form_utils.js where hardcoded. -Version 2.0.5 (2005-03-21) - Added API docs for the TinyMCE_Popup class that is used by all dialogs in TinyMCE. - Added new TinyMCE_Layer class to the core of TinyMCE plugins will be using this later on. - Added new loadPlugin function, use this to load external plugins. - Added instructions on how to contribute language packs. - Added new support for multiple content_css files, based on contribution by Man-Chicken. - Added new table_cell_limit, table_row_limit, table_col_limit options, based on contribution by Man-Chicken. - Added new fix_list_elements option, if this is set to true UL/OL lists will be forced XHTML valid on cleanup. - Added new fix_table_elements, if this is set to true tables will be moved outside paragraphs. - Fixed so input and button as closed elements in the cleanup logic. - Fixed so the mceButtonSelected is more visible with darker background in the editor_ui.css. - Fixed issue where charmap.js was calling switchClass that's reserved for buttons. - Fixed issue where the directionality option wasn't used in the preview plugin. - Fixed issues with nestled bullet lists pasted from Word 2003. - Fixed bug where button wasn't selected correctly in MSIE due to a CSS issue. - Fixed bug where ask mode wasn't working on DIV elements in Firefox and Opera. - Fixed bug where the mceAddFrameControl command wasn't working correctly. - Fixed bug where language packs wasn't imported correctly in plugins loaded externaly. - Fixed bug where focusing external input elements was visible in element path under MSIE. - Fixed bug where fullscreen plugin wasn't opening the window fullscreen in Firefox. - Fixed bug where style select dropdown wasn't working in Firefox when used in fullscreen mode. - Fixed bug where the fix_content_duplication wasn't working anymore. - Fixed bug where MSIE sometimes generated empty paragraphs. - Fixed bug where MSIE sometimes generated tags like . - Fixed bug where the directionality option produced a error for the color picker dialog. - Fixed bug where configured callback options wasn't executed correctly in fullscreen mode. - Fixed bug where tags got generated as <*> some times in Gecko. - Fixed bug where the cursor was placed within a the anchor when inserting a new one in Gecko. - Fixed bug where convert_fonts_to_span option wasn't working correctly with new cleanup engine. - Fixed various language pack issues such as invalid characters. - Fixed naming conflict with zoom plugin and the format select box. - Fixed so that the initialization of the editor is slightly faster. - Removed all language packs except the english one from the core package. [BREAKS COMPATIBLITY] -Version 2.0.4 (2006-02-24) - Fixed bug where fullscreen plugin was using the tinymce_dev.js script. - Fixed bug where events where having a return true; statement infront of them. - Fixed bug where theme_advanced_toolbar_location option wasn't working. - Fixed bug where select lists wasn't working if you touched them with the tab key. - Fixed bug where auto reset design mode wasn't working correctly. - Fixed bug where null was inserted in paste button action in MSIE. - Fixed bug where _template plugin had a , instead of . character on e.type. - Fixed bug where src, href where replaced to xsrc and xhref in comments. - Fixed bug where paste_cleanup_on_paste option wasn't working correctly with the paste plugin. - Fixed bug where MSIE was reporting an error when TinyMCE was placed in a frame and not focused. - Fixed bug where clipboard_msg wasn't entity decoded corectly before displaying it in confirm box. - Fixed bug where mceRemoveControl wasn't working correctly on DIV elements. - Fixed bug where mceInsertContent/mceReplaceContent produced error when a empty string was inserted. - Fixed so the default valid_elements option is more XHTML valid. - Fixed issue where style formatting wasn't handled when pasting content from Word. - Fixed issue where ' characters wasn't entity encoded, they are now encoded into ' and not '. - Fixed issue with empty paragraphs, these are now filled with &nsbp; if they are empty. - Added documentation on how the # prefix can be used in the valid_elements option. - Added new options paste_remove_styles and paste_remove_spans to paste plugin. - Added possibility to have empty default attributes values. -Version 2.0.3 (2006-02-13) - Added missing buttons to button reference page in documentation. - Added dt,dl,dd elements to default_valid elements config value. - Added new support for self registrering plugins. - Added new callback for themes and plugins handleEvent and the handle_event_callback option. - Added new execcommand_callback option, this enables you to add custom execcommand logic on page level. - Added new custom_shortcuts option, this enables you to disable plugin/theme specific keyboard shortcuts. - Added new addShortcut to TinyMCE_Control, this enables plugin to register custom keyboard shortcuts. - Added new getButtonHTML function to TinyMCE core, this function makes it easier for plugins/themes to make buttons. - Added more documentation on how to write plugins and updated the _template plugin. - Added more documentation on how to write custom themes. - Fixed so the default window size of the source editor is larger in the advanced theme. - Fixed so all internal plugins use the new auto registration and separation logic. - Fixed so all internal themes use the new auto registration and separation logic. - Fixed so the Safari warning is switched off by default. - Fixed so cursor position isn't moved when performing a cleanup. - Fixed so cursor position is correct when performing undo/redo actions. - Fixed so all themes/plugins now use a:hover to produce the mouse over button effect. - Fixed so it uses the DOMContentLoaded and onreadystatechange instead of onload. - Fixed so the simple theme also supports the button_tile_map option. - Fixed so the selection/cursor is moved to the beginning of area on search/replace. - Fixed callback handling to reduce logic, improve performance and flexibility. - Fixed documentarion error for the paste plugin, contributed by Jochen Metzger. - Fixed bug that made the cleanup process to hang MSIE on specific content. - Fixed bug with absolute to relative URL convertion logic if the absolute URL didn't have a path. - Fixed bug where about.htm in advanced theme refered to a non existing css file. - Fixed bug with defParam and the event_elements option. - Fixed bug where fullscreen plugin wasn't correctly setup with editor contents. - Fixed bug where paste/drop converted relative URLs incorrectly in MSIE. - Fixed bug with inlinepopups not restoring selection on close window in MSIE. - Fixed bug where selection was lost when a new column/row was inserted in a table running in Gecko. - Fixed bug where save plugin wasn't working in fullscreen mode. - Fixed bug where fullscreen plugin wasn't working in Opera. - Fixed bug where editor resizing in advanced theme wasn't working in Opera. - Fixed bug where cursor position was placed at the end of instance on word paste. - Fixed bug where a tinyMCE is undefined error was reported in Firefox. - Fixed compatiblity issues with new cleanup plugin and the prototype.js library. - Renamed the mceItemEditable/mceItemNonEditable to mceEditable/mceNonEditable. - Renamed the TinyMCEControl class to TinyMCE_Control, TinyMCE_ is the valid class prefix. - Removed the getInsertLinkTemplate and getInsertImageTemplate functions from themes and from API. - Removed insertImage and insertLink from TinyMCE core, they are moved to the advanced theme. - Removed opacity workaround made for Opera Preview 1, download Opera Preview 2 instead. - Removed search backward function from replace dialog since it could result in a infinite loop. - Marked insertlink_callback, insertimage_callback options as deprecated these can be replaced with execcommand_callback. - Moved selection specific methods to a new class. For example inst.selectNode is now inst.selection.selectNode. - Updated German language pack, contributed by Ace Man. -Version 2.0.2 (2006-01-24) - Added updated Danish language pack contributed by Jan Moelgaard, John Dalsgaard and Bo Frederiksen. - Added updated Czech language pack contributed by michi aka mishal. - Added new Slovenian language pack contributed by Domen Kosir. - Added new Turkish language pack contributed by Engin Dumlu. - Added new save_onsavecallback option to the save plugin, this function is called on save. - Added new save_enablewhendirty option to the save plugin, this will disable the button until changes are made. - Added new onpageload callback event, this event is called when the page is loaded but before instances are made. - Added new accessibility_focus option, this enables you to control if buttons should be tab focusable or not. - Added new greek alpha character to charmap dialog. - Added new Scaron,scaron,Alpha entities to the default value of the entities option thanks to Kevin Rodgers. - Added new contextmenu items link.unlink,advhr contributed by Speednet. - Added new paste_insert_word_content_callback option for the paste plugin. - Added new cleanup plugin, this will replace the one inside the core ones it's considered stable. - Added cancel button to color picker contributed by Speednet. - Fixed various documentation errors and typos, modified the FAQ. - Fixed issue where the first handleNodeChange call was done to early in initialization. - Fixed issue with Dutch language pack for advlink plugin. - Fixed issue where dialogs was to short when dialog_type option was set to modal in MSIE. - Fixed bug where insert image under Gecko resulted in a broken image if it was inserted a the beginning of a element. - Fixed bug where mceVisualAid class wasn't removed from TH elements on save. - Fixed bug where the href attribute area elements gets converted to xhref. - Fixed bug with document relative anchors being forced absolute even when the convert_urls was set to false. - Fixed bug where some plugins produced &gr; intead of > entities on string encoding. - Fixed bug where some characters in charmap dialog was double encoded in Firefox/Gecko. - Fixed bug with XML core entities wasn't encoded when using raw or numeric value in entity_encoding option. - Fixed bug where classes was removed from table,td,th elements when the verify_css_classes option was enabled. - Fixed bug where elements was getting a visual aid class if a default or force class attribute value rule was used. - Fixed bug where strong/em rules didn't handle the -/+ prefixes correctly under Firefox/Mozilla. - Fixed bug where non textarea elements didn't work when submiting content. - Fixed bug where a access denied error was produced when using contextmenu together with modal dialogs under MSIE. - Fixed bug where fullscreen plugin didn't call custom cleanup functions when passing content back and forth. - Fixed issue where default rule for font tags didn't have a + prefix in valid_elements. - Fixed issue with CSS where "arrow" was used instead of "default" for cursor replacement. - Fixed issue where the replace button replaced the current selection first time it was used. - Fixed issue with missing title for the advhr dialog. - Fixed issue with div not beeing usable in the theme_advanced_blockformats option. - Fixed issue in with translation in the German language pack. - Fixed so the word wrap toggle for source view functions in Firefox/Mozilla. - Fixed so title attribute of emotion images gets inserted aswell as alt. - Fixed so the insert return on popups is checked by default in advlink. - Fixed so url gets filled when empty if a user selects a popup url. - Fixed so some init settings gets trimmed from whitespace. - Fixed so charmap closes when a char is selected since most of the time users only need one char. - Fixed so the link and image dialogs of advanced theme are styled with the new 2.x layout. - Fixed accessibility issuew with the link, image and advhr dialogs. - Fixed so the advhr dialog uses the new 2.x layout. - Fixed XHTML compliance for Preview plugin contributed by Bo Frederiksen. - Fixed entity decoding problem with insert button of the advhr plugin contributed by Bo Frederiksen. -Version 2.0.1 (2005-12-02) - Fixed critical bug in some MSIE versions when submiting content. -Version 2.0 (2005-12-01) - Added new paste_replace_list option to the paste plugin, this replaces some MS specific characters into normal characters. - Added new convert_urls option, this was required to address some issues with Firefox 1.5. - Added new paste_create_linebreaks option to paste plugin contributed by Kevin Rodgers. - Added new advimage_update_dimensions_onchange option to advimage plugin, this is enabled by default. - Added new table_inline_editing option, this enables you to toggle the inline table editing controls in FF 1.5. - Added new object_resizing option, this enables you to toggle the resizing controls of table and images in FF 1.5. - Added updated simplified Chinese language pack contributed by Wang Yang (tom_cat). - Added updated Dutch language pack contributed by Mark van der Sanden. - Added updated French language pack contributed by Normand Lamoureux. - Added updated Polish language pack contributed by Wooya. - Added updated Brazilian Portuguese language pack contributed by Marcio Barbosa. - Added new Traditional Chinese language pack contributed by Twapweb. - Added new Slovak language pack contributed by Vladimir VASIL. - Added new Norwegian Nynorsk pack contributed by Knut B. Jacobsen. - Fixed bug where getting init settings in handleNodeChange callback wasn't working correctly when multiple configs where used. - Fixed bug with urls being converted into incorrect values in Firefox 1.5. - Fixed bug where editor and cursor was flickering when TinyMCE was placed in a hidden div in Firefox 1.5. - Fixed bug with missing parenthesis in a MSIE setInnerHTML call. - Fixed bug where MSIE was producing a "Invalid source HTML for this operation" javascript error when placed in P tags. - Fixed bug where some styles with RGB values was parsed/serialized incorrectly in Firefox/Mozilla. - Fixed bug where reset form action didn't reset all editor instances to their original values. - Fixed bug where a javascript exception whas thrown when the editor was resized to a negative value in MSIE. - Fixed bug where inserting custom characters or date/time within a font element removed formatting in Firefox/Mozilla. - Fixed bug where image urls was inserted incorrectly if relative_urls was set to false due to issues with inserthtml command. - Fixed bug where encoding option wasn't working correctly becurse the entities list wasn't initialized. - Fixed bug where MSIE removed the first comment from the HTML of a mceInsertContent call. - Fixed bug where update all cells in table/row wasn't working on some tables with lots of whitespace. - Fixed bug with td background attribute when inline_styles option was set to true in MSIE. - Fixed bug where forms submitted with accesskey or return produced a JS error in Firefox 1.5. - Fixed bug with URL convertion logic not converting paths correctly to relative/absolute URLs. - Fixed bug where inline_styles option and flash moviews produced strange results. - Fixed bug where tabs and links where opened in a new window in MSIE when dialog_type option was set to modal. - Fixed bug where dialogs didn't open in Opera if the dialog_type option was set to modal. - Fixed bug where the table plugin wasn't working with the inlinepopups plugin while running in MSIE. - Fixed bug where embed elements whasn't parsed correctly by the flash plugin if no object tag was surrounding it. - Fixed bug where contents wasn't stored/restored when using the browser back button in Firefox 1.5. - Fixed issue where the ghost resize handles in Firefox/Mozilla was appearing when resizing images/tables. - Fixed issue with constrain proportions feature in advimage plugin, when trying to reset the values to blank. - Fixed issue where inlinepopups option couldn't be enabled/disabled on individual instances. - Fixed issue where TDs was created instead of TH elements when inserting a column on a row with TH elements. - Fixed issue with editor_selector/editor_deselector options couldn't be used when mode was specific_textareas. - Fixed issue where font selection produced null face attributes in MSIE. - Fixed issue where document local anchors where prefixed with the document name. - Fixed issue where link/image dialogs of the advanced theme didn't open using inlinepopups when enabled. - Fixed so the CSS select list gets hidden in the link dialog in advanced theme if there isn't any CSS classes. - Fixed so that the onsubmit handler of a form was processed correctly when posting using the save plugin. - Fixed so TinyMCE makes some very simple cleanups even if cleanup option is set to false. - Fixed so alignment button gifs have the justify prefix, such as justifyleft, for compatiblity with Drupal. - Fixed compatiblity issues with the .NET version of TinyMCE Compressor. - Fixed performance issue with fullscreen plugin, it switches back to normal view a lot faster now. - Fixed issues with mceSelectList class in advanced theme and compressed it some. - Renamed the Norwegian language pack from no to nb since it's "Norwegian Bokmål". -Version 2.0RC4 (2005-10-30) - Fixed bug with font face/size/color wasn't working correctly in Firefox 1.5b1. - Fixed bug where all actions where dispatching the onbeforeunload event. - Fixed bug where buttons in fullscreen mode wasn't working in MSIE. - Fixed bug where style removal with drop list wasn't working correctly. - Fixed bug where element path list or return key some times didn't scroll to the right location. - Fixed bug where return key in Firefox/Mozilla some times produced a error. - Fixed bug where MSIE was presenting a alert box about insecure items when running TinyMCE over HTTPS. - Fixed bug where TR/TD elements width/height attributes produced a JS error on cleanup. - Fixed bug where Polish Ctrl+Alt+Z executed the undo function instead of inserting national character. - Fixed bug where editor couldn't be initialized if no rows or height where specified on a textarea. - Fixed bug where comments sometimes got removed from HTML code. - Fixed bug with advimage not inserting onmouseover attribute correctly. - Fixed bug where anchors with child nodes messed up list elements. - Fixed bug where apply_source_formatting option wasn't working when used together with remove_linebreaks. - Fixed bug where empty paragraphs where invisible in Firefox. These are now padded with a  . - Fixed bug where tables without a border attribute didn't get visual aid borders until cleanup. - Fixed bug with URL convertion, absolute URLs to the same domain without trailing slash produced incorrect results. - Fixed bug with URL convertion of urls like this somedir/?id=3 produced somedir?id=3. - Fixed bug with weird cursor movement when pressing return/enter in a list when running on Firefox/Mozilla. - Fixed bug where contents where deleted sometimes when user pressed return/enter running on Firefox/Mozilla. - Fixed bug where style elements what generated empty in MSIE, but using style tags is not recommended. - Fixed bug with not beeing able to have absolute urls in the external_link_list_url and simmilar. - Fixed bug with bold, italic, underline, strikethrough buttons not beeing selected correctly. - Fixed bug with font size and font face select list not beeing selected correctly. - Fixed bug where document anchors was incorrectly converted if document_base_url was defined. - Fixed bug where changing border width/color of a table didn't update CSS styles correcty. - Fixed bug where emotions plugin didn't insert a new smiley the second time you insert one. - Fixed bug with blockquote command produced javascript error when used on lists in MSIE. - Fixed bug with cleanup converting flash elements to images. - Fixed bug where class wasn't selected in drop list of advlink/advimage dialogs when editing links/images. - Fixed bug where cellpadding/cellspacing/scope wasn't correctly handled in MSIE 5.5SP2. - Fixed bug where hreflang,charset and type attributes wasn't returned correctly in MSIE 5.5SP2. - Fixed bug with broken image URLs when user clicked the cleanup button in Firefox 1.5b2. - Fixed some compatiblity issues with call to createStyleSheet and event.target setup. - Fixed more compatiblity issues with scripts extending core JS logic such as the Array class. - Fixed issue where paragraphs wasn't generated if user pressed returned inside a H1-H6 running on Firefox/Mozilla. - Fixed issue with context menu plugin messing up some onclick events. - Fixed issue with missing HTML in advanced theme. - Fixed issue with Finnish language pack, it wasn't working at all. - Fixed issue where button control styles needed to be overriden in default editor_ui.css. - Fixed issue with a broken link in the documentation to the theme_advanced_resize_horizontal option. - Fixed issue with missing var declaration of a buttons variable in the advanced theme. - Fixed issue with missing block elements in block element regexp. - Fixed issue where advhr plugin didn't produce valid attribute for noshade. - Fixed issue with misslabeled option, plaintext_create_paragraphs is renamed to paste_create_paragraphs. - Fixed issue where remove_script_host and relative_urls where treated as true if they where specified as strings. - Fixed issue with charmap, made it easier to select/click characters. - Fixed issue with search/replace dialogs not being refocused in MSIE. - Fixed issues with dialogs being to small if large class names where added. Made sure they can grow. - Fixed issues with some dialogs being to small in NS 7.2 and not working correctly in NS 7.1. - Fixed missing HEAD element in fullscreen.htm file, contributed by monkeybrain. - Fixed some HTML issues with the advhr plugin, contributed by monkeybrain. - Fixed some small issues with the span element rule of the XHTML rule set in valid_elements documentation. - Added new Opera 9 support, most of the functions is working in the prerelease of Opera 9. - Added new paste_strip_class_attributes option to paste plugin, contributed by monkeybrain. - Added new merge_styles_invalid_parents option, allows users to control what elements gets styles. - Added new theme_advanced_resizing_use_cookie option, this enables you to disable the cookie used by resize. - Added new function that converts all font elements to span elements when the editor loads. - Added new force_hex_style_colors option, enables you to control the color format of CSS styles. - Added new convert_fonts_to_spans option, this option converts fonts to span elements. - Added new font_size_classes option, this option is used together with convert_fonts_to_spans. - Added new doctype option, enables you to control the internal doctype declaration. - Added new event_elements option contributed by happy_noodle_boy. - Added new path tooltips for font, span and flash elements such as color, font-family, src and so forth. - Added trim_span_elements back again, this option removes unneeded span elements. - Added documentation of the apply_source_formatting option. - Added updated Danish language pack, contributed by Jan Moelgaard. - Added updated Hebrew language pack, contributed by Liron Newman. - Added updated Russian language pack, contributed by Vladimir Vitkovsky. - Added updated Finnish language pack, contributed by Tuomo Aura. - Added updated Spanish language pack, contributed by Adolfo Sanz De Diego. - Added updated Italian language pack, contributed by grueff. - Added updated Icelandic language pack, contributed by Johannes Birgir Jensson. - Removed option convert_fonts_to_styles due to various compatiblity issues. Use convert_fonts_to_spans instead. -Version 2.0RC3 (2005-09-26) - Fixed bug where colorpicker in table plugin wasn't working in Mozilla/Firefox. - Fixed bug where closed anchors produced strange results. Anchors are now forced open. - Fixed bug where the font style/color functions wasn't producing correct results. - Fixed bug where buttons not working if a target was defined in head element. - Fixed bug where paragraphs wasn't generated when pressing return/enter in a floating div. - Fixed bug where anchor contents was getting lost, contents of anchors are now placed behind them. - Fixed bug where style info such font size/face/color was removing parent elements such as LI. - Fixed bug where %I wasn't inserting correct hour in the insertdatetime plugin. - Fixed bug where MSIE sometimes doesn't output attributes correctly, contributed by Luke Bennett. - Fixed bug where images was lost if the user pressed return after a image in a TD on FF. - Fixed bug where empty non block elements where produced when hitting return in Gecko browsers. - Fixed bug where it was impossible to update tables. - Fixed various bugs and issues with removeformatting function it will now remove classes and styles. - Fixed compatiblity issues with prototype.js and other scripts that modifies the Object.prototype. - Fixed issue where a unnecessary dir and style attribute was generated on the blockquote command in MSIE. - Fixed issue with access denied error if page contained iframes with external URLs. - Fixed issue where the plugin links in about dialog was linking to blank. - Fixed issue with useCSS command not working in Deer park beta. - Fixed XHTML table compatiblity issues. Placed bordercolor and height in styles instead of attributes. - Fixed issue with tables getting empty summary attribute in MSIE. - Fixes so the insert custom character dialog is accessible through keyboard. - Removed _self as the default target for links inorder to produce more XHTML compliant code. - Removed bordercolor field from table row properties dialog since this is not a valid attribute. - Added accessibility warnings to image and table plugin. These can be disabled by the accessibility_warnings option. - Added updated Danish language pack, contributed by Jan Moelgaard. - Added updated Hebrew language pack, contributed by Liron Newman. - Added updated Norwegian language pack, contributed by Knut B. Jacobsen. - Added updated German language pack, contributed by salzbermat. -Version 2.0RC2 (2005-09-12) - Fixed bug with plugin tab in about dialog not working in MSIE 5.01. - Fixed bug issues with paste and noneditable plugin in MSIE 5.01. - Fixed bug where dialogs in the search/replace plugin was to small. - Fixed bug where about dialog sometimes produced unknown runtime error in MSIE. - Fixed bug where é and í characters was converted the wrong entities. - Fixed bug where it was possible to click on the disabled link icon when nothing was selected. - Fixed bug where autosave plugin wasn't working with JS submit calls or the save plugin. - Fixed bug where file/image browser wasn't working with the default link/image dialogs. - Fixed bug where style attributes where parsed/serialized incorrectly when using - and #. - Fixed bug where inline popups plugin wasn't working when loading the compressed JS files. - Fixed bug with contextmenu showing theme image dialog instead of advimage dialog. - Fixed bug with flash plugin trying to include a empty external list JS file. - Fixed bug with some fields beeing to short if the file browser was disabled. - Fixed bug where contextmenu wasn't recognizing flash elements. - Fixed bug where border styles on images and tables was removed. - Fixed accessibility issue with colorpicker, added titles and keyboard access. - Fixed accessibility issue with toolbar buttons, all toolbar buttons are now wrapped in links. - Fixed accessibility issue width browse buttons, these are now wrapped in links. - Fixed accessibility issue with select lists, all select lists has now keyboard access. - Fixed accessibility issues with missing labels in various dialogs. - Fixed accessibility issue with the emotions plugin, this one now inserts a alt text for smileys. - Fixed accessibility issue with the locationbar, menubar and so fort in advlink plugin. - Fixed accessibility issue with TOC in english help pages. This is not wrapped in a acronym element. - Fixed issue with the directionality plugin. It will now get disabled on invalid elements. - Fixed issue where popups was the wrong size a new resizeToInnerSize function resizes popups to the correct size. - Fixed so empty elements gets removed since they serve no purpose. - Added support for TinyMCE grabbing text from input elements if specified in exact mode. - Added language specific relative popup width/heights to all build in dialogs. - Added missing browser for popup url in advlink plugin. - Added missing delete table icon to context menu. - Added so it's possible to see the target value in the target select dropdown in the advlink plugin. - Updated the documentation to include information about the new language packs. - Updated the swedish language pack. -Version 2.0RC1 (2005-09-06) - Renamed CSS classes mcePathTop,mcePathBottom,mcePath to mceStatusbarTop,mceStatusbarBottom,mceStatusbar. [BREAKS COMPATIBLITY]. - Moved all theme CSS files to a css directory within the theme. [BREAKS COMPATIBLITY]. - Removed the default theme since the advanced theme can be configured to be as the default theme. [BREAKS COMPATIBLITY]. - Removed closeDialog method from TinyMCE use tinyMCEPopup.close(); instead of tinyMCE.closeDialog();. [BREAKS COMPATIBLITY]. - Removed the auto_cleanup_word option, since the paste plugin now handles this better than the build in function. - Added improved undo/redo and onchange handling. All modifications are now undo/redo:able. - Added new mceBeginUndoLevel/mceEndUndoLevel commands. Used to begin/end a undo/redo:able action. - Added new link dialog with tab interface and lots of new fields and options. - Added new image dialog with tab interface and lots of new fields and options. - Added new about dialog with tab interface, this one replaces the old help dialog. - Added new table dialogs with tab interface and lots of new fileds and options. - Added new utils directory in tiny_mce script dir. This directory contains various utility classes. - Added new TinyMCEPopup class to tiny_mce_popup.js, used for common popup logic. - Added new inlinepopups plugin, this makes the popup windows to open as DHTML windows (divs). - Added new version info constants to TinyMCE (majorVersion, minorVersion, releaseDate). - Added new resizing functionality to the advanced theme, the editor instance can now be resized. - Added new theme_advanced_resizing option, enables/disables the new resizing functionality. - Added new theme_advanced_resize_horizontal option, enables/disables the horizontal resizing. - Added new theme_advanced_path option, enables/disables the element path functionality in statusbar. - Added new compressed icons about 1/3 of the original size, contributed by Jozef. - Added new center support of images, images are now wrapped in a div with alignment. - Added new - character to the valid_elements/extended_valid_elements options this feature removes empty elements. - Added new setup_content_dom and submit_content types to custom cleanup callbacks. - Added new inst parameter to custom cleanup callbacks, this is a reference to the editor instance. - Added new mceColorPicker command to the advanced theme, enables the possibility invoke the color picker. - Added new safari_warning option, this enables you to disable the alert that gets presented when running on Safari. - Added new editor_selector/editor_deselector options that enables you to specify a include/exclude from convertion class. - Added new tinyMCE.addToLang function to reduce the overall size of the language files. - Added new auto save plugin. This plugin will confirm that the user want's the leave any modifications unsaved. - Added new noneditable plugin. This plugin enables you to disable/enable the possibility to edit various elements. - Added new word example, to better illustrate how TinyMCE is to be used when pasting content from Office/Word. - Added missing entities eactute,iacute,oacute,uacute,Aacute,Eacute,Iacute,Oacute,Uacute,Yacute,Aacute. - Added updated Hebrew language pack contributed by Liron Newman. - Added visual aid icon for invisible anchors elements. - Added new insert table and delete table commands to context menu. - Added new convert_fonts_to_styles option, this option controls if font or span will be used when using font size, color etc. - Renamed the theme_advanced_path_location to theme_advanced_statusbar_location. - Moved all popup javascript logic into external .js files, inorder to separate presentation and logic. - Removed the automatic resizing of popups. Better to use relative window sizes for each language when opening a dialog. - Fixed issue where the character map dialog lost focus when inserting a char. - Fixed issue where the attribute values where not XML encoded correctly. For example: & will be &. - Fixed performance issue with the table plugin, it was executing logic even when it was inactive. - Fixed so the directionality gets inherited by all popups/dialogs. - Fixed so the CSS file content_css loads after the theme content CSS, user specific CSS extends theme CSS. - Fixed so more than 3 toolbar rows may be added in when using the default simple layout. - Fixed so the insertdatetime plugin polls it's default date formats from the language pack. - Fixes so auto_reset_designmode is enabled by default, to avoid the question about the editor not working in tabs. - Fixed better inline styles support for images and tables. - Fixed duplicate IDs on advanced theme with external toolbar, contributed by Miguel Fortea. - Fixed issue with remove formatting under MSIE, if all contents of a element is selected the element is also selected. - Fixed issue with visual aids not being removed from content when cleanup is disabled. But it's NOT recommended to disable the cleanup. - Fixed bug where return/enter key sometimes produced empty elements in MSIE. - Fixed bug where link list was generated twice in the advanced themes link dialog. - Fixed bug issue where embed was converted in to ibed due to some invalid regexps. - Fixed bug where summary attribute on tables got lost in MSIE. - Fixed bug where the editor scrolled to the top of content when the pasting text with the paste plugin. - Fixed bug where external toolbar wasn't translated, contributed by Miguel Fortea. - Fixed bug where the editor had a incorrect height, contributed by Miguel Fortea. - Fixed bug where visual aid class where presented in element path. - Fixed bug where HR elements with a id set to "null" produced runtime error in MSIE. - Fixed bug where isDirty wasn't working due to the same function name and variable name. - Fixed bug where events like onclick wasn't removed/stored correctly in old MSIE. -Version 1.45 (2005-06-23) - Fixed so the newdocument button shows again, was removed by accident in RC2. - Fixed so styles drop down in link dialog gets hidden if no classes are defined. - Fixed bug where Paste command in context menu wasn't working. - Fixed bug issue with not having a base href element in preview plugin. - Fixed bug where input elements produced double type/value attributes in MSIE. - Fixed so the check for empty contents in cleanup handled uppercase elements. - Added a alert box is a popup is blocked by a popup blocker. - Added updated dutch language pack, contributed by Fred Stuurman. - Added a confirm dialog for the newdocument action. - Added mceContentBody class to the iframe document body. - Added allowtransparency attribute to iframe. - Added fix where some HTML content produced runtime error in MSIE. - Added a lot better Safari support, but many things are still very buggy. - Added flash_wmode, flash_quality and flash_menu options for the flash plugin. - Added new dialog_type option, this enables you to switch back to modal dialogs in MSIE. - Updated Canadian French table language pack contributed by Virtuelcom. - Fixed some minor issues with Simplified Chinese language pack. - Re-added Tahoma font to font drop list, was removed in previous version. -Version 1.45 RC2 (2005-06-15) - Fixed bug where paste_use_dialog option for the paste plugin wasn't working correctly. - Fixed bug issue with setContent not calling custom cleanups correctly. Inflicts the Flash plugin. - Fixed bug where external_link_list_url/external_image_list_url in fullscreen mode. - Fixed so TinyMCE doesn't use modal dialogs on MSIE, these where giving some problems with for example lost sessions. - Fixed the auto resize function for popups to use new logic. - Fixed so callback functions gets called correctly from fullscreen mode. - Fixed misspelled language pack for canadian french in the advimage plugin. - Fixed so openWindow can open use absolute URL:s. - Fixed bug issue where auto_cleanup_word sometimes didn't work in MSIE. - Fixed bug issue where the close button in dialogs wasn't available on Firefox on MacOSX. - Added new pastetext icon contributed by speednet. - Added new browsers option that enables you to specify what browsers is to be WYSIWYG enabled or not. - Added partial Catalan translation contributed by Marc Bria Ramírez. - Added portuguese Brazil translation contributed by João Borges. - Added updated Simplified Chinese language pack contributed by cube316. - Added beforeunload handler for fullscreen plugin so contents gets updated when the window is closed. - Added a new fullscreen_settings option for the fullscreen plugin contributed by David Glick. - Added new insert table command to context menu when user clicks within a table. - Added new advimage_constrain_proportions option to advimage plugin, contributed by Knut B. Jacobsen. - Added updated advanced theme with a new external toolbar location option, contributed by Man-Chicken (http://www.zoomshare.com/). - Added new tiny_mce_gzip.php file, this PHP script merges and compressed the requested .js files to improve loading times. - Added updated czech language pack, contributed by Stanislav Lacko. - Added new mceRemoveNode command, this command removes a node and inserts the node contents instead. - Added new behavior to format select box, you can now remove a paragraph by selecting -- Format --. - Removed ?rnd from external_link_list_url/external_image_list_url since it doesn't work well with serverside scripts. -Version 1.45 RC1 (2005-05-27) - Fixed bug where character map inserted & and </> when using & < >. - Fixed so paragraphs containing   is converted to numeric or raw if entity_encoding is set. - Fixed bug in searchreplace plugin when user tried to search on a empty string or the editor contents was empty. - Fixed repaint/trail graphics issues with images and tables in FF/Mozilla. - Fixed some memory leaks in TinyMCE core and context menu plugin, only MSIE was inflicted by this. - Fixed stange issue where elements sometimes disappeared in MSIE. - Fixed URL convertion problems with onmouseover, onmouseout image urls in advimage plugin. - Fixed URL convertion problems with Flash plugin. - Fixed the experimental Safari support, some features work some doesn't. - Fixed bug where multiple a elements where created when updating links on images in FF/Mozilla. - Fixed bug in importCSS function, was having a meaning less if statement. - Fixed so the contextmenu plugin uses images from the configurated theme instead of the advanced theme. - Fixed so the external_link_list_url/external_image_list_url options can use relative or absolute path. - Fixed so the external_link_list_url/external_image_list_url has a random query parameter to prevent it from cache. - Added new mceInsertRawHTML command, this inserts raw as it is HTML code in the the selected position. - Added paste plain text plugin contributed by Ryan Demmer, converted it into a paste plugin. - Added updated paste plugin contributed by speednet, includes paste directly feature for MSIE. - Added split/merge table cells support, to table plugin and context menus. - Added cut/copy/paste table rows functionality to context menu and table plugin. - Added new mceSetContent command, this does the same as the setContent function. - Added new clear all/new document icon to advanced theme. - Added new remove formatting and select text color icons. - Added new directionality plugin to better support languages that write from right to left. - Added new fullscreen plugin, enables users to toggle fullscreen editing mode. - Added a new template/tutorial plugin to aid people in the development of own plugins. - Removed visual_table_style and replaced it with visual_table_class. [BREAKS COMPATIBLITY]. - Renamed urlconvertor_callback option to urlconverter_callback. -Version 1.44 (2005-05-03) - Fixed bug with contextmenu not showing at the correct location in MSIE. - Fixed bug where a error was produced by the Flash plugin if the user reloaded the page in MSIE. - Fixed issue where mceAddControl and mceRemoveControl commands produced a error in MSIE. - Fixed bug when images and flash movies where mixed in the editor produced strange results. - Fixed so trailing / characters isn't removed from URLs. - Fixed so the contextmenu uses a diffrent method of loading it's custom CSS file. - Fixed getAttributes problem, it should read getAttribute. - Fixed so "Edit HTML source" window may be maximized. - Added French eacute entitiy to default entities option. - Added a height CSS value for the element path in advanced themes editor_ui.css since it keept bobbing up and down. - Added updated Polish language pack contributed by Marcin Szymon Sznyra. - Added better window auto resize method for most dialogs. - Added new feature to set what tags are to be left open in valid_elements. Add a + before the element names to enable. - Added nowrap for the editor table cells, sometimes the editors controls wrapped. - Updated German language pack contributed by Krokogras. -Version 1.44 RC2 (2005-04-25) - Fixed bug with host prefixes and port numbers when having relative_urls set to false and remove_script_host set to true. - Fixed bug when site absolute URLs for example /something was converted incorrectly in Firefox/Mozilla. - Fixed bug where the link wasn't auto selected in the drop list in the advanced themes default link dialog. - Fixed bug issue with the flash plugin and croping out characters before and after the movie. - Fixed bug where the editor jumped to top of editor area on enter/return when doctype was set to XML Transitional. - Fixed bug where context menu was appearing in the wrong location if the window was resized. - Fixed bug in the context menu where table properties wasn't working. - Fixed bug where a selectorText exception was trown if the CSS file contained @import or @charset. - Fixed bug where bold/italic/strikethough/underline wasn't selected/unselected in toolbar some times. - Fixed issue with hspace and vspace when having the inline_styles option enabled. Contributed by speednet. - Fixed bug where access denied error was thrown sometimes in MSIE. - Fixed so images without src won't be inserted. - Fixed some issues with width/height fields in the advimage plugin. - Fixed so the contextmenu plugin doesn't appear in MSIE 5.0, now functions with 5.5+. - Added filebrowser icon to mouse over and mouse out fields in the advimage plugin. - Added filebrowser icon to popup field in the advlink plugin. - Added so the triggerSave function gets auto executed when a user calls submit on a form, this can be disabled with the submit_patch option. - Added missing readme.txt file for the context menu plugin. - Added new border and background color fields to table dialog, based on contribution by Neirda. Enable them by the table_color_fields option. - Removed some old outdated items from FAQ. -Version 1.44 RC1 (2005-04-20) - Fixed bug where width/height attributes of a image wasn't stored some times in Firefox/Mozilla. - Fixed bug where P elements where created if a user pressed return/enter within a h1-h6 in Firefox/Mozilla. - Fixed bug where the remove format fuction didn't work some times in MSIE. - Fixed so backspace/delete gets added in one undo level in MSIE (improves performance). - Fixed so the "Could not find element by id or name" alert only shows when the debug option is set to true. - Fixed bug where bold/italic didn't work in Mozilla 1.3. - Fixed bug where width/height of a hidden TinyMCE instance where incorrect. - Fixed so the function layout of classes in tiny_mce_src.js uses prototype keyword instead of TinyMCE_ prefix (reduces size). - Fixed bug where triggerNodeChange produced javascript error some times in MSIE. - Fixed some issues in the Swedish and Spanish language packs. - Fixed bug where first undo level wasn't working correctly. - Fixed so flash plugin loads it's needed CSS data from within the plugin. - Fixed button images and CSS in the simple theme. - Fixed so the simple example shows how to use the simple theme instead of the default theme. - Fixed so cleanup default values can be set to empty. For example alt= generated alt="" on img elements. - Fixed memory leaks in MSIE (circular closure problem) events are now removed in a better way. - Fixed bug where URLs where converted incorrectly if the editor page URL contained / characters. - Fixed bug where table guidlines didn't work correctly when using the build in Mozilla table buttons. - Fixed bug where the Flash plugin was breaking other elements. - Added new contextmenu plugin, this plugin adds a menu if the user right clicks/uses the contextmenu on elements. - Added new multiple configuration support, the init method may now be called multiple times. - Added new remove_linebreaks option, this option is enabled by default and removes all HTML code linebreaks. - Added new behavior to the textarea_trigger option, if mode is textareas and trigger is false those elements will not be converted into editors. - Added new entity_encoding option, enabled user to better control the behavior of how character are converted into entities. - Added new isDirty command to TinyMCEControl, this method returns true if the user has done any modifications to the content. - Added new onchange_callback option, this callback is executed when contents within the editor instance is changed. - Added new init function for themes/plugins this gets called when a editor instance has finished it's setup. - Added new init_instance_callback option this callback is executed when instances are added to the editor. - Added new cleanup option this option enables users to totaly disable the whole cleanup process. - Added new importCSS method to TinyMCE. This method allows plugins and themes to load custom CSS files on initialization. - Added new getSelectedHTML method to TinyMCEControl class, this method returns the currently selected HTML contents. - Added new getSelectedText method to TinyMCEControl class, this method returns the currently selected contents as text. - Added new removeclass behavior to the removeformat button. The current class will be removed if no contents is selected. - Added new queryInstanceCommandValue and queryInstanceCommandState methods. - Added new option button_tile_map, this option contols the usage of button tile maps and is disabled by default. -Version 1.43 (2005-03-06) - Fixed bug with ask option not working at all. - Fixed bug where a "instance is not defined bug" error was produced. - Fixed bug with empty image src produced a error. - Fixed so the simple and default theme used the same CSS style as the advanced theme. - Fixed bug with the relative to absolute URL convertion logic if a empty string was passed used. - Fixed parse error bug with the source editor some servers can't handle XML PI declarations. - Fixed bug issue with HR elements in MSIE, if a specific work pattern where used a runtime error was produced by MSIE. - Fixed bug in the URL convertor logic, port numbers was not correctly handled. - Fixed issue where the cursor was placed before a insert of custom charater or date/time. - Fixed bug where the editor height option didn't work on MSIE. - Fixed bug where a linefeed within a table cell broke the table in Firefox/Mozilla. - Fixed bug where return/enter key after a image removed all content. - Fixed bug where return/enter key sometimes produced nestled P elements. - Fixed bug where the editor was stealing focus on load in MSIE. - Fixed bug where the visual aid logic forces width/height attributes on tables. - Fixed bug where getCSSClasses some times returned null value. - Fixed issue where the lang_insert/lang_update language variables wasn't entity decoded. - Fixed so the image/link/flash drop list gets auto selected thanks goes to Randy Simons and salzbermat. - Fixed so remove formatting button in MSIE removes all classes aswell. - Fixed issue where output contained single br element when the editor area was empty. - Added new %A/%a/%B/%b format chunks to insertdatetime, these insert localized date names such as January. - Added new oninit callback option for TinyMCE this callback is executed when all editor instances been initialized. - Added new preview panel to dialog in the advimage plugin, contributed by Virtuelcom. - Added element class name to element path in the advanced theme. - Updated Canadian French table language pack contributed by Virtuelcom. - Updated the swedish language pack, contributed by Mats Löfström, York Consulting AB. -Version 1.42 (2005-02-14) - Fixed bug with the element path beeing resized if width/height of editor was 100%. - Fixed bug with reloading/flicker of all button images in MSIE if browser cache is disabled. - Fixed backspace/delete bug in Firefox, some times the cursor got stuck. - Fixed bug issues with enter/return key in Firefox/Mozilla. - Fixed bug where copy/paste and drag drop of images/links failed in Firefox/Mozilla if a document_base_url is provided. - Fixed so when relative_urls is set to false it forces absolute URLs for images/links. - Fixed so the _src.js suffix versions of the themes and plugins gets loaded with the tiny_mce_src.js script is used. - Fixed so verify_css_classes option is disabled by default. - Fixed bug where tables where resized when toggling visual aid in Firefox/Mozilla. - Fixed bugs with advhr plugin running in a hidden div element. - Added new auto_focus option that enabled a specific editor area to be focused on startup. - Added a extra argument to the filebrowser callback inorder to get the calling window reference. - Added a new persian (farsi) language pack contributed by Morteza Zafari. - Added new more nice looking icons contributed by Morteza Zafari and Michael Keck. The old icons are available in a separate icon pack. - Added updated Canadian French language pack contributed by Virtuelcom. - Added updated French languahe pack contributed by Laurent Dran. - Added updated German language pack contributed by Tobias Heer. - Added some documentation regarding the layout manager options made by SlyD. -Version 1.41 (2005-01-31) - Added new table plugin, all table code is moved into this plugin [BREAKS COMPATIBLITY]. - Added new external_link_list_url/external_image_list_url options for better backend integration. - Added new file_browser_callback option for better backend integration. - Added new layout manager code into the advanced theme, contributed by SlyD. - Added new nowrap option, enables so users may change the word wraping behavior. - Added new Thai language pack contributed by Innozent. - Added obfuscated version of all plugins and themes to reduce over all startup/download time. - Added Simplified Chinese language pack contributed by cube316. - Added a updated Czech language pack thanks to Josef Klimosz. - Fixed issue where anchor elements where closed. This results in browser problems with the outputed HTML. - Fixed bug where the first return key press didn't produce a paragraph in Firefox/Mozilla. - Fixed bug in the searchreplace plugin where replace content sometimes fails in Firefox/Mozilla. - Fixed so all language packs now uses the ISO-639-2 code instead of ISO 3166-1 [BREAKS COMPATIBLITY]. - Fixed some issues with the force_br_newlines option in MSIE. - Fixed bug where the backspace or delete key produced BR elements in Firefox/Mozilla. - Fixed bug issue with link and image dialogs of the default theme/simple example. - Fixed some bugs when having the editor hidden in a tab/div, contributed by Ernst de Moor. - Fixed some character issues with the Danish language packs, contributed by someone unknown. -Version 1.40 (2005-01-09) - Added a new default value for the font size drop down, if no font size where found this gets selected. - Added a auto resize window feature, this is enabled by default but can be disabled with a window argument. - Added a new print plugin, prints the current editor contents to a printer. - Added a new searchreplace plugin, adds a search, searchnext and replace button. - Fixed bug issue where buttons didn't display correctly on some Firefox installations. - Fixed issue with value and type attributes of input elements getting lost in cleanup on MSIE. - Fixed so that the getEditorInstance command is public, returns a TinyMCEControl by id. - Fixed issue where "true" and "false" string wasn't treated as booleans in TinyMCE init options. - Fixed so cursor/mousepointer allways remains a arrow in all themes when rolling over buttons. - Fixed the popup windows so they are mode "modal" in Mozilla/Firefox. - Fixed so the ask question is displayed when elements are focused with the tab key. - Fixed so the ask option works when mode option is set to exact. - Fixed issue with visualaids on tables not working correctly when the user uses the tab key in Firefox/Mozilla. - Fixed some bugs with the mceSetCSSClass class command and the element path. - Fixed a new version of the mceInsertContent command. - Fixed so the auto_cleanup_word option is disabled by default. - Removed the langs of the zoom plugin, it now uses + instead of the "zoom" word. -Version 1.391 (2005-01-04) - Fixed major spacebar bug in MSIE, spacebar was disabled. -Version 1.39 (2005-01-04) - Updated the Flash plugin with a new version, contributed by jamesw. - Added new setWindowArg function, useful if plugins are to call other plugins. - Added new save plugin, this plugin adds a save/submit form button to tinyMCE, contributed by SlyD. - Added new hilite color support, sets a background-color style on the selected text. - Added new variable replacement popup URLs, check the openWindow function documentation for details. - Added new force_p_newlines option, forces P elements on return/enter key in Mozilla/Firefox. - Added new theme_advanced_path_location, adds a element path list. - Added new theme_advanced_toolbar_align option, defaults to center. - Added new Portuguese translation contributed by José Pedro Pereira. - Added new mceSelectNode and mceSelectNodeDepth commands. - Added new add_unload_trigger option, this adds a unload triggerSave call. Enabled by default. - Added am/pm time format to the insertdatetime plugin. - Fixed font color and size attribute bug, contributed by Vincent FIACK. - Fixed className undefined bug, Firefox/Mozilla produced a console error sometimes. - Fixed so mceSetCSSClass command may be applied to all sorts of elements. - Fixed so anchor elements can be removed by setting the anchor name to nothing. - Fixed typing performance some in Firefox/Mozilla, removed some nodechange triggers. - Fixed so the zoom plugin is invisible in MSIE 5.0, since zoom isn't available in that browser. - Fixed bug with the emotions plugin in MSIE 5.0, it was opening a new window. - Fixed so contents stay within the editor if the user hits the back/forward buttons. - Fixed bug where the window.name property was set to the image name. - Fixed so anchors links within the same page are made relative when relative_urls are set to false. - Updated the advanced theme so most of the images are loaded from a tiled image, improves loading time. - Updated the Swedish language pack, contributed by Martin. - Updated the readme.txt in the advlink plugin, was some problems with the valid_elements. - Updated the default CSS for the advanced theme some, added button backgrounds to look like office2k. -Version 1.38 (2004-11-28) - Added new textarea field for form elements when debug mode is enabled, contributed by Michael Keck. - Added new spacer item support for the theme_advanced_buttons options, contributed by Michael Keck. - Added new selection borders for images and hr elements, contributed by Michael Keck. - Added new advhr plugin, this plugin handles advanced settings on HR elements, contributed by Michael Keck. - Added new german language pack for the preview plugin, contributed by Michael Keck. - Added new word wrap and source formatting to the source editor, contributed by Michael Keck. - Added new updated charmap, contributed by Michael Keck. - Added new flash plugin that enabled flash movied to be handled, contributed by Michael Keck. - Added the old cut/copy/paste commands to the advanced theme, these are not visible by default. - Added new theme_advanced_buttons_add_before option to advanced theme. - Added new "update" button title for a popup windows. - Added new zoom prefix language variable to the zoom plugin. - Added new entities option, that enables you to config entity code to name convertion. - Added new custom cleanup possibility to plugins. - Added new cleanup_callback option, adds the possibilty to add custom cleanup logic. - Added new Norwegian language pack, contributed by Sten Aksel Heien. - Added new Korean language pack, contributed by Setzer Gabbiani. - Fixed the layout of the color picker, contributed by Michael Keck. - Fixed so the preview plugin doesn't include the any toolsbars in preview popup window, contributed by Michael Keck. - Fixed bug where anchors elements was treated as links. - Fixed so all popup windows are modal dialogs in MSIE. - Fixed bug where the word "null" sometimes appares in HTML after cleanup in Firefox/Mozilla. - Fixed bug where form elements with missing name attributes produced errors. - Fixed some default value bugs and issues with the new advlink plugin. - Fixed the link/image dialog sizes in the SE language pack. - Fixed the content duplication bug, it seems to be fixed anyway, if not please let me know. - Fixed bug where plugin handleNodeChange extentions broke the theme function. -Version 1.37 (2004-11-12) - Added new mceResetDesignMode command that can be used when the editor is placed in tabs. - Added new updated Italian language pack thanks goes to "Fabrix Xm" for the contribtion. - Added new greek language pack thanks goes to "Jacaranda Bill" for the contribution. - Added new french language pack thanks goes to "Pat Boens" for the contribution. - Added new russian language pack thanks goes to "Roman Filippov" for the contribution. - Added new updated Dutch language pack thanks goes to Arnoud van Delden and Ernst de Moor for the contribution. - Added new convert_newlines_to_brs option, that enables newlines to be converted to br elements. - Added new custom_undo_redo_keyboard_shortcuts option, enables keyboard shortcuts to be enabled/disabled. - Added new auto_reset_designmode option, thats resets the design mode when a editor instance is focused. - Added new form reset handler, resets the contents of TinyMCE areas when the onreset event is trigged. - Added new skip_cleanup parameter to triggerSave, this parameter is optional and defaults to false. - Added new lang_underline_img language variable to all themes. - Added new title attribute to all images, enables tooltips in Mozilla and Firefox. - Added new insert and cancel CSS id's for all submit and cancel buttons. - Added new full featured example that includes all available plugins and buttons. - Added new advlink and advimage plugins to TinyMCE, these are more advanced link and image tools. Contributed by Michael Keck. - Added new parameters to insertImage and insertLink commands. Contributed by Michael Keck. - Added updated compatiblity chart, includes a matrix table thanks goes to Ernst de Moor. - Added new insert image icon contributed by Arnoud van Delden and Ernst de Moor. - Added window focus on all popup windows, contributed by Arnoud van Delden and Ernst de Moor. - Fixed some issues with the char map added some characters and removed duplicate ones, contributed by Arnoud van Delden and Ernst de Moor. - Fixed the insert row icon, rotated it 180 degrees, contributed by Arnoud van Delden and Ernst de Moor. - Fixed the visual aid icon, made it a bit darker. Contributed by Arnoud van Delden and Ernst de Moor. - Fixed some issues with entity encoding in source editor aswell as in core cleanup code. - Fixed bug where the auto import CSS feature imported invalid CSS rules with : or spaces. - Fixed bug where unnecessary entity encoding of characters was done. - Fixed the window sizes some to better function on MSIE with SP2. - Fixed some issued with the auto word cleanup feature, fixes some issued with content duplication. - Fixed bug that made the editor to throw weird error when HTML code includes content. - Fixed bug where the style attribute was returned on images in source output even if it was disabled. - Fixed issue where the UI form elements of TinyMCE was submitted with the form submit. -Version 1.36 (2004-10-19) - Added a newly modified version of the German language pack from "krokogras". - Added auto resizing to popup windows with the same name. - Added example page for the plugin_preview_pageurl option in the preview plugin. - Fixed issue with link button auto enable/disable feature when content selection was made with the keyboard. - Fixed bug where events wasn't handled correctly in MSIE 5.5 and some 6.0 versions. - Fixed so align on images gets set as float style when the inline_styles option is enabled. - Fixed so solid border style isn't applied on elements with a border when the inline_styles option is enabled. - Fixed some issues with tables and the inline_styles option. - Fixed back button issue with MSIE, iframes was placed in browser history. -Version 1.35 (2004-10-13) - Added so that whitespace gets stripped in plugin and theme_advanced_buttons options. - Added custom plugin_preview_pageurl option to preview plugin. - Added Canadian French language packs for the new plugins, contributed by Virtuelcom. - Added new theme_advanced_blockformats option. - Added new title support to advanced theme link dialog. - Added new Ctrl+B/I/U keyboard shortcuts for Firefox. - Added Polish language pack contributed by "revyag". - Added Taiwanese language pack contributed by "Jim Kou". - Added updated German language pack contributed by "Krokogras". - Fixed some issues with ieSpell including better language support. - Fixed bug with default value in valid_elements not working in Firefox some times. - Fixed bug when focusing links without selecting any characters. - Fixed some typos in Swedish language pack. - Fixed bug with content selection and link button auto enable/disable feature. - Fixed bug issue when "theme_advanced_buttons" options where left empty. - Fixed various bugs with absolute URLs. -Version 1.34 (2004-10-03) - Added new insertdatetime plugin, inserts date/time in various formats. - Added new preview plugin, previews the HTML page in a new window. - Added new zoom plugin, adds the possibility zoom the editor in MSIE. - Added new emotions plugin, adds the possibility to add smileys. - Fixed so that TinyMCE functions on MSIE 5.0 again. - Fixed so that TinyMCE functions better on Mozilla 1.3. - Fixed so that the cursor doesn't jump to the top when setting styles. - Fixed bug with STRONG and EM elements wasn't handled correctly in Firefox. - Optimized the key handling some, gives better typing performance. - Removed key down statusbar debug info. -Version 1.33 (2004-09-29) - Removed the need of loading blank.html, iframes are now created dynamicly. - Fixed bug when selecting tables, MSIE was casting errors. - Fixed bug with pluginurl variable. - Fixed bug when tinyMCE.selectedElement error was cast in Mozilla. - Added new Arabic language pack contributed by Hani Suleiman. - Added "lang_dir" support to language packs like Arabic. -Version 1.32 (2004-09-25) - Added new ieSpell plugin, only works in MSIE. - Added new "theme_advanced_buttons_add" option. - Added new importPluginLanguagePack function. - Added new Danish language pack contributed by Jan Moelgaard. - Added updated German language pack contributed by Christopher Müller. - Added new any_selection to handleNodeChange callback. - Modified so link/unlink is dimmed if nothing is selected. - Fixed bug when deleting images in Firefox. - Changed the plugin location to a new plugin directory. - Renamed the "theme_plugins" option to "plugins". -Version 1.31 (2004-09-18) - Added Canadian French language pack, contributed by Virtuelcom. - Added so link/unlink buttons gets selected when user enters a link element. - Fixed URL bug when drag dropping/copy pasting images in Mozilla. - Fixed so mso style attribs don't get trimmed if auto_cleanup_word option is set to false. - Fixed bug with text alignment buttons. - Fixed bug with CSS auto import function in MSIE. - Fixed initialization bugs and issues. -Version 1.30 (2004-09-10) - Fixed bug issue where the editor was stealing focus from location bar. - Fixed bug issue with absolute aligned images lost focus when using tools. - Fixed bug #1025483, Url converting broken. - Added ability to send command values in advanced theme button list, contributed by someone helpfull. - Added new cleanup_on_startup option, to increase startup speed. - Added new inline_styles partly based on a contribution by Victor Nilsson. - Added new named anchor support. - Added custom_undo_redo_levels option. -Version 1.29 (2004-09-08) - Added new getEditorId function, to retrive the editor id of a form element. - Readded so cleanup is automaticly executed on editor startup in MSIE. - Added some various cleanup fixes for MS Word HTML. - Added new auto_cleanup_word option, enabled auto MS Word HTML cleanup on paste events. - Fixed parameter issue with insertImage function. Bug #1022863. - Fixed bug #1022874, Where the small theme had underline command on strikethrough button. - Fixed some bugs with table commands. - Fixed bug #1023204, mceRemoveControl brings back the old HTML. - Fixed bug issue with tinyMCE.selectedInstance in Mozilla. - Fixed bug issue with Mozilla not saving content. -Version 1.28 (2004-09-04) - Added new Finnish language pack thanks to Urho Konttori. - Added new rowseparator as a possible value of the theme_advanced_buttons options. - Added new theme_advanced_toolbar_location option. - Added new uid variable option to valid_elements. (Generates unique IDs) - Added new "directionality" option to support languages like Arabic. - Added new character map button/window. - Added new guidelines/visual aid toggle button. - Reduced the source of the advanced theme some, and added some better comments. - Separated the default theme in to files aswell. - Removed source area size options and made source editor resizable instead. - Increased the default width and height of the source editor. - Fixed bug where image width/height default to 0x0 if these attributes wasn't defined. - Fixed some bug issues with MSIE 5.5. -Version 1.27 (2004-08-29) - Added new cleanup logic, with new options and smarter behavior. - Added new "trim_span_elements" option (removed unneeded span elements). - Added new "verify_css_classes" option (verifies so class attributes contain a valid class). - Added new "verify_html" option (enables/disabled verification of elements and attributes). - Added new value verification type to "valid_elements" option. - Added new simple wildcard support in "valid_elements" option. - Added class as a valid attribute to table elements by default. - Added so non existent classes gets removed HTML output. - Added fix for   entities, so they get converted correctly. - Added new class select box in table dialog. - Added hr as a default valid element. - Fixed some issues with the language packs. - Fixed some weird bugs and issues with hr elements. - Fixed bug where Mozilla was casting exceptions on keypress. -Version 1.26 (2004-08-25) - Added a better way to create theme popup windows (External files). - Added new getWindowArg function, returns window arguments in theme popups. - Modified the advanced theme to adopt the new theme popup idea. - Fixed critical Mozilla bug, where the editor didn't work at all some times. - Fixed bug with auto CSS class import feature running on Firefox. -Version 1.25 (2004-08-22) - Added new format select box in advanced theme (Can be disabled). - Added new "theme_advanced_disable" option to advanced theme. - Added some new elements to default list of valid elements (Format select box elements). - Added new font face, forecolor and font size support, these are not enabled by default. - Added new "mceAddControl" command, enables users to dynamicly add editors. - Added new execInstanceCommand function, check the documentation for details. - Added new "mceSetAttribute" command. - Modified the themes so that the focus alert doesn't popup as often as before. - Modified the "mceRemoveControl" command so it can handle element id aswell as editor ids. - Fixed some bugs and issues with the new custom undo/redo logic. - Fixed weird Mozilla bug #997860. -Version 1.24 (2004-08-17) - Modified so that span with CSS classes that don't exists get removed. - Added new "custom_undo_redo" option, this option is enabled by default. - Added new "fix_content_duplication" option, that fixes some MSIE content duplication issues. - Added new "mceFocus" command, that changes focus to the specified editor instance. - Added new "mceReplaceContent" command, that enables users to replace the current selection. - Fixed so styles including spaces doesn't get listed in style selection box. - Fixed bug with form element names and exact mode in Mozilla. - Fixed so tiny_mce_src.js can be used aswell as tiny_mce.js. - Converted some of the language packs to better support unicode. -Version 1.23 (2004-07-31) - Modified the mceSetCSSClass command to address bug #997071. - Added new Hungarian language pack thanks to 2XP. - Added new callback "setupcontent_callback" check the manual for details. - Fixed bug #994506, where empty theme_plugins option generated a 404 error. - Fixed bug #999332, where image properties wasn't removed if the user deleted the image. -Version 1.22 (2004-07-19) - Fixed bug #989846, Image resize bug. - Changed so that style attribute values get converted to lowercase in MSIE. - Changed so the alignment called "middle" is "center" in table properties. - Fixed so visual aids work correctly after using the source editor. - Fixed some issues with anchor links. - Fixed so that javascript: links can be used. - Added width/height options for the advanced source editor. - Fixed bug issue with URL:s containing quotes or single quotes. - Fixed so that document_base_url can point to another domain. -Version 1.21 (2004-07-12) - Added new "theme_plugins" option, check the manuals for details. - Added new "execCommand" plugin extention possibility. - Added new "buttons" config options to the advanced theme. - Added new "mceRemoveControl" command. - Added Spanish language pack thanks to "Alvaro Velasco". - Fixed first click bug. - Fixed so CSS url:s can be absolute. - Updated the FAQ regarding the Cut/Copy/Paste issue. -Version 1.20 (2004-07-05) - Fixed bug issue #983257, JS runtime error when template contains no controls. - Removed cut/copy/paste commands and icons due to security reasons in Mozilla. - Added Czech language pack, thanks goes to "Pavel Novák" for the contribution. - Fixed minor bug regarding empty attributes. - Fixed so the "extended_valid_elements" overrides previous declarations. -Version 1.19 (2004-06-28) - Fixed focus bug that appared on Linux version of Mozilla. - Fixed major bug issues with some Firefox/Firebird versions on Linux. - Fixed minor visual aid bugs on tables. - Fixed minor bugs with table commands. - Fixed scroll issue in HTML source windows on Mozilla/Linux. - Added a compatiblity chart to the manuals. -Version 1.18 (2004-06-20) - Added new option "remove_script_host". - Some minor fixes to the mceInsertContent command. - Fixed some issues with visual aids for tables. - Fixed strange focus bug in MSIE. - Updated some of the documentation. -Version 1.17 (2004-06-16) - Fixed bug, #972666 - Doesn't save edits when id != name. - Added more Italian, user manuals. Thanks goes to "Fabrix Xm". - Added Dutch language pack thanks to "Meint Post". - Modified the MSIE version of mceInsertContent command. -Version 1.16 (2004-06-14) - Added new table dialog and TinyMCE__getInsertTableTemplate template function. - Added auto class import feature and Italian language pack thanks goes to "Lorenzo Pavani". - Added border, alignment, vspace, hspace, width, height fields to the image properties dialog in advanced theme. - Updates advanced theme help pages for Swedish and English. - Fixed some minor issues with the mceSetCSSClass command. - Fixed minor MSIE bug in built in default URL convertor. - Fixed some image alignment issues. - Fixed support for site root script paths like src="/jscripts/tiny_mce.js". - Removed the use of "TinyMCE_advanced_cssClasses" from "advanced" theme. - Modified the default value of "valid_elements" to include table align and class as valid attributes. - Modified the default value of "valid_elements" to set img border attribute to 0 by default instead of by force. - Modified so that popup windows gets centered on screen. -Version 1.15 (2004-06-09) - Added new "advanced" theme, that adds some new functions. - Added new public js functions "getContent, setContent, applyTemplate, openWindow". - Added new custom command "mceSetCSSClass", that sets css class of the selection. - Added new custom command "mceInsertContent", that inserts HTML content. - Added class attributes to some of the elements in the default value of "valid_elements". - Added ability to have theme specific language packs by the js function "importThemeLanguagePack". - Added more documentation to the usage and themes sections. - Added table support, with custom commands and in advanced theme. - Modified the advanced example to include the new advanced theme. - Fixed tooltips for buttons in Mozilla. -Version 1.14 (2004-06-07) - Added new conversion possibility to save callback. - Added some more usage documentation. - Fixed some issues will updateContent function in Mozilla. - Fixed some issues with relative paths. - Fixed small Mozilla issue with visual aids. - Fixed so that the default theme sets image border to 0. - Fixed bug #968079, Removing editor buttons in template can cause errors. -Version 1.13 (2004-06-04) - Fixed critical bug where the editor didn't work at all in MSIE. - Fixed bug where table visual aids didn't work in Mozilla. -Version 1.12 (2004-06-03) - Added updateContent function thanks to "Jürgen Baute" contribution. - Added documentation of the diffrent public javascript functions of tinyMCE. - Fixed bug #965615, Empty editor content returns "
    " as value after cleanup. - Fixed bug where Bold and Italic didn't work correctly in Mozilla. -Version 1.11 (2004-06-01) - Added new option "document_base_url", it's used when converting absolute URLs to relative ones. - Added so that align button sets the align attribute of selected images. - Fixed bug when / was passed within query string to the editors page. - Fixed bug #961041, Image attributes are not removed. -Version 1.1 (2004-05-26) - Fixed bug #960112 JavaScript error when opening image window. - Fixed bug #926644 Multiple forms with elements having the same name failed. - Added function so that "specific_textareas" mode handles the "ask" option. - Added new option "focus_alert", to remove annoying focus alert message. -Version 1.09 (2004-05-24) - Added new option "extended_valid_elements", this option adds extra elements to the "valid_elements" list. - Fixed bug #958637, Resized images are displayed in original size - Fixed bug #958942, Bug on realitive_urls (Bug with absolute URLs to insertlink_callback, insertimage_callback callbacks) - Fixed bug #958498, Unable to change Bold and italic text in Mozilla. -Version 1.08 (2004-05-21) - Added new attributes "border, hspace, vspace, width, height, align" to the getInsertImageTemplate theme function. - Added new relative_urls option, this new feature converts all absolute URLs to relative URLs and it's on by default. - Fixed bug #956007, the CSS theme URL:s was allways pointing to the default theme. - Fixed bug where enter/return key produced a error in the insert link popup window form. (This was done in the default template) - Fixed bug #957681, Could not delete text without first adding character bug in Mozilla. -Version 1.07 (2004-05-10) - Added experimental support for option "force_br_newlines" to address bug #922416 and feature request #936270. - Fixed bug with mailto: links. -Version 1.06 (2004-04-15) - Added new German language pack. Thanks goes to "Simon Rupf" for the contribution. - Added new German/Swedish bold/italic language specific icons to both default and simple theme. - Added new Swedish documentation. -Version 1.05 (2004-04-02) - Added new Italian language pack and documentation. Thanks goes to "Fabrix Xm" for the contribution. - Fixed missing "lang_help_desc" definition in UK and SE langpacks. - Added better documentation for the "valid_elements" option and it's format. - Added new "preformatted" option to address feature request #927948. - Added browser checker so that the script don't break on non compatible browsers. - Fixed bug #926639, now the editor instance gets resized if a width/height is specified in %. - Added new simple theme, this theme has only basic functions. -Version 1.04 (2004-03-30) - Fixed bug when insertLink and insertImage function didn't use the url_convertor callback. - Fixed MSIE bug when images was 32x32 on initialization on slow connections. - Fixed bug that made request on images with wrong path, produced some 404 error in webserver logs. - Fixed MSIE bug where users could add images outside of the editor scope. -Version 1.03 (2004-03-26) - Added new "add_form_submit_trigger" this option is default and is added on all document forms within the page. To address bug #923362 - Moved javascript sourcecode file to "jscripts/tiny_mce/tiny_mce_src.js". - Added new obfuscated version of tinymce to reduce size of script. - Added some performance boosting code to the switchClassSticky function. - Removed the "autosave" option, this is no longer needed and is replaced with "add_form_submit_trigger" or triggerSave call. - Fixed undo bug in MSIE. - Removed some unused eventhandlers results in better performance. -Version 1.02 (2004-03-26) - Added new handleNodeChange callback to themes. - Fixed some bugs regarding events and themes function checks. - Fixed bug issue when user focused nodes with keyboard. -Version 1.01 (2004-03-12) - Added some more documentation. - Added new "visual" option to editor. - Fixed bug on empty P elements. - Fixed bug on table width/height. -Version 1.0 (2004-03-11) - Added new "debug" option and fixed some path issues. diff --git a/vendor/plugins/tiny_mce/docs/readme b/vendor/plugins/tiny_mce/docs/readme deleted file mode 100644 index 77db08433..000000000 --- a/vendor/plugins/tiny_mce/docs/readme +++ /dev/null @@ -1,3 +0,0 @@ -Documentation available online at - -http://tinymce.moxiecode.com/documentation.php \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/lib/tiny_mce_helper.rb b/vendor/plugins/tiny_mce/lib/tiny_mce_helper.rb index 472fe6ad9..629c551b6 100644 --- a/vendor/plugins/tiny_mce/lib/tiny_mce_helper.rb +++ b/vendor/plugins/tiny_mce/lib/tiny_mce_helper.rb @@ -1,15 +1,16 @@ module TinyMCEHelper class InvalidOption < Exception end - + def using_tiny_mce? !@uses_tiny_mce.nil? end - + def tiny_mce_init(options = @tiny_mce_options) options ||= {} - default_options = {:mode => 'textareas', - :theme => 'simple'} + default_options = { :mode => 'textareas', + :editor_selector => 'mceEditor', + :theme => 'simple' } options = default_options.merge(options) TinyMCE::OptionValidator.plugins = options[:plugins] tinymce_js = "tinyMCE.init({\n" @@ -20,7 +21,7 @@ def tiny_mce_init(options = @tiny_mce_options) tinymce_js += "#{key} : " case value when String, Symbol, Fixnum - tinymce_js += "'#{value}'" + tinymce_js += "'#{value.to_s}'" when Array tinymce_js += '"' + value.join(',') + '"' when TrueClass @@ -37,12 +38,26 @@ def tiny_mce_init(options = @tiny_mce_options) javascript_tag tinymce_js end alias tiny_mce tiny_mce_init - - def javascript_include_tiny_mce - javascript_include_tag RAILS_ENV == 'development' ? "tiny_mce/tiny_mce_src" : "tiny_mce/tiny_mce" + + def tiny_mce_init_if_needed + tiny_mce_init if @uses_tiny_mce end - - def javascript_include_tiny_mce_if_used - javascript_include_tiny_mce if @uses_tiny_mce + alias tiny_mce_if_needed tiny_mce_init_if_needed + + def include_tiny_mce_js + javascript_include_tag ((RAILS_ENV == 'development') ? "tiny_mce/tiny_mce_src" : "tiny_mce/tiny_mce") + end + alias javascript_include_tiny_mce include_tiny_mce_js + + def include_tiny_mce_js_if_needed + include_tiny_mce_js if @uses_tiny_mce + end + alias javascript_include_tiny_mce_if_used include_tiny_mce_js_if_needed + + def include_tiny_mce_if_needed + if @uses_tiny_mce + include_tiny_mce_js + tiny_mce_init + end end end \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advimage/js/image.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advimage/js/image.js index 0db894ca3..64fc6f677 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advimage/js/image.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advimage/js/image.js @@ -103,7 +103,7 @@ var ImageDialog = { if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { if (!f.alt.value) { - tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { + tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { if (s) t.insertAndClose(); }); diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js index 2efc1b731..a89625014 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js @@ -428,7 +428,6 @@ function setAllAttribs(elm) { var target = getSelectValue(formObj, 'targetlist'); setAttrib(elm, 'href', href); - setAttrib(elm, 'mce_href', href); setAttrib(elm, 'title'); setAttrib(elm, 'target', target == '_self' ? '' : target); setAttrib(elm, 'id'); @@ -464,7 +463,7 @@ function setAllAttribs(elm) { function getSelectValue(form_obj, field_name) { var elm = form_obj.elements[field_name]; - if (elm == null || elm.options == null) + if (!elm || elm.options == null || elm.selectedIndex == -1) return ""; return elm.options[elm.selectedIndex].value; diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js index 31423da17..727beb574 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js @@ -1 +1 @@ -(function(){tinymce.create('tinymce.plugins.FullPagePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceFullPageProperties',function(){ed.windowManager.open({file:url+'/fullpage.htm',width:430+parseInt(ed.getLang('fullpage.delta_width',0)),height:495+parseInt(ed.getLang('fullpage.delta_height',0)),inline:1},{plugin_url:url,head_html:t.head});});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);},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};},_setBodyAttribs:function(ed,o){var bdattr,i,len,kv,k,v,t,attr=this.head.match(/body(.*?)>/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);for(i=0,len=bdattr.length;i',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('\n';t.head+=ed.getParam('fullpage_default_doctype','');t.head+='\n\n\n'+ed.getParam('fullpage_default_title','Untitled document')+'\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='\n\n';t.foot='\n\n';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})(); \ No newline at end of file +(function(){tinymce.create('tinymce.plugins.FullPagePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceFullPageProperties',function(){ed.windowManager.open({file:url+'/fullpage.htm',width:430+parseInt(ed.getLang('fullpage.delta_width',0)),height:495+parseInt(ed.getLang('fullpage.delta_height',0)),inline:1},{plugin_url:url,head_html:t.head});});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);},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};},_setBodyAttribs:function(ed,o){var bdattr,i,len,kv,k,v,t,attr=this.head.match(/body(.*?)>/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(bdattr){for(i=0,len=bdattr.length;i',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('\n';t.head+=ed.getParam('fullpage_default_doctype','');t.head+='\n\n\n'+ed.getParam('fullpage_default_title','Untitled document')+'\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='\n\n';t.foot='\n\n';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})(); \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js index b91fb2975..019682d69 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 827 2008-04-29 15:02:42Z spocke $ + * $Id: editor_plugin_src.js 920 2008-09-09 14:05:33Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -51,21 +51,23 @@ if (attr && attr[1]) { bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g); - for(i = 0, len = bdattr.length; i < len; i++) { - kv = bdattr[i].split('='); - k = kv[0].replace(/\s/,''); - v = kv[1]; + if (bdattr) { + for(i = 0, len = bdattr.length; i < len; i++) { + kv = bdattr[i].split('='); + k = kv[0].replace(/\s/,''); + v = kv[1]; - if (v) { - v = v.replace(/^\s+/,'').replace(/\s+$/,''); - t = v.match(/^["'](.*)["']$/); + if (v) { + v = v.replace(/^\s+/,'').replace(/\s+$/,''); + t = v.match(/^["'](.*)["']$/); - if (t) - v = t[1]; - } else - v = k; + if (t) + v = t[1]; + } else + v = k; - ed.dom.setAttrib(ed.getBody(), 'style', v); + ed.dom.setAttrib(ed.getBody(), 'style', v); + } } } }, diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js index b22d28800..89059ef66 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js @@ -143,7 +143,7 @@ function init() { switch (eq.toLowerCase()) { case "content-type": - tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, value, 1); + tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1); // Override XML encoding if (tmp != "") @@ -374,7 +374,6 @@ function updateAction() { } function changedStyleField(field) { - //alert(field.id); } function setMeta(he, k, v) { diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js index 7b848f1e9..fbcec59e8 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js @@ -1 +1 @@ -(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})(); \ No newline at end of file +(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(tinymce.isIE&&(s.fullscreen_html_overflow=='visible'||s.fullscreen_html_overflow=='scroll'))s.fullscreen_html_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:'+(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel)?'absolute':'fixed')+';top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})(); \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js index ba43f27d5..77a8c3b9a 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 766 2008-04-03 20:37:06Z spocke $ + * $Id: editor_plugin_src.js 923 2008-09-09 16:45:29Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -60,6 +60,10 @@ if (tinymce.isIE && s.fullscreen_overflow == 'scroll') s.fullscreen_overflow = 'auto'; + // Fixes an IE bug where the scrollbars doesn't reappear + if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll')) + s.fullscreen_html_overflow = 'auto'; + if (s.fullscreen_overflow == '0px') s.fullscreen_overflow = ''; @@ -71,7 +75,7 @@ if (tinymce.isIE) vp.h -= 1; - n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:absolute;top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'}); + n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'}); DOM.add(n, 'div', {id : 'mce_fullscreen'}); tinymce.each(ed.settings, function(v, n) { diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js index 2ddf43ba9..b4fffe5a2 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js @@ -1 +1 @@ -(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','
    '));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&&t.editor.getParam('dialog_type')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{left:vp.x,top:vp.y,zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;iix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(w,ti){var e;w=this._findId(w);if(e=DOM.get(w+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_findId:function(w){var t=this;if(typeof(w)=='string')return w;each(t.windows,function(wo){var ifr=DOM.get(wo.id+'_ifr');if(ifr&&w==ifr.contentWindow){w=wo.id;return false;}});return w;},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})(); \ No newline at end of file +(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;t.windows={};},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','
    '));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&&t.editor.getParam('dialog_type','modal')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);if(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel))DOM.setStyles('mceModalBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w;if(w=t.windows[id]){w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;}},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;iix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(w,ti){var e;w=this._findId(w);if(e=DOM.get(w+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_findId:function(w){var t=this;if(typeof(w)=='string')return w;each(t.windows,function(wo){var ifr=DOM.get(wo.id+'_ifr');if(ifr&&w==ifr.contentWindow){w=wo.id;return false;}});return w;},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})(); \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js index 1d77c943f..0ae223b63 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 809 2008-04-17 14:41:31Z spocke $ + * $Id: editor_plugin_src.js 917 2008-09-03 19:08:38Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -35,6 +35,7 @@ t.parent(ed); t.zIndex = 300000; t.count = 0; + t.windows = {}; }, open : function(f, p) { @@ -237,7 +238,6 @@ }); // Add window - t.windows = t.windows || {}; w = t.windows[id] = { id : id, mousedown_func : mdf, @@ -254,17 +254,20 @@ }); // Setup blocker - if (t.count == 0 && t.editor.getParam('dialog_type') == 'modal') { + if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') { DOM.add(DOM.doc.body, 'div', { id : 'mceModalBlocker', 'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker', - style : {left : vp.x, top : vp.y, zIndex : t.zIndex - 1} + style : {zIndex : t.zIndex - 1} }); DOM.show('mceModalBlocker'); // Reduces flicker in IE } else DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1); + if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel)) + DOM.setStyles('mceModalBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2}); + t.focus(id); t._fixIELayout(id, 1); @@ -278,16 +281,18 @@ }, focus : function(id) { - var t = this, w = t.windows[id]; - - w.zIndex = this.zIndex++; - w.element.setStyle('zIndex', w.zIndex); - w.element.update(); + var t = this, w; - id = id + '_wrapper'; - DOM.removeClass(t.lastId, 'mceFocus'); - DOM.addClass(id, 'mceFocus'); - t.lastId = id; + if (w = t.windows[id]) { + w.zIndex = this.zIndex++; + w.element.setStyle('zIndex', w.zIndex); + w.element.update(); + + id = id + '_wrapper'; + DOM.removeClass(t.lastId, 'mceFocus'); + DOM.addClass(id, 'mceFocus'); + t.lastId = id; + } }, _addAll : function(te, ne) { @@ -349,8 +354,12 @@ DOM.add(d.body, 'div', { id : 'mceEventBlocker', 'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'), - style : {left : vp.x, top : vp.y, zIndex : t.zIndex + 1} + style : {zIndex : t.zIndex + 1} }); + + if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel)) + DOM.setStyles('mceEventBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2}); + eb = new Element('mceEventBlocker'); eb.update(); @@ -470,17 +479,17 @@ id = t._findId(id || win); - t.count--; - - if (t.count == 0) - DOM.remove('mceModalBlocker'); - // Probably not inline - if (!id && win) { + if (!t.windows[id]) { t.parent(win); return; } + t.count--; + + if (t.count == 0) + DOM.remove('mceModalBlocker'); + if (w = t.windows[id]) { t.onClose.dispatch(t); Event.remove(d, 'mousedown', w.mousedownFunc); diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css index 403692283..f844aba0d 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css @@ -6,9 +6,9 @@ /* General */ .clearlooks2 {position:absolute; direction:ltr} .clearlooks2 .mceWrapper {position:static} -.mceEventBlocker {position:absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} +.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} .clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50)} -.clearlooks2_modalBlocker {position:absolute; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none} +.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none} /* Top */ .clearlooks2 .mceTop, .clearlooks2 .mceTop div {top:0; width:100%; height:23px} diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin.js index 9c2c4bbf9..598649352 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin.js @@ -1 +1 @@ -(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.onPreInit.add(function(){ed.serializer.addRules('param[name|value|_value]');});ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return''});h=h.replace(/]*)>/gi,'');h=h.replace(/]*)\/>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/(object|embed)([^>]*)>/gi,'');h=h.replace(/]*)>/gi,function(a,b){return''});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam">');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.onPreInit.add(function(){ed.serializer.addRules('param[name|value|_value]');});ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};ed.selection.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.selection.onBeforeSetContent.add(t._objectsToSpans,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(t._objectsToSpans,t);ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_objectsToSpans:function(ed,o){var t=this,h=o.content;h=h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return''});h=h.replace(/]*)>/gi,'');h=h.replace(/]*)\/?>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/(object)([^>]*)>/gi,'');h=h.replace(/<\/embed>/gi,'');h=h.replace(/]*)>/gi,function(a,b){return''});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam">');o.content=h;},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';if(v)dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode','allowfullscreen','quality'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js index ebedd1273..8ed663e10 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 870 2008-06-13 09:25:41Z spocke $ + * $Id: editor_plugin_src.js 906 2008-08-24 16:47:29Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. @@ -52,6 +52,12 @@ mceItemRealMedia : 'realmedia' }; + ed.selection.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.selection.onBeforeSetContent.add(t._objectsToSpans, t); + if (ed.settings.content_css !== false) ed.dom.loadCSS(url + "/css/content.css"); @@ -78,24 +84,7 @@ } }); - ed.onBeforeSetContent.add(function(ed, o) { - var h = o.content; - - h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { - var o = t._parse(c); - - return '' - }); - - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)\/>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/<\/(object|embed)([^>]*)>/gi, ''); - h = h.replace(/]*)>/gi, function(a, b) {return ''}); - h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam">'); - - o.content = h; - }); + ed.onBeforeSetContent.add(t._objectsToSpans, t); ed.onSetContent.add(function() { t._spansToImgs(ed.getBody()); @@ -211,6 +200,25 @@ }, // Private methods + _objectsToSpans : function(ed, o) { + var t = this, h = o.content; + + h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { + var o = t._parse(c); + + return '' + }); + + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)\/?>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/<\/(object)([^>]*)>/gi, ''); + h = h.replace(/<\/embed>/gi, ''); + h = h.replace(/]*)>/gi, function(a, b) {return ''}); + h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam">'); + + o.content = h; + }, _buildObj : function(o, n) { var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title); @@ -230,12 +238,13 @@ p.src = ed.convertURL(p.src, 'src', n); each (p, function(v, k) { - if (!/^(width|height|codebase|classid)$/.test(k)) { + if (!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)) { // Use url instead of src in IE for Windows media if (o.type == 'application/x-mplayer2' && k == 'src') k = 'url'; - dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v}); + if (v) + dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v}); } }); @@ -324,7 +333,7 @@ }); // Setup base parameters - each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode'], function(na) { + each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality'], function(na) { var v = dom.getAttrib(n, na); if (v) diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/js/media.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/js/media.js index f04d5d9c3..28816d1e1 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/js/media.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/media/js/media.js @@ -183,7 +183,7 @@ function insertMedia() { tinyMCEPopup.restoreSelection(); if (!AutoValidator.validate(f)) { - alert(ed.getLang('invalid_data')); + tinyMCEPopup.alert(ed.getLang('invalid_data')); return false; } diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js index 4a35002b4..eeeebd5bb 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js @@ -1 +1 @@ -(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

    ');content=content.replace(/\r\r/g,'

    ');content=content.replace(/\n\n/g,'

    ');if((pos=content.indexOf('

    '))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

    ";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

    ";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
    ');content=content.replace(/\r/g,'
    ');content=content.replace(/\n/g,'
    ');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

    $1

    ');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
    ","gi"),"

    "+middot+"$1

    ");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
    ]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

     <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

    ','

    ','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

      

    ');content=content.replace(//gi,'

    ');content=content.replace(/<\/h[1-6]>/gi,'

    ');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(!this.editor.selection.isCollapsed())this.editor.execCommand("Delete");if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

    ');content=content.replace(/\r\r/g,'

    ');content=content.replace(/\n\n/g,'

    ');if((pos=content.indexOf('

    '))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

    ";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

    ";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
    ');content=content.replace(/\r/g,'
    ');content=content.replace(/\n/g,'
    ');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

    $1

    ');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
    ","gi"),"

    "+middot+"$1

    ");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
    ]+>/g,"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

     <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

    ','

    ','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

      

    ');content=content.replace(//gi,'

    ');content=content.replace(/<\/h[1-6]>/gi,'

    ');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i 0) { + // Delete any highlighted text before pasting + if (!this.editor.selection.isCollapsed()) + this.editor.execCommand("Delete"); + if (bLinebreaks) { // Special paragraph treatment if (this.editor.getParam("paste_create_paragraphs", true)) { @@ -172,7 +176,7 @@ if (ed.getParam('paste_insert_word_content_callback')) content = ed.execCallback('paste_insert_word_content_callback', 'before', content); - var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); for (var i=0; i', 'gi'), "" + bull); // Covert to bull list content = content.replace(/<\/o:p>/gi, ""); content = content.replace(new RegExp('
    |';});}h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'<':return'<';case'>':return'>';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.doc.getElementById(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE)u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
    ');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='
    '+o.content+'
    ';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(

    ( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
    ');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
    ']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fz=tinymce.explode(s.font_size_style_values),fzc=tinymce.explode(s.font_size_classes),h,bm;each(ed.dom.select('font'),function(e){e.style.fontSize='';});ed.getDoc().execCommand('FontSize',false,v);if(s.inline_styles){each(ed.dom.select('font'),function(e){if(e.parentNode.nodeName=='FONT'&&e.size==e.parentNode.size){if(!bm)bm=ed.selection.getBookmark();ed.dom.remove(e,1);return;}if(v=e.size){if(fzc&&fzc.length>0)ed.dom.setAttrib(e,'class',fzc[parseInt(v)-1]);else ed.dom.setStyle(e,'fontSize',fz[parseInt(v)-1]);}});}ed.selection.moveToBookmark(bm);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
    ');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

    '):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),dom.isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

    <\\\/p>||

    \\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

    [\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

    ( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
    \\s*<\\\/p>|

    \\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
    ');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
    ');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
    ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
    ');aft=ed.dom.add(sn,se.element,null,'
    ');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
    ';if(isEmpty(aft))aft.innerHTML=isOpera?' ':'
    ';if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(aft):aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y=items.length){for(i=0,l=base.length;i=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0,l=base.length-(bp-1);i=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);function ready(){if(!o.async||x.readyState==4||c++>10000){if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}else w.setTimeout(ready,10);};if(!o.async)return ready();t=w.setTimeout(ready,10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value"},DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,sr;e=t.get(e);p=t.getPos(e);sr=t.getSize(e);return{x:p.x,y:p.y,w:sr.w,h:sr.h};},getSize:function(e){var t=this,w,h;e=t.get(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName.toUpperCase()==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n,xp;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(!t.selectorRe)t.selectorRe=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;;if(tinymce.isAir){each(tinymce.explode(pa),function(v){if(!(xp=t.cache[v])){xp='';each(v.split(' '),function(v){v=t.selectorRe.exec(v);xp+=v[1]?'//'+v[1]:'//*';if(v[2])xp+="[@id='"+v[2]+"']";if(v[3]){each(v[3].split('.'),function(n){xp+="[@class = '"+n+"' or contains(concat(' ', @class, ' '), ' "+n+" ')]";});}});t.cache[v]=xp;}xp=t.doc.evaluate(xp,s,null,4,null);while(n=xp.iterateNext())o.push(n);});return o;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;t.setAttribs(e,a);if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(!e||!n)return;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(!is(v,'string')){each(v,function(v,n){t.setStyle(e,n,v);});return;}if(s.keep_values){if(v&&!t._isRes(v))e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;case"shape":e.setAttribute('mce_style',v);break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv='';if(/^(src|href|style|coords|shape)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}if(isIE&&t.props[n]){v=e[t.props[n]];v=v&&v.nodeValue?v.nodeValue:v;}if(!v)v=e.getAttribute(n,2);if(n==='style'){v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&!t._isRes(v))e.setAttribute('mce_style',v);}}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0'||v===20)v='';break;case'width':case'height':case'vspace':if(v===0)v='';break;case'hspace':if(v===-1)v='';break;case'maxlength':case'tabindex':if(v===32768||v===2147483647)v='';break;case'compact':case'noshade':if(v===65535)return n;return dv;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v!==undefined&&v!==null&&v!=='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};st=st.replace(/&(#?[a-z0-9]+);/g,'&$1_MCE_SEMI_');each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/_MCE_SEMI_/g,';');v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null)+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){if(tinymce.isGecko&&k.indexOf('-moz-')===0)return;switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='
    '+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='
    '+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/

    <\/p>|]+)><\/p>|/gi,' 

    ');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/]+)>|

    /g,'');h=h.replace(/<\/p>/g,'

    ');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x|]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|]+)>/gi,'<$1i$2>');}else if(isIE)h=h.replace(/'/g,''');h=h.replace(/]+)\/>|/gi,'
    ');if(s.keep_values){h=h.replace(//g,'');if(/|\/\/\s*-->|\]\]>|-->)\s*$/g,'');return s;};h=h.replace(/]+|)>([\s\S]*?)<\/script>/g,function(v,a,b){b=trim(b);if(!a)a=' type="text/javascript"';if(b)b='';return''+b+'';});h=h.replace(/]+|)>([\s\S]*?)<\/style>/g,function(v,a,b){b=trim(b);return''+b+'';});}h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'<':return'<';case'>':return'>';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.get(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE||(tinymce.isOpera&&parseFloat(opera.version())>=9.5))u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{if(!s.readonly)d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);if(!s.readonly)b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,element_format:s.element_format,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;if(!s.readonly)t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
    ');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='
    '+o.content+'
    ';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(

    ( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,'');});}if(isGecko&&!s.readonly){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language||'en',i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[(this.settings.language||'en')+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
    ');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko&&!s.readonly){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){var c=e.keyCode;if((c>=33&&c<=36)||(c>=37&&c<=40)||c==13||c==45||c==46||c==8||(tinymce.isMac&&(c==91||c==93))||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
    ']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;function isBlock(n){return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName);};tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else{if(ed.settings.convert_fonts_to_spans)t._applyInlineStyle('span',{style:{fontFamily:v}});else ed.getDoc().execCommand('FontName',false,v);}},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fc,fs;if(s.convert_fonts_to_spans&&v>=1&&v<=7){fs=tinymce.explode(s.font_size_style_values);fc=tinymce.explode(s.font_size_classes);if(fc)v=fc[v-1]||v;else v=fs[v-1]||v;}if(v>=1&&v<=7)ed.getDoc().execCommand('FontSize',false,v);else this._applyInlineStyle('span',{style:{fontSize:v}});},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontSize;if(!v&&(isOpera||isWebKit)){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return v||this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontFamily.replace(/, /g,',').replace(/[\'\"]/g,'').toLowerCase();if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(bl||n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(bl&&/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(bl||n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
    ');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if((e=t.getSelectedElement())&&!ed.settings.force_span_wrappers)set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(ed.settings.force_span_wrappers&&p.nodeName!='SPAN')return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},ForeColor:function(ui,v){var ed=this.editor;if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{color:v}});return;}else ed.getDoc().execCommand('ForeColor',false,v);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{backgroundColor:val}});return;}function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

    '):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!ed.settings.inline_styles&&!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE'));},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),isBlock);eb=dom.getParent(s.getEnd(),isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_applyInlineStyle:function(na,at,op){var t=this,ed=t.editor,dom=ed.dom,bm,lo={},kh;na=na.toUpperCase();if(op&&op.check_classes&&at['class'])op.check_classes.push(at['class']);function replaceFonts(){var bm;each(dom.select(tinymce.isWebKit?'span':'font'),function(n){if(n.style.fontFamily=='mceinline'||n.face=='mceinline'){if(!bm)bm=ed.selection.getBookmark();at._mce_new='1';dom.replace(dom.create(na,at),n,1);}});each(dom.select(na),function(n){if(n.getAttribute('_mce_new')){function removeStyle(n){if(n.nodeType==1){each(at.style,function(v,k){dom.setStyle(n,k,'');});if(at['class']&&n.className&&op){each(op.check_classes,function(c){if(dom.hasClass(n,c))dom.removeClass(n,c);});}}};each(dom.select(na,n),removeStyle);if(n.parentNode&&n.parentNode.nodeType==1&&n.parentNode.childNodes.length==1)removeStyle(n.parentNode);dom.getParent(n.parentNode,function(pn){if(pn.nodeType==1){if(at.style){each(at.style,function(v,k){var sv;if(!lo[k]&&(sv=dom.getStyle(pn,k))){if(sv===v)dom.setStyle(n,k,'');lo[k]=1;}});}if(at['class']&&pn.className&&op){each(op.check_classes,function(c){if(dom.hasClass(pn,c))dom.removeClass(n,c);});}}return false;});n.removeAttribute('_mce_new');}});each(dom.select(na).reverse(),function(n){var c=0;each(dom.getAttribs(n),function(an){if(an.nodeName.substring(0,1)!='_'&&dom.getAttrib(n,an.nodeName)!=''){c++;}});if(c==0)dom.remove(n,1);});ed.selection.moveToBookmark(bm);return!!bm;};ed.focus();ed.getDoc().execCommand('FontName',false,'mceinline');replaceFonts();if(kh=t._applyInlineStyle.keyhandler){ed.onKeyUp.remove(kh);ed.onKeyPress.remove(kh);ed.onKeyDown.remove(kh);ed.onSetContent.remove(t._applyInlineStyle.chandler);}if(ed.selection.isCollapsed()){t._pendingStyles=tinymce.extend(t._pendingStyles||{},at.style);t._applyInlineStyle.chandler=ed.onSetContent.add(function(){delete t._pendingStyles;});t._applyInlineStyle.keyhandler=kh=function(e){if(t._pendingStyles){at.style=t._pendingStyles;delete t._pendingStyles;}if(replaceFonts()){ed.onKeyDown.remove(t._applyInlineStyle.keyhandler);ed.onKeyPress.remove(t._applyInlineStyle.keyhandler);}if(e.type=='keyup')ed.onKeyUp.remove(t._applyInlineStyle.keyhandler);};ed.onKeyDown.add(kh);ed.onKeyPress.add(kh);ed.onKeyUp.add(kh);}else t._pendingStyles=0;},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),isBlock);eb=dom.getParent(en||s.getEnd(),isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

    <\\\/p>||

    \\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

    [\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

    ( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
    \\s*<\\\/p>|

    \\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
    ');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
    ');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
    ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i,n;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(r.startContainer.nodeType==1&&(n=r.startContainer.childNodes[r.startOffset])&&n.nodeType==1){n.setAttribute("id","__mce");}else{if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}else if(!isIE&&(n=ed.dom.get('__mce'))){n.removeAttribute('id');r=d.createRange();r.setStartBefore(n);r.setEndBefore(n);se.setRng(r);}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch,car;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
    ');aft=ed.dom.add(sn,se.element,null,'
    ');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
    ';function appendStyles(e,en){var nl=[],nn,n,i;e.innerHTML='';if(se.keep_styles){n=en;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)){nn=n.cloneNode(false);dom.setAttrib(nn,'id','');nl.push(nn);}}while(n=n.parentNode);}if(nl.length>0){for(i=nl.length-1,nn=e;i>=0;i--)nn=nn.appendChild(nl[i]);nl[0].innerHTML=isOpera?' ':'
    ';return nl[0];}else e.innerHTML=isOpera?' ':'
    ';};if(isEmpty(aft))car=appendStyles(aft,en);if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(car||aft):car||aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y]+)/gi, ' $1="$2"') + // Replace a=x with a="x" in IE + if (tinymce.isIE) + h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') + + document.dir = t.editor.getParam('directionality',''); + + if ((nv = t.editor.translate(h)) && nv != h) + document.body.innerHTML = nv; + + if ((nv = t.editor.translate(ti)) && nv != ti) + document.title = ti = nv; + } - document.dir = t.editor.getParam('directionality',''); - document.body.innerHTML = t.editor.translate(h); - document.title = ti = t.editor.translate(ti); document.body.style.display = ''; // Restore selection in IE when focus is placed on a non textarea or input element of the type text diff --git a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/tiny_mce_src.js b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/tiny_mce_src.js index eeaab3b1e..24979606e 100755 --- a/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/tiny_mce_src.js +++ b/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/tiny_mce_src.js @@ -3,8 +3,8 @@ var tinymce = { majorVersion : '3', - minorVersion : '1.0.1', - releaseDate : '2008-06-18', + minorVersion : '2.0.2', + releaseDate : '2008-10-02', _init : function() { var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v; @@ -17,6 +17,7 @@ var tinymce = { t.isIE6 = t.isIE && /MSIE [56]/.test(ua); t.isGecko = !t.isWebKit && /Gecko/.test(ua); t.isMac = ua.indexOf('Mac') != -1; + t.isAir = /adobeair/i.test(ua); // TinyMCE .NET webcontrol might be setting the values for TinyMCE if (w.tinyMCEPreInit) { @@ -511,7 +512,7 @@ tinymce.create('tinymce.util.Dispatcher', { u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u; // Relative path - if (u.indexOf('://') === -1 && u.indexOf('//') !== 0) + if (u.indexOf(':/') === -1 && u.indexOf('//') !== 0) u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u); // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) @@ -564,6 +565,9 @@ tinymce.create('tinymce.util.Dispatcher', { toRelative : function(u) { var t = this, o; + if (u === "./") + return u; + u = new tinymce.util.URI(u, {base_uri : t}); // Not on same domain/port or protocol @@ -590,7 +594,7 @@ tinymce.create('tinymce.util.Dispatcher', { }, toRelPath : function(base, path) { - var items, bp = 0, out = '', i; + var items, bp = 0, out = '', i, l; // Split the paths base = base.substring(0, base.lastIndexOf('/')); @@ -598,7 +602,7 @@ tinymce.create('tinymce.util.Dispatcher', { items = path.split('/'); if (base.length >= items.length) { - for (i = 0; i < base.length; i++) { + for (i = 0, l = base.length; i < l; i++) { if (i >= items.length || base[i] != items[i]) { bp = i + 1; break; @@ -607,7 +611,7 @@ tinymce.create('tinymce.util.Dispatcher', { } if (base.length < items.length) { - for (i = 0; i < items.length; i++) { + for (i = 0, l = items.length; i < l; i++) { if (i >= base.length || base[i] != items[i]) { bp = i + 1; break; @@ -618,10 +622,10 @@ tinymce.create('tinymce.util.Dispatcher', { if (bp == 1) return path; - for (i = 0; i < base.length - (bp - 1); i++) + for (i = 0, l = base.length - (bp - 1); i < l; i++) out += "../"; - for (i = bp - 1; i < items.length; i++) { + for (i = bp - 1, l = items.length; i < l; i++) { if (i != bp - 1) out += "/" + items[i]; else @@ -803,7 +807,7 @@ tinymce.create('static tinymce.util.JSON', { if (t == 'string') { v = '\bb\tt\nn\ff\rr\""\'\'\\\\'; - return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g, function(a, b) { + return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) { i = v.indexOf(b); if (i + 1) @@ -977,6 +981,17 @@ tinymce.create('static tinymce.util.XHR', { idPattern : /^#[\w]+$/, elmPattern : /^[\w_*]+$/, elmClassPattern : /^([\w_]*)\.([\w_]+)$/, + props : { + "for" : "htmlFor", + "class" : "className", + className : "className", + checked : "checked", + disabled : "disabled", + maxlength : "maxLength", + readonly : "readOnly", + selected : "selected", + value : "value" + }, DOMUtils : function(d, s) { var t = this; @@ -1030,10 +1045,24 @@ tinymce.create('static tinymce.util.XHR', { }, getRect : function(e) { - var p, t = this, w, h; + var p, t = this, sr; e = t.get(e); p = t.getPos(e); + sr = t.getSize(e); + + return { + x : p.x, + y : p.y, + w : sr.w, + h : sr.h + }; + }, + + getSize : function(e) { + var t = this, w, h; + + e = t.get(e); w = t.getStyle(e, 'width'); h = t.getStyle(e, 'height'); @@ -1046,8 +1075,6 @@ tinymce.create('static tinymce.util.XHR', { h = 0; return { - x : p.x, - y : p.y, w : parseInt(w) || e.offsetWidth || e.clientWidth, h : parseInt(h) || e.offsetHeight || e.clientHeight }; @@ -1116,7 +1143,7 @@ tinymce.create('static tinymce.util.XHR', { // #if !jquery select : function(pa, s) { - var t = this, cs, c, pl, o = [], x, i, l, n; + var t = this, cs, c, pl, o = [], x, i, l, n, xp; s = t.get(s) || t.doc; @@ -1140,6 +1167,44 @@ tinymce.create('static tinymce.util.XHR', { return l; } + if (!t.selectorRe) + t.selectorRe = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;; + + // Air doesn't support eval due to security sandboxing and querySelectorAll isn't supported yet + if (tinymce.isAir) { + each(tinymce.explode(pa), function(v) { + if (!(xp = t.cache[v])) { + xp = ''; + + each(v.split(' '), function(v) { + v = t.selectorRe.exec(v); + + xp += v[1] ? '//' + v[1] : '//*'; + + // Id + if (v[2]) + xp += "[@id='" + v[2] + "']"; + + // Class + if (v[3]) { + each(v[3].split('.'), function(n) { + xp += "[@class = '" + n + "' or contains(concat(' ', @class, ' '), ' " + n + " ')]"; + }); + } + }); + + t.cache[v] = xp; + } + + xp = t.doc.evaluate(xp, s, null, 4, null); + + while (n = xp.iterateNext()) + o.push(n); + }); + + return o; + } + if (t.settings.strict) { function get(s, n) { return s.getElementsByTagName(n.toLowerCase()); @@ -1226,7 +1291,7 @@ tinymce.create('static tinymce.util.XHR', { pl = v.split(' '); each(pl, function(v) { - var p = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v); + var p = t.selectorRe.exec(v); // Find elements p[1] = p[1] || '*'; @@ -1284,19 +1349,7 @@ tinymce.create('static tinymce.util.XHR', { var e, k; e = is(n, 'string') ? t.doc.createElement(n) : n; - - if (a) { - for (k in a) { - if (a.hasOwnProperty(k) && !is(a[k], 'object')) - t.setAttrib(e, k, '' + a[k]); - } - - if (a.style && !is(a.style, 'string')) { - each(a.style, function(v, n) { - t.setStyle(e, n, v); - }); - } - } + t.setAttribs(e, a); if (h) { if (h.nodeType) @@ -1458,6 +1511,10 @@ tinymce.create('static tinymce.util.XHR', { setAttrib : function(e, n, v) { var t = this; + // Whats the point + if (!e || !n) + return; + // Strict XML mode if (t.settings.strict) n = n.toLowerCase(); @@ -1467,6 +1524,14 @@ tinymce.create('static tinymce.util.XHR', { switch (n) { case "style": + if (!is(v, 'string')) { + each(v, function(v, n) { + t.setStyle(e, n, v); + }); + + return; + } + // No mce_style for elements with these since they might get resized by the user if (s.keep_values) { if (v && !t._isRes(v)) @@ -1526,7 +1591,7 @@ tinymce.create('static tinymce.util.XHR', { return false; if (!is(dv)) - dv = ""; + dv = ''; // Try the mce variant for these if (/^(src|href|style|coords|shape)$/.test(n)) { @@ -1536,38 +1601,23 @@ tinymce.create('static tinymce.util.XHR', { return v; } - v = e.getAttribute(n, 2); - - if (!v) { - switch (n) { - case 'class': - v = e.className; - break; - - default: - // Fix for IE crash Bug: #1884376 probably due to invalid DOM structure - if (isIE && n === 'name' && e.nodeName === 'A') { - v = e.name; - break; - } - - v = e.attributes[n]; - v = v && is(v.nodeValue) ? v.nodeValue : v; - } + if (isIE && t.props[n]) { + v = e[t.props[n]]; + v = v && v.nodeValue ? v.nodeValue : v; } - switch (n) { - case 'style': - v = v || e.style.cssText; + if (!v) + v = e.getAttribute(n, 2); - if (v) { - v = t.serializeStyle(t.parseStyle(v)); + if (n === 'style') { + v = v || e.style.cssText; - if (t.settings.keep_values && !t._isRes(v)) - e.setAttribute('mce_style', v); - } + if (v) { + v = t.serializeStyle(t.parseStyle(v)); - break; + if (t.settings.keep_values && !t._isRes(v)) + e.setAttribute('mce_style', v); + } } // Remove Apple and WebKit stuff @@ -1587,7 +1637,15 @@ tinymce.create('static tinymce.util.XHR', { case 'size': // IE returns +0 as default value for size - if (v === '+0') + if (v === '+0' || v === 20) + v = ''; + + break; + + case 'width': + case 'height': + case 'vspace': + if (v === 0) v = ''; break; @@ -1599,19 +1657,20 @@ tinymce.create('static tinymce.util.XHR', { break; + case 'maxlength': case 'tabindex': // IE returns default value - if (v === 32768) + if (v === 32768 || v === 2147483647) v = ''; break; - case 'maxlength': - // IE returns default value - if (v === 2147483647) - v = ''; + case 'compact': + case 'noshade': + if (v === 65535) + return n; - break; + return dv; case 'shape': v = v.toLowerCase(); @@ -1624,7 +1683,7 @@ tinymce.create('static tinymce.util.XHR', { } } - return (v && v != '') ? '' + v : dv; + return (v !== undefined && v !== null && v !== '') ? '' + v : dv; }, getPos : function(n) { @@ -2002,6 +2061,8 @@ tinymce.create('static tinymce.util.XHR', { // Store away src and href in mce_src and mce_href since browsers mess them up if (s.keep_values) { + h = h.replace(//g, ''); + // Wrap scripts and styles in comments for serialization purposes if (/_')); - t.select(t.dom.get('__caret')); - t.getRng().deleteContents(); - return; - } + // Make caret marker since insertNode places the caret in the beginning of text after insert + h += '_'; - // Use insert HTML if it exists (places cursor after content) - try { - // This might fail with an exception see bug #1893736 - if (d.queryCommandEnabled('InsertHTML')) - return d.execCommand('InsertHTML', false, h); - } catch (ex) { - // Use old school method - r.deleteContents(); - r.insertNode(t.getRng().createContextualFragment(h)); - } + // Delete and insert new node + r.deleteContents(); + r.insertNode(t.getRng().createContextualFragment(h)); + + // Move to caret marker + c = t.dom.get('__caret'); + + // Make sure we wrap it compleatly, Opera fails with a simple select call + r = d.createRange(); + r.setStartBefore(c); + r.setEndAfter(c); + t.setRng(r); + + // Delete the marker, and hopefully the caret gets placed in the right location + d.execCommand('Delete', false, null); + + // In case it's still there + t.dom.remove('__caret'); } else { if (r.item) { // Delete content and get caret text selection @@ -2875,6 +2955,9 @@ tinymce.create('static tinymce.util.XHR', { r.pasteHTML(h); } + + // Dispatch set content event + t.onSetContent.dispatch(t, s); }, getStart : function() { @@ -3235,7 +3318,7 @@ tinymce.create('static tinymce.util.XHR', { if (!r || r.item) return false; - return !s || r.boundingWidth == 0 || s.isCollapsed; + return !s || r.boundingWidth == 0 || r.collapsed; }, collapse : function(b) { @@ -3316,8 +3399,12 @@ tinymce.create('static tinymce.util.XHR', { // Handle selection a image or other control like element such as anchors if (!r.collapsed) { - if (r.startContainer == r.endContainer || (tinymce.isWebKit && r.startContainer == r.endContainer.parentNode)) { - if (r.startOffset - r.endOffset < 2 || tinymce.isWebKit) { + // If the anchor node is a element instead of a text node then return this element + if (tinymce.isWebKit && s.anchorNode && s.anchorNode.nodeType == 1) + return s.anchorNode.childNodes[s.anchorOffset]; + + if (r.startContainer == r.endContainer) { + if (r.startOffset - r.endOffset < 2) { if (r.startContainer.hasChildNodes()) e = r.startContainer.childNodes[r.startOffset]; } @@ -3417,6 +3504,10 @@ tinymce.create('static tinymce.util.XHR', { }, writeComment : function(v) { + // Fix for bug #2035694 + if (tinymce.isIE) + v = v.replace(/^\-|\-$/g, ' '); + this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' '))); }, @@ -3635,11 +3726,27 @@ tinymce.create('static tinymce.util.XHR', { indent_mode : 'simple', indent_char : '\t', indent_levels : 1, - remove_linebreaks : 1 + remove_linebreaks : 1, + remove_redundant_brs : 1, + element_format : 'xhtml' }, s); t.dom = s.dom; + if (s.remove_redundant_brs) { + t.onPostProcess.add(function(se, o) { + // Remove BR elements at end of list elements since they get rendered in IE + o.content = o.content.replace(/
    (\s*<\/li>)/g, '$1'); + }); + } + + // Remove XHTML element endings i.e. produce crap :) XHTML is better + if (s.element_format == 'html') { + t.onPostProcess.add(function(se, o) { + o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>'); + }); + } + if (s.fix_list_elements) { t.onPreProcess.add(function(se, o) { var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np; @@ -4076,7 +4183,8 @@ tinymce.create('static tinymce.util.XHR', { patterns : [ {pattern : /(]*>)(.*?)(<\/script>)/g}, {pattern : /(]*>)(.*?)(<\/style>)/g}, - {pattern : /(]*>)(.*?)(<\/pre>)/g, encode : 1} + {pattern : /(]*>)(.*?)(<\/pre>)/g, encode : 1}, + {pattern : /()/g} ] }); @@ -4120,6 +4228,9 @@ tinymce.create('static tinymce.util.XHR', { h = t._unprotect(h, p); + // Restore CDATA sections + h = h.replace(//g, ''); + // Restore the \u00a0 character if raw mode is enabled if (s.entity_encoding == 'raw') h = h.replace(/

     <\/p>|]+)> <\/p>/g, '\u00a0

    '); @@ -4247,8 +4358,14 @@ tinymce.create('static tinymce.util.XHR', { } // Padd empty nodes with a   - if (!hc && ru.padd) - w.writeText('\u00a0'); + if (ru.padd) { + // If it has only one bogus child, padd it anyway workaround for
    bug + if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) { + if (cn.hasAttribute ? cn.hasAttribute('mce_bogus') : cn.getAttribute('mce_bogus')) + w.writeText('\u00a0'); + } else if (!hc) + w.writeText('\u00a0'); // No children then padd it + } break; @@ -5341,34 +5458,58 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { t.classPrefix = 'mceListBox'; }, - select : function(v) { - var t = this, e, fv; + select : function(va) { + var t = this, fv, f; - // Do we need to do something? - if (v != t.selectedValue) { - e = DOM.get(t.id + '_text'); - t.selectedValue = v; + if (va == undefined) + return t.selectByIndex(-1); + + // Is string or number make function selector + if (va && va.call) + f = va; + else { + f = function(v) { + return v == va; + }; + } + // Do we need to do something? + if (va != t.selectedValue) { // Find item - each(t.items, function(o) { - if (o.value == v) { - DOM.setHTML(e, DOM.encode(o.title)); + each(t.items, function(o, i) { + if (f(o.value)) { fv = 1; + t.selectByIndex(i); return false; } }); - // If no item was found then present title - if (!fv) { + if (!fv) + t.selectByIndex(-1); + } + }, + + selectByIndex : function(idx) { + var t = this, e, o; + + if (idx != t.selectedIndex) { + e = DOM.get(t.id + '_text'); + o = t.items[idx]; + + if (o) { + t.selectedValue = o.value; + t.selectedIndex = idx; + DOM.setHTML(e, DOM.encode(o.title)); + DOM.removeClass(e, 'mceTitle'); + } else { DOM.setHTML(e, DOM.encode(t.settings.title)); DOM.addClass(e, 'mceTitle'); - e = 0; - return; - } else - DOM.removeClass(e, 'mceTitle'); - } + t.selectedValue = t.selectedIndex = null; + } - e = 0; + e = 0; + } else + t.selectedValue = t.selectedIndex = null; }, add : function(n, v, o) { @@ -5573,18 +5714,40 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { return DOM.get(this.id).disabled; }, - select : function(v) { - var e = DOM.get(this.id), ol = e.options; + select : function(va) { + var t = this, fv, f; - v = '' + (v || ''); + if (va == undefined) + return t.selectByIndex(-1); - e.selectedIndex = 0; - each(ol, function(o, i) { - if (o.value == v) { - e.selectedIndex = i; - return false; - } - }); + // Is string or number make function selector + if (va && va.call) + f = va; + else { + f = function(v) { + return v == va; + }; + } + + // Do we need to do something? + if (va != t.selectedValue) { + // Find item + each(t.items, function(o, i) { + if (f(o.value)) { + fv = 1; + t.selectByIndex(i); + return false; + } + }); + + if (!fv) + t.selectByIndex(-1); + } + }, + + selectByIndex : function(idx) { + DOM.get(this.id).selectedIndex = idx + 1; + this.selectedValue = this.items[idx] ? this.items[idx].value : null; }, add : function(n, v, a) { @@ -5630,12 +5793,14 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { t.rendered = true; function onChange(e) { - var v = e.target.options[e.target.selectedIndex].value; + var v = t.items[e.target.selectedIndex - 1]; - t.onChange.dispatch(t, v); + if (v = v.value) { + t.onChange.dispatch(t, v); - if (t.settings.onselect) - t.settings.onselect(v); + if (t.settings.onselect) + t.settings.onselect(v); + } }; Event.add(t.id, 'change', onChange); @@ -6073,18 +6238,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }, requireLangPack : function(n) { - var u, s; + var u, s = tinymce.EditorManager.settings; - if (tinymce.EditorManager.settings) { - u = this.urls[n] + '/langs/' + tinymce.EditorManager.settings.language + '.js'; - s = tinymce.EditorManager.settings; + if (s && s.language) { + u = this.urls[n] + '/langs/' + s.language + '.js'; - if (s) { - if (!tinymce.dom.Event.domLoaded && !s.strict_mode) - tinymce.ScriptLoader.load(u); - else - tinymce.ScriptLoader.add(u); - } + if (!tinymce.dom.Event.domLoaded && !s.strict_mode) + tinymce.ScriptLoader.load(u); + else + tinymce.ScriptLoader.add(u); } }, @@ -6137,8 +6299,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL); tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL); - // Setup document domain - if (tinymce.EditorManager.baseURI.host != lo.hostname && lo.hostname) + // User already specified a document.domain value + if (document.domain && lo.hostname != document.domain) + tinymce.relaxedDomain = document.domain; + + // Setup document domain if tinymce is loaded from other domain + if (!tinymce.relaxedDomain && tinymce.EditorManager.baseURI.host != lo.hostname && lo.hostname) document.domain = tinymce.relaxedDomain = lo.hostname.replace(/.*\.(.+\..+)$/, '$1'); // Add before unload listener @@ -6153,7 +6319,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { }, init : function(s) { - var t = this, pl, sl = tinymce.ScriptLoader, c, e; + var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed; function execCallback(se, n, s) { var f = se[n]; @@ -6259,9 +6425,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if(l.length > 0) { each(explode(l), function(v) { - if (DOM.get(v)) - new tinymce.Editor(v, s).render(1); - else { + if (DOM.get(v)) { + ed = new tinymce.Editor(v, s); + el.push(ed); + ed.render(1); + } else { c = 0; each(document.forms, function(f) { @@ -6269,7 +6437,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (e.name === v) { v = 'mce_editor_' + c; DOM.setAttrib(e, 'id', v); - new tinymce.Editor(v, s).render(1); + + ed = new tinymce.Editor(v, s); + el.push(ed); + ed.render(1); } }); }); @@ -6298,7 +6469,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (!v.id || t.get(v.id)) v.id = DOM.uniqueId(); - new tinymce.Editor(v.id, s).render(1); + ed = new tinymce.Editor(v.id, s); + el.push(ed); + ed.render(1); } }); break; @@ -6308,7 +6481,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { if (s.oninit) { l = co = 0; - each (t.editors, function(ed) { + each (el, function(ed) { co++; if (!ed.initialized) { @@ -6414,7 +6587,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { case "mceRemoveEditor": case "mceRemoveControl": - ed.remove(); + if (ed) + ed.remove(); + return true; case 'mceToggleEditor': @@ -6582,13 +6757,14 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; apply_source_formatting : 1, directionality : 'ltr', forced_root_block : 'p', - valid_elements : '@[id|class|style|title|dir= 9.5)) u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'; else if (tinymce.isOpera) u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()'; @@ -6923,7 +7101,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; // Design mode needs to be added here Ctrl+A will fail otherwise if (!isIE) { try { - d.designMode = 'On'; + if (!s.readonly) + d.designMode = 'On'; } catch (ex) { // Will fail on Gecko if the editor is placed in an hidden container element // The design mode will be set ones the editor is focused @@ -6935,7 +7114,10 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; // It will not steal focus if we hide it while setting contentEditable b = t.getBody(); DOM.hide(b); - b.contentEditable = true; + + if (!s.readonly) + b.contentEditable = true; + DOM.show(b); } @@ -6965,6 +7147,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; font_size_style_values : s.font_size_style_values, apply_source_formatting : s.apply_source_formatting, remove_linebreaks : s.remove_linebreaks, + element_format : s.element_format, dom : t.dom }); @@ -6988,7 +7171,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (!s.gecko_spellcheck) t.getBody().spellcheck = 0; - t._addEvents(); + if (!s.readonly) + t._addEvents(); t.controlManager.onPostRender.dispatch(t, t.controlManager); t.onPostRender.dispatch(t); @@ -7153,7 +7337,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }); } - if (isGecko) { + if (isGecko && !s.readonly) { try { // Design mode must be set here once again to fix a bug where // Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again @@ -7250,7 +7434,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }, translate : function(s) { - var c = this.settings.language, i18n = EditorManager.i18n; + var c = this.settings.language || 'en', i18n = EditorManager.i18n; if (!s) return ''; @@ -7261,7 +7445,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }, getLang : function(n, dv) { - return EditorManager.i18n[this.settings.language + '.' + n] || (is(dv) ? dv : '{#' + n + '}'); + return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}'); }, getParam : function(n, dv, ty) { @@ -7936,7 +8120,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; function setOpts() { var t = this, d = t.getDoc(), s = t.settings; - if (isGecko) { + if (isGecko && !s.readonly) { if (t._isHidden()) { try { if (!s.content_editable) @@ -7971,7 +8155,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; t.onMouseUp.add(t.nodeChanged); t.onClick.add(t.nodeChanged); t.onKeyUp.add(function(ed, e) { - if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.keyCode == 46 || e.keyCode == 8 || e.ctrlKey) + var c = e.keyCode; + + if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey) t.nodeChanged(); }); @@ -8328,7 +8514,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (cl = s.font_size_classes) cl = explode(cl); - +/* function convertToFonts(no) { var n, f, nl, x, i, v, st; @@ -8391,7 +8577,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; t.onSetContent.add(function(ed, o) { convertToFonts(ed.getBody()); }); - +*/ // Run on cleanup t.onPreProcess.add(function(ed, o) { var n, sp, nl, x; @@ -8500,6 +8686,10 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; (function() { var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit; + function isBlock(n) { + return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName); + }; + tinymce.create('tinymce.EditorCommands', { EditorCommands : function(ed) { this.editor = ed; @@ -8676,44 +8866,32 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; s.select(s.getNode()); t.RemoveFormat(); - } else - ed.getDoc().execCommand('FontName', false, v); + } else { + if (ed.settings.convert_fonts_to_spans) + t._applyInlineStyle('span', {style : {fontFamily : v}}); + else + ed.getDoc().execCommand('FontName', false, v); + } }, FontSize : function(u, v) { - var ed = this.editor, s = ed.settings, fz = tinymce.explode(s.font_size_style_values), fzc = tinymce.explode(s.font_size_classes), h, bm; - - // Remove style sizes - each(ed.dom.select('font'), function(e) { - e.style.fontSize = ''; - }); - - // Let the browser add new size it will remove unneded ones in some browsers - ed.getDoc().execCommand('FontSize', false, v); + var ed = this.editor, s = ed.settings, fc, fs; - // Add style values - if (s.inline_styles) { - each(ed.dom.select('font'), function(e) { - // Try remove redundant font elements - if (e.parentNode.nodeName == 'FONT' && e.size == e.parentNode.size) { - if (!bm) - bm = ed.selection.getBookmark(); - - ed.dom.remove(e, 1); - return; - } + // Use style options instead + if (s.convert_fonts_to_spans && v >= 1 && v <= 7) { + fs = tinymce.explode(s.font_size_style_values); + fc = tinymce.explode(s.font_size_classes); - // Setup font size based on font size value - if (v = e.size) { - if (fzc && fzc.length > 0) - ed.dom.setAttrib(e, 'class', fzc[parseInt(v) - 1]); - else - ed.dom.setStyle(e, 'fontSize', fz[parseInt(v) - 1]); - } - }); + if (fc) + v = fc[v - 1] || v; + else + v = fs[v - 1] || v; } - ed.selection.moveToBookmark(bm); + if (v >= 1 && v <= 7) + ed.getDoc().execCommand('FontSize', false, v); + else + this._applyInlineStyle('span', {style : {fontSize : v}}); }, queryCommandValue : function(c) { @@ -8763,14 +8941,17 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; queryValueFontSize : function() { var ed = this.editor, v = 0, p; - if (isOpera || isWebKit) { + if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN')) + v = p.style.fontSize; + + if (!v && (isOpera || isWebKit)) { if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT')) v = p.size; return v; } - return this._queryVal('FontSize'); + return v || this._queryVal('FontSize'); }, queryValueFontName : function() { @@ -8779,6 +8960,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT')) v = p.face; + if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN')) + v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); + if (!v) v = this._queryVal('FontName'); @@ -8799,7 +8983,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (rm) { if (v == 'center') - dom.setStyle(n.parentNode, 'textAlign', ''); + dom.setStyle(bl || n.parentNode, 'textAlign', ''); dom.setStyle(n, 'float', ''); this.mceRepaint(); @@ -8808,7 +8992,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (v == 'center') { // Do not change table elements - if (/^(TD|TH)$/.test(bl.nodeName)) + if (bl && /^(TD|TH)$/.test(bl.nodeName)) bl = 0; if (!bl || bl.childNodes.length > 1) { @@ -8829,7 +9013,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; dom.setStyle(n, 'float', ''); } else { dom.setStyle(n, 'float', v); - dom.setStyle(n.parentNode, 'textAlign', ''); + dom.setStyle(bl || n.parentNode, 'textAlign', ''); } this.mceRepaint(); @@ -9015,7 +9199,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; re = new RegExp(re, 'i'); // Set style info on selected element - if (e = t.getSelectedElement()) + if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers) set(e, 1); else { // Generate wrappers and set styles on them @@ -9060,6 +9244,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if (!p || !dom.getAttrib(n, 'mce_new')) return; + if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN') + return; + // Has parent of the same type and only child if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1) return dom.remove(p, 1); @@ -9107,9 +9294,24 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; return this._queryState(c); }, + ForeColor : function(ui, v) { + var ed = this.editor; + + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {color : v}}); + return; + } else + ed.getDoc().execCommand('ForeColor', false, v); + }, + HiliteColor : function(ui, val) { var t = this, ed = t.editor, d = ed.getDoc(); + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {backgroundColor : val}}); + return; + } + function set(s) { if (!isGecko) return; @@ -9275,10 +9477,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0) return true; - } else - return !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE'); + } - return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList(); + return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE')); }, queryStateInsertUnorderedList : function() { @@ -9301,8 +9502,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; }; // Get start/end block - sb = dom.getParent(s.getStart(), dom.isBlock); - eb = dom.getParent(s.getEnd(), dom.isBlock); + sb = dom.getParent(s.getStart(), isBlock); + eb = dom.getParent(s.getEnd(), isBlock); // Remove blockquote(s) if (bq = getBQ(sb)) { @@ -9347,7 +9548,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; s.collapse(0); // IE misses the empty block some times element so we must move back the caret - if (dom.getParent(s.getStart(), dom.isBlock) != sb) { + if (dom.getParent(s.getStart(), isBlock) != sb) { r = s.getRng(); r.move('character', -1); r.select(); @@ -9419,6 +9620,151 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; } else s.moveToBookmark(bm); }, + + _applyInlineStyle : function(na, at, op) { + var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh; + + na = na.toUpperCase(); + + if (op && op.check_classes && at['class']) + op.check_classes.push(at['class']); + + function replaceFonts() { + var bm; + + each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') { + if (!bm) + bm = ed.selection.getBookmark(); + + at._mce_new = '1'; + dom.replace(dom.create(na, at), n, 1); + } + }); + + // Remove redundant elements + each(dom.select(na), function(n) { + if (n.getAttribute('_mce_new')) { + function removeStyle(n) { + if (n.nodeType == 1) { + each(at.style, function(v, k) { + dom.setStyle(n, k, ''); + }); + + // Remove spans with the same class or marked classes + if (at['class'] && n.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(n, c)) + dom.removeClass(n, c); + }); + } + } + }; + + // Remove specified style information from child elements + each(dom.select(na, n), removeStyle); + + // Remove the specified style information on parent if current node is only child (IE) + if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1) + removeStyle(n.parentNode); + + // Remove the child elements style info if a parent already has it + dom.getParent(n.parentNode, function(pn) { + if (pn.nodeType == 1) { + if (at.style) { + each(at.style, function(v, k) { + var sv; + + if (!lo[k] && (sv = dom.getStyle(pn, k))) { + if (sv === v) + dom.setStyle(n, k, ''); + + lo[k] = 1; + } + }); + } + + // Remove spans with the same class or marked classes + if (at['class'] && pn.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(pn, c)) + dom.removeClass(n, c); + }); + } + } + + return false; + }); + + n.removeAttribute('_mce_new'); + } + }); + + // Remove empty span elements + each(dom.select(na).reverse(), function(n) { + var c = 0; + + // Check if there is any attributes + each(dom.getAttribs(n), function(an) { + if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') { + //console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName)); + c++; + } + }); + + // No attributes then remove the element and keep the children + if (c == 0) + dom.remove(n, 1); + }); + + ed.selection.moveToBookmark(bm); + + return !!bm; + }; + + // Create inline elements + ed.focus(); + ed.getDoc().execCommand('FontName', false, 'mceinline'); + replaceFonts(); + + if (kh = t._applyInlineStyle.keyhandler) { + ed.onKeyUp.remove(kh); + ed.onKeyPress.remove(kh); + ed.onKeyDown.remove(kh); + ed.onSetContent.remove(t._applyInlineStyle.chandler); + } + + if (ed.selection.isCollapsed()) { + // Start collecting styles + t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style); + + t._applyInlineStyle.chandler = ed.onSetContent.add(function() { + delete t._pendingStyles; + }); + + t._applyInlineStyle.keyhandler = kh = function(e) { + // Use pending styles + if (t._pendingStyles) { + at.style = t._pendingStyles; + delete t._pendingStyles; + } + + if (replaceFonts()) { + ed.onKeyDown.remove(t._applyInlineStyle.keyhandler); + ed.onKeyPress.remove(t._applyInlineStyle.keyhandler); + } + + if (e.type == 'keyup') + ed.onKeyUp.remove(t._applyInlineStyle.keyhandler); + }; + + ed.onKeyDown.add(kh); + ed.onKeyPress.add(kh); + ed.onKeyUp.add(kh); + } else + t._pendingStyles = 0; + }, + /* _mceBlockQuote : function() { var t = this, s = t.editor.selection, b = s.getBookmark(), bq, dom = t.editor.dom; @@ -9478,8 +9824,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; _getSelectedBlocks : function(st, en) { var ed = this.editor, dom = ed.dom, s = ed.selection, sb, eb, n, bl = []; - sb = dom.getParent(st || s.getStart(), dom.isBlock); - eb = dom.getParent(en || s.getEnd(), dom.isBlock); + sb = dom.getParent(st || s.getStart(), isBlock); + eb = dom.getParent(en || s.getEnd(), isBlock); if (sb) bl.push(sb); @@ -9488,7 +9834,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager; n = sb; while ((n = n.nextSibling) && n != eb) { - if (dom.isBlock(n)) + if (isBlock(n)) bl.push(n); } } @@ -9810,11 +10156,11 @@ tinymce.create('tinymce.UndoManager', { forceRoots : function(ed, e) { var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF; - var nx, bl, bp, sp, le, nl = b.childNodes, i; + var nx, bl, bp, sp, le, nl = b.childNodes, i, n; // Fix for bug #1863847 - if (e && e.keyCode == 13) - return true; + //if (e && e.keyCode == 13) + // return true; // Wrap non blocks into blocks for (i = nl.length - 1; i >= 0; i--) { @@ -9828,12 +10174,17 @@ tinymce.create('tinymce.UndoManager', { // Store selection if (si == -2 && r) { if (!isIE) { - // If element is inside body, might not be the case in contentEdiable mode - if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) { - so = r.startOffset; - eo = r.endOffset; - si = t.find(b, 0, r.startContainer); - ei = t.find(b, 0, r.endContainer); + // If selection is element then mark it + if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) { + n.setAttribute("id", "__mce"); + } else { + // If element is inside body, might not be the case in contentEdiable mode + if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) { + so = r.startOffset; + eo = r.endOffset; + si = t.find(b, 0, r.startContainer); + ei = t.find(b, 0, r.endContainer); + } } } else { tr = d.body.createTextRange(); @@ -9902,6 +10253,13 @@ tinymce.create('tinymce.UndoManager', { // Ignore } } + } else if (!isIE && (n = ed.dom.get('__mce'))) { + // Move caret before selected element + n.removeAttribute('id'); + r = d.createRange(); + r.setStartBefore(n); + r.setEndBefore(n); + se.setRng(r); } }, @@ -9913,7 +10271,7 @@ tinymce.create('tinymce.UndoManager', { insertPara : function(e) { var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body; - var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch; + var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car; function isEmpty(n) { n = n.innerHTML; @@ -10090,8 +10448,39 @@ tinymce.create('tinymce.UndoManager', { if (isEmpty(bef)) bef.innerHTML = '
    '; + function appendStyles(e, en) { + var nl = [], nn, n, i; + + e.innerHTML = ''; + + // Make clones of style elements + if (se.keep_styles) { + n = en; + do { + // We only want style specific elements + if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) { + nn = n.cloneNode(false); + dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique + nl.push(nn); + } + } while (n = n.parentNode); + } + + // Append style elements to aft + if (nl.length > 0) { + for (i = nl.length - 1, nn = e; i >= 0; i--) + nn = nn.appendChild(nl[i]); + + // Padd most inner style element + nl[0].innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + return nl[0]; // Move caret to most inner element + } else + e.innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + }; + + // Fill empty afterblook with current style if (isEmpty(aft)) - aft.innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + car = appendStyles(aft, en); // Opera needs this one backwards for older versions if (isOpera && parseFloat(opera.version()) < 9.5) { @@ -10112,7 +10501,7 @@ tinymce.create('tinymce.UndoManager', { // Move cursor and scroll into view r = d.createRange(); - r.selectNodeContents(isGecko ? first(aft) : aft); + r.selectNodeContents(isGecko ? first(car || aft) : car || aft); r.collapse(1); s.removeAllRanges(); s.addRange(r); @@ -10123,7 +10512,7 @@ tinymce.create('tinymce.UndoManager', { // Is element within viewport if (y < vp.y || y + ch > vp.y + vp.h) { - ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + ch); + ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks //console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight)); } @@ -10165,12 +10554,21 @@ tinymce.create('tinymce.UndoManager', { // Gecko generates BR elements here and there, we don't like those so lets remove them function handler(e) { + var pr; + e = e.target; // A new BR was created in a block element, remove it if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) { + pr = e.previousSibling; + Event.remove(b, 'DOMNodeInserted', handler); + // Is there whitespace at the end of the node before then we might need the pesky BR + // to place the caret at a correct location see bug: #2013943 + if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue)) + return; + // Only remove BR elements that got inserted in the middle of the text if (e.previousSibling || e.nextSibling) ed.dom.remove(e); @@ -10409,11 +10807,11 @@ tinymce.create('tinymce.UndoManager', { return t.add(c); }, - createMenuButton : function(id, s) { + createMenuButton : function(id, s, cc) { s = s || {}; s.menu_button = 1; - return this.createButton(id, s); + return this.createButton(id, s, cc); }, createSplitButton : function(id, s, cc) { @@ -10635,14 +11033,17 @@ tinymce.create('tinymce.UndoManager', { return new f(a, b, c, d, e); }, - confirm : function(t, cb, s) { - cb.call(s || this, confirm(this._decode(this.editor.getLang(t, t)))); + confirm : function(t, cb, s, w) { + w = w || window; + + cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t)))); }, - alert : function(tx, cb, s) { + alert : function(tx, cb, s, w) { var t = this; - - alert(t._decode(t.editor.getLang(tx, tx))); + + w = w || window; + w.alert(t._decode(t.editor.getLang(tx, tx))); if (cb) cb.call(s || t); diff --git a/vendor/plugins/tiny_mce/tasks/tiny_mce.rake b/vendor/plugins/tiny_mce/tasks/tiny_mce.rake index 188d6ec3b..5ed8ddbf7 100644 --- a/vendor/plugins/tiny_mce/tasks/tiny_mce.rake +++ b/vendor/plugins/tiny_mce/tasks/tiny_mce.rake @@ -1,40 +1,45 @@ -VERSION = '3.1.0.1' +VERSION = '3.2.0.2' namespace :tiny_mce do - namespace :scripts do - desc 'Install the TinyMCE scripts into the public/javascripts directory of this application' - task :install do - require 'fileutils' - dest = RAILS_ROOT + '/public/javascripts/tiny_mce' - if File.exists?(dest) - puts "Error : destination directory #{dest} already exists, perhaps you need to update instead?" - exit 1 - else + desc 'Install the TinyMCE scripts into the public/javascripts directory of this application' + task :install => ['tiny_mce:add_or_replace_tiny_mce'] + + desc 'Update the TinyMCE scripts installed at public/javascripts/tiny_mce for this application' + task :update => ['tiny_mce:add_or_replace_tiny_mce'] + + task :add_or_replace_tiny_mce do + require 'fileutils' + dest = "#{RAILS_ROOT}/public/javascripts/tiny_mce" + if File.exists?(dest) + # upgrade + begin + puts "Removing directory #{dest}..." + FileUtils.rm_rf dest + puts "Recreating directory #{dest}..." + FileUtils.mkdir_p dest + puts "Installing TinyMCE version #{VERSION} to #{dest}..." + FileUtils.cp_r "#{RAILS_ROOT}/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/.", dest + puts "Successfully updated TinyMCE to version #{VERSION}." + rescue + puts "ERROR: Problem updating TinyMCE. Please manually copy " + puts "#{RAILS_ROOT}/vendor/plugins/tiny_mce/public/javascripts/tiny_mce" + puts "to" + puts "#{dest}" + end + else + # install + begin puts "Creating directory #{dest}..." - FileUtils.mkdir dest - puts "** Installing TinyMCE version #{VERSION} to #{dest}..." - recursively_copy File.expand_path(File.dirname(__FILE__) + '/../public/javascripts/tiny_mce'), dest - puts "** Successfully installed TinyMCE version #{VERSION}" + FileUtils.mkdir_p dest + puts "Installing TinyMCE version #{VERSION} to #{dest}..." + FileUtils.cp_r "#{RAILS_ROOT}/vendor/plugins/tiny_mce/public/javascripts/tiny_mce/.", dest + puts "Successfully installed TinyMCE version #{VERSION}." + rescue + puts "ERROR: Problem installing TinyMCE. Please manually copy " + puts "#{RAILS_ROOT}/vendor/plugins/tiny_mce/public/javascripts/tiny_mce" + puts "to" + puts "#{dest}" end end - - task :update do - puts "Not yet implemented." - end end end - -def recursively_copy(source, dest) - Dir.chdir(source) - Dir.foreach(source) do |entry| - next if entry =~ /^\./ - if File.directory?(File.join(source, entry)) - puts "Creating directory #{entry}..." - FileUtils.mkdir File.join(dest, entry)#, :noop => true#, :verbose => true - recursively_copy File.join(source, entry), File.join(dest, entry) - else - puts " Installing file #{entry}..." - FileUtils.cp File.join(source, entry), File.join(dest, entry)#, :noop => true#, :verbose => true - end - end -end \ No newline at end of file diff --git a/vendor/plugins/tiny_mce/tiny_mce_options.yml b/vendor/plugins/tiny_mce/tiny_mce_options.yml index 60bd31e62..6788a3ead 100644 --- a/vendor/plugins/tiny_mce/tiny_mce_options.yml +++ b/vendor/plugins/tiny_mce/tiny_mce_options.yml @@ -1,91 +1,140 @@ -- mode -- theme -- plugins -- language +# +# For more information about each configuration options, see +# http://wiki.moxiecode.com/index.php/TinyMCE:Configuration +# + +# General +- accessibility_focus +- accessibility_warnings - ask -- textarea_trigger -- editor_selector -- editor_deselector -- elements -- docs_language -- debug -- focus_alert -- directionality -- auto_reset_designmode - auto_focus -- nowrap -- button_tile_map +- auto_reset_designmode - auto_resize +- browsers +- button_tile_map +- class_filter +- custom_shortcuts +- debug +- default_document - dialog_type -- accessibility_warnings -- accessibility_focus +- directionality +- docs_language +- editor_deselector +- editor_selector +- elements - event_elements -- table_inline_editing +- focus_alert +- gecko_spellcheck +- hide_selects_on_submit +- keep_styles +- language +- mode +- nowrap - object_resizing -- custom_shortcuts +- plugins +- readonly +- skin +- skin_variant - strict_loading_mode +- table_inline_editing +- tab_focus +- textarea_trigger +- theme + +# Callbacks +- cleanup_callback +- execcommand_callback +- file_browser_callback +- handle_event_callback +- handle_node_change_callback +- init_instance_callback +- onchange_callback +- oninit +- onpageload +- remove_instance_callback +- save_callback +- setup +- setupcontent_callback +- urlconverter_callback + +# Cleanup/Output +- apply_source_formatting - cleanup -- valid_elements -- extended_valid_elements -- invalid_elements -- verify_css_classes -- verify_html -- preformatted -- encoding - cleanup_on_startup -- fix_content_duplication -- inline_styles +- cleanup_serializer +- convert_fonts_to_spans - convert_newlines_to_brs -- force_br_newlines -- force_p_newlines +- custom_elements +- doctype +- element_format +- encoding - entities - entity_encoding -- remove_linebreaks -- convert_fonts_to_spans +- extended_valid_elements +- fix_content_duplication +- fix_list_elements +- fix_table_elements +- fix_nesting - font_size_classes - font_size_style_values -- merge_styles_invalid_parents +- force_p_newlines +- force_br_newlines - force_hex_style_colors -- apply_source_formatting +- forced_root_block +- indentation +- inline_styles +- invalid_elements +- merge_styles_invalid_parents +- remove_linebreaks +- remove_trailing_nbsp +- preformatted - trim_span_elements -- doctype -- fix_list_elements -- fix_table_elements +- valid_child_elements +- valid_elements +- verify_css_classes +- verify_html + +# URL - convert_urls - relative_urls - remove_script_host - document_base_url -- urlconverter_callback -- insertlink_callback -- insertimage_callback -- setupcontent_callback -- save_callback -- onchange_callback -- init_instance_callback -- file_browser_callback -- cleanup_callback -- handle_event_callback -- execcommand_callback -- oninit -- onpageload + +# Layout +- body_id +- body_class +- constrain_menus - content_css -- popups_css +- popup_css +- popup_css_add - editor_css - width - height + +# Visual aids - visual - visual_table_class + +# Undo/Redo - custom_undo_redo - custom_undo_redo_levels - custom_undo_redo_keyboard_shortcuts - custom_undo_redo_restore_selection + +# File lists - external_link_list_url - external_image_list_url + +# Tab specific - display_tab_class - hidden_tab_class + +# Triggers/Patches - add_form_submit_trigger - add_unload_trigger - submit_patch + +# Advanced theme - theme_advanced_layout_manager - theme_advanced_blockformats - theme_advanced_styles @@ -114,7 +163,15 @@ - theme_advanced_custom_layout - theme_advanced_link_targets - theme_advanced_resizing +- theme_advanced_resizing_min_width +- theme_advanced_resizing_min_height +- theme_advanced_resizing_max_width +- theme_advanced_resizing_max_height - theme_advanced_resizing_use_cookie - theme_advanced_resize_horizontal - theme_advanced_path - theme_advanced_fonts +- theme_advanced_font_sizes +- theme_advanced_text_colors +- theme_advanced_background_colors +- theme_advanced_more_colors \ No newline at end of file