home *** CD-ROM | disk | FTP | other *** search
HTML Component | 2002-12-11 | 9.0 KB | 280 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_FileInfoTitle_Text + '</td></tr>';
- s += '<tr><td height=16><table width=368 border=0 cellpadding=0 cellspacing=0><td>' + GetFileTOC(0) + '</td><td class=textTitle align=right id=editInfoButton onbuttonclick="trackIt(\'TIN0\'); return oCurrentPage.edit();" style="behavior:url(barbutton.htc)" text="' + L_EditInfoButton_Text + '"></td></tr></table></td></tr>';
- s += '<tr><td height=14 class=text id=fileinfoHeader></td></tr>';
- s += '<tr><td height=10></td></tr>';
- s += '<tr><td valign=top height=40>' + GetButtons(-1, '', 15, L_PhotographyTitle_Text) + '</td></tr>';
-
- s += '<tr><td id=tagInfoData width=368 height=100% valign=top><div class=text style="overflow-y: scroll; width: 368;">';
- s += '<table border=0 cellpadding=0 cellspacing=0>';
- s += getBlock(L_TrackInfoLabel_Text, 'fiTrackInfo');
- s += getBlock(L_ArtistInfoLabel_Text, 'fiArtistInfo');
- s += getBlock(L_CommentsInfoLabel_Text, 'fiComments');
- s += getBlock(L_WebsitesLabel_Text, 'fiWebsites');
- s += getBlock(L_CreditsLabel_Text, 'fiCredits');
- s += getBlock(L_DRMPropertiesLabel_Text, 'fiDRMProperties');
- s += '</table></div></td></tr>';
-
- s += '<tr><td style="display:none" id=tagInfoError></td></tr>';
- element.innerHTML = s + '</table>';
- resize();
- }
-
- function getBlock(sTitle, sID)
- {
- var s = '<tr><td><table id='+ sID + 'table border=0 cellpadding=0 cellspacing=0>';
- s += '<tr><td colspan=3 class=textBold>' + sTitle + '</td></tr>';
- return s + '<tr><td id=' + sID + 'data></td></tr></table></td></tr>';
- }
-
- var aTrackInfo = new Array('Title', 'WM/SetSubTitle', 'WM/Genre', 'WM/Mood', 'WM/Track', 'WM/BeatsPerMinute', 'WM/InitialKey', 'WM/AlbumTitle',
- 'WM/OriginalAlbumTitle', 'WM/PartOfSet', 'WM/ContentGroupDescription', 'WM/Language');
- var aTrackInfoLabels = new Array(L_SongNameLabel_Text, L_SubtitleLabel_Text, L_GenreLabel_Text, L_MoodLabel_Text, L_TrackNumberLabel_Text, L_BeatsPerMinuteLabel_Text, L_InitialKeyLabel_Text, L_AlbumLabel_Text,
- L_OriginalAlbumLabel_Text, L_PartOfSetLabel_Text, L_MusicCategoryLabel_Text, L_LanguageLabel_Text);
-
- var aArtistInfo = new Array('Author', 'WM/AlbumArtist', 'WM/Conductor', 'WM/Writer', 'WM/OriginalLyricist',
- 'WM/Composer', 'WM/ModifiedBy', 'WM/OriginalArtist');
- var aArtistInfoLabels = new Array(L_LeadArtistLabel_Text, L_BandLabel_Text, L_ConductorLabel_Text, L_LyricistLabel_Text, L_OriginalLyricistLabel_Text,
- L_ComposerLabel_Text, L_ModifiedByLabel_Text, L_OriginalArtistLabel_Text);
-
- var aDRMInfo = new Array('Is_Protected', 'DRMHasLicense', 'DRMPlayRightsStatus', 'DRMCDCopyStatus', 'DRMDeviceCopyStatus', 'DRMSDMICopyStatus', 'DRMBackupStatus');
- var aDRMInfoLabels = new Array(L_ProtectedLabel_Text, L_HasLicenseLabel_Text, L_PlayRightsLabel_Text, L_CopyRightsLabel_Text, L_DeviceCopyRightsLabel_Text, L_SDMICopyRightsLabel_Text, L_BackupRightsLabel_Text);
-
- var aInfoList = new Array(aTrackInfo, aArtistInfo);
- var aInfoLabels = new Array(aTrackInfoLabels, aArtistInfoLabels);
- var aInfoIDs = new Array('fiTrackInfo', 'fiArtistInfo');
-
- function resize()
- {
- var el = element.document.all('fileInfoText');
- if (el)
- el.style.height = Math.max(element.document.body.clientHeight - getElementTop('tagInfoData'), 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 mediaChange(m) { updateMedia(m); }
-
- function updateMedia(media)
- {
- var i, sEditDisplay = 'none', a = element.document.all;
-
- a('tagInfoData').style.display = 'inline';
- a('tagInfoError').style.display = 'none';
- if (media)
- {
- SetArtistAlbumHeader('fileinfoHeader', true, true, false);
- if (window.external.appColorMedium)
- {
- if (window.external.IsAdvancedEditDialogAvailable())
- sEditDisplay = 'inline';
- }
-
- for (i = 0; i < aInfoList.length; i++)
- GetInfo(aInfoIDs[i], media, aInfoList[i], aInfoLabels[i]);
-
- GetComments(media);
- GetWebsites(media);
- GetCredits(media);
- GetDRMInfo(media);
- }
- else
- {
- var oDL = a('dataload');
- oDL.setNoMedia();
- }
- resize();
- a('editInfoButton').style.display = sEditDisplay;
- }
-
- function GetInfo(sID, media, aFields, aLabels)
- {
- var s = '<table border=0 cellpadding=0 cellspacing=0>', i, sText, a = element.document.all, fDisplay = false;
-
- for (i = 0; i < aFields.length; i++)
- {
- sText = media.getItemInfo(aFields[i]);
-
- if (sText && sText.length)
- {
- fDisplay = true;
- s += '<tr><td width=125 valign=top class=textGray>' + aLabels[i] + '</td><td width=8><td valign=top id=' + sID + i + ' class=text></td></tr>';
- }
- }
-
- if (fDisplay)
- {
- a(sID + 'data').innerHTML = s + '<tr><td height=5></td></tr></table>';
- a(sID + 'table').style.display = 'inline';
-
- for (i = 0; i < aFields.length; i++)
- {
- sText = media.getItemInfo(aFields[i]);
-
- if(aFields[i] == 'Is_Protected')
- {
- if (sText == 'False')
- sText = L_DRMProtectionNo_Text;
- else
- sText = L_DRMProtectionYes_Text;
- }
-
- if (sText && sText.length)
- a(sID + i).innerText = sText;
- }
- }
- else
- a(sID + 'table').style.display = 'none';
- }
-
- function GetComments(media)
- {
- var s = '<table border=0 cellpadding=0 cellspacing=0>', c, i, o, sText = '', a = element.document.all;
- sText = media.getItemInfo('Description');
- if (sText.length)
- {
- s += '<tr><td id=fiCommentsText class=text></td></tr>';
- s += '<tr><td height=5></td></tr></table>';
- a('fiCommentsdata').innerHTML = s;
-
- a('fiCommentsText').innerText = sText;
- a('fiCommentstable').style.display = 'inline';
- }
- else
- a('fiCommentstable').style.display = 'none';
- }
-
- function GetWebsites(media)
- {
- var s = '<table border=0 cellpadding=0 cellspacing=0>', fDisplay = false, sText, c, i, o, a = element.document.all;
- sText = media.getItemInfo('WM/AudioFileURL');
- if (sText.length)
- {
- fDisplay = true;
- s += '<tr><td class=text><A href="" onclick="return visitLink(this, \'LTN0\');" id=fiAudioUrl></a></td></tr>';
- }
-
- sText = media.getItemInfo('WM/AuthorURL');
- if (sText.length)
- {
- fDisplay = true;
- s += '<tr><td class=text><A href="" onclick="return visitLink(this, \'LTN1\');" id=fiAuthorUrl></a></td></tr>';
- }
-
- sText = media.getItemInfo('WM/AudioSourceURL');
- if (sText.length)
- {
- fDisplay = true;
- s += '<tr><td class=text><A href="" onclick="return visitLink(this, \'LTN2\');" id=fiSourceUrl></a></td></tr>';
- }
-
- c = media.getAttributeCountByType('WM/UserWebURL', '');
- for (i = 0; i < c; i++)
- {
- o = media.getItemInfoByType('WM/UserWebURL', '', i);
- sText = o.text;
- if (sText.length)
- {
- fDisplay = true;
- s += '<tr><td class=text><A href="" onclick="return visitLink(this, \'LTN' + getClickIndex(i + 3) + '\');" id=fiUserUrl' + i + '></a></td></tr>';
- }
- }
-
- if (fDisplay)
- {
- a('fiWebsitesdata').innerHTML = s + '<tr><td height=5></td></tr></table>';
-
- setText(media.getItemInfo('WM/AudioFileURL'), a, 'fiAudioUrl')
- setText(media.getItemInfo('WM/AuthorURL'), a, 'fiAuthorUrl');
- setText(media.getItemInfo('WM/AudioSourceURL'), a, 'fiSourceUrl');
-
- c = media.getAttributeCountByType('WM/UserWebURL', '');
- for (i = 0; i < c; i++)
- {
- o = media.getItemInfoByType('WM/UserWebURL', '', i);
- setText(o.text, a, 'fiUserUrl' + i);
- }
-
- a('fiWebsitestable').style.display = 'inline';
- }
- else
- a('fiWebsitestable').style.display = 'none';
- }
-
- function setText(sText, a, sID)
- {
- if (sText.length)
- {
- a(sID).href = sText;
- a(sID).innerText = sText;
- }
- }
-
- function GetCredits(media)
- {
- var s = '<table border=0 cellpadding=0 cellspacing=0>', c, i, o, sText = '', a = element.document.all;
- sText = media.getItemInfo('WM/MusicianCreditsList');
- if (sText.length)
- {
- s += '<tr><td id=fiCreditsText class=text></td></tr>';
- s += '<tr><td height=5></td></tr></table>';
- a('fiCreditsdata').innerHTML = s;
-
- a('fiCreditsText').innerText = sText;
- a('fiCreditstable').style.display = 'inline';
- }
- else
- a('fiCreditstable').style.display = 'none';
- }
-
- function GetDRMInfo(media)
- {
- if (media.getItemInfo('Is_Protected') != 'False')
- GetInfo('fiDRMProperties', media, aDRMInfo, aDRMInfoLabels);
- else
- element.document.all('fiDRMPropertiesTable').style.display = 'none';
- }
-
- function noData(sHTML)
- {
- var a = element.document.all;
- a('tagInfoData').style.display = 'none';
- a('tagInfoError').style.display = 'inline';
- a('tagInfoError').innerHTML = sHTML;
- }
- </SCRIPT>
- </PUBLIC:COMPONENT>
-