Author: tkoomzaaskz
Date: 2010-02-24 18:20:08 +0100 (Wed, 24 Feb 2010)
New Revision: 28251

Modified:
   plugins/tdVisualFactoryPlugin/trunk/config/doctrine/schema.yml
   
plugins/tdVisualFactoryPlugin/trunk/config/tdVisualFactoryPluginConfiguration.class.php
   
plugins/tdVisualFactoryPlugin/trunk/lib/form/doctrine/PlugintdImageForm.class.php
   
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImage.class.php
   
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImageAlbum.class.php
   plugins/tdVisualFactoryPlugin/trunk/lib/vendor/VisualFactory.class.php
   
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/actions/actions.class.php
   
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/config/generator.yml
   
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/i18n/sf_admin.pl.xml
Log:
[td][visual_factory] initial release 0.1.0

Modified: plugins/tdVisualFactoryPlugin/trunk/config/doctrine/schema.yml
===================================================================
--- plugins/tdVisualFactoryPlugin/trunk/config/doctrine/schema.yml      
2010-02-24 15:42:19 UTC (rev 28250)
+++ plugins/tdVisualFactoryPlugin/trunk/config/doctrine/schema.yml      
2010-02-24 17:20:08 UTC (rev 28251)
@@ -17,10 +17,6 @@
       notnull: true
     description:
       type: clob
-    horizontal:
-      type: boolean
-      notnull: true
-      default: true
   relations:
     Album:
       class: tdImageAlbum

Modified: 
plugins/tdVisualFactoryPlugin/trunk/config/tdVisualFactoryPluginConfiguration.class.php
===================================================================
--- 
plugins/tdVisualFactoryPlugin/trunk/config/tdVisualFactoryPluginConfiguration.class.php
     2010-02-24 15:42:19 UTC (rev 28250)
+++ 
plugins/tdVisualFactoryPlugin/trunk/config/tdVisualFactoryPluginConfiguration.class.php
     2010-02-24 17:20:08 UTC (rev 28251)
@@ -24,10 +24,16 @@
     sfConfig::set('td_visual_factory_image_dir', 
sfConfig::get('sf_upload_dir').'/td/images');
 
     // image sizes
-    sfConfig::set('td_visual_factory_sizes', array('128x75', '600x400'));
+    sfConfig::set('td_visual_factory_sizes', array('150x100', '600x400'));
 
+    // watermarked image sizes
+    sfConfig::set('td_visual_factory_watermark_sizes', array('600x400'));
+
+    // temporary watermarked image prefix
+    sfConfig::set('td_visual_factory_watermark_prefix', 'tmp-');
+
     // image thumbnail size index
-    sfConfig::set('td_visual_factory_size_thumbnail', '128x75');
+    sfConfig::set('td_visual_factory_size_thumbnail', '150x100');
 
     // image full size index
     sfConfig::set('td_visual_factory_size_full', '600x400');

Modified: 
plugins/tdVisualFactoryPlugin/trunk/lib/form/doctrine/PlugintdImageForm.class.php
===================================================================
--- 
plugins/tdVisualFactoryPlugin/trunk/lib/form/doctrine/PlugintdImageForm.class.php
   2010-02-24 15:42:19 UTC (rev 28250)
+++ 
plugins/tdVisualFactoryPlugin/trunk/lib/form/doctrine/PlugintdImageForm.class.php
   2010-02-24 17:20:08 UTC (rev 28251)
@@ -26,7 +26,6 @@
   protected function removeFields()
   {
     unset($this['created_at'], $this['updated_at']);
-    unset($this['horizontal']);
   }
 
   protected function manageHidden()
@@ -43,6 +42,17 @@
     }
   }
 
