<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>public/viewers/extjs/javascripts/BootLoader.js</filename>
    </added>
    <added>
      <filename>public/viewers/extjs/javascripts/Router.js</filename>
    </added>
    <added>
      <filename>public/viewers/extjs/javascripts/data/SingleStore.js</filename>
    </added>
    <added>
      <filename>public/viewers/extjs/javascripts/data/View.js</filename>
    </added>
    <added>
      <filename>public/viewers/extjs/javascripts/widgets/MainPane.js</filename>
    </added>
    <added>
      <filename>public/viewers/extjs/javascripts/widgets/Page.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,40 +1,40 @@
 # App base controller
 
 module App
-	VIEW_ROUTES = {:dir =&gt; {}, :host =&gt; {}, :catch_all =&gt; nil}
+  VIEW_ROUTES = {:dir =&gt; {}, :host =&gt; {}, :catch_all =&gt; nil}
 	
-	class AppController &lt; Application
-		layout false
-		before :set_view
-		before :set_namespace
-		protected
+  class AppController &lt; Application
+    layout false
+    before :set_view
+    before :set_namespace
+    protected
 
-		##
-		# setup the views according to the registerd view routes
-		#
-		def set_view
-				return if params[:dir] &amp;&amp; @view = App::VIEW_ROUTES[:dir][params[:dir]]
-				return if @view = App::VIEW_ROUTES[:host][request.host]
-				return if @view = App::VIEW_ROUTES[:catch_all]
-				raise NotFoundException
-		end
+    ##
+    # setup the views according to the registerd view routes
+    #
+    def set_view
+      return if params[:dir] &amp;&amp; @view = App::VIEW_ROUTES[:dir][params[:dir]]
+      return if @view = App::VIEW_ROUTES[:host][request.host]
+      return if @view = App::VIEW_ROUTES[:catch_all]
+      raise NotFoundException
+    end
 		
-		##
-		# sets the schema's namespace 
-		#
-		#
-		def set_namespace
-		  @ns = @view::SCHEMA
-	  end
+    ##
+    # sets the schema's namespace
+    #
+    #
+    def set_namespace
+      @ns = @view::NAMESPACE
+    end
 	  
 	  
-	  ##
-	  # Sets the response code to 200
-	  # and returns the body
-	  #
-	  def ok(body = '')
-	    self.status = 200
-	    return body
+    ##
+    # Sets the response code to 200
+    # and returns the body
+    #
+    def ok(body = '')
+      self.status = 200
+      return body
     end
-	end
+  end
 end
\ No newline at end of file</diff>
      <filename>app/controllers/app/app.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,13 +10,17 @@ module App
       render :template =&gt; &quot;viewers/#{@view::VIEWER}&quot;,
         :layout   =&gt; false
     end
-		
-    def page
-      page = @view::PAGES[params[:page]]
-      return display(page) if page
-      raise NotFoundException
+
+    ##
+    # response to a describe request by a client.
+    # returns a valuable info for the client about schema information
+    #
+    def describe
+      only_provides :js, :xml  # only response to json/xml requsets
+
+      display(@view.describe())
     end
-		
+    
     protected
 		
     ##</diff>
      <filename>app/controllers/app/views.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ module App
   #
   #
   class Action
-		include Namespacing
+    include Namespacing
     @@actions ||= {}
     
     </diff>
      <filename>app/models/app/action.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,67 +1,67 @@
 require 'namespacing'
 
 module App
-	class Entity &lt; Sequel::Model
-		# = Entity
-		#
-		# The base Entity model, used by NiftyVM
-		#
-		# * Entities used the InheritanceMixin for STI
-		# * Entity's subclasses are generated by the EntityKind model on Schema load
-		#
-		#
-		# = Architecture
-		# *	Entity 
-		#    + Fields
-		# 	 + Fieldlets	
-		#
-		# == Fields
-		# A Field is a set of 1 or more instances, and a solid definition of it's fieldlets
-		# 	Every FieldInstnace has the Fieldlets acording to the definition in the field
-		#
-		# == Fieldlets
-		# Fieldlet is the smallest piece of information that can be store in an entity
-		# Simple examples of fieldlets are: String, Text, File, Date etc
-		# 
-		# For more information about entities, checkout entity's included modules
+  class Entity &lt; Sequel::Model
+    # = Entity
+    #
+    # The base Entity model, used by NiftyVM
+    #
+    # * Entities used the InheritanceMixin for STI
+    # * Entity's subclasses are generated by the EntityKind model on Schema load
+    #
+    #
+    # = Architecture
+    # *	Entity
+    #    + Fields
+    # 	 + Fieldlets
+    #
+    # == Fields
+    # A Field is a set of 1 or more instances, and a solid definition of it's fieldlets
+    # 	Every FieldInstnace has the Fieldlets acording to the definition in the field
+    #
+    # == Fieldlets
+    # Fieldlet is the smallest piece of information that can be store in an entity
+    # Simple examples of fieldlets are: String, Text, File, Date etc
+    #
+    # For more information about entities, checkout entity's included modules
 		
 			
-		# set schema
-		set_schema(:entities) do 
-			bigint		  :id, :unsigned =&gt; true, :null =&gt; false
-			bigint			:kind, :unsigned =&gt; true, :null =&gt; false
-			timestamp		:created_at
-			timestamp		:updated_at
-			varchar			:title
+    # set schema
+    set_schema(:entities) do
+      bigint		  :id, :unsigned =&gt; true, :null =&gt; false
+      bigint			:kind, :unsigned =&gt; true, :null =&gt; false
+      timestamp		:created_at
+      timestamp		:updated_at
+      varchar			:title
 
-			primary_key [:id]
-			index				[:title,:kind]
-		end
+      primary_key [:id]
+      index				[:title,:kind]
+    end
 		
-		# Inheritance Mixin - for smart STI
-		include InheritanceMixin
-		include Namespacing
+    # Inheritance Mixin - for smart STI
+    include InheritanceMixin
+    include Namespacing
 
 
 
-		# setup all the instance variables
-		after_initialize do 
-			@fieldlets = Hash.new{|hash, key| hash[key] = {}}
-			@fields = FieldContainer.new(self.class::FIELDS,self)
-			@instances = {}
-			@fieldlets_by_type = {}
-			@entities_to_load = {}
-			@actions = []
-		end
+    # setup all the instance variables
+    after_initialize do
+      @fieldlets = Hash.new{|hash, key| hash[key] = {}}
+      @fields = FieldContainer.new(self.class::FIELDS,self)
+      @instances = {}
+      @fieldlets_by_type = {}
+      @entities_to_load = {}
+      @actions = []
+    end
 		
 		
-		## utility
+    ## utility
 
     # nice shit
-		def fwf
-		  self.class.find_with_fieldlets(self.pk.to_s(16))
-		end
+    def fwf
+      self.class.find_with_fieldlets(self.pk.to_s(16))
+    end
 		
 
-	end
+  end
 end
\ No newline at end of file</diff>
      <filename>app/models/app/entity.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,29 +1,29 @@
 
 
 module App
-	class Entity &lt; Sequel::Model
-		#
-		# accessors
-		#
-		attr_accessor :fields, :fieldlets, :instances, :fieldlets_by_type
+  class Entity &lt; Sequel::Model
+    #
+    # accessors
+    #
+    attr_accessor :fields, :fieldlets, :instances, :fieldlets_by_type
 		
 		
-		##
-		# Setup the fields-fieldlets structure, iterates over the given fieldlets
-		# and push them to their corrsponding fields
-		#
-		# @param [Array[App::Fieldlet]] fieldlets. an array of loaded fieldlets
-		#
-		# @see Entity.find_with_fieldlets
-		#
-		def init_fieldlets(fieldlets=[])
-			fieldlets.each do |fieldlet|
-				@instances[fieldlet[:instance_id]] = @fields.push(fieldlet)
+    ##
+    # Setup the fields-fieldlets structure, iterates over the given fieldlets
+    # and push them to their corrsponding fields
+    #
+    # @param [Array[App::Fieldlet]] fieldlets. an array of loaded fieldlets
+    #
+    # @see Entity.find_with_fieldlets
+    #
+    def init_fieldlets(fieldlets=[])
+      fieldlets.each do |fieldlet|
+        @instances[fieldlet[:instance_id]] = @fields.push(fieldlet)
     
