home *** CD-ROM | disk | FTP | other *** search
HTML Component | 2002-12-11 | 3.7 KB | 136 lines |
- <PUBLIC:COMPONENT lightWeight=true>
- <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="load()" />
- <PUBLIC:METHOD NAME="reload" />
- <PUBLIC:METHOD NAME="updateMedia" />
- <PUBLIC:METHOD NAME="mediaChange" />
- <PUBLIC:METHOD NAME="edit" />
- <PUBLIC:ATTACH EVENT="onresize" ONEVENT="resize()" />
- <PUBLIC:METHOD NAME="noData" />
-
- <SCRIPT LANGUAGE="JScript">
-
- function reload() { load(); }
-
- function load()
- {
- var s = '<table width=368 class=pane border=0 cellpadding=0 cellspacing=0>';
- s += '<tr><td class=artist>' + L_PhotographyTitle_Text + '</td></tr>';
- s += '<tr><td height=16><table width=368 border=0 cellpadding=0 cellspacing=0><td>' + GetFileTOC(1) + '</td><td class=textTitle id=photoEditButton align=right onbuttonclick="trackIt(\'TIN0\'); return oCurrentPage.edit();" style="behavior:url(barbutton.htc)" text="' + L_EditPhotosButton_Text + '"></td></tr></table></td></tr>';
- s += '<tr><td height=14 class=text id=photosHeader></td></tr>';
- s += '<tr><td height=10></td></tr>';
- s += '<tr><td valign=top height=40>' + GetButtons(14, L_FileInfoTitle_Text, -1, '') + '</td></tr>';
-
- s += '<tr><td id=photoInfoData width=368 height=100% valign=top><div class=text id=photoInfoText style="overflow-x: scroll; overflow-y: scroll; width: 368;"></div></td></tr>';
-
- s += '<tr><td style="display:none" id=photoInfoError></td></tr>';
- element.innerHTML = s + '</table>';
- resize();
- }
-
- function resize()
- {
- var el = element.document.all('photoInfoText');
- if (el)
- el.style.height = Math.max(element.document.body.clientHeight - getElementTop('photoInfoData'), 10);
- }
-
- function edit()
- {
- if (window.external.appColorLight)
- window.external.AdvancedEditDialog();
- updateUI();
- return false;
- }
-
- function updateUI()
- {
- try
- {
- var p = element.document.all('player');
- var m = p.currentMedia;
- updateMedia(m);
- } catch(e)
- {
- }
- }
-
- function GetImageLayout()
- {
- var s = '<tr><td valign=top>';
- s += '<table border=0 cellpadding=0 cellspacing=0>';
- s += '<tr><td valign=top><img border=0 id=photoImg src=""></td>'
- s += '<td width=8></td>';
- s += '<td valign=top class=text id=photoDescription></td>';
- s += '</tr></table></td></tr>';
- return s;
- }
-
- function mediaChange(m) { updateMedia(m); }
-
- function updateMedia(media)
- {
- var s = '<table border=0 cellpadding=0 cellspacing=0>', i, c, o, iMid, sDisplay = 'none', a = element.document.all;
-
- SetArtistAlbumHeader('photosHeader', true, true, false);
- a('photoInfoData').style.display = 'block';
- a('photoInfoError').style.display = 'none';
-
- if (media)
- {
- if (window.external.appColorMedium)
- {
- if (window.external.IsAdvancedEditDialogAvailable())
- sDisplay = 'inline';
- }
-
- s += '<tr><td width=368 valign=top><table border=0 cellpadding=0 cellspacing=0>';
- c = media.getAttributeCountByType('WM/Picture', '');
- if (c)
- {
- for (i = 0; i < c; i++)
- s += GetImageLayout();
-
- s += '</table></td></tr></table>';
- a('photoInfoText').innerHTML = s;
-
- for (i = 0; i < c; i++)
- {
- o = media.getItemInfoByType('WM/Picture', '', i);
- if (c == 1)
- {
- a('photoImg').src = o.URL;
- a('photoDescription').innerText = o.description;
- }
- else
- {
- a('photoImg')[i].src = o.URL;
- a('photoDescription')[i].innerText = o.description;
- }
- }
- }
- else
- {
- s = L_NoPhotos_Text;
- if (sDisplay == 'inline') s += L_AddPhotos_Text;
- a('photoInfoText').innerText = s;
- }
- }
- else
- {
- var oDL = a('dataload');
- oDL.setNoMedia();
- }
-
- a('photoEditButton').style.display = sDisplay;
- }
-
- function noData(sHTML)
- {
- var a = element.document.all;
- a('photoInfoData').style.display = 'none';
- a('photoInfoError').style.display = 'block';
- a('photoInfoError').innerHTML = sHTML;
- }
- </SCRIPT>
- </PUBLIC:COMPONENT>
-