Author: gimler
Date: 2010-01-14 15:03:13 +0100 (Thu, 14 Jan 2010)
New Revision: 26629

Added:
   
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerActions.class.php
   
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerComponents.class.php
Modified:
   
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/actions.class.php
   
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/components.class.php
   plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/package.xml
Log:
sfJqueryTreeDoctrineManagerPlugin: add module base classes; fix getTree method

Modified: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/actions.class.php
===================================================================
--- 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/actions.class.php
       2010-01-14 14:00:04 UTC (rev 26628)
+++ 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/actions.class.php
       2010-01-14 14:03:13 UTC (rev 26629)
@@ -1,127 +1,22 @@
 <?php
 
+/*
+ * This file is part of the symfony package.
+ * (c) 2004-2006 Fabien Potencier <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
 
 /**
- * sfJsTreeDoctrine actions.
+ * sfJqueryTreeDoctrineManager actions.
  * 
- * @package    sfJsTreeDoctrinePlugin
- * @subpackage sfJsTreeDoctrine
- * @author     Your name here
- * @version    SVN: $Id: actions.class.php 12534 2008-11-01 13:38:27Z 
Kris.Wallsmith $
+ * @package    symfony
+ * @subpackage plugin
+ * @author     Gregory Schurgast <[email protected]>
+ * @author     Gordon Franke <[email protected]>
+ * @version    SVN: $Id: BasesfGuardForgotPasswordActions.class.php 18401 
2009-05-18 14:12:09Z gimler $
  */
-class sfJqueryTreeDoctrineManagerActions extends sfActions
+class sfJqueryTreeDoctrineManagerActions extends 
BasesfJqueryTreeDoctrineManagerActions
 {
-
-
-
-  public function getTree($model, $rootId = 0)
-  {
-    if( $rootId )
-    {
-      $root = Doctrine_Core::getTable($model)->getTree()->findRoot($rootId);
-    
-      return 
Doctrine_Core::getTable($model)->getTree()->fetchBranch($root->getId()); 
-    } else {
-      return Doctrine_Core::getTable($model)->getTree()->fetchTree();
-    }
-  }
-
-  public function executeAdd_child()
-  {
-    $parent_id = $this->getRequestParameter('parent_id');
-    $model = $this->getRequestParameter('model');
-    $field = $this->getRequestParameter('field');
-    $value = $this->getRequestParameter('value');
-    $record = Doctrine_Core::getTable($model)->find($parent_id);
-
-    $child = new $model;
-    $child->set($field, $value);
-    $record->getNode()->addChild($child);
-    
-    $this->json = json_encode($child->toArray());
-    
-    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
-    $this->setTemplate('json');
-    
-    
-
-  }
-  
-  public function executeAdd_root()
-  {
-    $model = $this->getRequestParameter('model');
-    $data = $this->getRequestParameter( strtolower($model) );
-    
-    $tree = $this->getTree($model);
-    
-    $root = new $model;
-    
-    $root->synchronizeWithArray( $data );    
-    
-    Doctrine_Core::getTable($model)->getTree()->createRoot($root);
-    $this->records = $this->getTree($model);
-    return sfView::NONE;
-  }
-
-  public function executeEdit_field()
-  {
-    $id = $this->getRequestParameter('id');
-    $model = $this->getRequestParameter('model');
-    $field = $this->getRequestParameter('field');
-    $value = $this->getRequestParameter('value');
-
-    $record = Doctrine_Core::getTable($model)->find($id);
-    $record->set($field, $value);
-    $record->save();
-
-    $this->json = json_encode($record->toArray());
-    
-    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
-    $this->setTemplate('json');
-  }
-
-  public function executeDelete()
-  {
-    $id = $this->getRequestParameter('id');
-    $model = $this->getRequestParameter('model');
-    
-    $record = Doctrine_Core::getTable($model)->find($id);
-    $record->getNode()->delete();
-    $this->json = json_encode(array());
-    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
-    $this->setTemplate('json');
-    
-  }
-
-  public function executeMove()
-  {
-    $id = $this->getRequestParameter('id');
-    $to_id = $this->getRequestParameter('to_id');
-    $model = $this->getRequestParameter('model');
-    $movetype = $this->getRequestParameter('movetype');
-    
-    $record = Doctrine_Core::getTable($model)->find($id);
-    $dest = Doctrine_Core::getTable($model)->find($to_id);
-    
-    if( $movetype == 'inside' )
-    {
-      //$prev = $record->getNode()->getPrevSibling();
-      $record->getNode()->moveAsLastChildOf($dest);
-    }
-    else if( $movetype == 'after' )
-    {
-      $record->getNode()->moveAsNextSiblingOf($dest);
-    }
-    
-    else if( $movetype == 'before' )
-    {
-      //$next = $record->getNode()->getNextSibling();
-      $record->getNode()->moveAsPrevSiblingOf($dest);
-    }
-    $this->json = json_encode($record->toArray());
-    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
-    $this->setTemplate('json');
-  }
-
- 
 }