-				@fieldlets[fieldlet[:instance_id]][fieldlet.class::IDENTIFIER] = fieldlet
-				@fieldlets_by_type[fieldlet.class::IDENTIFIER] ||= fieldlet
-			end
-		end
+        @fieldlets[fieldlet[:instance_id]][fieldlet.class::IDENTIFIER] = fieldlet
+        @fieldlets_by_type[fieldlet.class::IDENTIFIER] ||= fieldlet
+      end
+    end
     
     ##
     # a shorthand for 
@@ -31,134 +31,136 @@ module App
     #
     #
     def fetch_entities_to_load
-	    self.class.fetch_entities_with_callbacks(@entities_to_load) 
-		end
+      self.class.fetch_entities_with_callbacks(@entities_to_load)
+    end
 		
-		## == ClassMethods
+    ## == ClassMethods
 		
 		
-		##
-		# Fetch entities by the given ids, and load their fieldlets.
-		#
-		# @param [String] *args - one or more hex encoded entity ids
-		#
-		# @return [nil] if no entity found
-		# @return [App::Entity] if single entity found
-		# @return Array[App::Entity] array of entities if more than one found
-		#
-		# === Notes
-		# * First we load the fieldlets for all the given entity ids 
-		# * We load all the entities by the given ids and the linked entities
-		# * We return only the requested entities
-		#
-		def self.find_with_fieldlets(*args)
-				entities_to_load = {}
+    ##
+    # Fetch entities by the given ids, and load their fieldlets.
+    #
+    # @param [String] *args - one or more hex encoded entity ids
+    #
+    # @return [nil] if no entity found
+    # @return [App::Entity] if single entity found
+    # @return Array[App::Entity] array of entities if more than one found
+    #
+    # === Notes
+    # * First we load the fieldlets for all the given entity ids
+    # * We load all the entities by the given ids and the linked entities
+    # * We return only the requested entities
+    #
+    def self.find_with_fieldlets(*args)
+      entities_to_load = {}
 			
-				ids = convert_ids_and_push_to_entities_to_load!(args,entities_to_load)
-				# convert ids to int from hexs ids
+      ids = convert_ids_and_push_to_entities_to_load!(args,entities_to_load)
+      # convert ids to int from hexs ids
 			
 				
-				fieldlets_dataset = ns()::Fieldlet.order(:entity_id, :instance_id).
-																					 filter!(:entity_id =&gt; ids)
+      fieldlets_dataset = ns()::Fieldlet.order(:entity_id, :instance_id).
+        filter!(:entity_id =&gt; ids)
 				
 				
-				fieldlets_for_entities = Hash.new{|hash, key| hash[key] = []}
+      fieldlets_for_entities = Hash.new{|hash, key| hash[key] = []}
 				
-				# Load all the fieldlets, push them to a hash by the entity_id
-				fetched_fieldlets = fieldlets_dataset.all
-				fetched_fieldlets.each do |fieldlet|
-					next if !fieldlet #
+      # Load all the fieldlets, push them to a hash by the entity_id
+      fetched_fieldlets = fieldlets_dataset.all
+      fetched_fieldlets.each do |fieldlet|
+        next if !fieldlet #
 					
-					fieldlet.extract_callback(:entity_load_callback,entities_to_load)
+        fieldlet.extract_callback(:entity_load_callback,entities_to_load)
 					
-					fieldlets_for_entities[fieldlet[:entity_id]] &lt;&lt; fieldlet
-				end
+        fieldlets_for_entities[fieldlet[:entity_id]] &lt;&lt; fieldlet
+      end
 				
-				entities = fetch_entities_with_callbacks(entities_to_load) do |entity|
-					fieldlets = fieldlets_for_entities[entity[:id]]
-					next if fieldlets.empty?
+      entities = fetch_entities_with_callbacks(entities_to_load) do |entity|
+        fieldlets = fieldlets_for_entities[entity[:id]]
+        next if fieldlets.empty?
 	
-					entity.init_fieldlets(fieldlets)
-				end
+        entity.init_fieldlets(fieldlets)
+      end
 				
-				return prepere_fetch_result(ids, entities)
-		end
+      return prepere_fetch_result(ids, entities)
+    end
 
-		##
-		# Load the entities with the ids from the entities_to_load hash keys
-		# for each loaded entity, call the proc given as the hash value
-		# and yield the entity
-		#
-		# @param [Hash{String =&gt; Array[Proc]}] entities_to_load 
-		# 
-		# @yield proc to run on each entity after running the callbacks
-		# @yieldparam [App::Entity] 
-		#
-		# @return [App::Entity] the loaded entities
-		#
-		def self.fetch_entities_with_callbacks(entities_to_load)
-			return [] if entities_to_load.empty?
-			
-			# fetch from DB
-			entities = ns()::Entity.filter(:id =&gt; entities_to_load.keys).all
-			
-			# iterate each loaded entity, run callbacks and push fieldlets
-			entities.each do |entity|
-				next if !entity #skip nils
-				# run callbacks
-				if (entities_to_load[entity[:id]])
-					entities_to_load[entity[:id]].each{|callback| callback.call(entity)}
-				end
+    ##
+    # Load the entities with the ids from the entities_to_load hash keys
+    # for each loaded entity, call the proc given as the hash value
+    # and yield the entity
+    #
+    # @param [Hash{String =&gt; Array[Proc]}] entities_to_load
+    #
+    # @yield proc to run on each entity after running the callbacks
+    # @yieldparam [App::Entity]
+    #
+    # @return [App::Entity] the loaded entities
+    #
+    def self.fetch_entities_with_callbacks(entities_to_load)
+      return [] if entities_to_load.empty?
+
+      debugger
+      # fetch from DB
+      entities = ns()::Entity.filter(:id =&gt; entities_to_load.keys).all
+
+
+      # iterate each loaded entity, run callbacks and push fieldlets
+      entities.each do |entity|
+        next if !entity #skip nils
+        # run callbacks
+        if (entities_to_load[entity[:id]])
+          entities_to_load[entity[:id]].each{|callback| callback.call(entity)}
+        end
 				
-				yield entity if block_given? 
-			end
+        yield entity if block_given?
+      end
 			
-			# return the loaded entities
-			return entities
-		end
+      # return the loaded entities
+      return entities
+    end
 		
 		
-		protected
-		##
-		# Convert the given args from hex to fixnum and push them into the given 
-		# entities_to_load hash 
-		# 
-		# @param [Array[String]] list of entity ids (hex encoded)
-		# @param [Hash{Fixnum =&gt; Array[Proc]}] hash to push converted ids to
-		#
-		# @return [Array[Fixnum]] the converted ids
-		#
-		def self.convert_ids_and_push_to_entities_to_load!(args,entities_to_load)
-			ids = args.collect{|x| x.to_i(16)}
+    protected
+    ##
+    # Convert the given args from hex to fixnum and push them into the given
+    # entities_to_load hash
+    #
+    # @param [Array[String]] list of entity ids (hex encoded)
+    # @param [Hash{Fixnum =&gt; Array[Proc]}] hash to push converted ids to
+    #
+    # @return [Array[Fixnum]] the converted ids
+    #
+    def self.convert_ids_and_push_to_entities_to_load!(args,entities_to_load)
+      ids = args.collect{|x| x.to_i(16)}
 			
-			## setup hash for entities loading and callbacks
-			ids.each{|id| entities_to_load.merge!(id =&gt; [])}
-		end
+      ## setup hash for entities loading and callbacks
+      ids.each{|id| entities_to_load.merge!(id =&gt; [])}
+    end
 	
 		
-		##
-		# Return only the entities that their id is in ids
-		# (@see Entity.find_with_fieldlets)
-		# 
-		# @param [Array[Fixnum]] ids list of entity ids
-		# @param [Array[App::Entity]] entities - a list of entities to filter on
-		#
-		# @return [nil] if no entity found
-		# @return [App::Entity] if single entity found
-		# @return Array[App::Entity] array of entities if more than one found
-		#
+    ##
+    # Return only the entities that their id is in ids
+    # (@see Entity.find_with_fieldlets)
+    #
+    # @param [Array[Fixnum]] ids list of entity ids
+    # @param [Array[App::Entity]] entities - a list of entities to filter on
+    #
+    # @return [nil] if no entity found
+    # @return [App::Entity] if single entity found
+    # @return Array[App::Entity] array of entities if more than one found
+    #
 		
