file resource, Content ID keeps changing upon saving

file resource, Content ID keeps changing upon saving

by Steve Bilton -
Number of replies: 0

Hi,

I use the 'file' resource to upload a zip, then uncompress it.

Inside this zip are a number of files used for a swf animation.

The 'main file' is index.html, other components/js/xml etc are in subfolders.

I then link to the index.html using an iframe within any content area of that course i.e. within the 'lesson module' pages.

This method works great and have had no issues so far.

However! I have now discovered an issue and I'm pretty certain this cannot have been intended by design and I believe it to be a BUG. Before filing a bug report I'd like some feedback from others experience - perhaps there's something I'm missing.

The issue is this:

When a 'file type' resource is created and saved with the 'main file' set all is ok.

I'd leave it on 'automatic' for display option and set it to hidden.

I'd then look at the source code once the page has loaded of this file resource.

I'd copy the link to the resource from the below code snippet:

<object id="resourceobject" data="http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/13/index.html" type="text/html"  width="800" height="600"><param name="src" value="http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/13/index.html" />
    Click <a href="http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/13/index.html" >index.html</a> link to view the file.
  </object>

So I'd copy this link: http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/13/index.html

I'd then use the editor in code view and use an iframe like so:

<div style="text-align: center;">
<h2><span style="text-decoration: underline;">Accident MED</span></h2>
<br /><iframe src="http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/13/index.html" frameborder="0" height="500" scrolling="no" width="650">
Please download the latest Flash Player</iframe>
</div>

Which again works absolutely fine and is great. The animating appears and all works brilliantly.

The issue occurs when I revisit the 'file type' resource, let's say I add a better description for my own notes (as it's hidden) and then 'save' the file type resource.

The issue is exactly this:

The url to the index.html file (main file) of the file type resource changes upon any save action!!!

So the url which was once: http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/13/index.html

Now becomes a new url, which has been incremented upon saving:

http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/14/index.html

See the difference?

http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/13/index.html
http://503962-db1.sheilds.org/pluginfile.php/770/mod_resource/content/14/index.html

This happens every single time the file type resource is saved/amended.

Which in turn means I have to manually go through all the previous occurences and update to the new url to the main file.

Why Oh WHY this happens boggles my mind - Why would it? Why should it? I see no reasonable rationale for this approach and would suggest it's a BUG which keeps auto incrementing file type resources upon save.

It's left me pulling my hair out is the least I can say.

Does anyone know where in the code this causes the incrementation and I'll hack it up. It's not something I'm comfortable with and would like to see these links stay 'static'.

Any help on this issue would be fantastic! Hopefully soon as it's created a lot of work for myself.

Thanks

Steve

Average of ratings: -