Author: jablko
Date: Thu Oct 28 00:21:19 2010
New Revision: 8607

Log:
Add slug to digital objects

Modified:
   trunk/apps/qubit/modules/digitalobject/templates/uploadFormSuccess.php
   trunk/lib/model/QubitDigitalObject.php
   trunk/vendor/symfony/lib/widget/sfWidgetFormInputFile.class.php

Modified: trunk/apps/qubit/modules/digitalobject/templates/uploadFormSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/uploadFormSuccess.php      
Thu Oct 28 00:02:15 2010        (r8606)
+++ trunk/apps/qubit/modules/digitalobject/templates/uploadFormSuccess.php      
Thu Oct 28 00:21:19 2010        (r8607)
@@ -12,9 +12,7 @@
 
     <legend><?php echo __('Upload a digital object') ?></legend>
 
-    <?php echo $form->file
-        ->help(-1 < $maxUploadSize ? __('Max. size ~%1%', array('%1%' => 
hr_filesize($maxUploadSize))) : null)
-        ->renderRow() ?>
+    <?php echo $form->file->renderRow() ?>
 
   </fieldset>
 

Modified: trunk/lib/model/QubitDigitalObject.php
==============================================================================
--- trunk/lib/model/QubitDigitalObject.php      Thu Oct 28 00:02:15 2010        
(r8606)
+++ trunk/lib/model/QubitDigitalObject.php      Thu Oct 28 00:21:19 2010        
(r8607)
@@ -27,12 +27,15 @@
  */
 class QubitDigitalObject extends BaseDigitalObject
 {
-  // Directory for generic icons
-  const GENERIC_ICON_DIR = 'generic-icons';
+  const
 
-  // Mime-type for thumbnails (including reference image)
-  const THUMB_MIME_TYPE = 'image/jpeg';
-  const THUMB_EXTENSION = 'jpg';
+    // Directory for generic icons
+    GENERIC_ICON_DIR = 'generic-icons',
+
+    // Mime-type for thumbnails (including reference image)
+    THUMB_MIME_TYPE = 'image/jpeg',
+
+    THUMB_EXTENSION = 'jpg';
 
   // Variables for save actions
   public
@@ -40,202 +43,203 @@
     $indexOnSave = true,
     $createDerivatives = true;
 
-  // Temporary path for local copy of an external object (see importFromUri 
method)
-  protected $localPath;
-
-  // List of web compatible image formats (supported in most major browsers)
-  protected static $webCompatibleImageFormats = array(
-    'image/jpeg',
-    'image/jpg',
-    'image/jpe',
-    'image/gif',
-    'image/png'
-  );
-
-  // Qubit Generic Icon list
-  protected static $qubitGenericThumbs = array(
-    'application/x-msaccess'        => 'icon-ms-access.gif',
-    'application/vnd.ms-excel'      => 'icon-ms-excel.gif',
-    'application/msword'            => 'icon-ms-word.gif',
-    'application/vnd.ms-powerpoint' => 'icon-ms-powerpoint.gif'
-  );
-
-  protected static $qubitGenericReference = array(
-    '*/*' => 'no_reference_rep.png'
-  );
-
   /*
    * The following mime-type array is taken from the Gallery 2 project
    * http://gallery.menalto.com
    */