-		def self.prepere_fetch_result(ids, entities)
-			# return only requested entities
-			entities.reject!{|e| !ids.include? e[:id]}
+    def self.prepere_fetch_result(ids, entities)
+      # return only requested entities
+      entities.reject!{|e| !ids.include? e[:id]}
 			
-			# return nil if there are no results
-			return entities = nil if entities.empty?
+      # return nil if there are no results
+      return entities = nil if entities.empty?
 			
-			# return only one entity if the result array size is 1
-			return entities.first if entities.size == 1
+      # return only one entity if the result array size is 1
+      return entities.first if entities.size == 1
 			
-			return entities
-		end
-	end
+      return entities
+    end
+  end
 end
\ No newline at end of file</diff>
      <filename>app/models/app/entity/fetching.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,25 +12,25 @@
 # 
 
 module App
-	class Entity &lt; Sequel::Model
+  class Entity &lt; Sequel::Model
 		
 			
-			def to_json(*args)				
-				json_hash = {
-					:id =&gt; &quot;%016x&quot; % @values[:id],
-					:type =&gt; self.class::IDENTIFIER,
-					:title =&gt; @values[:title],
-					:created_at =&gt; @values[:created_at],
-					:updated_at	=&gt; @values[:updated_at],
-					:fields =&gt; @fields.with_return_value(),
-					:schema =&gt; self.class::SCHEMA
-				}
+    def to_json(*args)
+      json_hash = {
+        :id =&gt; &quot;%016x&quot; % @values[:id],
+        :type =&gt; self.class::IDENTIFIER,
+        :title =&gt; @values[:title],
+        :created_at =&gt; @values[:created_at],
+        :updated_at	=&gt; @values[:updated_at],
+        :fields =&gt; @fields.with_return_value(),
+        :schema =&gt; self.class::SCHEMA
+      }
 				
-				json_hash[:new] = true if @new
+      json_hash[:new] = true if @new
 
-				return json_hash.to_json(*args)
-			end
+      return json_hash.to_json
+    end
 		
-		# end  InstanceMethods
-	end
+    # end  InstanceMethods
+  end
 end</diff>
      <filename>app/models/app/entity/representation.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,193 +1,193 @@
 module App
-	class Entity &lt; Sequel::Model
+  class Entity &lt; Sequel::Model
 		
-		##
-		# Adds, updates and removes field instances for the entity
-		#
-		# @param [Hash] instance_hash
-		#
-		# === instance_hash examples
-		# * Updating: {&lt;InstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}
-		# 						{'80044300905744541' =&gt; {'4589dcc19104b5ad' =&gt; 'Merb'}}
-		# 						{'80044300905278446' =&gt; {'2a1f35b7547e73a7' =&gt; {x: 12, y: 34}}}
-		#
-		# * Adding: 	{'new' =&gt; {&lt;UniqInstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}}
-		# * Removing: {'remove' =&gt; {&lt;InstanceID&gt; =&gt; true}}
-		#
-		#def instances=(instances_hash)
-		#	@fieldlets_by_type ||= {} #for later lambda reference of the new fieldlets
-		#	@entities_to_load    = {}
-		#	
-		#	add_instances!		instances_hash.delete('new')
-		#	remove_instances! instances_hash.delete('remove')
-		#	update_instances! instances_hash
-		#	self.class.fetch_entities_with_callbacks(@entities_to_load)
-    #
-		#	
-		#	return true
-		#end
+    ##
+    # Adds, updates and removes field instances for the entity
+    #
+    # @param [Hash] instance_hash
+    #
+    # === instance_hash examples
+    # * Updating: {&lt;InstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}
+    # 						{'80044300905744541' =&gt; {'4589dcc19104b5ad' =&gt; 'Merb'}}
+    # 						{'80044300905278446' =&gt; {'2a1f35b7547e73a7' =&gt; {x: 12, y: 34}}}
+    #
+    # * Adding: 	{'new' =&gt; {&lt;UniqInstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}}
+    # * Removing: {'remove' =&gt; {&lt;InstanceID&gt; =&gt; true}}
+    #
+    #def instances=(instances_hash)
+    #	@fieldlets_by_type ||= {} #for later lambda reference of the new fieldlets
+    #	@entities_to_load    = {}
+    #
+    #	add_instances!		instances_hash.delete('new')
+    #	remove_instances! instances_hash.delete('remove')
+    #	update_instances! instances_hash
+    #	self.class.fetch_entities_with_callbacks(@entities_to_load)
+    #
+    #
+    #	return true
+    #end
 		
 
-		##
-		# Adds field instances for the entity
-		#
-		# @param [Hash] instance_hash
-		#
-		# === instance_hash examples
-		# {&lt;UniqInstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}
-		# {'80044300905744541' =&gt; {'4589dcc19104b5ad' =&gt; 'Merb'}}
-		#
-		#
-		# The UniqInstanceID has no real usage, it is only used the group fieldlets
-		# from the same instance
-		def add_instances!(instances_hash)
-				return if !instances_hash
-				instances_hash.each do |uniq_id, fieldlets_hash|
-				  field, fieldlets = ns()::Field.create_new_with_fieldlets(self, 
-				  																												fieldlets_hash)
+    ##
+    # Adds field instances for the entity
+    #
+    # @param [Hash] instance_hash
+    #
+    # === instance_hash examples
+    # {&lt;UniqInstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}
+    # {'80044300905744541' =&gt; {'4589dcc19104b5ad' =&gt; 'Merb'}}
+    #
+    #
+    # The UniqInstanceID has no real usage, it is only used the group fieldlets
+    # from the same instance
+    def add_instances!(instances_hash)
+      return if !instances_hash
+      instances_hash.each do |uniq_id, fieldlets_hash|
+        field, fieldlets = ns()::Field.create_new_with_fieldlets(self,
+          fieldlets_hash)
 				  
-				  @fields[field.class::IDENTIFIER] &lt;&lt; field
+        @fields[field.class::IDENTIFIER] &lt;&lt; field
 				  
-				  # iterate fieldlets, execute load callbacks																														
-				  fieldlets.each do |fieldlet|
-				  	# fetch and call any callback related to deferred loading of 
-				  	# entities
-				  	if callback = fieldlet.entity_create_callback
-				  		callback.call(@entities_to_load)
-				  	end
+        # iterate fieldlets, execute load callbacks
+        fieldlets.each do |fieldlet|
+          # fetch and call any callback related to deferred loading of
+          # entities
+          if callback = fieldlet.entity_create_callback
+            callback.call(@entities_to_load)
+          end
 				  	
-				  	# for later usage with the display generations
-				  	@fieldlets_by_type[fieldlet.class::IDENTIFIER] ||= fieldlet
-				  end																						
-			end
-		end
+          # for later usage with the display generations
+          @fieldlets_by_type[fieldlet.class::IDENTIFIER] ||= fieldlet
+        end
+      end
+    end
 		
 		
-		#
-		# instances_hash = {&lt;instance_id&gt; =&gt; &lt;field_id&gt;}
-		#
+    #
+    # instances_hash = {&lt;instance_id&gt; =&gt; &lt;field_id&gt;}
+    #
 
-		##
-		# Removes field instances for the entity
-		#
-		# @param [Hash] instance_hash
-		#
-		# === instance_hash examples
-		#  {&lt;InstanceID&gt; =&gt; true}
-		#  {'80044300905744541' =&gt; true}
-		#
-		def remove_instances!(instances_hash)	
-			return if !instances_hash		
-			instances_hash.each do |instance, value|
-				@instances[instance.to_i].mark_for_removal!
-			end
-		end
+    ##
+    # Removes field instances for the entity
+    #
+    # @param [Hash] instance_hash
+    #
+    # === instance_hash examples
+    #  {&lt;InstanceID&gt; =&gt; true}
+    #  {'80044300905744541' =&gt; true}
+    #
+    def remove_instances!(instances_hash)
+      return if !instances_hash
+      instances_hash.each do |instance, value|
+        @instances[instance.to_i].mark_for_removal!
+      end
+    end
 		
