1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
--- a/wwwroot/inc/interface-lib.php
+++ b/wwwroot/inc/interface-lib.php
@@ -403,6 +403,36 @@
">";
}
+//jlee new method start
+function mkImageButton ($tag, $location_id = '', $title = '', $do_input = FALSE)
+{
+ global $image;
+ if (!isset ($image[$tag]))
+ $tag = 'error';
+ $img = $image[$tag];
+ $img['path'] = '?module=chrome&uri=' . $img['path'];
+ if ($do_input == TRUE){
+ echo
+ "<input type=image name=edit class=edit " .
+ "src='${img['path']}' " .
+ "id='${location_id}' " .
+ "border=0 " .
+ (!strlen ($title) ? '' : " title='${title}'") . // JT: Add title to input hrefs too
+ ">";
+ }
+ else{
+ echo
+ "<img " .
+ "src='${img['path']}' " .
+ "width=${img['width']} " .
+ "height=${img['height']} " .
+ "border=0 " .
+ (!strlen ($title) ? '' : "title='${title}'") .
+ ">";
+ }
+}
+//jlee new method end
+
function escapeString ($value, $do_db_escape = FALSE)
{
$ret = htmlspecialchars ($value, ENT_QUOTES, 'UTF-8');
@@ -967,7 +997,6 @@
foreach ($extra as $inputname => $inputvalue)
printf ('<input type=hidden name="%s" value="%s">', htmlspecialchars ($inputname, ENT_QUOTES), htmlspecialchars ($inputvalue, ENT_QUOTES));
}
-
// Display hrefs for all of a file's parents. If scissors are requested,
// prepend cutting button to each of them.
--- a/wwwroot/inc/interface.php
+++ b/wwwroot/inc/interface.php
@@ -616,7 +616,8 @@
printOpFormIntro ('addRow');
echo '<tr><td>';
printImageHREF ('create', 'Add new row', TRUE);
- echo '</td><td><select name=location_id>';
+ //echo '</td><td><select name=location_id>';
+ echo '</td><td><select id=location_id name=location_id>'; //jlee add id
renderLocationSelectTree ();
echo '</td><td><input type=text name=name></td><td>';
printImageHREF ('create', 'Add new row', TRUE);
@@ -629,16 +630,32 @@
printNewItemTR ();
foreach (listCells ('row') as $row_id => $rowInfo)
{
+
echo '<tr><td>';
if ($rc = $rowInfo['rackc'])
printImageHREF ('nodestroy', "${rc} rack(s) here");
else
echo getOpLink (array('op'=>'deleteRow', 'row_id'=>$row_id), '', 'destroy', 'Delete row');
- printOpFormIntro ('updateRow', array ('row_id' => $row_id));
- echo '</td><td>';
- echo '<select name=location_id>';
- renderLocationSelectTree ($rowInfo['location_id']);
- echo "</td><td><input type=text name=name value='${rowInfo['name']}'></td><td>";
+ printOpFormIntro ('updateRow', array ('row_id' => $row_id));
+
+ //jlee start
+ //echo '</td><td>';
+ //echo '<select name=location_id>';
+ //renderLocationSelectTree ($rowInfo['location_id']);
+ //echo "</td><td><input type=text name=name value='${rowInfo['name']}'></td><td>";
+ echo '</td><td><div id="location_name" name="location_name">'; //jlee - add div field
+ echo $rowInfo['location_name'];
+ echo "</div>";
+ echo "<input type=hidden id=location_id name=location_id value=".$rowInfo['location_id'].">"; //hidden container to hold final value
+ echo "</td>";
+ echo "<td>";
+ echo "<div id=temp_name name=temp_name value='${rowInfo['name']}'>".$rowInfo['name']."</div>";
+ echo "<input type=hidden id=name name=name value='".$rowInfo['name']."'>"; //hidden containers to hold final value
+ echo "</td><td>";
+
+ mkImageButton ('pencil', $rowInfo['location_id'], 'Edit row', TRUE); //jlee try adding an edit button
+ echo " ";
+ //jlee end
printImageHREF ('save', 'Save changes', TRUE);
echo "</form></td>";
echo "<td>" . mkCellA ($rowInfo) . "</td>";
@@ -648,6 +665,7 @@
printNewItemTR ();
echo "</table><br>\n";
finishPortlet();
+ addJS('js/inline-row-edit.js'); //jlee add reference to new js file
}
function renderRow ($row_id)
Only in b: wwwroot/js/inline-row-edit.js
|