Enables publishing of assets and/or asset metadata, sorted by actual upload time!
Can't we already do that?
The current version of the plugin does the following:
Schema modification upgrade and existing asset survey: Perform an upgrade procedure which creates a
file_mtimecolumn in the
mt_assettable and populates each asset record with the modification time of the file it represents. (n.b.: If you have a lot of assets, you may want to use the command line script
mt:Assets sorting by assetfile modified time: The
file_mtimecolumn is indexed which means template designers can use it to sort
Provides a template block tag, mt:AssetsUploaded, which is exactly like mt:Assets except more predictable, well-behaved and has fewer characters to type.
Provides a standard MT date template tag, mt:AssetFileModified, which outputs the file modification time in your desired format for the asset in context.
Each time an asset is uploaded (both new assets and overwrites) this plugin sets the
file_mtimevalue accordingly in the asset record.
When a user navigates to an asset listing screen, the plugin ensures that all assets on the current page of the listing also have a populated value for
When a user navigates to any asset editing screen, the plugin flushes the
file_mtimevalue and re-reads it from the filesystem. This provides a way to force-refresh an asset's
file_mtimeproperty which may be needed if the asset is replaced or modified directly on the filesystem.
Unzip the download archive. Move the resulting folder to
$MT_HOME is your MT or Melody application directory).
If you use Git, you can do the following:
cd $MT_HOME/plugins git clone git://github.com/endevver/mt-plugin-assetfile-modified.git
All of the following methods can be found in the AssetFileModified package.
This method is the handler for the mt:AssetFileModified template tag which returns the modification timestamp (mtime) of the file represented by the asset in context.
- Same as mt:Date
<mt:Assets><mt:AssetLabel> was uploaded <mt:AssetFileModified relative="1"> </mt:Assets>
Could be used to output something like this:
IMG_1195.JPG was uploaded 1 hour ago IMG_1194.JPG was uploaded 3 days ago n599367413_1714467_7256.jpg was uploaded 3 months ago ohhai.jpg was uploaded Dec 23 2009
This method is the handler for the
mt:AssetsUploaded block tag which is
provided simply as a shorter way of writing:
<mt:Assets sort_by="file_mtime" sort_order="descend"> [...] </mt:Assets>
After applying the sort paramters and loading the assets, this method hands
them off to the mt:Assets handler method to do the rest of the work.
Because of that,
mt:AssetsUploaded supports all of the same attributes and
attribute values as
mt:Assets and produces the exact same results.
NOTE: Using a
sort_by value with
mt:AssetsUploaded will not override
file_mtime but instead be applied as a secondary sort:
on_upload( $cb, %params )
This method is the handler for the cmsuploadfile.file callback which is triggered whenever a file is uploaded via the CMS. It ensures that all newly uploaded files (including replacements of existing files) have a file_modified property.
cb_list_assets_param( $cb, $app, $param, $tmpl )
This method is a template param callback handler for the list_assets mode. It
is triggered anytime a user navigates to an asset listing screen at which
point it ensures that all assets on the current page of the listing have a
This is mostly just backup for the upgrade script. Probably isn't necessary anymore....
cb_edit_asset_param( $cb, $app, $param, $tmpl )
This method is a template param callback handler for the edit_asset mode.
It is triggered anytime a user navigates to an asset's editing screen at
which point it flushes the C
This provides a way to force-refresh an asset's file_modified property which
may be needed if the asset is replaced or modified directly on the filesystem.
Since this plugin only updates the C
upgrade_set_file_modified( $upgrader_app )
This method is the upgrade handler for the plugin which is responsible for populating the file_modified property for all asset records.
This method provides the
file_mtime value for the asset in question or does
the work of deriving it and saving it back into the asset record when
undef as the only argument will flush and refresh the
value cached in the database:
my $new_mtime = $asset->file_modified(undef); # Already saved!
This plugin does not currently have the capability to automatically detect direct modification of asset files on the filesystem.
HELP, BUGS AND FEATURE REQUESTS
If you are having problems installing or using the plugin, please check out our general knowledge base and help ticket system at help.endevver.com.
Movable Type versions: 4.3