-		##
-		# Updates field instances for the entity
-		#
-		# @param [Hash] instance_hash
-		#
-		# === instance_hash examples
-		#  {&lt;InstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}
-		#  {'80044300905744541' =&gt; {'4589dcc19104b5ad' =&gt; 'Merb'}}
-		#  {'80044300905278446' =&gt; {'2a1f35b7547e73a7' =&gt; {x: 12, y: 34}}}
-		#
-		def update_instances!(instances_hash)
-			return if !instances_hash
+    ##
+    # Updates field instances for the entity
+    #
+    # @param [Hash] instance_hash
+    #
+    # === instance_hash examples
+    #  {&lt;InstanceID&gt; =&gt; {&lt;FieldletKind&gt; =&gt; &lt;FieldletValue&gt;}}
+    #  {'80044300905744541' =&gt; {'4589dcc19104b5ad' =&gt; 'Merb'}}
+    #  {'80044300905278446' =&gt; {'2a1f35b7547e73a7' =&gt; {x: 12, y: 34}}}
+    #
+    def update_instances!(instances_hash)
+      return if !instances_hash
 			
-			instances_hash.each do |instance_id,fieldlets_hash|
-				fieldlets_hash.each do |kind, value|
-					fieldlet = @fieldlets[instance_id.to_i][kind]						
+      instances_hash.each do |instance_id,fieldlets_hash|
+        fieldlets_hash.each do |kind, value|
+          fieldlet = @fieldlets[instance_id.to_i][kind]
 
-					if(!fieldlet) # if there is no such fieldlet, create it
-						field = @instances[instance_id.to_i]
-						raise &quot;BadInstanceIdException&quot;
-						fieldlet = ns()::Fieldlet.get_subclass_by_id(kind).new
+          if(!fieldlet) # if there is no such fieldlet, create it
+            field = @instances[instance_id.to_i]
+            raise &quot;BadInstanceIdException&quot;
+            fieldlet = ns()::Fieldlet.get_subclass_by_id(kind).new
 
-						field.push(fieldlet)
-					end
+            field.push(fieldlet)
+          end
 					
-					# set the fieldlet's value
-					fieldlet.value = value
+          # set the fieldlet's value
+          fieldlet.value = value
 					
-					# fetch and call any callback related to deferred loading of 
-					# entities
+          # fetch and call any callback related to deferred loading of
+          # entities
 					
-					if callback = fieldlet.entity_update_callback
-						callback.call(@entities_to_load)
-					end
-				end
-			end
-		end
+          if callback = fieldlet.entity_update_callback
+            callback.call(@entities_to_load)
+          end
+        end
+      end
+    end
 		
 	
-		##
-	 	# Saves the entity and the fieldlets
-	 	# sets the display value of the entity based on the fieldlets
-		# 
-		# @return [Boolean] true if the entity saved correctly, false if the 
-		# 	validation Failed
-		#
-	 	# ==== Notes
-	 	# * If no fieldets, saves only the entity
-	 	# * If the fieldlets do not validate, don't save and return false
-	 	# * Saves entity and fieldlets in a transaction
-	 	#
-	 	def save_changes
-	 		set_title_value()
-	 		return super if @fields.empty? # if no fieldlets, save the normal way
-	 	  return false if !self.valid?
-	 		self.db.transaction do
-	 			if(@new)
-	 				self.save
-	 			else	
-	 				super #call for the inherited save action - saves the entity
-	 			end
+    ##
+    # Saves the entity and the fieldlets
+    # sets the display value of the entity based on the fieldlets
+    #
+    # @return [Boolean] true if the entity saved correctly, false if the
+    # 	validation Failed
+    #
+    # ==== Notes
+    # * If no fieldets, saves only the entity
+    # * If the fieldlets do not validate, don't save and return false
+    # * Saves entity and fieldlets in a transaction
+    #
+    def save_changes
+      set_title_value()
+      return super if @fields.empty? # if no fieldlets, save the normal way
+      return false if !self.valid?
+      self.db.transaction do
+        if(@new)
+          self.save
+        else
+          super #call for the inherited save action - saves the entity
+        end
 	 			
-	 			@fields.save
-	 		end
-	 		return true
-	 	end
+        @fields.save
+      end
+      return true
+    end
 	 	
-	 	##
-		# Sets the 'title' column on the entity row to the evaluated proc
-		# stored in the TITLE_FORMAT const of the class
-		#
-	 	def set_title_value
-	 		if self.class::TITLE_FORMAT
-	 			self[:title] = self.class::TITLE_FORMAT.call(@fieldlets_by_type) 
-	 		end
-	 	end
+    ##
+    # Sets the 'title' column on the entity row to the evaluated proc
+    # stored in the TITLE_FORMAT const of the class
+    #
+    def set_title_value
+      if self.class::TITLE_FORMAT
+        self[:title] = self.class::TITLE_FORMAT.call(@fieldlets_by_type)
+      end
+    end
 	 	
-	 	##
-	 	# Overides the valid? method of Sequel::Model
-	 	#
-	 	# @return [Boolean] true if the entity is valid
-	 	#
-	 	def valid? 
-	 	  @valid ||= @fields.valid?
- 	  end
+    ##
+    # Overides the valid? method of Sequel::Model
+    #
+    # @return [Boolean] true if the entity is valid
+    #
+    def valid?
+      @valid ||= @fields.valid?
+    end
  	  
- 	  ##
- 	  # Overides the errors method of Sequel::Model
- 	  #
- 	  # @return [Array] of errors
- 	  def errors
- 	    @fields.errors
+    ##
+    # Overides the errors method of Sequel::Model
+    #
+    # @return [Array] of errors
+    def errors
+      @fields.errors
     end
 	 	
 	 	
-	 	##
-		# Generates a random 64bit integer for usage as a primary key for entities
-		#
-		# @return [Fixnum] 64bit random
-		#
-	 	def generate_entity_pk
-	 		s = &quot;&quot;
-	 		8.times{s &lt;&lt; rand(256).to_s(16)}
-	 		@values[:id] = s.to_i(16) # 64 bits random
-	 	end
+    ##
+    # Generates a random 64bit integer for usage as a primary key for entities
+    #
+    # @return [Fixnum] 64bit random
+    #
+    def generate_entity_pk
+      s = &quot;&quot;
+      8.times{s &lt;&lt; rand(256).to_s(16)}
+      @values[:id] = s.to_i(16) # 64 bits random
+    end
 	 	
-	end
+  end
 end
\ No newline at end of file</diff>
      <filename>app/models/app/entity/writing.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,25 +8,25 @@ module App
   # Responsible for creating, updating and deleting instances and their linked instances
   #
   # === Usage
-	class Field
-		include Enumerable	
-		include Namespacing
+  class Field
+    include Enumerable
+    include Namespacing
 		
     attr_accessor :fieldlets
 		
-		##
-		# Constructor
-		#
-		# @param [App::Entity] entity that the field belongs to
-		# @return [App::Field]
-		#
-		# === Notes
-		# * duplicant is for the other side of an optional link. @see Field#duplicant
-		def initialize(entity)
-			@entity = entity
-			@fieldlets = {} 
-			@duplicant = nil
-		end
+    ##
+    # Constructor
+    #
+    # @param [App::Entity] entity that the field belongs to
+    # @return [App::Field]
+    #
+    # === Notes
+    # * duplicant is for the other side of an optional link. @see Field#duplicant
+    def initialize(entity)
+      @entity = entity
+      @fieldlets = {}
+      @duplicant = nil
+    end
 		
     ##
     # Push a given fieldlet to this field instance 
@@ -40,17 +40,17 @@ module App
     # === Notes
     # * If the fieldlet have instance_id, it is set for the field instance's instance_id
     #
-		def push(fieldlet)
-			if (self.class != fieldlet.class::FIELD)
-				raise &quot;FieldletKind mismatch: expected #{self.class} but got #{fieldlet.class::FIELD}&quot; 
-			end
+    def push(fieldlet)
+      if (self.class != fieldlet.class::FIELD)
+        raise &quot;FieldletKind mismatch: expected #{self.class} but got #{fieldlet.class::FIELD}&quot;
+      end
 			
-			# set the instance_id
-			@instance_id ||= fieldlet[:instance_id]
-			@fieldlets[fieldlet.class::IDENTIFIER] = fieldlet
-		end
+      # set the instance_id
+      @instance_id ||= fieldlet[:instance_id]
+      @fieldlets[fieldlet.class::IDENTIFIER] = fieldlet
+    end
 		