-  public static $qubitMimeTypes = array(
-    /* This data was lifted from Apache's mime.types listing. */
-    'z' => 'application/x-compress',
-    'ai' => 'application/postscript',
-    'aif' => 'audio/x-aiff',
-    'aifc' => 'audio/x-aiff',
-    'aiff' => 'audio/x-aiff',
-    'asc' => 'text/plain',
-    'au' => 'audio/basic',
-    'avi' => 'video/x-msvideo',
-    'bcpio' => 'application/x-bcpio',
-    'bin' => 'application/octet-stream',
-    'bmp' => 'image/bmp',
-    'cdf' => 'application/x-netcdf',
-    'class' => 'application/octet-stream',
-    'cpio' => 'application/x-cpio',
-    'cpt' => 'application/mac-compactpro',
-    'csh' => 'application/x-csh',
-    'css' => 'text/css',
-    'dcr' => 'application/x-director',
-    'dir' => 'application/x-director',
-    'djv' => 'image/vnd.djvu',
-    'djvu' => 'image/vnd.djvu',
-    'dll' => 'application/octet-stream',
-    'dms' => 'application/octet-stream',
-    'doc' => 'application/msword',
-    'dvi' => 'application/x-dvi',
-    'dxr' => 'application/x-director',
-    'eps' => 'application/postscript',
-    'etx' => 'text/x-setext',
-    'exe' => 'application/octet-stream',
-    'ez' => 'application/andrew-inset',
-    'gif' => 'image/gif',
-    'gtar' => 'application/x-gtar',
-    'gz' => 'application/x-gzip',
-    'hdf' => 'application/x-hdf',
-    'hqx' => 'application/mac-binhex40',
-    'ice' => 'x-conference/x-cooltalk',
-    'ief' => 'image/ief',
-    'iges' => 'model/iges',
-    'igs' => 'model/iges',
-    'jpg' => 'image/jpeg',
-    'jpeg' => 'image/jpeg',
-    'jpe' => 'image/jpeg',
-    'js' => 'application/x-javascript',
-    'kar' => 'audio/midi',
-    'latex' => 'application/x-latex',
-    'lha' => 'application/octet-stream',
-    'lzh' => 'application/octet-stream',
-    'm3u' => 'audio/x-mpegurl',
-    'man' => 'application/x-troff-man',
-    'me' => 'application/x-troff-me',
-    'mesh' => 'model/mesh',
-    'mid' => 'audio/midi',
-    'midi' => 'audio/midi',
-    'mif' => 'application/vnd.mif',
-    'mov' => 'video/quicktime',
-    'movie' => 'video/x-sgi-movie',
-    'mp2' => 'audio/mpeg',
-    'mp3' => 'audio/mpeg',
-    'mpe' => 'video/mpeg',
-    'mpeg' => 'video/mpeg',
-    'mpg' => 'video/mpeg',
-    'mpga' => 'audio/mpeg',
-    'ms' => 'application/x-troff-ms',
-    'msh' => 'model/mesh',
-    'mxu' => 'video/vnd.mpegurl',
-    'nc' => 'application/x-netcdf',
-    'oda' => 'application/oda',
-    'pbm' => 'image/x-portable-bitmap',
-    'pdb' => 'chemical/x-pdb',
-    'pdf' => 'application/pdf',
-    'pgm' => 'image/x-portable-graymap',
-    'pgn' => 'application/x-chess-pgn',
-    'png' => 'image/png',
-    'pnm' => 'image/x-portable-anymap',
-    'ppm' => 'image/x-portable-pixmap',
-    'ppt' => 'application/vnd.ms-powerpoint',
-    'ps' => 'application/postscript',
-    'qt' => 'video/quicktime',
-    'ra' => 'audio/x-realaudio',
-    'ram' => 'audio/x-pn-realaudio',
-    'ras' => 'image/x-cmu-raster',
-    'rgb' => 'image/x-rgb',
-    'rm' => 'audio/x-pn-realaudio',
-    'roff' => 'application/x-troff',
-    'rpm' => 'audio/x-pn-realaudio-plugin',
-    'rtf' => 'text/rtf',
-    'rtx' => 'text/richtext',
-    'sgm' => 'text/sgml',
-    'sgml' => 'text/sgml',
-    'sh' => 'application/x-sh',
-    'shar' => 'application/x-shar',
-    'silo' => 'model/mesh',
-    'sit' => 'application/x-stuffit',
-    'skd' => 'application/x-koan',
-    'skm' => 'application/x-koan',
-    'skp' => 'application/x-koan',
-    'skt' => 'application/x-koan',
-    'smi' => 'application/smil',
-    'smil' => 'application/smil',
-    'snd' => 'audio/basic',
-    'so' => 'application/octet-stream',
-    'spl' => 'application/x-futuresplash',
-    'src' => 'application/x-wais-source',
-    'sv4cpio' => 'application/x-sv4cpio',
-    'sv4crc' => 'application/x-sv4crc',
-    'svg' => 'image/svg+xml',
-    'swf' => 'application/x-shockwave-flash',
-    't' => 'application/x-troff',
-    'tar' => 'application/x-tar',
-    'tcl' => 'application/x-tcl',
-    'tex' => 'application/x-tex',
-    'texi' => 'application/x-texinfo',
-    'texinfo' => 'application/x-texinfo',
-    'tif' => 'image/tiff',
-    'tiff' => 'image/tiff',
-    'tr' => 'application/x-troff',
-    'tsv' => 'text/tab-separated-values',
-    'txt' => 'text/plain',
-    'ustar' => 'application/x-ustar',
-    'vcd' => 'application/x-cdlink',
-    'vrml' => 'model/vrml',
-    'vsd' => 'application/vnd.visio',
-    'wav' => 'audio/x-wav',
-    'wbmp' => 'image/vnd.wap.wbmp',
-    'wbxml' => 'application/vnd.wap.wbxml',
-    'wml' => 'text/vnd.wap.wml',
-    'wmlc' => 'application/vnd.wap.wmlc',
-    'wmls' => 'text/vnd.wap.wmlscript',
-    'wmlsc' => 'application/vnd.wap.wmlscriptc',
-    'wrl' => 'model/vrml',
-    'xbm' => 'image/x-xbitmap',
-    'xls' => 'application/vnd.ms-excel',
-    'xpm' => 'image/x-xpixmap',
-    'xsl' => 'text/xml',
-    'xwd' => 'image/x-xwindowdump',
-    'xyz' => 'chemical/x-xyz',
-    'zip' => 'application/zip',
-
-    /* And additions from Gallery2 - http://codex.gallery2.org  */
-    /* From support.microsoft.com/support/kb/articles/Q284/0/94.ASP */
-    'asf' => 'video/x-ms-asf',
-    'asx' => 'video/x-ms-asx',
-    'wmv' => 'video/x-ms-wmv',
-    'wma' => 'audio/x-ms-wma',
-
-    /* JPEG 2000: From RFC 3745: http://www.faqs.org/rfcs/rfc3745.html */
-    'jp2' => 'image/jp2',
-    'jpg2' => 'image/jp2',
-    'jpf' => 'image/jpx',
-    'jpx' => 'image/jpx',
-    'mj2' => 'video/mj2',
-    'mjp2' => 'video/mj2',
-    'jpm' => 'image/jpm',
-    'jpgm' => 'image/jpgm',
-
-    /* Other */
-    'psd' => 'application/photoshop',
-    'pcd' => 'image/x-photo-cd',
-    'jpgcmyk' => 'image/jpeg-cmyk',
-    'tifcmyk' => 'image/tiff-cmyk',
-    'wmf' => 'image/wmf',
-    'tga' => 'image/tga',
-    'flv' => 'video/x-flv',
-    'mp4' => 'video/mp4',
-    'tgz' => 'application/x-compressed'
-  );
+  public static
+    $qubitMimeTypes = array(
+
+      /* This data was lifted from Apache's mime.types listing. */
+      'z' => 'application/x-compress',
+      'ai' => 'application/postscript',
+      'aif' => 'audio/x-aiff',
+      'aifc' => 'audio/x-aiff',
+      'aiff' => 'audio/x-aiff',
+      'asc' => 'text/plain',
+      'au' => 'audio/basic',
+      'avi' => 'video/x-msvideo',
+      'bcpio' => 'application/x-bcpio',
+      'bin' => 'application/octet-stream',
+      'bmp' => 'image/bmp',
+      'cdf' => 'application/x-netcdf',
+      'class' => 'application/octet-stream',
+      'cpio' => 'application/x-cpio',
+      'cpt' => 'application/mac-compactpro',
+      'csh' => 'application/x-csh',
+      'css' => 'text/css',
+      'dcr' => 'application/x-director',
+      'dir' => 'application/x-director',
+      'djv' => 'image/vnd.djvu',
+      'djvu' => 'image/vnd.djvu',
+      'dll' => 'application/octet-stream',
+      'dms' => 'application/octet-stream',
+      'doc' => 'application/msword',
+      'dvi' => 'application/x-dvi',
+      'dxr' => 'application/x-director',
+      'eps' => 'application/postscript',
+      'etx' => 'text/x-setext',
+      'exe' => 'application/octet-stream',
+      'ez' => 'application/andrew-inset',
+      'gif' => 'image/gif',
+      'gtar' => 'application/x-gtar',
+      'gz' => 'application/x-gzip',
+      'hdf' => 'application/x-hdf',
+      'hqx' => 'application/mac-binhex40',
+      'ice' => 'x-conference/x-cooltalk',
+      'ief' => 'image/ief',
+      'iges' => 'model/iges',
+      'igs' => 'model/iges',
+      'jpg' => 'image/jpeg',
+      'jpeg' => 'image/jpeg',
+      'jpe' => 'image/jpeg',
+      'js' => 'application/x-javascript',
+      'kar' => 'audio/midi',
+      'latex' => 'application/x-latex',
+      'lha' => 'application/octet-stream',
+      'lzh' => 'application/octet-stream',
+      'm3u' => 'audio/x-mpegurl',
+      'man' => 'application/x-troff-man',
+      'me' => 'application/x-troff-me',
+      'mesh' => 'model/mesh',
+      'mid' => 'audio/midi',
+      'midi' => 'audio/midi',
+      'mif' => 'application/vnd.mif',
+      'mov' => 'video/quicktime',
+      'movie' => 'video/x-sgi-movie',
+      'mp2' => 'audio/mpeg',
+      'mp3' => 'audio/mpeg',
+      'mpe' => 'video/mpeg',
+      'mpeg' => 'video/mpeg',
+      'mpg' => 'video/mpeg',
+      'mpga' => 'audio/mpeg',
+      'ms' => 'application/x-troff-ms',
+      'msh' => 'model/mesh',
+      'mxu' => 'video/vnd.mpegurl',
+      'nc' => 'application/x-netcdf',
+      'oda' => 'application/oda',
+      'pbm' => 'image/x-portable-bitmap',
+      'pdb' => 'chemical/x-pdb',
+      'pdf' => 'application/pdf',
+      'pgm' => 'image/x-portable-graymap',
+      'pgn' => 'application/x-chess-pgn',
+      'png' => 'image/png',
+      'pnm' => 'image/x-portable-anymap',
+      'ppm' => 'image/x-portable-pixmap',
+      'ppt' => 'application/vnd.ms-powerpoint',
+      'ps' => 'application/postscript',
+      'qt' => 'video/quicktime',
+      'ra' => 'audio/x-realaudio',
+      'ram' => 'audio/x-pn-realaudio',
+      'ras' => 'image/x-cmu-raster',
+      'rgb' => 'image/x-rgb',
+      'rm' => 'audio/x-pn-realaudio',
+      'roff' => 'application/x-troff',
+      'rpm' => 'audio/x-pn-realaudio-plugin',
+      'rtf' => 'text/rtf',
+      'rtx' => 'text/richtext',
+      'sgm' => 'text/sgml',
+      'sgml' => 'text/sgml',
+      'sh' => 'application/x-sh',
+      'shar' => 'application/x-shar',
+      'silo' => 'model/mesh',
+      'sit' => 'application/x-stuffit',
+      'skd' => 'application/x-koan',
+      'skm' => 'application/x-koan',
+      'skp' => 'application/x-koan',
+      'skt' => 'application/x-koan',
+      'smi' => 'application/smil',
+      'smil' => 'application/smil',
+      'snd' => 'audio/basic',
+      'so' => 'application/octet-stream',
+      'spl' => 'application/x-futuresplash',
+      'src' => 'application/x-wais-source',
+      'sv4cpio' => 'application/x-sv4cpio',
+      'sv4crc' => 'application/x-sv4crc',
+      'svg' => 'image/svg+xml',
+      'swf' => 'application/x-shockwave-flash',
+      't' => 'application/x-troff',
+      'tar' => 'application/x-tar',
+      'tcl' => 'application/x-tcl',
+      'tex' => 'application/x-tex',
+      'texi' => 'application/x-texinfo',
+      'texinfo' => 'application/x-texinfo',
+      'tif' => 'image/tiff',
+      'tiff' => 'image/tiff',
+      'tr' => 'application/x-troff',
+      'tsv' => 'text/tab-separated-values',
+      'txt' => 'text/plain',
+      'ustar' => 'application/x-ustar',
+      'vcd' => 'application/x-cdlink',
+      'vrml' => 'model/vrml',
+      'vsd' => 'application/vnd.visio',
+      'wav' => 'audio/x-wav',
+      'wbmp' => 'image/vnd.wap.wbmp',
+      'wbxml' => 'application/vnd.wap.wbxml',
+      'wml' => 'text/vnd.wap.wml',
+      'wmlc' => 'application/vnd.wap.wmlc',
+      'wmls' => 'text/vnd.wap.wmlscript',
+      'wmlsc' => 'application/vnd.wap.wmlscriptc',
+      'wrl' => 'model/vrml',
+      'xbm' => 'image/x-xbitmap',
+      'xls' => 'application/vnd.ms-excel',
+      'xpm' => 'image/x-xpixmap',
+      'xsl' => 'text/xml',
+      'xwd' => 'image/x-xwindowdump',
+      'xyz' => 'chemical/x-xyz',
+      'zip' => 'application/zip',
+
+      /* And additions from Gallery2 - http://codex.gallery2.org  */
+      /* From support.microsoft.com/support/kb/articles/Q284/0/94.ASP */
+      'asf' => 'video/x-ms-asf',
+      'asx' => 'video/x-ms-asx',
+      'wmv' => 'video/x-ms-wmv',
+      'wma' => 'audio/x-ms-wma',
+
+      /* JPEG 2000: From RFC 3745: http://www.faqs.org/rfcs/rfc3745.html */
+      'jp2' => 'image/jp2',
+      'jpg2' => 'image/jp2',
+      'jpf' => 'image/jpx',
+      'jpx' => 'image/jpx',
+      'mj2' => 'video/mj2',
+      'mjp2' => 'video/mj2',
+      'jpm' => 'image/jpm',
+      'jpgm' => 'image/jpgm',
+
+      /* Other */
+      'psd' => 'application/photoshop',
+      'pcd' => 'image/x-photo-cd',
+      'jpgcmyk' => 'image/jpeg-cmyk',
+      'tifcmyk' => 'image/tiff-cmyk',
+      'wmf' => 'image/wmf',
+      'tga' => 'image/tga',
+      'flv' => 'video/x-flv',
+      'mp4' => 'video/mp4',
+      'tgz' => 'application/x-compressed');
+
+  // Temporary path for local copy of an external object (see importFromUri
+  // method)
+  protected
+    $localPath;
+
+  // List of web compatible image formats (supported in most major browsers)
+  protected static
+    $webCompatibleImageFormats = array(
+      'image/jpeg',
+      'image/jpg',
+      'image/jpe',
+      'image/gif',
+      'image/png'),
+
+    // Qubit generic icon list
+    $qubitGenericThumbs = array(
+      'application/x-msaccess'        => 'icon-ms-access.gif',
+      'application/vnd.ms-excel'      => 'icon-ms-excel.gif',
+      'application/msword'            => 'icon-ms-word.gif',
+      'application/vnd.ms-powerpoint' => 'icon-ms-powerpoint.gif'),
+
+    $qubitGenericReference = array(
+      '*/*' => 'no_reference_rep.png');
 
   public function __toString()
   {
@@ -271,6 +275,16 @@
     return call_user_func_array(array($this, 'BaseDigitalObject::__get'), 
$args);
   }
 
