Author: Leon.van.der.Ree
Date: 2010-04-16 00:26:29 +0200 (Fri, 16 Apr 2010)
New Revision: 29169

Added:
   plugins/sfGridExtjsPlugin/trunk/
   plugins/sfGridExtjsPlugin/trunk/lib/
   plugins/sfGridExtjsPlugin/trunk/lib/action/
   plugins/sfGridExtjsPlugin/trunk/lib/action/sfGridExtjsActions.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/dataSourcePager/
   
plugins/sfGridExtjsPlugin/trunk/lib/dataSourcePager/sfDataSourcePagerExtjs3.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/grid/
   plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/
   
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3.class.php
   
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3Row.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/grid/sfGridExtjs3.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/routing/
   plugins/sfGridExtjsPlugin/trunk/lib/routing/sfGridExtjsRoute.php
   plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/
   plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sfExtjs3sx.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxColumnModel.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxGridPanel.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxStore.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarPaging.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarTop.class.php
   plugins/sfGridExtjsPlugin/trunk/lib/widget/
   plugins/sfGridExtjsPlugin/trunk/lib/widget/sfWidgetExtjs3.class.php
   plugins/sfGridExtjsPlugin/trunk/modules/
   plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/
   plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/actions/
   plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/actions/actions.class.php
   plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/templates/
   plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/templates/indexSuccess.php
Log:
initial commit sfGridExtjsPlugin

Added: plugins/sfGridExtjsPlugin/trunk/lib/action/sfGridExtjsActions.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/action/sfGridExtjsActions.class.php     
                        (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/action/sfGridExtjsActions.class.php     
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * extjsGrid actions.
+ *
+ * @package    symfony
+ * @subpackage sfGridExtjsPlugin
+ * @author     Leon van der Ree
+ * @version    SVN: $Id:  $
+ */
+class sfGridExtjsActions extends sfActions
+{
+  
+  /**
+   * @see sfActions
+   */
+  public function execute($request)
+  {
+    $this->grid = $this->getRoute()->getObject(); // getGrid()
+
+    $response = $this->getResponse();
+    if ($request->getRequestFormat() == 'json')
+    {
+      sfConfig::set('sf_web_debug', false);
+      $response->setContentType('application/json');
+      return $this->renderText($this->grid->renderData());
+    }
+    elseif ($request->getRequestFormat() == 'js')
+    {
+      sfConfig::set('sf_web_debug', false);
+      $response->setContentType('text/javascript');
+      return $this->renderText($this->grid->renderJavaScript());
+    }
+    
+    // if html include javascript as well
+    
$response->addJavascript($this->getController()->genUrl($this->grid->getUri()."?sf_format=js")
 );
+    return parent::execute($request);
+  }
+}

Added: 
plugins/sfGridExtjsPlugin/trunk/lib/dataSourcePager/sfDataSourcePagerExtjs3.class.php
===================================================================
--- 
plugins/sfGridExtjsPlugin/trunk/lib/dataSourcePager/sfDataSourcePagerExtjs3.class.php
                               (rev 0)
+++ 
plugins/sfGridExtjsPlugin/trunk/lib/dataSourcePager/sfDataSourcePagerExtjs3.class.php
       2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,427 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) Leon van der Ree <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+// This is a realy lazy pager, that paginates without pages (only uses start 
