home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Programare / paranoia / ParanoiaSetup.exe / Gui / transfers.js < prev   
Text File  |  2005-04-08  |  6KB  |  165 lines

  1. /*
  2.  * function: OnloadShared
  3.  * Description: Loads the shared files list and sets its template
  4.  */
  5. function OnloadTransfers()
  6. {
  7.  
  8.     /* Start onload download settings */
  9.     ExecuteCommand("SetDownloadFilesHeaderTemplate|SEPERATOR|<table width='100%' border='0' cellpadding='0' cellspacing='0'>");
  10.     var lsCompletedDownloadTemplate = "<tr> \
  11.                                 <td align='left'  bgcolor='#F1F1F1'><span style='width: 100%; padding: 5px;' class='CommandLink' onclick=run_file(<DownloadID>)><b><DownloadName></b></span></td>\
  12.                             </tr>\
  13.                             <tr >\
  14.                                 <td align='left' ><span style='border-bottom: 1px solid #6799FF; width: 100%;padding: 5px;'>\
  15.                                 <strong>Size:</strong> <span style='color:#339933'><DownloadSize></span> KB   \
  16.                                 <strong>Completed:</strong> <span style='color:#339933'><DownloadComplete></span>  \
  17.                                 <strong>Status:</strong> <span style='color:#339933'><DownloadStatus></span>\
  18.                                 </span></td>\
  19.                             </tr>";
  20.     var lsCmd = "SetCompletedDownloadFilesTemplate" + "|SEPERATOR|" + lsCompletedDownloadTemplate;
  21.     ExecuteCommand(lsCmd);
  22.     
  23.     var lsIncompleteDownloadTemplate = "<tr> \
  24.                                 <td align='left' bgcolor='#F1F1F1'><span style='width: 100%; padding: 5px;'><b><DownloadName></b></span></td>\
  25.                             </tr>\
  26.                             <tr >\
  27.                                 <td align='left' ><span style='width: 100%; padding: 5px;'>\
  28.                                 <strong>Size:</strong> <span style='color:#339933'><DownloadSize> KB</span>   \
  29.                                 <strong>Speed:</strong> <span style='color:#339933'><DownloadSpeed></span>   \
  30.                                 <strong>Completed:</strong> <span style='color:#339933'><DownloadComplete></span>   \
  31.                                 <strong>Status:</strong> <span style='color:#339933'><DownloadStatus></span>   \
  32.                                 <strong>Remaining:</strong> <span style='color:#339933'><DownloadETA></span>\
  33.                                 </span></td>\
  34.                             </tr>\
  35.                             <tr>\
  36.                             <td ><span style='border-bottom: 1px solid #6799FF; width: 100%; padding: 5px;'>\
  37.                                 <span class='CommandLink' onclick=pause_resume_download(<DownloadID>)>Pause/Resume Download</span> | \
  38.                                 <span class='CommandLink' onclick=remove_download(<DownloadID>)>Remove Download</span> | \
  39.                                 <span class='CommandLink' onclick=find_more_sources(<DownloadID>)>Find more sources</span>\
  40.                             </span></td>\
  41.                             </tr>";
  42.  
  43.     var lsCmd = "SetIncompleteDownloadFilesTemplate" + "|SEPERATOR|" + lsIncompleteDownloadTemplate;
  44.     ExecuteCommand(lsCmd);
  45.  
  46.     ExecuteCommand("SetDownloadFilesFooterTemplate|SEPERATOR|</table>");
  47.     
  48.     ExecuteCommand("SetDownloadID|SEPERATOR|DownloadsID");
  49.     /* End onload download settings */
  50.     
  51.     
  52.     
  53.     /* Start onload upload settings */
  54.     ExecuteCommand("SetUploadFilesHeaderTemplate|SEPERATOR|<table width='100%' border='0' cellpadding='0' cellspacing='0'>");
  55.     var lsUploadTemplate = "<tr> \
  56.                                 <td align='left'  bgcolor='#F1F1F1'><span style='width: 100%; padding: 5px;'><b><UploadName></b></span></td>\
  57.                             </tr>\
  58.                             <tr >\
  59.                                 <td align='left' ><span style='border-bottom: 1px solid #6799FF; width: 100%;padding: 5px;'>\
  60.                                 <strong>Status:</strong> <span style='color:#339933'><UploadStatus></span>  \
  61.                                 <strong>Bytes Sent:</strong> <span style='color:#339933'><UploadBytesSent></span>  \
  62.                                 <strong>Speed:</strong> <span style='color:#339933'><UploadSpeed></span>  \
  63.                                 <strong>Estimated Time:</strong> <span style='color:#339933'><UploadEstimatedTime></span>  \
  64.                                 <strong>Time:</strong> <span style='color:#339933'><UploadTime> KB</span>   \
  65.                                 </span></td>\
  66.                             </tr>";
  67.     var lsCmd = "SetUploadFilesTemplate" + "|SEPERATOR|" + lsUploadTemplate;
  68.     ExecuteCommand(lsCmd);
  69.     ExecuteCommand("SetUploadFilesFooterTemplate|SEPERATOR|</table>");
  70.     
  71.     ExecuteCommand("SetUploadID|SEPERATOR|UploadsID");    
  72.     /* End onload upload settings */    
  73.     
  74. }
  75.  
  76.  
  77. /*
  78.  * function: run_file
  79.  * Parameters:
  80.  * DownloadID - The ID of the download
  81.  * Description: Runs a file by its  ID - make sure the function name is lower case, 
  82.  * because the template is converted into lower case characters.
  83.  */
  84. function run_file(DownloadID)
  85. {
  86.     var lsCmd;
  87.     lsCmd = "RunFile|SEPERATOR|" + DownloadID;
  88.     ExecuteCommand(lsCmd);
  89. }
  90.  
  91.  
  92. /*
  93.  * function: remove_download
  94.  * Parameters:
  95.  * DownloadID - The ID of the download
  96.  * Description: Removes a download and update the interface - make sure the function name is lower case, 
  97.  * because the template is converted into lower case characters.
  98.  */
  99. function remove_download(DownloadID)
  100. {
  101.     var lsCmd;
  102.     lsCmd = "RemoveDownload|SEPERATOR|" + DownloadID;
  103.     ExecuteCommand(lsCmd);
  104. }
  105.  
  106. /*
  107.  * function: find_more_sources
  108.  * Parameters:
  109.  * DownloadID - The ID of the download
  110.  * Description: Finds more sources for the download - make sure the function name is lower case, 
  111.  * because the template is converted into lower case characters.
  112.  */
  113. function find_more_sources(DownloadID)
  114. {
  115.     var lsCmd;
  116.     lsCmd = "FindMoreSources|SEPERATOR|" + DownloadID;
  117.     ExecuteCommand(lsCmd);
  118. }
  119.  
  120. /*
  121.  * function: pause_resume_download
  122.  * Parameters:
  123.  * DownloadID - The ID of the download
  124.  * Description: Depending on the download status pause or resumes the download - make sure the function name is lower case, 
  125.  * because the template is converted into lower case characters.
  126.  */
  127. function pause_resume_download(DownloadID)
  128. {
  129.     var lsCmd;
  130.     lsCmd = "IsStopped|SEPERATOR|" + DownloadID + "|SEPERATOR|IsStoppedID";
  131.     ExecuteCommand(lsCmd);
  132.     if(IsStoppedID.innerHTML == "1")
  133.     {
  134.         lsCmd = "StartDownload|SEPERATOR|" + DownloadID;
  135.  
  136.     }else
  137.     {
  138.         lsCmd = "PauseDownload|SEPERATOR|" + DownloadID;
  139.     }
  140.         
  141.     ExecuteCommand(lsCmd);
  142.     
  143.     
  144. }
  145.  
  146. function ShowDownloadURI()
  147. {
  148.     var intTop = event.clientY + document.body.scrollTop+10;
  149.     var intLeft = event.clientX + document.body.scrollLeft-10;
  150.         
  151.     DownloadURIID.style.pixelTop = intTop;
  152.     DownloadURIID.style.pixelLeft = intLeft;        
  153.     DownloadURIID.style.display = "inline";
  154. }
  155.  
  156.  
  157. function DownloadURI()
  158. {
  159.     DownloadURIID.style.display = "none";
  160.     var lsCmd;
  161.     lsCmd = "DownloadURI|SEPERATOR|" + URIInput.value;
  162.  
  163.         
  164.     ExecuteCommand(lsCmd);
  165. }