<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>config/dependencies.rb</filename>
    </added>
    <added>
      <filename>merb/merb-auth/setup.rb</filename>
    </added>
    <added>
      <filename>merb/merb-auth/strategies.rb</filename>
    </added>
    <added>
      <filename>merb/session/session.rb</filename>
    </added>
    <added>
      <filename>public/images/icons/flag_blue.png</filename>
    </added>
    <added>
      <filename>public/images/icons/flag_red.png</filename>
    </added>
    <added>
      <filename>public/images/icons/star.png</filename>
    </added>
    <added>
      <filename>public/images/icons/tag.png</filename>
    </added>
    <added>
      <filename>public/images/pane/base.png</filename>
    </added>
    <added>
      <filename>public/images/pane/bottom.png</filename>
    </added>
    <added>
      <filename>public/images/pane/footer.png</filename>
    </added>
    <added>
      <filename>public/images/pane/topright.png</filename>
    </added>
    <added>
      <filename>public/javascripts/nifty/widgets/main_pane.js</filename>
    </added>
    <added>
      <filename>public/stylesheets/nifty/nifty-pane.css</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -37,3 +37,14 @@ task :default =&gt; 'spec'
 # ADD YOUR CUSTOM TASKS IN /lib/tasks
 # NAME YOUR RAKE FILES file_name.rake
 ##############################################################################
+
+desc &quot;Init the schema &quot;
+task :init_schema  =&gt; :merb_env do
+  [VM::Schema,
+   VM::SchemaElement,
+   App::Entity, 
+   App::Fileldet].each{|m| m.create_table!}  
+end
+
+
+</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -35,8 +35,7 @@ module App
     
     def validate_vars!(vars)
     end
-    
-    
+
     ##
     # order a given params hash as an array of parameters to send
     # to the constructor of the action</diff>
      <filename>app/models/app/action.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ module App
   # 
   # Get an instance from a given entity using an instance_id
   #
-  class ActionEachInstance &lt; Action
+  class ActionGetInstance &lt; Action
     register 'get_instance'
     
     ASYNC = false</diff>
      <filename>app/models/app/actions/get_instance.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ module App
   # 
   # Create new instance in the given entity and field_id
   #
-  class ActionEachInstance &lt; Action
+  class ActionNewInstance &lt; Action
     register 'new_instance'
     
     ASYNC = false</diff>
      <filename>app/models/app/actions/new_instance.rb</filename>
    </modified>
    <modified>
      <diff>@@ -120,6 +120,8 @@ module VM
 		#end
 		
 		
+	
+		
 		def load!
 				self.setup_namespace()
 				self.load_schema_elements()</diff>
      <filename>app/models/vm/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ module VM
 	class SchemaElement &lt; Sequel::Model
 		include PreferencesTools
 		
-		@@element_types = {}
+		@@element_types ||= {}
 		
 		set_schema do
 			bigint  :schema, :unsigned =&gt; true, :null =&gt; false			
@@ -52,6 +52,8 @@ module VM
 		
 		def schema_element_type
 			@schema_element_type ||= SchemaElement.element_types[@values[:type].to_sym]
+			raise &quot;No schema element type :#{@values[:type]}&quot; if !@schema_element_type
+			return @schema_element_type
 		end
 		
 		def has_model?</diff>
      <filename>app/models/vm/schema_element.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,7 @@
 											'nifty/widgets/nifty_field_instance.css',
 											'nifty/widgets/nifty_fieldlet.css',
 											'nifty/widgets/string_fieldlet.css',
+											'nifty/nifty-pane.css',
 											:bundle =&gt; 'nifty'
 											
 	 %&gt;
@@ -38,34 +39,14 @@
 	&lt;/div&gt;	
 	
 	&lt;%= js_include_tag('../ext/ext-base', &quot;../ext/ext-all.js&quot;, :bundle =&gt; 'ext') %&gt;
