phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: infolog/inc class.boinfolog.inc.php,1.25,1.26 cl


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: infolog/inc class.boinfolog.inc.php,1.25,1.26 class.bolink.inc.php,1.8,1.9 class.solink.inc.php,1.6,1.7 class.uiinfolog.inc.php,1.51,1.52
Date: Thu, 17 Oct 2002 18:03:11 -0400

Update of /cvsroot/phpgroupware/infolog/inc
In directory subversions:/tmp/cvs-serv2607

Modified Files:
        class.boinfolog.inc.php class.bolink.inc.php 
        class.solink.inc.php class.uiinfolog.inc.php 
Log Message:
update with new table-structure for infolog


Index: class.boinfolog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.boinfolog.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** class.boinfolog.inc.php     16 Oct 2002 00:23:39 -0000      1.25
--- class.boinfolog.inc.php     17 Oct 2002 22:02:44 -0000      1.26
***************
*** 23,33 ****
                        'delete'         => True,
                        'check_access'   => True,
-                       'readProj'       => True,
-                       'readAddr'       => True,
                        'anzSubs'        => True,
                        'search'         => True,
                        'get_rows'       => True,
                        'accountInfo'    => True,       // in class boinfolog 
(this class)
!                       'addr2name'      => True,
                        'attach_file'    => True,
                        'delete_attached'=> True,
--- 23,33 ----
                        'delete'         => True,
                        'check_access'   => True,
                        'anzSubs'        => True,
                        'search'         => True,
                        'get_rows'       => True,
                        'accountInfo'    => True,       // in class boinfolog 
(this class)
! /*                    'readProj'       => True,
!                       'readAddr'       => True,
!                       'addr2name'      => True,*/
                        'attach_file'    => True,
                        'delete_attached'=> True,
***************
*** 37,41 ****
                        'attached_local' => True,
                        'link_title'     => True,
!                       'link_query'     => True
                );
                var $enums;
--- 37,42 ----
                        'attached_local' => True,
                        'link_title'     => True,
!                       'link_query'     => True,
!                       'link_id2title'  => True
                );
                var $enums;
***************
*** 52,60 ****
                                        'urgent' => 'urgent','high' => 
'high','normal' => 'normal',
                                        'low' => 'low' ),
!                               'status'   => array(
                                        'offer' => 'offer','ongoing' => 
'ongoing','call' => 'call',
                                        'will-call' => 'will-call','done' => 
'done',
                                        'billed' => 'billed' ),
!                               'confirm'   => array(
                                        'not' => 'not','accept' => 
'accept','finish' => 'finish',
                                        'both' => 'both' ),
--- 53,61 ----
                                        'urgent' => 'urgent','high' => 
'high','normal' => 'normal',
                                        'low' => 'low' ),
! /*                            'status'   => array(
                                        'offer' => 'offer','ongoing' => 
'ongoing','call' => 'call',
                                        'will-call' => 'will-call','done' => 
'done',
                                        'billed' => 'billed' ),
! */                            'confirm'   => array(
                                        'not' => 'not','accept' => 
'accept','finish' => 'finish',
                                        'both' => 'both' ),
***************
*** 62,66 ****
                                        'task' => 'task','phone' => 
