diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 5435a2d61..daf11b33f 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -1,3 +1,4 @@
+# -*coding:utf-8 -*-
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@@ -14,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
class MembersController < ApplicationController
model_object Member
before_filter :find_model_object, :except => [:index, :create, :autocomplete]
@@ -124,7 +126,13 @@ class MembersController < ApplicationController
attrs = params[:membership].dup
user_ids = attrs.delete(:user_ids)
user_ids.each do |user_id|
- members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
+ member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
+ role = Role.find_by_id(params[:membership][:role_ids])
+ # 这里的判断只能通过角色名,可以弄成常量
+ if role.name == "学生"
+ StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id)
+ end
+ members << member
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
@@ -201,6 +209,15 @@ class MembersController < ApplicationController
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
+ # 这里的判断只能通过角色名,可以弄成常量
+ if role.name == "学生"
+ StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id)
+ else
+ joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
+ joined.each do |join|
+ join.delete
+ end
+ end
if role.allowed_to?(:is_manager)
@courseInfo = CourseInfos.new(:user_id => @member.user_id, :course_id => @course.id)
@courseInfo.save
@@ -271,6 +288,11 @@ class MembersController < ApplicationController
user.destroy
end
end
+ joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
+ joined.each do |join|
+ join.delete
+ end
+
end
respond_to do |format|
format.html { redirect_to_settings_in_courses }
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 27505ad59..cb517e40b 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -642,9 +642,9 @@ class UsersController < ApplicationController
return
end
if @obj.save
- ## 执行成功的操作。
+ logger.debug "#{__FILE__}:#{__LINE__} ===> #{@obj.to_json}"
else
- #捕获异常
+ logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}"
end
respond_to do |format|
format.js
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index b03f6cfa1..033b6405c 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -114,7 +114,15 @@ module CoursesHelper
# 学生人数计算
# add by nwb
def studentCount course
- course.student.count
+ count = course.student.count
+ if count <= 5
+ result = count.to_s
+ elsif count < 10 && count > 5
+ result = "5+"
+ else
+ result = (count-count % 10).to_s + "+"
+ end
+ result
end
def eventToLanguageCourse event_type, course
diff --git a/app/helpers/stores_helper.rb b/app/helpers/stores_helper.rb
index b4cd47eb1..5a161dc85 100644
--- a/app/helpers/stores_helper.rb
+++ b/app/helpers/stores_helper.rb
@@ -42,7 +42,6 @@ module StoresHelper
container = attachment.container
case container.class.to_s
when 'Message'
- # binding.pry
# '项目 > zzz > 论坛 > 帖子xxx'
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index e65fe174e..58935dd11 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -258,4 +258,24 @@ module UsersHelper
end
return result
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
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index b301ba73c..85f36fc5f 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -227,7 +227,8 @@ class Attachment < ActiveRecord::Base
def file=(incoming_file)
unless incoming_file.nil?
@temp_file = incoming_file
- if @temp_file.size > 0
+ # 允许上传文件大小为0的文件
+ #if @temp_file.size > 0
if @temp_file.respond_to?(:original_filename)
self.filename = @temp_file.original_filename
self.filename.force_encoding("UTF-8") if filename.respond_to?(:force_encoding)
@@ -239,7 +240,7 @@ class Attachment < ActiveRecord::Base
self.content_type = Redmine::MimeType.of(filename)
end
self.filesize = @temp_file.size
- end
+ #end
end
end
@@ -255,7 +256,8 @@ class Attachment < ActiveRecord::Base
# Copies the temporary file to its final location
# and computes its MD5 hash
def files_to_final_location
- if @temp_file && (@temp_file.size > 0)
+ # # 允许上传文件大小为0的文件
+ if @temp_file# && (@temp_file.size > 0)
self.disk_directory = target_directory
self.disk_filename = Attachment.disk_filename(filename, disk_directory)
logger.info("Saving attachment '#{self.diskfile}' (#{@temp_file.size} bytes)")
diff --git a/app/models/course.rb b/app/models/course.rb
index 75bac905c..45830c719 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -36,7 +36,7 @@ class Course < ActiveRecord::Base
validates_presence_of :password, :term,:name
validates_format_of :class_period, :with =>/^[1-9]\d*$/
- validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
+ #validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
before_save :self_validate
after_create :create_board_sync
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 4c5e77cb5..f47e1c6f9 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -564,10 +564,8 @@ class Issue < ActiveRecord::Base
end
# 缺陷的短描述信息
def short_description(length = 255)
- # 不再使用短描述
- #description.gsub(/<\/?.*?>/,"").html_safe if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
- description
end
private :workflow_rule_by_attribute
diff --git a/app/models/news.rb b/app/models/news.rb
index 860dd0baa..4f8601796 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -76,10 +76,9 @@ class News < ActiveRecord::Base
# 新闻的短描述信息
def short_description(length = 255)
- #description.gsub(/<\/?.*?>/,"").html_safe if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
- # 不再使用短描述
- description
+ #description
end
private
diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb
index 4a657edb4..0adc0957f 100644
--- a/app/models/open_source_project.rb
+++ b/app/models/open_source_project.rb
@@ -84,10 +84,10 @@ class OpenSourceProject < ActiveRecord::Base
# end
def short_description(length = 255)
- #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
#description.gsub(/<\/?.*?>/,"").html_safe if description
# 不再使用短描述
- description
+ # description
end
def applied_by?(user)
diff --git a/app/models/project.rb b/app/models/project.rb
index 6c453baa9..5bcd2e8c5 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -630,9 +630,7 @@ class Project < ActiveRecord::Base
# Returns a short description of the projects (first lines)
def short_description(length = 255)
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
- # 不再使用短描述
- # description.gsub(/<\/?.*?>/,"").html_safe if description
- description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
end
def css_classes
diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb
index c9f78d8e1..25d35d407 100644
--- a/app/views/boards/_course_show.html.erb
+++ b/app/views/boards/_course_show.html.erb
@@ -1,12 +1,12 @@
-
+
-
+
- <%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
+ <%= link_to(contest.name, contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
<% if contest.id == 2 or contest.id == 3 or contest.id == 6 %>
(<%= link_to("#{contest.projects.where('is_public=1').count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %>)
<% else %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index c701ce41a..52624dcc9 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1776,7 +1776,7 @@ zh:
label_fork_homework_new: 选为作业
#wang
label_contest_userresponse: 用户留言
- label_contest_joincontest: 参入竞赛
+ label_contest_joincontest: 参加竞赛
label_contest_notification: 竞赛通知
#end
diff --git a/db/schema.rb b/db/schema.rb
index ac5ca0644..4a14a02f2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -809,18 +809,18 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
create_table "relative_memos", :force => true do |t|
t.integer "osp_id"
t.integer "parent_id"
- t.string "subject", :null => false
- t.text "content", :null => false
+ t.string "subject", :null => false
+ t.text "content", :limit => 16777215, :null => false
t.integer "author_id"
- t.integer "replies_count", :default => 0
+ t.integer "replies_count", :default => 0
t.integer "last_reply_id"
- t.boolean "lock", :default => false
- t.boolean "sticky", :default => false
- t.boolean "is_quote", :default => false
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "viewed_count_crawl", :default => 0
- t.integer "viewed_count_local", :default => 0
+ t.boolean "lock", :default => false
+ t.boolean "sticky", :default => false
+ t.boolean "is_quote", :default => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "viewed_count_crawl", :default => 0
+ t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"
@@ -844,6 +844,19 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
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|
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1
diff --git a/plugins/redmine_ckeditor/assets/ckeditor/plugins/iframe/dialogs/iframe.js b/plugins/redmine_ckeditor/assets/ckeditor/plugins/iframe/dialogs/iframe.js
index dba1e9306..ebda240da 100644
--- a/plugins/redmine_ckeditor/assets/ckeditor/plugins/iframe/dialogs/iframe.js
+++ b/plugins/redmine_ckeditor/assets/ckeditor/plugins/iframe/dialogs/iframe.js
@@ -1,10 +1,75 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
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"}};
-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")]}})})();
\ No newline at end of file
+ */
+(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"}};
+ 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")
+ ]}
+ })
+})();
\ No newline at end of file
diff --git a/plugins/redmine_ckeditor/assets/ckeditor/plugins/image/dialogs/image.js b/plugins/redmine_ckeditor/assets/ckeditor/plugins/image/dialogs/image.js
index 953de6967..8b0eb6a3c 100644
--- a/plugins/redmine_ckeditor/assets/ckeditor/plugins/image/dialogs/image.js
+++ b/plugins/redmine_ckeditor/assets/ckeditor/plugins/image/dialogs/image.js
@@ -1,43 +1,453 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
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
'+c.lang.image.lockRatio+''+c.lang.image.resetSize+" "}]},{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:"