-		alias :&lt;&lt; :push
+    alias :&lt;&lt; :push
 		
     ##
     # Each implementation required by the Enumerable mixin
@@ -58,9 +58,9 @@ module App
     # @yield a block for iterating on the filedlets in this instance
     # @yieldparam [App::Fieldlet] the currently iterated fieldlet
     #
-		def each(&amp;block)
-			@fieldlets.values.each(&amp;block)
-		end
+    def each(&amp;block)
+      @fieldlets.values.each(&amp;block)
+    end
     
     ##
     # Returns or sets the 64bit instance_id &quot;random&quot;
@@ -70,147 +70,147 @@ module App
     # === Notes
     # * The left side of the number is the current time, the right side is a random number
     #
-		def instance_id
-			@instance_id ||= ((Time.now.to_f * 1000).to_i &lt;&lt; 16) + rand(1024 * 64)
-		end
+    def instance_id
+      @instance_id ||= ((Time.now.to_f * 1000).to_i &lt;&lt; 16) + rand(1024 * 64)
+    end
 		
-		##
-		# Checks if this instance is empty or all its fieldlets are new
-		#
-		# @return [Boolean] true if there are no fieldlets or that non of the fieldlets is new
-		#
-		def new?
-			@fieldlets.empty? || self.all?{|x| x.new?} 
-		end
+    ##
+    # Checks if this instance is empty or all its fieldlets are new
+    #
+    # @return [Boolean] true if there are no fieldlets or that non of the fieldlets is new
+    #
+    def new?
+      @fieldlets.empty? || self.all?{|x| x.new?}
+    end
 		
-		## 
-		# Checks if all of the fieldlets have value
-		#
-		# @return [Boolean] true if all the fieldlets have no value, false otherwise
-		def null?
-			!self.all?{|x| x.value?}
-		end
+    ##
+    # Checks if all of the fieldlets have value
+    #
+    # @return [Boolean] true if all the fieldlets have no value, false otherwise
+    def null?
+      !self.all?{|x| x.value?}
+    end
 		
-		##
-		# Checks this instance is new and all the fieldlets have no value
-		#
-		# @return [Boolean] true if all the fieldlets have no value and this instance
-		#                   is new. otherwise instead
-		def clean?
-			self.new? &amp;&amp; self.null?
-		end
+    ##
+    # Checks this instance is new and all the fieldlets have no value
+    #
+    # @return [Boolean] true if all the fieldlets have no value and this instance
+    #                   is new. otherwise instead
+    def clean?
+      self.new? &amp;&amp; self.null?
+    end
 		
 		
-		##
-		# Checks if any of the fieldlets is changed
-		#
-		# @return [Boolean] if one or more fieldlets have changed
-		#
-		def changed?
-			self.any?{|f| !f.changed_columns.empty?}
-		end
+    ##
+    # Checks if any of the fieldlets is changed
+    #
+    # @return [Boolean] if one or more fieldlets have changed
+    #
+    def changed?
+      self.any?{|f| !f.changed_columns.empty?}
+    end
 		
-		## 
-		# Sets the instance for removal 
-		#
-		# === Notes
-		# * Instances are removed upon save
-		#
-		def mark_for_removal!
-			@remove = true
-		end
+    ##
+    # Sets the instance for removal
+    #
+    # === Notes
+    # * Instances are removed upon save
+    #
+    def mark_for_removal!
+      @remove = true
+    end
 		
-		##
-		# Checks if the instance is marked for deletion
-		#
-		# @return [Boolean] true if marked for deletion
-		def marked_for_removal?
-		  @remove
-	  end
+    ##
+    # Checks if the instance is marked for deletion
+    #
+    # @return [Boolean] true if marked for deletion
+    def marked_for_removal?
+      @remove
+    end
 		
 		
-		# should we return this field? 
-		# if linked, and have link value =&gt; returned. 
-		# if not linked, always returned
-		def has_return_value?
-			return true if !self.class::DUPLICATION
-			return false if self.link_fieldlet.value.nil?
-			true
-		end
+    # should we return this field?
+    # if linked, and have link value =&gt; returned.
+    # if not linked, always returned
+    def has_return_value?
+      return true if !self.class::DUPLICATION
+      return false if self.link_fieldlet.value.nil?
+      true
+    end
 		
-		##
-		# Return all the fieldlets the instance have, existing and new ones
-		#
-		# @return [Array[App::Fieldlet]] fieldlets of the field instance
-		#
-		# === Notes
-		# * Non exist fieldlets are created
-		#
-		def all_fieldlets
-			self.class::FIELDLET_IDS.collect do |kind_id| 
-				@fieldlets[kind_id] || ns()::Fieldlet.get_subclass_by_id(kind_id).new
-			end
-		end
+    ##
+    # Return all the fieldlets the instance have, existing and new ones
+    #
+    # @return [Array[App::Fieldlet]] fieldlets of the field instance
+    #
+    # === Notes
+    # * Non exist fieldlets are created
+    #
+    def all_fieldlets
+      self.class::FIELDLET_IDS.collect do |kind_id|
+        @fieldlets[kind_id] || ns()::Fieldlet.get_subclass_by_id(kind_id).new
+      end
+    end
 
 		
 		
-		##
-		# Saves the field instance
-		#
-		# @return [Boolean] true if saved, false if not
-		# === Notes
-		# * If the field is marked for removal, it will be removed @see App::Field#destroy
-		# * If the field hasn't change, return false and do nothing
-		# * Handles field duplication before saving the field instance
-		#
-		def save
-			return self.destroy() if @remove 
-			return false if !self.changed? || self.clean? # if new and null, we don't need to save anything	
-			@new = self.new?
-			instance = self.instance_id # prepare the instance id
+    ##
+    # Saves the field instance
+    #
+    # @return [Boolean] true if saved, false if not
+    # === Notes
+    # * If the field is marked for removal, it will be removed @see App::Field#destroy
+    # * If the field hasn't change, return false and do nothing
+    # * Handles field duplication before saving the field instance
+    #
+    def save
+      return self.destroy() if @remove
+      return false if !self.changed? || self.clean? # if new and null, we don't need to save anything
+      @new = self.new?
+      instance = self.instance_id # prepare the instance id
 		
-			save_duplication!
+      save_duplication!
 			
-			self.each do |fieldlet|
-				fieldlet.instance_id = instance if fieldlet.new?
-				# set entity id for the new fieldlets
-				fieldlet.entity_id = @entity[:id]
-				# save the fieldlets
-				fieldlet.save_changes
-			end
-			@new = false
+      self.each do |fieldlet|
+        fieldlet.instance_id = instance if fieldlet.new?
+        # set entity id for the new fieldlets
+        fieldlet.entity_id = @entity[:id]
+        # save the fieldlets
+        fieldlet.save_changes
+      end
+      @new = false
 			
-			return true
-		end
+      return true
+    end
 		
-		##
-		# Set the duplication 
-		#
-		# === Notes
-		# * If the field is not duplicated, return nil
-		# * If the instance is new, call Field#create_duplicates!, else call Field#update_duplicaes!
-		def save_duplication!
-			# duplication
-			if self.class::DUPLICATION
-				@new ? create_duplicates!(@instance_id) : update_duplicates!(@instance_id)
-			end
-		end
+    ##
+    # Set the duplication
+    #
+    # === Notes
+    # * If the field is not duplicated, return nil
+    # * If the instance is new, call Field#create_duplicates!, else call Field#update_duplicaes!
+    def save_duplication!
+      # duplication
+      if self.class::DUPLICATION
+        @new ? create_duplicates!(@instance_id) : update_duplicates!(@instance_id)
+      end
+    end
 		
 		
-		##
-		# Remove the duplicates if the field is duplicated, delete the field instance
-		#
-		#
-		def destroy	
-				destroy_duplicates! if self.class::DUPLICATION
-				ns()::Fieldlet.filter(:entity_id =&gt; @entity[:id], 
-															:instance_id =&gt; self.instance_id).delete
+    ##
+    # Remove the duplicates if the field is duplicated, delete the field instance
+    #
+    #
+    def destroy
+      destroy_duplicates! if self.class::DUPLICATION
+      ns()::Fieldlet.filter(:entity_id =&gt; @entity[:id],
+        :instance_id =&gt; self.instance_id).delete
 				