and limit to return a subset of the datasource)
+
+/**
+ *
+ * @package    symfony
+ * @subpackage grid-extjs3
+ * @author     Leon van der Ree <[email protected]>
+ * @version    SVN: $Id$
+ */
+class sfDataSourcePagerExtjs3 //implements Iterator
+{
+  const DEFAULT_MAX_ITEMS_PER_PAGE = 10;
+
+  protected
+    $source      = null,
+    $maxPerPage  = 0,
+    $start       = 0;
+
+  /**
+   * Constructor.
+   *
+   * The given data source will be cloned internally because it needs to be
+   * modified.
+   *
+   * @param  sfDataSourceInterface $source      The data source for the pager
+   * @param  integer               $maxPerPage  The maximum number of rows per
+   *                                            page. Default: 10
+   *
+   * @see setMaxPerPage()
+   */
+  public function __construct(sfDataSourceInterface $source, $maxPerPage = 
self::DEFAULT_MAX_ITEMS_PER_PAGE)
+  {
+    $this->source = clone $source;
+
+    $this->setMaxPerPage($maxPerPage);
+  }
+
+  /**
+   * Adjusts the maximum number of rows per page.
+   *
+   * @param  integer $amount  The maximum number of rows per page. If set to 0
+   *                          (=no limit), all rows will be rendered on one 
page.
+   * @throws DomainException  Throws an exception if the given amount is 
smaller
+   *                          than zero
+   */
+  public function setMaxPerPage($amount)
+  {
+    if ($amount < 0)
+    {
+      throw new DomainException(sprintf('The maximum amount of records per 
page (%s) must be 0 or greater', $amount));
+    }
+
+    if (isset($this->page))
+    {
+      throw new Exception('You should call setMaxPerPage directly after the 
construction of the page object,
+                           or at least before setting the current page');
+    }
+
+    $this->maxPerPage = $amount;
+    $this->source->setLimit($amount);
+  }
+
+  /**
+   * Returns the maximum number of rows per page given to the constructor or
+   * set with setMaxPerPage().
+   *
+   * @return integer The maximum number of rows per page
+   */
+  public function getMaxPerPage()
+  {
+    return $this->maxPerPage;
+  }
+
+  /**
+   * Returns the data source of the pager. You can iterate over this data
+   * source to access the records of the current page.
+   *
+   * @return sfDataSourceInterface
+   */
+  public function getDataSource()
+  {
+    return $this->source;
+  }
+
+//  /**
+//   * Returns total the number of pages. This method will always return 1 if
+//   * maximum number of rows per page is set to 0 (=no limit).
+//   *
+//   * @return integer The number of pages
+//   */
+//  public function getPageCount()
+//  {
+//    // cache the page count since countAll() might use resources on every 
call
+//    if ($this->getMaxPerPage() > 0
+//        &&
+//        $this->getRecordCount() > 0)
+//    {
+//      return (int)ceil($this->getRecordCount() / 
(float)$this->getMaxPerPage());
+//    }
+//    else
+//    {
+//      return 1;
+//    }
+//  }
+
+  /**
+   * Returns the total number of records in the data source.
+   *
+   * @return integer The number of records
+   */
+  public function getRecordCount()
+  {
+    return $this->source->countAll();
+  }
+
+//  /**
+//   * Returns whether the pager needs to paginate, i.e., whether the data 
source
+//   * spans over more than one page.
+//   *
+//   * @return boolean Whether pagination is required
+//   */
+//  public function hasToPaginate()
+//  {
+//    return $this->getPageCount() > 1;
+//  }
+//  /*
+//   * same as hasToPaginate, but Symfony sfPager has defined haveToPaginate()
+//   * TODO: maybe remove hasToPaginate...
+//   *
+//    @return boolean Whether pagination is required
+//   */
+//  public function haveToPaginate()
+//  {
+//    return $this->hasToPaginate();
+//  }
+
+
+//  /**
+//   * Sets the current page of the pager. The offset and limit values of the
+//   * underlying data source will be adjusted accordingly.
+//   *
+//   * If the given value is smaller than 1, the page will be set to the first
+//   * page. If the given value is greater than the number of pages, the page 
will
+//   * be set to the last page.
+//   *
+//   * @param integer $page The current page. The first page has index 1
+//   */
+//  public function setPage($page)
+//  {
+//    $this->page = $page;
+//  }
+
+  public function setStart($start)
+  {
+    $this->start = $start;
+  }
+
+  public function getStart()
+  {
+    return $this->start;
+  }
+
+//  /**
+//   * Returns the current page set with setPage(). If no page has been set, 
this
+//   * method returns 1.
+//   *
+//   * @return integer The current page. The first page has index 1
+//   */
+//  public function getPage()
+//  {
+//    if (!isset($this->page))
+//    {
+//      $this->page = 1;
+//    }
+//    else
+//    {
+//      if ($this->page > $this->getPageCount())
+//      {
+//        $this->page = $this->getPageCount();
+//      }
+//
+//      if ($this->page < 1)
+//      {
+//        $this->page = 1;
+//      }
+//    }
+//
+//    return $this->page;
+//  }
+
+  /**
+   * Returns the index of the first record on the current page. The first
+   * record on the first page has index 0. This in contradiction to pages,
+   * that are based on index 1
+   *
+   * @return integer The index of the first record on the current page
+   */
+  public function getFirstIndex()
+  {
+    return $this->getStart();
+  }
+
+  /**
+   * Returns the index of the last record on the current page. The first
+   * record on the first page has index 1. This in contradiction to pages,
+   * that are based on index 1
+   *
+   * @return integer The index of the last record on the current page
+   */
+  public function getLastIndex()
+  {
+    return min($this->getStart() + $this->getMaxPerPage(), 
$this->getRecordCount())-1;
+  }
+
+//  /**
+//   * Returns the index of the first page. This method returns always 1.
+//   *
+//   * @return integer The index of the first page
+//   */
+//  public function getFirstPage()
+//  {
+//    return 1;
+//  }
+
+//  /**
+//   * Returns the index of the previous page or of the first page, if no
+//   * previous page exists.
+//   *
+//   * @return integer The index of the previous page
+//   */
+//  public function getPreviousPage()
+//  {
+//    return (int)max($this->getPage() - 1, $this->getFirstPage());
+//  }
+//
+//  /**
+//   * Returns the index of the next page or of the last page, if no
+//   * next page exists.
+//   *
+//   * @return integer The index of the next page
+//   */
+//  public function getNextPage()
+//  {
+//    return (int)min($this->getPage() + 1, $this->getLastPage());
+//  }
+//
+//  /**
+//   * Returns the index of the last page. If only one page exists, this index
+//   * is equal to the index of the first page.
+//   *
+//   * @return integer The index of the last page
+//   */
+//  public function getLastPage()
+//  {
+//    return $this->getPageCount();
+//  }
+//
+//  /**
+//   * Returns whether a navigation element pointing to the first page should
+//   * be rendered. This method returns TRUE if the current page is 3 or 
higher.
+//   *
+//   * @return boolean Whether the first page should be linked
+//   */
+//  public function hasFirstPage()
+//  {
+//    return $this->hasPreviousPage() && $this->getPreviousPage() !== 
$this->getFirstPage();
+//  }
+//
+//  /**
+//   * Returns whether a navigation element pointing to the previous page 
should
+//   * be rendered. This method returns TRUE if the current page is 2 or 
higher.
+//   *
+//   * @return boolean Whether the previous page should be linked
+//   */
+//  public function hasPreviousPage()
+//  {
+//    return !$this->isCurrentPage($this->getFirstPage());
+//  }
+//
+//  /**
+//   * Returns whether a navigation element pointing to the next page should
+//   * be rendered. This method returns TRUE if the current page is (last-1) 
or lower.
+//   *
+//   * @return boolean Whether the next page should be linked
+//   */
+//  public function hasNextPage()
+//  {
+//    return !$this->isCurrentPage($this->getLastPage());
+//  }
+//
+//  /**
+//   * Returns whether a navigation element pointing to the last page should
+//   * be rendered. This method returns TRUE if the current page is (last-2) 
or lower.
+//   *
+//   * @return boolean Whether the last page should be linked
+//   */
+//  public function hasLastPage()
+//  {
+//    return $this->hasNextPage() && $this->getNextPage() !== 
$this->getLastPage();
+//  }
+//
+//  /**
+//   * Returns whether the given page is the current page set by setPage()
+//   *
+//   * @param  integer $page  The page to check for
+//   * @return boolean        Whether $page is equal to the current page
+//   */
+//  public function isCurrentPage($page)
+//  {
+//    return $this->getPage() == $page;
+//  }
+//
+//  /**
+//   * Sets the maximum number of pages processed by the iterator. This method
+//   * is very effective to limit the number of linked pages in the navigation.
+//   *
+//   * You can set the limit to 0 (=no limit) to disable the page limit.
+//   *
+//   * @param integer $limit The maximum number of iterated pages
+//   */
+//  public function setPageLimit($limit)
+//  {
+//    if ($limit < 0)
+//    {
+//      throw new DomainException(sprintf('The page limit (%s) must be 0 or 
greater', $limit));
+//    }
+//
+//    $this->pageLimit = $limit;
+//  }
+//
+//  /**
+//   * Returns the page limit set with setPageLimit(). If no page limit has 
been
+//   * set, this method returns 0 (=no limit).
+//   *
+//   * @return integer The maximum number of iterated pages
+//   */
+//  public function getPageLimit()
+//  {
+//    return $this->pageLimit;
+//  }
+
+//  /**
+//   * Returns the page currently processed by the iterator. The index of the
+//   * first processed page depends on the current page set with setPage() and
+//   * on the limit of visible pages set with setPageLimit(). If no limit is 
set,
+//   * the first page will always be page 1.
+//   *
+//   * @return integer The index of the current page
+//   */
+//  public function current()
+//  {
+//    return $this->pages[$this->cursor];
+//  }
+//
+//  /**
+//   * Advances the iterator to the next page.
+//   */
+//  public function next()
+//  {
+//    ++$this->cursor;
+//  }
+//
+//  /**
+//   * Returns the cursor of the iterator. While page values depend on the
+//   * current page set with setPage() and on the page limit set with 
setPageLimit(),
+//   * the cursor of the first processed page will always be 0.
+//   *
+//   * @return integer The cursor of the iterator
+//   */
+//  public function key()
+//  {
+//    return $this->cursor;
+//  }
+//
+//  /**
+//   * Returns whether the cursor of the iterator still points on a valid page.
+//   *
+//   * @return boolean Whether the cursor is valid
+//   */
+//  public function valid()
+//  {
+//    return $this->cursor < count($this->pages);
+//  }
+//
+//  /**
+//   * Resets the cursor of the iterator to the first page that should be
+//   * displayed. The index of this page depends on the current page set with
+//   * setPage() and on the page limit set with setPageLimit(). If no limit is
+//   * set, the first page will always be page 1.
+//   */
+//  public function rewind()
+//  {
+//    $this->cursor = 0;
+//
+//    if ($this->getPageLimit() != 0)
+//    {
+//      $offset = $this->getPage() - (int)floor($this->getPageLimit()/2);
+//
+//      // we don't want page numbers < 1
+//      if ($offset < 1)
+//      {
+//        $offset = 1;
+//      }
+//      // we don't want page numbers > total page count
+//      if ($offset+$this->getPageLimit() > $this->getPageCount())
+//      {
+//        $offset = $this->getPageCount() - $this->getPageLimit() + 1;
+//      }
+//
+//      $this->pages = range($offset, $offset + $this->getPageLimit() - 1);
+//    }
+//    else
+//    {
+//      $this->pages = range(1, $this->getPageCount());
+//    }
+//  }
+}
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/dataSourcePager/sfDataSourcePagerExtjs3.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3.class.php
===================================================================
--- 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3.class.php
                          (rev 0)
+++ 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3.class.php
  2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,170 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * Leon van der Ree <[email protected]> 
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+class sfGridFormatterExtjs3 extends sfGridFormatterDynamic
+{
+  /**
+   * @var sxStore 
+   */
+  protected $sxStore; 
+  
+  /**
+   * @var sxColumnModel  
+   */
+  protected $sxColumnModel; 
+  
+  /**
+   * @var sxToolbarTop 
+   */
+  protected $sxToolbarTop;
+  
+  /**
+   * @var sxToolbarPaging  
+   */
+  protected $sxToolbarPaging;
+  
+  /**
+   * 
+   * @param sfGridExtjs3 $grid
+   */
+  public function __construct(sfGridExtjs3 $grid)
+  {
+    // grid setup
+    $this->grid = $grid;
+    $this->row = new sfGridFormatterExtjs3Row($grid, 0);
+  }
+  
+  /**
+   * Returns an array of columns, containing Json-arrays with parameters
+   *
+   * @return array
+   */
+  public function getDataStoreFields()
+  {
+    $columnConfig = array();
+    
+    foreach ($this->grid->getWidgets() as $column => $widget)
+    {
+      $columnConfig[] = new sfExtjs3Json($widget->getDSFieldConfig($column));
+    }
+    
+    return $columnConfig;
+  }
+  
+  public function getTitle()
+  {
+    return $this->title;
+  }
+
+  /**
+   * Returns an array of columns, containing Json-arrays with parameters
+   *
+   * @return array
+   */
+  public function getColumnModelConfig()
+  {
+    $columnModelConfig = array();
+    
+    foreach ($this->grid->getWidgets() as $column => $widget)
+    {
+      $columnConfig = $widget->getColumnConfig($column);
+      $columnConfig['header'] = 
'"'.$this->grid->getTitleForColumn($column).'"';
+      $columnModelConfig[] = new sfExtjs3Json($columnConfig);
+    }
+    
+    return $columnModelConfig;
+  }  
+  
+  /**
+   * Renders the table in ExtJS
+   *
+   * @return string
+   */
+  public function render()
+  {
+    $controller = sfContext::getInstance()->getController();
+    
+    // lazy extjs setup
+    $this->sxStore          = new sxStore('List'.$this->grid->getName(), 
$this->getDataStoreFields(), 
$controller->genUrl($this->grid->getUri()."?sf_format=json"));
+    $this->sxColumnModel    = new sxColumnModel('List'.$this->grid->getName(), 
$this->getColumnModelConfig());
+//    $this->sxToolbarTop     = new 
sxToolbarTop('List'.$this->grid->getName());
+//    $this->sxToolbarPaging  = new 
sxToolbarPaging('List'.$this->grid->getName());
+    
+    
+    $code = array(
+              $this->renderNamespace(),
+              $this->renderDataStore(),
+              $this->renderColumnModel(),
+//              $this->renderToolbarTop(),
+//              $this->renderToolbarPaging(),
+              $this->renderGridPanel(),
+            );
+            
+    return implode("\n\n", $code);
+  }
+
+  public function renderNamespace()
+  {
+    return "
+      // namespace: Ext.app.sx
+      Ext.namespace('Ext.app.sx');
+    ";
+  }
+  
+  public function renderDataStore()
+  {
+    $js  = $this->sxStore->__toString();
+    $js .= 
$this->sxStore->registerXtypeAs(sfInflector::underscore('List'.$this->grid->getName()));
+
+    return $js;
+  }
+
+  public function renderColumnModel()
+  {
+    $js  = $this->sxColumnModel->__toString();
+    $js .= 
$this->sxColumnModel->registerXtypeAs(sfInflector::underscore('List'.$this->grid->getName()));
+
+    return $js;
+  }
+
+  public function renderToolbarTop()
+  {
+    $js  = $this->sxToolbarTop->__toString();
+    $js .= 
$this->sxToolbarTop->registerXtypeAs(sfInflector::underscore('List'.$this->grid->getName()));
+
+    return $js;
+  }
+  
+  public function renderToolbarPaging()
+  {
+    $js  = $this->sxToolbarPaging->__toString();
+    $js .= 
$this->sxToolbarPaging->registerXtypeAs(sfInflector::underscore('List'.$this->grid->getName()));
+
+    return $js;
+  }
+  
+  public function renderGridPanel()
+  {
+    $sxGridPanel = new sxGridPanel('List'.$this->grid->getName(), 
+                                   $this->sxStore, 
+                                   $this->sxColumnModel, 
+                                   $this->sxToolbarTop, 
+                                   $this->sxToolbarPaging,
+                                   $this->grid->getPager()->getMaxPerPage(),
+                                   '"'.$this->grid->getTitle().'"'
+                                  );
+
+    $js  = $sxGridPanel;
+    $js .= 
$sxGridPanel->registerXtypeAs(sfInflector::underscore('List'.$this->grid->getName()));
+
+    return $js;
+  }
+
+}


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3Row.class.php
===================================================================
--- 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3Row.class.php
                               (rev 0)
+++ 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3Row.class.php
       2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,40 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * Leon van der Ree <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * A formatter that renders a row for ExtJs3
+ *
+ * @package    symfony
+ * @subpackage grid-extjs3
+ * @author     Leon van der Ree <[email protected]>
+ * @version    SVN: $Id$
+ */
+class sfGridFormatterExtjs3Row extends sfGridFormatterDynamicRow
+{
+  /**
+   * Renders a row to html
+   *
+   * @return string
+   */
+  public function render()
+  {
+    $source = $this->grid->getDataSource();
+    $source->seek($this->index);
+    
+    $data = array();
+
+    foreach ($this->grid->getWidgets() as $column => $widget)
+    {
+      $data[$column] = $source[$column];
+    }
+
+    return $data;
+  }
+}
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/grid/formatter/sfGridFormatterExtjs3Row.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/grid/sfGridExtjs3.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/grid/sfGridExtjs3.class.php             
                (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/grid/sfGridExtjs3.class.php     
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,82 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * Leon van der Ree <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ *
+ * @package    symfony
+ * @subpackage grid-extjs3
+ * @author     Leon van der Ree <[email protected]>
+ * @version    SVN: $Id$
+ */
+class sfGridExtjs3 extends sfContextGridJavaScript
+{
+  /**
+   * the name of the ExtJsGrid-components
+   * 
+   * @var string
+   */
+  protected $name;
+  
+  /**
+   * Constructor.
+   *
+   * @param string $name   the name of the ExtJsGrid-components
+   * @param  mixed $source An array or an instance of sfDataSourceInterface 
with
+   *                       data that should be displayed in the grid.
+   *                       If an array is given, the array must conform to the
+   *                       requirements of the constructor of 
sfDataSourceArray.
+   */
+  public function __construct($name, $source)
+  {
+    parent::__construct($source);
+    
+    $this->name = $name;
+  }
+  
+  /**
+   * Configures the grid. This method is called from the constructor. It can
+   * be overridden in child classes to configure the grid.
+   */
+  public function configure()
+  {
+    parent::configure();
+    
+    // get the source from the original pager
+    $source = $this->getPager()->getDataSource();
+    // redefine the pager
+//    $this->pager = new sfDataSourcePagerExtjs3($source);
+
+    // define the javascript formatter
+    $this->setJavaScriptFormatter(new sfGridFormatterExtjs3($this));
+  }
+  
+
+  /**
+   * returns the name of the ExtJsGrid-components
+   * 
+   * @return string
+   */
+  public function getName()
+  {
+    return $this->name;
+  }
+  
+  /**
+   * Returns the default widget
+   *
+   * @return sfWidget
+   */
+  protected function getDefaultWidget()
+  {
+    return new sfWidgetExtjs3();
+  }
+
+
+}
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/grid/sfGridExtjs3.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/routing/sfGridExtjsRoute.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/routing/sfGridExtjsRoute.php            
                (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/routing/sfGridExtjsRoute.php    
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,41 @@
+<?php
+/**
+ * sfGridExtjsRoute represents a route that is bound to an GridExtjs-class.
+ *
+ * A grid route can only represent a single Grid object.
+ *
+ * @package    symfony
+ * @subpackage routing
+ * @author     Leon van der Ree
+ * @version    SVN: $Id:  $
+ */
+class sfGridExtjsRoute extends sfGridRoute
+{
+  public function __construct($pattern, array $defaults = array(), array 
$requirements = array(), array $options = array())
+  {
+    if (strpos($pattern,':sf_format') === false)
+    {
+      $pattern .= '.:sf_format';
+    }
+    
+    $defaults = array_merge(
+      array(
+        'module' => 'extjsGrid', 
+        'action' => 'index', 
+        'sf_format' => 'html',
+      ),
+      $defaults
+    ); 
+    
+    if (!isset($requirements['sf_method']))
+    {
+      $requirements['sf_method'] = array('get', 'head', 'post');
+    }
+    else
+    {
+      $requirements['sf_method'] = array_map('strtolower', (array) 
$requirements['sf_method']);
+    }
+    
+    parent::__construct($pattern, $defaults, $requirements, $options);
+  }
+}
\ No newline at end of file

Added: plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sfExtjs3sx.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sfExtjs3sx.class.php         
                (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sfExtjs3sx.class.php 
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * sfExtjs3sx
+ *
+ * Instances of this class can render themself as JavaScript (definitions and 
instances)
+ *
+ */
+class sfExtjs3sx extends sfExtjs3Object
+{
+  const EXT_NAMESPACE = 'Ext.app.sx';
+
+       /**
+        * Creates a new JsObject
+        *
+        * @param string $objectName the name of the new class to be created 
(is preceded with namespace Ext.app.sx.
+        * @param string $baseObject the base object which this new class 
should extend
+        * @param array $functions   an associative array of function-names and 
the sfExtjs3Function itself
+        */
+       public function __construct($objectName, $baseObject, $functions = 
array())
+       {
+         $objectName = self::EXT_NAMESPACE.'.'.$objectName;
+
+         parent::__construct($objectName, $baseObject, $functions);
+       }
+
+}
+
+?>
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sfExtjs3sx.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxColumnModel.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxColumnModel.class.php      
                        (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxColumnModel.class.php      
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,50 @@
+<?php
+/**
+ * sxColumnModel
+ *
+ * Instances of this class can render themself as JavaScript (definitions and 
instances)
+ *
+ */
+class sxColumnModel extends sfExtjs3sx
+{
+  const NAME_SUFFIX = 'ColumnModel';
+  const BASE_OBJECT = 'Ext.grid.ColumnModel';
+
+  /**
+   * A multiarray holding all field config for this columnModel
+   *
+   * @var array
+   */
+  protected $configFields;
+  
+  /**
+   * Creates a new JsObject
+   *
+   * @param string $name         the name of the new class to be created (is 
between namespace and nameSuffix
+   * @param array  $configFields the config-fields to be added to this 
columnModel (an array containing json-arrays with parameters)
+   */
+  public function __construct($name, $configFields)
+  {
+    $objectName = $name.self::NAME_SUFFIX;
+    
+    $this->configFields = $configFields;
+    
+    parent::__construct($objectName, self::BASE_OBJECT);
+  }
+
+  public function configure()
+  {
+    $cmConfig = 'this.cmConfig = ['.implode(",\n", $this->configFields).']';
+    
+    $this->addFunction('constructor', new sfExtjs3Function(array('c'), array(
+        $cmConfig.";",
+        $this->renderFunctionCall('superclass.constructor.call', array('this', 
'Ext.apply(this.cmConfig, c)')).";",
+        "this.defaultSortable = true;",
+      )));
+
+//      $this->addFunction('initComponent', new sfExtjs3Function(array(''),
+//        $this->renderFunctionCall('superclass.initComponent.apply', 
array('this', 'arguments')).";"
+//      ));
+  }
+}
+


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxColumnModel.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxGridPanel.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxGridPanel.class.php        
                        (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxGridPanel.class.php        
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,198 @@
+<?php
+/**
+ * sxGridPanel
+ *
+ * Instances of this class can render themself as JavaScript (definitions and 
instances)
+ *
+ */
+class sxGridPanel extends sfExtjs3sx
+{
+  const NAME_SUFFIX = 'GridPanel';
+  const BASE_OBJECT = 'Ext.grid.EditorGridPanel';
+
+  /**
+   * The maximum number of results per page
+   *
+   * @var sxStore
+   */
+  protected $sxStore;
+  
+  /**
+   * The maximum number of results per page
+   *
+   * @var sxColumnModel
+   */
+  protected $sxColumnModel;
+  
+  /**
+   * The maximum number of results per page
+   *
+   * @var sxToolbarTop
+   */
+  protected $sxToolbarTop;
+  
+  /**
+   * The maximum number of results per page
+   *
+   * @var sxToolbarPaging
+   */
+  protected $sxToolbarPaging;
+  
+  
+  /**
+   * The maximum number of results per page
+   *
+   * @var int
+   */
+  protected $maxPerPage;
+  
+  /**
+   * The title of the panel 
+   * 
+   * @var string
+   */
+  protected $title;
+  
+  /**
+   * Creates a new JsObject
+   *
+   * @param string $name      the name of the new class to be created (is 
between namespace and nameSuffix
+   * @param sxStore $sxStore 
+   * @param sxColumnModel $sxColumnModel 
+   * @param sxToolbarTop $sxToolbarTop = null 
+   * @param sxToolbarPaging $sxToolbarPaging = null 
+   * @param int $maxPerPage   The maximum number of results per page
+   * @param string $title     The title of this panel
+   */
+  public function __construct(
+    $name, 
+    sxStore $sxStore, 
+    sxColumnModel $sxColumnModel, 
+    sxToolbarTop $sxToolbarTop = null, 
+    sxToolbarPaging $sxToolbarPaging = null, 
+    $maxPerPage,
+    $title
+  )
+  {
+    $objectName = $name.self::NAME_SUFFIX;
+    
+    $this->sxStore         = $sxStore;
+    $this->sxColumnModel   = $sxColumnModel;
+    $this->sxToolbarTop    = $sxToolbarTop;
+    $this->sxToolbarPaging = $sxToolbarPaging;
+    
+    $this->maxPerPage = $maxPerPage;
+    $this->title = $title;
+        
+    parent::__construct($objectName, self::BASE_OBJECT);
+  }
+  
+  public function getTitle()
+  {
+    return $this->title;
+  }
+
+  public function configure()
+  {
+    sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url'));
+    
+    $gridView = new sfExtjs3Object('Ext.grid.GridView', '');
+    $rowSelectionModel = new sfExtjs3Object('Ext.grid.RowSelectionModel', '');
+    
+    $this->addFunction('constructor', new sfExtjs3Function(array('c'), array(
+        new sfExtjs3Json(
+          array(
+            'title' => $this->getTitle(),
+            'ds'    => $this->sxStore->renderConstruction(),
+            'cm'    => $this->sxColumnModel->renderConstruction(),
+            'view'  => $gridView->renderConstruction(array(new 
sfExtjs3Json(array(
+              'forceFit' => true,
+            )))),
+            'autoScroll'    => true,
+            'autoLoadStore' => true,
+            'selModel'      => 
$rowSelectionModel->renderConstruction(array(new sfExtjs3Json(array(
+              'singleSelect' => true
+            )))),
+            'clicksToEdit'   => 1,
+            'trackMouseOver' => true,
+            'loadMask'       => true,
+//            plugins : [
+//              new Ext.ux.grid.RowMouseOver()
+//            ],
+            'stripeRows'     => true,
+          ),
+          'this.gridPanelConfig'
+        ),
+        $this->renderFunctionCall('superclass.constructor.call', array('this', 
'Ext.apply(this.gridPanelConfig, c)')).";",
+        
+//        this.modulename = '".sfInflector::underscore($this->name)."';
+//        this.panelType  = 'list';
+
+        // TODO: needs testing
+        "if ((typeof c != 'undefined') && (typeof c.filter != 'undefined'))
+        {
+          this.store.baseParams.filter = 'query';
+          c.filter_key = (typeof c.filter_key != 'undefined') ? c.filter_key : 
-1;
+          this.store.baseParams['filters[' + c.filter + ']'] = c.filter_key;
+        }
+        "
+        
+    )));
+
+    $components = array();
+    
+    $components[] = "// initialise items which use this grid's-store";
+    if ($this->sxToolbarTop)
+    {
+      $components[] = "this.tbar = 
".$this->sxToolbarTop->renderConstruction(array(new sfExtjs3Json(array(
+                        'store' => "this.ds",
+                      )))).";";
+    }
+                   
+    if ($this->sxToolbarPaging)
+    {
+      $components[] = "this.bbar = 
".$this->sxToolbarPaging->renderConstruction(array(new sfExtjs3Json(array(
+                        'store' => "this.ds",
+                      )))).";";
+    }
+    $components[] = $this->renderFunctionCall('superclass.initComponent.call', 
array('this', 'arguments')).";";
+    $components[] = "
+      // TODO these events should be implemented
+      //          this.addEvents()
+    ";
+    
+    $this->addFunction('initComponent', new sfExtjs3Function(array(), 
$components));
+    
+    $this->addFunction('initEvents', new sfExtjs3Function(array(), array(
+      $this->renderFunctionCall('superclass.initEvents.apply', 
array('this')).";",
+      "",
+      $this->renderFunctionCallThis('on', array(new sfExtjs3Json(array(
+        'afteredit' => new sfExtjs3Json(array(
+          'fn'    => 'this.updateDB',
+          'scope' => 'this',
+        ))
+      )))).";",
+      "",
+      $this->renderFunctionCallThis('on', array(new sfExtjs3Json(array(
+        'scope' => 'this',
+        'click' =>  'this.onLinkClick',
+        'delegate' =>  '"a.gridlink"', // TODO!
+        'stopEvent' => true
+      )))).";",
+    )));
+    
+    $this->addFunction('onRender', new sfExtjs3Function(array('ct', 
'position'), array(
+      $this->renderFunctionCall('superclass.onRender.apply', array('this', 
'arguments')).";",
+      "
+        if (this.autoLoadStore)
+        {
+          this.store.load();
+        }
+      "
+    )));
+//TODO continue    
+    
+  }
+}
+
+?>
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxGridPanel.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxStore.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxStore.class.php            
                (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxStore.class.php    
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,88 @@
+<?php
+/**
+ * sxStore
+ *
+ * Instances of this class can render themself as JavaScript (definitions and 
instances)
+ *
+ */
+class sxStore extends sfExtjs3sx
+{
+  const NAME_SUFFIX = 'Store';
+  const BASE_OBJECT = 'Ext.data.Store';
+
+  /**
+   * A multiarray holding all field info for this store
+   *
+   * @var array
+   */
+  protected $fields;
+  
+  /**
+   * the url for the store to the json-data
+   * 
+   * @var string
+   */
+  protected $json_store_url;
+  
+  /**
+   * Creates a new JsObject
+   *
+   * @param string $name      the name of the new class to be created (is 
between namespace and nameSuffix
+   * @param array $fields     the fields to be added to this store (an array 
containing json-arrays with parameters)
+   * @param string $json_store_url the url for the store to the json-data
+   */
+  public function __construct($name, $fields, $json_store_url)
+  {
+    $objectName = $name.self::NAME_SUFFIX;
+    
+    $this->fields = $fields;
+    $this->json_store_url = $json_store_url;
+        
+    parent::__construct($objectName, self::BASE_OBJECT);
+  }
+
+  public function configure()
+  {
+    $httpProxy = new sfExtjs3Object('Ext.data.HttpProxy', '');
+    $jsonReader = new sfExtjs3Object('Ext.data.JsonReader', '');
+
+    $this->addFunction('constructor', new sfExtjs3Function(array('c'), array(
+        new sfExtjs3Json(
+          array(
+//            'sortInfo' => sfExtjs3Json(array(
+//              'field'     => "'TODO_sort_field'",
+//              'direction' => "'asc'"
+//            )),
+            'remoteSort' => true,
+            'defaultParamNames' => new sfExtjs3Json(array(
+              'dir' => "'type'",
+              'sort' => "'sort'",
+          // start , limit
+            )),
+            'proxy' => $httpProxy->renderConstruction(array(new 
sfExtjs3Json(array(
+              'url'    => "'".$this->json_store_url."'", // TODO: maybe use 
the ext-direct plugin?
+              'method' => "'POST'",
+            )))),
+            'reader' => $jsonReader->renderConstruction(array(new 
sfExtjs3Json(array(
+              'id'            => "'TODO_PK'",
+              'root'          => "'data'",
+              'totalProperty' => "'totalCount'",
+              'fields'        => $this->fields,
+            )))),
+          ),
+          'this.storeConfig'
+        ),
+        $this->renderFunctionCall('superclass.constructor.call', array('this', 
'Ext.apply(this.storeConfig, c)')).";",
+      )));
+
+      $this->addFunction('initComponent', new sfExtjs3Function(array(''),
+        $this->renderFunctionCall('superclass.initComponent.apply', 
array('this', 'arguments')).";"
+      ));
+
+      $this->addFunction('initEvents', new sfExtjs3Function(array(''),
+        $this->renderFunctionCall('superclass.initEvents.apply', 
array('this')).";"
+      ));
+  }
+}
+
+?>
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxStore.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarPaging.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarPaging.class.php    
                        (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarPaging.class.php    
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,50 @@
+<?php
+/**
+ * sxToolbarPaging
+ *
+ * Instances of this class can render themself as JavaScript (definitions and 
instances)
+ *
+ */
+class sxToolbarPaging extends sfExtjs3sx
+{
+  const NAME_SUFFIX = 'ToolbarPaging';
+  const BASE_OBJECT = 'Ext.PagingToolbar';
+
+  /**
+   * Creates a new JsObject
+   *
+   * @param string $name       the name of the new class to be created (is 
between namespace and nameSuffix
+   */
+  public function __construct($name)
+  {
+    $objectName = $name.self::NAME_SUFFIX;
+
+    parent::__construct($objectName, self::BASE_OBJECT);
+  }
+
+  public function configure()
+  {
+    $store = new sfExtjs3Object('this.store', '');
+    $iconMgr = new sfExtjs3Object('Ext.ux.IconMgr', '');
+
+    $this->addFunction('constructor', new sfExtjs3Function(array('c'), array(
+        new sfExtjs3Json(
+          array(
+            'pageSize'    => 10,
+            'displayInfo' => true,
+            'displayMsg'  => '"Displaying item {0} - {1} of {2}"',
+            'emptyMsg'    => '"no results"',
+          ),
+          'this.ptbConfig'
+        ),
+        $this->renderFunctionCall('superclass.constructor.call', array('this', 
'Ext.apply(this.ptbConfig, c)')).";",
+      )));
+
+      $this->addFunction('initComponent', new sfExtjs3Function(array(''),
+        $this->renderFunctionCall('superclass.initComponent.apply', 
array('this', 'arguments')).";"
+      ));
+  }
+
+}
+
+?>
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarPaging.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarTop.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarTop.class.php       
                        (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarTop.class.php       
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,90 @@
+<?php
+/**
+ * sxToolbarTop
+ *
+ * Instances of this class can render themself as JavaScript (definitions and 
instances)
+ *
+ */
+class sxToolbarTop extends sfExtjs3sx
+{
+  const NAME_SUFFIX = 'ToolbarTop';
+  const BASE_OBJECT = 'Ext.Toolbar';
+
+  /**
+   * Creates a new JsObject
+   *
+   * @param string $name       the name of the new class to be created (is 
between namespace and nameSuffix
+   */
+  public function __construct($name)
+  {
+    $objectName = $name.self::NAME_SUFFIX;
+
+    parent::__construct($objectName, self::BASE_OBJECT);
+  }
+
+  public function configure()
+  {
+//    $store = new sfExtjs3Object('this.store', '');
+//    $iconMgr = new sfExtjs3Object('Ext.ux.IconMgr', '');
+//
+//    $this->addFunction('constructor', new sfExtjs3Function(array('c'), array(
+//        new sfExtjs3Json(
+//          array(
+//            'items' => array(
+//              new sfExtjs3Json(array(
+//                'xtype' => "'tbbutton'",
+//                'text' => "'Refresh'",
+//                'action' => "'refresh'",
+//                'idRequired' => false,
+////                'iconCls' => $iconMgr->renderFunctionCall('getIcon', 
array("'table_refresh'")), // or simply 
"Ext.ux.IconMgr.getIcon('table_refresh')",
+//                'disabled' => false,
+//                'scope' => "this",
+//                'store' => "c.store", // TODO: this can be done differently, 
see argument that can be modeled, but this easy aint't it
+//                'handler' => new sfExtjs3Function(
+//                  array(),
+//                  $store->renderFunctionCall('reload').';' // or simply 
"this.store.reload();"
+//                )
+//              )),
+//              new sfExtjs3Json(array(
+//                'xtype' => "'tbfill'",
+//              )),
+//              new sfExtjs3Json(array(
+//                'xtype' => "'tbbutton'",
+//                'text' => "'Pdf'",
+//                'action' => "'pdf'",
+//                'idRequired' => false,
+////                'iconCls' => $iconMgr->renderFunctionCall('getIcon', 
array("'page_white_acrobat'")),
+//                'disabled' => false,
+//                'scope' => "this",
+//                'store' => "c.store",
+//                'handler' => 'this._pdf'
+//              )),
+//              new sfExtjs3Json(array(
+//                'xtype' => "'tbbutton'",
+//                'text' => "'Print'",
+//                'action' => "'print'",
+//                'idRequired' => false,
+////                'iconCls' => $iconMgr->renderFunctionCall('getIcon', 
array("'printer'")),
+//                'disabled' => false,
+//                'scope' => "this",
+//                'store' => "c.store",
+//                'handler' => new sfExtjs3Function(
+//                  array(),
+//                  "window.open('/daily_view/listPrint');"
+//                )
+//              )),
+//            )
+//          ),
+//          'this.ttbConfig'
+//        ),
+//        $this->renderFunctionCall('superclass.constructor.call', 
array('this', 'Ext.apply(this.ttbConfig, c)')).";",
+//      )));
+//
+//      $this->addFunction('initComponent', new sfExtjs3Function(array(''),
+//        $this->renderFunctionCall('superclass.initComponent.apply', 
array('this', 'arguments')).";"
+//      ));
+  }
+
+}
+
+?>
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/sfExtjs3sx/sxToolbarTop.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: plugins/sfGridExtjsPlugin/trunk/lib/widget/sfWidgetExtjs3.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/lib/widget/sfWidgetExtjs3.class.php         
                (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/lib/widget/sfWidgetExtjs3.class.php 
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,77 @@
+<?php
+/*
+ * This file is part of the symfony package.
+ * Leon van der Ree <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ *
+ * @package    symfony
+ * @subpackage grid-extjs3
+ * @author     Leon van der Ree <[email protected]>
+ * @version    SVN: $Id$
+ */
+class sfWidgetExtjs3 extends sfWidget
+{
+  protected $type = 'string';
+
+  /**
+   * renders value (you can extend this class and pre-process this value)
+   *
+   * @see sfWidget#render()
+   */
+  public function render($name, $value = null, $attributes = array(), $errors 
= array())
+  {
+    return $value;
+  }
+
+  /**
+   * Returns the column-definition for DataStores
+   * this is defined in the widget, to allow you to define the type
+   *
+   * @param string $name
+   * @return array
+   */
+  public function getDSFieldConfig($name)
+  {
+    $arrJs = array(
+      'name'    => '"'.$this->convertToDataFieldName($name).'"',
+      'type'    => '"'.$this->type.'"',
+      'mapping' => '"'.$name.'"',
+    );
+    
+    return $arrJs;
+  }
+    
+  /**
+   * Returns the column-definition for ColumnModel
+   * this is defined in the widget, to allow you to define the type
+   *
+   * @param string $name
+   * @return array
+   */
+  public function getColumnConfig($name)
+  {
+    $arrJs = array(
+//      $arrJs['header'] = '"'.$name.'"';
+      $arrJs['dataIndex'] = '"'.($name).'"',
+//      $arrJs['renderer'] = 'this.renderLink.createDelegate(this)';
+//      $arrJs['editor'] = array(
+//        'xtype' => '"textfield"',
+//      );
+      $arrJs['sortable'] = true,
+    );
+    
+    return $arrJs;
+  }
+  
+  
+  protected function convertToDataFieldName($name)
+  {
+    return str_replace('.', '_', $name);
+  }
+  
+}
\ No newline at end of file


Property changes on: 
plugins/sfGridExtjsPlugin/trunk/lib/widget/sfWidgetExtjs3.class.php
___________________________________________________________________
Added: svn:executable
   + *

Added: 
plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/actions/actions.class.php
===================================================================
--- plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/actions/actions.class.php 
                        (rev 0)
+++ plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/actions/actions.class.php 
2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * extjsGrid actions.
+ *
+ * @package    sfGridExtjsPlugin
+ * @subpackage extjsGrid
+ * @author     Your name here
+ * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z 
Kris.Wallsmith $
+ */
+class extjsGridActions extends sfGridExtjsActions
+{
+ /**
+  * Executes index action
+  *
+  * @param sfRequest $request A request object
+  */
+  public function executeIndex(sfWebRequest $request)
+  {
+  }
+}

Added: 
plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/templates/indexSuccess.php
===================================================================
--- 
plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/templates/indexSuccess.php    
                            (rev 0)
+++ 
plugins/sfGridExtjsPlugin/trunk/modules/extjsGrid/templates/indexSuccess.php    
    2010-04-15 22:26:29 UTC (rev 29169)
@@ -0,0 +1,51 @@
+<?php $grid = $sf_data->getRaw('grid'); ?>
+<div id="grid-example">
+  <table>
+   <?php echo $grid->render() ?>
+  </table>
+</div>
+
+<?php
+  // create extjs3 instance
+  $sfExtjs3Plugin = new sfExtjs3Plugin(array('theme'=>'blue'), array('css' => 
'')); // no extra css or js
+
+  // load extjs
+  $sfExtjs3Plugin->load();
+  // start javascript tag
+  $sfExtjs3Plugin->begin();
+
+  // start init application
+  $sfExtjs3Plugin->beginApplication(array(
+    'name'   => 'App',
+    'private' => array
+    (
+    ),
+    'public' => array
+    (
+      // public attributes
+      // public methods
+      'init'    =>  $sfExtjs3Plugin->asMethod(
+        "Ext.QuickTips.init();
+
+        // remove the html-grid
+        Ext.get('grid-example').update();
+                
+        // create an instance of the extjs-Grid
+        var grid = new 
Ext.app.sx.List".$grid->getName()."GridPanel(".json_encode(array(
+            'height'   => 350,
+            'width'    => 600,
+            'title'    => 'Array Grid',
+            'renderTo' => 'grid-example',
+        )).");
+      "),
+    )
+  ));
+  // close application tag
+  $sfExtjs3Plugin->endApplication();
+
+  // start the application
+  $sfExtjs3Plugin->initApplication('App');
+
+  // close javascript tag
+  $sfExtjs3Plugin->end();
+?>
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to