AC_4897, AC_4898, AC_4899: Multifile uploader fixes.
[acontent.git] / docs / themes / default / language / 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 global $_custom_css;\r
14 $_custom_css = TR_BASE_HREF."include/jscripts/infusion/components/inlineEdit/css/InlineEdit.css";\r
15 \r
16 include(TR_INCLUDE_PATH.'header.inc.php');\r
17 ?>\r
18 <div class="input-form">\r
19 \r
20 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1">\r
21 <fieldset class="group_form"><legend class="group_form"><?php echo _AT("language"); ?></legend>\r
22 \r
23 <table class="data" rules="rows" id="editable_table">\r
24 <thead>\r
25         <tr>\r
26                 <th scope="col">&nbsp;</th>\r
27                 <th scope="col"><?php echo _AT('name_in_translated');?></th>\r
28                 <th scope="col"><?php echo _AT('name_in_english');?></th>\r
29                 <th scope="col"><?php echo _AT('lang_code');?></th>\r
30                 <th scope="col"><?php echo _AT('charset');?></th>\r
31                 <th scope="col"><?php echo _AT('status');?></th>\r
32         </tr>\r
33 </thead>\r
34 \r
35 <tfoot>\r
36         <tr>\r
37                 <td colspan="6">\r
38                         <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />\r
39                         <input type="submit" name="export" value="<?php echo _AT('export'); ?>" />\r
40                         <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />\r
41                 </td>\r
42         </tr>\r
43 </tfoot>\r
44 \r
45 <tbody>\r
46 <?php foreach ($this->rows as $row) {?>\r
47         <tr onmousedown="document.form1['m<?php echo $row["language_code"]."_".$row["charset"]; ?>'].checked = true; trans.utility.rowselect(this);" \r
48             onkeydown="document.form1['m<?php echo $row["language_code"]."_".$row["charset"]; ?>'].checked = true; trans.utility.rowselect(this);"\r
49             id="r_<?php echo $row["language_code"]."_".$row["charset"]; ?>">\r
50                 <td><input type="radio" name="id" value="<?php echo $row["language_code"]."_".$row["charset"]; ?>" id="m<?php echo $row['language_code']."_".$row["charset"]; ?>" \r
51                            onmouseup="this.checked=!this.checked" onkeyup="this.checked=!this.checked" /></td>\r
52                 <td><label for="m<?php echo $row["language_code"]."_".$row["charset"]; ?>"><span class="inlineEdits" id="<?php echo "native_name:".$row["language_code"].":".$row["charset"]; ?>"><?php echo $row["native_name"]; ?></span></label></td>\r
53                 <td><span class="inlineEdits" id="<?php echo "english_name:".$row["language_code"].":".$row["charset"]; ?>"><?php echo $row['english_name']; ?></span></td>\r
54                 <td><?php echo $row['language_code']; ?></td>\r
55                 <td><?php echo $row['charset']; ?></td>\r
56                 <td>\r
57                 <?php \r
58                 if ($row['status'] == TR_STATUS_ENABLED) echo _AT('enabled'); \r
59                 else if ($row['status'] == TR_STATUS_DISABLED) echo _AT('disabled'); \r
60                 else echo _AT('unknown'); \r
61                 ?>\r
62                 </td>\r
63         </tr>\r
64 <?php }?>\r
65 </tbody>\r
66 \r
67 </table><br />\r
68 <small class="data-table-tip"><?php echo _AT('inline_editor_tip'); ?></small>\r
69 </fieldset>\r
70 </form>\r
71 \r
72 <br /><br />\r
73 \r
74 <form name="import_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">\r
75 <fieldset class="group_form"><legend class="group_form"><?php echo _AT("import_a_new_lang"); ?></legend>\r
76 <div id="container">\r
77         <input type="file" name="file" id="file" size="50"/>\r
78         <input type="submit" name="import" value="<?php echo _AT('import'); ?>" onclick="javascript: return validate_filename(); " />\r
79 </div>\r
80 </fieldset>\r
81 </form>\r
82 </div> <!-- end input-form duv -->\r
83 <script type="text/javascript">\r
84 <!--\r
85 \r
86 String.prototype.trim = function() {\r
87         return this.replace(/^\s+|\s+$/g,"");\r
88 }\r
89 \r
90 // This function validates if and only if a zip file is given\r
91 function validate_filename() {\r
92   // check file type\r
93   var file = document.import_form.file.value;\r
94   if (!file || file.trim()=='') {\r
95     alert('Please select a language pack zip file.');\r
96     return false;\r
97   }\r
98   \r
99   if(file.slice(file.lastIndexOf(".")).toLowerCase() != '.zip') {\r
100     alert('Please upload ZIP file only!');\r
101     return false;\r
102   }\r
103 }\r
104 \r
105 jQuery(document).ready(function () {\r
106         var tableEdit = fluid.inlineEdits("#editable_table", {\r
107                 selectors : {\r
108                         text : "span",\r
109                         editables : "td:has(span.inlineEdits)"\r
110                 },\r
111                 defaultViewText: "",\r
112                 useTooltip: true,\r
113                 listeners: {\r
114                         afterFinishEdit : function (newValue, oldValue, editNode, viewNode) {\r
115                                 if (newValue != oldValue)\r
116                                         rtn = jQuery.post("<?php echo TR_BASE_HREF; ?>language/index_inline_editor_submit.php", { "field":viewNode.id, "value":newValue }, \r
117                                                           function(data) {handleAjaxResponse(data, viewNode, oldValue); }, "json");\r
118                         }\r
119                 }\r
120         });\r
121 });\r
122 \r
123 //  End -->\r
124 //-->\r
125 </script>\r
126 \r
127 <?php \r
128 // display footer\r
129 include(TR_INCLUDE_PATH.'footer.inc.php');\r
130 ?>