Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
5087f90a26
|
@ -258,4 +258,24 @@ module UsersHelper
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#获取用户参与的公开的课程列表
|
||||||
|
def user_public_course_list user
|
||||||
|
membership = user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||||
|
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
|
||||||
|
memberships = []
|
||||||
|
membership.collect { |e|
|
||||||
|
memberships.push(e)
|
||||||
|
}
|
||||||
|
## 判断课程是否过期 [需封装]
|
||||||
|
memberships_doing = []
|
||||||
|
memberships_done = []
|
||||||
|
memberships.map { |e|
|
||||||
|
if course_endTime_timeout?(e.course)
|
||||||
|
memberships_done.push e
|
||||||
|
else
|
||||||
|
memberships_doing.push e
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<!-- <%= course_board_breadcrumb(@board) %> -->
|
<!-- <%#= course_board_breadcrumb(@board) %> -->
|
||||||
|
|
||||||
<!--new and follow-->
|
<!--new and follow-->
|
||||||
<!-- <div class="content-title-top">
|
<!-- <div class="content-title-top">
|
||||||
<%= link_to l(:label_message_new),
|
<%#= link_to l(:label_message_new),
|
||||||
new_board_message_path(@board),
|
new_board_message_path(@board),
|
||||||
:class => 'icon icon-add',
|
:class => 'icon icon-add',
|
||||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> -->
|
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> -->
|
||||||
<!-- <%= watcher_link(@board, User.current) %> -->
|
<!-- <%#= watcher_link(@board, User.current) %> -->
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<div id="add-message" class="add_frame" style="display:none;">
|
<div id="add-message" class="add_frame" style="display:none;">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
|
|
|
@ -1,33 +1,35 @@
|
||||||
<!-- <%= board_breadcrumb(@board) %> -->
|
<!-- <%#= board_breadcrumb(@board) %> -->
|
||||||
|
|
||||||
<!--new and follow-->
|
<!--new and follow-->
|
||||||
<!-- <div class="content-title-top">
|
<!-- <div class="content-title-top">
|
||||||
<%= link_to l(:label_message_new),
|
<%#= link_to l(:label_message_new),
|
||||||
new_board_message_path(@board),
|
new_board_message_path(@board),
|
||||||
:class => 'icon icon-add',
|
:class => 'icon icon-add',
|
||||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> -->
|
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> -->
|
||||||
<!-- <%= watcher_link(@board, User.current) %> -->
|
<!-- <%#= watcher_link(@board, User.current) %> -->
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<div id="add-message" class="add_frame" style="display:none;">
|
<div id="add-message" class="add_frame" style="display:none;">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<h3><%= link_to h(@board.name), project_board_path(@project, @board) %> » <%= l(:label_message_new) %></h3>
|
<h3><%= link_to h(@board.name), project_board_path(@project, @board) %> » <%= l(:label_message_new) %></h3>
|
||||||
<div class="add_frame_header" >
|
|
||||||
|
<div class="add_frame_header">
|
||||||
<%= l(:label_message_new) %>
|
<%= l(:label_message_new) %>
|
||||||
</div>
|
</div>
|
||||||
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||||
<%= render :partial => 'messages/form', :locals => {:f => f} %>
|
<%= render :partial => 'messages/form', :locals => {:f => f} %>
|
||||||
<p><%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
|
<p><%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
|
||||||
<%= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> |
|
<%= preview_link(preview_board_message_path(@board), 'message-form', target='preview', {:class => 'whiteButton m3p10'}) %>
|
||||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %></p>
|
|
|
||||||
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'whiteButton m3p10' %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div id="preview" class="wiki"></div>
|
<div id="preview" class="wiki"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--display the board-->
|
<!--display the board-->
|
||||||
<div class="borad-title"><%=h @board.name %></div>
|
<div class="borad-title"><%= h @board.name %></div>
|
||||||
|
|
||||||
<% if !User.current.logged?%>
|
<% if !User.current.logged? %>
|
||||||
<div style="font-size: 14px;margin:20px;">
|
<div style="font-size: 14px;margin:20px;">
|
||||||
<% if @project.project_type == 1 %>
|
<% if @project.project_type == 1 %>
|
||||||
<%= l(:label_user_login_course_board) %>
|
<%= l(:label_user_login_course_board) %>
|
||||||
|
@ -39,15 +41,17 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<!-- <div class="borad-description"><%=h @board.description %></div> -->
|
<!-- <div class="borad-description"><%= h @board.description %></div> -->
|
||||||
<div class="borad-setitle">
|
<div class="borad-setitle">
|
||||||
<span class="borad-topic-count">共有 <%=link_to @topics.count %> 个贴子</span>
|
<span class="borad-topic-count">共有 <%= link_to @topics.count %> 个贴子</span>
|
||||||
<span>
|
<% if @project.enabled_modules.where("name = 'boards'").count > 0 %>
|
||||||
<%= link_to l(:label_message_new),
|
<span>
|
||||||
new_board_message_path(@board),
|
<%= link_to l(:label_message_new),
|
||||||
:class => 'icon icon-add',
|
new_board_message_path(@board),
|
||||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %>
|
:class => 'icon icon-add',
|
||||||
</span>
|
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-top: 10px">
|
<div style="padding-top: 10px">
|
||||||
<% if @topics.any? %>
|
<% if @topics.any? %>
|
||||||
|
@ -63,18 +67,29 @@
|
||||||
<% @topics.each do |topic| %>
|
<% @topics.each do |topic| %>
|
||||||
<table class="content-text-list">
|
<table class="content-text-list">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
|
<td colspan="2" valign="top" width="50"><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
|
||||||
<td>
|
<td>
|
||||||
<table width="640px" border="0">
|
<table width="640px" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top" width="500px" class=" <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
<td valign="top" width="500px" class=" <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
||||||
<td align="right" rowspan="3"><table class="borad-count"><tr><td align="center" class="borad-count-digit"><%=link_to (topic.replies_count), board_message_path(@board, topic) %></td></tr>
|
<td align="right" rowspan="3">
|
||||||
<tr><td align="center">回答</td></tr>
|
<table class="borad-count">
|
||||||
</table></td>
|
<tr>
|
||||||
|
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), board_message_path(@board, topic) %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center">回答</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- <tr><td colspan="2" ><span class="font_description">标签</span></td></tr> -->
|
<!-- <tr><td colspan="2" ><span class="font_description">标签</span></td></tr> -->
|
||||||
<tr><td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_on, topic.author %><br /></span></td></tr>
|
<tr>
|
||||||
</table></td>
|
<td align="left" colspan="2">
|
||||||
|
<span class="font_lighter"><%= authoring topic.created_on, topic.author %><br/></span></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -1,120 +1,127 @@
|
||||||
<div class="content-title-top">
|
<div class="content-title-top">
|
||||||
<div>
|
<% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %>
|
||||||
<%= link_to l(:label_issue_new), { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
|
<div>
|
||||||
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }, :class => 'icon icon-add' %>
|
<%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new,
|
||||||
|
:html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %>
|
||||||
|
|
||||||
<%= link_to l(:label_query), '#', :class => 'icon icon-help',
|
<%= link_to l(:label_query), '#', :class => 'icon icon-help',
|
||||||
:onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %>
|
:onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<% if !@query.new_record? && @query.editable_by?(User.current) %>
|
<% if !@query.new_record? && @query.editable_by?(User.current) %>
|
||||||
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
|
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
|
||||||
<%= delete_link query_path(@query) %>
|
<%= delete_link query_path(@query) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
|
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
|
||||||
<div style="clear:right; ">
|
<div style="clear:right; ">
|
||||||
<%= form_tag({ :controller => 'issues', :action => 'index', :project_id => @project }, :method => :get, :id => 'query_form', :class => 'query_form') do %>
|
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %>
|
||||||
<%= hidden_field_tag 'set_filter', '1' %>
|
<%= hidden_field_tag 'set_filter', '1' %>
|
||||||
|
|
||||||
<div id="custom_query" class="custom_query" style="display: <%= !params[:utf8].blank? ? 'block' : 'none' %>;">
|
<div id="custom_query" class="custom_query" style="display: <%= !params[:utf8].blank? ? 'block' : 'none' %>;">
|
||||||
<span>---<%= l :label_query_new %>---</span>
|
<span>---<%= l :label_query_new %>---</span>
|
||||||
<div id="query_form_content" class="hide-when-print">
|
|
||||||
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
|
<div id="query_form_content" class="hide-when-print">
|
||||||
<legend onclick="toggleFieldset(this);">
|
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
|
||||||
<%= l(:label_issue_query_condition) %>
|
<legend onclick="toggleFieldset(this);">
|
||||||
</legend>
|
<%= l(:label_issue_query_condition) %>
|
||||||
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
|
</legend>
|
||||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
|
||||||
</div>
|
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||||
</fieldset>
|
</div>
|
||||||
<fieldset class="collapsible collapsed" >
|
</fieldset>
|
||||||
<legend onclick="toggleFieldset(this);">
|
<fieldset class="collapsible collapsed">
|
||||||
<%= l(:label_options) %>
|
<legend onclick="toggleFieldset(this);">
|
||||||
</legend>
|
<%= l(:label_options) %>
|
||||||
<div style="display: none;">
|
</legend>
|
||||||
<table>
|
<div style="display: none;">
|
||||||
<tr>
|
<table>
|
||||||
<td><%= l(:field_column_names) %></td>
|
<tr>
|
||||||
<td><%= render_query_columns_selection(@query) %></td>
|
<td><%= l(:field_column_names) %></td>
|
||||||
</tr>
|
<td><%= render_query_columns_selection(@query) %></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td><label for='group_by'><%= l(:field_group_by) %></label></td>
|
<tr>
|
||||||
<td><%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, @query.group_by) ) %></td>
|
<td><label for='group_by'><%= l(:field_group_by) %></label></td>
|
||||||
</tr>
|
<td><%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td><%= l(:button_show) %></td>
|
<tr>
|
||||||
<td><%= available_block_columns_tags(@query) %></td>
|
<td><%= l(:button_show) %></td>
|
||||||
</tr>
|
<td><%= available_block_columns_tags(@query) %></td>
|
||||||
</table>
|
</tr>
|
||||||
</div>
|
</table>
|
||||||
</fieldset>
|
</div>
|
||||||
<div class="buttons hide-when-print">
|
</fieldset>
|
||||||
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
|
<div class="buttons hide-when-print">
|
||||||
<%= link_to l(:label_issue_cancel_query), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload' %>
|
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
|
||||||
</div>
|
<%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= error_messages_for 'query' %>
|
<%= error_messages_for 'query' %>
|
||||||
|
|
||||||
<% if @query.valid? %>
|
<% if @query.valid? %>
|
||||||
<% if @issues.empty? %>
|
<% if @issues.empty? %>
|
||||||
<p class="nodata">
|
<p class="nodata">
|
||||||
<%= l(:label_no_data) %>
|
<%= l(:label_no_data) %>
|
||||||
</p>
|
</p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
|
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
|
||||||
<div class="pagination"><ul><%= pagination_links_full @issue_pages, @issue_count %></ul></div>
|
<div class="pagination">
|
||||||
<% end %>
|
<ul><%= pagination_links_full @issue_pages, @issue_count %></ul>
|
||||||
<div style="float: right; padding-top: 30px">
|
</div>
|
||||||
<% other_formats_links do |f| %>
|
<% end %>
|
||||||
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
|
<div style="float: right; padding-top: 30px">
|
||||||
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
<% other_formats_links do |f| %>
|
||||||
<%= f.link_to 'PDF', :url => params %>
|
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
|
||||||
<% end %>
|
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||||||
</div>
|
<%= f.link_to 'PDF', :url => params %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="csv-export-options" style="display:none;">
|
<div id="csv-export-options" style="display:none;">
|
||||||
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||||||
<%= form_tag(params.merge({:format => 'csv',:page=>nil}), :method => :get, :id => 'csv-export-form') do %>
|
<%= form_tag(params.merge({:format => 'csv', :page => nil}), :method => :get, :id => 'csv-export-form') do %>
|
||||||
<p>
|
<p>
|
||||||
<label><%= radio_button_tag 'columns', 'all' %> <%= l(:description_all_columns) %></label>
|
<label><%= radio_button_tag 'columns', 'all' %> <%= l(:description_all_columns) %></label>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
<label><%= check_box_tag 'description', '1', @query.has_column?(:description) %> <%= l(:field_description) %></label>
|
<p>
|
||||||
</p>
|
<label><%= check_box_tag 'description', '1', @query.has_column?(:description) %> <%= l(:field_description) %></label>
|
||||||
<p class="buttons">
|
</p>
|
||||||
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
|
|
||||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
|
<p class="buttons">
|
||||||
</p>
|
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
|
||||||
<% end %>
|
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
|
||||||
</div>
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %>
|
<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %>
|
||||||
|
|
||||||
<% content_for :sidebar do %>
|
<% content_for :sidebar do %>
|
||||||
<%= render :partial => 'issues/sidebar' %>
|
<%= render :partial => 'issues/sidebar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom,
|
<%= auto_discovery_link_tag(:atom,
|
||||||
{:query_id => @query, :format => 'atom',
|
{:query_id => @query, :format => 'atom',
|
||||||
:page => nil, :key => User.current.rss_key},
|
:page => nil, :key => User.current.rss_key},
|
||||||
:title => l(:label_issue_plural)) %>
|
:title => l(:label_issue_plural)) %>
|
||||||
<%= auto_discovery_link_tag(:atom,
|
<%= auto_discovery_link_tag(:atom,
|
||||||
{:controller => 'journals', :action => 'index',
|
{:controller => 'journals', :action => 'index',
|
||||||
:query_id => @query, :format => 'atom',
|
:query_id => @query, :format => 'atom',
|
||||||
:page => nil, :key => User.current.rss_key},
|
:page => nil, :key => User.current.rss_key},
|
||||||
:title => l(:label_changes_details)) %>
|
:title => l(:label_changes_details)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= context_menu issues_context_menu_path %>
|
<%= context_menu issues_context_menu_path %>
|
||||||
|
|
|
@ -11,11 +11,12 @@
|
||||||
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
|
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
|
||||||
<%= label_tips %>
|
<%= label_tips %>
|
||||||
</span>
|
</span>
|
||||||
|
<% if @project.enabled_modules.where("name = 'news'").count > 0 %>
|
||||||
<%= link_to(btn_tips,
|
<%= link_to(btn_tips,
|
||||||
new_project_news_path(@project),
|
new_project_news_path(@project),
|
||||||
:class => 'icon icon-add',
|
:class => 'icon icon-add',
|
||||||
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
|
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
|
||||||
|
<% end %>
|
||||||
<% if @project && User.current.allowed_to?(:manage_news, @project) %>
|
<% if @project && User.current.allowed_to?(:manage_news, @project) %>
|
||||||
<div id="add-news" class="add_frame" style="display:none;">
|
<div id="add-news" class="add_frame" style="display:none;">
|
||||||
<%= labelled_form_for @news, :url => project_news_index_path(@project),
|
<%= labelled_form_for @news, :url => project_news_index_path(@project),
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
<ul><h3>项目交流</h3>
|
<ul><h3>项目交流</h3>
|
||||||
<li><%= link_to l(:label_project_tool_response) ,project_feedback_path(@project) %></li>
|
<li><%= link_to l(:label_project_tool_response) ,project_feedback_path(@project) %></li>
|
||||||
<li><%= link_to l(:project_module_files) ,project_files_path(@project) %></li>
|
<li><%= link_to l(:project_module_files) ,project_files_path(@project) %></li>
|
||||||
<li><%= link_to l(:project_module_wiki), project_wiki_path(@project) %></li>
|
<% if @project.enabled_modules.where("name = 'wiki'").count > 0 %>
|
||||||
|
<li><%= link_to l(:project_module_wiki), project_wiki_path(@project) %></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<ul><h3>进度跟踪</h3>
|
<ul><h3>进度跟踪</h3>
|
||||||
<li><%= link_to l(:project_module_calendar),project_calendar_path(@project) %></li>
|
<li><%= link_to l(:project_module_calendar),project_calendar_path(@project) %></li>
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
<%# unless user.memberships.empty? %>
|
<%# unless user.memberships.empty? %>
|
||||||
<%# cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %>
|
<%# cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %>
|
||||||
<%# memberships = user.memberships.all(:conditions => cond) %>
|
<%# memberships = user.memberships.all(:conditions => cond) %>
|
||||||
<% user_courses = user.coursememberships.map(&:course) %>
|
<% user_courses = user_courses_list(user) %>
|
||||||
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
|
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
|
||||||
<% for course in user_courses %>
|
<% for course in user_courses %>
|
||||||
<%# if course.name != nil %>
|
<%# if course.name != nil %>
|
||||||
|
|
|
@ -1,308 +1,395 @@
|
||||||
<% if User.current.id == @user.id%>
|
<% if User.current.id == @user.id %>
|
||||||
<div class="menu-div">
|
<div class="menu-div">
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<span style="color: #000; font-weight: ;"><%= "#{@user.name}的动态" %></span>
|
<span style="color: #000; font-weight: ;"><%= "#{@user.name}的动态" %></span>
|
||||||
<ul><%#链接绑定在页面最下方的jQuery%>
|
<ul><%#链接绑定在页面最下方的jQuery%>
|
||||||
<li mode='all' class="<%= "on" if @state.eql?(0)%>"><%=l :label_user_all_activity%></li>
|
<li mode='all' class="<%= "on" if @state.eql?(0) %>"><%= l :label_user_all_activity %></li>
|
||||||
<li mode='myself' class="<%= "on" if @state.eql?(1)%>"><%=l :label_user_activity_myself%></li>
|
<li mode='myself' class="<%= "on" if @state.eql?(1) %>"><%= l :label_user_activity_myself %></li>
|
||||||
<li mode='respond' class="<%= "on" if @state.eql?(2)%>"><%=l :label_user_all_respond%></li>
|
<li mode='respond' class="<%= "on" if @state.eql?(2) %>"><%= l :label_user_all_respond %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<%#= show_activity @state%>
|
<%#= show_activity @state%>
|
||||||
<div style="height:20px"></div>
|
<div style="height:20px"></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<%= form_tag(:controller => 'users', :action => "show") do %>
|
<%= form_tag(:controller => 'users', :action => "show") do %>
|
||||||
<div class="user-search-block hidden" style="float:right;margin-top:-55px">
|
<div class="user-search-block hidden" style="float:right;margin-top:-55px">
|
||||||
<table width="100%" valign="center">
|
<table width="100%" valign="center">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<div class="project-search">
|
<div class="project-search">
|
||||||
<%= text_field_tag 'user', params[:user], :size => 30 %>
|
<%= text_field_tag 'user', params[:user], :size => 30 %>
|
||||||
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
|
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% unless @state == 2%>
|
<% unless @state == 2 %>
|
||||||
<% unless @activity.empty? %>
|
<% unless @activity.empty? %>
|
||||||
<div id="activity">
|
<div id="activity">
|
||||||
<% @activity.each do |e| %>
|
<% @activity.each do |e| %>
|
||||||
<%# 以下一行代码解决有未知的活动无法转换成Model报错%>
|
<%# 以下一行代码解决有未知的活动无法转换成Model报错%>
|
||||||
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next; ) if e.act_type.safe_constantize.nil? %>
|
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %>
|
||||||
<% act = e.act %>
|
<% act = e.act %>
|
||||||
<% unless act.nil? %>
|
<% unless act.nil? %>
|
||||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
||||||
<td>
|
<td>
|
||||||
<table width="580" border="0" class="info-break">
|
<table width="580" border="0" class="info-break">
|
||||||
<% case e.act_type %>
|
<% case e.act_type %>
|
||||||
<% when 'JournalsForMessage' %>
|
<% when 'JournalsForMessage' %>
|
||||||
<% if User.current.login == e.user.try(:login) %>
|
<% if User.current.login == e.user.try(:login) %>
|
||||||
<%# if e.user_id == act.jour.id %>
|
<%# if e.user_id == act.jour.id %>
|
||||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %>
|
<tr>
|
||||||
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
<td colspan="2" valign="top">
|
||||||
<%# else %>
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %>
|
||||||
<!-- <tr><td colspan="2" valign="top" class="font_lighter"><strong><%#= link_to("#{e.user.name}", user_path(e.user_id)) %> 给 <%#= link_to("#{act.at_user.name if act.at_user}", user_path(act.jour.id)) %> 留言了</strong> </td></tr> -->
|
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span>
|
||||||
<%# end %>
|
</td>
|
||||||
<% else %>
|
</tr>
|
||||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %><%=
|
<%# else %>
|
||||||
link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
<!-- <tr><td colspan="2" valign="top" class="font_lighter"><strong><%#= link_to("#{e.user.name}", user_path(e.user_id)) %> 给 <%#= link_to("#{act.at_user.name if act.at_user}", user_path(act.jour.id)) %> 留言了</strong> </td></tr> -->
|
||||||
<% end %>
|
<%# end %>
|
||||||
<tr>
|
<% else %>
|
||||||
<td colspan="2" width="580"><p class="font_description"> <%= textilizable act.notes %> </p>
|
<tr>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
|
<td colspan="2" valign="top">
|
||||||
|
<strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %><%=
|
||||||
|
link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" width="580">
|
||||||
|
<p class="font_description"> <%= textilizable act.notes %> </p>
|
||||||
|
|
||||||
|
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
|
||||||
</span></div>
|
</span></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
<span class="font_lighter"> <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% when 'Bid' %>
|
<% when 'Bid' %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if act.reward_type ==3 %>
|
<% if act.reward_type ==3 %>
|
||||||
<% if e.user == User.current%>
|
<% if e.user == User.current %>
|
||||||
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %></td>
|
<td colspan="2" valign="top">
|
||||||
<% else %>
|
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %></td>
|
</td>
|
||||||
<% end %>
|
<% else %>
|
||||||
<% else %>
|
<td colspan="2" valign="top">
|
||||||
<% if e.user == User.current%>
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||||
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %></td>
|
</td>
|
||||||
<% else %>
|
<% end %>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %></td>
|
<% else %>
|
||||||
<% end %>
|
<% if e.user == User.current %>
|
||||||
<% end %>
|
<td colspan="2" valign="top">
|
||||||
</tr>
|
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.description.html_safe %> </p></td> </tr>
|
</td>
|
||||||
<tr>
|
<% else %>
|
||||||
<td>
|
<td colspan="2" valign="top">
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
</td>
|
||||||
</div>
|
<% end %>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), respond_path(e.act_id) %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.commit)%></a></div>
|
<% end %>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<% when 'Journal' %>
|
<td colspan="2" width="580">
|
||||||
<tr>
|
<p class="font_description"> <%= act.description.html_safe %> </p></td>
|
||||||
<% if e.user == User.current%>
|
</tr>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
|
<tr>
|
||||||
<% else %>
|
<td>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to( l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
<% end %>
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
</tr>
|
</div>
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.notes.html_safe %> </p></td> </tr>
|
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||||
<tr>
|
<span><%= link_to l(:label_find_all_comments), respond_path(e.act_id) %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.commit) %></a>
|
||||||
<td>
|
</div>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
</td>
|
||||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
</tr>
|
||||||
</div>
|
<% when 'Journal' %>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
<tr>
|
||||||
</td>
|
<% if e.user == User.current %>
|
||||||
</tr>
|
<td colspan="2" valign="top">
|
||||||
<% when 'Changeset' %>
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier)) %> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %>
|
||||||
<tr>
|
</td>
|
||||||
<% if e.user == User.current%>
|
<% else %>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span></td>
|
<td colspan="2" valign="top">
|
||||||
<% else %>
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier)) %> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.long_comments.html_safe %> </p></td> </tr>
|
<tr>
|
||||||
<tr>
|
<td colspan="2" width="580"><p class="font_description"> <%= act.notes.html_safe %> </p>
|
||||||
<td>
|
</td>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
</tr>
|
||||||
<span class="font_lighter"> <%= format_time(e.act.committed_on) %></span>
|
<tr>
|
||||||
</div>
|
<td>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.count)%></a></div>
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
</td>
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
</tr>
|
</div>
|
||||||
<% when 'Message' %>
|
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||||
<tr>
|
</td>
|
||||||
<% if e.user == User.current%>
|
</tr>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %></td>
|
<% when 'Changeset' %>
|
||||||
<% else %>
|
<tr>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %></td>
|
<% if e.user == User.current %>
|
||||||
<% end %>
|
<td colspan="2" valign="top">
|
||||||
</tr>
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span>
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.content.truncate(240, omission: '...') %> </p></td> </tr>
|
</td>
|
||||||
<tr>
|
<% else %>
|
||||||
<td>
|
<td colspan="2" valign="top">
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %>
|
||||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
</td>
|
||||||
</div>
|
<% end %>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<td colspan="2" width="580">
|
||||||
<% when 'Principal' %>
|
<p class="font_description"> <%= act.long_comments.html_safe %> </p></td>
|
||||||
<tr>
|
</tr>
|
||||||
<% if e.user == User.current%>
|
<tr>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_user) %></span></td>
|
<td>
|
||||||
<% else %>
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_user) %></span></td>
|
<span class="font_lighter"> <%= format_time(e.act.committed_on) %></span>
|
||||||
<% end %>
|
</div>
|
||||||
</tr>
|
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> </p></td> </tr>
|
<span><%= link_to l(:label_find_all_comments), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.count) %></a>
|
||||||
<tr>
|
</div>
|
||||||
<td>
|
</td>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
</tr>
|
||||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
<% when 'Message' %>
|
||||||
</div>
|
<tr>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
<% if e.user == User.current %>
|
||||||
</td>
|
<td colspan="2" valign="top">
|
||||||
</tr>
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
|
||||||
<% when 'News' %>
|
</td>
|
||||||
<tr>
|
<% else %>
|
||||||
<% if e.user == User.current%>
|
<td colspan="2" valign="top">
|
||||||
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td>
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
|
||||||
<% else %>
|
</td>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td>
|
<% end %>
|
||||||
<% end %>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.description.html_safe %> </p></td> </tr>
|
<td colspan="2" width="580">
|
||||||
<tr>
|
<p class="font_description"> <%= h act.content.truncate(240, omission: '...') %> </p>
|
||||||
<td>
|
</td>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
</tr>
|
||||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
<tr>
|
||||||
</div>
|
<td>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.comments_count)%></a></div></td>
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
</tr>
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
<% when 'Issue' %>
|
</div>
|
||||||
<tr>
|
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||||
<% if e.user == User.current%>
|
</td>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
|
</tr>
|
||||||
<% else %>
|
<% when 'Principal' %>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
|
<tr>
|
||||||
<% end %>
|
<% if e.user == User.current %>
|
||||||
</tr>
|
<td colspan="2" valign="top">
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= textilizable(act.description) %> </p></td> </tr>
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_user) %></span>
|
||||||
<tr>
|
</td>
|
||||||
<td>
|
<% else %>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
<td colspan="2" valign="top">
|
||||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_user) %></span>
|
||||||
</div>
|
</td>
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count)%></a></div>
|
<% end %>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<% when 'Contest' %>
|
<td colspan="2" width="580"><p class="font_description"></p></td>
|
||||||
<tr>
|
</tr>
|
||||||
<% if e.user == User.current%>
|
<tr>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %></td>
|
<td>
|
||||||
<% else %>
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %></td>
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
<% end %>
|
</div>
|
||||||
</tr>
|
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
|
</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>
|
<% when 'News' %>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
<tr>
|
||||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
<% if e.user == User.current %>
|
||||||
</div>
|
<td colspan="2" valign="top">
|
||||||
</tr>
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
|
||||||
<% else %>
|
</td>
|
||||||
<% f=1 %>
|
<% else %>
|
||||||
<% end %><!-- < % #case end %> -->
|
<td colspan="2" valign="top">
|
||||||
</table>
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
<% end %>
|
||||||
</table>
|
</tr>
|
||||||
<% end %><!-- < % #unless act.nil? end %> -->
|
<tr>
|
||||||
|
<td colspan="2" width="580">
|
||||||
|
<p class="font_description"> <%= act.description.html_safe %> </p></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||||
|
<span><%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.comments_count) %></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% when 'Issue' %>
|
||||||
|
<tr>
|
||||||
|
<% if e.user == User.current %>
|
||||||
|
<td colspan="2" valign="top">
|
||||||
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
|
||||||
|
</td>
|
||||||
|
<% else %>
|
||||||
|
<td colspan="2" valign="top">
|
||||||
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" width="580">
|
||||||
|
<p class="font_description"> <%= textilizable(act.description) %> </p></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||||
|
<span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count) %></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% when 'Contest' %>
|
||||||
|
<tr>
|
||||||
|
<% if e.user == User.current %>
|
||||||
|
<td colspan="2" valign="top">
|
||||||
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
|
||||||
|
</td>
|
||||||
|
<% else %>
|
||||||
|
<td colspan="2" valign="top">
|
||||||
|
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" width="580"><p class="font_description"> <%= h act.description %> </p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
|
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||||
|
</div>
|
||||||
|
</tr>
|
||||||
|
<% else %>
|
||||||
|
<% f=1 %>
|
||||||
|
<% end %><!-- < % #case end %> -->
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<% end %><!-- < % #unless act.nil? end %> -->
|
||||||
|
|
||||||
<% end %><!-- < % #@activity.each do |e| end%> -->
|
<% end %><!-- < % #@activity.each do |e| end%> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination" style="float:left;">
|
<div class="pagination" style="float:left;">
|
||||||
<ul> <%= pagination_links_full @activity_pages %> </ul>
|
<ul> <%= pagination_links_full @activity_pages %> </ul>
|
||||||
</div>
|
</div>
|
||||||
<% else %> <!-- < %# unless @activity.empty? %> -->
|
<% else %> <!-- < %# unless @activity.empty? %> -->
|
||||||
<% if @user == User.current %>
|
<% if @user == User.current %>
|
||||||
<%= l(:label_user_activities) %>
|
<%= l(:label_user_activities) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="font_description">
|
<p class="font_description">
|
||||||
<%= l(:label_user_activities_other) %>
|
<%= l(:label_user_activities_other) %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %><!-- < %# unless @activity.empty? end %> -->
|
<% end %><!-- < %# unless @activity.empty? end %> -->
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<% unless @message.empty? %>
|
<% unless @message.empty? %>
|
||||||
<div id="activity">
|
<div id="activity">
|
||||||
<% @message.each do |e| -%>
|
<% @message.each do |e| -%>
|
||||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;">
|
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
||||||
<td>
|
<td>
|
||||||
<table width="580" border="0">
|
<table width="580" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user)) %></strong><span class="font_lighter">
|
<td colspan="2" valign="top">
|
||||||
<% if e.instance_of?(JournalsForMessage)%>
|
<strong> <%= link_to(h(e.user), user_path(e.user)) %></strong><span class="font_lighter">
|
||||||
<% if e.reply_id == User.current.id%>
|
<% if e.instance_of?(JournalsForMessage) %>
|
||||||
<%if e.jour_type == 'Bid'%>
|
<% if e.reply_id == User.current.id %>
|
||||||
<%= l(:label_in_bids)%><%= link_to(e.jour.name, respond_path(e.jour))%> <%= l(:label_quote_my_words) %>
|
<% if e.jour_type == 'Bid' %>
|
||||||
|
<%= l(:label_in_bids) %><%= link_to(e.jour.name, respond_path(e.jour)) %> <%= l(:label_quote_my_words) %>
|
||||||
<% elsif e.jour_type == 'User' %>
|
<% elsif e.jour_type == 'User' %>
|
||||||
<%= l(:label_in_users)%><%= link_to(e.jour.firstname, feedback_path(e.jour))%> <%= l(:label_quote_my_words) %>
|
<%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %> <%= l(:label_quote_my_words) %>
|
||||||
<% elsif e.jour_type == 'Project' %>
|
<% elsif e.jour_type == 'Project' %>
|
||||||
<%= '在'<<l(:field_project)%><%= link_to(e.jour.name, feedback_path(e.jour))%> <%= l(:label_reply_plural) %>
|
<%= '在'<<l(:field_project) %><%= link_to(e.jour.name, feedback_path(e.jour)) %> <%= l(:label_reply_plural) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id))%> <%= l(:label_have_respond) %>
|
<%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %> <%= l(:label_have_respond) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %>
|
<% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %>
|
||||||
<%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id))%><%= l(:label_have_respond) %>
|
<%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id)) %><%= l(:label_have_respond) %>
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= l(:label_in_issues)%><%= link_to(e.issue.subject, issue_path(e.issue))%><%= l(:label_quote_my_words) %>
|
<%= l(:label_in_issues) %><%= link_to(e.issue.subject, issue_path(e.issue)) %><%= l(:label_quote_my_words) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %> </span>
|
<% end %> </span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" width="580" > <p class="font_description"> <%= textilizable e.notes %> </p></td>
|
<td colspan="2" width="580"><p class="font_description"> <%= textilizable e.notes %> </p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left"><a class="font_lighter"></a></td>
|
<td align="left"><a class="font_lighter"></a></td>
|
||||||
<td width="200" align="right" class="a"><span class="font_lighter"><%= format_time e.created_on %></span></td>
|
<td width="200" align="right" class="a">
|
||||||
</tr>
|
<span class="font_lighter"><%= format_time e.created_on %></span></td>
|
||||||
</table>
|
</tr>
|
||||||
</td>
|
</table>
|
||||||
</tr>
|
</td>
|
||||||
</table>
|
</tr>
|
||||||
<% end %>
|
</table>
|
||||||
</div>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="pagination" style="float:left;">
|
<div class="pagination" style="float:left;">
|
||||||
<ul> <%= pagination_links_full @info_pages %> </ul>
|
<ul> <%= pagination_links_full @info_pages %> </ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="font_description"><%= l(:label_no_user_respond_you) %></p>
|
<p class="font_description"><%= l(:label_no_user_respond_you) %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
$(document).ready(function($) {
|
$(document).ready(function ($) {
|
||||||
$("#content .menu-div:first~ div").first().find("a").attr("target", "_blank");
|
$("#content .menu-div:first~ div").first().find("a").attr("target", "_blank");
|
||||||
$('[mode=all]').click(function(event) {window.location.href='<%=user_activities_url%>'; });
|
$('[mode=all]').click(function (event) {
|
||||||
$('[mode=myself]').click(function(event) {window.location.href='<%=user_activities_url(type: 1)%>'; });
|
window.location.href = '<%=user_activities_url%>';
|
||||||
$('[mode=respond]').click(function(event) {window.location.href='<%=user_activities_url(type: 2)%>'; });
|
});
|
||||||
});
|
$('[mode=myself]').click(function (event) {
|
||||||
|
window.location.href = '<%=user_activities_url(type: 1)%>';
|
||||||
|
});
|
||||||
|
$('[mode=respond]').click(function (event) {
|
||||||
|
window.location.href = '<%=user_activities_url(type: 2)%>';
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
33
db/schema.rb
33
db/schema.rb
|
@ -809,18 +809,18 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
|
||||||
create_table "relative_memos", :force => true do |t|
|
create_table "relative_memos", :force => true do |t|
|
||||||
t.integer "osp_id"
|
t.integer "osp_id"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
t.string "subject", :null => false
|
t.string "subject", :null => false
|
||||||
t.text "content", :null => false
|
t.text "content", :limit => 16777215, :null => false
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.integer "replies_count", :default => 0
|
t.integer "replies_count", :default => 0
|
||||||
t.integer "last_reply_id"
|
t.integer "last_reply_id"
|
||||||
t.boolean "lock", :default => false
|
t.boolean "lock", :default => false
|
||||||
t.boolean "sticky", :default => false
|
t.boolean "sticky", :default => false
|
||||||
t.boolean "is_quote", :default => false
|
t.boolean "is_quote", :default => false
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "viewed_count_crawl", :default => 0
|
t.integer "viewed_count_crawl", :default => 0
|
||||||
t.integer "viewed_count_local", :default => 0
|
t.integer "viewed_count_local", :default => 0
|
||||||
t.string "url"
|
t.string "url"
|
||||||
t.string "username"
|
t.string "username"
|
||||||
t.string "userhomeurl"
|
t.string "userhomeurl"
|
||||||
|
@ -844,6 +844,19 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
|
||||||
|
|
||||||
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
||||||
|
|
||||||
|
create_table "rich_rich_files", :force => true do |t|
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
t.string "rich_file_file_name"
|
||||||
|
t.string "rich_file_content_type"
|
||||||
|
t.integer "rich_file_file_size"
|
||||||
|
t.datetime "rich_file_updated_at"
|
||||||
|
t.string "owner_type"
|
||||||
|
t.integer "owner_id"
|
||||||
|
t.text "uri_cache"
|
||||||
|
t.string "simplified_type", :default => "file"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "roles", :force => true do |t|
|
create_table "roles", :force => true do |t|
|
||||||
t.string "name", :limit => 30, :default => "", :null => false
|
t.string "name", :limit => 30, :default => "", :null => false
|
||||||
t.integer "position", :default => 1
|
t.integer "position", :default => 1
|
||||||
|
|
|
@ -1,10 +1,75 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
||||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||||
*/
|
*/
|
||||||
(function(){function c(b){var c=this instanceof CKEDITOR.ui.dialog.checkbox;b.hasAttribute(this.id)&&(b=b.getAttribute(this.id),c?this.setValue(e[this.id]["true"]==b.toLowerCase()):this.setValue(b))}function d(b){var c=""===this.getValue(),a=this instanceof CKEDITOR.ui.dialog.checkbox,d=this.getValue();c?b.removeAttribute(this.att||this.id):a?b.setAttribute(this.id,e[this.id][d]):b.setAttribute(this.att||this.id,d)}var e={scrolling:{"true":"yes","false":"no"},frameborder:{"true":"1","false":"0"}};
|
(function () {
|
||||||
CKEDITOR.dialog.add("iframe",function(b){var f=b.lang.iframe,a=b.lang.common,e=b.plugins.dialogadvtab;return{title:f.title,minWidth:350,minHeight:260,onShow:function(){this.fakeImage=this.iframeNode=null;var a=this.getSelectedElement();a&&(a.data("cke-real-element-type")&&"iframe"==a.data("cke-real-element-type"))&&(this.fakeImage=a,this.iframeNode=a=b.restoreRealElement(a),this.setupContent(a))},onOk:function(){var a;a=this.fakeImage?this.iframeNode:new CKEDITOR.dom.element("iframe");var c={},d=
|
function c(b) {
|
||||||
{};this.commitContent(a,c,d);a=b.createFakeElement(a,"cke_iframe","iframe",!0);a.setAttributes(d);a.setStyles(c);this.fakeImage?(a.replace(this.fakeImage),b.getSelection().selectElement(a)):b.insertElement(a)},contents:[{id:"info",label:a.generalTab,accessKey:"I",elements:[{type:"vbox",padding:0,children:[{id:"src",type:"text",label:a.url,required:!0,validate:CKEDITOR.dialog.validate.notEmpty(f.noUrl),setup:c,commit:d}]},{type:"hbox",children:[{id:"width",type:"text",requiredContent:"iframe[width]",
|
var c = this instanceof CKEDITOR.ui.dialog.checkbox;
|
||||||
style:"width:100%",labelLayout:"vertical",label:a.width,validate:CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1",a.width)),setup:c,commit:d},{id:"height",type:"text",requiredContent:"iframe[height]",style:"width:100%",labelLayout:"vertical",label:a.height,validate:CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1",a.height)),setup:c,commit:d},{id:"align",type:"select",requiredContent:"iframe[align]","default":"",items:[[a.notSet,""],[a.alignLeft,"left"],[a.alignRight,
|
b.hasAttribute(this.id) && (b = b.getAttribute(this.id), c ? this.setValue(e[this.id]["true"] == b.toLowerCase()) : this.setValue(b))
|
||||||
"right"],[a.alignTop,"top"],[a.alignMiddle,"middle"],[a.alignBottom,"bottom"]],style:"width:100%",labelLayout:"vertical",label:a.align,setup:function(a,b){c.apply(this,arguments);if(b){var d=b.getAttribute("align");this.setValue(d&&d.toLowerCase()||"")}},commit:function(a,b,c){d.apply(this,arguments);this.getValue()&&(c.align=this.getValue())}}]},{type:"hbox",widths:["50%","50%"],children:[{id:"scrolling",type:"checkbox",requiredContent:"iframe[scrolling]",label:f.scrolling,setup:c,commit:d},{id:"frameborder",
|
}
|
||||||
type:"checkbox",requiredContent:"iframe[frameborder]",label:f.border,setup:c,commit:d}]},{type:"hbox",widths:["50%","50%"],children:[{id:"name",type:"text",requiredContent:"iframe[name]",label:a.name,setup:c,commit:d},{id:"title",type:"text",requiredContent:"iframe[title]",label:a.advisoryTitle,setup:c,commit:d}]},{id:"longdesc",type:"text",requiredContent:"iframe[longdesc]",label:a.longDescr,setup:c,commit:d}]},e&&e.createAdvancedTab(b,{id:1,classes:1,styles:1},"iframe")]}})})();
|
|
||||||
|
function d(b) {
|
||||||
|
var c = "" === this.getValue(), a = this instanceof CKEDITOR.ui.dialog.checkbox, d = this.getValue();
|
||||||
|
c ? b.removeAttribute(this.att || this.id) : a ? b.setAttribute(this.id, e[this.id][d]) : b.setAttribute(this.att || this.id, d)
|
||||||
|
}
|
||||||
|
|
||||||
|
var e = {scrolling: {"true": "yes", "false": "no"}, frameborder: {"true": "1", "false": "0"}};
|
||||||
|
CKEDITOR.dialog.add("iframe", function (b) {
|
||||||
|
var f = b.lang.iframe, a = b.lang.common, e = b.plugins.dialogadvtab;
|
||||||
|
return{title: f.title, minWidth: 350, minHeight: 260, onShow: function () {
|
||||||
|
this.fakeImage = this.iframeNode = null;
|
||||||
|
var a = this.getSelectedElement();
|
||||||
|
a && (a.data("cke-real-element-type") && "iframe" == a.data("cke-real-element-type")) && (this.fakeImage = a, this.iframeNode = a = b.restoreRealElement(a), this.setupContent(a))
|
||||||
|
}, onOk: function () {
|
||||||
|
var a;
|
||||||
|
a = this.fakeImage ? this.iframeNode : new CKEDITOR.dom.element("iframe");
|
||||||
|
var c = {}, d =
|
||||||
|
{};
|
||||||
|
this.commitContent(a, c, d);
|
||||||
|
a = b.createFakeElement(a, "cke_iframe", "iframe", !0);
|
||||||
|
a.setAttributes(d);
|
||||||
|
a.setStyles(c);
|
||||||
|
this.fakeImage ? (a.replace(this.fakeImage), b.getSelection().selectElement(a)) : b.insertElement(a)
|
||||||
|
}, contents: [
|
||||||
|
{id: "info", label: a.generalTab, accessKey: "I", elements: [
|
||||||
|
{type: "vbox", padding: 0, children: [
|
||||||
|
{id: "src", type: "text", label: a.url, required: !0, validate: CKEDITOR.dialog.validate.notEmpty(f.noUrl), setup: c, commit: d}
|
||||||
|
]},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{id: "width", type: "text", requiredContent: "iframe[width]",
|
||||||
|
style: "width:100%", labelLayout: "vertical", label: a.width, validate: CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1", a.width)), setup: c, commit: d},
|
||||||
|
{id: "height", type: "text", requiredContent: "iframe[height]", style: "width:100%", labelLayout: "vertical", label: a.height, validate: CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1", a.height)), setup: c, commit: d},
|
||||||
|
{id: "align", type: "select", requiredContent: "iframe[align]", "default": "", items: [
|
||||||
|
[a.notSet, ""],
|
||||||
|
[a.alignLeft, "left"],
|
||||||
|
[a.alignRight,
|
||||||
|
"right"],
|
||||||
|
[a.alignTop, "top"],
|
||||||
|
[a.alignMiddle, "middle"],
|
||||||
|
[a.alignBottom, "bottom"]
|
||||||
|
], style: "width:100%", labelLayout: "vertical", label: a.align, setup: function (a, b) {
|
||||||
|
c.apply(this, arguments);
|
||||||
|
if (b) {
|
||||||
|
var d = b.getAttribute("align");
|
||||||
|
this.setValue(d && d.toLowerCase() || "")
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, c) {
|
||||||
|
d.apply(this, arguments);
|
||||||
|
this.getValue() && (c.align = this.getValue())
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{type: "hbox", widths: ["50%", "50%"], children: [
|
||||||
|
{id: "scrolling", type: "checkbox", requiredContent: "iframe[scrolling]", label: f.scrolling, setup: c, commit: d},
|
||||||
|
{id: "frameborder",
|
||||||
|
type: "checkbox", requiredContent: "iframe[frameborder]", label: f.border, setup: c, commit: d}
|
||||||
|
]},
|
||||||
|
{type: "hbox", widths: ["50%", "50%"], children: [
|
||||||
|
{id: "name", type: "text", requiredContent: "iframe[name]", label: a.name, setup: c, commit: d},
|
||||||
|
{id: "title", type: "text", requiredContent: "iframe[title]", label: a.advisoryTitle, setup: c, commit: d}
|
||||||
|
]},
|
||||||
|
{id: "longdesc", type: "text", requiredContent: "iframe[longdesc]", label: a.longDescr, setup: c, commit: d}
|
||||||
|
]},
|
||||||
|
e && e.createAdvancedTab(b, {id: 1, classes: 1, styles: 1}, "iframe")
|
||||||
|
]}
|
||||||
|
})
|
||||||
|
})();
|
|
@ -1,43 +1,453 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
||||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||||
*/
|
*/
|
||||||
(function(){var r=function(c,j){function r(){var a=arguments,b=this.getContentElement("advanced","txtdlgGenStyle");b&&b.commit.apply(b,a);this.foreach(function(b){b.commit&&"txtdlgGenStyle"!=b.id&&b.commit.apply(b,a)})}function i(a){if(!s){s=1;var b=this.getDialog(),d=b.imageElement;if(d){this.commit(f,d);for(var a=[].concat(a),e=a.length,c,g=0;g<e;g++)(c=b.getContentElement.apply(b,a[g].split(":")))&&c.setup(f,d)}s=0}}var f=1,k=/^\s*(\d+)((px)|\%)?\s*$/i,v=/(^\s*(\d+)((px)|\%)?\s*$)|^$/i,o=/^\d+px$/,
|
(function () {
|
||||||
w=function(){var a=this.getValue(),b=this.getDialog(),d=a.match(k);d&&("%"==d[2]&&l(b,!1),a=d[1]);b.lockRatio&&(d=b.originalElement,"true"==d.getCustomData("isReady")&&("txtHeight"==this.id?(a&&"0"!=a&&(a=Math.round(d.$.width*(a/d.$.height))),isNaN(a)||b.setValueOf("info","txtWidth",a)):(a&&"0"!=a&&(a=Math.round(d.$.height*(a/d.$.width))),isNaN(a)||b.setValueOf("info","txtHeight",a))));g(b)},g=function(a){if(!a.originalElement||!a.preview)return 1;a.commitContent(4,a.preview);return 0},s,l=function(a,
|
var r = function (c, j) {
|
||||||
b){if(!a.getContentElement("info","ratioLock"))return null;var d=a.originalElement;if(!d)return null;if("check"==b){if(!a.userlockRatio&&"true"==d.getCustomData("isReady")){var e=a.getValueOf("info","txtWidth"),c=a.getValueOf("info","txtHeight"),d=1E3*d.$.width/d.$.height,f=1E3*e/c;a.lockRatio=!1;!e&&!c?a.lockRatio=!0:!isNaN(d)&&!isNaN(f)&&Math.round(d)==Math.round(f)&&(a.lockRatio=!0)}}else void 0!=b?a.lockRatio=b:(a.userlockRatio=1,a.lockRatio=!a.lockRatio);e=CKEDITOR.document.getById(p);a.lockRatio?
|
function r() {
|
||||||
e.removeClass("cke_btn_unlocked"):e.addClass("cke_btn_unlocked");e.setAttribute("aria-checked",a.lockRatio);CKEDITOR.env.hc&&e.getChild(0).setHtml(a.lockRatio?CKEDITOR.env.ie?"■":"▣":CKEDITOR.env.ie?"□":"▢");return a.lockRatio},x=function(a){var b=a.originalElement;if("true"==b.getCustomData("isReady")){var d=a.getContentElement("info","txtWidth"),e=a.getContentElement("info","txtHeight");d&&d.setValue(b.$.width);e&&e.setValue(b.$.height)}g(a)},y=function(a,b){function d(a,b){var d=a.match(k);return d?
|
var a = arguments, b = this.getContentElement("advanced", "txtdlgGenStyle");
|
||||||
("%"==d[2]&&(d[1]+="%",l(e,!1)),d[1]):b}if(a==f){var e=this.getDialog(),c="",g="txtWidth"==this.id?"width":"height",h=b.getAttribute(g);h&&(c=d(h,c));c=d(b.getStyle(g),c);this.setValue(c)}},t,q=function(){var a=this.originalElement;a.setCustomData("isReady","true");a.removeListener("load",q);a.removeListener("error",h);a.removeListener("abort",h);CKEDITOR.document.getById(m).setStyle("display","none");this.dontResetSize||x(this);this.firstLoad&&CKEDITOR.tools.setTimeout(function(){l(this,"check")},
|
b && b.commit.apply(b, a);
|
||||||
0,this);this.dontResetSize=this.firstLoad=!1},h=function(){var a=this.originalElement;a.removeListener("load",q);a.removeListener("error",h);a.removeListener("abort",h);a=CKEDITOR.getUrl(CKEDITOR.plugins.get("image").path+"images/noimage.png");this.preview&&this.preview.setAttribute("src",a);CKEDITOR.document.getById(m).setStyle("display","none");l(this,!1)},n=function(a){return CKEDITOR.tools.getNextId()+"_"+a},p=n("btnLockSizes"),u=n("btnResetSize"),m=n("ImagePreviewLoader"),A=n("previewLink"),
|
this.foreach(function (b) {
|
||||||
z=n("previewImage");return{title:c.lang.image["image"==j?"title":"titleButton"],minWidth:420,minHeight:360,onShow:function(){this.linkEditMode=this.imageEditMode=this.linkElement=this.imageElement=!1;this.lockRatio=!0;this.userlockRatio=0;this.dontResetSize=!1;this.firstLoad=!0;this.addLink=!1;var a=this.getParentEditor(),b=a.getSelection(),d=(b=b&&b.getSelectedElement())&&a.elementPath(b).contains("a",1);CKEDITOR.document.getById(m).setStyle("display","none");t=new CKEDITOR.dom.element("img",a.document);
|
b.commit && "txtdlgGenStyle" != b.id && b.commit.apply(b, a)
|
||||||
this.preview=CKEDITOR.document.getById(z);this.originalElement=a.document.createElement("img");this.originalElement.setAttribute("alt","");this.originalElement.setCustomData("isReady","false");if(d){this.linkElement=d;this.linkEditMode=!0;var c=d.getChildren();if(1==c.count()){var g=c.getItem(0).getName();if("img"==g||"input"==g)this.imageElement=c.getItem(0),"img"==this.imageElement.getName()?this.imageEditMode="img":"input"==this.imageElement.getName()&&(this.imageEditMode="input")}"image"==j&&
|
})
|
||||||
this.setupContent(2,d)}if(this.customImageElement)this.imageEditMode="img",this.imageElement=this.customImageElement,delete this.customImageElement;else if(b&&"img"==b.getName()&&!b.data("cke-realelement")||b&&"input"==b.getName()&&"image"==b.getAttribute("type"))this.imageEditMode=b.getName(),this.imageElement=b;this.imageEditMode?(this.cleanImageElement=this.imageElement,this.imageElement=this.cleanImageElement.clone(!0,!0),this.setupContent(f,this.imageElement)):this.imageElement=a.document.createElement("img");
|
}
|
||||||
l(this,!0);CKEDITOR.tools.trim(this.getValueOf("info","txtUrl"))||(this.preview.removeAttribute("src"),this.preview.setStyle("display","none"))},onOk:function(){if(this.imageEditMode){var a=this.imageEditMode;"image"==j&&"input"==a&&confirm(c.lang.image.button2Img)?(this.imageElement=c.document.createElement("img"),this.imageElement.setAttribute("alt",""),c.insertElement(this.imageElement)):"image"!=j&&"img"==a&&confirm(c.lang.image.img2Button)?(this.imageElement=c.document.createElement("input"),
|
|
||||||
this.imageElement.setAttributes({type:"image",alt:""}),c.insertElement(this.imageElement)):(this.imageElement=this.cleanImageElement,delete this.cleanImageElement)}else"image"==j?this.imageElement=c.document.createElement("img"):(this.imageElement=c.document.createElement("input"),this.imageElement.setAttribute("type","image")),this.imageElement.setAttribute("alt","");this.linkEditMode||(this.linkElement=c.document.createElement("a"));this.commitContent(f,this.imageElement);this.commitContent(2,this.linkElement);
|
function i(a) {
|
||||||
this.imageElement.getAttribute("style")||this.imageElement.removeAttribute("style");this.imageEditMode?!this.linkEditMode&&this.addLink?(c.insertElement(this.linkElement),this.imageElement.appendTo(this.linkElement)):this.linkEditMode&&!this.addLink&&(c.getSelection().selectElement(this.linkElement),c.insertElement(this.imageElement)):this.addLink?this.linkEditMode?c.insertElement(this.imageElement):(c.insertElement(this.linkElement),this.linkElement.append(this.imageElement,!1)):c.insertElement(this.imageElement)},
|
if (!s) {
|
||||||
onLoad:function(){"image"!=j&&this.hidePage("Link");var a=this._.element.getDocument();this.getContentElement("info","ratioLock")&&(this.addFocusable(a.getById(u),5),this.addFocusable(a.getById(p),5));this.commitContent=r},onHide:function(){this.preview&&this.commitContent(8,this.preview);this.originalElement&&(this.originalElement.removeListener("load",q),this.originalElement.removeListener("error",h),this.originalElement.removeListener("abort",h),this.originalElement.remove(),this.originalElement=
|
s = 1;
|
||||||
!1);delete this.imageElement},contents:[{id:"info",label:c.lang.image.infoTab,accessKey:"I",elements:[{type:"vbox",padding:0,children:[{type:"hbox",widths:["280px","110px"],align:"right",children:[{id:"txtUrl",type:"text",label:c.lang.common.url,required:!0,onChange:function(){var a=this.getDialog(),b=this.getValue();if(0<b.length){var a=this.getDialog(),d=a.originalElement;a.preview.removeStyle("display");d.setCustomData("isReady","false");var c=CKEDITOR.document.getById(m);c&&c.setStyle("display",
|
var b = this.getDialog(), d = b.imageElement;
|
||||||
"");d.on("load",q,a);d.on("error",h,a);d.on("abort",h,a);d.setAttribute("src",b);t.setAttribute("src",b);a.preview.setAttribute("src",t.$.src);g(a)}else a.preview&&(a.preview.removeAttribute("src"),a.preview.setStyle("display","none"))},setup:function(a,b){if(a==f){var d=b.data("cke-saved-src")||b.getAttribute("src");this.getDialog().dontResetSize=!0;this.setValue(d);this.setInitValue()}},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())?(b.data("cke-saved-src",this.getValue()),b.setAttribute("src",
|
if (d) {
|
||||||
this.getValue())):8==a&&(b.setAttribute("src",""),b.removeAttribute("src"))},validate:CKEDITOR.dialog.validate.notEmpty(c.lang.image.urlMissing)},{type:"button",id:"browse",style:"display:inline-block;margin-top:10px;",align:"center",label:c.lang.common.browseServer,hidden:!0,filebrowser:"info:txtUrl"}]}]},{id:"txtAlt",type:"text",label:c.lang.image.alt,accessKey:"T","default":"",onChange:function(){g(this.getDialog())},setup:function(a,b){a==f&&this.setValue(b.getAttribute("alt"))},commit:function(a,
|
this.commit(f, d);
|
||||||
b){a==f?(this.getValue()||this.isChanged())&&b.setAttribute("alt",this.getValue()):4==a?b.setAttribute("alt",this.getValue()):8==a&&b.removeAttribute("alt")}},{type:"hbox",children:[{id:"basic",type:"vbox",children:[{type:"hbox",requiredContent:"img{width,height}",widths:["50%","50%"],children:[{type:"vbox",padding:1,children:[{type:"text",width:"45px",id:"txtWidth",label:c.lang.common.width,onKeyUp:w,onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:function(){var a=this.getValue().match(v);
|
for (var a = [].concat(a), e = a.length, c, g = 0; g < e; g++)(c = b.getContentElement.apply(b, a[g].split(":"))) && c.setup(f, d)
|
||||||
(a=!!(a&&0!==parseInt(a[1],10)))||alert(c.lang.common.invalidWidth);return a},setup:y,commit:function(a,b,d){var c=this.getValue();a==f?(c?b.setStyle("width",CKEDITOR.tools.cssLength(c)):b.removeStyle("width"),!d&&b.removeAttribute("width")):4==a?c.match(k)?b.setStyle("width",CKEDITOR.tools.cssLength(c)):(a=this.getDialog().originalElement,"true"==a.getCustomData("isReady")&&b.setStyle("width",a.$.width+"px")):8==a&&(b.removeAttribute("width"),b.removeStyle("width"))}},{type:"text",id:"txtHeight",
|
}
|
||||||
width:"45px",label:c.lang.common.height,onKeyUp:w,onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:function(){var a=this.getValue().match(v);(a=!!(a&&0!==parseInt(a[1],10)))||alert(c.lang.common.invalidHeight);return a},setup:y,commit:function(a,b,d){var c=this.getValue();a==f?(c?b.setStyle("height",CKEDITOR.tools.cssLength(c)):b.removeStyle("height"),!d&&b.removeAttribute("height")):4==a?c.match(k)?b.setStyle("height",CKEDITOR.tools.cssLength(c)):(a=this.getDialog().originalElement,
|
s = 0
|
||||||
"true"==a.getCustomData("isReady")&&b.setStyle("height",a.$.height+"px")):8==a&&(b.removeAttribute("height"),b.removeStyle("height"))}}]},{id:"ratioLock",type:"html",style:"margin-top:30px;width:40px;height:40px;",onLoad:function(){var a=CKEDITOR.document.getById(u),b=CKEDITOR.document.getById(p);a&&(a.on("click",function(a){x(this);a.data&&a.data.preventDefault()},this.getDialog()),a.on("mouseover",function(){this.addClass("cke_btn_over")},a),a.on("mouseout",function(){this.removeClass("cke_btn_over")},
|
}
|
||||||
a));b&&(b.on("click",function(a){l(this);var b=this.originalElement,c=this.getValueOf("info","txtWidth");if(b.getCustomData("isReady")=="true"&&c){b=b.$.height/b.$.width*c;if(!isNaN(b)){this.setValueOf("info","txtHeight",Math.round(b));g(this)}}a.data&&a.data.preventDefault()},this.getDialog()),b.on("mouseover",function(){this.addClass("cke_btn_over")},b),b.on("mouseout",function(){this.removeClass("cke_btn_over")},b))},html:'<div><a href="javascript:void(0)" tabindex="-1" title="'+c.lang.image.lockRatio+
|
}
|
||||||
'" class="cke_btn_locked" id="'+p+'" role="checkbox"><span class="cke_icon"></span><span class="cke_label">'+c.lang.image.lockRatio+'</span></a><a href="javascript:void(0)" tabindex="-1" title="'+c.lang.image.resetSize+'" class="cke_btn_reset" id="'+u+'" role="button"><span class="cke_label">'+c.lang.image.resetSize+"</span></a></div>"}]},{type:"vbox",padding:1,children:[{type:"text",id:"txtBorder",requiredContent:"img{border-width}",width:"60px",label:c.lang.image.border,"default":"",onKeyUp:function(){g(this.getDialog())},
|
|
||||||
onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateBorder),setup:function(a,b){if(a==f){var d;d=(d=(d=b.getStyle("border-width"))&&d.match(/^(\d+px)(?: \1 \1 \1)?$/))&&parseInt(d[1],10);isNaN(parseInt(d,10))&&(d=b.getAttribute("border"));this.setValue(d)}},commit:function(a,b,d){var c=parseInt(this.getValue(),10);a==f||4==a?(isNaN(c)?!c&&this.isChanged()&&b.removeStyle("border"):(b.setStyle("border-width",CKEDITOR.tools.cssLength(c)),
|
var f = 1, k = /^\s*(\d+)((px)|\%)?\s*$/i, v = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i, o = /^\d+px$/,
|
||||||
b.setStyle("border-style","solid")),!d&&a==f&&b.removeAttribute("border")):8==a&&(b.removeAttribute("border"),b.removeStyle("border-width"),b.removeStyle("border-style"),b.removeStyle("border-color"))}},{type:"text",id:"txtHSpace",requiredContent:"img{margin-left,margin-right}",width:"60px",label:c.lang.image.hSpace,"default":"",onKeyUp:function(){g(this.getDialog())},onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateHSpace),
|
w = function () {
|
||||||
setup:function(a,b){if(a==f){var d,c;d=b.getStyle("margin-left");c=b.getStyle("margin-right");d=d&&d.match(o);c=c&&c.match(o);d=parseInt(d,10);c=parseInt(c,10);d=d==c&&d;isNaN(parseInt(d,10))&&(d=b.getAttribute("hspace"));this.setValue(d)}},commit:function(a,b,c){var e=parseInt(this.getValue(),10);a==f||4==a?(isNaN(e)?!e&&this.isChanged()&&(b.removeStyle("margin-left"),b.removeStyle("margin-right")):(b.setStyle("margin-left",CKEDITOR.tools.cssLength(e)),b.setStyle("margin-right",CKEDITOR.tools.cssLength(e))),
|
var a = this.getValue(), b = this.getDialog(), d = a.match(k);
|
||||||
!c&&a==f&&b.removeAttribute("hspace")):8==a&&(b.removeAttribute("hspace"),b.removeStyle("margin-left"),b.removeStyle("margin-right"))}},{type:"text",id:"txtVSpace",requiredContent:"img{margin-top,margin-bottom}",width:"60px",label:c.lang.image.vSpace,"default":"",onKeyUp:function(){g(this.getDialog())},onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateVSpace),setup:function(a,b){if(a==f){var c,e;c=b.getStyle("margin-top");e=
|
d && ("%" == d[2] && l(b, !1), a = d[1]);
|
||||||
b.getStyle("margin-bottom");c=c&&c.match(o);e=e&&e.match(o);c=parseInt(c,10);e=parseInt(e,10);c=c==e&&c;isNaN(parseInt(c,10))&&(c=b.getAttribute("vspace"));this.setValue(c)}},commit:function(a,b,c){var e=parseInt(this.getValue(),10);a==f||4==a?(isNaN(e)?!e&&this.isChanged()&&(b.removeStyle("margin-top"),b.removeStyle("margin-bottom")):(b.setStyle("margin-top",CKEDITOR.tools.cssLength(e)),b.setStyle("margin-bottom",CKEDITOR.tools.cssLength(e))),!c&&a==f&&b.removeAttribute("vspace")):8==a&&(b.removeAttribute("vspace"),
|
b.lockRatio && (d = b.originalElement, "true" == d.getCustomData("isReady") && ("txtHeight" == this.id ? (a && "0" != a && (a = Math.round(d.$.width * (a / d.$.height))), isNaN(a) || b.setValueOf("info", "txtWidth", a)) : (a && "0" != a && (a = Math.round(d.$.height * (a / d.$.width))), isNaN(a) || b.setValueOf("info", "txtHeight", a))));
|
||||||
b.removeStyle("margin-top"),b.removeStyle("margin-bottom"))}},{id:"cmbAlign",requiredContent:"img{float}",type:"select",widths:["35%","65%"],style:"width:90px",label:c.lang.common.align,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.alignLeft,"left"],[c.lang.common.alignRight,"right"]],onChange:function(){g(this.getDialog());i.call(this,"advanced:txtdlgGenStyle")},setup:function(a,b){if(a==f){var c=b.getStyle("float");switch(c){case "inherit":case "none":c=""}!c&&(c=(b.getAttribute("align")||
|
g(b)
|
||||||
"").toLowerCase());this.setValue(c)}},commit:function(a,b,c){var e=this.getValue();if(a==f||4==a){if(e?b.setStyle("float",e):b.removeStyle("float"),!c&&a==f)switch(e=(b.getAttribute("align")||"").toLowerCase(),e){case "left":case "right":b.removeAttribute("align")}}else 8==a&&b.removeStyle("float")}}]}]},{type:"vbox",height:"250px",children:[{type:"html",id:"htmlPreview",style:"width:95%;",html:"<div>"+CKEDITOR.tools.htmlEncode(c.lang.common.preview)+'<br><div id="'+m+'" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div><div class="ImagePreviewBox"><table><tr><td><a href="javascript:void(0)" target="_blank" onclick="return false;" id="'+
|
}, g = function (a) {
|
||||||
A+'"><img id="'+z+'" alt="" /></a>'+(c.config.image_previewText||"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.")+
|
if (!a.originalElement || !a.preview)return 1;
|
||||||
"</td></tr></table></div></div>"}]}]}]},{id:"Link",requiredContent:"a[href]",label:c.lang.image.linkTab,padding:0,elements:[{id:"txtUrl",type:"text",label:c.lang.common.url,style:"width: 100%","default":"",setup:function(a,b){if(2==a){var c=b.data("cke-saved-href");c||(c=b.getAttribute("href"));this.setValue(c)}},commit:function(a,b){if(2==a&&(this.getValue()||this.isChanged())){var d=decodeURI(this.getValue());b.data("cke-saved-href",d);b.setAttribute("href",d);if(this.getValue()||!c.config.image_removeLinkByEmptyURL)this.getDialog().addLink=
|
a.commitContent(4, a.preview);
|
||||||
!0}}},{type:"button",id:"browse",filebrowser:{action:"Browse",target:"Link:txtUrl",url:c.config.filebrowserImageBrowseLinkUrl},style:"float:right",hidden:!0,label:c.lang.common.browseServer},{id:"cmbTarget",type:"select",requiredContent:"a[target]",label:c.lang.common.target,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.targetNew,"_blank"],[c.lang.common.targetTop,"_top"],[c.lang.common.targetSelf,"_self"],[c.lang.common.targetParent,"_parent"]],setup:function(a,b){2==a&&this.setValue(b.getAttribute("target")||
|
return 0
|
||||||
"")},commit:function(a,b){2==a&&(this.getValue()||this.isChanged())&&b.setAttribute("target",this.getValue())}}]},{id:"Upload",hidden:!0,filebrowser:"uploadButton",label:c.lang.image.upload,elements:[{type:"file",id:"upload",label:c.lang.image.btnUpload,style:"height:40px",size:38},{type:"fileButton",id:"uploadButton",filebrowser:"info:txtUrl",label:c.lang.image.btnUpload,"for":["Upload","upload"]}]},{id:"advanced",label:c.lang.common.advancedTab,elements:[{type:"hbox",widths:["50%","25%","25%"],
|
}, s, l = function (a, b) {
|
||||||
children:[{type:"text",id:"linkId",requiredContent:"img[id]",label:c.lang.common.id,setup:function(a,b){a==f&&this.setValue(b.getAttribute("id"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("id",this.getValue())}},{id:"cmbLangDir",type:"select",requiredContent:"img[dir]",style:"width : 100px;",label:c.lang.common.langDir,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.langDirLtr,"ltr"],[c.lang.common.langDirRtl,"rtl"]],setup:function(a,b){a==f&&this.setValue(b.getAttribute("dir"))},
|
if (!a.getContentElement("info", "ratioLock"))return null;
|
||||||
commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("dir",this.getValue())}},{type:"text",id:"txtLangCode",requiredContent:"img[lang]",label:c.lang.common.langCode,"default":"",setup:function(a,b){a==f&&this.setValue(b.getAttribute("lang"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("lang",this.getValue())}}]},{type:"text",id:"txtGenLongDescr",requiredContent:"img[longdesc]",label:c.lang.common.longDescr,setup:function(a,b){a==f&&this.setValue(b.getAttribute("longDesc"))},
|
var d = a.originalElement;
|
||||||
commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("longDesc",this.getValue())}},{type:"hbox",widths:["50%","50%"],children:[{type:"text",id:"txtGenClass",requiredContent:"img(cke-xyz)",label:c.lang.common.cssClass,"default":"",setup:function(a,b){a==f&&this.setValue(b.getAttribute("class"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("class",this.getValue())}},{type:"text",id:"txtGenTitle",requiredContent:"img[title]",label:c.lang.common.advisoryTitle,
|
if (!d)return null;
|
||||||
"default":"",onChange:function(){g(this.getDialog())},setup:function(a,b){a==f&&this.setValue(b.getAttribute("title"))},commit:function(a,b){a==f?(this.getValue()||this.isChanged())&&b.setAttribute("title",this.getValue()):4==a?b.setAttribute("title",this.getValue()):8==a&&b.removeAttribute("title")}}]},{type:"text",id:"txtdlgGenStyle",requiredContent:"img{cke-xyz}",label:c.lang.common.cssStyle,validate:CKEDITOR.dialog.validate.inlineStyle(c.lang.common.invalidInlineStyle),"default":"",setup:function(a,
|
if ("check" == b) {
|
||||||
b){if(a==f){var c=b.getAttribute("style");!c&&b.$.style.cssText&&(c=b.$.style.cssText);this.setValue(c);var e=b.$.style.height,c=b.$.style.width,e=(e?e:"").match(k),c=(c?c:"").match(k);this.attributesInStyle={height:!!e,width:!!c}}},onChange:function(){i.call(this,"info:cmbFloat info:cmbAlign info:txtVSpace info:txtHSpace info:txtBorder info:txtWidth info:txtHeight".split(" "));g(this)},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("style",this.getValue())}}]}]}};
|
if (!a.userlockRatio && "true" == d.getCustomData("isReady")) {
|
||||||
CKEDITOR.dialog.add("image",function(c){return r(c,"image")});CKEDITOR.dialog.add("imagebutton",function(c){return r(c,"imagebutton")})})();
|
var e = a.getValueOf("info", "txtWidth"), c = a.getValueOf("info", "txtHeight"), d = 1E3 * d.$.width / d.$.height, f = 1E3 * e / c;
|
||||||
|
a.lockRatio = !1;
|
||||||
|
!e && !c ? a.lockRatio = !0 : !isNaN(d) && !isNaN(f) && Math.round(d) == Math.round(f) && (a.lockRatio = !0)
|
||||||
|
}
|
||||||
|
} else void 0 != b ? a.lockRatio = b : (a.userlockRatio = 1, a.lockRatio = !a.lockRatio);
|
||||||
|
e = CKEDITOR.document.getById(p);
|
||||||
|
a.lockRatio ?
|
||||||
|
e.removeClass("cke_btn_unlocked") : e.addClass("cke_btn_unlocked");
|
||||||
|
e.setAttribute("aria-checked", a.lockRatio);
|
||||||
|
CKEDITOR.env.hc && e.getChild(0).setHtml(a.lockRatio ? CKEDITOR.env.ie ? "■" : "▣" : CKEDITOR.env.ie ? "□" : "▢");
|
||||||
|
return a.lockRatio
|
||||||
|
}, x = function (a) {
|
||||||
|
var b = a.originalElement;
|
||||||
|
if ("true" == b.getCustomData("isReady")) {
|
||||||
|
var d = a.getContentElement("info", "txtWidth"), e = a.getContentElement("info", "txtHeight");
|
||||||
|
d && d.setValue(b.$.width);
|
||||||
|
e && e.setValue(b.$.height)
|
||||||
|
}
|
||||||
|
g(a)
|
||||||
|
}, y = function (a, b) {
|
||||||
|
function d(a, b) {
|
||||||
|
var d = a.match(k);
|
||||||
|
return d ?
|
||||||
|
("%" == d[2] && (d[1] += "%", l(e, !1)), d[1]) : b
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a == f) {
|
||||||
|
var e = this.getDialog(), c = "", g = "txtWidth" == this.id ? "width" : "height", h = b.getAttribute(g);
|
||||||
|
h && (c = d(h, c));
|
||||||
|
c = d(b.getStyle(g), c);
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, t, q = function () {
|
||||||
|
var a = this.originalElement;
|
||||||
|
a.setCustomData("isReady", "true");
|
||||||
|
a.removeListener("load", q);
|
||||||
|
a.removeListener("error", h);
|
||||||
|
a.removeListener("abort", h);
|
||||||
|
CKEDITOR.document.getById(m).setStyle("display", "none");
|
||||||
|
this.dontResetSize || x(this);
|
||||||
|
this.firstLoad && CKEDITOR.tools.setTimeout(function () {
|
||||||
|
l(this, "check")
|
||||||
|
},
|
||||||
|
0, this);
|
||||||
|
this.dontResetSize = this.firstLoad = !1
|
||||||
|
}, h = function () {
|
||||||
|
var a = this.originalElement;
|
||||||
|
a.removeListener("load", q);
|
||||||
|
a.removeListener("error", h);
|
||||||
|
a.removeListener("abort", h);
|
||||||
|
a = CKEDITOR.getUrl(CKEDITOR.plugins.get("image").path + "images/noimage.png");
|
||||||
|
this.preview && this.preview.setAttribute("src", a);
|
||||||
|
CKEDITOR.document.getById(m).setStyle("display", "none");
|
||||||
|
l(this, !1)
|
||||||
|
}, n = function (a) {
|
||||||
|
return CKEDITOR.tools.getNextId() + "_" + a
|
||||||
|
}, p = n("btnLockSizes"), u = n("btnResetSize"), m = n("ImagePreviewLoader"), A = n("previewLink"),
|
||||||
|
z = n("previewImage");
|
||||||
|
return{title: c.lang.image["image" == j ? "title" : "titleButton"], minWidth: 420, minHeight: 360, onShow: function () {
|
||||||
|
this.linkEditMode = this.imageEditMode = this.linkElement = this.imageElement = !1;
|
||||||
|
this.lockRatio = !0;
|
||||||
|
this.userlockRatio = 0;
|
||||||
|
this.dontResetSize = !1;
|
||||||
|
this.firstLoad = !0;
|
||||||
|
this.addLink = !1;
|
||||||
|
var a = this.getParentEditor(), b = a.getSelection(), d = (b = b && b.getSelectedElement()) && a.elementPath(b).contains("a", 1);
|
||||||
|
CKEDITOR.document.getById(m).setStyle("display", "none");
|
||||||
|
t = new CKEDITOR.dom.element("img", a.document);
|
||||||
|
this.preview = CKEDITOR.document.getById(z);
|
||||||
|
this.originalElement = a.document.createElement("img");
|
||||||
|
this.originalElement.setAttribute("alt", "");
|
||||||
|
this.originalElement.setCustomData("isReady", "false");
|
||||||
|
if (d) {
|
||||||
|
this.linkElement = d;
|
||||||
|
this.linkEditMode = !0;
|
||||||
|
var c = d.getChildren();
|
||||||
|
if (1 == c.count()) {
|
||||||
|
var g = c.getItem(0).getName();
|
||||||
|
if ("img" == g || "input" == g)this.imageElement = c.getItem(0), "img" == this.imageElement.getName() ? this.imageEditMode = "img" : "input" == this.imageElement.getName() && (this.imageEditMode = "input")
|
||||||
|
}
|
||||||
|
"image" == j &&
|
||||||
|
this.setupContent(2, d)
|
||||||
|
}
|
||||||
|
if (this.customImageElement)this.imageEditMode = "img", this.imageElement = this.customImageElement, delete this.customImageElement; else if (b && "img" == b.getName() && !b.data("cke-realelement") || b && "input" == b.getName() && "image" == b.getAttribute("type"))this.imageEditMode = b.getName(), this.imageElement = b;
|
||||||
|
this.imageEditMode ? (this.cleanImageElement = this.imageElement, this.imageElement = this.cleanImageElement.clone(!0, !0), this.setupContent(f, this.imageElement)) : this.imageElement = a.document.createElement("img");
|
||||||
|
l(this, !0);
|
||||||
|
CKEDITOR.tools.trim(this.getValueOf("info", "txtUrl")) || (this.preview.removeAttribute("src"), this.preview.setStyle("display", "none"))
|
||||||
|
}, onOk: function () {
|
||||||
|
if (this.imageEditMode) {
|
||||||
|
var a = this.imageEditMode;
|
||||||
|
"image" == j && "input" == a && confirm(c.lang.image.button2Img) ? (this.imageElement = c.document.createElement("img"), this.imageElement.setAttribute("alt", ""), c.insertElement(this.imageElement)) : "image" != j && "img" == a && confirm(c.lang.image.img2Button) ? (this.imageElement = c.document.createElement("input"),
|
||||||
|
this.imageElement.setAttributes({type: "image", alt: ""}), c.insertElement(this.imageElement)) : (this.imageElement = this.cleanImageElement, delete this.cleanImageElement)
|
||||||
|
} else"image" == j ? this.imageElement = c.document.createElement("img") : (this.imageElement = c.document.createElement("input"), this.imageElement.setAttribute("type", "image")), this.imageElement.setAttribute("alt", "");
|
||||||
|
this.linkEditMode || (this.linkElement = c.document.createElement("a"));
|
||||||
|
this.commitContent(f, this.imageElement);
|
||||||
|
this.commitContent(2, this.linkElement);
|
||||||
|
this.imageElement.getAttribute("style") || this.imageElement.removeAttribute("style");
|
||||||
|
this.imageEditMode ? !this.linkEditMode && this.addLink ? (c.insertElement(this.linkElement), this.imageElement.appendTo(this.linkElement)) : this.linkEditMode && !this.addLink && (c.getSelection().selectElement(this.linkElement), c.insertElement(this.imageElement)) : this.addLink ? this.linkEditMode ? c.insertElement(this.imageElement) : (c.insertElement(this.linkElement), this.linkElement.append(this.imageElement, !1)) : c.insertElement(this.imageElement)
|
||||||
|
},
|
||||||
|
onLoad: function () {
|
||||||
|
"image" != j && this.hidePage("Link");
|
||||||
|
var a = this._.element.getDocument();
|
||||||
|
this.getContentElement("info", "ratioLock") && (this.addFocusable(a.getById(u), 5), this.addFocusable(a.getById(p), 5));
|
||||||
|
this.commitContent = r
|
||||||
|
}, onHide: function () {
|
||||||
|
this.preview && this.commitContent(8, this.preview);
|
||||||
|
this.originalElement && (this.originalElement.removeListener("load", q), this.originalElement.removeListener("error", h), this.originalElement.removeListener("abort", h), this.originalElement.remove(), this.originalElement = !1);
|
||||||
|
delete this.imageElement
|
||||||
|
}, contents: [
|
||||||
|
{id: "info", label: c.lang.image.infoTab, accessKey: "I", elements: [
|
||||||
|
{type: "vbox", padding: 0, children: [
|
||||||
|
{type: "hbox", widths: ["280px", "110px"], align: "right", children: [
|
||||||
|
{id: "txtUrl", type: "text", label: c.lang.common.url, required: !0, onChange: function () {
|
||||||
|
var a = this.getDialog(), b = this.getValue();
|
||||||
|
if (0 < b.length) {
|
||||||
|
var a = this.getDialog(), d = a.originalElement;
|
||||||
|
a.preview.removeStyle("display");
|
||||||
|
d.setCustomData("isReady", "false");
|
||||||
|
var c = CKEDITOR.document.getById(m);
|
||||||
|
c && c.setStyle("display",
|
||||||
|
"");
|
||||||
|
d.on("load", q, a);
|
||||||
|
d.on("error", h, a);
|
||||||
|
d.on("abort", h, a);
|
||||||
|
d.setAttribute("src", b);
|
||||||
|
t.setAttribute("src", b);
|
||||||
|
a.preview.setAttribute("src", t.$.src);
|
||||||
|
g(a)
|
||||||
|
} else a.preview && (a.preview.removeAttribute("src"), a.preview.setStyle("display", "none"))
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var d = b.data("cke-saved-src") || b.getAttribute("src");
|
||||||
|
this.getDialog().dontResetSize = !0;
|
||||||
|
this.setValue(d);
|
||||||
|
this.setInitValue()
|
||||||
|
}
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) ? (b.data("cke-saved-src", this.getValue()), b.setAttribute("src",
|
||||||
|
this.getValue())) : 8 == a && (b.setAttribute("src", ""), b.removeAttribute("src"))
|
||||||
|
}, validate: CKEDITOR.dialog.validate.notEmpty(c.lang.image.urlMissing)},
|
||||||
|
{type: "button", id: "browse", style: "display:inline-block;margin-top:10px;", align: "center", label: c.lang.common.browseServer, hidden: !0, filebrowser: "info:txtUrl"}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{id: "txtAlt", type: "text", label: c.lang.image.alt, accessKey: "T", "default": "", onChange: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("alt"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f ? (this.getValue() || this.isChanged()) && b.setAttribute("alt", this.getValue()) : 4 == a ? b.setAttribute("alt", this.getValue()) : 8 == a && b.removeAttribute("alt")
|
||||||
|
}},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{id: "basic", type: "vbox", children: [
|
||||||
|
{type: "hbox", requiredContent: "img{width,height}", widths: ["50%", "50%"], children: [
|
||||||
|
{type: "vbox", padding: 1, children: [
|
||||||
|
{type: "text", width: "45px", id: "txtWidth", label: c.lang.common.width, onKeyUp: w, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: function () {
|
||||||
|
var a = this.getValue().match(v);
|
||||||
|
(a = !!(a && 0 !== parseInt(a[1], 10))) || alert(c.lang.common.invalidWidth);
|
||||||
|
return a
|
||||||
|
}, setup: y, commit: function (a, b, d) {
|
||||||
|
var c = this.getValue();
|
||||||
|
a == f ? (c ? b.setStyle("width", CKEDITOR.tools.cssLength(c)) : b.removeStyle("width"), !d && b.removeAttribute("width")) : 4 == a ? c.match(k) ? b.setStyle("width", CKEDITOR.tools.cssLength(c)) : (a = this.getDialog().originalElement, "true" == a.getCustomData("isReady") && b.setStyle("width", a.$.width + "px")) : 8 == a && (b.removeAttribute("width"), b.removeStyle("width"))
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtHeight",
|
||||||
|
width: "45px", label: c.lang.common.height, onKeyUp: w, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: function () {
|
||||||
|
var a = this.getValue().match(v);
|
||||||
|
(a = !!(a && 0 !== parseInt(a[1], 10))) || alert(c.lang.common.invalidHeight);
|
||||||
|
return a
|
||||||
|
}, setup: y, commit: function (a, b, d) {
|
||||||
|
var c = this.getValue();
|
||||||
|
a == f ? (c ? b.setStyle("height", CKEDITOR.tools.cssLength(c)) : b.removeStyle("height"), !d && b.removeAttribute("height")) : 4 == a ? c.match(k) ? b.setStyle("height", CKEDITOR.tools.cssLength(c)) : (a = this.getDialog().originalElement,
|
||||||
|
"true" == a.getCustomData("isReady") && b.setStyle("height", a.$.height + "px")) : 8 == a && (b.removeAttribute("height"), b.removeStyle("height"))
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{id: "ratioLock", type: "html", style: "margin-top:30px;width:40px;height:40px;", onLoad: function () {
|
||||||
|
var a = CKEDITOR.document.getById(u), b = CKEDITOR.document.getById(p);
|
||||||
|
a && (a.on("click", function (a) {
|
||||||
|
x(this);
|
||||||
|
a.data && a.data.preventDefault()
|
||||||
|
}, this.getDialog()), a.on("mouseover", function () {
|
||||||
|
this.addClass("cke_btn_over")
|
||||||
|
}, a), a.on("mouseout", function () {
|
||||||
|
this.removeClass("cke_btn_over")
|
||||||
|
},
|
||||||
|
a));
|
||||||
|
b && (b.on("click", function (a) {
|
||||||
|
l(this);
|
||||||
|
var b = this.originalElement, c = this.getValueOf("info", "txtWidth");
|
||||||
|
if (b.getCustomData("isReady") == "true" && c) {
|
||||||
|
b = b.$.height / b.$.width * c;
|
||||||
|
if (!isNaN(b)) {
|
||||||
|
this.setValueOf("info", "txtHeight", Math.round(b));
|
||||||
|
g(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a.data && a.data.preventDefault()
|
||||||
|
}, this.getDialog()), b.on("mouseover", function () {
|
||||||
|
this.addClass("cke_btn_over")
|
||||||
|
}, b), b.on("mouseout", function () {
|
||||||
|
this.removeClass("cke_btn_over")
|
||||||
|
}, b))
|
||||||
|
}, html: '<div><a href="javascript:void(0)" tabindex="-1" title="' + c.lang.image.lockRatio +
|
||||||
|
'" class="cke_btn_locked" id="' + p + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + c.lang.image.lockRatio + '</span></a><a href="javascript:void(0)" tabindex="-1" title="' + c.lang.image.resetSize + '" class="cke_btn_reset" id="' + u + '" role="button"><span class="cke_label">' + c.lang.image.resetSize + "</span></a></div>"}
|
||||||
|
]},
|
||||||
|
{type: "vbox", padding: 1, children: [
|
||||||
|
{type: "text", id: "txtBorder", requiredContent: "img{border-width}", width: "60px", label: c.lang.image.border, "default": "", onKeyUp: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
},
|
||||||
|
onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: CKEDITOR.dialog.validate.integer(c.lang.image.validateBorder), setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var d;
|
||||||
|
d = (d = (d = b.getStyle("border-width")) && d.match(/^(\d+px)(?: \1 \1 \1)?$/)) && parseInt(d[1], 10);
|
||||||
|
isNaN(parseInt(d, 10)) && (d = b.getAttribute("border"));
|
||||||
|
this.setValue(d)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, d) {
|
||||||
|
var c = parseInt(this.getValue(), 10);
|
||||||
|
a == f || 4 == a ? (isNaN(c) ? !c && this.isChanged() && b.removeStyle("border") : (b.setStyle("border-width", CKEDITOR.tools.cssLength(c)),
|
||||||
|
b.setStyle("border-style", "solid")), !d && a == f && b.removeAttribute("border")) : 8 == a && (b.removeAttribute("border"), b.removeStyle("border-width"), b.removeStyle("border-style"), b.removeStyle("border-color"))
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtHSpace", requiredContent: "img{margin-left,margin-right}", width: "60px", label: c.lang.image.hSpace, "default": "", onKeyUp: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: CKEDITOR.dialog.validate.integer(c.lang.image.validateHSpace),
|
||||||
|
setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var d, c;
|
||||||
|
d = b.getStyle("margin-left");
|
||||||
|
c = b.getStyle("margin-right");
|
||||||
|
d = d && d.match(o);
|
||||||
|
c = c && c.match(o);
|
||||||
|
d = parseInt(d, 10);
|
||||||
|
c = parseInt(c, 10);
|
||||||
|
d = d == c && d;
|
||||||
|
isNaN(parseInt(d, 10)) && (d = b.getAttribute("hspace"));
|
||||||
|
this.setValue(d)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, c) {
|
||||||
|
var e = parseInt(this.getValue(), 10);
|
||||||
|
a == f || 4 == a ? (isNaN(e) ? !e && this.isChanged() && (b.removeStyle("margin-left"), b.removeStyle("margin-right")) : (b.setStyle("margin-left", CKEDITOR.tools.cssLength(e)), b.setStyle("margin-right", CKEDITOR.tools.cssLength(e))),
|
||||||
|
!c && a == f && b.removeAttribute("hspace")) : 8 == a && (b.removeAttribute("hspace"), b.removeStyle("margin-left"), b.removeStyle("margin-right"))
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtVSpace", requiredContent: "img{margin-top,margin-bottom}", width: "60px", label: c.lang.image.vSpace, "default": "", onKeyUp: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: CKEDITOR.dialog.validate.integer(c.lang.image.validateVSpace), setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var c, e;
|
||||||
|
c = b.getStyle("margin-top");
|
||||||
|
e =
|
||||||
|
b.getStyle("margin-bottom");
|
||||||
|
c = c && c.match(o);
|
||||||
|
e = e && e.match(o);
|
||||||
|
c = parseInt(c, 10);
|
||||||
|
e = parseInt(e, 10);
|
||||||
|
c = c == e && c;
|
||||||
|
isNaN(parseInt(c, 10)) && (c = b.getAttribute("vspace"));
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, c) {
|
||||||
|
var e = parseInt(this.getValue(), 10);
|
||||||
|
a == f || 4 == a ? (isNaN(e) ? !e && this.isChanged() && (b.removeStyle("margin-top"), b.removeStyle("margin-bottom")) : (b.setStyle("margin-top", CKEDITOR.tools.cssLength(e)), b.setStyle("margin-bottom", CKEDITOR.tools.cssLength(e))), !c && a == f && b.removeAttribute("vspace")) : 8 == a && (b.removeAttribute("vspace"),
|
||||||
|
b.removeStyle("margin-top"), b.removeStyle("margin-bottom"))
|
||||||
|
}},
|
||||||
|
{id: "cmbAlign", requiredContent: "img{float}", type: "select", widths: ["35%", "65%"], style: "width:90px", label: c.lang.common.align, "default": "", items: [
|
||||||
|
[c.lang.common.notSet, ""],
|
||||||
|
[c.lang.common.alignLeft, "left"],
|
||||||
|
[c.lang.common.alignRight, "right"]
|
||||||
|
], onChange: function () {
|
||||||
|
g(this.getDialog());
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var c = b.getStyle("float");
|
||||||
|
switch (c) {
|
||||||
|
case "inherit":
|
||||||
|
case "none":
|
||||||
|
c = ""
|
||||||
|
}
|
||||||
|
!c && (c = (b.getAttribute("align") ||
|
||||||
|
"").toLowerCase());
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, c) {
|
||||||
|
var e = this.getValue();
|
||||||
|
if (a == f || 4 == a) {
|
||||||
|
if (e ? b.setStyle("float", e) : b.removeStyle("float"), !c && a == f)switch (e = (b.getAttribute("align") || "").toLowerCase(), e) {
|
||||||
|
case "left":
|
||||||
|
case "right":
|
||||||
|
b.removeAttribute("align")
|
||||||
|
}
|
||||||
|
} else 8 == a && b.removeStyle("float")
|
||||||
|
}}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{type: "vbox", height: "250px", children: [
|
||||||
|
{type: "html", id: "htmlPreview", style: "width:95%;", html: "<div>" + CKEDITOR.tools.htmlEncode(c.lang.common.preview) + '<br><div id="' + m + '" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div><div class="ImagePreviewBox"><table><tr><td><a href="javascript:void(0)" target="_blank" onclick="return false;" id="' +
|
||||||
|
A + '"><img id="' + z + '" alt="" /></a>' + (c.config.image_previewText || "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.") +
|
||||||
|
"</td></tr></table></div></div>"}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{id: "Link", requiredContent: "a[href]", label: c.lang.image.linkTab, padding: 0, elements: [
|
||||||
|
{id: "txtUrl", type: "text", label: c.lang.common.url, style: "width: 100%", "default": "", setup: function (a, b) {
|
||||||
|
if (2 == a) {
|
||||||
|
var c = b.data("cke-saved-href");
|
||||||
|
c || (c = b.getAttribute("href"));
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
if (2 == a && (this.getValue() || this.isChanged())) {
|
||||||
|
var d = decodeURI(this.getValue());
|
||||||
|
b.data("cke-saved-href", d);
|
||||||
|
b.setAttribute("href", d);
|
||||||
|
if (this.getValue() || !c.config.image_removeLinkByEmptyURL)this.getDialog().addLink = !0
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{type: "button", id: "browse", filebrowser: {action: "Browse", target: "Link:txtUrl", url: c.config.filebrowserImageBrowseLinkUrl}, style: "float:right", hidden: !0, label: c.lang.common.browseServer},
|
||||||
|
{id: "cmbTarget", type: "select", requiredContent: "a[target]", label: c.lang.common.target, "default": "", items: [
|
||||||
|
[c.lang.common.notSet, ""],
|
||||||
|
[c.lang.common.targetNew, "_blank"],
|
||||||
|
[c.lang.common.targetTop, "_top"],
|
||||||
|
[c.lang.common.targetSelf, "_self"],
|
||||||
|
[c.lang.common.targetParent, "_parent"]
|
||||||
|
], setup: function (a, b) {
|
||||||
|
2 == a && this.setValue(b.getAttribute("target") ||
|
||||||
|
"")
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
2 == a && (this.getValue() || this.isChanged()) && b.setAttribute("target", this.getValue())
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{id: "Upload", hidden: !0, filebrowser: "uploadButton", label: c.lang.image.upload, elements: [
|
||||||
|
{type: "file", id: "upload", label: c.lang.image.btnUpload, style: "height:40px", size: 38},
|
||||||
|
{type: "fileButton", id: "uploadButton", filebrowser: "info:txtUrl", label: c.lang.image.btnUpload, "for": ["Upload", "upload"]}
|
||||||
|
]},
|
||||||
|
{id: "advanced", label: c.lang.common.advancedTab, elements: [
|
||||||
|
{type: "hbox", widths: ["50%", "25%", "25%"],
|
||||||
|
children: [
|
||||||
|
{type: "text", id: "linkId", requiredContent: "img[id]", label: c.lang.common.id, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("id"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("id", this.getValue())
|
||||||
|
}},
|
||||||
|
{id: "cmbLangDir", type: "select", requiredContent: "img[dir]", style: "width : 100px;", label: c.lang.common.langDir, "default": "", items: [
|
||||||
|
[c.lang.common.notSet, ""],
|
||||||
|
[c.lang.common.langDirLtr, "ltr"],
|
||||||
|
[c.lang.common.langDirRtl, "rtl"]
|
||||||
|
], setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("dir"))
|
||||||
|
},
|
||||||
|
commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("dir", this.getValue())
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtLangCode", requiredContent: "img[lang]", label: c.lang.common.langCode, "default": "", setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("lang"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("lang", this.getValue())
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{type: "text", id: "txtGenLongDescr", requiredContent: "img[longdesc]", label: c.lang.common.longDescr, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("longDesc"))
|
||||||
|
},
|
||||||
|
commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("longDesc", this.getValue())
|
||||||
|
}},
|
||||||
|
{type: "hbox", widths: ["50%", "50%"], children: [
|
||||||
|
{type: "text", id: "txtGenClass", requiredContent: "img(cke-xyz)", label: c.lang.common.cssClass, "default": "", setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("class"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("class", this.getValue())
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtGenTitle", requiredContent: "img[title]", label: c.lang.common.advisoryTitle,
|
||||||
|
"default": "", onChange: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("title"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f ? (this.getValue() || this.isChanged()) && b.setAttribute("title", this.getValue()) : 4 == a ? b.setAttribute("title", this.getValue()) : 8 == a && b.removeAttribute("title")
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{type: "text", id: "txtdlgGenStyle", requiredContent: "img{cke-xyz}", label: c.lang.common.cssStyle, validate: CKEDITOR.dialog.validate.inlineStyle(c.lang.common.invalidInlineStyle), "default": "", setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var c = b.getAttribute("style");
|
||||||
|
!c && b.$.style.cssText && (c = b.$.style.cssText);
|
||||||
|
this.setValue(c);
|
||||||
|
var e = b.$.style.height, c = b.$.style.width, e = (e ? e : "").match(k), c = (c ? c : "").match(k);
|
||||||
|
this.attributesInStyle = {height: !!e, width: !!c}
|
||||||
|
}
|
||||||
|
}, onChange: function () {
|
||||||
|
i.call(this, "info:cmbFloat info:cmbAlign info:txtVSpace info:txtHSpace info:txtBorder info:txtWidth info:txtHeight".split(" "));
|
||||||
|
g(this)
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("style", this.getValue())
|
||||||
|
}}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
};
|
||||||
|
CKEDITOR.dialog.add("image", function (c) {
|
||||||
|
return r(c, "image")
|
||||||
|
});
|
||||||
|
CKEDITOR.dialog.add("imagebutton", function (c) {
|
||||||
|
return r(c, "imagebutton")
|
||||||
|
})
|
||||||
|
})();
|
|
@ -1,37 +1,492 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
||||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||||
*/
|
*/
|
||||||
CKEDITOR.dialog.add("link",function(n){var p,q;function r(a){return a.replace(/'/g,"\\$&")}function t(a){var g,c=p,d,e;g=[q,"("];for(var b=0;b<c.length;b++)d=c[b].toLowerCase(),e=a[d],0<b&&g.push(","),g.push("'",e?r(encodeURIComponent(a[d])):"","'");g.push(")");return g.join("")}function u(a){for(var g,c=a.length,d=[],e=0;e<c;e++)g=a.charCodeAt(e),d.push(g);return"String.fromCharCode("+d.join(",")+")"}function v(a){return(a=a.getAttribute("class"))?a.replace(/\s*(?:cke_anchor_empty|cke_anchor)(?:\s*$)?/g,
|
CKEDITOR.dialog.add("link", function (n) {
|
||||||
""):""}var w=CKEDITOR.plugins.link,s=function(){var a=this.getDialog(),g=a.getContentElement("target","popupFeatures"),a=a.getContentElement("target","linkTargetName"),c=this.getValue();if(g&&a)switch(g=g.getElement(),g.hide(),a.setValue(""),c){case "frame":a.setLabel(n.lang.link.targetFrameName);a.getElement().show();break;case "popup":g.show();a.setLabel(n.lang.link.targetPopupName);a.getElement().show();break;default:a.setValue(c),a.getElement().hide()}},x=/^javascript:/,y=/^mailto:([^?]+)(?:\?(.+))?$/,
|
var p, q;
|
||||||
z=/subject=([^;?:@&=$,\/]*)/,A=/body=([^;?:@&=$,\/]*)/,B=/^#(.*)$/,C=/^((?:http|https|ftp|news):\/\/)?(.*)$/,D=/^(_(?:self|top|parent|blank))$/,E=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,F=/^javascript:([^(]+)\(([^)]+)\)$/,G=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,H=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,I=function(a,g){var c=g&&(g.data("cke-saved-href")||g.getAttribute("href"))||"",d,e,b=
|
|
||||||
{};c.match(x)&&("encode"==o?c=c.replace(E,function(a,c,b){return"mailto:"+String.fromCharCode.apply(String,c.split(","))+(b&&b.replace(/\\'/g,"'"))}):o&&c.replace(F,function(a,c,d){if(c==q){b.type="email";for(var a=b.email={},c=/(^')|('$)/g,d=d.match(/[^,\s]+/g),e=d.length,g,f,h=0;h<e;h++)g=decodeURIComponent,f=d[h].replace(c,"").replace(/\\'/g,"'"),f=g(f),g=p[h].toLowerCase(),a[g]=f;a.address=[a.name,a.domain].join("@")}}));if(!b.type)if(d=c.match(B))b.type="anchor",b.anchor={},b.anchor.name=b.anchor.id=
|
function r(a) {
|
||||||
d[1];else if(d=c.match(y)){e=c.match(z);c=c.match(A);b.type="email";var f=b.email={};f.address=d[1];e&&(f.subject=decodeURIComponent(e[1]));c&&(f.body=decodeURIComponent(c[1]))}else c&&(e=c.match(C))?(b.type="url",b.url={},b.url.protocol=e[1],b.url.url=e[2]):b.type="url";if(g){d=g.getAttribute("target");b.target={};b.adv={};if(d)d.match(D)?b.target.type=b.target.name=d:(b.target.type="frame",b.target.name=d);else if(d=(d=g.data("cke-pa-onclick")||g.getAttribute("onclick"))&&d.match(G)){b.target.type=
|
return a.replace(/'/g, "\\$&")
|
||||||
"popup";for(b.target.name=d[1];c=H.exec(d[2]);)("yes"==c[2]||"1"==c[2])&&!(c[1]in{height:1,width:1,top:1,left:1})?b.target[c[1]]=!0:isFinite(c[2])&&(b.target[c[1]]=c[2])}d=function(a,c){var d=g.getAttribute(c);null!==d&&(b.adv[a]=d||"")};d("advId","id");d("advLangDir","dir");d("advAccessKey","accessKey");b.adv.advName=g.data("cke-saved-name")||g.getAttribute("name")||"";d("advLangCode","lang");d("advTabIndex","tabindex");d("advTitle","title");d("advContentType","type");CKEDITOR.plugins.link.synAnchorSelector?
|
}
|
||||||
b.adv.advCSSClasses=v(g):d("advCSSClasses","class");d("advCharset","charset");d("advStyles","style");d("advRel","rel")}d=b.anchors=[];var h;if(CKEDITOR.plugins.link.emptyAnchorFix){f=a.document.getElementsByTag("a");c=0;for(e=f.count();c<e;c++)if(h=f.getItem(c),h.data("cke-saved-name")||h.hasAttribute("name"))d.push({name:h.data("cke-saved-name")||h.getAttribute("name"),id:h.getAttribute("id")})}else{f=new CKEDITOR.dom.nodeList(a.document.$.anchors);c=0;for(e=f.count();c<e;c++)h=f.getItem(c),d[c]=
|
|
||||||
{name:h.getAttribute("name"),id:h.getAttribute("id")}}if(CKEDITOR.plugins.link.fakeAnchor){f=a.document.getElementsByTag("img");c=0;for(e=f.count();c<e;c++)(h=CKEDITOR.plugins.link.tryRestoreFakeAnchor(a,f.getItem(c)))&&d.push({name:h.getAttribute("name"),id:h.getAttribute("id")})}this._.selectedElement=g;return b},j=function(a){a.target&&this.setValue(a.target[this.id]||"")},k=function(a){a.adv&&this.setValue(a.adv[this.id]||"")},l=function(a){a.target||(a.target={});a.target[this.id]=this.getValue()||
|
function t(a) {
|
||||||
""},m=function(a){a.adv||(a.adv={});a.adv[this.id]=this.getValue()||""},o=n.config.emailProtection||"";o&&"encode"!=o&&(q=p=void 0,o.replace(/^([^(]+)\(([^)]+)\)$/,function(a,b,c){q=b;p=[];c.replace(/[^,\s]+/g,function(a){p.push(a)})}));var i=n.lang.common,b=n.lang.link;return{title:b.title,minWidth:350,minHeight:230,contents:[{id:"info",label:b.info,title:b.info,elements:[{id:"linkType",type:"select",label:b.type,"default":"url",items:[[b.toUrl,"url"],[b.toAnchor,"anchor"],[b.toEmail,"email"]],onChange:function(){var a=
|
var g, c = p, d, e;
|
||||||
this.getDialog(),b=["urlOptions","anchorOptions","emailOptions"],c=this.getValue(),d=a.definition.getContents("upload"),d=d&&d.hidden;if(c=="url"){n.config.linkShowTargetTab&&a.showPage("target");d||a.showPage("upload")}else{a.hidePage("target");d||a.hidePage("upload")}for(d=0;d<b.length;d++){var e=a.getContentElement("info",b[d]);if(e){e=e.getElement().getParent().getParent();b[d]==c+"Options"?e.show():e.hide()}}a.layout()},setup:function(a){a.type&&this.setValue(a.type)},commit:function(a){a.type=
|
g = [q, "("];
|
||||||
this.getValue()}},{type:"vbox",id:"urlOptions",children:[{type:"hbox",widths:["25%","75%"],children:[{id:"protocol",type:"select",label:i.protocol,"default":"http://",items:[["http://","http://"],["https://","https://"],["ftp://","ftp://"],["news://","news://"],[b.other,""]],setup:function(a){a.url&&this.setValue(a.url.protocol||"")},commit:function(a){if(!a.url)a.url={};a.url.protocol=this.getValue()}},{type:"text",id:"url",label:i.url,required:!0,onLoad:function(){this.allowOnChange=true},onKeyUp:function(){this.allowOnChange=
|
for (var b = 0; b < c.length; b++)d = c[b].toLowerCase(), e = a[d], 0 < b && g.push(","), g.push("'", e ? r(encodeURIComponent(a[d])) : "", "'");
|
||||||
false;var a=this.getDialog().getContentElement("info","protocol"),b=this.getValue(),c=/^((javascript:)|[#\/\.\?])/i,d=/^(http|https|ftp|news):\/\/(?=.)/i.exec(b);if(d){this.setValue(b.substr(d[0].length));a.setValue(d[0].toLowerCase())}else c.test(b)&&a.setValue("");this.allowOnChange=true},onChange:function(){if(this.allowOnChange)this.onKeyUp()},validate:function(){var a=this.getDialog();if(a.getContentElement("info","linkType")&&a.getValueOf("info","linkType")!="url")return true;if(/javascript\:/.test(this.getValue())){alert(i.invalidValue);
|
g.push(")");
|
||||||
return false}return this.getDialog().fakeObj?true:CKEDITOR.dialog.validate.notEmpty(b.noUrl).apply(this)},setup:function(a){this.allowOnChange=false;a.url&&this.setValue(a.url.url);this.allowOnChange=true},commit:function(a){this.onChange();if(!a.url)a.url={};a.url.url=this.getValue();this.allowOnChange=false}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().show()}},{type:"button",id:"browse",hidden:"true",filebrowser:"info:url",label:i.browseServer}]},
|
return g.join("")
|
||||||
{type:"vbox",id:"anchorOptions",width:260,align:"center",padding:0,children:[{type:"fieldset",id:"selectAnchorText",label:b.selectAnchor,setup:function(a){a.anchors.length>0?this.getElement().show():this.getElement().hide()},children:[{type:"hbox",id:"selectAnchor",children:[{type:"select",id:"anchorName","default":"",label:b.anchorName,style:"width: 100%;",items:[[""]],setup:function(a){this.clear();this.add("");for(var b=0;b<a.anchors.length;b++)a.anchors[b].name&&this.add(a.anchors[b].name);a.anchor&&
|
}
|
||||||
this.setValue(a.anchor.name);(a=this.getDialog().getContentElement("info","linkType"))&&a.getValue()=="email"&&this.focus()},commit:function(a){if(!a.anchor)a.anchor={};a.anchor.name=this.getValue()}},{type:"select",id:"anchorId","default":"",label:b.anchorId,style:"width: 100%;",items:[[""]],setup:function(a){this.clear();this.add("");for(var b=0;b<a.anchors.length;b++)a.anchors[b].id&&this.add(a.anchors[b].id);a.anchor&&this.setValue(a.anchor.id)},commit:function(a){if(!a.anchor)a.anchor={};a.anchor.id=
|
|
||||||
this.getValue()}}],setup:function(a){a.anchors.length>0?this.getElement().show():this.getElement().hide()}}]},{type:"html",id:"noAnchors",style:"text-align: center;",html:'<div role="note" tabIndex="-1">'+CKEDITOR.tools.htmlEncode(b.noAnchors)+"</div>",focus:!0,setup:function(a){a.anchors.length<1?this.getElement().show():this.getElement().hide()}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().hide()}},{type:"vbox",id:"emailOptions",padding:1,children:[{type:"text",
|
function u(a) {
|
||||||
id:"emailAddress",label:b.emailAddress,required:!0,validate:function(){var a=this.getDialog();return!a.getContentElement("info","linkType")||a.getValueOf("info","linkType")!="email"?true:CKEDITOR.dialog.validate.notEmpty(b.noEmail).apply(this)},setup:function(a){a.email&&this.setValue(a.email.address);(a=this.getDialog().getContentElement("info","linkType"))&&a.getValue()=="email"&&this.select()},commit:function(a){if(!a.email)a.email={};a.email.address=this.getValue()}},{type:"text",id:"emailSubject",
|
for (var g, c = a.length, d = [], e = 0; e < c; e++)g = a.charCodeAt(e), d.push(g);
|
||||||
label:b.emailSubject,setup:function(a){a.email&&this.setValue(a.email.subject)},commit:function(a){if(!a.email)a.email={};a.email.subject=this.getValue()}},{type:"textarea",id:"emailBody",label:b.emailBody,rows:3,"default":"",setup:function(a){a.email&&this.setValue(a.email.body)},commit:function(a){if(!a.email)a.email={};a.email.body=this.getValue()}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().hide()}}]},{id:"target",requiredContent:"a[target]",label:b.target,
|
return"String.fromCharCode(" + d.join(",") + ")"
|
||||||
title:b.target,elements:[{type:"hbox",widths:["50%","50%"],children:[{type:"select",id:"linkTargetType",label:i.target,"default":"notSet",style:"width : 100%;",items:[[i.notSet,"notSet"],[b.targetFrame,"frame"],[b.targetPopup,"popup"],[i.targetNew,"_blank"],[i.targetTop,"_top"],[i.targetSelf,"_self"],[i.targetParent,"_parent"]],onChange:s,setup:function(a){a.target&&this.setValue(a.target.type||"notSet");s.call(this)},commit:function(a){if(!a.target)a.target={};a.target.type=this.getValue()}},{type:"text",
|
}
|
||||||
id:"linkTargetName",label:b.targetFrameName,"default":"",setup:function(a){a.target&&this.setValue(a.target.name)},commit:function(a){if(!a.target)a.target={};a.target.name=this.getValue().replace(/\W/gi,"")}}]},{type:"vbox",width:"100%",align:"center",padding:2,id:"popupFeatures",children:[{type:"fieldset",label:b.popupFeatures,children:[{type:"hbox",children:[{type:"checkbox",id:"resizable",label:b.popupResizable,setup:j,commit:l},{type:"checkbox",id:"status",label:b.popupStatusBar,setup:j,commit:l}]},
|
|
||||||
{type:"hbox",children:[{type:"checkbox",id:"location",label:b.popupLocationBar,setup:j,commit:l},{type:"checkbox",id:"toolbar",label:b.popupToolbar,setup:j,commit:l}]},{type:"hbox",children:[{type:"checkbox",id:"menubar",label:b.popupMenuBar,setup:j,commit:l},{type:"checkbox",id:"fullscreen",label:b.popupFullScreen,setup:j,commit:l}]},{type:"hbox",children:[{type:"checkbox",id:"scrollbars",label:b.popupScrollBars,setup:j,commit:l},{type:"checkbox",id:"dependent",label:b.popupDependent,setup:j,commit:l}]},
|
function v(a) {
|
||||||
{type:"hbox",children:[{type:"text",widths:["50%","50%"],labelLayout:"horizontal",label:i.width,id:"width",setup:j,commit:l},{type:"text",labelLayout:"horizontal",widths:["50%","50%"],label:b.popupLeft,id:"left",setup:j,commit:l}]},{type:"hbox",children:[{type:"text",labelLayout:"horizontal",widths:["50%","50%"],label:i.height,id:"height",setup:j,commit:l},{type:"text",labelLayout:"horizontal",label:b.popupTop,widths:["50%","50%"],id:"top",setup:j,commit:l}]}]}]}]},{id:"upload",label:b.upload,title:b.upload,
|
return(a = a.getAttribute("class")) ? a.replace(/\s*(?:cke_anchor_empty|cke_anchor)(?:\s*$)?/g,
|
||||||
hidden:!0,filebrowser:"uploadButton",elements:[{type:"file",id:"upload",label:i.upload,style:"height:40px",size:29},{type:"fileButton",id:"uploadButton",label:i.uploadSubmit,filebrowser:"info:url","for":["upload","upload"]}]},{id:"advanced",label:b.advanced,title:b.advanced,elements:[{type:"vbox",padding:1,children:[{type:"hbox",widths:["45%","35%","20%"],children:[{type:"text",id:"advId",requiredContent:"a[id]",label:b.id,setup:k,commit:m},{type:"select",id:"advLangDir",requiredContent:"a[dir]",
|
"") : ""
|
||||||
label:b.langDir,"default":"",style:"width:110px",items:[[i.notSet,""],[b.langDirLTR,"ltr"],[b.langDirRTL,"rtl"]],setup:k,commit:m},{type:"text",id:"advAccessKey",requiredContent:"a[accesskey]",width:"80px",label:b.acccessKey,maxLength:1,setup:k,commit:m}]},{type:"hbox",widths:["45%","35%","20%"],children:[{type:"text",label:b.name,id:"advName",requiredContent:"a[name]",setup:k,commit:m},{type:"text",label:b.langCode,id:"advLangCode",requiredContent:"a[lang]",width:"110px","default":"",setup:k,commit:m},
|
}
|
||||||
{type:"text",label:b.tabIndex,id:"advTabIndex",requiredContent:"a[tabindex]",width:"80px",maxLength:5,setup:k,commit:m}]}]},{type:"vbox",padding:1,children:[{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:b.advisoryTitle,requiredContent:"a[title]","default":"",id:"advTitle",setup:k,commit:m},{type:"text",label:b.advisoryContentType,requiredContent:"a[type]","default":"",id:"advContentType",setup:k,commit:m}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:b.cssClasses,
|
|
||||||
requiredContent:"a(cke-xyz)","default":"",id:"advCSSClasses",setup:k,commit:m},{type:"text",label:b.charset,requiredContent:"a[charset]","default":"",id:"advCharset",setup:k,commit:m}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:b.rel,requiredContent:"a[rel]","default":"",id:"advRel",setup:k,commit:m},{type:"text",label:b.styles,requiredContent:"a{cke-xyz}","default":"",id:"advStyles",validate:CKEDITOR.dialog.validate.inlineStyle(n.lang.common.invalidInlineStyle),setup:k,commit:m}]}]}]}],
|
var w = CKEDITOR.plugins.link, s = function () {
|
||||||
onShow:function(){var a=this.getParentEditor(),b=a.getSelection(),c=null;(c=w.getSelectedLink(a))&&c.hasAttribute("href")?b.getSelectedElement()||b.selectElement(c):c=null;this.setupContent(I.apply(this,[a,c]))},onOk:function(){var a={},b=[],c={},d=this.getParentEditor();this.commitContent(c);switch(c.type||"url"){case "url":var e=c.url&&c.url.protocol!=void 0?c.url.protocol:"http://",i=c.url&&CKEDITOR.tools.trim(c.url.url)||"";a["data-cke-saved-href"]=i.indexOf("/")===0?i:e+i;break;case "anchor":e=
|
var a = this.getDialog(), g = a.getContentElement("target", "popupFeatures"), a = a.getContentElement("target", "linkTargetName"), c = this.getValue();
|
||||||
c.anchor&&c.anchor.id;a["data-cke-saved-href"]="#"+(c.anchor&&c.anchor.name||e||"");break;case "email":var f=c.email,e=f.address;switch(o){case "":case "encode":var i=encodeURIComponent(f.subject||""),h=encodeURIComponent(f.body||""),f=[];i&&f.push("subject="+i);h&&f.push("body="+h);f=f.length?"?"+f.join("&"):"";if(o=="encode"){e=["javascript:void(location.href='mailto:'+",u(e)];f&&e.push("+'",r(f),"'");e.push(")")}else e=["mailto:",e,f];break;default:e=e.split("@",2);f.name=e[0];f.domain=e[1];e=
|
if (g && a)switch (g = g.getElement(), g.hide(), a.setValue(""), c) {
|
||||||
["javascript:",t(f)]}a["data-cke-saved-href"]=e.join("")}if(c.target)if(c.target.type=="popup"){for(var e=["window.open(this.href, '",c.target.name||"","', '"],j=["resizable","status","location","toolbar","menubar","fullscreen","scrollbars","dependent"],i=j.length,f=function(a){c.target[a]&&j.push(a+"="+c.target[a])},h=0;h<i;h++)j[h]=j[h]+(c.target[j[h]]?"=yes":"=no");f("width");f("left");f("height");f("top");e.push(j.join(","),"'); return false;");a["data-cke-pa-onclick"]=e.join("");b.push("target")}else{c.target.type!=
|
case "frame":
|
||||||
"notSet"&&c.target.name?a.target=c.target.name:b.push("target");b.push("data-cke-pa-onclick","onclick")}if(c.adv){e=function(d,e){var f=c.adv[d];f?a[e]=f:b.push(e)};e("advId","id");e("advLangDir","dir");e("advAccessKey","accessKey");c.adv.advName?a.name=a["data-cke-saved-name"]=c.adv.advName:b=b.concat(["data-cke-saved-name","name"]);e("advLangCode","lang");e("advTabIndex","tabindex");e("advTitle","title");e("advContentType","type");e("advCSSClasses","class");e("advCharset","charset");e("advStyles",
|
a.setLabel(n.lang.link.targetFrameName);
|
||||||
"style");e("advRel","rel")}e=d.getSelection();a.href=a["data-cke-saved-href"];if(this._.selectedElement){d=this._.selectedElement;i=d.data("cke-saved-href");f=d.getHtml();d.setAttributes(a);d.removeAttributes(b);c.adv&&(c.adv.advName&&CKEDITOR.plugins.link.synAnchorSelector)&&d.addClass(d.getChildCount()?"cke_anchor":"cke_anchor_empty");if(i==f||c.type=="email"&&f.indexOf("@")!=-1){d.setHtml(c.type=="email"?c.email.address:a["data-cke-saved-href"]);e.selectElement(d)}delete this._.selectedElement}else{e=
|
a.getElement().show();
|
||||||
e.getRanges()[0];if(e.collapsed){d=new CKEDITOR.dom.text(c.type=="email"?c.email.address:a["data-cke-saved-href"],d.document);e.insertNode(d);e.selectNodeContents(d)}d=new CKEDITOR.style({element:"a",attributes:a});d.type=CKEDITOR.STYLE_INLINE;d.applyToRange(e);e.select()}},onLoad:function(){n.config.linkShowAdvancedTab||this.hidePage("advanced");n.config.linkShowTargetTab||this.hidePage("target")},onFocus:function(){var a=this.getContentElement("info","linkType");if(a&&a.getValue()=="url"){a=this.getContentElement("info",
|
break;
|
||||||
"url");a.select()}}}});
|
case "popup":
|
||||||
|
g.show();
|
||||||
|
a.setLabel(n.lang.link.targetPopupName);
|
||||||
|
a.getElement().show();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
a.setValue(c), a.getElement().hide()
|
||||||
|
}
|
||||||
|
}, x = /^javascript:/, y = /^mailto:([^?]+)(?:\?(.+))?$/,
|
||||||
|
z = /subject=([^;?:@&=$,\/]*)/, A = /body=([^;?:@&=$,\/]*)/, B = /^#(.*)$/, C = /^((?:http|https|ftp|news):\/\/)?(.*)$/, D = /^(_(?:self|top|parent|blank))$/, E = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/, F = /^javascript:([^(]+)\(([^)]+)\)$/, G = /\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/, H = /(?:^|,)([^=]+)=(\d+|yes|no)/gi, I = function (a, g) {
|
||||||
|
var c = g && (g.data("cke-saved-href") || g.getAttribute("href")) || "", d, e, b =
|
||||||
|
{};
|
||||||
|
c.match(x) && ("encode" == o ? c = c.replace(E, function (a, c, b) {
|
||||||
|
return"mailto:" + String.fromCharCode.apply(String, c.split(",")) + (b && b.replace(/\\'/g, "'"))
|
||||||
|
}) : o && c.replace(F, function (a, c, d) {
|
||||||
|
if (c == q) {
|
||||||
|
b.type = "email";
|
||||||
|
for (var a = b.email = {}, c = /(^')|('$)/g, d = d.match(/[^,\s]+/g), e = d.length, g, f, h = 0; h < e; h++)g = decodeURIComponent, f = d[h].replace(c, "").replace(/\\'/g, "'"), f = g(f), g = p[h].toLowerCase(), a[g] = f;
|
||||||
|
a.address = [a.name, a.domain].join("@")
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
if (!b.type)if (d = c.match(B))b.type = "anchor", b.anchor = {}, b.anchor.name = b.anchor.id =
|
||||||
|
d[1]; else if (d = c.match(y)) {
|
||||||
|
e = c.match(z);
|
||||||
|
c = c.match(A);
|
||||||
|
b.type = "email";
|
||||||
|
var f = b.email = {};
|
||||||
|
f.address = d[1];
|
||||||
|
e && (f.subject = decodeURIComponent(e[1]));
|
||||||
|
c && (f.body = decodeURIComponent(c[1]))
|
||||||
|
} else c && (e = c.match(C)) ? (b.type = "url", b.url = {}, b.url.protocol = e[1], b.url.url = e[2]) : b.type = "url";
|
||||||
|
if (g) {
|
||||||
|
d = g.getAttribute("target");
|
||||||
|
b.target = {};
|
||||||
|
b.adv = {};
|
||||||
|
if (d)d.match(D) ? b.target.type = b.target.name = d : (b.target.type = "frame", b.target.name = d); else if (d = (d = g.data("cke-pa-onclick") || g.getAttribute("onclick")) && d.match(G)) {
|
||||||
|
b.target.type =
|
||||||
|
"popup";
|
||||||
|
for (b.target.name = d[1]; c = H.exec(d[2]);)("yes" == c[2] || "1" == c[2]) && !(c[1]in{height: 1, width: 1, top: 1, left: 1}) ? b.target[c[1]] = !0 : isFinite(c[2]) && (b.target[c[1]] = c[2])
|
||||||
|
}
|
||||||
|
d = function (a, c) {
|
||||||
|
var d = g.getAttribute(c);
|
||||||
|
null !== d && (b.adv[a] = d || "")
|
||||||
|
};
|
||||||
|
d("advId", "id");
|
||||||
|
d("advLangDir", "dir");
|
||||||
|
d("advAccessKey", "accessKey");
|
||||||
|
b.adv.advName = g.data("cke-saved-name") || g.getAttribute("name") || "";
|
||||||
|
d("advLangCode", "lang");
|
||||||
|
d("advTabIndex", "tabindex");
|
||||||
|
d("advTitle", "title");
|
||||||
|
d("advContentType", "type");
|
||||||
|
CKEDITOR.plugins.link.synAnchorSelector ?
|
||||||
|
b.adv.advCSSClasses = v(g) : d("advCSSClasses", "class");
|
||||||
|
d("advCharset", "charset");
|
||||||
|
d("advStyles", "style");
|
||||||
|
d("advRel", "rel")
|
||||||
|
}
|
||||||
|
d = b.anchors = [];
|
||||||
|
var h;
|
||||||
|
if (CKEDITOR.plugins.link.emptyAnchorFix) {
|
||||||
|
f = a.document.getElementsByTag("a");
|
||||||
|
c = 0;
|
||||||
|
for (e = f.count(); c < e; c++)if (h = f.getItem(c), h.data("cke-saved-name") || h.hasAttribute("name"))d.push({name: h.data("cke-saved-name") || h.getAttribute("name"), id: h.getAttribute("id")})
|
||||||
|
} else {
|
||||||
|
f = new CKEDITOR.dom.nodeList(a.document.$.anchors);
|
||||||
|
c = 0;
|
||||||
|
for (e = f.count(); c < e; c++)h = f.getItem(c), d[c] =
|
||||||
|
{name: h.getAttribute("name"), id: h.getAttribute("id")}
|
||||||
|
}
|
||||||
|
if (CKEDITOR.plugins.link.fakeAnchor) {
|
||||||
|
f = a.document.getElementsByTag("img");
|
||||||
|
c = 0;
|
||||||
|
for (e = f.count(); c < e; c++)(h = CKEDITOR.plugins.link.tryRestoreFakeAnchor(a, f.getItem(c))) && d.push({name: h.getAttribute("name"), id: h.getAttribute("id")})
|
||||||
|
}
|
||||||
|
this._.selectedElement = g;
|
||||||
|
return b
|
||||||
|
}, j = function (a) {
|
||||||
|
a.target && this.setValue(a.target[this.id] || "")
|
||||||
|
}, k = function (a) {
|
||||||
|
a.adv && this.setValue(a.adv[this.id] || "")
|
||||||
|
}, l = function (a) {
|
||||||
|
a.target || (a.target = {});
|
||||||
|
a.target[this.id] = this.getValue() ||
|
||||||
|
""
|
||||||
|
}, m = function (a) {
|
||||||
|
a.adv || (a.adv = {});
|
||||||
|
a.adv[this.id] = this.getValue() || ""
|
||||||
|
}, o = n.config.emailProtection || "";
|
||||||
|
o && "encode" != o && (q = p = void 0, o.replace(/^([^(]+)\(([^)]+)\)$/, function (a, b, c) {
|
||||||
|
q = b;
|
||||||
|
p = [];
|
||||||
|
c.replace(/[^,\s]+/g, function (a) {
|
||||||
|
p.push(a)
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
var i = n.lang.common, b = n.lang.link;
|
||||||
|
return{title: b.title, minWidth: 350, minHeight: 230, contents: [
|
||||||
|
{id: "info", label: b.info, title: b.info, elements: [
|
||||||
|
{id: "linkType", type: "select", label: b.type, "default": "url", items: [
|
||||||
|
[b.toUrl, "url"],
|
||||||
|
[b.toAnchor, "anchor"],
|
||||||
|
[b.toEmail, "email"]
|
||||||
|
], onChange: function () {
|
||||||
|
var a =
|
||||||
|
this.getDialog(), b = ["urlOptions", "anchorOptions", "emailOptions"], c = this.getValue(), d = a.definition.getContents("upload"), d = d && d.hidden;
|
||||||
|
if (c == "url") {
|
||||||
|
n.config.linkShowTargetTab && a.showPage("target");
|
||||||
|
d || a.showPage("upload")
|
||||||
|
} else {
|
||||||
|
a.hidePage("target");
|
||||||
|
d || a.hidePage("upload")
|
||||||
|
}
|
||||||
|
for (d = 0; d < b.length; d++) {
|
||||||
|
var e = a.getContentElement("info", b[d]);
|
||||||
|
if (e) {
|
||||||
|
e = e.getElement().getParent().getParent();
|
||||||
|
b[d] == c + "Options" ? e.show() : e.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a.layout()
|
||||||
|
}, setup: function (a) {
|
||||||
|
a.type && this.setValue(a.type)
|
||||||
|
}, commit: function (a) {
|
||||||
|
a.type =
|
||||||
|
this.getValue()
|
||||||
|
}},
|
||||||
|
{type: "vbox", id: "urlOptions", children: [
|
||||||
|
{type: "hbox", widths: ["25%", "75%"], children: [
|
||||||
|
{id: "protocol", type: "select", label: i.protocol, "default": "http://", items: [
|
||||||
|
["http://", "http://"],
|
||||||
|
["https://", "https://"],
|
||||||
|
["ftp://", "ftp://"],
|
||||||
|
["news://", "news://"],
|
||||||
|
[b.other, ""]
|
||||||
|
], setup: function (a) {
|
||||||
|
a.url && this.setValue(a.url.protocol || "")
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.url)a.url = {};
|
||||||
|
a.url.protocol = this.getValue()
|
||||||
|
}},
|
||||||
|
{type: "text", id: "url", label: i.url, required: !0, onLoad: function () {
|
||||||
|
this.allowOnChange = true
|
||||||
|
}, onKeyUp: function () {
|
||||||
|
this.allowOnChange =
|
||||||
|
false;
|
||||||
|
var a = this.getDialog().getContentElement("info", "protocol"), b = this.getValue(), c = /^((javascript:)|[#\/\.\?])/i, d = /^(http|https|ftp|news):\/\/(?=.)/i.exec(b);
|
||||||
|
if (d) {
|
||||||
|
this.setValue(b.substr(d[0].length));
|
||||||
|
a.setValue(d[0].toLowerCase())
|
||||||
|
} else c.test(b) && a.setValue("");
|
||||||
|
this.allowOnChange = true
|
||||||
|
}, onChange: function () {
|
||||||
|
if (this.allowOnChange)this.onKeyUp()
|
||||||
|
}, validate: function () {
|
||||||
|
var a = this.getDialog();
|
||||||
|
if (a.getContentElement("info", "linkType") && a.getValueOf("info", "linkType") != "url")return true;
|
||||||
|
if (/javascript\:/.test(this.getValue())) {
|
||||||
|
alert(i.invalidValue);
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return this.getDialog().fakeObj ? true : CKEDITOR.dialog.validate.notEmpty(b.noUrl).apply(this)
|
||||||
|
}, setup: function (a) {
|
||||||
|
this.allowOnChange = false;
|
||||||
|
a.url && this.setValue(a.url.url);
|
||||||
|
this.allowOnChange = true
|
||||||
|
}, commit: function (a) {
|
||||||
|
this.onChange();
|
||||||
|
if (!a.url)a.url = {};
|
||||||
|
a.url.url = this.getValue();
|
||||||
|
this.allowOnChange = false
|
||||||
|
}}
|
||||||
|
], setup: function () {
|
||||||
|
this.getDialog().getContentElement("info", "linkType") || this.getElement().show()
|
||||||
|
}},
|
||||||
|
{type: "button", id: "browse", hidden: "true", filebrowser: "info:url", label: i.browseServer}
|
||||||
|
]},
|
||||||
|
{type: "vbox", id: "anchorOptions", width: 260, align: "center", padding: 0, children: [
|
||||||
|
{type: "fieldset", id: "selectAnchorText", label: b.selectAnchor, setup: function (a) {
|
||||||
|
a.anchors.length > 0 ? this.getElement().show() : this.getElement().hide()
|
||||||
|
}, children: [
|
||||||
|
{type: "hbox", id: "selectAnchor", children: [
|
||||||
|
{type: "select", id: "anchorName", "default": "", label: b.anchorName, style: "width: 100%;", items: [
|
||||||
|
[""]
|
||||||
|
], setup: function (a) {
|
||||||
|
this.clear();
|
||||||
|
this.add("");
|
||||||
|
for (var b = 0; b < a.anchors.length; b++)a.anchors[b].name && this.add(a.anchors[b].name);
|
||||||
|
a.anchor &&
|
||||||
|
this.setValue(a.anchor.name);
|
||||||
|
(a = this.getDialog().getContentElement("info", "linkType")) && a.getValue() == "email" && this.focus()
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.anchor)a.anchor = {};
|
||||||
|
a.anchor.name = this.getValue()
|
||||||
|
}},
|
||||||
|
{type: "select", id: "anchorId", "default": "", label: b.anchorId, style: "width: 100%;", items: [
|
||||||
|
[""]
|
||||||
|
], setup: function (a) {
|
||||||
|
this.clear();
|
||||||
|
this.add("");
|
||||||
|
for (var b = 0; b < a.anchors.length; b++)a.anchors[b].id && this.add(a.anchors[b].id);
|
||||||
|
a.anchor && this.setValue(a.anchor.id)
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.anchor)a.anchor = {};
|
||||||
|
a.anchor.id =
|
||||||
|
this.getValue()
|
||||||
|
}}
|
||||||
|
], setup: function (a) {
|
||||||
|
a.anchors.length > 0 ? this.getElement().show() : this.getElement().hide()
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{type: "html", id: "noAnchors", style: "text-align: center;", html: '<div role="note" tabIndex="-1">' + CKEDITOR.tools.htmlEncode(b.noAnchors) + "</div>", focus: !0, setup: function (a) {
|
||||||
|
a.anchors.length < 1 ? this.getElement().show() : this.getElement().hide()
|
||||||
|
}}
|
||||||
|
], setup: function () {
|
||||||
|
this.getDialog().getContentElement("info", "linkType") || this.getElement().hide()
|
||||||
|
}},
|
||||||
|
{type: "vbox", id: "emailOptions", padding: 1, children: [
|
||||||
|
{type: "text",
|
||||||
|
id: "emailAddress", label: b.emailAddress, required: !0, validate: function () {
|
||||||
|
var a = this.getDialog();
|
||||||
|
return!a.getContentElement("info", "linkType") || a.getValueOf("info", "linkType") != "email" ? true : CKEDITOR.dialog.validate.notEmpty(b.noEmail).apply(this)
|
||||||
|
}, setup: function (a) {
|
||||||
|
a.email && this.setValue(a.email.address);
|
||||||
|
(a = this.getDialog().getContentElement("info", "linkType")) && a.getValue() == "email" && this.select()
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.email)a.email = {};
|
||||||
|
a.email.address = this.getValue()
|
||||||
|
}},
|
||||||
|
{type: "text", id: "emailSubject",
|
||||||
|
label: b.emailSubject, setup: function (a) {
|
||||||
|
a.email && this.setValue(a.email.subject)
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.email)a.email = {};
|
||||||
|
a.email.subject = this.getValue()
|
||||||
|
}},
|
||||||
|
{type: "textarea", id: "emailBody", label: b.emailBody, rows: 3, "default": "", setup: function (a) {
|
||||||
|
a.email && this.setValue(a.email.body)
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.email)a.email = {};
|
||||||
|
a.email.body = this.getValue()
|
||||||
|
}}
|
||||||
|
], setup: function () {
|
||||||
|
this.getDialog().getContentElement("info", "linkType") || this.getElement().hide()
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{id: "target", requiredContent: "a[target]", label: b.target,
|
||||||
|
title: b.target, elements: [
|
||||||
|
{type: "hbox", widths: ["50%", "50%"], children: [
|
||||||
|
{type: "select", id: "linkTargetType", label: i.target, "default": "notSet", style: "width : 100%;", items: [
|
||||||
|
[i.notSet, "notSet"],
|
||||||
|
[b.targetFrame, "frame"],
|
||||||
|
[b.targetPopup, "popup"],
|
||||||
|
[i.targetNew, "_blank"],
|
||||||
|
[i.targetTop, "_top"],
|
||||||
|
[i.targetSelf, "_self"],
|
||||||
|
[i.targetParent, "_parent"]
|
||||||
|
], onChange: s, setup: function (a) {
|
||||||
|
a.target && this.setValue(a.target.type || "notSet");
|
||||||
|
s.call(this)
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.target)a.target = {};
|
||||||
|
a.target.type = this.getValue()
|
||||||
|
}},
|
||||||
|
{type: "text",
|
||||||
|
id: "linkTargetName", label: b.targetFrameName, "default": "", setup: function (a) {
|
||||||
|
a.target && this.setValue(a.target.name)
|
||||||
|
}, commit: function (a) {
|
||||||
|
if (!a.target)a.target = {};
|
||||||
|
a.target.name = this.getValue().replace(/\W/gi, "")
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{type: "vbox", width: "100%", align: "center", padding: 2, id: "popupFeatures", children: [
|
||||||
|
{type: "fieldset", label: b.popupFeatures, children: [
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{type: "checkbox", id: "resizable", label: b.popupResizable, setup: j, commit: l},
|
||||||
|
{type: "checkbox", id: "status", label: b.popupStatusBar, setup: j, commit: l}
|
||||||
|
]},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{type: "checkbox", id: "location", label: b.popupLocationBar, setup: j, commit: l},
|
||||||
|
{type: "checkbox", id: "toolbar", label: b.popupToolbar, setup: j, commit: l}
|
||||||
|
]},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{type: "checkbox", id: "menubar", label: b.popupMenuBar, setup: j, commit: l},
|
||||||
|
{type: "checkbox", id: "fullscreen", label: b.popupFullScreen, setup: j, commit: l}
|
||||||
|
]},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{type: "checkbox", id: "scrollbars", label: b.popupScrollBars, setup: j, commit: l},
|
||||||
|
{type: "checkbox", id: "dependent", label: b.popupDependent, setup: j, commit: l}
|
||||||
|
]},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{type: "text", widths: ["50%", "50%"], labelLayout: "horizontal", label: i.width, id: "width", setup: j, commit: l},
|
||||||
|
{type: "text", labelLayout: "horizontal", widths: ["50%", "50%"], label: b.popupLeft, id: "left", setup: j, commit: l}
|
||||||
|
]},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{type: "text", labelLayout: "horizontal", widths: ["50%", "50%"], label: i.height, id: "height", setup: j, commit: l},
|
||||||
|
{type: "text", labelLayout: "horizontal", label: b.popupTop, widths: ["50%", "50%"], id: "top", setup: j, commit: l}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{id: "upload", label: b.upload, title: b.upload,
|
||||||
|
hidden: !0, filebrowser: "uploadButton", elements: [
|
||||||
|
{type: "file", id: "upload", label: i.upload, style: "height:40px", size: 29},
|
||||||
|
{type: "fileButton", id: "uploadButton", label: i.uploadSubmit, filebrowser: "info:url", "for": ["upload", "upload"]}
|
||||||
|
]},
|
||||||
|
{id: "advanced", label: b.advanced, title: b.advanced, elements: [
|
||||||
|
{type: "vbox", padding: 1, children: [
|
||||||
|
{type: "hbox", widths: ["45%", "35%", "20%"], children: [
|
||||||
|
{type: "text", id: "advId", requiredContent: "a[id]", label: b.id, setup: k, commit: m},
|
||||||
|
{type: "select", id: "advLangDir", requiredContent: "a[dir]",
|
||||||
|
label: b.langDir, "default": "", style: "width:110px", items: [
|
||||||
|
[i.notSet, ""],
|
||||||
|
[b.langDirLTR, "ltr"],
|
||||||
|
[b.langDirRTL, "rtl"]
|
||||||
|
], setup: k, commit: m},
|
||||||
|
{type: "text", id: "advAccessKey", requiredContent: "a[accesskey]", width: "80px", label: b.acccessKey, maxLength: 1, setup: k, commit: m}
|
||||||
|
]},
|
||||||
|
{type: "hbox", widths: ["45%", "35%", "20%"], children: [
|
||||||
|
{type: "text", label: b.name, id: "advName", requiredContent: "a[name]", setup: k, commit: m},
|
||||||
|
{type: "text", label: b.langCode, id: "advLangCode", requiredContent: "a[lang]", width: "110px", "default": "", setup: k, commit: m},
|
||||||
|
{type: "text", label: b.tabIndex, id: "advTabIndex", requiredContent: "a[tabindex]", width: "80px", maxLength: 5, setup: k, commit: m}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{type: "vbox", padding: 1, children: [
|
||||||
|
{type: "hbox", widths: ["45%", "55%"], children: [
|
||||||
|
{type: "text", label: b.advisoryTitle, requiredContent: "a[title]", "default": "", id: "advTitle", setup: k, commit: m},
|
||||||
|
{type: "text", label: b.advisoryContentType, requiredContent: "a[type]", "default": "", id: "advContentType", setup: k, commit: m}
|
||||||
|
]},
|
||||||
|
{type: "hbox", widths: ["45%", "55%"], children: [
|
||||||
|
{type: "text", label: b.cssClasses,
|
||||||
|
requiredContent: "a(cke-xyz)", "default": "", id: "advCSSClasses", setup: k, commit: m},
|
||||||
|
{type: "text", label: b.charset, requiredContent: "a[charset]", "default": "", id: "advCharset", setup: k, commit: m}
|
||||||
|
]},
|
||||||
|
{type: "hbox", widths: ["45%", "55%"], children: [
|
||||||
|
{type: "text", label: b.rel, requiredContent: "a[rel]", "default": "", id: "advRel", setup: k, commit: m},
|
||||||
|
{type: "text", label: b.styles, requiredContent: "a{cke-xyz}", "default": "", id: "advStyles", validate: CKEDITOR.dialog.validate.inlineStyle(n.lang.common.invalidInlineStyle), setup: k, commit: m}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
],
|
||||||
|
onShow: function () {
|
||||||
|
var a = this.getParentEditor(), b = a.getSelection(), c = null;
|
||||||
|
(c = w.getSelectedLink(a)) && c.hasAttribute("href") ? b.getSelectedElement() || b.selectElement(c) : c = null;
|
||||||
|
this.setupContent(I.apply(this, [a, c]))
|
||||||
|
}, onOk: function () {
|
||||||
|
var a = {}, b = [], c = {}, d = this.getParentEditor();
|
||||||
|
this.commitContent(c);
|
||||||
|
switch (c.type || "url") {
|
||||||
|
case "url":
|
||||||
|
var e = c.url && c.url.protocol != void 0 ? c.url.protocol : "http://", i = c.url && CKEDITOR.tools.trim(c.url.url) || "";
|
||||||
|
a["data-cke-saved-href"] = i.indexOf("/") === 0 ? i : e + i;
|
||||||
|
break;
|
||||||
|
case "anchor":
|
||||||
|
e =
|
||||||
|
c.anchor && c.anchor.id;
|
||||||
|
a["data-cke-saved-href"] = "#" + (c.anchor && c.anchor.name || e || "");
|
||||||
|
break;
|
||||||
|
case "email":
|
||||||
|
var f = c.email, e = f.address;
|
||||||
|
switch (o) {
|
||||||
|
case "":
|
||||||
|
case "encode":
|
||||||
|
var i = encodeURIComponent(f.subject || ""), h = encodeURIComponent(f.body || ""), f = [];
|
||||||
|
i && f.push("subject=" + i);
|
||||||
|
h && f.push("body=" + h);
|
||||||
|
f = f.length ? "?" + f.join("&") : "";
|
||||||
|
if (o == "encode") {
|
||||||
|
e = ["javascript:void(location.href='mailto:'+", u(e)];
|
||||||
|
f && e.push("+'", r(f), "'");
|
||||||
|
e.push(")")
|
||||||
|
} else e = ["mailto:", e, f];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
e = e.split("@", 2);
|
||||||
|
f.name = e[0];
|
||||||
|
f.domain = e[1];
|
||||||
|
e =
|
||||||
|
["javascript:", t(f)]
|
||||||
|
}
|
||||||
|
a["data-cke-saved-href"] = e.join("")
|
||||||
|
}
|
||||||
|
if (c.target)if (c.target.type == "popup") {
|
||||||
|
for (var e = ["window.open(this.href, '", c.target.name || "", "', '"], j = ["resizable", "status", "location", "toolbar", "menubar", "fullscreen", "scrollbars", "dependent"], i = j.length, f = function (a) {
|
||||||
|
c.target[a] && j.push(a + "=" + c.target[a])
|
||||||
|
}, h = 0; h < i; h++)j[h] = j[h] + (c.target[j[h]] ? "=yes" : "=no");
|
||||||
|
f("width");
|
||||||
|
f("left");
|
||||||
|
f("height");
|
||||||
|
f("top");
|
||||||
|
e.push(j.join(","), "'); return false;");
|
||||||
|
a["data-cke-pa-onclick"] = e.join("");
|
||||||
|
b.push("target")
|
||||||
|
} else {
|
||||||
|
c.target.type !=
|
||||||
|
"notSet" && c.target.name ? a.target = c.target.name : b.push("target");
|
||||||
|
b.push("data-cke-pa-onclick", "onclick")
|
||||||
|
}
|
||||||
|
if (c.adv) {
|
||||||
|
e = function (d, e) {
|
||||||
|
var f = c.adv[d];
|
||||||
|
f ? a[e] = f : b.push(e)
|
||||||
|
};
|
||||||
|
e("advId", "id");
|
||||||
|
e("advLangDir", "dir");
|
||||||
|
e("advAccessKey", "accessKey");
|
||||||
|
c.adv.advName ? a.name = a["data-cke-saved-name"] = c.adv.advName : b = b.concat(["data-cke-saved-name", "name"]);
|
||||||
|
e("advLangCode", "lang");
|
||||||
|
e("advTabIndex", "tabindex");
|
||||||
|
e("advTitle", "title");
|
||||||
|
e("advContentType", "type");
|
||||||
|
e("advCSSClasses", "class");
|
||||||
|
e("advCharset", "charset");
|
||||||
|
e("advStyles",
|
||||||
|
"style");
|
||||||
|
e("advRel", "rel")
|
||||||
|
}
|
||||||
|
e = d.getSelection();
|
||||||
|
a.href = a["data-cke-saved-href"];
|
||||||
|
if (this._.selectedElement) {
|
||||||
|
d = this._.selectedElement;
|
||||||
|
i = d.data("cke-saved-href");
|
||||||
|
f = d.getHtml();
|
||||||
|
d.setAttributes(a);
|
||||||
|
d.removeAttributes(b);
|
||||||
|
c.adv && (c.adv.advName && CKEDITOR.plugins.link.synAnchorSelector) && d.addClass(d.getChildCount() ? "cke_anchor" : "cke_anchor_empty");
|
||||||
|
if (i == f || c.type == "email" && f.indexOf("@") != -1) {
|
||||||
|
d.setHtml(c.type == "email" ? c.email.address : a["data-cke-saved-href"]);
|
||||||
|
e.selectElement(d)
|
||||||
|
}
|
||||||
|
delete this._.selectedElement
|
||||||
|
} else {
|
||||||
|
e =
|
||||||
|
e.getRanges()[0];
|
||||||
|
if (e.collapsed) {
|
||||||
|
d = new CKEDITOR.dom.text(c.type == "email" ? c.email.address : a["data-cke-saved-href"], d.document);
|
||||||
|
e.insertNode(d);
|
||||||
|
e.selectNodeContents(d)
|
||||||
|
}
|
||||||
|
d = new CKEDITOR.style({element: "a", attributes: a});
|
||||||
|
d.type = CKEDITOR.STYLE_INLINE;
|
||||||
|
d.applyToRange(e);
|
||||||
|
e.select()
|
||||||
|
}
|
||||||
|
}, onLoad: function () {
|
||||||
|
n.config.linkShowAdvancedTab || this.hidePage("advanced");
|
||||||
|
n.config.linkShowTargetTab || this.hidePage("target")
|
||||||
|
}, onFocus: function () {
|
||||||
|
var a = this.getContentElement("info", "linkType");
|
||||||
|
if (a && a.getValue() == "url") {
|
||||||
|
a = this.getContentElement("info",
|
||||||
|
"url");
|
||||||
|
a.select()
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
});
|
|
@ -1,43 +1,453 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
||||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||||
*/
|
*/
|
||||||
(function(){var r=function(c,j){function r(){var a=arguments,b=this.getContentElement("advanced","txtdlgGenStyle");b&&b.commit.apply(b,a);this.foreach(function(b){b.commit&&"txtdlgGenStyle"!=b.id&&b.commit.apply(b,a)})}function i(a){if(!s){s=1;var b=this.getDialog(),d=b.imageElement;if(d){this.commit(f,d);for(var a=[].concat(a),e=a.length,c,g=0;g<e;g++)(c=b.getContentElement.apply(b,a[g].split(":")))&&c.setup(f,d)}s=0}}var f=1,k=/^\s*(\d+)((px)|\%)?\s*$/i,v=/(^\s*(\d+)((px)|\%)?\s*$)|^$/i,o=/^\d+px$/,
|
(function () {
|
||||||
w=function(){var a=this.getValue(),b=this.getDialog(),d=a.match(k);d&&("%"==d[2]&&l(b,!1),a=d[1]);b.lockRatio&&(d=b.originalElement,"true"==d.getCustomData("isReady")&&("txtHeight"==this.id?(a&&"0"!=a&&(a=Math.round(d.$.width*(a/d.$.height))),isNaN(a)||b.setValueOf("info","txtWidth",a)):(a&&"0"!=a&&(a=Math.round(d.$.height*(a/d.$.width))),isNaN(a)||b.setValueOf("info","txtHeight",a))));g(b)},g=function(a){if(!a.originalElement||!a.preview)return 1;a.commitContent(4,a.preview);return 0},s,l=function(a,
|
var r = function (c, j) {
|
||||||
b){if(!a.getContentElement("info","ratioLock"))return null;var d=a.originalElement;if(!d)return null;if("check"==b){if(!a.userlockRatio&&"true"==d.getCustomData("isReady")){var e=a.getValueOf("info","txtWidth"),c=a.getValueOf("info","txtHeight"),d=1E3*d.$.width/d.$.height,f=1E3*e/c;a.lockRatio=!1;!e&&!c?a.lockRatio=!0:!isNaN(d)&&!isNaN(f)&&Math.round(d)==Math.round(f)&&(a.lockRatio=!0)}}else void 0!=b?a.lockRatio=b:(a.userlockRatio=1,a.lockRatio=!a.lockRatio);e=CKEDITOR.document.getById(p);a.lockRatio?
|
function r() {
|
||||||
e.removeClass("cke_btn_unlocked"):e.addClass("cke_btn_unlocked");e.setAttribute("aria-checked",a.lockRatio);CKEDITOR.env.hc&&e.getChild(0).setHtml(a.lockRatio?CKEDITOR.env.ie?"■":"▣":CKEDITOR.env.ie?"□":"▢");return a.lockRatio},x=function(a){var b=a.originalElement;if("true"==b.getCustomData("isReady")){var d=a.getContentElement("info","txtWidth"),e=a.getContentElement("info","txtHeight");d&&d.setValue(b.$.width);e&&e.setValue(b.$.height)}g(a)},y=function(a,b){function d(a,b){var d=a.match(k);return d?
|
var a = arguments, b = this.getContentElement("advanced", "txtdlgGenStyle");
|
||||||
("%"==d[2]&&(d[1]+="%",l(e,!1)),d[1]):b}if(a==f){var e=this.getDialog(),c="",g="txtWidth"==this.id?"width":"height",h=b.getAttribute(g);h&&(c=d(h,c));c=d(b.getStyle(g),c);this.setValue(c)}},t,q=function(){var a=this.originalElement;a.setCustomData("isReady","true");a.removeListener("load",q);a.removeListener("error",h);a.removeListener("abort",h);CKEDITOR.document.getById(m).setStyle("display","none");this.dontResetSize||x(this);this.firstLoad&&CKEDITOR.tools.setTimeout(function(){l(this,"check")},
|
b && b.commit.apply(b, a);
|
||||||
0,this);this.dontResetSize=this.firstLoad=!1},h=function(){var a=this.originalElement;a.removeListener("load",q);a.removeListener("error",h);a.removeListener("abort",h);a=CKEDITOR.getUrl(CKEDITOR.plugins.get("image").path+"images/noimage.png");this.preview&&this.preview.setAttribute("src",a);CKEDITOR.document.getById(m).setStyle("display","none");l(this,!1)},n=function(a){return CKEDITOR.tools.getNextId()+"_"+a},p=n("btnLockSizes"),u=n("btnResetSize"),m=n("ImagePreviewLoader"),A=n("previewLink"),
|
this.foreach(function (b) {
|
||||||
z=n("previewImage");return{title:c.lang.image["image"==j?"title":"titleButton"],minWidth:420,minHeight:360,onShow:function(){this.linkEditMode=this.imageEditMode=this.linkElement=this.imageElement=!1;this.lockRatio=!0;this.userlockRatio=0;this.dontResetSize=!1;this.firstLoad=!0;this.addLink=!1;var a=this.getParentEditor(),b=a.getSelection(),d=(b=b&&b.getSelectedElement())&&a.elementPath(b).contains("a",1);CKEDITOR.document.getById(m).setStyle("display","none");t=new CKEDITOR.dom.element("img",a.document);
|
b.commit && "txtdlgGenStyle" != b.id && b.commit.apply(b, a)
|
||||||
this.preview=CKEDITOR.document.getById(z);this.originalElement=a.document.createElement("img");this.originalElement.setAttribute("alt","");this.originalElement.setCustomData("isReady","false");if(d){this.linkElement=d;this.linkEditMode=!0;var c=d.getChildren();if(1==c.count()){var g=c.getItem(0).getName();if("img"==g||"input"==g)this.imageElement=c.getItem(0),"img"==this.imageElement.getName()?this.imageEditMode="img":"input"==this.imageElement.getName()&&(this.imageEditMode="input")}"image"==j&&
|
})
|
||||||
this.setupContent(2,d)}if(this.customImageElement)this.imageEditMode="img",this.imageElement=this.customImageElement,delete this.customImageElement;else if(b&&"img"==b.getName()&&!b.data("cke-realelement")||b&&"input"==b.getName()&&"image"==b.getAttribute("type"))this.imageEditMode=b.getName(),this.imageElement=b;this.imageEditMode?(this.cleanImageElement=this.imageElement,this.imageElement=this.cleanImageElement.clone(!0,!0),this.setupContent(f,this.imageElement)):this.imageElement=a.document.createElement("img");
|
}
|
||||||
l(this,!0);CKEDITOR.tools.trim(this.getValueOf("info","txtUrl"))||(this.preview.removeAttribute("src"),this.preview.setStyle("display","none"))},onOk:function(){if(this.imageEditMode){var a=this.imageEditMode;"image"==j&&"input"==a&&confirm(c.lang.image.button2Img)?(this.imageElement=c.document.createElement("img"),this.imageElement.setAttribute("alt",""),c.insertElement(this.imageElement)):"image"!=j&&"img"==a&&confirm(c.lang.image.img2Button)?(this.imageElement=c.document.createElement("input"),
|
|
||||||
this.imageElement.setAttributes({type:"image",alt:""}),c.insertElement(this.imageElement)):(this.imageElement=this.cleanImageElement,delete this.cleanImageElement)}else"image"==j?this.imageElement=c.document.createElement("img"):(this.imageElement=c.document.createElement("input"),this.imageElement.setAttribute("type","image")),this.imageElement.setAttribute("alt","");this.linkEditMode||(this.linkElement=c.document.createElement("a"));this.commitContent(f,this.imageElement);this.commitContent(2,this.linkElement);
|
function i(a) {
|
||||||
this.imageElement.getAttribute("style")||this.imageElement.removeAttribute("style");this.imageEditMode?!this.linkEditMode&&this.addLink?(c.insertElement(this.linkElement),this.imageElement.appendTo(this.linkElement)):this.linkEditMode&&!this.addLink&&(c.getSelection().selectElement(this.linkElement),c.insertElement(this.imageElement)):this.addLink?this.linkEditMode?c.insertElement(this.imageElement):(c.insertElement(this.linkElement),this.linkElement.append(this.imageElement,!1)):c.insertElement(this.imageElement)},
|
if (!s) {
|
||||||
onLoad:function(){"image"!=j&&this.hidePage("Link");var a=this._.element.getDocument();this.getContentElement("info","ratioLock")&&(this.addFocusable(a.getById(u),5),this.addFocusable(a.getById(p),5));this.commitContent=r},onHide:function(){this.preview&&this.commitContent(8,this.preview);this.originalElement&&(this.originalElement.removeListener("load",q),this.originalElement.removeListener("error",h),this.originalElement.removeListener("abort",h),this.originalElement.remove(),this.originalElement=
|
s = 1;
|
||||||
!1);delete this.imageElement},contents:[{id:"info",label:c.lang.image.infoTab,accessKey:"I",elements:[{type:"vbox",padding:0,children:[{type:"hbox",widths:["280px","110px"],align:"right",children:[{id:"txtUrl",type:"text",label:c.lang.common.url,required:!0,onChange:function(){var a=this.getDialog(),b=this.getValue();if(0<b.length){var a=this.getDialog(),d=a.originalElement;a.preview.removeStyle("display");d.setCustomData("isReady","false");var c=CKEDITOR.document.getById(m);c&&c.setStyle("display",
|
var b = this.getDialog(), d = b.imageElement;
|
||||||
"");d.on("load",q,a);d.on("error",h,a);d.on("abort",h,a);d.setAttribute("src",b);t.setAttribute("src",b);a.preview.setAttribute("src",t.$.src);g(a)}else a.preview&&(a.preview.removeAttribute("src"),a.preview.setStyle("display","none"))},setup:function(a,b){if(a==f){var d=b.data("cke-saved-src")||b.getAttribute("src");this.getDialog().dontResetSize=!0;this.setValue(d);this.setInitValue()}},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())?(b.data("cke-saved-src",this.getValue()),b.setAttribute("src",
|
if (d) {
|
||||||
this.getValue())):8==a&&(b.setAttribute("src",""),b.removeAttribute("src"))},validate:CKEDITOR.dialog.validate.notEmpty(c.lang.image.urlMissing)},{type:"button",id:"browse",style:"display:inline-block;margin-top:10px;",align:"center",label:c.lang.common.browseServer,hidden:!0,filebrowser:"info:txtUrl"}]}]},{id:"txtAlt",type:"text",label:c.lang.image.alt,accessKey:"T","default":"",onChange:function(){g(this.getDialog())},setup:function(a,b){a==f&&this.setValue(b.getAttribute("alt"))},commit:function(a,
|
this.commit(f, d);
|
||||||
b){a==f?(this.getValue()||this.isChanged())&&b.setAttribute("alt",this.getValue()):4==a?b.setAttribute("alt",this.getValue()):8==a&&b.removeAttribute("alt")}},{type:"hbox",children:[{id:"basic",type:"vbox",children:[{type:"hbox",requiredContent:"img{width,height}",widths:["50%","50%"],children:[{type:"vbox",padding:1,children:[{type:"text",width:"45px",id:"txtWidth",label:c.lang.common.width,onKeyUp:w,onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:function(){var a=this.getValue().match(v);
|
for (var a = [].concat(a), e = a.length, c, g = 0; g < e; g++)(c = b.getContentElement.apply(b, a[g].split(":"))) && c.setup(f, d)
|
||||||
(a=!!(a&&0!==parseInt(a[1],10)))||alert(c.lang.common.invalidWidth);return a},setup:y,commit:function(a,b,d){var c=this.getValue();a==f?(c?b.setStyle("width",CKEDITOR.tools.cssLength(c)):b.removeStyle("width"),!d&&b.removeAttribute("width")):4==a?c.match(k)?b.setStyle("width",CKEDITOR.tools.cssLength(c)):(a=this.getDialog().originalElement,"true"==a.getCustomData("isReady")&&b.setStyle("width",a.$.width+"px")):8==a&&(b.removeAttribute("width"),b.removeStyle("width"))}},{type:"text",id:"txtHeight",
|
}
|
||||||
width:"45px",label:c.lang.common.height,onKeyUp:w,onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:function(){var a=this.getValue().match(v);(a=!!(a&&0!==parseInt(a[1],10)))||alert(c.lang.common.invalidHeight);return a},setup:y,commit:function(a,b,d){var c=this.getValue();a==f?(c?b.setStyle("height",CKEDITOR.tools.cssLength(c)):b.removeStyle("height"),!d&&b.removeAttribute("height")):4==a?c.match(k)?b.setStyle("height",CKEDITOR.tools.cssLength(c)):(a=this.getDialog().originalElement,
|
s = 0
|
||||||
"true"==a.getCustomData("isReady")&&b.setStyle("height",a.$.height+"px")):8==a&&(b.removeAttribute("height"),b.removeStyle("height"))}}]},{id:"ratioLock",type:"html",style:"margin-top:30px;width:40px;height:40px;",onLoad:function(){var a=CKEDITOR.document.getById(u),b=CKEDITOR.document.getById(p);a&&(a.on("click",function(a){x(this);a.data&&a.data.preventDefault()},this.getDialog()),a.on("mouseover",function(){this.addClass("cke_btn_over")},a),a.on("mouseout",function(){this.removeClass("cke_btn_over")},
|
}
|
||||||
a));b&&(b.on("click",function(a){l(this);var b=this.originalElement,c=this.getValueOf("info","txtWidth");if(b.getCustomData("isReady")=="true"&&c){b=b.$.height/b.$.width*c;if(!isNaN(b)){this.setValueOf("info","txtHeight",Math.round(b));g(this)}}a.data&&a.data.preventDefault()},this.getDialog()),b.on("mouseover",function(){this.addClass("cke_btn_over")},b),b.on("mouseout",function(){this.removeClass("cke_btn_over")},b))},html:'<div><a href="javascript:void(0)" tabindex="-1" title="'+c.lang.image.lockRatio+
|
}
|
||||||
'" class="cke_btn_locked" id="'+p+'" role="checkbox"><span class="cke_icon"></span><span class="cke_label">'+c.lang.image.lockRatio+'</span></a><a href="javascript:void(0)" tabindex="-1" title="'+c.lang.image.resetSize+'" class="cke_btn_reset" id="'+u+'" role="button"><span class="cke_label">'+c.lang.image.resetSize+"</span></a></div>"}]},{type:"vbox",padding:1,children:[{type:"text",id:"txtBorder",requiredContent:"img{border-width}",width:"60px",label:c.lang.image.border,"default":"",onKeyUp:function(){g(this.getDialog())},
|
|
||||||
onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateBorder),setup:function(a,b){if(a==f){var d;d=(d=(d=b.getStyle("border-width"))&&d.match(/^(\d+px)(?: \1 \1 \1)?$/))&&parseInt(d[1],10);isNaN(parseInt(d,10))&&(d=b.getAttribute("border"));this.setValue(d)}},commit:function(a,b,d){var c=parseInt(this.getValue(),10);a==f||4==a?(isNaN(c)?!c&&this.isChanged()&&b.removeStyle("border"):(b.setStyle("border-width",CKEDITOR.tools.cssLength(c)),
|
var f = 1, k = /^\s*(\d+)((px)|\%)?\s*$/i, v = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i, o = /^\d+px$/,
|
||||||
b.setStyle("border-style","solid")),!d&&a==f&&b.removeAttribute("border")):8==a&&(b.removeAttribute("border"),b.removeStyle("border-width"),b.removeStyle("border-style"),b.removeStyle("border-color"))}},{type:"text",id:"txtHSpace",requiredContent:"img{margin-left,margin-right}",width:"60px",label:c.lang.image.hSpace,"default":"",onKeyUp:function(){g(this.getDialog())},onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateHSpace),
|
w = function () {
|
||||||
setup:function(a,b){if(a==f){var d,c;d=b.getStyle("margin-left");c=b.getStyle("margin-right");d=d&&d.match(o);c=c&&c.match(o);d=parseInt(d,10);c=parseInt(c,10);d=d==c&&d;isNaN(parseInt(d,10))&&(d=b.getAttribute("hspace"));this.setValue(d)}},commit:function(a,b,c){var e=parseInt(this.getValue(),10);a==f||4==a?(isNaN(e)?!e&&this.isChanged()&&(b.removeStyle("margin-left"),b.removeStyle("margin-right")):(b.setStyle("margin-left",CKEDITOR.tools.cssLength(e)),b.setStyle("margin-right",CKEDITOR.tools.cssLength(e))),
|
var a = this.getValue(), b = this.getDialog(), d = a.match(k);
|
||||||
!c&&a==f&&b.removeAttribute("hspace")):8==a&&(b.removeAttribute("hspace"),b.removeStyle("margin-left"),b.removeStyle("margin-right"))}},{type:"text",id:"txtVSpace",requiredContent:"img{margin-top,margin-bottom}",width:"60px",label:c.lang.image.vSpace,"default":"",onKeyUp:function(){g(this.getDialog())},onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateVSpace),setup:function(a,b){if(a==f){var c,e;c=b.getStyle("margin-top");e=
|
d && ("%" == d[2] && l(b, !1), a = d[1]);
|
||||||
b.getStyle("margin-bottom");c=c&&c.match(o);e=e&&e.match(o);c=parseInt(c,10);e=parseInt(e,10);c=c==e&&c;isNaN(parseInt(c,10))&&(c=b.getAttribute("vspace"));this.setValue(c)}},commit:function(a,b,c){var e=parseInt(this.getValue(),10);a==f||4==a?(isNaN(e)?!e&&this.isChanged()&&(b.removeStyle("margin-top"),b.removeStyle("margin-bottom")):(b.setStyle("margin-top",CKEDITOR.tools.cssLength(e)),b.setStyle("margin-bottom",CKEDITOR.tools.cssLength(e))),!c&&a==f&&b.removeAttribute("vspace")):8==a&&(b.removeAttribute("vspace"),
|
b.lockRatio && (d = b.originalElement, "true" == d.getCustomData("isReady") && ("txtHeight" == this.id ? (a && "0" != a && (a = Math.round(d.$.width * (a / d.$.height))), isNaN(a) || b.setValueOf("info", "txtWidth", a)) : (a && "0" != a && (a = Math.round(d.$.height * (a / d.$.width))), isNaN(a) || b.setValueOf("info", "txtHeight", a))));
|
||||||
b.removeStyle("margin-top"),b.removeStyle("margin-bottom"))}},{id:"cmbAlign",requiredContent:"img{float}",type:"select",widths:["35%","65%"],style:"width:90px",label:c.lang.common.align,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.alignLeft,"left"],[c.lang.common.alignRight,"right"]],onChange:function(){g(this.getDialog());i.call(this,"advanced:txtdlgGenStyle")},setup:function(a,b){if(a==f){var c=b.getStyle("float");switch(c){case "inherit":case "none":c=""}!c&&(c=(b.getAttribute("align")||
|
g(b)
|
||||||
"").toLowerCase());this.setValue(c)}},commit:function(a,b,c){var e=this.getValue();if(a==f||4==a){if(e?b.setStyle("float",e):b.removeStyle("float"),!c&&a==f)switch(e=(b.getAttribute("align")||"").toLowerCase(),e){case "left":case "right":b.removeAttribute("align")}}else 8==a&&b.removeStyle("float")}}]}]},{type:"vbox",height:"250px",children:[{type:"html",id:"htmlPreview",style:"width:95%;",html:"<div>"+CKEDITOR.tools.htmlEncode(c.lang.common.preview)+'<br><div id="'+m+'" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div><div class="ImagePreviewBox"><table><tr><td><a href="javascript:void(0)" target="_blank" onclick="return false;" id="'+
|
}, g = function (a) {
|
||||||
A+'"><img id="'+z+'" alt="" /></a>'+(c.config.image_previewText||"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.")+
|
if (!a.originalElement || !a.preview)return 1;
|
||||||
"</td></tr></table></div></div>"}]}]}]},{id:"Link",requiredContent:"a[href]",label:c.lang.image.linkTab,padding:0,elements:[{id:"txtUrl",type:"text",label:c.lang.common.url,style:"width: 100%","default":"",setup:function(a,b){if(2==a){var c=b.data("cke-saved-href");c||(c=b.getAttribute("href"));this.setValue(c)}},commit:function(a,b){if(2==a&&(this.getValue()||this.isChanged())){var d=decodeURI(this.getValue());b.data("cke-saved-href",d);b.setAttribute("href",d);if(this.getValue()||!c.config.image_removeLinkByEmptyURL)this.getDialog().addLink=
|
a.commitContent(4, a.preview);
|
||||||
!0}}},{type:"button",id:"browse",filebrowser:{action:"Browse",target:"Link:txtUrl",url:c.config.filebrowserImageBrowseLinkUrl},style:"float:right",hidden:!0,label:c.lang.common.browseServer},{id:"cmbTarget",type:"select",requiredContent:"a[target]",label:c.lang.common.target,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.targetNew,"_blank"],[c.lang.common.targetTop,"_top"],[c.lang.common.targetSelf,"_self"],[c.lang.common.targetParent,"_parent"]],setup:function(a,b){2==a&&this.setValue(b.getAttribute("target")||
|
return 0
|
||||||
"")},commit:function(a,b){2==a&&(this.getValue()||this.isChanged())&&b.setAttribute("target",this.getValue())}}]},{id:"Upload",hidden:!0,filebrowser:"uploadButton",label:c.lang.image.upload,elements:[{type:"file",id:"upload",label:c.lang.image.btnUpload,style:"height:40px",size:38},{type:"fileButton",id:"uploadButton",filebrowser:"info:txtUrl",label:c.lang.image.btnUpload,"for":["Upload","upload"]}]},{id:"advanced",label:c.lang.common.advancedTab,elements:[{type:"hbox",widths:["50%","25%","25%"],
|
}, s, l = function (a, b) {
|
||||||
children:[{type:"text",id:"linkId",requiredContent:"img[id]",label:c.lang.common.id,setup:function(a,b){a==f&&this.setValue(b.getAttribute("id"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("id",this.getValue())}},{id:"cmbLangDir",type:"select",requiredContent:"img[dir]",style:"width : 100px;",label:c.lang.common.langDir,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.langDirLtr,"ltr"],[c.lang.common.langDirRtl,"rtl"]],setup:function(a,b){a==f&&this.setValue(b.getAttribute("dir"))},
|
if (!a.getContentElement("info", "ratioLock"))return null;
|
||||||
commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("dir",this.getValue())}},{type:"text",id:"txtLangCode",requiredContent:"img[lang]",label:c.lang.common.langCode,"default":"",setup:function(a,b){a==f&&this.setValue(b.getAttribute("lang"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("lang",this.getValue())}}]},{type:"text",id:"txtGenLongDescr",requiredContent:"img[longdesc]",label:c.lang.common.longDescr,setup:function(a,b){a==f&&this.setValue(b.getAttribute("longDesc"))},
|
var d = a.originalElement;
|
||||||
commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("longDesc",this.getValue())}},{type:"hbox",widths:["50%","50%"],children:[{type:"text",id:"txtGenClass",requiredContent:"img(cke-xyz)",label:c.lang.common.cssClass,"default":"",setup:function(a,b){a==f&&this.setValue(b.getAttribute("class"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("class",this.getValue())}},{type:"text",id:"txtGenTitle",requiredContent:"img[title]",label:c.lang.common.advisoryTitle,
|
if (!d)return null;
|
||||||
"default":"",onChange:function(){g(this.getDialog())},setup:function(a,b){a==f&&this.setValue(b.getAttribute("title"))},commit:function(a,b){a==f?(this.getValue()||this.isChanged())&&b.setAttribute("title",this.getValue()):4==a?b.setAttribute("title",this.getValue()):8==a&&b.removeAttribute("title")}}]},{type:"text",id:"txtdlgGenStyle",requiredContent:"img{cke-xyz}",label:c.lang.common.cssStyle,validate:CKEDITOR.dialog.validate.inlineStyle(c.lang.common.invalidInlineStyle),"default":"",setup:function(a,
|
if ("check" == b) {
|
||||||
b){if(a==f){var c=b.getAttribute("style");!c&&b.$.style.cssText&&(c=b.$.style.cssText);this.setValue(c);var e=b.$.style.height,c=b.$.style.width,e=(e?e:"").match(k),c=(c?c:"").match(k);this.attributesInStyle={height:!!e,width:!!c}}},onChange:function(){i.call(this,"info:cmbFloat info:cmbAlign info:txtVSpace info:txtHSpace info:txtBorder info:txtWidth info:txtHeight".split(" "));g(this)},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("style",this.getValue())}}]}]}};
|
if (!a.userlockRatio && "true" == d.getCustomData("isReady")) {
|
||||||
CKEDITOR.dialog.add("image",function(c){return r(c,"image")});CKEDITOR.dialog.add("imagebutton",function(c){return r(c,"imagebutton")})})();
|
var e = a.getValueOf("info", "txtWidth"), c = a.getValueOf("info", "txtHeight"), d = 1E3 * d.$.width / d.$.height, f = 1E3 * e / c;
|
||||||
|
a.lockRatio = !1;
|
||||||
|
!e && !c ? a.lockRatio = !0 : !isNaN(d) && !isNaN(f) && Math.round(d) == Math.round(f) && (a.lockRatio = !0)
|
||||||
|
}
|
||||||
|
} else void 0 != b ? a.lockRatio = b : (a.userlockRatio = 1, a.lockRatio = !a.lockRatio);
|
||||||
|
e = CKEDITOR.document.getById(p);
|
||||||
|
a.lockRatio ?
|
||||||
|
e.removeClass("cke_btn_unlocked") : e.addClass("cke_btn_unlocked");
|
||||||
|
e.setAttribute("aria-checked", a.lockRatio);
|
||||||
|
CKEDITOR.env.hc && e.getChild(0).setHtml(a.lockRatio ? CKEDITOR.env.ie ? "■" : "▣" : CKEDITOR.env.ie ? "□" : "▢");
|
||||||
|
return a.lockRatio
|
||||||
|
}, x = function (a) {
|
||||||
|
var b = a.originalElement;
|
||||||
|
if ("true" == b.getCustomData("isReady")) {
|
||||||
|
var d = a.getContentElement("info", "txtWidth"), e = a.getContentElement("info", "txtHeight");
|
||||||
|
d && d.setValue(b.$.width);
|
||||||
|
e && e.setValue(b.$.height)
|
||||||
|
}
|
||||||
|
g(a)
|
||||||
|
}, y = function (a, b) {
|
||||||
|
function d(a, b) {
|
||||||
|
var d = a.match(k);
|
||||||
|
return d ?
|
||||||
|
("%" == d[2] && (d[1] += "%", l(e, !1)), d[1]) : b
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a == f) {
|
||||||
|
var e = this.getDialog(), c = "", g = "txtWidth" == this.id ? "width" : "height", h = b.getAttribute(g);
|
||||||
|
h && (c = d(h, c));
|
||||||
|
c = d(b.getStyle(g), c);
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, t, q = function () {
|
||||||
|
var a = this.originalElement;
|
||||||
|
a.setCustomData("isReady", "true");
|
||||||
|
a.removeListener("load", q);
|
||||||
|
a.removeListener("error", h);
|
||||||
|
a.removeListener("abort", h);
|
||||||
|
CKEDITOR.document.getById(m).setStyle("display", "none");
|
||||||
|
this.dontResetSize || x(this);
|
||||||
|
this.firstLoad && CKEDITOR.tools.setTimeout(function () {
|
||||||
|
l(this, "check")
|
||||||
|
},
|
||||||
|
0, this);
|
||||||
|
this.dontResetSize = this.firstLoad = !1
|
||||||
|
}, h = function () {
|
||||||
|
var a = this.originalElement;
|
||||||
|
a.removeListener("load", q);
|
||||||
|
a.removeListener("error", h);
|
||||||
|
a.removeListener("abort", h);
|
||||||
|
a = CKEDITOR.getUrl(CKEDITOR.plugins.get("image").path + "images/noimage.png");
|
||||||
|
this.preview && this.preview.setAttribute("src", a);
|
||||||
|
CKEDITOR.document.getById(m).setStyle("display", "none");
|
||||||
|
l(this, !1)
|
||||||
|
}, n = function (a) {
|
||||||
|
return CKEDITOR.tools.getNextId() + "_" + a
|
||||||
|
}, p = n("btnLockSizes"), u = n("btnResetSize"), m = n("ImagePreviewLoader"), A = n("previewLink"),
|
||||||
|
z = n("previewImage");
|
||||||
|
return{title: c.lang.image["image" == j ? "title" : "titleButton"], minWidth: 420, minHeight: 360, onShow: function () {
|
||||||
|
this.linkEditMode = this.imageEditMode = this.linkElement = this.imageElement = !1;
|
||||||
|
this.lockRatio = !0;
|
||||||
|
this.userlockRatio = 0;
|
||||||
|
this.dontResetSize = !1;
|
||||||
|
this.firstLoad = !0;
|
||||||
|
this.addLink = !1;
|
||||||
|
var a = this.getParentEditor(), b = a.getSelection(), d = (b = b && b.getSelectedElement()) && a.elementPath(b).contains("a", 1);
|
||||||
|
CKEDITOR.document.getById(m).setStyle("display", "none");
|
||||||
|
t = new CKEDITOR.dom.element("img", a.document);
|
||||||
|
this.preview = CKEDITOR.document.getById(z);
|
||||||
|
this.originalElement = a.document.createElement("img");
|
||||||
|
this.originalElement.setAttribute("alt", "");
|
||||||
|
this.originalElement.setCustomData("isReady", "false");
|
||||||
|
if (d) {
|
||||||
|
this.linkElement = d;
|
||||||
|
this.linkEditMode = !0;
|
||||||
|
var c = d.getChildren();
|
||||||
|
if (1 == c.count()) {
|
||||||
|
var g = c.getItem(0).getName();
|
||||||
|
if ("img" == g || "input" == g)this.imageElement = c.getItem(0), "img" == this.imageElement.getName() ? this.imageEditMode = "img" : "input" == this.imageElement.getName() && (this.imageEditMode = "input")
|
||||||
|
}
|
||||||
|
"image" == j &&
|
||||||
|
this.setupContent(2, d)
|
||||||
|
}
|
||||||
|
if (this.customImageElement)this.imageEditMode = "img", this.imageElement = this.customImageElement, delete this.customImageElement; else if (b && "img" == b.getName() && !b.data("cke-realelement") || b && "input" == b.getName() && "image" == b.getAttribute("type"))this.imageEditMode = b.getName(), this.imageElement = b;
|
||||||
|
this.imageEditMode ? (this.cleanImageElement = this.imageElement, this.imageElement = this.cleanImageElement.clone(!0, !0), this.setupContent(f, this.imageElement)) : this.imageElement = a.document.createElement("img");
|
||||||
|
l(this, !0);
|
||||||
|
CKEDITOR.tools.trim(this.getValueOf("info", "txtUrl")) || (this.preview.removeAttribute("src"), this.preview.setStyle("display", "none"))
|
||||||
|
}, onOk: function () {
|
||||||
|
if (this.imageEditMode) {
|
||||||
|
var a = this.imageEditMode;
|
||||||
|
"image" == j && "input" == a && confirm(c.lang.image.button2Img) ? (this.imageElement = c.document.createElement("img"), this.imageElement.setAttribute("alt", ""), c.insertElement(this.imageElement)) : "image" != j && "img" == a && confirm(c.lang.image.img2Button) ? (this.imageElement = c.document.createElement("input"),
|
||||||
|
this.imageElement.setAttributes({type: "image", alt: ""}), c.insertElement(this.imageElement)) : (this.imageElement = this.cleanImageElement, delete this.cleanImageElement)
|
||||||
|
} else"image" == j ? this.imageElement = c.document.createElement("img") : (this.imageElement = c.document.createElement("input"), this.imageElement.setAttribute("type", "image")), this.imageElement.setAttribute("alt", "");
|
||||||
|
this.linkEditMode || (this.linkElement = c.document.createElement("a"));
|
||||||
|
this.commitContent(f, this.imageElement);
|
||||||
|
this.commitContent(2, this.linkElement);
|
||||||
|
this.imageElement.getAttribute("style") || this.imageElement.removeAttribute("style");
|
||||||
|
this.imageEditMode ? !this.linkEditMode && this.addLink ? (c.insertElement(this.linkElement), this.imageElement.appendTo(this.linkElement)) : this.linkEditMode && !this.addLink && (c.getSelection().selectElement(this.linkElement), c.insertElement(this.imageElement)) : this.addLink ? this.linkEditMode ? c.insertElement(this.imageElement) : (c.insertElement(this.linkElement), this.linkElement.append(this.imageElement, !1)) : c.insertElement(this.imageElement)
|
||||||
|
},
|
||||||
|
onLoad: function () {
|
||||||
|
"image" != j && this.hidePage("Link");
|
||||||
|
var a = this._.element.getDocument();
|
||||||
|
this.getContentElement("info", "ratioLock") && (this.addFocusable(a.getById(u), 5), this.addFocusable(a.getById(p), 5));
|
||||||
|
this.commitContent = r
|
||||||
|
}, onHide: function () {
|
||||||
|
this.preview && this.commitContent(8, this.preview);
|
||||||
|
this.originalElement && (this.originalElement.removeListener("load", q), this.originalElement.removeListener("error", h), this.originalElement.removeListener("abort", h), this.originalElement.remove(), this.originalElement = !1);
|
||||||
|
delete this.imageElement
|
||||||
|
}, contents: [
|
||||||
|
{id: "info", label: c.lang.image.infoTab, accessKey: "I", elements: [
|
||||||
|
{type: "vbox", padding: 0, children: [
|
||||||
|
{type: "hbox", widths: ["280px", "110px"], align: "right", children: [
|
||||||
|
{id: "txtUrl", type: "text", label: c.lang.common.url, required: !0, onChange: function () {
|
||||||
|
var a = this.getDialog(), b = this.getValue();
|
||||||
|
if (0 < b.length) {
|
||||||
|
var a = this.getDialog(), d = a.originalElement;
|
||||||
|
a.preview.removeStyle("display");
|
||||||
|
d.setCustomData("isReady", "false");
|
||||||
|
var c = CKEDITOR.document.getById(m);
|
||||||
|
c && c.setStyle("display",
|
||||||
|
"");
|
||||||
|
d.on("load", q, a);
|
||||||
|
d.on("error", h, a);
|
||||||
|
d.on("abort", h, a);
|
||||||
|
d.setAttribute("src", b);
|
||||||
|
t.setAttribute("src", b);
|
||||||
|
a.preview.setAttribute("src", t.$.src);
|
||||||
|
g(a)
|
||||||
|
} else a.preview && (a.preview.removeAttribute("src"), a.preview.setStyle("display", "none"))
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var d = b.data("cke-saved-src") || b.getAttribute("src");
|
||||||
|
this.getDialog().dontResetSize = !0;
|
||||||
|
this.setValue(d);
|
||||||
|
this.setInitValue()
|
||||||
|
}
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) ? (b.data("cke-saved-src", this.getValue()), b.setAttribute("src",
|
||||||
|
this.getValue())) : 8 == a && (b.setAttribute("src", ""), b.removeAttribute("src"))
|
||||||
|
}, validate: CKEDITOR.dialog.validate.notEmpty(c.lang.image.urlMissing)},
|
||||||
|
{type: "button", id: "browse", style: "display:inline-block;margin-top:10px;", align: "center", label: c.lang.common.browseServer, hidden: !0, filebrowser: "info:txtUrl"}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{id: "txtAlt", type: "text", label: c.lang.image.alt, accessKey: "T", "default": "", onChange: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("alt"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f ? (this.getValue() || this.isChanged()) && b.setAttribute("alt", this.getValue()) : 4 == a ? b.setAttribute("alt", this.getValue()) : 8 == a && b.removeAttribute("alt")
|
||||||
|
}},
|
||||||
|
{type: "hbox", children: [
|
||||||
|
{id: "basic", type: "vbox", children: [
|
||||||
|
{type: "hbox", requiredContent: "img{width,height}", widths: ["50%", "50%"], children: [
|
||||||
|
{type: "vbox", padding: 1, children: [
|
||||||
|
{type: "text", width: "45px", id: "txtWidth", label: c.lang.common.width, onKeyUp: w, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: function () {
|
||||||
|
var a = this.getValue().match(v);
|
||||||
|
(a = !!(a && 0 !== parseInt(a[1], 10))) || alert(c.lang.common.invalidWidth);
|
||||||
|
return a
|
||||||
|
}, setup: y, commit: function (a, b, d) {
|
||||||
|
var c = this.getValue();
|
||||||
|
a == f ? (c ? b.setStyle("width", CKEDITOR.tools.cssLength(c)) : b.removeStyle("width"), !d && b.removeAttribute("width")) : 4 == a ? c.match(k) ? b.setStyle("width", CKEDITOR.tools.cssLength(c)) : (a = this.getDialog().originalElement, "true" == a.getCustomData("isReady") && b.setStyle("width", a.$.width + "px")) : 8 == a && (b.removeAttribute("width"), b.removeStyle("width"))
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtHeight",
|
||||||
|
width: "45px", label: c.lang.common.height, onKeyUp: w, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: function () {
|
||||||
|
var a = this.getValue().match(v);
|
||||||
|
(a = !!(a && 0 !== parseInt(a[1], 10))) || alert(c.lang.common.invalidHeight);
|
||||||
|
return a
|
||||||
|
}, setup: y, commit: function (a, b, d) {
|
||||||
|
var c = this.getValue();
|
||||||
|
a == f ? (c ? b.setStyle("height", CKEDITOR.tools.cssLength(c)) : b.removeStyle("height"), !d && b.removeAttribute("height")) : 4 == a ? c.match(k) ? b.setStyle("height", CKEDITOR.tools.cssLength(c)) : (a = this.getDialog().originalElement,
|
||||||
|
"true" == a.getCustomData("isReady") && b.setStyle("height", a.$.height + "px")) : 8 == a && (b.removeAttribute("height"), b.removeStyle("height"))
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{id: "ratioLock", type: "html", style: "margin-top:30px;width:40px;height:40px;", onLoad: function () {
|
||||||
|
var a = CKEDITOR.document.getById(u), b = CKEDITOR.document.getById(p);
|
||||||
|
a && (a.on("click", function (a) {
|
||||||
|
x(this);
|
||||||
|
a.data && a.data.preventDefault()
|
||||||
|
}, this.getDialog()), a.on("mouseover", function () {
|
||||||
|
this.addClass("cke_btn_over")
|
||||||
|
}, a), a.on("mouseout", function () {
|
||||||
|
this.removeClass("cke_btn_over")
|
||||||
|
},
|
||||||
|
a));
|
||||||
|
b && (b.on("click", function (a) {
|
||||||
|
l(this);
|
||||||
|
var b = this.originalElement, c = this.getValueOf("info", "txtWidth");
|
||||||
|
if (b.getCustomData("isReady") == "true" && c) {
|
||||||
|
b = b.$.height / b.$.width * c;
|
||||||
|
if (!isNaN(b)) {
|
||||||
|
this.setValueOf("info", "txtHeight", Math.round(b));
|
||||||
|
g(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a.data && a.data.preventDefault()
|
||||||
|
}, this.getDialog()), b.on("mouseover", function () {
|
||||||
|
this.addClass("cke_btn_over")
|
||||||
|
}, b), b.on("mouseout", function () {
|
||||||
|
this.removeClass("cke_btn_over")
|
||||||
|
}, b))
|
||||||
|
}, html: '<div><a href="javascript:void(0)" tabindex="-1" title="' + c.lang.image.lockRatio +
|
||||||
|
'" class="cke_btn_locked" id="' + p + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + c.lang.image.lockRatio + '</span></a><a href="javascript:void(0)" tabindex="-1" title="' + c.lang.image.resetSize + '" class="cke_btn_reset" id="' + u + '" role="button"><span class="cke_label">' + c.lang.image.resetSize + "</span></a></div>"}
|
||||||
|
]},
|
||||||
|
{type: "vbox", padding: 1, children: [
|
||||||
|
{type: "text", id: "txtBorder", requiredContent: "img{border-width}", width: "60px", label: c.lang.image.border, "default": "", onKeyUp: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
},
|
||||||
|
onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: CKEDITOR.dialog.validate.integer(c.lang.image.validateBorder), setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var d;
|
||||||
|
d = (d = (d = b.getStyle("border-width")) && d.match(/^(\d+px)(?: \1 \1 \1)?$/)) && parseInt(d[1], 10);
|
||||||
|
isNaN(parseInt(d, 10)) && (d = b.getAttribute("border"));
|
||||||
|
this.setValue(d)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, d) {
|
||||||
|
var c = parseInt(this.getValue(), 10);
|
||||||
|
a == f || 4 == a ? (isNaN(c) ? !c && this.isChanged() && b.removeStyle("border") : (b.setStyle("border-width", CKEDITOR.tools.cssLength(c)),
|
||||||
|
b.setStyle("border-style", "solid")), !d && a == f && b.removeAttribute("border")) : 8 == a && (b.removeAttribute("border"), b.removeStyle("border-width"), b.removeStyle("border-style"), b.removeStyle("border-color"))
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtHSpace", requiredContent: "img{margin-left,margin-right}", width: "60px", label: c.lang.image.hSpace, "default": "", onKeyUp: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: CKEDITOR.dialog.validate.integer(c.lang.image.validateHSpace),
|
||||||
|
setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var d, c;
|
||||||
|
d = b.getStyle("margin-left");
|
||||||
|
c = b.getStyle("margin-right");
|
||||||
|
d = d && d.match(o);
|
||||||
|
c = c && c.match(o);
|
||||||
|
d = parseInt(d, 10);
|
||||||
|
c = parseInt(c, 10);
|
||||||
|
d = d == c && d;
|
||||||
|
isNaN(parseInt(d, 10)) && (d = b.getAttribute("hspace"));
|
||||||
|
this.setValue(d)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, c) {
|
||||||
|
var e = parseInt(this.getValue(), 10);
|
||||||
|
a == f || 4 == a ? (isNaN(e) ? !e && this.isChanged() && (b.removeStyle("margin-left"), b.removeStyle("margin-right")) : (b.setStyle("margin-left", CKEDITOR.tools.cssLength(e)), b.setStyle("margin-right", CKEDITOR.tools.cssLength(e))),
|
||||||
|
!c && a == f && b.removeAttribute("hspace")) : 8 == a && (b.removeAttribute("hspace"), b.removeStyle("margin-left"), b.removeStyle("margin-right"))
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtVSpace", requiredContent: "img{margin-top,margin-bottom}", width: "60px", label: c.lang.image.vSpace, "default": "", onKeyUp: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, onChange: function () {
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, validate: CKEDITOR.dialog.validate.integer(c.lang.image.validateVSpace), setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var c, e;
|
||||||
|
c = b.getStyle("margin-top");
|
||||||
|
e =
|
||||||
|
b.getStyle("margin-bottom");
|
||||||
|
c = c && c.match(o);
|
||||||
|
e = e && e.match(o);
|
||||||
|
c = parseInt(c, 10);
|
||||||
|
e = parseInt(e, 10);
|
||||||
|
c = c == e && c;
|
||||||
|
isNaN(parseInt(c, 10)) && (c = b.getAttribute("vspace"));
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, c) {
|
||||||
|
var e = parseInt(this.getValue(), 10);
|
||||||
|
a == f || 4 == a ? (isNaN(e) ? !e && this.isChanged() && (b.removeStyle("margin-top"), b.removeStyle("margin-bottom")) : (b.setStyle("margin-top", CKEDITOR.tools.cssLength(e)), b.setStyle("margin-bottom", CKEDITOR.tools.cssLength(e))), !c && a == f && b.removeAttribute("vspace")) : 8 == a && (b.removeAttribute("vspace"),
|
||||||
|
b.removeStyle("margin-top"), b.removeStyle("margin-bottom"))
|
||||||
|
}},
|
||||||
|
{id: "cmbAlign", requiredContent: "img{float}", type: "select", widths: ["35%", "65%"], style: "width:90px", label: c.lang.common.align, "default": "", items: [
|
||||||
|
[c.lang.common.notSet, ""],
|
||||||
|
[c.lang.common.alignLeft, "left"],
|
||||||
|
[c.lang.common.alignRight, "right"]
|
||||||
|
], onChange: function () {
|
||||||
|
g(this.getDialog());
|
||||||
|
i.call(this, "advanced:txtdlgGenStyle")
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var c = b.getStyle("float");
|
||||||
|
switch (c) {
|
||||||
|
case "inherit":
|
||||||
|
case "none":
|
||||||
|
c = ""
|
||||||
|
}
|
||||||
|
!c && (c = (b.getAttribute("align") ||
|
||||||
|
"").toLowerCase());
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b, c) {
|
||||||
|
var e = this.getValue();
|
||||||
|
if (a == f || 4 == a) {
|
||||||
|
if (e ? b.setStyle("float", e) : b.removeStyle("float"), !c && a == f)switch (e = (b.getAttribute("align") || "").toLowerCase(), e) {
|
||||||
|
case "left":
|
||||||
|
case "right":
|
||||||
|
b.removeAttribute("align")
|
||||||
|
}
|
||||||
|
} else 8 == a && b.removeStyle("float")
|
||||||
|
}}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{type: "vbox", height: "250px", children: [
|
||||||
|
{type: "html", id: "htmlPreview", style: "width:95%;", html: "<div>" + CKEDITOR.tools.htmlEncode(c.lang.common.preview) + '<br><div id="' + m + '" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div><div class="ImagePreviewBox"><table><tr><td><a href="javascript:void(0)" target="_blank" onclick="return false;" id="' +
|
||||||
|
A + '"><img id="' + z + '" alt="" /></a>' + (c.config.image_previewText || "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.") +
|
||||||
|
"</td></tr></table></div></div>"}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
{id: "Link", requiredContent: "a[href]", label: c.lang.image.linkTab, padding: 0, elements: [
|
||||||
|
{id: "txtUrl", type: "text", label: c.lang.common.url, style: "width: 100%", "default": "", setup: function (a, b) {
|
||||||
|
if (2 == a) {
|
||||||
|
var c = b.data("cke-saved-href");
|
||||||
|
c || (c = b.getAttribute("href"));
|
||||||
|
this.setValue(c)
|
||||||
|
}
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
if (2 == a && (this.getValue() || this.isChanged())) {
|
||||||
|
var d = decodeURI(this.getValue());
|
||||||
|
b.data("cke-saved-href", d);
|
||||||
|
b.setAttribute("href", d);
|
||||||
|
if (this.getValue() || !c.config.image_removeLinkByEmptyURL)this.getDialog().addLink = !0
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{type: "button", id: "browse", filebrowser: {action: "Browse", target: "Link:txtUrl", url: c.config.filebrowserImageBrowseLinkUrl}, style: "float:right", hidden: !0, label: c.lang.common.browseServer},
|
||||||
|
{id: "cmbTarget", type: "select", requiredContent: "a[target]", label: c.lang.common.target, "default": "", items: [
|
||||||
|
[c.lang.common.notSet, ""],
|
||||||
|
[c.lang.common.targetNew, "_blank"],
|
||||||
|
[c.lang.common.targetTop, "_top"],
|
||||||
|
[c.lang.common.targetSelf, "_self"],
|
||||||
|
[c.lang.common.targetParent, "_parent"]
|
||||||
|
], setup: function (a, b) {
|
||||||
|
2 == a && this.setValue(b.getAttribute("target") ||
|
||||||
|
"")
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
2 == a && (this.getValue() || this.isChanged()) && b.setAttribute("target", this.getValue())
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{id: "Upload", hidden: !0, filebrowser: "uploadButton", label: c.lang.image.upload, elements: [
|
||||||
|
{type: "file", id: "upload", label: c.lang.image.btnUpload, style: "height:40px", size: 38},
|
||||||
|
{type: "fileButton", id: "uploadButton", filebrowser: "info:txtUrl", label: c.lang.image.btnUpload, "for": ["Upload", "upload"]}
|
||||||
|
]},
|
||||||
|
{id: "advanced", label: c.lang.common.advancedTab, elements: [
|
||||||
|
{type: "hbox", widths: ["50%", "25%", "25%"],
|
||||||
|
children: [
|
||||||
|
{type: "text", id: "linkId", requiredContent: "img[id]", label: c.lang.common.id, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("id"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("id", this.getValue())
|
||||||
|
}},
|
||||||
|
{id: "cmbLangDir", type: "select", requiredContent: "img[dir]", style: "width : 100px;", label: c.lang.common.langDir, "default": "", items: [
|
||||||
|
[c.lang.common.notSet, ""],
|
||||||
|
[c.lang.common.langDirLtr, "ltr"],
|
||||||
|
[c.lang.common.langDirRtl, "rtl"]
|
||||||
|
], setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("dir"))
|
||||||
|
},
|
||||||
|
commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("dir", this.getValue())
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtLangCode", requiredContent: "img[lang]", label: c.lang.common.langCode, "default": "", setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("lang"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("lang", this.getValue())
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{type: "text", id: "txtGenLongDescr", requiredContent: "img[longdesc]", label: c.lang.common.longDescr, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("longDesc"))
|
||||||
|
},
|
||||||
|
commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("longDesc", this.getValue())
|
||||||
|
}},
|
||||||
|
{type: "hbox", widths: ["50%", "50%"], children: [
|
||||||
|
{type: "text", id: "txtGenClass", requiredContent: "img(cke-xyz)", label: c.lang.common.cssClass, "default": "", setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("class"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("class", this.getValue())
|
||||||
|
}},
|
||||||
|
{type: "text", id: "txtGenTitle", requiredContent: "img[title]", label: c.lang.common.advisoryTitle,
|
||||||
|
"default": "", onChange: function () {
|
||||||
|
g(this.getDialog())
|
||||||
|
}, setup: function (a, b) {
|
||||||
|
a == f && this.setValue(b.getAttribute("title"))
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f ? (this.getValue() || this.isChanged()) && b.setAttribute("title", this.getValue()) : 4 == a ? b.setAttribute("title", this.getValue()) : 8 == a && b.removeAttribute("title")
|
||||||
|
}}
|
||||||
|
]},
|
||||||
|
{type: "text", id: "txtdlgGenStyle", requiredContent: "img{cke-xyz}", label: c.lang.common.cssStyle, validate: CKEDITOR.dialog.validate.inlineStyle(c.lang.common.invalidInlineStyle), "default": "", setup: function (a, b) {
|
||||||
|
if (a == f) {
|
||||||
|
var c = b.getAttribute("style");
|
||||||
|
!c && b.$.style.cssText && (c = b.$.style.cssText);
|
||||||
|
this.setValue(c);
|
||||||
|
var e = b.$.style.height, c = b.$.style.width, e = (e ? e : "").match(k), c = (c ? c : "").match(k);
|
||||||
|
this.attributesInStyle = {height: !!e, width: !!c}
|
||||||
|
}
|
||||||
|
}, onChange: function () {
|
||||||
|
i.call(this, "info:cmbFloat info:cmbAlign info:txtVSpace info:txtHSpace info:txtBorder info:txtWidth info:txtHeight".split(" "));
|
||||||
|
g(this)
|
||||||
|
}, commit: function (a, b) {
|
||||||
|
a == f && (this.getValue() || this.isChanged()) && b.setAttribute("style", this.getValue())
|
||||||
|
}}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
};
|
||||||
|
CKEDITOR.dialog.add("image", function (c) {
|
||||||
|
return r(c, "image")
|
||||||
|
});
|
||||||
|
CKEDITOR.dialog.add("imagebutton", function (c) {
|
||||||
|
return r(c, "imagebutton")
|
||||||
|
})
|
||||||
|
})();
|
Loading…
Reference in New Issue