home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 December / PCWorld_2002-12_cd.bin / Software / Topware / wmp99xrc / mpsetup.exe / wmploc.DLL / HTML / FILEINFO.HTC < prev    next >
Encoding:
HTML Component  |  2002-10-28  |  8.9 KB  |  248 lines

  1. <PUBLIC:COMPONENT lightWeight=true>
  2. <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="load()" />
  3. <PUBLIC:METHOD NAME="reload" />
  4. <PUBLIC:METHOD NAME="updateMedia" />
  5. <PUBLIC:METHOD NAME="mediaChange" />
  6. <PUBLIC:METHOD NAME="edit" />
  7. <PUBLIC:ATTACH EVENT="onresize" ONEVENT="resize()" />
  8. <PUBLIC:METHOD NAME="noData" />
  9.  
  10. <SCRIPT LANGUAGE="JScript">
  11.  
  12. function reload() { load(); }
  13.  
  14. function load()
  15. {
  16.     var s = '<table width=368 class=pane border=0 cellpadding=0 cellspacing=0>';
  17.     s += '<tr><td class=artist>' + L_FileInfoTitle_Text + '</td></tr>';
  18.     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="return oCurrentPage.edit();" style="behavior:url(barbutton.htc)" text="' + L_EditInfoButton_Text + '"></td></tr></table></td></tr>';
  19.     s += '<tr><td height=14 id=fileinfoHeader></td></tr>';
  20.     s += '<tr><td height=10></td></tr>';
  21.     s += '<tr><td valign=top height=40>' + GetButtons(-1, '', 15, L_PhotographyTitle_Text) + '</td></tr>';
  22.  
  23.     s += '<tr><td id=tagInfoData width=368 height=100% valign=top><div class=text id=fileInfoText style="overflow-y: scroll; width: 368;"></div></td></tr>';
  24.  
  25.     s += '<tr><td style="display:none" id=tagInfoError></td></tr>';
  26.     element.innerHTML = s + '</table>';    
  27.     resize();
  28. }
  29.  
  30. var aTrackInfo = new Array('Title', 'WM/SetSubTitle', 'WM/Genre', 'WM/Mood', 'WM/Track', 'WM/BeatsPerMinute', 'WM/InitialKey', 'WM/AlbumTitle', 
  31.     'WM/OriginalAlbumTitle', 'WM/PartOfSet', 'WM/ContentGroupDescription', 'WM/Language', 'WM/MediaClassPrimaryID', 'WM/MediaClassSecondaryID');
  32. 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, 
  33.     L_OriginalAlbumLabel_Text, L_PartOfSetLabel_Text, L_MusicCategoryLabel_Text, L_LanguageLabel_Text, L_PrimaryMediaLabel_Text, L_SecondaryMediaLabel_Text);
  34.  
  35. var aArtistInfo = new Array('Author', 'WM/AlbumArtist', 'WM/Conductor', 'WM/Writer', 'WM/OriginalLyricist',
  36.     'WM/Composer', 'WM/ModifiedBy', 'WM/OriginalArtist');
  37. var aArtistInfoLabels = new Array(L_LeadArtistLabel_Text, L_BandLabel_Text, L_ConductorLabel_Text, L_LyricistLabel_Text, L_OriginalLyricistLabel_Text,
  38.     L_ComposerLabel_Text, L_ModifiedByLabel_Text, L_OriginalArtistLabel_Text);
  39.  
  40. var aDRMInfo = new Array('Is_Protected', 'DRMHasLicense', 'DRMPlayRightsStatus', 'DRMCDCopyStatus', 'DRMDeviceCopyStatus', 'DRMSDMICopyStatus', 'DRMBackupStatus');
  41. 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);
  42.  
  43. var aInfoList = new Array(aTrackInfo, aArtistInfo);
  44. var aInfoLabels = new Array(aTrackInfoLabels, aArtistInfoLabels);
  45. var aInfoTitles = new Array(L_TrackInfoLabel_Text, L_ArtistInfoLabel_Text);
  46.  
  47. function resize()
  48. {
  49.     var el = element.document.all('fileInfoText');
  50.     if (el)
  51.         el.style.height = Math.max(element.document.body.clientHeight - getElementTop('tagInfoData'), 10);
  52. }
  53.  
  54. function edit()
  55. {
  56.     if (window.external.appColorLight)
  57.         window.external.AdvancedEditDialog(); 
  58.     updateUI(); 
  59.     return false;
  60. }
  61.  
  62. function updateUI()
  63. {
  64.     try
  65.     {
  66.         var p = element.document.all('player');
  67.         var m = p.currentMedia;
  68.         updateMedia(m);
  69.     } catch(e)
  70.     {
  71.     }
  72. }
  73.  
  74. function mediaChange(m) { updateMedia(m); }
  75.  
  76. function updateMedia(media) 
  77. {
  78.     var s = '<table border=0 cellpadding=0 cellspacing=0>', i, sEditDisplay = 'none', a = element.document.all;
  79.     
  80.     a('tagInfoData').style.display = 'inline';
  81.     a('tagInfoError').style.display = 'none';
  82.     if (media)
  83.     {
  84.         SetArtistAlbumHeader('fileinfoHeader', true, true, false);
  85.         if (window.external.appColorMedium)
  86.         {
  87.             if (window.external.IsAdvancedEditDialogAvailable())
  88.                 sEditDisplay = 'inline';
  89.         }
  90.         
  91.         for (i = 0; i < aInfoList.length; i++)
  92.             s += GetInfo(aInfoTitles[i], media, aInfoList[i], aInfoLabels[i]);
  93.  
  94.         s += GetComments(media);
  95.         s += GetWebsites(media);
  96.         s += GetCredits(media);
  97.         s += GetDRMInfo(media);
  98.     }
  99.     else
  100.     {
  101.         var oDL = a('dataload');
  102.         oDL.setNoMedia();
  103.     }
  104.     a('editInfoButton').style.display = sEditDisplay;
  105.     a('fileInfoText').innerHTML = s + '</table>';
  106. }
  107.  
  108. var aPrimaryID = new Array();
  109. aPrimaryID['{D1607DBC-E323-4BE2-86A1-48A42A28441E}'] = 'Music';
  110. aPrimaryID['{01CD0F29-DA4E-4157-897B-6275D50C4F11}'] = 'Audio';
  111. aPrimaryID['{DB9830BD-3AB3-4FAB-8A37-1A995F7FF74B}'] = 'Video';
  112. aPrimaryID['{FCF24A76-9A57-4036-990D-E35DD8B244E1}'] = 'Other';
  113.  
  114. var aSecondaryID = new Array();
  115. aSecondaryID['{6677DB9B-E5A0-4063-A1AD-ACEB52840CF1}'] = 'News';
  116. aSecondaryID['{1B824A67-3F80-4E3E-9CDE-F7361B0F5F1B}'] = 'Talk Show';
  117. aSecondaryID['{E0236BEB-C281-4EDE-A36D-7AF76A3D45B5}'] = 'Audio Book';
  118. aSecondaryID['{3A172A13-2BD9-4831-835B-114F6A95943F}'] = 'Spoken Word';
  119. aSecondaryID['{1FE2E091-4E1E-40CE-B22D-348C732E0B10}'] = 'News';
  120. aSecondaryID['{D6DE1D88-C77C-4593-BFBC-9C61E8C373E3}'] = 'Talk Show';
  121. aSecondaryID['{B76628F4-300D-443D-9CB5-01C285109DAF}'] = 'Home Video';
  122. aSecondaryID['{A9B87FC9-BD47-4BF0-AC4F-655B89F7D868}'] = 'Movie/Film';
  123. aSecondaryID['{BA7F258A-62F7-47A9-B21F-4651C42A000E}'] = 'TV Show';
  124. aSecondaryID['{44051B5B-B103-4B5C-92AB-93060A9463F0}'] = 'Corporate Video';
  125. aSecondaryID['{E3E689E2-BA8C-4330-96DF-A0EEEFFA6876}'] = 'Music Video';
  126.  
  127. function GetInfo(sTitle, media, aFields, aLabels)
  128. {
  129.     var s = '<table border=0 cellpadding=0 cellspacing=0>', i, sText;
  130.     
  131.     s += '<tr><td colspan=3 class=textBold>' + sTitle + '</td></tr>';
  132.     
  133.     for (i = 0; i < aFields.length; i++)
  134.     {
  135.         sText = fixText(media.getItemInfo(aFields[i]));
  136.         
  137.         if (aFields[i] == 'WM/MediaClassPrimaryID')
  138.             sText = aPrimaryID[sText];
  139.         else if (aFields[i] == 'WM/MediaClassSecondaryID')
  140.             sText = aSecondaryID[sText];
  141.         else if(aFields[i] == 'Is_Protected')
  142.         {
  143.             if (!sText)
  144.                 sText = L_DRMProtectionNo_Text;
  145.             else
  146.                 sText = L_DRMProtectionYes_Text;
  147.         }
  148.             
  149.         if (sText && sText.length)
  150.             s += '<tr><td width=125 valign=top class=textGray>' + aLabels[i] + '</td><td width=8><td valign=top class=text>' + sText + '</td></tr>';
  151.     }
  152.         
  153.     return s + '<tr><td height=5></td></tr></table>';
  154. }
  155.  
  156. function GetComplexText(media, strField)
  157. {
  158.     var s = '', c, i, o;
  159.     c = media.getAttributeCountByType(strField, '');
  160.     for (i = 0; i < c; i++)
  161.     {
  162.         o = media.getItemInfoByType(strField, '', i);
  163.         s += fixText(o.text) + '<br>';
  164.     }
  165.     return s;
  166. }
  167.  
  168. function GetComments(media)
  169. {
  170.     var s = '<table border=0 cellpadding=0 cellspacing=0>', c, i, o, sText = '', fDisplay = false;
  171.     
  172.     s += '<tr><td class=textBold>' + L_CommentsInfoLabel_Text + '</td></tr>';
  173.     sText = fixText(media.getItemInfo('Description'));
  174.     if (sText.length) fDisplay = true;
  175.     s += '<tr><td class=text>' + sText + '</td></tr>';
  176.     
  177.     if (fDisplay)
  178.         return s + '<tr><td height=5></td></tr></table>';
  179.     else
  180.         return '';
  181. }
  182.  
  183. function GetWebsites(media)
  184. {
  185.     var s = '<table border=0 cellpadding=0 cellspacing=0>', fDisplay = false, sText, c, i, o;
  186.     
  187.     s += '<tr><td class=textBold>' + L_WebsitesLabel_Text + '</td></tr>';
  188.     sText = fixText(media.getItemInfo('WM/AudioFileURL'));
  189.     if (sText.length) fDisplay = true;
  190.     s += '<tr><td class=text><A href="' + sText + '" target=web>' + sText + '</a></td></tr>';
  191.  
  192.     sText = fixText(media.getItemInfo('WM/AuthorURL'));
  193.     if (sText.length) fDisplay = true;
  194.     s += '<tr><td class=text><A href="' + sText + '" target=web>' + sText + '</a></td></tr>';
  195.  
  196.     sText = fixText(media.getItemInfo('WM/AudioSourceURL'));
  197.     if (sText.length) fDisplay = true;
  198.     s += '<tr><td class=text><A href="' + sText + '" target=web>' + sText + '</a></td></tr>';
  199.  
  200.     c = media.getAttributeCountByType('WM/UserWebURL', '');
  201.     for (i = 0; i < c; i++)
  202.     {
  203.         o = media.getItemInfoByType('WM/UserWebURL', '', i);
  204.         sText = fixText(o.text);
  205.         if (sText.length) fDisplay = true;
  206.         s += '<tr><td class=text><A href="' + sText + '" target=web>' + sText + '</a></td></tr>';
  207.     }
  208.  
  209.     if (fDisplay)
  210.         return s + '<tr><td height=5></td></tr></table>';
  211.     else
  212.         return '';
  213. }
  214.  
  215. function GetCredits(media)
  216. {
  217.     var s = '<table border=0 cellpadding=0 cellspacing=0>', fDisplay = false, sText;
  218.     
  219.     s += '<tr><td class=textBold>' + L_CreditsLabel_Text + '</td></tr>';
  220.     
  221.     sText = fixText(media.getItemInfo('WM/MusicianCreditsList'));
  222.     if (sText.length) fDisplay = true;
  223.     s += '<tr><td class=text>' + sText + '</td></tr>';
  224.  
  225.     if (fDisplay)
  226.         return s + '<tr><td height=5></td></tr></table>';
  227.     else
  228.         return '';
  229. }
  230.  
  231. function GetDRMInfo(media)
  232. {
  233.     if (media.getItemInfo('Is_Protected'))
  234.         return GetInfo(L_DRMPropertiesLabel_Text, media, aDRMInfo, aDRMInfoLabels);
  235.     else
  236.         return '';
  237. }
  238.  
  239. function noData(sHTML)
  240. {
  241.     var a = element.document.all;
  242.     a('tagInfoData').style.display = 'none';
  243.     a('tagInfoError').style.display = 'inline';
  244.     a('tagInfoError').innerHTML = sHTML;
  245. }
  246. </SCRIPT>
  247. </PUBLIC:COMPONENT>
  248.