+  protected function insert($connection = null)
+  {
+    if (!isset($this->slug))
+    {
+      $this->slug = QubitSlug::slugify($this->name);
+    }
+
+    return parent::insert($connection);
+  }
+
   public function save($connection = null)
   {
     // TODO: $cleanInformationObject = $this->informationObject->clean;

Modified: trunk/vendor/symfony/lib/widget/sfWidgetFormInputFile.class.php
==============================================================================
--- trunk/vendor/symfony/lib/widget/sfWidgetFormInputFile.class.php     Thu Oct 
28 00:02:15 2010        (r8606)
+++ trunk/vendor/symfony/lib/widget/sfWidgetFormInputFile.class.php     Thu Oct 
28 00:21:19 2010        (r8607)
@@ -50,7 +50,14 @@
     $this->setOption('type', 'file');
     $this->setOption('needs_multipart', true);
 
-    $size = min($this->getBytes(ini_get('post_max_size')), 
$this->getBytes(ini_get('upload_max_filesize')));
+    $size = $this->getBytes(ini_get('post_max_size'));
+
+    $uploadMaxFilesize = $this->getBytes(ini_get('upload_max_filesize'));
+    if (0 < $uploadMaxFilesize)
+    {
+      $size = $uploadMaxFilesize;
+    }
+
     foreach (array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB') as 
$unit)
     {
       // 0.9# if > 1000, ### if < 1000

-- 
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