'phone','note' => 'note'
                                /*      ,'confirm' => 'confirm','reject' => 
'reject','email' => 'email',
!                                       'fax' => 'fax' no implemented so far */ 
)
                        );
                        $this->status = array(
--- 63,67 ----
                                        'task' => 'task','phone' => 
'phone','note' => 'note'
                                /*      ,'confirm' => 'confirm','reject' => 
'reject','email' => 'email',
!                                       'fax' => 'fax' not implemented so far 
*/ )
                        );
                        $this->status = array(
***************
*** 68,73 ****
                                        'task' => 'ongoing', 'phone' => 'call', 
'note' => 'done'),
                                'task' => array(
!                                       'offer' => 'offer','ongoing' => 
'ongoing',
!                                       'done' => 'done', 'billed' => 'billed' 
),
                                'phone' => array(
                                        'call' => 'call','will-call' => 
'will-call',
--- 69,76 ----
                                        'task' => 'ongoing', 'phone' => 'call', 
'note' => 'done'),
                                'task' => array(
!                                       'offer' => 'offer','ongoing' => 
'ongoing','done' => 'done',
!                                       '0%' => '0%', '10%' => '10%', '20%' => 
'20%', '30%' => '30%', '40%' => '40%',
!                                       '50%' => '50%', '60%' => '60%', '70%' 
=> '70%', '80%' => '80%', '90%' => '90%',
!                                       'billed' => 'billed' ),
                                'phone' => array(
                                        'call' => 'call','will-call' => 
'will-call',
***************
*** 79,82 ****
--- 82,86 ----
                        $this->so = CreateObject('infolog.soinfolog');
                        $this->vfs = CreateObject('infolog.vfs');
+                       $this->link = CreateObject('infolog.bolink');
  
                        $this->config = CreateObject('phpgwapi.config');
***************
*** 112,247 ****
                        return $account_data['account_lid'];
                }
! 
!               function addr2name( $addr )
!               {
!                       if (!is_array($addr) && !($addr = 
$this->readAddr($addr)))
!                       {
!                               return '';
!                       }
!                       $name = $addr['n_family'];
!                       if ($addr['n_given'])
!                       {
!                               $name .= ', '.$addr['n_given'];
!                       }
!                       else
!                       {
!                               if ($addr['n_prefix'])
!                               {
!                                       $name .= ', '.$addr['n_prefix'];
!                               }
!                       }
!                       if ($addr['org_name'])
!                       {
!                               $name = $addr['org_name'].': '.$name;
!                       }
!                       return $GLOBALS['phpgw']->strip_html($name);
!               }
! 
!               function proj2name( $proj )
!               {
!                       if (!is_array($proj))
!                       {
!                               $proj = $this->readProj($proj);
!                       }
!                       return is_array($proj) ? $proj['title'] : '';
!               }
! 
!               function readProj($proj_id)
!               {
!                       if ($proj_id)
!                       {
!                               if (!is_object($this->projects) && 
file_exists(PHPGW_SERVER_ROOT.'/projects'))
!                               {
!                                       $this->projects = 
createobject('projects.boprojects');
!                               }
!                               if (is_object($this->projects) && ($proj = 
$this->projects->read_single_project( $proj_id)))
!                               {
!                                       return $proj;
!                               }
!                       }
!                       return False;
!               }
! 
!               function readAddr($addr_id)
                {
!                       if ($addr_id)
!                       {
!                               if (!is_object($this->contacts))
!                               {
!                                       $this->contacts = 
createobject('phpgwapi.contacts');
!                               }
!                               if (list( $addr ) = 
$this->contacts->read_single_entry( $addr_id ))
!                               {
!                                       return $addr;
!                               }
!                       }
!                       return False;
                }
  
!               function event2name( $event )
                {
!                       if (!is_object($this->bocal) && 
file_exists(PHPGW_SERVER_ROOT.'/projects'))
!                       {
!                               $this->bocal = 
createobject('calendar.bocalendar');
!                       }
!                       if (is_object($this->bocal) && !is_array($event) && 
(int) $event > 0)
!                       {
!                               $event = $this->bocal->read_entry($event);
!                       }
!                       if (!is_array($event))
!                       {
!                               return '';
!                       }
!                       $name = 
$GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - 
$this->bocal->datetime->tz_offset);
!                       $name .= ' -- ' . 
$GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['end']) - 
$this->bocal->datetime->tz_offset);
!                       $name .= ': ' . $event['title'];
! 
!                       return $GLOBALS['phpgw']->strip_html($name);
                }
  
!               function readEvent($cal_id)
                {
!                       if ($cal_id)
                        {
!                               if (!is_object($this->bocal) && 
file_exists(PHPGW_SERVER_ROOT.'/projects'))
                                {
!                                       $this->bocal = 
createobject('calendar.bocalendar');
                                }
!                               if (is_object($this->bocal) && $event = 
$this->bocal->read_entry( $cal_id ))
                                {
!                                       return $event;
                                }
                        }
                        return False;
                }
  
