mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 16:33:17 +01:00
* InfoLog: if one of status, percent or datecompleted changed, change others to reasonable values
This commit is contained in:
parent
a58a358011
commit
4ae51b95db
@ -26,3 +26,57 @@ function add_email_from_ab(ab_id,info_cc)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* If one of info_status, info_percent or info_datecompleted changed --> set others to reasonable values
|
||||
*
|
||||
* @param string changed_id id of changed element
|
||||
* @param string status_id
|
||||
* @param string percent_id
|
||||
* @param string datecompleted_id
|
||||
*/
|
||||
function status_changed(changed_id, status_id, percent_id, datecompleted_id)
|
||||
{
|
||||
var status = document.getElementById(status_id);
|
||||
var percent = document.getElementById(percent_id);
|
||||
var datecompleted = document.getElementById(datecompleted_id+'[str]');
|
||||
var completed;
|
||||
|
||||
switch(changed_id)
|
||||
{
|
||||
case status_id:
|
||||
completed = status.value == 'done' || status.value == 'billed';
|
||||
if (completed || status.value == 'not-started') percent.value = completed ? 100 : 0;
|
||||
break;
|
||||
|
||||
case percent_id:
|
||||
completed = percent.value == 100;
|
||||
if (completed != (status.value == 'done' || status.value == 'billed') ||
|
||||
(status.value == 'not-started') != (percent.value == 0))
|
||||
{
|
||||
status.value = percent.value == 0 ? 'not-started' : (percent.value == 100 ? 'done' : 'ongoing');
|
||||
}
|
||||
break;
|
||||
|
||||
case datecompleted_id+'[str]':
|
||||
case datecompleted_id:
|
||||
completed = datecompleted.value != '';
|
||||
if (completed != (status.value == 'done' || status.value == 'billed'))
|
||||
{
|
||||
status.value = completed ? 'done' : 'not-started';
|
||||
}
|
||||
if (completed != (percent.value == 100))
|
||||
{
|
||||
percent.value = completed ? 100 : 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!completed && datecompleted.value != '')
|
||||
{
|
||||
datecompleted.value = '';
|
||||
}
|
||||
else if (completed && datecompleted.value == '')
|
||||
{
|
||||
// todo: set current date in correct format
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -166,7 +166,7 @@
|
||||
<column width="103"/>
|
||||
<column width="260"/>
|
||||
<column width="90"/>
|
||||
<column width="27%"/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row disabled="!@msg">
|
||||
@ -242,16 +242,16 @@
|
||||
<row class="row">
|
||||
<description value="Status" for="info_status"/>
|
||||
<menulist>
|
||||
<menupopup statustext="@status_help" id="info_status" onchange="if (this.value=='done' || this.value=='billed') set_element(this.form,'exec[info_percent]','100'); else if (this.value=='not-started') set_element(this.form,'exec[info_percent]','0');"/>
|
||||
<menupopup statustext="@status_help" id="info_status" onchange="status_changed(this.id, form::name('info_status'), form::name('info_percent'), form::name('info_datecompleted'))"/>
|
||||
</menulist>
|
||||
<description value="Completed" for="info_percent"/>
|
||||
<menulist>
|
||||
<menupopup type="select-percent" statustext="Percent completed" id="info_percent" onchange="if (this.value==100 && this.form['exec[info_status]'].value != 'done' && this.form['exec[info_status]'].value != 'billed' && this.form['exec[info_status]'].value != 'cancelled') this.form['exec[info_status]'].value='done'; else if (this.value != 100 && this.form['exec[info_status]'].value != 'cancelled') this.form['exec[info_status]'].value=this.value != 0 ? 'ongoing' : 'not-started'; else if (this.value==0 && this.form['exec[info_status]'].value != 'cancelled' && this.form['exec[info_status]'].value != 'offer') this.form['exec[info_status]'].value='not-started'; "/>
|
||||
<menupopup type="select-percent" statustext="Percent completed" id="info_percent" onchange="status_changed(this.id, form::name('info_status'), form::name('info_percent'), form::name('info_datecompleted'))"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row class="row">
|
||||
<description value="Date completed" for="info_datecompleted"/>
|
||||
<date-time statustext="Date completed (leave it empty to have it automatic set if status is done or billed)" id="info_datecompleted"/>
|
||||
<date-time statustext="Date completed (leave it empty to have it automatic set if status is done or billed)" id="info_datecompleted" onchange="status_changed(this.id, form::name('info_status'), form::name('info_percent'), form::name('info_datecompleted'))"/>
|
||||
<description value="Private" for="info_access"/>
|
||||
<checkbox statustext="should this entry only be visible to you and people you grant privat access via the ACL" id="info_access" options="private,public"/>
|
||||
</row>
|
||||
|
Loading…
Reference in New Issue
Block a user