backport infolog feature copy and print from stefan becker

This commit is contained in:
Klaus Leithoff 2009-12-14 08:25:31 +00:00
commit 18f03e6314
6 changed files with 309 additions and 18 deletions

View File

@ -242,7 +242,7 @@ class infolog_ui
{
$for = @$values['session_for'] ? $values['session_for'] : @$this->called_by;
//echo "<p>$for: ".__METHOD__.'('.print_r($values,True).") called_by='$this->called_by', for='$for'<br />".function_backtrace()."</p>\n";
$arrayToStore = array(
'search' => $values['search'],
'start' => $values['start'],
@ -258,7 +258,7 @@ class infolog_ui
'col_filter' => $values['col_filter'],
'session_for' => $for
);
if ($values['filter']=='bydate')
if ($values['filter']=='bydate')
{
$arrayToStore['startdate'] = $values['startdate'];
$arrayToStore['enddate'] = $values['enddate'];
@ -298,8 +298,8 @@ class infolog_ui
{
$query['header_left'] = 'infolog.index.dates';
$GLOBALS['egw']->js->set_onload("set_style_by_class('table','custom_hide','visibility','visible');");
if (is_int($query['startdate'])) $query['col_filter'][] = 'info_startdate > '.$GLOBALS['egw']->db->quote($query['startdate']);
if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate < '.$GLOBALS['egw']->db->quote($query['enddate']);
if (is_int($query['startdate'])) $query['col_filter'][] = 'info_startdate > '.$GLOBALS['egw']->db->quote($query['startdate']);
if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate < '.$GLOBALS['egw']->db->quote($query['enddate']);
//unset($query['startdate']);
//unset($query['enddate']);
}
@ -828,7 +828,6 @@ class infolog_ui
function edit($content = null,$action = '',$action_id=0,$type='',$referer='')
{
$tabs = 'description|links|delegation|project|customfields|history';
if (is_array($content))
{
//echo "infolog_ui::edit: content="; _debug_array($content);
@ -838,14 +837,29 @@ class infolog_ui
$referer = $content['referer']; unset($content['referer']);
$no_popup = $content['no_popup']; unset($content['no_popup']);
$caller = $content['caller']; unset($content['caller']);
// convert custom from to 0 or 1, it's unset if not checked, which starts the detection
$content['info_custom_from'] = (int)$content['info_custom_from'];
list($button) = @each($content['button']);
if (!$button && $action) $button = $action; // action selectbox
unset($content['button']);
if ($button)
{
//Copy Infolog
if (($button == 'copy'))
{
unset($content['info_id']);
unset ($info_id);
unset($content['info_datemodified']);
unset($contentt['info_modifier']);
$content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(EGW_ACL_ADD,0,$this->owner) ? $this->user : $this->owner;
$content['msg'] = lang('Infolog copied - the copy can now be edited');
$content['info_subject'] = lang('Copy of:').' '.$content['info_subject'];
}
if ($button == 'print')
{
$content['js'] = $this->custom_print($content,!$content['info_id'])."\n".$js; // first open the new window and then update the view
}
//echo "<p>infolog_ui::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content);
if (($button == 'save' || $button == 'apply') && isset($content['info_subject']) && empty($content['info_subject']))
{
@ -994,6 +1008,7 @@ class infolog_ui
$GLOBALS['egw']->common->get_referer('/index.php?menuaction=infolog.infolog_ui.index'));
$referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer
$no_popup = $_GET['no_popup'];
$print = (int) $_REQUEST['print'];
//echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
$content = $this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id );
@ -1201,7 +1216,7 @@ class infolog_ui
// use a typ-specific template (infolog.edit.xyz), if one exists, otherwise fall back to the generic one
if (!$this->tmpl->read('infolog.edit.'.$content['info_type']))
{
$this->tmpl->read('infolog.edit');
$this->tmpl->read($print ? 'infolog.edit.print':'infolog.edit');
}
if ($this->bo->has_customfields($content['info_type']))
{
@ -1272,6 +1287,10 @@ class infolog_ui
'info_confirm' => $this->bo->enums['confirm'],
'info_status' => $this->bo->status[$content['info_type']],
'status' => $history_stati,
'action' => array(
'copy' => array('label' => 'Copy', 'title' => 'Copy this Infolog'),
'print' => array('label' => 'Print', 'title' => 'Print this Infolog'),
),
),$readonlys,$preserv+array( // preserved values
'info_id' => $info_id,
'action' => $action,
@ -1623,6 +1642,23 @@ class infolog_ui
return $message;
}
/**
* return javascript to open compose window to print the Infolog
*
* @param array $event
* @param boolean $added
* @return string javascript window.open command
*/
function custom_print($content,$added)
{
$vars = array(
'menuaction' => 'infolog.infolog_ui.edit',
'info_id' => $content['info_id'],
'print' => true,
);
return "window.open('".egw::link('/index.php',$vars)."','_blank','width=700,height=700,scrollbars=yes,status=no');";
}
/**
* shows infolog in other applications
*

View File

@ -26,6 +26,7 @@ a short subject for the entry infolog de einen kurzen Titel für diesen Eintrag
abort without deleting infolog de Abruch ohne zu Löschen
accept infolog de bei Annahme
action infolog de Befehle
actions... infolog de Befehle...
actual date and time infolog de aktuelles Datum und Uhrzeit
add infolog de Hinzufügen
add a file infolog de Datei anhängen
@ -74,6 +75,7 @@ completed infolog de Erledigt
configuration infolog de Konfiguration
confirm infolog de Bestätigung
contact infolog de Kontakt
copy of: infolog de Kopie von:
copy your changes to the clipboard, %1reload the entry%2 and merge them. infolog de Kopieren Sie ihre Änderungen in die Zwischenablage, %1laden den Eintrag neu%2 und fügen diese wieder ein.
create new links infolog de Neue Verknüpfung erzeugen
creates a new field infolog de erstellt ein neues Feld
@ -177,6 +179,7 @@ infolog - import csv-file infolog de InfoLog - Import CSV-Datei
infolog - new infolog de InfoLog - Anlegen
infolog - new subproject infolog de InfoLog - Anlegen Teilprojekt
infolog - subprojects from infolog de InfoLog - Teilprojekte von
infolog copied - the copy can now be edited infolog de Infolog Kopie - Diese Kopie kann jetzt bearbeitet werden
infolog entry deleted infolog de InfoLog Eintrag gelöscht
infolog entry saved infolog de InfoLog Eintrag gespeichert
infolog filter for the main screen infolog de InfoLog Filter für Startseite

View File

@ -26,6 +26,7 @@ a short subject for the entry infolog en a short subject for the entry
abort without deleting infolog en Abort without deleting
accept infolog en accept
action infolog en Action
actions... infolog en Actions...
actual date and time infolog en actual date and time
add infolog en Add
add a file infolog en Add a file
@ -74,6 +75,7 @@ completed infolog en Completed
configuration infolog en Configuration
confirm infolog en Confirm
contact infolog en Contact
copy of: infolog en Copy of:
copy your changes to the clipboard, %1reload the entry%2 and merge them. infolog en Copy your changes to the clipboard, %1reload the entry%2 and merge them.
create new links infolog en Create new links
creates a new field infolog en creates a new field
@ -177,6 +179,7 @@ infolog - import csv-file infolog en InfoLog - Import CSV-File
infolog - new infolog en InfoLog - New
infolog - new subproject infolog en InfoLog - New Subproject
infolog - subprojects from infolog en InfoLog - Subprojects from
infolog copied - the copy can now be edited infolog en Infolog copied - the copy can now be edited
infolog entry deleted infolog en InfoLog entry deleted
infolog entry saved infolog en InfoLog entry saved
infolog filter for the main screen infolog en InfoLog filter for the main screen

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,241 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="infolog.edit.print.project" template="" lang="" group="0" version="1.7.001">
<grid width="100%" height="245">
<columns>
<column width="100"/>
<column/>
</columns>
<rows>
<row class="th">
<description span="all" value="Projectmanager"/>
</row>
<row class="row">
<description value="Project"/>
<description id="pm_id" onchange="1" options="None" readonly="true"/>
</row>
<row class="row">
<description value="Price"/>
<hbox span="all">
<description id="pl_id" options="None" onchange="this.form['exec[info_price]'].value=this.options[this.selectedIndex].text.lastIndexOf('(') &lt; 0 ? '' : this.options[this.selectedIndex].text.slice(this.options[this.selectedIndex].text.lastIndexOf('(')+1,-1);" readonly="true"/>
<textbox type="float" id="info_price" span="all" readonly="true"/>
</hbox>
</row>
<row class="row">
<description options=",,,info_planned_time" value="planned time"/>
<date-duration id="info_planned_time" options=",$cont[duration_format]" readonly="true"/>
</row>
<row class="row">
<description options=",,,info_replanned_time" value="Re-planned time"/>
<date-duration id="info_replanned_time" options=",$cont[duration_format]" readonly="true"/>
</row>
<row class="row" valign="top" height="60%">
<description options=",,,info_used_time" value="used time" statustext="Leave blank to get the used time calculated by timesheet entries"/>
<date-duration id="info_used_time" readonly="true"/>
</row>
</rows>
</grid>
</template>
<template id="infolog.edit.print.links" template="" lang="" group="0" version="1.7.001">
<grid width="100%" height="245">
<columns>
<column width="95"/>
<column/>
</columns>
<rows>
<row class="th">
<description span="all" value="Existing links"/>
</row>
<row class="row_off" valign="top">
<link-list span="all" id="link_to" readonly="true"/>
</row>
</rows>
</grid>
</template>
<template id="infolog.edit.print.delegation" template="" lang="" group="0" version="1.7.001">
<grid width="100%" height="200" overflow="auto">
<columns>
<column width="100"/>
<column/>
</columns>
<rows>
<row class="th" height="10">
<description span="all" value="General"/>
</row>
<row class="row">
<description options=",,,info_priority" value="Priority"/>
<menulist>
<menupopup id="info_priority" statustext="select a priority for this task" readonly="true"/>
</menulist>
</row>
<row class="row">
<description options=",,,info_location" value="Location" readonly="true"/>
<textbox size="80" maxlength="255" id="info_location" readonly="true"/>
</row>
<row class="th" height="10">
<description span="all" value="Delegation"/>
</row>
<row class="row" valign="top">
<description options=",,,info_responsible" value="Responsible" readonly="true"/>
<listbox type="select-account" id="info_responsible" rows="10" options="both" statustext="select a responsible user: a person you want to delegate this task" readonly="true"/>
</row>
<row class="row" disabled="1">
<description options=",,,info_confirm" value="Confirm"/>
<menulist>
<menupopup id="info_confirm" statustext="do you want a confirmation of the responsible on: accepting, finishing the task or both" readonly="true"/>
</menulist>
</row>
</rows>
</grid>
</template>
<template id="infolog.edit.print" template="" lang="" group="0" version="1.7.001">
<grid width="100%">
<columns>
<column width="103"/>
<column width="260"/>
<column width="140"/>
<column width="27%"/>
</columns>
<rows>
<row disabled="!@msg">
<html span="all" class="redItalic" align="center" id="msg" no_lang="1"/>
<description/>
<description/>
<description/>
</row>
<row class="th" height="28">
<hbox>
<image src="print" onclick="window.print();"/>
<description value="Type" options=",,,info_type" readonly="true"/>
</hbox>
<hbox span="all" options="0,0">
<menulist>
<menupopup id="info_type" onchange="1" statustext="Type of the log-entry: Note, Phonecall or ToDo" no_lang="1" readonly="true"/>
</menulist>
<int id="info_number" class="infoId" readonly="true"/>
</hbox>
</row>
<row class="row">
<description value="Category" options=",,,info_cat"/>
<menulist>
<menupopup type="select-cat" options="None" id="info_cat" statustext="select a category for this entry" readonly="true"/>
</menulist>
<hbox span="all">
<description value="Parent"/>
<link-entry options="infolog" id="info_id_parent" align="right" class="noWrap" readonly="true"/>
</hbox>
</row>
<row class="row">
<description value="Contact" options=",,,info_from"/>
<vbox options="0,0">
<hbox options="0,0">
<link-entry id="info_contact" class="noWrap" readonly="true"/>
<checkbox id="info_custom_from" onchange="document.getElementById(form::name('info_from')).style.display=this.checked?'block':'none';" statustext="Check to specify custom contact" readonly="true"/>
</hbox>
<textbox size="36" maxlength="255" id="info_from" statustext="Custom contact-information, leave emtpy to use information from most recent link" blur="@blur_title" class="$cont[hide_from_css]" readonly="true"/>
</vbox>
<description options=",,,info_addr" value="Phone/Email"/>
<textbox size="30" maxlength="255" id="info_addr" statustext="Custom contact-address, leave empty to use information from most recent link" class="inputFullWidth" readonly="true"/>
</row>
<row class="row">
<description value="Subject" options=",,,info_subject"/>
<textbox size="80" maxlength="255" span="all" class="b" id="info_subject" statustext="a short subject for the entry" readonly="true"/>
<description/>
<description/>
</row>
<row>
<description/>
<description/>
<description/>
<description/>
</row>
<row class="th" height="10">
<description span="all" value="Description"/>
</row>
<row>
<textbox multiline="true" no_lang="1" id="info_des" statustext="enter a textual description of the log-entry" span="all" class="description" readonly="true"/>
<description/>
<description/>
<description/>
</row>
<row>
<description/>
<description/>
<description/>
<description/>
</row>
<row class="th">
<description span="all" value="customfields"/>
</row>
<row>
<customfields span="all" readonly="true"/>
</row>
<row>
<template span="all" id="infolog.edit.print.project"/>
</row>
<row>
<template id="infolog.edit.print.links" span="all"/>
</row>
<row>
<description/>
<description/>
<description/>
<description/>
</row>
<row>
<template id="infolog.edit.print.delegation" span="all"/>
</row>
<row>
<description/>
<description/>
<description/>
<description/>
</row>
<row class="th" height="10">
<description span="all" value="Dates, Status, Access"/>
</row>
<row class="row_on">
<description value="Startdate" options=",,,info_startdate" readonly="true"/>
<date-time options=",2" id="info_startdate" statustext="when should the ToDo or Phonecall be started, it shows up from that date in the filter open or own open (startpage)" readonly="true"/>
<description value="Enddate" options=",,,info_enddate"/>
<date id="info_enddate" statustext="til when should the ToDo or Phonecall be finished" readonly="true"/>
</row>
<row class="row">
<description value="Status" options=",,,info_status"/>
<menulist>
<menupopup id="info_status" statustext="@status_help" 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');" readonly="true"/>
</menulist>
<description value="Completed" options=",,,info_percent"/>
<menulist>
<menupopup type="select-percent" id="info_percent" statustext="Percent completed" onchange="if (this.value==100 &amp;&amp; this.form['exec[info_status]'].value != 'done' &amp;&amp; this.form['exec[info_status]'].value != 'billed' &amp;&amp; this.form['exec[info_status]'].value != 'cancelled') this.form['exec[info_status]'].value='done'; else if (this.value != 100 &amp;&amp; this.form['exec[info_status]'].value != 'cancelled') this.form['exec[info_status]'].value=this.value != 0 ? 'ongoing' : 'not-started'; else if (this.value==0 &amp;&amp; this.form['exec[info_status]'].value != 'cancelled' &amp;&amp; this.form['exec[info_status]'].value != 'offer') this.form['exec[info_status]'].value='not-started'; " readonly="true"/>
</menulist>
</row>
<row class="row">
<description options=",,,info_datecompleted" value="Date completed" readonly="true"/>
<date-time id="info_datecompleted" statustext="Date completed (leave it empty to have it automatic set if status is done or billed)" readonly="true"/>
<description value="Private" options=",,,info_access"/>
<checkbox options="private,public" id="info_access" statustext="should this entry only be visible to you and people you grant privat access via the ACL" readonly="true"/>
</row>
<row class="row" disabled="!@info_owner">
<description value="Owner"/>
<menulist>
<menupopup type="select-account" id="info_owner" readonly="true"/>
</menulist>
<description value="Last modified"/>
<hbox options="0" orient="0">
<menulist>
<menupopup type="select-account" id="info_modifier" readonly="true"/>
</menulist>
<date-time class="lpadding5" id="info_datemodified" readonly="true"/>
</hbox>
</row>
</rows>
</grid>
<styles>
.hideFrom input { display: none; }
.link_select select { width: 250px; }
.description textarea { width: 98%; }
</styles>
</template>
</overlay>

View File

@ -44,7 +44,7 @@
</grid>
</template>
<template id="infolog.edit.delegation" template="" lang="" group="0" version="1.3.001">
<grid width="100%" border="0">
<grid width="100%" height="245" border="0">
<columns>
<column width="100"/>
<column/>
@ -131,7 +131,7 @@
</grid>
</template>
<template id="infolog.edit.history" template="" lang="" group="0" version="1.3.002">
<grid width="100%">
<grid width="100%" height="245" overflow="auto">
<columns>
<column/>
</columns>
@ -142,7 +142,7 @@
</rows>
</grid>
</template>
<template id="infolog.edit" template="" lang="" group="0" version="1.7.002">
<template id="infolog.edit" template="" lang="" group="0" version="1.7.003">
<grid width="100%">
<columns>
<column width="103"/>
@ -255,6 +255,9 @@
<button label="Save" id="button[save]" statustext="Saves this entry"/>
<button id="button[apply]" label="Apply" statustext="Apply the changes"/>
<button label="Cancel" id="button[cancel]" statustext="leave without saveing the entry" onclick="window.close();"/>
<menulist>
<menupopup id="action" statustext="Execute a further action for this entry" options="Actions..." onchange="this.form.submit(); this.value='';"/>
</menulist>
<html id="js"/>
</hbox>
<description/>