Property changes on: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/actions.class.php
___________________________________________________________________
Added: svn:keyowrds
   + id

Modified: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/components.class.php
===================================================================
--- 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/components.class.php
    2010-01-14 14:00:04 UTC (rev 26628)
+++ 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/components.class.php
    2010-01-14 14:03:13 UTC (rev 26629)
@@ -1,27 +1,22 @@
 <?php
 
+/*
+ * This file is part of the symfony package.
+ * (c) 2004-2006 Fabien Potencier <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
 
-class sfJqueryTreeDoctrineManagerComponents extends sfComponents
+/**
+ * sfJqueryTreeDoctrineManager components.
+ *
+ * @package    symfony
+ * @subpackage plugin
+ * @author     Gregory Schurgast <[email protected]>
+ * @author     Gordon Franke <[email protected]>
+ * @version    SVN: $Id: BasesfGuardAuthActions.class.php 7745 2008-03-05 
11:05:33Z fabien $
+ */
+class sfJqueryTreeDoctrineManagerComponents extends 
BasesfJqueryTreeDoctrineManagerComponents
 {
-    public function getTree($model, $rootId = 0)
-  {
-    $tree = Doctrine_Core::getTable($model)->getTree();
-    
-    if( $rootId )
-    {
-      $root = $tree->findRoot($rootId);
-      return $tree->fetchBranch($root->getId()); 
-      
-    } else {
-      return $tree->fetchTree();
-    }
-  }
-
-  public function executeManager()
-  {
-    $this->records = $this->getTree($this->model, $this->root);
-    if (!$this->records){ echo 'pas de racine';}
-    
-    
-  }
 }
\ No newline at end of file


Property changes on: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/actions/components.class.php
___________________________________________________________________
Added: svn:keyowrds
   + id

Added: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerActions.class.php
===================================================================
--- 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerActions.class.php
                            (rev 0)
+++ 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerActions.class.php
    2010-01-14 14:03:13 UTC (rev 26629)
