tutos-commits Mailing List for TUTOS
Projects / CRM / PLM / Calendar / Tasks / SCRUM / Test / Inventory
Brought to you by:
gokohnert
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(214) |
Sep
(144) |
Oct
(22) |
Nov
(22) |
Dec
(93) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(25) |
Feb
(31) |
Mar
(92) |
Apr
(70) |
May
(103) |
Jun
(130) |
Jul
(265) |
Aug
(325) |
Sep
(233) |
Oct
(244) |
Nov
(261) |
Dec
(157) |
2003 |
Jan
(101) |
Feb
(135) |
Mar
(148) |
Apr
(164) |
May
(53) |
Jun
(116) |
Jul
(149) |
Aug
(126) |
Sep
(45) |
Oct
(109) |
Nov
(36) |
Dec
(61) |
2004 |
Jan
(131) |
Feb
(236) |
Mar
(278) |
Apr
(259) |
May
(92) |
Jun
(110) |
Jul
(150) |
Aug
(64) |
Sep
(141) |
Oct
(141) |
Nov
(146) |
Dec
(65) |
2005 |
Jan
(70) |
Feb
(77) |
Mar
(129) |
Apr
(153) |
May
(161) |
Jun
(63) |
Jul
(42) |
Aug
(16) |
Sep
(30) |
Oct
(3) |
Nov
(8) |
Dec
(40) |
2006 |
Jan
(114) |
Feb
(16) |
Mar
(12) |
Apr
(15) |
May
(4) |
Jun
(9) |
Jul
(69) |
Aug
(27) |
Sep
(12) |
Oct
(80) |
Nov
(62) |
Dec
(41) |
2007 |
Jan
(34) |
Feb
(2) |
Mar
(38) |
Apr
(82) |
May
(61) |
Jun
(37) |
Jul
(16) |
Aug
(64) |
Sep
(7) |
Oct
(52) |
Nov
(18) |
Dec
(28) |
2008 |
Jan
(168) |
Feb
(26) |
Mar
(27) |
Apr
(19) |
May
(10) |
Jun
(58) |
Jul
(58) |
Aug
(91) |
Sep
(14) |
Oct
(23) |
Nov
(56) |
Dec
(38) |
2009 |
Jan
(58) |
Feb
(90) |
Mar
(204) |
Apr
(90) |
May
(27) |
Jun
(177) |
Jul
(116) |
Aug
(53) |
Sep
(42) |
Oct
(120) |
Nov
(51) |
Dec
(58) |
2010 |
Jan
(117) |
Feb
(231) |
Mar
(163) |
Apr
(90) |
May
(40) |
Jun
(139) |
Jul
(49) |
Aug
(118) |
Sep
(25) |
Oct
(80) |
Nov
(102) |
Dec
(99) |
2011 |
Jan
(176) |
Feb
(42) |
Mar
(60) |
Apr
(52) |
May
(30) |
Jun
(29) |
Jul
(27) |
Aug
(16) |
Sep
(51) |
Oct
(70) |
Nov
(63) |
Dec
(58) |
2012 |
Jan
(28) |
Feb
(26) |
Mar
(7) |
Apr
(12) |
May
(41) |
Jun
(61) |
Jul
(59) |
Aug
(38) |
Sep
(30) |
Oct
(28) |
Nov
(14) |
Dec
(31) |
2013 |
Jan
(24) |
Feb
(54) |
Mar
(45) |
Apr
(22) |
May
(35) |
Jun
(8) |
Jul
(18) |
Aug
(38) |
Sep
(11) |
Oct
(8) |
Nov
(19) |
Dec
(20) |
2014 |
Jan
(20) |
Feb
(22) |
Mar
(4) |
Apr
(6) |
May
(13) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(6) |
2015 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2016 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(8) |
Aug
(13) |
Sep
(12) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2021 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1
(25) |
2
(1) |
3
|
4
(2) |
5
(16) |
6
(8) |
7
(7) |
8
(16) |
9
(7) |
10
|
11
(1) |
12
(5) |
13
(26) |
14
|
15
|
16
|
17
(2) |
18
|
19
|
20
|
21
|
22
|
23
|
24
(40) |
25
(6) |
26
|
27
|
28
|
29
(27) |
30
(15) |
31
|
|
|
|
|
From: Gero K. <gok...@us...> - 2009-03-30 15:48:20
|
Update of /cvsroot/tutos/tutos/php/expense In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/expense Modified Files: expense_ins.php expense_new.php expense_overview.php expense_select.php expense_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: expense_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/expense/expense_ins.php,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- expense_ins.php 13 Mar 2009 20:00:40 -0000 1.9 +++ expense_ins.php 30 Mar 2009 15:48:06 -0000 1.10 @@ -152,13 +152,8 @@ $dbconn->Commit("WORK"); $gotourl = $u->getURL(); } - $gotourl = addMessage($gotourl,$msg,true); - $gotourl = addSessionKey($gotourl,true); - -Header("Status: 302 Moved Temporarily"); -Header("Location: ". dirname(getBaseUrl()) ."/". $gotourl); -$dbconn->Close(); +leave_insert($dbconn,$gotourl,$msg); /** * CVS Info: $Id$ * $Author$ Index: expense_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/expense/expense_show.php,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- expense_show.php 25 Mar 2009 10:50:09 -0000 1.15 +++ expense_show.php 30 Mar 2009 15:48:06 -0000 1.16 @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2008 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2009 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -26,193 +26,188 @@ * display a expense */ class Expense_show extends layout { - /** - * - */ - Function info() { - global $lang,$tutos; + /** + * + */ + Function info() { + global $lang,$tutos; - if ( $this->format == "xml") { - echo $this->obj->exportXMLHeader(); - echo $this->obj->exportXML(); - return; - } + $r = ''; + if ( $this->format == "xml") { + $r .= $this->obj->exportXMLHeader(); + $r .= $this->obj->exportXML(); + return $r; + } - echo $this->DataTableStart(); - echo '<tr><th colspan="3">'. $lang['Expense'] ."</th>\n"; - echo $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); - echo "</tr>\n"; + $r .= $this->DataTableStart(); + $r .= '<tr><th colspan="3">'. $lang['Expense'] ."</th>\n"; + $r .= $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); + $r .= "</tr>\n"; - echo $this->CreatorInfoLine($this->obj,4); + $r .= $this->CreatorInfoLine($this->obj,4); - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseName']); - echo "<td colspan=\"3\"><b><font size=\"+1\">". myentities($this->obj->name) ."</font><b></td>"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseName']); + $r .= "<td colspan=\"3\"><b><font size=\"+1\">". myentities($this->obj->name) ."</font><b></td>"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseReference']); - echo $this->showdata($this->obj->getRefLink(),3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseReference']); + $r .= $this->showdata($this->obj->getRefLink(),3); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseAddress']); - echo $this->showdata($this->obj->getAdrRefLink(),3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseAddress']); + $r .= $this->showdata($this->obj->getAdrRefLink(),3); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseCategory']); - echo $this->showdata($this->obj->getCategory()); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseCategory']); + $r .= $this->showdata($this->obj->getCategory()); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseReason']); - echo $this->showdata(myentities($this->obj->reason)); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseReason']); + $r .= $this->showdata(myentities($this->obj->reason)); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpensePeople']); - echo $this->showdata(myentities($this->obj->people)); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpensePeople']); + $r .= $this->showdata(myentities($this->obj->people)); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseGAmount']); - echo $this->showdata(number_format($this->obj->gamount,2,$lang['DecPoint'],$lang['ThousandPoint']) - ." ". myentities($this->obj->currency)); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseGAmount']); + $r .= $this->showdata(number_format($this->obj->gamount,2,$lang['DecPoint'],$lang['ThousandPoint']) + ." ". myentities($this->obj->currency)); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseITax']); - echo $this->showdata(number_format($this->obj->GetTax(),2,$lang['DecPoint'],$lang['ThousandPoint']) - ." ". myentities($this->obj->currency)); - echo $this->showdata("(". myentities($this->obj->itax) ." %)"); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseITax']); + $r .= $this->showdata(number_format($this->obj->GetTax(),2,$lang['DecPoint'],$lang['ThousandPoint']) + ." ". myentities($this->obj->currency)); + $r .= $this->showdata("(". myentities($this->obj->itax) ." %)"); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseDeduction']); - echo $this->showdata(number_format($this->obj->deduction,2,$lang['DecPoint'],$lang['ThousandPoint']) - ." ". myentities($this->obj->currency)); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseDeduction']); + $r .= $this->showdata(number_format($this->obj->deduction,2,$lang['DecPoint'],$lang['ThousandPoint']) + ." ". myentities($this->obj->currency)); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseNAmount']); - echo "<td colspan=\"3\"><b>". number_format($this->obj->getNetAmount(),2,$lang['DecPoint'],$lang['ThousandPoint']) - ." ". myentities($this->obj->currency) ."<b></td>"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseNAmount']); + $r .= "<td colspan=\"3\"><b>". number_format($this->obj->getNetAmount(),2,$lang['DecPoint'],$lang['ThousandPoint']) + ." ". myentities($this->obj->currency) ."<b></td>"; + $r .= "</tr>\n"; - if ( $this->obj->t_start->notime != 1 ) { - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseStartTime']); - echo "<td colspan=\"3\">". $this->obj->t_start->getDateTime() ."</td>"; - echo "</tr>\n"; - } + if ( $this->obj->t_start->notime != 1 ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseStartTime']); + $r .= "<td colspan=\"3\">". $this->obj->t_start->getDateTime() ."</td>"; + $r .= "</tr>\n"; + } - if ( $this->obj->t_end->notime != 1 ) { - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseEndTime']); - echo "<td colspan=\"3\">". $this->obj->t_end->getDateTime() ."</td>"; - echo "</tr>\n"; - } + if ( $this->obj->t_end->notime != 1 ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseEndTime']); + $r .= "<td colspan=\"3\">". $this->obj->t_end->getDateTime() ."</td>"; + $r .= "</tr>\n"; + } - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseMOP']); - echo $this->showdata($this->obj->getMOP()); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseMOP']); + $r .= $this->showdata($this->obj->getMOP()); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['City']); - echo $this->showdata(myentities($this->obj->city)); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['City']); + $r .= $this->showdata(myentities($this->obj->city)); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['Country']); - echo $this->showdata(myentities($lang['countrycde'][$this->obj->country] ." (". $this->obj->country .")")); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['Country']); + $r .= $this->showdata(myentities($lang['countrycde'][$this->obj->country] ." (". $this->obj->country .")")); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseCCentre']); - echo $this->showdata(myentities($this->obj->ccentre)); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseCCentre']); + $r .= $this->showdata(myentities($this->obj->ccentre)); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseDescription']); - echo " <td colspan=\"4\" class=\"pre\"><pre>". wordwrap(urlReplace($this->obj->description),80) ."</pre></td>"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseDescription']); + $r .= " <td colspan=\"4\" class=\"pre\"><pre>". wordwrap(urlReplace($this->obj->description),80) ."</pre></td>"; + $r .= "</tr>\n"; - if ( $this->obj->invoice != -1 ) { - echo "<tr>\n"; - echo $this->showfield($lang['Invoice']); - $i = getObject($this->dbconn,$this->obj->invoice); - echo $this->showdata(is_object($i) ? $i->getLink():''); - echo "</tr>\n"; - } + if ( $this->obj->invoice != -1 ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['Invoice']); + $i = getObject($this->dbconn,$this->obj->invoice); + $r .= $this->showdata(is_object($i) ? $i->getLink():''); + $r .= "</tr>\n"; + } - # - # Show additional custom fields - # - echo show_custom_fields($this,$this->obj->gettype(),$this->obj,4); - # References to modules - echo show_module_infolists($this->user,$this->obj,4); - echo $this->obj->getHistoryLink(4); + // Show additional custom fields + $r .= show_custom_fields($this,$this->obj->gettype(),$this->obj,4); + // References to modules + $r .= show_module_infolists($this->user,$this->obj,4); + $r .= $this->obj->getHistoryLink(4); - echo $this->DataTableEnd(); - } - /** - * navigation - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + $r .= $this->DataTableEnd(); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->name = $lang['ExpenseDetail']; - $this->obj = new expense($this->dbconn); - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - } - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['Expense']); - $this->stop = true; - return; - } else if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } - $this->obj->read_reference(); - $this->obj->read_adr_reference(); - $this->obj->read_relations(); + $this->name = $lang['ExpenseDetail']; + $this->obj = new expense($this->dbconn); + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + } + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['Expense']); + $this->stop = true; + return; + } else if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } + $this->obj->read_reference(); + $this->obj->read_adr_reference(); + $this->obj->read_relations(); - # menu - $m = expense::getSelectLink($this->user, $lang['Search']); - $m[category][] = "obj"; - $this->addmenu($m); + // menu + $m = expense::getSelectLink($this->user, $lang['Search']); + $m[category][] = "obj"; + $this->addmenu($m); - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - $x = array( url => $this->obj->getModURL(), - text => $lang['Modify'], - info => $lang['ExpenseMod'], - category => array("expense","mod","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelURL(), - text => $lang['Delete'], - info => $lang['ExpenseDelete'], - confirm => true, - category => array("expense","del","obj") - ); - $this->addMenu($x); - } + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $x = array( url => $this->obj->getModURL(), + text => $lang['Modify'], + info => $lang['ExpenseMod'], + category => array("expense","mod","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelURL(), + text => $lang['Delete'], + info => $lang['ExpenseDelete'], + confirm => true, + category => array("expense","del","obj") + ); + $this->addMenu($x); + } - add_module_addlinks($this,$this->obj); - # add this page to the browsehistory of the users session - $this->addtohistory(); - } + add_module_addlinks($this,$this->obj); + // add this page to the browsehistory of the users session + $this->addtohistory(); + } } $l = new Expense_show($current_user); @@ -220,6 +215,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: expense_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/expense/expense_overview.php,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- expense_overview.php 13 Mar 2009 20:00:40 -0000 1.14 +++ expense_overview.php 30 Mar 2009 15:48:06 -0000 1.15 @@ -25,435 +25,423 @@ * a overview of expenses */ class Expense_overview extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang; - + /** + * display the form + */ + Function info() { + global $tutos,$lang; - $n = $this->result->numrows(); + $r = ''; + $n = $this->result->numrows(); - if ( $this->format == "xml" ) { - $e = new expense($this->dbconn); - echo $e->exportXMLHeader(); - echo $e->exportXML_head(); - echo "<expense_set>\n"; - $x = 0; - while ( $x < $n ) { - $e = new expense($this->dbconn); - $e->read_result($this->result,$x); - echo $e->exportXML(false); - $x++; - } - echo "</expense_set>\n"; - $this->result->free(); - return; - } - if ( 0 == $n) { - echo $this->error($lang['Err0048']); - $this->result->free(); - return; - } + if ( $this->format == "xml" ) { + $e = new expense($this->dbconn); + $r .= $e->exportXMLHeader(); + $r .= $e->exportXML_head(); + $r .= "<expense_set>\n"; + $x = 0; + while ( $x < $n ) { + $e = new expense($this->dbconn); + $e->read_result($this->result,$x); + $r .= $e->exportXML(false); + $x++; + } + $r .= "</expense_set>\n"; + $this->result->free(); + return; + } + if ( 0 == $n) { + $r .= $this->error($lang['Err0048']); + $this->result->free(); + return; + } - # Reset the sum - $sum[''] = 0.0; - foreach($tutos[currencies] as $ia => $c) { - $sum[$c] = 0.0; - } + // Reset the sum + $sum[''] = 0.0; + foreach($tutos[currencies] as $c) { + $sum[$c] = 0.0; + } - $blist = array(); - # Make a big array of all visible expenses - $x = 0; - while ( $x < $n ) { - $b = new expense($this->dbconn); - $b->read_result($this->result,$x); - $x++; - if ( ! $b->see_ok() ) { - continue; - } - $sum[$b->currency] += $b->gamount; - $blist[] = &$b; - unset($b); - } - $n = count($blist); + $blist = array(); + // Make a big array of all visible expenses + $x = 0; + while ( $x < $n ) { + $b = new expense($this->dbconn); + $b->read_result($this->result,$x); + $x++; + if ( ! $b->see_ok() ) { + continue; + } + $sum[$b->currency] += $b->gamount; + $blist[] = &$b; + unset($b); + } + $n = count($blist); - $this->result->free(); + $this->result->free(); - echo $this->actionformStart("expense_overview.php"); - echo $this->OverviewTableStart(); - echo "<thead>\n"; - echo "<tr>\n"; - echo $this->orderHeader("name",$lang['ExpenseName'],$this->link2); - echo $this->orderHeader("link_id",$lang['ExpenseReference'],$this->link2); - echo $this->orderHeader("adr_id",$lang['ExpenseAddress'],$this->link2); - echo $this->orderHeader("",$lang['ExpenseGAmount'],$this->link2); - echo $this->orderHeader("category",$lang['ExpenseCategory'],$this->link2); - $this->flds = 5; - echo show_custom_overview_headers($this,'expense',$this->link2); - echo get_module_overview_header($this,'expense'); - if ( $tutos[massupdate] == 1 ) { - echo " <th nowrap><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\"></th>\n"; - $this->flds++; - } - echo "</tr>\n"; - echo "</thead>\n"; + $r .= $this->actionformStart("expense_overview.php"); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + $r .= $this->orderHeader("name",$lang['ExpenseName'],$this->link2); + $r .= $this->orderHeader("link_id",$lang['ExpenseReference'],$this->link2); + $r .= $this->orderHeader("adr_id",$lang['ExpenseAddress'],$this->link2); + $r .= $this->orderHeader("",$lang['ExpenseGAmount'],$this->link2); + $r .= $this->orderHeader("category",$lang['ExpenseCategory'],$this->link2); + $this->flds = 5; + $r .= show_custom_overview_headers($this,'expense',$this->link2); + $r .= get_module_overview_header($this,'expense'); + if ( $tutos[massupdate] == 1 ) { + $r .= " <th nowrap><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\"></th>\n"; + $this->flds++; + } + $r .= "</tr>\n"; + $r .= "</thead>\n"; - if ( $this->start == -1 ) { - # Show the last pasrt - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } + if ( $this->start == -1 ) { + // Show the last pasrt + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } - $this->filter['name'] = prepare_regpattern($this->filter['name']); - echo "<tbody>\n"; - $line = 1; - while ( ($a < $n) && ($a < $end) ) { - $b = &$blist[$a]; - $b->read_reference(); - $b->read_adr_reference(); + $this->filter['name'] = prepare_regpattern($this->filter['name']); + $r .= "<tbody>\n"; + $line = 1; + while ( ($a < $n) && ($a < $end) ) { + $b = &$blist[$a]; + $b->read_reference(); + $b->read_adr_reference(); - echo $this->OverviewRowStart($line); - $x = myentities($b->getFullName()); - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - echo " <td>". makelink($b->getUrl(),$x) ."</td>\n"; - echo " <td> ". $b->getRefLink() ."</td>\n"; - echo " <td> ". $b->getAdrRefLink() ."</td>\n"; - echo " <td> ". number_format($b->gamount,2,$lang['DecPoint'],$lang['ThousandPoint']) - ." ". myentities($b->currency) ."</td>\n"; - echo " <td> ". $b->getCategory() ."</td>\n"; - echo show_custom_overview_data($this,'expense',$b); - echo get_module_overview_data($this,$b); - if ( $tutos[massupdate] == 1 ) { - echo " <td align=\"center\">\n"; - if ( $b->mod_ok() ) { - echo "<input name=\"mark[]\" type=\"checkbox\" value=\"". $b->id ."\">\n"; - } else { - echo "-\n"; - } - echo "</td>\n"; - } - echo $this->OverviewRowEnd($line++); - unset($b); - $a++; - } - echo "</tbody>\n"; + $r .= $this->OverviewRowStart($line); + $x = myentities($b->getFullName()); + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + $r .= " <td>". makelink($b->getUrl(),$x) ."</td>\n"; + $r .= " <td> ". $b->getRefLink() ."</td>\n"; + $r .= " <td> ". $b->getAdrRefLink() ."</td>\n"; + $r .= " <td> ". number_format($b->gamount,2,$lang['DecPoint'],$lang['ThousandPoint']) + ." ". myentities($b->currency) ."</td>\n"; + $r .= " <td> ". $b->getCategory() ."</td>\n"; + $r .= show_custom_overview_data($this,'expense',$b); + $r .= get_module_overview_data($this,$b); + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $b->mod_ok() ) { + $r .= "<input name=\"mark[]\" type=\"checkbox\" value=\"". $b->id ."\">\n"; + } else { + $r .= "-\n"; + } + $r .= "</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + unset($b); + $a++; + } + $r .= "</tbody>\n"; - echo $this->list_navigation($this->link1,$this->flds,$this->start,$a,$n); + $r .= $this->list_navigation($this->link1,$this->flds,$this->start,$a,$n); - echo "<tr>\n"; - echo " <td colspan=\"3\"> </td>\n"; - echo " <td align=\"right\"><b>\n"; - foreach ($sum as $s => $x) { - #if ( ($s != 'v') && ($x != 0.0) ) { - if ( $x != 0.0 ) { - $z= array($x,$s); - echo handle('money',$z,number_format($sum[$s],2,$lang['DecPoint'],$lang['ThousandPoint']) ." ". myentities($s)) ."<br />\n"; - } else { - echo " "; - } - } - echo "</b></td>\n"; - echo " <td colspan=\"".($this->flds - 4)."\"> </td>\n"; - #$test = 5+$tutos[massupdate]; - #if ( $cols > $test ) { - # echo " <td colspan=\"". ( $cols - $test )."\"> </td>\n"; - #} - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= " <td colspan=\"3\"> </td>\n"; + $r .= " <td align=\"right\"><b>\n"; + foreach ($sum as $s => $x) { + if ( $x != 0.0 ) { + $z= array($x,$s); + $r .= handle('money',$z,number_format($sum[$s],2,$lang['DecPoint'],$lang['ThousandPoint']) ." ". myentities($s)) ."<br />\n"; + } else { + $r .= " "; + } + } + $r .= "</b></td>\n"; + $r .= " <td colspan=\"".($this->flds - 4)."\"> </td>\n"; + $r .= "</tr>\n"; - if ( $tutos[massupdate] == 1 ) { - echo $this->UpdateRowStart(4); - echo sprintf($lang['withmarked'],$lang['Expenses']); - echo "<select name=\"action\">\n"; - echo " <option value=\"-1\" selected>". $lang['ActionNil'] ."</option>\n"; - echo " <option value=\"-2\">". $lang['Delete'] ."</option>\n"; - echo " <option value=\"-4\">". $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - echo " <option value=\"WatchAdd\">". $lang['WatchAdd'] ."</option>\n"; - echo " <option value=\"WatchDel\">". $lang['WatchDel'] ."</option>\n"; - } - echo "</select>\n"; - echo $this->UpdateRowEnd($this->flds -4); - } - echo $this->OverviewTableEnd(); - echo $this->actionformEnd("expense_overview.php"); - } - /** - * naviagte - */ - Function navigate() { - } - /** - * action via massupdate - */ - Function action() { - global $lang,$msg; + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart(4); + $r .= sprintf($lang['withmarked'],$lang['Expenses']); + $r .= "<select name=\"action\">\n"; + $r .= " <option value=\"-1\" selected>". $lang['ActionNil'] ."</option>\n"; + $r .= " <option value=\"-2\">". $lang['Delete'] ."</option>\n"; + $r .= " <option value=\"-4\">". $lang['AclModify'] ."</option>\n"; + if (class_exists('watchlist')) { + $r .= watchlist::action_options(); + } + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd($this->flds -4); + } + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("expense_overview.php"); + return $r; + } + /** + * action via massupdate + */ + Function action() { + global $lang,$msg; - if ( $_GET['action'] == -2 ) { - $this->dbconn->Begin("WORK"); - foreach ($_GET['mark'] as $key => $val) { - $b = new expense($this->dbconn); - $b = $b->read($val,$b); - if ( $b->id != $val ) { - continue; - } - if ( $b->del_ok() ) { - $msg .= $lang['Delete'].":". $b->getFullName() ."<br />"; - $msg .= $b->delete(); - } else { - $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; - } - unset($b); - } - $this->dbconn->Commit("WORK"); - return; - } - if ( $_GET['action'] == -4 ) { - $this->redirect = "../". acl_action(); - return; - } - if (class_exists('watchlist')) { - watchlist::parse_action($this->user); - } - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + if ( $_GET['action'] == -2 ) { + $this->dbconn->Begin("WORK"); + foreach ($_GET['mark'] as $key => $val) { + $b = new expense($this->dbconn); + $b = $b->read($val,$b); + if ( $b->id != $val ) { + continue; + } + if ( $b->del_ok() ) { + $msg .= $lang['Delete'].":". $b->getFullName() ."<br />"; + $msg .= $b->delete(); + } else { + $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; + } + unset($b); + } + $this->dbconn->Commit("WORK"); + return; + } + if ( $_GET['action'] == -4 ) { + $this->redirect = "../". acl_action(); + return; + } + if (class_exists('watchlist')) { + watchlist::parse_action($this->user); + } + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->name = $lang['ExpensesOverview']; - $this->css_class = 'overviewbox'; + $this->name = $lang['ExpensesOverview']; + $this->css_class = 'overviewbox'; - if ( ! $this->user->feature_ok(useexpenses,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + if ( ! $this->user->feature_ok(useexpenses,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - $this->link1 = "expense/expense_overview.php"; - $this->filter = array(); + $this->link1 = "expense/expense_overview.php"; + $this->filter = array(); - $reftype = ""; - $name = ""; - $nsrn = ""; - $nscr = ""; + $reftype = ""; + $name = ""; + $nsrn = ""; + $nscr = ""; - if ( isset($_GET['reftype']) ) { - $reftype = $_GET['reftype']; - } - if ( isset($_GET['name']) ) { - $name = $_GET['name']; - } - if ( isset($_GET['nsrn']) ) { - $nsrn = $_GET['nsrn']; - } - if ( isset($_GET['nscr']) ) { - $nscr = $_GET['nscr']; - } + if ( isset($_GET['reftype']) ) { + $reftype = $_GET['reftype']; + } + if ( isset($_GET['name']) ) { + $name = $_GET['name']; + } + if ( isset($_GET['nsrn']) ) { + $nsrn = $_GET['nsrn']; + } + if ( isset($_GET['nscr']) ) { + $nscr = $_GET['nscr']; + } - $j = "SELECT DISTINCT e.* FROM ". $this->dbconn->prefix ."expenses e "; // select + join - $q = ""; - $pre = " WHERE "; + $j = "SELECT DISTINCT e.* FROM ". $this->dbconn->prefix ."expenses e "; // select + join + $q = ""; + $pre = " WHERE "; - if ( ($name != "*") && ($name != "") ) { - $q .= " " . $pre ."(". $this->dbconn->Like("e.name",$name) ." OR ". $this->dbconn->Like("e.name",$name) .")"; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"name=".UrlEncode($name)); - $this->filter['name'] = $name; - } else { - $this->filter['name'] = ""; - } + if ( ($name != "*") && ($name != "") ) { + $q .= " " . $pre ."(". $this->dbconn->Like("e.name",$name) ." OR ". $this->dbconn->Like("e.name",$name) .")"; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"name=".UrlEncode($name)); + $this->filter['name'] = $name; + } else { + $this->filter['name'] = ""; + } - if ( isset($_GET['id']) ) { - if (false == is_numeric($_GET['id'])) { - $msg .= sprintf($lang['Err0012'],"id",$_GET['id']); - $this->stop = true; - } - $q .= " ". $pre ." e.id = ".$_GET['id']; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"id=". $_GET['id']); - } + if ( isset($_GET['id']) ) { + if (false == is_numeric($_GET['id'])) { + $msg .= sprintf($lang['Err0012'],"id",$_GET['id']); + $this->stop = true; + } + $q .= " ". $pre ." e.id = ".$_GET['id']; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"id=". $_GET['id']); + } - if ( isset($_GET['link_id']) ) { - if (false == is_numeric($_GET['link_id'])) { - $msg .= sprintf($lang['Err0012'],"link_id",$_GET['link_id']); - $this->stop = true; - } - $q .= " ". $pre ." e.link_id = ".$_GET['link_id']; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); - } + if ( isset($_GET['link_id']) ) { + if (false == is_numeric($_GET['link_id'])) { + $msg .= sprintf($lang['Err0012'],"link_id",$_GET['link_id']); + $this->stop = true; + } + $q .= " ". $pre ." e.link_id = ".$_GET['link_id']; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); + } - if ( isset($_GET['currency']) ) { - $q .= " ". $pre ." e.currency = '".$_GET['currency']."'"; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"currency=". $_GET['currency']); - } + if ( isset($_GET['currency']) ) { + $q .= " ". $pre ." e.currency = '".$_GET['currency']."'"; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"currency=". $_GET['currency']); + } - # References to display - if ( ($reftype > 0) || ($reftype > 0 && ($nsrn != "*") && ($nsrn != "")) ) { - if ( ! isset($nsrn) || ($nsrn == "*") ) { - $nsrn = ""; - } - if ( ($reftype == 1) || ($reftype == -1) ) { - $j .= ", ". $this->dbconn->prefix ."companies c "; - $q .= " ". $pre . "(e.link_id=c.id "; - if ( $nsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("c.name",$nsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 2) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."departments d "; - $q .= " ". $pre . "(e.link_id=d.id "; - if ( $nsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("d.name",$nsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 3) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."addresses a "; - $q .= $pre ."( ("; - $q .= $this->dbconn->Like("a.f_name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("a.m_name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("a.l_name",$nsrn) .")"; - $q .= " AND e.link_id=a.id )"; - $pre = " OR "; - } - if ( ($reftype == 4) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."bugs b"; - $q .= " ". $pre . "(e.link_id=b.id "; - if ( $nsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("b.short",$nsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 5) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."products p"; - $q .= $pre ."( e.link_id=p.id "; - if ( $nsrn != "" ) { - $q .= " AND ("; - $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("p.version",$nsrn) .")"; - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 6) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."teams t"; - $q .= $pre . "(e.link_id=t.id AND ". $this->dbconn->Like("t.name",$nsrn) .")"; - $pre = " OR "; - } - if ( ($reftype == 7) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."tasks k"; - $q .= $pre . "(e.link_id=k.id AND ". $this->dbconn->Like("k.name",$nsrn) .")"; - $pre = " OR "; - } - if ( ($reftype == 8) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."installations i"; - if ( ! stristr($j, "products") ) { - $j .= ",". $this->dbconn->prefix ."products p"; - } - $q .= $pre ."( e.link_id=i.id AND i.product_id=p.id AND ("; - $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("p.version",$nsrn) .") )"; - $pre = " OR "; - } - $pre = "AND "; + // References to display + if ( ($reftype > 0) || ($reftype > 0 && ($nsrn != "*") && ($nsrn != "")) ) { + if ( ! isset($nsrn) || ($nsrn == "*") ) { + $nsrn = ""; + } + if ( ($reftype == 1) || ($reftype == -1) ) { + $j .= ", ". $this->dbconn->prefix ."companies c "; + $q .= " ". $pre . "(e.link_id=c.id "; + if ( $nsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("c.name",$nsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 2) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."departments d "; + $q .= " ". $pre . "(e.link_id=d.id "; + if ( $nsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("d.name",$nsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 3) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."addresses a "; + $q .= $pre ."( ("; + $q .= $this->dbconn->Like("a.f_name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("a.m_name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("a.l_name",$nsrn) .")"; + $q .= " AND e.link_id=a.id )"; + $pre = " OR "; + } + if ( ($reftype == 4) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."bugs b"; + $q .= " ". $pre . "(e.link_id=b.id "; + if ( $nsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("b.short",$nsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 5) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."products p"; + $q .= $pre ."( e.link_id=p.id "; + if ( $nsrn != "" ) { + $q .= " AND ("; + $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("p.version",$nsrn) .")"; + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 6) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."teams t"; + $q .= $pre . "(e.link_id=t.id AND ". $this->dbconn->Like("t.name",$nsrn) .")"; + $pre = " OR "; + } + if ( ($reftype == 7) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."tasks k"; + $q .= $pre . "(e.link_id=k.id AND ". $this->dbconn->Like("k.name",$nsrn) .")"; + $pre = " OR "; + } + if ( ($reftype == 8) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."installations i"; + if ( ! stristr($j, "products") ) { + $j .= ",". $this->dbconn->prefix ."products p"; + } + $q .= $pre ."( e.link_id=i.id AND i.product_id=p.id AND ("; + $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("p.version",$nsrn) .") )"; + $pre = " OR "; + } + $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"reftype=". $reftype); - $this->link1 = addUrlParameter($this->link1,"nsrn=". $nsrn); - # remember this - $_SESSION['expensesearchreftype'] = $reftype; - $this->filter['reftype'] = $reftype; - } - if ( ($nscr != "*") && ($nscr != "") ) { - $j .= ", addresses "; - $q .= $pre ."( ("; - $q .= $this->dbconn->Like("addresses.f_name",$nscr) ." OR "; - $q .= $this->dbconn->Like("addresses.m_name",$nscr) ." OR "; - $q .= $this->dbconn->Like("addresses.l_name",$nscr) .")"; - $q .= " AND e.creator=addresses.id )"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"nscr=".UrlEncode($nscr)); - $this->filter['nscr'] = $nscr; - } + $this->link1 = addUrlParameter($this->link1,"reftype=". $reftype); + $this->link1 = addUrlParameter($this->link1,"nsrn=". $nsrn); + // remember this + $_SESSION['expensesearchreftype'] = $reftype; + $this->filter['reftype'] = $reftype; + } + if ( ($nscr != "*") && ($nscr != "") ) { + $j .= ", addresses "; + $q .= $pre ."( ("; + $q .= $this->dbconn->Like("addresses.f_name",$nscr) ." OR "; + $q .= $this->dbconn->Like("addresses.m_name",$nscr) ." OR "; + $q .= $this->dbconn->Like("addresses.l_name",$nscr) .")"; + $q .= " AND e.creator=addresses.id )"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"nscr=".UrlEncode($nscr)); + $this->filter['nscr'] = $nscr; + } - # Start Date for search - $from = new TUTOS_Date_Time(0); - if ( isset($_GET['fd']) ) { - $from->setDateTime($_GET['fd']); - } else { - $from->setDateTimeF("f"); - # remember this -# session_register('expensesearchfrom'); - $_SESSION['expensesearchfrom'] = $from->getYYYYMMDD(); - } - if ( $from->notime != 1 ) { - $q .= $pre ."(e.creation >= ". $this->dbconn->Date($from) .")"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); - $this->filter['from'] = $from; - } - # End Date for search - $to = new TUTOS_Date_Time(0); - if ( isset($_GET['td']) ) { - $to->setDateTime($_GET['td']); - } else { - $to->setDateTimeF("t"); - # remember this -# session_register('expensesearchto'); - $_SESSION['expensesearchto'] = $to->getYYYYMMDD(); - } - if ( $to->notime != 1 ) { - $q .= $pre ."(e.creation <= ". $this->dbconn->Date($to) .")"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); - $this->filter['to'] = $to; - } + // Start Date for search + $from = new TUTOS_Date_Time(0); + if ( isset($_GET['fd']) ) { + $from->setDateTime($_GET['fd']); + } else { + $from->setDateTimeF("f"); + // remember this + $_SESSION['expensesearchfrom'] = $from->getYYYYMMDD(); + } + if ( $from->notime != 1 ) { + $q .= $pre ."(e.creation >= ". $this->dbconn->Date($from) .")"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); + $this->filter['from'] = $from; + } + // End Date for search + $to = new TUTOS_Date_Time(0); + if ( isset($_GET['td']) ) { + $to->setDateTime($_GET['td']); + } else { + $to->setDateTimeF("t"); + // remember this + $_SESSION['expensesearchto'] = $to->getYYYYMMDD(); + } + if ( $to->notime != 1 ) { + $q .= $pre ."(e.creation <= ". $this->dbconn->Date($to) .")"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); + $this->filter['to'] = $to; + } - $this->q = $j.$q; - check_dbacl($this->dbconn,$this->q, $this->user->id); + $this->q = $j.$q; + check_dbacl($this->dbconn,$this->q, $this->user->id); - # sorting - $xxx = ""; - $this->link2 = $this->link1; - order_parse($this->q,$this->link1,$xxx,$xxx,"e.creation DESC"); + // sorting + $xxx = ""; + $this->link2 = $this->link1; + order_parse($this->q,$this->link1,$xxx,$xxx,"e.creation DESC"); - if ($this->stop) { - return; - } - $this->result = $this->dbconn->Exec($this->q); - if ( 0 == $this->result->numrows()) { - $this->redirect = "expense_select.php?msg=". UrlEncode($lang['Err0048']); - $this->result->free(); - } + if ($this->stop) { + return; + } + $this->result = $this->dbconn->Exec($this->q); + if ( 0 == $this->result->numrows()) { + $this->redirect = "expense_select.php?msg=". UrlEncode($lang['Err0048']); + $this->result->free(); + } - # menu - $x = expense::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addMenu($x); - } - } + // menu + $x = expense::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addMenu($x); + } +} $l = new Expense_overview($current_user); $l->display(); $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: expense_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/expense/expense_new.php,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- expense_new.php 24 Mar 2009 16:01:40 -0000 1.16 +++ expense_new.php 30 Mar 2009 15:48:06 -0000 1.17 @@ -25,288 +25,282 @@ * change/modify a expense */ class Expense_new extends layout { - /** - * display the form - */ - Function info() { - global $lang,$tutos,$table,$current_user; + /** + * display the form + */ + Function info() { + global $lang,$tutos,$table,$current_user; - $this->width = 6; + $r = ''; + $this->width = 6; - echo "<form id=\"expensenew\" name=\"expensenew\" action=\"expense_ins.php\" method=\"post\">\n"; - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); + $r .= "<form id=\"expensenew\" name=\"expensenew\" action=\"expense_ins.php\" method=\"post\">\n"; + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); - if ( isset ($this->obj->id) && ( $this->obj->id != -1 ) ) { - $this->addhidden("id",$this->obj->id); - } + if ( isset ($this->obj->id) && ( $this->obj->id != -1 ) ) { + $this->addhidden("id",$this->obj->id); + } - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseReference'],1,"link_id"); - echo " <td colspan=\"5\">\n"; - if ($this->obj->id == -1) { - echo ($this->obj->ref != null ? $lang[$this->obj->ref->getType()]:'') ." ". $this->obj->getRefLink() ."\n"; - $this->addhidden("link_id",$this->obj->link_id); - } else { - echo " <select name=\"link_id\">\n"; - foreach ($this->obj->plist as $i => $f) { - echo " <option value=\"". $i ."\"". ($i == $this->obj->link_id ? " selected>* ":">") . $lang[$f->getType()] .": ". $f->getFullName() ."</option>\n"; - } - echo " </select>\n"; - } - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseReference'],1,"link_id"); + $r .= " <td colspan=\"5\">\n"; + if ($this->obj->id == -1) { + $r .= ($this->obj->ref != null ? $lang[$this->obj->ref->getType()]:'') ." ". $this->obj->getRefLink() ."\n"; + $this->addhidden("link_id",$this->obj->link_id); + } else { + $r .= " <select name=\"link_id\">\n"; + foreach ($this->obj->plist as $i => $f) { + $r .= " <option value=\"". $i ."\"". ($i == $this->obj->link_id ? " selected>* ":">") . $lang[$f->getType()] .": ". $f->getFullName() ."</option>\n"; + } + $r .= " </select>\n"; + } + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseAddress'],1,"adr_id"); - echo " <td colspan=\"5\">\n"; - if ($this->obj->id == -1) { - echo $lang[$current_user->getType()] ." ". $current_user->getLink() ."\n"; - $this->addhidden("adr_id",$current_user->id); - } else { - echo $lang[$this->obj->adr_ref->getType()] ." ". $this->obj->adr_ref->getLink() . "\n"; - $this->addhidden("adr_id",$this->obj->adr_ref->id); - } - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseAddress'],1,"adr_id"); + $r .= " <td colspan=\"5\">\n"; + if ($this->obj->id == -1) { + $r .= $lang[$current_user->getType()] ." ". $current_user->getLink() ."\n"; + $this->addhidden("adr_id",$current_user->id); + } else { + $r .= $lang[$this->obj->adr_ref->getType()] ." ". $this->obj->adr_ref->getLink() . "\n"; + $this->addhidden("adr_id",$this->obj->adr_ref->id); + } + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseName'],1,"name"); - echo " <td colspan=\"5\"><input id=\"name\" size=\"80\" maxlength=\"". $table['expense']['name'][size] ."\" name=\"name\" value=\"". myentities($this->obj->name) ."\"></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseName'],1,"name"); + $r .= " <td colspan=\"5\"><input id=\"name\" size=\"80\" maxlength=\"". $table['expense']['name'][size] ."\" name=\"name\" value=\"". myentities($this->obj->name) ."\"></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseCategory'],0,"category"); - echo " <td>\n"; - #echo $this->obj->Category_Select("category",$this->obj->category); - echo $this->obj->askCategory(); - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseCategory'],0,"category"); + $r .= " <td>\n"; +#$r .= $this->obj->Category_Select("category",$this->obj->category); + $r .= $this->obj->askCategory(); + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseReason'],0,"reason"); - echo " <td colspan=\"5\"><input id=\"reason\" size=\"80\" maxlength=\"". $table['expense']['reason'][size] ."\" name=\"reason\" value=\"". myentities($this->obj->reason) ."\"></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseReason'],0,"reason"); + $r .= " <td colspan=\"5\"><input id=\"reason\" size=\"80\" maxlength=\"". $table['expense']['reason'][size] ."\" name=\"reason\" value=\"". myentities($this->obj->reason) ."\"></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpensePeople'],0,"people"); - echo " <td colspan=\"5\"><textarea id=\"people\" rows=\"1\" cols=\"60\" name=\"people\">". $this->obj->people ."</textarea></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpensePeople'],0,"people"); + $r .= " <td colspan=\"5\"><textarea id=\"people\" rows=\"1\" cols=\"60\" name=\"people\">". $this->obj->people ."</textarea></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseGAmount'],1,"gamount"); - echo " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"gamount\" value=\"". number_format($this->obj->gamount,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\">\n"; - echo Currency_Select("currency",$this->obj->currency); - echo " </td>\n"; - echo $this->showfieldc($lang['ExpenseITax'],0,"itax"); - echo " <td>\n"; - echo TAX_select("itax",$this->obj->itax); - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseGAmount'],1,"gamount"); + $r .= " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"gamount\" value=\"". number_format($this->obj->gamount,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\">\n"; + $r .= Currency_Select("currency",$this->obj->currency); + $r .= " </td>\n"; + $r .= $this->showfieldc($lang['ExpenseITax'],0,"itax"); + $r .= " <td>\n"; + $r .= TAX_select("itax",$this->obj->itax); + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseDeduction'],0,"deduction"); - echo " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"deduction\" value=\"". number_format($this->obj->deduction,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\">\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseDeduction'],0,"deduction"); + $r .= " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"deduction\" value=\"". number_format($this->obj->deduction,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\">\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseStartTime'],1,"t_start"); - echo " <td colspan=\"2\">\n"; - echo $this->obj->t_start->EnterDateTime("t_start"); - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseStartTime'],1,"t_start"); + $r .= " <td colspan=\"2\">\n"; + $r .= $this->obj->t_start->EnterDateTime("t_start"); + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseEndTime'],0,"t_end"); - echo " <td colspan=\"2\">\n"; - #echo $this->obj->t_end->EnterDateTime("t_end"); - echo $this->obj->t_end->EnterDateTime("t_end",1,true); - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseEndTime'],0,"t_end"); + $r .= " <td colspan=\"2\">\n"; +#$r .= $this->obj->t_end->EnterDateTime("t_end"); + $r .= $this->obj->t_end->EnterDateTime("t_end",1,true); + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseMOP'],0,"mop"); - echo " <td>\n"; - #echo $this->obj->MOP_Select("mop",$this->obj->mop); - echo $this->obj->askMOP(); - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseMOP'],0,"mop"); + $r .= " <td>\n"; +#$r .= $this->obj->MOP_Select("mop",$this->obj->mop); + $r .= $this->obj->askMOP(); + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['City'],0,"city"); - echo " <td colspan=\"5\"><input id=\"city\" size=\"80\" maxlength=\"". $table['expense']['city'][size] ."\" name=\"city\" value=\"". myentities($this->obj->city) ."\"></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['City'],0,"city"); + $r .= " <td colspan=\"5\"><input id=\"city\" size=\"80\" maxlength=\"". $table['expense']['city'][size] ."\" name=\"city\" value=\"". myentities($this->obj->city) ."\"></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['Country'],0,"country"); - echo "<td colspan=\"5\">\n"; - echo SelectCntryCde("country", $this->obj->country); - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['Country'],0,"country"); + $r .= "<td colspan=\"5\">\n"; + $r .= SelectCntryCde("country", $this->obj->country); + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['ExpenseCCentre'],0,"ccentre"); - echo " <td colspan=\"5\"><input id=\"ccentre\" size=\"80\" maxlength=\"". $table['expense']['ccentre'][size] ."\" name=\"ccentre\" value=\"". myentities($this->obj->ccentre) ."\"></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['ExpenseCCentre'],0,"ccentre"); + $r .= " <td colspan=\"5\"><input id=\"ccentre\" size=\"80\" maxlength=\"". $table['expense']['ccentre'][size] ."\" name=\"ccentre\" value=\"". myentities($this->obj->ccentre) ."\"></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['ExpenseDescription'],0,"description"); - echo " <td colspan=\"5\"><textarea id=\"description\" rows=\"10\" cols=\"60\" name=\"description\">". $this->obj->description ."</textarea></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['ExpenseDescription'],0,"description"); + $r .= " <td colspan=\"5\"><textarea id=\"description\" rows=\"10\" cols=\"60\" name=\"description\">". $this->obj->description ."</textarea></td>\n"; + $r .= "</tr>\n"; - # - # Edit additional custom fields - # - echo edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); - # References to modules - echo module_addforms($this->user,$this->obj,6); + // Edit additional custom fields + $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); + // References to modules + $r .= module_addforms($this->user,$this->obj,6); - echo "<tr>\n"; - if ( isset($this->obj->id) && ($this->obj->id != -1) ) { - echo submit_reset(0,1,2,1,2,0); - } else { - echo submit_reset(0,-1,2,1,2,0); - } - echo "</tr>\n"; + $r .= "<tr>\n"; + if ( isset($this->obj->id) && ($this->obj->id != -1) ) { + $r .= submit_reset(0,1,2,1,2,0); + } else { + $r .= submit_reset(0,-1,2,1,2,0); + } + $r .= "</tr>\n"; - echo $this->DataTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo "</form>\n"; - echo $this->setfocus("expensenew.name"); - echo $lang['FldsRequired'] ."\n"; - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; + $r .= $this->setfocus("expensenew.name"); + $r .= $lang['FldsRequired'] ."\n"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->obj = new expense($this->dbconn); - if ( isset($_GET['id']) ){ - $this->obj = $this->obj->read($_GET['id'],$this->obj); - $this->name = $lang['ExpenseMod']; - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['expense']); - $this->stop = true ; - return; - } - } else { - $this->name = $lang['ExpenseCreation']; - if ( !$this->user->feature_ok(useexpenses,PERM_NEW) ) { - $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } - } - if ( isset($_GET['link_id']) ){ - $this->obj->link_id = $_GET['link_id']; - } - if ( isset($_GET['adr_id']) ){ - $this->obj->adr_id = $_GET['adr_id']; - } - if ( isset($_GET['invoice']) ){ - $this->obj->invoice = $_GET['invoice']; - } - if ( isset($_GET['gamount']) ){ - $this->obj->gamount = $_GET['gamount']; - } - if ( isset($_GET['deduction']) ){ - $this->obj->deduction = $_GET['deduction']; - } - if ( isset($_GET['itax']) ){ - $this->obj->itax = $_GET['itax']; - } - if ( isset($_GET['description']) ){ - $this->obj->description = StripSlashes($_GET['description']); - } - if ( isset($_GET['name']) ){ - $this->obj->name = StripSlashes($_GET['name']); - } - if ( isset($_GET['category']) ){ - $this->obj->category = $_GET['category']; - } - if ( isset($_GET['reason']) ){ - $this... [truncated message content] |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:19
|
Update of /cvsroot/tutos/tutos/php/note In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/note Modified Files: note_select.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: note_select.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/note/note_select.php,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- note_select.php 27 Feb 2009 15:52:07 -0000 1.20 +++ note_select.php 30 Mar 2009 15:48:06 -0000 1.21 @@ -8,168 +8,165 @@ * Free Software Foundation; version 2 of the License. * */ - $tutos['base'] = "../.."; - ini_set("include_path",".."); - include_once 'webelements.p3'; - include_once 'permission.p3'; +$tutos['base'] = "../.."; +ini_set("include_path",".."); +require_once 'webelements.p3'; +require_once 'permission.p3'; - /* Check if user is allowed to use it */ - check_user(); - loadmodules('note','select'); - loadmodule('note'); - loadlayout(); +// Check if user is allowed to use it +check_user(); +loadmodules('note','select'); +loadmodule('note'); +loadlayout(); - /** - * select notes - */ - class note_select extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang; +/** + * select notes + */ +class note_select extends layout { + /** + * display the form + */ + Function info() { + global $tutos,$lang; - echo "<form id=\"notesearch\" name=\"notesearch\" method=\"get\" action=\"note_overview.php\">\n"; - if ( $this->ext == false ) { - $this->addHidden("reftype",0); - } - echo DoubleTableStart(); + $r = ''; + $r .= "<form id=\"notesearch\" name=\"notesearch\" method=\"get\" action=\"note_overview.php\">\n"; + if ( $this->ext == false ) { + $this->addHidden("reftype",0); + } + $r .= DoubleTableStart(); - echo "<tr>\n"; - if ( $this->ext == false ) { - echo "<th colspan=\"3\">". $lang['SearchForNote'] ."</th>\n"; + $r .= "<tr>\n"; + if ( $this->ext == false ) { + $r .= "<th colspan=\"3\">". $lang['SearchForNote'] ."</th>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['NoteName']); - echo " <td align=\"center\"> <input type=\"text\" value=\"\" name=\"name\" /></td>\n"; - echo " <td align=\"center\">\n"; - echo " <input type=\"submit\" value=\"". $lang['Search'] ."\" /></td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\" align=\"center\"><font size=\"-1\">". $lang['NoteSelInfo'] ."</font></td>\n"; - echo " <td align=\"center\">". makelink("note/note_select.php?ext=1",$lang['extended']) ."</td>\n"; - } else { - echo "<th colspan=\"3\">". $lang['SearchForNoteExt'] ."</th>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['NoteName']); + $r .= " <td align=\"center\"> <input type=\"text\" value=\"\" name=\"name\" /></td>\n"; + $r .= " <td align=\"center\">\n"; + $r .= " <input type=\"submit\" value=\"". $lang['Search'] ."\" /></td>\n"; + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\" align=\"center\"><font size=\"-1\">". $lang['NoteSelInfo'] ."</font></td>\n"; + $r .= " <td align=\"center\">". makelink("note/note_select.php?ext=1",$lang['extended']) ."</td>\n"; + } else { + $r .= "<th colspan=\"3\">". $lang['SearchForNoteExt'] ."</th>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['NoteName']); - echo " <td> <input type=\"text\" value=\"\" name=\"name\" />"; - echo " </td>\n"; - echo " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\" /></td>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['NoteName']); + $r .= " <td> <input type=\"text\" value=\"\" name=\"name\" />"; + $r .= " </td>\n"; + $r .= " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\" /></td>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['NoteRefType']); - echo " <td colspan=\"2\"> <b>". $this->NoteAskRefType($this->nsrt,0) ."</b> </td>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['NoteRefType']); + $r .= " <td colspan=\"2\"> <b>". $this->NoteAskRefType($this->nsrt,0) ."</b> </td>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['NoteRefName']); - echo " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nsrn\" /> </td>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['NoteRefName']); + $r .= " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nsrn\" /> </td>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['NoteCreator']); - echo " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nscr\" /> </td>\n"; - echo "</tr><tr>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['NoteCreator']); + $r .= " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nscr\" /> </td>\n"; + $r .= "</tr><tr>\n"; - echo " <td rowspan=\"2\" class=\"desc\">". $lang['NoteBetween'] ."</td>\n"; - echo " <td colspan=\"2\"> "; - echo $this->nsfd->EnterDate("f",1); - echo " </td>\n"; + $r .= " <td rowspan=\"2\" class=\"desc\">". $lang['NoteBetween'] ."</td>\n"; + $r .= " <td colspan=\"2\"> "; + $r .= $this->nsfd->EnterDate("f",1); + $r .= " </td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\"> "; - echo $this->nstd->EnterDate("t",1); - echo " </td>\n"; - } + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\"> "; + $r .= $this->nstd->EnterDate("t",1); + $r .= " </td>\n"; + } - echo "</tr>\n"; + $r .= "</tr>\n"; - echo DoubleTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo "</form>\n"; - echo $this->setfocus("notesearch.name"); - } - /** - */ - function NoteAskRefType ($default,$any) { - global $lang; + $r .= DoubleTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; + $r .= $this->setfocus("notesearch.name"); + return $r; + } + /** + */ + function NoteAskRefType ($default,$any) { + global $lang; - $r = "<select name=\"reftype\">"; - foreach ($lang['NoteReferences'] as $i => $f ) { - $r .= "<option value=\"". $i ."\" "; - if ( $i == $default ) { - $r .= " selected "; - } - $r .= ">". $f ."</option>\n"; - } - if ( $any > 0 ) { - $r .= "<option value=\"-1\""; - if ( -1 == $default ) { - $r .= " selected "; - } - $r .= ">". $lang['any'] ."</option>"; - } - $r .= "\n</select>"; - return $r; - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + $r = "<select name=\"reftype\">"; + foreach ($lang['NoteReferences'] as $i => $f ) { + $r .= "<option value=\"". $i ."\" "; + if ( $i == $default ) { + $r .= " selected "; + } + $r .= ">". $f ."</option>\n"; + } + if ( $any > 0 ) { + $r .= "<option value=\"-1\""; + if ( -1 == $default ) { + $r .= " selected "; + } + $r .= ">". $lang['any'] ."</option>"; + } + $r .= "\n</select>"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->name = $lang['NoteSearch']; - $this->center = true; - $this->css_class = 'selectbox'; + $this->name = $lang['NoteSearch']; + $this->center = true; + $this->css_class = 'selectbox'; - if ( ! $this->user->feature_ok(usenotes,PERM_SEL) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + if ( ! $this->user->feature_ok(usenotes,PERM_SEL) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - # Defaults for search - $this->nsfd = new TUTOS_Date_Time(0); - $this->nstd = new TUTOS_Date_Time(0); - $this->nsrt = -1; + // Defaults for search + $this->nsfd = new TUTOS_Date_Time(0); + $this->nstd = new TUTOS_Date_Time(0); + $this->nsrt = -1; - if ( isset($_SESSION['notesearchfrom']) ) { - $this->nsfd->setDateTime($_SESSION['notesearchfrom']); - } - if ( isset($_SESSION['notesearchto']) ) { - $this->nstd->setDateTime($_SESSION['notesearchto']); - } - if ( isset($_SESSION['notesearchreftype']) ) { - $this->nsrt = $_SESSION['notesearchreftype']; - } - if ( ! isset($_GET['ext']) ) { - $this->ext = 0; - } else { - $this->ext = $_GET['ext']; - } + if ( isset($_SESSION['notesearchfrom']) ) { + $this->nsfd->setDateTime($_SESSION['notesearchfrom']); + } + if ( isset($_SESSION['notesearchto']) ) { + $this->nstd->setDateTime($_SESSION['notesearchto']); + } + if ( isset($_SESSION['notesearchreftype']) ) { + $this->nsrt = $_SESSION['notesearchreftype']; + } + if ( ! isset($_GET['ext']) ) { + $this->ext = 0; + } else { + $this->ext = $_GET['ext']; + } - $lang['NoteReferences'][1] = &$lang['Company']; - $lang['NoteReferences'][2] = &$lang['Department']; - $lang['NoteReferences'][3] = &$lang['Address']; - $lang['NoteReferences'][4] = &$lang['Bug']; - $lang['NoteReferences'][5] = &$lang['ProductP']; - $lang['NoteReferences'][6] = &$lang['Team']; - $lang['NoteReferences'][7] = &$lang['Task']; + $lang['NoteReferences'][1] = &$lang['Company']; + $lang['NoteReferences'][2] = &$lang['Department']; + $lang['NoteReferences'][3] = &$lang['Address']; + $lang['NoteReferences'][4] = &$lang['Bug']; + $lang['NoteReferences'][5] = &$lang['ProductP']; + $lang['NoteReferences'][6] = &$lang['Team']; + $lang['NoteReferences'][7] = &$lang['Task']; # $lang['NoteReferences'][8] = &$lang['Installation']; # $lang['NoteReferences'][9] = &$lang['Checklist']; - } - } + } +} - $l = new note_select($current_user); - $l->display(); - $dbconn->Close(); +$l = new note_select($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:17
|
Update of /cvsroot/tutos/tutos/php/resource In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/resource Modified Files: resource_ins.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: resource_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/resource/resource_ins.php,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- resource_ins.php 16 Feb 2009 20:03:57 -0000 1.11 +++ resource_ins.php 30 Mar 2009 15:48:06 -0000 1.12 @@ -59,13 +59,7 @@ $gotourl = $b->getURL(); } - $gotourl = addMessage($gotourl,$msg,true); - $gotourl = addSessionKey($gotourl,true); - - - Header("Status: 302 Moved Temporarily"); - Header("Location: ". dirname(getBaseUrl()) ."/". $gotourl); - $dbconn->Close(); +leave_insert($dbconn,$gotourl,$msg); /* * CVS Info: $Id$ * $Author$ |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:16
|
Update of /cvsroot/tutos/tutos/php/invoice In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/invoice Modified Files: invoice.pinc invoice_ins.php invoice_new.php invoice_overview.php invoice_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: invoice_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/invoice/invoice_show.php,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- invoice_show.php 5 Mar 2009 19:07:43 -0000 1.41 +++ invoice_show.php 30 Mar 2009 15:48:06 -0000 1.42 @@ -30,244 +30,239 @@ include_once $tutos['base'] ."/". $tutos[fpdfpath].'/fpdf.php'; } - /* --------------------------------------------------------------------------- - * - */ - Function show_invpos(&$f) { - global $lang; +/* --------------------------------------------------------------------------- + * + */ +Function show_invpos(&$f) { + global $lang; - $f->read_ref(); - echo "<tr>\n"; - if ( is_object($f->ref) ) { - echo ' <td align="right" valign="top">'. $f->ref->getLink(sprintf("%04d",$f->pos)) ."</td>"; - } else { - echo ' <td align="right" valign="top">'. sprintf("%04d",$f->pos) ."</td>"; - } - echo ' <td align="right" valign="top">'. number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </td>"; - echo ' <td align="right" valign="top">'. $f->itype ." </td>"; - echo ' <td valign="top"><pre>'. myentities($f->description) ."</pre></td>"; - echo ' <td align="right" valign="top">'. number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - echo ' <td align="right" valign="top">'. number_format($f->tax ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - echo ' <td align="right" valign="top">'. number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - echo ' <td align="left" valign="top"> '. $f->currency ."</td>"; - echo "</tr>\n"; - } + $r = ''; + $f->read_ref(); + $r .= "<tr>\n"; + if ( is_object($f->ref) ) { + $r .= ' <td align="right" valign="top">'. $f->ref->getLink(sprintf("%04d",$f->pos)) ."</td>"; + } else { + $r .= ' <td align="right" valign="top">'. sprintf("%04d",$f->pos) ."</td>"; + } + $r .= ' <td align="right" valign="top">'. number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </td>"; + $r .= ' <td align="right" valign="top">'. $f->itype ." </td>"; + $r .= ' <td valign="top"><pre>'. myentities($f->description) ."</pre></td>"; + $r .= ' <td align="right" valign="top">'. number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + $r .= ' <td align="right" valign="top">'. number_format($f->tax ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + $r .= ' <td align="right" valign="top">'. number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + $r .= ' <td align="left" valign="top"> '. $f->currency ."</td>"; + $r .= "</tr>\n"; + return $r; +} - /** - * display a invoice - */ - class invoice_show extends layout { - /** - * the data display part - */ - Function info() { - global $tutos,$lang; +/** + * display a invoice + */ +class invoice_show extends layout { + /** + * the data display part + */ + Function info() { + global $tutos,$lang; - if ( $this->format == "pdf" ) { - $data = $this->obj->getPDF(); - Header("Content-Type: application/pdf"); - if(headers_sent()) - Fatal_Error('Some data has already been output to browser, can\'t send PDF file'); - Header('Content-Disposition: inline; filename="'. $this->obj->name .'.pdf"'); - Header('Content-Description: Upload from TUTOS' ); - Header('Content-Length: '.strlen($data)); - echo $data; - return; - } else if ( $this->format == "xml" ) { - $r = $this->obj->exportXML(); - echo $this->obj->exportXMLHeader(strlen($r)); - echo $r; - return; - } - echo $this->DataTableStart(); - echo "<tr>\n"; - echo ' <th colspan="7">'. sprintf($lang['Showing'],$lang[$this->obj->getType()]) ."</th>\n"; - echo $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); - echo "</tr>\n"; + $r = '';; + if ( $this->format == "pdf" ) { + $data = $this->obj->getPDF(); + Header("Content-Type: application/pdf"); + if(headers_sent()) + Fatal_Error('Some data has already been output to browser, can\'t send PDF file'); + Header('Content-Disposition: inline; filename="'. $this->obj->name .'.pdf"'); + Header('Content-Description: Upload from TUTOS' ); + Header('Content-Length: '.strlen($data)); + return $data; + } else if ( $this->format == "xml" ) { + $r = $this->obj->exportXML(); + $this->obj->exportXMLHeader(strlen($r)); + return $r; + } + $r .= $this->DataTableStart(); + $r .= "<tr>\n"; + $r .= ' <th colspan="7">'. sprintf($lang['Showing'],$lang[$this->obj->getType()]) ."</th>\n"; + $r .= $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); + $r .= "</tr>\n"; - echo $this->CreatorInfoLine($this->obj,8); + $r .= $this->CreatorInfoLine($this->obj,8); - echo "<tr>\n"; - echo $this->showfieldc($lang['Accountant']); - if ( $this->obj->acc->getType() == "location" ) { - echo "<td colspan=\"7\">". $this->obj->acc->company->getLink() ."</td>\n"; - } else { - echo "<td colspan=\"7\">". $this->obj->acc->getLink() ."</td>\n"; - } - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['Accountant']); + if ( $this->obj->acc->getType() == "location" ) { + $r .= "<td colspan=\"7\">". $this->obj->acc->company->getLink() ."</td>\n"; + } else { + $r .= "<td colspan=\"7\">". $this->obj->acc->getLink() ."</td>\n"; + } + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InvoiceName']); - echo $this->showdata(myentities($this->obj->name),3); - echo $this->showfieldc($lang['InvoiceState']); - echo $this->showdata($this->obj->getState(),3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvoiceName']); + $r .= $this->showdata(myentities($this->obj->name),3); + $r .= $this->showfieldc($lang['InvoiceState']); + $r .= $this->showdata($this->obj->getState(),3); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InvoiceCustomer']); - if (is_object($this->obj->customer) ) { - echo $this->showdata($this->obj->customer->getLink(),7); - } else { - echo $this->showdata($lang['HistoryDeleted'],7); - } - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvoiceCustomer']); + if (is_object($this->obj->customer) ) { + $r .= $this->showdata($this->obj->customer->getLink(),7); + } else { + $r .= $this->showdata($lang['HistoryDeleted'],7); + } + $r .= "</tr>\n"; - if ( is_object($this->obj->ref) ) { - echo "<tr>\n"; - echo $this->showfieldc($lang[$this->obj->ref->getType()],0); - echo $this->showdata($this->obj->ref->getLink(),7); - echo "</tr>\n"; - } + if ( is_object($this->obj->ref) ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang[$this->obj->ref->getType()],0); + $r .= $this->showdata($this->obj->ref->getLink(),7); + $r .= "</tr>\n"; + } - if ( ($this->obj->datesent[0]->notime != 1) or ($this->obj->datedue[0]->notime != 1) ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['InvDateSent'][0]); - echo $this->showdata($this->obj->datesent[0]->getDate(),3); - echo $this->showfieldc($lang['InvDateDue'][0]); - echo $this->showdata($this->obj->datedue[0]->getDate(),3); - echo "</tr>\n"; - } + if ( ($this->obj->datesent[0]->notime != 1) or ($this->obj->datedue[0]->notime != 1) ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvDateSent'][0]); + $r .= $this->showdata($this->obj->datesent[0]->getDate(),3); + $r .= $this->showfieldc($lang['InvDateDue'][0]); + $r .= $this->showdata($this->obj->datedue[0]->getDate(),3); + $r .= "</tr>\n"; + } - if ( $this->obj->datesent[1]->notime != 1 ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['InvDateSent'][1]); - echo $this->showdata($this->obj->datesent[1]->getDate(),3); - echo $this->showfieldc($lang['InvDateDue'][1]); - echo $this->showdata($this->obj->datedue[1]->getDate(),3); - echo "</tr>\n"; - } + if ( $this->obj->datesent[1]->notime != 1 ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvDateSent'][1]); + $r .= $this->showdata($this->obj->datesent[1]->getDate(),3); + $r .= $this->showfieldc($lang['InvDateDue'][1]); + $r .= $this->showdata($this->obj->datedue[1]->getDate(),3); + $r .= "</tr>\n"; + } - if ( $this->obj->datesent[2]->notime != 1 ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['InvDateSent'][2]); - echo $this->showdata($this->obj->datesent[2]->getDate(),3); - echo $this->showfieldc($lang['InvDateDue'][2]); - echo $this->showdata($this->obj->datedue[2]->getDate(),3); - echo "</tr>\n"; - } - if ( $this->obj->state == INV_STATE_PAYED ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['InvDatePayed']); - echo $this->showdata($this->obj->datefinish->getDate(),7); - echo "</tr>\n"; - } - if ( $this->obj->state == INV_STATE_CANCELLED ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['InvDateCancel']); - echo $this->showdata($this->obj->datefinish->getDate(),7); - echo "</tr>\n"; - } + if ( $this->obj->datesent[2]->notime != 1 ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvDateSent'][2]); + $r .= $this->showdata($this->obj->datesent[2]->getDate(),3); + $r .= $this->showfieldc($lang['InvDateDue'][2]); + $r .= $this->showdata($this->obj->datedue[2]->getDate(),3); + $r .= "</tr>\n"; + } + if ( $this->obj->state == INV_STATE_PAYED ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvDatePayed']); + $r .= $this->showdata($this->obj->datefinish->getDate(),7); + $r .= "</tr>\n"; + } + if ( $this->obj->state == INV_STATE_CANCELLED ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvDateCancel']); + $r .= $this->showdata($this->obj->datefinish->getDate(),7); + $r .= "</tr>\n"; + } - echo "<tr>\n"; - echo "<th>". $lang['InvPosPos'] ."</th>\n"; - echo "<th>". $lang['InvPosItems'] ."</th>\n"; - echo "<th>". $lang['InvPosIType'] ."</th>\n"; - echo "<th>". $lang['InvPosDesc'] ."</th>\n"; - echo "<th>". $lang['InvPosSingle'] ."</th>\n"; - echo "<th>". $lang['InvPosTax'] ."</th>\n"; - echo "<th>". $lang['InvPosSum'] ."</th>\n"; - echo "<th>". $lang['Currency'] ."</th>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= "<th>". $lang['InvPosPos'] ."</th>\n"; + $r .= "<th>". $lang['InvPosItems'] ."</th>\n"; + $r .= "<th>". $lang['InvPosIType'] ."</th>\n"; + $r .= "<th>". $lang['InvPosDesc'] ."</th>\n"; + $r .= "<th>". $lang['InvPosSingle'] ."</th>\n"; + $r .= "<th>". $lang['InvPosTax'] ."</th>\n"; + $r .= "<th>". $lang['InvPosSum'] ."</th>\n"; + $r .= "<th>". $lang['Currency'] ."</th>\n"; + $r .= "</tr>\n"; - if ( count($this->obj->pos) == 0 ) { - echo "<tr>\n"; - echo " <td colspan=\"8\" class=\"warn\">".$lang['Err0048']."</td>\n"; - echo "</tr>\n"; - } - $sum = $this->obj->getTotal(); - foreach ($this->obj->pos as $f) { - show_invpos($f); - unset($f); - } - echo "<tr>"; - echo " <td colspan=\"6\"> </td>\n"; - echo " <td colspan=\"2\" align=\"right\"> <b>"; - $pre = ''; - foreach($sum as $cur => $val) { - if ( $val != 0 ) { - $x = array($val,$cur); - echo $pre . handle('money',$x,number_format($val,2,$lang['DecPoint'],$lang['ThousandPoint']) ." ". $cur); - $pre = "<br />\n"; - } - } - echo "</b></td>\n"; - echo "</tr>\n"; + if ( count($this->obj->pos) == 0 ) { + $r .= "<tr>\n"; + $r .= " <td colspan=\"8\" class=\"warn\">".$lang['Err0048']."</td>\n"; + $r .= "</tr>\n"; + } + $sum = $this->obj->getTotal(); + foreach ($this->obj->pos as $f) { + $r .= show_invpos($f); + unset($f); + } + $r .= "<tr>"; + $r .= " <td colspan=\"6\"> </td>\n"; + $r .= " <td colspan=\"2\" align=\"right\"> <b>"; + $pre = ''; + foreach($sum as $cur => $val) { + if ( $val != 0 ) { + $x = array($val,$cur); + $r .= $pre . handle('money',$x,number_format($val,2,$lang['DecPoint'],$lang['ThousandPoint']) ." ". $cur); + $pre = "<br />\n"; + } + } + $r .= "</b></td>\n"; + $r .= "</tr>\n"; - # - # Show additional custom fields - # - echo show_custom_fields($this,$this->obj->gettype(),$this->obj,8); - # References to modules - echo show_module_infolists($this->user,$this->obj,8,$this->format); - echo $this->obj->getHistoryLink(8); - echo $this->DataTableEnd(); - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang, $tutos; + // Show additional custom fields + $r .= show_custom_fields($this,$this->obj->gettype(),$this->obj,8); + // References to modules + $r .= show_module_infolists($this->user,$this->obj,8,$this->format); + $r .= $this->obj->getHistoryLink(8); + $r .= $this->DataTableEnd(); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang, $tutos; - $this->name = $lang['Invoice']; - $this->obj = new invoice($this->dbconn); - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - } - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['Invoice']); - $this->stop = true; - $this->format = "html"; - return; - } else if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } else if ( $this->obj->id < 0 ) { - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } else { - $this->name .= ": ". $this->obj->getFullName(); - $this->obj->read_pos(); - $this->obj->read_ref(); - } - # menu - $m = invoice::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addmenu($m); - add_module_addlinks($this,$this->obj); + $this->name = $lang['Invoice']; + $this->obj = new invoice($this->dbconn); + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + } + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['Invoice']); + $this->stop = true; + $this->format = "html"; + return; + } else if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } else if ( $this->obj->id < 0 ) { + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } else { + $this->name .= ": ". $this->obj->getFullName(); + $this->obj->read_pos(); + $this->obj->read_ref(); + } + // menu + $m = invoice::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addmenu($m); + add_module_addlinks($this,$this->obj); - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - $x = array( url => "invoice/invoice_new.php?id=". $this->obj->id, - text => $lang['Modify'], - info => sprintf($lang['InvModInfo'],$this->obj->getFullname()), - category => array("invoice","mod","obj") - ); - $this->addMenu($x); - } + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $x = array( url => "invoice/invoice_new.php?id=". $this->obj->id, + text => $lang['Modify'], + info => sprintf($lang['InvModInfo'],$this->obj->getFullname()), + category => array("invoice","mod","obj") + ); + $this->addMenu($x); + } - if ( ($this->obj->id > 0) && $this->obj->see_ok() && class_exists( 'fpdf') ) { - $x = array( url => $this->obj->getUrl() ."&format=pdf", - text => $lang['InvDocument'], - info => $lang['InvDocumentI'], - category => array("invoice","show","obj") - ); - $this->addMenu($x); - } + if ( ($this->obj->id > 0) && $this->obj->see_ok() && class_exists( 'fpdf') ) { + $x = array( url => $this->obj->getUrl() ."&format=pdf", + text => $lang['InvDocument'], + info => $lang['InvDocumentI'], + category => array("invoice","show","obj") + ); + $this->addMenu($x); + } - # add this page to the browsehistory of the users session - $this->addtohistory(); - } - } + // add this page to the browsehistory of the users session + $this->addtohistory(); + } +} - $l = new invoice_show($current_user); - $l->display(); - $dbconn->Close(); -?> +$l = new invoice_show($current_user); +$l->display(); +$dbconn->Close(); +?> \ No newline at end of file Index: invoice_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/invoice/invoice_new.php,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- invoice_new.php 5 Mar 2009 19:07:43 -0000 1.60 +++ invoice_new.php 30 Mar 2009 15:48:06 -0000 1.61 @@ -17,7 +17,7 @@ require_once 'webelements.p3'; require_once 'permission.p3'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('invoice','new'); loadmodule('invoice'); @@ -26,481 +26,487 @@ /* --------------------------------------------------------------------------- * */ - Function show_invpos(&$f,&$obj) { - global $lang; +Function show_invpos(&$f,&$obj) { + global $lang; - echo "<tr>\n"; - if ( $f->id != -1 ) { - # EXISTING - if ( is_object($f->ref) ) { - echo ' <td valign="top"><label for="del_'. $f->id .'">'. $f->ref->getLink(sprintf("%04d",$f->pos)) ."</label></td>"; - } else { - echo ' <td valign="top"><label for="del_'. $f->id .'">'. sprintf("%04d",$f->pos) ."</label></td>"; - } - if ( $obj->change_ok() ) { - echo ' <td valign="top"><input name="I-'. $f->id .'" size="4" value="'. $f->items ."\" /></td>\n"; - } else { - echo ' <td align="right" valign="top">'. number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </td>"; - } - echo ' <td valign="top">'. $f->itype .'</td>'; - if ( $obj->change_ok() ) { - echo ' <td valign="top"><textarea name="D-'. $f->id .'" rows="3" cols="20">'. myentities($f->description) .'</textarea></td>'; - echo ' <td valign="top"><input name="S-'. $f->id .'" type="text" size="6" value="'. $f->sum_single ."\" /></td>\n"; - echo ' <td valign="top">'; - echo TAX_select("T-".$f->id,$f->tax); - echo ' </td>'; - } else { - echo " <td valign=\"top\"><pre>". $f->description ."</pre></td>"; - echo " <td align=\"right\" valign=\"top\">". number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - echo " <td align=\"right\" valign=\"top\">". number_format($f->tax ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - } - echo " <td align=\"right\" valign=\"top\">". number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - if ( $obj->change_ok() ) { - echo " <td align=\"left\" valign=\"top\">\n"; - echo Currency_Select("C-".$f->id ,$f->currency); - echo "</td>"; - echo ' <td align="center" valign="top"><input type="checkbox" id="del_'. $f->id .'" name="del[]" value="'. $f->id ."\" /></td>\n"; - } else { - echo " <td align=\"left\" valign=\"top\">". $f->currency ."</td>\n"; - echo " <td align=\"center\" valign=\"top\"> </td>\n"; - } - } else { - # NEW - echo " <td valign=\"top\"><label for=\"add_". $f->ref_id ."\">". $f->ref->getLink() ."</label></td>"; - echo " <td align=\"right\" valign=\"top\">". number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </td>"; - echo " <td align=\"right\" valign=\"top\">". $f->itype ." </td>"; - echo " <td valign=\"top\"><pre>". myentities($f->description) ."</pre></td>"; - echo " <td align=\"right\" valign=\"top\">". number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - echo " <td align=\"right\" valign=\"top\">".($f->tax > 0 ? $f->tax."%":"") ."</td>"; - echo " <td align=\"right\" valign=\"top\">". number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; - echo " <td align=\"left\" valign=\"top\">". $f->currency ." </td>"; - if ( is_object($f->ref) && ($f->ref->getType() == "timetrack") ) { - echo " <td align=\"left\" valign=\"top\">\n"; - if ( $f->ref->state != 1 ) { - echo $f->ref->getLink( $lang['TTState']." ".$f->ref->getState()); - } else { - echo "<center><input type=\"checkbox\" id=\"add_".$f->ref_id ."\" name=\"add[]\" value=\"". $f->ref_id ."\" /></center>"; - } - if ( isset($f->ref->inv_id) && ($f->ref->inv_id != $obj->id) && ($f->ref->inv_id > 0) ) { - $f->ref->inv = new invoice($f->dbconn); - $f->ref->inv = $f->ref->inv->read($f->ref->inv_id,$f->ref->inv); - echo " ". $f->ref->inv->getLink(); - } - } else { - echo "<td align=\"center\" valign=\"top\"><input type=\"checkbox\" id=\"add_". $f->ref_id ."\" name=\"add[]\" value=\"". $f->ref_id ."\" />"; - } - echo "</td>"; - } - echo "</tr>\n"; - } - /** - * change/modify a invoice - */ - class invoice_new extends layout { - /** - * display the form - */ - Function info() { - global $lang,$tutos,$table; + $r = ''; + $r .= "<tr>\n"; + if ( $f->id != -1 ) { +# EXISTING + if ( is_object($f->ref) ) { + $r .= ' <td valign="top"><label for="del_'. $f->id .'">'. $f->ref->getLink(sprintf("%04d",$f->pos)) ."</label></td>"; + } else { + $r .= ' <td valign="top"><label for="del_'. $f->id .'">'. sprintf("%04d",$f->pos) ."</label></td>"; + } + if ( $obj->change_ok() ) { + $r .= ' <td valign="top"><input name="I-'. $f->id .'" size="4" value="'. $f->items ."\" /></td>\n"; + } else { + $r .= ' <td align="right" valign="top">'. number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </td>"; + } + $r .= ' <td valign="top">'. $f->itype .'</td>'; + if ( $obj->change_ok() ) { + $r .= ' <td valign="top"><textarea name="D-'. $f->id .'" rows="3" cols="20">'. myentities($f->description) .'</textarea></td>'; + $r .= ' <td valign="top"><input name="S-'. $f->id .'" type="text" size="6" value="'. $f->sum_single ."\" /></td>\n"; + $r .= ' <td valign="top">'; + $r .= TAX_select("T-".$f->id,$f->tax); + $r .= ' </td>'; + } else { + $r .= " <td valign=\"top\"><pre>". $f->description ."</pre></td>"; + $r .= " <td align=\"right\" valign=\"top\">". number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + $r .= " <td align=\"right\" valign=\"top\">". number_format($f->tax ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + } + $r .= " <td align=\"right\" valign=\"top\">". number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + if ( $obj->change_ok() ) { + $r .= " <td align=\"left\" valign=\"top\">\n"; + $r .= Currency_Select("C-".$f->id ,$f->currency); + $r .= "</td>"; + $r .= ' <td align="center" valign="top"><input type="checkbox" id="del_'. $f->id .'" name="del[]" value="'. $f->id ."\" /></td>\n"; + } else { + $r .= " <td align=\"left\" valign=\"top\">". $f->currency ."</td>\n"; + $r .= " <td align=\"center\" valign=\"top\"> </td>\n"; + } + } else { +# NEW + $r .= " <td valign=\"top\"><label for=\"add_". $f->ref_id ."\">". $f->ref->getLink() ."</label></td>"; + $r .= " <td align=\"right\" valign=\"top\">". number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </td>"; + $r .= " <td align=\"right\" valign=\"top\">". $f->itype ." </td>"; + $r .= " <td valign=\"top\"><pre>". myentities($f->description) ."</pre></td>"; + $r .= " <td align=\"right\" valign=\"top\">". number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + $r .= " <td align=\"right\" valign=\"top\">".($f->tax > 0 ? $f->tax."%":"") ."</td>"; + $r .= " <td align=\"right\" valign=\"top\">". number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>"; + $r .= " <td align=\"left\" valign=\"top\">". $f->currency ." </td>"; + if ( is_object($f->ref) && ($f->ref->getType() == "timetrack") ) { + $r .= " <td align=\"left\" valign=\"top\">\n"; + if ( $f->ref->state != 1 ) { + $r .= $f->ref->getLink( $lang['TTState']." ".$f->ref->getState()); + } else { + $r .= "<center><input type=\"checkbox\" id=\"add_".$f->ref_id ."\" name=\"add[]\" value=\"". $f->ref_id ."\" /></center>"; + } + if ( isset($f->ref->inv_id) && ($f->ref->inv_id != $obj->id) && ($f->ref->inv_id > 0) ) { + $f->ref->inv = new invoice($f->dbconn); + $f->ref->inv = $f->ref->inv->read($f->ref->inv_id,$f->ref->inv); + $r .= " ". $f->ref->inv->getLink(); + } + } else { + $r .= "<td align=\"center\" valign=\"top\"><input type=\"checkbox\" id=\"add_". $f->ref_id ."\" name=\"add[]\" value=\"". $f->ref_id ."\" />"; + } + $r .= "</td>"; + } + $r .= "</tr>\n"; + return $r; +} +/** + * change/modify a invoice + */ +class Invoice_new extends layout { + /** + * display the form + */ + Function info() { + global $lang,$tutos,$table; - $this->width = 9; - echo "<form id=\"invadd\" name=\"invadd\" action=\"invoice_ins.php\" method=\"post\">\n"; - if ($this->obj->id > 0 ) { - $this->addHidden("id",$this->obj->id); - } - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); + $r = ''; + $this->width = 9; + $r .= "<form id=\"invadd\" name=\"invadd\" action=\"invoice_ins.php\" method=\"post\">\n"; + if ($this->obj->id > 0 ) { + $this->addHidden("id",$this->obj->id); + } + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); - echo "<tr>\n"; - echo $this->showfieldc($lang['Accountant'],1,"accountant"); - echo " <td colspan=\"8\">\n"; - if ( $this->obj->change_ok() ) { - echo " <select id=\"accountant\" name=\"accountant\">\n"; - $this->obj->creator->read_locs_data(); - echo " <option value=\"". $this->obj->creator->id ."\"". ($this->obj->accountant == $this->obj->creator->id ? ' selected="selected"':'') .">". myentities($this->obj->creator->getFullName()) ."</option>\n"; - foreach($this->obj->creator->location as $j => $l) { - if ( $l->company->id != -1 ) { - echo ' <option value="'. $l->id .'"'. ($this->obj->accountant == $l->id ? ' selected="selected" >':'>') . myentities($l->company->getFullName()) ."</option>\n"; - } - } - echo " </select>\n"; - } else { - echo $this->obj->acc->getLink(); - $this->addHidden("accountant",$this->obj->accountant); - } - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['Accountant'],1,"accountant"); + $r .= " <td colspan=\"8\">\n"; + if ( $this->obj->change_ok() ) { + $r .= " <select id=\"accountant\" name=\"accountant\">\n"; + $this->obj->creator->read_locs_data(); + $r .= " <option value=\"". $this->obj->creator->id ."\"". ($this->obj->accountant == $this->obj->creator->id ? ' selected="selected"':'') .">". myentities($this->obj->creator->getFullName()) ."</option>\n"; + foreach($this->obj->creator->location as $j => $l) { + if ( $l->company->id != -1 ) { + $r .= ' <option value="'. $l->id .'"'. ($this->obj->accountant == $l->id ? ' selected="selected" >':'>') . myentities($l->company->getFullName()) ."</option>\n"; + } + } + $r .= " </select>\n"; + } else { + $r .= $this->obj->acc->getLink(); + $this->addHidden("accountant",$this->obj->accountant); + } + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InvoiceName'],1,"name"); - echo "<td colspan=\"4\" valign=\"top\">\n"; - if ( $this->obj->change_ok() ) { - if ( $this->obj->name == "auto" ) { - echo "automatic"; - $this->addHidden("name",$this->obj->name); - } else { - echo ' <input id="name" size="'. min($table['invoice']['name'][size],30) .'" maxlength="'.$table['invoice']['name'][size].'" name="name" value="'. myentities($this->obj->name) ."\" />\n"; - } - } else { - echo $this->obj->getLink(); - $this->addHidden("name",$this->obj->name); - } - echo "</td>\n"; - echo $this->showfieldc($lang['InvoiceState'],1,"state"); - echo " <td colspan=\"3\">\n"; - echo InvoiceAskState($this->obj->state); - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvoiceName'],1,"name"); + $r .= "<td colspan=\"4\" valign=\"top\">\n"; + if ( $this->obj->change_ok() ) { + if ( $this->obj->name == "auto" ) { + $r .= "automatic"; + $this->addHidden("name",$this->obj->name); + } else { + $r .= ' <input id="name" size="'. min($table['invoice']['name'][size],30) .'" maxlength="'.$table['invoice']['name'][size].'" name="name" value="'. myentities($this->obj->name) ."\" />\n"; + } + } else { + $r .= $this->obj->getLink(); + $this->addHidden("name",$this->obj->name); + } + $r .= "</td>\n"; + $r .= $this->showfieldc($lang['InvoiceState'],1,"state"); + $r .= " <td colspan=\"3\">\n"; + $r .= InvoiceAskState($this->obj->state); + $r .= "</td></tr>\n"; - echo "<tr>\n"; - if ( is_object($this->obj->ref) ) { - echo $this->showfieldc($lang[$this->obj->ref->getType()],0,"link_id"); - echo ' <td colspan="8" valign="top">'. $this->obj->ref->getLink() ."</td>\n"; - $this->addHidden("link_id",$this->obj->link_id); - } - echo "</tr>\n"; + $r .= "<tr>\n"; + if ( is_object($this->obj->ref) ) { + $r .= $this->showfieldc($lang[$this->obj->ref->getType()],0,"link_id"); + $r .= ' <td colspan="8" valign="top">'. $this->obj->ref->getLink() ."</td>\n"; + $this->addHidden("link_id",$this->obj->link_id); + } + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InvoiceCustomer'],1,"c"); - echo " <td colspan=\"8\">\n"; - if ( $this->obj->change_ok() ) { - echo select_from_array_or_input($this->obj,"c",$this->obj->customer,0,'atcd'); - } else { - if (isset($this->obj->cutomer) && is_object($this->obj->customer) ) { - echo $this->obj->customer->getLink(); - } else { - echo select_from_array_or_input($this->obj,"c",$this->obj->customer,0,'atcd'); - } - } - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvoiceCustomer'],1,"c"); + $r .= " <td colspan=\"8\">\n"; + if ( $this->obj->change_ok() ) { + $r .= select_from_array_or_input($this->obj,"c",$this->obj->customer,0,'atcd'); + } else { + if (isset($this->obj->cutomer) && is_object($this->obj->customer) ) { + $r .= $this->obj->customer->getLink(); + } else { + $r .= select_from_array_or_input($this->obj,"c",$this->obj->customer,0,'atcd'); + } + } + $r .= "</td></tr>\n"; - echo "<tr>\n"; - if ( ($this->obj->state == INV_STATE_NEW) or ($this->obj->state == INV_STATE_READY) ) { - echo $this->showfieldc($lang['InvDateSent'][0]); - echo "<td colspan=\"4\">"; - echo $this->obj->datesent[0]->EnterDate("s0",1); - echo "</td>"; - echo $this->showfieldc($lang['InvDateDue'][0]); - echo "<td colspan=\"3\">"; - echo $this->obj->datedue[0]->EnterDate("d0",1); - echo "</td>"; - } else { - echo $this->showfieldc($lang['InvDateSent'][0]); - echo $this->showdata($this->obj->datesent[0]->getDate(),4); - echo $this->showfieldc($lang['InvDateDue'][0]); - echo $this->showdata($this->obj->datedue[0]->getDate(),3); - $this->addHidden("s0",$this->obj->datesent[0]->getYYYYMMDD()); - $this->addHidden("d0",$this->obj->datedue[0]->getYYYYMMDD()); - } - echo "</tr>\n"; - if ( ($this->obj->state == INV_STATE_PAYNOW) ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['InvDateSent'][1]); - echo "<td colspan=\"4\">"; - echo $this->obj->datesent[1]->EnterDate("s1",1); - echo "</td>"; - echo $this->showfieldc($lang['InvDateDue'][1]); - echo "<td colspan=\"3\">"; - echo $this->obj->datedue[1]->EnterDate("d1",1); - echo "</td>"; - echo "</tr>\n"; - } else { - echo "<tr>\n"; - echo $this->showfieldc($lang['InvDateSent'][0]); - echo $this->showdata($this->obj->datesent[0]->getDate(),4); - echo $this->showfieldc($lang['InvDateDue'][0]); - echo $this->showdata($this->obj->datedue[0]->getDate(),3); - echo "</tr>\n"; + $r .= "<tr>\n"; + if ( ($this->obj->state == INV_STATE_NEW) or ($this->obj->state == INV_STATE_READY) ) { + $r .= $this->showfieldc($lang['InvDateSent'][0]); + $r .= "<td colspan=\"4\">"; + $r .= $this->obj->datesent[0]->EnterDate("s0",1); + $r .= "</td>"; + $r .= $this->showfieldc($lang['InvDateDue'][0]); + $r .= "<td colspan=\"3\">"; + $r .= $this->obj->datedue[0]->EnterDate("d0",1); + $r .= "</td>"; + } else { + $r .= $this->showfieldc($lang['InvDateSent'][0]); + $r .= $this->showdata($this->obj->datesent[0]->getDate(),4); + $r .= $this->showfieldc($lang['InvDateDue'][0]); + $r .= $this->showdata($this->obj->datedue[0]->getDate(),3); + $this->addHidden("s0",$this->obj->datesent[0]->getYYYYMMDD()); + $this->addHidden("d0",$this->obj->datedue[0]->getYYYYMMDD()); + } + $r .= "</tr>\n"; + if ( ($this->obj->state == INV_STATE_PAYNOW) ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvDateSent'][1]); + $r .= "<td colspan=\"4\">"; + $r .= $this->obj->datesent[1]->EnterDate("s1",1); + $r .= "</td>"; + $r .= $this->showfieldc($lang['InvDateDue'][1]); + $r .= "<td colspan=\"3\">"; + $r .= $this->obj->datedue[1]->EnterDate("d1",1); + $r .= "</td>"; + $r .= "</tr>\n"; + } else { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InvDateSent'][0]); + $r .= $this->showdata($this->obj->datesent[0]->getDate(),4); + $r .= $this->showfieldc($lang['InvDateDue'][0]); + $r .= $this->showdata($this->obj->datedue[0]->getDate(),3); + $r .= "</tr>\n"; - $this->addHidden("s1",$this->obj->datesent[1]->getYYYYMMDD()); - $this->addHidden("d1",$this->obj->datedue[1]->getYYYYMMDD()); - } + $this->addHidden("s1",$this->obj->datesent[1]->getYYYYMMDD()); + $this->addHidden("d1",$this->obj->datedue[1]->getYYYYMMDD()); + } - # The existing positions in the invoice - echo "<tr>\n"; - echo '<th colspan="9">'. $lang['InvExistingPos'] ."</th>\n"; - echo "</tr>\n"; - echo "<tr>\n"; - echo ' <th>'. $lang['InvPosPos'] ."</th>\n"; - echo ' <th>'. $lang['InvPosItems'] ."</th>\n"; - echo ' <th>'. $lang['InvPosIType'] ."</th>\n"; - echo ' <th>'. $lang['InvPosDesc'] ."</th>\n"; - echo ' <th>'. $lang['InvPosSingle'] ."</th>\n"; - echo ' <th>'. $lang['InvPosTax'] ."</th>\n"; - echo ' <th>'. $lang['InvPosSum'] ."</th>\n"; - echo ' <th>'. $lang['Currency'] ."</th>\n"; - echo ' <th>'. $lang['InvDelPos'] ."</th>\n"; - echo "</tr>\n"; - $showed = array(); - $this->obj->read_pos(); - if ( count($this->obj->pos) == 0 ) { - echo "<tr>\n"; - echo ' <td colspan="9" class="warn">'.$lang['Err0048']."</td>\n"; - echo "</tr>\n"; - } - @reset($this->obj->pos) ; - while ( list ($i,$f) = @each ($this->obj->pos) ) { - $f->read_ref(); - $showed[$f->ref->id] = 1; - show_invpos($f,$this->obj); - unset($f); - } - if ( $this->obj->change_ok() ) { - # The possible positions in the invoice - echo "<tr>\n"; - echo ' <th colspan="9">'. $lang['InvPossiblePos'] ."</th>\n"; - echo "</tr>\n"; - echo "<tr>\n"; - echo " <th> </th>\n"; - echo ' <th>'. $lang['InvPosItems'] ."</th>\n"; - echo ' <th>'. $lang['InvPosIType'] ."</th>\n"; - echo ' <th>'. $lang['InvPosDesc'] ."</th>\n"; - echo ' <th>'. $lang['InvPosSingle'] ."</th>\n"; - echo ' <th>'. $lang['InvPosTax'] ."</th>\n"; - echo ' <th>'. $lang['InvPosSum'] ."</th>\n"; - echo ' <th>'. $lang['Currency'] ."</th>\n"; - echo ' <th>'. $lang['InvAddPos'] ."</th>\n"; - echo "</tr>\n"; +# The existing positions in the invoice + $r .= "<tr>\n"; + $r .= '<th colspan="9">'. $lang['InvExistingPos'] ."</th>\n"; + $r .= "</tr>\n"; + $r .= "<tr>\n"; + $r .= ' <th>'. $lang['InvPosPos'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosItems'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosIType'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosDesc'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosSingle'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosTax'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosSum'] ."</th>\n"; + $r .= ' <th>'. $lang['Currency'] ."</th>\n"; + $r .= ' <th>'. $lang['InvDelPos'] ."</th>\n"; + $r .= "</tr>\n"; + $showed = array(); + $this->obj->read_pos(); + if ( count($this->obj->pos) == 0 ) { + $r .= "<tr>\n"; + $r .= ' <td colspan="9" class="warn">'.$lang['Err0048']."</td>\n"; + $r .= "</tr>\n"; + } + @reset($this->obj->pos) ; + while ( list ($i,$f) = @each ($this->obj->pos) ) { + $f->read_ref(); + $showed[$f->ref->id] = 1; + $r .= show_invpos($f,$this->obj); + unset($f); + } + if ( $this->obj->change_ok() ) { +# The possible positions in the invoice + $r .= "<tr>\n"; + $r .= ' <th colspan="9">'. $lang['InvPossiblePos'] ."</th>\n"; + $r .= "</tr>\n"; + $r .= "<tr>\n"; + $r .= " <th> </th>\n"; + $r .= ' <th>'. $lang['InvPosItems'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosIType'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosDesc'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosSingle'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosTax'] ."</th>\n"; + $r .= ' <th>'. $lang['InvPosSum'] ."</th>\n"; + $r .= ' <th>'. $lang['Currency'] ."</th>\n"; + $r .= ' <th>'. $lang['InvAddPos'] ."</th>\n"; + $r .= "</tr>\n"; - $p = new invpos($this->dbconn); - $p->set($this->obj,$this->obj->ref); - $p->read_ref(); - if ( ! isset($showed[$p->ref->id]) ) { - show_invpos($p,$this->obj); - } + $p = new invpos($this->dbconn); + $p->set($this->obj,$this->obj->ref); + $p->read_ref(); + if ( ! isset($showed[$p->ref->id]) ) { + $r .= show_invpos($p,$this->obj); + } - # Time directly booked on the parent object - $this->obj->ref->readtimetrack(); - foreach($this->obj->ref->ttlist as $i => $f) { - if ( ($f->inv_id == $this->obj->id) && ($this->obj->id != -1) ) { - continue; - } - $p = new invpos($this->dbconn); - $p->set($this->obj,$f); - $p->read_ref(); - if ( ! isset($showed[$p->ref->id]) ) { - show_invpos($p,$this->obj); - } - unset($p); - unset($f); - } + // Time directly booked on the parent object + $this->obj->ref->readtimetrack(); + foreach($this->obj->ref->ttlist as $i => $f) { + if ( ($f->inv_id == $this->obj->id) && ($this->obj->id != -1) ) { + continue; + } + $p = new invpos($this->dbconn); + $p->set($this->obj,$f); + $p->read_ref(); + if ( ! isset($showed[$p->ref->id]) ) { + $r .= show_invpos($p,$this->obj); + } + unset($p); + unset($f); + } - # Time and expenses booked on tasks - $this->obj->ref->readtasks(); - foreach ($this->obj->ref->fulltasklist as $i => $f) { - $p = new invpos($this->dbconn); - $p->set($this->obj,$f); - show_invpos($p,$this->obj); - unset($p); - if( $tutos[useexpenses] ) { - loadmodule("expense"); - expense::obj_read($f); - foreach ($f->list[useexpenses] as $f2) { - if ( ($f2->invoice == $this->obj->id) && ($this->obj->id != -1) ) { - continue; - } - invoice::obj_read($f2); - if (count($f2->invlist) == 0 ) { - $p = new invpos($this->dbconn); - $p->set($this->obj,$f2); - show_invpos($p,$this->obj); - unset($p); - } - } - } # if expense - } + // Time and expenses booked on tasks + $this->obj->ref->readtasks(); + foreach ($this->obj->ref->fulltasklist as $i => $f) { + $p = new invpos($this->dbconn); + $p->set($this->obj,$f); + $r .= show_invpos($p,$this->obj); + unset($p); + if( $tutos[useexpenses] ) { + loadmodule("expense"); + expense::obj_read($f); + foreach ($f->list[useexpenses] as $f2) { + if ( ($f2->invoice == $this->obj->id) && ($this->obj->id != -1) ) { + continue; + } + invoice::obj_read($f2); + if (count($f2->invlist) == 0 ) { + $p = new invpos($this->dbconn); + $p->set($this->obj,$f2); + $r .= show_invpos($p,$this->obj); + unset($p); + } + } + } # if expense + } - # Installation related to out project - if( $tutos[useinstmanagement] ) { - loadmodule("installation"); - installation::obj_read($this->obj->ref); - foreach ($this->obj->ref->list[useinstmanagement] as $f) { - invoice::obj_read($f); - if (count($f->invlist) == 0 ) { - $p = new invpos($this->dbconn); - $p->set($this->obj,$f); - show_invpos($p,$this->obj); - unset($p); - } - $f->readtimetrack(); - foreach($f->ttlist as $i2 => $f2) { - if ( ($f2->inv_id == $this->obj->id) && ($this->obj->id != -1) ) { - continue; - } - $p = new invpos($this->dbconn); - $p->set($this->obj,$f2); - $p->read_ref(); - if ( ! isset($showed[$p->ref->id]) ) { - show_invpos($p,$this->obj); - } - unset($p); - unset($f2); - } - } - } + // Installation related to out project + if( $tutos[useinstmanagement] ) { + loadmodule("installation"); + installation::obj_read($this->obj->ref); + foreach ($this->obj->ref->list[useinstmanagement] as $f) { + invoice::obj_read($f); + if (count($f->invlist) == 0 ) { + $p = new invpos($this->dbconn); + $p->set($this->obj,$f); + $r .= show_invpos($p,$this->obj); + unset($p); + } + $f->readtimetrack(); + foreach($f->ttlist as $i2 => $f2) { + if ( ($f2->inv_id == $this->obj->id) && ($this->obj->id != -1) ) { + continue; + } + $p = new invpos($this->dbconn); + $p->set($this->obj,$f2); + $p->read_ref(); + if ( ! isset($showed[$p->ref->id]) ) { + $r .= show_invpos($p,$this->obj); + } + unset($p); + unset($f2); + } + } + } - if( $tutos[usebugtracking] ) { - loadmodule("bugtracking"); - bug::obj_read($this->obj->ref); - foreach ($this->obj->ref->list[usebugtracking] as $f) { - invoice::obj_read($f); - if (count($f->invlist) == 0 ) { - $p = new invpos($this->dbconn); - $p->set($this->obj,$f); - show_invpos($p,$this->obj); - unset($p); - } - $f->readtimetrack(); - foreach($f->ttlist as $i2 => $f2) { - if ( ($f2->inv_id == $this->obj->id) && ($this->obj->id != -1) ) { - continue; - } - $p = new invpos($this->dbconn); - $p->set($this->obj,$f2); - $p->read_ref(); - if ( ! isset($showed[$p->ref->id]) ) { - show_invpos($p,$this->obj); - } - unset($p); - unset($f2); - } - } - } # bugtracking + if( $tutos[usebugtracking] ) { + loadmodule("bugtracking"); + bug::obj_read($this->obj->ref); + foreach ($this->obj->ref->list[usebugtracking] as $f) { + invoice::obj_read($f); + if (count($f->invlist) == 0 ) { + $p = new invpos($this->dbconn); + $p->set($this->obj,$f); + $r .= show_invpos($p,$this->obj); + unset($p); + } + $f->readtimetrack(); + foreach($f->ttlist as $i2 => $f2) { + if ( ($f2->inv_id == $this->obj->id) && ($this->obj->id != -1) ) { + continue; + } + $p = new invpos($this->dbconn); + $p->set($this->obj,$f2); + $p->read_ref(); + if ( ! isset($showed[$p->ref->id]) ) { + $r .= show_invpos($p,$this->obj); + } + unset($p); + unset($f2); + } + } + } # bugtracking - if( $tutos[useexpenses] ) { - loadmodule("expense"); - expense::obj_read($this->obj->ref); - foreach ($this->obj->ref->list[useexpenses] as $f) { - if ( ($f->invoice == $this->obj->id) && ($this->obj->id != -1) ) { - continue; - } - invoice::obj_read($f); - if (count($f->invlist) == 0 ) { - $p = new invpos($this->dbconn); - $p->set($this->obj,$f); - show_invpos($p,$this->obj); - unset($p); - } - } - } # expenses - } + if( $tutos[useexpenses] ) { + loadmodule("expense"); + expense::obj_read($this->obj->ref); + foreach ($this->obj->ref->list[useexpenses] as $f) { + if ( ($f->invoice == $this->obj->id) && ($this->obj->id != -1) ) { + continue; + } + invoice::obj_read($f); + if (count($f->invlist) == 0 ) { + $p = new invpos($this->dbconn); + $p->set($this->obj,$f); + $r .= show_invpos($p,$this->obj); + unset($p); + } + } + } # expenses + } - # References to modules - echo module_addforms($this->user,$this->obj,9); + // References to modules + $r .= module_addforms($this->user,$this->obj,9); - if ( $this->obj->mod_ok() != 0 ) { - echo "<tr>\n"; - if ($this->obj->id > 0 ) { - echo submit_reset(0,1,4,1,3,0); - } else { - echo submit_reset(0,-1,4,1,3,0); - } - echo "</tr>\n"; - } - echo $this->DataTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo $this->markBadFields(); - echo "</form>\n"; - echo $lang['FldsRequired'] ."\n"; - } - /** - * naviagte - */ - Function navigate() { - global $lang, $tutos; + if ( $this->obj->mod_ok() != 0 ) { + $r .= "<tr>\n"; + if ($this->obj->id > 0 ) { + $r .= submit_reset(0,1,4,1,3,0); + } else { + $r .= submit_reset(0,-1,4,1,3,0); + } + $r .= "</tr>\n"; + } + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= $this->markBadFields(); + $r .= "</form>\n"; + $r .= $lang['FldsRequired'] ."\n"; + return $r; + } + /** + * naviagte + */ + Function navigate() { + global $lang, $tutos; - echo "<tr><td>"; - if ( is_object($this->obj) && ($this->obj->id > 0) ) { - echo menulink("invoice/invoice_show.php?id=". $this->obj->id ,$lang['AppSeeEntry'],$lang['AppSeeEntryI']) . "<br />"; - } - echo "</td></tr>"; - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang, $tutos; + $r = ''; + $r .= "<tr><td>"; + if ( is_object($this->obj) && ($this->obj->id > 0) ) { + $r .= menulink("invoice/invoice_show.php?id=". $this->obj->id ,$lang['AppSeeEntry'],$lang['AppSeeEntryI']) . "<br />"; + } + $r .= "</td></tr>"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang, $tutos; - $this->obj = new invoice($this->dbconn); - $this->name = $lang['Invoice']; + $this->obj = new invoice($this->dbconn); + $this->name = $lang['Invoice']; - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['invoice']); - $this->stop = true; - return; - } - $this->name .= ": ". myentities($this->obj->getFullName()); - $this->obj->read_ref(); - } else { - $this->name = $lang['InvoiceCreate']; - if ( !$this->user->feature_ok(useinvoice,PERM_NEW) ) { - $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } - if ( !isset($_GET['link_id']) ) { - $msg .= $lang['Err0048']; - $this->stop = true; - return; - } - } - if ( ! $this->obj->mod_ok() ) { - $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['invoice']); + $this->stop = true; + return; + } + $this->name .= ": ". myentities($this->obj->getFullName()); + $this->obj->read_ref(); + } else { + $this->name = $lang['InvoiceCreate']; + if ( !$this->user->feature_ok(useinvoice,PERM_NEW) ) { + $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } + if ( !isset($_GET['link_id']) ) { + $msg .= $lang['Err0048']; + $this->stop = true; + return; + } + } + if ( ! $this->obj->mod_ok() ) { + $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } - $this->obj->set_int_from_arg('state','state',$lang['InvoiceState']); - $this->obj->set_string_from_arg('name','name',$lang['InvoiceName']); + $this->obj->set_int_from_arg('state','state',$lang['InvoiceState']); + $this->obj->set_string_from_arg('name','name',$lang['InvoiceName']); - if ( isset($_GET['link_id']) ) { - $this->obj->link_id = $_GET['link_id']; - if ( $this->obj->id == -1 ) { - $this->obj->read_ref(); - if ( $this->obj->ref->getType() == "product" ) { - # Preset the custumer if possible - $this->obj->ref->readroles(); - if ( isset($this->obj->ref->role[6][0]) ) { - $this->obj->customer = $this->obj->ref->role[6][0]; - } - } else if ( $this->obj->ref->getType() == "installation" ) { - $this->obj->customer = $this->obj->ref->customer; - } - } - } + if ( isset($_GET['link_id']) ) { + $this->obj->link_id = $_GET['link_id']; + if ( $this->obj->id == -1 ) { + $this->obj->read_ref(); + if ( $this->obj->ref->getType() == "product" ) { + // Preset the custumer if possible + $this->obj->ref->readroles(); + if ( isset($this->obj->ref->role[6][0]) ) { + $this->obj->customer = $this->obj->ref->role[6][0]; + } + } else if ( $this->obj->ref->getType() == "installation" ) { + $this->obj->customer = $this->obj->ref->customer; + } + } + } - # Customer - preset_from_array_or_input($this->obj,'customer',"c"); - # menu - $m = invoice::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addmenu($m); - add_module_newlinks($this,$this->obj); + // Customer + preset_from_array_or_input($this->obj,'customer',"c"); + // menu + $m = invoice::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addmenu($m); + add_module_newlinks($this,$this->obj); - if ( $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelUrl(), - text => $lang['Delete'], - info => sprintf($lang['InvDelInfo'],$this->obj->getFullname()), - confirm => true, - category => array("invoice","del","obj") - ); - $this->addMenu($x); - } - } - } + if ( $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelUrl(), + text => $lang['Delete'], + info => sprintf($lang['InvDelInfo'],$this->obj->getFullname()), + confirm => true, + category => array("invoice","del","obj") + ); + $this->addMenu($x); + } + } +} - $l = new invoice_new($current_user); - $l->display(); - $dbconn->Close(); +$l = new Invoice_new($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: invoice.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/invoice/invoice.pinc,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- invoice.pinc 29 Mar 2009 18:25:41 -0000 1.75 +++ invoice.pinc 30 Mar 2009 15:48:06 -0000 1.76 @@ -225,11 +225,11 @@ @reset($obj->ttlist) ; foreach($obj->ttlist as $i2 => $f2) { if ( $f2->state != TT_STATE_CHECKED ) { -# Show only checked entries + // Show only checked entries continue; } if ( $f2->inv_id != -1 ) { -# Show only entries without a invoice + // Show only entries without a invoice continue; } $this->sum_single += $f2->volume * $f2->cph; @@ -846,28 +846,28 @@ $pdf->SetFont('Arial','',12); -# Customer + // Customer if (is_object($this->customer) ) { $pdf->Cell(0,20,$this->customer->getFullName(),0,1); } -# Accountant + // Accountant if ( $this->acc->getType() == "location" ) { $pdf->Cell(0,20,$this->acc->company->getFullName(),0,1); } else { $pdf->Cell(0,20,$this->acc->getFullName(),0,1); } -# Product + // Product $pdf->Cell(40,20,$lang[$this->ref->getType()],0,0); $pdf->Cell(0,20,$this->ref->getFullName(),0,1); -# add textblock + // add textblock $pdf->addFileBlock($tutos['base... [truncated message content] |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:15
|
Update of /cvsroot/tutos/tutos/php/rate In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/rate Modified Files: rate.pinc Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: rate.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/rate/rate.pinc,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- rate.pinc 29 Mar 2009 18:25:41 -0000 1.44 +++ rate.pinc 30 Mar 2009 15:48:06 -0000 1.45 @@ -20,19 +20,19 @@ $r = ''; $n = 1; - $x = count($obj->ratelist); + $x = count($obj->list[userates]); if ( $rows == 0 ) { $rows = $tutos[maxshort]; } if ( $rows == -1 ) { - $rows = count($obj->ratelist); + $rows = $x; } - foreach ($obj->ratelist as $i => $f) { + foreach ($obj->list[userates] as $f) { if ( $cols > 0 ) { $r .= "<tr><td colspan=\"". $cols ."\">\n"; } if ( ($n >= $rows) && ( $x != $rows ) ) { - $r .= ' '. $user->layout->theme->getImage(folder,'list') ." ". makelink("rate/rate_overview.php?link_id=". $obj->id,sprintf($lang['AllEntries'], count($obj->ratelist))); + $r .= ' '. $user->layout->theme->getImage(folder,'list') ." ". makelink("rate/rate_overview.php?link_id=". $obj->id,sprintf($lang['AllEntries'], $x)); if ( $cols > 0 ) { $r .= "</td></tr>\n"; } @@ -567,7 +567,7 @@ return $r; } rate::obj_read($obj); - if ( count($obj->ratelist) < 1 ) { + if ( count($obj->list[userates]) < 1 ) { return $r; } $r .= "<tr>\n"; @@ -576,7 +576,7 @@ $r .= "<td valign=\"top\" colspan=\"".($cols-1)."\">\n"; $r .= "<select id=\"rate[]\" name=\"rate[]\" size=\"1\">\n"; #$r .= "<option value=\"keep\">". $obj->cph ." ". $obj->currency ."</option>"; - foreach($obj->ratelist as $i => $f) { + foreach($obj->list[userates] as $i => $f) { if ($f->use_ok()) { $r .= "<option value=\"". $f->id ."\""; if ( $f->cph == $obj->cph && $f->currency == $obj->currency && $f->state == $obj->state) { @@ -608,7 +608,7 @@ return $r; } rate::obj_read($obj); - if ( count($obj->ratelist) == 0 ) { + if ( count($obj->list[userates]) == 0 ) { return $r; } $r .= "<tr>\n"; @@ -636,10 +636,10 @@ return $r; } rate::obj_read($obj); - if ( count($obj->ratelist) > 0 ) { + if ( count($obj->list[userates]) > 0 ) { $sep = ""; $r .= " <tr><td class=\"". $class ."\" colspan=". $cols ." align=\"left\">"; - foreach ($obj->ratelist as $i => $f) { + foreach ($obj->list[userates] as $i => $f) { $r .= $sep . "-" . $f->getLink(); $sep = "<br />\n"; } @@ -673,10 +673,10 @@ global $current_user; if (! is_object($obj) ) return; - if ( isset($obj->ratelist) ) { + if ( isset($obj->list[userates]) ) { return; } - $obj->ratelist = array(); + $obj->list[userates] = array(); $q = "SELECT * from ". $obj->dbconn->prefix ."rates where link_id in ("; @@ -743,7 +743,7 @@ $rate = new rate($obj->dbconn); $rate->read_result($r,$a); if ( $rate->see_ok() ) { - $obj->ratelist[$rate->id] = &$rate; + $obj->list[userates][$rate->id] = &$rate; } $a++; unset($rate); @@ -761,10 +761,8 @@ } rate::obj_read($obj); - if ( count($obj->ratelist) > 0 ) { - @reset ($obj->ratelist); - while ( list ($i,$f) = @each ($obj->ratelist) ) { -# $msg .= " ".$i." ". $f."<br>"; + if ( count($obj->list[userates]) > 0 ) { + foreach ($obj->list[userates] as $f) { $msg .= $f->delete(); } } |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:15
|
Update of /cvsroot/tutos/tutos/php/localization In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/localization Modified Files: tw.p3 zh.p3 Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: tw.p3 =================================================================== RCS file: /cvsroot/tutos/tutos/php/localization/tw.p3,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- tw.p3 26 Feb 2009 09:48:09 -0000 1.62 +++ tw.p3 30 Mar 2009 15:48:06 -0000 1.63 @@ -11,6 +11,7 @@ # Original Translation by "Keith Tsao" <kei...@va...> # Current Translation by "Cecil Sheng" <cec...@ms...> $lang['content_encoding'] = "utf-8"; +$lang['target_enc'] = 'gb2312'; //for pdf , excel etc setlocale(LC_TIME,'zh_TW'); # # Traditional Chinese Texts Index: zh.p3 =================================================================== RCS file: /cvsroot/tutos/tutos/php/localization/zh.p3,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- zh.p3 26 Feb 2009 09:48:10 -0000 1.62 +++ zh.p3 30 Mar 2009 15:48:06 -0000 1.63 @@ -12,6 +12,7 @@ # Very minor tinkering by Ambrose Li <a....@ie...> # $lang['content_encoding'] = "utf-8"; +$lang['target_enc'] = 'gb2312'; //for pdf , excel etc setlocale(LC_TIME,'zh_CN'); # # Traditional Chinese Texts |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:15
|
Update of /cvsroot/tutos/tutos/php/url In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/url Modified Files: url_ins.php url_overview.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: url_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/url/url_overview.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- url_overview.php 29 Mar 2009 18:25:42 -0000 1.12 +++ url_overview.php 30 Mar 2009 15:48:06 -0000 1.13 @@ -27,172 +27,172 @@ * change/modify a url */ class Url_overview extends layout { - /** - * display the info - */ - Function info() { - global $lang,$tutos; + /** + * display the info + */ + Function info() { + global $lang,$tutos; - $r = ''; - $n = $this->result->numrows(); + $r = ''; + $n = $this->result->numrows(); - $r .= $this->actionformStart("url_overview.php"); - $r .= $this->OverviewTableStart(); + $r .= $this->actionformStart("url_overview.php"); + $r .= $this->OverviewTableStart(); - $r .= "<tr>\n"; - $r .= $this->orderHeader("",$lang['Reference'],$this->link2); - $r .= $this->orderHeader("name",$lang['URLName'],$this->link2); - $r .= $this->orderHeader("url",$lang['URL'],$this->link2); - if ( $tutos[massupdate] == 1 ) { - $r .= " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - } - $r .= "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->orderHeader("",$lang['Reference'],$this->link2); + $r .= $this->orderHeader("name",$lang['URLName'],$this->link2); + $r .= $this->orderHeader("url",$lang['URL'],$this->link2); + if ( $tutos[massupdate] == 1 ) { + $r .= " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + } + $r .= "</tr>\n"; - if ( $this->start == -1 ) { - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } + if ( $this->start == -1 ) { + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } - $this->filter['name'] = prepare_regpattern($this->filter['name']); - $line = 0; - while ( ($a < $n) && ($a < $end) ) { - $c = new url($this->dbconn); - $c->read_result($this->result,$a); - $a++; - if ( ! $c->see_ok() ) { - continue; - } - $c->ref = getObject($this->dbconn,$c->link_id); - $r .= $this->OverviewRowStart($line); - $r .= "<td valign=\"top\">"; - if (is_object($c->ref)) { - $r .= $c->ref->getLink(); - } else { - $r .= " "; - } - $r .= "</td>\n"; - $x = myentities($c->name); - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - $r .= "<td valign=\"top\">". $c->getLink($x) ."</td>"; + $this->filter['name'] = prepare_regpattern($this->filter['name']); + $line = 0; + while ( ($a < $n) && ($a < $end) ) { + $c = new url($this->dbconn); + $c->read_result($this->result,$a); + $a++; + if ( ! $c->see_ok() ) { + continue; + } + $c->ref = getObject($this->dbconn,$c->link_id); + $r .= $this->OverviewRowStart($line); + $r .= "<td valign=\"top\">"; + if (is_object($c->ref)) { + $r .= $c->ref->getLink(); + } else { + $r .= " "; + } + $r .= "</td>\n"; + $x = myentities($c->name); + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + $r .= "<td valign=\"top\">". $c->getLink($x) ."</td>"; - $x = myentities($c->url); - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - $r .= "<td valign=\"top\">". $x ."</td>"; - if ( $tutos[massupdate] == 1 ) { - $r .= " <td align=\"center\">\n"; - if ( $c->del_ok() ) { - $r .= '<input name="mark[]" type="checkbox" value="'. $c->id ."\" />\n"; - } else { - $r .= "-\n"; - } - $r .= "</td>\n"; - } - $r .= $this->OverviewRowEnd($line++); - } + $x = myentities($c->url); + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + $r .= "<td valign=\"top\">". $x ."</td>"; + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $c->del_ok() ) { + $r .= '<input name="mark[]" type="checkbox" value="'. $c->id ."\" />\n"; + } else { + $r .= "-\n"; + } + $r .= "</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + } - $r .= $this->list_navigation($this->link1,3 + $tutos[massupdate],$this->start,$a,$n); - if ( $tutos[massupdate] == 1 ) { - $r .= $this->UpdateRowStart(2); - $r .= sprintf($lang['withmarked'],$lang['URL']); - $r .= " <select name=\"action\">\n"; - $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; - $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; - $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; - $r .= "</select>\n"; - $r .= $this->UpdateRowEnd(2); - } + $r .= $this->list_navigation($this->link1,3 + $tutos[massupdate],$this->start,$a,$n); + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart(2); + $r .= sprintf($lang['withmarked'],$lang['URL']); + $r .= " <select name=\"action\">\n"; + $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; + $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; + $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(2); + } - $r .= $this->OverviewTableEnd(); - $r .= $this->actionformEnd("url_overview.php"); - $this->result->free(); - return $r; - } - /** - * action via massupdate - */ - Function action() { - global $lang,$msg; + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("url_overview.php"); + $this->result->free(); + return $r; + } + /** + * action via massupdate + */ + Function action() { + global $lang,$msg; - if ( $_GET['action'] == -2 ) { - $this->dbconn->Begin("WORK"); - foreach ($_GET['mark'] as $val) { - $b = new url($this->dbconn); - $b = $b->read($val,$b); - if ( $b->id != $val ) { - continue; - } - if ( $b->del_ok() ) { - $msg .= $lang['URLDel'] .": ". myentities($b->name) ."<br />"; - $msg .= $b->delete(); - } else { - $msg .= myentities($b->name) .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; - } - unset($b); - } - $this->dbconn->Commit("WORK"); - } else if ( $_GET['action'] == -4 ) { - $this->redirect = "../". acl_action(); - } - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + if ( $_GET['action'] == -2 ) { + $this->dbconn->Begin("WORK"); + foreach ($_GET['mark'] as $val) { + $b = new url($this->dbconn); + $b = $b->read($val,$b); + if ( $b->id != $val ) { + continue; + } + if ( $b->del_ok() ) { + $msg .= $lang['URLDel'] .": ". myentities($b->name) ."<br />"; + $msg .= $b->delete(); + } else { + $msg .= myentities($b->name) .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; + } + unset($b); + } + $this->dbconn->Commit("WORK"); + } else if ( $_GET['action'] == -4 ) { + $this->redirect = "../". acl_action(); + } + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->name = $lang['URLOverview']; - $this->css_class = 'overviewbox'; + $this->name = $lang['URLOverview']; + $this->css_class = 'overviewbox'; - if ( ! $this->user->feature_ok(useurl,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - return; - } + if ( ! $this->user->feature_ok(useurl,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + return; + } - $this->link1 = "url/url_overview.php"; - $this->filter = array(); + $this->link1 = "url/url_overview.php"; + $this->filter = array(); - $this->q = "SELECT * FROM ". $this->dbconn->prefix ."urls"; - $pre = " WHERE "; + $this->q = "SELECT * FROM ". $this->dbconn->prefix ."urls"; + $pre = " WHERE "; - if ( isset($_GET['name']) && ($_GET['name'] != "*") && ($_GET['name'] != "") ) { - $this->q .= $pre ."(". $this->dbconn->Like("name",$_GET['name']); - $this->q .= " or ". $this->dbconn->Like("url",$_GET['name']) .")"; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); - $this->filter['name'] = $_GET['name']; - $this->addHidden("name",$_GET['name']); - } else { - $this->filter['name'] = ""; - } + if ( isset($_GET['name']) && ($_GET['name'] != "*") && ($_GET['name'] != "") ) { + $this->q .= $pre ."(". $this->dbconn->Like("name",$_GET['name']); + $this->q .= " or ". $this->dbconn->Like("url",$_GET['name']) .")"; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); + $this->filter['name'] = $_GET['name']; + $this->addHidden("name",$_GET['name']); + } else { + $this->filter['name'] = ""; + } - check_dbacl($this->dbconn, $this->q, $this->user->id); + check_dbacl($this->dbconn, $this->q, $this->user->id); - // sorting - $xxx = ""; - $this->link2 = $this->link1; - order_parse($this->q,$this->link1,$xxx,$xxx,"name"); + // sorting + $xxx = ""; + $this->link2 = $this->link1; + order_parse($this->q,$this->link1,$xxx,$xxx,"name"); - $this->result = $this->dbconn->Exec($this->q); - if ( 0 == $this->result->numrows()) { - $this->redirect = "url_select.php?msg=". UrlEncode($lang['Err0048']); - $this->result->free(); - } + $this->result = $this->dbconn->Exec($this->q); + if ( 0 == $this->result->numrows()) { + $this->redirect = "url_select.php?msg=". UrlEncode($lang['Err0048']); + $this->result->free(); + } - // menu - $x = url::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addMenu($x); - } + // menu + $x = url::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addMenu($x); + } } $l = new Url_overview($current_user); Index: url_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/url/url_ins.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- url_ins.php 17 May 2007 08:45:44 -0000 1.13 +++ url_ins.php 30 Mar 2009 15:48:06 -0000 1.14 @@ -73,14 +73,9 @@ $gotourl = $ref->getUrl(); } - $gotourl = addMessage($gotourl,$msg,true); - $gotourl = addSessionKey($gotourl,true); -#die(dirname(getBaseUrl()) ." / ". $gotourl); - Header("Status: 302 Moved Temporarily"); - Header("Location: ". dirname(getBaseUrl()) ."/". $gotourl); - $dbconn->Close(); - /* - * CVS Info: $Id$ - * $Author$ - */ +leave_insert($dbconn,$gotourl,$msg); +/** + * CVS Info: $Id$ + * $Author$ + */ ?> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:14
|
Update of /cvsroot/tutos/tutos/php/group In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/group Modified Files: group_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: group_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/group_show.php,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- group_show.php 29 Mar 2009 18:25:41 -0000 1.44 +++ group_show.php 30 Mar 2009 15:48:06 -0000 1.45 @@ -47,9 +47,9 @@ $pdf=new tutospdf($this->obj->dbconn); $pdf->Open(); - $pdf->setAuthor($this->obj->creator != -1 ? $this->obj->creator->getFullName():$lang['HistoryDeleted']); - $pdf->setTitle($this->obj->getFullName()); - $pdf->setSubject($this->obj->getFullName()); + $pdf->setAuthor(myiconv(is_object($this->obj->creator) ? $this->obj->creator->getFullName():$lang['HistoryDeleted'])); + $pdf->setTitle(myiconv($this->obj->getFullName())); + $pdf->setSubject(myiconv($this->obj->getFullName())); $pdf->headtitle = $this->name; @@ -69,15 +69,15 @@ // Header $h = 8; $pdf->SetFont('Arial','B',$fs[0]); - $pdf->Cell($w[0],$h, $lang['AdrName'],1,0,$al[0]); + $pdf->Cell($w[0],$h, myiconv($lang['AdrName']),1,0,$al[0]); $pdf->SetFont('Arial','B',$fs[1]); - $pdf->Cell($w[1],$h, $lang['Description'],1,0,$al[1]); + $pdf->Cell($w[1],$h, myiconv($lang['Description']),1,0,$al[1]); $pdf->SetFont('Arial','B',$fs[2]); - $pdf->Cell($w[2],$h, $lang['Phone'],1,0,$al[2]); + $pdf->Cell($w[2],$h, myiconv($lang['Phone']),1,0,$al[2]); $pdf->SetFont('Arial','B',$fs[3]); - $pdf->Cell($w[3],$h, $lang['AdrEmail'],1,0,$al[3]); + $pdf->Cell($w[3],$h, myiconv($lang['AdrEmail']),1,0,$al[3]); $pdf->SetFont('Arial','B',$fs[4]); - $pdf->Cell($w[4],$h, $lang['AdrFax'],1,0,$al[4]); + $pdf->Cell($w[4],$h, myiconv($lang['AdrFax']),1,0,$al[4]); $pdf->Ln(); @@ -154,19 +154,19 @@ } // name $pdf->SetFont('Arial','',$fs[0]); - $pdf->Cell($w[0],$h, (isset($name[$i]) ? $name[$i]:" "),$border,0,$al[0]); + $pdf->Cell($w[0],$h, (isset($name[$i]) ? myiconv($name[$i]):" "),$border,0,$al[0]); // desc $pdf->SetFont('Arial','',$fs[1]); - $pdf->Cell($w[1],$h, (isset($d[$i]) ? $d[$i]:" "),$border,0,$al[1]); + $pdf->Cell($w[1],$h, (isset($d[$i]) ? myiconv($d[$i]):" "),$border,0,$al[1]); // phone $pdf->SetFont('Arial','',$fs[2]); - $pdf->Cell($w[2],$h,(isset($p[$i]) ? $p[$i] : " "),$border,0,$al[2]); + $pdf->Cell($w[2],$h,(isset($p[$i]) ? myiconv($p[$i]) : " "),$border,0,$al[2]); // email $pdf->SetFont('Arial','',$fs[3]); - $pdf->Cell($w[3],$h, (isset($e[$i]) ? $e[$i] : " "),$border,0,$al[3]); + $pdf->Cell($w[3],$h, (isset($e[$i]) ? myiconv($e[$i]) : " "),$border,0,$al[3]); // fax $pdf->SetFont('Arial','',$fs[4]); - $pdf->Cell($w[4],$h, (isset($f[$i]) ? $f[$i] : " "),$border,0,$al[4]); + $pdf->Cell($w[4],$h, (isset($f[$i]) ? myiconv($f[$i]) : " "),$border,0,$al[4]); $pdf->Ln(); } |
Update of /cvsroot/tutos/tutos/php In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402 Modified Files: address_overview.php company_new.php product_overview.php team_new.php team_overview.php team_show.php timetrack_new.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: team_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/team_new.php,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- team_new.php 29 Mar 2009 18:25:41 -0000 1.60 +++ team_new.php 30 Mar 2009 15:48:05 -0000 1.61 @@ -97,7 +97,7 @@ $r .= " <td> </td>\n"; if ( $this->user->isadmin() ) { - // Members of the virtual 0 team + // Members of the virtual 0 team $x = new team($this->dbconn); $x = $x->read(0,$x); $x->read_member(); @@ -134,12 +134,12 @@ $cchecked[$aid] = ""; } } - // Remove team where we are member + // Remove team where we are member foreach ($this->obj->teamlist as $aid => $f) { unset($uids[$aid]); unset($cchecked[$aid]); } - // Remove Current Members + // Remove Current Members foreach($this->obj->member as $aid => $adr) { unset($uids[$aid]); } @@ -154,12 +154,12 @@ $r .= "</select></td>"; $r .= "</tr>\n"; - // Edit additional custom fields + // Edit additional custom fields $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,8); $r .= module_addforms($this->user,$this->obj,8); - // Feature Permisssions + // Feature Permisssions $r .= permission_form($this,$this->user,$this->obj); $r .= "<tr>\n"; Index: team_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/team_overview.php,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- team_overview.php 29 Mar 2009 18:25:41 -0000 1.60 +++ team_overview.php 30 Mar 2009 15:48:05 -0000 1.61 @@ -118,7 +118,7 @@ $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; if (class_exists('watchlist')) { - $r .= watchlist::action_options(); + $r .= watchlist::action_options(); } $r .= "</select>\n"; $r .= $this->UpdateRowEnd(2); Index: product_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/product_overview.php,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- product_overview.php 29 Mar 2009 18:25:41 -0000 1.132 +++ product_overview.php 30 Mar 2009 15:48:05 -0000 1.133 @@ -434,9 +434,9 @@ echo " <option value=\"S". $i ."\">". sprintf($lang['SetTo'],$lang['ProdState'],$lang['ProdStates'][$i]) ."</option>\n"; } echo " <option value=\"-4\">". $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - echo watchlist::action_options(); - } + if (class_exists('watchlist')) { + echo watchlist::action_options(); + } echo "</select>\n"; echo $this->UpdateRowEnd(1); } Index: timetrack_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/timetrack_new.php,v retrieving revision 1.83 retrieving revision 1.84 diff -u -d -r1.83 -r1.84 --- timetrack_new.php 29 Mar 2009 18:25:41 -0000 1.83 +++ timetrack_new.php 30 Mar 2009 15:48:05 -0000 1.84 @@ -26,315 +26,310 @@ */ class Timetrack_new extends layout { - /** - * display the form - */ - Function info() { - global $lang, $tutos,$table; + /** + * display the form + */ + Function info() { + global $lang, $tutos,$table; - if ( $this->mode == 1 ) { - # if we are in time record mode we first give a list of all OPEN records - $q = 'SELECT * from '. $this->obj->tablename .' WHERE t_start is not null AND t_end is NULL and adr_id = '. $this->obj->worker->id; - $r = $this->dbconn->Exec($q); - $n = $r->numrows(); - $a = 0; - if ( $n > 0 ) { - echo $this->DataTableStart(); - echo "<tr>\n"; - echo ' <th>'. $lang['Timetrack'] ."</th>\n"; - echo ' <th>'. $lang['AppStart'] ."</th>\n"; - echo ' <th>'. $lang['TimetrackRef'] ."</th>\n"; - echo ' <th>'. $lang['TimetrackModify'] ."</th>\n"; - echo ' <th>'. $lang['TTfinish'] ."</th>\n"; - echo "</tr>\n"; - } - $line = 0 ; - while ( $a < $n ) { - $f = new timetrack($this->dbconn); - $f->read_result($r,$a); - $a++; - echo $this->OverviewRowStart($line); - echo ' <td>'. $f->getLink() ."</td>\n"; - echo ' <td>'. $f->t_start->getDateTime() ."</td>\n"; - echo ' <td>'. $f->ref->getLink() ."</td>\n"; - echo ' <td>'. makelink("timetrack_new.php?mode=2&id=". $f->id,$lang['Modify'],$lang['TimetrackModify']) ."</td>"; - echo ' <td>'. makelink("timetrack_finish.php?id=". $f->id,$lang['TTfinish'],$lang['TTfinish']) ."</td>"; - echo $this->OverviewRowEnd($line++); - } - $r->free(); - if ( $n > 0 ) { - echo $this->DataTableEnd(); - return; - } - } + $r = ''; + if ( $this->mode == 1 ) { + // if we are in time record mode we first give a list of all OPEN records + $q = 'SELECT * from '. $this->obj->tablename .' WHERE t_start is not null AND t_end is NULL and adr_id = '. $this->obj->worker->id; + $res = $this->dbconn->Exec($q); + $n = $res->numrows(); + $a = 0; + if ( $n > 0 ) { + $r .= $this->DataTableStart(); + $r .= "<tr>\n"; + $r .= ' <th>'. $lang['Timetrack'] ."</th>\n"; + $r .= ' <th>'. $lang['AppStart'] ."</th>\n"; + $r .= ' <th>'. $lang['TimetrackRef'] ."</th>\n"; + $r .= ' <th>'. $lang['TimetrackModify'] ."</th>\n"; + $r .= ' <th>'. $lang['TTfinish'] ."</th>\n"; + $r .= "</tr>\n"; + } + $line = 0 ; + while ( $a < $n ) { + $f = new timetrack($this->dbconn); + $f->read_result($res,$a); + $a++; + $r .= $this->OverviewRowStart($line); + $r .= ' <td>'. $f->getLink() ."</td>\n"; + $r .= ' <td>'. $f->t_start->getDateTime() ."</td>\n"; + $r .= ' <td>'. $f->ref->getLink() ."</td>\n"; + $r .= ' <td>'. makelink("timetrack_new.php?mode=2&id=". $f->id,$lang['Modify'],$lang['TimetrackModify']) ."</td>"; + $r .= ' <td>'. makelink("timetrack_finish.php?id=". $f->id,$lang['TTfinish'],$lang['TTfinish']) ."</td>"; + $r .= $this->OverviewRowEnd($line++); + } + $res->free(); + if ( $n > 0 ) { + $r .= $this->DataTableEnd(); + return $r; + } + } - $this->width = 6; - echo "<form id=\"ttadd\" name=\"ttadd\" action=\"timetrack_ins.php\" method=\"post\">\n"; - $this->addHidden("mode",$this->mode); - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); + $this->width = 6; + $r .= "<form id=\"ttadd\" name=\"ttadd\" action=\"timetrack_ins.php\" method=\"post\">\n"; + $this->addHidden("mode",$this->mode); + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); - if ( $this->obj->id > 0 ) { - $this->addHidden("id",$this->obj->id); - } + if ( $this->obj->id > 0 ) { + $this->addHidden("id",$this->obj->id); + } - echo "<tr>\n"; - echo $this->showfield($lang['TimetrackRef']); - echo " <td colspan=\"5\">\n"; - echo "<select id=\"lid\" name=\"lid\">\n"; - foreach ($this->obj->plist as $i => $f) { - echo '<option value="'. $i .'"'. ($i == $this->obj->ref->id ? ' selected="selected">* ':'>') . $lang[$f->getType()] .': '. myentities($f->getFullName()) ."</option>\n"; - } - echo "</select>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['TimetrackRef']); + $r .= " <td colspan=\"5\">\n"; + $r .= "<select id=\"lid\" name=\"lid\">\n"; + foreach ($this->obj->plist as $i => $f) { + $r .= '<option value="'. $i .'"'. ($i == $this->obj->ref->id ? ' selected="selected">* ':'>') . $lang[$f->getType()] .': '. myentities($f->getFullName()) ."</option>\n"; + } + $r .= "</select>\n"; - echo " </td>\n"; - echo "</tr>\n"; + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['TimetrackWorker'],1,'w'); - echo " <td colspan=\"5\">\n"; - if ( $this->mode == 0 ) { - echo select_from_array_or_input($this->obj,'w',$this->obj->worker,0,'at'); - } else { - echo $this->obj->worker->getLink(); - $this->addHidden("wid",$this->obj->worker->id); - } - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['TimetrackWorker'],1,'w'); + $r .= " <td colspan=\"5\">\n"; + if ( $this->mode == 0 ) { + $r .= select_from_array_or_input($this->obj,'w',$this->obj->worker,0,'at'); + } else { + $r .= $this->obj->worker->getLink(); + $this->addHidden("wid",$this->obj->worker->id); + } + $r .= " </td>\n"; + $r .= "</tr>\n"; - if ( $this->obj->t_start->notime != 0 ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['TTVolumeDone'],1,"volume"); - echo ' <td><input size="10" maxlength="10" id="volume" name="volume" value="'. number_format($this->obj->volume,2,$lang['DecPoint'],$lang['ThousandPoint']) .'" />'. $lang['hours'] ."</td>\n"; - # added by J. baten to facilitate travel distance + if ( $this->obj->t_start->notime != 0 ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['TTVolumeDone'],1,"volume"); + $r .= ' <td><input size="10" maxlength="10" id="volume" name="volume" value="'. number_format($this->obj->volume,2,$lang['DecPoint'],$lang['ThousandPoint']) .'" />'. $lang['hours'] ."</td>\n"; +# added by J. baten to facilitate travel distance - echo $this->showfieldc($lang['Distance'],0,"distance"); - echo "<td><input size=\"10\" maxlength=\"10\" name=\"distance\" value=\"". number_format($this->obj->distance,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\" />". $lang['DistanceUnit'] ."</td>\n"; + $r .= $this->showfieldc($lang['Distance'],0,"distance"); + $r .= "<td><input size=\"10\" maxlength=\"10\" name=\"distance\" value=\"". number_format($this->obj->distance,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\" />". $lang['DistanceUnit'] ."</td>\n"; - echo $this->showfieldc($lang['atDateTime'],1,"wd_d"); - echo " <td>\n"; - echo $this->obj->wday->EnterDate("wd",1); - echo " </td>\n"; - echo "</tr>\n"; - } else { - echo "<tr>\n"; - echo $this->showfieldc($lang['AppStart'],1,"start_d"); - echo " <td colspan=\"2\">\n"; - echo $this->obj->t_start->EnterDateTime('start',1); - echo " </td>\n"; - echo $this->showfieldc($lang['AppEnd'],0,"end_d"); - echo " <td colspan=\"2\">\n"; - echo $this->obj->t_end->EnterDateTime('end',1); - echo " </td>\n"; - echo "</tr>\n"; - } + $r .= $this->showfieldc($lang['atDateTime'],1,"wd_d"); + $r .= " <td>\n"; + $r .= $this->obj->wday->EnterDate("wd",1); + $r .= " </td>\n"; + $r .= "</tr>\n"; + } else { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['AppStart'],1,"start_d"); + $r .= " <td colspan=\"2\">\n"; + $r .= $this->obj->t_start->EnterDateTime('start',1); + $r .= " </td>\n"; + $r .= $this->showfieldc($lang['AppEnd'],0,"end_d"); + $r .= " <td colspan=\"2\">\n"; + $r .= $this->obj->t_end->EnterDateTime('end',1); + $r .= " </td>\n"; + $r .= "</tr>\n"; + } - if ($this->obj->ref->getType() == 'task') { - if( $this->obj->ref->volume_todo == -1 ) { - $volume_todo = $this->obj->ref->volume - $this->obj->ref->volume_done; - } else { - $volume_todo = $this->obj->ref->volume_todo; - } - echo "<tr>\n"; - echo $this->showfieldc($lang['TaskVolumeTodo'],0,"volume_todo"); - echo ' <td><input size="10" maxlength="10" name="volume_todo" />'. $lang['hours'] ."</td>\n"; + if ($this->obj->ref->getType() == 'task') { + if( $this->obj->ref->volume_todo == -1 ) { + $volume_todo = $this->obj->ref->volume - $this->obj->ref->volume_done; + } else { + $volume_todo = $this->obj->ref->volume_todo; + } + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['TaskVolumeTodo'],0,"volume_todo"); + $r .= ' <td><input size="10" maxlength="10" name="volume_todo" />'. $lang['hours'] ."</td>\n"; - echo ' <td colspan="4"><i>'. $lang['TaskVolumeTodo'] .': '. $volume_todo .' '. $lang['hours'] .'</i></td>'; + $r .= ' <td colspan="4"><i>'. $lang['TaskVolumeTodo'] .': '. $volume_todo .' '. $lang['hours'] .'</i></td>'; - echo "\n</tr>\n"; - } + $r .= "\n</tr>\n"; + } - if (!isset($this->obj->ratelist) || (count($this->obj->ratelist) == 0) ) { - echo "<tr>\n"; - echo $this->showfieldc($lang['TTcph'],0,"cph"); - echo ' <td colspan="1"><input size="10" maxlength="10" id="cph" name="cph" value="'. number_format($this->obj->cph,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\" />\n"; - echo Currency_Select("currency",$this->obj->currency); - echo "</td>\n"; - echo $this->showfieldc($lang['TTState'],1,"state"); - echo " <td colspan=\"1\">\n"; - echo $this->obj->askState(); - echo "</td>\n"; - echo " <td colspan=\"2\"> </td>\n"; - echo "</tr>\n"; - } + if (!isset($this->obj->list[userates]) || (count($this->obj->list[userates]) == 0) ) { + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['TTcph'],0,"cph"); + $r .= ' <td colspan="1"><input size="10" maxlength="10" id="cph" name="cph" value="'. number_format($this->obj->cph,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\" />\n"; + $r .= Currency_Select("currency",$this->obj->currency); + $r .= "</td>\n"; + $r .= $this->showfieldc($lang['TTState'],1,"state"); + $r .= " <td colspan=\"1\">\n"; + $r .= $this->obj->askState(); + $r .= "</td>\n"; + $r .= " <td colspan=\"2\"> </td>\n"; + $r .= "</tr>\n"; + } - # - # Edit additional custom fields - # - echo edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); - # References to modules - echo module_addforms($this->user,$this->obj,6); + // Edit additional custom fields + $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); + // References to modules + $r .= module_addforms($this->user,$this->obj,6); - echo "<tr>\n"; - echo $this->showfield($lang['Description'],1,"desc"); - echo $this->textarea("desc",5,$table['timetrack']['description'][size], $this->obj->desc ); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['Description'],1,"desc"); + $r .= $this->textarea("desc",5,$table['timetrack']['description'][size], $this->obj->desc ); + $r .= "</tr>\n"; - # - # Set Task to finished when ticked - # - if ( ($this->obj->ref->getType() == 'task') || ($this->obj->ref->getType() == 'product') ) { - echo "<tr>\n"; - echo $this->showfield($lang['TTRefFinished'],0,"finished"); - echo '<td><input type="checkbox" name="finished" value="1"></td>'; - echo "</tr>\n"; - } + // Set Task to finished when ticked + if ( ($this->obj->ref->getType() == 'task') || ($this->obj->ref->getType() == 'product') ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['TTRefFinished'],0,"finished"); + $r .= '<td><input type="checkbox" name="finished" value="1"></td>'; + $r .= "</tr>\n"; + } - echo "<tr>\n"; - if ( $this->obj->id != -1 ) { - echo submit_reset(0,1,1,1,3,0); - } else { - echo submit_reset(0,-1,1,1,3,0); - } - echo "</tr>\n"; + $r .= "<tr>\n"; + if ( $this->obj->id != -1 ) { + $r .= submit_reset(0,1,1,1,3,0); + } else { + $r .= submit_reset(0,-1,1,1,3,0); + } + $r .= "</tr>\n"; - echo $this->DataTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo $this->markBadFields(); - echo "</form>\n"; - echo $this->setfocus("ttadd.desc"); - echo $lang['FldsRequired'] ."\n"; - } - /** - * prepare - */ - Function prepare() - { - global $msg,$tutos,$lang; - # - # Mode - # 0 = classical Timetrack - # 1 = timerecord with a list of open entries - # 2 = timerecord editable - # - if ( isset($_GET['mode']) ) { - $this->mode = $_GET['mode']; - } else { - $this->mode = 0; - } - $this->obj = new timetrack($this->dbconn); - if ( isset($_GET['id']) && ($_GET['id'] > 0) ) { - # existing timetrack - $this->obj = $this->obj->read($_GET['id'],$this->obj); - if ( !is_object($this->obj) || ($this->obj->id < 0) ) { - $msg .= sprintf($lang['Err0040'],$lang['timetrack']); - $this->stop = true; - return; - } - if ( ($this->obj->t_start->notime == 0) && ( $this->mode != 2) ) { - $this->mode = 1; - } - } else { - # new stuff - if ( $this->mode == 1 ) { - $this->obj->t_start = new TUTOS_Date_Time(); - } - $this->obj->ref = $this->user; - } + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= $this->markBadFields(); + $r .= "</form>\n"; + $r .= $this->setfocus("ttadd.desc"); + $r .= $lang['FldsRequired'] ."\n"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$tutos,$lang; + // + // Mode + // 0 = classical Timetrack + // 1 = timerecord with a list of open entries + // 2 = timerecord editable + // + if ( isset($_GET['mode']) ) { + $this->mode = $_GET['mode']; + } else { + $this->mode = 0; + } + $this->obj = new timetrack($this->dbconn); + if ( isset($_GET['id']) && ($_GET['id'] > 0) ) { + // existing timetrack + $this->obj = $this->obj->read($_GET['id'],$this->obj); + if ( !is_object($this->obj) || ($this->obj->id < 0) ) { + $msg .= sprintf($lang['Err0040'],$lang['timetrack']); + $this->stop = true; + return; + } + if ( ($this->obj->t_start->notime == 0) && ( $this->mode != 2) ) { + $this->mode = 1; + } + } else { + // new stuff + if ( $this->mode == 1 ) { + $this->obj->t_start = new TUTOS_Date_Time(); + } + $this->obj->ref = $this->user; + } - if ( ($this->obj->id < 0) && !$this->user->feature_ok(usetimetrack,PERM_NEW) ) { - $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); - $this->stop = true; - } - if ( $this->mode != 0 ) { - $this->name = $lang['TTRecord']; - } else if ( $this->obj->id > 0 ) { - $this->name = $lang['TimetrackModify']; - } else { - $this->name = $lang['TimetrackNew']; - } + if ( ($this->obj->id < 0) && !$this->user->feature_ok(usetimetrack,PERM_NEW) ) { + $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); + $this->stop = true; + } + if ( $this->mode != 0 ) { + $this->name = $lang['TTRecord']; + } else if ( $this->obj->id > 0 ) { + $this->name = $lang['TimetrackModify']; + } else { + $this->name = $lang['TimetrackNew']; + } - if (true == $this->stop) return; + if (true == $this->stop) return; - if ( isset($_GET['reftype']) ) { - $this->obj->reftype = StripSlashes($_GET['reftype']); - } else { - $this->obj->reftype = ""; - } - if ( isset($_GET['desc']) ) { - $this->obj->desc = StripSlashes($_GET['desc']); - } - if ( isset($_GET['volume']) ) { - $this->obj->volume = $_GET['volume']; - } - if ( isset($_GET['state']) ) { - $this->obj->state = $_GET['state']; - } - if ( isset($_GET['cph']) ) { - $this->obj->cph = $_GET['cph']; - } - if ( isset($_GET['distance']) ) { - $this->obj->distance = $_GET['distance']; - } - if ( isset($_GET['currency']) ) { - $this->obj->currncy = $_GET['currency']; - } - if ( isset($_GET['wd']) ) { - $this->obj->wday->setDateTime($_GET['wd']); - } - if ( isset($_GET['start']) ) { - $this->obj->t_start->setDateTime($_GET['start']); - } - if ( isset($_GET['end']) ) { - $this->obj->t_end->setDateTime($_GET['end']); - } + if ( isset($_GET['reftype']) ) { + $this->obj->reftype = StripSlashes($_GET['reftype']); + } else { + $this->obj->reftype = ""; + } + if ( isset($_GET['desc']) ) { + $this->obj->desc = StripSlashes($_GET['desc']); + } + if ( isset($_GET['volume']) ) { + $this->obj->volume = $_GET['volume']; + } + if ( isset($_GET['state']) ) { + $this->obj->state = $_GET['state']; + } + if ( isset($_GET['cph']) ) { + $this->obj->cph = $_GET['cph']; + } + if ( isset($_GET['distance']) ) { + $this->obj->distance = $_GET['distance']; + } + if ( isset($_GET['currency']) ) { + $this->obj->currncy = $_GET['currency']; + } + if ( isset($_GET['wd']) ) { + $this->obj->wday->setDateTime($_GET['wd']); + } + if ( isset($_GET['start']) ) { + $this->obj->t_start->setDateTime($_GET['start']); + } + if ( isset($_GET['end']) ) { + $this->obj->t_end->setDateTime($_GET['end']); + } - preset_from_array_or_input($this->obj,'worker',"w"); - preset_from_array_or_input($this->obj,'ref',"l"); - $this->obj->read_relations(); + preset_from_array_or_input($this->obj,'worker',"w"); + preset_from_array_or_input($this->obj,'ref',"l"); + $this->obj->read_relations(); - if (!is_object($this->obj->ref)) { - $this->obj->link_id = -1; - } else { - $this->obj->link_id = $this->obj->ref->id; - } - if ( $this->obj->link_id == -1 ) { - $msg .= "Unknown reference"; - $this->stop = true; - } + if (!is_object($this->obj->ref)) { + $this->obj->link_id = -1; + } else { + $this->obj->link_id = $this->obj->ref->id; + } + if ( $this->obj->link_id == -1 ) { + $msg .= "Unknown reference"; + $this->stop = true; + } - # - # preset additional custom fields - # - preset_custom_fields($this->obj->gettype(),$this->obj); - # menu - $x = timetrack::getSelectLink($this->user); - $x[category][] = "obj"; - $this->addmenu($x); + // preset additional custom fields + preset_custom_fields($this->obj->gettype(),$this->obj); + // menu + $x = timetrack::getSelectLink($this->user); + $x[category][] = "obj"; + $this->addmenu($x); - $x = timetrack::getaddlink($this->user,$this->obj->ref); - $this->addMenu($x); + $x = timetrack::getaddlink($this->user,$this->obj->ref); + $this->addMenu($x); - if ( is_object($this->obj) && $this->obj->del_ok() && is_object($this->obj->ref) ) { - $x = array( url => $this->obj->getDelURL(), - text => $lang['Delete'], - info => sprintf($lang['TimetrackDelI'],$this->obj->ref->getFullname()), - confirm => true, - category => array("timetrack","del","obj") - ); - $this->addMenu($x); - } + if ( is_object($this->obj) && $this->obj->del_ok() && is_object($this->obj->ref) ) { + $x = array( url => $this->obj->getDelURL(), + text => $lang['Delete'], + info => sprintf($lang['TimetrackDelI'],$this->obj->ref->getFullname()), + confirm => true, + category => array("timetrack","del","obj") + ); + $this->addMenu($x); + } - add_module_newlinks($this,$this->obj); + add_module_newlinks($this,$this->obj); - // read the rates possible for this new timetrack - if ( class_exists ("rate") ) { - rate::obj_read($this->obj); - } - $this->addtohistory(); - } - } + // read the rates possible for this new timetrack + if ( class_exists ("rate") ) { + rate::obj_read($this->obj); + } + $this->addtohistory(); + } +} $l = new Timetrack_new($current_user); $l->display(); $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: team_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/team_show.php,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- team_show.php 29 Mar 2009 18:25:41 -0000 1.70 +++ team_show.php 30 Mar 2009 15:48:05 -0000 1.71 @@ -49,11 +49,11 @@ $pdf=new tutospdf($this->obj->dbconn); $pdf->Open(); - $pdf->setAuthor($this->obj->creator->getFullName()); - $pdf->setTitle($this->obj->getFullName()); - $pdf->setSubject($this->obj->getFullName()); + $pdf->setAuthor(myiconv($this->obj->creator->getFullName())); + $pdf->setTitle(myiconv($this->obj->getFullName())); + $pdf->setSubject(myiconv($this->obj->getFullName())); - $pdf->headtitle = $lang[$this->obj->getType()] .":". $this->obj->getFullName(); + $pdf->headtitle = myiconv($lang[$this->obj->getType()] .":". $this->obj->getFullName()); $pdf->AddPage(); $w = array(35,25,40,50,0); @@ -64,15 +64,15 @@ // Header $h = 8; $pdf->SetFont('Arial','B',$fs[0]); - $pdf->Cell($w[0],$h, $lang['AdrName'],1,0,$al[0]); + $pdf->Cell($w[0],$h, myiconv($lang['AdrName']),1,0,$al[0]); $pdf->SetFont('Arial','B',$fs[1]); - $pdf->Cell($w[1],$h, $lang['Description'],1,0,$al[1]); + $pdf->Cell($w[1],$h, myiconv($lang['Description']),1,0,$al[1]); $pdf->SetFont('Arial','B',$fs[2]); - $pdf->Cell($w[2],$h, $lang['Phone'],1,0,$al[2]); + $pdf->Cell($w[2],$h, myiconv($lang['Phone']),1,0,$al[2]); $pdf->SetFont('Arial','B',$fs[3]); - $pdf->Cell($w[3],$h, $lang['AdrEmail'],1,0,$al[3]); + $pdf->Cell($w[3],$h, myiconv($lang['AdrEmail']),1,0,$al[3]); $pdf->SetFont('Arial','B',$fs[4]); - $pdf->Cell($w[4],$h, $lang['AdrFax'],1,0,$al[4]); + $pdf->Cell($w[4],$h, myiconv($lang['AdrFax']),1,0,$al[4]); $pdf->Ln(); foreach ($this->obj->member as $obj ) { @@ -133,19 +133,19 @@ } // name $pdf->SetFont('Arial','',$fs[0]); - $pdf->Cell($w[0],$h, (isset($name[$i]) ? $name[$i]:" "),$border,0,$al[0]); + $pdf->Cell($w[0],$h, (isset($name[$i]) ? myiconv($name[$i]):" "),$border,0,$al[0]); // desc $pdf->SetFont('Arial','',$fs[1]); - $pdf->Cell($w[1],$h, (isset($d[$i]) ? $d[$i]:" "),$border,0,$al[1]); + $pdf->Cell($w[1],$h, (isset($d[$i]) ? myiconv($d[$i]):" "),$border,0,$al[1]); // phone $pdf->SetFont('Arial','',$fs[2]); - $pdf->Cell($w[2],$h,(isset($p[$i]) ? $p[$i] : " "),$border,0,$al[2]); + $pdf->Cell($w[2],$h,(isset($p[$i]) ? myiconv($p[$i]) : " "),$border,0,$al[2]); // email $pdf->SetFont('Arial','',$fs[3]); - $pdf->Cell($w[3],$h, (isset($e[$i]) ? $e[$i] : " "),$border,0,$al[3]); + $pdf->Cell($w[3],$h, (isset($e[$i]) ? myiconv($e[$i]) : " "),$border,0,$al[3]); // fax $pdf->SetFont('Arial','',$fs[4]); - $pdf->Cell($w[4],$h, (isset($f[$i]) ? $f[$i] : " "),$border,0,$al[4]); + $pdf->Cell($w[4],$h, (isset($f[$i]) ? myiconv($f[$i]) : " "),$border,0,$al[4]); $pdf->Ln(); } Index: address_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/address_overview.php,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- address_overview.php 29 Mar 2009 18:25:40 -0000 1.53 +++ address_overview.php 30 Mar 2009 15:48:05 -0000 1.54 @@ -80,9 +80,9 @@ } else if ( $_GET['action'] == -4 ) { $this->redirect = acl_action(); } - if (class_exists('watchlist')) { - watchlist::parse_action($this->user); - } + if (class_exists('watchlist')) { + watchlist::parse_action($this->user); + } } /** * prepare Index: company_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/company_new.php,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- company_new.php 29 Mar 2009 18:25:40 -0000 1.70 +++ company_new.php 30 Mar 2009 15:48:05 -0000 1.71 @@ -111,7 +111,7 @@ $r .= "</form>\n"; $r .= $this->setfocus("cmpadd.name"); $r .= $lang['FldsRequired'] ."\n"; - return $r; + return $r; } /** * naviagte |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:14
|
Update of /cvsroot/tutos/tutos/php/file In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/file Modified Files: file.pinc file_new.php file_overview.php file_select.php file_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: file_select.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/file/file_select.php,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- file_select.php 28 Oct 2007 16:16:35 -0000 1.10 +++ file_select.php 30 Mar 2009 15:48:06 -0000 1.11 @@ -1,6 +1,6 @@ <?php /** - * Copyright 2001 - 2007 by Gero Kohnert + * Copyright 2001 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -10,108 +10,105 @@ * @module file_select * @package file */ - $tutos['base'] = "../.."; - ini_set("include_path",".."); - include_once 'webelements.p3'; - include_once 'permission.p3'; +$tutos['base'] = "../.."; +ini_set("include_path",".."); +require_once 'webelements.p3'; +require_once 'permission.p3'; - /* Check if user is allowed to use it */ - check_user(); - loadmodules('file','select'); - loadmodule('file'); - loadlayout(); +// Check if user is allowed to use it +check_user(); +loadmodules('file','select'); +loadmodule('file'); +loadlayout(); - /** - * display a file selection form - */ - class file_select extends layout { - /** - * - */ - Function info() { - global $lang,$tutos; +/** + * display a file selection form + */ +class File_select extends layout { + /** + * + */ + Function info() { + global $lang,$tutos; - echo "<form id=\"filesearch\" name=\"filesearch\" method=\"get\" action=\"file_overview.php\">\n"; - echo hiddenFormElements(); - echo DoubleTableStart(); + $r = ''; + $r .= "<form id=\"filesearch\" name=\"filesearch\" method=\"get\" action=\"file_overview.php\">\n"; + $r .= hiddenFormElements(); + $r .= DoubleTableStart(); - echo "<tr>\n"; - if ( $this->ext == 0 ) { - echo "<th colspan=\"3\">". $lang['SearchForFile'] ."</th>\n"; + $r .= "<tr>\n"; + if ( $this->ext == 0 ) { + $r .= "<th colspan=\"3\">". $lang['SearchForFile'] ."</th>\n"; - echo "</tr><tr>\n"; + $r .= "</tr><tr>\n"; - echo $this->showfieldc($lang['AdrName']); - echo " <td align=\"center\"><input type=\"text\" value=\"\" name=\"name\"></td>\n"; - echo " <td align=\"center\">\n"; - echo " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForFile'] ."\"></td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\" align=\"center\"> </td>\n"; - echo " <td align=\"center\">". makelink("file/file_select.php?ext=1",$lang['extended']) ."</td>\n"; - } else { - echo "<th colspan=\"3\">". $lang['SearchForFileExt'] ."</th>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['AdrName']); - echo " <td> <input type=\"text\" value=\"\" name=\"name\">"; - echo " </td>\n"; - echo " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForFileExt'] ."\"></td>\n"; + $r .= $this->showfieldc($lang['AdrName']); + $r .= " <td align=\"center\"><input type=\"text\" value=\"\" name=\"name\"></td>\n"; + $r .= " <td align=\"center\">\n"; + $r .= " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForFile'] ."\"></td>\n"; + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\" align=\"center\"> </td>\n"; + $r .= " <td align=\"center\">". makelink("file/file_select.php?ext=1",$lang['extended']) ."</td>\n"; + } else { + $r .= "<th colspan=\"3\">". $lang['SearchForFileExt'] ."</th>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['AdrName']); + $r .= " <td> <input type=\"text\" value=\"\" name=\"name\">"; + $r .= " </td>\n"; + $r .= " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForFileExt'] ."\"></td>\n"; - echo "</tr><tr>\n"; - echo " <td rowspan=\"2\" class=\"desc\">". $lang['TimetrackBetween'] ."</td>\n"; - echo " <td colspan=\"2\"> "; - echo $this->fd->EnterDate("f",1); - echo " </td>\n"; + $r .= "</tr><tr>\n"; + $r .= " <td rowspan=\"2\" class=\"desc\">". $lang['TimetrackBetween'] ."</td>\n"; + $r .= " <td colspan=\"2\"> "; + $r .= $this->fd->EnterDate("f",1); + $r .= " </td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\"> "; - echo $this->td->EnterDate("t",1); - echo " </td>\n"; - } - echo "</tr>\n"; - echo DoubleTableEnd(); - echo "</form>\n"; + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\"> "; + $r .= $this->td->EnterDate("t",1); + $r .= " </td>\n"; + } + $r .= "</tr>\n"; + $r .= DoubleTableEnd(); + $r .= "</form>\n"; - echo $this->setfocus("filesearch.name"); - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + $r .= $this->setfocus("filesearch.name"); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->name = $lang['FileSearch']; - $this->center = true; - $this->css_class = 'selectbox'; - $this->ext = 0; + $this->name = $lang['FileSearch']; + $this->center = true; + $this->css_class = 'selectbox'; + $this->ext = 0; - # Defaults for search - $this->fd = new TUTOS_Date_Time(0); - $this->td = new TUTOS_Date_Time(0); - if ( isset($_SESSION['filesearchfrom']) ) { - $this->fd->setDateTime($_SESSION['filesearchfrom']); - } - if ( isset($_SESSION['filesearchto']) ) { - $this->td->setDateTime($_SESSION['filesearchto']); - } - if ( isset($_GET['ext']) ) { - $this->ext = $_GET['ext']; - } - if ( ! $this->user->feature_ok(usedocmanagement,PERM_SEL) ) { - $this->stop = true; - } - } - } + // Defaults for search + $this->fd = new TUTOS_Date_Time(0); + $this->td = new TUTOS_Date_Time(0); + if ( isset($_SESSION['filesearchfrom']) ) { + $this->fd->setDateTime($_SESSION['filesearchfrom']); + } + if ( isset($_SESSION['filesearchto']) ) { + $this->td->setDateTime($_SESSION['filesearchto']); + } + if ( isset($_GET['ext']) ) { + $this->ext = $_GET['ext']; + } + if ( ! $this->user->feature_ok(usedocmanagement,PERM_SEL) ) { + $this->stop = true; + } + } +} - $l = new file_select($current_user); - $l->display(); - $dbconn->Close(); +$l = new File_select($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: file.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/file/file.pinc,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- file.pinc 29 Mar 2009 18:25:41 -0000 1.86 +++ file.pinc 30 Mar 2009 15:48:06 -0000 1.87 @@ -455,13 +455,23 @@ $r .= "Comment :" . $za->comment . "\n"; $za->close(); } else { - @passthru("zipinfo -zt \"". $fname ."\""); + $p = popen ('zipinfo -zt "'. $fname .'"','r'); + if (!is_resource($p)) die ('Problems with: zipinfo'); + while(!feof($p)) { + $r .= htmlentities(fread($p,1024)); + } + pclose($p); } $r .= "</pre>\n"; } elseif ( eregi("\.pdf$",$this->filename) || ($this->filetype == "application/pdf") ) { if (file_exists($tutos[pdfinfo]) && is_executable($tutos[pdfinfo])) { $r .= "PDF Info<pre>"; - @passthru($tutos[pdfinfo] . " \"". $fname ."\""); + $p = popen ($tutos[pdfinfo]. ' "'. $fname .'"','r'); + if (!is_resource($p)) die ('Problems with:'. $tutos[pdfinfo]); + while(!feof($p)) { + $r .= htmlentities(fread($p,1024)); + } + pclose($p); $r .= "</pre>\n"; } else { $x = get_pdf_prop($fname); Index: file_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/file/file_new.php,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- file_new.php 13 Mar 2009 20:00:40 -0000 1.33 +++ file_new.php 30 Mar 2009 15:48:06 -0000 1.34 @@ -26,267 +26,262 @@ * change/modify a document */ class File_new extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang,$table; + /** + * display the form + */ + Function info() { + global $tutos,$lang,$table; - $this->width = 4; - echo "<form id=\"fileadd\" name=\"fileadd\" enctype=\"multipart/form-data\" method=\"post\" action=\"file_ins.php\">\n"; + $r = ''; + $this->width = 4; + $r .= "<form id=\"fileadd\" name=\"fileadd\" enctype=\"multipart/form-data\" method=\"post\" action=\"file_ins.php\">\n"; - if ( $this->obj->id > 0 ) { - $this->addHidden("id",$this->obj->id); - } - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); + if ( $this->obj->id > 0 ) { + $this->addHidden("id",$this->obj->id); + } + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); - echo "<tr>\n"; - echo $this->showfieldc($lang['FileNameDoc'],1,"name"); - echo ' <td><input id="name" maxlength="'.$table['file']['name'][size]."\" name=\"name\" value=\"". $this->obj->name ."\" /></td>\n"; - echo $this->showfieldc($lang['FileVersion'],0,"version"); - echo ' <td><input id="version" size="10" maxlength="'.$table['file']['version'][size].'" name="version" value="'. $this->obj->version ."\" /></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['FileNameDoc'],1,"name"); + $r .= ' <td><input id="name" maxlength="'.$table['file']['name'][size]."\" name=\"name\" value=\"". $this->obj->name ."\" /></td>\n"; + $r .= $this->showfieldc($lang['FileVersion'],0,"version"); + $r .= ' <td><input id="version" size="10" maxlength="'.$table['file']['version'][size].'" name="version" value="'. $this->obj->version ."\" /></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['FileAuthor'],0,"a"); - echo " <td colspan=\"3\">\n"; - echo select_from_array_or_input($this->obj,"a",$this->obj->author,0,'at'); - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['FileAuthor'],0,"a"); + $r .= " <td colspan=\"3\">\n"; + $r .= select_from_array_or_input($this->obj,"a",$this->obj->author,0,'at'); + $r .= " </td>\n"; + $r .= "</tr>\n"; - $cnt = 0; - foreach ($this->obj->links as $i => $f) { - echo "<tr>\n"; - if ($cnt == 0) { - echo $this->showfield($lang['FileReference'],0,"link_id_".$cnt); - } else { - echo "<td> </td>\n"; - } - echo " <td colspan=\"2\">\n"; - echo ' <select id="link_id_'. $cnt ."\" name=\"link_id[]\">\n"; - foreach ($this->obj->plist[$i] as $i1 => $f1) { - echo " <option value=\"". $i1 ."\"". ($i1 == $i ? ' selected="selected">* ':'>') . $lang[$f1->getType()] .": ". myentities($f1->getFullName()) ."</option>\n"; - } - echo " </select>\n"; - $cnt++; - echo " </td>\n"; - echo " <td align=\"left\"> \n"; - if (count($this->obj->links) > 1) { - echo "<input type=\"checkbox\" id=\"del[]\" name=\"del[]\" value=\"". $i ."\" />". $lang['Remove']." ". $f->getLink(); - } - echo " </td>\n"; + $cnt = 0; + foreach ($this->obj->links as $i => $f) { + $r .= "<tr>\n"; + if ($cnt == 0) { + $r .= $this->showfield($lang['FileReference'],0,"link_id_".$cnt); + } else { + $r .= "<td> </td>\n"; + } + $r .= " <td colspan=\"2\">\n"; + $r .= ' <select id="link_id_'. $cnt ."\" name=\"link_id[]\">\n"; + foreach ($this->obj->plist[$i] as $i1 => $f1) { + $r .= " <option value=\"". $i1 ."\"". ($i1 == $i ? ' selected="selected">* ':'>') . $lang[$f1->getType()] .": ". myentities($f1->getFullName()) ."</option>\n"; + } + $r .= " </select>\n"; + $cnt++; + $r .= " </td>\n"; + $r .= " <td align=\"left\"> \n"; + if (count($this->obj->links) > 1) { + $r .= "<input type=\"checkbox\" id=\"del[]\" name=\"del[]\" value=\"". $i ."\" />". $lang['Remove']." ". $f->getLink(); + } + $r .= " </td>\n"; - echo "</tr>\n"; - } - # Allow new References - echo "<tr>\n"; - if ($cnt == 0) { - echo $this->showfield($lang['FileReference'],0,"link_id_".$cnt); - } else { - echo "<td> </td>\n"; - } - if (count($this->refl) > 0) { - echo " <td colspan=\"3\">"; - echo " <select name=\"link_id[]\">\n"; - echo " <option value=\"-1\" selcted=\"selected\">--</option>\n"; - foreach ($this->refl as $f) { - echo " <option value=\"". $f->id ."\">". $lang[$f->getType()] .": ". myentities($f->getFullName()) ."</option>\n"; - } - echo " </select>\n"; - echo " </td>\n"; - } else { - echo " <td colspan=\"3\">"; - echo " <select name=\"reftype\">\n"; - echo " <option value=\"0\">--</option>\n"; - foreach ($tutos['docowners'] as $f) { - if (! class_exists($f)) continue; - $x = new $f($this->dbconn); - if (method_exists($x,"search_by_name")) { - echo " <option value=\"". $f ."\"". ($this->reftype == $f ? " selected":"") .">". $lang[$x->getType()] ."</option>\n"; - } - } - echo " </select>\n"; - echo " <input name=\"refname\" size=\"30\" value=\"". myentities($this->refname)."\" />\n"; - echo " </td>\n"; - } - echo "</tr>\n"; + $r .= "</tr>\n"; + } +# Allow new References + $r .= "<tr>\n"; + if ($cnt == 0) { + $r .= $this->showfield($lang['FileReference'],0,"link_id_".$cnt); + } else { + $r .= "<td> </td>\n"; + } + if (count($this->refl) > 0) { + $r .= " <td colspan=\"3\">"; + $r .= " <select name=\"link_id[]\">\n"; + $r .= " <option value=\"-1\" selcted=\"selected\">--</option>\n"; + foreach ($this->refl as $f) { + $r .= " <option value=\"". $f->id ."\">". $lang[$f->getType()] .": ". myentities($f->getFullName()) ."</option>\n"; + } + $r .= " </select>\n"; + $r .= " </td>\n"; + } else { + $r .= " <td colspan=\"3\">"; + $r .= " <select name=\"reftype\">\n"; + $r .= " <option value=\"0\">--</option>\n"; + foreach ($tutos['docowners'] as $f) { + if (! class_exists($f)) continue; + $x = new $f($this->dbconn); + if (method_exists($x,"search_by_name")) { + $r .= " <option value=\"". $f ."\"". ($this->reftype == $f ? " selected":"") .">". $lang[$x->getType()] ."</option>\n"; + } + } + $r .= " </select>\n"; + $r .= " <input name=\"refname\" size=\"30\" value=\"". myentities($this->refname)."\" />\n"; + $r .= " </td>\n"; + } + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['FileName'],0,"file"); - echo ' <td colspan="3"><input id="file1" size="40" name="file1" type="file" value="'. $this->obj->filename ."\" />\n"; - if ( $this->obj->id != -1 ) { - echo "<br /><font size=\"-1\">". $this->obj->filename ."</font>"; - } - echo "<br /><font size=\"-1\">(max. allowed size = ". ini_get('upload_max_filesize') ." Bytes)</font>"; - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileName'],0,"file"); + $r .= ' <td colspan="3"><input id="file1" size="40" name="file1" type="file" value="'. $this->obj->filename ."\" />\n"; + if ( $this->obj->id != -1 ) { + $r .= "<br /><font size=\"-1\">". $this->obj->filename ."</font>"; + } + $r .= "<br /><font size=\"-1\">(max. allowed size = ". ini_get('upload_max_filesize') ." Bytes)</font>"; + $r .= " </td>\n"; + $r .= "</tr>\n"; - if ($tutos['file_local_allow']) { - echo "<tr>\n"; - echo $this->showfield($lang['FileName'],0,"file2"); - echo ' <td colspan="4"><i>'. sprintf($lang['FileLocalInfo'],$tutos['file_local_searchpath'])."</i></td>\n"; - echo "</tr>\n"; - echo "<tr>\n"; - echo " <td></td>\n"; - echo " <td id=\"file\" colspan=\"3\">\n"; + if ($tutos['file_local_allow']) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileName'],0,"file2"); + $r .= ' <td colspan="4"><i>'. sprintf($lang['FileLocalInfo'],$tutos['file_local_searchpath'])."</i></td>\n"; + $r .= "</tr>\n"; + $r .= "<tr>\n"; + $r .= " <td></td>\n"; + $r .= " <td id=\"file\" colspan=\"3\">\n"; - echo tutos_file::get_local_selection(); - echo " </td>\n"; - echo "</tr>\n"; - } + $r .= tutos_file::get_local_selection(); + $r .= " </td>\n"; + $r .= "</tr>\n"; + } - if ( ($this->obj->id != -1) && ($this->obj->vsys != 0) ) { - echo "<tr>\n"; - echo $this->showfield($lang['FileVersioning'],0,"save"); - echo " <td id=\"save\" colspan=\"3\">\n"; - echo " <font size=\"-1\"><i>". $lang['FileVersioningI'] ."</i></font><br />\n"; - echo ' <input type="radio" name="save" value="0" /> '. sprintf($lang['FileOverwrite'],$this->obj->getFullname()) ."<br />\n"; - echo ' <input type="radio" name="save" value="1" checked="checked" /> '. sprintf($lang['FileSave'],$this->obj->name,$this->obj->version) ."\n"; - echo " </td>\n"; - echo "</tr>\n"; - } - if ( $this->obj->id == -1 ) { - echo "<tr>\n"; - echo $this->showfield($lang['FileVersionType'],0,"vsys"); - echo " <td id=\"vsys\" colspan=\"3\"> \n"; - echo ' <font size="-1"><i>'. $lang['FileVersionTypeI'] ."</i></font><br />\n"; - echo ' <input type="radio" name="vsys" value="0"'. ( $this->obj->vsys == 0 ? ' checked="checked"':'') ." /> none \n"; - echo ' <input type="radio" name="vsys" value="1"'. ( $this->obj->vsys == 1 ? ' checked="checked"':'') ." /> TUTOS \n"; - if ( file_exists($tutos[file_ci]) && is_executable($tutos[file_ci]) ) { - echo " <input type=\"radio\" name=\"vsys\" value=\"2\"". ( $this->obj->vsys == 2 ? ' checked="checked"':'') ." /> RCS \n"; - } - echo " </td>\n"; - echo "</tr>\n"; - } + if ( ($this->obj->id != -1) && ($this->obj->vsys != 0) ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileVersioning'],0,"save"); + $r .= " <td id=\"save\" colspan=\"3\">\n"; + $r .= " <font size=\"-1\"><i>". $lang['FileVersioningI'] ."</i></font><br />\n"; + $r .= ' <input type="radio" name="save" value="0" /> '. sprintf($lang['FileOverwrite'],$this->obj->getFullname()) ."<br />\n"; + $r .= ' <input type="radio" name="save" value="1" checked="checked" /> '. sprintf($lang['FileSave'],$this->obj->name,$this->obj->version) ."\n"; + $r .= " </td>\n"; + $r .= "</tr>\n"; + } + if ( $this->obj->id == -1 ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileVersionType'],0,"vsys"); + $r .= " <td id=\"vsys\" colspan=\"3\"> \n"; + $r .= ' <font size="-1"><i>'. $lang['FileVersionTypeI'] ."</i></font><br />\n"; + $r .= ' <input type="radio" name="vsys" value="0"'. ( $this->obj->vsys == 0 ? ' checked="checked"':'') ." /> none \n"; + $r .= ' <input type="radio" name="vsys" value="1"'. ( $this->obj->vsys == 1 ? ' checked="checked"':'') ." /> TUTOS \n"; + if ( file_exists($tutos[file_ci]) && is_executable($tutos[file_ci]) ) { + $r .= " <input type=\"radio\" name=\"vsys\" value=\"2\"". ( $this->obj->vsys == 2 ? ' checked="checked"':'') ." /> RCS \n"; + } + $r .= " </td>\n"; + $r .= "</tr>\n"; + } - echo "<tr>\n"; - echo $this->showfield($lang['FileLocking'],0,"locked"); - echo " <td id=\"locked\" colspan=\"3\"> \n"; - echo " <input type=\"radio\" name=\"locked\" value=\"0\" ". ( $this->obj->locked == 0 ? ' checked="checked"':'') ." /> ". $lang['FileUnlocked'] ."\n"; - echo " <input type=\"radio\" name=\"locked\" value=\"". $this->user->id ."\"". ( $this->obj->locked == $this->user->id ? ' checked="checked"':'') ." /> ". sprintf ($lang['FileLocked'], $this->user->getLink()) ."\n" ; - echo " </td>\n"; - echo "</tr>\n"; - # - # Edit additional custom fields - # - echo edit_custom_fields($this,$this->obj->gettype(),$this->obj,4); + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileLocking'],0,"locked"); + $r .= " <td id=\"locked\" colspan=\"3\"> \n"; + $r .= " <input type=\"radio\" name=\"locked\" value=\"0\" ". ( $this->obj->locked == 0 ? ' checked="checked"':'') ." /> ". $lang['FileUnlocked'] ."\n"; + $r .= " <input type=\"radio\" name=\"locked\" value=\"". $this->user->id ."\"". ( $this->obj->locked == $this->user->id ? ' checked="checked"':'') ." /> ". sprintf ($lang['FileLocked'], $this->user->getLink()) ."\n" ; + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo module_addforms($this->user,$this->obj,4); + // Edit additional custom fields + $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,4); - echo "<tr>\n"; - if ( isset($this->obj->id) && ($this->obj->id != -1) ) { - echo submit_reset(0,1,1,1,1,0); - } else { - echo submit_reset(0,-1,1,1,1,0); - } - echo "</tr>\n"; + $r .= module_addforms($this->user,$this->obj,4); - echo $this->DataTableEnd(); - echo hiddenFormElements(); - $this->addHidden("gotourl","file/file_new.php"); - echo $this->getHidden(); - echo $this->markBadFields(); - echo "</form>\n"; - echo $lang['FldsRequired'] ."\n"; - echo $this->setfocus("fileadd.name"); - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang,$tutos; + $r .= "<tr>\n"; + if ( isset($this->obj->id) && ($this->obj->id != -1) ) { + $r .= submit_reset(0,1,1,1,1,0); + } else { + $r .= submit_reset(0,-1,1,1,1,0); + } + $r .= "</tr>\n"; - $this->refl = array(); - $this->refname = ""; - $this->reftype = "0"; - $this->obj = new tutos_file($this->dbconn); - if ( isset($_GET['id']) ){ - $this->name = $lang['FileMod']; - $this->obj = $this->obj->read($_GET['id'],$this->obj); - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['File']); - $this->stop = true ; - return; - } else if ( ! $this->obj->mod_ok() ) { - $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } - $this->name .= ": ".$this->obj->getFullName(); - } else { - $this->name = $lang['FileCreation']; - if ( ! $this->user->feature_ok(usedocmanagement,PERM_NEW) ) { - $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); - $this->stop = true; - } - } + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $this->addHidden("gotourl","file/file_new.php"); + $r .= $this->getHidden(); + $r .= $this->markBadFields(); + $r .= "</form>\n"; + $r .= $lang['FldsRequired'] ."\n"; + $r .= $this->setfocus("fileadd.name"); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang,$tutos; - if ( isset($_GET['link_id']) && is_array($_GET['link_id']) ){ - $arr = $_GET['link_id']; - foreach($arr as $i) { - $l = getObject($this->dbconn,$i); - $this->obj->links[$l->id] = &$l; - unset($l); - } - } - if ( isset($_GET['link_id']) && is_numeric($_GET['link_id']) ){ - $arr = $_GET['link_id']; - $l = getObject($this->dbconn,$arr); - $this->obj->links[$l->id] = &$l; - } - if ( isset($_GET['refl']) && is_array($_GET['refl']) ){ - $arr = $_GET['refl']; - foreach($arr as $i) { - $l = getObject($this->dbconn,$i); - $this->refl[$l->id] = &$l; - unset($l); - } - } - if ( isset($_GET['refname']) ) { - $this->refname = Stripslashes($_GET['refname']); - } - if ( isset($_GET['reftype']) ) { - $this->reftype = Stripslashes($_GET['reftype']); - } + $this->refl = array(); + $this->refname = ""; + $this->reftype = "0"; + $this->obj = new tutos_file($this->dbconn); + if ( isset($_GET['id']) ){ + $this->name = $lang['FileMod']; + $this->obj = $this->obj->read($_GET['id'],$this->obj); + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['File']); + $this->stop = true ; + return; + } else if ( ! $this->obj->mod_ok() ) { + $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } + $this->name .= ": ".$this->obj->getFullName(); + } else { + $this->name = $lang['FileCreation']; + if ( ! $this->user->feature_ok(usedocmanagement,PERM_NEW) ) { + $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); + $this->stop = true; + } + } - if ( isset($_GET['name']) ){ - $this->obj->name = StripSlashes($_GET['name']); - } - if ( isset($_GET['version']) ){ - $this->obj->version = StripSlashes($_GET['version']); - } - preset_from_array_or_input($this->obj,'author',"a"); + if ( isset($_GET['link_id']) && is_array($_GET['link_id']) ){ + $arr = $_GET['link_id']; + foreach($arr as $i) { + $l = getObject($this->dbconn,$i); + $this->obj->links[$l->id] = &$l; + unset($l); + } + } + if ( isset($_GET['link_id']) && is_numeric($_GET['link_id']) ){ + $arr = $_GET['link_id']; + $l = getObject($this->dbconn,$arr); + $this->obj->links[$l->id] = &$l; + } + if ( isset($_GET['refl']) && is_array($_GET['refl']) ){ + $arr = $_GET['refl']; + foreach($arr as $i) { + $l = getObject($this->dbconn,$i); + $this->refl[$l->id] = &$l; + unset($l); + } + } + if ( isset($_GET['refname']) ) { + $this->refname = Stripslashes($_GET['refname']); + } + if ( isset($_GET['reftype']) ) { + $this->reftype = Stripslashes($_GET['reftype']); + } - $this->obj->readLinks(); - $this->obj->read_relations(); - # - # preset additional custom fields - # - preset_custom_fields($this->obj->gettype(),$this->obj); - # menu - $m = tutos_file::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addmenu($m); + if ( isset($_GET['name']) ){ + $this->obj->name = StripSlashes($_GET['name']); + } + if ( isset($_GET['version']) ){ + $this->obj->version = StripSlashes($_GET['version']); + } + preset_from_array_or_input($this->obj,'author',"a"); - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => "file/file_del.php?id=". $this->obj->id, - text => $lang['Delete'], - info => sprintf($lang['FileDeleteI'],$this->obj->getFullName()), - confirm => true, - category => array("file","del","obj") - ); - $this->addMenu($x); - } + $this->obj->readLinks(); + $this->obj->read_relations(); - add_module_newlinks($this,$this->obj); - } + // preset additional custom fields + preset_custom_fields($this->obj->gettype(),$this->obj); + // menu + $m = tutos_file::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addmenu($m); + + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => "file/file_del.php?id=". $this->obj->id, + text => $lang['Delete'], + info => sprintf($lang['FileDeleteI'],$this->obj->getFullName()), + confirm => true, + category => array("file","del","obj") + ); + $this->addMenu($x); + } + + add_module_newlinks($this,$this->obj); + } } $l = new File_new($current_user); @@ -294,6 +289,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: file_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/file/file_show.php,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- file_show.php 29 Mar 2009 18:25:41 -0000 1.28 +++ file_show.php 30 Mar 2009 15:48:06 -0000 1.29 @@ -18,7 +18,7 @@ require_once 'webelements.p3'; require_once 'permission.p3'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('file','show'); loadmodule('file'); Index: file_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/file/file_overview.php,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- file_overview.php 13 Mar 2009 14:22:22 -0000 1.27 +++ file_overview.php 30 Mar 2009 15:48:06 -0000 1.28 @@ -16,7 +16,7 @@ require_once 'webelements.p3'; require_once 'permission.p3'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('file','overview'); loadmodule('file'); @@ -26,280 +26,276 @@ * show a overview of files */ class File_overview extends layout { - /** - * display the info - */ - Function info() { - global $lang,$tutos; + /** + * display the info + */ + Function info() { + global $lang,$tutos; - $n = $this->result->numrows(); + $r = ''; + $n = $this->result->numrows(); - if ( $this->start == -1 ) { - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } + if ( $this->start == -1 ) { + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } - echo $this->actionformStart("file_overview.php"); - echo $this->OverviewTableStart(); - echo "<thead>\n"; - echo "<tr>\n"; - echo $this->orderHeader("name",$lang['FileNameDoc'],$this->link2); - echo $this->orderHeader("version",$lang['FileVersion'],$this->link2); - echo $this->orderHeader("filename",$lang['FileName'],$this->link2); - echo $this->orderHeader("",$lang['FileReference'],$this->link2); - echo $this->orderHeader("f_size",$lang['FileSize'],$this->link2); - echo $this->orderHeader("creation",$lang['created'],$this->link2); - $this->flds = 6; - echo show_custom_overview_headers($this,'file',$this->link2); - if ( $tutos[massupdate] == 1 ) { - echo " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - } - echo "</tr>\n"; - echo "</thead>\n"; + $r .= $this->actionformStart("file_overview.php"); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + $r .= $this->orderHeader("name",$lang['FileNameDoc'],$this->link2); + $r .= $this->orderHeader("version",$lang['FileVersion'],$this->link2); + $r .= $this->orderHeader("filename",$lang['FileName'],$this->link2); + $r .= $this->orderHeader("",$lang['FileReference'],$this->link2); + $r .= $this->orderHeader("f_size",$lang['FileSize'],$this->link2); + $r .= $this->orderHeader("creation",$lang['created'],$this->link2); + $this->flds = 6; + $r .= show_custom_overview_headers($this,'file',$this->link2); + if ( $tutos[massupdate] == 1 ) { + $r .= " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + } + $r .= "</tr>\n"; + $r .= "</thead>\n"; - $line = 0; - while ( ($a < $n) && ($a < $end) ) { - $f = new tutos_file($this->dbconn); - $f->read_result($this->result,$a); - $f->readLinks(); + $line = 0; + while ( ($a < $n) && ($a < $end) ) { + $f = new tutos_file($this->dbconn); + $f->read_result($this->result,$a); + $f->readLinks(); - echo $this->OverviewRowStart($line); - echo " <td valign=\"top\">"; - $x = myentities($f->name); - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - if ( $f->see_ok() ) { - echo makelink($f->getUrl(),$x); - } else { - echo $x; - } - echo "</td>\n"; - $x = $f->version; - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - echo " <td valign=\"top\" align=\"right\">". $x ." </td>\n"; + $r .= $this->OverviewRowStart($line); + $r .= " <td valign=\"top\">"; + $x = myentities($f->name); + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + if ( $f->see_ok() ) { + $r .= makelink($f->getUrl(),$x); + } else { + $r .= $x; + } + $r .= "</td>\n"; + $x = $f->version; + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + $r .= " <td valign=\"top\" align=\"right\">". $x ." </td>\n"; - $x = $f->filename; - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - echo " <td valign=\"top\">". $x ."</td>\n"; + $x = $f->filename; + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + $r .= " <td valign=\"top\">". $x ."</td>\n"; - echo " <td valign=\"top\" align=\"right\">"; - if ( count($f->links) ) { - foreach ($f->links as $ref) { - echo $ref->getLink()."<br />"; - } - } else { - echo "--"; - } - echo "</td>\n"; - echo " <td valign=\"top\" align=\"right\">". $f->filesize ."</td>\n"; - echo " <td valign=\"top\" align=\"right\">". $f->creation->getDateTime() ." </td>\n"; + $r .= " <td valign=\"top\" align=\"right\">"; + if ( count($f->links) ) { + foreach ($f->links as $ref) { + $r .= $ref->getLink()."<br />"; + } + } else { + $r .= "--"; + } + $r .= "</td>\n"; + $r .= " <td valign=\"top\" align=\"right\">". $f->filesize ."</td>\n"; + $r .= " <td valign=\"top\" align=\"right\">". $f->creation->getDateTime() ." </td>\n"; - echo show_custom_overview_data($this,'file',$f); + $r .= show_custom_overview_data($this,'file',$f); - if ( $tutos[massupdate] == 1 ) { - echo " <td align=\"center\">\n"; - if ( $f->mod_ok() ) { - echo '<input name="mark[]" type="checkbox" value="'. $f->id ."\" />\n"; - } else { - echo "-\n"; - } - echo "</td>\n"; - } + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $f->mod_ok() ) { + $r .= '<input name="mark[]" type="checkbox" value="'. $f->id ."\" />\n"; + } else { + $r .= "-\n"; + } + $r .= "</td>\n"; + } - echo $this->OverviewRowEnd($line++); - $a++; - } - $this->result->free(); + $r .= $this->OverviewRowEnd($line++); + $a++; + } + $this->result->free(); - echo $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); - if ( $tutos[massupdate] == 1 ) { - echo $this->UpdateRowStart($this->flds-1); - echo sprintf($lang['withmarked'],$lang['Files']); - echo " <select name=\"action\">\n"; - echo ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; - echo ' <option value="-2">'. $lang['Delete'] ."</option>\n"; - echo ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - echo " <option value=\"WatchAdd\">". $lang['WatchAdd'] ."</option>\n"; - echo " <option value=\"WatchDel\">". $lang['WatchDel'] ."</option>\n"; - } - echo "</select>\n"; - echo $this->UpdateRowEnd(2); - } - echo $this->OverviewTableEnd(); - echo $this->actionformEnd("file_overview.php"); - } - /** - * navigate - */ - Function navigate() { - } - /** - * action via massupdate - */ - Function action() { - global $lang,$msg; + $r .= $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart($this->flds-1); + $r .= sprintf($lang['withmarked'],$lang['Files']); + $r .= " <select name=\"action\">\n"; + $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; + $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; + $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; + if (class_exists('watchlist')) { + $r .= watchlist::action_options(); + } + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(2); + } + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("file_overview.php"); + return $r; + } + /** + * action via massupdate + */ + Function action() { + global $lang,$msg; - if ( $_GET['action'] == -2 ) { - $this->dbconn->Begin("WORK"); - foreach ($_GET['mark'] as $key => $val) { - $b = new tutos_file($this->dbconn); - $b = $b->read($val,$b); - if ( $b->id != $val ) { - continue; - } - if ( $b->del_ok() ) { - $msg .= sprintf($lang['FileDeleteI'], $b->getFullName()) ."<br />"; - $msg .= $b->delete(); - } else { - $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; - } - unset($b); - } - $this->dbconn->Commit("WORK"); - return; - } - if ( $_GET['action'] == -4 ) { - $this->redirect = "../" . acl_action(); - return; - } - if (class_exists('watchlist')) { - watchlist::parse_action($this->user); - } - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang,$tutos; + if ( $_GET['action'] == -2 ) { + $this->dbconn->Begin("WORK"); + foreach ($_GET['mark'] as $val) { + $b = new tutos_file($this->dbconn); + $b = $b->read($val,$b); + if ( $b->id != $val ) { + continue; + } + if ( $b->del_ok() ) { + $msg .= sprintf($lang['FileDeleteI'], $b->getFullName()) ."<br />"; + $msg .= $b->delete(); + } else { + $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; + } + unset($b); + } + $this->dbconn->Commit("WORK"); + return; + } + if ( $_GET['action'] == -4 ) { + $this->redirect = "../" . acl_action(); + return; + } + if (class_exists('watchlist')) { + watchlist::parse_action($this->user); + } + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang,$tutos; - $this->name = $lang['FileOverview']; - $this->css_class = 'overviewbox'; + $this->name = $lang['FileOverview']; + $this->css_class = 'overviewbox'; - if ( ! $this->user->feature_ok(usedocmanagement,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + if ( ! $this->user->feature_ok(usedocmanagement,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - $this->link1 = "file/file_overview.php"; + $this->link1 = "file/file_overview.php"; - # Optimize HERE !!! - $this->q = 'SELECT distinct f.* FROM '. $this->dbconn->prefix .'files f,'. $this->dbconn->prefix .'filelink l'; - if(! $this->user->isadmin()) { - $this->q .= ",".$this->dbconn->prefix ."acl a"; - } + // TODO: Optimize HERE !!! + $this->q = 'SELECT distinct f.* FROM '. $this->dbconn->prefix .'files f,'. $this->dbconn->prefix .'filelink l'; + if(! $this->user->isadmin()) { + $this->q .= ",".$this->dbconn->prefix ."acl a"; + } - $pre = " WHERE " ; + $pre = " WHERE " ; - if ( isset($_GET['link_id']) && is_numeric($_GET['link_id']) ) { - $this->q .= $pre . "( (f.link_id = ".$_GET['link_id'].") OR (l.f_id = f.id and l.link_id = ". $_GET['link_id'] ."))"; - $pre = " AND " ; - $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); - } - if ( isset($_GET['author']) ) { - $this->q .= $pre . " f.author = ". $_GET['author']; - $pre = " AND " ; - $this->link1 = addUrlParameter($this->link1,"author=". $_GET['author']); - } - if ( isset($_GET['creator']) ) { - $this->q .= $pre . " f.creator = ". $_GET['creator']; - $pre = " AND " ; - $this->link1 = addUrlParameter($this->link1,"creator=". $_GET['creator']); - } - if ( isset($_GET['type']) ) { - $this->q .= $pre . $this->dbconn->Like("f.type",$_GET['type']); - $pre = " AND " ; - $this->link1 = addUrlParameter($this->link1,"type=". UrlEncode($_GET['type'])); - } - if ( isset($_GET['name']) && ($_GET['name'] != "") ) { - $this->q .= $pre . "("; - $this->q .= $this->dbconn->Like("f.name",$_GET['name']); - $this->q .= " OR ". $this->dbconn->Like("filename",$_GET['name']); - $this->q .= " OR ". $this->dbconn->Like("version",$_GET['name']); - # $this->q .= " OR ". $this->dbconn->Like("logtxt",$name); - $this->q .= ")"; - $pre = " AND " ; - $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); - $this->filter['name'] = $_GET['name']; - } else { - $this->filter['name'] = ""; - } + if ( isset($_GET['link_id']) && is_numeric($_GET['link_id']) ) { + $this->q .= $pre . "( (f.link_id = ".$_GET['link_id'].") OR (l.f_id = f.id and l.link_id = ". $_GET['link_id'] ."))"; + $pre = " AND " ; + $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); + } + if ( isset($_GET['author']) ) { + $this->q .= $pre . " f.author = ". $_GET['author']; + $pre = " AND " ; + $this->link1 = addUrlParameter($this->link1,"author=". $_GET['author']); + } + if ( isset($_GET['creator']) ) { + $this->q .= $pre . " f.creator = ". $_GET['creator']; + $pre = " AND " ; + $this->link1 = addUrlParameter($this->link1,"creator=". $_GET['creator']); + } + if ( isset($_GET['type']) ) { + $this->q .= $pre . $this->dbconn->Like("f.type",$_GET['type']); + $pre = " AND " ; + $this->link1 = addUrlParameter($this->link1,"type=". UrlEncode($_GET['type'])); + } + if ( isset($_GET['name']) && ($_GET['name'] != "") ) { + $this->q .= $pre . "("; + $this->q .= $this->dbconn->Like("f.name",$_GET['name']); + $this->q .= " OR ". $this->dbconn->Like("filename",$_GET['name']); + $this->q .= " OR ". $this->dbconn->Like("version",$_GET['name']); +# $this->q .= " OR ". $this->dbconn->Like("logtxt",$name); + $this->q .= ")"; + $pre = " AND " ; + $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); + $this->filter['name'] = $_GET['name']; + } else { + $this->filter['name'] = ""; + } - # Start Date for search - $from = new TUTOS_Date_Time(0); - if ( isset($_GET['fd']) ) { - $from->setDateTime($_GET['fd']); - } else { - $from->setDateTimeF("f"); - # remember this - $_SESSION['filesearchfrom'] = $from->getYYYYMMDD(); - } - if ( $from->notime != 1 ) { - $this->q .= $pre ."(creation >= ". $this->dbconn->Date($from) .")"; - $pre = " AND "; + // Start Date for search + $from = new TUTOS_Date_Time(0); + if ( isset($_GET['fd']) ) { + $from->setDateTime($_GET['fd']); + } else { + $from->setDateTimeF("f"); + // remember this + $_SESSION['filesearchfrom'] = $from->getYYYYMMDD(); + } + if ( $from->notime != 1 ) { + $this->q .= $pre ."(creation >= ". $this->dbconn->Date($from) .")"; + $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); - $this->filter['from'] = $from; - } - # End Date for search - $to = new TUTOS_Date_Time(0); - if ( isset($_GET['td']) ) { - $to->setDateTime($_GET['td']); - } else { - $to->setDateTimeF("t"); - # remember this - $_SESSION['filesearchto'] = $to->getYYYYMMDD(); - } - if ( $to->notime != 1 ) { - $this->q .= $pre ."(creation <= ". $this->dbconn->Date($to) .")"; - $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); + $this->filter['from'] = $from; + } + // End Date for search + $to = new TUTOS_Date_Time(0); + if ( isset($_GET['td']) ) { + $to->setDateTime($_GET['td']); + } else { + $to->setDateTimeF("t"); + // remember this + $_SESSION['filesearchto'] = $to->getYYYYMMDD(); + } + if ( $to->notime != 1 ) { + $this->q .= $pre ."(creation <= ". $this->dbconn->Date($to) .")"; + $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); - $this->filter['to'] = $to; - } + $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); + $this->filter['to'] = $to; + } - if(! $this->user->isadmin()) { - $tq = ''; - foreach ( $this->user->teamlist as $key => $val ) - { - $tq .= "OR ( a.adr_id = ".$key." ) "; - } - $this->q .= $pre."(( f.id = a.obj_id ) AND ( a.perm >= ".$tutos[seeok]." ) AND (( a.adr_id = ".$this->user->id.") OR (a.adr_id = ".EVERYBODY.") ".$tq.") )"; - $pre = " AND "; - } + if(! $this->user->isadmin()) { + $tq = ''; + foreach ( $this->user->teamlist as $key => $val ) + { + $tq .= "OR ( a.adr_id = ".$key." ) "; + } + $this->q .= $pre."(( f.id = a.obj_id ) AND ( a.perm >= ".$tutos[seeok]." ) AND (( a.adr_id = ".$this->user->id.") OR (a.adr_id = ".EVERYBODY.") ".$tq.") )"; + $pre = " AND "; + } - check_dbacl($this->dbconn, $this->q, $this->user->id); + check_dbacl($this->dbconn, $this->q, $this->user->id); - # sorting - $xxx = ""; - $this->link2 = $this->link1; - order_parse($this->q,$this->link1,$xxx,$xxx,"name"); - # display default sortorder - if (!isset($_GET['xf'])) { - $_GET['xf'] = "name"; - $_GET['xo'] = 1; - } - $this->result = $this->dbconn->Exec($this->q); -//print_r( $this->user->acl); - if ( 0 == $this->result->numrows()) { - $this->redirect = "file_select.php?msg=". UrlEncode($lang['Err0048']); - $this->result->free(); - } + // sorting + $xxx = ""; + $this->link2 = $this->link1; + order_parse($this->q,$this->link1,$xxx,$xxx,"name"); + // display default sortorder + if (!isset($_GET['xf'])) { + $_GET['xf'] = "name"; + $_GET['xo'] = 1; + } + $this->result = $this->dbconn->Exec($this->q); + //print_r( $this->user->acl); + if ( 0 == $this->result->numrows()) { + $this->redirect = "file_select.php?msg=". UrlEncode($lang['Err0048']); + $this->result->free(); + } - # menu - $m = tutos_file::getSelectLink($this->user, $lang['Search']); - $m[category][] = "obj"; - $this->addmenu($m); - } + // menu + $m = tutos_file::getSelectLink($this->user, $lang['Search']); + $m[category][] = "obj"; + $this->addmenu($m); + } } $l = new File_overview($current_user); @@ -307,6 +303,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:14
|
Update of /cvsroot/tutos/tutos/php/bugtracking In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/bugtracking Modified Files: bug_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: bug_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/bugtracking/bug_show.php,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- bug_show.php 29 Mar 2009 18:25:41 -0000 1.28 +++ bug_show.php 30 Mar 2009 15:48:06 -0000 1.29 @@ -29,174 +29,175 @@ * display a bug */ class Bug_show extends layout { - /** - * the data display part - */ - Function info() { - global $tutos,$lang; + /** + * the data display part + */ + Function info() { + global $tutos,$lang; - echo $this->DataTableStart(); - echo "<tr>\n"; - echo ' <th colspan="3">'. sprintf($lang['Showing'],$lang['Bug'] .' '. $this->obj->getFullName()) ."</th>\n"; - echo $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); - echo "</tr>\n"; + $r = ''; + $r .= $this->DataTableStart(); + $r .= "<tr>\n"; + $r .= ' <th colspan="3">'. sprintf($lang['Showing'],$lang['Bug'] .' '. $this->obj->getFullName()) ."</th>\n"; + $r .= $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); + $r .= "</tr>\n"; - echo $this->CreatorInfoLine($this->obj,4); + $r .= $this->CreatorInfoLine($this->obj,4); - echo "<tr>\n"; + $r .= "<tr>\n"; - echo $this->showfield($lang['BugID']); - echo $this->showdata(myentities($this->obj->name),3); + $r .= $this->showfield($lang['BugID']); + $r .= $this->showdata(myentities($this->obj->name),3); - echo "</tr><tr>\n"; + $r .= "</tr><tr>\n"; - if ( $this->obj->parent->id > 0 ) { - echo $this->showfield($lang[$this->obj->parent->getType()]); - echo $this->showdata($this->obj->parent->getLink(),3); - } else { - echo $this->showfield($lang['ProductP']); - echo $this->showdata($lang['HistoryDeleted'],3); - } + if ( $this->obj->parent->id > 0 ) { + $r .= $this->showfield($lang[$this->obj->parent->getType()]); + $r .= $this->showdata($this->obj->parent->getLink(),3); + } else { + $r .= $this->showfield($lang['ProductP']); + $r .= $this->showdata($lang['HistoryDeleted'],3); + } - echo "</tr><tr>\n"; + $r .= "</tr><tr>\n"; - echo $this->showfield($lang['BugState']); - echo $this->showdata($this->obj->getState(),1); - echo $this->showfield($lang['BugClass']); - echo $this->showdata($this->obj->getClass(),1); + $r .= $this->showfield($lang['BugState']); + $r .= $this->showdata($this->obj->getState(),1); + $r .= $this->showfield($lang['BugClass']); + $r .= $this->showdata($this->obj->getClass(),1); - echo "</tr><tr>\n"; + $r .= "</tr><tr>\n"; - if ( $this->obj->state == BUG_STATE_SOLVED ) { - echo $this->showfield($lang['BugSolvedBy']); - } else if ( $this->obj->state == BUG_STATE_CLOSED ) { - echo $this->showfield($lang['BugClosedBy']); - } else { - echo $this->showfield($lang['BugAssignedTo']); - } - if ( $this->obj->solver->id > 0 ) { - echo $this->showdata($this->obj->solver->getLink(),1); - } else { - echo $this->showdata("not solved",1); - } - if ( ($this->obj->state == BUG_STATE_SOLVED) || ($this->obj->state == BUG_STATE_CLOSED) ) { - echo $this->showfield($lang['atDateTime']); - echo $this->showdata( $this->obj->solvedate->getDateTime().'<br \>('.$this->obj->plandate->getDate().')',1); - } else { - echo $this->showfield($lang['DateTimeTill']); - echo $this->showdata($this->obj->plandate->getDate(),1); - } + if ( $this->obj->state == BUG_STATE_SOLVED ) { + $r .= $this->showfield($lang['BugSolvedBy']); + } else if ( $this->obj->state == BUG_STATE_CLOSED ) { + $r .= $this->showfield($lang['BugClosedBy']); + } else { + $r .= $this->showfield($lang['BugAssignedTo']); + } + if ( $this->obj->solver->id > 0 ) { + $r .= $this->showdata($this->obj->solver->getLink(),1); + } else { + $r .= $this->showdata("not solved",1); + } + if ( ($this->obj->state == BUG_STATE_SOLVED) || ($this->obj->state == BUG_STATE_CLOSED) ) { + $r .= $this->showfield($lang['atDateTime']); + $r .= $this->showdata( $this->obj->solvedate->getDateTime().'<br \>('.$this->obj->plandate->getDate().')',1); + } else { + $r .= $this->showfield($lang['DateTimeTill']); + $r .= $this->showdata($this->obj->plandate->getDate(),1); + } - // Target System - if (is_object($this->obj->target)) { - echo "</tr><tr>\n"; - echo $this->showfield($lang['BugTarget']); - echo $this->showdata($lang[$this->obj->target->getType()].' '.$this->obj->target->getLink(),3); - } - echo "</tr><tr>\n"; + // Target System + if (is_object($this->obj->target)) { + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['BugTarget']); + $r .= $this->showdata($lang[$this->obj->target->getType()].' '.$this->obj->target->getLink(),3); + } + $r .= "</tr><tr>\n"; - if (is_object($this->obj->reporter)) { - echo $this->showfield($lang['BugReportedFrom']); - echo $this->showdata($this->obj->reporter->id != -1 ? $this->obj->reporter->getLink():"",1); - echo $this->showdata( ' ('. makelink("bugtracking/bug_overview.php?reporterid=". $this->obj->reporter->id, - $lang['BugReportedAll']) .')',2); - echo "</tr><tr>\n"; - } - echo $this->showfield($lang['BugMedium']); - echo $this->showdata($this->obj->getMedium(),1); + if (is_object($this->obj->reporter)) { + $r .= $this->showfield($lang['BugReportedFrom']); + $r .= $this->showdata($this->obj->reporter->id != -1 ? $this->obj->reporter->getLink():"",1); + $r .= $this->showdata( ' ('. makelink("bugtracking/bug_overview.php?reporterid=". $this->obj->reporter->id, + $lang['BugReportedAll']) .')',2); + $r .= "</tr><tr>\n"; + } + $r .= $this->showfield($lang['BugMedium']); + $r .= $this->showdata($this->obj->getMedium(),1); - echo "</tr><tr>\n"; - echo $this->showfield($lang['BugShort']); - echo $this->showdata(myentities($this->obj->short),3); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['BugShort']); + $r .= $this->showdata(myentities($this->obj->short),3); - if ( $this->user->feature_ok(usetimetrack,PERM_SEE) ) { - $this->obj->readTimetrackSum(); - if ( $this->obj->timetracksum > 0) { - echo "<tr>\n"; - echo $this->showfield($lang['Timetrack']); - echo " <td valign=\"top\" colspan=\"3\">\n"; - echo makelink("timetrack_overview.php?link_id=". $this->obj->id ,number_format($this->obj->timetracksum,2),$lang['TimetrackOverview']); - echo " ". $lang['hours'] ."</td>\n"; - echo "</tr>\n"; - } - } + if ( $this->user->feature_ok(usetimetrack,PERM_SEE) ) { + $this->obj->readTimetrackSum(); + if ( $this->obj->timetracksum > 0) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['Timetrack']); + $r .= " <td valign=\"top\" colspan=\"3\">\n"; + $r .= makelink("timetrack_overview.php?link_id=". $this->obj->id ,number_format($this->obj->timetracksum,2),$lang['TimetrackOverview']); + $r .= " ". $lang['hours'] ."</td>\n"; + $r .= "</tr>\n"; + } + } - echo "</tr><tr>\n"; - echo $this->showfield($lang['BugHistory']); - echo " <td class=\"pre\" colspan=\"3\">"; - echo wordwrap($this->obj->getBugHistory(true),90);# wrap only neccessary for old info/ new info is already wrapped - echo "</td></tr>\n"; - # - # Show additional custom fields - # - echo show_custom_fields($this,$this->obj->gettype(),$this->obj,4); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['BugHistory']); + $r .= " <td class=\"pre\" colspan=\"3\">"; + $r .= wordwrap($this->obj->getBugHistory(true),90);# wrap only neccessary for old info/ new info is already wrapped + $r .= "</td></tr>\n"; - echo show_module_infolists($this->user,$this->obj,4,$this->format); + // Show additional custom fields + $r .= show_custom_fields($this,$this->obj->gettype(),$this->obj,4); - echo $this->DataTableEnd(); - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang,$current_user; + $r .= show_module_infolists($this->user,$this->obj,4,$this->format); - $this->name = $lang['BugsDetail']; - $this->obj = new bug($this->dbconn); + $r .= $this->DataTableEnd(); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang,$current_user; - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - } - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['Bug']); - $this->stop = true; - $this->format = "html"; - return; - } else if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } else if ( $this->obj->id < 0 ) { - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } else { - $this->name .=": ". $this->obj->getFullName(); - } + $this->name = $lang['BugsDetail']; + $this->obj = new bug($this->dbconn); - $this->obj->read_bughistory(); + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + } + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['Bug']); + $this->stop = true; + $this->format = "html"; + return; + } else if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } else if ( $this->obj->id < 0 ) { + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } else { + $this->name .=": ". $this->obj->getFullName(); + } - # menu - $x = bug::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addmenu($x); + $this->obj->read_bughistory(); - if ( $this->user->feature_ok(usebugtracking,PERM_NEW) ) { - # Pre select the same project as the one of the current bug - $x = array( url => "bugtracking/bug_new.php?pid=".$this->obj->parent->id, - text => $lang['NewEntry'], - info => $lang['CreateNewBug'], - category => array("bug","new","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - $x = array( url => $this->obj->getModURL(), - text => $lang['Modify'], - info => sprintf($lang['BugModifyI'],$this->obj->getFullname()), - category => array("bug","mod","obj") - ); - $this->addMenu($x); - } + // menu + $x = bug::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addmenu($x); - $x = timetrack::getaddlink($this->user,$this->obj); - $this->addMenu($x); + if ( $this->user->feature_ok(usebugtracking,PERM_NEW) ) { + // Pre select the same project as the one of the current bug + $x = array( url => "bugtracking/bug_new.php?pid=".$this->obj->parent->id, + text => $lang['NewEntry'], + info => $lang['CreateNewBug'], + category => array("bug","new","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $x = array( url => $this->obj->getModURL(), + text => $lang['Modify'], + info => sprintf($lang['BugModifyI'],$this->obj->getFullname()), + category => array("bug","mod","obj") + ); + $this->addMenu($x); + } - add_module_addlinks($this,$this->obj); + $x = timetrack::getaddlink($this->user,$this->obj); + $this->addMenu($x); - # add this page to the browsehistory of the users session - $this->addtohistory(); - } + add_module_addlinks($this,$this->obj); + + // add this page to the browsehistory of the users session + $this->addtohistory(); + } } $l = new Bug_show($current_user); @@ -205,6 +206,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:14
|
Update of /cvsroot/tutos/tutos/php/stuff In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/stuff Modified Files: stuff_config.php stuff_ins.php stuff_overview.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: stuff_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/stuff/stuff_overview.php,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- stuff_overview.php 29 Mar 2009 18:25:42 -0000 1.17 +++ stuff_overview.php 30 Mar 2009 15:48:06 -0000 1.18 @@ -30,136 +30,136 @@ * display an overview of stuff */ class Stuff_overview extends layout { - /** - * the data display part - */ - Function info() { - global $tutos,$lang; + /** + * the data display part + */ + Function info() { + global $tutos,$lang; - $r = ''; - $result = $this->dbconn->Exec($this->q); - $n = $result->numrows(); + $r = ''; + $result = $this->dbconn->Exec($this->q); + $n = $result->numrows(); - if ( 0 == $n) { - $r .= $this->error($lang['Err0048']); - $result->free(); - return $r; - } - foreach($tutos[currencies] as $c) { - $sum[1][$c] = 0; - } - $sum[1][''] = 0; + if ( 0 == $n) { + $r .= $this->error($lang['Err0048']); + $result->free(); + return $r; + } + foreach($tutos[currencies] as $c) { + $sum[1][$c] = 0; + } + $sum[1][''] = 0; - $x = 0; - while ( $x < $n ) { - $c = new stuff($this->dbconn); - $c->read_result($result,$x); - $x++; - if ( ! $c->see_ok() ) { - continue; - } - if (! isset ($sum[1][$c->currency])) { - $sum[1][$c->currency] = 0; - } - $sum[1][$c->currency] += $c->price; - unset($c); - } + $x = 0; + while ( $x < $n ) { + $c = new stuff($this->dbconn); + $c->read_result($result,$x); + $x++; + if ( ! $c->see_ok() ) { + continue; + } + if (! isset ($sum[1][$c->currency])) { + $sum[1][$c->currency] = 0; + } + $sum[1][$c->currency] += $c->price; + unset($c); + } - $r .= $this->actionformStart("stuff_overview.php"); - $r .= $this->OverviewTableStart(); - $r .= "<thead>\n"; - $r .= "<tr>\n"; - $r .= $this->orderHeader("name",$lang['StuffName'],$this->link2); - $r .= $this->orderHeader("type",$lang['StuffType'],$this->link2); - $r .= $this->orderHeader('',$lang['StuffSerial'],$this->link2); - $r .= $this->orderHeader('',$lang['StuffOwner'],$this->link2); - $r .= $this->orderHeader('',$lang['StuffUser'],$this->link2); - $r .= $this->orderHeader('',$lang['StuffId'],$this->link2); - $r .= $this->orderHeader('purchase_date',$lang['StuffPurchaseDate'],$this->link2); - $r .= $this->orderHeader('',$lang['StuffPrice'],$this->link2); - $this->flds = 8; - $r .= show_custom_overview_headers($this,'stuff',$this->link2); - if ( $tutos[massupdate] == 1 ) { - $r .= " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - } - $r .= "</tr>\n"; - $r .= "</thead>\n"; + $r .= $this->actionformStart("stuff_overview.php"); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + $r .= $this->orderHeader("name",$lang['StuffName'],$this->link2); + $r .= $this->orderHeader("type",$lang['StuffType'],$this->link2); + $r .= $this->orderHeader('',$lang['StuffSerial'],$this->link2); + $r .= $this->orderHeader('',$lang['StuffOwner'],$this->link2); + $r .= $this->orderHeader('',$lang['StuffUser'],$this->link2); + $r .= $this->orderHeader('',$lang['StuffId'],$this->link2); + $r .= $this->orderHeader('purchase_date',$lang['StuffPurchaseDate'],$this->link2); + $r .= $this->orderHeader('',$lang['StuffPrice'],$this->link2); + $this->flds = 8; + $r .= show_custom_overview_headers($this,'stuff',$this->link2); + if ( $tutos[massupdate] == 1 ) { + $r .= " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + } + $r .= "</tr>\n"; + $r .= "</thead>\n"; - if ( $this->start == -1 ) { - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } + if ( $this->start == -1 ) { + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } - $r .= "<tbody>\n"; - $line = 1; - while ( ($a < $n) && ($a < $end) ) { - $c = new stuff($this->dbconn); - $c->read_result($result,$a); - $a++; - if ( ! $c->see_ok() ) { - continue; - } - $r .= $this->OverviewRowStart($line); - $r .= '<td valign="top">'. $c->getLink() ."</td>\n"; - $r .= '<td valign="top">'. myentities($lang['StuffTypes'][$c->type]) ." </td>\n"; - $r .= '<td valign="top">'. myentities($c->serial) ." </td>\n"; - $r .= '<td valign="top">'. (is_object($c->owner) ? $c->owner->getLink():'-') ." </td>\n"; - $r .= '<td valign="top">'. (is_object($c->suser) ? $c->suser->getLink():'-') ." </td>\n"; - $r .= '<td valign="top">'. myentities($c->invid) ." </td>\n"; - $r .= '<td valign="top">'. $c->p_date->getDate() ." </td>\n"; - $r .= '<td valign="top" align="right">'. number_format($c->price,2,$lang['DecPoint'],$lang['ThousandPoint'])." <b>". $c->currency ." </td>\n"; - $r .= show_custom_overview_data($this,'stuff',$c); - if ( $tutos[massupdate] == 1 ) { - $r .= " <td align=\"center\">\n"; - if ( $c->mod_ok() ) { - $r .= '<input name="mark[]" type="checkbox" value="'. $c->id .'" />'; - } else { - $r .= '-'; - } - $r .= "\n</td>\n"; - } - $r .= $this->OverviewRowEnd($line++); - } - $r .= "</tbody>\n"; + $r .= "<tbody>\n"; + $line = 1; + while ( ($a < $n) && ($a < $end) ) { + $c = new stuff($this->dbconn); + $c->read_result($result,$a); + $a++; + if ( ! $c->see_ok() ) { + continue; + } + $r .= $this->OverviewRowStart($line); + $r .= '<td valign="top">'. $c->getLink() ."</td>\n"; + $r .= '<td valign="top">'. myentities($lang['StuffTypes'][$c->type]) ." </td>\n"; + $r .= '<td valign="top">'. myentities($c->serial) ." </td>\n"; + $r .= '<td valign="top">'. (is_object($c->owner) ? $c->owner->getLink():'-') ." </td>\n"; + $r .= '<td valign="top">'. (is_object($c->suser) ? $c->suser->getLink():'-') ." </td>\n"; + $r .= '<td valign="top">'. myentities($c->invid) ." </td>\n"; + $r .= '<td valign="top">'. $c->p_date->getDate() ." </td>\n"; + $r .= '<td valign="top" align="right">'. number_format($c->price,2,$lang['DecPoint'],$lang['ThousandPoint'])." <b>". $c->currency ." </td>\n"; + $r .= show_custom_overview_data($this,'stuff',$c); + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $c->mod_ok() ) { + $r .= '<input name="mark[]" type="checkbox" value="'. $c->id .'" />'; + } else { + $r .= '-'; + } + $r .= "\n</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + } + $r .= "</tbody>\n"; - /** sums */ - $r .= "<tr>\n"; - $r .= " <td colspan=\"7\"> </td>\n"; - $r .= ' <td align="right">'; - $pre = ''; - foreach ($sum[1] as $i => $f) { - if ($f != 0) { - $r .= $pre.number_format($f,2,$lang['DecPoint'],$lang['ThousandPoint']).' '.$i.' '; - $pre = '<br />'; - } - } - $r .= "</td>\n"; - $r .= ' <td colspan="'.($this->flds + $tutos[massupdate] - 8)."\"> </td>\n"; - $r .= "</tr>\n"; + /** sums */ + $r .= "<tr>\n"; + $r .= " <td colspan=\"7\"> </td>\n"; + $r .= ' <td align="right">'; + $pre = ''; + foreach ($sum[1] as $i => $f) { + if ($f != 0) { + $r .= $pre.number_format($f,2,$lang['DecPoint'],$lang['ThousandPoint']).' '.$i.' '; + $pre = '<br />'; + } + } + $r .= "</td>\n"; + $r .= ' <td colspan="'.($this->flds + $tutos[massupdate] - 8)."\"> </td>\n"; + $r .= "</tr>\n"; - $r .= $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); - if ( $tutos[massupdate] == 1 ) { - $r .= $this->UpdateRowStart($this->flds-1); - $r .= sprintf($lang['withmarked'],$lang['Stuffs']); - $r .= " <select name=\"action\">\n"; - $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; - $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; - $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - $r .= watchlist::action_options(); - } - $r .= "</select>\n"; - $r .= $this->UpdateRowEnd(2); - } - $r .= $this->OverviewTableEnd(); - $r .= $this->actionformEnd("stuff_overview.php"); - $result->free(); - return $r; - } + $r .= $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart($this->flds-1); + $r .= sprintf($lang['withmarked'],$lang['Stuffs']); + $r .= " <select name=\"action\">\n"; + $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; + $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; + $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; + if (class_exists('watchlist')) { + $r .= watchlist::action_options(); + } + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(2); + } + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("stuff_overview.php"); + $result->free(); + return $r; + } /** * do mass actions */ @@ -193,54 +193,54 @@ watchlist::parse_action($this->user); } } - /** - * prepare - */ - Function prepare() { - global $msg,$lang,$tutos; + /** + * prepare + */ + Function prepare() { + global $msg,$lang,$tutos; - $this->name = $lang['StuffOverview']; - $this->css_class = 'overviewbox'; + $this->name = $lang['StuffOverview']; + $this->css_class = 'overviewbox'; - if ( ! $this->user->feature_ok(USESTUFF,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + if ( ! $this->user->feature_ok(USESTUFF,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - $this->link1 = 'stuff/stuff_overview.php'; + $this->link1 = 'stuff/stuff_overview.php'; - $this->q = "SELECT * FROM ". $this->dbconn->prefix ."stuff"; - $pre = " WHERE "; + $this->q = "SELECT * FROM ". $this->dbconn->prefix ."stuff"; + $pre = " WHERE "; - if ( isset($_GET['name']) && ($_GET['name'] != "*") && ($_GET['name'] != "") ) { - $this->q .= $pre . $this->dbconn->Like("name",$_GET['name']); - $this->q .= ' or ' . $this->dbconn->Like("description",$_GET['name']); - $this->q .= ' or ' . $this->dbconn->Like("serial",$_GET['name']); - $this->q .= ' or ' . $this->dbconn->Like("invid",$_GET['name']); - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); - } + if ( isset($_GET['name']) && ($_GET['name'] != "*") && ($_GET['name'] != "") ) { + $this->q .= $pre . $this->dbconn->Like("name",$_GET['name']); + $this->q .= ' or ' . $this->dbconn->Like("description",$_GET['name']); + $this->q .= ' or ' . $this->dbconn->Like("serial",$_GET['name']); + $this->q .= ' or ' . $this->dbconn->Like("invid",$_GET['name']); + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); + } - check_dbacl($this->dbconn,$this->q, $this->user->id); + check_dbacl($this->dbconn,$this->q, $this->user->id); - // sorting - $xxx = ""; - $this->link2 = $this->link1; - order_parse($this->q,$this->link1,$xxx,$xxx,"name"); + // sorting + $xxx = ""; + $this->link2 = $this->link1; + order_parse($this->q,$this->link1,$xxx,$xxx,"name"); - $m = stuff::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addMenu($m); + $m = stuff::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addMenu($m); - if ( $this->user->feature_ok(USESTUFF,PERM_NEW) ) { - $x = array( url => "stuff/stuff_new.php", - text => $lang['NewEntry'], - info => $lang['StuffCreate'], - category => array('stuff','new','obj') - ); - $this->addMenu($x); - } - } + if ( $this->user->feature_ok(USESTUFF,PERM_NEW) ) { + $x = array( url => "stuff/stuff_new.php", + text => $lang['NewEntry'], + info => $lang['StuffCreate'], + category => array('stuff','new','obj') + ); + $this->addMenu($x); + } + } } $l = new stuff_overview($current_user); @@ -250,4 +250,4 @@ <!-- CVS Info: $Id$ $Author$ - --> + --> \ No newline at end of file Index: stuff_config.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/stuff/stuff_config.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- stuff_config.php 29 Mar 2009 18:25:42 -0000 1.2 +++ stuff_config.php 30 Mar 2009 15:48:06 -0000 1.3 @@ -27,56 +27,56 @@ /** * */ - function info() { - global $lang,$table,$tutos; + function info() { + global $lang,$table,$tutos; - $r = ''; - $r .= "<form id=\"stuffconfig\" name=\"stuffconfig\" action=\"stuff_config.php\" method=\"post\">\n"; - $r .= $this->DataTableStart(); + $r = ''; + $r .= "<form id=\"stuffconfig\" name=\"stuffconfig\" action=\"stuff_config.php\" method=\"post\">\n"; + $r .= $this->DataTableStart(); - $line = 0; + $line = 0; - $r .= $this->OverviewRowStart($line); - $r .= $this->showfield('stuff_autoname'); - $r .= '<td><input name="autoname" value="'.$tutos['stuff_autoname'] .'">'; - $r .= '</input></td>'; - $r .= '<td colspan="2" class="pre"><pre>'.$lang['StuffConfigHelpAutoname'].'</pre></td>'; - $r .= $this->OverviewRowEnd($line++); + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('stuff_autoname'); + $r .= '<td><input name="autoname" value="'.$tutos['stuff_autoname'] .'">'; + $r .= '</input></td>'; + $r .= '<td colspan="2" class="pre"><pre>'.$lang['StuffConfigHelpAutoname'].'</pre></td>'; + $r .= $this->OverviewRowEnd($line++); - $r .= '<tr>'; - $r .= submit_reset(0,1,1,1,1,0); - $r .= '</tr>'; + $r .= '<tr>'; + $r .= submit_reset(0,1,1,1,1,0); + $r .= '</tr>'; - $r .= $this->DataTableEnd(); - $this->addHidden("save", 1); - $r .= hiddenFormElements(); - $r .= $this->getHidden(); - $r .= "</form>\n"; - return $r; - } + $r .= $this->DataTableEnd(); + $this->addHidden("save", 1); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; + return $r; + } /** * */ - function prepare() { - global $lang,$msg,$tutos; + function prepare() { + global $lang,$msg,$tutos; - $this->name = $lang['StuffConfig']; + $this->name = $lang['StuffConfig']; - // default - if (!isset($tutos['stuff_autoname'])) $tutos['stuff_autoname'] = 'I-%Y-&X'; + // default + if (!isset($tutos['stuff_autoname'])) $tutos['stuff_autoname'] = 'I-%Y-&X'; - if ( ! $this->user->isAdmin() ) { - $msg .= $this->error("Only admins are allowed to see this"); - $this->stop = true; - return; - } - if (isset($_REQUEST['save']) && ($_REQUEST['save'] == 1) ) { - $tutos['stuff_autoname'] = $_REQUEST['autoname']; - write_config_value($this->dbconn,'stuff_autoname','stuff'); - $msg .= ' saving done '; - } - } + if ( ! $this->user->isAdmin() ) { + $msg .= $this->error("Only admins are allowed to see this"); + $this->stop = true; + return; + } + if (isset($_REQUEST['save']) && ($_REQUEST['save'] == 1) ) { + $tutos['stuff_autoname'] = $_REQUEST['autoname']; + write_config_value($this->dbconn,'stuff_autoname','stuff'); + $msg .= ' saving done '; + } + } } $l = new Stuff_config($current_user); Index: stuff_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/stuff/stuff_ins.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- stuff_ins.php 13 Mar 2009 20:00:41 -0000 1.12 +++ stuff_ins.php 30 Mar 2009 15:48:06 -0000 1.13 @@ -151,12 +151,7 @@ $dbconn->Commit("WORK"); $gotourl = $obj->getURL(); } -$gotourl = addMessage($gotourl,$msg,true); -$gotourl = addSessionKey($gotourl,true); - -Header("Status: 302 Moved Temporarily"); -Header("Location:". dirname(getBaseUrl()) ."/". $gotourl); -$dbconn->Close(); +leave_insert($dbconn,$gotourl,$msg); /** * CVS Info: $Id$ * $Author$ |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:14
|
Update of /cvsroot/tutos/tutos/php/stc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/stc Modified Files: stc_ins.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: stc_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/stc/stc_ins.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- stc_ins.php 5 Mar 2009 16:16:44 -0000 1.4 +++ stc_ins.php 30 Mar 2009 15:48:06 -0000 1.5 @@ -125,13 +125,8 @@ $gotourl = $obj->getModURL(); } -$gotourl = addMessage($gotourl,$msg,true); -$gotourl = addSessionKey($gotourl,true); - -Header("Status: 302 Moved Temporarily"); -Header("Location:". dirname(getBaseUrl()) ."/". $gotourl); -$dbconn->Close(); -/* +leave_insert($dbconn,$gotourl,$msg); +/** * CVS Info: $Id$ * $Author$ */ |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:14
|
Update of /cvsroot/tutos/tutos/php/installation In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/installation Modified Files: installation_ins.php installation_new.php installation_overview.php installation_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: installation_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/installation/installation_new.php,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- installation_new.php 13 Mar 2009 14:22:22 -0000 1.30 +++ installation_new.php 30 Mar 2009 15:48:06 -0000 1.31 @@ -16,7 +16,7 @@ require_once 'permission.p3'; require_once 'product.pinc'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('installation','new'); loadmodule('installation'); @@ -26,225 +26,216 @@ * change/modify a installation */ class Installation_new extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang,$table; + /** + * display the form + */ + Function info() { + global $tutos,$lang,$table; - $this->width = 4; - echo "<form id=\"instadd\" name=\"instadd\" method=\"post\" action=\"installation_ins.php\">\n"; - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); + $r = ''; + $this->width = 4; + $r .= "<form id=\"instadd\" name=\"instadd\" method=\"post\" action=\"installation_ins.php\">\n"; + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); - echo "<tr>\n"; - echo $this->showfieldc($lang['Product'],1,"pid"); - echo " <td colspan=\"3\">"; - if ( count($this->obj->plist) > 0 ) { - echo "<select name=\"pid\">\n"; - foreach ($this->obj->plist as $i => $f) { - echo '<option value="'. $i .'"'. (is_object($this->obj->product) && ($i == $this->obj->product->id) ? ' selected="selected">* ':'>') . $lang[$f->getType()] .": ". myentities($f->getFullName()) ."</option>\n"; - } - echo "</select>\n"; - } else { - echo $this->obj->product->getLink(); - $this->addHidden("pid",$this->obj->product->id); - } - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['Product'],1,"pid"); + $r .= " <td colspan=\"3\">"; + if ( count($this->obj->plist) > 0 ) { + $r .= "<select name=\"pid\">\n"; + foreach ($this->obj->plist as $i => $f) { + $r .= '<option value="'. $i .'"'. (is_object($this->obj->product) && ($i == $this->obj->product->id) ? ' selected="selected">* ':'>') . $lang[$f->getType()] .": ". myentities($f->getFullName()) ."</option>\n"; + } + $r .= "</select>\n"; + } else { + $r .= $this->obj->product->getLink(); + $this->addHidden("pid",$this->obj->product->id); + } + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['Customer'],1,"c"); - echo " <td colspan=\"3\">\n"; - echo select_from_array_or_input($this->obj,"c",$this->obj->customer,0,'atcd'); - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['Customer'],1,"c"); + $r .= " <td colspan=\"3\">\n"; + $r .= select_from_array_or_input($this->obj,"c",$this->obj->customer,0,'atcd'); + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['Description'],0,"desc"); - echo ' <td colspan="3"><input id="desc" name="desc" size="'. min($table['installation']['description'][size],60) ."\" maxlength=\"". $table['installation']['description'][size] ."\" value=\"". myentities($this->obj->description) ."\" />\n"; - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['Description'],0,"desc"); + $r .= ' <td colspan="3"><input id="desc" name="desc" size="'. min($table['installation']['description'][size],60) ."\" maxlength=\"". $table['installation']['description'][size] ."\" value=\"". myentities($this->obj->description) ."\" />\n"; + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InstVersion'],0,"version"); - echo ' <td colspan="3"><input id="version" name="version" size="'. min($table['installation']['version'][size],20) ."\" maxlength=\"". $table['installation']['version'][size] .'" value="'. myentities($this->obj->version) ."\" />\n"; - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InstVersion'],0,"version"); + $r .= ' <td colspan="3"><input id="version" name="version" size="'. min($table['installation']['version'][size],20) ."\" maxlength=\"". $table['installation']['version'][size] .'" value="'. myentities($this->obj->version) ."\" />\n"; + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InstSerial'],0,"serial"); - echo " <td colspan=\"3\"><input id=\"serial\" name=\"serial\" size=\"". min($table['installation']['serial'][size],40) ."\" maxlength=\"". $table['installation']['serial'][size] ."\" value=\"". myentities($this->obj->serial) ."\" />\n"; - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InstSerial'],0,"serial"); + $r .= " <td colspan=\"3\"><input id=\"serial\" name=\"serial\" size=\"". min($table['installation']['serial'][size],40) ."\" maxlength=\"". $table['installation']['serial'][size] ."\" value=\"". myentities($this->obj->serial) ."\" />\n"; + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InstKey1'],0,"key1"); - echo " <td colspan=\"3\"><input id=\"key1\" name=\"key1\" size=\"". min($table['installation']['key_1'][size],40) ."\" maxlength=\"". $table['installation']['key_1'][size] ."\" value=\"". myentities($this->obj->key_1) ."\" />\n"; - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InstKey1'],0,"key1"); + $r .= " <td colspan=\"3\"><input id=\"key1\" name=\"key1\" size=\"". min($table['installation']['key_1'][size],40) ."\" maxlength=\"". $table['installation']['key_1'][size] ."\" value=\"". myentities($this->obj->key_1) ."\" />\n"; + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InstKey2'],0,"key2"); - echo " <td colspan=\"3\"><input id=\"key2\" name=\"key2\" size=\"". min($table['installation']['key_2'][size],40) ."\" maxlength=\"". $table['installation']['key_2'][size] ."\" value=\"". myentities($this->obj->key_2) ."\" />\n"; - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InstKey2'],0,"key2"); + $r .= " <td colspan=\"3\"><input id=\"key2\" name=\"key2\" size=\"". min($table['installation']['key_2'][size],40) ."\" maxlength=\"". $table['installation']['key_2'][size] ."\" value=\"". myentities($this->obj->key_2) ."\" />\n"; + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['InstalledBy'],0,"i"); - echo " <td>\n"; - echo select_from_array_or_input($this->obj,"i",$this->obj->installer,1,'at'); - echo " </td>\n"; - echo $this->showfieldc($lang['atDateTime'],0); - echo " <td>\n"; - echo $this->obj->instdate->EnterDate("inst"); - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['InstalledBy'],0,"i"); + $r .= " <td>\n"; + $r .= select_from_array_or_input($this->obj,"i",$this->obj->installer,1,'at'); + $r .= " </td>\n"; + $r .= $this->showfieldc($lang['atDateTime'],0); + $r .= " <td>\n"; + $r .= $this->obj->instdate->EnterDate("inst"); + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['SoldBy'],0,"s"); - echo " <td>\n"; - echo select_from_array_or_input($this->obj,"s",$this->obj->seller,1,'at'); - echo " </td>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['SoldBy'],0,"s"); + $r .= " <td>\n"; + $r .= select_from_array_or_input($this->obj,"s",$this->obj->seller,1,'at'); + $r .= " </td>\n"; - echo $this->showfieldc($lang['atDateTime'],0); - echo " <td>\n"; - echo $this->obj->salesdate->EnterDate("sale"); - echo "</td></tr>\n"; + $r .= $this->showfieldc($lang['atDateTime'],0); + $r .= " <td>\n"; + $r .= $this->obj->salesdate->EnterDate("sale"); + $r .= "</td></tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['Money'],0,"money"); - echo ' <td><input id="money" size="10" maxlength="10" name="money" value="'. myentities($this->obj->money) ."\" /></td>"; - echo $this->showfieldc($lang['Currency'],0); - echo "<td colspan=\"1\" valign=\"top\">"; - echo Currency_Select("currency",$this->obj->currency); - echo "</td></tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['Money'],0,"money"); + $r .= ' <td><input id="money" size="10" maxlength="10" name="money" value="'. myentities($this->obj->money) ."\" /></td>"; + $r .= $this->showfieldc($lang['Currency'],0); + $r .= "<td colspan=\"1\" valign=\"top\">"; + $r .= Currency_Select("currency",$this->obj->currency); + $r .= "</td></tr>\n"; - # - # Edit additional custom fields - # - echo edit_custom_fields($this,$this->obj->gettype(),$this->obj,4); - # References to modules - echo module_addforms($this->user,$this->obj,4); + // Edit additional custom fields + $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,4); + // References to modules + $r .= module_addforms($this->user,$this->obj,4); - if ( $this->obj->mod_ok() != 0 ) { - echo "<tr>\n"; - if ( $this->obj->id > 0 ) { - echo submit_reset(0,1,1,1,1,0); - } else { - echo submit_reset(0,-1,1,1,1,0); - } - echo "</tr>\n"; - } - echo $this->DataTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo $this->markBadFields(); - echo "</form>\n"; - echo $this->setfocus("instadd.desc"); - echo $lang['FldsRequired'] ."\n"; - } - /** - * naviagte - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang,$tutos; + if ( $this->obj->mod_ok() != 0 ) { + $r .= "<tr>\n"; + if ( $this->obj->id > 0 ) { + $r .= submit_reset(0,1,1,1,1,0); + } else { + $r .= submit_reset(0,-1,1,1,1,0); + } + $r .= "</tr>\n"; + } + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= $this->markBadFields(); + $r .= "</form>\n"; + $r .= $this->setfocus("instadd.desc"); + $r .= $lang['FldsRequired'] ."\n"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang,$tutos; - $this->obj = new installation($this->dbconn); - if ( isset($_GET['id']) ) { - $this->name = $lang['InstModify'] .": "; - $this->obj = $this->obj->read($_GET['id'],$this->obj); - if ( is_object($this->obj) ) { - $this->name .= $this->obj->getFullName(); - } else { - $msg .= sprintf($lang['Err0012'],$lang['Installation'],''); - $this->stop = true; - return; - } - $this->addHidden("id",$this->obj->id); - } else { - $this->name = $lang['InstCreate']; - if ( !$this->user->feature_ok(useinstmanagement,PERM_NEW) ) { - $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); - $this->stop = true; - } - } + $this->obj = new installation($this->dbconn); + if ( isset($_GET['id']) ) { + $this->name = $lang['InstModify'] .": "; + $this->obj = $this->obj->read($_GET['id'],$this->obj); + if ( is_object($this->obj) ) { + $this->name .= $this->obj->getFullName(); + } else { + $msg .= sprintf($lang['Err0012'],$lang['Installation'],''); + $this->stop = true; + return; + } + $this->addHidden("id",$this->obj->id); + } else { + $this->name = $lang['InstCreate']; + if ( !$this->user->feature_ok(useinstmanagement,PERM_NEW) ) { + $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); + $this->stop = true; + } + } - $this->obj->read_relations(); - if ( isset($_GET['pid']) ) { - $this->obj->product = getObject($this->dbconn,$_GET['pid']); - $this->obj->money = $this->obj->product->price; - $this->obj->currency = $this->obj->product->currency; - } + $this->obj->read_relations(); + if ( isset($_GET['pid']) ) { + $this->obj->product = getObject($this->dbconn,$_GET['pid']); + $this->obj->money = $this->obj->product->price; + $this->obj->currency = $this->obj->product->currency; + } - $this->obj->set_float_from_arg('money','money',$lang['Money']); - $this->obj->set_string_from_arg('currency','currency',$lang['Currency']); - $this->obj->set_string_from_arg('description','desc',$lang['Description']); - $this->obj->set_string_from_arg('version','version',$lang['InstVersion']); - $this->obj->set_string_from_arg('serial','serial',$lang['InstSerial']); - $this->obj->set_string_from_arg('key_1','key1',$lang['InstKey1']); - $this->obj->set_string_from_arg('key_2','key2',$lang['InstKey2']); + $this->obj->set_float_from_arg('money','money',$lang['Money']); + $this->obj->set_string_from_arg('currency','currency',$lang['Currency']); + $this->obj->set_string_from_arg('description','desc',$lang['Description']); + $this->obj->set_string_from_arg('version','version',$lang['InstVersion']); + $this->obj->set_string_from_arg('serial','serial',$lang['InstSerial']); + $this->obj->set_string_from_arg('key_1','key1',$lang['InstKey1']); + $this->obj->set_string_from_arg('key_2','key2',$lang['InstKey2']); - # Installer - preset_from_array_or_input($this->obj,'installer',"i"); + // Installer + preset_from_array_or_input($this->obj,'installer',"i"); - if ( !is_object($this->obj->installer) ) { - if ( is_object($this->obj->product) ) { - # Defaults to manager - $this->obj->installer = $this->obj->product->role[1]; - } else { - $this->obj->installer = $this->user; - } - } + if ( !is_object($this->obj->installer) ) { + if ( is_object($this->obj->product) ) { +# Defaults to manager + $this->obj->installer = $this->obj->product->role[1]; + } else { + $this->obj->installer = $this->user; + } + } - # Seller - preset_from_array_or_input($this->obj,'seller',"s"); + // Seller + preset_from_array_or_input($this->obj,'seller',"s"); - if ( !is_object($this->obj->seller) ) { - if ( is_object($this->obj->product) ) { - # Defaults to manager - $this->obj->seller = $this->obj->product->role[4]; - } else { - $this->obj->seller = $this->user; - } - } + if ( !is_object($this->obj->seller) ) { + if ( is_object($this->obj->product) ) { +# Defaults to manager + $this->obj->seller = $this->obj->product->role[4]; + } else { + $this->obj->seller = $this->user; + } + } - # Customer - preset_from_array_or_input($this->obj,'customer',"c"); + // Customer + preset_from_array_or_input($this->obj,'customer',"c"); - if ( ! $this->obj->mod_ok() ) { - $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); - $this->stop = true; - } - # - # preset additional custom fields - # - preset_custom_fields($this->obj->gettype(),$this->obj); - # menu - $x = installation::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addmenu($x); -# $m = installation::getOverviewLink($this->user,$lang['Installations']); -# $m[category][] = "obj"; -# $this->addmenu($m); - if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { - $x = array( url => "installation/installation_new.php", - confirm => false, - text => $lang['NewEntry'], - info => sprintf($lang['InstCreateI'],""), - category => array("installation","new","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelURL(), - text => $lang['Delete'], - info => sprintf($lang['InstDelI'],$this->obj->getFullname()), - category => array("installation","del","obj"), - confirm => true - ); - $this->addMenu($x); - } - add_module_newlinks($this,$this->obj); - } + if ( ! $this->obj->mod_ok() ) { + $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); + $this->stop = true; + } + + // preset additional custom fields + preset_custom_fields($this->obj->gettype(),$this->obj); +# menu + $x = installation::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addmenu($x); + if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { + $x = array( url => "installation/installation_new.php", + confirm => false, + text => $lang['NewEntry'], + info => sprintf($lang['InstCreateI'],""), + category => array("installation","new","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelURL(), + text => $lang['Delete'], + info => sprintf($lang['InstDelI'],$this->obj->getFullname()), + category => array("installation","del","obj"), + confirm => true + ); + $this->addMenu($x); + } + add_module_newlinks($this,$this->obj); + } } $l = new Installation_new($current_user); @@ -252,6 +243,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: installation_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/installation/installation_show.php,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- installation_show.php 16 Feb 2009 20:03:57 -0000 1.31 +++ installation_show.php 30 Mar 2009 15:48:06 -0000 1.32 @@ -17,7 +17,7 @@ require_once 'product.pinc'; require_once 'timetrack.pinc'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('installation','show'); loadmodule('installation'); @@ -27,227 +27,226 @@ * display an overview of installations */ class installation_show extends layout { - /** - * the data display part - */ - Function info() { - global $tutos,$lang,$current_user; + /** + * the data display part + */ + Function info() { + global $tutos,$lang,$current_user; - echo $this->DataTableStart(); + $r = ''; + $r .= $this->DataTableStart(); - echo "<tr>\n"; - echo ' <th colspan="3">'. sprintf($lang['Showing'],$lang[$this->obj->getType()])."</th>\n"; - echo $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); + $r .= "<tr>\n"; + $r .= ' <th colspan="3">'. sprintf($lang['Showing'],$lang[$this->obj->getType()])."</th>\n"; + $r .= $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); - echo "</tr><tr>\n"; - echo $this->showfield($lang['ProductP']); - if ( is_object($this->obj->product) && $this->obj->product->id != -1 ) { - echo " <td colspan=\"3\">". $this->obj->product->getLink() ." </td>\n"; - } else { - echo " <td colspan=\"3\">". $lang['HistoryDeleted'] ." </td>\n"; - } - echo "</tr><tr>\n"; - echo $this->showfield($lang['Customer']); - echo "<td colspan=\"3\">"; - if ( is_object($this->obj->customer) && $this->obj->customer->id == -1 ) { - echo "<i>". $lang['HistoryDeleted'] ."</i>"; - } else if ( $this->obj->customer->id != -1 ) { - echo $this->obj->customer->getLink(); - } else { - echo " "; - } - echo " </td>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['ProductP']); + if ( is_object($this->obj->product) && $this->obj->product->id != -1 ) { + $r .= " <td colspan=\"3\">". $this->obj->product->getLink() ." </td>\n"; + } else { + $r .= " <td colspan=\"3\">". $lang['HistoryDeleted'] ." </td>\n"; + } + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['Customer']); + $r .= "<td colspan=\"3\">"; + if ( is_object($this->obj->customer) && $this->obj->customer->id == -1 ) { + $r .= "<i>". $lang['HistoryDeleted'] ."</i>"; + } else if ( $this->obj->customer->id != -1 ) { + $r .= $this->obj->customer->getLink(); + } else { + $r .= " "; + } + $r .= " </td>\n"; - echo "</tr><tr>\n"; - echo $this->showfield($lang['Description']); - echo $this->showdata(myentities($this->obj->description) ." ",3); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['Description']); + $r .= $this->showdata(myentities($this->obj->description) ." ",3); - echo "</tr><tr>\n"; - echo $this->showfield($lang['InstVersion']); - echo $this->showdata(myentities($this->obj->version) ." ",3); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['InstVersion']); + $r .= $this->showdata(myentities($this->obj->version) ." ",3); - echo "</tr><tr>\n"; - echo $this->showfield($lang['InstSerial']); - echo $this->showdata(myentities($this->obj->serial) ." ",3); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['InstSerial']); + $r .= $this->showdata(myentities($this->obj->serial) ." ",3); - echo "</tr><tr>\n"; - echo $this->showfield($lang['InstKey1']); - echo $this->showdata(myentities($this->obj->key_1) ." ",3); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['InstKey1']); + $r .= $this->showdata(myentities($this->obj->key_1) ." ",3); - echo "</tr><tr>\n"; - echo $this->showfield($lang['InstKey2']); - echo $this->showdata(myentities($this->obj->key_2) ." ",3); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['InstKey2']); + $r .= $this->showdata(myentities($this->obj->key_2) ." ",3); - echo "</tr><tr>\n"; - echo $this->showfield($lang['InstalledBy']); - if ( is_object($this->obj->installer) && ($this->obj->installer->id != -1) ) { - echo " <td>". $this->obj->installer->getLink() ." </td>\n"; - #} else if ( $this->obj->installer->id != -1 ) { - # echo " <td>". $this->obj->installer->getLink() ." </td>\n"; - } else { - echo " <td> </td>\n"; - } - echo $this->showfield($lang['atDateTime']); - echo $this->showData($this->obj->instdate->getLinkDate(),1); - echo "</tr>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['InstalledBy']); + if ( is_object($this->obj->installer) && ($this->obj->installer->id != -1) ) { + $r .= " <td>". $this->obj->installer->getLink() ." </td>\n"; + } else { + $r .= " <td> </td>\n"; + } + $r .= $this->showfield($lang['atDateTime']); + $r .= $this->showData($this->obj->instdate->getLinkDate(),1); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['SoldBy']); - if ( is_object($this->obj->seller) && ($this->obj->seller->id != -1)) { - echo " <td>". $this->obj->seller->getLink() ."</td>\n"; - #} else if ( $this->obj->seller->id != -1 ) { - # echo " <td>". $this->obj->seller->getLink() ."</td>\n"; - } else { - echo " <td> </td>\n"; - } - echo $this->showfield($lang['atDateTime']); - echo $this->showData($this->obj->salesdate->getLinkDate(),1); + $r .= "<tr>\n"; + $r .= $this->showfield($lang['SoldBy']); + if ( is_object($this->obj->seller) && ($this->obj->seller->id != -1)) { + $r .= " <td>". $this->obj->seller->getLink() ."</td>\n"; + } else { + $r .= " <td> </td>\n"; + } + $r .= $this->showfield($lang['atDateTime']); + $r .= $this->showData($this->obj->salesdate->getLinkDate(),1); - echo "</tr><tr>\n"; - $x= array($this->obj->money,$this->obj->currency); - echo $this->showfield($lang['Money']); - echo $this->showdata(handle('money',$x,number_format($this->obj->money,2,$lang['DecPoint'],$lang['ThousandPoint']) ." <b>". $this->obj->currency ."</b>"),3); + $r .= "</tr><tr>\n"; + $x= array($this->obj->money,$this->obj->currency); + $r .= $this->showfield($lang['Money']); + $r .= $this->showdata(handle('money',$x,number_format($this->obj->money,2,$lang['DecPoint'],$lang['ThousandPoint']) ." <b>". $this->obj->currency ."</b>"),3); - echo "</tr>\n"; + $r .= "</tr>\n"; - if ( $this->user->feature_ok(usetimetrack,PERM_SEE) ) { - $this->obj->readTimetrackSum(); - $rows = 0; - if ( $this->obj->timetracksum > 0) { - $rows++; - } - @reset ($this->obj->tsum); - while( list ($i,$f) = @each ($this->obj->tsum)) { - if ( $this->obj->tsum[$i] > 0 ) { - $rows++; - } - } - $r = 0; - if ( $rows > 0 ) { - echo "<tr>\n"; - echo "<td class=\"desc\" valign=\"top\" rowspan=\"". $rows ."\">". $lang['Timetrack'] ; - echo "</td>\n"; + if ( $this->user->feature_ok(usetimetrack,PERM_SEE) ) { + $this->obj->readTimetrackSum(); + $rows = 0; + if ( $this->obj->timetracksum > 0) { + $rows++; + } + @reset ($this->obj->tsum); + while( list ($i,$f) = @each ($this->obj->tsum)) { + if ( $this->obj->tsum[$i] > 0 ) { + $rows++; + } + } + $rx = 0; + if ( $rows > 0 ) { + $r .= "<tr>\n"; + $r .= "<td class=\"desc\" valign=\"top\" rowspan=\"". $rows ."\">". $lang['Timetrack'] ; + $r .= "</td>\n"; - if ( $this->obj->timetracksum > 0) { - echo " <td valign=\"top\" align=\"right\">\n"; - echo makelink("timetrack_overview.php?link_id=". $this->obj->id ,number_format($this->obj->timetracksum,2),$lang['TimetrackOverview']); - echo " </td>\n"; - echo " <td align=\"left\">". $lang['hours'] ."</td>\n"; - echo " <td> </td>\n"; - echo "</tr>\n"; - $r = 1; - } - @reset ($this->obj->tsum); - while( list ($i,$f) = @each ($this->obj->tsum)) { - if ( $this->obj->tsum[$i] > 0 ) { - if ( $r == 1 ) { - echo "<tr>\n"; - } - echo ' <td align="right">'. number_format($this->obj->tsum[$i],2) ."</td>\n"; - echo ' <td align="left">'. $lang['hours'] ."</td>\n"; - echo ' <td>('. $lang[$i] .")</td>\n"; - echo "</tr>\n"; - $r = 1; - } - } - } - } - # - # Show additional custom fields - # - echo show_custom_fields($this,$this->obj->gettype(),$this->obj,4); - # References to modules - echo show_module_infolists($this->user,$this->obj,4); - echo $this->obj->getHistoryLink(4); - echo $this->DataTableEnd(); - } - /** - * - */ - Function navigate() { - global $tutos,$lang; + if ( $this->obj->timetracksum > 0) { + $r .= " <td valign=\"top\" align=\"right\">\n"; + $r .= makelink("timetrack_overview.php?link_id=". $this->obj->id ,number_format($this->obj->timetracksum,2),$lang['TimetrackOverview']); + $r .= " </td>\n"; + $r .= " <td align=\"left\">". $lang['hours'] ."</td>\n"; + $r .= " <td> </td>\n"; + $r .= "</tr>\n"; + $rx = 1; + } + @reset ($this->obj->tsum); + while( list ($i,$f) = @each ($this->obj->tsum)) { + if ( $this->obj->tsum[$i] > 0 ) { + if ( $rx == 1 ) { + $r .= "<tr>\n"; + } + $r .= ' <td align="right">'. number_format($this->obj->tsum[$i],2) ."</td>\n"; + $r .= ' <td align="left">'. $lang['hours'] ."</td>\n"; + $r .= ' <td>('. $lang[$i] .")</td>\n"; + $r .= "</tr>\n"; + $rx = 1; + } + } + } + } - echo "<tr><td>"; - if ( is_object($this->obj) && $this->user->feature_ok(usetimetrack,PERM_NEW) ) { - echo menulink("timetrack_new.php?mode=1&reftype=installation&lid=".$this->obj->id,$lang['TTRecord'],$lang['TTRecord']) ."<br />\n"; - } - echo "</td></tr>"; - } - /** - * preapre everything read data , parse args etc - */ - Function prepare() { - global $msg,$lang; + // Show additional custom fields + $r .= show_custom_fields($this,$this->obj->gettype(),$this->obj,4); + // References to modules + $r .= show_module_infolists($this->user,$this->obj,4); + $r .= $this->obj->getHistoryLink(4); + $r .= $this->DataTableEnd(); + return $r; + } + /** + * + */ + Function navigate() { + global $tutos,$lang; - $this->name = $lang['InstDetail']; + $r = ''; + $r .= "<tr><td>"; + if ( is_object($this->obj) && $this->user->feature_ok(usetimetrack,PERM_NEW) ) { + $r .= menulink("timetrack_new.php?mode=1&reftype=installation&lid=".$this->obj->id,$lang['TTRecord'],$lang['TTRecord']) ."<br />\n"; + } + $r .= "</td></tr>"; + return $r; + } + /** + * preapre everything read data , parse args etc + */ + Function prepare() { + global $msg,$lang; - $this->obj = new installation($this->dbconn); - if (isset($_GET['id'])) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['Installation']); - $this->stop = true; - return; - } - } else { - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } - if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - } + $this->name = $lang['InstDetail']; - # menu - $x = installation::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addmenu($x); - $m = installation::getOverviewLink($this->user,$lang['Installations']); - $m[category][] = "obj"; - $this->addmenu($m); - if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { - $x = array( url => "installation/installation_new.php", - confirm => false, - text => $lang['NewEntry'], - info => sprintf($lang['InstCreateI'],""), - category => array("installation","new","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - $x = array( url => $this->obj->getModURL(), - text => $lang['Modify'], - info => sprintf($lang['InstModifyI'],$this->obj->getFullname()), - category => array("installation","mod","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelURL(), - text => $lang['Delete'], - info => sprintf($lang['InstDelI'],$this->obj->getFullname()), - category => array("installation","del","obj"), - confirm => true - ); - $this->addMenu($x); - } + $this->obj = new installation($this->dbconn); + if (isset($_GET['id'])) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['Installation']); + $this->stop = true; + return; + } + } else { + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } + if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + } - $x = timetrack::getaddlink($this->user,$this->obj); - $this->addMenu($x); + // menu + $x = installation::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addmenu($x); + $m = installation::getOverviewLink($this->user,$lang['Installations']); + $m[category][] = "obj"; + $this->addmenu($m); + if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { + $x = array( url => "installation/installation_new.php", + confirm => false, + text => $lang['NewEntry'], + info => sprintf($lang['InstCreateI'],""), + category => array("installation","new","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $x = array( url => $this->obj->getModURL(), + text => $lang['Modify'], + info => sprintf($lang['InstModifyI'],$this->obj->getFullname()), + category => array("installation","mod","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelURL(), + text => $lang['Delete'], + info => sprintf($lang['InstDelI'],$this->obj->getFullname()), + category => array("installation","del","obj"), + confirm => true + ); + $this->addMenu($x); + } - add_module_addlinks($this,$this->obj); + $x = timetrack::getaddlink($this->user,$this->obj); + $this->addMenu($x); - # add this page to the browsehistory of the users session - $this->addtohistory(); - } - } + add_module_addlinks($this,$this->obj); - $l = new installation_show($current_user); - $l->display(); - $dbconn->Close(); + // add this page to the browsehistory of the users session + $this->addtohistory(); + } +} + +$l = new installation_show($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: installation_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/installation/installation_overview.php,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- installation_overview.php 13 Mar 2009 14:22:22 -0000 1.28 +++ installation_overview.php 30 Mar 2009 15:48:06 -0000 1.29 @@ -11,12 +11,12 @@ */ $tutos['base'] = "../.."; ini_set("include_path",".."); -include_once 'webelements.p3'; -include_once 'permission.p3'; -include_once 'product.pinc'; -include_once 'timetrack.pinc'; +require_once 'webelements.p3'; +require_once 'permission.p3'; +require_once 'product.pinc'; +require_once 'timetrack.pinc'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('installation','overview'); loadmodule('installation'); @@ -26,252 +26,248 @@ * display an overview of installations */ class Installation_overview extends layout { - /** - * the real overview part - */ - Function info() { - global $lang,$tutos; + /** + * the real overview part + */ + Function info() { + global $lang,$tutos; - $result = $this->dbconn->Exec($this->q); - $n = $result->numrows(); - # Make a big array of all visible installations - $x = 0; - while ( $x < $n ) { - $b = new installation($this->dbconn); - $b->read_result($result,$x); - $x++; - if ( ! $b->see_ok() ) { - continue; - } - $blist[] = &$b; - unset($b); - } - $n = count($blist); - $result->free(); - if ( 0 == $n) { - echo $this->error($lang['Err0048']); - return; - } - $this->flds = 6; - echo $this->actionformStart("installation_overview.php"); - echo $this->OverviewTableStart(); - echo "<thead>\n"; - echo "<tr>\n"; - echo $this->orderHeader("","#",$this->link1); - echo $this->orderHeader("",$lang['Product'],$this->link1); - echo $this->orderHeader("",$lang['Customer'],$this->link1); - echo $this->orderHeader("description",$lang['Description'],$this->link1); - echo $this->orderHeader("",$lang['InstalledBy'],$this->link1); - echo $this->orderHeader("instdate",$lang['Date'],$this->link1); + $r = ''; + $result = $this->dbconn->Exec($this->q); + $n = $result->numrows(); + // Make a big array of all visible installations + $x = 0; + while ( $x < $n ) { + $b = new installation($this->dbconn); + $b->read_result($result,$x); + $x++; + if ( ! $b->see_ok() ) { + continue; + } + $blist[] = &$b; + unset($b); + } + $n = count($blist); + $result->free(); + if ( 0 == $n) { + $r .= $this->error($lang['Err0048']); + return $r; + } + $this->flds = 6; + $r .= $this->actionformStart("installation_overview.php"); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + $r .= $this->orderHeader("","#",$this->link1); + $r .= $this->orderHeader("",$lang['Product'],$this->link1); + $r .= $this->orderHeader("",$lang['Customer'],$this->link1); + $r .= $this->orderHeader("description",$lang['Description'],$this->link1); + $r .= $this->orderHeader("",$lang['InstalledBy'],$this->link1); + $r .= $this->orderHeader("instdate",$lang['Date'],$this->link1); - echo get_module_overview_header($this,'installation'); - echo show_custom_overview_headers($this,'installation',$this->link1); + $r .= get_module_overview_header($this,'installation'); + $r .= show_custom_overview_headers($this,'installation',$this->link1); - if ( $tutos[massupdate] == 1 ) { - echo " <th><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - $this->flds++; - } + if ( $tutos[massupdate] == 1 ) { + $r .= " <th><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + $this->flds++; + } - echo "</tr>\n"; - echo "</thead>\n"; + $r .= "</tr>\n"; + $r .= "</thead>\n"; - if ( $this->start == -1 ) { - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } + if ( $this->start == -1 ) { + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } - $line = 0; - while ( ($a < $n) && ($a < $end) ) { - $i = &$blist[$a]; - $a++; - echo $this->OverviewRowStart($line,$lang[$i->getType()] .": ". $i->getFullName()); - echo " <td align=\"right\">". $i->getLink(sprintf("%03d",$a)) ."</td>\n"; - echo " <td>"; - if ( is_object($i->product) && $i->product->id != -1 ) { - echo $i->product->getLink(); - } else { - echo "<i>". $lang['HistoryDeleted'] ."</i>"; - } - echo "</td>\n"; - if ( is_object($i->customer) && $i->customer->id == -1 ) { - echo ' <td><i>'. $lang['HistoryDeleted'] ."</i></td>\n"; - } else if (is_object($i->customer) && $i->customer->id != -1 ) { - echo ' <td>'. $i->customer->getLink() ."</td>\n"; - } else { - echo " <td> </td>\n"; - } - echo ' <td>'. myentities($i->description) ." </td>\n"; - if ( is_object($i->installer) && $i->installer->id == -1 ) { - echo " <td><i>". $lang['HistoryDeleted'] ."</i></td>\n"; - } else if ( is_object($i->installer) && $i->installer->id != -1 ) { - echo " <td>". $i->installer->getLink() ."</td>\n"; - } else { - echo " <td> </td>\n"; - } - echo " <td>". $i->instdate->getLinkDate() ."</td>\n"; - echo get_module_overview_data($this,$i); - echo show_custom_overview_data($this,'installation',$i); + $line = 0; + while ( ($a < $n) && ($a < $end) ) { + $i = &$blist[$a]; + $a++; + $r .= $this->OverviewRowStart($line,$lang[$i->getType()] .": ". $i->getFullName()); + $r .= " <td align=\"right\">". $i->getLink(sprintf("%03d",$a)) ."</td>\n"; + $r .= " <td>"; + if ( is_object($i->product) && $i->product->id != -1 ) { + $r .= $i->product->getLink(); + } else { + $r .= "<i>". $lang['HistoryDeleted'] ."</i>"; + } + $r .= "</td>\n"; + if ( is_object($i->customer) && $i->customer->id == -1 ) { + $r .= ' <td><i>'. $lang['HistoryDeleted'] ."</i></td>\n"; + } else if (is_object($i->customer) && $i->customer->id != -1 ) { + $r .= ' <td>'. $i->customer->getLink() ."</td>\n"; + } else { + $r .= " <td> </td>\n"; + } + $r .= ' <td>'. myentities($i->description) ." </td>\n"; + if ( is_object($i->installer) && $i->installer->id == -1 ) { + $r .= " <td><i>". $lang['HistoryDeleted'] ."</i></td>\n"; + } else if ( is_object($i->installer) && $i->installer->id != -1 ) { + $r .= " <td>". $i->installer->getLink() ."</td>\n"; + } else { + $r .= " <td> </td>\n"; + } + $r .= " <td>". $i->instdate->getLinkDate() ."</td>\n"; + $r .= get_module_overview_data($this,$i); + $r .= show_custom_overview_data($this,'installation',$i); - if ( $tutos[massupdate] == 1 ) { - echo " <td align=\"center\">\n"; - if ( $i->mod_ok() ) { - echo "<input name=\"mark[]\" type=\"checkbox\" value=\"". $i->id ."\" />\n"; - } else { - echo "-\n"; - } - echo "</td>\n"; - } - echo $this->OverviewRowEnd($line++); - } + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $i->mod_ok() ) { + $r .= "<input name=\"mark[]\" type=\"checkbox\" value=\"". $i->id ."\" />\n"; + } else { + $r .= "-\n"; + } + $r .= "</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + } - echo $this->list_navigation($this->link1,$this->flds,$this->start,$a,$n); + $r .= $this->list_navigation($this->link1,$this->flds,$this->start,$a,$n); - if ( $tutos[massupdate] == 1 ) { - echo $this->UpdateRowStart($this->flds -2); - echo sprintf($lang['withmarked'],$lang['Installations']); - echo " <select name=\"action\">\n"; - echo ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; - echo ' <option value="-2">'. $lang['Delete'] ."</option>\n"; - echo ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - echo ' <option value="WatchAdd">'. $lang['WatchAdd'] ."</option>\n"; - echo ' <option value="WatchDel">'. $lang['WatchDel'] ."</option>\n"; - } - echo "</select>\n"; - echo $this->UpdateRowEnd(2); - } + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart($this->flds -2); + $r .= sprintf($lang['withmarked'],$lang['Installations']); + $r .= " <select name=\"action\">\n"; + $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; + $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; + $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; + if (class_exists('watchlist')) { + $r .= watchlist::action_options(); + } + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(2); + } - echo $this->OverviewTableEnd(); - echo $this->actionformEnd("installation_overview.php"); - } - /** - * navigation - */ - Function navigate() { - } - /** - * action via massupdate - */ - Function action() { - global $lang,$msg; + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("installation_overview.php"); + return $r; + } + /** + * action via massupdate + */ + Function action() { + global $lang,$msg; - if ( $_GET['action'] == -2 ) { - $this->dbconn->Begin("WORK"); - foreach ($_GET['mark'] as $key => $val) { - $b = new installation($this->dbconn); - $b = $b->read($val,$b); - if ( $b->id != $val ) { - continue; - } - if ( $b->del_ok() ) { - $msg .= sprintf($lang['InstDelI'], $b->getFullName()) ."<br />"; - $msg .= $b->delete(); - } else { - $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; - } - unset($b); - } - $this->dbconn->Commit("WORK"); - return; - } - if ( $_GET['action'] == -4 ) { - $this->redirect = "../".acl_action(); - return; - } - if (class_exists('watchlist')) { - watchlist::parse_action($this->user); - } - } - /** - * preapre everything read data , parse args etc - */ - Function prepare() { - global $lang,$current_user; + if ( $_GET['action'] == -2 ) { + $this->dbconn->Begin("WORK"); + foreach ($_GET['mark'] as $val) { + $b = new installation($this->dbconn); + $b = $b->read($val,$b); + if ( $b->id != $val ) { + continue; + } + if ( $b->del_ok() ) { + $msg .= sprintf($lang['InstDelI'], $b->getFullName()) ."<br />"; + $msg .= $b->delete(); + } else { + $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; + } + unset($b); + } + $this->dbconn->Commit("WORK"); + return; + } + if ( $_GET['action'] == -4 ) { + $this->redirect = "../".acl_action(); + return; + } + if (class_exists('watchlist')) { + watchlist::parse_action($this->user); + } + } + /** + * preapre everything read data , parse args etc + */ + Function prepare() { + global $lang,$current_user; - $this->name = $lang['InstOverview']; - $this->css_class = 'overviewbox'; + $this->name = $lang['InstOverview']; + $this->css_class = 'overviewbox'; - if ( ! $this->user->feature_ok(useinstmanagement,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + if ( ! $this->user->feature_ok(useinstmanagement,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - $link1 = "installation/installation_overview.php"; - $q = "SELECT * FROM ". $this->dbconn->prefix ."installations"; - $pre = " WHERE "; + $link1 = "installation/installation_overview.php"; + $q = "SELECT * FROM ". $this->dbconn->prefix ."installations"; + $pre = " WHERE "; - if ( isset($_GET['link_id']) ) { - $link1 = addUrlParameter($link1,"link_id=". $_GET['link_id']); - $o = getObject($this->dbconn,$_GET['link_id']); - if ( $o->id > 0 ) { - if ( $o->getType() == "product" ) { - $q .= $pre ."product_id = ". $o->id; - $pre = " AND "; - } else if ( $o->getType() == "company" ) { - $q .= $pre ."customer_id = ". $o->id; - $pre = " AND "; - } else if ( $o->getType() == "address" ) { - $q .= $pre ."customer_id = ". $o->id; - $pre = " AND "; - } - } - } + if ( isset($_GET['link_id']) ) { + $link1 = addUrlParameter($link1,"link_id=". $_GET['link_id']); + $o = getObject($this->dbconn,$_GET['link_id']); + if ( $o->id > 0 ) { + if ( $o->getType() == "product" ) { + $q .= $pre ."product_id = ". $o->id; + $pre = " AND "; + } else if ( $o->getType() == "company" ) { + $q .= $pre ."customer_id = ". $o->id; + $pre = " AND "; + } else if ( $o->getType() == "address" ) { + $q .= $pre ."customer_id = ". $o->id; + $pre = " AND "; + } + } + } - if(isset($_GET['name'])){ - $this->filter = $_GET['name']; - $arr = array(); - product::search_by_name(&$arr,&$current_user,$this->filter); - if ( count($arr) != 0 ) { - $q .= $pre ."("; - $pre = ""; - foreach($arr as $key => $val) { - $q .= $pre ."product_id = ". $key; - $pre = " OR "; - } - $q .= ")"; - } - $q .= $pre . "description LIKE '%". $this->filter ."%'"; - } + if(isset($_GET['name'])){ + $this->filter = $_GET['name']; + $arr = array(); + product::search_by_name(&$arr,&$current_user,$this->filter); + if ( count($arr) != 0 ) { + $q .= $pre ."("; + $pre = ""; + foreach($arr as $key => $val) { + $q .= $pre ."product_id = ". $key; + $pre = " OR "; + } + $q .= ")"; + } + $q .= $pre . "description LIKE '%". $this->filter ."%'"; + } - check_dbacl($this->dbconn, $q, $this->user->id); - # sorting - $xxx = ""; - order_parse($q,$link1,$xxx,$xxx,"instdate"); + check_dbacl($this->dbconn, $q, $this->user->id); + // sorting + $xxx = ""; + order_parse($q,$link1,$xxx,$xxx,"instdate"); - $this->q = $q; + $this->q = $q; - $result = $this->dbconn->Exec($this->q); - $n = $result->numrows(); - if ( 0 == $n) { - $this->redirect = "installation_select.php?msg=". UrlEncode($lang['Err0048']); - return; - } + $result = $this->dbconn->Exec($this->q); + $n = $result->numrows(); + if ( 0 == $n) { + $this->redirect = "installation_select.php?msg=". UrlEncode($lang['Err0048']); + return; + } - $this->link1 = $link1; - if ( isset($_GET['start']) ) { - $this->start = $_GET['start']; - } else { - $this->start = 0; - } + $this->link1 = $link1; + if ( isset($_GET['start']) ) { + $this->start = $_GET['start']; + } else { + $this->start = 0; + } - $x = installation::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addmenu($x); + $x = installation::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addmenu($x); - if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { - $x = array( url => "installation/installation_new.php", - confirm => false, - text => $lang['NewEntry'], - info => sprintf($lang['InstCreateI'],""), - category => array("installation","new","obj") - ); - $this->addMenu($x); - } - } + if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { + $x = array( url => "installation/installation_new.php", + confirm => false, + text => $lang['NewEntry'], + info => sprintf($lang['InstCreateI'],""), + category => array("installation","new","obj") + ); + $this->addMenu($x); + } + } } $l = new Installation_overview($current_user); @@ -279,6 +275,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: installation_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/installation/installation_ins.php,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- installation_ins.php 16 Feb 2009 20:03:57 -0000 1.19 +++ installation_ins.php 30 Mar 2009 15:48:06 -0000 1.20 @@ -131,14 +131,8 @@ $gotourl = $obj->getUrl(); } - $gotourl = addMessage($gotourl,$msg,true); - $gotourl = addSessionKey($gotourl,true); - - /* Go back to user mask */ - Header("Status: 302 Moved Temporarily"); - Header("Location: ". dirname(getBaseUrl()) ."/". $gotourl); - $dbconn->Close(); - /* +leave_insert($dbconn,$gotourl,$msg); +/** * CVS Info: $Id$ * $Author$ */ |
From: Gero K. <gok...@us...> - 2009-03-30 15:48:14
|
Update of /cvsroot/tutos/tutos/php/watchlist In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8402/watchlist Modified Files: watchlist_ins.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: watchlist_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/watchlist/watchlist_ins.php,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- watchlist_ins.php 4 Dec 2007 11:48:18 -0000 1.16 +++ watchlist_ins.php 30 Mar 2009 15:48:06 -0000 1.17 @@ -49,14 +49,9 @@ $dbconn->Commit("WORK"); } - $gotourl = addMessage($gotourl,$msg,true); - $gotourl = addSessionKey($gotourl,true); - - Header("Status: 302 Moved Temporarily"); - Header("Location: ". $gotourl); - $dbconn->Close(); - /* - * CVS Info: $Id$ - * $Author$ - */ +leave_insert($dbconn,$gotourl,$msg); +/** + * CVS Info: $Id$ + * $Author$ + */ ?> |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:53
|
Update of /cvsroot/tutos/tutos/php/expense In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/expense Modified Files: expense.pinc mconfig.pinc Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: expense.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/expense/expense.pinc,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- expense.pinc 24 Mar 2009 20:56:14 -0000 1.27 +++ expense.pinc 29 Mar 2009 18:25:41 -0000 1.28 @@ -16,91 +16,91 @@ * cols > 0 make sperate rows with cols columns for each expense */ function showExpenses(&$user,&$obj,$cols,$rows = 0) { - global $tutos,$lang,$table; + global $tutos,$lang,$table; - $r = ''; - $n = 1; - $x = count($obj->list[useexpenses]); + $r = ''; + $n = 1; [...1728 lines suppressed...] + * get the help index + */ + function getHelpIndex () { + global $lang; - $r = ""; - $r .= "<h3>". makelink("help.php?p=glossary#expense",$lang['Expense'],$lang['Expense']) ."</h3><ul>\n"; - $r .= "<li>". makelink("help.php?p=expense_overview",$lang["ExpenseOverview"],$lang["ExpenseOverview"]) ."</li>\n"; - $r .= "</ul>\n"; - return $r; - } + $r = ""; + $r .= "<h3>". makelink("help.php?p=glossary#expense",$lang['Expense'],$lang['Expense']) ."</h3><ul>\n"; + $r .= "<li>". makelink("help.php?p=expense_overview",$lang["ExpenseOverview"],$lang["ExpenseOverview"]) ."</li>\n"; + $r .= "</ul>\n"; + return $r; + } } ?> \ No newline at end of file Index: mconfig.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/expense/mconfig.pinc,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- mconfig.pinc 1 Mar 2009 10:29:17 -0000 1.4 +++ mconfig.pinc 29 Mar 2009 18:25:41 -0000 1.5 @@ -1,6 +1,6 @@ <?php /* - * Copyright 1999 - 2004 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2009 by Gero Kohnert and ECOsoft.net * * Module specific configuration * @@ -14,11 +14,11 @@ # define('useexpenses',-90); $tutos[modules]['expense'] = array( - name => "expense", - Desc => "expenses", - file => "php/expense/expense.pinc", - 'overview' => "expense/expense_overview.php", - 'perm' => useexpenses + name => "expense", + Desc => "expenses", + file => "php/expense/expense.pinc", + 'overview' => "expense/expense_overview.php", + 'perm' => useexpenses ); # # globally enable this module @@ -34,4 +34,4 @@ $tutos[modulesinc]['expense'][] = "scheme"; $permskip[useexpenses][PERM_MYTUTOS] = 1; -?> +?> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:53
|
Update of /cvsroot/tutos/tutos/php/file In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/file Modified Files: file.pinc file_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: file_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/file/file_show.php,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- file_show.php 13 Mar 2009 14:22:22 -0000 1.27 +++ file_show.php 29 Mar 2009 18:25:41 -0000 1.28 @@ -28,260 +28,252 @@ * show a file (info) */ class File_show extends layout { - /** - * display the file as thumbnail - */ - Function info_thumb() { - global $tutos,$lang; + /** + * display the file as thumbnail + */ + Function info_thumb() { + global $tutos,$lang; - if (strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 5") || strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 6") ) { - Header("Expires:"); - Header("Cache-Control:"); - Header("Pragma:"); - Header("Content-Type: application/octet-stream"); - Header("Connection: close"); - Header("Content-Transfer-Encoding: binary"); - } else { - if ( ($this->obj->filetype != "") && ($this->obj->version == $this->version) ) { - Header("Content-type: ". $this->obj->filetype); - } else { - Header("Content-type: text/plain"); - } - Header("Content-Disposition: inline; filename=\"thumb_". $this->obj->filename ."\""); - } - Header("Content-Description: Upload from TUTOS" ); - $this->obj->thumbnail($this->version); - } - /** - * display the file - */ - Function info_download() { - global $tutos,$lang; - // see also - // http://www.phpbuilder.com/forum/archives/1/2001/3/4/113046 - // http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html - // http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/overview/appendix_a.asp - if (strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 5") || strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 6") ) { - Header("Expires:"); - Header("Cache-Control:"); - Header("Pragma:"); - Header("Content-Type: application/octet-stream"); - Header("Connection: close"); - Header("Content-Transfer-Encoding: binary"); - } else { - if ( ($this->obj->filetype != "") && ($this->obj->version == $this->version) ) { - Header("Content-type: ". $this->obj->filetype); - } else { - Header("Content-type: text/plain"); - } - } - Header("Content-Disposition: attachment; filename=\"". $this->obj->filename ."\""); - Header("Content-Description: Upload from TUTOS" ); - $this->obj->download($this->version); - } - /** - * display the info - */ - Function info() { - global $tutos,$lang; + if (strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 5") || strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 6") ) { + Header("Expires:"); + Header("Cache-Control:"); + Header("Pragma:"); + Header("Content-Type: application/octet-stream"); + Header("Connection: close"); + Header("Content-Transfer-Encoding: binary"); + } else { + if ( ($this->obj->filetype != "") && ($this->obj->version == $this->version) ) { + Header("Content-type: ". $this->obj->filetype); + } else { + Header("Content-type: text/plain"); + } + Header("Content-Disposition: inline; filename=\"thumb_". $this->obj->filename ."\""); + } + Header("Content-Description: Upload from TUTOS" ); + $this->obj->thumbnail($this->version); + } + /** + * display the file + */ + Function info_download() { + global $tutos,$lang; + // see also + // http://www.phpbuilder.com/forum/archives/1/2001/3/4/113046 + // http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html + // http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/overview/appendix_a.asp + if (strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 5") || strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 6") ) { + Header("Expires:"); + Header("Cache-Control:"); + Header("Pragma:"); + Header("Content-Type: application/octet-stream"); + Header("Connection: close"); + Header("Content-Transfer-Encoding: binary"); + } else { + if ( ($this->obj->filetype != "") && ($this->obj->version == $this->version) ) { + Header("Content-type: ". $this->obj->filetype); + } else { + Header("Content-type: text/plain"); + } + } + Header("Content-Disposition: attachment; filename=\"". $this->obj->filename ."\""); + Header("Content-Description: Upload from TUTOS" ); + return $this->obj->download($this->version); + } + /** + * display the info + */ + Function info() { + global $tutos,$lang; - if ( $this->format == "thumbnail" ) { - $this->info_thumb(); - return; - } else if ( $this->format == "show" ) { - $this->obj->show($this->version,$this); - return; - } else if ( $this->format == "download" ) { - $this->info_download($this->version); - return; - } + $r = ''; + if ( $this->format == "thumbnail" ) { + return $this->info_thumb(); + } else if ( $this->format == "show" ) { + return $this->obj->show($this->version,$this); + } else if ( $this->format == "download" ) { + return $this->info_download($this->version); + } - echo $this->DataTableStart(); - echo "<tr>\n"; - echo ' <th colspan="3">'. $lang['FileDetail'] ."</th>\n"; - echo $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); - echo "</tr>\n"; + $r .= $this->DataTableStart(); + $r .= "<tr>\n"; + $r .= ' <th colspan="3">'. $lang['FileDetail'] ."</th>\n"; + $r .= $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); + $r .= "</tr>\n"; - echo $this->CreatorInfoLine($this->obj,4); + $r .= $this->CreatorInfoLine($this->obj,4); - echo "<tr>\n"; - echo $this->showfield($lang['FileNameDoc']); - echo $this->showdata($this->obj->name,1); - echo $this->showfield($lang['FileVersion']); - echo $this->showdata($this->obj->version,1); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileNameDoc']); + $r .= $this->showdata($this->obj->name,1); + $r .= $this->showfield($lang['FileVersion']); + $r .= $this->showdata($this->obj->version,1); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['FileName']); - echo $this->showdata($this->obj->filename,3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileName']); + $r .= $this->showdata($this->obj->filename,3); + $r .= "</tr>\n"; -# echo "<tr>\n"; -# echo $this->showfield($lang['created']); -# echo $this->showdata($this->obj->creation->getDateTime(),3); -# echo "</tr>\n"; +# $r .= "<tr>\n"; +# $r .= $this->showfield($lang['created']); +# $r .= $this->showdata($this->obj->creation->getDateTime(),3); +# $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['FileAuthor']); - echo $this->showdata($this->obj->author->getLink(),3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileAuthor']); + $r .= $this->showdata($this->obj->author->getLink(),3); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['FileReference']); - echo " <td colspan=\"3\">\n"; - if ( count($this->obj->links) ) { - foreach ($this->obj->links as $ref) { - echo $lang[$ref->getType()] ." ". $ref->getLink()."<br />"; - } - } else { - echo "--"; - } - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileReference']); + $r .= " <td colspan=\"3\">\n"; + if ( count($this->obj->links) ) { + foreach ($this->obj->links as $ref) { + $r .= $lang[$ref->getType()] ." ". $ref->getLink()."<br />"; + } + } else { + $r .= "--"; + } + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['FileSize']); - echo $this->showdata($this->obj->filesize ." Bytes",3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileSize']); + $r .= $this->showdata($this->obj->filesize ." Bytes",3); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['FileMd5']); - echo $this->showdata($this->obj->md5,3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileMd5']); + $r .= $this->showdata($this->obj->md5,3); + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['FileType']); - echo $this->showdata($this->obj->filetype,3); - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileType']); + $r .= $this->showdata($this->obj->filetype,3); + $r .= "</tr>\n"; - if ( $this->obj->locked > 0 ) { - echo "<tr>\n"; - echo $this->showfield($lang['FileLockedBy']); - echo $this->showdata($this->obj->locker->getMailLink(),3); - echo "</tr>\n"; - } + if ( $this->obj->locked > 0 ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileLockedBy']); + $r .= $this->showdata($this->obj->locker->getMailLink(),3); + $r .= "</tr>\n"; + } - echo "<tr>\n"; - echo $this->showfield($lang['FileMore']); - echo " <td colspan=\"3\" class=\"pre\"><font size=\"-1\"><tt>\n"; - $this->obj->moreinfo($this); - echo " </tt></font></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileMore']); + $r .= " <td colspan=\"3\" class=\"pre\"><font size=\"-1\"><tt>\n"; + $r .= $this->obj->moreinfo($this); + $r .= " </tt></font></td>\n"; + $r .= "</tr>\n"; - $this->obj->make_vlist(); - @reset($this->obj->vlist); - if (count($this->obj->vlist) > 0 ) { - echo "<tr>\n"; - echo $this->showfield($lang['FileOldVersion']); - echo " <td colspan=\"3\"><font size=\"-1\">\n"; - while ( list ($i,$v) = @each ($this->obj->vlist) ) { - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - echo makelink("file/file_show.php?id=". $this->obj->id ."&format=download&version=".$v, $lang['FileDownload'] ." ". $lang['FileVersion'] ." ". $i , $v); - } else { - echo $lang['FileVersion'] ." ". $i ."\n"; - } - echo "<br />\n"; - } - echo "</font></td>\n"; - echo "</tr>\n"; - } - echo "<tr>\n"; - echo $this->showfield($lang['FileLog']); - echo " <td colspan=\"3\" class=\"pre\"><font size=\"-1\"><tt>\n"; - $logtxt = str_replace("\n", "<br />\n", $this->obj->logtxt); - echo $logtxt; -# echo $this->obj->logtxt; - echo " </tt></font></td>\n"; - echo "</tr>\n"; + $this->obj->make_vlist(); + @reset($this->obj->vlist); + if (count($this->obj->vlist) > 0 ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileOldVersion']); + $r .= " <td colspan=\"3\"><font size=\"-1\">\n"; + while ( list ($i,$v) = @each ($this->obj->vlist) ) { + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $r .= makelink("file/file_show.php?id=". $this->obj->id ."&format=download&version=".$v, $lang['FileDownload'] ." ". $lang['FileVersion'] ." ". $i , $v); + } else { + $r .= $lang['FileVersion'] ." ". $i ."\n"; + } + $r .= "<br />\n"; + } + $r .= "</font></td>\n"; + $r .= "</tr>\n"; + } + $r .= "<tr>\n"; + $r .= $this->showfield($lang['FileLog']); + $r .= " <td colspan=\"3\" class=\"pre\"><font size=\"-1\"><tt>\n"; + $logtxt = str_replace("\n", "<br />\n", $this->obj->logtxt); + $r .= $logtxt; +# $r .= $this->obj->logtxt; + $r .= " </tt></font></td>\n"; + $r .= "</tr>\n"; - # - # Show additional custom fields - # - echo show_custom_fields($this,$this->obj->gettype(),$this->obj,4); - # References to modules - echo show_module_infolists($this->user,$this->obj,4,$this->format); - echo $this->obj->getHistoryLink(4); - echo $this->DataTableEnd(); - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + // Show additional custom fields + $r .= show_custom_fields($this,$this->obj->gettype(),$this->obj,4); + // References to modules + $r .= show_module_infolists($this->user,$this->obj,4,$this->format); + $r .= $this->obj->getHistoryLink(4); + $r .= $this->DataTableEnd(); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->name = $lang['FileDetail']; - $this->obj = new tutos_file($this->dbconn); + $this->name = $lang['FileDetail']; + $this->obj = new tutos_file($this->dbconn); - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - } - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['File']); - $this->stop = true; - $this->format = "html"; - return; - } else if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - $this->format = "html"; - return; - } else if ( $this->obj->id < 0 ) { - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - $this->stop = true; - $this->format = "html"; - return; - } else { - $this->obj->readLinks(); - $this->name .= ": ".$this->obj->getFullName(); - } - if ( ! isset($_GET['version']) ) { - $this->version = $this->obj->version; - } else { - $this->version = $_GET['version'] ; - } - # menu - $m = tutos_file::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addmenu($m); + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + } + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['File']); + $this->stop = true; + $this->format = "html"; + return; + } else if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + $this->format = "html"; + return; + } else if ( $this->obj->id < 0 ) { + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + $this->stop = true; + $this->format = "html"; + return; + } else { + $this->obj->readLinks(); + $this->name .= ": ".$this->obj->getFullName(); + } + if ( ! isset($_GET['version']) ) { + $this->version = $this->obj->version; + } else { + $this->version = $_GET['version'] ; + } + // menu + $m = tutos_file::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addmenu($m); - add_module_addlinks($this,$this->obj); + add_module_addlinks($this,$this->obj); - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - $x = array( url => "file/file_new.php?id=". $this->obj->id, - text => $lang['Modify'], - info => sprintf($lang['FileModifyI'],$this->obj->getFullName()), - category => array("file","mod","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->see_ok() ) { - $x = array( url => $this->obj->getUrl() ."&format=show", - text => $lang['FileShow'], - info => sprintf($lang['FileShowI'],$this->obj->getFullName()), - category => array("file","view") - ); - $this->addMenu($x); - $x = array( url => $this->obj->getUrl() ."&format=download", - text => $lang['FileDownload'], - info => sprintf($lang['FileDownloadI'],$this->obj->getFullName()), - category => array("file","view") - ); - $this->addMenu($x); - } + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $x = array( url => "file/file_new.php?id=". $this->obj->id, + text => $lang['Modify'], + info => sprintf($lang['FileModifyI'],$this->obj->getFullName()), + category => array("file","mod","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->see_ok() ) { + $x = array( url => $this->obj->getUrl() ."&format=show", + text => $lang['FileShow'], + info => sprintf($lang['FileShowI'],$this->obj->getFullName()), + category => array("file","view") + ); + $this->addMenu($x); + $x = array( url => $this->obj->getUrl() ."&format=download", + text => $lang['FileDownload'], + info => sprintf($lang['FileDownloadI'],$this->obj->getFullName()), + category => array("file","view") + ); + $this->addMenu($x); + } - # add this page to the browsehistory of the users session - if ($this->format == "html") { - $this->addtohistory(); - } - } + // add this page to the browsehistory of the users session + if ($this->format == "html") { + $this->addtohistory(); + } + } } $l = new File_show($current_user); Index: file.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/file/file.pinc,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -r1.85 -r1.86 --- file.pinc 24 Mar 2009 20:56:15 -0000 1.85 +++ file.pinc 29 Mar 2009 18:25:41 -0000 1.86 @@ -25,7 +25,7 @@ { $f = fopen($file,'rb'); if(!$f) - return false; + return false; //Read the last 16KB fseek($f, -16384, SEEK_END); @@ -33,13 +33,13 @@ //Extract cross-reference table and trailer [...2537 lines suppressed...] + if ($filter != '') { + if (!eregi($filter,$file)) continue; + } + $r .= ' <option value="'.$file.'">'. myentities($file).' ('.(filesize($ff)/1024).' KB)' ."</option>\n"; + } + closedir($dh); } - $r .= ' <option value="'.$file.'">'. myentities($file).' ('.(filesize($ff)/1024).' KB)' ."</option>\n"; - } - closedir($dh); + $r .= " </select>"; + return $r; } - $r .= " </select>"; - return $r; - } } ?> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:52
|
Update of /cvsroot/tutos/tutos/php/bugtracking In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/bugtracking Modified Files: bug.pinc bug_config.php bug_new.php bug_overview.php bug_select.php bug_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: bug.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/bugtracking/bug.pinc,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- bug.pinc 24 Mar 2009 20:56:14 -0000 1.79 +++ bug.pinc 29 Mar 2009 18:25:41 -0000 1.80 @@ -40,7 +40,7 @@ } # $r = SelectLangArray('state','BugStates',$default,$any,$additional); -# $r .= $stc->getStateSelection($default); +# $r .= $stc->getStateSelection($default); $r = "<select id=\"state\" name=\"state\">\n"; foreach ($stc->states as $f) { @@ -705,7 +705,7 @@ * set the target (i.e. the object where the bug should be solved) */ function setTarget(&$target) { - return $this->setObjectField('target',$target,'BugTarget'); + return $this->setObjectField('target',$target,'BugTarget'); } /** * set the planned endtime @@ -1129,16 +1129,15 @@ $ret = ''; - foreach ($lang['BugStates'] as $i => $f) { - $b[$i] = 0; - $t[$i] = 0; - $s[$i] = ''; - } - foreach ($obj->list[usebugtracking] as $i => $bug) { - $b[$bug->state]++; - $t[$bug->state] += $bug->timetracksum; - $s[$bug->state] = $bug->short; + if (!isset($b[$bug->state])) { + $b[$bug->state] = 0; + $t[$bug->state] = 0; + $s[$bug->state] = ''; + } + $b[$bug->state]++; + $t[$bug->state] += $bug->timetracksum; + $s[$bug->state] = $bug->short; } $bug = new bug($obj->dbconn); Index: bug_config.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/bugtracking/bug_config.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- bug_config.php 7 Mar 2009 10:29:12 -0000 1.6 +++ bug_config.php 29 Mar 2009 18:25:41 -0000 1.7 @@ -24,103 +24,105 @@ * display a admin page */ class Bug_config extends layout { - function info() { - global $lang,$table,$tutos; - - - echo "<form id=\"bugconfig\" name=\"bugconfig\" action=\"bug_config.php\" method=\"post\">\n"; - echo $this->DataTableStart(); - - $line = 0; - echo $this->OverviewRowStart($line); - echo $this->showfield('bug_long_pop'); - echo '<td><select name="long_pop">'; - echo ' <option value="1"'.($tutos['bug_long_pop'] == 1 ? ' selected="selected"':'').'>'.$lang['yes'].'</option>'; - echo ' <option value="0"'.($tutos['bug_long_pop'] == 0 ? ' selected="selected"':'').'>'.$lang['no'].'</option>'; - echo '</select></td>'; - echo '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpLongPop'].'</pre></td>'; - echo $this->OverviewRowEnd($line++); - - echo $this->OverviewRowStart($line); - echo $this->showfield('bug_remember'); - echo '<td><input name="remember" value="'.$tutos['bug_remember'].'">'; - echo '</input></td>'; - echo '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpRemember'].'</pre></td>'; - echo $this->OverviewRowEnd($line++); - - echo $this->OverviewRowStart($line); - echo $this->showfield('bug_autoname'); - echo '<td><input name="autoname" value="'.$tutos['bug_autoname'] .'">'; - echo '</input></td>'; - echo '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpAutoname'].'</pre></td>'; - echo $this->OverviewRowEnd($line++); - - echo $this->OverviewRowStart($line); - echo $this->showfield('bug_delete'); - echo '<td><select name="delete">'; - echo ' <option value="1"'.($tutos['bug_delete'] == 1 ? ' selected="selected"':'').'>'.$lang['yes'].'</option>'; - echo ' <option value="0"'.($tutos['bug_delete'] == 0 ? ' selected="selected"':'').'>'.$lang['no'].'</option>'; - echo '</select></td>'; - echo '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpDelete'].'</pre></td>'; - echo $this->OverviewRowEnd($line++); - - echo $this->OverviewRowStart($line); - echo $this->showfield('bug_state_stc'); - echo '<td><select name="state_stc">'; - echo ' <option value="-1"'.($tutos['bug_state_stc'] == -1 ? ' selected="selected"':'').'>'.$lang['no'].'</option>'; - stc::getListByLangArray($this,'BugStates'); - foreach($this->stcs as $j) { - echo '<option value="'.$j->id.'"'.($tutos['bug_state_stc'] == $j->id ? ' selected="selected"':'').'>'.$j->getLink().'</option>'; - } - echo '</select>'; - echo '<br />'.makelink('stc/stc_new.php?lgarr=BugStates','Create a new STC'); - echo '</td>'; - echo '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpStateSTC'].'</pre></td>'; - echo $this->OverviewRowEnd($line++); - - echo '<tr>'; - echo submit_reset(0,1,1,1,1,0); - echo '</tr>'; - - echo $this->DataTableEnd(); - $this->addHidden("save", 1); - echo hiddenFormElements(); - echo $this->getHidden(); - echo "</form>\n"; - } - function navigate() { - } - function prepare() { - global $lang,$msg,$tutos; - - $this->name = $lang['BugConfig']; - - # default - if (!isset($tutos['bug_long_pop'])) $tutos['bug_long_pop'] = 0; - if (!isset($tutos['bug_remember'])) $tutos['bug_remember'] = 0; - if (!isset($tutos['bug_autoname'])) $tutos['bug_autoname'] = '%Y-%m-&X-&Y'; - if (!isset($tutos['bug_delete'])) $tutos['bug_delete'] = 1; - if (!isset($tutos['bug_state_stc'])) $tutos['bug_state_stc'] = -1; - - if ( ! $this->user->isAdmin() ) { - $msg .= $this->error("Only admins are allowed to see this"); - $this->stop = true; - return; - } - if (isset($_REQUEST['save']) && ($_REQUEST['save'] == 1) ) { - $tutos['bug_long_pop'] = $_REQUEST['long_pop']; - write_config_value($this->dbconn,'bug_long_pop','bugtracking'); - $tutos['bug_remember'] = $_REQUEST['remember']; - write_config_value($this->dbconn,'bug_remember','bugtracking'); - $tutos['bug_autoname'] = $_REQUEST['autoname']; - write_config_value($this->dbconn,'bug_autoname','bugtracking'); - $tutos['bug_delete'] = $_REQUEST['delete']; - write_config_value($this->dbconn,'bug_delete','bugtracking'); - $tutos['bug_state_stc'] = $_REQUEST['state_stc']; - write_config_value($this->dbconn,'bug_state_stc','bugtracking'); - $msg .= ' saving done '; - } - } + function info() { + global $lang,$table,$tutos; + + $r = ''; + $r .= "<form id=\"bugconfig\" name=\"bugconfig\" action=\"bug_config.php\" method=\"post\">\n"; + $r .= $this->DataTableStart(); + + $line = 0; + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('bug_long_pop'); + $r .= '<td><select name="long_pop">'; + $r .= ' <option value="1"'.($tutos['bug_long_pop'] == 1 ? ' selected="selected"':'').'>'.$lang['yes'].'</option>'; + $r .= ' <option value="0"'.($tutos['bug_long_pop'] == 0 ? ' selected="selected"':'').'>'.$lang['no'].'</option>'; + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpLongPop'].'</pre></td>'; + $r .= $this->OverviewRowEnd($line++); + + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('bug_remember'); + $r .= '<td><input name="remember" value="'.$tutos['bug_remember'].'">'; + $r .= '</input></td>'; + $r .= '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpRemember'].'</pre></td>'; + $r .= $this->OverviewRowEnd($line++); + + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('bug_autoname'); + $r .= '<td><input name="autoname" value="'.$tutos['bug_autoname'] .'">'; + $r .= '</input></td>'; + $r .= '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpAutoname'].'</pre></td>'; + $r .= $this->OverviewRowEnd($line++); + + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('bug_delete'); + $r .= '<td><select name="delete">'; + $r .= ' <option value="1"'.($tutos['bug_delete'] == 1 ? ' selected="selected"':'').'>'.$lang['yes'].'</option>'; + $r .= ' <option value="0"'.($tutos['bug_delete'] == 0 ? ' selected="selected"':'').'>'.$lang['no'].'</option>'; + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpDelete'].'</pre></td>'; + $r .= $this->OverviewRowEnd($line++); + + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('bug_state_stc'); + $r .= '<td><select name="state_stc">'; + $r .= ' <option value="-1"'.($tutos['bug_state_stc'] == -1 ? ' selected="selected"':'').'>'.$lang['no'].'</option>'; + stc::getListByLangArray($this,'BugStates'); + foreach($this->stcs as $j) { + $r .= '<option value="'.$j->id.'"'.($tutos['bug_state_stc'] == $j->id ? ' selected="selected"':'').'>'.$j->getLink().'</option>'; + } + $r .= '</select>'; + $r .= '<br />'.makelink('stc/stc_new.php?lgarr=BugStates','Create a new STC'); + $r .= '</td>'; + $r .= '<td colspan="2" class="pre"><pre>'.$lang['BugConfigHelpStateSTC'].'</pre></td>'; + $r .= $this->OverviewRowEnd($line++); + + $r .= '<tr>'; + $r .= submit_reset(0,1,1,1,1,0); + $r .= '</tr>'; + + $r .= $this->DataTableEnd(); + $this->addHidden("save", 1); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; + return $r; + } + /** + * + */ + function prepare() { + global $lang,$msg,$tutos; + + $this->name = $lang['BugConfig']; + + // default + if (!isset($tutos['bug_long_pop'])) $tutos['bug_long_pop'] = 0; + if (!isset($tutos['bug_remember'])) $tutos['bug_remember'] = 0; + if (!isset($tutos['bug_autoname'])) $tutos['bug_autoname'] = '%Y-%m-&X-&Y'; + if (!isset($tutos['bug_delete'])) $tutos['bug_delete'] = 1; + if (!isset($tutos['bug_state_stc'])) $tutos['bug_state_stc'] = -1; + + if ( ! $this->user->isAdmin() ) { + $msg .= $this->error("Only admins are allowed to see this"); + $this->stop = true; + return; + } + if (isset($_REQUEST['save']) && ($_REQUEST['save'] == 1) ) { + $tutos['bug_long_pop'] = $_REQUEST['long_pop']; + write_config_value($this->dbconn,'bug_long_pop','bugtracking'); + $tutos['bug_remember'] = $_REQUEST['remember']; + write_config_value($this->dbconn,'bug_remember','bugtracking'); + $tutos['bug_autoname'] = $_REQUEST['autoname']; + write_config_value($this->dbconn,'bug_autoname','bugtracking'); + $tutos['bug_delete'] = $_REQUEST['delete']; + write_config_value($this->dbconn,'bug_delete','bugtracking'); + $tutos['bug_state_stc'] = $_REQUEST['state_stc']; + write_config_value($this->dbconn,'bug_state_stc','bugtracking'); + $msg .= ' saving done '; + } + } } $l = new Bug_config($current_user); Index: bug_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/bugtracking/bug_new.php,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- bug_new.php 24 Mar 2009 16:01:40 -0000 1.34 +++ bug_new.php 29 Mar 2009 18:25:41 -0000 1.35 @@ -234,11 +234,6 @@ echo $lang['FldsRequired'] ."\n"; } /** - * navigate - */ - Function navigate() { - } - /** * prepare */ Function prepare() { Index: bug_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/bugtracking/bug_overview.php,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- bug_overview.php 24 Mar 2009 16:01:40 -0000 1.34 +++ bug_overview.php 29 Mar 2009 18:25:41 -0000 1.35 @@ -22,7 +22,7 @@ require_once 'product.pinc'; require_once 'timetrack.pinc'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('bugtracking','overview'); loadmodule('bugtracking'); @@ -538,11 +538,6 @@ echo $this->DataTableEnd(); } /** - * navigate - */ - Function navigate() { - } - /** * action via massupdate */ Function action() { Index: bug_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/bugtracking/bug_show.php,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- bug_show.php 24 Mar 2009 16:01:40 -0000 1.27 +++ bug_show.php 29 Mar 2009 18:25:41 -0000 1.28 @@ -136,11 +136,6 @@ echo $this->DataTableEnd(); } /** - * navigate - */ - Function navigate() { - } - /** * prepare */ Function prepare() { Index: bug_select.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/bugtracking/bug_select.php,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- bug_select.php 5 Mar 2009 16:16:44 -0000 1.11 +++ bug_select.php 29 Mar 2009 18:25:41 -0000 1.12 @@ -16,7 +16,7 @@ require_once 'permission.p3'; require_once 'bug.pinc'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('bugtracking','select'); loadmodule('bugtracking'); @@ -26,131 +26,128 @@ * display a bug selection form */ class Bug_select extends layout { - /** - * - */ - Function info() { - global $lang,$tutos; - - echo "<form id=\"bugsearch\" name=\"bugsearch\" method=\"get\" action=\"bug_overview.php\">\n"; - echo DoubleTableStart(); - - echo "<tr>\n"; - if ( $this->ext == 0 ) { - echo "<th colspan=\"3\">". $lang['SearchForBug'] ."</th>\n"; - - echo "</tr><tr>\n"; - - echo $this->showfieldc($lang['AdrName'],0,"name"); - echo " <td align=\"center\"><input id=\"name\" type=\"text\" value=\"\" name=\"name\" /></td>\n"; - echo " <td align=\"center\">\n"; - echo " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForBug'] ."\" /></td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\" align=\"center\"><font size=\"-1\">". $lang['BugSelInfo'] ."</font></td>\n"; - echo " <td align=\"center\">". makelink("bugtracking/bug_select.php?ext=1",$lang['extended']) ."</td>\n"; - } else { - echo "<th colspan=\"3\">". $lang['SearchForBugExt'] ."</th>\n"; - - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['AdrName'],0,"name"); - echo " <td> <input id=\"name\" type=\"text\" value=\"\" name=\"name\" />"; - echo " </td>\n"; - echo " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForBugExt'] ."\" /></td>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['BugState'],0,"state"); - echo " <td colspan=\"2\"> <b>". BugAskState($this->state,2) ."</b> </td>\n"; - - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['BugClass'],0,"class"); - echo " <td colspan=\"2\"> <b>". BugAskClass($this->class,true) ."</b> </td>\n"; - - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['BugMedium'],0,"medium"); - echo " <td colspan=\"2\"> <b>". BugAskMedium($this->medium,true) ."</b> </td>\n"; - - echo "</tr><tr>\n"; - echo " <td class=\"desc\" rowspan=\"2\">". $lang['BugBetween'] ." </td>\n"; - echo " <td colspan=\"2\"> "; - echo $this->from->EnterDate("f",1); - echo " </td>\n"; - - echo "</tr><tr>\n"; - echo " <td colspan=\"2\"> "; - echo $this->to->EnterDate("t",1); - echo " </td>\n"; - - echo "</tr><tr>\n"; - echo $this->showfieldc(sprintf($lang['UserBugSearch'],$this->user->getLink()),0,"solverid"); - echo "<td><input id=\"solverid\" type=\"checkbox\" name=\"solverid\" value=\"". $this->user->id ."\" />"; - echo " </td>\n"; - } - - echo "</tr>\n"; - echo DoubleTableEnd(); - echo hiddenFormElements(); - echo "</form>\n"; - - echo $this->setfocus("bugsearch.name"); - } - /** - * - */ - Function navigate() { - } - /** - * - */ - Function prepare() { - global $lang,$tutos; - - $this->name = $lang['BugsSearch']; - $this->center = true; - $this->css_class = 'selectbox'; - - if ( ! $this->user->feature_ok(usebugtracking,PERM_SEL) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + /** + * + */ + Function info() { + global $lang,$tutos; - # Defaults for search - $this->from = new TUTOS_Date_Time(0); - $this->to = new TUTOS_Date_Time(0); + $r = ''; + $r .= "<form id=\"bugsearch\" name=\"bugsearch\" method=\"get\" action=\"bug_overview.php\">\n"; + $r .= DoubleTableStart(); + + $r .= "<tr>\n"; + if ( $this->ext == 0 ) { + $r .= "<th colspan=\"3\">". $lang['SearchForBug'] ."</th>\n"; + + $r .= "</tr><tr>\n"; + + $r .= $this->showfieldc($lang['AdrName'],0,"name"); + $r .= " <td align=\"center\"><input id=\"name\" type=\"text\" value=\"\" name=\"name\" /></td>\n"; + $r .= " <td align=\"center\">\n"; + $r .= " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForBug'] ."\" /></td>\n"; + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\" align=\"center\"><font size=\"-1\">". $lang['BugSelInfo'] ."</font></td>\n"; + $r .= " <td align=\"center\">". makelink("bugtracking/bug_select.php?ext=1",$lang['extended']) ."</td>\n"; + } else { + $r .= "<th colspan=\"3\">". $lang['SearchForBugExt'] ."</th>\n"; + + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['AdrName'],0,"name"); + $r .= " <td> <input id=\"name\" type=\"text\" value=\"\" name=\"name\" />"; + $r .= " </td>\n"; + $r .= " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForBugExt'] ."\" /></td>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['BugState'],0,"state"); + $r .= " <td colspan=\"2\"> <b>". BugAskState($this->state,2) ."</b> </td>\n"; + + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['BugClass'],0,"class"); + $r .= " <td colspan=\"2\"> <b>". BugAskClass($this->class,true) ."</b> </td>\n"; + + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['BugMedium'],0,"medium"); + $r .= " <td colspan=\"2\"> <b>". BugAskMedium($this->medium,true) ."</b> </td>\n"; + + $r .= "</tr><tr>\n"; + $r .= " <td class=\"desc\" rowspan=\"2\">". $lang['BugBetween'] ." </td>\n"; + $r .= " <td colspan=\"2\"> "; + $r .= $this->from->EnterDate("f",1); + $r .= " </td>\n"; + + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\"> "; + $r .= $this->to->EnterDate("t",1); + $r .= " </td>\n"; + + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc(sprintf($lang['UserBugSearch'],$this->user->getLink()),0,"solverid"); + $r .= "<td><input id=\"solverid\" type=\"checkbox\" name=\"solverid\" value=\"". $this->user->id ."\" />"; + $r .= " </td>\n"; + } + + $r .= "</tr>\n"; + $r .= DoubleTableEnd(); + $r .= hiddenFormElements(); + $r .= "</form>\n"; + + $r .= $this->setfocus("bugsearch.name"); + return $r; + } + /** + * + */ + Function prepare() { + global $lang,$tutos; + + $this->name = $lang['BugsSearch']; + $this->center = true; + $this->css_class = 'selectbox'; + + if ( ! $this->user->feature_ok(usebugtracking,PERM_SEL) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } + + // Defaults for search + $this->from = new TUTOS_Date_Time(0); + $this->to = new TUTOS_Date_Time(0); - if ( isset($_SESSION['bugsearchfrom']) ) { - $this->from->setDateTime($_SESSION['bugsearchfrom']); - } - if ( isset($_SESSION['bugsearchto']) ) { - $this->to->setDateTime($_SESSION['bugsearchto']); - } - if ( isset($_SESSION['bugsearchclass']) ) { - $this->class = $_SESSION['bugsearchclass']; - } else { - $this->class = -1; - } - if ( isset($_SESSION['bugsearchstate']) ) { - $this->state = $_SESSION['bugsearchstate']; - } else { - $this->state = -1; - } - if ( isset($_SESSION['bugsearchmedium']) ) { - $this->medium = $_SESSION['bugsearchmedium']; - } else { - $this->medium = -1; - } - if ( ! isset($_GET['ext']) ) { - $this->ext = 0; - } else { - $this->ext = $_GET['ext']; - } - if ( $this->user->feature_ok(usebugtracking,PERM_NEW) ) { - $x = array( url => "bugtracking/bug_new.php", - text => $lang['NewEntry'], - info => $lang['CreateNewBug'], - category => array("bug","new","obj") - ); - $this->addMenu($x); - } - } + if ( isset($_SESSION['bugsearchfrom']) ) { + $this->from->setDateTime($_SESSION['bugsearchfrom']); + } + if ( isset($_SESSION['bugsearchto']) ) { + $this->to->setDateTime($_SESSION['bugsearchto']); + } + if ( isset($_SESSION['bugsearchclass']) ) { + $this->class = $_SESSION['bugsearchclass']; + } else { + $this->class = -1; + } + if ( isset($_SESSION['bugsearchstate']) ) { + $this->state = $_SESSION['bugsearchstate']; + } else { + $this->state = -1; + } + if ( isset($_SESSION['bugsearchmedium']) ) { + $this->medium = $_SESSION['bugsearchmedium']; + } else { + $this->medium = -1; + } + if ( ! isset($_GET['ext']) ) { + $this->ext = 0; + } else { + $this->ext = $_GET['ext']; + } + if ( $this->user->feature_ok(usebugtracking,PERM_NEW) ) { + $x = array( url => "bugtracking/bug_new.php", + text => $lang['NewEntry'], + info => $lang['CreateNewBug'], + category => array("bug","new","obj") + ); + $this->addMenu($x); + } + } } $l = new Bug_select($current_user); |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:51
|
Update of /cvsroot/tutos/tutos/php/rate In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/rate Modified Files: rate.pinc rate_ins.php rate_new.php rate_overview.php rate_select.php rate_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: rate_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/rate/rate_overview.php,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- rate_overview.php 13 Mar 2009 20:00:41 -0000 1.19 +++ rate_overview.php 29 Mar 2009 18:25:41 -0000 1.20 @@ -30,420 +30,411 @@ * a overview of rates */ class Rate_overview extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang; + /** + * display the form + */ + Function info() { + global $tutos,$lang; - $n = $this->result->numrows(); + $r = ''; + $n = $this->result->numrows(); - $blist = array(); - # Make a big array of all visible rates - $x = 0; - while ( $x < $n ) { - $b = new rate($this->dbconn); - $b->read_result($this->result,$x); - $x++; - if ( ! $b->see_ok() ) { - continue; - } - $blist[] = &$b; - unset($b); - } - $this->result->free(); - $n = count($blist); - if ( 0 == $n) { - echo $this->error($lang['Err0048']); - return; - } + $blist = array(); + // Make a big array of all visible rates + $x = 0; + while ( $x < $n ) { + $b = new rate($this->dbconn); + $b->read_result($this->result,$x); + $x++; + if ( ! $b->see_ok() ) { + continue; + } + $blist[] = &$b; + unset($b); + } + $this->result->free(); + $n = count($blist); + if ( 0 == $n) { + $r .= $this->error($lang['Err0048']); + return $r; + } - echo $this->actionformStart("rate_overview.php"); - echo $this->OverviewTableStart(); - echo "<thead>\n"; - echo "<tr>\n"; - if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(1)) ) { - echo $this->orderHeader(""," ",$this->link2); - $this->flds ++; - } - echo $this->orderHeader("name",$lang['RateName'],$this->link2); - echo $this->orderHeader("link_id",$lang['RateReference'],$this->link2); - echo $this->orderHeader("n.worker",$lang['RateWorkerReference'],$this->link2); - echo $this->orderHeader("role_id",$lang['RateRole'],$this->link2); - echo $this->orderHeader("cph",$lang['Rate'],$this->link2); - echo $this->orderHeader("vat",$lang['RateVat'],$this->link2); - echo $this->orderHeader("state",$lang['TTState'],$this->link2); - echo $this->orderHeader("priority",$lang['RatePriority'],$this->link2); - $this->flds +=8; - echo show_custom_overview_headers($this,'rate',$this->link2); - if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(2)) ) { - echo $this->orderHeader(""," ",$this->link2); - $this->flds ++; - } - if ( $tutos[massupdate] == 1 ) { - echo " <th nowrap><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - } - echo "</tr>\n"; - echo "</thead>\n"; + $r .= $this->actionformStart("rate_overview.php"); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(1)) ) { + $r .= $this->orderHeader(""," ",$this->link2); + $this->flds ++; + } + $r .= $this->orderHeader("name",$lang['RateName'],$this->link2); + $r .= $this->orderHeader("link_id",$lang['RateReference'],$this->link2); + $r .= $this->orderHeader("n.worker",$lang['RateWorkerReference'],$this->link2); + $r .= $this->orderHeader("role_id",$lang['RateRole'],$this->link2); + $r .= $this->orderHeader("cph",$lang['Rate'],$this->link2); + $r .= $this->orderHeader("vat",$lang['RateVat'],$this->link2); + $r .= $this->orderHeader("state",$lang['TTState'],$this->link2); + $r .= $this->orderHeader("priority",$lang['RatePriority'],$this->link2); + $this->flds +=8; + $r .= show_custom_overview_headers($this,'rate',$this->link2); + if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(2)) ) { + $r .= $this->orderHeader(""," ",$this->link2); + $this->flds ++; + } + if ( $tutos[massupdate] == 1 ) { + $r .= " <th nowrap><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + } + $r .= "</tr>\n"; + $r .= "</thead>\n"; - if ( $this->start == -1 ) { - # Show the last pasrt - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } + if ( $this->start == -1 ) { + // Show the last part + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } - $this->filter['name'] = prepare_regpattern($this->filter['name']); - echo "<tbody>\n"; - $line = 1; - while ( ($a < $n) && ($a < $end) ) { - $b = &$blist[$a]; - $b->read_reference(); + $this->filter['name'] = prepare_regpattern($this->filter['name']); + $r .= "<tbody>\n"; + $line = 1; + while ( ($a < $n) && ($a < $end) ) { + $b = &$blist[$a]; + $b->read_reference(); - echo $this->OverviewRowStart($line); + $r .= $this->OverviewRowStart($line); - $x = myentities($b->name); - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - # myparentobj-parameter not needed, but must be filled. Dont know how to leave it blank. - if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(1)) ) { - echo $this->user->layout->showGuiIcons(" <td>","</td>\n",$b,$b,$this->user->get_preficons(1),false); - } - echo " <td>". makelink($b->getUrl(),$x) ."</td>\n"; - if ( is_object($b->ref)) { - echo " <td> ". $b->ref->getLink() ."</td>\n"; - } else { - echo " <td><i> ". $lang['HistoryDeleted'] ."</i></td>\n"; - } - if ( is_object($b->worker) ) { - echo " <td> ". $b->worker->getLink($b->worker->getShortname()) ."</td>\n"; - #} else if (is_object($b->ref)) { - # echo " <td> ". $b->ref->getLink() ."</td>\n"; - } else { - echo " <td><i> ". $lang['HistoryDeleted'] ."</i></td>\n"; - } - echo " <td> ". $lang['ProdRole'][$b->role_id] ."</td>\n"; - echo " <td> ". number_format($b->cph,2,$lang['DecPoint'],$lang['ThousandPoint']) ." ". $b->currency ."</td>\n"; - echo " <td> ". number_format($b->vat,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>\n"; - echo " <td> ". $lang['TTStates'][$b->state] ."</td>\n"; - echo " <td> ". $b->priority ."</td>\n"; - echo show_custom_overview_data($this,'rate',$b); - if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(2)) ) { - echo $this->user->layout->showGuiIcons(" <td>","</td>\n",$b,$b,$this->user->get_preficons(2),false); - } - if ( $tutos[massupdate] == 1 ) { - echo " <td align=\"center\">\n"; - if ( $b->mod_ok() ) { - echo "<input name=\"mark[]\" type=\"checkbox\" value=\"". $b->id ."\">\n"; - } else { - echo "-\n"; - } - echo "</td>\n"; - } - echo $this->OverviewRowEnd($line++); - unset($b); - $a++; - } - echo "</tbody>\n"; + $x = myentities($b->name); + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(1)) ) { + $r .= $this->user->layout->showGuiIcons(" <td>","</td>\n",$b,$b,$this->user->get_preficons(1),false); + } + $r .= " <td>". makelink($b->getUrl(),$x) ."</td>\n"; + if ( is_object($b->ref)) { + $r .= " <td> ". $b->ref->getLink() ."</td>\n"; + } else { + $r .= " <td><i> ". $lang['HistoryDeleted'] ."</i></td>\n"; + } + if ( is_object($b->worker) ) { + $r .= " <td> ". $b->worker->getLink($b->worker->getShortname()) ."</td>\n"; + } else { + $r .= " <td><i> ". $lang['HistoryDeleted'] ."</i></td>\n"; + } + $r .= " <td> ". $lang['ProdRole'][$b->role_id] ."</td>\n"; + $r .= " <td> ". number_format($b->cph,2,$lang['DecPoint'],$lang['ThousandPoint']) ." ". $b->currency ."</td>\n"; + $r .= " <td> ". number_format($b->vat,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>\n"; + $r .= " <td> ". $lang['TTStates'][$b->state] ."</td>\n"; + $r .= " <td> ". $b->priority ."</td>\n"; + $r .= show_custom_overview_data($this,'rate',$b); + if ( $this->user->layout->checkGuiIcons() && count($this->user->get_preficons(2)) ) { + $r .= $this->user->layout->showGuiIcons(" <td>","</td>\n",$b,$b,$this->user->get_preficons(2),false); + } + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $b->mod_ok() ) { + $r .= "<input name=\"mark[]\" type=\"checkbox\" value=\"". $b->id ."\">\n"; + } else { + $r .= "-\n"; + } + $r .= "</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + unset($b); + $a++; + } + $r .= "</tbody>\n"; - echo $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); - if ( $tutos[massupdate] == 1 ) { - echo $this->UpdateRowStart($this->flds-1); - echo sprintf($lang['withmarked'],$lang['Rates']); - echo "<select name=\"action\">\n"; - echo " <option value=\"-1\" selected>". $lang['ActionNil'] ."</option>\n"; - echo " <option value=\"-2\">". $lang['Delete'] ."</option>\n"; - echo " <option value=\"-4\">". $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - echo " <option value=\"WatchAdd\">". $lang['WatchAdd'] ."</option>\n"; - echo " <option value=\"WatchDel\">". $lang['WatchDel'] ."</option>\n"; - } - echo "</select>\n"; - echo $this->UpdateRowEnd(2); - } - echo $this->OverviewTableEnd(); - echo $this->actionformEnd("rate_overview.php"); - } - /** - * naviagte - */ - Function navigate() { - } - /** - * action via massupdate - */ - Function action() { - global $lang,$msg; + $r .= $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart($this->flds-1); + $r .= sprintf($lang['withmarked'],$lang['Rates']); + $r .= "<select name=\"action\">\n"; + $r .= " <option value=\"-1\" selected>". $lang['ActionNil'] ."</option>\n"; + $r .= " <option value=\"-2\">". $lang['Delete'] ."</option>\n"; + $r .= " <option value=\"-4\">". $lang['AclModify'] ."</option>\n"; + if (class_exists('watchlist')) { + $r .= watchlist::action_options(); + } + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(2); + } + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("rate_overview.php"); + return $r; + } + /** + * action via massupdate + */ + Function action() { + global $lang,$msg; - if ( $_GET['action'] == -2 ) { - $this->dbconn->Begin("WORK"); - foreach ($_GET['mark'] as $key => $val) { - $b = new rate($this->dbconn); - $b = $b->read($val,$b); - if ( $b->id != $val ) { - continue; - } - if ( $b->del_ok() ) { - $msg .= $lang['Delete'].":". $b->getFullName() ."<br />"; - $msg .= $b->delete(); - } else { - $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; - } - unset($b); - } - $this->dbconn->Commit("WORK"); - return; - } - if ( $_GET['action'] == -4 ) { - $this->redirect = "../". acl_action(); - return; - } - if (class_exists('watchlist')) { - watchlist::parse_action($this->user); - } - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + if ( $_GET['action'] == -2 ) { + $this->dbconn->Begin("WORK"); + foreach ($_GET['mark'] as $val) { + $b = new rate($this->dbconn); + $b = $b->read($val,$b); + if ( $b->id != $val ) { + continue; + } + if ( $b->del_ok() ) { + $msg .= $lang['Delete'].":". $b->getFullName() ."<br />"; + $msg .= $b->delete(); + } else { + $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; + } + unset($b); + } + $this->dbconn->Commit("WORK"); + return; + } + if ( $_GET['action'] == -4 ) { + $this->redirect = "../". acl_action(); + return; + } + if (class_exists('watchlist')) { + watchlist::parse_action($this->user); + } + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->name = $lang['RatesOverview']; - $this->css_class = 'overviewbox'; + $this->name = $lang['RatesOverview']; + $this->css_class = 'overviewbox'; - if ( ! $this->user->feature_ok(userates,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + if ( ! $this->user->feature_ok(userates,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - $this->link1 = "rate/rate_overview.php"; - $this->filter = array(); + $this->link1 = "rate/rate_overview.php"; + $this->filter = array(); - $reftype = ""; - $name = ""; - $rsrn = ""; - $rscr = ""; + $reftype = ""; + $name = ""; + $rsrn = ""; + $rscr = ""; - if ( isset($_GET['reftype']) ) { - $reftype = $_GET['reftype']; - } - if ( isset($_GET['name']) ) { - $name = $_GET['name']; - } - if ( isset($_GET['rsrn']) ) { - $nsrn = $_GET['rsrn']; - } - if ( isset($_GET['rscr']) ) { - $nscr = $_GET['rscr']; - } - if ( isset($_GET['workerid']) ) { - $solverid = $_GET['workerid']; - } + if ( isset($_GET['reftype']) ) { + $reftype = $_GET['reftype']; + } + if ( isset($_GET['name']) ) { + $name = $_GET['name']; + } + if ( isset($_GET['rsrn']) ) { + $nsrn = $_GET['rsrn']; + } + if ( isset($_GET['rscr']) ) { + $nscr = $_GET['rscr']; + } + if ( isset($_GET['workerid']) ) { + $solverid = $_GET['workerid']; + } - $j = "SELECT DISTINCT n.* FROM ". $this->dbconn->prefix ."rates n "; // select + join - $q = ""; - $pre = " WHERE "; + $j = "SELECT DISTINCT n.* FROM ". $this->dbconn->prefix ."rates n "; // select + join + $q = ""; + $pre = " WHERE "; - if ( ($name != "*") && ($name != "") ) { - $q .= " " . $pre ."(". $this->dbconn->Like("n.name",$name) .")"; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"name=".UrlEncode($name)); - $this->filter['name'] = $name; - } else { - $this->filter['name'] = ""; - } + if ( ($name != "*") && ($name != "") ) { + $q .= " " . $pre ."(". $this->dbconn->Like("n.name",$name) .")"; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"name=".UrlEncode($name)); + $this->filter['name'] = $name; + } else { + $this->filter['name'] = ""; + } - if ( isset($_GET['id']) ) { - if (false == is_numeric($_GET['id'])) { - $msg .= sprintf($lang['Err0012'],"id",$_GET['id']); - $this->stop = true; - } - $q .= " ". $pre ." n.id = ".$_GET['id']; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"id=". $_GET['id']); - } + if ( isset($_GET['id']) ) { + if (false == is_numeric($_GET['id'])) { + $msg .= sprintf($lang['Err0012'],"id",$_GET['id']); + $this->stop = true; + } + $q .= " ". $pre ." n.id = ".$_GET['id']; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"id=". $_GET['id']); + } - if ( isset($_GET['link_id']) ) { - if (false == is_numeric($_GET['link_id'])) { - $msg .= sprintf($lang['Err0012'],"link_id",$_GET['link_id']); - $this->stop = true; - } - $q .= " ". $pre ." n.link_id = ".$_GET['link_id']; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); - } + if ( isset($_GET['link_id']) ) { + if (false == is_numeric($_GET['link_id'])) { + $msg .= sprintf($lang['Err0012'],"link_id",$_GET['link_id']); + $this->stop = true; + } + $q .= " ". $pre ." n.link_id = ".$_GET['link_id']; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); + } - # References to display - if ( ($reftype > 0) || ($reftype > 0 && ($rsrn != "*") && ($rsrn != "")) ) { - if ( ! isset($rsrn) || ($rsrn == "*") ) { - $rsrn = ""; - } - if ( ($reftype == 1) || ($reftype == -1) ) { - $j .= ", ". $this->dbconn->prefix ."companies c "; - $q .= " ". $pre . "(n.link_id=c.id "; - if ( $rsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("c.name",$rsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 2) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."departments d "; - $q .= " ". $pre . "(n.link_id=d.id "; - if ( $rsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("d.name",$rsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 3) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."addresses a "; - $q .= $pre ."( ("; - $q .= $this->dbconn->Like("a.f_name",$rsrn) ." OR "; - $q .= $this->dbconn->Like("a.m_name",$rsrn) ." OR "; - $q .= $this->dbconn->Like("a.l_name",$rsrn) .")"; - $q .= " AND n.link_id=a.id )"; - $pre = " OR "; - } - if ( ($reftype == 4) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."bugs b"; - $q .= " ". $pre . "(n.link_id=b.id "; - if ( $rsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("b.short",$rsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 5) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."products p"; - $q .= $pre ."( n.link_id=p.id "; - if ( $rsrn != "" ) { - $q .= " AND ("; - $q .= $this->dbconn->Like("p.name",$rsrn) ." OR "; - $q .= $this->dbconn->Like("p.version",$rsrn) .")"; - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 6) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."teams t"; - $q .= $pre . "(n.link_id=t.id AND ". $this->dbconn->Like("t.name",$rsrn) .")"; - $pre = " OR "; - } - if ( ($reftype == 7) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."tasks k"; - $q .= $pre . "(n.link_id=k.id AND ". $this->dbconn->Like("k.name",$rsrn) .")"; - $pre = " OR "; - } - if ( ($reftype == 8) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."installations i"; - if ( ! stristr($j, "products") ) { - $j .= ",". $this->dbconn->prefix ."products p"; - } - $q .= $pre ."( n.link_id=i.id AND i.product_id=p.id AND ("; - $q .= $this->dbconn->Like("p.name",$rsrn) ." OR "; - $q .= $this->dbconn->Like("p.version",$rsrn) .") )"; - $pre = " OR "; - } - $pre = "AND "; + // References to display + if ( ($reftype > 0) || ($reftype > 0 && ($rsrn != "*") && ($rsrn != "")) ) { + if ( ! isset($rsrn) || ($rsrn == "*") ) { + $rsrn = ""; + } + if ( ($reftype == 1) || ($reftype == -1) ) { + $j .= ", ". $this->dbconn->prefix ."companies c "; + $q .= " ". $pre . "(n.link_id=c.id "; + if ( $rsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("c.name",$rsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 2) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."departments d "; + $q .= " ". $pre . "(n.link_id=d.id "; + if ( $rsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("d.name",$rsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 3) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."addresses a "; + $q .= $pre ."( ("; + $q .= $this->dbconn->Like("a.f_name",$rsrn) ." OR "; + $q .= $this->dbconn->Like("a.m_name",$rsrn) ." OR "; + $q .= $this->dbconn->Like("a.l_name",$rsrn) .")"; + $q .= " AND n.link_id=a.id )"; + $pre = " OR "; + } + if ( ($reftype == 4) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."bugs b"; + $q .= " ". $pre . "(n.link_id=b.id "; + if ( $rsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("b.short",$rsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 5) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."products p"; + $q .= $pre ."( n.link_id=p.id "; + if ( $rsrn != "" ) { + $q .= " AND ("; + $q .= $this->dbconn->Like("p.name",$rsrn) ." OR "; + $q .= $this->dbconn->Like("p.version",$rsrn) .")"; + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 6) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."teams t"; + $q .= $pre . "(n.link_id=t.id AND ". $this->dbconn->Like("t.name",$rsrn) .")"; + $pre = " OR "; + } + if ( ($reftype == 7) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."tasks k"; + $q .= $pre . "(n.link_id=k.id AND ". $this->dbconn->Like("k.name",$rsrn) .")"; + $pre = " OR "; + } + if ( ($reftype == 8) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."installations i"; + if ( ! stristr($j, "products") ) { + $j .= ",". $this->dbconn->prefix ."products p"; + } + $q .= $pre ."( n.link_id=i.id AND i.product_id=p.id AND ("; + $q .= $this->dbconn->Like("p.name",$rsrn) ." OR "; + $q .= $this->dbconn->Like("p.version",$rsrn) .") )"; + $pre = " OR "; + } + $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"reftype=". $reftype); - $this->link1 = addUrlParameter($this->link1,"rsrn=". $rsrn); - # remember this - $_SESSION['ratesearchreftype'] = $reftype; - $this->filter['reftype'] = $reftype; - } - if ( ($rscr != "*") && ($rscr != "") ) { - $j .= ", addresses "; - $q .= $pre ."( ("; - $q .= $this->dbconn->Like("addresses.f_name",$rscr) ." OR "; - $q .= $this->dbconn->Like("addresses.m_name",$rscr) ." OR "; - $q .= $this->dbconn->Like("addresses.l_name",$rscr) .")"; - $q .= " AND n.creator=addresses.id )"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"rscr=".UrlEncode($rscr)); - $this->filter['rscr'] = $rscr; - } + $this->link1 = addUrlParameter($this->link1,"reftype=". $reftype); + $this->link1 = addUrlParameter($this->link1,"rsrn=". $rsrn); + // remember this + $_SESSION['ratesearchreftype'] = $reftype; + $this->filter['reftype'] = $reftype; + } + if ( ($rscr != "*") && ($rscr != "") ) { + $j .= ", addresses "; + $q .= $pre ."( ("; + $q .= $this->dbconn->Like("addresses.f_name",$rscr) ." OR "; + $q .= $this->dbconn->Like("addresses.m_name",$rscr) ." OR "; + $q .= $this->dbconn->Like("addresses.l_name",$rscr) .")"; + $q .= " AND n.creator=addresses.id )"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"rscr=".UrlEncode($rscr)); + $this->filter['rscr'] = $rscr; + } - # user to display - if ( isset($workerid) ) { - $q1 .= $pre1 ." worker = ". $workerid; - $q2 .= $pre2 ." b.worker = ". $workerid; - $pre1 = " AND "; - $pre2 = " AND "; - $this->link1 = addUrlParameter($this->link1,"workerid=". $workerid); - $this->filter['worker'] = $workerid; - $this->addHidden("workerid",$workerid); - } + // user to display + if ( isset($workerid) ) { + $q1 .= $pre1 ." worker = ". $workerid; + $q2 .= $pre2 ." b.worker = ". $workerid; + $pre1 = " AND "; + $pre2 = " AND "; + $this->link1 = addUrlParameter($this->link1,"workerid=". $workerid); + $this->filter['worker'] = $workerid; + $this->addHidden("workerid",$workerid); + } - # Start Date for search - $from = new TUTOS_Date_Time(0); - if ( isset($_GET['fd']) ) { - $from->setDateTime($_GET['fd']); - } else { - $from->setDateTimeF("f"); - # remember this -# session_register('ratesearchfrom'); - $_SESSION['ratesearchfrom'] = $from->getYYYYMMDD(); - } - if ( $from->notime != 1 ) { - $q .= $pre ."(n.creation >= ". $this->dbconn->Date($from) .")"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); - $this->filter['from'] = $from; - } - # End Date for search - $to = new TUTOS_Date_Time(0); - if ( isset($_GET['td']) ) { - $to->setDateTime($_GET['td']); - } else { - $to->setDateTimeF("t"); - # remember this -# session_register('ratesearchto'); - $_SESSION['ratesearchto'] = $to->getYYYYMMDD(); - } - if ( $to->notime != 1 ) { - $q .= $pre ."(n.creation <= ". $this->dbconn->Date($to) .")"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); - $this->filter['to'] = $to; - } + // Start Date for search + $from = new TUTOS_Date_Time(0); + if ( isset($_GET['fd']) ) { + $from->setDateTime($_GET['fd']); + } else { + $from->setDateTimeF("f"); + // remember this + $_SESSION['ratesearchfrom'] = $from->getYYYYMMDD(); + } + if ( $from->notime != 1 ) { + $q .= $pre ."(n.creation >= ". $this->dbconn->Date($from) .")"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); + $this->filter['from'] = $from; + } + // End Date for search + $to = new TUTOS_Date_Time(0); + if ( isset($_GET['td']) ) { + $to->setDateTime($_GET['td']); + } else { + $to->setDateTimeF("t"); + // remember this + $_SESSION['ratesearchto'] = $to->getYYYYMMDD(); + } + if ( $to->notime != 1 ) { + $q .= $pre ."(n.creation <= ". $this->dbconn->Date($to) .")"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); + $this->filter['to'] = $to; + } - $this->q = $j.$q; - check_dbacl($this->dbconn, $this->q, $this->user->id); + $this->q = $j.$q; + check_dbacl($this->dbconn, $this->q, $this->user->id); - # sorting - $xxx = ""; - $this->link2 = $this->link1; - order_parse($this->q,$this->link1,$xxx,$xxx,"n.creation DESC"); + // sorting + $xxx = ""; + $this->link2 = $this->link1; + order_parse($this->q,$this->link1,$xxx,$xxx,"n.creation DESC"); - if ($this->stop) { - return; - } - $this->result = $this->dbconn->Exec($this->q); - if ( 0 == $this->result->numrows()) { - $this->redirect = "rate_select.php?msg=". UrlEncode($lang['Err0048']); - $this->result->free(); - } + if ($this->stop) { + return; + } + $this->result = $this->dbconn->Exec($this->q); + if ( 0 == $this->result->numrows()) { + $this->redirect = "rate_select.php?msg=". UrlEncode($lang['Err0048']); + $this->result->free(); + } - # menu - $x = rate::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addMenu($x); - } + // menu + $x = rate::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addMenu($x); + } } -$l = new rate_overview($current_user); +$l = new Rate_overview($current_user); $l->display(); $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: rate_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/rate/rate_new.php,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- rate_new.php 13 Mar 2009 20:00:41 -0000 1.15 +++ rate_new.php 29 Mar 2009 18:25:41 -0000 1.16 @@ -1,6 +1,6 @@ <?php /** - * Copyright 2000 - 2008 by Gero Kohnert and ecosoft + * Copyright 2000 - 2009 by Gero Kohnert and ecosoft * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -25,189 +25,182 @@ * change/modify a rate */ class Rate_new extends layout { - /** - * display the form - */ - Function info() { - global $lang,$tutos,$table; + /** + * display the form + */ + Function info() { + global $lang,$tutos,$table; - $this->width = 6; + $r = ''; + $this->width = 6; - echo "<form id=\"ratenew\" name=\"ratenew\" action=\"rate_ins.php\" method=\"post\">\n"; - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); + $r .= "<form id=\"ratenew\" name=\"ratenew\" action=\"rate_ins.php\" method=\"post\">\n"; + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); - if ( isset ($this->obj->id) && ( $this->obj->id != -1 ) ) { - $this->addhidden("id",$this->obj->id); - } + if ( isset ($this->obj->id) && ( $this->obj->id != -1 ) ) { + $this->addhidden("id",$this->obj->id); + } - echo "<tr>\n"; - echo $this->showfieldc($lang['RateName'],1,"name"); - echo " <td colspan=\"5\"><input id=\"name\" size=\"". min($table['rate']['name'][size],40) ."\" maxlength=\"". $table['rate']['name'][size] ."\" name=\"name\" value=\"". myentities($this->obj->name) ."\"></td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['RateName'],1,"name"); + $r .= " <td colspan=\"5\"><input id=\"name\" size=\"". min($table['rate']['name'][size],40) ."\" maxlength=\"". $table['rate']['name'][size] ."\" name=\"name\" value=\"". myentities($this->obj->name) ."\"></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['RateReference'],1); - echo " <td colspan=\"5\">\n"; - if ($this->obj->id == -1) { - echo $lang[$this->obj->ref->getType()] ." ". $this->obj->getRefLink() ."\n"; - $this->addhidden("link_id",$this->obj->link_id); - } else { - echo " <select name=\"link_id\">\n"; - foreach ($this->obj->plist as $i => $f) { - echo " <option value=\"". $i ."\"". ($i == $this->obj->link_id ? " selected>* ":">") . $lang[$f->getType()] .": ". myentities($f->getFullName()) ."</option>\n"; - } - echo " </select>\n"; - } - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['RateReference'],1); + $r .= " <td colspan=\"5\">\n"; + if ($this->obj->id == -1) { + $r .= $lang[$this->obj->ref->getType()] ." ". $this->obj->getRefLink() ."\n"; + $this->addhidden("link_id",$this->obj->link_id); + } else { + $r .= " <select name=\"link_id\">\n"; + foreach ($this->obj->plist as $i => $f) { + $r .= " <option value=\"". $i ."\"". ($i == $this->obj->link_id ? " selected>* ":">") . $lang[$f->getType()] .": ". myentities($f->getFullName()) ."</option>\n"; + } + $r .= " </select>\n"; + } + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['RateWorkerReference'],"worker"); - echo " <td valign=\"top\">\n"; - echo "". $this->user->askPeople("worker",$this->obj->worker,0) ."\n"; - echo " </td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['RateWorkerReference'],"worker"); + $r .= " <td valign=\"top\">\n"; + $r .= "". $this->user->askPeople("worker",$this->obj->worker,0) ."\n"; + $r .= " </td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['RateRole'],1,"role_id"); - echo " <td><select name=\"role_id\">\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['RateRole'],1,"role_id"); + $r .= " <td><select name=\"role_id\">\n"; - foreach ($lang['ProdRole'] as $role => $x) { - if ( $tutos[rolecheck][$role] == "p") { - continue; - } - echo " <option value=\"". $role ."\"". ($this->obj->role_id == $role ? " selected" : "") .">". $lang['ProdRole'][$role] ."</option>\n"; - } - echo "</select></td>\n"; - echo "</tr>\n"; + foreach ($lang['ProdRole'] as $role => $x) { + if ( $tutos[rolecheck][$role] == "p") { + continue; + } + $r .= " <option value=\"". $role ."\"". ($this->obj->role_id == $role ? " selected" : "") .">". $lang['ProdRole'][$role] ."</option>\n"; + } + $r .= "</select></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['Rate'],1,"cph"); - echo " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"cph\" value=\"". number_format($this->obj->cph,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\">\n"; - echo Currency_Select("currency",$this->obj->currency); - echo $this->showfieldc($lang['TTState'],1,"state"); - echo " <td><select name=\"state\">\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['Rate'],1,"cph"); + $r .= " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"cph\" value=\"". number_format($this->obj->cph,2,$lang['DecPoint'],$lang['ThousandPoint']) ."\">\n"; + $r .= Currency_Select("currency",$this->obj->currency); + $r .= $this->showfieldc($lang['TTState'],1,"state"); + $r .= " <td><select name=\"state\">\n"; - foreach ($lang['TTStates'] as $s => $x) { - echo " <option value=\"". $s ."\"". ($this->obj->state == $s ? " selected" : "") .">". $lang['TTStates'][$s] ."</option>\n"; - } - echo "</select></td>\n"; - echo "</tr>\n"; + foreach ($lang['TTStates'] as $s => $x) { + $r .= " <option value=\"". $s ."\"". ($this->obj->state == $s ? " selected" : "") .">". $lang['TTStates'][$s] ."</option>\n"; + } + $r .= "</select></td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfield($lang['RateVat']); - echo "<td>\n"; - echo TAX_select("vat",$this->obj->vat); - echo "</td>\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['RateVat']); + $r .= "<td>\n"; + $r .= TAX_select("vat",$this->obj->vat); + $r .= "</td>\n"; + $r .= "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['RatePriority']); - echo " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"priority\" value=\"". $this->obj->priority ."\">\n"; - echo "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['RatePriority']); + $r .= " <td colspan=\"1\"><input size=\"10\" maxlength=\"10\" name=\"priority\" value=\"". $this->obj->priority ."\">\n"; + $r .= "</tr>\n"; - # - # Edit additional custom fields - # - echo edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); - # References to modules - echo module_addforms($this->user,$this->obj,6); + // Edit additional custom fields + $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); + // References to modules + $r .= module_addforms($this->user,$this->obj,6); - echo "<tr>\n"; - if ( isset($this->obj->id) && ($this->obj->id != -1) ) { - echo submit_reset(0,1,2,1,2,0); - } else { - echo submit_reset(0,-1,2,1,2,0); - } - echo "</tr>\n"; + $r .= "<tr>\n"; + if ( isset($this->obj->id) && ($this->obj->id != -1) ) { + $r .= submit_reset(0,1,2,1,2,0); + } else { + $r .= submit_reset(0,-1,2,1,2,0); + } + $r .= "</tr>\n"; - echo $this->DataTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo "</form>\n"; - echo $this->setfocus("ratenew.name"); - echo $lang['FldsRequired'] ."\n"; - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; + $r .= $this->setfocus("ratenew.name"); + $r .= $lang['FldsRequired'] ."\n"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - $this->obj = new rate($this->dbconn); - if ( isset($_GET['id']) ){ - $this->obj = $this->obj->read($_GET['id'],$this->obj); - $this->name = $lang['RateMod']; - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['Rate']); - $this->stop = true ; - return; - } - } else { - $this->name = $lang['RateCreation']; - if ( !$this->user->feature_ok(userates,PERM_NEW) ) { - $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); - $this->stop = true; - return; - } - } - if ( isset($_GET['link_id']) ){ - $this->obj->link_id = $_GET['link_id']; - } - if ( isset($_GET['rate']) ){ - $this->obj->rate = StripSlashes($_GET['rate']); - } - if ( isset($_GET['name']) ){ - $this->obj->name = StripSlashes($_GET['name']); - } - if ( isset($_GET['vat']) ) { - $this->obj->vat = $_GET['vat']; - } - if ( isset($_GET['state']) ) { - $this->obj->state = $_GET['state']; - } - if ( isset($_GET['worker']) ) { - $this->obj->worker = $_GET['worker']; - } - if ( isset($_GET['role_id']) ) { - $this->obj->role_id = $_GET['role_id']; - } - if ( ! $this->obj->mod_ok() ) { - $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); - $this->stop = true; - } + $this->obj = new rate($this->dbconn); + if ( isset($_GET['id']) ){ + $this->obj = $this->obj->read($_GET['id'],$this->obj); + $this->name = $lang['RateMod']; + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['Rate']); + $this->stop = true ; + return; + } + } else { + $this->name = $lang['RateCreation']; + if ( !$this->user->feature_ok(userates,PERM_NEW) ) { + $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); + $this->stop = true; + return; + } + } + if ( isset($_GET['link_id']) ){ + $this->obj->link_id = $_GET['link_id']; + } + if ( isset($_GET['rate']) ){ + $this->obj->rate = StripSlashes($_GET['rate']); + } + if ( isset($_GET['name']) ){ + $this->obj->name = StripSlashes($_GET['name']); + } + if ( isset($_GET['vat']) ) { + $this->obj->vat = $_GET['vat']; + } + if ( isset($_GET['state']) ) { + $this->obj->state = $_GET['state']; + } + if ( isset($_GET['worker']) ) { + $this->obj->worker = $_GET['worker']; + } + if ( isset($_GET['role_id']) ) { + $this->obj->role_id = $_GET['role_id']; + } + if ( ! $this->obj->mod_ok() ) { + $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); + $this->stop = true; + } - $this->obj->read_reference(); - $this->obj->read_relations(); + $this->obj->read_reference(); + $this->obj->read_relations(); - # - # preset additional custom fields - # - preset_custom_fields($this->obj->gettype(),$this->obj); - # menu - $x = rate::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addmenu($x); + // preset additional custom fields + preset_custom_fields($this->obj->gettype(),$this->obj); + // menu + $x = rate::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addmenu($x); - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelURL(), - text => $lang['Delete'], - info => $lang['RateDelete'], - confirm => true, - category => array("rate","del","obj") - ); - $this->addMenu($x); - } + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelURL(), + text => $lang['Delete'], + info => $lang['RateDelete'], + confirm => true, + category => array("rate","del","obj") + ); + $this->addMenu($x); + } - add_module_newlinks($this,$this->obj); - } + add_module_newlinks($this,$this->obj); + } } $l = new rate_new($current_user); @@ -215,6 +208,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: rate_select.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/rate/rate_select.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- rate_select.php 14 Jun 2008 12:30:08 -0000 1.8 +++ rate_select.php 29 Mar 2009 18:25:41 -0000 1.9 @@ -1,163 +1,158 @@ <?php /** - * Copyright 2002 - 2007 by Gero Kohnert + * Copyright 2002 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; version 2 of the License. * */ - $tutos['base'] = "../.."; - ini_set("include_path",".."); - include_once 'webelements.p3'; - include_once 'permission.p3'; - - /* Check if user is allowed to use it */ - check_user(); - loadmodules('rate','select'); - loadmodule('rate'); - loadlayout(); - - /** - * select rates - */ - class rate_select extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang; +$tutos['base'] = "../.."; +ini_set("include_path",".."); +include_once 'webelements.p3'; +include_once 'permission.p3'; - echo "<form id=\"ratesearch\" name=\"ratesearch\" method=\"get\" action=\"rate_overview.php\">\n"; - if ( $this->ext == false ) { - $this->addHidden("reftype",0); - } - echo DoubleTableStart(); +// Check if user is allowed to use it +check_user(); +loadmodules('rate','select'); +loadmodule('rate'); +loadlayout(); - echo "<tr>\n"; - if ( $this->ext == false ) { - echo "<th colspan=\"3\">". $lang['SearchForRate'] ."</th>\n"; +/** + * select rates + */ +class Rate_select extends layout { + /** + * display the form + */ + Function info() { + global $tutos,$lang; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['RateName']); - echo " <td align=\"center\"> <input type=\"text\" value=\"\" name=\"name\"></td>\n"; - echo " <td align=\"center\">\n"; - echo " <input type=\"submit\" value=\"". $lang['Search'] ."\"></td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\" align=\"center\"><font size=\"-1\">". $lang['RateSelInfo'] ."</font></td>\n"; - echo " <td align=\"center\">". makelink("rate/rate_select.php?ext=1",$lang['extended']) ."</td>\n"; - } else { - echo "<th colspan=\"3\">". $lang['SearchForRateExt'] ."</th>\n"; + $r = ''; + $r .= "<form id=\"ratesearch\" name=\"ratesearch\" method=\"get\" action=\"rate_overview.php\">\n"; + if ( $this->ext == false ) { + $this->addHidden("reftype",0); + } + $r .= DoubleTableStart(); - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['RateName']); - echo " <td> <input type=\"text\" value=\"\" name=\"name\">"; - echo " </td>\n"; - echo " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\"></td>\n"; + $r .= "<tr>\n"; + if ( $this->ext == false ) { + $r .= '<th colspan="3">'. $lang['SearchForRate'] ."</th>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['RateReference']); - echo " <td colspan=\"2\"> <b>". $this->RateAskRefType($this->rsrt,0) ."</b> </td>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['RateName']); + $r .= " <td align=\"center\"> <input type=\"text\" value=\"\" name=\"name\"></td>\n"; + $r .= " <td align=\"center\">\n"; + $r .= ' <input type="submit" value="'. $lang['Search'] ."\"></td>\n"; + $r .= "</tr><tr>\n"; + $r .= ' <td colspan="2" align="center"><font size="-1">'. $lang['RateSelInfo'] ."</font></td>\n"; + $r .= ' <td align="center">'. makelink("rate/rate_select.php?ext=1",$lang['extended']) ."</td>\n"; + } else { + $r .= '<th colspan="3">'. $lang['SearchForRateExt'] ."</th>\n"; - #echo "</tr><tr>\n"; - #echo $this->showfieldc($lang['RateWorkerReference']); - #echo " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nsrn\"> </td>\n"; + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['RateName']); + $r .= " <td> <input type=\"text\" value=\"\" name=\"name\">"; + $r .= " </td>\n"; + $r .= ' <td align="center"><input type="submit" value="'. $lang['Search'] ."\"></td>\n"; - #echo "</tr><tr>\n"; - #echo $this->showfieldc($lang['RateCreator']); - #echo " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nscr\"> </td>\n"; - echo "</tr><tr>\n"; - } + $r .= "</tr><tr>\n"; + $r .= $this->showfieldc($lang['RateReference']); + $r .= ' <td colspan="2"> <b>'. $this->RateAskRefType($this->rsrt,0) ."</b> </td>\n"; - echo "</tr>\n"; +#$r .= "</tr><tr>\n"; +#$r .= $this->showfieldc($lang['RateWorkerReference']); +#$r .= " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nsrn\"> </td>\n"; - echo DoubleTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo "</form>\n"; +#$r .= "</tr><tr>\n"; +#$r .= $this->showfieldc($lang['RateCreator']); +#$r .= " <td colspan=\"2\"> <input type=\"text\" value=\"\" name=\"nscr\"> </td>\n"; + $r .= "</tr><tr>\n"; + } - echo $this->setfocus("ratesearch.name"); - } - /** - */ - function RateAskRefType ($default,$any) { - global $lang; + $r .= "</tr>\n"; - $r = "<select name=\"reftype\">"; - foreach ($lang['RateReferences'] as $i => $f ) { - $r .= "<option value=\"". $i ."\" "; - if ( $i == $default ) { - $r .= " selected "; - } - $r .= ">". $f ."</option>\n"; - } - if ( $any > 0 ) { - $r .= "<option value=\"-1\""; - if ( -1 == $default ) { - $r .= " selected "; - } - $r .= ">". $lang['any'] ."</option>"; - } - $r .= "\n</select>"; - return $r; - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; + $r .= DoubleTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; - $this->name = $lang['RateSearch']; - $this->center = true; - $this->css_class = 'selectbox'; + $r .= $this->setfocus("ratesearch.name"); + return $r; + } + /** + */ + function RateAskRefType ($default,$any) { + global $lang; - if ( ! $this->user->feature_ok(userates,PERM_SEL) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + $r = "<select name=\"reftype\">"; + foreach ($lang['RateReferences'] as $i => $f ) { + $r .= "<option value=\"". $i ."\" "; + if ( $i == $default ) { + $r .= " selected "; + } + $r .= ">". $f ."</option>\n"; + } + if ( $any > 0 ) { + $r .= "<option value=\"-1\""; + if ( -1 == $default ) { + $r .= " selected "; + } + $r .= ">". $lang['any'] ."</option>"; + } + $r .= "\n</select>"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; - # Defaults for search - $this->rsfd = new TUTOS_Date_Time(0); - $this->rstd = new TUTOS_Date_Time(0); - $this->rsrt = -1; + $this->name = $lang['RateSearch']; + $this->center = true; + $this->css_class = 'selectbox'; - if ( isset($_SESSION['ratesearchfrom']) ) { - $this->rsfd->setDateTime($_SESSION['ratesearchfrom']); - } - if ( isset($_SESSION['ratesearchto']) ) { - $this->rstd->setDateTime($_SESSION['ratesearchto']); - } - if ( isset($_SESSION['ratesearchreftype']) ) { - $this->rsrt = $_SESSION['ratesearchreftype']; - } - if ( ! isset($_GET['ext']) ) { - $this->ext = 0; - } else { - $this->ext = $_GET['ext']; - } + if ( ! $this->user->feature_ok(userates,PERM_SEL) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - $lang['RateReferences'][1] = &$lang['Company']; - $lang['RateReferences'][2] = &$lang['Department']; - $lang['RateReferences'][3] = &$lang['Address']; - $lang['RateReferences'][4] = &$lang['Bug']; - $lang['RateReferences'][5] = &$lang['ProductP']; - $lang['RateReferences'][6] = &$lang['Team']; - $lang['RateReferences'][7] = &$lang['Task']; - } - } + // Defaults for search + $this->rsfd = new TUTOS_Date_Time(0); + $this->rstd = new TUTOS_Date_Time(0); + $this->rsrt = -1; + if ( isset($_SESSION['ratesearchfrom']) ) { + $this->rsfd->setDateTime($_SESSION['ratesearchfrom']); + } + if ( isset($_SESSION['ratesearchto']) ) { + $this->rstd->setDateTime($_SESSION['ratesearchto']); + } + if ( isset($_SESSION['ratesearchreftype']) ) { + $this->rsrt = $_SESSION['ratesearchreftype']; + } + if ( ! isset($_GET['ext']) ) { + $this->ext = 0; + } else { + $this->ext = $_GET['ext']; + } + $lang['RateReferences'][1] = &$lang['Company']; + $lang['RateReferences'][2] = &$lang['Department']; + $lang['RateReferences'][3] = &$lang['Address']; + $lang['RateReferences'][4] = &$lang['Bug']; + $lang['RateReferences'][5] = &$lang['ProductP']; + $lang['RateReferences'][6] = &$lang['Team']; + $lang['RateReferences'][7] = &$lang['Task']; + } +} - $l = new rate_select($current_user); - $l->display(); - $dbconn->Close(); +$l = new Rate_select($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: rate_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/rate/rate_ins.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- rate_ins.php 13 Mar 2009 20:00:41 -0000 1.8 +++ rate_ins.php 29 Mar 2009 18:25:41 -0000 1.9 @@ -29,88 +29,82 @@ $msg = ''; $u = new rate($dbconn); - if ( isset($_POST['id']) ) { - $u = $u->read($_POST['id'],$u); - $gotourl= addUrlParameter($gotourl,"id=". $u->id,true); - } else { - $u->creator = $current_user; - } - # name - if ( empty($_POST['name']) ) { - $msg .= sprintf($lang['Err0009'],$lang['RateName']) ."<br />"; - } else { - $u->setName(StripSlashes($_POST['name'])); - $gotourl= addUrlParameter($gotourl,"name=". UrlEncode($u->name),true); - } - # cph - if ( empty($_POST['cph']) ) { - $msg .= sprintf($lang['Err0009'],$lang['Rate']) ."<br />"; - } else { - $u->setCph($_POST['cph']); - $gotourl= addUrlParameter($gotourl,"cph=". UrlEncode($u->cph),true); - } - # currency - if ( empty($_POST['currency']) ) { - $msg .= sprintf($lang['Err0009'],$lang['Rate']) ."<br />"; - } else { - $u->setCurrency($_POST['currency']); - $gotourl= addUrlParameter($gotourl,"currency=". UrlEncode($u->currency),true); - } - # priority - if ( isset($_POST['priority']) ) { - $u->setPriority($_POST['priority']); - $gotourl= addUrlParameter($gotourl,"priority=". UrlEncode($u->priority),true); - } - # vat - if ( isset($_POST['vat']) ) { - $u->setVat($_POST['vat']); - $gotourl= addUrlParameter($gotourl,"vat=". UrlEncode($u->vat),true); - } - # state - if ( isset($_POST['state']) ) { - $u->setState($_POST['state']); - $gotourl= addUrlParameter($gotourl,"state=". UrlEncode($u->state),true); - } - # role - if ( isset($_POST['role_id']) ) { - $u->setRole($_POST['role_id']); - $gotourl= addUrlParameter($gotourl,"role_id=". UrlEncode($u->role_id),true); - } - # worker - if ( isset($_POST['worker']) ) { - $u->setWorker($_POST['worker']); - $gotourl= addUrlParameter($gotourl,"worker=". UrlEncode($u->worker),true); - } - # reference - if ( empty($_POST['link_id']) ) { - $msg .= "No Link ID given !<br />"; - } else { - $u->setReference($_POST['link_id']); - $gotourl= addUrlParameter($gotourl,"link_id=". $u->link_id,true); - $u->read_reference(); - } +if ( isset($_POST['id']) ) { + $u = $u->read($_POST['id'],$u); + $gotourl= addUrlParameter($gotourl,"id=". $u->id,true); +} else { + $u->creator = $current_user; +} +# name +if ( empty($_POST['name']) ) { + $msg .= sprintf($lang['Err0009'],$lang['RateName']) ."<br />"; +} else { + $u->setName(StripSlashes($_POST['name'])); + $gotourl= addUrlParameter($gotourl,"name=". UrlEncode($u->name),true); +} +# cph +if ( empty($_POST['cph']) ) { + $msg .= sprintf($lang['Err0009'],$lang['Rate']) ."<br />"; +} else { + $u->setCph($_POST['cph']); + $gotourl= addUrlParameter($gotourl,"cph=". UrlEncode($u->cph),true); +} +# currency +if ( empty($_POST['currency']) ) { + $msg .= sprintf($lang['Err0009'],$lang['Rate']) ."<br />"; +} else { + $u->setCurrency($_POST['currency']); + $gotourl= addUrlParameter($gotourl,"currency=". UrlEncode($u->currency),true); +} +# priority +if ( isset($_POST['priority']) ) { + $u->setPriority($_POST['priority']); + $gotourl= addUrlParameter($gotourl,"priority=". UrlEncode($u->priority),true); +} +# vat +if ( isset($_POST['vat']) ) { + $u->setVat($_POST['vat']); + $gotourl= addUrlParameter($gotourl,"vat=". UrlEncode($u->vat),true); +} +# state +if ( isset($_POST['state']) ) { + $u->setState($_POST['state']); + $gotourl= addUrlParameter($gotourl,"state=". UrlEncode($u->state),true); +} +# role +if ( isset($_POST['role_id']) ) { + $u->setRole($_POST['role_id']); + $gotourl= addUrlParameter($gotourl,"role_id=". UrlEncode($u->role_id),true); +} +# worker +if ( isset($_POST['worker']) ) { + $u->setWorker($_POST['worker']); + $gotourl= addUrlParameter($gotourl,"worker=". UrlEncode($u->worker),true); +} +# reference +if ( empty($_POST['link_id']) ) { + $msg .= "No Link ID given !<br />"; +} else { + $u->setReference($_POST['link_id']); + $gotourl= addUrlParameter($gotourl,"link_id=". $u->link_id,true); + $u->read_reference(); +} - # - # Parse additional custom fields - # - $msg .= parse_custom_fields($u->gettype(),$u); - # other modules - $msg .= module_parseforms($current_user,$u,$gotourl); - - if ( $msg == "" ) { - $dbconn->Begin("WORK"); - $msg .= $u->save(); - $dbconn->Commit("WORK"); - $gotourl = $u->ref->getURL(); - } +# +# Parse additional custom fields +# +$msg .= parse_custom_fields($u->gettype(),$u); +# other modules +$msg .= module_parseforms($current_user,$u,$gotourl); -$gotourl = addMessage($gotourl,$msg,true); -$gotourl = addSessionKey($gotourl,true); +if ( $msg == "" ) { + $dbconn->Begin("WORK"); + $msg .= $u->save(); + $dbconn->Commit("WORK"); + $gotourl = $u->ref->getURL(); +} -Header("Status: 302 Moved Temporarily"); -Header("Location: ". dirname(getBaseUrl()) ."/". $gotourl); -$dbconn->Close(); - +leave_insert($dbconn,$gotourl,$msg); /** * CVS Info: $Id$ * $Author$ Index: rate.pinc =================================================================== RCS file: /cvsroot/tutos/tut... [truncated message content] |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:50
|
Update of /cvsroot/tutos/tutos/php/db In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/db Modified Files: db_firebird.pinc db_mysql.pinc db_pg.pinc Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: db_firebird.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/db/db_firebird.pinc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- db_firebird.pinc 1 Dec 2005 21:05:14 -0000 1.1 +++ db_firebird.pinc 29 Mar 2009 18:25:41 -0000 1.2 @@ -1,6 +1,6 @@ <?php /** - * Copyright 2005 by Gero Kohnert + * Copyright 2005 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -18,47 +18,47 @@ $tutos['dateformat'][] = 'fbformat2'; if (!extension_loaded('interbase')) { [...983 lines suppressed...] - $fn = ibase_field_info($this->rs,$nr); - return $this->dbconn->colnameREV($fn['alias']); - } - /* --------------------------------------------------------------------------- - */ - function fieldtype($nr) { - $fn = ibase_field_info($this->rs,$nr); - return $fn['type']; - } - /* --------------------------------------------------------------------------- - */ - function free() { - unset($this->result); - return ibase_free_result($this->rs); - } } -?> +?> \ No newline at end of file Index: db_mysql.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/db/db_mysql.pinc,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- db_mysql.pinc 30 Jan 2009 09:43:51 -0000 1.47 +++ db_mysql.pinc 29 Mar 2009 18:25:41 -0000 1.48 @@ -18,46 +18,46 @@ $tutos['dateformat'][] = 'mysqlformat2'; if (!extension_loaded('mysql')) { - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { - dl('php_mysql.dll'); - } else { - dl('mysql.so'); - } + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { + dl('php_mysql.dll'); + } else { [...1212 lines suppressed...] + } + /* --------------------------------------------------------------------------- + */ + function fieldtype($nr) { + if ( empty($this->rs) ) return -1; + return mysql_field_type($this->rs,$nr); + } + /* --------------------------------------------------------------------------- + */ + function free() { + if ( empty($this->rs) ) return -1; + if (is_resource($this->rs)) { + return mysql_free_result($this->rs); + } } - } } ?> \ No newline at end of file Index: db_pg.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/db/db_pg.pinc,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- db_pg.pinc 22 Sep 2008 17:52:57 -0000 1.41 +++ db_pg.pinc 29 Mar 2009 18:25:41 -0000 1.42 @@ -1,6 +1,6 @@ <?php /** - * Copyright 2001 - 2007 by Gero Kohnert + * Copyright 2001 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -14,10 +14,10 @@ # # Register parse functions for datetime # +$tutos['dateformat'][] = 'pgformat4'; $tutos['dateformat'][] = 'pgformat1'; $tutos['dateformat'][] = 'pgformat2'; $tutos['dateformat'][] = 'pgformat3'; -$tutos['dateformat'][] = 'pgformat4'; $tutos['dateformat'][] = 'pgformat6'; $tutos['dateformat'][] = 'pgformat5'; @@ -66,7 +66,7 @@ return; } /** - * check for string delivered in postgres format + * check for string delivered in postgres format Date only */ function pgformat3(&$d,$str) { $regs = array(); |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:50
|
Update of /cvsroot/tutos/tutos/php/installation In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/installation Modified Files: installation_select.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: installation_select.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/installation/installation_select.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- installation_select.php 28 Oct 2007 16:16:36 -0000 1.6 +++ installation_select.php 29 Mar 2009 18:25:41 -0000 1.7 @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2007 by Gero Kohnert + * Copyright 1999 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -10,130 +10,104 @@ * @module installation_select * @package installation */ - $tutos['base'] = "../.."; - ini_set("include_path",".."); - include_once 'webelements.p3'; - include_once 'permission.p3'; - include_once 'installation.pinc'; - - /* Check if user is allowed to use it */ - check_user(); - loadmodules('installation','select'); - loadmodule('installation'); - loadlayout(); - - /** - * display a instalation selection form - */ - class installation_select extends layout { - /** - * - */ - Function info() { - global $lang,$tutos; - - echo "<form id=\"installationsearch\" name=\"installationsearch\" method=\"get\" action=\"installation_overview.php\">\n"; - echo DoubleTableStart(); +$tutos['base'] = "../.."; +ini_set("include_path",".."); +require_once 'webelements.p3'; +require_once 'permission.p3'; +require_once 'installation.pinc'; - echo "<tr>\n"; - if ( $this->ext == 0 ) { - echo "<th colspan=\"3\">". $lang['SearchForInst'] ."</th>\n"; +// Check if user is allowed to use it */ +check_user(); +loadmodules('installation','select'); +loadmodule('installation'); +loadlayout(); - echo "</tr><tr>\n"; +/** + * display a instalation selection form + */ +class Installation_select extends layout { + /** + * + */ + Function info() { + global $lang,$tutos; - echo $this->showfieldc($lang['SearchString'],0,"name"); - echo " <td align=\"center\"><input id=\"name\" type=\"text\" value=\"\" name=\"name\" /></td>\n"; - echo " <td align=\"center\">\n"; - echo " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForInst'] ."\" /></td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\" align=\"center\"><font size=\"-1\">". $lang['InstSelInfo'] ."</font></td>\n"; - //echo " <td align=\"center\">". makelink("installation/installation_select.php?ext=1",$lang['extended']) ."</td>\n"; - } /*else { - echo "<th colspan=\"3\">". $lang['SearchForForumExt'] ."</th>\n"; + $r = ''; + $r .= "<form id=\"installationsearch\" name=\"installationsearch\" method=\"get\" action=\"installation_overview.php\">\n"; + $r .= DoubleTableStart(); - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['ForumTopic'],0,"name"); - echo " <td> <input id=\"name\" type=\"text\" value=\"\" name=\"name\" />"; - echo " </td>\n"; - echo " <td align=\"center\"><input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForForumExt'] ."\" /></td>\n"; - echo "</tr><tr>\n"; - echo $this->showfieldc($lang['ForumState'],0,"state"); - echo " <td colspan=\"2\"> <b>". ForumAskState($this->state,2) ."</b> </td>\n"; + $r .= "<tr>\n"; + if ( $this->ext == 0 ) { + $r .= "<th colspan=\"3\">". $lang['SearchForInst'] ."</th>\n"; - echo "</tr><tr>\n"; - echo " <td class=\"desc\" rowspan=\"2\">". $lang['ForumBetween'] ." </td>\n"; - echo " <td colspan=\"2\"> "; - echo $this->from->EnterDate("f",1); - echo " </td>\n"; + $r .= "</tr><tr>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\"> "; - echo $this->to->EnterDate("t",1); - echo " </td>\n"; - }*/ + $r .= $this->showfieldc($lang['SearchString'],0,"name"); + $r .= " <td align=\"center\"><input id=\"name\" type=\"text\" value=\"\" name=\"name\" /></td>\n"; + $r .= " <td align=\"center\">\n"; + $r .= " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForInst'] ."\" /></td>\n"; + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\" align=\"center\"><font size=\"-1\">". $lang['InstSelInfo'] ."</font></td>\n"; + } - echo "</tr>\n"; - echo DoubleTableEnd(); - echo hiddenFormElements(); - echo "</form>\n"; + $r .= "</tr>\n"; + $r .= DoubleTableEnd(); + $r .= hiddenFormElements(); + $r .= "</form>\n"; - echo $this->setfocus("installationsearch.name"); - } - /** - * - */ - Function navigate() { - } - /** - * - */ - Function prepare() { - global $lang,$tutos; + $r .= $this->setfocus("installationsearch.name"); + return $r; + } + /** + * + */ + Function prepare() { + global $lang,$tutos; - $this->name = $lang['InstSearch']; - $this->center = true; - $this->css_class = 'selectbox'; - $this->ext = 0; + $this->name = $lang['InstSearch']; + $this->center = true; + $this->css_class = 'selectbox'; + $this->ext = 0; - if ( ! $this->user->feature_ok(useinstmanagement,PERM_SEL) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } + if ( ! $this->user->feature_ok(useinstmanagement,PERM_SEL) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } - # Defaults for search - $this->from = new TUTOS_Date_Time(0); - $this->to = new TUTOS_Date_Time(0); + // Defaults for search + $this->from = new TUTOS_Date_Time(0); + $this->to = new TUTOS_Date_Time(0); - if ( isset($_SESSION['installationsearchfrom']) ) { - $this->from->setDateTime($_SESSION['installationsearchfrom']); - } - if ( isset($_SESSION['installationsearchto']) ) { - $this->to->setDateTime($_SESSION['installationsearchto']); - } - if ( isset($_SESSION['installationsearchstate']) ) { - $this->state = $_SESSION['installationsearchstate']; - } else { - $this->state = -1; - } - /*if ( isset($_GET['ext']) ) { + if ( isset($_SESSION['installationsearchfrom']) ) { + $this->from->setDateTime($_SESSION['installationsearchfrom']); + } + if ( isset($_SESSION['installationsearchto']) ) { + $this->to->setDateTime($_SESSION['installationsearchto']); + } + if ( isset($_SESSION['installationsearchstate']) ) { + $this->state = $_SESSION['installationsearchstate']; + } else { + $this->state = -1; + } + /*if ( isset($_GET['ext']) ) { $this->ext = $_GET['ext']; }*/ - if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { - $x = array( url => "installation/installation_new.php", - text => $lang['NewEntry'], - info => $lang['InstCreate'], - category => array("installation","new","obj") - ); - $this->addMenu($x); - } - } - } + if ( $this->user->feature_ok(useinstmanagement,PERM_NEW) ) { + $x = array( url => "installation/installation_new.php", + text => $lang['NewEntry'], + info => $lang['InstCreate'], + category => array("installation","new","obj") + ); + $this->addMenu($x); + } + } +} - $l = new installation_select($current_user); - $l->display(); - $dbconn->Close(); +$l = new Installation_select($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:49
|
Update of /cvsroot/tutos/tutos/php/invoice In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/invoice Modified Files: invoice.pinc mconfig.pinc Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: invoice.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/invoice/invoice.pinc,v retrieving revision 1.74 retrieving revision 1.75 diff -u -d -r1.74 -r1.75 --- invoice.pinc 24 Mar 2009 20:56:15 -0000 1.74 +++ invoice.pinc 29 Mar 2009 18:25:41 -0000 1.75 @@ -46,7 +46,7 @@ } $r .= '>'. $lang['any'] .'</option>'; } - # Any but not closed +# Any but not closed if ( $any == 2 ) { $r .= '<option value="-2"'; if ( -2 == $default ) { @@ -62,39 +62,39 @@ * cols > 0 make sperate rows with cols columns for each note */ [...2322 lines suppressed...] - global $lang; + /** + * get the help index + */ + function getHelpIndex () { + global $lang; - $r = ""; - $r .= "<h3>". makelink("help.php?p=glossary#invoice",$lang['Invoices'],$lang['Invoices']) ."</h3><ul>\n"; - $r .= "</ul>\n"; - return $r; - } + $r = ""; + $r .= "<h3>". makelink("help.php?p=glossary#invoice",$lang['Invoices'],$lang['Invoices']) ."</h3><ul>\n"; + $r .= "</ul>\n"; + return $r; + } } ?> \ No newline at end of file Index: mconfig.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/invoice/mconfig.pinc,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- mconfig.pinc 8 Mar 2009 17:59:45 -0000 1.14 +++ mconfig.pinc 29 Mar 2009 18:25:41 -0000 1.15 @@ -14,12 +14,12 @@ # define('useinvoice',-22); $tutos[modules]['invoice'] = array( - name => "invoice", - Desc => "maintain invoices", - file => "php/invoice/invoice.pinc", - 'configurl' => "invoice/invoice_config.php", - 'overview' => "invoice/invoice_select.php", - 'perm' => useinvoice + name => "invoice", + Desc => "maintain invoices", + file => "php/invoice/invoice.pinc", + 'configurl' => "invoice/invoice_config.php", + 'overview' => "invoice/invoice_select.php", + 'perm' => useinvoice ); # # globally enable this module |
Update of /cvsroot/tutos/tutos/php/group In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/group Modified Files: group.pinc group_ins.php group_new.php group_overview.php group_select.php group_show.php mconfig.pinc Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: group_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/group_new.php,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- group_new.php 13 Mar 2009 20:00:40 -0000 1.36 +++ group_new.php 29 Mar 2009 18:25:41 -0000 1.37 @@ -14,8 +14,8 @@ */ $tutos['base'] = "../.."; ini_set("include_path",".."); -include_once 'webelements.p3'; -include_once 'permission.p3'; +require_once 'webelements.p3'; +require_once 'permission.p3'; // Check if user is allowed to use it check_user(); @@ -27,122 +27,116 @@ * change/modify a CRM group */ class Group_new extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang,$table; - - $this->width = 4; - echo "<form id=\"groupnew\" name=\"groupnew\" action=\"group_ins.php\" method=\"post\">\n"; - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); - - if ($this->obj->id > 0 ) { - $this->addHidden("id", $this->obj->id ); - } - - echo "<tr>\n"; - echo $this->showfieldc($lang['GroupName'],1,"name"); - echo " <td colspan=\"3\" valign=\"top\"><input id=\"name\" size=\"". min($table['group']['name'][size],30) ."\" maxlength=\"".$table['group']['name'][size]."\" name=\"name\" value=\"". myentities($this->obj->name) ."\" /></td>"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo $this->showfieldc($lang['GroupDesc'],0,"desc"); - echo " <td colspan=\"3\" valign=\"top\"><input id=\"desc\" size=\"". min($table['group']['description'][size],60) ."\" maxlength=\"".$table['group']['description'][size]."\" name=\"desc\" value=\"". myentities($this->obj->desc) ."\" /></td>"; - echo "</tr>\n"; - - # - # Show additional custom fields - # - echo edit_custom_fields($this,$this->obj->gettype(),$this->obj,4); - - # References to modules - echo module_addforms($this->user,$this->obj,4); - - if ( $this->obj->mod_ok() != 0 ) { - echo "<tr>\n"; - - if ($this->obj->id > 0 ) { - echo submit_reset(0,1,1,1,1,0); - } else { - echo submit_reset(0,-1,1,1,1,0); - } - - echo "</tr>\n"; - } - echo $this->DataTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo $this->markBadFields(); - echo "</form>\n"; - echo $this->setfocus("groupnew.name"); - echo $lang['FldsRequired'] ."\n"; - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $tutos,$lang,$msg; - - $this->obj = new group($this->dbconn); - - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - if ( is_numeric($this->obj) && $this->obj == -1 ) { - $msg .= sprintf($lang['Err0040'],$lang['Group']); - $this->stop = true; - return; - } - $this->name = $lang['GroupModify'] .": ". $this->obj->getFullName(); - } else { - $this->name = $lang['GroupCreate']; - } - - if ( isset($_GET['name']) ) { - $this->obj->name = StripSlashes($_GET['name']); - } - if ( isset($_GET['desc']) ) { - $this->obj->desc = StripSlashes($_GET['desc']); - } - if ( ! $this->obj->mod_ok() ) { - $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); - $this->stop = true; - } - # - # preset additional custom fields - # - preset_custom_fields($this->obj->gettype(),$this->obj); - # menu - $m = group::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addMenu($m); + /** + * display the form + */ + Function info() { + global $tutos,$lang,$table; + + $r = ''; + $this->width = 4; + $r .= "<form id=\"groupnew\" name=\"groupnew\" action=\"group_ins.php\" method=\"post\">\n"; + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); + + if ($this->obj->id > 0 ) { + $this->addHidden("id", $this->obj->id ); + } + + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['GroupName'],1,"name"); + $r .= " <td colspan=\"3\" valign=\"top\"><input id=\"name\" size=\"". min($table['group']['name'][size],30) ."\" maxlength=\"".$table['group']['name'][size]."\" name=\"name\" value=\"". myentities($this->obj->name) ."\" /></td>"; + $r .= "</tr>\n"; + + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['GroupDesc'],0,"desc"); + $r .= " <td colspan=\"3\" valign=\"top\"><input id=\"desc\" size=\"". min($table['group']['description'][size],60) ."\" maxlength=\"".$table['group']['description'][size]."\" name=\"desc\" value=\"". myentities($this->obj->desc) ."\" /></td>"; + $r .= "</tr>\n"; + + // Show additional custom fields + $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,4); + + // References to modules + $r .= module_addforms($this->user,$this->obj,4); + + if ( $this->obj->mod_ok() != 0 ) { + $r .= "<tr>\n"; + + if ($this->obj->id > 0 ) { + $r .= submit_reset(0,1,1,1,1,0); + } else { + $r .= submit_reset(0,-1,1,1,1,0); + } + + $r .= "</tr>\n"; + } + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= $this->markBadFields(); + $r .= "</form>\n"; + $r .= $this->setfocus("groupnew.name"); + $r .= $lang['FldsRequired'] ."\n"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $tutos,$lang,$msg; + + $this->obj = new group($this->dbconn); + + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + if ( is_numeric($this->obj) && $this->obj == -1 ) { + $msg .= sprintf($lang['Err0040'],$lang['Group']); + $this->stop = true; + return; + } + $this->name = $lang['GroupModify'] .": ". $this->obj->getFullName(); + } else { + $this->name = $lang['GroupCreate']; + } + + if ( isset($_GET['name']) ) { + $this->obj->name = StripSlashes($_GET['name']); + } + if ( isset($_GET['desc']) ) { + $this->obj->desc = StripSlashes($_GET['desc']); + } + if ( ! $this->obj->mod_ok() ) { + $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); + $this->stop = true; + } - if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { - $x = array( url => "group/group_new.php", - text => $lang['NewEntry'], - info => $lang['GroupCreate'], - category => array("group","new","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelUrl(), - text => $lang['Delete'], - info => $lang['Delete'] ." ". $this->obj->getFullname(), - confirm => true, - category => array("group","del","obj") - ); - $this->addMenu($x); - } - add_module_newlinks($this,$this->obj); - } + // preset additional custom fields + preset_custom_fields($this->obj->gettype(),$this->obj); + // menu + $m = group::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addMenu($m); + + if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { + $x = array( url => "group/group_new.php", + text => $lang['NewEntry'], + info => $lang['GroupCreate'], + category => array("group","new","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelUrl(), + text => $lang['Delete'], + info => $lang['Delete'] ." ". $this->obj->getFullname(), + confirm => true, + category => array("group","del","obj") + ); + $this->addMenu($x); + } + add_module_newlinks($this,$this->obj); + } } $l = new Group_new($current_user); @@ -150,6 +144,6 @@ $dbconn->Close(); ?> <!-- - CVS Info: $Id$ - $Author$ ---> \ No newline at end of file +CVS Info: $Id$ + $Author$ + --> \ No newline at end of file Index: group_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/group_show.php,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- group_show.php 18 Mar 2008 19:01:55 -0000 1.43 +++ group_show.php 29 Mar 2009 18:25:41 -0000 1.44 @@ -1,6 +1,6 @@ <?php /** - * Copyright 2001 - 2008 by Gero Kohnert + * Copyright 2001 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -10,348 +10,342 @@ * @module group_show * @package group */ - $tutos['base'] = "../.."; - ini_set("include_path",".."); - include_once 'webelements.p3'; - include_once 'permission.p3'; - include_once 'pdf.pinc'; - - /* Check if user is allowed to use it */ - check_user(); - loadmodules('group','show'); - loadmodule('group'); - loadlayout(); - - function member_sort(&$a,&$b) { - if ( $a->gettype() != $b->gettype() ) { - return $a->gettype() > $b->gettype(); - } - if ( ($b->gettype() == 'address') ) { - return ($a->l_name < $b->l_name) ? -1 : 1; - } - if ( ($b->gettype() == 'company') ) { - return ($a->name < $b->name) ? -1 : 1; - } - } - - - /** - * display a CRM group - */ - class group_show extends layout { - /** - * display the info as PDF - */ - Function pdf() { - global $tutos,$lang; - - $pdf=new tutospdf($this->obj->dbconn); - $pdf->Open(); - $pdf->setAuthor($this->obj->creator != -1 ? $this->obj->creator->getFullName():$lang['HistoryDeleted']); - $pdf->setTitle($this->obj->getFullName()); - $pdf->setSubject($this->obj->getFullName()); - - $pdf->headtitle = $this->name; - - $pdf->AddPage(); - $h = 5; - $pdf->SetFont('Arial','',8); - $pdf->Cell(30,$h,$lang['GroupName'],0,0); - $pdf->Cell(0,$h,$this->obj->name,0,1); - $pdf->Cell(30,$h,$lang['GroupDesc'],0,0); - $pdf->Cell(0,$h,$this->obj->desc,0,1); - $pdf->Ln(); - - $w = array(35,25,40,50,0); - $fs = array(7,7,7,7,7); - $al = array('R','R','L','L','L'); - - # Header - $h = 8; - $pdf->SetFont('Arial','B',$fs[0]); - $pdf->Cell($w[0],$h, $lang['AdrName'],1,0,$al[0]); - $pdf->SetFont('Arial','B',$fs[1]); - $pdf->Cell($w[1],$h, $lang['Description'],1,0,$al[1]); - $pdf->SetFont('Arial','B',$fs[2]); - $pdf->Cell($w[2],$h, $lang['Phone'],1,0,$al[2]); - $pdf->SetFont('Arial','B',$fs[3]); - $pdf->Cell($w[3],$h, $lang['AdrEmail'],1,0,$al[3]); - $pdf->SetFont('Arial','B',$fs[4]); - $pdf->Cell($w[4],$h, $lang['AdrFax'],1,0,$al[4]); - - $pdf->Ln(); - - foreach($this->obj->member as $i => $obj) { - $x = $obj->gettype(); - - $e = array(); - $f = array(); - $p = array(); - $d = array(); - $name = array(); - - $name[] = $obj->getFullName(); - if ( ($x == "company") || ($x == "department") ){ - $obj->read_locs_data(); - foreach($obj->location as $l) { - if (count($obj->location) == 1) { - $loc = ""; - } else { - $loc = " (".$l->lname.")"; - } - if ($l->email_1) - $e[] = $l->email_1 .$loc; - if ($l->email_2) - $e[] = $l->email_2 .$loc; - if ($l->fax_1) - $f[] = $l->fax_1 .$loc; - if ($l->phone_1) - $p[] = $l->phone_1 .$loc; - if ($l->phone_2) - $p[] = $l->phone_2 .$loc; - } - } - if ($x == "address"){ - $obj->read_locs_data(); - foreach($obj->location as $l) { - if (count($obj->location) == 1) { - $loc = ""; - } else { - $loc = " (".$l->lname.")"; - } - if ($l->email_1) - $e[] = $l->email_1 .$loc; - if ($l->email_2) - $e[] = $l->email_2 .$loc; - if ($l->fax_1) - $f[] = $l->fax_1 .$loc; - if ($l->phone_1) - $p[] = $l->phone_1 .$loc; - if ($l->phone_2) - $p[] = $l->phone_2 .$loc; - if ($l->desc1) - $d[] = $l->desc1 .$loc; - } - } - if ($x == "team") { - $name = array(); - $name[] = $lang[$x]; - $name[] = $obj->getFullName(); - } - - $max = 0; - $max = max($max,count($name)); - for ($i=0;$i<$max;$i++) { - $h = 5; - $border = "LR"; - if ($i == 0) { - $border .= "T"; - $h += 1; - } - if ($i == ($max-1)) { - $border .= "B"; - $h += 1; - } - #name - $pdf->SetFont('Arial','',$fs[0]); - $pdf->Cell($w[0],$h, (isset($name[$i]) ? $name[$i]:" "),$border,0,$al[0]); - #desc - $pdf->SetFont('Arial','',$fs[1]); - $pdf->Cell($w[1],$h, (isset($d[$i]) ? $d[$i]:" "),$border,0,$al[1]); - #phone - $pdf->SetFont('Arial','',$fs[2]); - $pdf->Cell($w[2],$h,(isset($p[$i]) ? $p[$i] : " "),$border,0,$al[2]); - #email - $pdf->SetFont('Arial','',$fs[3]); - $pdf->Cell($w[3],$h, (isset($e[$i]) ? $e[$i] : " "),$border,0,$al[3]); - #fax - $pdf->SetFont('Arial','',$fs[4]); - $pdf->Cell($w[4],$h, (isset($f[$i]) ? $f[$i] : " "),$border,0,$al[4]); - - $pdf->Ln(); - } - } - $pdf->Close(); - $data = $pdf->buffer; - Header("Content-Type: application/pdf"); - if(headers_sent()) { - Fatal_Error('Some data has already been output to browser, can\'t send PDF file'); - } - Header("Content-Disposition: inline; filename=\"". $this->obj->name .".pdf\""); - Header("Content-Description: Upload from TUTOS" ); - Header('Content-Length: '.strlen($data)); - echo $data; - return; - } - /** - * the data display part - */ - Function info() { - global $tutos,$lang; - - $this->obj->read_member(); - if ( count($this->obj->member) > 0 ) { - @reset ($this->obj->member); - usort($this->obj->member,"member_sort"); - } - - if ($this->format == 'pdf') { - Header("Expires: 0"); - Header("Pragma: no-cache"); - $this->pdf(); - return; - } - echo $this->DataTableStart(); - echo "<tr>\n"; - echo ' <th colspan="7">'. sprintf($lang['Showing'],myentities($this->obj->getFullName())) ."</th>\n"; - echo $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); - echo "</tr>\n"; - - echo $this->CreatorInfoLine($this->obj,8); - - echo "<tr>\n"; - echo $this->showfield($lang['GroupName']); - echo $this->showdata(myentities($this->obj->name),7); - - echo "</tr><tr>\n"; - echo $this->showfield($lang['GroupDesc']); - echo $this->showdata(myentities($this->obj->desc),7); - - echo "</tr>\n"; - - # - # Show additional custom fields - # - echo show_custom_fields($this,$this->obj->gettype(),$this->obj,4); - # References to modules - echo show_module_infolists($this->user,$this->obj,4); +$tutos['base'] = "../.."; +ini_set("include_path",".."); +require_once 'webelements.p3'; +require_once 'permission.p3'; +require_once 'pdf.pinc'; - if ( count($this->obj->member) > 0 ) { - $first = true; - echo "<tr>\n"; - echo $this->showfield($lang['GroupMember']); - echo '<th>'. $lang['AdrName'].'</th>'; - echo '<th colspan="3">'. $lang['Description'].'</th>'; - echo '<th>'. $lang['AdrEmail'].'</th>'; - echo '<th>'. $lang['Phone'].'</th>'; - echo '<th>'. $lang['AdrFax'].'</th>'; - echo "</tr>\n"; - $line = 1; - foreach ($this->obj->member as $i => $f) { - echo $this->OverviewRowStart($line); - echo "<td> </td>"; - $f->read_locs_data(); - $cnt = count($f->location); - if ( $cnt > 0 ) { - echo '<td valign="top" rowspan="'. $cnt .'">'. $this->obj->member[$i]->getLink() ."</td>\n"; - $cnt2 = 0; - foreach ($f->location as $i2 => $f2) { - if ( $cnt2 > 0 ) { - echo $this->OverviewRowEnd($line); - echo $this->OverviewRowStart($line); - echo "<td> </td>"; - } - echo ' <td>'. $f2->company->name ." </td>\n"; - echo ' <td>('. $f2->lname .") </td>\n"; - echo ' <td>'. $f2->desc1 ." </td>\n"; - echo ' <td>'. asEmail($f2->email_1,$f2->email_1,$f2->getFullName()); - if ( $f2->email_2 != "" ) { - echo '<br />'. asEmail($f2->email_2,$f2->email_2,$f2->getFullName()); - } - echo " </td>\n"; - echo ' <td>'. handle('phone',$f2,$f2->phone_1); - if ( $f2->email_2 != "" ) { - echo '<br />'. handle('phone',$f2,$f2->phone_2); - } - echo " </td>\n"; - echo ' <td>'. handle('fax',$f2,$f2->fax_1) ." </td>\n"; - $cnt2++; - } - } else { - echo '<td colspan="7">'. $this->obj->member[$i]->getLink() ."</td>\n"; - } - echo $this->OverviewRowEnd($line++); - } - } - echo $this->obj->getHistoryLink(8); - echo $this->DataTableEnd(); - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$tutos,$lang; +// Check if user is allowed to use it +check_user(); +loadmodules('group','show'); +loadmodule('group'); +loadlayout(); - $this->name = $lang['GroupDetail']; - $this->obj = new group($this->dbconn); +function member_sort(&$a,&$b) { + if ( $a->gettype() != $b->gettype() ) { + return $a->gettype() > $b->gettype(); + } + if ( ($b->gettype() == 'address') ) { + return ($a->l_name < $b->l_name) ? -1 : 1; + } + if ( ($b->gettype() == 'company') ) { + return ($a->name < $b->name) ? -1 : 1; + } +} + - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - } - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['Group']); - $this->stop = true; - $this->format = "html"; - return; - } else if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - $this->format = "html"; - return; - } else if ( $this->obj->id < 0 ) { - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - $this->stop = true; - $this->format = "html"; - return; - } else { - $this->name .=": ". $this->obj->getFullName(); - } - # menu - $m = group::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addMenu($m); +/** + * display a CRM group + */ +class Group_show extends layout { + /** + * display the info as PDF + */ + Function pdf() { + global $tutos,$lang; + + $pdf=new tutospdf($this->obj->dbconn); + $pdf->Open(); + $pdf->setAuthor($this->obj->creator != -1 ? $this->obj->creator->getFullName():$lang['HistoryDeleted']); + $pdf->setTitle($this->obj->getFullName()); + $pdf->setSubject($this->obj->getFullName()); + + $pdf->headtitle = $this->name; + + $pdf->AddPage(); + $h = 5; + $pdf->SetFont('Arial','',8); + $pdf->Cell(30,$h,$lang['GroupName'],0,0); + $pdf->Cell(0,$h,$this->obj->name,0,1); + $pdf->Cell(30,$h,$lang['GroupDesc'],0,0); + $pdf->Cell(0,$h,$this->obj->desc,0,1); + $pdf->Ln(); + + $w = array(35,25,40,50,0); + $fs = array(7,7,7,7,7); + $al = array('R','R','L','L','L'); + + // Header + $h = 8; + $pdf->SetFont('Arial','B',$fs[0]); + $pdf->Cell($w[0],$h, $lang['AdrName'],1,0,$al[0]); + $pdf->SetFont('Arial','B',$fs[1]); + $pdf->Cell($w[1],$h, $lang['Description'],1,0,$al[1]); + $pdf->SetFont('Arial','B',$fs[2]); + $pdf->Cell($w[2],$h, $lang['Phone'],1,0,$al[2]); + $pdf->SetFont('Arial','B',$fs[3]); + $pdf->Cell($w[3],$h, $lang['AdrEmail'],1,0,$al[3]); + $pdf->SetFont('Arial','B',$fs[4]); + $pdf->Cell($w[4],$h, $lang['AdrFax'],1,0,$al[4]); + + $pdf->Ln(); + + foreach($this->obj->member as $i => $obj) { + $x = $obj->gettype(); + + $e = array(); + $f = array(); + $p = array(); + $d = array(); + $name = array(); + + $name[] = $obj->getFullName(); + if ( ($x == "company") || ($x == "department") ){ + $obj->read_locs_data(); + foreach($obj->location as $l) { + if (count($obj->location) == 1) { + $loc = ""; + } else { + $loc = " (".$l->lname.")"; + } + if ($l->email_1) + $e[] = $l->email_1 .$loc; + if ($l->email_2) + $e[] = $l->email_2 .$loc; + if ($l->fax_1) + $f[] = $l->fax_1 .$loc; + if ($l->phone_1) + $p[] = $l->phone_1 .$loc; + if ($l->phone_2) + $p[] = $l->phone_2 .$loc; + } + } + if ($x == "address"){ + $obj->read_locs_data(); + foreach($obj->location as $l) { + if (count($obj->location) == 1) { + $loc = ""; + } else { + $loc = " (".$l->lname.")"; + } + if ($l->email_1) + $e[] = $l->email_1 .$loc; + if ($l->email_2) + $e[] = $l->email_2 .$loc; + if ($l->fax_1) + $f[] = $l->fax_1 .$loc; + if ($l->phone_1) + $p[] = $l->phone_1 .$loc; + if ($l->phone_2) + $p[] = $l->phone_2 .$loc; + if ($l->desc1) + $d[] = $l->desc1 .$loc; + } + } + if ($x == "team") { + $name = array(); + $name[] = $lang[$x]; + $name[] = $obj->getFullName(); + } + + $max = 0; + $max = max($max,count($name)); + for ($i=0;$i<$max;$i++) { + $h = 5; + $border = "LR"; + if ($i == 0) { + $border .= "T"; + $h += 1; + } + if ($i == ($max-1)) { + $border .= "B"; + $h += 1; + } + // name + $pdf->SetFont('Arial','',$fs[0]); + $pdf->Cell($w[0],$h, (isset($name[$i]) ? $name[$i]:" "),$border,0,$al[0]); + // desc + $pdf->SetFont('Arial','',$fs[1]); + $pdf->Cell($w[1],$h, (isset($d[$i]) ? $d[$i]:" "),$border,0,$al[1]); + // phone + $pdf->SetFont('Arial','',$fs[2]); + $pdf->Cell($w[2],$h,(isset($p[$i]) ? $p[$i] : " "),$border,0,$al[2]); + // email + $pdf->SetFont('Arial','',$fs[3]); + $pdf->Cell($w[3],$h, (isset($e[$i]) ? $e[$i] : " "),$border,0,$al[3]); + // fax + $pdf->SetFont('Arial','',$fs[4]); + $pdf->Cell($w[4],$h, (isset($f[$i]) ? $f[$i] : " "),$border,0,$al[4]); + + $pdf->Ln(); + } + } + $pdf->Close(); + $data = $pdf->buffer; + Header("Content-Type: application/pdf"); + if(headers_sent()) { + Fatal_Error('Some data has already been output to browser, can\'t send PDF file'); + } + Header("Content-Disposition: inline; filename=\"". $this->obj->name .".pdf\""); + Header("Content-Description: Upload from TUTOS" ); + Header('Content-Length: '.strlen($data)); + return $data; + } + /** + * the data display part + */ + Function info() { + global $tutos,$lang; + + $r = ''; + $this->obj->read_member(); + if ( count($this->obj->member) > 0 ) { + @reset ($this->obj->member); + usort($this->obj->member,"member_sort"); + } + + if ($this->format == 'pdf') { + Header("Expires: 0"); + Header("Pragma: no-cache"); + return $this->pdf(); + } + $r .= $this->DataTableStart(); + $r .= "<tr>\n"; + $r .= ' <th colspan="7">'. sprintf($lang['Showing'],myentities($this->obj->getFullName())) ."</th>\n"; + $r .= $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); + $r .= "</tr>\n"; + + $r .= $this->CreatorInfoLine($this->obj,8); + + $r .= "<tr>\n"; + $r .= $this->showfield($lang['GroupName']); + $r .= $this->showdata(myentities($this->obj->name),7); - if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { - $x = array( url => "group/group_new.php", - text => $lang['NewEntry'], - info => $lang['GroupCreate'], - category => array("group","new","obj") - ); - $this->addMenu($x); - } - if ( $this->obj->mod_ok() ) { - $x = array( url => $this->obj->getModUrl(), - text => $lang['Modify'], - info => sprintf($lang['GroupModifyI'],$this->obj->getFullName()), - category => array("group","mod","obj") - ); - $this->addMenu($x); - } - if (($this->obj->id > 0) && $this->user->feature_ok(useprojects,PERM_SEE) ) { - $x = array( url => "group/group_show.php?format=pdf&id=".$this->obj->id, - text => 'PDF', - info => 'PDF', - category => array("group","show","obj") - ); - $this->addMenu($x); - } - $x = $this->obj->getMailLink(); - $this->addMenu($x); - add_module_addlinks($this,$this->obj); + $r .= "</tr><tr>\n"; + $r .= $this->showfield($lang['GroupDesc']); + $r .= $this->showdata(myentities($this->obj->desc),7); + + $r .= "</tr>\n"; + + + // Show additional custom fields + $r .= show_custom_fields($this,$this->obj->gettype(),$this->obj,4); + // References to modules + $r .= show_module_infolists($this->user,$this->obj,4); + + if ( count($this->obj->member) > 0 ) { + $first = true; + $r .= "<tr>\n"; + $r .= $this->showfield($lang['GroupMember']); + $r .= '<th>'. $lang['AdrName'].'</th>'; + $r .= '<th colspan="3">'. $lang['Description'].'</th>'; + $r .= '<th>'. $lang['AdrEmail'].'</th>'; + $r .= '<th>'. $lang['Phone'].'</th>'; + $r .= '<th>'. $lang['AdrFax'].'</th>'; + $r .= "</tr>\n"; + $line = 1; + foreach ($this->obj->member as $i => $f) { + $r .= $this->OverviewRowStart($line); + $r .= "<td> </td>"; + $f->read_locs_data(); + $cnt = count($f->location); + if ( $cnt > 0 ) { + $r .= '<td valign="top" rowspan="'. $cnt .'">'. $this->obj->member[$i]->getLink() ."</td>\n"; + $cnt2 = 0; + foreach ($f->location as $i2 => $f2) { + if ( $cnt2 > 0 ) { + $r .= $this->OverviewRowEnd($line); + $r .= $this->OverviewRowStart($line); + $r .= "<td> </td>"; + } + $r .= ' <td>'. $f2->company->name ." </td>\n"; + $r .= ' <td>('. $f2->lname .") </td>\n"; + $r .= ' <td>'. $f2->desc1 ." </td>\n"; + $r .= ' <td>'. asEmail($f2->email_1,$f2->email_1,$f2->getFullName()); + if ( $f2->email_2 != "" ) { + $r .= '<br />'. asEmail($f2->email_2,$f2->email_2,$f2->getFullName()); + } + $r .= " </td>\n"; + $r .= ' <td>'. handle('phone',$f2,$f2->phone_1); + if ( $f2->email_2 != "" ) { + $r .= '<br />'. handle('phone',$f2,$f2->phone_2); + } + $r .= " </td>\n"; + $r .= ' <td>'. handle('fax',$f2,$f2->fax_1) ." </td>\n"; + $cnt2++; + } + } else { + $r .= '<td colspan="7">'. $this->obj->member[$i]->getLink() ."</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + } + } + $r .= $this->obj->getHistoryLink(8); + $r .= $this->DataTableEnd(); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$tutos,$lang; + + $this->name = $lang['GroupDetail']; + $this->obj = new group($this->dbconn); + + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + } + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['Group']); + $this->stop = true; + $this->format = "html"; + return; + } else if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + $this->format = "html"; + return; + } else if ( $this->obj->id < 0 ) { + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + $this->stop = true; + $this->format = "html"; + return; + } else { + $this->name .=": ". $this->obj->getFullName(); + } + // menu + $m = group::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addMenu($m); - # add this page to the browsehistory of the users session - $this->addtohistory(); - } - } + if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { + $x = array( url => "group/group_new.php", + text => $lang['NewEntry'], + info => $lang['GroupCreate'], + category => array("group","new","obj") + ); + $this->addMenu($x); + } + if ( $this->obj->mod_ok() ) { + $x = array( url => $this->obj->getModUrl(), + text => $lang['Modify'], + info => sprintf($lang['GroupModifyI'],$this->obj->getFullName()), + category => array("group","mod","obj") + ); + $this->addMenu($x); + } + if (($this->obj->id > 0) && $this->user->feature_ok(useprojects,PERM_SEE) ) { + $x = array( url => "group/group_show.php?format=pdf&id=".$this->obj->id, + text => 'PDF', + info => 'PDF', + category => array("group","show","obj") + ); + $this->addMenu($x); + } + $x = $this->obj->getMailLink(); + $this->addMenu($x); + add_module_addlinks($this,$this->obj); + + // add this page to the browsehistory of the users session + $this->addtohistory(); + } +} - $l = new group_show($current_user); - $l->display(); - $dbconn->Close(); +$l = new Group_show($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- CVS Info: $Id$ Index: group_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/group_overview.php,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- group_overview.php 19 Aug 2008 17:17:16 -0000 1.28 +++ group_overview.php 29 Mar 2009 18:25:41 -0000 1.29 @@ -1,6 +1,6 @@ <?php /** - * Copyright 2002 - 2008 by Gero Kohnert + * Copyright 2002 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -15,184 +15,187 @@ * @module group_overview * @package group */ - $tutos['base'] = "../.."; - ini_set("include_path",".."); - include_once 'webelements.p3'; - include_once 'permission.p3'; - - /* Check if user is allowed to use it */ - check_user(); - loadmodules('group','overview'); - loadmodule('group'); - loadlayout(); - - /** - * display an overview of CRM groups - */ - class group_overview extends layout { - /** - * the data display part - */ - Function info() { - global $tutos,$lang; - - $result = $this->dbconn->Exec($this->q); - $n = $result->numrows(); - if ( $this->format == "xml" ) { - $c = new group($this->dbconn); - echo $c->exportXMLHeader(); - echo $c->exportXML_Head(); - echo "<group_set>\n"; - $a = 0; - while ($a < $n) { - $c->read_result($result,$a); - $c->read_member(); - $a++; - if ( ! $c->see_ok() ) { - continue; - } else { - echo $c->exportXML_start(); - echo $c->exportXML_body(); - echo $c->exportXML_end(); - } - } - echo "</group_set>\n"; - $result->free(); - return; - } - if ( 0 == $n) { - echo $this->error($lang['Err0048']); - $result->free(); - return; - } - echo $this->actionformStart("group_overview.php"); - echo $this->OverviewTableStart(); - echo "<thead>\n"; - echo "<tr>\n"; - echo $this->orderHeader("name",$lang['GroupName'],$this->link2); - echo $this->orderHeader("",$lang['GroupDesc'],$this->link2); - echo $this->orderHeader("",$lang['GroupMember'],$this->link2); - $this->flds = 3; - echo show_custom_overview_headers($this,'group',$this->link2); - if ( $tutos[massupdate] == 1 ) { - echo " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - } - echo "</tr>\n"; - echo "</thead>\n"; - - if ( $this->start == -1 ) { - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } - - $line = 0; - while ( ($a < $n) && ($a < $end) ) { - $c = new group($this->dbconn); - $c->read_result($result,$a); - $c->read_member(); - $a++; - if ( ! $c->see_ok() ) { - continue; - } - echo $this->OverviewRowStart($line); - echo ' <td valign="top">'. $c->getLink() ."</td>\n"; - echo ' <td valign="top">'. myentities($c->desc) ." </td>\n"; - echo ' <td align="right" valign="top">'. count($c->member) ."</td>\n"; - echo show_custom_overview_data($this,'group',$c); - - if ( $tutos[massupdate] == 1 ) { - echo " <td align=\"center\">\n"; - if ( $c->mod_ok() ) { - echo '<input name="mark[]" type="checkbox" value="'. $c->id .'" />'; - } else { - echo '-'; - } - echo "\n</td>\n"; - } - echo $this->OverviewRowEnd($line++); - } - $result->free(); - - echo $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); - if ( $tutos[massupdate] == 1 ) { - echo $this->UpdateRowStart($this->flds-1); - echo sprintf($lang['withmarked'],$lang['Groups']); - echo " <select name=\"action\">\n"; - echo ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; - echo ' <option value="-2">'. $lang['Delete'] ."</option>\n"; - echo ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - echo " <option value=\"WatchAdd\">". $lang['WatchAdd'] ."</option>\n"; - echo " <option value=\"WatchDel\">". $lang['WatchDel'] ."</option>\n"; - } - echo "</select>\n"; - echo $this->UpdateRowEnd(2); - } - echo $this->OverviewTableEnd(); - echo $this->actionformEnd("group_overview.php"); - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang,$tutos; - - $this->name = $lang['GroupOverview']; - $this->css_class = 'overviewbox'; - - if ( ! $this->user->feature_ok(usegroups,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } - - $this->link1 = "group/group_overview.php"; - $this->q = "SELECT * FROM ". $this->dbconn->prefix ."groups"; - $pre = " WHERE "; - - if ( isset($_GET['name']) && ($_GET['name'] != "*") && ($_GET['name'] != "") ) { - $this->q .= $pre . $this->dbconn->Like("name",$_GET['name']); - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); - } - - check_dbacl($this->dbconn,$this->q, $this->user->id); - - # sorting - $xxx = ""; - $this->link2 = $this->link1; - order_parse($this->q,$this->link1,$xxx,$xxx,"name"); - # display default sortorder - if (!isset($_GET['xf'])) { - $_GET['xf'] = "name"; - $_GET['xo'] = 1; - } +$tutos['base'] = "../.."; +ini_set("include_path",".."); +include_once 'webelements.p3'; +include_once 'permission.p3'; - # menu - $m = group::getSelectLink($this->user,$lang['Search']); - $m[category][] = "obj"; - $this->addMenu($m); +// Check if user is allowed to use it +check_user(); +loadmodules('group','overview'); +loadmodule('group'); +loadlayout(); - if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { - $x = array( url => "group/group_new.php", - text => $lang['NewEntry'], - info => $lang['GroupCreate'], - category => array("group","new","obj") - ); - $this->addMenu($x); - } - } - } +/** + * display an overview of CRM groups + */ +class Group_overview extends layout { + /** + * the data display part + */ + Function info() { + global $tutos,$lang; + + $r = ''; + $result = $this->dbconn->Exec($this->q); + $n = $result->numrows(); + if ( $this->format == "xml" ) { + $c = new group($this->dbconn); + $r .= $c->exportXMLHeader(); + $r .= $c->exportXML_Head(); + $r .= "<group_set>\n"; + $a = 0; + while ($a < $n) { + $c->read_result($result,$a); + $c->read_member(); + $a++; + if ( ! $c->see_ok() ) { + continue; + } else { + $r .= $c->exportXML_start(); + $r .= $c->exportXML_body(); + $r .= $c->exportXML_end(); + } + } + $r .= "</group_set>\n"; + $result->free(); + return $r; + } + if ( 0 == $n) { + $r .= $this->error($lang['Err0048']); + $result->free(); + return $r; + } + $r .= $this->actionformStart("group_overview.php"); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + $r .= $this->orderHeader("name",$lang['GroupName'],$this->link2); + $r .= $this->orderHeader("",$lang['GroupDesc'],$this->link2); + $r .= $this->orderHeader("",$lang['GroupMember'],$this->link2); + $this->flds = 3; + $r .= show_custom_overview_headers($this,'group',$this->link2); + if ( $tutos[massupdate] == 1 ) { + $r .= " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + } + $r .= "</tr>\n"; + $r .= "</thead>\n"; + + if ( $this->start == -1 ) { + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } + + $line = 0; + while ( ($a < $n) && ($a < $end) ) { + $c = new group($this->dbconn); + $c->read_result($result,$a); + $c->read_member(); + $a++; + if ( ! $c->see_ok() ) { + continue; + } + $r .= $this->OverviewRowStart($line); + $r .= ' <td valign="top">'. $c->getLink() ."</td>\n"; + $r .= ' <td valign="top">'. myentities($c->desc) ." </td>\n"; + $r .= ' <td align="right" valign="top">'. count($c->member) ."</td>\n"; + $r .= show_custom_overview_data($this,'group',$c); + + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $c->mod_ok() ) { + $r .= '<input name="mark[]" type="checkbox" value="'. $c->id .'" />'; + } else { + $r .= '-'; + } + $r .= "\n</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + } + $result->free(); + + $r .= $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart($this->flds-1); + $r .= sprintf($lang['withmarked'],$lang['Groups']); + $r .= " <select name=\"action\">\n"; + $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; + $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; + $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; + if (class_exists('watchlist')) { + $r .= " <option value=\"WatchAdd\">". $lang['WatchAdd'] ."</option>\n"; + $r .= " <option value=\"WatchDel\">". $lang['WatchDel'] ."</option>\n"; + } + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(2); + } + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("group_overview.php"); + return $r; + } + /** + * action when massupdate + */ + Function action() { +# TODO + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang,$tutos; + + $this->name = $lang['GroupOverview']; + $this->css_class = 'overviewbox'; + + if ( ! $this->user->feature_ok(usegroups,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } + + $this->link1 = "group/group_overview.php"; + $this->q = "SELECT * FROM ". $this->dbconn->prefix ."groups"; + $pre = " WHERE "; + + if ( isset($_GET['name']) && ($_GET['name'] != "*") && ($_GET['name'] != "") ) { + $this->q .= $pre . $this->dbconn->Like("name",$_GET['name']); + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"name=". UrlEncode($_GET['name'])); + } + + check_dbacl($this->dbconn,$this->q, $this->user->id); + + // sorting + $xxx = ""; + $this->link2 = $this->link1; + order_parse($this->q,$this->link1,$xxx,$xxx,"name"); + // display default sortorder + if (!isset($_GET['xf'])) { + $_GET['xf'] = "name"; + $_GET['xo'] = 1; + } + + // menu + $m = group::getSelectLink($this->user,$lang['Search']); + $m[category][] = "obj"; + $this->addMenu($m); + + if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { + $x = array( url => "group/group_new.php", + text => $lang['NewEntry'], + info => $lang['GroupCreate'], + category => array("group","new","obj") + ); + $this->addMenu($x); + } + } +} - $l = new group_overview($current_user); - $l->display(); - $dbconn->Close(); +$l = new Group_overview($current_user); +$l->display(); +$dbconn->Close(); ?> \ No newline at end of file Index: group.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/group.pinc,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- group.pinc 24 Mar 2009 20:56:15 -0000 1.60 +++ group.pinc 29 Mar 2009 18:25:41 -0000 1.61 @@ -14,526 +14,530 @@ * @package group */ class group extends tutos_module { - /* --------------------------------------------------------------------------- - */ - function group(&$dbconn) { - global $table; + /* --------------------------------------------------------------------------- + */ + function group(&$dbconn) { + global $table; [...967 lines suppressed...] - global $lang; + /** + * get the help index + */ + function getHelpIndex () { + global $lang; - $r = ""; - $r .= "<h3>". makelink("help.php?p=glossary#group",$lang['Groups'],$lang['Groups']) ."</h3><ul>\n"; - $r .= "</ul>\n"; - return $r; - } + $r = ""; + $r .= "<h3>". makelink("help.php?p=glossary#group",$lang['Groups'],$lang['Groups']) ."</h3><ul>\n"; + $r .= "</ul>\n"; + return $r; + } } ?> \ No newline at end of file Index: mconfig.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/mconfig.pinc,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- mconfig.pinc 1 Mar 2009 10:29:17 -0000 1.11 +++ mconfig.pinc 29 Mar 2009 18:25:41 -0000 1.12 @@ -14,11 +14,11 @@ # define('usegroups',-99); $tutos[modules]['group'] = array( - name => "group", - Desc => "maintain groups of customers", - file => "php/group/group.pinc", - 'overview' => "group/group_select.php", - 'perm' => usegroups + name => "group", + Desc => "maintain groups of customers", + file => "php/group/group.pinc", + 'overview' => "group/group_select.php", + 'perm' => usegroups ); # # globally enable this module @@ -31,9 +31,9 @@ # and need to include this module # $tutos[modulesinc]['group'][] = 'company'; -$tutos[modulesinc]['group'][] = 'department'; +$tutos[modulesinc]['group'][] = 'department'; $tutos[modulesinc]['group'][] = 'address'; $tutos[modulesinc]['group'][] = 'scheme'; $permskip[usegroups][PERM_MYTUTOS] = 1; -?> +?> \ No newline at end of file Index: group_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/group_ins.php,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- group_ins.php 16 Feb 2009 20:03:56 -0000 1.19 +++ group_ins.php 29 Mar 2009 18:25:41 -0000 1.20 @@ -18,55 +18,51 @@ require_once 'webelements.p3'; require_once 'permission.p3'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('group','ins'); loadmodule("group"); -$gotourl = 'group/group_new.php'; $msg = ''; +$gotourl = 'group/group_new.php'; - $obj = new group($dbconn); - if ( isset($_POST['id']) ) { - $obj = $obj->read($_POST['id'],$obj); - $gotourl= addUrlParameter($gotourl,"id=". $obj->id,true); - } - - if ( !isset($_POST['name']) || empty($_POST['name']) || ($_POST['name'] == $lang['PlsChangeName']) ) { - $msg .= sprintf($lang['Err0009'],$lang['GroupName']) ."<br />"; - $gotourl = addBadField($gotourl,'name',true); - } else { - $obj->setName(trim(StripSlashes($_POST['name']))); - $gotourl = addUrlParameter($gotourl,"name=". UrlEncode($obj->name),true); - } - if ( isset($_POST['desc']) ) { - $gotourl = addUrlParameter($gotourl,"desc=". UrlEncode(StripSlashes($_POST['desc'])),true); - } - # - # Parse additional custom fields - # - $msg .= parse_custom_fields($obj->gettype(),$obj); - - # other modules - $msg .= module_parseforms($current_user,$obj,$gotourl); +$obj = new group($dbconn); +if ( isset($_POST['id']) ) { + $obj = $obj->read($_POST['id'],$obj); + $gotourl= addUrlParameter($gotourl,"id=". $obj->id,true); +} - if ( $msg == "" ) { - $obj->setDesc(trim(StripSlashes($_POST['desc']))); +if ( !isset($_POST['name']) || empty($_POST['name']) || ($_POST['name'] == $lang['PlsChangeName']) ) { + $msg .= sprintf($lang['Err0009'],$lang['GroupName']) ."<br />"; + $gotourl = addBadField($gotourl,'name',true); +} else { + $obj->setName(trim(StripSlashes($_POST['name']))); + $gotourl = addUrlParameter($gotourl,"name=". UrlEncode($obj->name),true); +} +if ( isset($_POST['desc']) ) { + $gotourl = addUrlParameter($gotourl,"desc=". UrlEncode(StripSlashes($_POST['desc'])),true); +} +# +# Parse additional custom fields +# +$msg .= parse_custom_fields($obj->gettype(),$obj); - $dbconn->Begin("WORK"); - $msg .= $obj->save(); - $dbconn->Commit("WORK"); +# other modules +$msg .= module_parseforms($current_user,$obj,$gotourl); - $gotourl = $obj->getURL(); - } - $gotourl = addMessage($gotourl,$msg,true); - $gotourl = addSessionKey($gotourl,true); +if ( $msg == "" ) { + $obj->setDesc(trim(StripSlashes($_POST['desc']))); + + $dbconn->Begin("WORK"); + $msg .= $obj->save(); + $dbconn->Commit("WORK"); + + $gotourl = $obj->getURL(); +} - Header("Status: 302 Moved Temporarily"); - Header("Location:". dirname(getBaseUrl()) ."/". $gotourl); - $dbconn->Close(); - /* - * CVS Info: $Id$ - * $Author$ - */ -?> +leave_insert($dbconn,$gotourl,$msg); +/** + * CVS Info: $Id$ + * $Author$ + */ +?> \ No newline at end of file Index: group_select.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/group/group_select.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- group_select.php 28 Oct 2007 16:16:35 -0000 1.7 +++ group_select.php 29 Mar 2009 18:25:41 -0000 1.8 @@ -1,6 +1,6 @@ <?php /** - * Copyright 2001 - 2007 by Gero Kohnert + * Copyright 2001 - 2009 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -10,81 +10,78 @@ * @module resource_select * @package resource */ - $tutos['base'] = "../.."; - ini_set("include_path",".."); - include_once 'webelements.p3'; - include_once 'permission.p3'; - - /* Check if user is allowed to use it */ - check_user(); - loadmodules('group','select'); - loadmodule('group'); - loadlayout(); - - /** - * display a CRM group selection form - */ - class group_select extends layout { - /** - * - */ - Function info() { - global $lang,$tutos; - - echo "<form id=\"groupsearch\" name=\"groupsearch\" method=\"get\" action=\"group_overview.php\">\n"; - echo hiddenFormElements(); - echo DoubleTableStart(); - - echo "<tr>\n"; - echo "<th colspan=\"3\">". $lang['SearchForGroup'] ."</th>\n"; - - echo "</tr><tr>\n"; - - echo $this->showfieldc($lang['AdrName']); - echo " <td align=\"center\"><input type=\"text\" value=\"\" name=\"name\" /></td>\n"; - echo " <td align=\"center\">\n"; - echo " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForGroup'] ."\" /></td>\n"; - echo "</tr><tr>\n"; - echo " <td colspan=\"2\" align=\"center\"> </td>\n"; - echo "</tr>\n"; - echo DoubleTableEnd(); - echo "</form>\n"; - - echo $this->setfocus("groupsearch.name"); - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; - - $this->name = $lang['GroupSearch']; - $this->center = true; - $this->css_class = 'selectbox'; +$tutos['base'] = "../.."; +ini_set("include_path",".."); +require_once 'webelements.p3'; +require_once 'permission.p3'; - if ( ! $this->user->feature_ok(usegroups,PERM_SEL) ) { - $this->stop = true; - } +// Check if user is allowed to use it +check_user(); +loadmodules('group','select'); +loadmodule('group'); +loadlayout(); - if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { - $x = array( url => "group/group_new.php", - text => $lang['NewEntry'], - info => $lang['GroupCreate'], - category => array("group","new","obj") - ); - $this->addMenu($x); - } - } - } +/** + * display a CRM group selection form + */ +class Group_select extends layout { + /** + * + */ + Function info() { + global $lang,$tutos; + + $r = ''; + $r .= "<form id=\"groupsearch\" name=\"groupsearch\" method=\"get\" action=\"group_overview.php\">\n"; + $r .= hiddenFormElements(); + $r .= DoubleTableStart(); + + $r .= "<tr>\n"; + $r .= "<th colspan=\"3\">". $lang['SearchForGroup'] ."</th>\n"; + + $r .= "</tr><tr>\n"; + + $r .= $this->showfieldc($lang['AdrName']); + $r .= " <td align=\"center\"><input type=\"text\" value=\"\" name=\"name\" /></td>\n"; + $r .= " <td align=\"center\">\n"; + $r .= " <input type=\"submit\" value=\"". $lang['Search'] ."\" title=\"". $lang['SearchForGroup'] ."\" /></td>\n"; + $r .= "</tr><tr>\n"; + $r .= " <td colspan=\"2\" align=\"center\"> </td>\n"; + $r .= "</tr>\n"; + $r .= DoubleTableEnd(); + $r .= "</form>\n"; + + $r .= $this->setfocus("groupsearch.name"); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; + + $this->name = $lang['GroupSearch']; + $this->center = true; + $this->css_class = 'selectbox'; + + if ( ! $this->user->feature_ok(usegroups,PERM_SEL) ) { + $this->stop = true; + } + + if ( $this->user->feature_ok(usegroups,PERM_NEW) ) { + $x = array( url => "group/group_new.php", + text => $lang['NewEntry'], + info => $lang['GroupCreate'], + category => array("group","new","obj") + ); + $this->addMenu($x); + } + } +} - $l = new group_select($current_user); - $l->display(); - $dbconn->Close(); +$l = new group_select($current_user); +$l->display(); +$dbconn->Close(); ?> <!-- CVS Info: $Id$ |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:48
|
Update of /cvsroot/tutos/tutos/php/note In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/note Modified Files: note_ins.php note_new.php note_overview.php note_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: note_overview.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/note/note_overview.php,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- note_overview.php 13 Mar 2009 20:00:41 -0000 1.48 +++ note_overview.php 29 Mar 2009 18:25:41 -0000 1.49 @@ -30,370 +30,364 @@ * a overview of notes */ class Note_overview extends layout { - /** - * display the form - */ - Function info() { - global $tutos,$lang; - - - $n = $this->result->numrows(); - - $blist = array(); - # Make a big array of all visible notes - $x = 0; - while ( $x < $n ) { - $b = new note($this->dbconn); - $b->read_result($this->result,$x); - $x++; - if ( ! $b->see_ok() ) { - continue; - } - $blist[] = &$b; - unset($b); - } - $this->result->free(); - $n = count($blist); - if ( 0 == $n) { - echo $this->error($lang['Err0048']); - return; - } - - echo $this->actionformStart("note_overview.php"); - echo $this->OverviewTableStart(); - echo "<thead>\n"; - echo "<tr>\n"; - echo $this->orderHeader("n.creation",$lang['created'],$this->link2); - echo $this->orderHeader("",$lang['NoteName'],$this->link2); - echo $this->orderHeader("link_id",$lang['NoteReference'],$this->link2); - echo $this->orderHeader("remember",$lang['NoteRemember'],$this->link2); - echo $this->orderHeader("n.creator",$lang['NoteCreator'],$this->link2); - $this->flds = 5; - echo show_custom_overview_headers($this,'note',$this->link2); - if ( $tutos[massupdate] == 1 ) { - echo " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - } - echo "</tr>\n"; - echo "</thead>\n"; - - if ( $this->start == -1 ) { - # Show the last part - $a = $n - $tutos[maxshow]; - $end = $n; - $this->start = $a; - } else { - $a = $this->start; - $end = $this->start + $tutos[maxshow]; - } - - $this->filter['name'] = prepare_regpattern($this->filter['name']); - $line = 1; - while ( ($a < $n) && ($a < $end) ) { - $b = &$blist[$a]; - $b->read_reference(); - - echo $this->OverviewRowStart($line); - echo " <td>". $b->creation->getDateTime() ."</td>\n"; - $x = myentities($b->getFullName()); - if ( $this->filter['name'] != "" ) { - $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); - } - echo " <td>". makelink($b->getUrl(),$x) ."</td>\n"; - echo " <td> ". $b->ref->getLink() ."</td>\n"; - echo " <td> ". $b->remember->getDateTime() ."</td>\n"; - echo " <td> ". ((!(is_numeric($b->creator) && $b->creator == -1)) ? $b->creator->getLink($b->creator->getShortname()):$lang['HistoryDeleted']) ."</td>\n"; - echo show_custom_overview_data($this,'note',$b); - if ( $tutos[massupdate] == 1 ) { - echo " <td align=\"center\">\n"; - if ( $b->mod_ok() ) { - echo "<input name=\"mark[]\" type=\"checkbox\" value=\"". $b->id ."\" />\n"; - } else { - echo "-\n"; - } - echo "</td>\n"; - } - echo $this->OverviewRowEnd($line++); - unset($b); - $a++; - } - - echo $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); - if ( $tutos[massupdate] == 1 ) { - echo $this->UpdateRowStart($this->flds - 1); - echo sprintf($lang['withmarked'],$lang['Notes']); - echo " <select name=\"action\">\n"; - echo " <option value=\"-1\" selected=\"selected\">". $lang['ActionNil'] ."</option>\n"; - echo " <option value=\"-2\">". $lang['Delete'] ."</option>\n"; - echo " <option value=\"-4\">". $lang['AclModify'] ."</option>\n"; - if (class_exists('watchlist')) { - echo " <option value=\"WatchAdd\">". $lang['WatchAdd'] ."</option>\n"; - echo " <option value=\"WatchDel\">". $lang['WatchDel'] ."</option>\n"; - } - echo "</select>\n"; - echo $this->UpdateRowEnd(2); - } - echo $this->OverviewTableEnd(); - echo $this->actionformEnd("note_overview.php"); - } - /** - * naviagte - */ - Function navigate() { - } - /** - * action via massupdate - */ - Function action() { - global $lang,$msg; - - if ( $_GET['action'] == -2 ) { - $this->dbconn->Begin("WORK"); - foreach ($_GET['mark'] as $key => $val) { - $b = new note($this->dbconn); - $b = $b->read($val,$b); - if ( $b->id != $val ) { - continue; - } - if ( $b->del_ok() ) { - $msg .= $lang['Delete'].":". $b->getFullName() ."<br />"; - $msg .= $b->delete(); - } else { - $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; - } - unset($b); - } - $this->dbconn->Commit("WORK"); - return; - } - if ( $_GET['action'] == -4 ) { - $this->redirect = "../". acl_action(); - return; - } - if (class_exists('watchlist')) { - watchlist::parse_action($this->user); - } - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; - - $this->name = $lang['NotesOverview']; - $this->css_class = 'overviewbox'; - - if ( ! $this->user->feature_ok(usenotes,PERM_SEE) ) { - $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); - $this->stop = true; - } - - $this->link1 = "note/note_overview.php"; - $this->filter = array(); - - $reftype = ""; - $name = ""; - $nsrn = ""; - $nscr = ""; - - if ( isset($_GET['reftype']) ) { - $reftype = $_GET['reftype']; - } - if ( isset($_GET['name']) ) { - $name = $_GET['name']; - } - if ( isset($_GET['nsrn']) ) { - $nsrn = $_GET['nsrn']; - } - if ( isset($_GET['nscr']) ) { - $nscr = $_GET['nscr']; - } - - - $j = "SELECT DISTINCT n.* FROM ". $this->dbconn->prefix ."notes n "; // select + join - $q = ""; - $pre = " WHERE "; - - if ( ($name != "*") && ($name != "") ) { - $q .= " " . $pre ."(". $this->dbconn->Like("n.note",$name) ." OR ". $this->dbconn->Like("n.name",$name) .")"; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"name=".UrlEncode($name)); - $this->filter['name'] = $name; - } else { - $this->filter['name'] = ""; - } - - if ( isset($_GET['id']) ) { - if (false == is_numeric($_GET['id'])) { - $msg .= sprintf($lang['Err0012'],"id",$_GET['id']); - $this->stop = true; - } - $q .= " ". $pre ." n.id = ".$_GET['id']; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"id=". $_GET['id']); - } - - if ( isset($_GET['link_id']) ) { - if (false == is_numeric($_GET['link_id'])) { - $msg .= sprintf($lang['Err0012'],"link_id",$_GET['link_id']); - $this->stop = true; - } - $q .= " ". $pre ." n.link_id = ".$_GET['link_id']; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); - } - - # References to display - if ( ($reftype > 0) || ($reftype > 0 && ($nsrn != "*") && ($nsrn != "")) ) { - if ( ! isset($nsrn) || ($nsrn == "*") ) { - $nsrn = ""; - } - if ( ($reftype == 1) || ($reftype == -1) ) { - $j .= ", ". $this->dbconn->prefix ."companies c "; - $q .= " ". $pre . "(n.link_id=c.id "; - if ( $nsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("c.name",$nsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 2) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."departments d "; - $q .= " ". $pre . "(n.link_id=d.id "; - if ( $nsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("d.name",$nsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 3) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."addresses a "; - $q .= $pre ."( ("; - $q .= $this->dbconn->Like("a.f_name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("a.m_name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("a.l_name",$nsrn) .")"; - $q .= " AND n.link_id=a.id )"; - $pre = " OR "; - } - if ( ($reftype == 4) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."bugs b"; - $q .= " ". $pre . "(n.link_id=b.id "; - if ( $nsrn != "" ) { - $q .= " AND ". $this->dbconn->Like("b.short",$nsrn); - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 5) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."products p"; - $q .= $pre ."( n.link_id=p.id "; - if ( $nsrn != "" ) { - $q .= " AND ("; - $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("p.version",$nsrn) .")"; - } - $q .= ")"; - $pre = " OR "; - } - if ( ($reftype == 6) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."teams t"; - $q .= $pre . "(n.link_id=t.id AND ". $this->dbconn->Like("t.name",$nsrn) .")"; - $pre = " OR "; - } - if ( ($reftype == 7) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."tasks k"; - $q .= $pre . "(n.link_id=k.id AND ". $this->dbconn->Like("k.name",$nsrn) .")"; - $pre = " OR "; - } - if ( ($reftype == 8) || ($reftype == -1) ) { - $j .= ",". $this->dbconn->prefix ."installations i"; - if ( ! stristr($j, "products") ) { - $j .= ",". $this->dbconn->prefix ."products p"; - } - $q .= $pre ."( n.link_id=i.id AND i.product_id=p.id AND ("; - $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; - $q .= $this->dbconn->Like("p.version",$nsrn) .") )"; - $pre = " OR "; - } - $pre = "AND "; - - $this->link1 = addUrlParameter($this->link1,"reftype=". $reftype); - $this->link1 = addUrlParameter($this->link1,"nsrn=". $nsrn); - # remember this - $_SESSION['notesearchreftype'] = $reftype; - $this->filter['reftype'] = $reftype; - } - if ( ($nscr != "*") && ($nscr != "") ) { - $j .= ", addresses "; - $q .= $pre ."( ("; - $q .= $this->dbconn->Like("addresses.f_name",$nscr) ." OR "; - $q .= $this->dbconn->Like("addresses.m_name",$nscr) ." OR "; - $q .= $this->dbconn->Like("addresses.l_name",$nscr) .")"; - $q .= " AND n.creator=addresses.id )"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"nscr=".UrlEncode($nscr)); - $this->filter['nscr'] = $nscr; - } - - # Start Date for search - $from = new TUTOS_Date_Time(0); - if ( isset($_GET['fd']) ) { - $from->setDateTime($_GET['fd']); - } else { - $from->setDateTimeF("f"); - # remember this -# session_register('notesearchfrom'); - $_SESSION['notesearchfrom'] = $from->getYYYYMMDD(); - } - if ( $from->notime != 1 ) { - $q .= $pre ."(n.creation >= ". $this->dbconn->Date($from) .")"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); - $this->filter['from'] = $from; - } - # End Date for search - $to = new TUTOS_Date_Time(0); - if ( isset($_GET['td']) ) { - $to->setDateTime($_GET['td']); - } else { - $to->setDateTimeF("t"); - # remember this -# session_register('notesearchto'); - $_SESSION['notesearchto'] = $to->getYYYYMMDD(); - } - if ( $to->notime != 1 ) { - $q .= $pre ."(n.creation <= ". $this->dbconn->Date($to) .")"; - $pre = "AND "; - $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); - $this->filter['to'] = $to; - } - - $this->q = $j.$q; -# check_dbacl($this->dbconn, $this->q, $this->user->id); WONT WORK - - # sorting - $xxx = ""; - $this->link2 = $this->link1; - order_parse($this->q,$this->link1,$xxx,$xxx,"n.creation DESC"); - # display default sortorder - if (!isset($_GET['xf'])) { - $_GET['xf'] = "n.creation"; - $_GET['xo'] = 2; - } - - if ($this->stop) { - return; - } - $this->result = $this->dbconn->Exec($this->q); - if ( 0 == $this->result->numrows()) { - $this->redirect = "note_select.php?msg=". UrlEncode($lang['Err0048']); - $this->result->free(); - } - - # menu - $x = note::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addMenu($x); - } + /** + * display the form + */ + Function info() { + global $tutos,$lang; + + $r = ''; + $n = $this->result->numrows(); + + $blist = array(); + // Make a big array of all visible notes + $x = 0; + while ( $x < $n ) { + $b = new note($this->dbconn); + $b->read_result($this->result,$x); + $x++; + if ( ! $b->see_ok() ) { + continue; + } + $blist[] = &$b; + unset($b); + } + $this->result->free(); + $n = count($blist); + if ( 0 == $n) { + $r .= $this->error($lang['Err0048']); + return $r; + } + + $r .= $this->actionformStart("note_overview.php"); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + $r .= $this->orderHeader("n.creation",$lang['created'],$this->link2); + $r .= $this->orderHeader("",$lang['NoteName'],$this->link2); + $r .= $this->orderHeader("link_id",$lang['NoteReference'],$this->link2); + $r .= $this->orderHeader("remember",$lang['NoteRemember'],$this->link2); + $r .= $this->orderHeader("n.creator",$lang['NoteCreator'],$this->link2); + $this->flds = 5; + $r .= show_custom_overview_headers($this,'note',$this->link2); + if ( $tutos[massupdate] == 1 ) { + $r .= " <th nowrap=\"nowrap\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + } + $r .= "</tr>\n"; + $r .= "</thead>\n"; + + if ( $this->start == -1 ) { + // Show the last part + $a = $n - $tutos[maxshow]; + $end = $n; + $this->start = $a; + } else { + $a = $this->start; + $end = $this->start + $tutos[maxshow]; + } + + $this->filter['name'] = prepare_regpattern($this->filter['name']); + $line = 1; + while ( ($a < $n) && ($a < $end) ) { + $b = &$blist[$a]; + $b->read_reference(); + + $r .= $this->OverviewRowStart($line); + $r .= " <td>". $b->creation->getDateTime() ."</td>\n"; + $x = myentities($b->getFullName()); + if ( $this->filter['name'] != "" ) { + $x = eregi_replace("(". $this->filter['name'] .")","<span class=\"found\">\\1</span>",$x); + } + $r .= ' <td>'. makelink($b->getUrl(),$x) ."</td>\n"; + $r .= ' <td> '. $b->ref->getLink() ."</td>\n"; + $r .= ' <td> '. $b->remember->getDateTime() ."</td>\n"; + $r .= ' <td> '. ((!(is_numeric($b->creator) && $b->creator == -1)) ? $b->creator->getLink($b->creator->getShortname()):$lang['HistoryDeleted']) ."</td>\n"; + $r .= show_custom_overview_data($this,'note',$b); + if ( $tutos[massupdate] == 1 ) { + $r .= " <td align=\"center\">\n"; + if ( $b->mod_ok() ) { + $r .= '<input name="mark[]" type="checkbox" value="'. $b->id ."\" />\n"; + } else { + $r .= "-\n"; + } + $r .= "</td>\n"; + } + $r .= $this->OverviewRowEnd($line++); + unset($b); + $a++; + } + + $r .= $this->list_navigation($this->link1,$this->flds + $tutos[massupdate],$this->start,$a,$n); + if ( $tutos[massupdate] == 1 ) { + $r .= $this->UpdateRowStart($this->flds - 1); + $r .= sprintf($lang['withmarked'],$lang['Notes']); + $r .= " <select name=\"action\">\n"; + $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; + $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; + $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; + if (class_exists('watchlist')) { + $r .= watchlist::action_options(); + } + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(2); + } + $r .= $this->OverviewTableEnd(); + $r .= $this->actionformEnd("note_overview.php"); + return $r; + } + /** + * action via massupdate + */ + Function action() { + global $lang,$msg; + + if ( $_GET['action'] == -2 ) { + $this->dbconn->Begin("WORK"); + foreach ($_GET['mark'] as $val) { + $b = new note($this->dbconn); + $b = $b->read($val,$b); + if ( $b->id != $val ) { + continue; + } + if ( $b->del_ok() ) { + $msg .= $lang['Delete'].":". $b->getFullName() ."<br />"; + $msg .= $b->delete(); + } else { + $msg .= $b->getLink() .": ". sprintf($lang['Err0023'],$lang[$b->getType()]) ."<br />\n"; + } + unset($b); + } + $this->dbconn->Commit("WORK"); + return; + } + if ( $_GET['action'] == -4 ) { + $this->redirect = "../". acl_action(); + return; + } + if (class_exists('watchlist')) { + watchlist::parse_action($this->user); + } + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; + + $this->name = $lang['NotesOverview']; + $this->css_class = 'overviewbox'; + + if ( ! $this->user->feature_ok(usenotes,PERM_SEE) ) { + $msg .= sprintf($lang['Err0022'],"'". $this->name ."'"); + $this->stop = true; + } + + $this->link1 = "note/note_overview.php"; + $this->filter = array(); + + $reftype = ""; + $name = ""; + $nsrn = ""; + $nscr = ""; + + if ( isset($_GET['reftype']) ) { + $reftype = $_GET['reftype']; + } + if ( isset($_GET['name']) ) { + $name = $_GET['name']; + } + if ( isset($_GET['nsrn']) ) { + $nsrn = $_GET['nsrn']; + } + if ( isset($_GET['nscr']) ) { + $nscr = $_GET['nscr']; + } + + + $j = "SELECT DISTINCT n.* FROM ". $this->dbconn->prefix ."notes n "; // select + join + $q = ""; + $pre = " WHERE "; + + if ( ($name != "*") && ($name != "") ) { + $q .= " " . $pre ."(". $this->dbconn->Like("n.note",$name) ." OR ". $this->dbconn->Like("n.name",$name) .")"; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"name=".UrlEncode($name)); + $this->filter['name'] = $name; + } else { + $this->filter['name'] = ""; + } + + if ( isset($_GET['id']) ) { + if (false == is_numeric($_GET['id'])) { + $msg .= sprintf($lang['Err0012'],"id",$_GET['id']); + $this->stop = true; + } + $q .= " ". $pre ." n.id = ".$_GET['id']; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"id=". $_GET['id']); + } + + if ( isset($_GET['link_id']) ) { + if (false == is_numeric($_GET['link_id'])) { + $msg .= sprintf($lang['Err0012'],"link_id",$_GET['link_id']); + $this->stop = true; + } + $q .= " ". $pre ." n.link_id = ".$_GET['link_id']; + $pre = " AND "; + $this->link1 = addUrlParameter($this->link1,"link_id=". $_GET['link_id']); + } + + // References to display + if ( ($reftype > 0) || ($reftype > 0 && ($nsrn != "*") && ($nsrn != "")) ) { + if ( ! isset($nsrn) || ($nsrn == "*") ) { + $nsrn = ""; + } + if ( ($reftype == 1) || ($reftype == -1) ) { + $j .= ", ". $this->dbconn->prefix ."companies c "; + $q .= " ". $pre . "(n.link_id=c.id "; + if ( $nsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("c.name",$nsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 2) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."departments d "; + $q .= " ". $pre . "(n.link_id=d.id "; + if ( $nsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("d.name",$nsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 3) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."addresses a "; + $q .= $pre ."( ("; + $q .= $this->dbconn->Like("a.f_name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("a.m_name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("a.l_name",$nsrn) .")"; + $q .= " AND n.link_id=a.id )"; + $pre = " OR "; + } + if ( ($reftype == 4) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."bugs b"; + $q .= " ". $pre . "(n.link_id=b.id "; + if ( $nsrn != "" ) { + $q .= " AND ". $this->dbconn->Like("b.short",$nsrn); + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 5) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."products p"; + $q .= $pre ."( n.link_id=p.id "; + if ( $nsrn != "" ) { + $q .= " AND ("; + $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("p.version",$nsrn) .")"; + } + $q .= ")"; + $pre = " OR "; + } + if ( ($reftype == 6) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."teams t"; + $q .= $pre . "(n.link_id=t.id AND ". $this->dbconn->Like("t.name",$nsrn) .")"; + $pre = " OR "; + } + if ( ($reftype == 7) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."tasks k"; + $q .= $pre . "(n.link_id=k.id AND ". $this->dbconn->Like("k.name",$nsrn) .")"; + $pre = " OR "; + } + if ( ($reftype == 8) || ($reftype == -1) ) { + $j .= ",". $this->dbconn->prefix ."installations i"; + if ( ! stristr($j, "products") ) { + $j .= ",". $this->dbconn->prefix ."products p"; + } + $q .= $pre ."( n.link_id=i.id AND i.product_id=p.id AND ("; + $q .= $this->dbconn->Like("p.name",$nsrn) ." OR "; + $q .= $this->dbconn->Like("p.version",$nsrn) .") )"; + $pre = " OR "; + } + $pre = "AND "; + + $this->link1 = addUrlParameter($this->link1,"reftype=". $reftype); + $this->link1 = addUrlParameter($this->link1,"nsrn=". $nsrn); + // remember this + $_SESSION['notesearchreftype'] = $reftype; + $this->filter['reftype'] = $reftype; + } + if ( ($nscr != "*") && ($nscr != "") ) { + $j .= ", addresses "; + $q .= $pre ."( ("; + $q .= $this->dbconn->Like("addresses.f_name",$nscr) ." OR "; + $q .= $this->dbconn->Like("addresses.m_name",$nscr) ." OR "; + $q .= $this->dbconn->Like("addresses.l_name",$nscr) .")"; + $q .= " AND n.creator=addresses.id )"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"nscr=".UrlEncode($nscr)); + $this->filter['nscr'] = $nscr; + } + + // Start Date for search + $from = new TUTOS_Date_Time(0); + if ( isset($_GET['fd']) ) { + $from->setDateTime($_GET['fd']); + } else { + $from->setDateTimeF("f"); + // remember this + // session_register('notesearchfrom'); + $_SESSION['notesearchfrom'] = $from->getYYYYMMDD(); + } + if ( $from->notime != 1 ) { + $q .= $pre ."(n.creation >= ". $this->dbconn->Date($from) .")"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"fd=".$from->getYYYYMMDD()); + $this->filter['from'] = $from; + } + // End Date for search + $to = new TUTOS_Date_Time(0); + if ( isset($_GET['td']) ) { + $to->setDateTime($_GET['td']); + } else { + $to->setDateTimeF("t"); + // remember this + $_SESSION['notesearchto'] = $to->getYYYYMMDD(); + } + if ( $to->notime != 1 ) { + $q .= $pre ."(n.creation <= ". $this->dbconn->Date($to) .")"; + $pre = "AND "; + $this->link1 = addUrlParameter($this->link1,"td=".$to->getYYYYMMDD()); + $this->filter['to'] = $to; + } + + $this->q = $j.$q; + //# check_dbacl($this->dbconn, $this->q, $this->user->id); WONT WORK + + // sorting + $xxx = ""; + $this->link2 = $this->link1; + order_parse($this->q,$this->link1,$xxx,$xxx,"n.creation DESC"); + // display default sortorder + if (!isset($_GET['xf'])) { + $_GET['xf'] = "n.creation"; + $_GET['xo'] = 2; + } + + if ($this->stop) { + return; + } + $this->result = $this->dbconn->Exec($this->q); + if ( 0 == $this->result->numrows()) { + $this->redirect = "note_select.php?msg=". UrlEncode($lang['Err0048']); + $this->result->free(); + } + + // menu + $x = note::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addMenu($x); + } } $l = new note_overview($current_user); Index: note_ins.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/note/note_ins.php,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- note_ins.php 8 Mar 2009 20:21:37 -0000 1.22 +++ note_ins.php 29 Mar 2009 18:25:41 -0000 1.23 @@ -18,76 +18,71 @@ require_once 'webelements.p3'; require_once 'permission.p3'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('note','ins'); loadmodule('note'); -/* Check Input */ +$msg = ''; $gotourl = 'note/note_new.php'; -$msg = ''; $u = new note($dbconn); if ( isset($_POST['id']) ) { - $u = $u->read($_POST['id'],$u); - $gotourl= addUrlParameter($gotourl,'id='. $u->id,true); + $u = $u->read($_POST['id'],$u); + $gotourl= addUrlParameter($gotourl,'id='. $u->id,true); } if ( empty($_POST['name']) ) { - $msg .= sprintf($lang['Err0009'],$lang['NoteName']) ."<br />"; - $gotourl = addBadField($gotourl,'name',true); + $msg .= sprintf($lang['Err0009'],$lang['NoteName']) ."<br />"; + $gotourl = addBadField($gotourl,'name',true); } else { - $u->setName(StripSlashes($_POST['name'])); - $gotourl= addUrlParameter($gotourl,'name='. UrlEncode($u->name),true); + $u->setName(StripSlashes($_POST['name'])); + $gotourl= addUrlParameter($gotourl,'name='. UrlEncode($u->name),true); } - if ( isset($_POST['etype']) ) { - $u->setEventType($_POST['etype']); - $gotourl= addUrlParameter($gotourl,"etype=". UrlEncode($u->etype),true); - } - if ( isset($_POST['note']) ) { - $u->setText(StripSlashes($_POST['note'])); - $gotourl= addUrlParameter($gotourl,"note=". UrlEncode($u->note),true); - } - if ( empty($_POST['link_id']) ) { - $msg .= "No Link ID given !<br />"; - } else { +if ( isset($_POST['etype']) ) { + $u->setEventType($_POST['etype']); + $gotourl= addUrlParameter($gotourl,"etype=". UrlEncode($u->etype),true); +} +if ( isset($_POST['note']) ) { + $u->setText(StripSlashes($_POST['note'])); + $gotourl= addUrlParameter($gotourl,"note=". UrlEncode($u->note),true); +} +if ( empty($_POST['link_id']) ) { + $msg .= "No Link ID given !<br />"; +} else { $u->setReference($_POST['link_id']); $gotourl= addUrlParameter($gotourl,"link_id=". $u->link_id,true); $u->read_reference(); - } +} - $r = new TUTOS_Date_Time(0); - $r->setDateTimeF("remember"); - $u->setRemember($r); +$r = new TUTOS_Date_Time(0); +$r->setDateTimeF("remember"); +$u->setRemember($r); - $gotourl= addUrlParameter($gotourl,"remember=". $u->remember->getYYYYMMDD(),true); - if ( !$r->checkDMY(true) ) { - $msg .= sprintf($lang['Err0038'],$lang['NoteRemember']) ."<br />"; - } +$gotourl= addUrlParameter($gotourl,"remember=". $u->remember->getYYYYMMDD(),true); +if ( !$r->checkDMY(true) ) { + $msg .= sprintf($lang['Err0038'],$lang['NoteRemember']) ."<br />"; +} - # - # Parse additional custom fields - # - $msg .= parse_custom_fields($u->gettype(),$u); - # other modules - $msg .= module_parseforms($current_user,$u,$gotourl); +# +# Parse additional custom fields +# +$msg .= parse_custom_fields($u->gettype(),$u); +# other modules +$msg .= module_parseforms($current_user,$u,$gotourl); - if ( $msg == "" ) { - $dbconn->Begin("WORK"); - $msg .= $u->save(); - $dbconn->Commit("WORK"); - $gotourl = $u->ref->getURL(); - } - $gotourl = addMessage($gotourl,$msg,true); - $gotourl = addSessionKey($gotourl,true); +if ( $msg == "" ) { + $dbconn->Begin("WORK"); + $msg .= $u->save(); + $dbconn->Commit("WORK"); + $gotourl = $u->ref->getURL(); +} - Header("Status: 302 Moved Temporarily"); - Header("Location: ". dirname(getBaseUrl()) ."/". $gotourl); - $dbconn->Close(); - /* - * CVS Info: $Id$ - * $Author$ - */ +leave_insert($dbconn,$gotourl,$msg); +/** + * CVS Info: $Id$ + * $Author$ + */ ?> \ No newline at end of file Index: note_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/note/note_new.php,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- note_new.php 13 Mar 2009 20:00:41 -0000 1.42 +++ note_new.php 29 Mar 2009 18:25:41 -0000 1.43 @@ -15,7 +15,7 @@ require_once 'webelements.p3'; require_once 'permission.p3'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('note','new'); loadmodule('note'); @@ -25,164 +25,158 @@ * change/modify/create a note */ class Note_new extends layout { - /** - * display the form - */ + /** + * display the form + */ Function info() { global $lang,$tutos,$table; + + $r = ''; + $this->width = 6; + $r .= "<form id=\"notenew\" name=\"notenew\" action=\"note_ins.php\" method=\"post\">\n"; + $r .= $this->DataTableStart(); + $r .= $this->Headline(); + $r .= $this->acl_line(true); + + if ( isset ($this->obj->id) && ( $this->obj->id != -1 ) ) { + $this->addhidden("id",$this->obj->id); + } + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['NoteName'],1,"name"); + $r .= ' <td colspan="5"><input id="name" size="'. min($table['note']['name'][size],40) .'" maxlength="'. $table['note']['name'][size] .'" name="name" value="'. myentities($this->obj->name) ."\" /></td>\n"; + $r .= "</tr>\n"; + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['NoteReference']); + $r .= " <td colspan=\"5\">\n"; + if ($this->obj->id == -1) { + $r .= $lang[$this->obj->ref->getType()] ." ". $this->obj->getRefLink() ."\n"; + $this->addhidden("link_id",$this->obj->link_id); + } else { + $r .= " <select name=\"link_id\">\n"; + foreach ($this->obj->plist as $i => $f) { + $r .= ' <option value="'. $i .'"'. ($i == $this->obj->link_id ? ' selected="selected">* ':'>') . $lang[$f->getType()] .': '. myentities($f->getFullName()) ."</option>\n"; + } + $r .= " </select>\n"; + } + $r .= " </td>\n"; + $r .= "</tr>\n"; + + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['NoteEventType'],0,"etype"); + $r .= " <td>\n"; + $r .= $this->obj->askEventType(); + $r .= " </td>\n"; + $r .= "</tr>\n"; + + $r .= "<tr>\n"; + $r .= $this->showfield($lang['NoteDescription'],0,"note"); + $r .= " <td colspan=\"5\"><textarea id=\"note\" rows=\"20\" cols=\"80\" name=\"note\">". $this->obj->note ."</textarea></td>\n"; + $r .= "</tr>\n"; + + $r .= "<tr>\n"; + $r .= $this->showfieldc($lang['NoteRemember'],0,"remember_d"); + $r .= " <td colspan=\"5\">\n"; + // reminders only make sense in the future + $r .= $this->obj->remember->EnterDateTime("remember",1,true); + $r .= " </td>\n"; + $r .= "</tr>\n"; - $this->width = 6; - echo "<form id=\"notenew\" name=\"notenew\" action=\"note_ins.php\" method=\"post\">\n"; - echo $this->DataTableStart(); - echo $this->Headline(); - echo $this->acl_line(true); - - if ( isset ($this->obj->id) && ( $this->obj->id != -1 ) ) { - $this->addhidden("id",$this->obj->id); - } - echo "<tr>\n"; - echo $this->showfieldc($lang['NoteName'],1,"name"); - echo ' <td colspan="5"><input id="name" size="'. min($table['note']['name'][size],40) .'" maxlength="'. $table['note']['name'][size] .'" name="name" value="'. myentities($this->obj->name) ."\" /></td>\n"; - echo "</tr>\n"; - echo "<tr>\n"; - echo $this->showfieldc($lang['NoteReference']); - echo " <td colspan=\"5\">\n"; - if ($this->obj->id == -1) { - echo $lang[$this->obj->ref->getType()] ." ". $this->obj->getRefLink() ."\n"; - $this->addhidden("link_id",$this->obj->link_id); - } else { - echo " <select name=\"link_id\">\n"; - foreach ($this->obj->plist as $i => $f) { - echo ' <option value="'. $i .'"'. ($i == $this->obj->link_id ? ' selected="selected">* ':'>') . $lang[$f->getType()] .': '. myentities($f->getFullName()) ."</option>\n"; - } - echo " </select>\n"; - } - echo " </td>\n"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo $this->showfieldc($lang['NoteEventType'],0,"etype"); - echo " <td>\n"; - echo $this->obj->askEventType(); - echo " </td>\n"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo $this->showfield($lang['NoteDescription'],0,"note"); - echo " <td colspan=\"5\"><textarea id=\"note\" rows=\"20\" cols=\"80\" name=\"note\">". $this->obj->note ."</textarea></td>\n"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo $this->showfieldc($lang['NoteRemember'],0,"remember_d"); - echo " <td colspan=\"5\">\n"; - # reminders only make sense in the future - echo $this->obj->remember->EnterDateTime("remember",1,true); - echo " </td>\n"; - echo "</tr>\n"; - - # - # Edit additional custom fields - # - echo edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); - # References to modules - echo module_addforms($this->user,$this->obj,6); - - echo "<tr>\n"; - if ( isset($this->obj->id) && ($this->obj->id != -1) ) { - echo submit_reset(0,1,2,1,2,0); - } else { - echo submit_reset(0,-1,2,1,2,0); - } - echo "</tr>\n"; - - echo $this->DataTableEnd(); - echo hiddenFormElements(); - echo $this->getHidden(); - echo $this->markBadFields(); - echo "</form>\n"; - echo $this->setfocus("notenew.name"); - echo $lang['FldsRequired'] ."\n"; - } - /** - * navigate - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang,$current_user; - - $this->obj = new note($this->dbconn); - if ( isset($_GET['id']) ){ - $this->obj = $this->obj->read($_GET['id'],$this->obj); - $this->name = $lang['NoteMod']; - if ( is_numeric($this->obj) && $this->obj == -1 ) { - $msg .= sprintf($lang['Err0040'],$lang['Note']); - $this->stop = true ; - return; - } - } else { - $this->name = $lang['NoteCreation']; - } - if ( isset($_GET['link_id']) ){ - $this->obj->link_id = $_GET['link_id']; - } - if ( isset($_GET['note']) ){ - $this->obj->note = StripSlashes($_GET['note']); - } - if ( isset($_GET['name']) ){ - $this->obj->name = StripSlashes($_GET['name']); - } - if ( isset($_GET['remember']) ) { - $this->obj->remember->setDateTime($_GET['remember']); - } - if ( isset($_GET['etype']) ){ - $this->obj->etype = $_GET['etype']; - } - if ( ! $this->obj->mod_ok() ) { - $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); - $this->stop = true; - } - $this->obj->read_reference(); - $this->obj->read_relations(); - - if ( is_object($this->obj->ref) && !$this->obj->ref->use_ok() ) { - $msg .= sprintf($lang['Err0001'],$lang[$this->obj->ref->getType()],$this->obj->ref->getFullName()); - $this->stop = true; - } - - if (($this->obj->id < 0) && !$this->user->feature_ok(usenotes,PERM_NEW) ) { - $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); - $this->stop = true; - } else if (! $this->obj->mod_ok() ) { - $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); - $this->stop = true; - } - - # - # preset additional custom fields - # - preset_custom_fields($this->obj->gettype(),$this->obj); - # menu - $x = note::getSelectLink($this->user,$lang['Search']); - $x[category][] = "obj"; - $this->addmenu($x); - - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelURL(), - text => $lang['Delete'], - info => $lang['NoteDelete'], - confirm => true, - category => array("note","del","obj") - ); - $this->addMenu($x); - } + // Edit additional custom fields + $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,6); + // References to modules + $r .= module_addforms($this->user,$this->obj,6); + + $r .= "<tr>\n"; + if ( isset($this->obj->id) && ($this->obj->id != -1) ) { + $r .= submit_reset(0,1,2,1,2,0); + } else { + $r .= submit_reset(0,-1,2,1,2,0); + } + $r .= "</tr>\n"; - add_module_newlinks($this,$this->obj); - } + $r .= $this->DataTableEnd(); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= $this->markBadFields(); + $r .= "</form>\n"; + $r .= $this->setfocus("notenew.name"); + $r .= $lang['FldsRequired'] ."\n"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang,$current_user; + + $this->obj = new note($this->dbconn); + if ( isset($_GET['id']) ){ + $this->obj = $this->obj->read($_GET['id'],$this->obj); + $this->name = $lang['NoteMod']; + if ( is_numeric($this->obj) && $this->obj == -1 ) { + $msg .= sprintf($lang['Err0040'],$lang['Note']); + $this->stop = true ; + return; + } + } else { + $this->name = $lang['NoteCreation']; + } + if ( isset($_GET['link_id']) ){ + $this->obj->link_id = $_GET['link_id']; + } + if ( isset($_GET['note']) ){ + $this->obj->note = StripSlashes($_GET['note']); + } + if ( isset($_GET['name']) ){ + $this->obj->name = StripSlashes($_GET['name']); + } + if ( isset($_GET['remember']) ) { + $this->obj->remember->setDateTime($_GET['remember']); + } + if ( isset($_GET['etype']) ){ + $this->obj->etype = $_GET['etype']; + } + if ( ! $this->obj->mod_ok() ) { + $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); + $this->stop = true; + } + $this->obj->read_reference(); + $this->obj->read_relations(); + + if ( is_object($this->obj->ref) && !$this->obj->ref->use_ok() ) { + $msg .= sprintf($lang['Err0001'],$lang[$this->obj->ref->getType()],$this->obj->ref->getFullName()); + $this->stop = true; + } + + if (($this->obj->id < 0) && !$this->user->feature_ok(usenotes,PERM_NEW) ) { + $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]); + $this->stop = true; + } else if (! $this->obj->mod_ok() ) { + $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]); + $this->stop = true; + } + + // preset additional custom fields + preset_custom_fields($this->obj->gettype(),$this->obj); + // menu + $x = note::getSelectLink($this->user,$lang['Search']); + $x[category][] = "obj"; + $this->addmenu($x); + + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelURL(), + text => $lang['Delete'], + info => $lang['NoteDelete'], + confirm => true, + category => array("note","del","obj") + ); + $this->addMenu($x); + } + + add_module_newlinks($this,$this->obj); + } } + $l = new Note_new($current_user); $l->display(); $dbconn->Close(); Index: note_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/note/note_show.php,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- note_show.php 25 Feb 2009 19:16:40 -0000 1.39 +++ note_show.php 29 Mar 2009 18:25:41 -0000 1.40 @@ -16,123 +16,118 @@ require_once 'permission.p3'; -/* Check if user is allowed to use it */ +// Check if user is allowed to use it check_user(); loadmodules('note','show'); loadmodule('note'); loadlayout(); - + /** * display a note */ class Note_show extends layout { - /** - * - */ - Function info() { - global $lang,$tutos; - - echo $this->DataTableStart(); - echo "<tr>\n"; - echo ' <th colspan="3">'. $lang['Note'] ."</th>\n"; - echo $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); - echo "</tr>\n"; - - echo $this->CreatorInfoLine($this->obj,4); - - echo "<tr>\n"; - echo $this->showfield($lang['NoteName']); - echo "<td colspan=\"3\"><b><font size=\"+1\">". myentities($this->obj->name) ."</font></b></td>"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo $this->showfield($lang['NoteEventType']); - echo $this->showdata($this->obj->getEventType()); - echo "</tr>\n"; - - echo "<tr>\n"; - echo $this->showfield($lang['NoteReference']); - echo $this->showdata($this->obj->getRefLink(),3); - echo "</tr>\n"; - - if ( $this->obj->remember->notime != 1 ) { - echo "<tr>\n"; - echo $this->showfield($lang['NoteRemember']); - echo "<td colspan=\"3\">". $this->obj->remember->getDateTime() ."</td>"; - echo "</tr>\n"; - } - echo "<tr>\n"; - echo " <td colspan=\"4\" class=\"pre\"><pre>". wordwrap(urlReplace($this->obj->note),80) ."</pre></td>"; - echo "</tr>\n"; - - # - # Show additional custom fields - # - echo show_custom_fields($this,$this->obj->gettype(),$this->obj,4); - # References to modules - echo show_module_infolists($this->user,$this->obj,4); - echo $this->obj->getHistoryLink(4); - - echo $this->DataTableEnd(); - } - /** - * navigation - */ - Function navigate() { - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; - - $this->name = $lang['NoteDetail']; - $this->obj = new note($this->dbconn); - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - } - if ( !is_object($this->obj) ) { - $msg .= sprintf($lang['Err0040'],$lang['Note']); - $this->stop = true; - $this->format = "html"; - return; - } else if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - } else if ( $this->obj->id < 0 ) { - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - $this->stop = true; - } else { - $this->obj->read_reference(); - } - # menu - $m = note::getSelectLink($this->user, $lang['Search']); - $m[category][] = "obj"; - $this->addmenu($m); - - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - $x = array( url => $this->obj->getModURL(), - text => $lang['Modify'], - info => $lang['NoteMod'], - category => array("note","mod","obj") - ); - $this->addMenu($x); - } - if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { - $x = array( url => $this->obj->getDelURL(), - text => $lang['Delete'], - info => $lang['NoteDelete'], - confirm => true, - category => array("note","del","obj") - ); - $this->addMenu($x); - } + /** + * + */ + Function info() { + global $lang,$tutos; + + $r = ''; + $r .= $this->DataTableStart(); + $r .= "<tr>\n"; + $r .= ' <th colspan="3">'. $lang['Note'] ."</th>\n"; + $r .= $this->showGuiIcons('<th class="icons">','</th>',$this->obj,$this->obj,array('mod','del','perm'),false); + $r .= "</tr>\n"; + + $r .= $this->CreatorInfoLine($this->obj,4); + + $r .= "<tr>\n"; + $r .= $this->showfield($lang['NoteName']); + $r .= "<td colspan=\"3\"><b><font size=\"+1\">". myentities($this->obj->name) ."</font></b></td>"; + $r .= "</tr>\n"; + + $r .= "<tr>\n"; + $r .= $this->showfield($lang['NoteEventType']); + $r .= $this->showdata($this->obj->getEventType()); + $r .= "</tr>\n"; + + $r .= "<tr>\n"; + $r .= $this->showfield($lang['NoteReference']); + $r .= $this->showdata($this->obj->getRefLink(),3); + $r .= "</tr>\n"; + + if ( $this->obj->remember->notime != 1 ) { + $r .= "<tr>\n"; + $r .= $this->showfield($lang['NoteRemember']); + $r .= '<td colspan="3">'. $this->obj->remember->getDateTime() ."</td>"; + $r .= "</tr>\n"; + } + $r .= "<tr>\n"; + $r .= ' <td colspan="4" class="pre"><pre>'. wordwrap(urlReplace($this->obj->note),80) ."</pre></td>"; + $r .= "</tr>\n"; - add_module_addlinks($this,$this->obj); - # add this page to the browsehistory of the users session - $this->addtohistory(); - } - } + // Show additional custom fields + $r .= show_custom_fields($this,$this->obj->gettype(),$this->obj,4); + // References to modules + $r .= show_module_infolists($this->user,$this->obj,4); + $r .= $this->obj->getHistoryLink(4); + + $r .= $this->DataTableEnd(); + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; + + $this->name = $lang['NoteDetail']; + $this->obj = new note($this->dbconn); + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + } + if ( !is_object($this->obj) ) { + $msg .= sprintf($lang['Err0040'],$lang['Note']); + $this->stop = true; + $this->format = "html"; + return; + } else if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + } else if ( $this->obj->id < 0 ) { + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + $this->stop = true; + } else { + $this->obj->read_reference(); + } + // menu + $m = note::getSelectLink($this->user, $lang['Search']); + $m[category][] = "obj"; + $this->addmenu($m); + + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $x = array( url => $this->obj->getModURL(), + text => $lang['Modify'], + info => $lang['NoteMod'], + category => array("note","mod","obj") + ); + $this->addMenu($x); + } + if ( ($this->obj->id > 0) && $this->obj->del_ok() ) { + $x = array( url => $this->obj->getDelURL(), + text => $lang['Delete'], + info => $lang['NoteDelete'], + confirm => true, + category => array("note","del","obj") + ); + $this->addMenu($x); + } + + add_module_addlinks($this,$this->obj); + // add this page to the browsehistory of the users session + $this->addtohistory(); + } +} $l = new Note_show($current_user); $l->display(); @@ -141,4 +136,4 @@ <!-- CVS Info: $Id$ $Author$ ---> +--> \ No newline at end of file |
From: Gero K. <gok...@us...> - 2009-03-29 18:25:48
|
Update of /cvsroot/tutos/tutos/php/mailbox In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2510/php/mailbox Modified Files: mailbox_show.php Log Message: big step towards next release. reworked most output related files in order to deliver output as string and not longer in the putput buffer. This allows more intelligence in the layout classes. more to come ! Index: mailbox_show.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/mailbox/mailbox_show.php,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- mailbox_show.php 13 Mar 2009 20:00:41 -0000 1.19 +++ mailbox_show.php 29 Mar 2009 18:25:41 -0000 1.20 @@ -12,8 +12,8 @@ */ $tutos['base'] = "../.."; ini_set("include_path",".."); -include_once 'webelements.p3'; -include_once 'permission.p3'; +require_once 'webelements.p3'; +require_once 'permission.p3'; // Check if user is allowed to use it check_user(); @@ -25,393 +25,393 @@ * show a overview of mails */ class Mailbox_show extends layout { - /** - * display the info - */ - Function info() { - global $lang,$tutos; - - if ( $this->doask ) { - $this->obj->ask_password(); - return; - } - if ( $this->obj->mbox == "" ) { - echo $this->error("failed"); - return; - } - - - $this->obj->getfolders(); - if (count($this->obj->allfolders) > 0) { - echo "<form name=\"folderjump\" method=\"get\" action=\"mailbox_show.php\">\n"; - echo $lang['MailActionGoto']; - $this->addHidden("id",$this->obj->id); - echo "<select name=\"path\">\n"; - @reset($this->obj->allfolders); - @ksort($this->obj->allfolders); - while (list ($key, $val) = @each($this->obj->allfolders)) { - echo "<option value=\"". base64_encode($key) ."\"". ($this->obj->addpath == $key ? " selected":"") .">+". myentities($val) ."</option>\n"; - } - echo "</select>\n"; - echo "<input type=\"submit\" value=\"". $lang['Enter'] ."\" title=\"OK\" />\n"; - hiddenFormElements(); - echo $this->getHidden(); - echo "</form>\n"; - } - - $this->obj->check(); - if ( $this->search != "" ) { - $headers = imap_sort($this->obj->mbox,$this->xf -1,($this->xo -1),SE_UID,'TEXT "'. $this->search .'"'); - } else { - $headers = imap_sort($this->obj->mbox,$this->xf -1,($this->xo -1),SE_UID); - } - - $this->obj->errors(); - if ($headers == false) { - echo "<b>". sprintf($lang['MailCountInfo0'],$this->obj->addpath) ."</b><br />"; - return; - } - - $cnt = count($headers); - if ( $this->search ) { - echo "<b>". sprintf($lang['MailCountInfoS'],$cnt,$this->search) ."</b><br />"; - } else { - echo "<b>". sprintf($lang['MailCountInfo'],$cnt) ."</b><br />"; - } - - echo $this->actionformStart("mailbox_show.php"); - if ( $this->obj->addpath != "" ) { - $this->addHidden("path",base64_encode($this->obj->addpath)); - } - $this->addHidden("search",$this->search); - echo $this->OverviewTableStart(); - echo "<thead>\n"; - echo "<tr>\n"; - echo " <th colspan=\"7\" class=\"nodeco\">". $this->obj->getFullname().' ---> '; - echo menulink($this->obj->parent->getUrl(),$lang[$this->obj->parent->gettype()].' '.$this->obj->parent->getFullname()); - if ( $this->obj->email != "" ) { - echo " mails sent to <". $this->obj->email .">\n"; - } - echo " </th>\n"; - echo "</tr>\n"; - if ( $this->obj->addpath != "" ) { - echo "<tr>\n"; - echo ' <th colspan="7">'. $this->theme->getImage(folder,'list') .' '. myentities($this->obj->addpath). "</th>\n"; - echo "</tr>\n"; - } - echo "<tr>\n"; - echo " <th>ID</th>\n"; - echo $this->orderHeader(1+SORTDATE,$lang['MailboxSDate'],$this->link1); - echo $this->orderHeader(1+SORTSUBJECT,$lang['MailboxSubject'],$this->link1); - echo $this->orderHeader('',$lang['MailboxSender'],$this->link1); - echo $this->orderHeader('',$lang['MailboxFlags'],$this->link1); - echo $this->orderHeader(1+SORTSIZE,$lang['MailSize'],$this->link1); - echo " <th class=\"over1\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; - echo "</tr>\n"; - echo "</thead>\n"; - - $n = 0; - if ( $this->start == -1 ) { - $this->start = $cnt - $tutos[maxshow]; - $end = $cnt; - } else { - $end = $this->start + $tutos[maxshow]; - } - - $d = new TUTOS_Date_Time(); - - - foreach ($headers as $hkey => $hval) { - flush(); - $n++; - $sbj = ""; - if ( $n < $this->start ) { - continue; - } - if ( $n > $end ) { - break; - } - $s = ""; - $hdr = imap_headerinfo($this->obj->mbox,imap_msgno($this->obj->mbox,$hval) ); - $id = $hkey; - $this->obj->errors("mail headers of mail ". $id); + /** + * display the info + */ + Function info() { + global $lang,$tutos; + + $r = ''; + if ( $this->doask ) { + return $this->obj->ask_password(); + } + if ( $this->obj->mbox == "" ) { + return $this->error("failed"); + } - $u = trim(imap_uid($this->obj->mbox,$hdr->Msgno)); -# echo $hval ." ". $hkey ." ". $u ."<br />"; + + $this->obj->getfolders(); + if (count($this->obj->allfolders) > 0) { + $r .= "<form name=\"folderjump\" method=\"get\" action=\"mailbox_show.php\">\n"; + $r .= $lang['MailActionGoto']; + $this->addHidden("id",$this->obj->id); + $r .= "<select name=\"path\">\n"; + @reset($this->obj->allfolders); + @ksort($this->obj->allfolders); + while (list ($key, $val) = @each($this->obj->allfolders)) { + $r .= "<option value=\"". base64_encode($key) ."\"". ($this->obj->addpath == $key ? " selected":"") .">+". myentities($val) ."</option>\n"; + } + $r .= "</select>\n"; + $r .= "<input type=\"submit\" value=\"". $lang['Enter'] ."\" title=\"OK\" />\n"; + hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; + } - $d->setDateTimeTS($hdr->udate); - echo $this->OverviewRowStart($n); - echo ' <td class="over1">'. makelink("mailbox/mail_show.php?mno=". $u ."&id=". $this->obj->id ."&path=". base64_encode($this->obj->addpath) ,$this->theme->getImage(mail,'list') . sprintf("%'_6d",$id) ,"") ."</td>\n"; - echo " <td>"; - if ( $hdr->date ) { - echo $hdr->date; - } else { - echo $d->getDateTime(); - } - echo " </td>\n"; - echo ' <td>'; - if ( isset($hdr->subject) ) { - $s = iconv_mime_decode($hdr->subject,ICONV_MIME_DECODE_CONTINUE_ON_ERROR,$lang['content_encoding']); - if ( $this->search ) { - $s = eregi_replace("(". $this->search .")","<span class=\"found\">\\1</span>",$s); - } - echo " ". $s; - } else { - echo "<i><font size=\"-2\">". $lang['MailNoSubject'] ."</font></i>"; - } - echo " </td>\n"; - echo " <td>\n"; - $pre = ''; - if ( isset($hdr->from) ) { - @reset($hdr->from); - while (list ($key,$val) = @each ($hdr->from)) { - echo $pre; - $adr = $this->obj->make_mailto($val); - $from = ''; - if ( isset($val->personal) ) { + $this->obj->check(); + if ( $this->search != "" ) { + $headers = imap_sort($this->obj->mbox,$this->xf -1,($this->xo -1),SE_UID,'TEXT "'. $this->search .'"'); + } else { + $headers = imap_sort($this->obj->mbox,$this->xf -1,($this->xo -1),SE_UID); + } + + $this->obj->errors(); + if ($headers == false) { + $r .= "<b>". sprintf($lang['MailCountInfo0'],$this->obj->addpath) ."</b><br />"; + return; + } + + $cnt = count($headers); + if ( $this->search ) { + $r .= "<b>". sprintf($lang['MailCountInfoS'],$cnt,$this->search) ."</b><br />"; + } else { + $r .= "<b>". sprintf($lang['MailCountInfo'],$cnt) ."</b><br />"; + } + + $r .= $this->actionformStart("mailbox_show.php"); + if ( $this->obj->addpath != "" ) { + $this->addHidden("path",base64_encode($this->obj->addpath)); + } + $this->addHidden("search",$this->search); + $r .= $this->OverviewTableStart(); + $r .= "<thead>\n"; + $r .= "<tr>\n"; + $r .= " <th colspan=\"7\" class=\"nodeco\">". $this->obj->getFullname().' ---> '; + $r .= menulink($this->obj->parent->getUrl(),$lang[$this->obj->parent->gettype()].' '.$this->obj->parent->getFullname()); + if ( $this->obj->email != "" ) { + $r .= " mails sent to <". $this->obj->email .">\n"; + } + $r .= " </th>\n"; + $r .= "</tr>\n"; + if ( $this->obj->addpath != "" ) { + $r .= "<tr>\n"; + $r .= ' <th colspan="7">'. $this->theme->getImage(folder,'list') .' '. myentities($this->obj->addpath). "</th>\n"; + $r .= "</tr>\n"; + } + $r .= "<tr>\n"; + $r .= " <th>ID</th>\n"; + $r .= $this->orderHeader(1+SORTDATE,$lang['MailboxSDate'],$this->link1); + $r .= $this->orderHeader(1+SORTSUBJECT,$lang['MailboxSubject'],$this->link1); + $r .= $this->orderHeader('',$lang['MailboxSender'],$this->link1); + $r .= $this->orderHeader('',$lang['MailboxFlags'],$this->link1); + $r .= $this->orderHeader(1+SORTSIZE,$lang['MailSize'],$this->link1); + $r .= " <th class=\"over1\"><input type=\"checkbox\" name=\"checkit\" "CheckAll2();\" /></th>\n"; + $r .= "</tr>\n"; + $r .= "</thead>\n"; + + $n = 0; + if ( $this->start == -1 ) { + $this->start = $cnt - $tutos[maxshow]; + $end = $cnt; + } else { + $end = $this->start + $tutos[maxshow]; + } + + $d = new TUTOS_Date_Time(); + + + foreach ($headers as $hkey => $hval) { + flush(); + $n++; + $sbj = ""; + if ( $n < $this->start ) { + continue; + } + if ( $n > $end ) { + break; + } + $s = ""; + $hdr = imap_headerinfo($this->obj->mbox,imap_msgno($this->obj->mbox,$hval) ); + $id = $hkey; + $this->obj->errors("mail headers of mail ". $id); + + $u = trim(imap_uid($this->obj->mbox,$hdr->Msgno)); +# $r .= $hval ." ". $hkey ." ". $u ."<br />"; + + $d->setDateTimeTS($hdr->udate); + $r .= $this->OverviewRowStart($n); + $r .= ' <td class="over1">'. makelink("mailbox/mail_show.php?mno=". $u ."&id=". $this->obj->id ."&path=". base64_encode($this->obj->addpath) ,$this->theme->getImage(mail,'list') . sprintf("%'_6d",$id) ,"") ."</td>\n"; + $r .= " <td>"; + if ( $hdr->date ) { + $r .= $hdr->date; + } else { + $r .= $d->getDateTime(); + } + $r .= " </td>\n"; + $r .= ' <td>'; + if ( isset($hdr->subject) ) { + $s = iconv_mime_decode($hdr->subject,ICONV_MIME_DECODE_CONTINUE_ON_ERROR,$lang['content_encoding']); + if ( $this->search ) { + $s = eregi_replace("(". $this->search .")","<span class=\"found\">\\1</span>",$s); + } + $r .= " ". $s; + } else { + $r .= "<i><font size=\"-2\">". $lang['MailNoSubject'] ."</font></i>"; + } + $r .= " </td>\n"; + $r .= " <td>\n"; + $pre = ''; + if ( isset($hdr->from) ) { + @reset($hdr->from); + while (list ($key,$val) = @each ($hdr->from)) { + $r .= $pre; + $adr = $this->obj->make_mailto($val); + $from = ''; + if ( isset($val->personal) ) { # $x = imap_mime_header_decode($val->personal); # foreach ($x as $f) { # $from .= $f->text; # } - $from = decodeheader($val->personal); - echo AsEmail($from,$adr,$from,"Re:". $s); - } else { - echo AsEmail($adr,$adr,"","Re:". $s); - } - $pre = "<br />\n"; - } - } - echo " </td>\n"; - echo " <td> ". $hdr->Recent . $hdr->Unseen . $hdr->Answered . $hdr->Deleted . $hdr->Draft . $hdr->Flagged ."</td>\n"; - # pretty format size - $s = $hdr->Size; - $x = "Bytes"; - if ($s > 1024) { - $s = sprintf("%01.2f",$hdr->Size / 1024); - $x = "kB"; - } - if ($s > 1024) { - $s = sprintf("%01.2f",$hdr->Size / (1024*1024)); - $x = "MB"; - } - echo " <td align=\"right\">". $s ." ". $x ."</td>\n"; - - echo " <td><center>\n"; - echo ' <input name="mark[]" type="checkbox" value="'. $u ."\" />\n"; - echo " </center></td>\n"; - echo $this->OverviewRowEnd($n); - flush(); - unset ($hdr); - } - - - $l = $this->obj->getUrl(); - $l = addUrlParameter($l,"path=".base64_Encode($this->obj->addpath)); - $l = addUrlParameter($l,"xf=". $this->xf); - $l = addUrlParameter($l,"xo=". $this->xo); - if ( $this->search ) { - $l = addUrlParameter($l,"search=".$this->search); - } - - echo $this->list_navigation($l,7,$this->start,$n,$cnt); - - echo $this->UpdateRowStart(4); - echo sprintf($lang['withmarked'],$lang['Mails']); - echo "<select name=\"mtarget\">\n"; - echo ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; - @reset($this->obj->allfolders); - @ksort($this->obj->allfolders); - while (list ($key, $val) = @each($this->obj->allfolders)) { - if ( $val != $this->obj->addpath ) { - echo "<option value=\"". base64_encode("+". $key) ."\">". sprintf($lang['MailActionCopy'],$val) ."</option>\n"; - } - } - @reset($this->obj->allfolders); - @ksort($this->obj->allfolders); - while (list ($key, $val) = @each($this->obj->allfolders)) { - if ( $val != $this->obj->addpath ) { - echo "<option value=\"". base64_encode("-". $key) ."\">". sprintf($lang['MailActionMove'],$val) ."</option>\n"; - } - } - echo "<option value=\"". base64_encode("TRASH") ."\">". $lang['MailActionDel']."</option>\n"; - echo "<option value=\"". base64_encode("SEEN") ."\" >". sprintf($lang['SetTo'],$lang['MailboxFlags'],"SEEN") ."</option>\n"; - echo "<option value=\"". base64_encode("UNSEEN") ."\">". sprintf($lang['SetTo'],$lang['MailboxFlags'],"not SEEN") ."</option>\n"; - echo "<option value=\"". base64_encode("FLAG") ."\" >". sprintf($lang['SetTo'],$lang['MailboxFlags'],"FLAGGED") ."</option>\n"; - echo "<option value=\"". base64_encode("UNFLAG") ."\">". sprintf($lang['SetTo'],$lang['MailboxFlags'],"UNFLAGGED") ."</option>\n"; - echo "</select>\n"; - echo $this->UpdateRowEnd(3); - - - if ( ereg("imap",$this->obj->type) ) { - echo "<tr>\n"; - echo " <td colspan=\"3\">". $lang['MailNewFolder'] ."</td>\n"; - echo " <td colspan=\"3\">\n"; - echo " <input name=\"new\" />\n"; - echo " </td>\n"; - echo " <td colspan=\"1\"><input type=\"submit\" value=\"OK\" /></td>\n"; - echo "</tr>\n"; - } - - - echo $this->OverviewTableEnd(); - $this->addHidden("id",$this->obj->id); - hiddenFormElements(); - echo $this->getHidden(); - echo $this->actionformEnd("mailbox_show.php"); - } - /** - * navigate - */ - Function navigate() { - global $lang; - - echo "<tr><td>\n"; - if ( ($this->obj->id > 0) && $this->obj->see_ok() ) { - if ( $this->user->feature_ok(usemailboxes,PERM_SEL) ) { - $url = "mailbox/mail_select.php?id=". $this->obj->id ; - $url = addUrlParameter($url,"path=".base64_Encode($this->obj->addpath)); - echo menulink($url ,$lang['Search'],sprintf($lang['MailboxSearch'],$this->obj->getFullname())) ." <br />"; - } - } - - if ( ($this->obj->id > 0) && ($this->obj->addpath != "") ) { - echo confirmlink("mailbox/mailbox_show.php?id=". $this->obj->id ."&delfolder=". base64_Encode($this->obj->addpath) ,$lang['Delete'],sprintf($lang['MailDelFolderI'],$this->obj->addpath)) ." <br />"; - } - echo "</td></tr>\n"; - } - /** - * prepare - */ - Function prepare() { - global $msg,$lang; - - $this->obj = new mailbox($this->dbconn); - $this->name = $lang['MailboxOverview']; - $this->link1 = "mailbox/mailbox_show.php"; - if ( isset($_GET['xf']) ) { - $this->xf = $_GET['xf']; - } else { - $this->xf = 1+SORTDATE; - } - if ( isset($_GET['xo']) ) { - $this->xo = $_GET['xo']; - } else { - $this->xo = 2; - } - if ( isset($_GET['id']) ) { - $this->obj = $this->obj->read($_GET['id'],$this->obj); - $this->link1 = addUrlParameter($this->link1,"id=".UrlEncode($_GET['id'])); - } else if ( isset($_POST['id']) ) { - $this->obj = $this->obj->read($_POST['id'],$this->obj); - $this->link1 = addUrlParameter($this->link1,"id=".UrlEncode($_POST['id'])); - } else { - $this->stop = true; - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - } - if ( $this->obj->id < 1 ) { - $this->stop = true; - $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); - } else if ( ! $this->obj->see_ok() ) { - $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); - $this->stop = true; - } - - $nopw = ($this->obj->pw == "" ); - $this->doask = false; - $x = sprintf("mpw%d",$this->obj->id); - if ( isset($_POST['mbpw']) ) { - $this->obj->pw = $_POST['mbpw']; - $_SESSION[$x] = $this->obj->pw; - } else if ( isset($_SESSION[$x]) ) { - $this->obj->pw = $_SESSION[$x]; - } - if ( isset($_GET['path']) ) { - $this->path = base64_Decode($_GET['path']); - $this->obj->setPath($this->path); - $this->link1 = addUrlParameter($this->link1,"path=".UrlEncode($_GET['path'])); - } else { - $this->path = ""; - } - if (! isset($_GET['search']) ) { - $this->search = ""; - } else { - $this->search = $_GET['search']; - } - - if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { - $x = array( url => "mailbox/mailbox_new.php?id=". $this->obj->id, - text => $lang['Modify'], - info => sprintf($lang['MailboxModifyI'],$this->obj->getFullname()), - category => array("mailbox","mod","obj") - ); - $this->addMenu($x); - } - - # Open the box - if ( ($this->stop == false) ) { -# echo $this->obj->pw ." ". $this->obj->getConnString(); -# flush(); - if (false == $this->obj->open()) { - if ( $nopw ) { - $this->doask = true; - } else { - $this->stop = true; - } - return; - } - } - - # actions - if ( $this->stop == false ) { - # Delete a mail - if ( isset($_GET['del']) ) { - $this->obj->delete_mail($_GET['del']); - $msg .= $lang['MailDeleted']; - } - # Delete a folder - if ( isset($_GET['delfolder']) ) { - if ( $_GET['delfolder'] != "" ){ - $this->obj->deletefolder(base64_Decode($_GET['delfolder'])); - $msg .= sprintf($lang['MailFolderDeleted'], base64_Decode($_GET['delfolder'])); - } - } - # Create new folder - if ( isset($_GET['new']) ) { - if ( $_GET['new'] != "" ){ - $this->obj->createfolder($_GET['new']); - $msg .= sprintf($lang['MailFolderCreated'], $_GET['new']); - } - } - # Some action - if ( isset($_GET['mtarget']) ) { - if ( $_GET['mtarget'] != -1 ) { - $mtarget = base64_decode($_GET['mtarget']); - @reset($_GET['mark']); - while (list ($key,$val) = @each ($_GET['mark'])) { - if ( $mtarget == "FLAG" ) { - $this->obj->flag_mail($val,"\\Flagged"); - } else if ( $mtarget == "UNFLAG" ) { - $this->obj->unflag_mail($val,"\\Flagged"); - } else if ( $mtarget == "SEEN" ) { - $this->obj->flag_mail($val,"\\Seen"); - } else if ( $mtarget == "UNSEEN" ) { - $this->obj->unflag_mail($val,"\\Seen"); - } else if ( $mtarget == "TRASH" ) { - $this->obj->delete_mail($val); - } else if ( ereg("^\+(.*)",$mtarget,$mm) ) { - imap_mail_copy($this->obj->mbox,$val,$this->obj->orgpath.$mm[1],FT_UID); - } else if ( ereg("^-(.*)",$mtarget,$mm) ) { - imap_mail_move($this->obj->mbox,$val,$this->obj->orgpath.$mm[1],FT_UID); - } - } - $this->obj->mail_expunge(); - } - } - } - - $this->addtohistory(); - - } + $from = decodeheader($val->personal); + $r .= AsEmail($from,$adr,$from,"Re:". $s); + } else { + $r .= AsEmail($adr,$adr,"","Re:". $s); + } + $pre = "<br />\n"; + } + } + $r .= " </td>\n"; + $r .= " <td> ". $hdr->Recent . $hdr->Unseen . $hdr->Answered . $hdr->Deleted . $hdr->Draft . $hdr->Flagged ."</td>\n"; +# pretty format size + $s = $hdr->Size; + $x = "Bytes"; + if ($s > 1024) { + $s = sprintf("%01.2f",$hdr->Size / 1024); + $x = "kB"; + } + if ($s > 1024) { + $s = sprintf("%01.2f",$hdr->Size / (1024*1024)); + $x = "MB"; + } + $r .= " <td align=\"right\">". $s ." ". $x ."</td>\n"; + + $r .= " <td><center>\n"; + $r .= ' <input name="mark[]" type="checkbox" value="'. $u ."\" />\n"; + $r .= " </center></td>\n"; + $r .= $this->OverviewRowEnd($n); + flush(); + unset ($hdr); + } + + + $l = $this->obj->getUrl(); + $l = addUrlParameter($l,"path=".base64_Encode($this->obj->addpath)); + $l = addUrlParameter($l,"xf=". $this->xf); + $l = addUrlParameter($l,"xo=". $this->xo); + if ( $this->search ) { + $l = addUrlParameter($l,"search=".$this->search); + } + + $r .= $this->list_navigation($l,7,$this->start,$n,$cnt); + + $r .= $this->UpdateRowStart(4); + $r .= sprintf($lang['withmarked'],$lang['Mails']); + $r .= "<select name=\"mtarget\">\n"; + $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; + @reset($this->obj->allfolders); + @ksort($this->obj->allfolders); + while (list ($key, $val) = @each($this->obj->allfolders)) { + if ( $val != $this->obj->addpath ) { + $r .= "<option value=\"". base64_encode("+". $key) ."\">". sprintf($lang['MailActionCopy'],$val) ."</option>\n"; + } + } + @reset($this->obj->allfolders); + @ksort($this->obj->allfolders); + while (list ($key, $val) = @each($this->obj->allfolders)) { + if ( $val != $this->obj->addpath ) { + $r .= "<option value=\"". base64_encode("-". $key) ."\">". sprintf($lang['MailActionMove'],$val) ."</option>\n"; + } + } + $r .= "<option value=\"". base64_encode("TRASH") ."\">". $lang['MailActionDel']."</option>\n"; + $r .= "<option value=\"". base64_encode("SEEN") ."\" >". sprintf($lang['SetTo'],$lang['MailboxFlags'],"SEEN") ."</option>\n"; + $r .= "<option value=\"". base64_encode("UNSEEN") ."\">". sprintf($lang['SetTo'],$lang['MailboxFlags'],"not SEEN") ."</option>\n"; + $r .= "<option value=\"". base64_encode("FLAG") ."\" >". sprintf($lang['SetTo'],$lang['MailboxFlags'],"FLAGGED") ."</option>\n"; + $r .= "<option value=\"". base64_encode("UNFLAG") ."\">". sprintf($lang['SetTo'],$lang['MailboxFlags'],"UNFLAGGED") ."</option>\n"; + $r .= "</select>\n"; + $r .= $this->UpdateRowEnd(3); + + + if ( ereg("imap",$this->obj->type) ) { + $r .= "<tr>\n"; + $r .= " <td colspan=\"3\">". $lang['MailNewFolder'] ."</td>\n"; + $r .= " <td colspan=\"3\">\n"; + $r .= " <input name=\"new\" />\n"; + $r .= " </td>\n"; + $r .= " <td colspan=\"1\"><input type=\"submit\" value=\"OK\" /></td>\n"; + $r .= "</tr>\n"; + } + + + $r .= $this->OverviewTableEnd(); + $this->addHidden("id",$this->obj->id); + hiddenFormElements(); + $r .= $this->getHidden(); + $r .= $this->actionformEnd("mailbox_show.php"); + return $r; + } + /** + * navigate + */ + Function navigate() { + global $lang; + + $r = ''; + $r .= "<tr><td>\n"; + if ( ($this->obj->id > 0) && $this->obj->see_ok() ) { + if ( $this->user->feature_ok(usemailboxes,PERM_SEL) ) { + $url = "mailbox/mail_select.php?id=". $this->obj->id ; + $url = addUrlParameter($url,"path=".base64_Encode($this->obj->addpath)); + $r .= menulink($url ,$lang['Search'],sprintf($lang['MailboxSearch'],$this->obj->getFullname())) ." <br />"; + } + } + + if ( ($this->obj->id > 0) && ($this->obj->addpath != "") ) { + $r .= confirmlink("mailbox/mailbox_show.php?id=". $this->obj->id ."&delfolder=". base64_Encode($this->obj->addpath) ,$lang['Delete'],sprintf($lang['MailDelFolderI'],$this->obj->addpath)) ." <br />"; + } + $r .= "</td></tr>\n"; + return $r; + } + /** + * prepare + */ + Function prepare() { + global $msg,$lang; + + $this->obj = new mailbox($this->dbconn); + $this->name = $lang['MailboxOverview']; + $this->link1 = "mailbox/mailbox_show.php"; + if ( isset($_GET['xf']) ) { + $this->xf = $_GET['xf']; + } else { + $this->xf = 1+SORTDATE; + } + if ( isset($_GET['xo']) ) { + $this->xo = $_GET['xo']; + } else { + $this->xo = 2; + } + if ( isset($_GET['id']) ) { + $this->obj = $this->obj->read($_GET['id'],$this->obj); + $this->link1 = addUrlParameter($this->link1,"id=".UrlEncode($_GET['id'])); + } else if ( isset($_POST['id']) ) { + $this->obj = $this->obj->read($_POST['id'],$this->obj); + $this->link1 = addUrlParameter($this->link1,"id=".UrlEncode($_POST['id'])); + } else { + $this->stop = true; + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + } + if ( $this->obj->id < 1 ) { + $this->stop = true; + $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]); + } else if ( ! $this->obj->see_ok() ) { + $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]); + $this->stop = true; + } + + $nopw = ($this->obj->pw == "" ); + $this->doask = false; + $x = sprintf("mpw%d",$this->obj->id); + if ( isset($_POST['mbpw']) ) { + $this->obj->pw = $_POST['mbpw']; + $_SESSION[$x] = $this->obj->pw; + } else if ( isset($_SESSION[$x]) ) { + $this->obj->pw = $_SESSION[$x]; + } + if ( isset($_GET['path']) ) { + $this->path = base64_Decode($_GET['path']); + $this->obj->setPath($this->path); + $this->link1 = addUrlParameter($this->link1,"path=".UrlEncode($_GET['path'])); + } else { + $this->path = ""; + } + if (! isset($_GET['search']) ) { + $this->search = ""; + } else { + $this->search = $_GET['search']; + } + + if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) { + $x = array( url => "mailbox/mailbox_new.php?id=". $this->obj->id, + text => $lang['Modify'], + info => sprintf($lang['MailboxModifyI'],$this->obj->getFullname()), + category => array("mailbox","mod","obj") + ); + $this->addMenu($x); + } + + // Open the box + if ( ($this->stop == false) ) { + if (false == $this->obj->open()) { + if ( $nopw ) { + $this->doask = true; + } else { + $this->stop = true; + } + return; + } + } + + // actions + if ( $this->stop == false ) { + // Delete a mail + if ( isset($_GET['del']) ) { + $this->obj->delete_mail($_GET['del']); + $msg .= $lang['MailDeleted']; + } + // Delete a folder + if ( isset($_GET['delfolder']) ) { + if ( $_GET['delfolder'] != "" ){ + $this->obj->deletefolder(base64_Decode($_GET['delfolder'])); + $msg .= sprintf($lang['MailFolderDeleted'], base64_Decode($_GET['delfolder'])); + } + } + // Create new folder + if ( isset($_GET['new']) ) { + if ( $_GET['new'] != "" ){ + $this->obj->createfolder($_GET['new']); + $msg .= sprintf($lang['MailFolderCreated'], $_GET['new']); + } + } + // Some action + if ( isset($_GET['mtarget']) ) { + if ( $_GET['mtarget'] != -1 ) { + $mtarget = base64_decode($_GET['mtarget']); + @reset($_GET['mark']); + while (list ($key,$val) = @each ($_GET['mark'])) { + if ( $mtarget == "FLAG" ) { + $this->obj->flag_mail($val,"\\Flagged"); + } else if ( $mtarget == "UNFLAG" ) { + $this->obj->unflag_mail($val,"\\Flagged"); + } else if ( $mtarget == "SEEN" ) { + $this->obj->flag_mail($val,"\\Seen"); + } else if ( $mtarget == "UNSEEN" ) { + $this->obj->unflag_mail($val,"\\Seen"); + } else if ( $mtarget == "TRASH" ) { + $this->obj->delete_mail($val); + } else if ( ereg("^\+(.*)",$mtarget,$mm) ) { + imap_mail_copy($this->obj->mbox,$val,$this->obj->orgpath.$mm[1],FT_UID); + } else if ( ereg("^-(.*)",$mtarget,$mm) ) { + imap_mail_move($this->obj->mbox,$val,$this->obj->orgpath.$mm[1],FT_UID); + } + } + $this->obj->mail_expunge(); + } + } + } + + $this->addtohistory(); + + } } $l = new Mailbox_show($current_user); |