-               /*
-                * check's if user has the requiered rights on entry $info_id
-                */
-               function check_access( $info_id,$required_rights )
-               {
-                       return $this->so->check_access( 
$info_id,$required_rights );
-               }
- 
-               function init()
-               {
-                       $this->so->init();
-               }      
- 
                function read($info_id)
                {
                        $err = $this->so->read($info_id) === False;
!                               
!                       if ($this->so->data['info_subject'] ==
!                                (substr($this->so->data['info_des'],0,60).' 
...'))
                        {
!                               $this->so->data['info_subject'] = '';
                        }
!                       if ($this->so->data['info_addr_id'] && 
$this->so->data['info_from'] ==
!                                $this->addr2name( $this->readAddr( 
$this->so->data['info_addr_id'] )))
                        {
!                               $this->so->data['info_from'] = '';
                        }
!                       return $err ? False : $this->so->data;
                }
  
--- 116,173 ----
                        return $account_data['account_lid'];
                }
!               
!               /*
!                * check's if user has the requiered rights on entry $info_id
!                */
!               function check_access( $info_id,$required_rights )
                {
!                       return $this->so->check_access( 
$info_id,$required_rights );
                }
  
!               function init()
                {
!                       $this->so->init();
                }
  
!               function link_id2title(&$info,$not_app='',$not_id='')
                {
!                       if ($info['info_link_id'] > 0 &&
!                                ($link = 
$this->link->get_link($info['info_link_id'])) !== False)
                        {
!                               $nr = $link['link_app1'] == 'infolog' && 
$link['link_id1'] == $info['info_id'] ? '2' : '1';
!                               $title = 
$this->link->title($link['link_app'.$nr],$link['link_id'.$nr]);
!                               if ($link['link_app'.$nr] == $not_app && 
$link['link_id'.$nr] == $not_id)
                                {
!                                       if ($title == $info['info_from'])
!                                       {
!                                               $info['info_from'] = '';
!                                       }
!                                       return False;
                                }
!                               if ($info['info_from'] == '' || 
$info['info_from'] == $title)
                                {
!                                       $info['info_link_view'] = 
$this->link->view($link['link_app'.$nr],$link['link_id'.$nr]);
!                                       $info['info_from'] = 
$info['info_link_title'] = $title;
                                }
+                               return $title;
                        }
                        return False;
                }
  
                function read($info_id)
                {
                        $err = $this->so->read($info_id) === False;
!                       $data = &$this->so->data;
! 
!                       if ($data['info_subject'] == 
(substr($data['info_des'],0,60).' ...'))
                        {
!                               $data['info_subject'] = '';
                        }
!                       $data['info_link_title'] = 
$this->link_id2title($data,$data['info_link_view']);
!                       if ($data['info_link_title'] == $data['info_from'])
                        {
!                               $data['info_from'] = '';
                        }
!                       return $err ? False : $data;
                }
  
***************
*** 249,252 ****
--- 175,179 ----
                {
                        $this->delete_attached($info_id);
+                       $this->link->unlink(0,'infolog',$info_id);
  
                        $this->so->delete($info_id);
***************
*** 271,284 ****
                                $values['info_owner'] = $this->so->user;
                        }
-                       $values['info_datemodified'] = time();
- 
                        if (!$values['info_subject'])
                        {
                                $values['info_subject'] = 
substr($values['info_des'],0,60).' ...';
                        }
!                       if ($values['info_addr_id'] && !$values['info_from'])
                        {
!                               $values['info_from'] = $this->addr2name( 
$this->readAddr( $values['info_addr_id'] ));
                        }
                        $this->so->write($values);
                }
--- 198,212 ----
                                $values['info_owner'] = $this->so->user;
                        }
                        if (!$values['info_subject'])
                        {
                                $values['info_subject'] = 
substr($values['info_des'],0,60).' ...';
                        }
