I added a pdf file with Title "abc" and it generated, a link to this pdf with link name - "abc" -great!
I want to use this asset on some other page with link title "abc- updated" Now if I try to create a new link to this asset by stealing the "aid" then it still shows the old title "abc".

I have to actually add the same pdf again with new title to create a new link. Please replication is a curse we all know, is there a better way to just change the title name... in the new dev verisons or is it on your list to be added next?
Thanks, your truly does what it says in the homepage... collects features from all other file management modules out there.

Comments

sankett’s picture

Version: 5.x-1.0-alpha2 » 5.x-1.x-dev
sankett’s picture

Priority: Normal » Critical

@authors

I am not sure if you noticed this bug...
but this should be one on the most important ones on the list.

Replicating an asset just to have two links with different names pointing to the same asset...is just not done.

Btw I noticed that every time a link is generated user has to input the name of the file twice-
once when storing the title and description ---> this goes to the
table->asset
attribute->title

Next when we choose link option,
it again asks for the link title (which is prefilled with the value given for the title attribute before)
Now we should **ideally** get a link with a title given for this link right?
So this is generated:
[asset|aid=276|format=link|formatter=asset|title=title submitted in form 2|height=undefined|width=undefined]

This looks what we want... believe me even in TINYMCE editor it looks fine!
but in the end when we save that page it retrieves the title from the table asset from the attribute title to given the link title which was submitted on form 1.

**********************
suggested patch
**********************
I think the current code may be like:

execute query = "select title,dirname, filename from asset where aid = 1 (say)";
$x = "dirname/filename";       // i am assuming the above variables here...
<a href="$x">title=(selected from above query)</a>

Update the link generating script as,

execute query = "select dirname, filename from asset where aid = 1 (say)";
$x = "dirname/filename";       // i am assuming the above variables here...
<a href="$x">title=(submitted as title in [asset|aid=276|format=link|formatter=asset|title=title submitted in form 2|height=undefined|width=undefined])</a>

Please let me know if this is correct suggestion.
I am increasing the priority of this bug (Replication is crime 8-) )

sankett’s picture

Category: feature » bug

@ authors

I am newbie at drupal and writing drupal modules...
even though I can easily understand this bug, explain you what the bug is... I don't have the ability to patch it....
Could someone respond back on my previous explanation about the bug?
Thanks

wmostrey’s picture

Category: bug » feature
Priority: Critical » Normal

This is more a feature request, and it's certainly not critical. To override the text in a textarea you can simply edit the "title" attribute in the asset string. For CCK fields this is currently not possible since they are read-only fields. I'll see what I'll do for this.

sankett’s picture

Hey wmostrey

I beg to disagree with you on this. I understand when you are saying that, you are assuming that the code works fine.
I can see this as a bug in the code.....
I edited the html,
before,
[asset|aid=276|format=link|formatter=asset|title=title submitted in
form 2|height=undefined|width=undefined]
afer,
[asset|aid=276|format=link|formatter=asset|title=NEW LINK TITLE|height=undefined|width=undefined]

It doesn't work as said on my installation.... Whatsoever I may put in the title there... its hardly cares...
It just retrieves the database from table name->asset, field name->title
and this is what shows up.
this is the view source:

<a href="somefile.pdf">Title stored in the database title name (first form of asset wizard)</a>

This happens regardless of what I type in the title up there... in [asset|aid=276|format=link|formatter=asset|title=title submitted in form 2|height=undefined|width=undefined].

I may have done something crazy that would have caused this bug to come in my version of 5.x-1.x-dev Feb 06 2008 build. It would be nice if you could think of any possibilities....please. I can not provide you with a link to my webpage as it is not live anywhere.. sorry about that.

Again thanks for being patient in answering a newbie's questions.

wmostrey’s picture

Status: Active » Reviewed & tested by the community

Hey Sankett,

This was indeed a bug, thanks for your persistence :) When creating the output and loading all the information about the asset from the given asset aid, the title was overwritten with the value from the database. This fix will be committed tonight, along with a fix for #212953 which is related for CCK links.

The function asset_render_macro no looks like this:

function asset_render_macro($attr = array()) {
  $asset = asset_load($attr['aid']);
  $asset->title = $attr['title'] ? $attr['title'] : $asset->title;
  if ($attr['formatter']) {
    $content = module_invoke($attr['formatter'], 'asset_formatter', 'render', $asset, $attr);
    return theme('asset', $content, $attr);
  }
  else {
    return theme('asset_render_default', $asset);
  }
}
wmostrey’s picture

Status: Reviewed & tested by the community » Fixed

This has been committed: http://drupal.org/cvs?commit=101719

sankett’s picture

Hey wmostrey, I checked the new dev version, thanks for taking care of it. Cheers!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.