-  &lt;%= js_include_tag(&quot;../viewer/#{@namespace::SCHEMA}/info&quot;)%&gt;	
-	&lt;%= js_include_tag	'nifty/core',
+  	&lt;%= js_include_tag(&quot;../viewer/#{@namespace::SCHEMA}/info&quot;)%&gt;	
+	&lt;%= js_include_tag	'nifty/boot_loader',
 						'nifty/router',
-						'nifty/schema',
-						'nifty/core/entity_crud',
-						'nifty/data/entity_store',
-						'nifty/data/search',
-						'nifty/data/simple_reader',
-						'nifty/data/field_store',
-						'nifty/data/entity_store_proxy',
-						'nifty/widgets/form_group',											
-						'nifty/widgets/info_bar',
-						'nifty/widgets/nifty_main_panel',
-						'nifty/widgets/nifty_side_panel',
-						'nifty/widgets/entity_panel',
-						'nifty/widgets/field_editor',
-						'nifty/widgets/field',
-						'nifty/layouts/field_editor_layout',
+						'nifty/data/schema',
+						'nifty/schema_loader',
+						'nifty/widgets/main_pane',
 						'nifty/widgets/page',
-						'nifty/widgets/entity_page',
-						'nifty/widgets/fieldlet',
-						'nifty/fieldlets/string_fieldlet',										
-						'nifty/fieldlets/link_fieldlet',
-						'nifty/fieldlets/text_fieldlet',
-						'nifty/widgets/new_entity_button',
-						'nifty/entity_loader',
-						'nifty/init',
-									  :bundle =&gt; 'nifty' %&gt;
+	 					:bundle =&gt; 'nifty' %&gt;
 
 &lt;/body&gt;
 &lt;/html&gt;</diff>
      <filename>app/views/layout/app.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,9 @@ Merb::Config.use { |c|
 	c[:auto_load_schema] = true
 	c[:auto_generate_js] = true
 	
+	c[:log_stream] = STDOUT
+  c[:log_file]   = nil
+  
 	c[:nifty_q] = {
 		:provider =&gt; :sequel,
 		:provider_options =&gt; {},</diff>
      <filename>config/environments/development.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,5 @@
-#
-# ==== Structure of Merb initializer
-#
-# 1. Load paths.
-# 2. Dependencies configuration.
-# 3. Libraries (ORM, testing tool, etc) you use.
-# 4. Application-specific configuration.
+require 'config/dependencies.rb'
 
-#
-# ==== Set up load paths
-#
 
 # Add the app's &quot;gems&quot; directory to the gem load path.
 Gem.clear_paths</diff>
      <filename>config/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -81,7 +81,7 @@ Nifty.BootLoader.prototype = {
 	 *
 	 * @param {Nifty.data.Schema} loaded_schema The loaded Schema
    */
-	finishSchemaLoading: function(loaded_schema){
+	finishSchemaLoading: function(loader,loaded_schema){
 		// Sets the current schema
 		this.schema = loaded_schema;
 		
@@ -107,7 +107,7 @@ Nifty.BootLoader.prototype = {
    * Sets the application title according to the loaded schema
    */
 	setApplicationTitle: function(){
-		Ext.fly('app-name').update(this.schema.loaded['name']);
+		Ext.fly('app-name').update(this.schema.name);
 	},
 	
 	/**
@@ -116,7 +116,17 @@ Nifty.BootLoader.prototype = {
 	setExtBaseOptions: function(){
 		// reference local blank image
 		Ext.BLANK_IMAGE_URL = '/ext/resources/images/default/s.gif';
-		
+		//init qtips
+    Ext.QuickTips.init();
+	},
+	
+	/**
+	 * Loads the page with the given id
+	 *
+	 * @param {String} id the page id to load 
+	 */ 
+	loadPage: function(id){
+		    new Nifty.widgets.page(Nifty.viewerInfo.pages[id]);
 	}
 };
  </diff>
      <filename>public/javascripts/nifty/boot_loader.js</filename>
    </modified>
    <modified>
      <diff>@@ -99,7 +99,7 @@ Nifty.data.Schema.prototype = {
 	 * 
 	 * @return {Object} constructor for the given element
 	 */ 
-	createConstructor: function(element) {
+	createConstructor: function(element){
 		if(element['type'] === 'fieldlet'){return;} //pass if fieldlet
 		
 		var constructor = Nifty.widgets[element['type']];
@@ -116,5 +116,5 @@ Nifty.data.Schema.prototype = {
 		
 		// call on dependent siblings
 		return klass;
-	};
+	}
 };</diff>
      <filename>public/javascripts/nifty/data/schema.js</filename>
    </modified>
    <modified>
      <diff>@@ -65,6 +65,8 @@ Ext.extend(Nifty.Router, Ext.util.Observable, {
 			// default 
 			if (url == null || url == '')
 				url = &quot;#&quot;
+
+			var result = false;
 			
 			// iterate over the routers
 			Ext.each(this.routes, function(route){
@@ -82,7 +84,8 @@ Ext.extend(Nifty.Router, Ext.util.Observable, {
 					return; 
 				}				
 			},this);
-			
+
+			if(result){return}; // if we found a route, exit
 			// if no route was found
 			this.routingError(url);
 		},
@@ -101,17 +104,17 @@ Ext.extend(Nifty.Router, Ext.util.Observable, {
 		 * Check if the current page can be left, and if the url hasn't change
 		 */ 
 		route: function(){
-			if (current_hash == document.location.hash){ return;};
+			if (this.current_hash == document.location.hash){ return;};
 			
 			// call the beforeLeave handler for the current page
 			if (Nifty.pages.current &amp;&amp; Nifty.pages.current.beforeLeave &amp;&amp; (Nifty.pages.current.beforeLeave() === false))
 			{
-				document.location.hash = current_hash;
+				document.location.hash = this.current_hash;
 				return;
 			}
 				
 
-			current_hash = document.location.hash;
+			this.current_hash = document.location.hash;
 
 			this.routeAndCall(document.location.hash);
 		},
@@ -123,7 +126,7 @@ Ext.extend(Nifty.Router, Ext.util.Observable, {
 		 */ 
 		registerUrlPolling: function(){
 			  this.route();
-			  window.setInterval(this.route.apply(this)), 100);
+			  window.setInterval(this.route.createDelegate(this), 100);
 		},
 		
 		/**
@@ -145,15 +148,15 @@ Ext.extend(Nifty.Router, Ext.util.Observable, {
 			// Setup pages
 			Ext.each(Nifty.viewerInfo.pageAddresses, function(pageAddress){
 				this.add(new RegExp(&quot;#/&quot; + pageAddress), function(){
-					Nifty.pages.fetchAndLoad(pageAddress);
+					Nifty.app.loadPage(pageAddress);
 				});
 			}, this);
 
 			// Setup home page
 			this.add(/#/, function(){
-				Nifty.pages.fetchAndLoad('/');
+				Nifty.app.loadPage('/');
 			});		
-		};
+		}
 		
 		
 }); // End of extending Nifty.router</diff>
      <filename>public/javascripts/nifty/router.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,109 +1,167 @@
-/*
-* Nifty.widgets.page
-*
-* Pages pack side panel and main panel
-* 
-*/
-
-
+/**
+ * @class Nifty.widgets.Page 
+ * @extends Ext.util.Observable
+ * 
+ * The main display element of the nifty app.
+ * &lt;p&gt;Packs two elements: the right side element and the main side element&lt;/p&gt;
+ *
+ *  @constructor
+ */ 
 Nifty.widgets.page = function(options){
 	Ext.apply(this,options, {})
-	
+
 	this.addEvents({
 		'beforeRender': true,
 		'rendered': true,
 		'beforeLeave': true
 	})
-	
+
 	this.init();
-	this.load();
+	this.render();
 }
 
 
 Ext.extend(Nifty.widgets.page, Ext.util.Observable,{
-	mainPanel: null,
-	sidePanel: null,
-	mainComponent: Nifty.widgets.mainPanel,
-	sideComponent: Nifty.widgets.sidePanel,
 	
-	init: function(){},
+	/**
+   * @cfg {Function} mainComponent
+   * The main component to draw 
+   */
+ 	mainComponent: Nifty.widgets.mainPane,
+
+	/**
+   * @cfg {Function} sideComponent
+   * The side component to draw 
+   */
+	sideComponent: Nifty.widgets.sidePane,
+
+  /**
+    * The instance of the mainComponent
+    * @type Ext.Component
+    * @property main
+    */
+
+	/**
+	  * The instance of the sideComponent
+	  * @type Ext.Component
+	  * @property side
+	  */
 	
-	load: function(data){
-		this.beforeLoad(); //before load callback
-		
-		
-		if (this.mainPanel){
-			this.mainPanel = new this.mainComponent(this.mainPanel);
-			this.mainPanel.hidden = true;
-			this.mainPanel.render('main');
+	/**
+	 * @cfg {Object} mainConf
+	 * The main component configuration
+	 */
+	
+	/**
+	 * @cfg {Object} sideConf
+	 * The side component configuration
+	 */
+
+	/**
+	 * Initializer function, called before the load function
+	 * 
+	 * @overidable
+	 */ 
+	init: function(){},
+
+	/**
+	 * Renders the page to the document
+	 * 
+	 */ 
+	render: function(){
+  	//before load callback
+		this.beforeRender();
+
+
+		if (this.mainConf){ // The main panel config
+			this.main = new this.mainComponent(this.mainConf);
+			this.main.hidden = true; // set as hidden
+			this.main.render('main'); // render to DIV#main
 		}
-		
-		if (this.sidePanel){
-			this.sidePanel = new this.sideComponent(this.sidePanel);
-			this.sidePanel.hidden = true;
-			this.sidePanel.render('side');
+
+		if (this.sideConf){ // The side panel config
+			this.side = new this.sideComponent(this.sideConf);
+			this.side.hidden = true; // set as hidden
+			this.side.render('side'); // render to DIV#side
 		}
 		
-		this.afterLoad();
+		// afterRender callback
+		this.afterRender();
 	},
-	
-	beforeLoad: function(){
+
+
+	/**
+	 * A callback which called before  the page is rendered
+	 * 
+	 * &lt;p&gt;This callback shows the loading bar, and clear the current page&lt;/p&gt;
+	 */ 
+	beforeRender: function(){
 		this.showLoading();
 		this.clear();
 	},
-	
-	afterLoad: function(){
+
+	/**
+	 * A callback which called after the page is rendered
+	 * 
+	 * &lt;p&gt;This callback hides the loading bar&lt;/p&gt;
+	 */
+	afterRender: function(){
 		this.hideLoading();
 	},
-	
 
-	// destroy the current content of the page
+
+	/**
+	 * Clears the page from the current loaded page
+	 * 
+	 * &lt;p&gt;Removes the current content of the page, sets the current page&lt;/p&gt;
+	 */
 	clear: function(){
-		if (Nifty.pages.current){
-			var current = Nifty.pages.current;
-			
-			if(current.mainPanel &amp;&amp; current.mainPanel.destroy){ 
-				current.mainPanel.destroy();}
-			
-			if(current.sidePanel &amp;&amp; current.sidePanel.destroy){
-				current.sidePanel.destroy();}
+		if (Nifty.app.currentPage){
+			var current = Nifty.app.currentPage;
+
+			if(current.main &amp;&amp; current.main.destroy){current.main.destroy();}
+			if(current.side &amp;&amp; current.side.destroy){current.side.destroy();}
 		}
-		
-		Nifty.pages.current = this;
+   
+		// Sets the current page
+		Nifty.app.currentPage = this;
 	},
-	
-	
-	
+
+
+	/**
+	 * Hides DIV#main and DIV#side and show the DIV#page_loading
+	 */ 
 	showLoading: function(){
 		Ext.fly('page_loading').setDisplayed(true);
 		Ext.fly('main').setDisplayed(false);
 		Ext.fly('side').setDisplayed(false);
-		
+
 	},
-	
+
+
+	/**
+	 * Hides DIV#page_loading and shows the main and sie panels
+	 */
 	hideLoading: function(){
 		Ext.fly('page_loading').setDisplayed(false);
 
-		if (this.mainPanel){this.mainPanel.show();}
-		if (this.sidePanel){this.sidePanel.show();}
+		if (this.main){this.main.show();}
+		if (this.side){this.side.show();}
 		Ext.fly('main').setDisplayed(true);
 		Ext.fly('side').setDisplayed(true);
 	},
-	
-	
-	// handler that is called before leaving a page. 
-	// if returns false, the routing will not happen, and 
-	// the page will not be left
+
+
+	/**
+	 * This callback is called before the page is left.
+	 * if it return false, the routing will not happen. 
+	 * 
+	 * @return {Boolean} if returned false, will stop the routing 
+	 */ 
 	beforeLeave: function(){
 		return true;
 	}
+	
 });
 
-Nifty.pages = {
-	current: null,
-	fetchAndLoad: function(id){
-		    new Nifty.widgets.page(Nifty.viewerInfo.pages[id]);
-	  	}
-	};
-
 </diff>
      <filename>public/javascripts/nifty/widgets/page.js</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>app/models/vm/schema_elements/step.rb</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/entity_page.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/entity_panel.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/field.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/field_editor.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/fieldlet.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/form_group.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/info_bar.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/new_entity_button.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/nifty_main_panel.js</filename>
    </removed>
    <removed>
      <filename>public/javascripts/nifty/widgets/nifty_side_panel.js</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>0c49cb5b285b3fcf8247eb31c650f32027bccf54</id>
    </parent>
  </parents>
  <author>
    <name>Shlomi Atar</name>
    <email>shlomiatar@gmail.com</email>
  </author>
  <url>http://github.com/shlomiatar/nifty-vm/commit/60106993d64bf85dcb882594bdcbbd43471e1c7f</url>
  <id>60106993d64bf85dcb882594bdcbbd43471e1c7f</id>
  <committed-date>2008-11-02T05:04:10-08:00</committed-date>
  <authored-date>2008-11-02T05:04:10-08:00</authored-date>
  <message>Merb 1.0RC2 competability
Progress on the client side</message>
  <tree>8053be982f0bb0594d222c10a70bde06388ad893</tree>
  <committer>
    <name>Shlomi Atar</name>
    <email>shlomiatar@gmail.com</email>
  </committer>
</commit>