!                       if ($values['info_link_id'] && $values['info_from'] == 
'')
                        {
!                               $values['info_from'] = 
$this->link_id2title($values);
                        }
+                       $values['info_datemodified'] = time();
+                       $values['info_modifier'] = $this->so->user;
+ 
                        $this->so->write($values);
                }
***************
*** 455,458 ****
--- 383,387 ----
                        return False;
                }
+               
                /*!
                @function link_title

Index: class.bolink.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.bolink.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.bolink.inc.php        9 Oct 2002 00:37:00 -0000       1.8
--- class.bolink.inc.php        17 Oct 2002 22:02:44 -0000      1.9
***************
*** 61,68 ****
                                'title' => 'infolog.boinfolog.link_title',
                                'view' => array(
!                                       'menuaction' => 
'infolog.uiinfolog.get_list',
                                        'action' => 'sp'
                                ),
!                               'view_id' => 'info_id',
                        )
                );
--- 61,68 ----
                                'title' => 'infolog.boinfolog.link_title',
                                'view' => array(
!                                       'menuaction' => 
'infolog.uiinfolog.index',
                                        'action' => 'sp'
                                ),
!                               'view_id' => 'action_id',
                        )
                );
***************
*** 89,93 ****
                @param $owner Owner of the link (defaults to user)
                @discussion Does NOT check if link already exists
!               @result db-errno or -1 (for param-error) or 0 for success
                @result if $id1==0 or already an array: $id1 is array with links
                */
--- 89,93 ----
                @param $owner Owner of the link (defaults to user)
                @discussion Does NOT check if link already exists
!               @result False (for db or param-error) or link_id on success
                @result if $id1==0 or already an array: $id1 is array with links
                */
***************
*** 100,104 ****
                        if (!$app1 || !$app2 || !$id1 && is_array($id2) || 
$app1 == $app2 && $id1 == $id2)
                        {
!                               return -1;
                        }
                        if (is_array($id1) || !$id1)            // create link 
only in $id1 array
--- 100,104 ----
                        if (!$app1 || !$app2 || !$id1 && is_array($id2) || 
$app1 == $app2 && $id1 == $id2)
                        {
!                               return False;
                        }
                        if (is_array($id1) || !$id1)            // create link 
only in $id1 array
***************
*** 108,130 ****
                                        $id1 = array( );
                                }
!                               $id1["$app2:$id2"] = array(
                                        'app' => $app2,
                                        'id'  => $id2,
                                        'remark' => $remark,
                                        'owner'  => $owner,
!                                       'link_id' => "$app2:$id2",
                                        'lastmod' => time()
                                );
!                               return 0;
                        }
                        if (is_array($app2) && !$id2)
                        {
                                reset($app2);
!                               $err = 0;
!                               while (!$err && list(,$link) = each($app2))
                                {
!                                       $err = 
solink::link($app1,$id1,$link['app'],$link['id'],$link['remark'],$link['owner'],$link['lastmod']);
                                }
!                               return $err;
                        }
                        return 
solink::link($app1,$id1,$app2,$id2,$remark,$owner);
--- 108,131 ----
                                        $id1 = array( );
                                }
!                               $link_id = "$app2:$id2";
!                               $id1[$link_id] = array(
                                        'app' => $app2,
                                        'id'  => $id2,
                                        'remark' => $remark,
                                        'owner'  => $owner,
!                                       'link_id' => $link_id,
                                        'lastmod' => time()
                                );
!                               return $link_id;
                        }
                        if (is_array($app2) && !$id2)
                        {
                                reset($app2);
!                               $link_id = True;
!                               while ($link_id && list(,$link) = each($app2))
                                {
!                                       $link_id = 
solink::link($app1,$id1,$link['app'],$link['id'],$link['remark'],$link['owner'],$link['lastmod']);
                                }
!                               return $link_id;
                        }
                        return 
