Changeset 5886

Show
Ignore:
Timestamp:
07/28/08 16:59:09 (4 months ago)
Author:
uta
Message:

2008/07/28 sync

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • rubricks_core/trunk/app/models/rubricks_group.rb

    r5781 r5886  
    6666 
    6767    def find_rubricks_groups(*args) 
    68       options = args.flex :admin, :guest, :registered, :root, :rc_id, include 
     68      options = args.flex :admin, :guest, :registered, :root, :rc_id, :include 
    6969      options = { 
    7070        :admin      => true, 
     
    201201 
    202202  def group_info_editable? 
    203     return true 
     203    return self.built_in.blank? 
    204204  end 
    205205 
  • 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. 
    21module RubricksCharacterSetConvert 
    32  def convert_for_ie(str) 
     
    98  end 
    109 
    11   # Change mail body to Chinese encoding. 
    1210  def convert_mail_body(str) 
    1311    str 
    1412  end 
    1513 
    16   # Change mail header to Chinese. 
    1714  def convert_mail_header(str) 
    1815    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. 
    21module RubricksCharacterSetConvert 
    32  def convert_for_ie(str) 
     
    98  end 
    109 
    11   # Change mail body to English encode. 
    1210  def convert_mail_body(str) 
    1311    return str 
    1412  end 
    1513 
    16   # Change mail header to English encode. 
    1714  def convert_mail_header(str) 
    1815    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. 
    21module RubricksCharacterSetConvert 
    32  def convert_for_ie(str) 
     
    98  end 
    109 
    11   # Change mail body to Japanese encoding. 
    1210  def convert_mail_body(str) 
    1311    Kconv::kconv(str, Kconv::JIS) 
    1412  end 
    1513 
    16   # Change mail header to Japanese. 
    1714  def convert_mail_header(str) 
    1815    Kconv::kconv(str, Kconv::JIS) 
  • rubricks_core/trunk/app/models/rubricks_lib/rubricks_character_set_convert_lib.rb

    r5084 r5886  
    22  @@charset_converts = {} 
    33 
    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)) 
    68  end 
    79 
    810  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) 
    1515      m, cache_mtime = @@charset_converts[lang] 
    1616      return m if mtime <= cache_mtime 
    1717    end 
    18  
    1918    m = load_charset_file(path) 
    20     @@charset_converts[lang] = [ m, mtime ] 
    21  
     19    @@charset_converts[lang] = [m, mtime] 
    2220    return m 
    2321  end 
     
    2523  def load_charset_file(path) 
    2624    m = Module.new 
    27  
    2825    open(path) do |f| 
    2926      m.module_eval(f.read) 
    3027      m.module_eval('extend self::RubricksCharacterSetConvert') 
    3128    end 
    32  
    3329    return m 
    3430  end 
  • rubricks_core/trunk/app/models/rubricks_mailer.rb

    r5816 r5886  
    77 
    88  class << self 
    9     def set_config 
     9    def set_config(language = nil) 
    1010      if RubricksLib.test_mode? 
    1111        logger.debug 'Selenium Test Mode' 
     
    2121          :authentication   => (use_auth) ? RubricksConfig.get('mail_smtp_password_encode').to_sym : nil 
    2222        } 
     23        language ||= RubricksLib.current_lang 
     24        TMail::Encoder::OPTIONS['UTF8'] = (language == 'japanese') ? '-M' : nil 
    2325        ActionMailer::Base.raise_delivery_errors = true 
    2426        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
    2628      end 
    2729    end 
    2830  end 
    2931 
    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) 
    3138    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' : nil 
    3639  end 
    3740 
    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   end 
    46    
    4741  def deliver! 
    4842    if RubricksLib.test_mode? 
     
    6256  protected 
    6357  def multi_lang!(str) 
    64     RubricksLib.convert("convert_mail_header", str) 
     58    RubricksLib.convert('convert_mail_header', str) 
    6559  end 
    6660 
     
    7064 
    7165  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 
    7277  def line_break(str) 
    7378    result = [] 
  • rubricks_core/trunk/app/models/rubricks_user.rb

    r5873 r5886  
    531531      System::SystemMailer.set_config 
    532532      begin 
    533         System::SystemMailer.deliver_password_changed(self.name, self.email_by_admin
     533        System::SystemMailer.deliver_password_changed(self
    534534      rescue Exception => ex 
    535535        logger.error(ex.message) 
  • rubricks_core/trunk/public/javascripts/rubricks_common.js

    r5833 r5886  
    749749var _2=$(_1); 
    750750if(_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); 
     751Event.observe(_2,"focus",this.onfocus.bindAsEventListener(this,_2),true); 
     752Event.observe(_2,"blur",this.onblur.bindAsEventListener(this,_2),true); 
    753753} 
    754754},focus_range:function(_3){ 
    755755var _4=$(_3); 
    756 _4.getElementsByClassName(rubricks.common.Rollover.class_name_focus).each(function(_5){ 
     756_4.getElementsByClassName(this.class_name_focus).each(function(_5){ 
    757757rubricks.common.Rollover.focus(_5); 
    758758}); 
    759759},onblur:function(_6,_7){ 
    760 if(!rubricks.common.Rollover._running){ 
    761 return true; 
    762 
    763 rubricks.common.Rollover._inactivate(_7); 
     760this._inactivate(_7); 
    764761},onfocus:function(_8,_9){ 
    765 if(!rubricks.common.Rollover._running){ 
    766 return true; 
    767 
    768 rubricks.common.Rollover._activate(_9); 
     762this._activate(_9); 
    769763},onmouseout:function(_a,_b){ 
    770 if(!rubricks.common.Rollover._running){ 
    771 return true; 
    772 
    773 rubricks.common.Rollover._inactivate(_b); 
     764this._inactivate(_b); 
    774765},onmouseover:function(_c,_d){ 
    775 if(!rubricks.common.Rollover._running){ 
    776 return true; 
    777 
    778 rubricks.common.Rollover._activate(_d); 
     766this._activate(_d); 
     767},start:function(){ 
     768this._running=true; 
     769},stop:function(){ 
     770this._running=false; 
    779771},swap:function(_e){ 
    780772var _f=$(_e); 
    781773if(_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); 
     774Event.observe(_f,"mouseover",this.onmouseover.bindAsEventListener(this,_f),true); 
     775Event.observe(_f,"mouseout",this.onmouseout.bindAsEventListener(this,_f),true); 
    784776} 
    785777},swap_range:function(_10){ 
    786778var _11=$(_10); 
    787779if(_11){ 
    788 _11.getElementsByClassName(rubricks.common.Rollover.class_name_swap).each(function(_12){ 
     780_11.getElementsByClassName(this.class_name_swap).each(function(_12){ 
    789781rubricks.common.Rollover.swap(_12); 
    790782}); 
    791783} 
    792 },start:function(){ 
    793 rubricks.common.Rollover._running=true; 
    794 },stop:function(){ 
    795 rubricks.common.Rollover._running=false; 
    796784},_activate:function(_13){ 
     785if(!this._running){ 
     786return true; 
     787} 
    797788_13.className.split(" ").each(function(_14){ 
    798789if(_14.indexOf(rubricks.common.Rollover.class_postfix_inactive)>0){ 
     
    802793}); 
    803794},_inactivate:function(_15){ 
     795if(!this._running){ 
     796return true; 
     797} 
    804798_15.className.split(" ").each(function(_16){ 
    805799if(_16.indexOf(rubricks.common.Rollover.class_postfix_active)>0){ 
     
    809803}); 
    810804}}; 
    811 Rollover=rubricks.common.Rollover; 
    812805 
    813806Object.extend(rubricks.common,{rubricks_header_show:function(){ 
  • rubricks_core/trunk/public/javascripts/src_rubricks_common_rollover.js

    r5833 r5886  
    88    var element = $(node); 
    99    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); 
    1212    } 
    1313  }, 
    1414  focus_range: function(node) { 
    1515    var element = $(node); 
    16     element.getElementsByClassName(rubricks.common.Rollover.class_name_focus).each( 
     16    element.getElementsByClassName(this.class_name_focus).each( 
    1717      function(element) { 
    1818        rubricks.common.Rollover.focus(element); 
     
    2121  }, 
    2222  onblur: function(event, node) { 
    23     if (!rubricks.common.Rollover._running) { return true; } 
    24     rubricks.common.Rollover._inactivate(node); 
     23    this._inactivate(node); 
    2524  }, 
    2625  onfocus: function(event, node) { 
    27     if (!rubricks.common.Rollover._running) { return true; } 
    28     rubricks.common.Rollover._activate(node); 
     26    this._activate(node); 
    2927  }, 
    3028  onmouseout: function(event, node) { 
    31     if (!rubricks.common.Rollover._running) { return true; } 
    32     rubricks.common.Rollover._inactivate(node); 
     29    this._inactivate(node); 
    3330  }, 
    3431  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; 
    3739  }, 
    3840  swap: function(node) { 
    3941    var element = $(node); 
    4042    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); 
    4345    } 
    4446  }, 
     
    4648    var element = $(node); 
    4749    if(element) { 
    48       element.getElementsByClassName(rubricks.common.Rollover.class_name_swap).each( 
     50      element.getElementsByClassName(this.class_name_swap).each( 
    4951        function(element) { 
    5052          rubricks.common.Rollover.swap(element); 
     
    5355    } 
    5456  }, 
    55   start: function() { 
    56     rubricks.common.Rollover._running = true; 
    57   }, 
    58   stop: function() { 
    59     rubricks.common.Rollover._running = false; 
    60   }, 
    6157  _activate: function(element) { 
     58    if(!this._running) {return true;} 
    6259    element.className.split(' ').each( 
    6360      function(class_name) { 
     
    7067  }, 
    7168  _inactivate: function(element) { 
     69    if(!this._running) {return true;} 
    7270    element.className.split(' ').each ( 
    7371      function(class_name) { 
     
    8078  } 
    8179} 
    82  
    83 //alias 
    84 Rollover = rubricks.common.Rollover; 
  • rubricks_core/trunk/script/create_mail

    r3161 r5886  
    1919  to      = parser.default_argv[2] 
    2020  from    = parser.default_argv[3] 
    21   System::SystemMailer.set_config 
    2221  System::SystemMailer.deliver_script(subject, message, to, from) 
    2322rescue OptionParser::ParseError 
  • rubricks_core/trunk/vendor/plugins/rubricks/lib/action_controller_user_management.rb

    r5873 r5886  
    161161        judge_show_group(@options) 
    162162        @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) 
    164165        rubricks_logger({:action_type => :list, :note => 'ALL GROUPS'}) 
    165166        render :template => '/system/user_management/group_tree.rhtml' 
     
    276277        else 
    277278          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) 
    280280          rescue Exception => ex 
    281281            logger.error(ex.message) 
  • rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_attachment_helper.rb

    r4886 r5886  
    33    module AttachmentHelper 
    44      def render_attachment(ra, options = {}) 
     5        type    = options.delete(:type) 
     6        type  ||= (ra.image_file?) ? 'image' : 'file' 
    57        if ra.accessable? 
    6           type = options.delete(:type) 
    78          url_options = options[:url_options] || ra.url_options 
    89          case type.to_s 
    9           when 'file' 
    10             return render_attachment_as_file(options, url_options) 
    1110          when 'image' 
    1211            return render_attachment_as_image(options, url_options) 
    1312          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) 
    1915          end 
    2016        else 
     
    2521      private 
    2622      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  ||= '' 
    2728        image_options = { 
    28           :alt      => options[:alt] || 'Attachment'
     29          :alt      => alt
    2930          :size     => '16x16', 
    3031          :title    => options[:title], 
    3132        } 
    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] 
    3633        options.merge!({:type => 'application/octet-stream'}) 
    3734        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  
    4040      end 
    4141 
     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 
    4246      def rollover_swap(*dom_ids) 
    4347        html = '<script type="text/javascript">' 
  • rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_language_helper.rb

    r5547 r5886  
    44      def jl(*args) 
    55        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]))) 
    127        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))) 
    159        end 
    1610      end 
     
    1812      def hl(*args) 
    1913        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])) 
    2615        else 
    27           format = args.shift 
    28           return html_escape(sprintf(l(format), *args)) 
     16          return html_escape(l(args.to_a)) 
    2917        end 
    3018      end 
    3119 
    32       def l(arg) 
     20      def l(*args) 
     21        arg, language = args[0], args[1] 
    3322        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 
    3633          if $2.nil? 
    3734            $1 + $3 + $4 
     
    3936            $1.chop + $2 + $3 + $4.chop 
    4037          else 
    41             if RubricksLib.lang.blank? 
     38            if RubricksLib.lang(language).blank? 
    4239              '' 
    4340            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 
    4548            end 
    4649          end 
  • rubricks_core/trunk/vendor/plugins/rubricks/lib/action_view_rubricks_layout_window_helper.rb

    r5583 r5886  
    3131              <p id="#{options[:contents][:prefix]}message" class="export_window_message">#{hl(options[:contents][:message])}</p> 
    3232              <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();" /> 
    3635              </p> 
    3736            </form>