From 003c060ee8be30c456f0dd17e9776c805b4c4503 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Tue, 18 Jul 2017 00:03:46 +0200 Subject: [PATCH] Convert in-place edit of task to jquery.editable --- class/stempel.class.php | 16 ++++++++++ src/InfoCon/stempel/index.wml | 18 +++++++++-- src/InfoCon/stempel/status.wml | 57 +++++----------------------------- 3 files changed, 39 insertions(+), 52 deletions(-) create mode 100644 class/stempel.class.php diff --git a/class/stempel.class.php b/class/stempel.class.php new file mode 100644 index 0000000..23a8cff --- /dev/null +++ b/class/stempel.class.php @@ -0,0 +1,16 @@ +modify('task', $data['content']); + } + +} diff --git a/src/InfoCon/stempel/index.wml b/src/InfoCon/stempel/index.wml index cda1025..5087641 100644 --- a/src/InfoCon/stempel/index.wml +++ b/src/InfoCon/stempel/index.wml @@ -24,7 +24,9 @@ $month = date('Y-m'); ?> + + Arbeitsbeschreibung '; $table_foot = ''; - $table_row = '%s%s%s%s'; + if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/') === false) + $table_row = '%s%s%s%s'; + else + $table_row = '%s%s%s%s'; $table_sum = ' %s Summe'; $query = <<
+
# Local variables: diff --git a/src/InfoCon/stempel/status.wml b/src/InfoCon/stempel/status.wml index 822d46e..5ee8b4d 100644 --- a/src/InfoCon/stempel/status.wml +++ b/src/InfoCon/stempel/status.wml @@ -3,6 +3,7 @@ + - + @@ -60,10 +61,10 @@ ''; $table_row = '' . - ''; + ''; $table_sum = ''; - $query = "SELECT stempel.oid,stempel.status,start,customer,time,task,kurz FROM stempel JOIN stempel_status ON (stempel.status = stempel_status.id) WHERE time IS NOT NULL "; + $query = "SELECT stempel.oid,stempel.id,stempel.status,start,customer,time,task,kurz FROM stempel JOIN stempel_status ON (stempel.status = stempel_status.id) WHERE time IS NOT NULL "; if (isset($month) && strlen($month)) $query .= "AND cast(start AS TEXT) LIKE '".$month."-%' "; if (isset($cust) && strlen($cust)) @@ -105,7 +106,9 @@ $row['oid'], $form); $date = sprintf('%s', $form, $d[0]); - printf($table_row, $color, $row['status'], $check.$date, $form, min2hour($row['time']), $form, $row['kurz'], htmlspecialchars($row['task'], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1')); + printf($table_row, $color, $row['status'], $check.$date, $form, min2hour($row['time']), $form, $row['kurz'], + $row['id'], + htmlspecialchars($row['task'], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1')); $color = !$color; } if (pg_num_rows($sth) > 0) { @@ -250,53 +253,8 @@ function add_sum(form, checkbox) sum.html('€' + ((newval/60)*rate.val()).toFixed(2)); } -var task_parent = null; -var task_title = ''; -var task_oid = 0; -function edit_task(obj) -{ - if (task_oid) { - if (task_oid != obj.parentNode.children[0].children[0].value) - edit_task_save(); - } - - if (!task_oid) { - task_parent = obj; - task_title = obj.innerHTML; - task_oid = obj.parentNode.children[0].children[0].value; - - var input = $(''); - input.val(obj.innerHTML.replace('>', '>').replace('<', '<').replace('&', '&')); - input.css('fontSize', '100%').css('width', '100%').css('background', 'yellow'); - obj.innerHTML = ''; - $(obj).append(input); - input.focus(); - } -} - -function edit_task_save() -{ - if (!task_parent) return; - - if (task_parent.children[0].value != task_title) - $.invoke('Sales/Text', {id: task_oid, text: task_parent.children[0].value}); - - task_parent.innerHTML = task_parent.children[0].value; - task_parent = null; - task_title = ''; - task_oid = 0; -} - -function edit_task_finish(obj) -{ - if (task_oid) - edit_task_save(); -} - function toggle_checkbox(form, obj) { - edit_task_finish(obj); - var row = $(obj).parents('tr:first'); var checkbox = row.find('input[type="checkbox"]') checkbox.prop('checked', !checkbox.prop('checked')); @@ -372,6 +330,7 @@ function status_change(e) $(function(){ $('div.jscode input.filter').keyup(filter_change); $('div.jscode img.filter').click(filter_clear); + make_editable('table.smallfont tr span'); }); -- 2.20.1
Datum Dauer St.
%s%s%s%s
%s%s
 %s Summe