-				return true
-		end
+      return true
+    end
 
 		
-		# == ClassMethods
+    # == ClassMethods
 	
 		
     ##
@@ -222,46 +222,46 @@ module App
     # @see Field::create_fieldlets_from_fieldlets_hash
     # 
     # @return [App::Field, Array[App::Fieldlet]] field and fieldlets created
-		def self.create_new_with_fieldlets(entity, new_fieldlets_hash)
-			fieldlets = create_fieldlets_from_fieldlets_hash(new_fieldlets_hash)
-			field_class = fieldlets.first.class::FIELD
+    def self.create_new_with_fieldlets(entity, new_fieldlets_hash)
+      fieldlets = create_fieldlets_from_fieldlets_hash(new_fieldlets_hash)
+      field_class = fieldlets.first.class::FIELD
 			
-			# create new field by the field_class
-			field = field_class.new(entity)
+      # create new field by the field_class
+      field = field_class.new(entity)
 			
-			fieldlets.each{|f| field &lt;&lt; f}
-			return field, fieldlets # return fields and fieldlets
-		end
+      fieldlets.each{|f| field &lt;&lt; f}
+      return field, fieldlets # return fields and fieldlets
+    end
 		
-		protected
-		##
-		# Create new fieldlets from the given fieldlets hash
-		#
-		# @param [Hash] new_fieldlets_hash, contains the information for the new fieldlets
-		# 
-		# @return [Array[App::Fieldlet]] the created fieldlets
-		#
-		def self.create_fieldlets_from_fieldlets_hash(new_fieldlets_hash)
-			field_class = nil
-			# initialize the fieldlets	
-			fieldlets = []
-			new_fieldlets_hash.each do |kind,value|
-				fieldlet = ns()::Fieldlet.get_subclass_by_id(kind).new
+    protected
+    ##
+    # Create new fieldlets from the given fieldlets hash
+    #
+    # @param [Hash] new_fieldlets_hash, contains the information for the new fieldlets
+    #
+    # @return [Array[App::Fieldlet]] the created fieldlets
+    #
+    def self.create_fieldlets_from_fieldlets_hash(new_fieldlets_hash)
+      field_class = nil
+      # initialize the fieldlets
+      fieldlets = []
+      new_fieldlets_hash.each do |kind,value|
+        fieldlet = ns()::Fieldlet.get_subclass_by_id(kind).new
 				
-				if field_class &amp;&amp; (field_class != fieldlet.class::FIELD)
-					raise &quot;FieldletKind mismatch: expected #{field_class} but got #{fieldlet.class::FIELD}&quot; 
-				end
+        if field_class &amp;&amp; (field_class != fieldlet.class::FIELD)
+          raise &quot;FieldletKind mismatch: expected #{field_class} but got #{fieldlet.class::FIELD}&quot;
+        end
 				
-				fieldlet.value = value
+        fieldlet.value = value
 				
-				field_class ||= fieldlet.class::FIELD
+        field_class ||= fieldlet.class::FIELD
 	
-				fieldlets &lt;&lt; fieldlet # return the fieldlet
-			end
+        fieldlets &lt;&lt; fieldlet # return the fieldlet
+      end
 			
-			return fieldlets
-		end
+      return fieldlets
+    end
 		
 		
-	end # Field
+  end # Field
 end # App
\ No newline at end of file</diff>
      <filename>app/models/app/field.rb</filename>
    </modified>
    <modified>
      <diff>@@ -60,15 +60,15 @@ module App
   	#   to another instance
   	#
   	def push(fieldlet)
-  		field = @fields[fieldlet.class::FIELD_ID].last
-  		if field &amp;&amp; field.instance_id == fieldlet[:instance_id]
-  			return field &lt;&lt; fieldlet
-  		end 
+      field = @fields[fieldlet.class::FIELD_ID].last
+      if field &amp;&amp; field.instance_id == fieldlet[:instance_id]
+        return field &lt;&lt; fieldlet
+      end
     
-  		field = fieldlet.class::FIELD.new(@entity)
-  		field &lt;&lt; fieldlet
+      field = fieldlet.class::FIELD.new(@entity)
+      field &lt;&lt; fieldlet
     
-  		@fields[fieldlet.class::FIELD_ID] &lt;&lt; field
+      @fields[fieldlet.class::FIELD_ID] &lt;&lt; field
     
       return field
   	end</diff>
      <filename>app/models/app/field_container.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,47 +2,47 @@ require 'namespacing'
 require 'inheritance_mixin'
 
 module App
-	class Fieldlet &lt; Sequel::Model
-		# = Fieldlet
-		#
-		# Fieldlets are the basic building blocks of Nifty
-		# Every fieldlet holds a tiny piece of data, from a different type:
-		# String, Int, Date, Text etc. 
-		#
-		# Fieldlets classes are genereated by the FieldletKind on schema load
-		# 
-		# === Fieldlet kinds
-		# 
-		# The Nifty platform have the ability to use different fieldlet types
-		# and write your own fieldlet types
-		#
-		# fieldlet types are mix-in modules, which are mixed on the generated
-		# fieldlet class on schema load
-		#
-		# Every fieldlet type must implement a set of methods, in order to work
-		# with the Nifty platform.
-		#
-		# For more information, read the WRITING_YOUR_OWN_FIELDLETS_AND_LISTS
-		#
-		# =======
-		
-		
-		set_schema(:fieldlets) do 
-			bigint			:instance_id, :unsigned =&gt; true, 	:null =&gt; false
-			bigint			:kind,			  :unsigned =&gt; true,	:null =&gt; false
-			bigint			:entity_id,   :unsigned =&gt; true, 	:null =&gt; false
-			bigint			:int_value
-			varchar			:string_value
-			text				:text_value
+  class Fieldlet &lt; Sequel::Model
+    # = Fieldlet
+    #
+    # Fieldlets are the basic building blocks of Nifty
+    # Every fieldlet holds a tiny piece of data, from a different type:
+    # String, Int, Date, Text etc.
+    #
+    # Fieldlets classes are genereated by the FieldletKind on schema load
+    #
+    # === Fieldlet kinds
+    #
+    # The Nifty platform have the ability to use different fieldlet types
+    # and write your own fieldlet types
+    #
+    # fieldlet types are mix-in modules, which are mixed on the generated
+    # fieldlet class on schema load
+    #
+    # Every fieldlet type must implement a set of methods, in order to work
+    # with the Nifty platform.
+    #
+    # For more information, read the WRITING_YOUR_OWN_FIELDLETS_AND_LISTS
+    #
+    # =======
+		
+		
+    set_schema(:fieldlets) do
+      bigint			:instance_id, :unsigned =&gt; true, 	:null =&gt; false
+      bigint			:kind,			  :unsigned =&gt; true,	:null =&gt; false
+      bigint			:entity_id,   :unsigned =&gt; true, 	:null =&gt; false
+      bigint			:int_value
+      varchar			:string_value
+      text				:text_value
 			
-			primary_key [:entity_id, :instance_id, :kind]
-		end
+      primary_key [:entity_id, :instance_id, :kind]
+    end
 		
-		set_primary_key :entity_id, :instance_id, :kind
+    set_primary_key :entity_id, :instance_id, :kind
 	
-		# Inheritance Mixin - for smart STI
-		include InheritanceMixin
-		include Namespacing
+    # Inheritance Mixin - for smart STI
+    include InheritanceMixin
+    include Namespacing
 
 
 
@@ -50,180 +50,180 @@ module App
       'required' =&gt; proc{|fieldlet, args| return false if !fieldlet.value? &amp;&amp; args == 'true'; return true}
     }
 
-		# ==== Representations 
-		#
-		# Every fieldlet must provide to_xml &amp; to_json methods
-		# for representing to fieldlet to the client side
-		# 
+    # ==== Representations
+    #
+    # Every fieldlet must provide to_xml &amp; to_json methods
+    # for representing to fieldlet to the client side
+    #
 
 		
-		##
-		# Renders to field in JSON
-		#
-		# @param [*] *args, args to pass to the to_json method
-		#
-		# @return [String] json encoded field instance
-		#
-		# @overrideable
-		def to_json(*args)
-			self.value_to_json.to_json(*args)
-		end
+    ##
+    # Renders to field in JSON
+    #
+    # @param [*] *args, args to pass to the to_json method
+    #
+    # @return [String] json encoded field instance
+    #
+    # @overrideable
+    def to_json(*args)
+      self.value_to_json.to_json(*args)
+    end
 	
