home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Programare / paranoia / ParanoiaSetup.exe / Gui / shared.js < prev    next >
Text File  |  2005-04-02  |  4KB  |  176 lines

  1. /*
  2.  * function: OnloadShared
  3.  * Description: Loads the shared files list and sets its template
  4.  */
  5. function OnloadShared()
  6. {
  7.     CommonOnload();
  8.     ExecuteCommand("SetSharedFilesHeaderTemplate|SEPERATOR|<table width='100%' border='0' cellpadding='2px' cellspacing='0'>");
  9.     var lsSharedTemplate = "<tr> \
  10.                                 <td align='left' colspan='5' bgcolor='#F1F1F1'><span class='CommandLink' onclick=runfile(<FileID>)><FileName></span></td>\
  11.                             </tr>\
  12.                             <tr >\
  13.                                 <td align='left' >Size: <FileSize> KB</td>\
  14.                                 <td align='left'>Type: <FileType></td>\
  15.                                 <td align='left'>Searched: <FileSearhced></td>\
  16.                                 <td align='left'>Uploaded: <FileUploaded></td>\
  17.                                 <td align='left'>Hashed: <FileHashed></td>\
  18.                             </tr>";
  19.     var lsCmd = "SetSharedFilesTemplate" + "|SEPERATOR|" + lsSharedTemplate;
  20.     ExecuteCommand(lsCmd);
  21.  
  22.     ExecuteCommand("SetSharedFilesFooterTemplate|SEPERATOR|</table>");
  23.     
  24.     
  25.     ExecuteCommand("LoadSharedList|SEPERATOR|SharedFilesID");
  26.     
  27.     ExecuteCommand("GetTotalFilesShared|SEPERATOR|TotalFilesSharedID");
  28.     ExecuteCommand("GetTotalSharedSize|SEPERATOR|TotalSharedSizeID");
  29.     ExecuteCommand("GetTotalSearched|SEPERATOR|TotalSearchedID");    
  30.     ExecuteCommand("GetTotalUploaded|SEPERATOR|TotalUploadedID");
  31.     
  32.     
  33. }
  34.  
  35. /*
  36.  * function: OnUpdate
  37.  * Description: Fired by the application when an update to the file list occurred
  38.  */
  39. function OnUpdate()
  40. {
  41.     ExecuteCommand("GetTotalFilesShared|SEPERATOR|TotalFilesSharedID");
  42.     ExecuteCommand("GetTotalSharedSize|SEPERATOR|TotalSharedSizeID");
  43.     ExecuteCommand("GetTotalSearched|SEPERATOR|TotalSearchedID");    
  44.     ExecuteCommand("GetTotalUploaded|SEPERATOR|TotalUploadedID");
  45.     
  46.     ExecuteCommand("IsPaged|SEPERATOR|IsPagedID");
  47.     if(IsPagedID.innerHTML == "1")
  48.         PagingID.style.display = 'inline';
  49.     else
  50.         PagingID.style.display = 'none';
  51.     
  52.     
  53.     GetStartingFileNumber();
  54.     GetEndingFileNumber();
  55. }
  56.  
  57. /*
  58.  * function: runfile
  59.  * Description: Runs a file by its file ID - make sure the function name is lower case, 
  60.  * because the template is converted into lower case characters.
  61.  */
  62. function runfile(FileID)
  63. {
  64.     var lsCmd;
  65.     lsCmd = "RunFile|SEPERATOR|" + FileID;
  66.     ExecuteCommand(lsCmd);
  67. }
  68.  
  69. /*
  70.  * function: SortByName
  71.  * Description: Sorts the list by the file name and updates the GUI
  72.  */
  73. function SortByName()
  74. {
  75.     ExecuteCommand("SortByName");
  76. }
  77.  
  78. /*
  79.  * function: SortBySize
  80.  * Description: Sorts the list by the file size and updates the GUI
  81.  */
  82. function SortBySize()
  83. {
  84.     ExecuteCommand("SortBySize");
  85. }
  86.  
  87. /*
  88.  * function: SortByType
  89.  * Description: Sorts the list by the type size and updates the GUI
  90.  */
  91. function SortByType()
  92. {
  93.     ExecuteCommand("SortByType");
  94. }
  95.  
  96. /*
  97.  * function: SortBySearched
  98.  * Description: Sorts the list by the number of time file was searched and updates the GUI
  99.  */
  100. function SortBySearched()
  101. {
  102.     ExecuteCommand("SortBySearched");
  103. }
  104.  
  105. /*
  106.  * function: SortByUploaded
  107.  * Description: Sorts the list by the number of time file was uploaded and updates the GUI
  108.  */
  109. function SortByUploaded()
  110. {
  111.     ExecuteCommand("SortByUploaded");
  112. }
  113.  
  114. /*
  115.  * function: SortByHashed
  116.  * Description: Sorts the list by hashed files and updates the GUI
  117.  */
  118. function SortByHashed()
  119. {
  120.     ExecuteCommand("SortByHashed");
  121. }
  122.  
  123. /*
  124.  * function: GoToFirstPage
  125.  * Description: Shows the first page of the list
  126.  */
  127. function GoToFirstPage()
  128. {
  129.     ExecuteCommand("GoToFirstPage");
  130. }
  131.  
  132. /*
  133.  * function: GoToNextPage
  134.  * Description: Shows the next page of the list
  135.  */
  136. function GoToNextPage()
  137. {
  138.     ExecuteCommand("GoToNextPage");
  139. }
  140.  
  141. /*
  142.  * function: GoToPrevPage
  143.  * Description: Shows the previous page of the list
  144.  */
  145. function GoToPrevPage()
  146. {
  147.     ExecuteCommand("GoToPrevPage");
  148. }
  149.  
  150.  
  151. /*
  152.  * function: GoToLastPage
  153.  * Description: Shows the last page of the list
  154.  */
  155. function GoToLastPage()
  156. {
  157.     ExecuteCommand("GoToLastPage");
  158. }
  159.  
  160. /*
  161.  * function: GetStartingFileNumber
  162.  * Description: Return the place in the list of the first shown file.
  163.  */
  164. function GetStartingFileNumber()
  165. {
  166.     ExecuteCommand("GetStartingFileNumber|SEPERATOR|FirstFileNumberID");
  167. }
  168.  
  169. /*
  170.  * function: GetEndingFileNumber
  171.  * Description: Return the place in the list of the last shown file.
  172.  */
  173. function GetEndingFileNumber()
  174. {
  175.     ExecuteCommand("GetEndingFileNumber|SEPERATOR|EndingFileNumberID");
  176. }