Paste: test

Author: test
Mode: ruby
Date: Wed, 24 Jun 2009 00:00:56
Plain Text |
  private
  def get_tree(rights, parent)
    data = Array.new
    rights.each { |right|
      if !right.leaf?
        if data.empty?
          data = [{"text"  =>  right.show_name,"id"  => right.id,
                    "cls" => "folder" ,"leaf"  => false,
                    :expanded => true,
                    "children" => get_tree(right.children,right) }]
        else
          data.concat([{"text" =>  right.show_name,"id"  => right.id,
                         "cls" => "folder" ,"leaf"  => false,
                         :expanded => true,
                         "children" => get_tree(right.children,right)}])
        end
      else
        data.concat([{"text" => right.show_name,"id" => right.id,"cls" => "file","leaf" => true}])
      end
    }
    return data
  end

Annotation: aaa

Author: aa
Mode: factor
Date: Wed, 24 Jun 2009 00:01:52
Plain Text |
  private
  def get_tree(rights, parent)
    data = Array.new
    rights.each { |right|
      if !right.leaf?
        if data.empty?
          data = [{"text"  =>  right.show_name,"id"  => right.id,
                    "cls" => "folder" ,"leaf"  => false,
                    :expanded => true,
                    "children" => get_tree(right.children,right) }]
        else
          data.concat([{"text" =>  right.show_name,"id"  => right.id,
                         "cls" => "folder" ,"leaf"  => false,
                         :expanded => true,
                         "children" => get_tree(right.children,right)}])
        end
      else
        data.concat([{"text" => right.show_name,"id" => right.id,"cls" => "file","leaf" => true}])
      end
    }
    return data #data
  end

New Annotation

Summary:
Author:
Mode:
Body: