diff options
| author | Christian Fowler <spider@viovio.com> | 2009-10-29 19:14:20 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2009-10-29 19:14:20 +0000 |
| commit | 834d4fb4fef34a39e2d2aa50d210de934a76c705 (patch) | |
| tree | 14aa0b39c7f92cc26520ab1cbbdef3d7774b2b81 | |
| parent | 3dbc36f7b26870f88cf4159e3ad07e0ac74729a7 (diff) | |
| download | liberty-834d4fb4fef34a39e2d2aa50d210de934a76c705.tar.gz liberty-834d4fb4fef34a39e2d2aa50d210de934a76c705.tar.bz2 liberty-834d4fb4fef34a39e2d2aa50d210de934a76c705.zip | |
set primary_attachment_id in mInfo from mStorage, and standardize on that in edit tpls
| -rw-r--r-- | LibertyMime.php | 9 | ||||
| -rw-r--r-- | templates/edit_storage_list.tpl | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/LibertyMime.php b/LibertyMime.php index 9ee4da9..cdd42c6 100644 --- a/LibertyMime.php +++ b/LibertyMime.php @@ -3,7 +3,7 @@ * Manages liberty Uploads * * @package liberty - * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyMime.php,v 1.44 2009/03/30 03:26:08 spiderr Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyMime.php,v 1.45 2009/10/29 19:14:19 spiderr Exp $ */ /** @@ -54,6 +54,13 @@ class LibertyMime extends LibertyAttachable { if( $result = $this->mDb->query( $query,array( (int)$contentId ))) { $this->mStorage = array(); while( $row = $result->fetchRow() ) { + if( !empty( $row['is_primary'] ) ) { + // used by edit tpl's among other things + $this->mInfo['primary_attachment_id'] = $row['attachment_id']; + } elseif( !$this->getField( 'primary_attachment_id' ) && !empty( $row['attachment_id'] ) ) { + // primary was not set by the above, default to first row. might be reset by later iterations via if is_primary above + $this->mInfo['primary_attachment_id'] = $row['attachment_id']; + } if( $func = $gLibertySystem->getPluginFunction( $row['attachment_plugin_guid'], 'load_function', 'mime' )) { // we will pass the preferences by reference that the plugin can easily update them if( empty( $this->mStoragePrefs[$row['attachment_id']] )) { diff --git a/templates/edit_storage_list.tpl b/templates/edit_storage_list.tpl index 3935249..3d1cf6a 100644 --- a/templates/edit_storage_list.tpl +++ b/templates/edit_storage_list.tpl @@ -118,7 +118,7 @@ <td class="actionicon"> <label> {tr}No {$primary_label|default:"Primary"}{/tr}: - <input type="radio" name="liberty_attachments[primary]" value="none" {if empty($gContent->mInfo[primary])}checked="checked"{/if} /> + <input type="radio" name="liberty_attachments[primary]" value="none" {if !$gContent->getField('primary_attachment_id')}checked="checked"{/if} /> </label> </td> </tr> |
