a65e4fc46f0ce44c3e51e49ce8e7a33cdc441feb
[acontent.git] / docs / themes / default / course_category / 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, $onload;\r
14 $_custom_css = TR_BASE_HREF."include/jscripts/infusion/components/inlineEdit/css/InlineEdit.css";\r
15 $onload = "document.add_form.category_name.focus();";\r
16 include(TR_INCLUDE_PATH.'header.inc.php');\r
17 ?>\r
18 \r
19 <div class="input-form">\r
20   <form name="add_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >\r
21   <fieldset class="group_form"><legend class="group_form"><?php echo _AT("add_course_category"); ?></legend>\r
22     <table class="form-data" align="left">\r
23     <tr align="left">\r
24       <td align="left">\r
25       <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="category_name"><?php echo _AT('category_name'); ?></label>:\r
26       <input id="category_name" name="category_name" type="text" maxlength="255" size="30" />\r
27       <input type="submit" name="add" value="<?php echo _AT('add'); ?>" />\r
28       </td>\r
29     </tr>\r
30     </table>\r
31   </fieldset>\r
32 </form>\r
33 </div>\r
34   \r
35 <div id="output_div" class="input-form">\r
36 <fieldset class="group_form"><legend class="group_form"><?php echo _AT("course_categories"); ?></legend>\r
37 \r
38 <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">\r
39 \r
40 <table summary="<?php echo _AT('course_category_table_summary'); ?>" class="data" rules="rows" id="editable_table">\r
41 <thead>\r
42 <tr>\r
43   <th scope="col" align="left" width="5%"><input type="checkbox" value="<?php echo _AT('select_all'); ?>" id="all" title="<?php echo _AT('select_all'); ?>" name="selectall" onclick="CheckAll();" /></th>\r
44   <th scope="col"><?php echo _AT('category_name'); ?></th>\r
45 </tr>\r
46 </thead>\r
47 \r
48 <?php if (is_array($this->rows) && count($this->rows) > 0): ?>\r
49   <tfoot>\r
50   <tr>\r
51     <td colspan="2">\r
52       <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />\r
53     </td>\r
54   </tr>\r
55   </tfoot>\r
56   <tbody>\r
57     <?php if (is_array($this->rows)){ foreach ($this->rows as $row) {?>\r
58       <!-- <tr onmousedown="document.form['m<?php echo $row['category_id']; ?>'].checked = !document.form['m<?php echo $row['category_id']; ?>'].checked; togglerowhighlight(this, 'm<?php echo $row['category_id']; ?>');" \r
59           onkeydown="document.form['m<?php echo $row['category_id']; ?>'].checked = !document.form['m<?php echo $row['category_id']; ?>'].checked; togglerowhighlight(this, 'm<?php echo $row['category_id']; ?>');"\r
60           id="rm<?php echo $row['category_id']; ?>"> \r
61                 <td><input type="checkbox" name="id[]" value="<?php echo $row['category_id']; ?>" id="m<?php echo $row['category_id']; ?>" \r
62                            onmouseup="this.checked=!this.checked" onkeyup="this.checked=!this.checked" /></td>\r
63           -->\r
64       <tr id="rm<?php echo $row['category_id']; ?>">\r
65                 <td><input type="checkbox" name="id[]" value="<?php echo $row['category_id']; ?>" id="m<?php echo $row['category_id']; ?>" /></td>\r
66         <td><span class="inlineEdits" id="<?php echo "category_name-".$row['category_id']; ?>"><?php echo $row['category_name']; ?></span></td>\r
67       </tr>\r
68     <?php }} ?>\r
69   </tbody>\r
70 <?php else: ?>\r
71   <tr>\r
72     <td colspan="2"><?php echo _AT('none_found'); ?></td>\r
73   </tr>\r
74 <?php endif; ?>\r
75 </table><br />\r
76 <small class="data-table-tip"><?php echo _AT('inline_editor_tip'); ?></small>\r
77 \r
78 </form>\r
79 </fieldset>\r
80 </div>\r
81 \r
82 <script language="JavaScript" type="text/javascript">\r
83 //<!--\r
84 function CheckAll() {\r
85   for (var i=0;i<document.form.elements.length;i++)  {\r
86     var e = document.form.elements[i];\r
87     if ((e.name == 'id[]') && (e.type=='checkbox')) {\r
88       e.checked = document.form.selectall.checked;\r
89       togglerowhighlight(document.getElementById("r" + e.id), e.id);\r
90     }\r
91   }\r
92 }\r
93 \r
94 function togglerowhighlight(obj, boxid) {\r
95   if (document.getElementById(boxid).checked) {\r
96     obj.className = 'selected';\r
97   } else {\r
98     obj.className = '';\r
99   }\r
100 }\r
101 \r
102 jQuery(document).ready(function () {\r
103   var tableEdit = fluid.inlineEdits("#editable_table", {\r
104     selectors : {\r
105       text : "span",\r
106       editables : "td:has(span.inlineEdits)"\r
107     },\r
108     defaultViewText: "",\r
109     useTooltip: true,\r
110     listeners: {\r
111       afterFinishEdit : function (newValue, oldValue, editNode, viewNode) {\r
112         if (newValue != oldValue)\r
113           rtn = jQuery.post("<?php echo TR_BASE_HREF; ?>course_category/index_inline_editor_submit.php", { "field":viewNode.id, "value":newValue }, \r
114                   function(data) { handleAjaxResponse(data, viewNode, oldValue); }, "json");\r
115       }\r
116     }\r
117   });\r
118 });\r
119 \r
120 //-->\r
121 </script>\r
122 <?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>