6a7e931e27f24a6c2c85dc12d3ecaa005ff8ffc2
[acontent.git] / docs / themes / default / updater / index.tmpl.php
1 <?php\r
2 /************************************************************************/\r
3 /* AContent                                                             */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2010                                                   */\r
6 /* Inclusive Design Institute                                           */\r
7 /*                                                                      */\r
8 /* This program is free software. You can redistribute it and/or        */\r
9 /* modify it under the terms of the GNU General Public License          */\r
10 /* as published by the Free Software Foundation.                        */\r
11 /************************************************************************/\r
12 \r
13 //include(TR_INCLUDE_PATH.'header.inc.php');\r
14 global $dependent_patches;\r
15 \r
16 if (isset($this->javascript_run_now)) echo $this->javascript_run_now;\r
17 ?>\r
18 \r
19 <div class="input-form">\r
20 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">\r
21 <fieldset class="group_form"><legend class="group_form"><?php echo _AT("updates"); ?></legend>\r
22 \r
23 <table class="data" rules="rows">\r
24 <thead>\r
25         <tr>\r
26                 <th scope="col">&nbsp;</th>\r
27                 <th scope="col"><?php echo _AT('system_update_id');?></th>\r
28                 <th scope="col"><?php echo _AT('description');?></th>\r
29                 <th scope="col"><?php echo _AT('status');?></th>\r
30                 <th scope="col"><?php echo _AT('available_to');?></th>\r
31                 <th scope="col"><?php echo _AT('author');?></th>\r
32                 <th scope="col"><?php echo _AT('installed_date');?></th>\r
33                 <th scope="col"><?php echo _AT('view_message');?></th>\r
34         </tr>\r
35 </thead>\r
36 \r
37 <?php if ($this->num_of_patches == 0){?>\r
38 <tbody>\r
39 <tr>\r
40         <td colspan="8">\r
41 <?php echo _AT('none_found'); ?>\r
42         </td>\r
43 </tr>\r
44 </tbody>\r
45 \r
46 <?php } else { ?>\r
47 <tfoot>\r
48 <tr>\r
49         <td colspan="8">\r
50                 <input type="submit" name="install" value="<?php echo _AT('install'); ?>" />\r
51         </td>\r
52 </tr>\r
53 </tfoot>\r
54 <tbody>\r
55 <?php   if (is_array($this->patches_in_db))\r
56                 foreach ($this->patches_in_db as $row)\r
57                                 print_patch_row($row, $row['patches_id'], false);\r
58         \r
59         $array_id = 0;\r
60         // display un-installed patches\r
61         if(is_array($this->patch_list_array))\r
62         {\r
63                 foreach ($this->patch_list_array as $row_num => $new_patch)\r
64                 {\r
65                         if (!is_patch_installed($new_patch['system_patch_id']))\r
66                         {\r
67                                 $dependent_patches_installed = true;\r
68                                 $dependent_patches = "";\r
69                                 \r
70                                 // check if the dependent patches are installed\r
71                                 if (is_array($new_patch["dependent_patches"]))\r
72                                 {\r
73                                         \r
74                                         foreach ($new_patch["dependent_patches"] as $num => $dependent_patch)\r
75                                         {\r
76                                                 if (!is_patch_installed($dependent_patch))\r
77                                                 {\r
78                                                         $dependent_patches_installed = false;\r
79                                                         $dependent_patches .= $dependent_patch. ", ";\r
80                                                 }\r
81                                         }\r
82                                         \r
83                                         // remove the last comma in the string\r
84                                         if ($dependent_patches <> "") $dependent_patches = substr($dependent_patches, 0, -2);\r
85                                 }\r
86 \r
87                                 // display patch row\r
88                                 if ($dependent_patches_installed)\r
89                                         print_patch_row($new_patch, $array_id++, true);\r
90                                 else\r
91                                 {\r
92                                         print_patch_row($new_patch, $array_id++, false);\r
93                                         $dependent_patches_installed = true;\r
94                                 }\r
95                         }\r
96                         else\r
97                                 $array_id++;\r
98                 }\r
99         }\r
100 ?>\r
101 </tbody>\r
102 \r
103 <?php } ?>\r
104 </table>\r
105 </fieldset>\r
106 \r
107 </form>\r
108 </div>\r
109 \r
110 <div class="input-form">\r
111 <form name="frm_upload" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >\r
112         <fieldset class="group_form"><legend class="group_form"><?php echo _AT("upload"); ?></legend>\r
113         \r
114                 <div class="row"><label for="patchfile"><?php echo _AT("upload_update"); ?></label></div>\r
115 \r
116                 <div class="row">\r
117                         <input type="hidden" name="MAX_FILE_SIZE" value="52428800" />\r
118                         <input type="file" name="patchfile"  id="patchfile" size="50" />\r
119                 </div>\r
120                 \r
121                 <div class="row buttons">\r
122                         <input type="submit" name="install_upload" value="Install" onclick="javascript: return validate_filename(); " class="submit" />\r
123                         <input type="hidden" name="uploading" value="1" />\r
124                 </div>\r
125         </fieldset>\r
126 </form>\r
127 </div>\r
128 \r
129 <script language="JavaScript" type="text/javascript">\r
130 <!--\r
131 \r
132 String.prototype.trim = function() {\r
133         return this.replace(/^\s+|\s+$/g,"");\r
134 }\r
135 \r
136 // This function validates if and only if a zip file is given\r
137 function validate_filename() {\r
138   // check file type\r
139   var file = document.frm_upload.patchfile.value;\r
140   if (!file || file.trim()=='') {\r
141     alert('Please give a zip file!');\r
142     return false;\r
143   }\r
144   \r
145   if(file.slice(file.lastIndexOf(".")).toLowerCase() != '.zip') {\r
146     alert('Please upload ZIP file only!');\r
147     return false;\r
148   }\r
149 }\r
150 \r
151 //  End -->\r
152 //-->\r
153 </script>\r
154 \r
155 <?php require (TR_INCLUDE_PATH.'footer.inc.php'); ?>\r