# R34819 - in /trunk/infolog: inc/ js/ lang/ setup/ templates/default/ templates/default/images/

**URL:** <https://help.egroupware.org/t/r34819-in-trunk-infolog-inc-js-lang-setup-templates-default-templates-default-images/47220>\
**Category:** eGW-svn\
**Created:** [May 2, 2011, 7:41pm UTC](https://help.egroupware.org/t/r34819-in-trunk-infolog-inc-js-lang-setup-templates-default-templates-default-images/47220 "2011-05-02T19:41:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralfbecker\_sf](https://help.egroupware.org/letter_avatar_proxy/v4/letter/r/b2d939/32.png) [@ralfbecker\_sf](https://help.egroupware.org/u/ralfbecker_sf)\
**Post date:** [May 2, 2011, 7:41pm UTC](https://help.egroupware.org/t/r34819-in-trunk-infolog-inc-js-lang-setup-templates-default-templates-default-images/47220/1 "2011-05-02T19:41:21Z")

</div>

Author: ralfbecker  
New Revision: 34819

URL: [http://www.egroupware.org/viewvc/egroupware?rev=34819&view=rev](http://www.egroupware.org/viewvc/egroupware?rev=34819&view=rev)  
Log:  
Context menu for InfoLog: NOT YET COMPLETET, SOME STUFF WILL NOT WORK!  
ToDo:

- implement view subs or parent from context
- test all context actions (some do not work)
- test CSS based disabling of actions
- change delegation or links popup not yet working (just an alert in index.js)
- delete of entries with subs (serverside confirmation displaying subs) probably not working

Added:  
trunk/infolog/templates/default/images/completed.png (with props)  
Modified:  
trunk/infolog/inc/class.infolog\_bo.inc.php  
trunk/infolog/inc/class.infolog\_ui.inc.php  
trunk/infolog/js/index.js  
trunk/infolog/lang/egw\_bg.lang  
trunk/infolog/lang/egw\_ca.lang  
trunk/infolog/lang/egw\_cs.lang  
trunk/infolog/lang/egw\_da.lang  
trunk/infolog/lang/egw\_de.lang  
trunk/infolog/lang/egw\_el.lang  
trunk/infolog/lang/egw\_en.lang  
trunk/infolog/lang/egw\_es-es.lang  
trunk/infolog/lang/egw\_et.lang  
trunk/infolog/lang/egw\_eu.lang  
trunk/infolog/lang/egw\_fa.lang  
trunk/infolog/lang/egw\_fi.lang  
trunk/infolog/lang/egw\_fr.lang  
trunk/infolog/lang/egw\_hr.lang  
trunk/infolog/lang/egw\_hu.lang  
trunk/infolog/lang/egw\_id.lang  
trunk/infolog/lang/egw\_it.lang  
trunk/infolog/lang/egw\_iw.lang  
trunk/infolog/lang/egw\_ko.lang  
trunk/infolog/lang/egw\_lv.lang  
trunk/infolog/lang/egw\_nl.lang  
trunk/infolog/lang/egw\_no.lang  
trunk/infolog/lang/egw\_pl.lang  
trunk/infolog/lang/egw\_pt-br.lang  
trunk/infolog/lang/egw\_pt.lang  
trunk/infolog/lang/egw\_ru.lang  
trunk/infolog/lang/egw\_sk.lang  
trunk/infolog/lang/egw\_sl.lang  
trunk/infolog/lang/egw\_sv.lang  
trunk/infolog/lang/egw\_tr.lang  
trunk/infolog/lang/egw\_uk.lang  
trunk/infolog/lang/egw\_zh-tw.lang  
trunk/infolog/lang/egw\_zh.lang  
trunk/infolog/setup/etemplates.inc.php  
trunk/infolog/templates/default/index.xet

# Modified: trunk/infolog/inc/class.infolog\_bo.inc.php URL: [http://www.egroupware.org/viewvc/egroupware/trunk/infolog/inc/class.infolog\_bo.inc.php?rev=34819&r1=34818&r2=34819&view=diff](http://www.egroupware.org/viewvc/egroupware/trunk/infolog/inc/class.infolog_bo.inc.php?rev=34819&r1=34818&r2=34819&view=diff)

— trunk/infolog/inc/class.infolog\_bo.inc.php (original)  
+++ trunk/infolog/inc/class.infolog\_bo.inc.php Mon May 2 21:41:21 2011  
@@ -128,7 +128,7 @@  
‘own-open-overdue’ =\> ‘own overdue’,  
‘own-upcoming’ =\> ‘own upcoming’,  
‘own-open-upcoming’ =\> ‘own open and upcoming’,

- 

```
  'open-today' => 'open',

```

- 

```
  'open-today' => 'open(status)',
  'open-overdue' => 'overdue',
  'upcoming' => 'upcoming',
  'open-upcoming' => 'open and upcoming',

```

# Modified: trunk/infolog/inc/class.infolog\_ui.inc.php URL: [http://www.egroupware.org/viewvc/egroupware/trunk/infolog/inc/class.infolog\_ui.inc.php?rev=34819&r1=34818&r2=34819&view=diff](http://www.egroupware.org/viewvc/egroupware/trunk/infolog/inc/class.infolog_ui.inc.php?rev=34819&r1=34818&r2=34819&view=diff)

— trunk/infolog/inc/class.infolog\_ui.inc.php (original)  
+++ trunk/infolog/inc/class.infolog\_ui.inc.php Mon May 2 21:41:21 2011  
@@ -91,7 +91,7 @@  
\*/  
function \_\_construct()  
{

- 

```
  if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') $GLOBALS['egw']->translation->add_app('infolog');

```

- 

```
  if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') translation::add_app('infolog');
  $this->bo = new infolog_bo();

  $this->tmpl = new etemplate();

```

@@ -161,8 +161,11 @@  
$info[‘info\_percent’] = (int) $info[‘info\_percent’].’%’;  
$editrights = $this-\>bo-\>check\_access($info,EGW\_ACL\_EDIT);  
$isresposible = $this-\>bo-\>is\_responsible($info);

- 

```
  $readonlys["edit[$id]"] = !($editrights || // edit rights or more then standard responsible rights

```

- 

```
  	$isresposible && array_diff($this->bo->responsible_edit,array('info_status','info_percent','info_datecompleted')));

```

- 

```
  if (($readonlys["edit[$id]"] = !($editrights || // edit rights or more then standard responsible rights

```

- 

```
  	$isresposible && array_diff($this->bo->responsible_edit,array('info_status','info_percent','info_datecompleted')))))

```

- 

```
  {

```

- 

```
  	$info['class'] .= 'rowNoEdit ';

```

- 

```
  }
  $readonlys["close[$id]"] = $done || ($readonlys["edit_status[$id]"] =
  	!($editrights || $isresposible));
  $readonlys["close_all[$id]"] = ($done) || !$info['info_anz_subs'] || ($readonlys["edit_status[$id]"] =

```

@@ -172,11 +175,21 @@  
$readonlys[“edit\_status[$id]”] = $readonlys[“edit\_percent[$id]”] =  
!$editrights && !$isresposible &&  
!$this-\>bo-\>check\_access($info,EGW\_ACL\_UNDELETE); // undelete is handled like status edit

- 

```
  $readonlys["delete[$id]"] = !$this->bo->check_access($info,EGW_ACL_DELETE);

```

- 

```
  $readonlys["sp[$id]"] = !$this->bo->check_access($info,EGW_ACL_ADD);

```

- 

```
  if (($readonlys["delete[$id]"] = !$this->bo->check_access($info,EGW_ACL_DELETE)))

```

- 

```
  {

```

- 

```
  	$info['class'] .= 'rowNoDelete ';

```

- 

```
  }

```

- 

```
  if (($readonlys["sp[$id]"] = !$this->bo->check_access($info,EGW_ACL_ADD)))

```

- 

```
  {

```

- 

```
  	$info['class'] .= 'rowNoSubs ';

```

- 

```
  }

```

- 

```
  if ($info['info_id_parent']) $info['class'] .= 'rowHasParent ';

```

- 

```
  if ($info['info_anz_subs'] > 0) $info['class'] .= 'rowHasSubs ';

```

- 

```
  $readonlys["view[$id]"] = $info['info_anz_subs'] < 1;
  $readonlys['view[0]'] = True;	// no parent
  $readonlys["timesheet[$id]"] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']);

```

- 

```
  $readonlys["document[$id]"] = !$this->prefs['default_document'];

  if (!$show_links) $show_links = $this->prefs['show_links'];
  if (($show_links != 'none' && $show_links != 'no_describtion' ||

```

@@ -231,56 +244,6 @@  
$info[‘info\_number’] = $info[‘info\_id’];  
}  
return $info;

- }

- 
- /\*\*

- 
  - Saves state of the infolog list in the session

- 
  - 

- 
  - @param array $values

- \*/

- function save\_sessiondata($values)

- {

- 

```
  $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'],

```

- 

```
  	'num_rows' => $values['num_rows'],

```

- 

```
  	'filter' => $values['filter'],

```

- 

```
  	'filter2' => $values['filter2'],

```

- 

```
  	'cat_id' => $values['cat_id'],

```

- 

```
  	'order' => $values['order'],

```

- 

```
  	'sort' => $values['sort'],

```

- 

```
  	'action' => $values['action'],

```

- 

```
  	'action_id' => $values['action_id'],

```

- 

```
  	'action_title' => $values['action_title'],

```

- 

```
  	'col_filter' => $values['col_filter'],

```

- 

```
  	'session_for' => $for

```

- 

```
  );

```

- 

```
  if ($values['filter']=='bydate')

```

- 

```
  {

```

- 

```
  	$arrayToStore['startdate'] = $values['startdate'];

```

- 

```
  	$arrayToStore['enddate'] = $values['enddate'];

```

- 

```
  }

```

- 

```
  $GLOBALS['egw']->session->appsession($for.'session_data','infolog',$arrayToStore);

```

- }

- 
- /\*\*

- 
  - reads list-state from the session

- 
  - 

- 
  - @return array

- \*/

- function read\_sessiondata()

- {

- 

```
  $values = $GLOBALS['egw']->session->appsession(@$this->called_by.'session_data','infolog');

```

- 

```
  if (!@$values['session_for'] && $this->called_by)

```

- 

```
  {

```

- 

```
  	$values['session_for'] = $this->called_by;

```

- 

```
  	$this->save_sessiondata($values);

```

- 

```
  }

```

- 

```
  //echo "<p>called_by='$this->called_by': ". __METHOD__."() = ".print_r($values,True)."</p>\n";

```

- 

```
  return $values;

```

}

/\*\*  
@@ -293,6 +256,11 @@  
\*/  
function get\_rows(&$query,&$rows,&$readonlys)  
{

- 

```
  if (!$query['csv_export'])

```

- 

```
  {

```

- 

```
  	egw_cache::setSession('infolog', $query['session_for'].'session_data', $query);

```

- 

```
  	$query['actions'] = $this->get_actions($query);

```

- 

```
  }
  $orginal_colfilter = $query['col_filter'];
  if ($query['filter'] == 'bydate')
  {

```

@@ -300,8 +268,6 @@  
$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’]+(60_60_24)-1);

- 

```
  	//unset($query['startdate']);

```

- 

```
  	//unset($query['enddate']);
  }
  else
  {

```

@@ -309,17 +275,11 @@  
unset($query[‘startdate’]);  
unset($query[‘enddate’]);  
}  
-//\_debug\_array($query);  
-//\_debug\_array($query[‘col\_filter’]);

