| | 7 | |
| | 8 | // remove the no assets text if it's there |
| | 9 | var Node = window.parent.document.getElementById("empty-asset-list"); |
| | 10 | if (Node) { |
| | 11 | Node.parentNode.removeChild(Node); |
| | 12 | } |
| | 13 | |
| | 14 | // make sure the asset isn't there already |
| | 15 | var Asset = window.parent.document.getElementById("list-asset-<mt:AssetID>"); |
| | 16 | if (Asset) { |
| | 17 | // do nothing |
| | 18 | } |
| | 19 | else { |
| | 20 | // add the asset's id to the include_asset_ids hidden input |
| | 21 | var asset_ids = window.parent.document.getElementById("include_asset_ids").value; |
| | 22 | window.parent.document.getElementById("include_asset_ids").value = asset_ids + ",<mt:AssetID>"; |
| | 23 | |
| | 24 | // create the link to the asset page with asset name as label |
| | 25 | var myAssetLink = window.document.createElement('a'); |
| | 26 | myAssetLink.setAttribute('href', '<mt:CGIPath><mt:AdminScript>?__mode=view&_type=asset&blog_id=<mt:var name="blog_id">&id=<mt:AssetID>'); |
| | 27 | myAssetLink.appendChild(document.createTextNode('<mt:AssetFileName> ')); |
| | 28 | |
| | 29 | // create the remove link icon |
| | 30 | var myRemoveIcon = window.document.createElement('img'); |
| | 31 | myRemoveIcon.setAttribute('src', '<mt:StaticWebPath>images/status_icons/view.gif'); |
| | 32 | |
| | 33 | // create the remove link for this asset |
| | 34 | var myRemoveLink = window.document.createElement('a'); |
| | 35 | myRemoveLink.setAttribute('href', 'javascript:removeAssetFromList(<mt:AssetID>)'); |
| | 36 | myRemoveLink.appendChild(myRemoveIcon); |
| | 37 | |
| | 38 | // create the asset list item |
| | 39 | var myElement = window.document.createElement('li'); |
| | 40 | myElement.setAttribute('id', 'list-asset-<mt:AssetID>'); |
| | 41 | <mt:If tag="AssetType" eq="image"> |
| | 42 | myElement.setAttribute('onmouseover', 'javascript:displayImage("list-image-<mt:AssetID>")'); |
| | 43 | myElement.setAttribute('onmouseout','javascript:hideImage("list-image-<mt:AssetID>")'); |
| | 44 | </mt:If> |
| | 45 | myElement.appendChild(myAssetLink); |
| | 46 | myElement.appendChild(myRemoveLink); |
| | 47 | window.parent.document.getElementById("asset-list").appendChild(myElement); |
| | 48 | |
| | 49 | // create the image thumbnail if it exists |
| | 50 | <mt:If tag="AssetType" eq="image"> |
| | 51 | var myImageElement = window.document.createElement('img'); |
| | 52 | myImageElement.setAttribute('id', 'list-image-<mt:AssetID>'); |
| | 53 | myImageElement.setAttribute('src', '<mt:AssetThumbnailURL height="100">'); |
| | 54 | myImageElement.setAttribute('style', 'display:none'); |
| | 55 | window.parent.document.getElementById("asset-list").appendChild(myImageElement); |
| | 56 | </mt:If> |
| | 57 | } |
| | 58 | |