-		# XML representation
-		# @overrideable		
-		def to_xml(options = {})
-		  xml = Builder::XmlMarkup.new(:indent =&gt; 2, :margin =&gt; 3)
-			xml.fieldlet({:type =&gt; self.class::IDENTIFIER}) do |xml|
-				xml.tag!(:value,self.value_to_xml, :type =&gt; self.value.class)
-			end
-		end
-		
-		# ==== Value Representations
-		#  
-		# value_to_json &amp; value_to_xml can be overrided to provide extra flexability
-		# for value representation.
-		#
-		
-		
-		# JSON representation
-		# @overrideable
-		def value_to_json
-			self.value()
-		end
-		
-		# XML representation
-		# @overrideable
-		def value_to_xml
-			self.value()
-		end
-		
-		
-		# ==== Value Manipulation
-		# Every fieldlet module must implement the value and value= methods, for
-		# reading and writing values
-		#
-		# Fieldlet have 3 data columns: int_value(integer), string_value(varchar), text_value(text)
-		# each fieldlet can set those columns, for any use
-		#
-		# Example:
-		#
-		# +DateFieldlet+
-		#  def value
-		#   Time.at(self.int_value)
-		#  end
-		#  
-		#  def value=(value&lt;DateTime&gt;)
-		#   int_value = value.to_i
-		#  end
-		#
-		#
+    # XML representation
+    # @overrideable
+    def to_xml(options = {})
+      xml = Builder::XmlMarkup.new(:indent =&gt; 2, :margin =&gt; 3)
+      xml.fieldlet({:type =&gt; self.class::IDENTIFIER}) do |xml|
+        xml.tag!(:value,self.value_to_xml, :type =&gt; self.value.class)
+      end
+    end
+		
+    # ==== Value Representations
+    #
+    # value_to_json &amp; value_to_xml can be overrided to provide extra flexability
+    # for value representation.
+    #
+		
+		
+    # JSON representation
+    # @overrideable
+    def value_to_json
+      self.value()
+    end
+		
+    # XML representation
+    # @overrideable
+    def value_to_xml
+      self.value()
+    end
+		
+		
+    # ==== Value Manipulation
+    # Every fieldlet module must implement the value and value= methods, for
+    # reading and writing values
+    #
+    # Fieldlet have 3 data columns: int_value(integer), string_value(varchar), text_value(text)
+    # each fieldlet can set those columns, for any use
+    #
+    # Example:
+    #
+    # +DateFieldlet+
+    #  def value
+    #   Time.at(self.int_value)
+    #  end
+    #
+    #  def value=(value&lt;DateTime&gt;)
+    #   int_value = value.to_i
+    #  end
+    #
+    #
 
 
-		# returns true if any of the value fields has any value
-		# used for checking if having any value, without using the getter
-		def value?
-			[@values[:string_value],@values[:text_value], @values[:int_value]].any?{|x| !x.nil?}
-		end
+    # returns true if any of the value fields has any value
+    # used for checking if having any value, without using the getter
+    def value?
+      [@values[:string_value],@values[:text_value], @values[:int_value]].any?{|x| !x.nil?}
+    end
 
 
-		# Value Getter
-		# gets the proper value, from the fieldlet row
-		# @overrideable
-		
-		def value
-		end
-		
-		# Value Setter
-		# sets the proper value
-		# @overrideable
-		
-		def value=(input)
-		end
-		
-		
-		# ==== callbacks
-		#
-		#
-		
-		# entity_load_callback
-		# 
-		# calls for each loaded entity, before the loading the entities
-		# 
-		#
-		# returns a proc{|entities_to_load, loaded_fieldlets|}
-		# 
-		# * entities_to_load&lt;Hash&gt;:: from entity_id to array of callbacks, 
-		# which called upon loading of the entity with the entity_id of the key. the callbacks
-		# are from the type proc{|entity|}
-		#
-		# * loaded_fieldlets&lt;Array&gt;:: of fieldlets which have been loaded
-		#
-		
-		def entity_load_callback
-		end
-		
-		# entity_save_callback
-		#
-		# calls for each pending for save fieldlet before it being saved
-		# returns a proc{|entity, pending_for_save|}
-		# 
-		# * entity&lt;Entity&gt;:: The entity of the fieldlet
-		# * pending_for_save&lt;Array&gt;:: Array of the fieldlets that are pending to be saved
-		#
-		
-		def entity_create_callback
-		end
-		
-		
-		def entity_update_callback
-		end
-		
-		
-		def extract_callback(callback_sym, entities_to_load)
-			if callback = self.send(callback_sym)		
-		 		callback.call(entities_to_load) 
-			end
-		end
-		
-		def set_changed_columns(changed_columns)
-			@changed_columns = changed_columns
-		end
-		
-		##
-		# Iterate over the defined validations, and return errors if there are 
-		# any
-		#
-		# @return [Array] list of errors
-		def validate
-		  @errors = []
+    # Value Getter
+    # gets the proper value, from the fieldlet row
+    # @overrideable
+		
+    def value
+    end
+		
+    # Value Setter
+    # sets the proper value
+    # @overrideable
+		
+    def value=(input)
+    end
+		
+		
+    # ==== callbacks
+    #
+    #
+		
+    # entity_load_callback
+    #
+    # calls for each loaded entity, before the loading the entities
+    #
+    #
+    # returns a proc{|entities_to_load, loaded_fieldlets|}
+    #
+    # * entities_to_load&lt;Hash&gt;:: from entity_id to array of callbacks,
+    # which called upon loading of the entity with the entity_id of the key. the callbacks
+    # are from the type proc{|entity|}
+    #
+    # * loaded_fieldlets&lt;Array&gt;:: of fieldlets which have been loaded
+    #
+		
+    def entity_load_callback
+    end
+		
+    # entity_save_callback
+    #
+    # calls for each pending for save fieldlet before it being saved
+    # returns a proc{|entity, pending_for_save|}
+    #
+    # * entity&lt;Entity&gt;:: The entity of the fieldlet
+    # * pending_for_save&lt;Array&gt;:: Array of the fieldlets that are pending to be saved
+    #
+		
+    def entity_create_callback
+    end
+		
+		
+    def entity_update_callback
+    end
+		
+		
+    def extract_callback(callback_sym, entities_to_load)
+      if callback = self.send(callback_sym)
+        callback.call(entities_to_load)
+      end
+    end
+		
+    def set_changed_columns(changed_columns)
+      @changed_columns = changed_columns
+    end
+		
+    ##
+    # Iterate over the defined validations, and return errors if there are
+    # any
+    #
+    # @return [Array] list of errors
+    def validate
+      @errors = []
 		  
-		  self.class::VALIDATIONS.each do |key, args|
-		    validate_value!(key, args)
-		  end
+      self.class::VALIDATIONS.each do |key, args|
+        validate_value!(key, args)
+      end
 		
-		  return @errors
-		end
+      return @errors
+    end
 				
-		protected
+    protected
 		
-		##
-		# Finds the requested validation and run it's proc
-		# with the given args
-		#
-		# @param [String] key, for the validations hash
-		# @param [String, Hash] args, args for the validation proc
-		#
-		def validate_value!(key, args)
-		  validation = self.class.validations[key]
-		  raise &quot;No validation was found for #{key}&quot; if !validation
-		  @errors &lt;&lt; {:key =&gt; key} if !validation.call(args)
-		end
+    ##
+    # Finds the requested validation and run it's proc
+    # with the given args
+    #
+    # @param [String] key, for the validations hash
+    # @param [String, Hash] args, args for the validation proc
+    #
+    def validate_value!(key, args)
+      validation = self.class.validations[key]
+      raise &quot;No validation was found for #{key}&quot; if !validation
+      @errors &lt;&lt; {:key =&gt; key} if !validation.call(args)
+    end
 		
 		
 		
-		def self.validations
-		 @@validations_hash
-		end
+    def self.validations
+      @@validations_hash
+    end
 		
-	end
+  end
 end</diff>
      <filename>app/models/app/fieldlet.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,5 +14,15 @@ module App
       self::VIEW_ITEMS.find{|i| i::TYPE == type &amp;&amp; i::FOR == identifier}
     end
 
