Author: garak
Date: 2010-03-31 16:35:11 +0200 (Wed, 31 Mar 2010)
New Revision: 28925
Added:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/filter/base/
plugins/sfAssetsLibraryPlugin/branches/garak/lib/form/base/
plugins/sfAssetsLibraryPlugin/branches/garak/test/bootstrap/
plugins/sfAssetsLibraryPlugin/branches/garak/test/bootstrap/functional.php
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/demo1.png
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/01_folders.yml
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/02_assets.yml
plugins/sfAssetsLibraryPlugin/branches/garak/test/functional/
plugins/sfAssetsLibraryPlugin/branches/garak/test/functional/sfAssetActionsTest.php
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolder.php
plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolderPeer.php
plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetException.class.php
plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetsLibraryTools.class.php
plugins/sfAssetsLibraryPlugin/branches/garak/lib/task/sfAssetCreateRootTask.class.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.fr.xml
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.it.xml
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/lib/BasesfAssetActions.class.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_asset.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_list.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_edit.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_list.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/editSuccess.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/listSuccess.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/searchSuccess.php
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/tinyConfigMediaSuccess.php
Log:
[sfAssetsLibraryPlugin] added first suite of functional tests
Property changes on:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/filter/base
___________________________________________________________________
Added: svn:ignore
+ *
Property changes on: plugins/sfAssetsLibraryPlugin/branches/garak/lib/form/base
___________________________________________________________________
Added: svn:ignore
+ *
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolder.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolder.php
2010-03-31 14:23:17 UTC (rev 28924)
+++ plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolder.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -246,7 +246,7 @@
if ($success)
{
$folders = sfFinder::type('dir')->maxdepth(0)->in($old_path);
- foreach($folders as $folder)
+ foreach ($folders as $folder)
{
$new_name = substr($folder, strlen($old_path));
$success = self::movePhysically($folder, $new_path . '/' . $new_name)
&& $success;
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolderPeer.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolderPeer.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/lib/model/sfAssetFolderPeer.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -147,14 +147,15 @@
{
$path = trim($path, '/');
$root_name = sfConfig::get('app_sfAssetsLibrary_upload_dir', 'media');
- if(!$path)
+ if (!$path)
{
$path = $root_name;
}
- elseif(strpos($path, $root_name) !== 0)
+ elseif (strpos($path, $root_name) !== 0)
{
$path = $root_name . '/' . $path;
}
+
return $path;
}
}
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetException.class.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetException.class.php
2010-03-31 14:23:17 UTC (rev 28924)
+++ plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetException.class.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -1,18 +1,18 @@
-<?php
-/*
- * This file is part of the sfAssetsLibrary package.
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
+<?php
+/*
+ * This file is part of the sfAssetsLibrary package.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
* sfAssetsException
- * Model exceptions for the sfAssetsLibrary plugin
- *
- * @author Magénération
- */
-class sfAssetException extends sfException
+ * Model exceptions for the sfAssetsLibrary plugin
+ *
+ * @author Magénération
+ */
+class sfAssetException extends sfException
{
protected $message_params = array();
@@ -30,5 +30,5 @@
public function getMessageParams()
{
return $this->message_params;
- }
-}
\ No newline at end of file
+ }
+}
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetsLibraryTools.class.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetsLibraryTools.class.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/lib/sfAssetsLibraryTools.class.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -335,7 +335,7 @@
else
{
list($w, $h, $type, $attr) = getimagesize($source);
- $newHeight = ceil(($width * $h) / $w);
+ $newHeight = $width ? ceil(($width * $h) / $w) : $height;
$thumbnail = new sfThumbnail($width, $newHeight, true, true, 85,
$adapter);
$thumbnail->loadFile($source);
$thumbnail->save($dest, $mime);
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/lib/task/sfAssetCreateRootTask.class.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/lib/task/sfAssetCreateRootTask.class.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/lib/task/sfAssetCreateRootTask.class.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -37,19 +37,19 @@
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
-
- if(sfAssetFolderPeer::retrieveRoot())
+
+ if (sfAssetFolderPeer::retrieveRoot())
{
throw new sfException('The asset library already has a root');
}
-
+
$this->logSection('asset', sprintf('Creating root node at %s...',
sfConfig::get('app_sfAssetsLibrary_upload_dir', 'media')), null, 'COMMENT');
-
+
$folder = new sfAssetFolder();
$folder->setName(sfConfig::get('app_sfAssetsLibrary_upload_dir', 'media'));
sfAssetFolderPeer::createRoot($folder);
$folder->save();
-
+
$this->logSection('asset', 'Root Node Created', null, 'INFO');
}
}
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.fr.xml
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.fr.xml
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.fr.xml
2010-03-31 14:35:11 UTC (rev 28925)
@@ -167,16 +167,16 @@
<target>[1]Un sous-répertoire|(1,+Inf)%nb% sous-répertoires</target>
</trans-unit>
<trans-unit>
- <source>[1]One file, %weight% Kb|(1,+Inf]%nb% files, %weight%
Kb</source>
- <target>[1]Un fichier, %weight% Ko|(1,+Inf]%nb% fichiers, %weight%
Ko</target>
+ <source>[1]One file, %weight% KiB|(1,+Inf]%nb% files, %weight%
KiB</source>
+ <target>[1]Un fichier, %weight% Kio|(1,+Inf]%nb% fichiers, %weight%
Kio</target>
</trans-unit>
<trans-unit>
<source>See full-size version</source>
<target>Voir la version originale</target>
</trans-unit>
<trans-unit>
- <source>%weight% Kb</source>
- <target>%weight% Ko</target>
+ <source>%weight% KiB</source>
+ <target>%weight% Kio</target>
</trans-unit>
<trans-unit>
<source>Created on %date%</source>
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.it.xml
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.it.xml
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/i18n/sfAsset.it.xml
2010-03-31 14:35:11 UTC (rev 28925)
@@ -167,8 +167,8 @@
<target>[1]Una sottocartella|(1,+Inf]%nb% sottocartelle</target>
</trans-unit>
<trans-unit>
- <source>[1]One file, %weight% Kb|(1,+Inf]%nb% files, %weight%
Kb</source>
- <target>[1]Un file, %weight% Ko|(1,+Inf]%nb% file, %weight% Ko</target>
+ <source>[1]One file, %weight% KiB|(1,+Inf]%nb% files, %weight%
KiB</source>
+ <target>[1]Un file, %weight% KiB|(1,+Inf]%nb% file, %weight%
KiB</target>
</trans-unit>
<trans-unit>
<source>See full-size version</source>
@@ -176,7 +176,7 @@
</trans-unit>
<trans-unit>
<source>%weight% Kb</source>
- <target>%weight% Ko</target>
+ <target>%weight% Kb</target>
</trans-unit>
<trans-unit>
<source>Created on %date%</source>
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/lib/BasesfAssetActions.class.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/lib/BasesfAssetActions.class.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/lib/BasesfAssetActions.class.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -257,8 +257,9 @@
public function executeRenameFolder(sfWebRequest $request)
{
$this->forward404Unless($request->getMethod() == sfRequest::POST, 'method
not allowed');
- $sf_asset_folder = $request->getParameter('sf_asset_folder');
- $folder = sfAssetFolderPeer::retrieveByPk($sf_asset_folder['id']);
+ $sfAssetFolder = $request->getParameter('sf_asset_folder');
+#print_r( $sfAssetFolder ); die;
+ $folder = sfAssetFolderPeer::retrieveByPk($sfAssetFolder['id']);
$this->forward404Unless($folder, 'folder not found');
$this->form = new sfAssetFolderRenameForm($folder);
$this->form->bind($request->getParameter($this->form->getName()));
@@ -281,7 +282,7 @@
public function executeDeleteFolder(sfWebRequest $request)
{
- $this->forward404Unless($request->isMethod(sfRequest::POST));
+ $this->forward404Unless($request->isMethod(sfRequest::DELETE), 'method not
allowed');
$folder = sfAssetFolderPeer::retrieveByPk($request->getParameter('id'));
$this->forward404Unless($folder);
try
@@ -400,6 +401,7 @@
public function executeDeleteAsset(sfWebRequest $request)
{
+ $this->forward404Unless($request->isMethod(sfRequest::DELETE), 'method not
allowed');
$sf_asset = sfAssetPeer::retrieveByPk($request->getParameter('id'));
$this->forward404Unless($sf_asset, 'asset not found');
$folderPath = $sf_asset->getFolderPath();
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_asset.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_asset.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_asset.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -7,10 +7,10 @@
<div class="assetComment">
<?php echo auto_wrap_text($sf_asset->getFilename()) ?>
<div class="details">
- <?php echo $sf_asset->getFilesize() ?> Ko
+ <?php echo $sf_asset->getFilesize() ?> KiB
<?php if (!$sf_user->hasAttribute('popup',
'sf_admin/sf_asset/navigation')): ?>
- <?php echo
link_to(image_tag('/sfAssetsLibraryPlugin/images/delete.png', 'alt=delete
class=deleteImage align=top'),
'@sf_asset_library_delete_asset?id='.$sf_asset->getId(), array('title' =>
__('Delete'), 'confirm' => __('Are you sure?'))); ?>
- <?php endif; ?>
+ <?php echo
link_to(image_tag('/sfAssetsLibraryPlugin/images/delete.png', 'alt=delete
class=deleteImage align=top'),
'@sf_asset_library_delete_asset?id='.$sf_asset->getId(), array('title' =>
__('Delete'), 'confirm' => __('Are you sure?'))) ?>
+ <?php endif ?>
</div>
</div>
</div>
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_list.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_list.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_list.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -10,7 +10,7 @@
</div>
<div class="assetComment" id="ajax_dir_0">..</div>
</div>
-<?php endif; ?>
+<?php endif ?>
<?php foreach ($dirs as $dir): ?>
<div class="assetImage">
@@ -20,8 +20,8 @@
<div class="assetComment"><?php echo auto_wrap_text($dir->getName()) ?>
</div>
</div>
-<?php endforeach; ?>
+<?php endforeach ?>
<?php foreach ($files as $sf_asset): ?>
<?php include_partial('sfAsset/asset', array('sf_asset' => $sf_asset,
'folder' => $folder)) ?>
-<?php endforeach; ?>
\ No newline at end of file
+<?php endforeach ?>
\ No newline at end of file
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_edit.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_edit.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_edit.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -18,7 +18,7 @@
<div class="content" id="input_new_name" style="display:none">
<?php echo $renameform['filename'] ?>
<?php echo $renameform->renderHiddenFields() ?>
- <input type="submit" value="<?php echo __('Ok', null, 'sfAsset') ?>" />
+ <input type="submit" value="<?php echo __('Rename', null, 'sfAsset') ?>"
/>
</div>
</div>
</form>
@@ -33,7 +33,7 @@
<div class="content" id="input_move_folder" style="display:none">
<?php echo $moveform['parent_folder'] ?>
<?php echo $moveform->renderHiddenFields() ?>
- <input type="submit" value="<?php echo __('Ok', null, 'sfAsset') ?>" />
+ <input type="submit" value="<?php echo __('Move', null, 'sfAsset') ?>" />
</div>
</div>
</form>
@@ -56,7 +56,7 @@
<div class="form-row">
<?php echo image_tag('/sfAssetsLibraryPlugin/images/page_delete.png',
'alt=delete align=top') ?>
<?php echo link_to(__('Delete', null, 'sfAsset'),
'@sf_asset_library_delete_asset?id='.$sf_asset->getId(), array(
- 'post' => true,
+ 'method' => 'delete',
'confirm' => __('Are you sure?', null, 'sfAsset'),
)) ?>
</div>
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_list.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_list.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/_sidebar_list.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -45,7 +45,7 @@
</label>
<div class="content" id="input_new_name" style="display:none">
<?php echo $renameform['name'] ?>
- <input type="submit" value="<?php echo __('Ok', null, 'sfAsset') ?>" />
+ <input type="submit" value="<?php echo __('Rename', null, 'sfAsset') ?>" />
</div>
</div>
<?php echo $renameform->renderHiddenFields() ?>
@@ -54,13 +54,13 @@
<form action="<?php echo url_for('@sf_asset_library_move_folder') ?>"
method="post">
<?php echo $moveform['id'] ?>
<div class="form-row">
- <label for="new_folder">
+ <label for="move_folder">
<?php echo image_tag('/sfAssetsLibraryPlugin/images/folder_go.png',
'alt=go align=top') ?>
<?php echo link_to_function(__('Move folder', null, 'sfAsset'),
'document.getElementById("input_move_folder").style.display="block"') ?>
</label>
<div class="content" id="input_move_folder" style="display:none">
<?php echo $moveform['parent_folder'] ?>
- <input type="submit" value="<?php echo __('Ok', null, 'sfAsset') ?>" />
+ <input type="submit" value="<?php echo __('Move', null, 'sfAsset') ?>" />
</div>
</div>
<?php echo $moveform->renderHiddenFields() ?>
@@ -69,7 +69,7 @@
<div class="form-row">
<?php echo image_tag('/sfAssetsLibraryPlugin/images/folder_delete.png',
'alt=delete align=top') ?>
<?php echo link_to(__('Delete folder', null, 'sfAsset'),
'@sf_asset_library_delete_folder?id='.$folder->getId(), array(
- 'post' => true,
+ 'method' => 'delete',
'confirm' => __('Are you sure?', null, 'sfAsset'),
)) ?>
</div>
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/editSuccess.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/editSuccess.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/editSuccess.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -6,7 +6,7 @@
<?php include_partial('sfAsset/edit_header', array('sf_asset' => $sf_asset)) ?>
<div id="sf_asset_bar">
- <?php include_partial('sfAsset/sidebar_edit', array('sf_asset' => $sf_asset,
'renameform' => $renameform, 'moveform' => $moveform, 'replaceform' =>
$replaceform)); ?>
+ <?php include_partial('sfAsset/sidebar_edit', array('sf_asset' => $sf_asset,
'renameform' => $renameform, 'moveform' => $moveform, 'replaceform' =>
$replaceform)) ?>
</div>
<div id="sf_asset_container">
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/listSuccess.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/listSuccess.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/listSuccess.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -5,18 +5,18 @@
<?php if (!$popup) : ?>
<?php include_partial('list_header', array('folder' => $folder)) ?>
-<?php endif; ?>
+<?php endif ?>
<div id="sf_asset_bar">
<p><?php echo $folder->getName() ?></p>
<?php if ($nb_dirs || $nb_files): ?>
<?php if ($nb_dirs): ?>
<p><?php echo format_number_choice('[1]One subfolder|(1,+Inf]%nb%
subfolders', array('%nb%' => $nb_dirs), $nb_dirs, 'sfAsset') ?></p>
- <?php endif; ?>
+ <?php endif ?>
<?php if ($nb_files): ?>
<p><?php echo format_number_choice('[1]One file, %weight%
Kb|(1,+Inf]%nb% files, %weight% Kb', array('%nb%' => $nb_files, '%weight%' =>
$total_size), $nb_files, 'sfAsset') ?></p>
- <?php endif; ?>
- <?php endif; ?>
+ <?php endif ?>
+ <?php endif ?>
<?php include_partial('sfAsset/sidebar_sort') ?>
<?php include_partial('sfAsset/sidebar_search', array('form' =>
$filterform)) ?>
<?php include_partial('sfAsset/sidebar_list', array('folder' => $folder,
'fileform' => $fileform, 'folderform' => $folderform, 'renameform' =>
$renameform, 'moveform' => $moveform)) ?>
@@ -33,4 +33,4 @@
<?php if (!$popup) : ?>
<?php include_partial('sfAsset/list_footer', array('folder' => $folder)) ?>
-<?php endif; ?>
\ No newline at end of file
+<?php endif ?>
\ No newline at end of file
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/searchSuccess.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/searchSuccess.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/searchSuccess.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -4,7 +4,7 @@
<?php if (!$popup) : ?>
<?php include_partial('search_header') ?>
-<?php endif; ?>
+<?php endif ?>
<div id="sf_asset_bar">
<p><?php echo link_to(__('Back to the list', null, 'sfAsset'),
'@sf_asset_library_list') ?></p>
@@ -20,31 +20,31 @@
<?php echo
assets_library_breadcrumb($sf_asset->getFolderPath(ESC_RAW), true, 'list')
?><?php echo link_to_asset_action($sf_asset->getFilename(), $sf_asset) ?><br />
<?php if ($description = $sf_asset->getDescription(ESC_RAW)): ?>
<?php echo $description ?><br />
- <?php endif; ?>
+ <?php endif ?>
<?php if ($copyright = $sf_asset->getCopyright(ESC_RAW)): ?>
<?php echo __('Copyright: %copyright%', array('%copyright%' =>
$copyright), 'sfAsset') ?><br />
- <?php endif; ?>
+ <?php endif ?>
<?php if ($author = $sf_asset->getAuthor(ESC_RAW)): ?>
<?php echo __('Author: %author%', array('%author%' => $author),
'sfAsset') ?><br />
- <?php endif; ?>
+ <?php endif ?>
<?php echo __('Created on %date%', array('%date%' =>
format_date($sf_asset->getCreatedAt('U'))), 'sfAsset') ?>
</div>
</div>
- <?php endforeach; ?>
+ <?php endforeach ?>
</div>
<div class="sf_asset_pager" style="clear: both">
<?php if ($pager->haveToPaginate(ESC_RAW)): ?>
<?php if ($pager->getPage(ESC_RAW) != 1): ?>
<?php echo link_to(__('< Previous page', null, 'sfAsset'),
'@sf_asset_library_search?page='.$pager->getPreviousPage()) ?>
- <?php endif; ?>
+ <?php endif ?>
<?php echo __('Page %number% on %total%', array('%number%' =>
$pager->getPage(), '%total%' => $pager->getLastPage()), 'sfAsset') ?>
<?php if ($pager->getPage() != $pager->getLastPage()): ?>
<?php echo link_to(__('Next page >', null, 'sfAsset'),
'@sf_asset_library_search?page='.$pager->getNextPage()) ?>
- <?php endif; ?>
+ <?php endif ?>
<?php endif ?>
</div>
<?php if (!$popup) : ?>
<?php include_partial('sfAsset/search_footer') ?>
-<?php endif; ?>
\ No newline at end of file
+<?php endif ?>
\ No newline at end of file
Modified:
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/tinyConfigMediaSuccess.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/tinyConfigMediaSuccess.php
2010-03-31 14:23:17 UTC (rev 28924)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/modules/sfAsset/templates/tinyConfigMediaSuccess.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -8,7 +8,7 @@
<?php echo asset_image_tag($sf_asset, 'large', array('class' => 'thumb'))
?>
<div class="form-row">
- <label><?php echo __('Filename', null, 'sfAsset'); ?></label>
+ <label><?php echo __('Filename', null, 'sfAsset') ?></label>
<div class=""><?php echo $sf_asset->getUrl() ?></div>
</div>
Added:
plugins/sfAssetsLibraryPlugin/branches/garak/test/bootstrap/functional.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/garak/test/bootstrap/functional.php
(rev 0)
+++ plugins/sfAssetsLibraryPlugin/branches/garak/test/bootstrap/functional.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -0,0 +1,28 @@
+<?php
+
+// guess current application
+if (!isset($app))
+{
+ $app = 'backend';
+}
+
+require_once
dirname(__FILE__).'/../../../../config/ProjectConfiguration.class.php';
+
+$configuration = ProjectConfiguration::getApplicationConfiguration($app,
'test', isset($debug) ? $debug : true);
+sfContext::createInstance($configuration);
+
+// remove all cache
+sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
+
+// clear possible fixture directories
+$mediaDir = sfAssetsLibraryTools::getMediaDir();
+...@unlink($mediaDir . '/TESTsubdir1/');
+...@unlink($mediaDir . '/TESTsubdir2/');
+...@unlink($mediaDir . '/TESTsubdir3/');
+
+// cp data files - why are they deleted during tests? :-|
+copy(dirname(__FILE__) . '/../data/demo1.png', dirname(__FILE__) .
'/../data/demo.png');
+
+// load fixtures
+$data = new sfPropelData();
+$data->loadData(dirname(__FILE__) . '/../data/fixtures/');
\ No newline at end of file
Added: plugins/sfAssetsLibraryPlugin/branches/garak/test/data/demo1.png
===================================================================
(Binary files differ)
Property changes on:
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/demo1.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/01_folders.yml
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/01_folders.yml
(rev 0)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/01_folders.yml
2010-03-31 14:35:11 UTC (rev 28925)
@@ -0,0 +1,16 @@
+sfAssetFolder:
+ media:
+ tree_left: 1
+ tree_right: 6
+ name: media
+ relative_path: media
+ subdir1:
+ tree_left: 2
+ tree_right: 3
+ name: TESTsubdir1
+ relative_path: media/TESTsubdir1
+ subdir2:
+ tree_left: 4
+ tree_right: 5
+ name: TESTsubdir2
+ relative_path: media/TESTsubdir2
\ No newline at end of file
Added:
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/02_assets.yml
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/02_assets.yml
(rev 0)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/test/data/fixtures/02_assets.yml
2010-03-31 14:35:11 UTC (rev 28925)
@@ -0,0 +1,31 @@
+sfAsset:
+ asset1:
+ folder_id: media
+ filename: asset1
+ description: asset1.png
+ type: image
+ filesize: 1
+ asset2:
+ folder_id: media
+ filename: asset2
+ description: asset2.png
+ type: image
+ filesize: 1
+ asset3:
+ folder_id: media
+ filename: asset3
+ description: asset3.png
+ type: image
+ filesize: 1
+ sub1asset1:
+ folder_id: subdir1
+ filename: asset1
+ description: asset1.png
+ type: image
+ filesize: 1
+ sub2asset1:
+ folder_id: subdir2
+ filename: asset1
+ description: asset1.png
+ type: image
+ filesize: 1
\ No newline at end of file
Added:
plugins/sfAssetsLibraryPlugin/branches/garak/test/functional/sfAssetActionsTest.php
===================================================================
---
plugins/sfAssetsLibraryPlugin/branches/garak/test/functional/sfAssetActionsTest.php
(rev 0)
+++
plugins/sfAssetsLibraryPlugin/branches/garak/test/functional/sfAssetActionsTest.php
2010-03-31 14:35:11 UTC (rev 28925)
@@ -0,0 +1,141 @@
+<?php
+
+include dirname(__FILE__).'/../bootstrap/functional.php';
+
+$subdir1 = sfAssetFolderPeer::retrieveByPath('TESTsubdir1');
+
+$browser = new sfTestFunctional(new sfBrowser());
+
+$browser->setTester('propel', 'sfTesterPropel');
+
+$browser->
+
+ info('assets list')->
+ get('/sfAsset/list?dir=media')->
+ with('request')->begin()->
+ isParameter('module', 'sfAsset')->
+ isParameter('action', 'list')->
+ end()->
+ with('response')->begin()->
+ isStatusCode(200)->
+ checkElement('div#sf_asset_bar p:first-child', '/media/')->
+ checkElement('div#sf_asset_bar p:nth-child(2)', '/2 subfolders/')->
+ checkElement('div#sf_asset_bar p:nth-child(3)', '/3 files, 3 Kb/')->
+ checkElement('div#sf_asset_container div.assetImage', 5)->
+ checkElement('div#sf_asset_container div.assetImage
img[src$="folder.png"]', 2)->
+ checkElement('div#sf_asset_container div.assetImage
img[src$="asset1.png"]', 1)->
+ end()->
+
+ info('enter first subfolder')->
+ click('a[href$="media/TESTsubdir1"]')->
+ with('request')->begin()->
+ isParameter('module', 'sfAsset')->
+ isParameter('action', 'list')->
+ end()->
+ with('response')->begin()->
+ isStatusCode(200)->
+ checkElement('div#sf_asset_bar p:first-child', '/TESTsubdir1/')->
+ checkElement('div#sf_asset_container div.assetImage', 2)->
+ checkElement('div#sf_asset_container div.assetComment', '/\.\./')->
+ end()->
+
+ info('return to list')->
+ click('a[href$="media"]')->
+ with('request')->begin()->
+ isParameter('module', 'sfAsset')->
+ isParameter('action', 'list')->
+ end()->
+
+ info('add new asset')->
+ click('a[href$="media/TESTsubdir1"]')->
+ click('input[value="Add"]', array('sf_asset' => array(
+ 'file' => '',
+ )))->
+ with('form')->begin()->
+ hasErrors(1)->
+ isError('file', 'required')->
+ end()->
+ get('/sfAsset/list?dir=media/TESTsubdir1')->
+ click('input[value="Add"]', array('sf_asset' => array(
+ 'file' => dirname(__FILE__) . '/../data/demo.png',
+ )))->
+ with('form')->hasErrors(false)->
+ with('propel')->check('sfAsset', array(
+ 'folder_id' => $subdir1->getId(),
+ 'filename' => 'demo.png',
+ 'description' => 'demo.png',
+ 'type' => 'image',
+ 'filesize' => 4,
+ ))->
+ with('request')->begin()->
+ isParameter('module', 'sfAsset')->
+ isParameter('action', 'addQuick')->
+ end()->
+ with('response')->isRedirected()->followRedirect()->
+ with('request')->begin()->
+ isParameter('module', 'sfAsset')->
+ isParameter('action', 'edit')->
+ end()->
+ with('response')->begin()->
+ isStatusCode(200)->
+ checkElement('div#sf_asset_container div.content', '/demo\.png/')->
+ end()->
+
+ info('create a new folder')->
+ click('TESTsubdir1')->
+ click('input[value="Create"]', array('sf_asset_folder' => array(
+ 'name' => '',
+ )))->
+ with('form')->begin()->
+ hasErrors(1)->
+ isError('name', 'required')->
+ end()->
+ get('/sfAsset/list?dir=media/TESTsubdir1')->
+ click('input[value="Create"]', array('sf_asset_folder' => array(
+ 'name' => 'foobar',
+ )))->
+ with('form')->hasErrors(false)->
+ with('propel')->check('sfAssetFolder', array(
+ 'tree_left' => 3,
+ 'tree_right' => 4,
+ 'name' => 'foobar',
+ 'relative_path' => 'media/TESTsubdir1/foobar',
+ ))->
+
+ info('rename folder')->
+ with('response')->isRedirected()->followRedirect()->
+ click('input[value="Rename"]', array('sf_asset_folder' => array(
+ // TODO found that, if not specified, id is passed 2 times
+ // this is likely due to conflict names of forms
+ 'id' => $subdir1->getId() + 2,
+ 'name' => 'barfoo',
+ )))->
+ with('form')->hasErrors(false)->
+ with('propel')->check('sfAssetFolder', array(
+ 'tree_left' => 3,
+ 'tree_right' => 4,
+ 'name' => 'barfoo',
+ 'relative_path' => 'media/TESTsubdir1/barfoo',
+ ))->
+
+ info('delete folder')->
+ with('response')->isRedirected()->followRedirect()->
+ click('Delete folder', array(), array('method' => 'delete', '_with_csrf' =>
true))->
+ with('request')->begin()->
+ isParameter('module', 'sfAsset')->
+ isParameter('action', 'deleteFolder')->
+ end()->
+ with('propel')->check('sfAssetFolder', array(
+ 'tree_left' => 3,
+ 'tree_right' => 4,
+ 'name' => 'barfoo',
+ 'relative_path' => 'media/TESTsubdir1/barfoo',
+ ), false)->
+ with('response')->isRedirected()->followRedirect()->
+ with('response')->begin()->
+ checkElement('h2', '/The folder has been deleted/')->
+ end();
+
+
+
+#end();
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.