Commits

Joachim Werner committed 763746f

Completed batch actions for multiple selected items. Fixes issue 2.

  • Participants
  • Parent commits 4d20571

Comments (0)

Files changed (6)

File controllers/DefaultController.php

     {
         $msg = '';
         $mediaAction = new DDMediaAction;
-        if(isset($_POST['DDMediaAction'])) {
-            $mediaAction->attributes = $_POST['DDMediaAction'];
-            $mediaAction->scenario = $mediaAction->action;
+        // $basePath = DDMediaDirectory::pathToUnix(realpath(Yii::app()->basePath.'/../files'));
+        // Get base path from module settings
+        $basePath = DDMediaDirectory::pathToUnix(realpath($this->module->baseDir));
+        // DEBUG echo "<li>basePath: $basePath";
+        /*
+        if(!is_dir($basePath))
+            throw new CHttpException(500, 'Directory '.$basePath.' is not a valid directory');
+         */
+        $defaultPath = '.';
+        $path = isset($_GET['p']) ? urldecode($_GET['p']) : '.';
+        $currentPath = DDMediaDirectory::pathToUnix(realpath($basePath.'/'.$path));
+        // DEBUG echo "<li>currentPath: $currentPath";
+        if($currentPath==$basePath) {
+            if(isset($_GET['p']))
+                Yii::app()->user->setFlash('error',"Can't change above base dir $basePath/$defaultPath");
+            $path = $defaultPath;
+        } else {
+            $path = str_replace($basePath.'/','',$currentPath);
+        }
+        // DEBUG echo "<li>path: $path";
+        $currentPath = DDMediaDirectory::pathToUnix(realpath($basePath.'/'.$path.'/'));
+
+        if(!isset($_POST['DDMediaAction'])) {
+            $mediaAction->selectedItems =' ';
+            $mediaAction->mediaType     = 'file';
+            $mediaAction->path          = $currentPath;
+        } else {
+            $mediaAction->attributes    = $_POST['DDMediaAction'];
+            $mediaAction->scenario      = $mediaAction->action;
+            $mediaAction->path          = $basePath.'/'.$mediaAction->path;
             // DEBUG var_dump($mediaAction->attributes);
             if($mediaAction->validate()) {
                 $result = $mediaAction->doAction();
                     switch($mediaAction->action)
                     {
                         case 'rename':
-                            Yii::app()->user->setFlash('success',Yii::t('main','The {mediaType} <em>{name}</em> has been renamed to <em>{p1}</em>.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->oldName,'{p1}'=>$mediaAction->p1)));
+                            Yii::app()->user->setFlash('success',Yii::t('main','The {mediaType} <em>{name}</em> has been renamed to <em>{p1}</em>.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->selectedItemsOld,'{p1}'=>$mediaAction->p1)));
                             break;
                         case 'copy':
-                            Yii::app()->user->setFlash('success',Yii::t('main','The {mediaType} <em>{name}</em> has been copied to <em>{p1}</em>.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->oldName,'{p1}'=>$mediaAction->p1)));
+                            Yii::app()->user->setFlash('success',Yii::t('main','The {mediaType} <em>{name}</em> has been copied to <em>{p1}</em>.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->selectedItemsOld,'{p1}'=>$mediaAction->p1)));
                             break;
                         case 'delete':
-                            Yii::app()->user->setFlash('success',Yii::t('main','The {mediaType} <em>{name}</em> has been deleted.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->oldName)));
+                            Yii::app()->user->setFlash('success',Yii::t('main','The {mediaType} <em>{name}</em> has been deleted.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->selectedItemsOld)));
                             break;
                         case 'move':
                             Yii::app()->user->setFlash('success',Yii::t('main','The {mediaType} <em>{name}</em> has been moved to <em>{path}/{p1}</em>.',array(
                                 '{mediaType}'=>$mediaAction->mediaType,
-                                '{name}'=>$mediaAction->oldName,
+                                '{name}'=>$mediaAction->selectedItemsOld,
                                 '{path}'=>$mediaAction->path,
                                 '{p1}'=>$mediaAction->p1)));
                             break;
                         case 'upload':
-                            Yii::app()->user->setFlash('success',Yii::t('main','The file <em>{oldName}</em> has been uploaded as <em>{name}</em>.',array('{name}'=>$mediaAction->name, '{oldName}'=>$mediaAction->oldName)));
+                            Yii::app()->user->setFlash('success',Yii::t('main','The file <em>{oldName}</em> has been uploaded as <em>{name}</em>.',array('{name}'=>$mediaAction->name, '{oldName}'=>$mediaAction->selectedItemsOld)));
                             break;
                         case 'newdir':
                             Yii::app()->user->setFlash('success',Yii::t('main','The directory <em>{p1}</em> has been created.',array('{p1}'=>$mediaAction->p1)));
 
             }
         }
-        // $basePath = DDMediaDirectory::pathToUnix(realpath(Yii::app()->basePath.'/../files'));
-        // Get base path from module settings
-        $basePath = DDMediaDirectory::pathToUnix(realpath($this->module->baseDir));
-        // DEBUG echo "<li>basePath: $basePath";
-        /*
-        if(!is_dir($basePath))
-            throw new CHttpException(500, 'Directory '.$basePath.' is not a valid directory');
-         */
-        $defaultPath = '.';
-        $path = isset($_GET['p']) ? urldecode($_GET['p']) : '.';
-        $currentPath = DDMediaDirectory::pathToUnix(realpath($basePath.'/'.$path));
-        // DEBUG echo "<li>currentPath: $currentPath";
-        if($currentPath==$basePath) {
-            if(isset($_GET['p']))
-                Yii::app()->user->setFlash('error',"Can't change above base dir $basePath/$defaultPath");
-            $path = $defaultPath;
-        } else {
-            $path = str_replace($basePath.'/','',$currentPath);
-        }
-        // DEBUG echo "<li>path: $path";
-        $currentPath = DDMediaDirectory::pathToUnix(realpath($basePath.'/'.$path.'/'));
-        if(!isset($_POST['DDMediaAction'])) {
-            $mediaAction->name=' ';
-            $mediaAction->mediaType = 'file';
-            $mediaAction->path = $currentPath;
-        }
+
         // DEBUG var_dump(array('basePath'=>$basePath, 'defaultPath'=>$defaultPath, 'GET[path]'=>urldecode($_GET['p']), 'path'=>$path, 'currentPath'=>$currentPath));
         try {
             $dir = new DDMediaDirectory($basePath.'/'.$path);

File messages/de/main.php

  * @version $Id: $
  */
 return array (
+  '(Batch Action)' => '(Mehrfach-Aktion)',
   'Create' => 'Anlegen',
   'Delete' => 'Löschen',
   'Destination' => 'Ziel',

File models/DDMediaAction.php

 {
     // {{{ *** Members ***
     public $path;
-    public $name;
-    public $multipleNames;
-    public $oldName;
+    public $selectedItems;
+    public $selectedItemsOld;
     public $mediaType;
     public $action;
     public $p1;
         return array(
             array('path, mediaType, action','required'),
             array('action','checkActionParams'),
-            array('name, multipleNames, oldName, p1', 'safe'),
+            array('selectedItems, selectedItemsOld, p1', 'safe'),
             array('uploadedFile','file','on'=>'upload'),
         );
     } // }}}
     public function attributeLabels()
     {
         return array(
-            'path'          => Yii::t('main','Path'),
-            'name'          => Yii::t('main','Name'),
-            'multipleNames' => Yii::t('main','Multiple Selection'),
-            'oldName'       => Yii::t('main','Old Name'),
-            'mediaType'     => Yii::t('main','Media Type'),
-            'action'        => Yii::t('main','Action'),
-            'p1'            => Yii::t('main','Parameter 1'),
-            'uploadedFile'  => Yii::t('main','Upload File'),
+            'path'              => Yii::t('main','Path'),
+            'selectedItems'     => Yii::t('main','Selected Items'),
+            'selectedItemsOld'  => Yii::t('main','Selected Items (old)'),
+            'mediaType'         => Yii::t('main','Media Type'),
+            'action'            => Yii::t('main','Action'),
+            'p1'                => Yii::t('main','Parameter 1'),
+            'uploadedFile'      => Yii::t('main','Upload File'),
         );
     } // }}}
     // {{{ doAction
         $result = false;
         switch($this->action)
         {
-            case 'rename':
-                $src = $this->path;
-                $dest = dirname($this->path).'/'.$this->p1;
-                if($this->isWindows()) {
-                    $src    = DDMediaDirectory::pathToWindows($src);
-                    $dest   = DDMediaDirectory::pathToWindows($dest);
+            case 'rename': // {{{ 
+                $result = true;
+                $items = preg_split('/^\R$/', $this->selectedItems, -1, PREG_SPLIT_NO_EMPTY);
+                foreach($items as $srcItem) {
+                    $src = $this->path.'/'.$srcItem;
+                    $dest = $this->path.'/'.$this->p1;
+                    if($this->isWindows()) {
+                        $src    = DDMediaDirectory::pathToWindows($src);
+                        $dest   = DDMediaDirectory::pathToWindows($dest);
+                    }
+                    $result = $result && @rename($src, $dest);
                 }
-                $result = @rename($src, $dest);
-                break;
-            case 'copy':
-                $src = $this->path;
-                $dest = dirname($this->path).'/'.$this->p1;
-                if($this->isWindows()) {
-                    $src    = DDMediaDirectory::pathToWindows($src);
-                    $dest   = DDMediaDirectory::pathToWindows($dest);
+                $this->selectedItemsOld = join(', ', preg_split('/^\R$/', $this->selectedItems, -1, PREG_SPLIT_NO_EMPTY) );
+                break; // }}} 
+            case 'copy': // {{{
+                $result = true;
+                $items = preg_split('/^\R$/', $this->selectedItems, -1, PREG_SPLIT_NO_EMPTY);
+                foreach($items as $srcItem) {
+                    $src = $this->path.'/'.$srcItem;
+                    $dest = $this->path.'/'.$this->p1;
+                    if($this->isWindows()) {
+                        $src    = DDMediaDirectory::pathToWindows($src);
+                        $dest   = DDMediaDirectory::pathToWindows($dest);
+                    }
+                    $result = $result && $this->rcopy($src, $dest);
                 }
-                $result = $this->rcopy($src, $dest);
-                break;
-            case 'delete':
-                $path = $this->path;
-                if($this->isWindows()) {
-                    $path    = DDMediaDirectory::pathToWindows($path);
+                $this->selectedItemsOld = join(', ', preg_split('/^\R$/', $this->selectedItems, -1, PREG_SPLIT_NO_EMPTY) );
+                break; // }}} 
+            case 'delete': // {{{
+                $result = true;
+                $items = explode("\n", $this->selectedItems);
+                foreach($items as $srcItem) {
+                    $path = $this->path.'/'.$srcItem;
+                    if($this->isWindows()) {
+                        $path    = DDMediaDirectory::pathToUnix($path);
+                    }
+                    $result0 = DDMediaDirectory::rrmdir($path);
+                    $result = $result && $result0;
                 }
-                //echo "<li>path: $path";
-                if(is_file($this->path))
-                    $result = @unlink($path);
-                else
-                    $result = DDMediaDirectory::rrmdir($path);
-                break;
-            case 'move':
-                $src    = $this->path;
-                $dest   = dirname($this->path).'/'.$this->p1;
-                if($this->isWindows()) {
-                    $src    = DDMediaDirectory::pathToWindows($src);
-                    $dest   = DDMediaDirectory::pathToWindows($dest);
+                break; // }}}
+            case 'move': // {{{ 
+                $result = true;
+                $items = explode("\n", $this->selectedItems);
+                foreach($items as $srcItem) {
+                    $src    = $this->path.'/'.$srcItem;
+                    $dest   = realpath($this->path.'/'.$this->p1).'/'.$srcItem;
+                    if($this->isWindows()) {
+                        $src    = DDMediaDirectory::pathToWindows($src);
+                        $dest   = DDMediaDirectory::pathToWindows($dest);
+                    }
+                    $result = $result && @rename($src, $dest);
                 }
-                $result = rename($src, $dest);
-                break;
-            case 'upload':
+                break; // }}} 
+            case 'upload': // {{{ 
                 $this->uploadedFile=CUploadedFile::getInstance($this,'uploadedFile');
                 $fileName = $this->oldName = $this->uploadedFile->name;
                 // Check if file already exists?
                 $result = $this->uploadedFile->saveAs($this->path.'/'.basename($fileName).$add);
                 if($this->oldName!==basename($fileName).$add)
                     $this->name = basename($fileName).$add;
-                break;
-            case 'newdir':
+                break; // }}} 
+            case 'newdir': // {{{ 
                 $newDir = $this->path.'/'.$this->p1;
                 if(!is_dir($newDir))
                     $result = @mkdir($newDir, 0770);
-                break;
+                break; // }}} 
         }
         return $result;
     } // }}}
     {
         return strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN';
     } // }}} 
-    // removes files and non-empty directories
+    // {{{ removes files and non-empty directories
     public function rrmdir($dir) 
     {
-        if (is_dir($dir)) {
+        echo "<li>dir: ".$dir;
+        echo "<li>realpath(dir): ".realpath($dir);
+        if (is_dir(realpath($dir.'/'))) {
+            echo " is dir";
             $files = scandir($dir);
-            foreach ($files as $file)
-                if ($file != "." && $file != "..") $this->rrmdir("$dir/$file");
+            foreach ($files as $file) {
+                if ($file != "." && $file != "..") {
+                    echo "<li>file: $dir/$file".
+                        $this->rrmdir("$dir/$file");
+                }
+            }
             rmdir($dir);
+        } else {
+            echo " is not a dir";
+            if (file_exists($dir)) {
+                unlink($dir);
+            }
         }
-        else if (file_exists($dir)) unlink($dir);
         return true;
-    }
-    
-    // copies files and non-empty directories
+    } // }}} 
+    // {{{ copies files and non-empty directories
     public function rcopy($src, $dst) 
     {
         if (file_exists($dst)) $this->rrmdir($dst);
         }
         else if (file_exists($src)) copy($src, $dst);
         return true;
-    }
+    } // }}}
 }

File models/DDMediaDirectory.php

      */
     function rrmdir($dir) 
     {
-        if (is_dir($dir)) { 
-            $objects = scandir($dir); 
+        if (!is_file($dir)) { 
+            $objects = @scandir($dir); 
+            if($objects===false)
+                return false;
             foreach ($objects as $object) { 
                 if ($object != "." && $object != "..") { 
                     if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
             } 
             reset($objects); 
             rmdir($dir); 
-        } 
+        } else {
+            return @unlink($dir);
+        }
         return !is_dir($dir);
     } // }}} 
     // }}} End Methods

File views/default/_mediaAction.php

     <?php echo CHtml::activeHiddenField($model,'mediaType') ?>
     <?php echo CHtml::activeHiddenField($model,'action'); ?>
  
-    <?php echo CHtml::activeHiddenField($model,'oldName') ?>
+    <?php echo CHtml::activeHiddenField($model,'selectedItemsOld') ?>
 
-    <div class="simple" id="nameRow" style="display:none">
-        <?php echo CHtml::activeLabel($model,'name'); ?>
-        <?php echo CHtml::activeTextField($model,'name') ?>
-    </div>
- 
-    <div class="simple" id="multipleNamesRow" style="display:none">
-        <?php echo CHtml::activeLabel($model,'multipleNames'); ?>
-        <?php echo CHtml::activeTextArea($model,'multipleNames', array( 'rows'=>5 )) ?>
-    </div>
- 
-    <div class="simple" id="nameRowDisplayOnly" style="display:none">
-        <?php echo CHtml::activeLabel($model,'name'); ?>
-        <?php //echo CHtml::activeHiddenField($model,'name') ?>
-        <span id="selectedItemName"></span>
+    <div class="simple" id="selectedItemsRow">
+        <?php echo CHtml::activeLabel($model,'selectedItems'); ?>
+        <?php echo CHtml::activeTextArea($model,'selectedItems', array( 'cols'=>40, 'rows'=>5 )) ?>
     </div>
  
     <div class="simple" id="p1Row" style="display:none">

File views/default/index.php

 .datahighlight { background-color: #ffdc87 !important; }
 .datahighlight2 { background-color: #C3D9FF !important; }
 div.ui-dialog form div.simple { margin: 5px 3px 5px 3px; }
+div.ui-dialog form div.simple textarea#DDMediaAction_selectedItems { font-size:smaller; }
 // -->
 </style>
 <?php
 
 <h1><?php echo CHtml::encode(Yii::t('main', 'Media Browser')); ?></h1>
 
+<?php 
+echo "<li>basePath: ".$basePath; 
+echo "<li>path: ".$path; 
+echo "<li>currentPath: ".$currentPath; 
+?>
+
 <?php
     foreach(Yii::app()->user->getFlashes() as $key => $message) {
         echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
         <!-- {{{ Batch Selection Row -->
         <tr>
             <td colspan="7">
-                <input type="text" name="path" value="<?php echo $path; ?>" size="20" />
+                &dArr;&rArr;&nbsp;
+                <input type="hidden" name="path" id="path" value="<?php echo $path; ?>" size="20" />
                 <select name="batchAction" id="batchAction" onchange="if(this.value!=='') { doBatchJob=true; doShowDialog=true; showDialog(this.value); }">
-                    <option value="">(Batch Action)</option>
-                    <option value="move">Move</option>
-                    <option value="delete">Delete</option>
+                    <option value=""><?php echo CHtml::encode(Yii::t('main', '(Batch Action)')); ?></option>
+                    <option value="move"><?php echo CHtml::encode(Yii::t('main', 'Move')); ?></option>
+                    <option value="delete"><?php echo CHtml::encode(Yii::t('main', 'Delete')); ?></option>
                 </select>
             </td>
         </tr>
     var doBatchJob=false;
     var doShowDialog=false;
     var selectedItems=[];
-    function toggleAll(toggle)
+    function toggleAll(toggle) // {{{ 
     {
         $('.chSelectedItems').each( function() {
             if(this.checked)
             else
                 this.checked=true;
         });
-    }
+    } // }}} 
+    // {{{ collectChSelectedItems
     function collectChSelectedItems()
     {
         selectedItems = [];
                 selectedItems.push( this.value );
             }
         });
-        jQuery('#DDMediaAction_multipleNames').val(selectedItems.join("\n"));
-    }
+        console.log('selectedItems: ' + selectedItems.join("; "));
+        jQuery('#DDMediaAction_selectedItems, #DDMediaAction_selectedItemsOld').val(selectedItems.join("\n"));
+    } // }}} 
     // {{{ selectMedia
     function selectMedia(mediaType, path, name)
     {
         else
             doShowDialog=true;
         jQuery('#DDMediaAction_mediaType').val(mediaType);
-        jQuery('#DDMediaAction_path').val(path);
-        jQuery('#DDMediaAction_name, #DDMediaAction_oldName').val(name);
+        jQuery('#DDMediaAction_path').val(jQuery('#path').val());
+        jQuery('#DDMediaAction_selectedItems, #DDMediaAction_selectedItemsOld').val(name);
         selectedItem = name;
     } // }}} 
     // {{{ showDialog
     function showDialog(action)
     {
+        console.log('doShowDialog : ' + doShowDialog);
+        console.log('doBatchJob   : ' + doBatchJob);
         if(doShowDialog==false)
             return;
         jQuery('#mydialog').dialog('open');
         if(doBatchJob==false) {
+            // Single file
             jQuery('#mydialog').dialog({title:'<?php echo CHtml::encode(Yii::t('main', 'Item: ')); ?>'+selectedItem /* +' &rArr; '+action */ });
+            jQuery('#DDMediaAction_selectedItems, #DDMediaAction_selectedItemsOld').val(selectedItem);
         } else {
+            // Multiple files - batch job
+            collectChSelectedItems();
             jQuery('#mydialog').dialog({title:'Multiple Selection'});
             jQuery('#batchAction').val('');
         }
         jQuery('#DDMediaAction_action').val(action);
         jQuery('#mediaActionSubmitButton').val('Submit');
         jQuery('.msg').html('').hide();
-        jQuery('#selectedItemName').html(selectedItem);
-        jQuery('#nameRow, #multipleNamesRow, #nameRowDisplayOnly, #p1Row, #uploadedFileRow').hide();
+        jQuery('#p1Row, #uploadedFileRow').hide();
         switch(action)
         {
-            case 'rename':
+            case 'rename': // {{{ 
                 jQuery('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('main', 'Rename')); ?>');
                 jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('main', 'Enter the new name:')); ?>').show();
                 jQuery('#nameRowDisplayOnly, #p1Row').show();
                 jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'New Name')); ?>');
-                jQuery('#DDMediaAction_p1').val(jQuery('#DDMediaAction_name').val());
+                jQuery('#DDMediaAction_p1').val(selectedItem);
                 jQuery('#DDMediaAction_p1').focus().select();
-                break;
-            case 'copy':
+                break; // }}} 
+            case 'copy': // {{{ 
                 jQuery('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('main', 'Copy')); ?>');
                 jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('main', 'Enter the new destination and name:')); ?>').show();
-                jQuery('#nameRowDisplayOnly, #p1Row').show();
+                jQuery('#p1Row').show();
                 jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'New Dest. and Name')); ?>');
-                jQuery('#DDMediaAction_p1').val('./'+jQuery('#DDMediaAction_name').val());
+                jQuery('#DDMediaAction_p1').val('./'+selectedItem);
                 jQuery('#DDMediaAction_p1').focus().select();
-                break;
-            case 'move':
+                break; // }}} 
+            case 'move': // {{{
                 jQuery('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('main', 'Move')); ?>');
                 jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('main', 'Enter the new location:')); ?>').show();
                 if(doBatchJob==false) {
-                    jQuery('#nameRowDisplayOnly, #p1Row').show();
                     jQuery('#DDMediaAction_p1').val('./'+selectedItem);
                 } else {
-                    jQuery('#multipleNamesRow, #p1Row').show();
                     jQuery('#DDMediaAction_p1').val('./');
                 }
                 jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'Destination')); ?>');
-                jQuery('#DDMediaAction_p1').focus().select();
-                break;
-            case 'delete':
+                jQuery('#p1Row').show();
+                jQuery('#DDMediaAction_p1').show().focus().select();
+                break; // }}} 
+            case 'delete': // {{{ 
                 jQuery('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('main', 'Delete')); ?>');
                 jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('main', 'Confirm to delete this item:')); ?>').show();
                 jQuery('#nameRowDisplayOnly').show();
                 jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'File to delete')); ?>');
-                break;
-            case 'newdir':
+                break; // }}} 
+            case 'newdir': // {{{ 
                 jQuery('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('main', 'Create')); ?>');
                 jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('main', 'Enter the name for the new directory:')); ?>').show();
                 jQuery('#DDMediaAction_path').val(currentPath);
                 jQuery('#p1Row').show();
                 jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'New Directory')); ?>');
                 jQuery('#DDMediaAction_p1').val('').focus().select();
-                break;
-            case 'upload':
+                break; // }}} 
+            case 'upload': // {{{ 
                 jQuery('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('main', 'Upload')); ?>');
                 jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('main', 'Select a file to be uploaded:')); ?>').show();
                 jQuery('#DDMediaAction_path').val(currentPath);
                 jQuery('#uploadedFileRow').show();
                 jQuery('#DDMediaAction_uploadedFile').focus().select();
-                break;
+                break; // }}} 
         }
         doShowDialog=false;
     } // }}}