Author: sevein
Date: Tue Aug 16 11:03:43 2011
New Revision: 9496

Log:
Cleanups in digitalobject edit template before upcoming integration with the 
rights component

Modified:
   trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php
   trunk/apps/qubit/modules/digitalobject/templates/_editRepresentation.php
   trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php

Modified: trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php Tue Aug 
16 11:01:22 2011        (r9495)
+++ trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php Tue Aug 
16 11:03:43 2011        (r9496)
@@ -76,17 +76,33 @@
       }
     }
 
-    // If reference represenation doesn't exist, include upload widget
+    $maxUploadSize = QubitDigitalObject::getMaxUploadSize();
+
+    ProjectConfiguration::getActive()->loadHelpers('Qubit');
+
+    // If reference representation doesn't exist, include upload widget
     foreach ($this->representations as $usageId => $representation)
     {
       if (null === $representation)
       {
-        $this->form->setValidator("repFile_$usageId", new sfValidatorFile);
-        $this->form->setWidget("repFile_$usageId", new sfWidgetFormInputFile);
+        $repName = "repFile_$usageId";
+        $derName = "generateDerivative_$usageId";
+
+        $this->form->setValidator($repName, new sfValidatorFile);
+        $this->form->setWidget($repName, new sfWidgetFormInputFile);
 
+        if (-1 < $maxUploadSize)
+        {
+          
$this->form->getWidgetSchema()->$repName->setHelp($this->context->i18n->__('Max.
 size ~%1%', array('%1%' => hr_filesize($maxUploadSize))));
+        }
+        else
+        {
+          $this->form->getWidgetSchema()->$repName->setHelp('');
+        }
+        
         // Add "auto-generate" checkbox
-        $this->form->setValidator("generateDerivative_$usageId", new 
sfValidatorBoolean);
-        $this->form->setWidget("generateDerivative_$usageId", new 
sfWidgetFormInputCheckbox(array(), array('value' => 1)));
+        $this->form->setValidator($derName, new sfValidatorBoolean);
+        $this->form->setWidget($derName, new 
sfWidgetFormInputCheckbox(array(), array('value' => 1)));
       }
     }
   }
@@ -99,9 +115,6 @@
 
     $this->informationObject = new QubitInformationObject;
 
-    // Get max upload size limits
-    $this->maxUploadSize = QubitDigitalObject::getMaxUploadSize();
-
     // If digital object already exists (template: edit)
     if (isset($this->getRoute()->resource))
     {

Modified: 
trunk/apps/qubit/modules/digitalobject/templates/_editRepresentation.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/_editRepresentation.php    
Tue Aug 16 11:01:22 2011        (r9495)
+++ trunk/apps/qubit/modules/digitalobject/templates/_editRepresentation.php    
Tue Aug 16 11:03:43 2011        (r9496)
@@ -1,35 +1,23 @@
-<div class="multiFileUpload">
-  <div class="multiFileUploadItem">
+<div>
 
-    <div class="multiFileUploadThumbItem">
-      <?php echo get_component('digitalobject', 'show', array(
-        'iconOnly' => true,
-        'link' => public_path($representation->getFullPath()),
-        'resource' => $representation,
-        'usageType' => QubitTerm::THUMBNAIL_ID)) ?>
-    </div>
-
-    <div class="multiFileUploadInfo">
-
-      <div>
-        <span class="title"><?php echo __('%1% representation', array('%1%' => 
$representation->usage)) ?></span>
-      </div>
-
-      <div class="multiFileUploadFilename">
-        <span class="title"><?php echo __('Filename') ?>:</span>
-        <span class="value"><?php echo $representation->name ?></span>
-      </div>
-
-      <div class="multiFileUploadFilesize">
-        <span class="title"><?php echo __('Filesize') ?>:</span>
-        <span class="value"><?php echo hr_filesize($representation->byteSize); 
?></span>
-      </div>
-
-      <div class="multiFileUploadInfoActions">
-        <?php echo link_to(__('Delete'), array($representation, 'module' => 
'digitalobject', 'action' => 'delete')) ?>
-      </div>
+  <div style="float: right;">
 
-    </div>
+    <?php echo get_component('digitalobject', 'show', array(
+      'iconOnly' => true,
+      'link' => public_path($representation->getFullPath()),
+      'resource' => $representation,
+      'usageType' => QubitTerm::THUMBNAIL_ID)) ?>
 
   </div>
+
+  <div>
+
+    <?php echo render_show(__('Filename'), $representation->name) ?>
+
+    <?php echo render_show(__('Filesize'), 
hr_filesize($representation->byteSize)) ?>
+
+    <?php echo link_to(__('Delete'), array($representation, 'module' => 
'digitalobject', 'action' => 'delete')) ?>
+
+  </div>
+
 </div>

Modified: trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php    Tue Aug 
16 11:01:22 2011        (r9495)
+++ trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php    Tue Aug 
16 11:03:43 2011        (r9496)
@@ -30,46 +30,33 @@
 
   </fieldset>
 
-  <fieldset class="collapsible collapsed">
+  <?php foreach ($representations as $usageId => $representation): ?>
 
-    <legend><?php echo __('Representations') ?></legend>
+    <fieldset class="collapsible">
+
+      <legend><?php echo __('%1% representation', array('%1%' => 
QubitTerm::getById($usageId))) ?></legend>
 
-    <?php foreach ($representations as $usageId => $representation): ?>
       <?php if (isset($representation)): ?>
+
         <?php echo get_component('digitalobject', 'editRepresentation', 
array('resource' => $resource, 'representation' => $representation)) ?>
+
       <?php else: ?>
-        <table>
-          <thead>
-            <tr>
-              <th>
-                <?php echo __('Add a new %1% representation', array('%1%' => 
QubitTerm::getById($usageId))) ?>
-              </th>
-            </tr>
-          </thead><tbody>
-            <tr>
-              <td>
-
-                <?php echo __('Select a digital object to upload') ?>
-
-                <?php if (-1 < $maxUploadSize): ?>
-                  <span class="note"><?php echo __('Max. size ~%1%', 
array('%1%' => hr_filesize($maxUploadSize))) ?></span>
-                <?php endif; ?>
-
-                <?php echo $form["repFile_$usageId"] ?>
-
-                <?php if ($resource->canThumbnail()): ?>
-                  <?php echo __('<em>or</em> Auto-generate a new 
representation from master image') ?>
-                  <?php echo $form["generateDerivative_$usageId"] ?>
-                <?php endif; ?>
-
-              </td>
-            </tr>
-          </tbody>
-        </table>
+
+        <?php echo $form["repFile_$usageId"]
+          ->label(__('Select a digital object to upload'))
+          ->renderRow() ?>
+
+        <?php if ($resource->canThumbnail()): ?>
+          <?php echo $form["generateDerivative_$usageId"]
+            ->label('Or auto-generate a new representation from master image')
+            ->renderRow() ?>
+        <?php endif; ?>
+
       <?php endif; ?>
-    <?php endforeach; ?>
 
-  </fieldset>
+    </fieldset>
+
+  <?php endforeach; ?>
 
   <div class="actions section">
 

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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/qubit-commits?hl=en.

Reply via email to