+  protected function renderLinks()
+  {
+    $filepath = $this->getObject()->getFile();
+    $links = array();
+    foreach(sfConfig::get('td_visual_factory_sizes') as $size)
+    {
+      $links[] = "<a 
href='/uploads/td/images/{$size}/{$filepath}'>{$size}</a>";
+    }
+    return implode(', ', $links);
+  }
+
   protected function manageFiles()
   {
     $thumb = sfConfig::get('td_visual_factory_size_thumbnail');
@@ -52,7 +62,7 @@
       'file_src'  => 
'/uploads/td/images/'.$thumb.'/'.$this->getObject()->getFile(),
       'is_image'  => true,
       'edit_mode' => !$this->isNew(),
-      'template'  => '%file%<br />%input%<br />%delete% %delete_label%',
+      'template'  => '%file%<br />'.$this->renderLinks().'<br />%input%',
     )));
 
     $this->setValidator('file', new sfValidatorFile(array(

Modified: 
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImage.class.php
===================================================================
--- 
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImage.class.php  
    2010-02-24 15:42:19 UTC (rev 28250)
+++ 
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImage.class.php  
    2010-02-24 17:20:08 UTC (rev 28251)
@@ -12,46 +12,78 @@
  */
 abstract class PlugintdImage extends BasetdImage
 {
-  protected function setOrientation()
+/*=========================== image files transitions 
========================*/
+
+  /**
+   * Creates watermarked image for a given size and watermark object.
+   *
+   * @param String $size - resized image size
+   * @param tdWatermark $watermark - watermark object
+   */
+  protected function createWatermarked($size, $watermark)
   {
     $sf_upload_dir = sfConfig::get('td_visual_factory_image_dir');
-    $file = $sf_upload_dir.'/'.$this->getFile();
-
-//    var_dump($file, $this); exit;
+    $prefix = sfConfig::get('td_visual_factory_watermark_prefix');
+    
+    VisualFactory::Watermark(
+      sfConfig::get('td_visual_factory_mode'),
+      $sf_upload_dir.'/'.$this->getFile(),
+      $sf_upload_dir.'/'.$size.'/'.$prefix.$this->getFile(),
+      $sf_upload_dir.'/'.$size.'/'.$this->getFile(),
+      $size,
+      
sfConfig::get('td_visual_factory_watermark_dir').'/'.$watermark->getFile());
   }
 
-/*============================================================================*/
-
-  public function postSave($event)
+  /**
+   * Creates resized image for a given size.
+   *
+   * @param String $size - resized image size
+   */
+  protected function createResized($size)
   {
     $sf_upload_dir = sfConfig::get('td_visual_factory_image_dir');
-    foreach(sfConfig::get('td_visual_factory_sizes') as $size)
-    {
-      VisualFactory::Resize(
-        sfConfig::get('td_visual_factory_mode'),
-        $sf_upload_dir.'/'.$this->getFile(),
-        $sf_upload_dir.'/'.$size.'/'.$this->getFile(),
-        $size);
-    }
+    VisualFactory::Resize(
+      sfConfig::get('td_visual_factory_mode'),
+      $sf_upload_dir.'/'.$this->getFile(),
+      $sf_upload_dir.'/'.$size.'/'.$this->getFile(),
+      $size);
   }
 
-  public function postDelete($event)
+/*================== Doctrine_Record pre/post modifications 
==================*/
+
+  /**
+   * Create all image versions, depending on watermark used for the album or 
not.
+   *
+   * @param Doctrine_Event $event
+   */
+  public function postInsert($event)
   {
-    $sf_upload_dir = sfConfig::get('td_visual_factory_image_dir');
-    foreach(sfConfig::get('td_visual_factory_sizes') as $size)
-    {
-      unlink($sf_upload_dir.'/'.$size.'/'.$this->getFile());
+    $all_sizes = sfConfig::get('td_visual_factory_sizes');
+    $album = $this->getAlbum();
+    $watermark_id = $album->gettdWatermarkId();
+
+    if ($watermark_id)
+    { // album has a watermark set - some sizes watermarked, some sizes resized
+      $watermark = $album->getWatermark();
+
+      $watermark_sizes = sfConfig::get('td_visual_factory_watermark_sizes');
+      $normal_sizes = array_diff($all_sizes, $watermark_sizes);
+
+      foreach($watermark_sizes as $size)
+        $this->createWatermarked($size, $watermark);
+
+      foreach($normal_sizes as $size)
+        $this->createResized($size);
     }
+    else
+    { // no watermark i set for the album - all sizes resized
+      foreach($all_sizes as $size)
+        $this->createResized($size);
+    }
   }
 
-  public function preInsert($event)
-  {
-    $this->setOrientation();
-  }
-
   public function preUpdate($event)
   {
-    $this->setOrientation();
 //      var_dump($this->isNew());
 //    if (! $this->isNew())
 //    {
@@ -65,14 +97,41 @@
 
   public function postUpdate($event)
   {
+//    $sf_upload_dir = sfConfig::get('td_visual_factory_image_dir');
+//    foreach(sfConfig::get('td_visual_factory_sizes') as $size)
+//    {
+//      VisualFactory::Resize(
+//        sfConfig::get('td_visual_factory_mode'),
+//        $sf_upload_dir.'/'.$this->getFile(),
+//        $sf_upload_dir.'/'.$size.'/'.$this->getFile(),
+//        $size);
+//    }
+  }
+
+  /**
+   * Delete all image versions
+   *
+   * @param Doctrine_Event $event
+   */
+  public function postDelete($event)
+  {
     $sf_upload_dir = sfConfig::get('td_visual_factory_image_dir');
+    unlink($sf_upload_dir.'/'.$this->getFile());
+
     foreach(sfConfig::get('td_visual_factory_sizes') as $size)
     {
-      VisualFactory::Resize(
-        sfConfig::get('td_visual_factory_mode'),
-        $sf_upload_dir.'/'.$this->getFile(),
-        $sf_upload_dir.'/'.$size.'/'.$this->getFile(),
-        $size);
+      unlink($sf_upload_dir.'/'.$size.'/'.$this->getFile());
     }
+
+    // check if temporary watermark images shall be deleted
+    $watermark = $this->getAlbum()->getWatermark();
+    if ($watermark)
+    { // album has a watermark set - some sizes watermarked, some sizes resized
+      $prefix = sfConfig::get('td_visual_factory_watermark_prefix');
+      $watermark_sizes = sfConfig::get('td_visual_factory_watermark_sizes');
+
+      foreach($watermark_sizes as $size)
+        unlink($sf_upload_dir.'/'.$size.'/'.$prefix.$this->getFile());
+    }
   }
 }
\ No newline at end of file

Modified: 
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImageAlbum.class.php
===================================================================
--- 
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImageAlbum.class.php
 2010-02-24 15:42:19 UTC (rev 28250)
+++ 
plugins/tdVisualFactoryPlugin/trunk/lib/model/doctrine/PlugintdImageAlbum.class.php
 2010-02-24 17:20:08 UTC (rev 28251)
@@ -21,4 +21,39 @@
   {
     return tdTools::getMbShortenedString($this->getDescription(), 
sfConfig::get('td_short_text_sign_count'));
   }
+
+  /**
+   * Activates the image album.
+   *
+   * @return True
+   */
+  public function activate()
+  {
+    $this->setActive(true);
+    $this->save();
+    return true;
+  }
+
+  /**
+   * Deactivates the image album.
+   *
+   * @return True
+   */
+  public function deactivate()
+  {
+    $this->setActive(false);
+    $this->save();
+    return true;
+  }
+
+  /**
+   * Deletes all image records before the whole image album is deleted.
+   *
+   * @param Doctrine_Event $event
+   */
+  public function preDelete($event)
+  {
+    foreach($this->getImages() as $image)
+      $image->delete();
+  }
 }
\ No newline at end of file

Modified: plugins/tdVisualFactoryPlugin/trunk/lib/vendor/VisualFactory.class.php
===================================================================
--- plugins/tdVisualFactoryPlugin/trunk/lib/vendor/VisualFactory.class.php      
2010-02-24 15:42:19 UTC (rev 28250)
+++ plugins/tdVisualFactoryPlugin/trunk/lib/vendor/VisualFactory.class.php      
2010-02-24 17:20:08 UTC (rev 28251)
@@ -6,6 +6,8 @@
  * Class performing basic image transforming operations using GD and Imagick
  * libraries.
  *
+ * (!) Image Magick doesn't support automatic orientation switching (600x400 
-> 400x600)
+ *
  * @package    VisualFactory
  * @author     Tomasz Ducin <[email protected]>
  */
@@ -15,10 +17,10 @@
    * Reads image from the filepath given by the parameter using gd built-in
    * functions.
    *
-   * @param String $filepath
-   * @return resource an image resource identifier on success, false on errors.
+   * @param String $filepath - file path of the input image
+   * @return resource $image - an image resource identifier on success, false 
on errors.
    */
-  protected static function imageCreateFrom($filepath)
+  public static function imageCreateFrom($filepath)
   {
     // file extension
     $path_arr = explode('.', $filepath);
@@ -49,10 +51,10 @@
    * Writes image to the filepath given by the parameter using gd built-in
    * functions.
    *
-   * @param resource an image resource identifier on success, false on errors.
-   * @param String $filepath
+   * @param resource $image - an image resource identifier
+   * @param String $filepath - file path for the output image
    */
-  protected static function imagePut($image, $filepath)
+  public static function imagePut($image, $filepath)
   {
     // file extension
     $path_arr = explode('.', $filepath);
@@ -78,70 +80,74 @@
     }
   }
 
- /**
-  * Performs WATERMARK operation using GD library.
-  *
-  * @param String $wm_file - watermark file path
-  * @param String $in_file - input file path
-  * @param String $out_file - output file path
-  */
-  protected static function putWatermark($wm_file, $in_file, $out_file)
+  /**
+   * Checks if given image is horizontal
+   *
+   * @param resource $image - an image resource identifier
+   * @return Boolean - given image is horizontal
+   */
+  public static function isHorizontal($image)
   {
-    $watermark = imagecreatefrompng($wm_file);
+    $width = imagesx($image);
+    $height = imagesy($image);
+    return $width > $height;
+  }
 
-    $image = self::imageCreateFrom($in_file);
-
-    $margin_right = 5;
-    $margin_bottom = 5;
-    $wm_sx = imagesx($watermark);
-    $wm_sy = imagesy($watermark);
-    $im_sx = imagesx($image);
-    $im_sy = imagesy($image);
-
-    imagecopy($image, $watermark,
-      $margin_right, $im_sy - $wm_sy - $margin_bottom, // w tym miejscu smaruj 
watermark
-      0, 0, // od tych współrzędnych bierzesz watermark
-      $wm_sx, $wm_sy // cały watermark bierzesz
-    );
-
-    self::imagePut($image, $out_file);
-
-    imagedestroy($image);
-    imagedestroy($watermark);
+  /**
+   * Checks if given image is vertical
+   *
+   * @param resource $image - an image resource identifier
+   * @return Boolean - given image is vertical
+   */
+  public static function isVertical($image)
+  {
+    return ! self::isHorizontal($image);
   }
 
+/*============================================================================*/
+/*============================ GD library 
====================================*/
+
  /**
   * Performs RESIZE operation using GD library.
   *
   * @param String $in_file - input file path
   * @param String $out_file - output file path
-  * @param Integer $new_width - new width value of the output image
-  * @param Integer $new_height - new height value of the output image
+  * @param String $format - output file format, e. g. '800x600'
+  * @param Boolean $switch - if the format shall be automatically switched
   */
-  protected static function putResized($in_file, $out_file, $new_width, 
$new_height)
+  protected static function GDResize($in_file, $out_file, $format, $switch)
   {
-    $destination = imagecreatetruecolor($new_width, $new_height);
+    $source = self::imageCreateFrom($in_file);
 
-    $image = self::imageCreateFrom($in_file);
-
     $src_width = imagesx($source);
     $src_height = imagesy($source);
 
+    $f = explode('x', $format);
+    if ($src_width > $src_height) {
+      $new_width = $f[0];
+      $new_height = $f[1];
+    } else {
+      $new_width = $f[1];
+      $new_height = $f[0];
+    }
+
+    $destination = imagecreatetruecolor($new_width, $new_height);
+
     $new_dwh = $new_width / $new_height; // stosunek dł/wys.
     $src_dwh = $src_width / $src_height;
 
     if ($src_dwh == $new_dwh)
-    { //
+    { // proporcjonalne
       $fin_x = 0;
       $fin_y = 0;
       $fin_width = $src_width;
       $fin_height = $src_height;
-    } elseif ($src_dwh > $new_dwh) { //
+    } elseif ($src_dwh > $new_dwh) { // src bardziej horyzontalny, new 
bardziej wertykalny
       $fin_height = $src_height;
-      $in_width = ceil($src_height * $new_width / $new_height);
+      $fin_width = ceil($src_height * $new_width / $new_height);
       $fin_x = ($src_width - $fin_width) / 2;
       $fin_y = 0;
-    } elseif ($src_dwh < $new_dwh) { //
+    } elseif ($src_dwh < $new_dwh) { // src bardziej wertykalny, new bardziej 
horyzontalny
       $fin_height = ceil($src_width * $new_height / $new_width);
       $fin_width = $src_width;
       $fin_x = 0;
@@ -158,7 +164,39 @@
 
     self::imagePut($destination, $out_file);
 
+    imagedestroy($source);
+  }
+
+ /**
+  * Performs WATERMARK operation using GD library.
+  *
+  * @param String $wm_file - watermark file path
+  * @param String $in_file - input file path
+  * @param String $out_file - output file path
+  */
+  protected static function GDWatermark($in_file, $out_file, $wm_file)
+  {
+    $watermark = imagecreatefrompng($wm_file);
+
+    $image = self::imageCreateFrom($in_file);
+
+    $margin_right = 5;
+    $margin_bottom = 5;
+    $wm_sx = imagesx($watermark);
+    $wm_sy = imagesy($watermark);
+    $im_sx = imagesx($image);
+    $im_sy = imagesy($image);
+
+    imagecopy($image, $watermark,
+      $margin_right, $im_sy - $wm_sy - $margin_bottom, // w tym miejscu smaruj 
watermark
+      0, 0, // od tych współrzędnych bierzesz watermark
+      $wm_sx, $wm_sy // cały watermark bierzesz
+    );
+
+    self::imagePut($image, $out_file);
+
     imagedestroy($image);
+    imagedestroy($watermark);
   }
 
 
/*============================================================================*/
@@ -188,64 +226,22 @@
   *
   * @param String $wm_file - watermark file path
   * @param String $in_file - input file path
-  * @param String $mid_file - auxiliary file path (created after resize and 
used to put a watermark on)
   * @param String $out_file - output file path
-  * @param String $format - output file format, e. g. '800x600'
   */
-  protected static function ImageMagickWatermark($wm_file, $in_file, 
$mid_file, $out_file, $format)
+  protected static function ImageMagickWatermark($in_file, $out_file, $wm_file)
   {
-    $command_convert =
-      "convert ".
-      escapeshellarg($in_file).
-      " -thumbnail $format -gravity center -extent $format -strip ".
-      escapeshellarg($mid_file);
-
     $command_composite =
       "composite -gravity SouthWest ".
       escapeshellarg($wm_file).
       " ".
-      escapeshellarg($mid_file).
+      escapeshellarg($in_file).
       " -strip ".
       escapeshellarg($out_file);
 
-    shell_exec($command_convert);
     shell_exec($command_composite);
   }
 
 
/*============================================================================*/
-/*============================ GD library 
====================================*/
-
- /**
-  * Performs RESIZE operation on given input and output files using GD library.
-  *
-  * @param String $in_file - input file path
-  * @param String $out_file - output file path
-  * @param String $format - output file format, e. g. '800x600'
-  */
-  protected static function GDResize($in_file, $out_file, $format)
-  {
-    $f = explode('x', $format);
-    self::putResized($in_file, $out_file, $f[0], $f[1]);
-  }
-
- /**
-  * Performs WATERMARK operation on given input, output and watermark files
-  * using GD library.
-  *
-  * @param String $wm_file - watermark file path
-  * @param String $in_file - input file path
-  * @param String $mid_file - auxiliary file path (created after resize and 
used to put a watermark on)
-  * @param String $out_file - output file path
-  * @param String $format - output file format, e. g. '800x600'
-  */
-  protected static function GDWatermark($wm_file, $in_file, $mid_file, 
$out_file, $format)
-  {
-    $f = explode('x', $format);
-    self::putResized($in_file, $mid_file, $f[0], $f[1]);
-    self::putWatermark($wm_file, $mid_file, $out_file);
-  }
-
-/*============================================================================*/
 /*================================ interface 
=================================*/
 
  /**
@@ -256,8 +252,9 @@
   * @param String $in_file - input file path
   * @param String $out_file - output file path
   * @param String $format - output file format, e. g. '800x600'
+  * @param Boolean $switch - if the format shall be automatically switched
   */
-  public static function Resize($mode, $in_file, $out_file, $format)
+  public static function Resize($mode, $in_file, $out_file, $format, $switch = 
true)
   {
     switch($mode)
     {
@@ -265,7 +262,7 @@
         self::ImageMagickResize($in_file, $out_file, $format);
         break;
       case 'gd':
-        self::GDResize($in_file, $out_file, $format);
+        self::GDResize($in_file, $out_file, $format, $switch);
         break;
     }
   }
@@ -282,15 +279,17 @@
   * @param String $out_file - output file path
   * @param String $format - output file format, e. g. '800x600'
   */
-  public static function Watermark($mode, $wm_file, $in_file, $mid_file, 
$out_file, $format)
+  public static function Watermark($mode, $in_file, $mid_file, $out_file, 
$format, $wm_file, $switch = true)
   {
     switch($mode)
     {
       case 'im':
-        self::ImageMagickWatermark($wm_file, $in_file, $mid_file, $out_file, 
$format);
+        self::ImageMagickResize($in_file, $mid_file, $format);
+        self::ImageMagickWatermark($mid_file, $out_file, $wm_file);
         break;
       case 'gd':
-        self::GDWatermark($wm_file, $in_file, $mid_file, $out_file, $format);
+        self::GDResize($in_file, $mid_file, $format, $switch);
+        self::GDWatermark($mid_file, $out_file, $wm_file);
         break;
     }
   }

Modified: 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/actions/actions.class.php
===================================================================
--- 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/actions/actions.class.php
        2010-02-24 15:42:19 UTC (rev 28250)
+++ 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/actions/actions.class.php
        2010-02-24 17:20:08 UTC (rev 28251)
@@ -13,4 +13,70 @@
  */
 class td_image_albumActions extends autoTd_image_albumActions
 {
+  /**
+   * Activates selected track albums.
+   *
+   * @param sfWebRequest $request
+   */
+  public function executeBatchActivate(sfWebRequest $request)
+  {
+    $ids = $request->getParameter('ids');
+    $query = Doctrine::getTable('tdImageAlbum')->getSelectedAlbumsQuery($ids);
+
+    foreach ($query->execute() as $album)
+    {
+      $album->activate(true);
+    }
+
+    $this->getUser()->setFlash('notice', 'The selected image albums have been 
activated successfully.');
+    $this->redirect('@td_image_album');
+  }
+
+  /**
+   * Deactivates selected track albums.
+   *
+   * @param sfWebRequest $request
+   */
+  public function executeBatchDeactivate(sfWebRequest $request)
+  {
+    $ids = $request->getParameter('ids');
+    $query = Doctrine::getTable('tdImageAlbum')->getSelectedAlbumsQuery($ids);
+
+    foreach ($query->execute() as $album)
+    {
+      $album->deactivate(true);
+    }
+
+    $this->getUser()->setFlash('notice', 'The selected image albums have been 
deactivated successfully.');
+    $this->redirect('@td_image_album');
+  }
+
+  /**
+   * Activates selected track album.
+   *
+   * @param sfWebRequest $request
+   */
+  public function executeListActivate(sfWebRequest $request)
+  {
+    $album = $this->getRoute()->getObject();
+    $album->activate();
+
+    $this->getUser()->setFlash('notice', 'The selected image album has been 
activated successfully.');
+    $this->redirect('@td_image_album');
+  }
+
+  /**
+   * Deactivates selected track album.
+   *
+   * @param sfWebRequest $request
+   */
+  public function executeListDeactivate(sfWebRequest $request)
+  {
+    $album = $this->getRoute()->getObject();
+    $album->deactivate();
+
+    $this->getUser()->setFlash('notice', 'The selected image album has been 
deactivated successfully.');
+
+    $this->redirect('@td_image_album');
+  }
 }

Modified: 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/config/generator.yml
===================================================================
--- 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/config/generator.yml 
    2010-02-24 15:42:19 UTC (rev 28250)
+++ 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/config/generator.yml 
    2010-02-24 17:20:08 UTC (rev 28251)
@@ -31,6 +31,15 @@
           label: Nowe zdjęcia
       list:
         title: List of galleries
+        batch_actions:
+          _delete: ~
+          activate: ~
+          deactivate: ~
+        object_actions:
+          _edit: ~
+          _delete: ~
+          activate: ~
+          deactivate: ~
         layout: stacked
         params: |
           <strong>Nazwa</strong>: <i>%%name%%</i> %%active%%
@@ -49,6 +58,6 @@
             attributes: { cols: 80, rows: 10 }
       edit:
         title: Edit gallery
-        display: [ name, description, active, Images, new ]
+        display: [ name, description, active, td_watermark_id, Images, new ]
       new:
         title: New gallery

Modified: 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/i18n/sf_admin.pl.xml
===================================================================
--- 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/i18n/sf_admin.pl.xml 
    2010-02-24 15:42:19 UTC (rev 28250)
+++ 
plugins/tdVisualFactoryPlugin/trunk/modules/td_image_album/i18n/sf_admin.pl.xml 
    2010-02-24 17:20:08 UTC (rev 28251)
@@ -18,6 +18,16 @@
         <target>Lista galerii</target>
       </trans-unit>
 
+      <!-- Object/Batch Actions -->
+      <trans-unit>
+        <source>Activate</source>
+        <target>Aktywuj</target>
+      </trans-unit>
+      <trans-unit>
+        <source>Deactivate</source>
+        <target>Deaktywuj</target>
+      </trans-unit>
+      
       <!-- Fields -->
       <trans-unit>
         <source>Created at</source>
@@ -27,6 +37,24 @@
         <source>Updated at</source>
         <target>Zmodyfikowano</target>
       </trans-unit>
+
+      <!-- Flashes -->
+      <trans-unit>
+        <source>The selected image albums have been activated 
successfully.</source>
+        <target>Wybrane albumy zdjęć zostały aktywowane.</target>
+      </trans-unit>
+      <trans-unit>
+        <source>The selected image album has been activated 
successfully.</source>
+        <target>Wybrany album zdjęć gości został aktywowany.</target>
+      </trans-unit>
+      <trans-unit>
+        <source>The selected image albums have been deactivated 
successfully.</source>
+        <target>Wybrane albumy zdjęć zostały deaktywowane.</target>
+      </trans-unit>
+      <trans-unit>
+        <source>The selected image album has been deactivated 
successfully.</source>
+        <target>Wybrany album zdjęć został deaktywowany.</target>
+      </trans-unit>
     </body>
   </file>
 </xliff>

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

Reply via email to