```
	//echo "<p>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])</p>\n";
	if (!isset($query['start'])) $query['start'] = 0;

```

- 

```
  if (!$query['csv_export'])

```

- 

```
  {

```

- 

```
  	$this->save_sessiondata($query);

```

- 

```
  }

```

- 

```
  else

```

- 

```
  if ($query['csv_export'])
  {
  	$query['csv_fields'] = $this->csv_export_fields($query['col_filter']['info_type']);
  }

```

@@ -412,9 +372,15 @@  
}  
}  
$rows[] = $info;

- 

```
  	$readonlys["document[{$info['info_id']}]"] = !$this->prefs['default_document'];
  }
  unset($links);

```

- 
- 

```
  if ($query['action'] == 'sp' && ($main = $this->bo->read($query['action_id'])))

```

- 

```
  {

```

- 

```
  	$main = $this->get_info($main, $readonlys);

```

- 

```
  	$main['class'] .= 'th ';

```

- 

```
  	array_unshift($rows, $main);

```

- 

```
  }

  if ($query['cat_id']) $rows['no_cat_id'] = true;
  if ($query['no_actions']) $rows['no_actions'] = true;

```

@@ -459,7 +425,7 @@  
{  
$GLOBALS[‘egw\_info’][‘flags’][‘app\_header’] .= ’ - '.lang($this-\>filters[$query[‘filter’]]);  
}