+
+
+    ##
+    # An mock for the 
+    #
+    #
+    def self.describe
+      {:name =&gt; self::NAME}
+    end
+
   end
 end
\ No newline at end of file</diff>
      <filename>app/models/app/view.rb</filename>
    </modified>
    <modified>
      <diff>@@ -41,12 +41,13 @@ module VM
       # * IDENTIFIER
       # * PREFS
       # * SCHEMA
+      
       #
       def setup_base_consts!
         @model.const_set('NAME', @element[:name].freeze)
         @model.const_set('IDENTIFIER', @id)
         @model.const_set('PREFS', @prefs)
-        @model.const_set('SCHEMA', (&quot;%016x&quot; % @element[:schema]).freeze)    
+        @model.const_set('SCHEMA', (&quot;%016x&quot; % @element[:schema]).freeze)
       end
 
 
@@ -54,7 +55,7 @@ module VM
       # Properly sets the model inheritance if availiable
       #
       def setup_inheritance!
-        return if !@model.respond_to?(:set_inheritance)
+        return if !@model.respond_to?(:set_inheritance!)
         @model.set_inheritance!
         @model.class_eval do
           # set the STI key to the proper kind</diff>
      <filename>app/models/vm/builders/abstract.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,8 @@ module VM
         :extras =&gt; [
         :set_viewer,
         :register_routing,
-        :set_view_items
+        :set_view_items,
+        :set_namespace
       ]
 
 
@@ -35,7 +36,7 @@ module VM
         base_pref_view_item = @schema.get(@prefs['basePrefs'])
         
         self.set_consts!({
-          'BASE_PREFS' =&gt; base_pref_view_item
+            'BASE_PREFS' =&gt; base_pref_view_item
           })
       end
 
@@ -59,6 +60,10 @@ module VM
             'VIEW_ITEMS_FOR' =&gt; view_items_for
           })
       end
+
+      def set_namespace
+        self.set_consts!({'NAMESPACE' =&gt; @ns})
+      end
      
     end
   end</diff>
      <filename>app/models/vm/builders/view.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,7 +156,7 @@ module VM
 		
     # load all the active schemas
     def self.load!
-      self.filter(:active =&gt; true).each do |schema|
+      self.filter(:active =&gt; true).all do |schema|
         schema.load!
       end
     end</diff>
      <filename>app/models/vm/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -31,10 +31,11 @@
 	
 	&lt;%= javascript_include( '../ext/ext-base',
 						    '../ext/ext-all',
-							'boot_loader',
-							'router',
-							'widgets/main_pane',
-							'widgets/page'
+							'BootLoader',
+                            'data/View',
+							'Router',
+							'widgets/MainPane',
+							'widgets/Page'
 							)%&gt;
 &lt;/body&gt;
 &lt;/html&gt;</diff>
      <filename>app/views/viewers/extjs.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 # dependencies are generated using a strict version, don't forget to edit the dependency versions when upgrading.
-merb_gems_version = &quot;1.0.6.1&quot;
+merb_gems_version = &quot;1.0.8.1&quot;
+sequel_gem_version = &quot;2.10.0&quot;
 
 # For more information about each component, please read http://wiki.merbivore.com/faqs/merb_components
 #dependency &quot;merb-action-args&quot;, merb_gems_version
@@ -7,9 +8,12 @@ dependency &quot;merb-assets&quot;, merb_gems_version
 dependency &quot;merb-cache&quot;, merb_gems_version
 dependency &quot;merb-helpers&quot;, merb_gems_version 
 dependency &quot;merb-mailer&quot;, merb_gems_version  
-dependency &quot;merb-slices&quot;, merb_gems_version  
+dependency &quot;merb-slices&quot;, merb_gems_version
+
 #dependency &quot;merb-auth-core&quot;, merb_gems_version
 #dependency &quot;merb-auth-more&quot;, merb_gems_version
 #dependency &quot;merb-auth-slice-password&quot;, merb_gems_version
 dependency &quot;merb-exceptions&quot;, merb_gems_version
- 
\ No newline at end of file
+
+# sequel
+dependency &quot;sequel&quot;, sequel_gem_version
\ No newline at end of file</diff>
      <filename>config/dependencies.rb</filename>
    </modified>
    <modified>
      <diff>@@ -20,18 +20,18 @@
 # See merb/specs/merb/router.rb for a fairly complete usage sample.
 
 module RoutingHelper
-	def self.nifty_routes(r)
-		r.resources('entities', 
-								:controller =&gt; 'app/entities', 
-								:collection =&gt; {:search =&gt; :get}) do |e|
-			e.resources 'lists', :controller =&gt; 'app/lists'
-		end
+  def self.nifty_routes(r)
+    r.resources('entities',
+      :controller =&gt; 'app/entities',
+      :collection =&gt; {:search =&gt; :get}) do |e|
+      e.resources 'lists', :controller =&gt; 'app/lists'
+    end
 
-		r.resources 'lists', :controller =&gt; 'app/lists'
-		r.match('/schema.:format').to(:controller =&gt; 'app/schemas', :action =&gt; 'show')
-		r.match('').to(:controller =&gt; 'app/views', :action =&gt;'index')
-		r.match('/').to(:controller =&gt; 'app/views', :action =&gt;'index')
-	end	
+    r.resources 'lists', :controller =&gt; 'app/lists'
+    r.match('/describe(.:format)').to(:controller =&gt; 'app/views', :action =&gt; 'describe')
+    r.match('').to(:controller =&gt; 'app/views', :action =&gt;'index')
+    r.match('/').to(:controller =&gt; 'app/views', :action =&gt;'index')
+  end
 end
 
 
@@ -46,11 +46,11 @@ Merb::Router.prepare do |r|
   
   # Change this for your home page to be available at /
 
-	r.match(&quot;/:directory&quot;) do |dr|
-		RoutingHelper::nifty_routes(dr)
-	end
+  r.match(&quot;/:directory&quot;) do |dr|
+    RoutingHelper::nifty_routes(dr)
+  end
 
-	RoutingHelper::nifty_routes(r)
+  RoutingHelper::nifty_routes(r)
 	
-	r.match('/').to(:controller =&gt; 'app/views', :action =&gt;'index')
+  r.match('/').to(:controller =&gt; 'app/views', :action =&gt;'index')
 end
\ No newline at end of file</diff>
      <filename>config/router.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,8 @@ module InheritanceMixin
 		def set_inheritance!
 			id = self::IDENTIFIER.to_i(16)
 			superclass_dataset = self.superclass.dataset
-			
+
+            
 			# add to our dataset models hash
 			models = superclass_dataset.opts[:models].update(id =&gt; self)
 			</diff>
      <filename>lib/inheritance_mixin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -62,7 +62,7 @@ DIV.x-nifty-pane-footer{
 	padding:10px;
 	background: url(/viewers/extjs/images/pane/footer.png) repeat-x top right;
 	border:1px solid #EEEEEE;
-	font-size:12px;
+	font-size:11px;
 	color: #555555;
 }
 </diff>
      <filename>public/viewers/extjs/stylesheets/nifty-pane.css</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>public/viewers/extjs/javascripts/boot_loader.js</filename>
    </removed>
    <removed>
      <filename>public/viewers/extjs/javascripts/router.js</filename>
    </removed>
    <removed>
      <filename>public/viewers/extjs/javascripts/widgets/main_pane.js</filename>
    </removed>
    <removed>
      <filename>public/viewers/extjs/javascripts/widgets/page.js</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>83d2dce8b9511bdc37c37ac7f6e4d2028eafb9f5</id>
    </parent>
  </parents>
  <author>
    <name>Shlomi Atar</name>
    <email>shlomiatar@gmail.com</email>
  </author>
  <url>http://github.com/shlomiatar/nifty-vm/commit/01823abd54b8752e30ebecd75391000874ce4348</url>
  <id>01823abd54b8752e30ebecd75391000874ce4348</id>
  <committed-date>2009-02-04T11:36:07-08:00</committed-date>
  <authored-date>2009-02-04T11:36:07-08:00</authored-date>
  <message>Many improvements to the client</message>
  <tree>631d1c6c27087b25d2af7c8b9c3f5e1c6ed108e7</tree>
  <committer>
    <name>Shlomi Atar</name>
    <email>shlomiatar@gmail.com</email>
  </committer>
</commit>
