Author: klemens
Date: 2014-06-17 10:44:55 +0200 (Tue, 17 Jun 2014)
New Revision: 4110
Added:
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.gitignore
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.travis.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/LICENSE
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/README.md
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/bin/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/bin/travis-init.sh
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/listener/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/listener/Sortable.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/template/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/template/Sortable.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bin/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bin/prove.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/bootstrap.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/sfPluginTestBootstrap.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/app.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/cache.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/factories.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/filters.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/frontendConfiguration.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/routing.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/security.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/settings.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/view.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/lib/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/lib/myUser.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/actions/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/actions/actions.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_body.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_bodyForm.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_link.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/blogSuccess.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/unit/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/unit/templates/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/unit/templates/_blog.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/templates/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/templates/layout.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/ProjectConfiguration.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-mysql.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-postgre.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-sqlite.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/doctrine/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/doctrine/schema.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/properties.ini
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/rsync_exclude.txt
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fixtures/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fixtures/categories.yml
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fresh_test_db.sqlite
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/sql/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/sql/schema.sql
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticle.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategory.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategoryTable.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleTable.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueBy.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueByTable.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticle.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleCategory.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleUniqueBy.class.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/symfony
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableBatchTest.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableTest.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableUniqueByTest.php
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/css/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/css/sortable.css
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/icons/
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/icons/demote.png
trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/icons/promote.png
Log:
Added csDoctrineActAsSortablePlugin
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.gitignore
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.gitignore (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.gitignore 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,5 @@
+test/fixtures/project/cache/*
+test/fixtures/project/data/test.sqlite
+test/fixtures/project/lib/filter
+test/fixtures/project/lib/form
+test/fixtures/project/config/databases.yml
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.travis.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.travis.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/.travis.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,21 @@
+language: php
+
+php:
+ - 5.3
+
+before_script:
+ - ./bin/travis-init.sh
+ - "export SYMFONY=`pwd`/lib/vendor/symfony/lib/"
+
+script: php test/bin/prove.php
+
+env:
+ - DB=postgre SYMFONY_REF=origin/1.4
+ - DB=mysql SYMFONY_REF=origin/1.4
+ - DB=sqlite SYMFONY_REF=origin/1.4
+ - DB=postgre SYMFONY_REF=origin/1.3
+ - DB=mysql SYMFONY_REF=origin/1.3
+ - DB=sqlite SYMFONY_REF=origin/1.3
+ - DB=postgre SYMFONY_REF=origin/1.2
+ - DB=mysql SYMFONY_REF=origin/1.2
+ - DB=sqlite SYMFONY_REF=origin/1.2
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/LICENSE
===================================================================
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/README.md
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/README.md (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/README.md 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,159 @@
+csDoctrineActAsSortablePlugin
+=============================
+
+[](http://travis-ci.org/bshaffer/csDoctrineActAsSortablePlugin)
+
+The `csDoctrineActAsSortablePlugin` is a symfony plugin that allows use of the doctrine behavior actAsSortable.
+
+This behavior provides methods on your model for setting display order/position.
+
+This plugin also contains images to implement for ordering.
+
+Installation
+------------
+
+### With git
+
+ git submodule add git://
github.com/bshaffer/csDoctrineActAsSortablePlugin.git plugins/csDoctrineActAsSortablePlugin
+ git submodule init
+ git submodule update
+
+### With subversion
+
+ svn propedit svn:externals plugins
+
+In the editor that's displayed, add the following entry and then save
+
+ csDoctrineActAsSortablePlugin
https://svn.github.com/bshaffer/csDoctrineActAsSortablePlugin.git
+
+Finally, update:
+
+ svn up
+
+# Setup
+
+In your `config/ProjectConfiguration.class.php` file, make sure you have
+the plugin enabled.
+
+ $this->enablePlugins('csDoctrineActAsSortablePlugin');
+
+Apply the behavior to your model in your schema file `config/doctrine/schema.yml`
+
+ MyModel:
+ actAs: [Sortable]
+
+Optionally accepts a UniqueBy attribute which will be used on a model with a one-to-many relationship
+
+ MyModel:
+ actAs:
+ Sortable:
+ uniqueBy: [parent_id]
+
+Rebuild your models and database
+
+ ./symfony doctrine:build --all --and-load
+
+Publish your assets
+
+ ./symfony plugin:publish-assets
+
+Clear your cache
+
+ ./symfony cc
+
+
+#Available Record Methods
+
+ * **promote**
+
+ $record->promote();
+
+ * **demote**
+
+ $record->demote();
+
+ * **moveToFirst**
+
+ $record->moveToFirst();
+
+ * **moveToLast**
+
+ $record->moveToLast();
+
+ * **moveToPosition**
+
+ $record->moveToPosition($newPosition);
+
+
+#Available Table Methods
+
+ * **sort** - accepts the array created by the symfony/prototype sortableElement tag
+
+ Doctrine::getTable('MyModel')->sort($order);
+
+ * **findAllSorted** - Accepts sort order (asc, desc)
+
+ Doctrine::getTable('Model')->findAllSorted('asc');
+
+ * **findAllSortedWithParent** - accepts the parent column name, the value, and sort order (asc, desc)
+
+ Doctrine::getTable('MyModel')->findAllSortedWithParent($fk_value, $fk_name, 'asc');
+
+
+#Example Usage With Admin Generator
+
+In your module, edit `config/generator.yml`, and under list, object actions, add:
+
+ object_actions:
+ promote:
+ action: promote
+ demote:
+ action: demote
+ _edit: ~
+ _delete: ~
+
+In your module, edit `actions/actions.class.php`, Add the following actions:
+
+ public function executePromote()
+ {
+ $object=Doctrine::getTable('MyModel')->findOneById($this->getRequestParameter('id'));
+
+
+ $object->promote();
+ $this->redirect("@moduleIndexRoute");
+ }
+
+ public function executeDemote()
+ {
+ $object=Doctrine::getTable('MyModel')->findOneById($this->getRequestParameter('id'));
+
+ $object->demote();
+ $this->redirect("@moduleIndexRoute");
+ }
+
+Running Unit Tests
+------------------
+
+This plugin comes with a fully functional test suite. If you'd like to run this against the symfony version
+used in your project, export the `$symfony` environment variable as follows:
+
+ export SYMFONY=/usr/share/php/symfony
+
+The above is where PEAR installs symfony on an Ubuntu/Debian-system.
+**Be sure to point this at your symfony `lib` directory!**
+
+By default, this will run against a `sqlite` database. If you'd like to run against `postgres` or `mysql`,
+export the environmental `$DB` variable as follows:
+
+ # Running against mysql:
+ export DB=mysql; php ./test/bin/prove.php
+
+ #Running against postgre:
+ export DB=postgre; php ./test/bin/prove.php
+
+*Database connection data*
+
+ - mySQL uses root with no password per default
+ - postgreSQL uses postgres with no password per default
+
+Database-Configuration can be changed in `/test/fixtures/project/config/database-*.yml`
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/bin/travis-init.sh
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/bin/travis-init.sh (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/bin/travis-init.sh 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,8 @@
+echo "Cloning symfony and checking out tag/branch/commit"
+git clone git://
github.com/symfony/symfony1.git lib/vendor/symfony
+
+cd lib/vendor/symfony
+
+git fetch --all
+
+git checkout $SYMFONY_REF
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/listener/Sortable.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/listener/Sortable.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/listener/Sortable.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,170 @@
+<?php
+
+
+/**
+ * Easily sort each record based on position
+ *
+ * @package csDoctrineSortablePlugin
+ * @subpackage listener
+ * @license
http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link
www.phpdoctrine.org
+ * @since 1.0
+ * @version $Revision$
+ * @author Travis Black <
tbl...@centresource.com>
+ */
+class Doctrine_Template_Listener_Sortable extends Doctrine_Record_Listener
+{
+ /**
+ * Array of sortable options
+ *
+ * @var array
+ */
+ protected $_options = array();
+
+
+ /**
+ * __construct
+ *
+ * @param array $options
+ * @return void
+ */
+ public function __construct(array $options)
+ {
+ $this->_options = $options;
+ }
+
+
+ /**
+ * Set the position value automatically when a new sortable object is created
+ *
+ * @param Doctrine_Event $event
+ * @return void
+ */
+ public function preInsert(Doctrine_Event $event)
+ {
+ $fieldName = $this->_options['name'];
+ $object = $event->getInvoker();
+ $object->$fieldName = $object->getFinalPosition()+1;
+ }
+
+ /**
+ * When a sortable object is updated, check to see if any of the uniqueBy
+ * fields are modified before saving to prevent two items having the same
+ * position.
+ *
+ * @param string $Doctrine_Event
+ * @return void
+ */
+ public function preUpdate(Doctrine_Event $event) {
+ $fieldName = $this->_options['name'];
+ $object = $event->getInvoker();
+ $modified = $object->getModified();
+
+ //-- Check to see if any of the uniqueBy fields have been modified
+ foreach ($this->_options['uniqueBy'] as $field)
+ {
+ if ( array_key_exists($field, $modified) ) {
+ //-- Move it to the end
+ $object->$fieldName = $object->getFinalPosition()+1;
+ break;
+ }
+ }
+ }
+
+ /**
+ * When a sortable object is deleted, refresh its position BEFORE it is deleted, to
+ * have the right position in postDelete
+ *
+ * @param Doctrine_Event $event
+ * @return void
+ */
+ public function preDelete(Doctrine_Event $event)
+ {
+ $object = $event->getInvoker();
+ $this->refreshPosition($object);
+ }
+
+ /**
+ * Refreshs the position of the object
+ *
+ * @param Doctrine_Record $object
+ */
+ private function refreshPosition(Doctrine_Record $object)
+ {
+ $fieldName = $this->_options['name'];
+ $identifiers = $object->getTable()->getIdentifierColumnNames();
+
+ $query = $object->getTable()->createQuery()->select($fieldName);
+
+ foreach($identifiers as $identifier)
+ {
+ $query->andWhere($identifier . ' = ?', $object->get($identifier));
+ }
+
+ $position = $query->fetchOne(array(), Doctrine::HYDRATE_ARRAY);
+ $object->set($fieldName, $position[$fieldName], false);
+ }
+
+ /**
+ * When a sortable object is deleted, promote all objects positioned lower than itself
+ *
+ * @param string $Doctrine_Event
+ * @return void
+ */
+ public function postDelete(Doctrine_Event $event)
+ {
+ $fieldName = $this->_options['name'];
+ $object = $event->getInvoker();
+ $position = $object->$fieldName;
+ $conn = $object->getTable()->getConnection();
+
+ // Quick fix forSoftDelete behavior
+ if ($object->getTable()->hasTemplate('SoftDelete'))
+ {
+ $object->set($fieldName, null);
+ $object->save();
+ }
+
+ // Create query to update other positions
+ $q = $object->getTable()->createQuery()
+ ->where($fieldName . ' > ?', $position)
+ ->orderBy($fieldName);
+
+ foreach ($this->_options['uniqueBy'] as $field)
+ {
+ if(is_null($object[$field]))
+ {
+ $q->addWhere($field . ' IS NULL');
+ }
+ else
+ {
+ $q->addWhere($field . ' = ?', $object[$field]);
+ }
+ }
+
+ if ($this->canUpdateWithOrderBy($conn))
+ {
+ $q->update(get_class($object))
+ ->set($fieldName, $fieldName . ' - ?', '1')
+ ->execute();
+ }
+ else
+ {
+ foreach ( $q->execute() as $item )
+ {
+ $pos = $item->get($this->_options['name'] );
+ $item->set($this->_options['name'], $pos-1)->save();
+ }
+ }
+ }
+
+ // some drivers do not support UPDATE with ORDER BY
+ protected function canUpdateWithOrderBy(Doctrine_Connection $conn)
+ {
+ // If transaction level is greater than 1,
+ // query will throw exceptions when using this function
+ return $conn->getTransactionLevel() < 2 &&
+ // some drivers do not support UPDATE with ORDER BY query syntax
+ $conn->getDriverName() != 'Pgsql' && $conn->getDriverName() != 'Sqlite' && $conn->getDriverName() != 'Mssql';
+ }
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/template/Sortable.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/template/Sortable.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/lib/template/Sortable.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,510 @@
+<?php
+
+/**
+ * Easily adds sorting functionality to a record.
+ *
+ * @package csDoctrineSortablePlugin
+ * @subpackage template
+ * @license
http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link
www.phpdoctrine.org
+ * @since 1.0
+ * @version $Revision$
+ * @author Travis Black <
tbl...@centresource.com>
+ */
+class Doctrine_Template_Sortable extends Doctrine_Template
+{
+ /**
+ * Array of Sortable options
+ *
+ * @var string
+ */
+ protected
+ $_options = array(
+ 'name' => 'position',
+ 'alias' => null,
+ 'type' => 'integer',
+ 'length' => 8,
+ 'unique' => true,
+ 'options' => array(),
+ 'fields' => array(),
+ 'uniqueBy' => array(),
+ 'uniqueIndex' => true,
+ 'indexName' => 'sortable')
+ ;
+
+ /**
+ * __construct
+ *
+ * @param string $array
+ * @return void
+ */
+ public function __construct(array $options = array())
+ {
+ $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
+ }
+
+
+ /**
+ * Set table definition for sortable behavior
+ * (borrowed and modified from Sluggable in Doctrine core)
+ *
+ * @return void
+ */
+ public function setTableDefinition()
+ {
+ $name = $this->_options['name'];
+
+ if ($this->_options['alias'])
+ {
+ $name .= ' as ' . $this->_options['alias'];
+ }
+
+ $this->hasColumn($name, $this->_options['type'], $this->_options['length'], $this->_options['options']);
+
+ if (!empty($this->_options['uniqueBy']) && !is_array($this->_options['uniqueBy']))
+ {
+ throw new sfException("Sortable option 'uniqueBy' must be an array");
+ }
+
+ if ($this->_options['uniqueIndex'] == true && ! empty($this->_options['uniqueBy']))
+ {
+ $indexFields = array($this->_options['name']);
+ $indexFields = array_merge($indexFields, $this->_options['uniqueBy']);
+
+ $this->index($this->getSortableIndexName(), array('fields' => $indexFields, 'type' => 'unique'));
+
+ }
+ elseif ($this->_options['unique'])
+ {
+ $indexFields = array($this->_options['name']);
+ $this->index($this->getSortableIndexName(), array('fields' => $indexFields, 'type' => 'unique'));
+
+ }
+
+ $this->addListener(new Doctrine_Template_Listener_Sortable($this->_options));
+ }
+
+ /**
+ * Returns the name of the index to create for the position field.
+ *
+ * @return string
+ */
+ protected function getSortableIndexName()
+ {
+ return sprintf('%s_%s_%s', $this->getTable()->getTableName(), $this->_options['name'], $this->_options['indexName']);
+ }
+
+
+ /**
+ * Demotes a sortable object to a lower position
+ *
+ * @return void
+ */
+ public function demote()
+ {
+ $object = $this->getInvoker();
+ $position = $object->get($this->_options['name']);
+
+ if ($position < $object->getFinalPosition())
+ {
+ $position = $this->getNextPosition();
+
+ if (0 != $position)
+ {
+ $object->moveToPosition($position);
+ }
+ }
+ }
+
+
+ /**
+ * Promotes a sortable object to a higher position
+ *
+ * @return void
+ */
+ public function promote()
+ {
+ $object = $this->getInvoker();
+ $position = $object->get($this->_options['name']);
+
+ if ($position > 1)
+ {
+ $position = $this->getPrevPosition();
+
+ if (0 != $position)
+ {
+ $object->moveToPosition($position);
+ }
+ }
+ }
+
+ /**
+ * Sets a sortable object to the first position
+ *
+ * @return void
+ */
+ public function moveToFirst()
+ {
+ $object = $this->getInvoker();
+ $object->moveToPosition(1);
+ }
+
+
+ /**
+ * Sets a sortable object to the last position
+ *
+ * @return void
+ */
+ public function moveToLast()
+ {
+ $object = $this->getInvoker();
+ $object->moveToPosition($object->getFinalPosition());
+ }
+
+
+ /**
+ * Moves a sortable object to a designate position
+ *
+ * @param int $newPosition
+ * @return void
+ */
+ public function moveToPosition($newPosition)
+ {
+ if (!is_int($newPosition))
+ {
+ throw new Doctrine_Exception('moveToPosition requires an Integer as the new position. Entered ' . $newPosition);
+ }
+
+ $object = $this->getInvoker();
+ $position = $object->get($this->_options['name']);
+ $conn = $object->getTable()->getConnection();
+
+ //begin Transaction
+ $conn->beginTransaction();
+
+ // Position is required to be unique. Blanks it out before it moves others up/down.
+ $object->set($this->_options['name'], null);
+ $object->save();
+
+ if ($position > $newPosition)
+ {
+ $q = $object->getTable()->createQuery()
+ ->where($this->_options['name'] . ' < ?', $position)
+ ->andWhere($this->_options['name'] . ' >= ?', $newPosition)
+ ->orderBy($this->_options['name'] . ' DESC');
+
+ foreach ($this->_options['uniqueBy'] as $field)
+ {
+ if (is_null($object[$field]))
+ {
+ $q->addWhere($field . ' IS NULL');
+ }
+ else
+ {
+ $q->addWhere($field . ' = ?', $object[$field]);
+ }
+ }
+
+ // some drivers do not support UPDATE with ORDER BY query syntax
+ if ($this->canUpdateWithOrderBy($conn))
+ {
+ $q->update(get_class($object))
+ ->set($this->_options['name'], $this->_options['name'] . ' + 1')
+ ->execute();
+ }
+ else
+ {
+ foreach ( $q->execute() as $item )
+ {
+ $pos = $item->get($this->_options['name'] );
+ $item->set($this->_options['name'], $pos+1)->save();
+ }
+ }
+
+ }
+ elseif ($position < $newPosition)
+ {
+
+ $q = $object->getTable()->createQuery()
+ ->where($this->_options['name'] . ' > ?', $position)
+ ->andWhere($this->_options['name'] . ' <= ?', $newPosition)
+ ->orderBy($this->_options['name'] . ' ASC');
+
+ foreach($this->_options['uniqueBy'] as $field)
+ {
+ if (is_null($object[$field]))
+ {
+ $q->addWhere($field . ' IS NULL');
+ }
+ else
+ {
+ $q->addWhere($field . ' = ?', $object[$field]);
+ }
+ }
+
+ // some drivers do not support UPDATE with ORDER BY query syntax
+ if ($this->canUpdateWithOrderBy($conn))
+ {
+ $q->update(get_class($object))
+ ->set($this->_options['name'], $this->_options['name'] . ' - 1')
+ ->execute();
+ }
+ else
+ {
+ foreach ( $q->execute() as $item )
+ {
+ $pos = $item->get($this->_options['name'] );
+ $item->set($this->_options['name'], $pos-1)->save();
+ }
+ }
+
+ }
+
+ $object->set($this->_options['name'], $newPosition);
+ $object->save();
+
+ // Commit Transaction
+ $conn->commit();
+ }
+
+
+ /**
+ * Send an array from the sortable_element tag (symfony+prototype)and it will
+ * update the sort order to match
+ *
+ * @param string $order
+ * @return void
+ * @author Travis Black
+ */
+ public function sortTableProxy($order)
+ {
+ /*
+ TODO
+ - Add proper error messages.
+ */
+ $table = $this->getInvoker()->getTable();
+ $class = get_class($this->getInvoker());
+ $conn = $table->getConnection();
+
+ $conn->beginTransaction();
+
+ foreach ($order as $position => $id)
+ {
+ $newObject = Doctrine::getTable($class)->findOneById($id);
+
+ if ($newObject->get($this->_options['name']) != $position + 1)
+ {
+ $newObject->moveToPosition($position + 1);
+ }
+ }
+
+ // Commit Transaction
+ $conn->commit();
+ }
+
+
+ /**
+ * Finds all sortable objects and sorts them based on position attribute
+ * Ascending or Descending based on parameter
+ *
+ * @param string $order
+ * @return $query
+ */
+ public function findAllSortedTableProxy($order = 'ASC')
+ {
+ $order = $this->formatAndCheckOrder($order);
+ $object = $this->getInvoker();
+
+ $query = $object->getTable()->createQuery()
+ ->orderBy($this->_options['name'] . ' ' . $order);
+
+ return $query->execute();
+ }
+
+
+ /**
+ * Finds and returns records sorted where the parent (fk) in a specified
+ * one to many relationship has the value specified
+ *
+ * @param string $parentValue
+ * @param string $parent_column_value
+ * @param string $order
+ * @return $query
+ */
+ public function findAllSortedWithParentTableProxy($parentValue, $parentColumnName = null, $order = 'ASC')
+ {
+ $order = $this->formatAndCheckOrder($order);
+
+ $object = $this->getInvoker();
+ $class = get_class($object);
+
+ if (!$parentColumnName)
+ {
+ $parents = get_class($object->getParent());
+
+ if (count($parents) > 1)
+ {
+ throw new Doctrine_Exception('No parent column name specified and object has mutliple parents');
+ }
+ elseif (count($parents) < 1)
+ {
+ throw new Doctrine_Exception('No parent column name specified and object has no parents');
+ }
+ else
+ {
+ $parentColumnName = $parents[0]->getType();
+ exit((string) $parentColumnName);
+ exit(print_r($parents[0]->toArray()));
+ }
+ }
+
+ $query = $object->getTable()->createQuery()
+ ->from($class . ' od')
+ ->where('od.' . $parentColumnName . ' = ?', $parentValue)
+ ->orderBy($this->_options['name'] . ' ' . $order);
+
+ return $query->execute();
+ }
+
+
+ /**
+ * Formats the ORDER for insertion in to query, else throws exception
+ *
+ * @param string $order
+ * @return $order
+ */
+ public function formatAndCheckOrder($order)
+ {
+ $order = strtolower($order);
+
+ if ('ascending' === $order || 'asc' === $order)
+ {
+ $order = 'ASC';
+ }
+ elseif ('descending' === $order || 'desc' === $order)
+ {
+ $order = 'DESC';
+ }
+ else
+ {
+ throw new Doctrine_Exception('Order parameter value must be "asc" or "desc"');
+ }
+
+ return $order;
+ }
+
+
+ /**
+ * Returns the position of the previous record.
+ *
+ * @return int Previous position
+ */
+ public function getPrevPosition()
+ {
+ $object = $this->getInvoker();
+
+ $q = $object->getTable()->createQuery();
+ $q->select($this->_options['name']);
+ $q->orderBy($this->_options['name'] . ' desc');
+
+ $q->addWhere($this->_options['name'] . ' < ?', $object->get($this->_options['name']));
+
+ foreach($this->_options['uniqueBy'] as $field)
+ {
+ if(is_object($object[$field]))
+ {
+ $q->addWhere($field . ' = ?', $object[$field]['id']);
+ }
+ elseif (is_null($object[$field]))
+ {
+ $q->addWhere($field . ' IS NULL');
+ }
+ else
+ {
+ $q->addWhere($field . ' = ?', $object[$field]);
+ }
+ }
+
+ $prev = $q->limit(1)->fetchOne();
+ $position = $prev ? $prev->get($this->_options['name']) : 0;
+
+ return (int) $position;
+ }
+
+ public function getNextPosition()
+ {
+ $object = $this->getInvoker();
+
+ $q = $object->getTable()->createQuery();
+ $q->select($this->_options['name']);
+ $q->orderBy($this->_options['name'] . ' asc');
+
+ $q->addWhere($this->_options['name'] . ' > ?', $object->get($this->_options['name']));
+
+ foreach($this->_options['uniqueBy'] as $field)
+ {
+ if(is_object($object[$field]))
+ {
+ $q->addWhere($field . ' = ?', $object[$field]['id']);
+ }
+ elseif (is_null($object[$field]))
+ {
+ $q->addWhere($field . ' IS NULL');
+ }
+ else
+ {
+ $q->addWhere($field . ' = ?', $object[$field]);
+ }
+ }
+
+ $next = $q->limit(1)->fetchOne();
+ $position = $next ? $next->get($this->_options['name']) : 0;
+
+ return (int) $position;
+ }
+
+ /**
+ * Get the final position of a model
+ *
+ * @return int $position
+ */
+ public function getFinalPosition()
+ {
+ $object = $this->getInvoker();
+
+ $q = $object->getTable()->createQuery()
+ ->select($this->_options['name'])
+ ->orderBy($this->_options['name'] . ' desc');
+
+ foreach($this->_options['uniqueBy'] as $field)
+ {
+ if(is_object($object[$field]))
+ {
+ $q->addWhere($field . ' = ?', $object[$field]['id']);
+ }
+ if (is_null($object[$field]))
+ {
+ $q->addWhere($field . ' IS NULL');
+ }
+ else
+ {
+ $q->addWhere($field . ' = ?', $object[$field]);
+ }
+ }
+
+ $last = $q->limit(1)->fetchOne();
+ $finalPosition = $last ? $last->get($this->_options['name']) : 0;
+
+ return (int)$finalPosition;
+ }
+
+ // sqlite/pgsql doesn't supports UPDATE with ORDER BY
+ protected function canUpdateWithOrderBy(Doctrine_Connection $conn)
+ {
+ // If transaction level is greater than 1,
+ // query will throw exceptions when using this function
+ return $conn->getTransactionLevel() < 2 &&
+ // some drivers do not support UPDATE with ORDER BY query syntax
+ $conn->getDriverName() != 'Pgsql' && $conn->getDriverName() != 'Sqlite' && $conn->getDriverName() != 'Mssql';
+ }
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bin/prove.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bin/prove.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bin/prove.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,19 @@
+<?php
+
+// handle --symfony_dir argument
+$symfony = null;
+foreach ($argv as $arg)
+{
+ $params = explode('=', $arg);
+ if (isset($params[1]) && $params[0] == '--symfony_dir')
+ {
+ $symfony = $params[1];
+ break;
+ }
+}
+
+include dirname(__FILE__).'/../bootstrap/sfPluginTestBootstrap.class.php';
+
+$bootstrap = new sfPluginTestBootstrap($symfony);
+$bootstrap->bootstrap();
+$bootstrap->run();
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/bootstrap.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/bootstrap.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/bootstrap.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,17 @@
+<?php
+
+include dirname(__FILE__).'/sfPluginTestBootstrap.class.php';
+$bootstrap = new sfPluginTestBootstrap();
+$bootstrap->bootstrap();
+
+$configuration = $bootstrap->getConfiguration();
+$context = $bootstrap->getContext();
+
+function doctrine_refresh()
+{
+ $args = func_get_args();
+ foreach ($args as $arg)
+ {
+ $arg->refresh();
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/sfPluginTestBootstrap.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/sfPluginTestBootstrap.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/bootstrap/sfPluginTestBootstrap.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,196 @@
+<?php
+
+class sfPluginTestBootstrap
+{
+ protected
+ $symfonyDir = null,
+ $configuration = null,
+ $context = null;
+ /**
+ *
+ * @var sfDatabaseManager
+ */
+ protected
+ $databasemanager = null;
+
+ public function __construct($symfonyDir = null)
+ {
+ if ($symfonyDir)
+ {
+ $this->setSymfonyDir($symfonyDir);
+ }
+
+ $this->setSymfonyPluginsDir(dirname(__FILE__).'/../../..');
+ }
+
+ public function teardown()
+ {
+ sfToolkit::clearDirectory(dirname(__FILE__).'/../fixtures/project/cache');
+ sfToolkit::clearDirectory(dirname(__FILE__).'/../fixtures/project/log');
+ }
+
+ public function setup()
+ {
+ $db = $this->databasemanager->getDatabase('doctrine');
+ /* @var $db sfDoctrineDatabase */
+
+ // Special Handling for postgre, since droping even when closing the connection, fails with
+ // SQLSTATE[55006]: Object in use: 7 ERROR: database "cs_doctrine_act_as_sortable_test" is being accessed by other users DETAIL: There are 1 other session(s) using the database.
+ if ($db->getDoctrineConnection() instanceof Doctrine_Connection_Pgsql) {
+ try {
+ $db->getDoctrineConnection()->createDatabase();
+ } catch (Exception $e) {
+
+ }
+ $export = new Doctrine_Export_Pgsql($db->getDoctrineConnection());
+ $import = new Doctrine_Import_Pgsql($db->getDoctrineConnection());
+ $tablenames = array(
+ SortableArticleTable::getInstance()->getTableName(),
+ SortableArticleUniqueByTable::getInstance()->getTableName(),
+ SortableArticleCategoryTable::getInstance()->getTableName()
+ );
+
+ foreach($tablenames as $tablename)
+ {
+ if ($import->tableExists($tablename)) {
+ $export->dropTable($tablename);
+ }
+ }
+ } else {
+ try {
+ // ignore error if database does not yet exist (clean CI-env)
+ $db->getDoctrineConnection()->dropDatabase();
+ } catch (Exception $e) {
+ }
+ $db->getDoctrineConnection()->createDatabase();
+ }
+
+ // Using Doctrine instead of Doctrine_Core keeps it symfony 1.2 compatible, which uses
+ Doctrine::loadModels(dirname(__FILE__).'/../fixtures/project/lib/model/doctrine', Doctrine::MODEL_LOADING_CONSERVATIVE);
+ Doctrine::createTablesFromArray(Doctrine::getLoadedModels());
+ Doctrine::loadData(dirname(__FILE__).'/../fixtures/project/data/fixtures/categories.yml');
+ }
+
+ // Find all tests and run them
+ public function run()
+ {
+ $h = new lime_harness(array('verbose' => true, 'output' => new lime_output_color()));
+ $h->register(sfFinder::type('file')->name('*Test.php')->in(dirname(__FILE__).'/..'));
+
+ exit($h->run() ? 0 : 1);
+ }
+
+ public function autoload($class)
+ {
+ $autoload = sfSimpleAutoload::getInstance();
+ $autoload->reload();
+ return $autoload->autoload($class);
+ }
+
+ public function getConfiguration()
+ {
+ return $this->configuration;
+ }
+
+ public function getContext()
+ {
+ return $this->context;
+ }
+
+ public function setSymfonyDir($symfonyDir)
+ {
+ if ($symfonyDir)
+ {
+ $this->symfonyDir = $symfonyDir;
+ $_SERVER['SYMFONY'] = $symfonyDir;
+ file_put_contents('/tmp/symfony_dir', $this->symfonyDir);
+ }
+ }
+
+ public function setSymfonyPluginsDir($pluginsDir)
+ {
+ $this->pluginsDir = $pluginsDir;
+ $_SERVER['SYMFONY_PLUGINS_DIR'] = $pluginsDir;
+ }
+
+ public function getSymfonyDir()
+ {
+ if (!$this->symfonyDir)
+ {
+ // Get path to symfony
+ if (isset($_SERVER['SYMFONY']))
+ {
+ $this->symfonyDir = $_SERVER['SYMFONY'];
+ }
+ elseif(file_exists('/tmp/symfony_dir'))
+ {
+ // Hack to allow the passing in of symfony_dir at runtime
+ $this->symfonyDir = file_get_contents('/tmp/symfony_dir');
+ $_SERVER['SYMFONY'] = $this->symfonyDir;
+ }
+ else
+ {
+ throw new Exception(sprintf("Symfony directory%s not found. Please set \$_SERVER['SYMFONY'] or provide a --symfony_dir argument", isset($_SERVER['SYMFONY']) ? " '$_SERVER[SYMFONY]'" : ''));
+ }
+ }
+
+ return $this->symfonyDir;
+ }
+
+ public function bootstrap($app = 'frontend', $debug = true)
+ {
+ // so that all notices will appear
+ error_reporting(E_ALL);
+
+ // Load symfony core and lime testing framework
+ require_once $this->getSymfonyDir().'/autoload/sfCoreAutoload.class.php';
+ sfCoreAutoload::register();
+
+ // Create configuration and context
+ require_once dirname(__FILE__).'/../fixtures/project/config/ProjectConfiguration.class.php';
+
+ $dbms = 'sqlite';
+ if (isset($_SERVER['DB']))
+ {
+ $dbms = strtolower($_SERVER['DB']);
+ }
+ if (!isset($_SERVER['DSN']))
+ {
+ // Check if configuration for dbms exists
+ if (!file_exists(dirname(__FILE__).'/../fixtures/project/config/database-' . $dbms . '.yml'))
+ {
+ throw new Exception('Didnt find database-'.$dbms. 'yml for DBMS: "' . $dbms . '"');
+ }
+
+ copy(dirname(__FILE__).'/../fixtures/project/config/database-' . $dbms . '.yml',
+ dirname(__FILE__).'/../fixtures/project/config/databases.yml');
+ }
+ else
+ {
+ $databaseConfiguration = <<<EOT
+all:
+ doctrine:
+ class: sfDoctrineDatabase
+ param:
+ dsn: {$_SERVER['DSN']}
+EOT;
+ file_put_contents(
+ dirname(__FILE__).'/../fixtures/project/config/databases.yml',
+ $databaseConfiguration
+ );
+ }
+ $this->configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', $debug);
+
+ require_once $this->configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
+ $this->context = sfContext::createInstance($this->configuration);
+
+ $this->databasemanager = new sfDatabaseManager($this->configuration);
+
+ // Register teardown / autoload functions
+ spl_autoload_register(array($this, 'autoload'));
+ register_shutdown_function(array($this, 'teardown'));
+
+ $this->teardown();
+ $this->setup();
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/app.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/app.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/app.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,11 @@
+all:
+ editable_content:
+
+ # class used to render the editable content areas
+ content_service_class: ioEditableContentService
+
+ content_service_options:
+ empty_text: "[Test edit]" # this content will be shown in place of empty content
+ edit_mode: inline # The default editor mode: fancybox|inline
+ admin_credential: test_credential # inline editing only made available to users with this credential
+ editable_class_name: test_editable_class_name
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/cache.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/cache.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/cache.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,7 @@
+# You can find more information about this file on the symfony website:
+#
http://www.symfony-project.org/reference/1_4/en/09-Cache
+
+default:
+ enabled: false
+ with_layout: false
+ lifetime: 86400
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/factories.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/factories.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/factories.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,42 @@
+# You can find more information about this file on the symfony website:
+#
http://www.symfony-project.org/reference/1_4/en/05-Factories
+
+prod:
+ logger:
+ class: sfNoLogger
+ param:
+ level: err
+ loggers: ~
+
+test:
+ storage:
+ class: sfSessionTestStorage
+ param:
+ session_path: %SF_TEST_CACHE_DIR%/sessions
+
+ response:
+ class: sfWebResponse
+ param:
+ send_http_headers: false
+
+ mailer:
+ param:
+ delivery_strategy: none
+
+dev:
+ mailer:
+ param:
+ delivery_strategy: none
+
+all:
+ routing:
+ class: sfPatternRouting
+ param:
+ generate_shortest_url: true
+ extra_parameters_as_query_string: true
+
+ view_cache_manager:
+ class: sfViewCacheManager
+ param:
+ cache_key_use_vary_headers: true
+ cache_key_use_host_name: true
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/filters.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/filters.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/filters.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,10 @@
+# You can find more information about this file on the symfony website:
+#
http://www.symfony-project.org/reference/1_4/en/12-Filters
+
+rendering: ~
+security: ~
+
+# insert your own filters here
+
+cache: ~
+execution: ~
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/frontendConfiguration.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/frontendConfiguration.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/frontendConfiguration.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,8 @@
+<?php
+
+class frontendConfiguration extends sfApplicationConfiguration
+{
+ public function configure()
+ {
+ }
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/routing.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/routing.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/routing.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,8 @@
+# You can find more information about this file on the symfony website:
+#
http://www.symfony-project.org/reference/1_4/en/10-Routing
+
+# default rules
+blog:
+ url: /blog
+ param: { module: test, action: blog}
+
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/security.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/security.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/security.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,5 @@
+# You can find more information about this file on the symfony website:
+#
http://www.symfony-project.org/reference/1_4/en/08-Security
+
+default:
+ is_secure: false
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/settings.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/settings.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/settings.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,35 @@
+# You can find more information about this file on the symfony website:
+#
http://www.symfony-project.org/reference/1_4/en/04-Settings
+
+prod:
+ .settings:
+ no_script_name: off
+ logging_enabled: false
+
+dev:
+ .settings:
+ error_reporting: <?php echo (E_ALL | E_STRICT)."\n" ?>
+ web_debug: true
+ cache: false
+ no_script_name: false
+ etag: false
+
+test:
+ .settings:
+ error_reporting: <?php echo ((E_ALL | E_STRICT) ^ E_NOTICE)."\n" ?>
+ cache: false
+ web_debug: false
+ no_script_name: false
+ etag: false
+
+all:
+ .settings:
+ # Form security secret (CSRF protection)
+ csrf_secret: ioEditableContentPlugin
+
+ # Output escaping settings
+ escaping_strategy: on
+ escaping_method: ESC_SPECIALCHARS
+
+ # Enable the database manager
+ use_database: true
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/view.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/view.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/config/view.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,20 @@
+# You can find more information about this file on the symfony website:
+#
http://www.symfony-project.org/reference/1_4/en/13-View
+
+default:
+ http_metas:
+ content-type: text/html
+
+ metas:
+ #title: symfony project
+ #description: symfony project
+ #keywords: symfony, project
+ #language: en
+ #robots: index, follow
+
+ stylesheets: [main.css]
+
+ javascripts: []
+
+ has_layout: true
+ layout: layout
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/lib/myUser.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/lib/myUser.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/lib/myUser.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,5 @@
+<?php
+
+class myUser extends sfBasicSecurityUser
+{
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/actions/actions.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/actions/actions.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/actions/actions.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,10 @@
+<?php
+
+class testActions extends sfActions
+{
+ // shows a screen where different editable content tags are rendered
+ public function executeBlog(sfWebRequest $request)
+ {
+ $this->blog = Doctrine_Core::getTable('Blog')->createQuery()->fetchOne();
+ }
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_body.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_body.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_body.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,2 @@
+<div>The body of the article</div>
+<div><?php echo $blog->getRaw('body') ?></div>
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_bodyForm.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_bodyForm.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_bodyForm.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,6 @@
+<?php echo $form['body']->renderError() ?>
+<?php echo $form['body']->render() ?>
+
+<?php foreach ($form->getErrorSchema()->getErrors() as $key => $error): ?>
+ <?php echo $key ?>
+<?php endforeach; ?>
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_link.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_link.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/_link.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1 @@
+<a href="<?php echo $blog->link_url ?>"><?php echo $blog->link_text ?></a>
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/blogSuccess.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/blogSuccess.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/test/templates/blogSuccess.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,11 @@
+<div class="test_title">
+ <?php echo editable_content_tag('h1', $blog, 'title') ?>
+</div>
+
+<div class="test_link">
+ <?php echo editable_content_tag('div', $blog, array('link_url', 'link_text'), array('partial' => 'test/link', 'mode' => 'fancybox')) ?>
+</div>
+
+<div class="test_body">
+ <?php echo editable_content_tag('div', $blog, null, array('partial' => 'test/body', 'form' => 'BlogBodyForm', 'form_partial' => 'test/bodyForm', 'class' => 'body')) ?>
+</div>
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/unit/templates/_blog.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/unit/templates/_blog.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/modules/unit/templates/_blog.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,3 @@
+<div class="var_name"><?php echo $var_name ?></div>
+<div class="obj_class"><?php echo get_class($blog->getRawValue()) ?></div>
+<div class="content"><?php echo $blog->title ?></div>
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/templates/layout.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/templates/layout.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/apps/frontend/templates/layout.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="
http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <?php include_http_metas() ?>
+ <?php include_metas() ?>
+ <?php include_title() ?>
+ <link rel="shortcut icon" href="/favicon.ico" />
+ <?php include_stylesheets() ?>
+ <?php include_javascripts() ?>
+ </head>
+ <body>
+ <?php echo $sf_content ?>
+ </body>
+</html>
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/ProjectConfiguration.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/ProjectConfiguration.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/ProjectConfiguration.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,21 @@
+<?php
+
+if (!isset($_SERVER['SYMFONY']))
+{
+ throw new RuntimeException('Could not find symfony core libraries.');
+}
+
+require_once $_SERVER['SYMFONY'].'/autoload/sfCoreAutoload.class.php';
+sfCoreAutoload::register();
+
+class ProjectConfiguration extends sfProjectConfiguration
+{
+ public function setup()
+ {
+ $this->setPlugins(array(
+ 'csDoctrineActAsSortablePlugin',
+ 'sfDoctrinePlugin',
+ ));
+ $this->setPluginPath('csDoctrineActAsSortablePlugin', dirname(__FILE__).'/../../../..');
+ }
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-mysql.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-mysql.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-mysql.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,5 @@
+all:
+ doctrine:
+ class: sfDoctrineDatabase
+ param:
+ dsn: 'mysql://root:@localhost/cs_doctrine_act_as_sortable_test'
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-postgre.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-postgre.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-postgre.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,5 @@
+all:
+ doctrine:
+ class: sfDoctrineDatabase
+ param:
+ dsn: 'pgsql://postgres:@localhost/cs_doctrine_act_as_sortable_test'
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-sqlite.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-sqlite.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/database-sqlite.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,5 @@
+all:
+ doctrine:
+ class: sfDoctrineDatabase
+ param:
+ dsn: 'sqlite:///%SF_DATA_DIR%/test.sqlite'
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/doctrine/schema.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/doctrine/schema.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/doctrine/schema.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,37 @@
+SortableArticle:
+ options:
+ symfony:
+ form: false
+ filter: false
+ columns:
+ name: string(255)
+ actAs:
+ Sortable: ~
+
+SortableArticleUniqueBy:
+ options:
+ symfony:
+ form: false
+ filter: false
+ actAs:
+ Sortable:
+ uniqueBy: [category_id]
+ columns:
+ name: string(255)
+ category_id:
+ type: integer(4)
+ notnull: true
+ unsigned: true
+ relations:
+ Category:
+ local: category_id
+ class: SortableArticleCategory
+
+SortableArticleCategory:
+ columns:
+ id:
+ type: integer(4)
+ primary: true
+ autoincrement: true
+ unsigned: true
+ name: string(100)
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/properties.ini
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/properties.ini (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/properties.ini 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,4 @@
+[symfony]
+ name=##PROJECT_NAME##
+ author=##AUTHOR_NAME##
+ orm=##ORM##
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/rsync_exclude.txt
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/rsync_exclude.txt (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/config/rsync_exclude.txt 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,15 @@
+# Project files
+/cache/*
+/log/*
+/web/*_dev.php
+/web/uploads/*
+
+# SCM files
+.arch-params
+.bzr
+_darcs
+.git
+.hg
+.monotone
+.svn
+CVS
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fixtures/categories.yml
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fixtures/categories.yml (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fixtures/categories.yml 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,9 @@
+SortableArticleCategory:
+ category_1:
+ name: Category 1
+ category_2:
+ name: Category 2
+ category_3:
+ name: Category 3
+ category_4:
+ name: Category 4
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fresh_test_db.sqlite
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/fresh_test_db.sqlite
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/sql/schema.sql
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/sql/schema.sql (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/data/sql/schema.sql 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,6 @@
+CREATE TABLE sortable_article (id BIGSERIAL, name VARCHAR(255), position BIGINT, PRIMARY KEY(id));
+CREATE TABLE sortable_article_category (id SERIAL, name VARCHAR(100), PRIMARY KEY(id));
+CREATE TABLE sortable_article_unique_by (id BIGSERIAL, name VARCHAR(255), category_id INT NOT NULL, position BIGINT, PRIMARY KEY(id));
+CREATE UNIQUE INDEX sortable_article_position_sortable ON sortable_article (position);
+CREATE UNIQUE INDEX sortable_article_unique_by_position_sortable ON sortable_article_unique_by (position, category_id);
+ALTER TABLE sortable_article_unique_by ADD CONSTRAINT scsi FOREIGN KEY (category_id) REFERENCES sortable_article_category(id) NOT DEFERRABLE INITIALLY IMMEDIATE;
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticle.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticle.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticle.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * SortableArticle
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ *
+ * @package ##PROJECT_NAME##
+ * @subpackage model
+ * @author ##AUTHOR_NAME##
+ * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
+ */
+class SortableArticle extends BaseSortableArticle
+{
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategory.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategory.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategory.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * SortableArticleCategory
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ *
+ * @package ##PROJECT_NAME##
+ * @subpackage model
+ * @author ##AUTHOR_NAME##
+ * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
+ */
+class SortableArticleCategory extends BaseSortableArticleCategory
+{
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategoryTable.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategoryTable.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleCategoryTable.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * SortableArticleCategoryTable
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ */
+class SortableArticleCategoryTable extends Doctrine_Table
+{
+ /**
+ * Returns an instance of this class.
+ *
+ * @return object SortableArticleCategoryTable
+ */
+ public static function getInstance()
+ {
+ return Doctrine::getTable('SortableArticleCategory');
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleTable.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleTable.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleTable.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * SortableArticleTable
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ */
+class SortableArticleTable extends Doctrine_Table
+{
+ /**
+ * Returns an instance of this class.
+ *
+ * @return object SortableArticleTable
+ */
+ public static function getInstance()
+ {
+ return Doctrine::getTable('SortableArticle');
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueBy.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueBy.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueBy.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * SortableArticleUniqueBy
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ *
+ * @package ##PROJECT_NAME##
+ * @subpackage model
+ * @author ##AUTHOR_NAME##
+ * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
+ */
+class SortableArticleUniqueBy extends BaseSortableArticleUniqueBy
+{
+}
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueByTable.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueByTable.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/SortableArticleUniqueByTable.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * SortableArticleUniqueByTable
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ */
+class SortableArticleUniqueByTable extends Doctrine_Table
+{
+ /**
+ * Returns an instance of this class.
+ *
+ * @return object SortableArticleUniqueByTable
+ */
+ public static function getInstance()
+ {
+ return Doctrine::getTable('SortableArticleUniqueBy');
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticle.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticle.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticle.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * BaseSortableArticle
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ *
+ * @property string $name
+ *
+ * @method string getName() Returns the current record's "name" value
+ * @method SortableArticle setName() Sets the current record's "name" value
+ *
+ * @package ##PROJECT_NAME##
+ * @subpackage model
+ * @author ##AUTHOR_NAME##
+ * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
+ */
+abstract class BaseSortableArticle extends sfDoctrineRecord
+{
+ public function setTableDefinition()
+ {
+ $this->setTableName('sortable_article');
+ $this->hasColumn('name', 'string', 255, array(
+ 'type' => 'string',
+ 'length' => 255,
+ ));
+
+ $this->option('symfony', array(
+ 'form' => false,
+ 'filter' => false,
+ ));
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+ $sortable0 = new Doctrine_Template_Sortable();
+ $this->actAs($sortable0);
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleCategory.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleCategory.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleCategory.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * BaseSortableArticleCategory
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ *
+ * @property integer $id
+ * @property string $name
+ * @property Doctrine_Collection $SortableArticleUniqueBy
+ *
+ * @method integer getId() Returns the current record's "id" value
+ * @method string getName() Returns the current record's "name" value
+ * @method Doctrine_Collection getSortableArticleUniqueBy() Returns the current record's "SortableArticleUniqueBy" collection
+ * @method SortableArticleCategory setId() Sets the current record's "id" value
+ * @method SortableArticleCategory setName() Sets the current record's "name" value
+ * @method SortableArticleCategory setSortableArticleUniqueBy() Sets the current record's "SortableArticleUniqueBy" collection
+ *
+ * @package ##PROJECT_NAME##
+ * @subpackage model
+ * @author ##AUTHOR_NAME##
+ * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
+ */
+abstract class BaseSortableArticleCategory extends sfDoctrineRecord
+{
+ public function setTableDefinition()
+ {
+ $this->setTableName('sortable_article_category');
+ $this->hasColumn('id', 'integer', 4, array(
+ 'type' => 'integer',
+ 'primary' => true,
+ 'autoincrement' => true,
+ 'unsigned' => true,
+ 'length' => 4,
+ ));
+ $this->hasColumn('name', 'string', 100, array(
+ 'type' => 'string',
+ 'length' => 100,
+ ));
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->hasMany('SortableArticleUniqueBy', array(
+ 'local' => 'id',
+ 'foreign' => 'category_id'));
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleUniqueBy.class.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleUniqueBy.class.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/lib/model/doctrine/base/BaseSortableArticleUniqueBy.class.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * BaseSortableArticleUniqueBy
+ *
+ * This class has been auto-generated by the Doctrine ORM Framework
+ *
+ * @property string $name
+ * @property integer $category_id
+ * @property SortableArticleCategory $Category
+ *
+ * @method string getName() Returns the current record's "name" value
+ * @method integer getCategoryId() Returns the current record's "category_id" value
+ * @method SortableArticleCategory getCategory() Returns the current record's "Category" value
+ * @method SortableArticleUniqueBy setName() Sets the current record's "name" value
+ * @method SortableArticleUniqueBy setCategoryId() Sets the current record's "category_id" value
+ * @method SortableArticleUniqueBy setCategory() Sets the current record's "Category" value
+ *
+ * @package ##PROJECT_NAME##
+ * @subpackage model
+ * @author ##AUTHOR_NAME##
+ * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
+ */
+abstract class BaseSortableArticleUniqueBy extends sfDoctrineRecord
+{
+ public function setTableDefinition()
+ {
+ $this->setTableName('sortable_article_unique_by');
+ $this->hasColumn('name', 'string', 255, array(
+ 'type' => 'string',
+ 'length' => 255,
+ ));
+ $this->hasColumn('category_id', 'integer', 4, array(
+ 'type' => 'integer',
+ 'notnull' => true,
+ 'unsigned' => true,
+ 'length' => 4,
+ ));
+
+ $this->option('symfony', array(
+ 'form' => false,
+ 'filter' => false,
+ ));
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->hasOne('SortableArticleCategory as Category', array(
+ 'local' => 'category_id',
+ 'foreign' => 'id'));
+
+ $sortable0 = new Doctrine_Template_Sortable(array(
+ 'uniqueBy' =>
+ array(
+ 0 => 'category_id',
+ ),
+ ));
+ $this->actAs($sortable0);
+ }
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/symfony
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/symfony (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/fixtures/project/symfony 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,14 @@
+#!/usr/bin/env php
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) Fabien Potencier <
fabien.p...@symfony-project.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+chdir(dirname(__FILE__));
+require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php');
+include(sfCoreAutoload::getInstance()->getBaseDir().'/command/cli.php');
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableBatchTest.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableBatchTest.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableBatchTest.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,51 @@
+<?php
+
+require_once dirname(__FILE__).'/../bootstrap/bootstrap.php';
+
+$t = new lime_test();
+
+$categories = Doctrine::getTable('SortableArticleCategory')->findAll();
+
+$t->info('Create Sortable Sample Set');
+
+ Doctrine::getTable('SortableArticle')
+ ->createQuery()->delete()->execute();
+
+ $a1 = new SortableArticleUniqueBy();
+ $a1->name = 'First Article';
+ $a1->Category = $categories[0];
+ $a1->save();
+
+ $a2 = new SortableArticleUniqueBy();
+ $a2->name = 'Second Article';
+ $a2->Category = $categories[0];
+ $a2->save();
+
+ $a3 = new SortableArticleUniqueBy();
+ $a3->name = 'Third Article';
+ $a3->Category = $categories[0];
+ $a3->save();
+
+ $a4 = new SortableArticleUniqueBy();
+ $a4->name = 'Fourth Article';
+ $a4->Category = $categories[0];
+ $a4->save();
+
+ $a5 = new SortableArticleUniqueBy();
+ $a5->name = 'Fifth Article';
+ $a5->Category = $categories[0];
+ $a5->save();
+
+$t->info('Fetch articles and delete them like in batchDelete');
+
+ $articles = Doctrine::getTable('SortableArticleUniqueBy')
+ ->createQuery()->execute();
+
+ try {
+ foreach($articles as $article) {
+ $article->delete();
+ $t->pass(sprintf('Successfully deleted article %s', $article['id']));
+ }
+ } catch (Exception $e) {
+ $t->fail('Failure while batch-deleting ' . $e->getMessage());
+ }
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableTest.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableTest.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableTest.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,109 @@
+<?php
+
+require_once dirname(__FILE__).'/../bootstrap/bootstrap.php';
+
+$t = new lime_test();
+
+$t->info('Create Sortable Sample Set');
+
+ Doctrine::getTable('SortableArticle')
+ ->createQuery()->delete()->execute();
+
+ $a1 = new SortableArticle();
+ $a1->name = 'First Article';
+ $a1->save();
+
+ $a2 = new SortableArticle();
+ $a2->name = 'Second Article';
+ $a2->save();
+
+ $a3 = new SortableArticle();
+ $a3->name = 'Third Article';
+ $a3->save();
+
+$t->info('Assert articles have thecorrect position');
+
+ $t->is($a1['position'], 1, 'First item saved has position of 1');
+ $t->is($a2['position'], 2, 'Second item saved has position of 2');
+ $t->is($a3['position'], 3, 'Third item saved has position of 3');
+
+$t->info('Test Demote and Promote');
+
+ $a1->demote(); doctrine_refresh($a2);
+ $t->is($a1['position'], 2, 'First item now has position of 2');
+ $t->is($a2['position'], 1, 'Second item now has position of 1');
+
+ $a3->promote(); doctrine_refresh($a1);
+ $t->is($a1['position'], 3, 'First item now has position of 3');
+ $t->is($a3['position'], 2, 'Third item now has position of 2');
+
+$t->info('Test Table Method "sort()"');
+
+ $table = $a1->getTable();
+ $sort = array($a1['id'], $a2['id'], $a3['id']);
+ $table->sort($sort);
+
+ $t->comment('Sort to original position (before promote/demote)');
+ $articles = $table->findAllSorted();
+ $t->is($articles->count(), 3, 'Three articles returned for "findAllSorted()" method');
+ $t->is($articles[0]['id'], $a1['id'], 'First item is now first');
+ $t->is($articles[1]['id'], $a2['id'], 'Second item is now second');
+ $t->is($articles[2]['id'], $a3['id'], 'Third item is last');
+
+ $t->comment('Sort to previous position (after promote/demote)');
+ $sort = array($a2['id'], $a3['id'], $a1['id']);
+ $table->sort($sort);
+ $articles = $table->findAllSorted();
+ $t->is($articles->count(), 3, 'Three articles returned for "findAllSorted()" method');
+ $t->is($articles[0]['id'], $a2['id'], 'Second item first (same as position)');
+ $t->is($articles[1]['id'], $a3['id'], 'Third item second (same as position)');
+ $t->is($articles[2]['id'], $a1['id'], 'First item last (same as position)');
+
+$t->info('Test Removing an item - items after it should be promoted');
+
+ $t->is($a2->getFinalPosition(), 3, '"Final Position" is "3" before the item is deleted');
+ $a3->delete(); doctrine_refresh($a1);
+ $t->is($a1['position'], 2, '"First item" has been promoted to "2" from "3"');
+ $t->is($a2['position'], 1, '"Second item" stays at position "1"');
+ $t->is($a2->getFinalPosition(), 2, '"Final Position" is now "2"');
+
+$t->info('Test "moveToPosition" method');
+
+ $a4 = new SortableArticle();
+ $a4->name = 'Fourth Article';
+ $a4->save();
+
+ $t->is($a4['position'], 3, 'The new article is placed at the end');
+ $a4->moveToPosition(1); doctrine_refresh($a1);
+ $t->is($a1['position'], 3, 'The 2nd-positioned item has been bumped up');
+
+$t->info('Test deleting a collection of sortable items');
+
+ $d1 = new SortableArticle();
+ $d1->name = 'Article To Delete 1';
+ $d1->save();
+
+ $d2 = new SortableArticle();
+ $d2->name = 'Article To Delete 2';
+ $d2->save();
+
+ $d3 = new SortableArticle();
+ $d3->name = 'Article To Delete 3';
+ $d3->save();
+
+ $d4 = new SortableArticle();
+ $d4->name = 'Article To Delete 4';
+ $d4->save();
+
+ $collection = new Doctrine_Collection('SortableArticle');
+ $collection[] = $d1;
+ $collection[] = $d2;
+ $collection[] = $d3;
+ $collection[] = $d4;
+
+ $collection->delete();
+
+ $t->ok(!$d1->exists(), '"Article To Delete 1" has been removed');
+ $t->ok(!$d2->exists(), '"Article To Delete 2" has been removed');
+ $t->ok(!$d3->exists(), '"Article To Delete 3" has been removed');
+ $t->ok(!$d4->exists(), '"Article To Delete 4" has been removed');
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableUniqueByTest.php
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableUniqueByTest.php (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/test/unit/SortableUniqueByTest.php 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,115 @@
+<?php
+
+require_once dirname(__FILE__).'/../bootstrap/bootstrap.php';
+
+$t = new lime_test();
+
+$categories = Doctrine::getTable('SortableArticleCategory')->findAll();
+
+$t->info('Create Sortable Sample Set');
+
+ Doctrine::getTable('SortableArticleUniqueBy')
+ ->createQuery()->delete()->execute();
+
+ $a1 = new SortableArticleUniqueBy();
+ $a1->name = 'First Article';
+ $a1->Category = $categories[0];
+ $a1->save();
+
+ $a2 = new SortableArticleUniqueBy();
+ $a2->name = 'Second Article';
+ $a2->Category = $categories[0];
+ $a2->save();
+
+ $a3 = new SortableArticleUniqueBy();
+ $a3->name = 'Third Article';
+ $a3->Category = $categories[1];
+ $a3->save();
+
+ $a4 = new SortableArticleUniqueBy();
+ $a4->name = 'Fourth Article';
+ $a4->Category = $categories[1];
+ $a4->save();
+
+ $a5 = new SortableArticleUniqueBy();
+ $a5->name = 'Fifth Article';
+ $a5->Category = $categories[1];
+ $a5->save();
+
+$t->info('Assert articles have the correct position');
+
+ $t->is($a1['position'], 1, 'First item saved has position of 1 (first in category 1)');
+ $t->is($a2['position'], 2, 'Second item saved has position of 2 (second in category 1)');
+ $t->is($a3['position'], 1, 'Third item saved has position of 1 (first in category 2)');
+ $t->is($a4['position'], 2, 'Fourth item saved has position of 2 (second in category 2)');
+ $t->is($a5['position'], 3, 'Fifth item saved has position of 3 (third in category 2)');
+
+$t->info('Test Demote and Promote');
+
+ $a1->demote(); doctrine_refresh($a2);
+ $t->is($a1['position'], 2, 'First item now has position of 2');
+ $t->is($a2['position'], 1, 'Second item now has position of 1');
+
+ $a3->demote(); doctrine_refresh($a4);
+ $t->is($a3['position'], 2, 'Third item now has position of 2');
+ $t->is($a4['position'], 1, 'Fourth item now has position of 1');
+ $t->is($a5['position'], 3, 'Fifth item still has a position of 3');
+
+$t->info('Test Removing an item - items after it should be promoted');
+
+ $a2->delete(); doctrine_refresh($a1);
+ $t->is($a1['position'], 1, '"First item" has been promoted to "1" from "2"');
+
+ $a4->delete(); doctrine_refresh($a3, $a5);
+ $t->is($a3['position'], 1, '"Third item" has been promoted to "1" from "2"');
+ $t->is($a5['position'], 2, '"Fifth item" has been promoted to "2" from "3"');
+
+$t->info('Test Moving an item to a different category with an item already at the same rank');
+
+ try {
+ $a1->Category = $categories[1];
+ $a1->save();
+ } catch (Doctrine_Connection_Sqlite_Exception $e) {
+ $t->info('WARNING: Doctrine_Connection_Sqlite_Exception caught.');
+ }
+ doctrine_refresh($a1);
+ $t->is($a1['category_id'], $categories[1]['id'], sprintf('"First item" has been moved to %s', $a3['Category']['name']));
+ $t->is($a1['position'], 3, '"First item" has been moved to "3" from "1"');
+
+$t->info('Test deleting a collection of sortable items');
+
+ $d1 = new SortableArticleUniqueBy();
+ $d1->name = 'ArticleUniqueBy To Delete 1';
+ $d1->Category = $categories[2];
+ $d1->save();
+
+ $d2 = new SortableArticleUniqueBy();
+ $d2->name = 'ArticleUniqueBy To Delete 2';
+ $d2->Category = $categories[2];
+ $d2->save();
+
+ $d3 = new SortableArticleUniqueBy();
+ $d3->name = 'ArticleUniqueBy To Delete 3';
+ $d3->Category = $categories[2];
+ $d3->save();
+
+ $d4 = new SortableArticleUniqueBy();
+ $d4->name = 'ArticleUniqueBy To Delete 4';
+ $d4->Category = $categories[2];
+ $d4->save();
+
+ $collection = Doctrine::getTable('SortableArticleUniqueBy')
+ ->createQuery()
+ ->where('category_id = ?', $categories[2]['id'])
+ ->execute();
+
+ $t->is($collection->count(), 4, 'Three items exist in the Doctrine Collection to be deleted');
+
+ $collection->delete();
+
+ $t->is($collection->count(), 0, 'No items in collection - they have been deleted');
+
+ $t->ok(!$d1->exists(), '"ArticleUniqueBy To Delete 1" has been removed');
+ $t->ok(!$d2->exists(), '"ArticleUniqueBy To Delete 2" has been removed');
+ $t->ok(!$d3->exists(), '"ArticleUniqueBy To Delete 3" has been removed');
+ $t->ok(!$d4->exists(), '"ArticleUniqueBy To Delete 4" has been removed');
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/css/sortable.css
===================================================================
--- trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/css/sortable.css (rev 0)
+++ trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/css/sortable.css 2014-06-17 08:44:55 UTC (rev 4110)
@@ -0,0 +1,19 @@
+#sf_admin_container ul li.sf_admin_action_promote a
+{
+ background-image:none;
+}
+#sf_admin_container ul li.sf_admin_action_demote a
+{
+ background-image:none;
+}
+#sf_admin_container ul li.sf_admin_action_promote
+{
+ background:transparent url(../images/sortable/icons/promote.png) no-repeat scroll 0 0;
+}
+#sf_admin_container ul li.sf_admin_action_demote
+{
+ background:transparent url(../images/sortable/icons/demote.png) no-repeat scroll 0 0;
+}
+#sf_admin_container ul.sf_admin_td_actions {
+ width:120px !important;
+}
\ No newline at end of file
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/icons/demote.png
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/icons/demote.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/icons/promote.png
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/ullCorePlugin/lib/vendor/csDoctrineActAsSortablePlugin/web/images/sortable/icons/promote.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream