Joachim Werner avatar Joachim Werner committed 9ff727b

Added module property 'tableCssClass'
Changed Yii::t domain to 'MediaModule.main'

Comments (0)

Files changed (5)

     public $logTag = 'application.modules.media';
 
     public $baseDir;
+
+    public $tableCssClass;
     
     // getAssetsUrl()
     //    return the URL for this module's assets, performing the publish operation

controllers/DefaultController.php

             if($mediaAction->validate()) {
                 $result = $mediaAction->doAction();
                 if($result==true) {
-                    $mediaAction->mediaType = $mediaAction->mediaType=='directory' ? Yii::t('main', 'directory') : Yii::t('main', 'file');
+                    $mediaAction->mediaType = $mediaAction->mediaType=='directory' ? Yii::t('MediaModule.main', 'directory') : Yii::t('MediaModule.main', 'file');
                     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('MediaModule.main','The {mediaType} <em>{name}</em> has been renamed to <em>{p1}</em>.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->oldName,'{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('MediaModule.main','The {mediaType} <em>{name}</em> has been copied to <em>{p1}</em>.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->oldName,'{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('MediaModule.main','The {mediaType} <em>{name}</em> has been deleted.',array('{mediaType}'=>$mediaAction->mediaType,'{name}'=>$mediaAction->oldName)));
                             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(
+                            Yii::app()->user->setFlash('success',Yii::t('MediaModule.main','The {mediaType} <em>{name}</em> has been moved to <em>{path}/{p1}</em>.',array(
                                 '{mediaType}'=>$mediaAction->mediaType,
                                 '{name}'=>$mediaAction->oldName,
                                 '{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('MediaModule.main','The file <em>{oldName}</em> has been uploaded as <em>{name}</em>.',array('{name}'=>$mediaAction->name, '{oldName}'=>$mediaAction->oldName)));
                             break;
                         case 'newdir':
-                            Yii::app()->user->setFlash('success',Yii::t('main','The directory <em>{p1}</em> has been created.',array('{p1}'=>$mediaAction->p1)));
+                            Yii::app()->user->setFlash('success',Yii::t('MediaModule.main','The directory <em>{p1}</em> has been created.',array('{p1}'=>$mediaAction->p1)));
                             break;
                     }
                 } else {

messages/de/main.php

   'Enter the new destination and name:' => 'Geben Sie den neuen Ort und Namen ein:',
   'Enter the new name:' => 'Geben Sie den neuen Namen ein:',
   'Icon' => 'Icon',
-  'IconCopy' => 'C',
-  'IconDelete' => 'X',
-  'IconMove' => 'V',
-  'IconRename' => 'U',
+  'C' => 'C',
+  'X' => 'X',
+  'M' => 'V',
+  'R' => 'U',
   'Media Browser' => 'Media-Browser',
   'Media Type' => 'Medien-Typ',
   'Move directory {dir}' => 'Verzeichnis {dir} verschieben',

models/DDMediaAction.php

     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('MediaModule.main','Path'),
+            'name'          => Yii::t('MediaModule.main','Name'),
+            'multipleNames' => Yii::t('MediaModule.main','Multiple Selection'),
+            'oldName'       => Yii::t('MediaModule.main','Old Name'),
+            'mediaType'     => Yii::t('MediaModule.main','Media Type'),
+            'action'        => Yii::t('MediaModule.main','Action'),
+            'p1'            => Yii::t('MediaModule.main','Parameter 1'),
+            'uploadedFile'  => Yii::t('MediaModule.main','Upload File'),
         );
     } // }}}
     // {{{ doAction

views/default/index.php

     //array('label'=>'Rename','url'=>'javascript:void(0)', 'linkOptions'=>array('onclick'=>"showDialog('rename');")),
     //array('label'=>'Move','url'=>'javascript:void(0)', 'linkOptions'=>array('onclick'=>"showDialog('move');")),
     //array('label'=>'Delete','url'=>'javascript:void(0)', 'linkOptions'=>array('onclick'=>"showDialog('delete');")),
-    array('label'=>Yii::t('main','Create New Dir'),'url'=>'javascript:void(0)', 'linkOptions'=>array('onclick'=>"doShowDialog=true;showDialog('newdir');")),
-    array('label'=>Yii::t('main','Upload File'),'url'=>'javascript:void(0)', 'linkOptions'=>array('onclick'=>"doShowDialog=true;showDialog('upload');")),
+    array('label'=>Yii::t('MediaModule.main','Create New Dir'),'url'=>'javascript:void(0)', 'linkOptions'=>array('onclick'=>"doShowDialog=true;showDialog('newdir');")),
+    array('label'=>Yii::t('MediaModule.main','Upload File'),'url'=>'javascript:void(0)', 'linkOptions'=>array('onclick'=>"doShowDialog=true;showDialog('upload');")),
 );
 ?>
 
-<h1><?php echo CHtml::encode(Yii::t('main', 'Media Browser')); ?></h1>
+<h1><?php echo CHtml::encode(Yii::t('MediaModule.main', 'Media Browser')); ?></h1>
 
 <?php
     foreach(Yii::app()->user->getFlashes() as $key => $message) {
 // var_dump($dirsBreadcrumbs2);
 $links[] = array(
     'link'=>CHtml::link(
-        Yii::t('main','Base Path'),
+        Yii::t('MediaModule.main','Base Path'),
         array('index')),
     'subDirs'=>DDMediaDirectory::getSubDirs($basePath)
 );
 // DDVarDumper::dumpAsList($files); 
 ?>
 
-<table class="media-items">
+<table class="media-items<?php echo !is_null($this->module->tableCssClass) ? ' '.$this->module->tableCssClass : ''; ?>">
     <thead>
         <tr>
             <th><input type="checkbox" value="" onclick="toggleAll(this.checked);" /></th>
-            <th><?php echo CHtml::encode(Yii::t('main', 'Icon')); ?></th>
-            <th><?php echo CHtml::encode(Yii::t('main', 'Name')); ?></th>
-            <th><?php echo CHtml::encode(Yii::t('main', 'Date')); ?></th>
-            <th><?php echo CHtml::encode(Yii::t('main', 'Type')); ?></th>
-            <th><?php echo CHtml::encode(Yii::t('main', 'Size')); ?></th>
-            <th><?php echo CHtml::encode(Yii::t('main', 'Action')); ?></th>
+            <th><?php echo CHtml::encode(Yii::t('MediaModule.main', 'Icon')); ?></th>
+            <th><?php echo CHtml::encode(Yii::t('MediaModule.main', 'Name')); ?></th>
+            <th><?php echo CHtml::encode(Yii::t('MediaModule.main', 'Date')); ?></th>
+            <th><?php echo CHtml::encode(Yii::t('MediaModule.main', 'Type')); ?></th>
+            <th><?php echo CHtml::encode(Yii::t('MediaModule.main', 'Size')); ?></th>
+            <th><?php echo CHtml::encode(Yii::t('MediaModule.main', 'Action')); ?></th>
         </tr>
     </thead>
     <tbody>
             <td class="folder"><?php echo CHtml::image($this->module->assetsUrl.'/filetypeicons/folder.png',$stats['name']); ?></td>
             <td><?php echo CHtml::link($stats['name'],array('index','p'=>urlencode($path.'/'.$stats['name']))); ?></td>
             <td>&ndash;</td>
-            <td><?php echo CHtml::encode(Yii::t('main','Directory')); ?></td>
+            <td><?php echo CHtml::encode(Yii::t('MediaModule.main','Directory')); ?></td>
             <td style="white-space:nowrap;font-size:smaller;text-align:right"><?php echo $stats['size']; ?></td>
             <td style="white-space:nowrap;font-size:smaller">
                 <?php if(!in_array($stats['name'],array('..'))) : ?>
-                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('rename');" title="<?php echo Yii::t('main', 'Rename directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconRename')); ?></a>&nbsp;
-                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('copy');" title="<?php echo Yii::t('main', 'Copy directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconCopy')); ?></a>&nbsp;
-                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('move');" title="<?php echo Yii::t('main', 'Move directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconMove')); ?></a>&nbsp;
-                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('delete');" title="<?php echo Yii::t('main', 'Delete directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconDelete')); ?></a>
+                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('rename');" title="<?php echo Yii::t('MediaModule.main', 'Rename directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'R')); ?></a>&nbsp;
+                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('copy');" title="<?php echo Yii::t('MediaModule.main', 'Copy directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'C')); ?></a>&nbsp;
+                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('move');" title="<?php echo Yii::t('MediaModule.main', 'Move directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'M')); ?></a>&nbsp;
+                <a href="javascript:void(0)" onclick="selectMedia('directory','<?php echo $dirPath; ?>','<?php echo $stats['name']; ?>');showDialog('delete');" title="<?php echo Yii::t('MediaModule.main', 'Delete directory {dir}', array('{dir}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'X')); ?></a>
                 <?php endif; ?>
             </td>
         </tr>
             <td><?php echo $stats['mimeType']; ?></td>
             <td style="white-space:nowrap;font-size:smaller;text-align:right"><?php echo $stats['sizeFormatted']; ?></td>
             <td style="white-space:nowrap;font-size:smaller">
-                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('rename');" title="<?php echo Yii::t('main', 'Rename file {file}', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconRename')); ?></a>&nbsp;
-                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('copy');" title="<?php echo Yii::t('main', 'Copy file {file}', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconCopy')); ?></a>&nbsp;
-                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('move');" title="<?php echo Yii::t('main', 'Move file {file} to another location', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconMove')); ?></a>&nbsp;
-                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('delete');" title="<?php echo Yii::t('main', 'Delete file {file}', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('main', 'IconDelete')); ?></a>
+                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('rename');" title="<?php echo Yii::t('MediaModule.main', 'Rename file {file}', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'R')); ?></a>&nbsp;
+                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('copy');" title="<?php echo Yii::t('MediaModule.main', 'Copy file {file}', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'C')); ?></a>&nbsp;
+                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('move');" title="<?php echo Yii::t('MediaModule.main', 'Move file {file} to another location', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'M')); ?></a>&nbsp;
+                <a href="javascript:void(0)" onclick="selectMedia('file','<?php echo $filePath; ?>','<?php echo $stats['name']; ?>');showDialog('delete');" title="<?php echo Yii::t('MediaModule.main', 'Delete file {file}', array('{file}'=>$stats['name'])); ?>"><?php echo CHtml::encode(Yii::t('MediaModule.main', 'X')); ?></a>
             </td>
         </tr>
         <?php endforeach; ?>
             return;
         jQuery('#mydialog').dialog('open');
         if(doBatchJob==false) {
-            jQuery('#mydialog').dialog({title:'<?php echo CHtml::encode(Yii::t('main', 'Item: ')); ?>'+selectedItem /* +' &rArr; '+action */ });
+            jQuery('#mydialog').dialog({title:'<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Item: ')); ?>'+selectedItem /* +' &rArr; '+action */ });
         } else {
             jQuery('#mydialog').dialog({title:'Multiple Selection'});
             jQuery('#batchAction').val('');
         switch(action)
         {
             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('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Rename')); ?>');
+                jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('MediaModule.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('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'New Name')); ?>');
                 jQuery('#DDMediaAction_p1').val(jQuery('#DDMediaAction_name').val());
                 jQuery('#DDMediaAction_p1').focus().select();
                 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('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Copy')); ?>');
+                jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Enter the new destination and name:')); ?>').show();
                 jQuery('#nameRowDisplayOnly, #p1Row').show();
-                jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'New Dest. and Name')); ?>');
+                jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'New Dest. and Name')); ?>');
                 jQuery('#DDMediaAction_p1').val('./'+jQuery('#DDMediaAction_name').val());
                 jQuery('#DDMediaAction_p1').focus().select();
                 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();
+                jQuery('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Move')); ?>');
+                jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Enter the new location:')); ?>').show();
                 if(doBatchJob==false) {
                     jQuery('#nameRowDisplayOnly, #p1Row').show();
                     jQuery('#DDMediaAction_p1').val('./'+selectedItem);
                     jQuery('#multipleNamesRow, #p1Row').show();
                     jQuery('#DDMediaAction_p1').val('./');
                 }
-                jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('main', 'Destination')); ?>');
+                jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Destination')); ?>');
                 jQuery('#DDMediaAction_p1').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('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Delete')); ?>');
+                jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('MediaModule.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')); ?>');
+                jQuery('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'File to delete')); ?>');
                 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('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Create')); ?>');
+                jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('MediaModule.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('label[for=DDMediaAction_p1]').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'New Directory')); ?>');
                 jQuery('#DDMediaAction_p1').val('').focus().select();
                 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('#mediaActionSubmitButton').val('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Upload')); ?>');
+                jQuery('.msg').html('<?php echo CHtml::encode(Yii::t('MediaModule.main', 'Select a file to be uploaded:')); ?>').show();
                 jQuery('#DDMediaAction_path').val(currentPath);
                 jQuery('#uploadedFileRow').show();
                 jQuery('#DDMediaAction_uploadedFile').focus().select();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.