@@ -0,0 +1,128 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) 2004-2006 Fabien Potencier <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * sfJqueryTreeDoctrineManager actions.
+ *
+ * @package    symfony
+ * @subpackage plugin
+ * @author     Gregory Schurgast <[email protected]>
+ * @author     Gordon Franke <[email protected]>
+ * @version    SVN: $Id: BasesfGuardForgotPasswordActions.class.php 18401 
2009-05-18 14:12:09Z gimler $
+ */
+class BasesfJqueryTreeDoctrineManagerActions extends sfActions
+{
+  public function getTree($model, $rootId = null)
+  {
+    $tree = Doctrine_Core::getTable($model)->getTree();
+
+    $options = array();
+    if($rootId !== null)
+    {
+      $options['root_id'] = $rootId;
+    }
+
+    return $tree->fetchTree($options);
+  }
+
+  public function executeAdd_child()
+  {
+    $parent_id = $this->getRequestParameter('parent_id');
+    $model = $this->getRequestParameter('model');
+    $field = $this->getRequestParameter('field');
+    $value = $this->getRequestParameter('value');
+    $record = Doctrine_Core::getTable($model)->find($parent_id);
+
+    $child = new $model;
+    $child->set($field, $value);
+    $record->getNode()->addChild($child);
+    
+    $this->json = json_encode($child->toArray());
+    
+    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
+    $this->setTemplate('json');
+  }
+  
+  public function executeAdd_root()
+  {
+    $model = $this->getRequestParameter('model');
+    $data = $this->getRequestParameter( strtolower($model) );
+    
+    $tree = $this->getTree($model);
+    
+    $root = new $model;
+    
+    $root->synchronizeWithArray( $data );    
+    
+    Doctrine_Core::getTable($model)->getTree()->createRoot($root);
+    $this->records = $this->getTree($model);
+
+    return sfView::NONE;
+  }
+
+  public function executeEdit_field()
+  {
+    $id = $this->getRequestParameter('id');
+    $model = $this->getRequestParameter('model');
+    $field = $this->getRequestParameter('field');
+    $value = $this->getRequestParameter('value');
+
+    $record = Doctrine_Core::getTable($model)->find($id);
+    $record->set($field, $value);
+    $record->save();
+
+    $this->json = json_encode($record->toArray());
+    
+    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
+    $this->setTemplate('json');
+  }
+
+  public function executeDelete()
+  {
+    $id = $this->getRequestParameter('id');
+    $model = $this->getRequestParameter('model');
+    
+    $record = Doctrine_Core::getTable($model)->find($id);
+    $record->getNode()->delete();
+    $this->json = json_encode(array());
+    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
+    $this->setTemplate('json');
+  }
+
+  public function executeMove()
+  {
+    $id = $this->getRequestParameter('id');
+    $to_id = $this->getRequestParameter('to_id');
+    $model = $this->getRequestParameter('model');
+    $movetype = $this->getRequestParameter('movetype');
+    
+    $record = Doctrine_Core::getTable($model)->find($id);
+    $dest = Doctrine_Core::getTable($model)->find($to_id);
+    
+    if( $movetype == 'inside' )
+    {
+      //$prev = $record->getNode()->getPrevSibling();
+      $record->getNode()->moveAsLastChildOf($dest);
+    }
+    else if( $movetype == 'after' )
+    {
+      $record->getNode()->moveAsNextSiblingOf($dest);
+    }
+    
+    else if( $movetype == 'before' )
+    {
+      //$next = $record->getNode()->getNextSibling();
+      $record->getNode()->moveAsPrevSiblingOf($dest);
+    }
+    $this->json = json_encode($record->toArray());
+    $this->getResponse()->setHttpHeader('Content-type', 'application/json');
+    $this->setTemplate('json');
+  }
+}


Property changes on: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerActions.class.php
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:keyowrds
   + id

Added: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerComponents.class.php
===================================================================
--- 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerComponents.class.php
                         (rev 0)
+++ 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerComponents.class.php
 2010-01-14 14:03:13 UTC (rev 26629)
@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) 2004-2006 Fabien Potencier <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * sfJqueryTreeDoctrineManager components.
+ *
+ * @package    symfony
+ * @subpackage plugin
+ * @author     Gregory Schurgast <[email protected]>
+ * @author     Gordon Franke <[email protected]>
+ * @version    SVN: $Id: BasesfGuardAuthActions.class.php 7745 2008-03-05 
11:05:33Z fabien $
+ */
+class BasesfJqueryTreeDoctrineManagerComponents extends sfComponents
+{
+  public function getTree($model, $rootId = null)
+  {
+    $tree = Doctrine_Core::getTable($model)->getTree();
+
+    $options = array();
+    if($rootId !== null)
+    {
+      $options['root_id'] = $rootId;
+    }
+
+    return $tree->fetchTree($options);
+  }
+
+  public function executeManager()
+  {
+    $this->records = $this->getTree($this->model, $this->root);
+
+    if (!$this->records){ echo 'pas de racine';}
+  }
+}


Property changes on: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/lib/BasesfJqueryTreeDoctrineManagerComponents.class.php
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:keyowrds
   + id

Modified: plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/package.xml
===================================================================
--- plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/package.xml 2010-01-14 
14:00:04 UTC (rev 26628)
+++ plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/package.xml 2010-01-14 
14:03:13 UTC (rev 26629)
@@ -10,6 +10,12 @@
   <email>[email protected]</email>
   <active>yes</active>
  </lead>
+<developer>
+  <name>Gordon Franke</name>
+  <user>gimler</user>
+  <email>[email protected]</email>
+  <active>yes</active>
+ </developer>
  <date>2010-01-06</date>
  <time>22:34:28</time>
  <version>

-- 
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