Commits

Joachim Werner committed 82d0a6d

Added translations
Fixied upload and new dir to work with new multiple selection dialog

Comments (0)

Files changed (6)

controllers/DefaultController.php

                                 '{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->selectedItemsOld)));
+                            Yii::app()->user->setFlash('success',Yii::t('main','The file <em>{oldName}</em> has been uploaded as <em>{name}</em>.',array('{name}'=>$mediaAction->selectedItems, '{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)));

messages/de/main.php

  * @version $Id: $
  */
 return array (
+  'Copy' => 'Kopieren',
+  'New Dest. and Name' => 'Neues Ziel und Name',
+  'Selected Items' => 'Ausgewählte Objekte',
+  'Selected Items (old)' => 'Ausgewählte Objekte (vorher)',
+  'The {mediaType} <em>{name}</em> has been copied to <em>{p1}</em>.' => '',
   '(Batch Action)' => '(Mehrfach-Aktion)',
-  'Create' => 'Anlegen',
-  'Delete' => 'Löschen',
-  'Destination' => 'Ziel',
-  'File to delete' => 'Zu löschende Datei',
-  'Item: ' => 'Objekt: ',
-  'Move' => 'Verschieben',
-  'New Directory' => 'Neues Verzeichnis',
-  'New Name' => 'Neuer Name',
-  'Rename' => 'Umbenennen',
-  'Upload' => 'Hochladen',
   'Action' => 'Aktion',
   'Base Path' => 'Basis-Pfad',
   'Confirm to delete this item:' => 'Bestätigen Sie das Löschen dieses Objekts:',
   'Copy directory {dir}' => 'Verzeichnis {dir} kopieren',
   'Copy file {file}' => 'Datei {dir} kopieren',
+  'Create' => 'Anlegen',
   'Create New Dir' => 'Neues Verzeichnis anlegen',
   'Date' => 'Datum',
+  'Delete' => 'Löschen',
   'Delete directory {dir}' => 'Verzeichnis {dir} löschen',
   'Delete file {file}' => 'Datei {file} löschen',
+  'Destination' => 'Ziel',
   'Directory' => 'Verzeichnis',
   'Enter the name for the new directory:' => 'Geben Sie den Namen für das neue Verzeichnis ein:',
-  'Enter the new location:' => 'Geben Sie den neuen Ort ein:',
   'Enter the new destination and name:' => 'Geben Sie den neuen Ort und Namen ein:',
+  'Enter the new location:' => 'Geben Sie den neuen Ort ein:',
   'Enter the new name:' => 'Geben Sie den neuen Namen ein:',
+  'File to delete' => 'Zu löschende Datei',
   'Icon' => 'Icon',
   'IconCopy' => 'C',
   'IconDelete' => 'X',
   'IconMove' => 'V',
   'IconRename' => 'U',
+  'Item: ' => 'Objekt: ',
   'Media Browser' => 'Media-Browser',
   'Media Type' => 'Medien-Typ',
+  'Move' => 'Verschieben',
   'Move directory {dir}' => 'Verzeichnis {dir} verschieben',
   'Move file {file} to another location' => 'Datei {file} an einen anderen Ort verschieben',
   'Name' => 'Name',
-  'Old Name' => 'Bisheriger Name',
+  'New Directory' => 'Neues Verzeichnis',
+  'New Name' => 'Neuer Name',
   'Parameter 1' => 'Parameter 1',
   'Path' => 'Pfad',
+  'Rename' => 'Umbenennen',
   'Rename directory {dir}' => 'Verzeichnis {dir} umbenennen',
   'Rename file {file}' => 'Datei {file} umbenennen',
   'Select a file to be uploaded:' => 'Wählen Sie eine Datei zum Hochladen aus:',
   'The {mediaType} <em>{name}</em> has been moved to <em>{path}/{p1}</em>.' => '{mediaType} <em>{name}</em> wurde verschoben nach <em>{path}/{p1}</em>.',
   'The {mediaType} <em>{name}</em> has been renamed to <em>{p1}</em>.' => '{mediaType} <em>{name}</em> wurde umbenannt nach <em>{p1}</em>.',
   'Type' => 'Typ',
+  'Upload' => 'Hochladen',
   'Upload File' => 'Datei hochladen',
   'directory' => 'Verzeichnis',
   'file' => 'Datei',

messages/en_us/main.php

+<?php
+/**
+ * Message translations.
+ *
+ * This file is automatically generated by 'yiic message' command.
+ * It contains the localizable messages extracted from source code.
+ * You may modify this file by translating the extracted messages.
+ *
+ * Each array element represents the translation (value) of a message (key).
+ * If the value is empty, the message is considered as not translated.
+ * Messages that no longer need translation will have their translations
+ * enclosed between a pair of '@@' marks.
+ *
+ * Message string can be used with plural forms format. Check i18n section
+ * of the guide for details.
+ *
+ * NOTE, this file must be saved in UTF-8 encoding.
+ *
+ * @version $Id: $
+ */
+return array (
+  '(Batch Action)' => '',
+  'Action' => '',
+  'Base Path' => '',
+  'Confirm to delete this item:' => '',
+  'Copy' => '',
+  'Copy directory {dir}' => '',
+  'Copy file {file}' => '',
+  'Create' => '',
+  'Create New Dir' => '',
+  'Date' => '',
+  'Delete' => '',
+  'Delete directory {dir}' => '',
+  'Delete file {file}' => '',
+  'Destination' => '',
+  'Directory' => '',
+  'Enter the name for the new directory:' => '',
+  'Enter the new destination and name:' => '',
+  'Enter the new location:' => '',
+  'Enter the new name:' => '',
+  'File to delete' => '',
+  'Icon' => '',
+  'IconCopy' => '',
+  'IconDelete' => '',
+  'IconMove' => '',
+  'IconRename' => '',
+  'Item: ' => '',
+  'Media Browser' => '',
+  'Media Type' => '',
+  'Move' => '',
+  'Move directory {dir}' => '',
+  'Move file {file} to another location' => '',
+  'Name' => '',
+  'New Dest. and Name' => '',
+  'New Directory' => '',
+  'New Name' => '',
+  'Parameter 1' => '',
+  'Path' => '',
+  'Rename' => '',
+  'Rename directory {dir}' => '',
+  'Rename file {file}' => '',
+  'Select a file to be uploaded:' => '',
+  'Selected Items' => '',
+  'Selected Items (old)' => '',
+  'Size' => '',
+  'The directory <em>{p1}</em> has been created.' => '',
+  'The file <em>{oldName}</em> has been uploaded as <em>{name}</em>.' => '',
+  'The {mediaType} <em>{name}</em> has been copied to <em>{p1}</em>.' => '',
+  'The {mediaType} <em>{name}</em> has been deleted.' => '',
+  'The {mediaType} <em>{name}</em> has been moved to <em>{path}/{p1}</em>.' => '',
+  'The {mediaType} <em>{name}</em> has been renamed to <em>{p1}</em>.' => '',
+  'Type' => '',
+  'Upload' => '',
+  'Upload File' => '',
+  'directory' => '',
+  'file' => '',
+);

models/DDMediaAction.php

                 }
                 break; // }}} 
             case 'upload': // {{{ 
+                var_dump($this->attributes);
                 $this->uploadedFile=CUploadedFile::getInstance($this,'uploadedFile');
-                $fileName = $this->oldName = $this->uploadedFile->name;
+                $fileName = $this->selectedItemsOld = $this->uploadedFile->name;
                 // Check if file already exists?
                 $filePathAndName = $this->path.'/'.basename($fileName);
                 $i=0;
                 while(is_file($filePathAndName.$add))
                     $add = '.'.(++$i+1);
                 $result = $this->uploadedFile->saveAs($this->path.'/'.basename($fileName).$add);
-                if($this->oldName!==basename($fileName).$add)
-                    $this->name = basename($fileName).$add;
+                if($this->selectedItemsOld!==basename($fileName).$add)
+                    $this->selectedItems = basename($fileName).$add;
                 break; // }}} 
             case 'newdir': // {{{ 
                 $newDir = $this->path.'/'.$this->p1;
                 if(!is_dir($newDir))
                     $result = @mkdir($newDir, 0770);
+                if(is_dir($newDir))
+                    $result = true;
                 break; // }}} 
         }
         return $result;

views/default/index.php

 <h1><?php echo CHtml::encode(Yii::t('main', 'Media Browser')); ?></h1>
 
 <?php 
+/* DEBUG
 echo "<li>basePath: ".$basePath; 
 echo "<li>path: ".$path; 
 echo "<li>currentPath: ".$currentPath; 
+ */
 ?>
 
 <?php
             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('#DDMediaAction_path').val(jQuery('#path').val());
+                jQuery('#selectedItemsRow').hide();
                 jQuery('#p1Row').show();
                 jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'New Directory')); ?>');
                 jQuery('#DDMediaAction_p1').val('').focus().select();
             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('#DDMediaAction_path').val(jQuery('#path').val());
+                jQuery('#selectedItemsRow').hide();
                 jQuery('#uploadedFileRow').show();
                 jQuery('#DDMediaAction_uploadedFile').focus().select();
                 break; // }}} 

views/default/textPreview.php

-<pre style="font-family:'Courier New';font-size:8pt;">
+<pre style="font-family:'Courier New';font-size:8pt;height:400px;overflow:auto;">
 <?php echo file_get_contents($path); ?>
 </pre>