Changeset 5886
- Timestamp:
- 07/28/08 16:59:09 (4 months ago)
- Files:
-
- rubricks_core/trunk/app/models/rubricks_group.rb (modified) (2 diffs)
- rubricks_core/trunk/app/models/rubricks_lib/character_set/chinese_character_set_convert.rb (modified) (2 diffs)
- rubricks_core/trunk/app/models/rubricks_lib/character_set/english_character_set_convert.rb (modified) (2 diffs)
- rubricks_core/trunk/app/models/rubricks_lib/character_set/japanese_character_set_convert.rb (modified) (2 diffs)
- rubricks_core/trunk/app/models/rubricks_lib/rubricks_character_set_convert_lib.rb (modified) (2 diffs)
- rubricks_core/trunk/app/models/rubricks_mailer.rb (modified) (4 diffs)
- rubricks_core/trunk/app/models/rubricks_user.rb (modified) (1 diff)
- rubricks_core/trunk/db/migrate/014_rubricks_core_schema_014.rb (added)
- rubricks_core/trunk/public/javascripts/rubricks_common.js (modified) (3 diffs)
- rubricks_core/trunk/public/javascripts/src_rubricks_common_rollover.js (modified) (6 diffs)
- rubricks_core/trunk/script/create_mail (modified) (1 diff)
- rubricks_core/trunk/vendor/plugins/rubricks/lib/action_controller_user_management.rb (modified) (2 diffs)
- rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_attachment_helper.rb (modified) (2 diffs)
- rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_js_helper.rb (modified) (1 diff)
- rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_language_helper.rb (modified) (3 diffs)
- rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_layout_window_helper.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
rubricks_core/trunk/app/models/rubricks_group.rb
r5781 r5886 66 66 67 67 def find_rubricks_groups(*args) 68 options = args.flex :admin, :guest, :registered, :root, :rc_id, include68 options = args.flex :admin, :guest, :registered, :root, :rc_id, :include 69 69 options = { 70 70 :admin => true, … … 201 201 202 202 def group_info_editable? 203 return true203 return self.built_in.blank? 204 204 end 205 205 rubricks_core/trunk/app/models/rubricks_lib/character_set/chinese_character_set_convert.rb
r5832 r5886 1 # Set of the encode change method to operate Chinese.2 1 module RubricksCharacterSetConvert 3 2 def convert_for_ie(str) … … 9 8 end 10 9 11 # Change mail body to Chinese encoding.12 10 def convert_mail_body(str) 13 11 str 14 12 end 15 13 16 # Change mail header to Chinese.17 14 def convert_mail_header(str) 18 15 str rubricks_core/trunk/app/models/rubricks_lib/character_set/english_character_set_convert.rb
r3260 r5886 1 # Set of the encode change method to operate English.2 1 module RubricksCharacterSetConvert 3 2 def convert_for_ie(str) … … 9 8 end 10 9 11 # Change mail body to English encode.12 10 def convert_mail_body(str) 13 11 return str 14 12 end 15 13 16 # Change mail header to English encode.17 14 def convert_mail_header(str) 18 15 return str rubricks_core/trunk/app/models/rubricks_lib/character_set/japanese_character_set_convert.rb
r4647 r5886 1 # Set of the encode change method to operate Japanese.2 1 module RubricksCharacterSetConvert 3 2 def convert_for_ie(str) … … 9 8 end 10 9 11 # Change mail body to Japanese encoding.12 10 def convert_mail_body(str) 13 11 Kconv::kconv(str, Kconv::JIS) 14 12 end 15 13 16 # Change mail header to Japanese.17 14 def convert_mail_header(str) 18 15 Kconv::kconv(str, Kconv::JIS) rubricks_core/trunk/app/models/rubricks_lib/rubricks_character_set_convert_lib.rb
r5084 r5886 2 2 @@charset_converts = {} 3 3 4 def convert(method, *args) 5 charset_convert.send(method, *args) 4 def convert(*args) 5 options = args.flex :method, :str, :language 6 lang = (options[:language].blank?) ? RubricksLib.current_lang : options[:language] 7 charset_convert(lang).send(options[:method], RubricksLib.l(options[:str], lang)) 6 8 end 7 9 8 10 private 9 def charset_convert(force = false) 10 lang = RubricksLib.current_lang 11 path = File.join(RAILS_ROOT, 'app', 'models', 'rubricks_lib', 'character_set', "#{lang}_character_set_convert.rb") 12 mtime = File.mtime(path) 13 14 if not force and @@charset_converts.has_key?(lang) 11 def charset_convert(lang) 12 path = File.join(RAILS_ROOT, 'app', 'models', 'rubricks_lib', 'character_set', "#{lang}_character_set_convert.rb") 13 mtime = File.mtime(path) 14 if @@charset_converts.has_key?(lang) 15 15 m, cache_mtime = @@charset_converts[lang] 16 16 return m if mtime <= cache_mtime 17 17 end 18 19 18 m = load_charset_file(path) 20 @@charset_converts[lang] = [ m, mtime ] 21 19 @@charset_converts[lang] = [m, mtime] 22 20 return m 23 21 end … … 25 23 def load_charset_file(path) 26 24 m = Module.new 27 28 25 open(path) do |f| 29 26 m.module_eval(f.read) 30 27 m.module_eval('extend self::RubricksCharacterSetConvert') 31 28 end 32 33 29 return m 34 30 end rubricks_core/trunk/app/models/rubricks_mailer.rb
r5816 r5886 7 7 8 8 class << self 9 def set_config 9 def set_config(language = nil) 10 10 if RubricksLib.test_mode? 11 11 logger.debug 'Selenium Test Mode' … … 21 21 :authentication => (use_auth) ? RubricksConfig.get('mail_smtp_password_encode').to_sym : nil 22 22 } 23 language ||= RubricksLib.current_lang 24 TMail::Encoder::OPTIONS['UTF8'] = (language == 'japanese') ? '-M' : nil 23 25 ActionMailer::Base.raise_delivery_errors = true 24 26 ActionMailer::Base.delivery_method = RubricksConfig.get('mail_method').to_sym 25 ActionMailer::Base.default_charset = RubricksLib. hl('[_Common_MailCharset]')27 ActionMailer::Base.default_charset = RubricksLib.l('[_Common_MailCharset]', language) 26 28 end 27 29 end 28 30 end 29 31 30 def create!(*) 32 def create!(*args) 33 options = args.flex :method_name, :ru 34 @language = options[:language] 35 @language ||= (options[:ru].is_a?(RubricksUser)) ? options[:ru].language : RubricksLib.current_lang 36 @headers = {'MIME-Version' => '1.0', 'Content-Transfer-Encoding' => RubricksLib.l('[_Common_MailTransferEncoding]', @language)} 37 self.class.set_config(@language) 31 38 super 32 @mail.body = line_break(@mail.body)33 @mail.body = RubricksLib.convert('convert_mail_body', @mail.body)34 language = (RubricksLib.current_user && !RubricksLib.guest?) ? RubricksLib.current_user.language : RubricksConfig.get('site_default_language')35 TMail::Encoder::OPTIONS['UTF8'] = (language == 'japanese') ? '-M' : nil36 39 end 37 40 38 alias :initialize_defaults_original :initialize_defaults unless method_defined?(:initialize_defaults_original)39 def initialize_defaults(method_name)40 @headers = {41 'MIME-Version' => '1.0',42 'Content-Transfer-Encoding' => RubricksLib.hl('[_Common_MailTransferEncoding]')43 }44 initialize_defaults_original(method_name)45 end46 47 41 def deliver! 48 42 if RubricksLib.test_mode? … … 62 56 protected 63 57 def multi_lang!(str) 64 RubricksLib.convert( "convert_mail_header", str)58 RubricksLib.convert('convert_mail_header', str) 65 59 end 66 60 … … 70 64 71 65 private 66 def convert(*args) 67 options = args.flex :str, :type 68 method = (options[:type] == :body) ? 'convert_mail_body' : 'convert_mail_header' 69 return RubricksLib.convert(method, options[:str], @language) 70 end 71 72 def create_mail 73 @subject, @from, @body = convert(self.subject), convert(self.from), convert(line_break(self.body), :body) 74 super 75 end 76 72 77 def line_break(str) 73 78 result = [] rubricks_core/trunk/app/models/rubricks_user.rb
r5873 r5886 531 531 System::SystemMailer.set_config 532 532 begin 533 System::SystemMailer.deliver_password_changed(self .name, self.email_by_admin)533 System::SystemMailer.deliver_password_changed(self) 534 534 rescue Exception => ex 535 535 logger.error(ex.message) rubricks_core/trunk/public/javascripts/rubricks_common.js
r5833 r5886 749 749 var _2=$(_1); 750 750 if(_2){ 751 Event.observe(_2,"focus", rubricks.common.Rollover.onfocus.bindAsEventListener(rubricks.common.Rollover,_2),true);752 Event.observe(_2,"blur", rubricks.common.Rollover.onblur.bindAsEventListener(rubricks.common.Rollover,_2),true);751 Event.observe(_2,"focus",this.onfocus.bindAsEventListener(this,_2),true); 752 Event.observe(_2,"blur",this.onblur.bindAsEventListener(this,_2),true); 753 753 } 754 754 },focus_range:function(_3){ 755 755 var _4=$(_3); 756 _4.getElementsByClassName( rubricks.common.Rollover.class_name_focus).each(function(_5){756 _4.getElementsByClassName(this.class_name_focus).each(function(_5){ 757 757 rubricks.common.Rollover.focus(_5); 758 758 }); 759 759 },onblur:function(_6,_7){ 760 if(!rubricks.common.Rollover._running){ 761 return true; 762 } 763 rubricks.common.Rollover._inactivate(_7); 760 this._inactivate(_7); 764 761 },onfocus:function(_8,_9){ 765 if(!rubricks.common.Rollover._running){ 766 return true; 767 } 768 rubricks.common.Rollover._activate(_9); 762 this._activate(_9); 769 763 },onmouseout:function(_a,_b){ 770 if(!rubricks.common.Rollover._running){ 771 return true; 772 } 773 rubricks.common.Rollover._inactivate(_b); 764 this._inactivate(_b); 774 765 },onmouseover:function(_c,_d){ 775 if(!rubricks.common.Rollover._running){ 776 return true; 777 } 778 rubricks.common.Rollover._activate(_d); 766 this._activate(_d); 767 },start:function(){ 768 this._running=true; 769 },stop:function(){ 770 this._running=false; 779 771 },swap:function(_e){ 780 772 var _f=$(_e); 781 773 if(_f){ 782 Event.observe(_f,"mouseover", rubricks.common.Rollover.onmouseover.bindAsEventListener(rubricks.common.Rollover,_f),true);783 Event.observe(_f,"mouseout", rubricks.common.Rollover.onmouseout.bindAsEventListener(rubricks.common.Rollover,_f),true);774 Event.observe(_f,"mouseover",this.onmouseover.bindAsEventListener(this,_f),true); 775 Event.observe(_f,"mouseout",this.onmouseout.bindAsEventListener(this,_f),true); 784 776 } 785 777 },swap_range:function(_10){ 786 778 var _11=$(_10); 787 779 if(_11){ 788 _11.getElementsByClassName( rubricks.common.Rollover.class_name_swap).each(function(_12){780 _11.getElementsByClassName(this.class_name_swap).each(function(_12){ 789 781 rubricks.common.Rollover.swap(_12); 790 782 }); 791 783 } 792 },start:function(){793 rubricks.common.Rollover._running=true;794 },stop:function(){795 rubricks.common.Rollover._running=false;796 784 },_activate:function(_13){ 785 if(!this._running){ 786 return true; 787 } 797 788 _13.className.split(" ").each(function(_14){ 798 789 if(_14.indexOf(rubricks.common.Rollover.class_postfix_inactive)>0){ … … 802 793 }); 803 794 },_inactivate:function(_15){ 795 if(!this._running){ 796 return true; 797 } 804 798 _15.className.split(" ").each(function(_16){ 805 799 if(_16.indexOf(rubricks.common.Rollover.class_postfix_active)>0){ … … 809 803 }); 810 804 }}; 811 Rollover=rubricks.common.Rollover;812 805 813 806 Object.extend(rubricks.common,{rubricks_header_show:function(){ rubricks_core/trunk/public/javascripts/src_rubricks_common_rollover.js
r5833 r5886 8 8 var element = $(node); 9 9 if(element) { 10 Event.observe(element, 'focus', rubricks.common.Rollover.onfocus.bindAsEventListener(rubricks.common.Rollover, element), true);11 Event.observe(element, 'blur', rubricks.common.Rollover.onblur.bindAsEventListener(rubricks.common.Rollover, element), true);10 Event.observe(element, 'focus', this.onfocus.bindAsEventListener(this, element), true); 11 Event.observe(element, 'blur', this.onblur.bindAsEventListener(this, element), true); 12 12 } 13 13 }, 14 14 focus_range: function(node) { 15 15 var element = $(node); 16 element.getElementsByClassName( rubricks.common.Rollover.class_name_focus).each(16 element.getElementsByClassName(this.class_name_focus).each( 17 17 function(element) { 18 18 rubricks.common.Rollover.focus(element); … … 21 21 }, 22 22 onblur: function(event, node) { 23 if (!rubricks.common.Rollover._running) { return true; } 24 rubricks.common.Rollover._inactivate(node); 23 this._inactivate(node); 25 24 }, 26 25 onfocus: function(event, node) { 27 if (!rubricks.common.Rollover._running) { return true; } 28 rubricks.common.Rollover._activate(node); 26 this._activate(node); 29 27 }, 30 28 onmouseout: function(event, node) { 31 if (!rubricks.common.Rollover._running) { return true; } 32 rubricks.common.Rollover._inactivate(node); 29 this._inactivate(node); 33 30 }, 34 31 onmouseover: function(event, node) { 35 if (!rubricks.common.Rollover._running) { return true; } 36 rubricks.common.Rollover._activate(node); 32 this._activate(node); 33 }, 34 start: function() { 35 this._running = true; 36 }, 37 stop: function() { 38 this._running = false; 37 39 }, 38 40 swap: function(node) { 39 41 var element = $(node); 40 42 if(element) { 41 Event.observe(element, 'mouseover', rubricks.common.Rollover.onmouseover.bindAsEventListener(rubricks.common.Rollover, element), true);42 Event.observe(element, 'mouseout', rubricks.common.Rollover.onmouseout.bindAsEventListener(rubricks.common.Rollover, element), true);43 Event.observe(element, 'mouseover', this.onmouseover.bindAsEventListener(this, element), true); 44 Event.observe(element, 'mouseout', this.onmouseout.bindAsEventListener(this, element), true); 43 45 } 44 46 }, … … 46 48 var element = $(node); 47 49 if(element) { 48 element.getElementsByClassName( rubricks.common.Rollover.class_name_swap).each(50 element.getElementsByClassName(this.class_name_swap).each( 49 51 function(element) { 50 52 rubricks.common.Rollover.swap(element); … … 53 55 } 54 56 }, 55 start: function() {56 rubricks.common.Rollover._running = true;57 },58 stop: function() {59 rubricks.common.Rollover._running = false;60 },61 57 _activate: function(element) { 58 if(!this._running) {return true;} 62 59 element.className.split(' ').each( 63 60 function(class_name) { … … 70 67 }, 71 68 _inactivate: function(element) { 69 if(!this._running) {return true;} 72 70 element.className.split(' ').each ( 73 71 function(class_name) { … … 80 78 } 81 79 } 82 83 //alias84 Rollover = rubricks.common.Rollover;rubricks_core/trunk/script/create_mail
r3161 r5886 19 19 to = parser.default_argv[2] 20 20 from = parser.default_argv[3] 21 System::SystemMailer.set_config22 21 System::SystemMailer.deliver_script(subject, message, to, from) 23 22 rescue OptionParser::ParseError rubricks_core/trunk/vendor/plugins/rubricks/lib/action_controller_user_management.rb
r5873 r5886 161 161 judge_show_group(@options) 162 162 @focus_id = params[:focus_id].to_i 163 @root_rg_list = RubricksGroup.find_rubricks_groups(:root => true, :rc_id => @options[:private_component_id]) 163 rg_options = RubricksConfig.get('user_guest_available') ? {:root => true, :rc_id => @options[:private_component_id]} : {:root => true, :rc_id => @options[:private_component_id], :guest => false} 164 @root_rg_list = RubricksGroup.find_rubricks_groups(rg_options) 164 165 rubricks_logger({:action_type => :list, :note => 'ALL GROUPS'}) 165 166 render :template => '/system/user_management/group_tree.rhtml' … … 276 277 else 277 278 begin 278 System::SystemMailer.set_config 279 System::SystemMailer.deliver_account_approval(ru.login_name, ru.email_by_admin) 279 System::SystemMailer.deliver_account_approval(ru) 280 280 rescue Exception => ex 281 281 logger.error(ex.message) rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_attachment_helper.rb
r4886 r5886 3 3 module AttachmentHelper 4 4 def render_attachment(ra, options = {}) 5 type = options.delete(:type) 6 type ||= (ra.image_file?) ? 'image' : 'file' 5 7 if ra.accessable? 6 type = options.delete(:type)7 8 url_options = options[:url_options] || ra.url_options 8 9 case type.to_s 9 when 'file'10 return render_attachment_as_file(options, url_options)11 10 when 'image' 12 11 return render_attachment_as_image(options, url_options) 13 12 else 14 if ra.image_file? 15 return render_attachment_as_image(options, url_options) 16 else 17 return render_attachment_as_file(options, url_options) 18 end 13 options[:text] ||= ra.name 14 return render_attachment_as_file(options, url_options) 19 15 end 20 16 else … … 25 21 private 26 22 def render_attachment_as_file(options, url_options) 23 image_url = url_for("/images/themes/#{RubricksLib.current_theme_name}/icons/icon_attachment.gif") 24 alt = options.delete(:alt) 25 alt ||= 'Attachment' 26 text = options.delete(:text) 27 text ||= '' 27 28 image_options = { 28 :alt => options[:alt] || 'Attachment',29 :alt => alt, 29 30 :size => '16x16', 30 31 :title => options[:title], 31 32 } 32 text = options[:text] || ''33 image_url = url_for("/images/themes/#{RubricksLib.current_theme_name}/icons/icon_attachment.gif")34 options.delete(:alt) if options[:alt]35 options.delete(:text) if options[:text]36 33 options.merge!({:type => 'application/octet-stream'}) 37 34 return link_to(image_tag(image_url, image_options) + text, url_options, options) rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_js_helper.rb
r5819 r5886 40 40 end 41 41 42 def rollover_attributes(options = {}) 43 %Q| onmouseover="#{options[:onmouseover]};rubricks.common.Rollover.onmouseover(event, this);" onmouseout="#{options[:onmouseout]};rubricks.common.Rollover.onmouseout(event, this);"| 44 end 45 42 46 def rollover_swap(*dom_ids) 43 47 html = '<script type="text/javascript">' rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_language_helper.rb
r5547 r5886 4 4 def jl(*args) 5 5 if(args.length == 1) 6 if args[0].is_a?(Array) 7 format = args[0].shift 8 return tag_escape(escape_javascript(sprintf(l(format), *args[0]))) 9 else 10 return tag_escape(escape_javascript(l(args[0]))) 11 end 6 return tag_escape(escape_javascript(l(args[0]))) 12 7 else 13 format = args.shift 14 return tag_escape(escape_javascript(sprintf(l(format), *args))) 8 return tag_escape(escape_javascript(l(args.to_a))) 15 9 end 16 10 end … … 18 12 def hl(*args) 19 13 if(args.length == 1) 20 if args[0].is_a?(Array) 21 format = args[0].shift 22 return html_escape(sprintf(l(format), *args[0])) 23 else 24 return html_escape(l(args[0])) 25 end 14 return html_escape(l(args[0])) 26 15 else 27 format = args.shift 28 return html_escape(sprintf(l(format), *args)) 16 return html_escape(l(args.to_a)) 29 17 end 30 18 end 31 19 32 def l(arg) 20 def l(*args) 21 arg, language = args[0], args[1] 33 22 return '' if arg.nil? 34 return arg unless arg.is_a?(String) 35 arg.gsub(/(\[+)(_)?([a-zA-Z0-9_]*)(\]+)/) do 23 case arg 24 when Array 25 str = arg.shift 26 arr = arg 27 when String 28 str = arg 29 else 30 return arg 31 end 32 str.gsub(/(\[+)(_)?([a-zA-Z0-9_]*)(\]+)/) do 36 33 if $2.nil? 37 34 $1 + $3 + $4 … … 39 36 $1.chop + $2 + $3 + $4.chop 40 37 else 41 if RubricksLib.lang .blank?38 if RubricksLib.lang(language).blank? 42 39 '' 43 40 else 44 (RubricksLib.lang[$2 + $3])? RubricksLib.lang[$2 + $3] : arg 41 str = (RubricksLib.lang(language)[$2 + $3]) ? RubricksLib.lang(language)[$2 + $3] : str 42 if arr.blank? 43 str 44 else 45 arr.unshift(str) 46 sprintf(*arr) 47 end 45 48 end 46 49 end rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_layout_window_helper.rb
r5583 r5886 31 31 <p id="#{options[:contents][:prefix]}message" class="export_window_message">#{hl(options[:contents][:message])}</p> 32 32 <p style="padding-right:20px; text-align:right;"> 33 #{submit_tag(hl('[_Common_Yes]'), {:id => "#{options[:contents][:prefix]}button", :class => 'submit_inactive submit_normal swap'})} 34 <input type="button" id="#{options[:contents][:prefix]}cancel_button" class="submit_inactive submit_normal swap" value="#{hl('[_Common_No]')}" onclick="#{options[:variable]}.close();"> 35 #{rollover_swap("#{options[:contents][:prefix]}button", "#{options[:contents][:prefix]}cancel_button")} 33 <input type="submit" id="#{options[:contents][:prefix]}button" class="submit_inactive submit_normal swap" value="#{hl('[_Common_Yes]')}" #{rollover_attributes} onclick="#{options[:variable]}.close();" /> 34 <input type="button" id="#{options[:contents][:prefix]}cancel_button" class="submit_inactive submit_normal swap" value="#{hl('[_Common_No]')}" #{rollover_attributes} onclick="#{options[:variable]}.close();" /> 36 35 </p> 37 36 </form>