solink::link($app1,$id1,$app2,$id2,$remark,$owner);
***************
*** 169,175 ****
  
                /*!
!       @function unlink
!       @syntax unlink( $link_id,$app='',$id='',$owner='',$app2='',$id2='' )
!       @author ralfbecker
                @abstract Remove link with $link_id or all links matching given 
$app,$id
                @param $link_id link-id to remove if > 0
--- 170,199 ----
  
                /*!
!               @function get_link
!               @syntax get_link(  $app_link_id,$id='',$app2='',$id2='' )
!               @author ralfbecker
!               @abstract returns data of a link
!               @param $app_link_id > 0 link_id of link or app-name of link
!               @param $id,$app2,$id2 other param of the link if not link_id 
given
!               @result array with link-data or False
!               @disscussion If $id is an array (links not yet created) only 
link_ids are allowed.
!               */ 
!               function get_link($app_link_id,$id='',$app2='',$id2='')
!               {
!                       if (is_array($id))
!                       {
!                               if (isset($id[$app_link_id]))
!                               {
!                                       return $id[$app_link_id];
!                               }
!                               return False;
!                       }
!                       return solink::get_link($app_link_id,$id,$app2,$id2);
!               }
! 
!               /*!
!               @function unlink
!               @syntax unlink( 
$link_id,$app='',$id='',$owner='',$app2='',$id2='' )
!               @author ralfbecker
                @abstract Remove link with $link_id or all links matching given 
$app,$id
                @param $link_id link-id to remove if > 0

Index: class.solink.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.solink.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.solink.inc.php        16 Oct 2002 00:22:04 -0000      1.6
--- class.solink.inc.php        17 Oct 2002 22:02:44 -0000      1.7
***************
*** 29,33 ****
                        'get_links' => True,
                        'unlink'    => True,
!                       'chown'     => True
                );
                var $db;
--- 29,34 ----
                        'get_links' => True,
                        'unlink'    => True,
!                       'chown'     => True,
!                       'get_link'  => True
                );
                var $db;
***************
*** 56,60 ****
                @param $owner Owner of the link (defaults to user)
                @discussion Does NOT check if link already exists
!               @result db-errno or -1 (for param-error) or 0 for success
                */
                function link( 
$app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 )
--- 57,61 ----
                @param $owner Owner of the link (defaults to user)
                @discussion Does NOT check if link already exists
!               @result False (for db or param-error) or link_id for success
                */
                function link( 
$app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 )
***************
*** 67,71 ****
                            $id1 == '' || $id2 == '' || $app1 == '' || $app2 == 
'')
                        {
!                               return -1;      // dont link to self or other 
nosense
                        }
                        if (!$owner)
--- 68,76 ----
                            $id1 == '' || $id2 == '' || $app1 == '' || $app2 == 
'')
                        {
!                               return False;   // dont link to self or other 
nosense
!                       }
!                       if ($this->get_link($app1,$id1,$app2,$id2))
!                       {
!                               return $link['link_id'];        // link alread 
exist
                        }
                        if (!$owner)
***************
*** 77,83 ****
                        {
                                $lastmod = time();
!          }
!                       $this->unlink(0,$app1,$id1,'',$app2,$id2);      // 
remove link if one exists
! 
                        $sql = "INSERT INTO $this->db_name 
(link_app1,link_id1,link_app2,link_id2,link_remark,link_lastmod,link_owner) ".
                               " VALUES 
('$app1','$id1','$app2','$id2','$remark',$lastmod,$owner)";
--- 82,86 ----
                        {
                                $lastmod = time();
!                       }
                        $sql = "INSERT INTO $this->db_name 
(link_app1,link_id1,link_app2,link_id2,link_remark,link_lastmod,link_owner) ".
                               " VALUES 
('$app1','$id1','$app2','$id2','$remark',$lastmod,$owner)";
***************
*** 87,93 ****
                                echo 
"<p>solink.link($app1,$id1,$app2,$id2,'$remark',$owner) sql='$sql'</p>\n";
                        }
!                       $this->db->query($sql);
  
!                       return $this->db->errno;
                }
  
--- 90,96 ----
                                echo 
