Not a developer? Go to MovableType.com

Plugin and Theme Directory

AssetFileModified v1.0.5

By Dan Wolfgang
Posted January 31, 2012, in Assets, Files, Uploading.

Details

Enables publishing of assets and/or asset metadata, sorted by actual upload time!

Can't we already do that?

No.

Current functionality

The current version of the plugin does the following:

  • Schema modification upgrade and existing asset survey: Perform an upgrade procedure which creates a file_mtime column in the mt_asset table 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_HOME/tools/upgrade).

  • mt:Assets sorting by assetfile modified time: The file_mtime column is indexed which means template designers can use it to sort mt:Assets: <mt:Assets sort_by="file_mtime">

  • 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_mtime value 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 file_mtime.

  • When a user navigates to any asset editing screen, the plugin flushes the file_mtime value and re-reads it from the filesystem. This provides a way to force-refresh an asset's file_mtime property which may be needed if the asset is replaced or modified directly on the filesystem.

INSTALLATION

Unzip the download archive. Move the resulting folder to $MT_HOME/plugins/ (where $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

METHODS

All of the following methods can be found in the AssetFileModified package.

hdlr_asset_file_modified($ctx, $args)

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.

Attributes

Example

The following:

<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

hdlr_assets_uploaded($ctx, $args)

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>

Attributes

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:

<mt:AssetsUploaded sort_by="somefield">

becomes

<mt:Assets sort_by="file_mtime,somefield">

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 C property stored in their asset metadata record.

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 property of the asset and causes it to be read again from the file system.

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 property upon upload through the CMS (for performance reasons), such manipulations would not be automatically recognized by the system.

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.

$asset->file_modified

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 necessary. Passing undef as the only argument will flush and refresh the value cached in the database:

my $new_mtime = $asset->file_modified(undef);   # Already saved!

LIMITATIONS

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.

Compatibility

Movable Type versions: 4.3

License

Perl Artistic


Back

33 Comments

Rahul Sharma

Rahul Sharma on September 2, 2016, 9:17 a.m. Reply

Just for information. movement2016.org will move 1% of $1 billion ($10 million) from TV ads to grassroots vote work and local organizing in 2016 USA Presidential Election.

Eliza Webb

Eliza Webb on May 24, 2017, 6:20 p.m. Reply

Hi Rahul,

I am not sure if I understand what you mean. Are you talking about this plugin? If you look it clearly states that it, “Enables publishing of assets and/or asset metadata, sorted by actual upload time!” The sorting is the important part, since there were other plugins that were written prior to this that did not have that feature. And that is the important part. I can understand if you used it for parts of your site. I use this plugin all of the time, and due to my site’s theme it is important to make sure things get posted when they should. For example, this post on fall weddings would have been senseless at any other time of the year.

way lanmarx

way lanmarx on August 31, 2018, 1:04 p.m. Reply

As an best research paper writing service provider, we help the students write their research papers well. college essay writing service

peterkevinn1987

peterkevinn1987 on September 22, 2017, 11:37 a.m. Reply

I’m now not positive if I recognize what you mean. Are you talking approximately this plugin? in case you look it honestly states that it, “permits publishing of assets and/or asset metadata, looked after with the aid of real add time!” A determination of thankfulness is all collectively for this statistics.

Source: Essay Writing Company .

SachinKhanna

SachinKhanna on November 3, 2017, 1:00 p.m. Reply

[url=https://cricketgames.life]cricket games[/url] [url=https://cricketgames.life/vivo-ipl-cricket-game-2018-download/]ipl cricket games[/url] [url=https://cricketgames.life/ea-sports-cricket-2018-pc-game-download/]ea sports cricket 2018[/url]

omejacker

omejacker on November 13, 2017, 8:44 a.m. Reply

I really like to learn about window 10. this is really mind blowing window 10 learning website. follow this link address windows 10 help and learn about window 10. this website always provide you step by step knowledge with full information.

Claire Jordan

Claire Jordan on July 3, 2018, 7:13 a.m. Reply

I think you would be required to list overseas assets on your bankruptcy schedules and the fact that they are overseas is immaterial. I think the failure to list all assets overseas or not would constitute bankruptcy fraud, a Federal crime for which you could see prison time. Source by marketing assignment writing service

johnb6174

johnb6174 on July 12, 2018, 1:29 p.m. Reply

I’ve been searching for some decent stuff on the subject and haven’t had any luck up until this point, You just got a new biggest fan!.. collegw writing

johnb6174

johnb6174 on July 21, 2018, 11:52 a.m. Reply

You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. click this site

johnb6174

johnb6174 on July 30, 2018, 4:07 p.m. Reply

This is really a nice and informative, containing all information and also has a great impact on the new technology. Thanks for sharing it westcoast420express.ca

johnb6174

johnb6174 on August 2, 2018, 1:43 p.m. Reply

nice bLogits interesting. thank you for sharing…. rental mobil jogja

Jerico22

Jerico22 on August 3, 2018, 1:20 p.m. Reply

You should try this Nerdy mates essay writing service and you will always get a good grades! There is no reason not to use it:)

milan

milan on August 4, 2018, 8:53 a.m. Reply

It’s nice to see the details regarding the AssetFileModified plugin you have shared here. Thank you so much for sharing some of the important details over here. That helps me to understand more about this plugin. I am expecting more such plugins from here and keep up the good work.http://parisguidedtour.com/paris-tour-guide/louvre-tours/

Barbara M. Malik

Barbara M. Malik on August 5, 2018, 10:18 a.m. Reply

The postings on top 3 best paper writing services your site are always excellent. Thanks for the great share and keep up this great work! All the best to you.

Barbara M. Malik

Barbara M. Malik on August 5, 2018, 10:19 a.m. Reply

The postings on your site are top 3 best paper writing services always excellent. Thanks for the great share and keep up this great work! All the best to you.

johnb6174

johnb6174 on August 9, 2018, 2:56 p.m. Reply

I’m glad I found this web site, I couldn’t find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, i am always look for people to check out my web site. small business administration

John

John on August 10, 2018, 7:15 a.m. Reply

This Site And The Resources You Provide Is Really Nice Keep It Up. Finance Assignment Writing

johnb6174

johnb6174 on August 10, 2018, 9:19 p.m. Reply

I would like to say that this blog really convinced me to do it! Thanks, very good post. PUBG Mod

johnb6174

johnb6174 on August 15, 2018, 4:41 p.m. Reply

This is really a nice and informative, containing all information and also has a great impact on the new technology. Thanks for sharing it search engine marketing

satta matka

satta matka on August 20, 2018, 5:42 p.m. Reply

It was a very good post AssetFileModified v1.0.5 indeed. I thoroughly enjoyed reading it in my lunch time. Will surely come and visit this blog more often. Thanks for sharing. Satta Matka

johnb6174

johnb6174 on August 21, 2018, 2:56 p.m. Reply

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. Disability Calculator

johnb6174

johnb6174 on August 27, 2018, 4:09 p.m. Reply

Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it’s nice to find a website that details so much information about different artists. ccfftoronto.ca

johnb6174

johnb6174 on August 28, 2018, 3:25 p.m. Reply

I admit, I have not been on this web page in a long time… however it was another joy to see It is such an important topic and ignored by so many, even professionals. professionals. I thank you to help making people more aware of possible issues. Michigan Personal Injury Law Firm

way lanmarx

way lanmarx on August 31, 2018, 1:01 p.m. Reply

As an best college essay writing service provider, we help the students write their research papers well.

way lanmarx

way lanmarx on September 3, 2018, 12:29 p.m. Reply

For online loans secured by collateral, relatively low interest rates are introduced. Revenue certificates are not required for payday loan credit cards.

way lanmarx

way lanmarx on September 3, 2018, 1:16 p.m. Reply

The possibility of cooperation with the bank, as a rule, can be restored after the 2-3-year period after the repayment of the same day payday loans

johnb6174

johnb6174 on September 3, 2018, 9:04 p.m. Reply

Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. Revo America Ultra Review

way lanmarx

way lanmarx on September 4, 2018, 7:23 a.m. Reply

Consider the example of instant payday loans applying to the bank of citizen A. He meets all the necessary parameters: an engineer in personal loans same day a construction company, age 30 years, 3 years – experience in the last place of work, has no previous convictions and credit debts, is registered in the cash advance bad credit region of the bank’s operation, confirmed his wage, has one child, is married.

way lanmarx

way lanmarx on September 4, 2018, 7:27 a.m. Reply

One of the foundations of the current payday loans economic system is a financial service, such as lending. The above remark is true for private citizens, payday loans guaranteed countries, businesses, major companies.

way lanmarx

way lanmarx on September 4, 2018, 7:28 a.m. Reply

So, we hope that now you know that Buy viagra online in Australia how the generic Viagra can help the men in rejoicing their married life again. This small pill can turn out to buy cheap viagra in Australia be magical for all those males who are suffering from ED or importance and cannot enjoy their sexual life at all.

Robert G

Robert G on September 6, 2018, 7:34 a.m. Reply

Get an instant access to one of the leading and top rated online assignment help service by visiting here that would eventually help you to improve your grades.

margaret

margaret on September 17, 2018, 7:50 a.m. Reply

The information is shared in an effective manner. If someone wants more information related to this topic or for writing assignments they can visit here for plagiarism free assignments without their submission date.

Leave a Comment

Dan Wolfgang

Dan is an engineering creative and uses his vast knowledge of the web to solve unique client problems with specialized solutions. Complex or straightforward, his focus is to find the most efficient, functional, elegant, and stable solutions for each project. 10 years in web engineering and 14 more in the print publishing industry give him a special insight to the needs, restrictions, and workflows of content publishers, both traditional and new media. Dan is an active Movable Type community member who has written and contributed to countless plugins including some of the most popular: More Custom Fields, Poll Position, and Asset Image Quality.

Website: http://uinnovations.com
Twitter: @danwolfgang