|
From: Greg M. <bli...@us...> - 2008-03-30 14:18:42
|
Update of /cvsroot/phpwebsite-comm/modules/featuredphoto/boost In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24414/boost Modified Files: boost.php dependency.xml update.php Log Message: Now works with File Cabinet 2.0 Index: dependency.xml =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/featuredphoto/boost/dependency.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dependency.xml 23 Jan 2008 04:04:17 -0000 1.5 --- dependency.xml 30 Mar 2008 14:18:12 -0000 1.6 *************** *** 10,14 **** <title>filecabinet</title> <properName>File Cabinet</properName> ! <version>1.3.0</version> <url>http://phpwebsite.appstate.edu/downloads/modules/filecabinet/</url> </module> --- 10,14 ---- <title>filecabinet</title> <properName>File Cabinet</properName> ! <version>2.0.0</version> <url>http://phpwebsite.appstate.edu/downloads/modules/filecabinet/</url> </module> Index: boost.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/featuredphoto/boost/boost.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** boost.php 27 Jan 2008 21:27:15 -0000 1.10 --- boost.php 30 Mar 2008 14:18:12 -0000 1.11 *************** *** 24,28 **** $proper_name = 'Featured Photo'; ! $version = '1.2.0'; $register = FALSE; $unregister = FALSE; --- 24,28 ---- $proper_name = 'Featured Photo'; ! $version = '1.2.1'; $register = FALSE; $unregister = FALSE; Index: update.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/featuredphoto/boost/update.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** update.php 27 Jan 2008 21:27:15 -0000 1.19 --- update.php 30 Mar 2008 14:18:12 -0000 1.20 *************** *** 27,161 **** switch ($currentVersion) { - case version_compare($currentVersion, '1.0.1', '<'): - $content[] = '- Fixed parse error on PHP4 hosts.'; - - case version_compare($currentVersion, '1.0.2', '<'): - $content[] = '- Added en_US translation to conversion script.'; - - case version_compare($currentVersion, '1.0.3', '<'): - $content[] = '- Fixed conversion script.'; - $content[] = '- Removed ampersands from constructors.'; - - case version_compare($currentVersion, '1.0.4', '<'): - $files = array('templates/photo/view.tpl'); - featuredphoto_update_files($files, $content); - - $content[] = '- Alternate text to images can now be translated.'; - $content[] = '- Default info file added for conversions.'; - $content[] = '- Title attribute added to images.'; - case version_compare($currentVersion, '1.1.0', '<'): ! $db = new PHPWS_DB('featuredphoto_photos'); ! ! /* First, need to add new column to photo table. */ ! if (PHPWS_Error::logIfError($db->addTableColumn('image_id', 'INT NOT NULL', 'block_id'))) ! { ! $content[] = '- Unable to create table column image_id in featuredphoto_photos table'; ! return false; ! } ! ! /* Move photos over to Image Manager. */ ! $db->reset(); ! $db->addOrder('id'); ! $photos = $db->select(); ! if (!PHPWS_Error::logIfError($photos) && ($photos != NULL)) ! { ! PHPWS_Core::initModClass('filecabinet', 'Image.php'); ! PHPWS_Core::initModClass('filecabinet', 'Folder.php'); ! PHPWS_Core::initCoreClass('File.php'); ! ! $folder = new Folder(); ! $folder->setTitle(dgettext('featuredphoto', 'Featured Photo')); ! $folder->setDescription(dgettext('featuredphoto', 'Featured Photo module images.')); ! $folder->module_created = 'featuredphoto'; ! $folder->ftype = IMAGE_FOLDER; ! $folder->save(); ! ! foreach ($photos as $photo) ! { ! $db->reset(); ! $db->addWhere('id', $photo['id']); ! ! /* Copy full size image first. */ ! PHPWS_File::fileCopy('images/featuredphoto/' . $photo['filename'], $folder->getFullDirectory(), $photo['filename'], 0, 0); ! $info = getimagesize($folder->getFullDirectory() . $photo['filename']); ! ! $image = new PHPWS_Image(); ! $image->folder_id = $folder->id; ! $image->setDirectory($folder->getFullDirectory()); ! $image->setFilename($photo['filename']); ! $image->setTitle($photo['name']); ! $image->setDescription($photo['caption']); ! $image->setSize($photo['size']); ! $image->width = $info[0]; ! $image->height = $info[1]; ! $image->file_type = $info['mime']; ! $image->save(true, false, true); ! ! /* If applicable, copy thumbnail. */ ! if ($photo['filename'] != $photo['tn_filename']) ! { ! PHPWS_File::fileCopy('images/featuredphoto/' . $photo['tn_filename'], $folder->getFullDirectory(), $photo['tn_filename'], 0, 0); ! $tn_info = getimagesize($folder->getFullDirectory() . $photo['tn_filename']); ! ! $tn_image = new PHPWS_Image(); ! $tn_image->folder_id = $folder->id; ! $tn_image->setDirectory($folder->getFullDirectory()); ! $tn_image->setFilename($photo['tn_filename']); ! $tn_image->setTitle($photo['name']); ! $tn_image->setDescription($photo['caption']); ! $tn_image->setSize(filesize($folder->getFullDirectory() . $photo['tn_filename'])); ! $tn_image->width = $tn_info[0]; ! $tn_image->height = $tn_info[1]; ! $tn_image->file_type = $tn_info['mime']; ! $tn_image->parent_id = $image->id; ! $tn_image->url = 'parent'; ! $tn_image->save(true, false, true); ! ! $db->addValue('image_id', $tn_image->id); ! } ! else ! { ! $db->addValue('image_id', $image->id); ! } ! ! PHPWS_Error::logIfError($db->update()); ! } ! } ! ! /* Now we can remove old photo info from Featured Photo table. */ ! PHPWS_Error::logIfError($db->dropTableColumn('name')); ! PHPWS_Error::logIfError($db->dropTableColumn('caption')); ! PHPWS_Error::logIfError($db->dropTableColumn('credit')); ! PHPWS_Error::logIfError($db->dropTableColumn('filename')); ! PHPWS_Error::logIfError($db->dropTableColumn('width')); ! PHPWS_Error::logIfError($db->dropTableColumn('height')); ! PHPWS_Error::logIfError($db->dropTableColumn('size')); ! PHPWS_Error::logIfError($db->dropTableColumn('tn_filename')); ! PHPWS_Error::logIfError($db->dropTableColumn('tn_width')); ! PHPWS_Error::logIfError($db->dropTableColumn('tn_height')); ! PHPWS_Error::logIfError($db->dropTableColumn('created')); ! ! /* Update the block table. */ ! PHPWS_Error::logIfError($db->setTable('featuredphoto_blocks')); ! PHPWS_Error::logIfError($db->dropTableColumn('resize_width')); ! PHPWS_Error::logIfError($db->dropTableColumn('resize_height')); ! PHPWS_Error::logIfError($db->dropTableColumn('tpl_large')); ! if (PHPWS_Error::logIfError($db->renameTableColumn('tpl_small', 'template'))) ! { ! $content[] = '- Unable to rename table column tpl_small in featuredphoto_blocks table'; ! return false; ! } ! ! /* Update the templates and config file. */ ! $files = array('templates/photo/view.tpl', 'templates/photo/list.tpl', ! 'templates/photo/edit.tpl', 'templates/block/edit.tpl', ! 'conf/config.php'); ! featuredphoto_update_files($files, $content); ! ! $content[] = '- Updated to new translation functions introduced in phpWebSite 1.2.0.'; ! $content[] = '- Cleaned up look of the about file.'; ! $content[] = '- Now using Image Manager from File Cabinet to manage photos.'; ! $content[] = '- Switch to use new logIfError() function in the core.'; case version_compare($currentVersion, '1.2.0', '<'): --- 27,33 ---- switch ($currentVersion) { case version_compare($currentVersion, '1.1.0', '<'): ! $content[] = '- This package will not update versions prior to 1.1.0.'; ! return false; case version_compare($currentVersion, '1.2.0', '<'): *************** *** 180,183 **** --- 52,70 ---- $content[] = '- Added Flickr support.'; $content[] = '- Added German translation.'; + + case version_compare($currentVersion, '1.2.1', '<'): + PHPWS_Core::initModClass('filecabinet', 'Cabinet.php'); + if (!Cabinet::convertImagesToFileAssoc('featuredphoto_photos', 'image_id')) + { + $content[] = '- Could not convert images to new File Cabinet format.'; + return false; + } + + /* Update the templates and config file. */ + $files = array('templates/photo/view.tpl', 'templates/photo/edit.tpl', 'conf/config.php'); + featuredphoto_update_files($files, $content); + + $content[] = '- Support File Cabinet 2.0.'; + $content[] = '- Corrected a few phrases that were not being translated.'; } |