"<p>solink.link($app1,$id1,$app2,$id2,'$remark',$owner) sql='$sql'</p>\n";
                        }
!                       $this->db->query($sql,__LINE__,__FILE__);
  
!                       return $this->db->errno ? False : 
$this->db->get_last_insert_id($this->db_name,'link_id');
                }
  
***************
*** 114,118 ****
                                echo 
"<p>solink.get_links($app,$id,$only_app,$order) sql='$sql'</p>\n";
                        }
!                       $this->db->query($sql);
  
                        if ($not_only = $only_app[0] == '!')
--- 117,121 ----
                                echo 
"<p>solink.get_links($app,$id,$only_app,$order) sql='$sql'</p>\n";
                        }
!                       $this->db->query($sql,__LINE__,__FILE__);
  
                        if ($not_only = $only_app[0] == '!')
***************
*** 152,155 ****
--- 155,192 ----
                        return $links;
                }
+               
+               /*!
+               @function get_link
+               @syntax get_link(  $app_link_id,$id='',$app2='',$id2='' )
+               @author ralfbecker
+               @abstract returns data of a link
+               @param $app_link_id > 0 link_id of link or app-name of link
+               @param $id,$app2,$id2 other param of the link if not link_id 
given
+               @result array with link-data or False
+               */
+               function get_link($app_link_id,$id='',$app2='',$id2='')
+               {
+                       $sql = "SELECT * FROM $this->db_name WHERE ";
+                       if (intval($app_link_id) > 0)
+                       {
+                               $sql .= "link_id=$app_link_id";
+                       }
+                       else
+                       {
+                               if ($app_link_id == '' || $id == '' || $app2 == 
'' || $id2 == '')
+                               {
+                                       return False;
+                               }
+                               $sql .= "(link_app1='$app_link_id' AND 
link_id1='$id' AND link_app2='$app2' AND link_id2='$id2') OR".
+                                       "(link_app2='$app_link_id' AND 
link_id2='$id' AND link_app1='$app2' AND link_id1='$id2')";
+                       }
+                       $this->db->query($sql,__LINE__,__FILE__);
+ 
+                       if ($this->db->next_record())
+                       {
+                               return $this->db->Record;
+                       }
+                       return False;
+               }
  
                /*!
***************
*** 200,204 ****
                                echo 
"<p>solink.unlink($link_id,$app,$id,$owner,$app2,$id2) sql='$sql'</p>\n";
                        }
!                       $this->db->query($sql);
  
                        return $this->db->affected_rows();
--- 237,241 ----
                                echo 
"<p>solink.unlink($link_id,$app,$id,$owner,$app2,$id2) sql='$sql'</p>\n";
                        }
!                       $this->db->query($sql,__LINE__,__FILE__);
  
                        return $this->db->affected_rows();
***************
*** 220,224 ****
                                return 0;
                        }
!                       $this->db->query("UPDATE $this->db_name SET 
owner=$new_owner WHERE owner=$owner");
  
                        return $this->db->affected_rows();
--- 257,261 ----
                                return 0;
                        }
!                       $this->db->query("UPDATE $this->db_name SET 
owner=$new_owner WHERE owner=$owner",__LINE__,__FILE__);
  
                        return $this->db->affected_rows();

Index: class.uiinfolog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.uiinfolog.inc.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -r1.51 -r1.52
*** class.uiinfolog.inc.php     16 Oct 2002 14:09:40 -0000      1.51
--- class.uiinfolog.inc.php     17 Oct 2002 22:02:44 -0000      1.52
***************
*** 18,22 ****
                var $public_functions = array
                (
-                       //'get_list'    => True,
                        'index'       => True,
                        'edit'        => True,
--- 18,21 ----
***************
*** 80,84 ****
                        //$this->categories = 
CreateObject('phpgwapi.categories');
                        //$this->nextmatchs = 
CreateObject('phpgwapi.nextmatchs');
!                       $this->link = CreateObject('infolog.uilink');
                        
                        $this->tmpl = CreateObject('etemplate.etemplate');
--- 79,83 ----
                        //$this->categories = 
CreateObject('phpgwapi.categories');
                        //$this->nextmatchs = 
CreateObject('phpgwapi.nextmatchs');
!                       $this->link = &$this->bo->link;
                        
                        $this->tmpl = CreateObject('etemplate.etemplate');
***************
*** 93,100 ****
                        }
                        $id = $info['info_id'];
!                       $info += $this->formatInfo($info,$action,$action_id);
                        $info['info_des'] = nl2br($info['info_des']);
                        $info['info_anz_subs'] = $this->bo->anzSubs($id);
! 
                        $readonlys["edit[$id]"] = 
!$this->bo->check_access($id,PHPGW_ACL_EDIT);
                        $readonlys["delete[$id]"] = 
!$this->bo->check_access($id,PHPGW_ACL_DELETE);
--- 92,105 ----
                        }
                        $id = $info['info_id'];
!                       $done = $info['info_status'] == 'done' || 
$info['info_status'] == 'billed';
!                       $info['sub_class'] = $info['info_pri'] . ($done ? 
'_done' : '');
!                       if (!$done && $info['info_enddate'] < 
time()+(60*60)*$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])
!                       {
!                               $info['end_class'] = 'overdue';
!                       }
                        $info['info_des'] = nl2br($info['info_des']);
                        $info['info_anz_subs'] = $this->bo->anzSubs($id);
!                       $this->bo->link_id2title(&$info,$action,$action_id);
!                       
                        $readonlys["edit[$id]"] = 
!$this->bo->check_access($id,PHPGW_ACL_EDIT);
                        $readonlys["delete[$id]"] = 
!$this->bo->check_access($id,PHPGW_ACL_DELETE);
***************
*** 131,135 ****
                        //echo "<p>readonlys = "; _debug_array($readonlys);
                        reset($rows);
! 
                        return $total;
                }
--- 136,140 ----
                        //echo "<p>readonlys = "; _debug_array($readonlys);
                        reset($rows);
!                       
                        return $total;
                }
***************
*** 153,159 ****
                                ));
                        }
!                       $action = $action ? $action : $values['action'];
!                       $action_id = $action_id ? $action_id : 
$values['action_id'];
! 
                        if ($values['add'] || $values['cancel'] || 
isset($values['nm']['rows']) || isset($values['main']))
                        {
--- 158,166 ----
                                ));
                        }
!                       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'));
!                       }
                        if ($values['add'] || $values['cancel'] || 
isset($values['nm']['rows']) || isset($values['main']))
                        {
***************
*** 168,172 ****
                                        list($do,$do_id) = 
isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']);
                                        list($do_id) = @each($do_id);
!                                       echo "<p>infolog::index: 
do='$do/$do_id', referer="; _debug_array($referer);
                                        switch($do)
                                        {
--- 175,179 ----
                                        list($do,$do_id) = 
isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']);
                                        list($do_id) = @each($do_id);
!                                       //echo "<p>infolog::index: 
do='$do/$do_id', referer="; _debug_array($referer);
                                        switch($do)
                                        {
***************
*** 260,264 ****
                                $action_id = $content['action_id'];
                                $referer   = $content['referer'];
!                               
                                if ($content['save'] || $content['delete'] || 
$content['cancel'])
                                {
--- 267,284 ----
                                $action_id = $content['action_id'];
                                $referer   = $content['referer'];
! 
!                               if (isset($content['link_to']['primary']))
!                               {
!                                       $content['info_link_id'] = 
$content['link_to']['primary'];
!                               }
!                               if 
(!$this->link->get_link($content['info_link_id']))
!                               {
!                                       $content['info_link_id'] = 0;   // link 
has been deleted
!                               }
!                               if ($content['set_today'])
!                               {
!                                       $content['info_startdate'] = time();
!                                       unset($content['set_today']);
!                               }
                                if ($content['save'] || $content['delete'] || 
$content['cancel'])
                                {
***************
*** 267,273 ****
                                                $this->bo->write($content);
  
!                                               if (!$info_id && 
is_array($content['link_to']['to_id']))
                                                {
!                                                       
$this->link->link('infolog',$this->bo->so->data['info_id'],$content['link_to']['to_id']);
                                                }
                                        }
--- 287,303 ----
                                                $this->bo->write($content);
  
!                                               if (!$info_id && 
is_array($content['link_to']['to_id']))        // writing link for new entry
                                                {
!                                                       $info_id = 
$this->bo->so->data['info_id'];
!                                                       
$this->link->link('infolog',$info_id,$content['link_to']['to_id']);
!                                                       if 
(strstr($content['info_link_id'],':') !== False)
!                                                       {
!                                                               list($app,$id) 
= explode(':',$content['info_link_id']);
!                                                               
$content['info_link_id'] = $this->link->get_link('info_log',$info_id,$app,$id);
!                                                               
$this->bo->write(array(
!                                                                       
'info_id' => $info_id,
!                                                                       
'info_link_id' => $content['info_link_id']
!                                                               ));
!                                                       }
                                                }
                                        }
***************
*** 296,303 ****
                                //echo "<p>uiinfolog::edit: info_id=$info_id,  
action='$action', action_id='$action_id', type='$type', 
referer='$referer'</p>\n";
                                
-                               if (!isset($this->bo->enums['type'][$type]))
-                               {
-                                       $type = 'note';
-                               }
                                $this->bo->read( $info_id || $action != 'sp' ? 
$info_id : $action_id );
                                $content = $this->bo->so->data;
--- 326,329 ----
***************
*** 335,339 ****
                                $content['links'] = $content['link_to'] = array(
                                        'to_id' => $info_id,
!                                       'to_app' => 'infolog'
                                );
                                switch ($action)
--- 361,365 ----
                                $content['links'] = $content['link_to'] = array(
                                        'to_id' => $info_id,
!                                       'to_app' => 'infolog',
                                );
                                switch ($action)
***************
*** 344,350 ****
                                        case 'projects':
                                        case 'calendar':
!                   
$this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id);
!                                       case 'new':
!                                               $content['info_type'] = $type;
                                                break;
                                        default:
--- 370,379 ----
                                        case 'projects':
                                        case 'calendar':
!                                               $content['info_link_id'] = 
$this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id);
!                                       case 'new': 
!                                               if ($type != '')
!                                               {
!                                                       $content['info_type'] = 
$type;
!                                               }
                                                break;
                                        default:
***************
*** 352,355 ****
--- 381,386 ----
                                                break;
                                }
+                               $content['link_to']['primary'] = 
$content['info_link_id'] ? $content['info_link_id'] : True;
+                               
                                if 
(!isset($this->bo->enums['type'][$content['info_type']]))
                                {
***************
*** 370,373 ****
--- 401,405 ----
                                'info_id'   => $info_id,
                                'info_id_parent' => $content['info_id_parent'],
+                               'info_link_id' => $content['info_link_id'],
                                'action'    => $action,
                                'action_id' => $action_id,
***************
*** 1524,1532 ****
                @function writeLangFile
                @abstract writes langfile with all templates and messages 
registered here
!               @discussion can be called via 
http://domain/phpgroupware/index.php?infolog.uiinfolog.writeLangFile
                */
                function writeLangFile()
                {
!                       
$this->tmpl->writeLangFile('infolog','en',$this->messages);
                }
        }
--- 1556,1573 ----
                @function writeLangFile
                @abstract writes langfile with all templates and messages 
registered here
!               @discussion call as 
http://domain/phpgroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile
                */
                function writeLangFile()
                {
!                       $extra = $this->messages + $this->filters;
!                       $enums = $this->bo->enums + $this->bo->status;
!                       unset($enums['defaults']);
!                       reset($enums);
!                       while (list($key,$msg_arr) = each($enums))
!                       {
!                               $extra += $msg_arr;
!                       }
!                       _debug_array($extra);
!                       echo $this->tmpl->writeLangFile('infolog','en',$extra);
                }
        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]