- 

```
  	if ($query['action'] && ($title = $query['action_title'] ? $query['action_title'] : egw_link::title($query['action'],$query['action_id'])))

```

- 

```
  	if ($query['action'] && ($title = $query['action_title'] ? $query['action_title'] : egw_link::title($query['action']=='sp'?'infolog':$query['action'],$query['action_id'])))
  	{
  		$GLOBALS['egw_info']['flags']['app_header'] .= ': '.$title;
  	}

```

@@ -507,23 +473,23 @@  
if (is\_array($values) && isset($values[‘nm’][‘rows’][‘document’])) // handle insert in default document button like an action  
{  
list($id) = @each($values[‘nm’][‘rows’][‘document’]);

- 

```
  	$values['multi_action'] = 'document';

```

- 

```
  	$values['nm']['rows']['checked'] = array($id);

```

- 

```
  }

```

- 

```
  if (is_array($values) && isset($values['multi_action']) && $values['multi_action'] !== '')

```

- 

```
  {

```

- 

```
  	if (!count($values['nm']['rows']['checked']) && !$values['use_all'])

```

- 

```
  	$values['nm']['action'] = 'document';

```

- 

```
  	$values['nm']['selected'] = array($id);

```

- 

```
  }

```

- 

```
  if (is_array($values) && !empty($values['nm']['action']))

```

- 

```
  {

```

- 

```
  	if (!count($values['nm']['selected']) && !$values['nm']['select_all'])
  	{
  		$msg = lang('You need to select some entries first');
  	}
  	else
  	{
  		// Some processing to add values in for links and cats

```

- 

```
  		$multi_action = $values['multi_action'];

```

- 

```
  		$multi_action = $values['nm']['action'];
  		// Action has an additional action - add / delete, etc. Buttons named <multi-action>_action[action_name]
  		if(in_array($multi_action, array('link', 'responsible')))
  		{

```

- 

```
  			$values['multi_action'] .= '_' . key($values[$multi_action . '_action']);

```

- 

```
  			$values['nm']['action'] .= '_' . key($values[$multi_action . '_action']);
  		}
  		// Action has a parameter - cat_id, percent, etc
  		if (in_array($multi_action, array('link', 'cat', 'completion', 'responsible')))

```

@@ -532,10 +498,10 @@  
{  
$values[$multi\_action] = implode(’,’,$values[$multi\_action]);  
}

- 

```
  			$values['multi_action'] .= '_' . $values[$multi_action];

```

- 

```
  		}

```

- 

```
  		if ($this->action($values['multi_action'],$values['nm']['rows']['checked'],$values['use_all'],

```

- 

```
  			$success,$failed,$action_msg,false,$msg, $values['no_notifications']))

```

- 

```
  			$values['nm']['action'] .= '_' . $values[$multi_action];

```

- 

```
  		}

```

- 

```
  		if ($this->action($values['nm']['action'], $values['nm']['selected'], $values['nm']['select_all'],

```

- 

```
  			$success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications']))
  		{
  			$msg .= lang('%1 entries %2',$success,$action_msg);
  		}

```

@@ -543,42 +509,29 @@  
{  
$msg .= lang(’%1 entries %2, %3 failed because of insufficent rights !!!’,$success,$action\_msg,$failed);  
}

- 

```
  		unset($values['multi_action']);

```

- 

```
  		unset($values['use_all']);

```

- 

```
  		unset($values['nm']['action']);

```

- 

```
  		unset($values['nm']['select_all']);
  	}
  	$values['msg'] = $msg;
  }

```

- 

```
  if(isset($values['nm']['rows'])) unset($values['nm']['rows']['checked']); // Can cause problems lower, no longer needed
  if (!$action)
  {
  	$action = $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
  	$action_id = $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET'));
  	$action_title = $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET'));

```

- 
- 

```
  	if ($values === 'reset_action_view')	// only read action from session, if not called by index.php

```

- 

```
  	{

```

- 

```
  		$session = $this->read_sessiondata();

```

- 

```
  		$session['action'] = $action = '';

```

- 

```
  		$session['action_id'] = $action_id = 0;

```

- 

```
  		$session['action_title'] = $action_title = '';

```

- 

```
  		$this->save_sessiondata($session);

```

- 

```
  		unset($session);

```

- 

```
  	}

```

- 

```
  	elseif (!$action)

```

- 

```
  	{

```

- 

```
  		$session = $this->read_sessiondata();

```

- 

```
  		$action = $session['action'];

```

- 

```
  		$action_id = $session['action_id'];

```

- 

```
  		$action_title = $session['action_title'];

```

- 

```
  		// no action -> try to restore the previous colfilter

```

- 

```
  		$colfilter = $session['col_filter'];

```

- 

```
  		unset($session);

```

- 

```
  	}
  }
  //echo "<p>". __METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values);
  if (!is_array($values))
  {

```

- 

```
  	$values = array('nm' => $this->read_sessiondata());

```

- 

```
  	$nm = egw_cache::getSession('infolog', $this->called_by.'session_data');

```

- 

```
  	if ($values === 'reset_action_view')

```

- 

```
  	{

```

- 

```
  		$nm['action'] = $action = '';

```

- 

```
  		$nm['action_id'] = $action_id = 0;

```

- 

```
  		$nm['action_title'] = $action_title = '';

```

- 

```
  	}

```

- 

```
  	$values = array('nm' => $nm);

```

- 

```
  	if (isset($_GET['filter']) && $_GET['filter'] != 'default' || !isset($values['nm']['filter']) && !$this->called_by)
  	{
  		$values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] :

```

@@ -588,19 +541,25 @@  
{  
$values[‘nm’][‘order’] = ‘info\_datemodified’;  
$values[‘nm’][‘sort’] = ‘DESC’;

- 

```
  	}

```

- 

```
  		$values['nm']['row_id'] = 'info_id';

```

- 

```
  	}

```

- 
- 

```
  	if (!$values['nm']['session_for'] && $this->called_by) $values['nm']['session_for'] = $this->called_by;

```

- 

```
  	$values['msg'] = $_GET['msg'];
  	$values['action'] = $action;
  	$values['action_id'] = $action_id;

```

- 

```
  }

```

- 

```
  if($_GET['search']) {

```

- 

```
  	$values['nm']['search'] = $_GET['search'];

```

- 

```
  }

```

- 

```
  	$values['action_title'] = $action_title;

```

- 

```
  }

```

- 

```
  if($_GET['search']) $values['nm']['search'] = $_GET['search'];

```

- 

```
  if ($values['nm']['add'])
  {
  	$values['add'] = $values['nm']['add'];
  	unset($values['nm']['add']);
  }

```

- 

```
  unset($values['nm']['rows']['checked']);	// not longer used, but hides button actions

```

- 

```
  if ($values['add'] || $values['cancel'] || isset($values['nm']['rows']) || isset($values['main']))
  {
  	if ($values['add'])

```

@@ -610,10 +569,9 @@  
}  
elseif ($values[‘cancel’] && $own\_referer)  
{

- 

```
  		$session = $this->read_sessiondata();

```

- 

```
  		unset($session['action']);

```

- 

```
  		unset($session['action_id']);

```

- 

```
  		$this->save_sessiondata($session);

```

- 

```
  		unset($values['nm']['action']);

```

- 

```
  		unset($values['nm']['action_id']);

```

- 

```
  		egw_cache::setSession('infolog', $values['nm']['session_for'].'session_data', $values['nm']);
  		$this->tmpl->location($own_referer);
  	}
  	else

```

@@ -621,11 +579,9 @@  
list($do,$do\_id) = isset($values[‘main’]) ? each($values[‘main’]) : @each($values[‘nm’][‘rows’]);  
list($do\_id) = @each($do\_id);  
//echo “

infolog::index: do=’$do/$do\_id’, referer=”; \_debug\_array($called\_as);  
+// todo: move this to actions(), interactive delete only if subs  
switch($do)  
{

- 

```
  			case 'edit':

```

- 

```
  			case 'edit_status':

```

- 

```
  				return $this->edit($do_id,$action,$action_id,'',$called_as);
  			case 'delete':
  				if (!($values['msg'] = $this->delete($do_id,$called_as,$called_as ? '' : 'index'))) return;
  				// did we deleted the entries, whos subentries we are showing?

```

@@ -647,8 +603,6 @@  
case ‘close\_all’:  
$this-\>close($do\_id,$called\_as,$closesingle);  
break;

- 

```
  			case 'sp':

```

- 

```
  				return $this->edit(0,'sp',$do_id,'',$called_as);
  			case 'view':
  				$value = array();
  				$action = 'sp';

```

@@ -671,7 +625,6 @@  
$action\_id = 0;  
break;  
}

- 

```
  		$values['main'][1] = $this->get_info($action_id,$readonlys['main']);
  		break;
  }
  $readonlys['cancel'] = $action != 'sp';

```

@@ -724,10 +677,11 @@  
$persist[‘called\_as’] = $called\_as;  
$persist[‘own\_referer’] = $own\_referer;  
$values[‘nm’][‘csv\_fields’] = true; // get set in get\_rows to not include all custom fields

- 

```
  $persist['nm'] = array(

```

- 

```
  	'sort' => $values['nm']['sort'],

```

- 

```
  	'order' => $values['nm']['order'],

```

- 

```
  );

```

- 
- 

```
  // store whole $values[nm] in etemplate request

```

- 

```
  unset($values['nm']['rows']);

```

- 

```
  $persist['nm'] = $values['nm'];

```

- 

```
  if (!$called_as)
  {
  	$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologIndex');

```

@@ -748,22 +702,25 @@  
$sel\_options = array(  
‘info\_type’ =\> $this-\>bo-\>enums[‘type’],  
‘pm\_id’ =\> array(lang(‘No project’)),

- 

```
  	'multi_action'	=> array(

```

- 

```
  		'close' => lang('Close'),

```

- 

```
  		'delete'	=> lang('Delete'),

```

- 

```
  		'cat' => lang('Change category'),

```

- 

```
  		'link' => lang('Add or delete links'),

```

- 

```
  		'completion'	=> lang('Change completion'),

```

- 

```
  		'responsible'	=> lang('Change responsible'),

```

- 

```
  	)
  );

```

- 

```
  // Add in multi-infolog actions

```

- 

```
  egw_framework::validate_file('.','index','infolog');

```

- 
- 

```
  return $this->tmpl->exec('infolog.infolog_ui.index',$values,$sel_options,$readonlys,$persist,$return_html ? -1 : 0);

```

- }
- 
- /\*\*
- 
  - Get actions / context menu items

- 
  - 

- 
  - @param array $query

- 
  - @return array see nextmatch\_widget::get\_actions()

- \*/
- private function get\_actions(array $query)
- {
- 

```
  for($i = 0; $i <= 100; $i += 10) $percent[$i] = $i.'%';

```

- 

```
  // Types

```

- 

```
  foreach($this->bo->enums['type'] as $type => $label)

```

- 

```
  {

```

- 

```
  	$types['type_'.$type] = $label;

```

- 

```
  }

```

- 

```
  $types = $this->bo->enums['type'];
  if ($this->bo->group_owners)
  {
  	// remove types owned by groups the user has no edit grant

```

@@ -771,41 +728,204 @@  
{  
if (!($this-\>bo-\>grants[$group] & EGW\_ACL\_EDIT))  
{

- 

```
  			unset($types['type_'.$type]);

```

- 

```
  		}

```

- 

```
  	}

```

- 

```
  }

```

- 

```
  $sel_options['multi_action'][lang('Change type:')] = $types;

```

- 

```
  			unset($types[$type]);

```

- 

```
  		}

```

- 

```
  	}

```

- 

```
  }

```

- 

```
  $types_add = array();

```

- 

```
  foreach($types as $type => &$data)

```

- 

```
  {

```

- 

```
  	$data = array(

```

- 

```
  		'caption' => $data,

```

- 

```
  		'icon' => $type,

```

- 

```
  	);

```

- 

```
  	$types_add[$type] = $data + array(

```

- 

```
  		'url' => 'menuaction=infolog.infolog_ui.edit&type='.$type,

```

- 

```
  		'popup' => egw_link::get_registry('infolog', 'add_popup'),

```

- 

```
  	);

```

- 

```
  }

  // if filtered by type, show only the stati of the filtered type

```

- 

```
  if ($values['nm']['col_filter']['info_type'] && isset($this->bo->status[$values['nm']['col_filter']['info_type']]))

```

- 

```
  {

```

- 

```
  	$statis = $this->bo->status[$values['nm']['col_filter']['info_type']];

```

- 

```
  if ($query['col_filter']['info_type'] && isset($this->bo->status[$query['col_filter']['info_type']]))

```

- 

```
  {

```

- 

```
  	$statis = $this->bo->status[$query['col_filter']['info_type']];
  }
  else	// show all stati
  {
  	$statis = array();

```

- 

```
  	foreach($this->bo->status as $typ => $stati)

```

- 

```
  	{

```

- 

```
  		if($typ == 'defaults') continue;

```

- 

```
  	foreach($this->bo->status as $type => $stati)

```

- 

```
  	{

```

- 

```
  		if ($type == 'defaults') continue;
  		$statis += $stati;
  	}
  	$statis = array_unique($statis);
  }

```

- 

```
  foreach($statis as $id => $label)

```

- 

```
  {

```

- 

```
  	$change_status['status_'.$id] = $label;

```

- 

```
  }

```

- 

```
  $sel_options['multi_action'][lang('Change status:')] = $change_status;

```

- 
- 

```
  // Merge print

```

- 

```
  if ($this->prefs['document_dir'])

```

- 

```
  {

```

- 

```
  	$sel_options['multi_action'][lang('Insert in document').':'] = $this->get_document_actions();

```

- 

```
  }

```

- 

```
  egw_framework::validate_file('.','index','infolog');

```

- 
- 

```
  return $this->tmpl->exec('infolog.infolog_ui.index',$values,$sel_options,$readonlys,$persist,$return_html ? -1 : 0);

```

- 

```
  foreach($statis as $type => &$data)

```

- 

```
  {

```

- 

```
  	$data = array(

```

- 

```
  		'caption' => $data,

```

- 

```
  		'icon' => $type,

```

- 

```
  	);

```

- 

```
  }

```

- 
- 

```
  $actions = array(

```

- 

```
  	'open' => array(

```

- 

```
  		'caption' => 'Open',

```

- 

```
  		'default' => true,

```

- 

```
  		'allowOnMultiple' => false,

```

- 

```
  		'url' => 'menuaction=infolog.infolog_ui.edit&info_id=$id',

```

- 

```
  		'popup' => egw_link::get_registry('infolog', 'add_popup'),

```

- 

```
  		'group' => $group=1,

```

- 

```
  	),

```

- 

```
  	'sp' => array(

```

- 

```
  		'caption' => 'View subs',

```

- 

```
  		'icon' => 'view',

```

- 

```
  		'group' => $group,

```

- 

```
  		'hint' => 'View all subs of this entry',

```

- 

```
  		'enableClass' => 'rowHasSubs',

```

- 

```
  	),

```

- 

```
  	'parent' => array(

```

- 

```
  		'caption' => 'View parent',

```

- 

```
  		'icon' => 'parent',

```

- 

```
  		'group' => $group,

```

- 

```
  		'hideOnDisabled' => true,

```

- 

```
  		'hint' => 'View the parent of this entry and all his subs',

```

- 

```
  		'enableClass' => 'rowHasParent'

```

- 

```
  	),

```

- 

```
  	'add' => array(

```

- 

```
  		'caption' => 'Add',

```

- 

```
  		'group' => $group,

```

- 

```
  		'children' => array(

```

- 

```
  			'new' => array(

```

- 

```
  				'caption' => 'New',

```

- 

```
  				'children' => $types_add,

```

- 

```
  				'icon' => 'task',

```

- 

```
  			),

```

- 

```
  			'sub' => array(

```

- 

```
  				'caption' => 'Sub-entry',

```

- 

```
  				'url' => 'menuaction=infolog.infolog_ui.edit&action=sp&action_id=$id',

```

- 

```
  				'popup' => egw_link::get_registry('infolog', 'add_popup'),

```

- 

```
  				'allowOnMultiple' => false,

```

- 

```
  				'hint' => 'Add a new sub-task, -note, -call to this entry',

```

- 

```
  				'icon' => 'new',

```

- 

```
  				'disableClass' => 'rowNoSubs',

```

- 

```
  			),

```

- 

```
  			'copy' => array(

```

- 

```
  				'caption' => 'Copy',

```

- 

```
  				'url' => 'menuaction=infolog.infolog_ui.edit&action=copy&info_id=$id',

```

- 

```
  				'popup' => egw_link::get_registry('infolog', 'add_popup'),

```

- 

```
  				'allowOnMultiple' => false,

```

- 

```
  				'icon' => 'copy',

```

- 

```
  			),

```

- 

```
  		),

```

- 

```
  	),

```

- 

```
  	'select_all' => array(

```

- 

```
  		'caption' => 'Whole query',

```

- 

```
  		'checkbox' => true,

```

- 

```
  		'hint' => 'Apply the action on the whole query, NOT only the shown entries',

```

- 

```
  		'group' => ++$group,

```

- 

```
  	),

```

- 

```
  	'no_notifications' => array(

```

- 

```
  		'caption' => 'Do not notify',

```

- 

```
  		'checkbox' => true,

```

- 

```
  		'hint' => 'Do not notify of these changes',

```

- 

```
  		'group' => $group,

```

- 

```
  	),

```

- 

```
  	// modifying content of one or multiple infolog(s)

```

- 

```
  	'change' => array(

```

- 

```
  		'caption' => 'Change',

```

- 

```
  		'group' => ++$group,

```

- 

```
  		'icon' => 'edit',

```

- 

```
  		'disableClass' => 'rowNoEdit',

```

- 

```
  		'children' => array(

```

- 

```
  			'type' => array(

```

- 

```
  				'caption' => 'Type',

```

- 

```
  				'prefix' => 'type_',

```

- 

```
  				'children' => $types,

```

- 

```
  				'group' => $group,

```

- 

```
  				'icon' => 'task',

```

- 

```
  			),

```

- 

```
  			'status' => array(

```

- 

```
  				'caption' => 'Status',

```

- 

```
  				'prefix' => 'status_',

```

- 

```
  				'children' => $statis,

```

- 

```
  				'group' => $group,

```

- 

```
  				'icon' => 'ongoing',

```

- 

```
  			),

```

- 

```
  			'completion' => array(

```

- 

```
  				'caption' => 'Completed',

```

- 

```
  				'prefix' => 'completion_',

```

- 

```
  				'children' => $percent,

```

- 

```
  				'group' => $group,

```

- 

```
  				'icon' => 'completed',

```

- 

```
  			),

```

- 

```
  			'cat' => nextmatch_widget::category_action(

```

- 

```
  				'infolog',$group,'Change category','cat_'

```

- 

```
  			),

```

- 

```
  			'responsible' => array(

```

- 

```
  				'caption' => 'Delegation',

```

- 

```
  				'group' => $group,

```

- 

```
  				'icon' => 'users',

```

- 

```
  				'onExecute' => 'javaScript:open_popup',

```

- 

```
  			),

```

- 

```
  			'link' => array(

```

- 

```
  				'caption' => 'Links',

```

- 

```
  				'group' => $group,

```

- 

```
  				'onExecute' => 'javaScript:open_popup',

```

- 

```
  			),

```

- 

```
  		),

```

- 

```
  	),

```

- 

```
  	'close' => array(

```

- 

```
  		'caption' => 'Close',

```

- 

```
  		'icon' => 'done',

```

- 

```
  		'group' => $group,

```

- 

```
  	),

```

- 

```
  	'close_all' => array(

```

- 

```
  		'caption' => 'Close all',

```

- 

```
  		'icon' => 'done_all',

```

- 

```
  		'group' => $group,

```

- 

```
  		'hint' => 'Sets the status of this entry and its subs to done',

```

- 

```
  		'allowOnMultiple' => false,

```

- 

```
  	),

```

- 

```
  );

```

- 

```
  ++$group;	// integration with other apps

```

- 

```
  if ($GLOBALS['egw_info']['user']['apps']['filemanager'])

```

- 

```
  {

```

- 

```
  	$actions['filemanager'] = array(

```

- 

```
  		'icon' => 'filemanager/navbar',

```

- 

```
  		'caption' => 'Filemanager',

```

- 

```
  		'url' => 'menuaction=filemanager.filemanager_ui.index&path=/apps/addressbook/$id',

```

- 

```
  		'allowOnMultiple' => false,

```

- 

```
  		'group' => $group,

```

- 

```
  	);

```

- 

```
  }

```

- 

```
  if ($GLOBALS['egw_info']['user']['apps']['timesheet'])

```

- 

```
  {

```

- 

```
  	$actions['timesheet'] = array(	// interactive add for a single event

```

- 

```
  		'icon' => 'timesheet/navbar',

```

- 

```
  		'caption' => 'Timesheet',

```

- 

```
  		'url' => 'menuaction=timesheet.timesheet_ui.edit&link_app[]=infolog&link_id[]=$id',

```

- 

```
  		'group' => $group,

```

- 

```
  		'allowOnMultiple' => false,

```

- 

```
  		'popup' => egw_link::get_registry('timesheet', 'add_popup'),

```

- 

```
  	);

```

- 

```
  }

```

- 
- 

```
  $actions['documents'] = infolog_merge::document_action(

```

- 

```
  	$this->prefs['document_dir'], ++$group, 'Insert in document', 'document_',

```

- 

```
  	$this->prefs['default_document']

```

- 

```
  );

```

- 
- 

```
  $actions['delete'] = array(

```

- 

```
  	'caption' => 'Delete',

```

- 

```
  	'confirm' => 'Delete this entry',

```

- 

```
  	'confirm_multiple' => 'Delete these entries',

```

- 

```
  	'group' => ++$group,

```

- 

```
  	'disableClass' => 'rowNoDelete',

```

- 

```
  );

```

- 
- 

```
  //echo "<p>". __METHOD__."($do_email, $tid_filter, $org_view)</p>\n"; _debug_array($actions);

```

- 

```
  return $actions;

```

}

/\*\*  
@@ -817,34 +937,27 @@

  - @param int &$success number of succeded actions
  - @param int &$failed number of failed actions (not enought permissions)
  - @param string &$action\_msg translated verb for the actions, to be used in a message like ‘%1 entries deleted’

- 
  - @param string/array $session\_name ‘index’, or array with session-data depending

- 
  - @param array $query get\_rows parameter

- 
  - @param string &$msg on return user feedback

- 
  - @param boolean $skip\_notifications=false true to NOT notify users about changes
  - @return boolean true if all actions succeded, false otherwise  
\*/

- function action($action,$checked,$use\_all,&$success,&$failed,&$action\_msg,$session\_name = false,&$msg, $skip\_notifications = false)

- function action($action, $checked, $use\_all, &$success, &$failed, &$action\_msg,
- 

```
  array $query, &$msg, $skip_notifications = false)

```

{  
//echo “

infolog\_ui::action(’$action’,”.print\_r($checked,true).’,’.(int)$use\_all.",…)

\n";  
$success = $failed = 0;  
if ($use\_all)  
{

- 

```
  	// get the whole selection

```

- 

```
  	if($session_name) {

```

- 

```
  		$query = is_array($session_name) ? $session_name : egw_session::appsession($session_name,'infolog');

```

- 

```
  	} else {

```

- 

```
  		$query = $this->read_sessiondata();

```

- 

```
  	}

```

- 
- 

```
  	if ($use_all)

```

- 

```
  	{

```

- 

```
  		@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small

```

- 

```
  		$query['num_rows'] = -1; // all

```

- 

```
  		$this->get_rows($query,$result,$readonlys);

```

- 

```
  		$checked = array();

```

- 

```
  		foreach($result as $key => $info)

```

- 

```
  		{

```

- 

```
  			if(is_numeric($key))

```

- 

```
  			{

```

- 

```
  				$checked[] = $info['info_id'];

```

- 

```
  			}

```

- 

```
  	@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small

```

- 

```
  	$query['num_rows'] = -1; // all

```

- 

```
  	$this->get_rows($query,$result,$readonlys);

```

- 

```
  	$checked = array();

```

- 

```
  	foreach($result as $key => $info)

```

- 

```
  	{

```

- 

```
  		if(is_numeric($key))

```

- 

```
  		{

```

- 

```
  			$checked[] = $info['info_id'];
  		}
  	}
  }

```

@@ -861,17 +974,19 @@  
if(!$link\_id)  
{  
$action\_msg = ‘linked’;

- 

```
  			$msg = lang('You need to select an entry for linking. ');

```

- 

```
  			$msg = lang('You need to select an entry for linking.');
  			break;
  		}
  		$title = egw_link::title($app, $link_id);
  		foreach($checked as $id)
  		{

```

- 

```
  			if(!$this->bo->check_access($id, EGW_ACL_EDIT)) {

```

- 

```
  			if(!$this->bo->check_access($id, EGW_ACL_EDIT))

```

- 

```
  			{
  				$failed++;
  				continue;
  			}

```

- 

```
  			if($add_remove == 'add') {

```

- 

```
  			if($add_remove == 'add')

```

- 

```
  			{
  				$action_msg = lang('linked to %1', $title);
  				if(egw_link::link('infolog', $id, $app, $link_id))
  				{

```

@@ -881,33 +996,41 @@  
{  
$failed++;  
}

- 

```
  			} else {

```

- 

```
  			}

```

- 

```
  			else

```

- 

```
  			{
  				$action_msg = lang('unlinked from %1', $title);
  				$count = egw_link::unlink(0, 'infolog', $id, '', $app, $link_id);
  				$success += $count;
  			}
  		}

```

- 

```
  		return ($failed == 0);

```

- 

```
  		return $failed == 0;

```

- 

```
  	case 'document':
  		$msg = $this->download_document($checked,$settings);
  		$failed = count($checked);

```

- 

```
                           return false;

```

- 

```
  		return false;

```

- 
- 

```
  	case 'view':

```

+// todo: implement or better move code from index to here

- 

```
  		return false;
  }

  // Actions that need to loop
  foreach($checked as $id)

```

- 

```
           {

```

- 

```
  {
  	if(!$entry = $this->bo->read($id))
  	{
  		continue;
  	}

```

- 

```
                   switch($action)

```

- 

```
                   {

```

- 

```
  	switch($action)

```

- 

```
  	{
  		case 'close':
  			$action_msg = lang('closed');
  			$this->close($id, '', false, $skip_notifications);
  			$success++;
  			break;

```

- 

```
  		case 'delete':
  			$action_msg = lang('deleted');
  			$result = $this->delete($id, '', 'multi-action', $skip_notifications);

```

@@ -920,6 +1043,7 @@  
$failed++;  
}  
break;  
+  
case ‘type’:  
$action\_msg = lang(‘changed type’);  
// Dont allow to change the type, if user has no delete rights from the group-owner  
@@ -937,7 +1061,8 @@  
$action\_msg = lang(‘changed completion to %1%’, $settings);  
$entry[‘info\_percent’] = $settings;  
// Done entries will get changed right back if we don’t change the status too

- 

```
  			if($entry['info_status'] == 'done') {

```

- 

```
  			if($entry['info_status'] == 'done')

```

- 

```
  			{
  				$entry['info_status'] = 'ongoing';
  			}
  			if($this->bo->write($entry, true,true,true,$skip_notifications))

```

@@ -963,11 +1088,14 @@  
{  
$success++;  
}

- 

```
  			} else {

```

- 

```
  			}

```

- 

```
  			else

```

- 

```
  			{
  				$msg .= lang('Invalid status for entry type %1. ', lang($this->bo->enums['type'][$entry['info_type']]));
  				$failed++;
  			}
  			break;

```

- 

```
  		case 'cat':
  			$cat_name = categories::id2name($settings);
  			$action_msg = lang('changed category to %1', $cat_name);

```

@@ -981,6 +1109,7 @@  
$failed++;  
}  
break;  
+  
case ‘responsible’:  
list($add\_remove, $users) = explode(’\_’, $settings, 2);  
$action\_msg = lang(‘changed responsible’) . ’ - ’ . ($add\_remove == ‘add’ ? lang(‘added’) : lang(‘removed’)) . ’ ';  
@@ -1003,7 +1132,7 @@  
break;  
}  
}

- 

```
  return ($failed == 0);

```

- 

```
  return $failed == 0;

```

}

/\*\*  
@@ -1154,36 +1283,8 @@  
if ($button)  
{  
//Copy Infolog

- 

```
  		if (($button == 'copy'))

```

- 

```
  		{

```

- 

```
  			unset($content['info_id']);

```

- 

```
  			unset ($info_id);

```

- 

```
  			unset($content['info_datemodified']);

```

- 

```
  			unset($content['info_modifier']);

```

- 
- 

```
  			// Get links to be copied

```

- 

```
  			$content['link_to']['to_id'] = egw_link::get_links($content['link_to']['to_app'], $content['link_to']['to_id']);

```

- 

```
  			// Special mangling for files so the files get copied

```

- 

```
  			foreach($content['link_to']['to_id'] as $link_id => &$link)

```

- 

```
  			{

```

- 

```
  				if ($link['app'] == egw_link::VFS_APPNAME)

```

- 

```
  				{

```

- 

```
  					$link['id'] = $link + array(

```

- 

```
  						'tmp_name' => egw_link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],

```

- 

```
  						'name' => $link['id'],

```

- 

```
  					);

```

- 

```
  				}

```

- 

```
  			}

```

- 

```
  			if($content['info_link_id'])

```

- 

```
  			{

```

- 

```
  				$info_link_id = $content['info_link_id'];

```

- 

```
  				unset($content['info_link_id']);

```

- 

```
  			}

```

- 
- 

```
  			$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 == 'copy') $action = 'copy';

```

- 

```
  		if ($button == 'print')
  		{
  			$content['js'] = $this->custom_print($content,!$content['info_id'])."\n".$js;	// first open the new window and then update the view

```

@@ -1443,7 +1544,7 @@  
‘to\_id’ =\> $info\_id,  
‘to\_app’ =\> ‘infolog’,  
);

- 

```
  		switch ($action)

```

- 

```
  	switch ($action)
  	{
  		case 'sp':
  			$links = egw_link::get_links('infolog',$parent['info_id'],'!'.egw_link::VFS_APPNAME);

```

@@ -1522,6 +1623,36 @@  
{  
$content[‘info\_type’] = ‘note’;  
}

- 

```
  }

```

- 

```
  if ($action == 'copy')	// get's called via actions selectbox or url (action=copy&info_id=123)

```

- 

```
  {

```

- 

```
  	unset($content['info_id']);

```

- 

```
  	unset ($info_id);

```

- 

```
  	unset($content['info_datemodified']);

```

- 

```
  	unset($content['info_modifier']);

```

- 
- 

```
  	// Get links to be copied

```

- 

```
  	$content['link_to']['to_id'] = egw_link::get_links($content['link_to']['to_app'], $content['link_to']['to_id']);

```

- 

```
  	// Special mangling for files so the files get copied

```

- 

```
  	foreach($content['link_to']['to_id'] as $link_id => &$link)

```

- 

```
  	{

```

- 

```
  		if ($link['app'] == egw_link::VFS_APPNAME)

```

- 

```
  		{

```

- 

```
  			$link['id'] = $link + array(

```

- 

```
  				'tmp_name' => egw_link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],

```

- 

```
  				'name' => $link['id'],

```

- 

```
  			);

```

- 

```
  		}

```

- 

```
  	}

```

- 

```
  	if($content['info_link_id'])

```

- 

```
  	{

```

- 

```
  		$info_link_id = $content['info_link_id'];

```

- 

```
  		unset($content['info_link_id']);

```

- 

```
  	}

```

- 
- 

```
  	$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'];
  }
  // group owners
  $types = $this->bo->enums['type'];

```

@@ -1966,7 +2097,7 @@  
}  
$this-\>called\_by = $app; // for read/save\_sessiondata, to have different sessions for the hooks

- 

```
  $GLOBALS['egw']->translation->add_app('infolog');

```

- 

```
  translation::add_app('infolog');

  etemplate::$hooked = true;
  $this->index(0,$app,$args[$view_id],array(

```

# Modified: trunk/infolog/js/index.js URL: [http://www.egroupware.org/viewvc/egroupware/trunk/infolog/js/index.js?rev=34819&r1=34818&r2=34819&view=diff](http://www.egroupware.org/viewvc/egroupware/trunk/infolog/js/index.js?rev=34819&r1=34818&r2=34819&view=diff)

— trunk/infolog/js/index.js (original)  
+++ trunk/infolog/js/index.js Mon May 2 21:41:21 2011  
@@ -18,6 +18,11 @@  
selbox.value = “”;  
}

+function open\_popup(\_action, \_senders)  
+{

- alert('Show popup: '+\_action.id);  
+}
- 

/\*\*

- Hide popup and clear values  
\*/

Modified: trunk/infolog/lang/egw\_bg.lang  
URL: [http://www.egroupware.org/viewvc/egroupware/trunk/infolog/lang/egw\_bg](http://www.egroupware.org/viewvc/egroupware/trunk/infolog/lang/egw_bg)
