diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index c24ee75c99..e7a42a6413 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -100,7 +100,7 @@ class infolog_ui $this->bo = new infolog_bo(); - $this->tmpl = new etemplate(); + $this->tmpl = new etemplate_new(); $this->user = $GLOBALS['egw_info']['user']['account_id']; @@ -289,17 +289,6 @@ class infolog_ui } $orginal_colfilter = $query['col_filter']; if (isset($parent_id)) $query['col_filter']['info_id_parent'] = (int)$parent_id; - if ($query['filter'] == 'bydate') - { - $query['header_left'] = 'infolog.index.dates'; - $GLOBALS['egw']->js->set_onload("set_style_by_class('table','custom_hide','visibility','visible');"); - } - else - { - unset($query['header_left']); - unset($query['startdate']); - unset($query['enddate']); - } //echo "

infolog_ui.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]',col_filter=".print_r($query['col_filter'],True).",sort=$query[sort],order=$query[order])

\n"; if (!isset($query['start'])) $query['start'] = 0; @@ -327,7 +316,7 @@ class infolog_ui unset($query['custom_fields']); if ($query['col_filter']['info_type']) { - $tpl = new etemplate; + $tpl = new etemplate_new; if ($tpl->read('infolog.index.rows.'.$query['col_filter']['info_type'])) { $query['template'] =& $tpl; @@ -818,35 +807,13 @@ class infolog_ui 'all' => 'details', ); if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['show_links']; - $values['nm']['filter2_onchange'] = " -if(typeof widget != 'undefined') { - // Show / hide descriptions - show_details(jQuery(this).val() == 'all'); - // Change preference location - widget is nextmatch - widget.options.settings.columnselection_pref = 'infolog.index.rows'+(jQuery(this).val()=='all'?'-details':''); + //apply infolog_filter_change javascript method (hide/show of date filter form) over onchange filter + $values['nm']['filter_onchange'] = "app.infolog.infolog_filter_change();"; - // Load new preferences - var colData = [] - for(var i = 0; i < widget.columns.length; i++) colData[i] = {disabled: true, width: '0'}; - widget._applyUserPreferences(widget.columns, colData); - for(var i = 0; i < colData.length; i++) - { - // Wants a string - widget.dataview.getColumnMgr().columns[i].set_width(colData[i].width + 'px'); - widget.dataview.getColumnMgr().columns[i].set_visibility(!colData[i].disabled); - } + //apply infolog_filter2_change javascript method (show/hide details each rows) over onchange filter2 + $values['nm']['filter2_onchange'] = "app.infolog.infolog_filter2_change();"; - widget.dataview.getColumnMgr().updated = true; - - // Update page - widget.dataview.updateColumns(); -} -else -{ - this.form.submit(); -} -"; // disable columns for main entry as set in the pref for details or no details if ($action == 'sp') { @@ -865,19 +832,9 @@ else } } $values['nm']['header_right'] = 'infolog.index.header_right'; - if ($extra_app_header && $values['nm']['filter']!='bydate') - { - $values['nm']['header_left'] = 'infolog.index.header_left'; - } if ($values['nm']['filter']=='bydate') { foreach (array_keys($values['nm']['col_filter']) as $colfk) if (is_int($colfk)) unset($values['nm']['col_filter']); - $values['nm']['header_left'] = 'infolog.index.dates'; - $GLOBALS['egw']->js->set_onload("set_style_by_class('table','custom_hide','visibility','visible');"); - } - if ($values['nm']['filter2'] == 'no_describtion') - { - $GLOBALS['egw']->js->set_onload("show_details(false);"); } $values['nm']['bottom_too'] = True; $values['nm']['never_hide'] = isset($this->prefs['never_hide']) ? @@ -1170,7 +1127,7 @@ else 'caption' => 'Delete', 'group' => ++$group, 'disableClass' => 'rowNoDelete', - 'onExecute' => 'javaScript:confirm_delete', + 'onExecute' => 'app.infolog.infolog_confirm_delete', ); if ($query['col_filter']['info_status'] == 'deleted') { @@ -1595,10 +1552,6 @@ else $button = 'apply'; // need to store infolog first } } - 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 "

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'])) { @@ -1659,7 +1612,7 @@ else else { $content['msg'] = lang('InfoLog entry saved'); - $content['js'] = "opener.egw_refresh('".str_replace("'","\\'",$content['msg'])."','infolog',$info_id,'$operation');"; + egw_framework::refresh_opener($content['msg'],'infolog',$info_id,$operation); } $content['tabs'] = $active_tab; if ((int) $content['pm_id'] != (int) $content['old_pm_id']) @@ -1722,12 +1675,12 @@ else ); if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first - $content['js'] = "opener.egw_refresh('".str_replace("'","\\'",$content['msg'])."','infolog',$info_id,'delete');"; + egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); } // called again after delete confirmation dialog elseif ($button == 'deleted' && $content['msg']) { - $content['js'] = "opener.egw_refresh('".str_replace("'","\\'",$content['msg'])."','infolog',$info_id,'delete');"; + egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); } if ($button == 'save' || $button == 'cancel' || $button == 'delete' || $button == 'deleted') { @@ -1735,11 +1688,8 @@ else { egw::redirect_link($referer,array('msg' => $content['msg'])); } - $content['js'] .= 'window.close();'; - echo ''; - common::egw_exit(); + egw_framework::window_close(); } - if ($content['js']) $content['js'] = ''; } // on a type-change, set the status to the default status of that type, if the actual status is not supported by the new type if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']])) @@ -2409,7 +2359,6 @@ else if (!empty($_to_emailAddress)) { $GLOBALS['egw_info']['flags']['currentapp'] = 'infolog'; - echo ''; if (is_array($_attachments)) { diff --git a/infolog/js/edit.js b/infolog/js/edit.js deleted file mode 100644 index f8963287c8..0000000000 --- a/infolog/js/edit.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Javascript used on the infolog edit popup - */ - -function add_email_from_ab(ab_id,info_cc) -{ - var ab = document.getElementById(ab_id); - - if (!ab || !ab.value) - { - jQuery("tr.hiddenRow").css("display", "table-row"); - } - else - { - var cc = document.getElementById(info_cc); - - for(var i=0; i < ab.options.length && ab.options[i].value != ab.value; ++i) ; - - if (i < ab.options.length) - { - cc.value += (cc.value?', ':'')+ab.options[i].text.replace(/^.* <(.*)>$/,'$1'); - ab.value = ''; - ab.onchange(); - jQuery("tr.hiddenRow").css("display", "none"); - } - } - 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]'); - if(!datecompleted) - { - datecompleted = jQuery('#'+datecompleted_id +' input').get(0); - } - var completed; - - switch(changed_id) - { - case status_id: - completed = status.value == 'done' || status.value == 'billed'; - if (completed || status.value == 'not-started' || - (status.value == 'ongoing') != (percent.value > 0 && percent.value < 100)) - { - percent.value = completed ? 100 : (status.value == 'not-started' ? 0 : 10); - } - 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 && datecompleted.value != '') - { - datecompleted.value = ''; - } - else if (completed && datecompleted && datecompleted.value == '') - { - // todo: set current date in correct format - } -} diff --git a/infolog/js/index.js b/infolog/js/index.js deleted file mode 100644 index 1665b2dc68..0000000000 --- a/infolog/js/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * EGroupware infolog javascript code used on index page - * - * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @package infolog - * @link http://www.egroupware.org - * @version $Id$ - */ - -/** - * Confirm delete - * If entry has children, asks if you want to delete children too - * - * @param _action - * @param _senders - */ -function confirm_delete(_action, _senders) -{ - var children = false; - var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0); - if(child_button) { - for(var i = 0; i < _senders.length; i++) { - if ($j(_senders[i].iface.node).hasClass('rowHasSubs')) { - children = true; - break; - } - } - child_button.style.display = children ? 'block' : 'none'; - } - nm_open_popup(_action, _senders); -} - -/** - * Show or hide details by changing the CSS class - */ -function show_details(show) -{ - // Show / hide descriptions - egw.css(".et2_box.infoDes","display:" + (show ? "block;" : "none;")); -} diff --git a/infolog/setup/setup.inc.php b/infolog/setup/setup.inc.php index 9f85c52a4d..6f6bb026a2 100755 --- a/infolog/setup/setup.inc.php +++ b/infolog/setup/setup.inc.php @@ -12,10 +12,11 @@ */ $setup_info['infolog']['name'] = 'infolog'; -$setup_info['infolog']['version'] = '1.9.004'; +$setup_info['infolog']['version'] = '1.10.001'; $setup_info['infolog']['app_order'] = 5; $setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra'); $setup_info['infolog']['enable'] = 1; +$setup_info['infolog']['index'] = 'infolog.infolog_ui.index&ajax=true'; $setup_info['infolog']['author'] = $setup_info['infolog']['maintainer'] = array( diff --git a/infolog/setup/tables_update.inc.php b/infolog/setup/tables_update.inc.php index 5dbaaeef3b..dc9c445d5f 100644 --- a/infolog/setup/tables_update.inc.php +++ b/infolog/setup/tables_update.inc.php @@ -713,4 +713,10 @@ function infolog_upgrade1_9_003() return $GLOBALS['setup_info']['infolog']['currentver'] = '1.9.004'; } - +/** + * Enable ajax=true + */ +function infolog_upgrade1_9_004() +{ + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.10.001'; +} diff --git a/infolog/templates/default/edit.xet b/infolog/templates/default/edit.xet index bcff9b4d73..8d2f22b38a 100644 --- a/infolog/templates/default/edit.xet +++ b/infolog/templates/default/edit.xet @@ -71,7 +71,7 @@ - + @@ -242,18 +242,18 @@ - + - + - + @@ -283,9 +283,8 @@