Index: /contrib/Dms/themes/default/HTMLFoot.html
===================================================================
--- /contrib/Dms/themes/default/HTMLFoot.html	(revision 3526)
+++ /contrib/Dms/themes/default/HTMLFoot.html	(revision 3526)
@@ -0,0 +1,1 @@
+</body></html>
Index: /contrib/Dms/themes/default/EndBox.html
===================================================================
--- /contrib/Dms/themes/default/EndBox.html	(revision 3526)
+++ /contrib/Dms/themes/default/EndBox.html	(revision 3526)
@@ -0,0 +1,6 @@
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
Index: /contrib/Dms/themes/default/FolderPageEnd.html
===================================================================
--- /contrib/Dms/themes/default/FolderPageEnd.html	(revision 3526)
+++ /contrib/Dms/themes/default/FolderPageEnd.html	(revision 3526)
@@ -0,0 +1,4 @@
+      <!-- </ul> -->
+    </td>
+  </tr>
+</table>
Index: /contrib/Dms/themes/default/DocumentPageEnd.html
===================================================================
--- /contrib/Dms/themes/default/DocumentPageEnd.html	(revision 3526)
+++ /contrib/Dms/themes/default/DocumentPageEnd.html	(revision 3526)
@@ -0,0 +1,27 @@
+      </ul>
+    </td>
+  </tr>
+  <tr>
+    <td width="45" height="25" background="<?php echo(printImgPath("line_vert_edit.gif")) ?>">
+      &nbsp;
+    </td>
+    <td height="25">
+      <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
+        <tr>
+          <td class="editfolder" valign="center">
+	    <b><?php echo($title) ?>:</b>
+	  </td>
+          <td class="editfolder" align="left">
+	    <?php echo($menu) ?>
+          </td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td width="45" background="<?php echo(printImgPath("line_vert.gif")) ?>">
+      &nbsp;
+    </td>
+    <td>&nbsp;</td>
+  </tr>
+</table>
Index: /contrib/Dms/themes/default/FolderPageStart.html
===================================================================
--- /contrib/Dms/themes/default/FolderPageStart.html	(revision 3526)
+++ /contrib/Dms/themes/default/FolderPageStart.html	(revision 3526)
@@ -0,0 +1,36 @@
+
+
+<table width="100%" cellpadding="0" cellspacing="0" border="0" height="600" valign=top>
+  <tr>
+    <td rowspan="1" align="center" valign="top" class="subfolderlist" style="width: 250px;">
+      <div id="mydmstreebox" style="top:0px; left:0px; width:250px; border:dotted 0px silver; text-align:left;">
+<?php  print $uimydms->getFolderTree($path, 0, $folder, true); ?>
+</div>
+      <div id="mydmsinfobox" style="top:0px; left:0px; width:250px; height:200px; border:dotted 0px red; text-align:left;">
+     
+<!--
+      <table cellpadding="0" cellspacing="10" style="width:100%;">
+                <tr>
+                        <td class="infos" valign="top"><?php printMLText("owner");?>:</td>
+                </tr>
+                <tr>
+                        <td class="infos">
+                                <?php 
+                                        $owner = $folder->getOwner();
+                                        print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".$owner->getFullName()."</a>";
+                                ?>
+                        </td>
+                </tr>
+                <tr>
+                        <td class="infos" valign="top"><?php printMLText("comment");?>:</td>
+                </tr>
+                <tr>
+                        <td class="infos"><?php print $folder->getComment();?></td>
+                </tr>
+        </table>
+-->
+      </div>
+      
+    </td>
+    <td valign="top">
+      <!-- <ul> -->
Index: /contrib/Dms/themes/default/HTMLHead.html
===================================================================
--- /contrib/Dms/themes/default/HTMLHead.html	(revision 3526)
+++ /contrib/Dms/themes/default/HTMLHead.html	(revision 3526)
@@ -0,0 +1,1 @@
+<link rel="STYLESHEET" type="text/css" href="<?php echo($stylesheet) ?>">
Index: /contrib/Dms/themes/default/StartBox.html
===================================================================
--- /contrib/Dms/themes/default/StartBox.html	(revision 3526)
+++ /contrib/Dms/themes/default/StartBox.html	(revision 3526)
@@ -0,0 +1,9 @@
+<table cellpadding="0" cellspacing="0" width="100%" border="0">
+	<tr class="th">
+					<td class="boxHeader">&nbsp;<?php echo($header) ?>:</td>
+	</tr>
+	<tr>
+		<td class="boxBorder">
+			<table cellpadding="10" width="100%">
+				<tr>
+					<td>
Index: /contrib/Dms/themes/default/TitleBar.html
===================================================================
--- /contrib/Dms/themes/default/TitleBar.html	(revision 3526)
+++ /contrib/Dms/themes/default/TitleBar.html	(revision 3526)
@@ -0,0 +1,8 @@
+<table class='titlebar' width='100%' cellpadding='5' cellspacing='0'>
+	<tr>
+		<td class='titlebar'><?php echo($title) ?></td>
+		<td align='right' class='titlebar'>
+<?php echo($menu) ?>
+		</td>
+	</tr>
+</table>
Index: /contrib/Dms/themes/default/NextBox.html
===================================================================
--- /contrib/Dms/themes/default/NextBox.html	(revision 3526)
+++ /contrib/Dms/themes/default/NextBox.html	(revision 3526)
@@ -0,0 +1,23 @@
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2">&nbsp;</td>
+	</tr>
+	<tr>
+		<td colspan="2">
+			<table cellpadding="0" cellspacing="0" border="0">
+				<tr>
+					<td class="boxHeader th">&nbsp;<?php echo($header) ?>:</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+	<tr>
+		<td width="30"><img src="images/dummy.gif" width="30" height="1" border="0" alt=""></td>
+		<td class="boxBorder">
+			<table cellpadding="10" width="100%">
+				<tr>
+					<td>
Index: /contrib/Dms/themes/default/styles.css
===================================================================
--- /contrib/Dms/themes/default/styles.css	(revision 3526)
+++ /contrib/Dms/themes/default/styles.css	(revision 3526)
@@ -0,0 +1,161 @@
+	a { text-decoration: none; }
+	a:hover { text-decoration: underline; }
+
+	.titlebar {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		background-color : #000080;
+		font-size : 12pt;
+		color : White;
+		font-weight: bold;
+	}
+
+	.header1 {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 11pt;
+		font-style : italic;
+		color : #000080;
+	}
+
+	.foldertree {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.foldertree_inpath {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+		font-style: italic;
+	}
+	
+	.foldertree_active {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 9pt;
+		color: black;
+		font-weight: bold;
+	}
+	
+	.path {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		background-color : #A0A1CE;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.editfolder {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		background-color : #A0A1CE;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.editdocument {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		background-color : #A0A1CE;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.infos {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 90%;
+		color: black;
+	}
+	
+	.filelist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+
+	.subfolderlist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.linklist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.boxHeader {
+			color : black;
+		        bbackground-color : #000080;
+			font-style : italic;
+			font-size : 11pt;
+			font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+	}
+
+	.boxBorder {
+			border: 1pt solid #000080;
+	}
+	
+	.pageHeader {
+			font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+			font-size: 13pt;
+			font-weight: bold;
+			color: #000080;
+	}
+	
+	 .inputDescription {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+		font-style: italic;
+	}
+	
+	.notifylist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.inheritAccess
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.accessList
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.defaultAccess
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.msgLocked
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.standardText
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.groupMembers
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+
+	.hline
+	{
+		background-color : #000080;
+	}
Index: /contrib/Dms/themes/default/DocumentPageStart.html
===================================================================
--- /contrib/Dms/themes/default/DocumentPageStart.html	(revision 3526)
+++ /contrib/Dms/themes/default/DocumentPageStart.html	(revision 3526)
@@ -0,0 +1,66 @@
+
+
+<table width="100%" cellpadding="0" cellspacing="0" border="0" height="600">
+  <tr>
+    <td rowspan="4" align="center" valign="top" class="subfolderlist">
+      &nbsp;<p>
+      
+      <div id="mydmstreebox" style="top:0px; left:0px; width:200px; height:400px; border:dotted 0px silver; text-align:left;">
+<?php  print $uimydms->getFolderTree($path, 0, $folder, true); ?>
+</div>
+
+
+
+      <div id="mydmsinfobox" style="top:0px; left:0px; width:200px; height:200px; border:dotted 0px red; text-align:left;">
+
+<!--
+
+
+      <table cellpadding="0" cellspacing="10">
+                <tr>
+                        <td class="infos" valign="top"><?php printMLText("owner");?>:</td>
+                </tr>
+                <tr>
+                        <td class="infos">
+                                <?php 
+                                        $owner = $folder->getOwner();
+                                        print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".$owner->getFullName()."</a>";
+                                ?>
+                        </td>
+                </tr>
+                <tr>
+                        <td class="infos" valign="top"><?php printMLText("comment");?>:</td>
+                </tr>
+                <tr>
+                        <td class="infos"><?php print $folder->getComment();?></td>
+                </tr>
+        </table>
+-->
+      </div>
+
+   
+
+    </td>
+    <td width="45" height="53" background="<?php echo(printImgPath("line_vert.gif")) ?>">
+      &nbsp;
+    </td>
+    <td height="53" valign="top">
+      <table cellpadding="0" cellspacing="0">
+        <tr>
+          <td><img src="<?php echo(printImgPath("path_left.gif")) ?>" 
+	         width="53" height="19" border="0" alt=""></td>
+          <td class="path">
+	    <?php echo($txtpath) ?>
+          </td>
+          <td><img src="<?php echo(printImgPath("path_right.gif")) ?>"
+	         width="42" height="19" border="0" alt=""></td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td width="45" background="<?php echo(printImgPath("line_vert.gif")) ?>">
+      &nbsp;
+    </td>
+    <td valign="top">
+      <ul>
Index: /contrib/Dms/css/TreeMenu.css
===================================================================
--- /contrib/Dms/css/TreeMenu.css	(revision 3526)
+++ /contrib/Dms/css/TreeMenu.css	(revision 3526)
@@ -0,0 +1,35 @@
+/* TreeMenu.css
+  A component of HTML_TreeMenu as extended by Chip Chapin
+  2002-10-31 Chip Chapin
+*/
+.tmenu0text {
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  font-size: 10pt;
+  font-weight: bold;
+}
+.tmenu1text {
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  font-size: 9pt;
+}
+.tmenu2text {
+  font-family: Arial, Helvetica, sans-serif;
+  font-size: 9pt;
+  font-style: italic;
+}
+.tmenu3text {
+  font-family: Arial, Helvetica, sans-serif;
+  font-size: 7.5pt;
+}
+
+/* Since all menu items are links, the following is equally important 
+ * to your menu appearance.  
+ * The main thing you may want to change are the A:link and A:visited colors.
+ */
+*.tmenu0text A:link,*.tmenu1text A:link,*.tmenu2text A:link,*.tmenu3text A:link 
+  { text-decoration:none; color:#505080 }
+*.tmenu0text A:visited,*.tmenu1text A:visited,*.tmenu2text A:visited,*.tmenu3text A:visited 
+  { text-decoration:none; color:#505080 }
+*.tmenu0text A:active,*.tmenu1text A:active,*.tmenu2text A:active,*.tmenu3text A:active 
+  { text-decoration:none; color:#805050 }
+*.tmenu0text A:hover,*.tmenu1text A:hover,*.tmenu2text A:hover,*.tmenu3text A:hover 
+  { text-decoration:underline; color:#FF0000 }
Index: /contrib/Dms/ccBrowserInfo.php
===================================================================
--- /contrib/Dms/ccBrowserInfo.php	(revision 3526)
+++ /contrib/Dms/ccBrowserInfo.php	(revision 3526)
@@ -0,0 +1,158 @@
+<?php
+  // ccBrowserInfo.php -- A PHP class for HTTP client user agent detection.
+  // by Chip Chapin <cchapin@chipchapin.com> 
+  // Visit my home page at http://www.chipchapin.com
+  // Visit the ccBrowserInfo home page:
+  //     http://www.chipchapin.com/WebTools/OtherTools/ccBrowserInfo/
+  
+  // ccBrowserInfo.php was inspired by browser.php in SourceForge 2.5.
+  // Other important influences:
+  //   sniffer.js from Netscape and 
+  //   phpSniff (http://phpsniff.sourceforge.net/), which offers more
+  //   functions and greater control, but is too elaborate for my taste.
+
+  // ccBrowserInfo does NOT try to be rigorous.  Our primary goal is to distinguish
+  // between older NN and IE, and between Windows and Mac (and Unix).
+  // A useful list of older browser strings is here: 
+  //   http://www.browserlist.browser.org/browser_mappings_list_big.html
+  // See also the built-in pull-down list in the phpSniff example: 
+  //   http://phpsniff.sourceforge.net/
+  
+  // Revision History  
+  // 2002-01-01  cchapin  Creation
+  // 2002-11-02  cchapin  Initial Public release (v1.0)
+  
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002 Chip Chapin <cchapin@chipchapin.com>               |
+// |                    http://www.chipchapin.com                          |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.| 
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Chip Chapin <cchapin@chipchapin.com>                          |
+// +-----------------------------------------------------------------------+
+
+class ccBrowserInfo
+{
+  var $agent='unknown';
+  var $ver=0;
+  var $majorver=0;
+  var $minorver=0;
+  var $platform='unknown';
+  var $debug=false;
+
+  function get_agent()    { return $this->agent; }
+  function get_version()  { return $this->ver; }	
+  function get_platform() { return $this->platform; }
+  function is_mac()       { return $this->platform == 'Mac'; }
+  // function is_windows()   { return $this->platform == 'Win'; }
+  function is_win()       { return $this->platform == 'Win'; }
+  function is_ie()        { return $this->agent == 'IE'; }
+  function is_ie3()       { return $this->is_ie() && $this->majorver < 4; }
+  function is_ie4()       { return $this->is_ie() && $this->majorver == 4; }
+  function is_ie5up()     { return $this->is_ie() && $this->majorver >= 5; }
+  // function is_netscape()  { return $this->agent == 'MOZILLA'; }
+  function is_moz()       { return $this->agent == 'MOZILLA'; }
+  // function is_netscape4() { return $this->agent == 'MOZILLA' && $this->majorver <= 4; }
+  function is_moz4dn()    { return $this->agent == 'MOZILLA' && $this->majorver <= 4; }
+  function is_moz5()      { return $this->agent == 'MOZILLA' && $this->majorver == 5; }
+  function is_moz5up()    { return $this->agent == 'MOZILLA' && $this->majorver >= 5; }
+  // function is_winNN()     { return ($this->is_windows() && $this->is_netscape());}
+  function is_winNN()     { return ($this->is_win() && $this->is_moz4dn());}
+  function is_macNN()     { return ($this->is_mac() && $this->is_moz4dn());}
+	
+  // This item relates to browser functionality, not identification.  
+  // It really belongs elsewhere.
+  function transparentFlashOK() {
+    return $this->is_ie5up() && $this->is_windows();
+  }
+
+  // Constructor
+  // Determine client browser type, version and platform using
+  // heuristic examination of user agent string.
+  // @param $ua allows override of user agent string for testing.
+  function ccBrowserInfo( $ua=0 )
+  {
+    if (empty($ua)) $ua = $_SERVER['HTTP_USER_AGENT'];
+    $useragent = strtolower($ua);
+
+    // Determine browser and version
+    // The order in which we test the agents patterns is important
+    // Intentionally ignore Konquerer.  It should show up as Mozilla.
+    // post-Netscape Mozilla versions using Gecko show up as Mozilla 5.0
+    if (preg_match( '/(opera |opera\/)([0-9]*).([0-9]{1,2})/', $useragent, $matches)) ;
+    elseif (preg_match( '/(msie )([0-9]*).([0-9]{1,2})/', $useragent, $matches)) ;
+    elseif (preg_match( '/(mozilla\/)([0-9]*).([0-9]{1,2})/', $useragent, $matches)) ;
+    else {
+      $matches[1] = 'unknown'; $matches[2]=0; $matches[3]=0;
+    }
+    switch ($matches[1]) {
+      case 'opera/':
+      case 'opera ': $this->agent='OPERA'; break;
+      case 'msie ': $this->agent='IE'; break;
+      case 'mozilla/': $this->agent='MOZILLA'; break;
+      case 'unknown': $this->agent='OTHER'; break;
+      default: $this->agent='Oops!';
+    }			
+    $this->majorver=$matches[2];
+    $this->minorver=$matches[3];
+    $this->ver=$matches[2].'.'.$matches[3];
+    
+    // Determine platform
+    // This is very incomplete for platforms other than Win/Mac
+    if (preg_match( '/(win|mac|linux|unix)/', $useragent, $matches)) ;
+    else $matches[1] = 'unknown';
+    switch ($matches[1]) {
+      case 'win': $this->platform='Win'; break;
+      case 'mac': $this->platform='Mac'; break;
+      case 'linux': $this->platform='Linux'; break;
+      case 'unix': $this->platform='Unix'; break;
+      case 'unknown': $this->platform='Other'; break;
+      default: $this->platform='Oops!';
+    }
+    
+    if ($this->debug) $this-showme();
+  } // ccBrowserInfo constructor
+
+
+  function showme()
+  {
+    echo "\n\nAgent String: " . $_SERVER['HTTP_USER_AGENT'] . "<br>\n";
+    echo "\nis Windows: " . ($this->is_win()?'true':'false') . "<br>\n";
+    echo "\nis Mac: " . ($this->is_mac()?'true':'false') . "<br>\n";
+    echo "\nis IE: " . ($this->is_ie()?'true':'false') . "<br>\n";
+    echo "\nis IE5up: " . ($this->is_ie5up()?'true':'false') . "<br>\n";
+    echo "\nis NN: " . ($this->is_moz4dn()?'true':'false') . "<br>\n";
+    echo "\nis Moz5up: " . ($this->is_moz5up()?'true':'false') . "<br>\n";
+    echo "\nPlatform: " . $this->get_platform() . "<br>\n";
+    echo "\nVersion: " . $this->get_version() . "<br>\n";
+    echo "\nAgent: " . $this->get_agent() . "<br>\n";
+  } // showme
+  
+} // class ccBrowserInfo
+
+?>
Index: /contrib/Dms/index.php
===================================================================
--- /contrib/Dms/index.php	(revision 3526)
+++ /contrib/Dms/index.php	(revision 3526)
@@ -0,0 +1,21 @@
+<?php
+$GLOBALS['phpgw_info']['flags'] = array(
+        'currentapp' => 'mydms',
+        'noheader'   => True,
+        'nonavbar'   => True
+);
+
+include('../header.inc.php');
+header("Location: out/out.ViewFolder.php");
+?>
+
+<html>
+<head>
+	<title>MyDMS</title>
+</head>
+
+<body>
+
+
+</body>
+</html>
Index: /contrib/Dms/templates/default/viewDocument.tpll
===================================================================
--- /contrib/Dms/templates/default/viewDocument.tpll	(revision 3526)
+++ /contrib/Dms/templates/default/viewDocument.tpll	(revision 3526)
@@ -0,0 +1,499 @@
+<!-- BEGIN main -->
+
+<table width="100%" border="0" cellspacing="0" cellpading="0" bgcolor="white" hheight="100px">
+	<tr class="topRow">
+		<th width="33%">{download}</th>
+		<th width="33%">{view_online}</th>
+		<th width="33%">{delete}</th>
+	</tr>
+</table>
+<br>
+<table width="100%" border="0" cellspacing="0" cellpading="0">
+	<tr>
+		<th width="20%" id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);" style="font-size:10px;">{lang_informations}</a></th>
+		<th width="20%" id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);" style="font-size:10px;">{lang_all_versions}</a></th>
+		<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">{lang_linked_documents}</a></th>
+		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">{lang_notifications}</a></th>
+		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>
+	</tr>
+</table>
+<div style="border-left: dotted 1px grey; border-bottom: dotted 1px grey; border-right: dotted 1px grey; background: white;">
+<div id="tabcontent1" class="inactivetab" bgcolor="white">
+	{informations}
+</div>
+
+<div id="tabcontent2" class="inactivetab">
+
+	<table cellspacing="5" cellpadding="0" border="0" width="100%">
+		<tr>
+			<td></td>
+			<td></td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_version}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_upload_date}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_comment}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_uploaded_by}</i></td>
+			<!-- if (($document->getAccessMode($user) >= M_READWRITE) && (count($versions) > 1))
+ -->
+			<td></td>
+		</tr>
+		{versions}
+	</table>
+</div>
+
+<div id="tabcontent3" class="inactivetab">
+<!--
+<table cellspacing="5" cellpadding="0" border="1">
+	<?
+	if ($rownum > 1)
+	{
+		?>
+		<tr>
+		<td></td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("name");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("comment");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("document_link_by");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("document_link_public");?></i></td>
+		<td></td>
+		</tr>
+		<?
+		foreach($links as $link)
+		{
+			$responsibleUser = $link->getUser();
+			$targetDoc = $link->getTarget();
+			
+			print "<tr>";
+			print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+			print "<td class=\"linklist\"><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
+			print "<td class=\"linklist\">".$targetDoc->getComment()."</td>";
+			print "<td class=\"linklist\">".$responsibleUser->getFullName()."</td>";
+			print "<td class=\"linklist\">" . (($link->isPublic()) ? getMLText("yes") : getMLText("no")) . "</td>";
+			print "<td>";
+			if (($user->getID() == $responsibleUser->getID()) || ($user->getID() == $settings->_adminID) || ($link->isPublic() && ($document->getAccessMode($user) >= M_READWRITE )))
+				print "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\"><img src=\"images/del.gif\" border=0></a>";
+			print "</td>";
+			print "</tr>";
+		}
+	}
+	else
+		print "<tr><td class=\"filelist\">".getMLText("no_document_links")."</td></tr>";
+	?>
+</table>
+
+
+if ($user->getID() != $settings->_guestID)
+
+	<form action="../op/op.AddDocumentLink.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?printMLText("choose_target_document");?>:</td>
+			<td><?printDocumentChooser("form1");?></td>
+		</tr>
+		<?
+			if ($document->getAccessMode($user) >= M_READWRITE)
+			{
+				print "<tr><td class=\"inputDescription\">".getMLText("document_link_public")."</td><td class=\"inputDescription\">";
+				print "<input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes") . "&nbsp;&nbsp;";
+				print "<input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no");
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit" value="<?printMLText("add_document_link");?>"></td>
+		</tr>
+	</table>
+	</form>-->
+</div>
+
+<div id="tabcontent4" class="inactivetab">
+	<table cellspacing="0" cellpadding="5" border="0" width="100%">
+		<tr>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+			<td style="border-bottom: 1pt solid #000080;" class="notifylist"><i>{lang_name}</i></td>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+		</tr>
+		{notifications}
+		<tr>
+			<td colspan="3">&nbsp;</td>
+		</tr>
+	</table>
+
+	<form action="{notify_form_action}" method="post" name="notify_form">
+		<fieldset><legend>{lang_add_notification}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_userid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_groupid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+	</form>
+</div>
+
+<div id="tabcontent5" class="inactivetab">
+	{change_owner}
+	{display_acl}
+</div>
+
+<div id="tabcontent6" class="inactivetab">
+	<form enctype="multipart/form-data" name="update_file_form" method="post" action="{action_update_file}">
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input type="file" name="userfile"></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;"></textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire_update}
+				<span id="jscalspan_update" class="{expire_class_update}">{expire_date_update}</span>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_update}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="javascript:tab.display(1);">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</form>
+</div>
+
+
+
+</div>
+<!-- END main -->
+
+<!-- BEGIN lock_row -->
+	<tr class="row_off">
+		<td class="description" valign="top">{lang_lock_status}:</td>
+		<td class="infos" colspan="2">
+			<input id="lockStatus" type="hidden" name="lockStatus" value="unchanged">
+			<input type="checkbox" onchange="javascript:toggleLock(this);" {checked_lock_status}>
+			<div id="currentLockStatus" class="active">
+				{lang_current_status}
+			</div>
+			<div id="lockFile" class="inactive">
+				{lang_file_gets_unlocked}
+			</div>
+			<div id="unlockFile" class="inactive">
+				{lang_file_gets_locked}
+			</div>
+		</td>
+	</tr>
+<!-- END lock_row -->
+
+<!-- BEGIN version_row -->
+	<tr>
+		<td>
+			{url_view_online}
+		</td>
+		<td>
+			<a href="{url_download_file}" class="oldcontent"><img src="{download_image}" width=22 height=22 border=0 title="{lang_download}"></a>
+		</td>
+		<td class="filelist" align="center">{version_version}</td>
+		<td class="filelist">{version_date}</td>
+		<td class="filelist">{version_comment}</td>
+		<td class="filelist">{version_uploadingUser}</td>
+		<td>{url_delete_file}</td>
+	</tr>
+<!-- END version_row -->
+
+<!-- BEGIN information_ro -->
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr>
+			<td class="infos" valign="top" width="150px">{lang_filename}:</td>
+			<td style="border-left: 1pt solid #000080;" rowspan="14" width="1px">&nbsp;</td>
+			<td class="infos">{filename}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_owner}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment}:</td>
+			<td class="infos">{comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_creation_date}:</td>
+			<td class="infos">{creation_date}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_keywords}:</td>
+			<td class="infos">{keywords}</td>
+		</tr>
+		{locking}
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_mime_type}:</td>
+			<td class="infos">
+				<img align="absmiddle" src="images/icons/<?php echo getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top">
+				{expire_date_ro}
+			</td>
+		</tr>
+	</table>
+<!-- END information_ro -->
+
+<!-- BEGIN information_rw -->
+	<form name="info_form" method="post" action="{action_informations}">
+	<fieldset><legend>{lang_general_information}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos"><input style="width: 100%; border: dotted 1px silver;" type="text" name="fname" value="{filename}"></td>
+			<td align="center" width="150px"><a href="#" tabindex="0" onfocus="tab.display(6);" onclick="tab.display(6); return(false);" style="font-size:10px;">{lang_update_document}</a></td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos">
+				<input id="targetname" style="width: 100%; border: dotted 1px silver;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="unchanged">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder({current_folder_id},'info_form'); return(false);" style="font-size:10px;">{lang_move_document}</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_owner}:</td>
+			<td class="infos" colspan="2">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_creation_date}:</td>
+			<td class="infos" colspan="2">{creation_date}</td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;">{comment}</textarea></td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_keywords}:</td>
+			<td class="infos" colspan="2"><textarea name="keywords" style="width: 100%;">{keywords}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire}
+				<span id="jscalspan" class="{expire_class}">{expire_date}</span>
+			</td>
+		</tr>
+		{locking}
+		<tr class="row_on">
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_save}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="window.close()">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_information_about_last_update}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+			<td class="description" valign="top" width="150px">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+			<td class="description" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top" colspan="3">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="description" valign="top">{lang_mime_type}:</td>
+			<td class="infos" colspan="3">
+				<img align="absmiddle" src="images/icons/<?print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	</form>
+<!-- END information_rw -->
+
+<!-- BEGIN block_download -->
+<a href="{download_link}"><img src="{download_image}" align="middle" border="0">{lang_download}</a>
+<!-- END block_download -->
+
+<!-- BEGIN block_view_online -->
+<a target="_blank" href="{view_link}"><img src="{view_image}" align="middle" border="0">{lang_view_online}</a>
+<!-- END block_view_online -->
+
+<!-- BEGIN block_delete -->
+<a href="{delete_link}" onClick="return confirm('{lang_confirm_delete}');"><img src="{delete_image}" align="middle" border="0">{lang_delete}</a>
+<!-- END block_delete -->
+
+<!-- BEGIN notification_row -->
+	<tr>
+		<td><img src="{notify_image}" width=16 height=16></td>
+		<td class="notifylist">{notify_username}</td>
+		<td align="right"><a href="{link_notify_delete}"><img title="{lang_delete_this_notification}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+<!-- END notification_row -->
+
+<!-- BEGIN block_change_owner -->
+	<form name="change_owner" action="{action_change_owner}" method="post">
+		<fieldset><legend>{lang_owner}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_ownerid}
+				</td>
+				<td><input type="Submit"></td>
+			</tr>
+		</table>
+		</fieldset>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>&nbsp;</td>
+			</tr>
+		</table>
+	</form>
+<!-- END block_change_owner -->
+
+<!-- BEGIN block_acl_inherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_acl_get_inherited}</div>
+	<p>
+	<a href="{link_acl_copy}">{lang_copy_acl}</a><br>
+	<a href="{link_acl_empty}">{lang_create_empty_acl}</a><br>
+	</fieldset>
+<!-- END block_acl_inherite -->
+
+<!-- BEGIN block_acl_notinherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_inherite_acl_again}</div>
+	<p>
+	<a href="{link_acl_inherit_again}">{lang_inherit_acl_again}</a><br>
+
+	<fieldset><legend>{lang_default_access}</legend>
+	<form name="change_default_access" action="{action_change_default_access}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_default_access}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	<fieldset><legend>{lang_current_acl}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td></td>
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_name}</i></td>
+				<!-- <td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td> -->
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_access_mode}</i></td>
+				<td></td>
+				<td></td>
+			</tr>
+			{acls}
+		</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_add_acl}</legend>
+	<form name="add_acl" action="{action_add_acl}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_add_acl_userid}
+				</td>
+				<td rowspan="3">
+					<input type="Submit">
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_add_acl_groupid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_permission}:</td>
+				<td>
+					{select_add_acl_permission}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	</fieldset>
+<!-- END block_acl_notinherite -->
+
+<!-- BEGIN acl_row -->
+	<form method="post" action="{action_acl_row}">
+	<tr>
+		<td width="20px"><img src="{acl_image}" width=16 height=16></td>
+		<td class="acllist">{acl_username}</td>
+		<td class="acllist" width="310px">{acl_selectbox}</td>
+		<td width="20px"><input type="Image" src="{save_image}" alt="{lang_save}"></td>
+		<td width="20px" align="right"><a href="{link_acl_delete}" onClick="return confirm('{lang_confirm_acl_delete}');"><img title="{lang_delete_this_acl}" alt="{lang_delete}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+	</form>
+<!-- END acl_row -->
+
Index: /contrib/Dms/templates/default/copyFolder.tpl
===================================================================
--- /contrib/Dms/templates/default/copyFolder.tpl	(revision 3526)
+++ /contrib/Dms/templates/default/copyFolder.tpl	(revision 3526)
@@ -0,0 +1,51 @@
+<!-- BEGIN main -->
+<script type='text/javascript'>
+	var folderChooserURL ='{folderChooserURL}';
+</script>
+
+<form name="copy_form" method="post" action="{form_action}">
+<fieldset><legend>{lang_target_folder}</legend>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos">
+				<input id="targetname" style="width: 100%;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="{folderid}">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder(1,'copy_form'); return(false);" style="font-size:10px;">{lang_select_target_folder}...</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_name}:</td>
+			<td class="infos">
+				<input id="newfoldername" style="width: 100%;" type="text" name="newfoldername" value="{newfoldername}">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder(1,'copy_form'); return(false);" style="font-size:10px;">&nbsp;</td>
+		</tr>
+	</table>
+</fieldset>
+<p>
+<fieldset><legend>{lang_copy_options}</legend>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_off">
+			<td class="infos">
+				<input type="checkbox" name="copy_subfolder" id="copy_subfolder"> <label for="copy_subfolder">{lang_copy_subfolders}</label>
+			</td>
+		</tr>
+		<tr class="row_off">
+			<td class="infos">
+				<input type="checkbox" name="copy_documents" id="copy_documents" disabled> <label for="copy_documents">{lang_copy_documents}</label>
+			</td>
+		</tr>
+	</table>
+</fieldset>
+<p>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_off">
+			<td class="infos">
+				<button type="submit" name="cancel">{lang_cancel}</button>
+				<button type="submit" name="copy">{lang_copy}</button>
+			</td>
+		</tr>
+	</table>
+</form>
+<!-- END main -->
Index: /contrib/Dms/templates/default/images/buttons/atualizar.sh
===================================================================
--- /contrib/Dms/templates/default/images/buttons/atualizar.sh	(revision 3526)
+++ /contrib/Dms/templates/default/images/buttons/atualizar.sh	(revision 3526)
@@ -0,0 +1,14 @@
+cp /public/home/desenvolvimento/arte/imagens_file_manager/up.png uplvl_big.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/refresh.png fs_refresh.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/new_folder.png new_folder.png
+
+cp /public/home/desenvolvimento/arte/imagens_file_manager/up_load.png upload.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/lixeira.png delete_big.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/cut.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/copy.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/sharing.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/searching.png ab_search.png
+
+cp /public/home/desenvolvimento/arte/imagens_file_manager/compress.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/decompress.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/home.png .
Index: /contrib/Dms/templates/default/images/index.html
===================================================================
--- /contrib/Dms/templates/default/images/index.html	(revision 3526)
+++ /contrib/Dms/templates/default/images/index.html	(revision 3526)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+	<title>eGroupWare Info Log Icons</title>
+</head>
+
+<body bgcolor=Silver>
+	Types:<br>
+	<img src="phone.gif" width="20" height="20" alt="Telefon" border="0"> &nbsp;
+	<img src="task.gif" width="20" height="20" alt="Aufgabe" border="0"> &nbsp;
+	<img src="note.gif" width="20" height="20" alt="Notiz" border="0"> &nbsp;
+	<img src="confirm.gif" width="20" height="20" alt="Bestätigung" border="0"> &nbsp;
+	<img src="reject.gif" width="20" height="20" alt="Absage" border="0">
+	<p>
+	Status:<br>
+	<img src="offer.gif" width="20" height="20" alt="Angebot" border="0"> &nbsp;
+	<img src="ongoing.gif" width="20" height="20" alt="läuft" border="0"> &nbsp;
+	<img src="call.gif" width="20" height="20" alt="anrufen" border="0"> &nbsp;
+	<img src="will-call.gif" width="20" height="20" alt="ruft zurück" border="0"> 
+&nbsp;
+	<img src="done.gif" width="20" height="20" alt="erledigt" border="0"> &nbsp;
+	<img src="billed.gif" width="20" height="20" alt="abgerechnet" border="0">
+	<p>
+	Actions:<br>
+	<img src="new.gif" width="20" height="20" alt="neue Teilaufgabe" border="0"> 
+&nbsp;
+	<img src="view.gif" width="20" height="20" alt="Teilaufgagen anzeigen" 
+border="0"> &nbsp;
+	<img src="edit.gif" width="20" height="20" alt="bearbeiten" border="0"> &nbsp;
+	<img src="delete.gif" width="20" height="20" alt="löschen" border="0">
+</body>
+</html>
+
Index: /contrib/Dms/templates/default/app.css
===================================================================
--- /contrib/Dms/templates/default/app.css	(revision 3526)
+++ /contrib/Dms/templates/default/app.css	(revision 3526)
@@ -0,0 +1,324 @@
+th.activetab
+{
+	color:#000000;
+	background-color:#D3DCE3;
+	border-top : 1px solid Silver;
+	border-left : 1px solid Silver;
+	border-right : 1px solid Silver;
+}
+
+th.inactivetab
+{
+	color:#000000;
+	background-color:#E8F0F0;
+	border-bottom : 1px solid Silver;
+}
+			
+.td_left 
+{
+   border-left : 1px solid Gray; 
+   border-top : 1px solid Gray; 
+}
+
+.input_text {
+	border : 1px solid Silver;
+}
+
+.td_right 
+{ 
+  border-right : 1px solid Gray; 
+  border-top : 1px solid Gray; 
+}
+
+.text_small { font-size: 10px; }
+.text_small_bold { font-size: 10px; font-weight : bold; }
+			
+div.activetab{ display:inline; }
+div.inactivetab{ display:none; }
+
+.active{ display:inline; }
+.inactive{ display:none; }
+
+.quoted1 { color:#660066; }
+.quoted2 { color:#007777; }
+.quoted3 { color:#990000; }
+.quoted4 { color:#000099; }
+.quoted5 { color:#bb6600; }
+
+TR.header_row_
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	font-weight : bold;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+	font-weight : bold;
+}
+
+TR.header_row_D
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	color: silver;
+	text-decoration : line-through;
+	font-weight : bold;
+	background : White;
+	white-space: nowrap;
+}
+	
+A.header_row_D
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+	color: silver;
+	text-decoration : line-through;
+	font-weight : bold;
+}
+	
+TR.header_row_DS, TR.header_row_ADS
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	color: silver;
+	text-decoration : line-through;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_DS, A.header_row_ADS
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+	color: silver;
+	text-decoration : line-through;
+}
+	
+TR.header_row_S
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_S
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+}
+	
+TR.header_row_RS
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_RS
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+}
+
+TR.header_row_AS,TR.header_row_RAS
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_AS, A.header_row_RAS
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+}
+
+TR.header_row_FAS,  TR.header_row_FS
+{
+	color: red;
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_FAS, A.header_row_FS
+{
+	color: red;
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+}
+
+TR.header_row_F
+{
+	color: red;
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	font-weight : bold;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_F
+{
+	color: red;
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+	font-weight : bold;
+}
+
+TR.header_row_R
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	font-weight : bold;
+	background : White;
+	white-space: nowrap;
+}
+
+A.header_row_R
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+	font-weight : bold;
+}
+
+.subjectBold
+{
+	FONT-SIZE: 12px;
+	font-weight : bold;
+	font-family : Arial;
+}
+
+.subject
+{
+	FONT-SIZE: 12px;
+	font-family : Arial;
+}
+
+.body
+{
+	FONT-SIZE: 12px;
+	font-family : Arial;
+}
+
+TR.sieveRowActive
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	background : White;
+}
+
+A.sieveRowActive
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;
+}
+
+TR.sieveRowInActive
+{
+	FONT-SIZE: 11px;
+	height : 20px;
+	padding: 0;
+	background : White;
+	color: Silver;
+}
+
+A.sieveRowInActive
+{
+	FONT-SIZE: 11px;
+	height : 14px;
+	padding: 0;	
+	color: Silver;
+}
+
+
+.dtree {
+	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+	font-size: 11px;
+	color: #666;
+	white-space: nowrap;
+}
+.dtree img {
+	border: 0px;
+	vertical-align: middle;
+}
+.dtree a {
+	color: #333;
+	text-decoration: none;
+}
+.dtree a.node, .dtree a.nodeSel {
+	white-space: nowrap;
+	padding: 1px 2px 1px 2px;
+}
+.dtree a.node:hover, .dtree a.nodeSel:hover {
+	color: #333;
+	text-decoration: underline;
+}
+.dtree a.nodeSel {
+	background-color: #c0d2ec;
+}
+.dtree .clip {
+	overflow: hidden;
+}
+
+textarea
+{
+	border:solid 1px silver;
+	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+	font-size:110%;
+	color:#006699;
+}
+
+legend
+{
+	border-left: 1px solid silver; 
+	padding-left: 5px;
+	border-right: 1px solid silver; 
+	padding-right: 5px;
+}
+
+fieldset
+{
+	border: 1px solid silver; 
+	padding-left: 5px;
+	padding-right: 5px;
+}
+
+.description
+{
+	font-weight:bold;
+}
+
+.topRow
+{
+	font-size:120%;
+}
Index: /contrib/Dms/templates/default/viewDocument.tpl
===================================================================
--- /contrib/Dms/templates/default/viewDocument.tpl	(revision 3526)
+++ /contrib/Dms/templates/default/viewDocument.tpl	(revision 3526)
@@ -0,0 +1,487 @@
+<!-- BEGIN main -->
+<script type='text/javascript'>
+	var folderChooserURL ='{folderChooserURL}';
+</script>
+
+<table width="100%" border="0" cellspacing="0" cellpading="0" bgcolor="white" hheight="100px">
+	<tr class="topRow">
+		<th width="33%">{delete}</th>
+		
+		<th width="33%">{download}</th>
+	</tr>
+</table>
+<br>
+<table width="100%" border="0" cellspacing="0" cellpading="0">
+	<tr>
+		<th width="20%" id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);" style="font-size:10px;">Informaci&oacute;n</a></th>
+		<th width="20%" id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);" style="font-size:10px;">Todas las versiones</a></th>
+		<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">Documentos relacionados</a></th>
+		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">Notificaciones</a></th>
+		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>
+	</tr>
+</table>
+<div style="border-left: dotted 1px grey; border-bottom: dotted 1px grey; border-right: dotted 1px grey; background: white;">
+<div id="tabcontent1" class="inactivetab" bgcolor="white">
+	{informations}
+</div>
+
+<div id="tabcontent2" class="inactivetab">
+
+	<table cellspacing="5" cellpadding="0" border="0" width="100%">
+		<tr>
+			<td></td>
+			<td></td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>Versi&oacute;n</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>Fecha Actualizaci&oacute;n</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_comment}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>Actualizado por:</i></td>
+			<td></td>
+		</tr>
+		{versions}
+	</table>
+</div>
+
+<div id="tabcontent3" class="inactivetab">
+<!--
+<table cellspacing="5" cellpadding="0" border="1">
+	<?php
+	if ($rownum > 1)
+	{
+		?>
+		<tr>
+		<td></td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("name");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("comment");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_by");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_public");?></i></td>
+		<td></td>
+		</tr>
+		<?php 
+		foreach($links as $link)
+		{
+			$responsibleUser = $link->getUser();
+			$targetDoc = $link->getTarget();
+			
+			print "<tr>";
+			print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+			print "<td class=\"linklist\"><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
+			print "<td class=\"linklist\">".$targetDoc->getComment()."</td>";
+			print "<td class=\"linklist\">".$responsibleUser->getFullName()."</td>";
+			print "<td class=\"linklist\">" . (($link->isPublic()) ? getMLText("yes") : getMLText("no")) . "</td>";
+			print "<td>";
+			if (($user->getID() == $responsibleUser->getID()) || ($user->getID() == $settings->_adminID) || ($link->isPublic() && ($document->getAccessMode($user) >= M_READWRITE )))
+				print "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\"><img src=\"images/del.gif\" border=0></a>";
+			print "</td>";
+			print "</tr>";
+		}
+	}
+	else
+		print "<tr><td class=\"filelist\">".getMLText("no_document_links")."</td></tr>";
+	?>
+</table>
+
+
+if ($user->getID() != $settings->_guestID)
+
+	<form action="../op/op.AddDocumentLink.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("choose_target_document");?>:</td>
+			<td><?php printDocumentChooser("form1");?></td>
+		</tr>
+		<?php 
+			if ($document->getAccessMode($user) >= M_READWRITE)
+			{
+				print "<tr><td class=\"inputDescription\">".getMLText("document_link_public")."</td><td class=\"inputDescription\">";
+				print "<input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes") . "&nbsp;&nbsp;";
+				print "<input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no");
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit" value="<?php printMLText("add_document_link");?>"></td>
+		</tr>
+	</table>
+	</form>-->
+</div>
+
+<div id="tabcontent4" class="inactivetab">
+	<table cellspacing="0" cellpadding="5" border="0" width="100%">
+		<tr>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+			<td style="border-bottom: 1pt solid #000080;" class="notifylist"><i>{lang_name}</i></td>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+		</tr>
+		{notifications}
+		<tr>
+			<td colspan="3">&nbsp;</td>
+		</tr>
+	</table>
+
+	<form action="{notify_form_action}" method="post" name="notify_form">
+		<fieldset><legend>Agregar Notificaci&oacute;n</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_userid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_groupid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+	</form>
+</div>
+
+<div id="tabcontent5" class="inactivetab">
+	{change_owner}
+	{display_acl}
+</div>
+
+<div id="tabcontent6" class="inactivetab">
+	<form enctype="multipart/form-data" name="update_file_form" method="post" action="{action_update_file}">
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input type="file" name="userfile"></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;"></textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire_update}
+				<span id="jscalspan_update" class="{expire_class_update}">{expire_date_update}</span>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_update}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="javascript:tab.display(1);">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</form>
+</div>
+
+
+
+</div>
+<!-- END main -->
+
+<!-- BEGIN lock_row -->
+	<tr class="row_on">
+		<td class="description" valign="top">Status de Bloqueo:</td>
+		<td class="infos" colspan="3">
+			<input id="lockStatus" type="hidden" name="lockStatus" value="unchanged">
+			<input type="checkbox" onClick="javascript:toggleLock(this);" {checked_lock_status}>
+			<div id="currentLockStatus" class="active">
+				{lang_current_status}
+			</div>
+			<div id="lockFile" class="inactive">
+				{lang_file_gets_unlocked}
+			</div>
+			<div id="unlockFile" class="inactive">
+				{lang_file_gets_locked}
+			</div>
+		</td>
+	</tr>
+<!-- END lock_row -->
+
+<!-- BEGIN version_row -->
+	<tr>
+		<td>
+			{url_view_online}
+		</td>
+		<td>
+			<a href="{url_download_file}" class="oldcontent"><img src="{download_image}" width=22 height=22 border=0 title="{lang_download}"></a>
+		</td>
+		<td class="filelist" align="center">{version_version}</td>
+		<td class="filelist">{version_date}</td>
+		<td class="filelist">{version_comment}</td>
+		<td class="filelist">{version_uploadingUser}</td>
+		<td>{url_delete_file}</td>
+	</tr>
+<!-- END version_row -->
+
+<!-- BEGIN information_ro -->
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr>
+			<td class="infos" valign="top" width="150px">{lang_filename}:</td>
+			<td style="border-left: 1pt solid #000080;" rowspan="14" width="1px">&nbsp;</td>
+			<td class="infos">{filename}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_owner}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment}:</td>
+			<td class="infos">{comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_creation_date}:</td>
+			<td class="infos">{creation_date}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_keywords}:</td>
+			<td class="infos">{keywords}</td>
+		</tr>
+		{locking}
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		
+		<tr>
+			<td class="infos" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top">
+				{expire_date_ro}
+			</td>
+		</tr>
+	</table>
+<!-- END information_ro -->
+
+<!-- BEGIN information_rw -->
+	<form name="info_form" method="post" action="{action_informations}">
+	<fieldset><legend>Informaci&oacute;n General</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">Nombre de Archivo:</td>
+			<td class="infos" colspan="2"><input style="width: 100%;" type="text" name="fname" value="{filename}"></td>
+			<td align="center" width="150px"><a href="#" tabindex="0" onfocus="tab.display(6);" onclick="tab.display(6); return(false);" style="font-size:10px;">Actualizaci&oacute;n del documento</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos" colspan="2">
+				<input id="targetname" style="width: 100%;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="unchanged">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder({current_folder_id},'info_form'); return(false);" style="font-size:10px;">Mover Documento</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="3"><textarea name="comment" style="width: 100%; height: 80px;">{comment}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_keywords}:</td>
+			<td class="infos" colspan="3"><textarea name="keywords" style="width: 100%; height: 30px;">{keywords}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="3">
+				{select_expire}
+				<span id="jscalspan" class="{expire_class}">{expire_date}</span>
+			</td>
+		</tr>
+		{locking}
+		<tr class="row_on">
+			<td class="description_small" valign="top">{lang_owner}:</td>
+			<td class="infos" colspan="1">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+			<td class="description_small" valign="top">Fecha creaci&oacute;n:</td>
+			<td class="infos" colspan="1">{creation_date}</td>
+		</tr>
+		<tr class="row_on">
+			<td colspan="4" valign="top">
+				<button type="submit" name="save" value="save">
+					{lang_save}
+				</button>
+				<button style="margin-left: 10px;" type="button" name="cancel" value="cancel" onClick="window.close()">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	<p>
+	<fieldset style="border: 1px solid silver;"><legend>Informaci&oacute;n acerca &uacute;ltima actualizaci&oacute;n</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_off">
+			<td class="description_small" valign="top" width="150px">&uacute;ltima actualizaci&oacute;n</td>
+			<td class="infos">{last_update}</td>
+			<td class="description_small" valign="top" width="150px">versi&oacute;n actual:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description_small" valign="top">Actualizado por:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+			<td class="description_small" valign="top">Tama&ntilde;o:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description_small" valign="top">Comentario versi&oacute;n actual:</td>
+			<td class="infos" valign="top" colspan="3">{current_comment}</td>
+		</tr>
+		
+	</table>
+	</fieldset>
+	</form>
+<!-- END information_rw -->
+
+<!-- BEGIN block_download -->
+<a href="{download_link}"><img src="{download_image}" align="middle" border="0">{lang_download}</a>
+<!-- END block_download -->
+
+<!-- BEGIN block_view_online -->
+<a target="_blank" href="{view_link}"><img src="{view_image}" align="middle" border="0">{lang_view_online}</a>
+<!-- END block_view_online -->
+
+<!-- BEGIN block_delete -->
+<a href="{delete_link}" onClick="return confirm('{lang_confirm_delete}');"><img src="{delete_image}" align="middle" border="0">{lang_delete}</a>
+<!-- END block_delete -->
+
+<!-- BEGIN notification_row -->
+	<tr>
+		<td><img src="{notify_image}" width=16 height=16></td>
+		<td class="notifylist">{notify_username}</td>
+		<td align="right"><a href="{link_notify_delete}"><img title="{lang_delete_this_notification}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+<!-- END notification_row -->
+
+<!-- BEGIN block_change_owner -->
+	<form name="change_owner" action="{action_change_owner}" method="post">
+		<fieldset><legend>{lang_owner}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_ownerid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>&nbsp;</td>
+			</tr>
+		</table>
+	</form>
+<!-- END block_change_owner -->
+
+<!-- BEGIN block_acl_inherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_acl_get_inherited}</div>
+	<p>
+	<a href="{link_acl_copy}">{lang_copy_acl}</a><br>
+	<a href="{link_acl_empty}">{lang_create_empty_acl}</a><br>
+	</fieldset>
+<!-- END block_acl_inherite -->
+
+<!-- BEGIN block_acl_notinherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_inherite_acl_again}</div>
+	<p>
+	<a href="{link_acl_inherit_again}">Derecho de acceso</a><br>
+
+	<fieldset><legend>Acceso por defecto</legend>
+	<form name="change_default_access" action="{action_change_default_access}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_default_access}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	<fieldset><legend>Acceso actual</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td></td>
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_name}</i></td>
+				<!-- <td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td> -->
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>Modo de acceso</i></td>
+				<td></td>
+				<td></td>
+			</tr>
+			{acls}
+		</table>
+	</fieldset>
+
+	<fieldset><legend>Agregar ACL</legend>
+	<form name="add_acl" action="{action_add_acl}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_add_acl_userid}
+				</td>
+				<td rowspan="3">
+					<input type="Submit">
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_add_acl_groupid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_permission}:</td>
+				<td>
+					{select_add_acl_permission}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	</fieldset>
+<!-- END block_acl_notinherite -->
+
+<!-- BEGIN acl_row -->
+	<form method="post" action="{action_acl_row}">
+	<tr>
+		<td width="20px"><img src="{acl_image}" width=16 height=16></td>
+		<td class="acllist">{acl_username}</td>
+		<td class="acllist" width="310px">{acl_selectbox}</td>
+		<td width="20px"><input type="Image" src="{save_image}" alt="{lang_save}"></td>
+		<td width="20px" align="right"><a href="{link_acl_delete}" onClick="return confirm('{lang_confirm_acl_delete}');"><img title="{lang_delete_this_acl}" alt="{lang_delete}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+	</form>
+<!-- END acl_row -->
+
Index: /contrib/Dms/templates/default/folderChooser.tpl
===================================================================
--- /contrib/Dms/templates/default/folderChooser.tpl	(revision 3526)
+++ /contrib/Dms/templates/default/folderChooser.tpl	(revision 3526)
@@ -0,0 +1,11 @@
+<!-- BEGIN main -->
+<script language="JavaScript">
+
+var targetName = opener.document.{formName}.targetname;
+var targetID   = opener.document.{formName}.targetid;
+
+</script>
+
+<div id="mydmstreebox" style="top:0px; left:0px; width:200px; height:400px; border:dotted 0px silver; text-align:left;"></div>
+{folderTree}
+<!-- END main -->
Index: /contrib/Dms/setup/phpgw_en.lang
===================================================================
--- /contrib/Dms/setup/phpgw_en.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_en.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	en	access mode
+access rights	mydms	en	access rights
+access_mode_all	mydms	en	All
+access_mode_none	mydms	en	No access
+access_mode_read	mydms	en	Read
+access_mode_readwrite	mydms	en	Read+Write
+acl get inherited	mydms	en	acl get inherited
+add acl	mydms	en	add acl
+add document	mydms	en	add document
+add notification	mydms	en	add notification
+add subfolder	mydms	en	add subfolder
+admin-tools	mydms	en	administration Tools
+all versions	mydms	en	all versions
+comment	mydms	en	Kommentar
+comment for current version	mydms	en	comment for current version
+copy acl	mydms	en	copy acl
+copy documents	mydms	en	copy documents
+copy folder	mydms	en	copy folder
+copy options	mydms	en	copy options
+copy subfolders	mydms	en	copy subfolder
+create empty acl	mydms	en	create empty acl
+creation date	mydms	en	creation date
+current acl	mydms	en	current acl
+current version	mydms	en	current version
+default access	mydms	en	default access
+delete folder	mydms	en	delete folder
+delete this notification	mydms	en	delete this notification
+do you really want to delete this acl?	mydms	en	Do you really want to delete this acl?
+do you really want to delete this document?	mydms	en	Do you really want to delete this document?
+do you really want to delete this version of the document?	mydms	en	do you really want to delete this version of the document?
+does not expire	mydms	en	does not expire
+download	mydms	en	download
+edit folder	mydms	en	edit folder
+expires	mydms	en	expires
+expires after	mydms	en	expires after
+file size	mydms	en	file size
+filename	mydms	en	file name
+folder	mydms	en	folder
+general information	mydms	en	general information
+information about last update	mydms	en	information about last update
+informations	mydms	en	Informations
+inherit acl again	mydms	en	inherit acl again
+last update	mydms	en	last update
+linked documents	mydms	en	linked documents
+lock status	mydms	en	lock status
+mime type	mydms	en	Mime Type
+move document	mydms	en	move document
+move folder	mydms	en	move folder
+mydms	common	en	MyDMS
+notifications	mydms	en	notifications
+permission	mydms	en	permission
+select folder	mydms	en	select folder
+select target folder	mydms	en	select target folder
+target folder	mydms	en	target folder
+this document gets locked by you!	mydms	en	this document gets locked by you!
+this document gets unlocked by you.	mydms	en	this document gets unlocked by you.
+this document is currently not locked.	mydms	en	this document is currently not locked.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	en	this document is locked by <a href="mailto:%1">%2</a>.
+update document	mydms	en	update document
+upload date	mydms	en	upload date
+uploaded by	mydms	en	uploaded by
+view online	mydms	en	view online
Index: /contrib/Dms/setup/phpgw_gl.lang
===================================================================
--- /contrib/Dms/setup/phpgw_gl.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_gl.lang	(revision 3526)
@@ -0,0 +1,64 @@
+access mode	mydms	gl	Modo de acceso
+access rights	mydms	gl	Dereitos de acceso
+access_mode_all	mydms	gl	Todos
+access_mode_none	mydms	gl	Sen acceso
+access_mode_read	mydms	gl	Lectura
+access_mode_readwrite	mydms	gl	Lectura e escrita
+acl get inherited	mydms	gl	ACL herdada
+add acl	mydms	gl	Engadir ACL
+add document	mydms	gl	Engadir documento
+add notification	mydms	gl	Engadir notificación
+add subfolder	mydms	gl	Engadir subcartafol
+adding subfolder "%1" to folder "%2"...	mydms	gl	Engadindo subcartafol "%1" ao cartafol "%2"...
+admin-tools	mydms	gl	Ferramentas da administración
+all versions	mydms	gl	Todas as versións
+comment	mydms	gl	Comentario
+comment for current version	mydms	gl	Comentario sobre a versión actual
+copy acl	mydms	gl	Copiar ACL
+copy documents	mydms	gl	Copiar documentos
+copy folder	mydms	gl	Copiar cartafol
+copy options	mydms	gl	Copiar opcións
+copy subfolders	mydms	gl	Copiar subcartafol
+create empty acl	mydms	gl	Crear ACL en branco
+creation date	mydms	gl	Data de creación
+current acl	mydms	gl	ACL actual
+current version	mydms	gl	Versión actual
+default access	mydms	gl	Acceso predefinido
+delete folder	mydms	gl	Eliminar cartafol
+delete this notification	mydms	gl	eliminar esta notificación
+do you really want to delete this acl?	mydms	gl	Está certo de querer eliminar esta ACL?
+do you really want to delete this document?	mydms	gl	Está certo de querer eliminar este documento?
+do you really want to delete this version of the document?	mydms	gl	Está certo de querer eliminar esta versión do documento?
+do you really want to remove the folder "%1" and its content?<br>be careful: this action cannot be undone.	mydms	gl	Está certo de querer eliminar o cartafol "%1" e o seu contido?<br>Coidado: Esta acción non se pode desfacer.
+does not expire	mydms	gl	Non caduca
+download	mydms	gl	Descargar
+edit folder	mydms	gl	Editar cartafol
+expires	mydms	gl	Caduca
+expires after	mydms	gl	Caduca após
+file size	mydms	gl	Tamaño do ficheiro
+filename	mydms	gl	Nome do ficheiro
+folder	mydms	gl	Cartafol
+general information	mydms	gl	Información xeral
+information about last update	mydms	gl	Información sobre a actualización máis recente
+informations	mydms	gl	Información
+inherit acl again	mydms	gl	Volver herdar ACL
+last update	mydms	gl	Actualización máis recente
+linked documents	mydms	gl	Documentos ligados
+lock status	mydms	gl	Estado do bloqueo
+mime type	mydms	gl	Tipo MIME
+move document	mydms	gl	Mover documento
+move folder	mydms	gl	Mover cartafol
+mydms	common	gl	Sistema de xestión de documentos
+notifications	mydms	gl	Notificacións
+permission	mydms	gl	Permiso
+select folder	mydms	gl	Seleccionar cartafol
+select target folder	mydms	gl	Seleccionar cartafol de destino
+target folder	mydms	gl	Cartafol de destino
+this document gets locked by you!	mydms	gl	Este documento foi bloqueado polo usuario
+this document gets unlocked by you.	mydms	gl	Este documento foi desbloqueado polo usuario
+this document is currently not locked.	mydms	gl	Este documento non está bloqueado
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	gl	Este documento está bloqueado por <a href="mailto:%1">%2</a>.
+update document	mydms	gl	Actualizar documento
+upload date	mydms	gl	Data da transferencia
+uploaded by	mydms	gl	Cargado por
+view online	mydms	gl	Ver en liña
Index: /contrib/Dms/setup/phpgw_cs.lang
===================================================================
--- /contrib/Dms/setup/phpgw_cs.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_cs.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	cs	pøístupový reŸim
+access rights	mydms	cs	pøístupová práva
+access_mode_all	mydms	cs	V¹e
+access_mode_none	mydms	cs	Bez pøístupu
+access_mode_read	mydms	cs	Ètení
+access_mode_readwrite	mydms	cs	Ètení+Zápis
+acl get inherited	mydms	cs	zdìdìné acl
+add acl	mydms	cs	pøidat acl
+add document	mydms	cs	pøidat dokument
+add notification	mydms	cs	pøidat upozornìní
+add subfolder	mydms	cs	pøidat podsloŸku
+admin-tools	mydms	cs	administraèní nástroje
+all versions	mydms	cs	v¹echny verze
+comment	mydms	cs	Komentáø
+comment for current version	mydms	cs	komentáø pro aktuální verzi
+copy acl	mydms	cs	kopírovat acl
+copy documents	mydms	cs	kopírovat dokumenty
+copy folder	mydms	cs	kopírovat sloŸku
+copy options	mydms	cs	volby kopírování
+copy subfolders	mydms	cs	kopírovat podsloŸku
+create empty acl	mydms	cs	vytvoøit prázdný acl
+creation date	mydms	cs	datum vytvoøení
+current acl	mydms	cs	aktuální acl
+current version	mydms	cs	aktuální verze
+default access	mydms	cs	výchozí pøístup
+delete folder	mydms	cs	smazat sloŸku
+delete this notification	mydms	cs	smazat upozornìní
+do you really want to delete this acl?	mydms	cs	Opravdu chcete smazat tento acl?
+do you really want to delete this document?	mydms	cs	Opravdu chcete smazat tento dokument?
+do you really want to delete this version of the document?	mydms	cs	Opravdu chcete smazat tuto verzi dokumentu?
+does not expire	mydms	cs	nevypr¹í
+download	mydms	cs	stáhnout
+edit folder	mydms	cs	editovat sloŸku
+expires	mydms	cs	vypr¹í
+expires after	mydms	cs	vypr¹í za
+file size	mydms	cs	velikost souboru
+filename	mydms	cs	jméno souboru
+folder	mydms	cs	sloŸka
+general information	mydms	cs	obecné informace
+information about last update	mydms	cs	informace o poslední aktualizaci
+informations	mydms	cs	Informace
+inherit acl again	mydms	cs	znovu zdìdit acl
+last update	mydms	cs	poslední aktualizace
+linked documents	mydms	cs	odkazované dokumenty
+lock status	mydms	cs	stav uzamèení
+mime type	mydms	cs	MIME typ
+move document	mydms	cs	pøesunout dokument
+move folder	mydms	cs	pøesunout sloŸku
+mydms	common	cs	Správce dokumentù
+notifications	mydms	cs	upozornìní
+permission	mydms	cs	oprávnìní
+select folder	mydms	cs	vybrat sloŸku
+select target folder	mydms	cs	vybrat cílovou sloŸku
+target folder	mydms	cs	cílová sloŸka
+this document gets locked by you!	mydms	cs	dokument jste uzamknul(a)!
+this document gets unlocked by you.	mydms	cs	dokument jste odemknul(a)!
+this document is currently not locked.	mydms	cs	dokument není v souèasné dobì uzamèen
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	cs	dokument uzamknul <a href="mailto:%1">%2</a>.
+update document	mydms	cs	akutalizovat dokument
+upload date	mydms	cs	datum uploadu
+uploaded by	mydms	cs	uploadoval(a)
+view online	mydms	cs	zobrazit online
Index: /contrib/Dms/setup/phpgw_fr.lang
===================================================================
--- /contrib/Dms/setup/phpgw_fr.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_fr.lang	(revision 3526)
@@ -0,0 +1,61 @@
+access rights	mydms	fr	Droits d'accès
+access_mode_all	mydms	fr	Tout
+access_mode_none	mydms	fr	Pas d'accès
+access_mode_read	mydms	fr	Lire
+access_mode_readwrite	mydms	fr	Lire+Ecrire
+acl get inherited	mydms	fr	Les permissions sont hérités
+add acl	mydms	fr	Ajouter des permissions
+add document	mydms	fr	Ajouter un document
+add notification	mydms	fr	Ajouter une notification
+add subfolder	mydms	fr	Ajouter un sous-répertoire
+admin-tools	mydms	fr	outils d'administration
+all versions	mydms	fr	toutes les versions
+comment	mydms	fr	Commentaire
+comment for current version	mydms	fr	commentaire pour la version en cours
+copy acl	mydms	fr	copier les permissions
+copy documents	mydms	fr	copier des documents
+copy folder	mydms	fr	copier un répertoire
+copy options	mydms	fr	copier les options
+copy subfolders	mydms	fr	copier un sous-répertoire
+create empty acl	mydms	fr	créer des permissions vides
+creation date	mydms	fr	Date de création
+current acl	mydms	fr	permissions courante
+current version	mydms	fr	version courante
+default access	mydms	fr	permissions par défaut
+delete folder	mydms	fr	supprimer un dossier
+delete this notification	mydms	fr	supprimer cette notification
+do you really want to delete this acl?	mydms	fr	Voulez-vous vraiment supprimer ces permissions?
+do you really want to delete this document?	mydms	fr	Voulez-vous vraiment supprimer ce document?
+do you really want to delete this version of the document?	mydms	fr	Voulez-vous vraiment supprimer cette version du document?
+does not expire	mydms	fr	n'expire jamais
+download	mydms	fr	téléchargement
+edit folder	mydms	fr	Editez le répertoire
+expires	mydms	fr	expire
+expires after	mydms	fr	expire aprés
+file size	mydms	fr	taille du fichier
+filename	mydms	fr	nom du fichier
+folder	mydms	fr	répertoire
+general information	mydms	fr	informations générales
+information about last update	mydms	fr	informations sur la dernière mise à jour
+informations	mydms	fr	informations
+inherit acl again	mydms	fr	permissions héritées encore
+last update	mydms	fr	dernière mise à jour
+linked documents	mydms	fr	documents liés
+mime type	mydms	fr	Type Mime
+move document	mydms	fr	déplacez le document
+move folder	mydms	fr	déplacez le répertoire
+mydms	common	fr	mydms
+notifications	mydms	fr	Notifications
+notifications
+permission	mydms	fr	permission
+select folder	mydms	fr	sélectionner un répertoire
+select target folder	mydms	fr	sélectionner le répertoire cible
+target folder	mydms	fr	répertoire cible
+this document gets locked by you!	mydms	fr	ce document a été  verrouillé par vous!
+this document gets unlocked by you.	mydms	fr	ce document a été  déverrouillé par vous.
+this document is currently not locked.	mydms	fr	ce document n'est pas verrouillé.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	fr	ce document est verrouillé par <a href="mailto:%1">%2</a>.
+update document	mydms	fr	document de mise à jour
+upload date	mydms	fr	date de téléchargement
+uploaded by	mydms	fr	téléchargé par
+view online	mydms	fr	voir en ligne
Index: /contrib/Dms/setup/setup.inc.php
===================================================================
--- /contrib/Dms/setup/setup.inc.php	(revision 3526)
+++ /contrib/Dms/setup/setup.inc.php	(revision 3526)
@@ -0,0 +1,54 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare - Mydms                                                       *
+	* http://www.egroupware.org                                                *
+	* --------------------------------------------                             *
+	*  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; either version 2 of the License, or (at your  *
+	*  option) any later version.                                              *
+	\**************************************************************************/
+
+	/* Basic information about this app */
+	$setup_info['mydms']['name']      = 'mydms';
+	$setup_info['mydms']['title']     = 'mydms';
+	$setup_info['mydms']['version']   = '2.0.001';
+	$setup_info['mydms']['app_order'] = 5;
+	$setup_info['mydms']['enable']    = 1;
+
+	$setup_info['mydms']['author'] = 'Real SoftService';
+	$setup_info['mydms']['note']   = 'DMS(Document Management System for Egroupware';
+	$setup_info['mydms']['license']  = 'GPL';
+	$setup_info['mydms']['description'] =
+		'This module is ported from project mydms';
+
+	$setup_info['mydms']['maintainer'] = 'Lars Kneschke';
+	$setup_info['mydms']['maintainer_email'] = 'l.kneschke@metaways.de';
+ 
+	/* The hooks this app includes, needed for hooks registration */
+	$setup_info['mydms']['hooks'][] = 'sidebox_menu';
+
+    /* The tables this app creates */
+	$setup_info['mydms']['tables']    = array(
+		'phpgw_mydms_acls',
+		'phpgw_mydms_documentcontent',
+		'phpgw_mydms_documents',
+		'phpgw_mydms_folders',
+		'phpgw_mydms_groupmembers',
+		'phpgw_mydms_groups',
+		'phpgw_mydms_notify',
+		'phpgw_mydms_documentlinks',
+		'phpgw_mydms_sessions',
+		'phpgw_mydms_userimages',
+		'phpgw_mydms_users',
+		'phpgw_mydms_keywordcategories',
+		'phpgw_mydms_keywords'
+	);
+	//$setup_info['mydms']['only_db'] = array('mysql');
+	
+	/* Dependencies for this app to work */
+	$setup_info['mydms']['depends'][] = array(
+		 'appname'  => 'phpgwapi',
+		 'versions' => Array('2.0.006')
+	);
+?>
Index: /contrib/Dms/setup/phpgw_zh-tw.lang
===================================================================
--- /contrib/Dms/setup/phpgw_zh-tw.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_zh-tw.lang	(revision 3526)
@@ -0,0 +1,67 @@
+access mode	mydms	zh-tw	å­åæš¡åŒ
+access rights	mydms	zh-tw	å­åæ¬é
+access_mode_all	mydms	zh-tw	å
+šéš
+access_mode_none	mydms	zh-tw	æçµå­å
+access_mode_read	mydms	zh-tw	è®å
+access_mode_readwrite	mydms	zh-tw	è®åïŒå¯«å
+¥
+acl get inherited	mydms	zh-tw	ç¹Œæ¿å­åæ¬é
+add acl	mydms	zh-tw	æ°å¢å­åæ¬é
+add document	mydms	zh-tw	æ°å¢æªæ¡
+add notification	mydms	zh-tw	æ°å¢æééç¥
+add subfolder	mydms	zh-tw	æ°å¢å­è³æå€Ÿ
+admin-tools	mydms	zh-tw	ç®¡çå·¥å
+·
+all versions	mydms	zh-tw	ææçæ¬
+comment	mydms	zh-tw	åèš»
+comment for current version	mydms	zh-tw	ç®åçæ¬çåèš»
+copy acl	mydms	zh-tw	è€è£œå­åæ¬é
+copy documents	mydms	zh-tw	è€è£œæªæ¡
+copy folder	mydms	zh-tw	è€è£œè³æå€Ÿ
+copy options	mydms	zh-tw	è€è£œéžé 
+
+copy subfolders	mydms	zh-tw	è€è£œå­è³æå€Ÿ
+create empty acl	mydms	zh-tw	å»ºç«ç©ºçå­åæ¬é
+creation date	mydms	zh-tw	æäŸçµŠ
+current acl	mydms	zh-tw	ç®åå­åæ¬é
+current version	mydms	zh-tw	ç®åçæ¬
+default access	mydms	zh-tw	é èš­å­åæ¬é
+delete folder	mydms	zh-tw	åªé€è³æå€Ÿ
+delete this notification	mydms	zh-tw	åªé€éåæééç¥
+do you really want to delete this acl?	mydms	zh-tw	æšç¢ºå®èŠåªé€éåå­åæ¬éïŒ
+do you really want to delete this document?	mydms	zh-tw	æšç¢ºå®èŠåªé€éåæªæ¡ïŒ
+do you really want to delete this version of the document?	mydms	zh-tw	æšç¢ºå®èŠåªé€éåæªæ¡çæ¬ïŒ
+does not expire	mydms	zh-tw	æ°žé åçš
+download	mydms	zh-tw	äžèŒ
+edit folder	mydms	zh-tw	ç·šèŒ¯è³æå€Ÿ
+expires	mydms	zh-tw	éæ
+expires after	mydms	zh-tw	å°ææ¥
+file size	mydms	zh-tw	æªæ¡å€§å°
+filename	mydms	zh-tw	æªæ¡åçš±
+folder	mydms	zh-tw	è³æå€Ÿ
+general information	mydms	zh-tw	äžè¬è³èš
+information about last update	mydms	zh-tw	æåŸæŽæ°è³èš
+informations	mydms	zh-tw	è³èš
+inherit acl again	mydms	zh-tw	åæ¬¡ç¹Œæ¿å­åæ¬é
+last update	mydms	zh-tw	æåŸæŽæ°
+linked documents	mydms	zh-tw	é£çµçæªæ¡
+lock status	mydms	zh-tw	éå®çæ
+
+mime type	mydms	zh-tw	Mimeé¡å
+move document	mydms	zh-tw	ç§»åæªæ¡
+move folder	mydms	zh-tw	ç§»åè³æå€Ÿ
+mydms	common	zh-tw	æçæä»¶å€Ÿ
+notifications	mydms	zh-tw	æééç¥
+permission	mydms	zh-tw	æ¬é
+select folder	mydms	zh-tw	éžæè³æå€Ÿ
+select target folder	mydms	zh-tw	éžæç®æšè³æå€Ÿ
+target folder	mydms	zh-tw	ç®æšè³æå€Ÿ
+this document gets locked by you!	mydms	zh-tw	éåæªæ¡è¢«æšéå®ïŒ
+this document gets unlocked by you.	mydms	zh-tw	éåæªæ¡è¢«æšåæ¶éå®ã
+this document is currently not locked.	mydms	zh-tw	éåç®åæªéå®ã
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	zh-tw	éåæªæ¡ç®åè¢« <a href="mailto:%1">%2</a> éå®ã
+update document	mydms	zh-tw	æŽæ°æªæ¡
+upload date	mydms	zh-tw	äžå³å°
+uploaded by	mydms	zh-tw	äžå³èª
+view online	mydms	zh-tw	ç·äžæª¢èŠ
Index: /contrib/Dms/setup/phpgw_nl.lang
===================================================================
--- /contrib/Dms/setup/phpgw_nl.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_nl.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	nl	toegangsmodus
+access rights	mydms	nl	toegangsrechten
+access_mode_all	mydms	nl	Alle
+access_mode_none	mydms	nl	Geen toegang
+access_mode_read	mydms	nl	Lezen
+access_mode_readwrite	mydms	nl	Lezen+Schrijven
+acl get inherited	mydms	nl	acl wordt geërfd
+add acl	mydms	nl	acl toevoegen
+add document	mydms	nl	document toevoegen
+add notification	mydms	nl	notificatie toevoegen
+add subfolder	mydms	nl	submap toevoegen
+admin-tools	mydms	nl	beheerders hulpmiddelen
+all versions	mydms	nl	alle versies
+comment	mydms	nl	Kommentaar
+comment for current version	mydms	nl	Kommentaar bij de huidige versie
+copy acl	mydms	nl	kopieer acl
+copy documents	mydms	nl	kopieer documenten
+copy folder	mydms	nl	kopieer map
+copy options	mydms	nl	kopieer opties
+copy subfolders	mydms	nl	kopieer submap
+create empty acl	mydms	nl	maak een lege acl aan
+creation date	mydms	nl	aanmaakdatum
+current acl	mydms	nl	huidige acl
+current version	mydms	nl	huidige versie
+default access	mydms	nl	standaard toegang
+delete folder	mydms	nl	map verwijderen
+delete this notification	mydms	nl	deze notificatie verwijderen
+do you really want to delete this acl?	mydms	nl	Wilt u deze acl werkelijk verwijderen?
+do you really want to delete this document?	mydms	nl	Wilt u dit document werkelijk verwijderen?
+do you really want to delete this version of the document?	mydms	nl	wilt u deze versie van dit document werkelijk verwijderen?
+does not expire	mydms	nl	verloopt nooit
+download	mydms	nl	ophalen
+edit folder	mydms	nl	map bewerken
+expires	mydms	nl	verloopt
+expires after	mydms	nl	verloopt na
+file size	mydms	nl	bestandsgrootte
+filename	mydms	nl	bestandsnaam
+folder	mydms	nl	map
+general information	mydms	nl	algemene informatie
+information about last update	mydms	nl	informatie over de laatste update
+informations	mydms	nl	Informatie
+inherit acl again	mydms	nl	acl opnieuw erven
+last update	mydms	nl	laatste update
+linked documents	mydms	nl	gekoppelde documenten
+lock status	mydms	nl	status vastzetten
+mime type	mydms	nl	Mime Type
+move document	mydms	nl	document verplaatsen
+move folder	mydms	nl	map verplaatsen
+mydms	common	nl	myDMS
+notifications	mydms	nl	notificaties
+permission	mydms	nl	toestemming
+select folder	mydms	nl	map selecteren
+select target folder	mydms	nl	doel map selecteren
+target folder	mydms	nl	doel map
+this document gets locked by you!	mydms	nl	dit document wordt door u vastgezet!
+this document gets unlocked by you.	mydms	nl	dit document wordt door u vrijgegeven.
+this document is currently not locked.	mydms	nl	dit document is op dit moment niet vastgezet.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	nl	dit document is vastgezet door <a href="mailto:%1">%2</a>.
+update document	mydms	nl	document bijwerken
+upload date	mydms	nl	verzenddatum
+uploaded by	mydms	nl	verzonden door
+view online	mydms	nl	online bekijken
Index: /contrib/Dms/setup/phpgw_es-es.lang
===================================================================
--- /contrib/Dms/setup/phpgw_es-es.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_es-es.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	es-es	modo de acceso
+access rights	mydms	es-es	derechos de acceso
+access_mode_all	mydms	es-es	Todos
+access_mode_none	mydms	es-es	Sin acceso
+access_mode_read	mydms	es-es	Lectura
+access_mode_readwrite	mydms	es-es	Lectura y escritura
+acl get inherited	mydms	es-es	acl heredada
+add acl	mydms	es-es	añadir acl
+add document	mydms	es-es	añadir documento
+add notification	mydms	es-es	añadir notificación
+add subfolder	mydms	es-es	añadir subcarpeta
+admin-tools	mydms	es-es	Herramientas de administración
+all versions	mydms	es-es	Todas las versiones
+comment	mydms	es-es	Comentario
+comment for current version	mydms	es-es	Comentario sobre la versión actual
+copy acl	mydms	es-es	copiar acl
+copy documents	mydms	es-es	copiar documentos
+copy folder	mydms	es-es	copiar carpeta
+copy options	mydms	es-es	copiar opciones
+copy subfolders	mydms	es-es	copiar subcarpeta
+create empty acl	mydms	es-es	crear acl vacía
+creation date	mydms	es-es	fecha de creación
+current acl	mydms	es-es	acl actual
+current version	mydms	es-es	Versión actual
+default access	mydms	es-es	acceso predeterminado
+delete folder	mydms	es-es	borrar carpeta
+delete this notification	mydms	es-es	borrar esta notificación
+do you really want to delete this acl?	mydms	es-es	¿Realmente desea borrar esta acl?
+do you really want to delete this document?	mydms	es-es	¿Realmente desea borrar este documento?
+do you really want to delete this version of the document?	mydms	es-es	¿Realmente desea borrar esta versión del documento?
+does not expire	mydms	es-es	no expira
+download	mydms	es-es	descargar
+edit folder	mydms	es-es	editar carpeta
+expires	mydms	es-es	expira
+expires after	mydms	es-es	expira después de
+file size	mydms	es-es	tamaño del fichero
+filename	mydms	es-es	nombre del fichero
+folder	mydms	es-es	carpeta
+general information	mydms	es-es	información general
+information about last update	mydms	es-es	información sobre la última actualización
+informations	mydms	es-es	Información
+inherit acl again	mydms	es-es	volver a heredar acl
+last update	mydms	es-es	última actualización
+linked documents	mydms	es-es	documentos vinculados
+lock status	mydms	es-es	estado del bloqueo
+mime type	mydms	es-es	Tipo MIME
+move document	mydms	es-es	mover documento
+move folder	mydms	es-es	mover carpeta
+mydms	common	es-es	Sistema de gestión de documentos
+notifications	mydms	es-es	notificaciones
+permission	mydms	es-es	permiso
+select folder	mydms	es-es	seleccionar carpeta
+select target folder	mydms	es-es	seleccionar carpeta de destino
+target folder	mydms	es-es	carpeta de destino
+this document gets locked by you!	mydms	es-es	este documento está bloqueado por usted
+this document gets unlocked by you.	mydms	es-es	este documento ha sido desbloqueado por usted
+this document is currently not locked.	mydms	es-es	este documento no se encuentra bloqueado
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	es-es	este documento está bloqueado por <a href="mailto:%1">%2</a>.
+update document	mydms	es-es	actualizar documento
+upload date	mydms	es-es	fecha en que se subió
+uploaded by	mydms	es-es	subido por
+view online	mydms	es-es	ver en línea
Index: /contrib/Dms/setup/phpgw_hu.lang
===================================================================
--- /contrib/Dms/setup/phpgw_hu.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_hu.lang	(revision 3526)
@@ -0,0 +1,295 @@
+--choose group--	mydms	hu	--Csoport vÃ¡lasztÃ¡sa--
+--choose user--	mydms	hu	--FelhasznÃ¡lÃ³ vÃ¡lasztÃ¡sa--
+--please choose--	mydms	hu	--KÃ©rem vÃ¡lasszon--
+<a class="inheritaccess" href="%1">inherit access</a>	mydms	hu	<a class="inheritAccess" href="%1">HozzÃ¡fÃ©rÃ©si jogosultsÃ¡g Ã¶rÃ¶kÃ¶ltetÃ©se</a>
+<a class="inheritaccess" href="[inheriturl]">inherit access</a>	mydms	hu	<a class="inheritAccess" href="[inheriturl]">HozzÃ¡fÃ©rÃ©si jogosultsÃ¡g Ã¶rÃ¶kÃ¶ltetÃ©se</a>
+<a class=\"inheritaccess\" href=\"[inheriturl]\">inherit access</a>	mydms	hu	<a class="inheritAccess" href="[inheriturl]">HozzÃ¡fÃ©rÃ©si jogosultsÃ¡g Ã¶rÃ¶kÃ¶ltetÃ©se</a>
+<br>setting image for user...	mydms	hu	<br>KÃ©p beÃ¡llÃ­tÃ¡sa a felhasznÃ¡lÃ³hoz...
+accept	mydms	hu	Elfogad
+access is being inherited.<p><a class="inheritaccess" href="%1">copy inherited access-list</a><br><a class="inheritaccess" href="%2">start with empty access-list</a>	mydms	hu	A hozzÃ¡fÃ©rÃ©si jogok Ã¶rÃ¶klÃ¶ttek.<p><a class="inheritAccess" href="%1">ÃrÃ¶klÃ¶tt hozzÃ¡fÃ©rÃ©si lista mÃ¡solÃ¡sa</a><br><a class="inheritAccess" href="%2">KezdÃ©s egy Ãºj Ã©s ÃŒres hozzÃ¡fÃ©rÃ©si listÃ¡val</a>
+access is being inherited.<p><a class="inheritaccess" href="[copyurl]">copy inherited access-list</a><br><a class="inheritaccess" href="[emptyurl]">start with empty access-list</a>	mydms	hu	A hozzÃ¡fÃ©rÃ©si jogok Ã¶rÃ¶klÃ¶ttek.<p><a class="inheritAccess" href="[copyurl]">ÃrÃ¶klÃ¶tt hozzÃ¡fÃ©rÃ©si lista mÃ¡solÃ¡sa</a><br><a class="inheritAccess" href="[emptyurl]">KezdÃ©s egy Ãºj Ã©s ÃŒres hozzÃ¡fÃ©rÃ©si listÃ¡val</a>
+access mode	mydms	hu	HozzÃ¡fÃ©rÃ©si mÃ³d
+access rights	mydms	hu	HozzÃ¡fÃ©rÃ©si jogosultsÃ¡gok
+access-list is empty	mydms	hu	A hozzÃ¡fÃ©rÃ©si lista ÃŒres
+access_mode_all	mydms	hu	Ãsszes
+access_mode_none	mydms	hu	Nincs hozzÃ¡fÃ©rÃ©se
+access_mode_read	mydms	hu	Olvas
+access_mode_readwrite	mydms	hu	ÃrÃ¡s+olvasÃ¡s
+acl get inherited	mydms	hu	szÃ¡rmaztatott ACL
+add a member	mydms	hu	Tag hozzÃ¡adÃ¡sa
+add access	mydms	hu	HozzÃ¡fÃ©rÃ©s hozzÃ¡adÃ¡sa
+add acl	mydms	hu	ACL hozzÃ¡adÃ¡sa
+add category	mydms	hu	KategÃ³ria hozzÃ¡adÃ¡sa
+add document	mydms	hu	Dokumentum hozzÃ¡adÃ¡sa
+add keywords	mydms	hu	Kulcsszavak hozzÃ¡adÃ¡sa
+add link	mydms	hu	HivatkozÃ¡s hozzÃ¡adÃ¡sa
+add new group	mydms	hu	Csoport hozzÃ¡adÃ¡sa
+add new notify	mydms	hu	Ãj Ã©rtesÃ­tÃ©s hozzÃ¡adÃ¡sa
+add new user	mydms	hu	Ãj felhasznÃ¡lÃ³ hozzÃ¡adÃ¡sa
+add notification	mydms	hu	ÃrtesÃ­tÅ hozzÃ¡adÃ¡sa
+add subfolder	mydms	hu	Almappa hozzÃ¡adÃ¡sa
+adding category...	mydms	hu	KategÃ³ria hozzÃ¡adÃ¡sa...
+adding document "[documentname]" to folder "[foldername]"...	mydms	hu	Dokumentum \"[documentname]\" hozzÃ¡adÃ¡sa a(z) \"[foldername]\" mappÃ¡hoz...
+adding document %1 to folder %2...	mydms	hu	%1 dokumentum hozzÃ¡adÃ¡sa a(z) %2 mappÃ¡hoz...
+adding document \"[documentname]\" to folder \"[foldername]\"...	mydms	hu	Dokumentum \"[documentname]\" hozzÃ¡adÃ¡sa a(z) \"[foldername]\" mappÃ¡hoz...
+adding element to access-list...	mydms	hu	Elem hozzÃ¡adÃ¡sa a hozzÃ¡fÃ©rÃ©si listÃ¡hoz...
+adding element to notify-list...	mydms	hu	Elem hozzÃ¡adÃ¡sa az Ã©rtesÃ­tÅ listÃ¡hoz...
+adding group to system...	mydms	hu	Csoport hozzÃ¡adÃ¡sa a rendszerhez...
+adding keywords...	mydms	hu	Kulcsszavak hozzÃ¡adÃ¡sa...
+adding link to related document...	mydms	hu	HivatkozÃ¡s hozzÃ¡adÃ¡sa a kapcsolÃ³dÃ³ dokumentumokhoz...
+adding member to group...	mydms	hu	Tag hozzÃ¡adÃ¡sa csoporthoz...
+adding subfolder "%1" to folder "%2"...	mydms	hu	"%1" almappa hozzÃ¡adÃ¡sa a "%2" mappÃ¡hoz...
+adding subfolder "[subfoldername]" to folder "[foldername]"...	mydms	hu	"%1" almappa hozzÃ¡adÃ¡sa a "%2" mappÃ¡hoz...
+adding user to system...	mydms	hu	FelhasznÃ¡lÃ³ hozzÃ¡adÃ¡sa a rendszerhez...
+admin-tools	mydms	hu	AdminisztrÃ¡ciÃ³
+after "[prevname]"	mydms	hu	%1 utÃ¡n
+after %1	mydms	hu	%1 utÃ¡n
+all	mydms	hu	Teljes jogkÃ¶r
+all folders	mydms	hu	Ãsszes mappÃ¡ban
+all users	mydms	hu	Ãsszes felhasznÃ¡lÃ³
+all versions	mydms	hu	Ãsszes verziÃ³
+all words	mydms	hu	Ã¶sszes kifejezÃ©s
+an error has occured	mydms	hu	Hiba tÃ¶rtÃ©nt
+and	mydms	hu	Ã©s
+at least one word	mydms	hu	legalÃ¡bb egy kifejezÃ©s
+at the end	mydms	hu	A vÃ©gÃ©re
+available keywords	mydms	hu	RendelkezÃ©sre Ã¡llÃ³ kulcsszavak
+between	mydms	hu	kÃ¶zÃ¶tte
+cancel	mydms	hu	Elvet
+categories	mydms	hu	KategÃ³riÃ¡k
+changing access-mode...	mydms	hu	HozzÃ¡fÃ©rÃ©si mÃ³d megvÃ¡ltoztatÃ¡sa...
+changing category...	mydms	hu	KategÃ³ria megvÃ¡ltoztatÃ¡sa...
+changing keywords...	mydms	hu	Kulcsszavak megvÃ¡ltoztatÃ¡sa...
+choose document	mydms	hu	VÃ¡lasszon egy dokumentumot
+choose target-folder	mydms	hu	VÃ¡lasszon cÃ©lmappÃ¡t
+comment	mydms	hu	MegjegyzÃ©s
+comment for current version	mydms	hu	MegjegyzÃ©s a legfrissebb verziÃ³hoz
+confirm password	mydms	hu	JelszÃ³ megerÅsÃ­tÃ©se
+content	mydms	hu	Tartalom
+copy acl	mydms	hu	ACL mÃ¡solÃ¡sa
+copy documents	mydms	hu	Dokumentum mÃ¡solÃ¡sa
+copy folder	mydms	hu	Mappa mÃ¡solÃ¡sa
+copy options	mydms	hu	OpciÃ³k mÃ¡solÃ¡sa
+copy subfolders	mydms	hu	Almappa mÃ¡solÃ¡sa
+copying access-list...	mydms	hu	HozzÃ¡fÃ©rÃ©si lista mÃ¡solÃ¡sa...
+create empty acl	mydms	hu	Ãres ACL lÃ©trehozÃ¡sa
+created	mydms	hu	KÃ©szÃŒlt
+creation date	mydms	hu	LÃ©trehozÃ¡s dÃ¡tuma
+current acl	mydms	hu	AktuÃ¡lis ACL
+current version	mydms	hu	AktuÃ¡lis verziÃ³
+default access	mydms	hu	AlapÃ©rtelmezett hozzÃ¡fÃ©rÃ©s
+default access-mode	mydms	hu	AlapÃ©rtelmezett hozzÃ¡fÃ©rÃ©si mÃ³d
+delete	mydms	hu	TÃ¶rlÃ©s
+delete folder	mydms	hu	Mappa tÃ¶rlÃ©se
+delete keywords	mydms	hu	Kulcsszavak tÃ¶rlÃ©se
+delete this category	mydms	hu	KategÃ³ria tÃ¶rlÃ©se
+delete this notification	mydms	hu	ÃrtesÃ­tÃ©s tÃ¶rlÃ©se
+deleting category...	mydms	hu	KategÃ³ria tÃ¶rlÃ©se...
+deleting keywords...	mydms	hu	Kulcsszavak tÃ¶rlÃ©se...
+do you really want to delete this acl?	mydms	hu	ValÃ³ban tÃ¶rÃ¶lni kÃ­vÃ¡nja ezt az ACL-t?
+do you really want to delete this document?	mydms	hu	ValÃ³ban tÃ¶rÃ¶lni kÃ­vÃ¡nja ezt a dokumentumot?
+do you really want to delete this version of the document?	mydms	hu	ValÃ³ban tÃ¶rÃ¶lni kÃ­vÃ¡nja a dokumentum ezen verziÃ³jÃ¡t?
+do you really want to remove the "[foldername]" and its content?<br>be careful: this action cannot be undone.	mydms	hu	ValÃ³ban tÃ¶rÃ¶lni kÃ­vÃ¡nja a "%1" mappÃ¡t Ã©s a teljes tartalmÃ¡t?<br>Figyelem: Ez a mÅ±velet nem vonhatÃ³ vissza!
+do you really want to remove the document "[documentname]"?<br>be careful: this action cannot be undone.	mydms	hu	ValÃ³ban el akarja tÃ¡volÃ­tani a dokumentumot "[documentname]"?<br>Figyelem: ez a mÅ±velet nem vonhatÃ³ vissza!
+do you really want to remove the document %1?<br>be careful: this action cannot be undone.	mydms	hu	ValÃ³ban el akarja tÃ¡volÃ­tani a dokumentumot  %1?<br>Figyelem: ez a mÅ±velet nem vonhatÃ³ vissza!
+do you really want to remove the folder "%1" and its content?<br>be careful: this action cannot be undone.	mydms	hu	ValÃ³ban tÃ¶rÃ¶lni kÃ­vÃ¡nja a "%1" mappÃ¡t Ã©s a teljes tartalmÃ¡t?<br>Figyelem: Ez a mÅ±velet nem vonhatÃ³ vissza!
+do you really want to remove version %2 of document %1?<br>be careful: this action cannot be undone.	mydms	hu	ValÃ³ban el akarja tÃ¡volÃ­tani a dokumentum %2 ezen verziÃ³jÃ¡t %1?<br>Figyelem: ez a mÅ±velet nem vonhatÃ³ vissza!
+do you really want to remove version [version] of document "[documentname]"?<br>be careful: this action cannot be undone.	mydms	hu	ValÃ³ban el akarja tÃ¡volÃ­tani a dokumentum [version] ezen verziÃ³jÃ¡t [documentname]?<br>Figyelem: ez a mÅ±velet nem vonhatÃ³ vissza!
+document-overview	mydms	hu	Dokumentum Ã¡ttekintÅ
+documents	mydms	hu	Dokumentumok
+does not expire	mydms	hu	Nem jÃ¡r le
+done	mydms	hu	KÃ©sz
+download	mydms	hu	LetÃ¶ltÃ©s
+edit access	mydms	hu	HozzÃ¡fÃ©rÃ©sek szerkesztÃ©se
+edit access-list	mydms	hu	HozzÃ¡fÃ©rÃ©si lista szerkesztÃ©se
+edit categories	mydms	hu	KategÃ³riÃ¡k szerkesztÃ©se
+edit document	mydms	hu	Dokumentum szerkesztÃ©se
+edit document access again	mydms	hu	Dokumentum hozzÃ¡fÃ©rÃ©sÃ©nek beÃ¡llÃ­tÃ¡sa ÃºjbÃ³l
+edit document again	mydms	hu	Dokumentum szerkesztÃ©se megint
+edit folder	mydms	hu	Mappa szerkesztÃ©se
+edit folder access again	mydms	hu	Mappa hozzÃ¡fÃ©rÃ©s ÃºjbÃ³li szerkesztÃ©se
+edit folder again	mydms	hu	Mappa szerkesztÃ©se ÃºjbÃ³l
+edit group	mydms	hu	Csoport szerkesztÃ©se
+edit group %1	mydms	hu	%1 csoport szerkesztÃ©se
+edit keywords	mydms	hu	Kulcsszavak szerkesztÃ©se
+edit notify-list	mydms	hu	ÃrtesÃ­tÃ©s szerkesztÃ©se
+edit notify-list again	mydms	hu	ÃrtesÃ­tÅ lista szerkesztÃ©se ÃºjbÃ³l
+edit personal keywords	mydms	hu	SzemÃ©lyes kulcsszavak szerkesztÃ©se
+edit user	mydms	hu	FelhasznÃ¡lÃ³ szerkesztÃ©se
+editing access...	mydms	hu	HozzÃ¡fÃ©rÃ©s szerkesztÃ©se...
+editing document...	mydms	hu	Dokumentum szerkesztÃ©se...
+editing folder...	mydms	hu	Mappa szerkesztÃ©se...
+editing group...	mydms	hu	Csoport szerkesztÃ©se...
+editing user settings...	mydms	hu	FelhasznÃ¡lÃ³ beÃ¡llÃ­tÃ¡sok szerkesztÃ©se...
+editing user...	mydms	hu	FelhasznÃ¡lÃ³ szerkesztÃ©se...
+elapsed time: [time] sec.	mydms	hu	Eltelt idÅ: [time] mÃ¡sodperc.
+email	mydms	hu	Email
+expires	mydms	hu	LejÃ¡r
+expires after	mydms	hu	LejÃ¡rat ideje
+file size	mydms	hu	ÃllomÃ¡ny mÃ©ret
+filename	mydms	hu	ÃllomÃ¡nynÃ©v
+filesize	mydms	hu	MÃ©ret
+first position	mydms	hu	Az elejÃ©re
+folder	mydms	hu	Mappa
+folder-overview	mydms	hu	Mappa Ã¡ttekintÅ
+foldertree	mydms	hu	Mappa fa
+found [count] documents for "[query]".	mydms	hu	%1 dokumentum talÃ¡lhatÃ³ a lekÃ©rdezÃ©s szerint "%2".
+fullname	mydms	hu	Teljes nÃ©v
+general information	mydms	hu	ÃltalÃ¡nos informÃ¡ciÃ³k
+global keywords	mydms	hu	GlobÃ¡lis kulcsszavak
+go back	mydms	hu	VisszatÃ©rÃ©s
+goto	mydms	hu	UgrÃ¡s
+group	mydms	hu	Csoport
+group members	mydms	hu	Csoport tagok
+groups	mydms	hu	Csoportok
+image	mydms	hu	KÃ©p
+in folder	mydms	hu	A mappÃ¡ban
+information about last update	mydms	hu	UtolsÃ³ frissÃ­tÃ©s rÃ©szletei
+informations	mydms	hu	InformÃ¡ciÃ³
+inherit access	mydms	hu	ÃrÃ¶klÃ¶tt hozzÃ¡fÃ©rÃ©si jogosultsÃ¡gok szerkesztÃ©se
+inherit acl again	mydms	hu	ACL szÃ¡rmaztatÃ¡sa ÃºjbÃ³l
+keep position	mydms	hu	Maradjon a pozÃ­ciÃ³jÃ¡n
+keywords	mydms	hu	Kulcsszavak
+language	mydms	hu	Nyelv
+last update	mydms	hu	UtolsÃ³ frissÃ­tÃ©s
+last updated	mydms	hu	UtolsÃ³ mÃ³dosÃ­tÃ¡s
+linked by	mydms	hu	HozzÃ¡rendelte:;
+linked documents	mydms	hu	Csatolt dokumentumok
+list of users	mydms	hu	FelhasznÃ¡lÃ³k listÃ¡ja
+local file	mydms	hu	Helyi fÃ¡jl
+lock	mydms	hu	ZÃ¡rolÃ¡s
+lock status	mydms	hu	ZÃ¡rolÃ¡s Ã¡llapota
+locking document...	mydms	hu	Dokumentum zÃ¡rolÃ¡sa...
+logged in	mydms	hu	BelÃ©pve mint
+login	mydms	hu	BejelentkezÃ©s
+login as guest	mydms	hu	BelÃ©pÃ©s mint vendÃ©g (publikus)
+logout	mydms	hu	KilÃ©pÃ©s
+mime type	mydms	hu	MIME tÃ­pus
+mime-type	mydms	hu	Mime tÃ­pus
+mode	mydms	hu	MÃ³d
+move document	mydms	hu	Dokumentum mozgatÃ¡s
+move folder	mydms	hu	Mappa mozgatÃ¡s
+moving document...	mydms	hu	Dokumentum mozgatÃ¡sa...
+moving folder...	mydms	hu	Mappa mozgatÃ¡sa...
+my account	mydms	hu	HozzÃ¡fÃ©rÃ©sem
+mydms	common	hu	DokumentumtÃ¡r
+mydms - document %1	mydms	hu	MyDMS - Dokumentum %1
+mydms - document [documentname]	mydms	hu	MyDMS - Dokumentum [documentname]
+mydms - folder %1	mydms	hu	MyDMS - Mappa %1
+mydms - folder [foldername]	mydms	hu	MyDMS - Mappa [foldername]
+name	mydms	hu	NÃ©v
+new image	mydms	hu	Ãj kÃ©p
+new or expired documents in your dms	mydms	hu	Ãj vagy lejÃ¡rt dokumentum a DokumentumkezelÅ rendszerben
+no	mydms	hu	Nem
+no access	mydms	hu	HozzÃ¡fÃ©rÃ©s megtagadva
+no documents	mydms	hu	Nincsenek dokumentumok
+no entries	mydms	hu	Nincsenek bejegyzÃ©sek
+no groups	mydms	hu	Nincsenek csoportok
+no image found	mydms	hu	KÃ©p nem talÃ¡lhatÃ³
+no keywords available	mydms	hu	Nem Ã©rhetÅk el kulcsszavak
+no related documents	mydms	hu	Nincsenek kapcsolÃ³dÃ³ dokumentumok
+no subfolders	mydms	hu	Nincsenek almappÃ¡k
+notifications	mydms	hu	ÃrtesÃ­tÃ©sek
+notify-list	mydms	hu	ÃrtesÃ­tÅ lista
+only .jpg-images may be used as user-images	mydms	hu	Csak .jpg kÃ©pek hasznÃ¡lhatÃ³ak felhasznÃ¡lÃ³i ikonkÃ©nt.
+only this ([foldername]) including subfolders	mydms	hu	csak itt ([foldername]), az almappÃ¡kkal egyÃŒtt
+overview of folders and documents	mydms	hu	MappÃ¡k Ã©s dokumentumok Ã¡ttekintÃ©se
+owner	mydms	hu	Tulajdonos
+password	mydms	hu	JelszÃ³
+password and passwords-confirmation are not equal	mydms	hu	A megadott jelszÃ³ Ã©s megerÅsÃ­tÃ©se nem egyezik
+path	mydms	hu	Ãtvonal
+permission	mydms	hu	EngedÃ©lyek
+personal keywords	mydms	hu	SzemÃ©lyes kulcsszavak
+please select a file	mydms	hu	KÃ©rem vÃ¡lasszon egy dokumentumot
+please select an user	mydms	hu	KÃ©rem vÃ¡lasszon egy felhasznÃ¡lÃ³t
+please type in a name	mydms	hu	KÃ©rem adjon meg egy nevet
+please type in an username	mydms	hu	KÃ©rem adjon meg egy felhasznÃ¡lÃ³nevet
+public	mydms	hu	NyilvÃ¡nos
+read	mydms	hu	OlvasÃ¡si jog
+read-write	mydms	hu	ÃrÃ¡s Ã©s olvasÃ¡s
+related documents	mydms	hu	KapcsolÃ³dÃ³ dokumentumok
+remove document	mydms	hu	Dokumentum tÃ¶rlÃ©se
+remove folder	mydms	hu	Mappa tÃ¶rlÃ©se
+remove link	mydms	hu	HivatkozÃ¡s eltÃ¡volÃ­tÃ¡sa
+remove member	mydms	hu	Tag eltÃ¡volÃ­tÃ¡sa
+remove this group	mydms	hu	Csoport eltÃ¡volÃ­tÃ¡sa
+remove this user	mydms	hu	FelhasznÃ¡lÃ³ eltÃ¡volÃ­tÃ¡sa
+remove version	mydms	hu	VerziÃ³ tÃ¶rlÃ©se
+removing acl. document will inherit access...	mydms	hu	ACL eltÃ¡volÃ­tÃ¡sa. A dokument Ã¶rÃ¶kli a hozzÃ¡fÃ©rÃ©si jogosultsÃ¡gokat...
+removing acl. folder will inherit access...	mydms	hu	ACL eltÃ¡volÃ­tÃ¡sa. A mappa Ã¶rÃ¶kÃ¶lni fogja a hozzÃ¡fÃ©rÃ©seket...
+removing document...	mydms	hu	Dokumentum eltÃ¡volÃ­tÃ¡sa...
+removing element from access-list...	mydms	hu	Elem eltÃ¡volÃ­tÃ¡sa a hozzÃ¡fÃ©rÃ©si listÃ¡rÃ³...
+removing element from notify-list...	mydms	hu	Elem eltÃ¡volÃ­tÃ¡sa az Ã©rtesÃ­tÅ listÃ¡rÃ³l...
+removing folder...	mydms	hu	Mappa eltÃ¡volÃ­tÃ¡sa...
+removing group from system...	mydms	hu	Csoport eltÃ¡volÃ­tÃ¡sa a rendszerbÅl...
+removing inherited access. starting with empty acl...	mydms	hu	ÃrÃ¶klÃ¶tt hozzÃ¡fÃ©rÃ©s eltÃ¡volÃ­tÃ¡sa. KezdÃ©s ÃŒres ACL-el...
+removing link to related document...	mydms	hu	KapcsolÃ³dÃ³ dokumentumokhoz valÃ³ hivatkozÃ¡s eltÃ¡volÃ­tÃ¡sa...
+removing member from group...	mydms	hu	Tag eltÃ¡volÃ­tÃ¡sa a csoportbÃ³l...
+removing user from system...	mydms	hu	FelhasznÃ¡lÃ³ eltÃ¡volÃ­tÃ¡sa a rendszerbÅl...
+removing version [version]...	mydms	hu	[version] verziÃ³ eltÃ¡volÃ­tÃ¡sa...
+root folder	mydms	hu	GyÃ¶kÃ©r mappa
+save	mydms	hu	MentÃ©s
+search	mydms	hu	KeresÃ©s
+search for	mydms	hu	KeresÃ©s
+search in	mydms	hu	KeresÃ©s itt
+search results	mydms	hu	KeresÃ©s eredmÃ©nye
+select at least a user or a group	mydms	hu	VÃ¡lasszon ki legalÃ¡bb egy felhasznÃ¡lÃ³t vagy csoportot
+select folder	mydms	hu	Mappa kivÃ¡lasztÃ¡sa
+select one	mydms	hu	VÃ¡lasszon egyet
+select target folder	mydms	hu	CÃ©lmappa kivÃ¡lasztÃ¡sa
+selected document	mydms	hu	KivÃ¡lasztott dokumentum
+selected folder	mydms	hu	KivÃ¡lsztott mappa
+sequence	mydms	hu	Sorrend
+set owner	mydms	hu	Tulajdonos beÃ¡llÃ­tÃ¡sa
+setting default access for document...	mydms	hu	A dokumentum alapÃ©rtelmezett hozzÃ¡fÃ©rÃ©sÃ©nek beÃ¡llÃ­tÃ¡sa...
+setting default access-mode for folder...	mydms	hu	AlapÃ©rtelmezett hozzÃ¡fÃ©rÃ©si mÃ³d beÃ¡llÃ­tÃ¡sa a mappÃ¡ra...
+setting expiration...	mydms	hu	LejÃ¡rat idÅpontjÃ¡nak beÃ¡llÃ­tÃ¡sa...
+setting owner...	mydms	hu	Tulajdonos beÃ¡llÃ­tÃ¡sa...
+specify some keywords	mydms	hu	HatÃ¡rozzon meg nÃ©hÃ¡ny kulcsszÃ³t
+start	mydms	hu	IndÃ­t
+status	mydms	hu	ZÃ¡rolÃ¡si Ã¡llapot
+subfolders	mydms	hu	AlmappÃ¡k
+target folder	mydms	hu	CÃ©lmappa
+the document "[documentname]" (path: "[path]") has expired on [expires]	mydms	hu	A [documentname] dokumentum (Ãºtvonal: [path]) lejÃ¡rt ezen a napon: [expires]
+the document "[documentname]" (path: "[path]") was created or updated on [updated]	mydms	hu	A [documentname] dokumentum (Ãºtvonal: [path]) lÃ©trehozva vagy frissÃ­tve ezen a napon: [updated]
+the document %1 (path: %2) has expired on %3	mydms	hu	A %1 dokumentum (Ãºtvonal: %2) lejÃ¡rt ezen a napon: %3
+the document %1 (path: %2) was created or updated on %3	mydms	hu	A %1 dokumentum (Ãºtvonal: %2) lÃ©trehozva vagy frissÃ­tve ezen a napon: %3
+theme	mydms	hu	TÃ©ma
+there are no documents that match your search ("[query]").	mydms	hu	Nem talÃ¡lhatÃ³ dokumentum a megadott keresÃ©si feltÃ©telek szerint. ("[query]").
+there is no comment	mydms	hu	Nincsenek megjegyzÃ©sek
+this document gets locked by you!	mydms	hu	A dokumentum zÃ¡rolÃ¡sa megtÃ¶rtÃ©nt.
+this document gets unlocked by you.	mydms	hu	A dokumentum zÃ¡rolÃ¡sÃ¡nak feloldÃ¡sa megtÃ¶rtÃ©nt.
+this document is aleady locked	mydms	hu	A dokumentum mÃ¡r zÃ¡rolt.
+this document is currently not locked.	mydms	hu	A dokumentum jelenleg nincs zÃ¡rolva.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	hu	A dokumentumot <a href="mailto:%1">%2</a> zÃ¡rolta.
+this document is locked.	mydms	hu	Ez a dokumentum zÃ¡rolt.
+this document is not locked	mydms	hu	A dokumentum nincs zÃ¡rolva.
+this document was locked by <a href="mailto:[email]">[username]</a>.<br>only authorized users can unlock this document (see end of page).	mydms	hu	Ezt a dokumentumot a <a href="mailto:[email]">[username]</a> nevÅ± felhasznÃ¡lÃ³ zÃ¡rolta.<br>Csak a megfelelÅ jogosultsÃ¡ggal rendelkezÅ felhasznÃ¡lÃ³k tudjÃ¡k a zÃ¡rolÃ¡st feloldani (tekintsen a lap aljÃ¡ra).
+this group has no members	mydms	hu	Ennek a csoportnak nincsenek tagjai
+this username does not exist	mydms	hu	Ez a felhasznÃ¡lÃ³nÃ©v nem lÃ©tezik.
+type in a query	mydms	hu	KÃ©rem adjon meg egy lekÃ©rdezÃ©st
+type in your email-address	mydms	hu	Adja meg az email cÃ­mÃ©t
+unlock	mydms	hu	ZÃ¡rolÃ¡s feloldÃ¡sa
+unlocking document...	mydms	hu	Dokumentum feloldÃ¡sa...
+update	mydms	hu	FrissÃ­tÃ©s
+update document	mydms	hu	Dokumentum frissÃ­tÃ©se
+updating document...	mydms	hu	Dokumentum frissÃ­tÃ©se...
+upload date	mydms	hu	FeltÃ¶ltÃ©s dÃ¡tuma
+upload failed. please contact the administrator.	mydms	hu	A feltÃ¶ltÃ©s nem sikerÃŒlt. LÃ©pjen kapcsolatba az adminisztrÃ¡torral.
+upload-date	mydms	hu	FeltÃ¶ltÃ©s ideje
+uploaded by	mydms	hu	FeltÃ¶ltÅ
+use predefined keywords	mydms	hu	HasznÃ¡lj elÅre meghatÃ¡rozott kulcsszavakat
+user	mydms	hu	FelhasznÃ¡lÃ³
+username	mydms	hu	FelhasznÃ¡lÃ³nÃ©v
+users	mydms	hu	FelhasznÃ¡lÃ³k
+version	mydms	hu	VerziÃ³
+view online	mydms	hu	Online megtekintÃ©s
+yes	mydms	hu	Igen
+you can still update it, beacuse you have access-mode	mydms	hu	Ãn mÃ©gis tudja frissÃ­teni, mivel megvan a megfelelÅ jogosultsÃ¡ga hozzÃ¡
+you can still update it, beacuse you have access-mode "all". locking will automatically be removed.	mydms	hu	Ãn mÃ©gis tudja frissÃ­teni, mivel megvan a megfelelÅ jogosultsÃ¡ga hozzÃ¡. A zÃ¡rolÃ¡s automatikusan el lesz tÃ¡volÃ­tva.
+you can still update it, because you are also the one that locked ist. locking will automatically be removed.	mydms	hu	Ãn frissÃ­theti a dokumentumot, mert Ã¶n zÃ¡rolta a dokumentumot.  A zÃ¡rolÃ¡s automatikusan feloldÃ¡sra Ã©s eltÃ¡volÃ­tÃ¡sra kerÃŒl.
+you can therefore not update this document. please contanct the locking user.	mydms	hu	HÃ¡t bizony, Ã¶n nem frissÃ­theti a dokumentumot. LÃ©pjen kapcsolatba a zÃ¡rolÃ¡st eszkÃ¶zlÅ felhasznÃ¡lÃ³val.
+you don't have enough rights to do that	mydms	hu	Nincs meg a jogosÃ­tvÃ¡nya a mÅ±velethez
+you dont't have enough rights to unlock this document	mydms	hu	Ãnnek nincs meg a jogosultsÃ¡ga, hogy feloldja a dokumentum zÃ¡rolÃ¡sÃ¡t.
+you need to type in your password	mydms	hu	Meg kell adnia a jelszavÃ¡t, kÃŒlÃ¶nben lelÅjÃŒk a kutyÃ¡jÃ¡t!
+your password is incorrect. try again.	mydms	hu	FelhasznÃ¡lÃ³nÃ©v Ã©s/vagy jelszÃ³ nem megfelelÅ. PrÃ³bÃ¡lja Ãºjra.
Index: /contrib/Dms/setup/phpgw_it.lang
===================================================================
--- /contrib/Dms/setup/phpgw_it.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_it.lang	(revision 3526)
@@ -0,0 +1,63 @@
+access mode	mydms	it	modalità accesso
+access rights	mydms	it	diritti di accesso
+access_mode_all	mydms	it	Tutto
+access_mode_none	mydms	it	Nessun accesso
+access_mode_read	mydms	it	Lettura
+access_mode_readwrite	mydms	it	Lettura+Scrittura
+acl get inherited	mydms	it	acl viene ereditata
+add acl	mydms	it	aggiungi acl
+add document	mydms	it	aggiungi documento
+add notification	mydms	it	aggiungi notifica
+add subfolder	mydms	it	aggiungi sottocartella
+admin-tools	mydms	it	Strumenti di Amministrazione
+all versions	mydms	it	Tutte le Versioni
+comment	mydms	it	Commento
+comment for current version	mydms	it	Commento alla versione attuale
+content	mydms	it	Contenuto
+copy acl	mydms	it	copia acl
+copy documents	mydms	it	copia documenti
+copy folder	mydms	it	copia cartella
+copy options	mydms	it	copia opzioni
+copy subfolders	mydms	it	copia sottocartella
+create empty acl	mydms	it	crea acl vuota
+creation date	mydms	it	data creazione
+current acl	mydms	it	acl corrente
+current version	mydms	it	Versiona Attuale
+default access	mydms	it	accesso predefinito
+delete folder	mydms	it	cancella cartella
+delete this notification	mydms	it	cancella questa notifica
+do you really want to delete this acl?	mydms	it	Vuoi davvero cancellare questa acl?
+do you really want to delete this document?	mydms	it	Vuoi davvero cancellare questo documento?
+do you really want to delete this version of the document?	mydms	it	Vuoi davvero cancellare questa versione del documento?
+does not expire	mydms	it	non scade
+download	mydms	it	download
+edit folder	mydms	it	modifica cartella
+expires	mydms	it	scade
+expires after	mydms	it	scade dopo
+file size	mydms	it	dimensione file
+filename	mydms	it	nome file
+folder	mydms	it	cartella
+general information	mydms	it	informazioni generali
+information about last update	mydms	it	informazioni ultimo aggiornamento
+informations	mydms	it	Informazioni
+inherit acl again	mydms	it	eredita acl ancora
+last update	mydms	it	ultimo aggiornamento
+linked documents	mydms	it	documenti collegati
+lock status	mydms	it	stato blocco
+mime type	mydms	it	Tipo Mime
+move document	mydms	it	sposta documento
+move folder	mydms	it	sposta cartella
+mydms	common	it	mydms
+notifications	mydms	it	notifiche
+permission	mydms	it	permesso
+select folder	mydms	it	scegli cartella
+select target folder	mydms	it	scegli cartella destinazione
+target folder	mydms	it	cartella destinazione
+this document gets locked by you!	mydms	it	questo documento viene bloccato da te!
+this document gets unlocked by you.	mydms	it	questo documento viene sbloccato da te
+this document is currently not locked.	mydms	it	questo documento non è attualmente bloccato
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	it	questo documento è bloccato da <a href="mailto:%1">%2</a>.
+update document	mydms	it	aggiorna documento
+upload date	mydms	it	data caricamento
+uploaded by	mydms	it	caricato da
+view online	mydms	it	visualizza online
Index: /contrib/Dms/setup/phpgw_no.lang
===================================================================
--- /contrib/Dms/setup/phpgw_no.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_no.lang	(revision 3526)
@@ -0,0 +1,55 @@
+access mode	mydms	no	aksessmodus
+access rights	mydms	no	Aksessrettigheter
+access_mode_all	mydms	no	Alle
+access_mode_none	mydms	no	Ingen adgang
+access_mode_read	mydms	no	Lese
+access_mode_readwrite	mydms	no	Lese + skrive
+acl get inherited	mydms	no	acl ble arvet
+add acl	mydms	no	Opprett acl
+add document	mydms	no	Opprett dokument
+add notification	mydms	no	Opprett bekjentgjørelse
+add subfolder	mydms	no	Opprett undermappe
+admin-tools	mydms	no	Administrasjonsverktøy
+all versions	mydms	no	Alle versjoner
+comment	mydms	no	Kommentar
+comment for current version	mydms	no	Kommentar til aktuell versjon
+copy acl	mydms	no	kopier acl
+create empty acl	mydms	no	opprett tom acl
+creation date	mydms	no	Først opprettet
+current acl	mydms	no	gjeldende acl
+current version	mydms	no	Aktuell versjon
+default access	mydms	no	standard tilgang
+delete folder	mydms	no	Slette mappe
+delete this notification	mydms	no	slette denne bekjentgjørelsen
+do you really want to delete this acl?	mydms	no	Ønsker du virkelig å slette denne acl ?
+do you really want to delete this document?	mydms	no	Ønsker du å slette dette dokumentet?
+do you really want to delete this version of the document?	mydms	no	ønsker du virkelig å slette denne versjonen av dokumentet ?
+does not expire	mydms	no	alltid disponibel
+download	mydms	no	Trekke ned
+edit folder	mydms	no	Endre mappe
+expires	mydms	no	Gyldighet
+expires after	mydms	no	disponibel innen
+file size	mydms	no	Filstørrelse
+filename	mydms	no	Filnavn
+folder	mydms	no	Mappe
+general information	mydms	no	Generell informasjon
+information about last update	mydms	no	informasjon om siste oppdatering
+informations	mydms	no	Informasjon
+inherit acl again	mydms	no	arve acl igjen
+last update	mydms	no	siste ajourføring
+linked documents	mydms	no	Nylig benyttede dokumenter
+lock status	mydms	no	Sperrestatus
+mime type	mydms	no	Mime-type
+move document	mydms	no	Flytte dokument
+move folder	mydms	no	Flytte mappe
+mydms	common	no	Dokumentsenter
+notifications	mydms	no	Bekjentgjørelser
+permission	mydms	no	tillatelser
+this document gets locked by you!	mydms	no	dette dokumentet ble låst av deg !
+this document gets unlocked by you.	mydms	no	dette dokumentet ble frigitt av deg !
+this document is currently not locked.	mydms	no	dette dokumentet er for nåværende ikke låst
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	no	dette dokumentet er låst av <a href="mailto:%1>%2</a>
+update document	mydms	no	oppdater dokument
+upload date	mydms	no	last opp hos
+uploaded by	mydms	no	last opp gjennom
+view online	mydms	no	anvise online
Index: /contrib/Dms/setup/phpgw_sl.lang
===================================================================
--- /contrib/Dms/setup/phpgw_sl.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_sl.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	sl	NaÄin dostopa
+access rights	mydms	sl	Pravice dostopa
+access_mode_all	mydms	sl	Vsi
+access_mode_none	mydms	sl	Ni dostopa
+access_mode_read	mydms	sl	Branje
+access_mode_readwrite	mydms	sl	Branje+pisanje
+acl get inherited	mydms	sl	ACL se deduje
+add acl	mydms	sl	Dodaj ACL
+add document	mydms	sl	Dodaj dokument
+add notification	mydms	sl	Dodaj obveÅ¡Äanje
+add subfolder	mydms	sl	Dodaj podmapo
+admin-tools	mydms	sl	Orodja Nadzornika
+all versions	mydms	sl	Vse razliÄice
+comment	mydms	sl	Komentar
+comment for current version	mydms	sl	Komentar za trenutno razliÄico
+copy acl	mydms	sl	Kopiraj ACL
+copy documents	mydms	sl	Kopiraj dokumente
+copy folder	mydms	sl	Kopiraj mapo
+copy options	mydms	sl	Kopiraj moÅŸnosti
+copy subfolders	mydms	sl	Kopiraj podmapo
+create empty acl	mydms	sl	Ustvari prazen ACL
+creation date	mydms	sl	Datum ustvarjanja
+current acl	mydms	sl	Trenutni ACL
+current version	mydms	sl	Trenutna razliÄica
+default access	mydms	sl	Privzeti dostop
+delete folder	mydms	sl	IzbriÅ¡i mapo
+delete this notification	mydms	sl	IzbriÅ¡i to obveÅ¡Äanje
+do you really want to delete this acl?	mydms	sl	Res ÅŸelite izbrisati ta ACL?
+do you really want to delete this document?	mydms	sl	Res ÅŸelite izbrisati ta dokument?
+do you really want to delete this version of the document?	mydms	sl	Res ÅŸelite izbrisati to razliÄico dokumenta?
+does not expire	mydms	sl	Ne poteÄe
+download	mydms	sl	Prenesi
+edit folder	mydms	sl	Uredi mapo
+expires	mydms	sl	PoteÄe
+expires after	mydms	sl	PoteÄe po
+file size	mydms	sl	Velikost datoteke
+filename	mydms	sl	Ime datoteke
+folder	mydms	sl	Mapa
+general information	mydms	sl	SploÅ¡ne informacije
+information about last update	mydms	sl	Informacije o zadnji posodobitvi
+informations	mydms	sl	Informacije
+inherit acl again	mydms	sl	Ponovno podeduj ACL
+last update	mydms	sl	Zadnja posodobitev
+linked documents	mydms	sl	Povezani dokumenti
+lock status	mydms	sl	Stanje zaklepanja
+mime type	mydms	sl	Tip MIME
+move document	mydms	sl	Premakni dokument
+move folder	mydms	sl	Premakni mapo
+mydms	common	sl	Dokumenti
+notifications	mydms	sl	Obvestila
+permission	mydms	sl	Dovoljenja
+select folder	mydms	sl	Izberi mapo
+select target folder	mydms	sl	Izberi ciljno mapo
+target folder	mydms	sl	Ciljna mapa
+this document gets locked by you!	mydms	sl	Ta dokument je zaklenjen z vaÅ¡e strani!
+this document gets unlocked by you.	mydms	sl	Ta dokument je odklenjen z vaÅ¡e strani.
+this document is currently not locked.	mydms	sl	Ta dokument trenutno ni zaklenjen.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	sl	Ta dokument je zaklenjen s strani <a href="mailto:%1">%2</a>.
+update document	mydms	sl	Posodobi dokument
+upload date	mydms	sl	Datum prenosa
+uploaded by	mydms	sl	Prenesel (naloÅŸil)
+view online	mydms	sl	Poglej online
Index: /contrib/Dms/setup/default_records.inc.php
===================================================================
--- /contrib/Dms/setup/default_records.inc.php	(revision 3526)
+++ /contrib/Dms/setup/default_records.inc.php	(revision 3526)
@@ -0,0 +1,28 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare - mydms                                                       *
+	* http://www.egroupware.org                                                *
+	* This application is ported from Mydms                                    *
+	*        by Lian Liming <dawnlinux@realss.com>                             *
+	* --------------------------------------------                             *
+	*  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                      *
+	\**************************************************************************/
+
+	/*Write the Root Folder name into the database*/
+	#$oProc->query("INSERT INTO phpgw_mydms_Folders VALUES (1, 'Root-Folder', 0, 'no comment', 1, false, 2, 0)");
+	#$oProc->query("INSERT INTO phpgw_mydms_Folders VALUES (1, 'Root-Folder', 0, 'no comment', 1, 0, 2, 0)");
+
+	$rootFolder = array(
+		'name'		=> 'Root-Folder',
+		'parent'	=> 0,
+		'comment'	=> 'no comment',
+		'owner'		=> 1,
+		'inheritAccess'	=> 0,
+		'defaultAccess'	=> 2,
+		'sequence'	=> 0,
+	);
+
+	//$GLOBALS['phpgw_setup']->oProc->insert('phpgw_mydms_Folders', $rootFolder, '', __LINE__, __FILE__, 'mydms');
+?>
Index: /contrib/Dms/setup/phpgw_lt.lang
===================================================================
--- /contrib/Dms/setup/phpgw_lt.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_lt.lang	(revision 3526)
@@ -0,0 +1,1 @@
+
Index: /contrib/Dms/setup/phpgw_zh.lang
===================================================================
--- /contrib/Dms/setup/phpgw_zh.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_zh.lang	(revision 3526)
@@ -0,0 +1,5 @@
+mydms	common	zh	ææ¡£ç®¡ç
+Admin-Tools	mydms	zh	ç®¡çå·¥å
+·
+Content	mydms	zh	å
+å®¹
Index: /contrib/Dms/setup/phpgw_pt.lang
===================================================================
--- /contrib/Dms/setup/phpgw_pt.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_pt.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	pt	Modo de acesso
+access rights	mydms	pt	Direitos de acesso
+access_mode_all	mydms	pt	Tudo
+access_mode_none	mydms	pt	Sem acesso
+access_mode_read	mydms	pt	Leitura
+access_mode_readwrite	mydms	pt	Leitura+Escrita
+acl get inherited	mydms	pt	ACL herdado
+add acl	mydms	pt	Adicionarl ACL
+add document	mydms	pt	Adicionar documento
+add notification	mydms	pt	Adicionar aviso
+add subfolder	mydms	pt	Adicionar subpasta
+admin-tools	mydms	pt	Ferramentas de administração
+all versions	mydms	pt	todas as versões
+comment	mydms	pt	Comentário
+comment for current version	mydms	pt	Comentários da versão actual
+copy acl	mydms	pt	Copiar ACL
+copy documents	mydms	pt	Copiar documentos
+copy folder	mydms	pt	Copiar pasta
+copy options	mydms	pt	Copiar opções
+copy subfolders	mydms	pt	Copiar subpasta
+create empty acl	mydms	pt	Criar acl vazio
+creation date	mydms	pt	Data de criação
+current acl	mydms	pt	ACL actual
+current version	mydms	pt	Versão actual
+default access	mydms	pt	acesso por omissão
+delete folder	mydms	pt	Eliminar pasta
+delete this notification	mydms	pt	Eliminar este aviso
+do you really want to delete this acl?	mydms	pt	Deseja realmente eliminar este acl?
+do you really want to delete this document?	mydms	pt	Deseja realmente eliminar este documento?
+do you really want to delete this version of the document?	mydms	pt	Deseja realmente eliminar esta versão do documento?
+does not expire	mydms	pt	Não expira
+download	mydms	pt	Transferir
+edit folder	mydms	pt	Editar pasta
+expires	mydms	pt	Expira
+expires after	mydms	pt	Expira depois
+file size	mydms	pt	Tamanho do ficheiro
+filename	mydms	pt	Nome do ficheiro
+folder	mydms	pt	Pasta
+general information	mydms	pt	informação geral
+information about last update	mydms	pt	informações sobre a última actualização
+informations	mydms	pt	Informações
+inherit acl again	mydms	pt	ACL herdado de novo
+last update	mydms	pt	Última actualização
+linked documents	mydms	pt	Documentos ligados
+lock status	mydms	pt	Estado trancado
+mime type	mydms	pt	Mime Type
+move document	mydms	pt	Mover documento
+move folder	mydms	pt	Mover pasta
+mydms	common	pt	MyDms
+notifications	mydms	pt	Avisos
+permission	mydms	pt	Permissão
+select folder	mydms	pt	Seleccionar pasta
+select target folder	mydms	pt	Seleccionar pasta de destino
+target folder	mydms	pt	Pasta de destino
+this document gets locked by you!	mydms	pt	Este documento é trancado por si!
+this document gets unlocked by you.	mydms	pt	Este documento é destrancado por si.
+this document is currently not locked.	mydms	pt	Este documento não se encontra trancado.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	pt	Este documento foi trancado por <a href="mailto:%1">%2</a>.
+update document	mydms	pt	Actualizar documento
+upload date	mydms	pt	Enviar data
+uploaded by	mydms	pt	Enviado por
+view online	mydms	pt	Ver em linha
Index: /contrib/Dms/setup/phpgw_pt-br.lang
===================================================================
--- /contrib/Dms/setup/phpgw_pt-br.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_pt-br.lang	(revision 3526)
@@ -0,0 +1,63 @@
+access mode	mydms	pt-br	Modo de acesso
+access rights	mydms	pt-br	Permissões de acesso
+access_mode_all	mydms	pt-br	Tudo
+access_mode_none	mydms	pt-br	Sem acesso
+access_mode_read	mydms	pt-br	Ler
+access_mode_readwrite	mydms	pt-br	Ler+Escrever
+acl get inherited	mydms	pt-br	Acl foi herdada
+add acl	mydms	pt-br	Adicionar acl
+add document	mydms	pt-br	Adicionar documento
+add notification	mydms	pt-br	Adicionar notificação
+add subfolder	mydms	pt-br	Adicionar sub-pasta
+admin-tools	mydms	pt-br	Ferramentas Administrativas
+all versions	mydms	pt-br	Todas versões
+comment	mydms	pt-br	Comentário
+comment for current version	mydms	pt-br	Comentário da versão atual
+content	mydms	pt-br	Conteúdo
+copy acl	mydms	pt-br	Copiar acl
+copy documents	mydms	pt-br	Copiar documentos
+copy folder	mydms	pt-br	Copiar pasta
+copy options	mydms	pt-br	Copiar opções
+copy subfolders	mydms	pt-br	Copiar sub-pasta
+create empty acl	mydms	pt-br	Criar acl vazia
+creation date	mydms	pt-br	Data de criação
+current acl	mydms	pt-br	Acl atual
+current version	mydms	pt-br	Versão atual
+default access	mydms	pt-br	Acesso padrão
+delete folder	mydms	pt-br	Remover pasta
+delete this notification	mydms	pt-br	Remover esta notificação
+do you really want to delete this acl?	mydms	pt-br	Tem certeza que deseja remover esta conta?
+do you really want to delete this document?	mydms	pt-br	Tem certeza que deseja remover este documento?
+do you really want to delete this version of the document?	mydms	pt-br	Tem certeza que deseja remover esta versão do documento?
+does not expire	mydms	pt-br	Não expira
+download	mydms	pt-br	Baixar
+edit folder	mydms	pt-br	Editar pasta
+expires	mydms	pt-br	Expira
+expires after	mydms	pt-br	Expira após
+file size	mydms	pt-br	Tamanho do arquivo
+filename	mydms	pt-br	Nome do arquivo
+folder	mydms	pt-br	Pasta
+general information	mydms	pt-br	Informação geral
+information about last update	mydms	pt-br	Informação sobre última atualização
+informations	mydms	pt-br	Informações
+inherit acl again	mydms	pt-br	Herdar acl novamente
+last update	mydms	pt-br	Última atualização
+linked documents	mydms	pt-br	Documentos linkados
+lock status	mydms	pt-br	Status de proteção
+mime type	mydms	pt-br	Mime Type
+move document	mydms	pt-br	Mover documento
+move folder	mydms	pt-br	Mover pasta
+mydms	common	pt-br	Meus Documentos
+notifications	mydms	pt-br	Notificações
+permission	mydms	pt-br	Permissões
+select folder	mydms	pt-br	Selecionar pasta
+select target folder	mydms	pt-br	Selecionar pasta destino
+target folder	mydms	pt-br	Pasta destino
+this document gets locked by you!	mydms	pt-br	Este documento foi protegido por você
+this document gets unlocked by you.	mydms	pt-br	Este documento foi desprotegido por você
+this document is currently not locked.	mydms	pt-br	Este documento não está protegido no momento
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	pt-br	Este documento está protegido por <a href="mailto:%1">%2</a>
+update document	mydms	pt-br	Atualizar documento
+upload date	mydms	pt-br	Data do carregamento
+uploaded by	mydms	pt-br	Carregado por
+view online	mydms	pt-br	Exibir online
Index: /contrib/Dms/setup/phpgw_da.lang
===================================================================
--- /contrib/Dms/setup/phpgw_da.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_da.lang	(revision 3526)
@@ -0,0 +1,58 @@
+access rights	mydms	da	Adgangs rettigheder
+access_mode_all	mydms	da	Alt
+access_mode_none	mydms	da	Ingen tilgang
+access_mode_read	mydms	da	Læs
+access_mode_readwrite	mydms	da	Læs+skriv
+acl get inherited	mydms	da	ACL blvier arvet
+add acl	mydms	da	tilføj ACL
+add document	mydms	da	Tilføj dokument
+add notification	mydms	da	Tilføj alarm
+add subfolder	mydms	da	Tilføj under folder
+admin-tools	mydms	da	Administrations værktøjer
+all versions	mydms	da	Alle versioner
+comment	mydms	da	Kommentar
+comment for current version	mydms	da	Note for aktuel version
+copy acl	mydms	da	Kopier ACL
+copy documents	mydms	da	Kopier dokumenter
+copy folder	mydms	da	Kopier folder
+copy options	mydms	da	Kopierings muligheder
+copy subfolders	mydms	da	Kopier under folder
+create empty acl	mydms	da	Lav en tom ACL
+creation date	mydms	da	Lavet (dato:)
+current acl	mydms	da	Aktuel ACL
+current version	mydms	da	Aktuel version
+default access	mydms	da	Standard tilgang
+delete folder	mydms	da	Slet folder
+delete this notification	mydms	da	Slet denne alarm
+do you really want to delete this acl?	mydms	da	Vil du slette denne ACL?
+do you really want to delete this document?	mydms	da	Vil du slette dette dokument?
+do you really want to delete this version of the document?	mydms	da	Vil du slette denne version af dokumentet?
+does not expire	mydms	da	Udløber ikke
+edit folder	mydms	da	editer folder
+expires	mydms	da	udløber
+expires after	mydms	da	udløber efter
+file size	mydms	da	fil størrelse
+filename	mydms	da	filnavn
+folder	mydms	da	folder
+information about last update	mydms	da	information om sidste opdatering
+informations	mydms	da	Informationer
+inherit acl again	mydms	da	arve ACL igen ?
+last update	mydms	da	Sidste opdatering
+linked documents	mydms	da	linkede dokumenter
+lock status	mydms	da	låse status
+move document	mydms	da	Flyt dokument
+move folder	mydms	da	Flyt folder
+mydms	common	da	Dokumenthåndtering
+notifications	mydms	da	Alarmer
+permission	mydms	da	Tilladelse
+select folder	mydms	da	Vælg folder
+select target folder	mydms	da	Vælg 'til-folder'
+target folder	mydms	da	'Til-folder'
+this document gets locked by you!	mydms	da	Dette dokument er låst af dig!
+this document gets unlocked by you.	mydms	da	Dette dokument bliver frigivet af dig.
+this document is currently not locked.	mydms	da	Dette dokument er ikke lukket pt.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	da	Dette dokument er låst af <a href="mailto:%1">%2</a>.
+update document	mydms	da	opdater dokument
+upload date	mydms	da	uploadet dato
+uploaded by	mydms	da	uploadet af
+view online	mydms	da	se online
Index: /contrib/Dms/setup/tables_current.inc.php
===================================================================
--- /contrib/Dms/setup/tables_current.inc.php	(revision 3526)
+++ /contrib/Dms/setup/tables_current.inc.php	(revision 3526)
@@ -0,0 +1,208 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare - mydms                                                       *
+	* http://www.egroupware.org                                                *
+	* This application is ported from Mydms                                    *
+        *        by Lian Liming <dawnlinux@realss.com>                             *
+	* --------------------------------------------                             *
+	*  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; either version 2 of the License, or (at your  *
+	*  option) any later version.                                              *
+	\**************************************************************************/
+	/* $Id: tables_current.inc.php 19890 2005-11-19 20:57:10Z ralfbecker $ */
+
+	$phpgw_baseline = array(
+		'phpgw_mydms_ACLs' => array(
+			'fd' => array(
+				'id' => array('type' => 'auto', 'nullable' => False),
+				'target' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+				'targetType' => array('type' => 'int', 'precision' => '2', 'nullable' => False ,'default' => '0'),
+				'userID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '-1'),
+				'groupID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '-1'),
+				'mode' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '0')
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+		),
+
+		'phpgw_mydms_DocumentContent' => array(
+			'fd' => array(
+				'id' => array('type' => 'auto', 'nullable' => False),
+				'document' => array('type' => 'int', 'precision' => '4', 'default' => 'NULL'),
+				'version'  => array('type' => 'int', 'precision' => '2', 'default' => 'NULL'),
+				'comment'  => array('type' => 'text'),
+				'date'     => array('type' => 'int', 'precision' => '8', 'default' => 'NULL'),
+				'createdBy' => array('type' => 'int', 'precision' => '4', 'default' => 'NULL'),
+				'dir'      => array('type' => 'varchar', 'precision' => '10','default' => ' ','nullable' => False),
+				'orgFileName' => array('type' => 'varchar', 'precision' => '150', 'default' => ' ', 'nullable' => False),
+				'fileType' => array('type' => 'varchar', 'precision' => '10', 'default' => ' ', 'nullable' => False),
+				'mimeType' => array('type' => 'varchar', 'precision' => '70', 'default' => ' ', 'nullable' => False)
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+		),
+
+		'phpgw_mydms_Documents' => array(
+			'fd' => array(
+				'id' => array('type' => 'auto', 'nullable' => False),
+				'name' => array('type' => 'varchar', 'precision' => '150', 'default' => 'NULL'),
+				'comment' => array('type' => 'text'),
+				'date' => array('type' => 'int', 'precision' => '8', 'default' => 'NULL'),
+				'expires' => array('type' => 'int', 'precision' => '8', 'default' => 'NULL'),
+				'owner' => array('type' => 'int', 'precision' => '4', 'default' => 'NULL'),
+				'folder' => array('type' => 'int', 'precision' => '4', 'default' => 'NULL'),
+				'inheritAccess' => array('type' => 'bool', 'nullable' => False, 'default' => 'true'),
+				'defaultAccess' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '0'),
+				'locked' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '-1'),
+				'keywords' => array('type' => 'text', 'nullable' => False),
+				'sequence' => array('type' => 'float', 'precision' => '8', 'nullable' => False, 'default' => '0')
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+	),
+
+	'phpgw_mydms_Folders' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'name' => array('type' => 'varchar', 'precision' => '90', 'default' => 'NULL'),
+			'parent' => array('type' => 'int', 'precision' => '4', 'default' => 'NULL'),
+			'comment' => array('type' => 'text'),
+			'owner' => array('type' => 'int', 'precision' => '4', 'default' => 'NULL'),
+			'inheritAccess' => array('type' => 'bool', 'nullable' => False, 'default' => 'true'),
+			'defaultAccess' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '0'),
+			'sequence' => array('type' => 'float', 'precision' => '8', 'nullable' => False, 'default' => '0')
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+
+	'phpgw_mydms_GroupMembers' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'groupID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'userID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0')
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+		
+	'phpgw_mydms_Groups' => array(
+		'fd' => array(
+	        'id' => array('type' => 'auto', 'nullable' => False),
+			'name' => array('type' => 'varchar', 'precision' => '50', 'default' => 'NULL'),
+			'comment' => array('type' => 'text', 'nullable' => 'NULL')
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+	'phpgw_mydms_Notify' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'target' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'targetType' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'userID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '-1'),
+			'groupID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '-1')
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+	'phpgw_mydms_DocumentLinks' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'document' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'target' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'userID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'public' => array('type' => 'bool', 'nullable' => False, 'default' => 'false')
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+	'phpgw_mydms_Sessions' => array(
+		'fd' => array(
+			'id' => array('type' => 'char','precision' => '50', 'nullable' => False, 'default' => ''),
+			'userID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'lastAccess' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'theme' => array('type' => 'varchar', 'precision' => '30', 'nullable' => False, 'default' => ''),
+			'language' => array('type' => 'varchar', 'precision' => '30', 'nullable' => False, 'default' => '')
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+	'phpgw_mydms_UserImages' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'userID' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'image' => array('type' => 'blob', 'nullable' => False),	
+			'mimeType' => array('type' => 'varchar', 'precision' => '10', 'nullable' => False, 'default' => '')		  
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+	'phpgw_mydms_Users' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'login' => array('type' => 'varchar', 'precision' => '50', 'default' => 'NULL'),
+			'pwd' => array('type' => 'varchar', 'precision' => '50', 'default' => 'NULL'),
+			'fullName' => array('type' => 'varchar', 'precision' => '100', 'default' => 'NULL'),
+			'email' => array('type' => 'varchar', 'precision' => '70', 'default' => 'NULL'),
+			'comment' => array('type' => 'text', 'nullable' => False),
+			'isAdmin' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '0')		 
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+	'phpgw_mydms_KeywordCategories' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'name' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => ''),
+			'owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0')
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	),
+
+	'phpgw_mydms_Keywords' => array(
+		'fd' => array(
+			'id' => array('type' => 'auto', 'nullable' => False),
+			'category' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
+			'keywords' => array('type' => 'text', 'nullable' => False)
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+	)
+        );
+?>
Index: /contrib/Dms/setup/tables_update.inc.php
===================================================================
--- /contrib/Dms/setup/tables_update.inc.php	(revision 3526)
+++ /contrib/Dms/setup/tables_update.inc.php	(revision 3526)
@@ -0,0 +1,28 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - Setup                                                       *
+  * http://www.egroupware.org                                                *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+  /* $Id: tables_update.inc.php 23741 2007-04-30 10:29:44Z lkneschke $ */
+
+	$test[] = '0.1.0.001';
+	function mydms_upgrade0_1_0_001()
+	{
+		$GLOBALS['setup_info']['mydms']['currentver'] = '1.2.000';
+		return $GLOBALS['setup_info']['mydms']['currentver'];
+	}
+
+
+	$test[] = '1.2.000';
+	function mydms_upgrade1_2_000()
+	{
+		$GLOBALS['setup_info']['mydms']['currentver'] = '1.4';
+		return $GLOBALS['setup_info']['mydms']['currentver'];
+	}
+?>
Index: /contrib/Dms/setup/phpgw_ru.lang
===================================================================
--- /contrib/Dms/setup/phpgw_ru.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_ru.lang	(revision 3526)
@@ -0,0 +1,65 @@
+access mode	mydms	ru	ÑÐµÐ¶ÐžÐŒ ÐŽÐŸÑÑÑÐ¿Ð°
+access rights	mydms	ru	Ð¿ÑÐ°Ð²Ð° ÐŽÐŸÑÑÑÐ¿Ð°
+access_mode_all	mydms	ru	ÐÑÐµ
+access_mode_none	mydms	ru	ÐÐµÑ ÐŽÐŸÑÑÑÐ¿Ð°
+access_mode_read	mydms	ru	Ð§ÑÐµÐœÐžÐµ
+access_mode_readwrite	mydms	ru	Ð§ÑÐµÐœÐžÐµ+ÐÐ°Ð¿ÐžÑÑ
+acl get inherited	mydms	ru	acl ÐœÐ°ÑÐ»ÐµÐŽÐŸÐ²Ð°ÐœÐŸ
+add acl	mydms	ru	ÐŽÐŸÐ±Ð°Ð²ÐžÑÑ acl
+add document	mydms	ru	ÐŽÐŸÐ±Ð°Ð²ÐžÑÑ ÐŽÐŸÐºÑÐŒÐµÐœÑ
+add notification	mydms	ru	ÐŽÐŸÐ±Ð°Ð²ÐžÑÑ ÑÐ²ÐµÐŽÐŸÐŒÐ»ÐµÐœÐžÐµ
+add subfolder	mydms	ru	ÐÐŸÐ±Ð°Ð²ÐžÑÑ Ð¿ÐŸÐŽÐ¿Ð°Ð¿ÐºÑ
+admin-tools	mydms	ru	Ð£ÑÐžÐ»ÐžÑÑ ÑÐ¿ÑÐ°Ð²Ð»ÐµÐœÐžÑ
+all versions	mydms	ru	Ð²ÑÐµ Ð²ÐµÑÑÐžÐž
+comment	mydms	ru	ÐÐŸÐŒÐµÐœÑÐ°ÑÐžÐ¹
+comment for current version	mydms	ru	ÐºÐŸÐŒÐµÐœÑÐ°ÑÐžÐ¹ ÐŽÐ»Ñ ÑÐµÐºÑÑÐµÐ¹ Ð²ÐµÑÑÐžÐž
+copy acl	mydms	ru	ÐºÐŸÐ¿ÐžÑÐŸÐ²Ð°ÑÑ acl
+copy documents	mydms	ru	ÐºÐŸÐ¿ÐžÑÐŸÐ²Ð°ÑÑ ÐŽÐŸÐºÑÐŒÐµÐœÑ
+copy folder	mydms	ru	ÐºÐŸÐ¿ÐžÑÐŸÐ²Ð°ÑÑ Ð¿Ð°Ð¿ÐºÑ
+copy options	mydms	ru	Ð¿Ð°ÑÐ°ÐŒÐµÑÑÑ ÐºÐŸÐ¿ÐžÑÐŸÐ²Ð°ÐœÐžÑ
+copy subfolders	mydms	ru	ÐºÐŸÐ¿ÐžÑÐŸÐ²Ð°ÑÑ Ð¿ÐŸÐŽÐ¿Ð°Ð¿ÐºÑ
+create empty acl	mydms	ru	ÑÐŸÐ·ÐŽÐ°ÑÑ Ð¿ÑÑÑÐŸÐ¹ acl
+creation date	mydms	ru	ÐŽÐ°ÑÐ° ÑÐŸÐ·ÐŽÐ°ÐœÐžÑ
+current acl	mydms	ru	ÑÐµÐºÑÑÐžÐ¹ acl
+current version	mydms	ru	ÑÐµÐºÑÑÐ°Ñ Ð²ÐµÑÑÐžÑ
+default access	mydms	ru	ÐŽÐŸÑÑÐ¿ Ð¿ÐŸ ÑÐŒÐŸÐ»ÑÐ°ÐœÐžÑ
+delete folder	mydms	ru	ÑÐŽÐ°Ð»ÐžÑÑ Ð¿Ð°Ð¿ÐºÑ
+delete this notification	mydms	ru	ÑÐŽÐ°Ð»ÐžÑÑ ÑÑÐŸ ÐžÐ·Ð²ÐµÑÐµÐœÐžÐµ
+do you really want to delete this acl?	mydms	ru	ÐÑ ÐŽÐµÐ¹ÑÑÐ²ÐžÑÐµÐ»ÑÐœÐŸ Ñ
+ÐŸÑÐžÑÐµ ÑÐŽÐ°Ð»ÐžÑÑ ÑÑÐŸÑ acl?
+do you really want to delete this document?	mydms	ru	ÐÑ ÐŽÐµÐ¹ÑÑÐ²ÐžÑÐµÐ»ÑÐœÐŸ Ñ
+ÐŸÑÐžÑÐµ ÑÐŽÐ°Ð»ÐžÑÑ ÑÑÐŸÑ ÐŽÐŸÐºÑÐŒÐµÐœÑ?
+do you really want to delete this version of the document?	mydms	ru	ÐÑ ÐŽÐµÐ¹ÑÑÐ²ÐžÑÐµÐ»ÑÐœÐŸ Ñ
+ÐŸÑÐžÑÐµ ÑÐŽÐ°Ð»ÐžÑÑ ÑÑÑ Ð²ÐµÑÑÐžÑ ÐŽÐŸÐºÑÐŒÐµÐœÑÐ°?
+does not expire	mydms	ru	ÑÑÐŸÐº ÐœÐµ ÐžÑÑÐµÐºÐ°ÐµÑ
+download	mydms	ru	ÐÐ°Ð³ÑÑÐ·ÐžÑÑ
+edit folder	mydms	ru	ÑÐµÐŽÐ°ÐºÑÐžÑÐŸÐ²Ð°ÑÑ Ð¿Ð°Ð¿ÐºÑ
+expires	mydms	ru	ÐžÑÑÐµÐºÐ°ÐµÑ
+expires after	mydms	ru	ÐžÑÑÐµÐºÐ°ÐµÑ Ð¿ÐŸÑÐ»Ðµ
+file size	mydms	ru	ÑÐ°Ð·ÐŒÐµÑ ÑÐ°Ð¹Ð»Ð°
+filename	mydms	ru	ÐžÐŒÑ ÑÐ°Ð¹Ð»Ð°
+folder	mydms	ru	Ð¿Ð°Ð¿ÐºÐ°
+general information	mydms	ru	ÐŸÐ±ÑÐ°Ñ ÐžÐœÑÐŸÑÐŒÐ°ÑÐžÑ
+information about last update	mydms	ru	ÐžÐœÑÐŸÑÐŒÐ°ÑÐžÑ ÐŸ Ð¿ÐŸÑÐ»ÐµÐŽÐœÐµÐŒ ÐŸÐ±ÐœÐŸÐ²Ð»ÐµÐœÐžÐž
+informations	mydms	ru	ÐÐœÑÐŸÑÐŒÐ°ÑÐžÑ
+inherit acl again	mydms	ru	ÐœÐ°ÑÐ»ÐµÐŽÐŸÐ²Ð°ÑÑ acl ÑÐœÐŸÐ²Ð°
+last update	mydms	ru	Ð¿ÐŸÑÐ»ÐµÐŽÐœÐµÐµ ÐŸÐ±ÐœÐŸÐ²Ð»ÐµÐœÐžÐµ
+linked documents	mydms	ru	ÑÐ²Ð·ÑÐ°ÐœÐœÑÐ¹ ÐŽÐŸÐºÑÐŒÐµÐœÑ
+lock status	mydms	ru	ÑÑÐ°ÑÑÑ Ð±Ð»ÐŸÐºÐžÑÐŸÐ²ÐºÐž
+mime type	mydms	ru	Ð¢ÐžÐ¿ Mime
+move document	mydms	ru	Ð¿ÐµÑÐµÐŒÐµÑÑÐžÑÑ ÐŽÐŸÐºÑÐŒÐµÐœÑ
+move folder	mydms	ru	Ð¿ÐµÑÐµÐŒÐµÑÑÐžÑÑ Ð¿Ð°Ð¿ÐºÑ
+mydms	common	ru	Ð£Ð¿ÑÐ°Ð²Ð»ÐµÐœÐžÐµ ÐÐŸÐºÑÐŒÐµÐœÑÐ°ÐŒÐž
+notifications	mydms	ru	ÑÐ²ÐµÐŽÐŸÐŒÐ»ÐµÐœÐžÑ
+permission	mydms	ru	ÑÐ°Ð·ÑÐµÑÐµÐœÐžÐµ
+select folder	mydms	ru	Ð²ÑÐ±ÑÐ°ÑÑ Ð¿Ð°Ð¿ÐºÑ
+select target folder	mydms	ru	Ð²ÑÐ±ÑÐ°ÑÑ Ð¿Ð°Ð¿ÐºÑ ÐœÐ°Ð·ÐœÐ°ÑÐµÐœÐžÑ
+target folder	mydms	ru	Ð¿Ð°Ð¿ÐºÐ° ÐœÐ°Ð·ÐœÐ°ÑÐµÐœÐžÑ
+this document gets locked by you!	mydms	ru	ÐÐ°ÐœÐœÑÐ¹ ÐŽÐŸÐºÑÐŒÐµÐœÑ Ð±Ð»ÐŸÐºÐžÑÐŸÐ²Ð°Ðœ Ð²Ð°ÐŒÐž!
+this document gets unlocked by you.	mydms	ru	ÐÐ°ÐœÐœÑÐ¹ ÐŽÐŸÐºÑÐŒÐµÐœÑ ÑÐ°Ð·Ð±Ð»ÐŸÐºÐžÑÐŸÐ²Ð°Ðœ Ð²Ð°ÐŒÐž.
+this document is currently not locked.	mydms	ru	ÐÐ°ÐœÐœÑÐ¹ ÐŽÐŸÐºÑÐŒÐµÐœÑ ÐœÐµ Ð±Ð»ÐŸÐºÐžÑÐŸÐ²Ð°Ðœ.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	ru	ÑÑÐŸÑ ÐŽÐŸÐºÑÐŒÐµÐœÑ Ð·Ð°Ð±Ð»ÐŸÐºÐžÑÐŸÐ²Ð°Ðœ <a href="mailto:%1">%2</a>.
+update document	mydms	ru	ÐŸÐ±ÐœÐŸÐ²ÐžÑÑ ÐŽÐŸÐºÑÐŒÐµÐœÑ
+upload date	mydms	ru	ÐŽÐ°ÑÐ° Ð²ÑÐ³ÑÑÐ·ÐºÐž
+uploaded by	mydms	ru	Ð²ÑÐ³ÑÑÐ¶ÐµÐœÐŸ
+view online	mydms	ru	Ð¿ÑÐŸÑÐŒÐŸÑÑ ÑÑÑ Ð¶Ðµ
Index: /contrib/Dms/setup/phpgw_de.lang
===================================================================
--- /contrib/Dms/setup/phpgw_de.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_de.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	de	Zugriffsberechtigung
+access rights	mydms	de	Zugriffsrechte
+access_mode_all	mydms	de	Keine Beschränkung
+access_mode_none	mydms	de	Kein Zugriff
+access_mode_read	mydms	de	Lesen
+access_mode_readwrite	mydms	de	Lesen+Schreiben
+acl get inherited	mydms	de	Berechtigungen werden momentan ererbt.
+add acl	mydms	de	Zugriffsberechtigung hinzufügen
+add document	mydms	de	Dokument anlegen
+add notification	mydms	de	Benachrichtigung hinzufügen
+add subfolder	mydms	de	Unterordner anlegen
+admin-tools	mydms	de	Administrations Tools
+all versions	mydms	de	alle Versionen
+comment	mydms	de	Kommentar
+comment for current version	mydms	de	Kommentar zur aktuellen Version
+copy acl	mydms	de	Berechtigungen kopieren
+copy documents	mydms	de	Dokumente mitkopieren
+copy folder	mydms	de	Ordner kopieren
+copy options	mydms	de	Kopieroptionen
+copy subfolders	mydms	de	Unterordner mitkopieren
+create empty acl	mydms	de	leere ACL
+creation date	mydms	de	Erstellt am
+current acl	mydms	de	Aktuelle Zugriffsberechtigungen
+current version	mydms	de	Aktuelle Version
+default access	mydms	de	Standardberechtigung
+delete folder	mydms	de	Ordner löschen
+delete this notification	mydms	de	diese Benachrichtigung löschen
+do you really want to delete this acl?	mydms	de	Möchten Sie diese Zugriffberechtigung wirklich löschen?
+do you really want to delete this document?	mydms	de	Möchten Sie dieses Dokument wirklich löschen?
+do you really want to delete this version of the document?	mydms	de	Möchten Sie wirklich diese Version des Dokumentes löschen?
+does not expire	mydms	de	für immer verfügbar
+download	mydms	de	Herunterladen
+edit folder	mydms	de	Ordner bearbeiten
+expires	mydms	de	Gültigkeit
+expires after	mydms	de	verfügbar bis
+file size	mydms	de	Dateigröße
+filename	mydms	de	Dateiname
+folder	mydms	de	Ordner
+general information	mydms	de	Allgemeine Informationen
+information about last update	mydms	de	Informationen über das letzte Update
+informations	mydms	de	Informationen
+inherit acl again	mydms	de	Berechtigungen wieder ererben
+last update	mydms	de	Letzte Aktualisierung
+linked documents	mydms	de	verwandte Dokumente
+lock status	mydms	de	Sperrstatus
+mime type	mydms	de	Mime-Typ
+move document	mydms	de	Dokument verschieben
+move folder	mydms	de	Ordner verschieben
+mydms	common	de	MyDMS
+notifications	mydms	de	Benachrichtigungen
+permission	mydms	de	Berechtigung
+select folder	mydms	de	Ordner auswählen
+select target folder	mydms	de	Zielordner auswählen
+target folder	mydms	de	Zielordner
+this document gets locked by you!	mydms	de	Dieses Dokument wird von Ihnen gesperrt!
+this document gets unlocked by you.	mydms	de	Dieses Dokument wird von Ihnen entsperrt.
+this document is currently not locked.	mydms	de	Dieses Dokument ist momentan nicht gesperrt.
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	de	Dieses Dokument wurde von <a href="mailto:%1">%2</a> gesperrt.
+update document	mydms	de	Dokument aktualisieren
+upload date	mydms	de	Upload am
+uploaded by	mydms	de	Upload durch
+view online	mydms	de	Online anzeigen
Index: /contrib/Dms/setup/phpgw_sv.lang
===================================================================
--- /contrib/Dms/setup/phpgw_sv.lang	(revision 3526)
+++ /contrib/Dms/setup/phpgw_sv.lang	(revision 3526)
@@ -0,0 +1,62 @@
+access mode	mydms	sv	Åtkomst läge
+access rights	mydms	sv	Reglera åtkomst
+access_mode_all	mydms	sv	Alla
+access_mode_none	mydms	sv	Ingen åtkomst
+access_mode_read	mydms	sv	Läs
+access_mode_readwrite	mydms	sv	Läs+skriv
+acl get inherited	mydms	sv	ACL ärvs
+add acl	mydms	sv	Lägg till ACL
+add document	mydms	sv	Skapa dokument
+add notification	mydms	sv	Lägg till notifiering
+add subfolder	mydms	sv	Skapa underkatalog
+admin-tools	mydms	sv	Administrativa verktyg
+all versions	mydms	sv	Alla versioner
+comment	mydms	sv	Kommentar
+comment for current version	mydms	sv	Kommentar till aktuell version
+copy acl	mydms	sv	Kopiera ACL
+copy documents	mydms	sv	Kopiera dokument
+copy folder	mydms	sv	Kopera katalog
+copy options	mydms	sv	Kopiera alternativ
+copy subfolders	mydms	sv	Kopiera underkatalog
+create empty acl	mydms	sv	Skapa tom ACL
+creation date	mydms	sv	Skapat datum
+current acl	mydms	sv	Aktuell ACL
+current version	mydms	sv	Aktuell version
+default access	mydms	sv	Standard åtkomst
+delete folder	mydms	sv	Radera katalog
+delete this notification	mydms	sv	Radera notifiering
+do you really want to delete this acl?	mydms	sv	Vill du verkligen radera ACL?
+do you really want to delete this document?	mydms	sv	Vill du verkligen radera dokumentet?
+do you really want to delete this version of the document?	mydms	sv	Vill du verkligen radera denna version av dokumentet?
+does not expire	mydms	sv	Förfaller inte
+download	mydms	sv	Ladda ner
+edit folder	mydms	sv	Ändra katalog
+expires	mydms	sv	Förfaller
+expires after	mydms	sv	Förfaller efter
+file size	mydms	sv	Filstorlek
+filename	mydms	sv	Filnamn
+folder	mydms	sv	Katalog
+general information	mydms	sv	Allmän information
+information about last update	mydms	sv	Information om senaste uppdatering
+informations	mydms	sv	Information
+inherit acl again	mydms	sv	Ärv ACL igen
+last update	mydms	sv	Senaste uppdatering
+linked documents	mydms	sv	Länkade dokument
+lock status	mydms	sv	Lås dokument
+mime type	mydms	sv	Mime Typ
+move document	mydms	sv	Flytta dokument
+move folder	mydms	sv	Flytta katalog
+mydms	common	sv	MyDMS
+notifications	mydms	sv	Meddelanden
+permission	mydms	sv	Behörighet
+select folder	mydms	sv	Välj katalog
+select target folder	mydms	sv	Välj målkatalog
+target folder	mydms	sv	Målkatalog
+this document gets locked by you!	mydms	sv	Dokumentet låses av dig
+this document gets unlocked by you.	mydms	sv	Dokumentet öppnas av dig
+this document is currently not locked.	mydms	sv	Dokumentet är inte låst
+this document is locked by <a href="mailto:%1">%2</a>.	mydms	sv	Dokumentet är låst av <a href="mailto:%1">%2</a>.
+update document	mydms	sv	Uppdatera dokument
+upload date	mydms	sv	Upplagd datum
+uploaded by	mydms	sv	Upplagd av
+view online	mydms	sv	Visa online
Index: /contrib/Dms/todo
===================================================================
--- /contrib/Dms/todo	(revision 3526)
+++ /contrib/Dms/todo	(revision 3526)
@@ -0,0 +1,205 @@
+
+CREATE TABLE phpgw_mydms_acls
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_acls'::regclass),
+  target integer NOT NULL DEFAULT 0,
+  targettype integer NOT NULL DEFAULT 0,
+  userid integer NOT NULL DEFAULT (-1),
+  groupid integer NOT NULL DEFAULT (-1),
+  "mode" integer NOT NULL DEFAULT 0,
+  CONSTRAINT phpgw_mydms_acls_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_acls OWNER TO postgres;
+
+
+
+CREATE TABLE phpgw_mydms_documentcontent
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_documentcontent'::regclass),
+  "document" integer DEFAULT 0,
+  "version" integer DEFAULT 0,
+  "comment" text,
+  date integer DEFAULT 0,
+  createdby integer DEFAULT 0,
+  dir character varying(10) NOT NULL DEFAULT ' '::character varying,
+  orgfilename character varying(150) NOT NULL DEFAULT ' '::character varying,
+  filetype character varying(10) NOT NULL DEFAULT ' '::character varying,
+  mimetype character varying(70) NOT NULL DEFAULT ' '::character varying,
+  CONSTRAINT phpgw_mydms_documentcontent_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_documentcontent OWNER TO postgres;
+
+
+
+CREATE TABLE phpgw_mydms_documentlinks
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_documentlinks'::regclass),
+  "document" integer NOT NULL DEFAULT 0,
+  target integer NOT NULL DEFAULT 0,
+  userid integer NOT NULL DEFAULT 0,
+  public boolean NOT NULL DEFAULT true,
+  CONSTRAINT phpgw_mydms_documentlinks_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_documentlinks OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_documents
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_documents'::regclass),
+  "name" character varying(150) DEFAULT NULL::character varying,
+  "comment" text,
+  date integer DEFAULT 0,
+  expires integer DEFAULT 0,
+  "owner" integer DEFAULT 0,
+  folder integer DEFAULT 0,
+  inheritaccess boolean NOT NULL DEFAULT true,
+  defaultaccess integer NOT NULL DEFAULT 0,
+  locked integer NOT NULL DEFAULT (-1),
+  keywords text,
+  "sequence" double precision NOT NULL,
+  CONSTRAINT phpgw_mydms_documents_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_documents OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_folders
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_folders'::regclass),
+  "name" character varying(90) DEFAULT NULL::character varying,
+  parent integer DEFAULT 0,
+  "comment" text,
+  "owner" integer DEFAULT 0,
+  inheritaccess boolean NOT NULL DEFAULT true,
+  defaultaccess integer NOT NULL DEFAULT 0,
+  "sequence" double precision NOT NULL,
+  CONSTRAINT phpgw_mydms_folders_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_folders OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_groupmembers
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_groupmembers'::regclass),
+  groupid integer NOT NULL DEFAULT 0,
+  userid integer NOT NULL DEFAULT 0,
+  CONSTRAINT phpgw_mydms_groupmembers_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_groupmembers OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_groups
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_groups'::regclass),
+  "name" character varying(50) DEFAULT NULL::character varying,
+  "comment" text,
+  CONSTRAINT phpgw_mydms_groups_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_groups OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_keywordcategories
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_keywordcategories'::regclass),
+  "name" character varying(255) NOT NULL DEFAULT ''::character varying,
+  "owner" integer NOT NULL DEFAULT 0,
+  CONSTRAINT phpgw_mydms_keywordcategories_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_keywordcategories OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_keywords
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_keywords'::regclass),
+  category integer NOT NULL DEFAULT 0,
+  keywords text,
+  CONSTRAINT phpgw_mydms_keywords_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_keywords OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_notify
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_notify'::regclass),
+  target integer NOT NULL DEFAULT 0,
+  targettype integer NOT NULL DEFAULT 0,
+  userid integer NOT NULL DEFAULT (-1),
+  groupid integer NOT NULL DEFAULT (-1),
+  CONSTRAINT phpgw_mydms_notify_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_notify OWNER TO postgres;
+
+
+
+
+
+CREATE TABLE phpgw_mydms_sessions
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_sessions'::regclass),
+  userid integer NOT NULL DEFAULT 0,
+  lastaccess integer NOT NULL DEFAULT 0,
+  theme character varying(30) NOT NULL DEFAULT ''::character varying,
+  "language" character varying(30) NOT NULL DEFAULT ''::character varying,
+  CONSTRAINT phpgw_mydms_sessions_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_sessions OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_userimages
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_userimages'::regclass),
+  userid integer NOT NULL DEFAULT 0,
+  image oid,
+  mimetype character varying(10) NOT NULL DEFAULT ''::character varying,
+  CONSTRAINT phpgw_mydms_userimages_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_userimages OWNER TO postgres;
+
+
+
+
+CREATE TABLE phpgw_mydms_users
+(
+  id integer NOT NULL DEFAULT nextval('seq_phpgw_mydms_users'::regclass),
+  "login" character varying(50) DEFAULT NULL::character varying,
+  pwd character varying(50) DEFAULT NULL::character varying,
+  fullname character varying(100) DEFAULT NULL::character varying,
+  email character varying(70) DEFAULT NULL::character varying,
+  "comment" text,
+  isadmin integer NOT NULL DEFAULT 0,
+  CONSTRAINT phpgw_mydms_users_key UNIQUE (id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_mydms_users OWNER TO postgres;
+
+
+
+
+
Index: /contrib/Dms/languages/Spanish/lang.inc
===================================================================
--- /contrib/Dms/languages/Spanish/lang.inc	(revision 3526)
+++ /contrib/Dms/languages/Spanish/lang.inc	(revision 3526)
@@ -0,0 +1,253 @@
+<?php
+$text = array();
+$text["folder_title"] = "MyDMS - Carpeta [foldername]";
+$text["document_title"] = "MyDMS - Documento [documentname]";
+$text["folder_infos"] = "Informaciones";
+$text["document_infos"] = "Informaciones";
+$text["subfolder_list"] = "SubCarpetas";
+$text["document_list"] = "Documentos";
+$text["download"] = "Download";
+$text["document_versions"] = "Todas las versiones";
+$text["logged_in_as"] = "Login";
+$text["my_account"] = "Mi cuenta";
+$text["user_management"] = "Users";
+$text["user_list"] = "Lista de usuarios";
+$text["logout"] = "Logout";
+$text["foldertree"] = "Arbol de Carpetas";
+$text["selected_folder"] = "Carpeta seleccionada";
+$text["selected_document"] = "Documento seleccionado";
+$text["folder_path"] = "Path";
+$text["folder_overview"] = "Carpeta-Overview";
+$text["document_overview"] = "Documento-Overview";
+$text["comment"] = "Comentario";
+$text["name"] = "Nombre";
+$text["local_file"] = "Archivo local";
+$text["owner"] = "Due&ntilde;o";
+$text["no_subfolders"] = "sin subcarpeta";
+$text["no_documents"] = "sin documentos";
+$text["edit_folder"] = "Edit carpeta";
+$text["edit_document"] = "Edit documento";
+$text["add_subfolder"] = "Agregar Subcarpeta";
+$text["add_document"] = "Agregar Documento";
+$text["edit_folder_props"] = "Editar Carpeta";
+$text["edit_folder_notify"] = "Lista de Notificacion";
+$text["edit_existing_notify"] = "Editar lista de notificacion";
+$text["add_new_notify"] = "Agregar nueva notificacion";
+$text["rm_folder"] = "Borrar carpeta";
+$text["edit_folder_access"] = "Editar acceso";
+$text["creation_date"] = "Creado";
+$text["last_update"] = "Ultima actualizacion";
+$text["current_version"] = "Version actual";
+$text["comment_for_current_version"] = "comentario de la version actual";
+$text["uploaded_by"] = "Actualizado por";
+$text["file_size"] = "tama&ntilde;o de archivo";
+$text["mime_type"] = "Mime-Type";
+$text["exp_date"] = "Expira";
+$text["does_not_expire"] = "No expira";
+$text["lock_status"] = "Status";
+$text["lock_message"] = "Este documento esta bloqueado por <a href=\"mailto:[email]\">[username]</a>.<br>Solo usuaqrio autorizado puede desbloquear el documento (ver fin de pagina).";
+$text["version"] = "Version";
+$text["upload_date"] = "Upload-Fecha";
+$text["update_document"] = "Actualizado";
+$text["unlock_document"] = "Desbloqueado";
+$text["lock_document"] = "Bloqueado";
+$text["edit_document_props"] = "Editar documento";
+$text["edit_document_notify"] = "Lista de Notificacion";
+$text["rm_document"] = "Borrar documento";
+$text["rm_version"] = "Borrar version";
+$text["edit_document_access"] = "Editar accesso";
+$text["select_one"] = "Seleccione uno";
+$text["user"] = "Usuario";
+$text["group"] = "Grupo";
+$text["empty_notify_list"] = "No hay entrado";
+$text["access_mode_none"] = "No hay acceso";
+$text["access_mode_read"] = "Lectura";
+$text["access_mode_readwrite"] = "Lectura-Escritura";
+$text["access_mode_all"] = "Todos";
+$text["login"] = "Login";
+$text["user_login"] = "Nombre de Usuario";
+$text["password"] = "Password";
+$text["wrong_pwd"] = "Password incorrecto, intente otra vez.";
+$text["back"] = "retornar";
+$text["login_not_found"] = "no existe ese usuario";
+$text["content"] = "Contenido";
+$text["search"] = "Busqueda";
+$text["group_management"] = "Grupos";
+$text["search_query"] = "Busqueda por";
+$text["search_mode"] = "Modo";
+$text["search_mode_and"] = "Todas las palabras";
+$text["search_mode_or"] = "al menos una palabra";
+$text["search_in"] = "Buscar en";
+$text["search_in_all"] = "Todas las carpetas";
+$text["search_in_current"] = "solo esta ([foldername]) incluyendo subcarpetas";
+$text["search_results"] = "Resultado de la busqueda";
+$text["search_no_results"] = "No se encontraron documentos para esa busqueda (\"[query]\").";
+$text["search_time"] = "Tiempo transcurrido: [time] sec.";
+$text["search_report"] = "Encontrados [count] documentos para \"[query]\".";
+$text["email"] = "Email";
+$text["user_image"] = "Imagen";
+$text["new_user_image"] = "Nueva imagen";
+$text["goto"] = "Ir a";
+$text["editing_user_data"] = "Editando configuracion usuarios...";
+$text["op_finished"] = "done";
+$text["error_occured"] = "Un error a ocurrido";
+$text["add_user"] = "Agrega nuevo usuario";
+$text["edit_user"] = "Editar usuario";
+$text["choose_user"] = "--Seleccione usuario--";
+$text["user_name"] = "Nombre completo";
+$text["no_user_image"] = "No encontro imagen";
+$text["rm_user"] = "Borrar este usuario";
+$text["add_group"] = "Agrego nuevo usuario";
+$text["edit_group"] = "Editar grupo";
+$text["choose_group"] = "--Seleccione grupo--";
+$text["rm_group"] = "Borrar este grupo";
+$text["add_member"] = "Agregar un miembro";
+$text["adding_group"] = "Agregando grupo del sistema...";
+$text["no_group_members"] = "Este grupo no tiene miembros";
+$text["removing_group"] = "Borrando grupo del sistema...";
+$text["adding_member"] = "Agregando miembro al grupo...";
+$text["remove_member"] = "Borrando miembro";
+$text["removing_member"] = "Borrando miembro del grupo...";
+$text["adding_user"] = "Agregando usuario al sistema...";
+$text["editing_user"] = "Editando usuario...";
+$text["setting_user_image"] = "<br>Asignando imagen al usuario...";
+$text["removing_user"] = "Borrando usuario del sistema...";
+$text["adding_sub_folder"] = "Agregando subcarpeta \"[subfoldername]\" a la carpeta \"[foldername]\"...";
+$text["keywords"] = "Palabras clave";
+$text["expires"] = "Expira";
+$text["adding_document"] = "Agregando documento \"[documentname]\" en la carpeta \"[foldername]\"...";
+$text["updating_document"] = "Actualizando documento...";
+$text["locking_document"] = "Bloqueando documento...";
+$text["unlocking_document"] = "Desbloqueando documento...";
+$text["editing_document_props"] = "Editando documento...";
+$text["edit_document_props_again"] = "Editar documento nuevamente";
+$text["setting_expires"] = "Asignando  expiracion...";
+$text["adding_document_notify"] = "Agregando elementos a la lista de notificacion...";
+$text["document_notify_again"] = "Editar lista de notificacion nuevamente";
+$text["deleting_document_notify"] = "Borrando elemento de lista de notificacion...";
+$text["set_owner"] = "asignando due&ntilde;o";
+$text["edit_inherit_access"] = "Acceso Heredado";
+$text["inherits_access_msg"] = "acceso recursivo.<p><a class=\"inheritAccess\" href=\"[copyurl]\">creando lista de acceso recursiva</a><br><a class=\"inheritAccess\" href=\"[emptyurl]\">Inicializando vacio lista de acceso</a>";
+$text["setting_owner"] = "asignando due&ntilde;o...";
+$text["document_access_again"] = "Editar acceso al documento nuevamente";
+$text["document_set_not_inherit_copy"] = "creando lista de acceso...";
+$text["document_set_not_inherit_empty"] = "Borrando acceso heredado. Vaciando acceso ACL...";
+$text["does_not_inherit_access_msg"] = "<a class=\"inheritAccess\" href=\"[inheriturl]\">acceso recursivo</a>";
+$text["document_set_inherit"] = "Borrando ACL. Documento con acceso recursivo...";
+$text["default_access"] = "modo de acceso por defecto";
+$text["document_set_default_access"] = "guardando modo de acceso por defecto al documento...";
+$text["edit_existing_access"] = "Editando lista de  accesso";
+$text["empty_access_list"] = "Lista de acceso vacia";
+$text["add_access"] = "Agregando accesso";
+$text["access_mode"] = "Modo de Accesso";
+$text["document_add_access"] = "Agregando elemento a la lista de acceso...";
+$text["document_del_access"] = "Borrando elemento de lista de acceso...";
+$text["document_edit_access"] = "Cambiando mode de acceso...";
+$text["editing_folder_props"] = "Editando carpeta...";
+$text["edit_folder_props_again"] = "Editando carpeta nuevamente";
+$text["adding_folder_notify"] = "Agregando elemento a la lista de acceso...";
+$text["folder_notify_again"] = "Editando lista de notificacion";
+$text["deleting_folder_notify"] = "Borrando elemento de lista de notificacion...";
+$text["folder_access_again"] = "Editar carpeta de accesso nuevamente";
+$text["folder_set_not_inherit_copy"] = "Copiando lista de acceso...";
+$text["folder_set_not_inherit_empty"] = "Borrando acceso heredado. Iniciando vacio ACL...";
+$text["folder_set_inherit"] = "Borrando ACL. Todos los accesos heredados...";
+$text["folder_set_default_access"] = "Configurando modo de acceso a la carpeta...";
+$text["folder_add_access"] = "Agregando elemento a lista de acceso...";
+$text["folder_del_access"] = "Borrando elemento de lista de acceso...";
+$text["removing_document"] = "Borrando documento...";
+$text["removing_version"] = "Borrando version [version]...";
+$text["removing_folder"] = "Borrando carpeta...";
+$text["operation_not_allowed"] = "No tiene permiso";
+$text["msg_document_expired"] = "El documento \"[documentname]\" (Path: \"[path]\") expiro [expires]";
+$text["msg_document_updated"] = "El documento \"[documentname]\" (Path: \"[path]\") fue creado o actualizado [updated]";
+$text["notify_subject"] = "Nuevo o expiro documento en el DMS";
+$text["uploading_failed"] = "Fallo subir el archivo. Por favor contacte al administrator.";
+$text["update_locked_msg"] = "El documento esta bloqueado.";
+$text["unlock_cause_locking_user"] = "No se puede actualizar, esta bloqueado.";
+$text["unlock_cause_access_mode_all"] = "Puede actualizarlo \"all\". el bloqueo sera removido automaticamente.";
+$text["no_update_cause_locked"] = "No se puede actualizar el documento, contacte al usuario que lo tiene bloqueado.";
+$text["no_groups"] = "Sin grupos";
+$text["groups"] = "Grupos";
+$text["users"] = "Usuarios";
+$text["root_folder"] = "Carpeta raiz";
+$text["document_already_locked"] = "Documento bloqueado";
+$text["document_is_not_locked"] = "Documento no esta bloqueado";
+$text["unlocking_denied"] = "No tiene permiso para desbloquear documento";
+$text["only_jpg_user_images"] = "Solo .jpg-images puede ser usada como imagen del usuario";
+$text["folder_edit_access"] = "Editando acceso...";
+$text["editing_group"] = "Editando grupo...";
+$text["group_members"] = "Miembros del grupo";
+$text["confirm_pwd"] = "Confirma password";
+$text["js_no_file"] = "Seleccione un archivo";
+$text["js_no_name"] = "Indique un nombre";
+$text["js_no_comment"] = "No es un comentario";
+$text["js_no_keywords"] = "especifique algunas palabras clave";
+$text["js_select_user_or_group"] = "Select un usuario o grupo";
+$text["js_no_login"] = "escriba el nombre de usuario";
+$text["js_no_pwd"] = "debe indicar el password";
+$text["js_no_query"] = "escriba una busqueda";
+$text["js_pwd_not_conf"] = "Password y repetir password no son iguales";
+$text["js_no_email"] = "escriba el email";
+$text["js_select_user"] = "Seleccione un usuario";
+$text["guest_login"] = "Login ";
+$text["view_online"] = "Ver en linea";
+$text["confirm_rm_document"] = "realmente quiere borrar el documento \"[documentname]\"?<br>.";
+$text["confirm_rm_version"] = "realmente quiere borrar la vrsion [version] of document \"[documentname]\"?<br>.";
+$text["confirm_rm_folder"] = "realmente quiere borrar  \"[foldername]\" y su contenido?<br>.";
+$text["sequence"] = "Secuencia";
+$text["seq_end"] = "al final";
+$text["seq_start"] = "primera posicion";
+$text["seq_after"] = "Despues \"[prevname]\"";
+$text["seq_keep"] = "posicion";
+$text["linked_documents"] = "Documentos relacionados";
+$text["document_link_by"] = "Link por";
+$text["no_document_links"] = "Sin documentos relacionados";
+$text["document_link_public"] = "Publico";
+$text["choose_target_document"] = "Seleccione el documento";
+$text["add_document_link"] = "Agregar link";
+$text["adding_document_link"] = "Agregar link de documento relacionado...";
+$text["remove_document_link"] = "Borrando link";
+$text["removing_document_link"] = "Borrando link de documento relacionado...";
+$text["yes"] = "Si";
+$text["no"] = "No";
+$text["save"] = "Guardar";
+$text["delete"] = "Borrar";
+$text["move_folder"] = "Mover Carpeta";
+$text["choose_target_folder"] = "Seleccione carpeta a cargar";
+$text["moving_folder"] = "Moviendo carpeta...";
+$text["move_document"] = "Moviendo documento";
+$text["moving_document"] = "Moviendo documento...";
+$text["under_folder"] = "En la carpeta";
+$text["all_users"] = "Todos los usuarios";
+$text["language"] = "Lenguaje";
+$text["theme"] = "Tema";
+$text["admin_tools"] = "Herramientas de administracion";
+$text["folders_and_documents_statistic"] = "Overview de carpetas y documentos";
+$text["start"] = "Inicio";
+$text["between"] = "entre";
+$text["and"] = "y";
+$text["use_default_keywords"] = "Usar palablas claves predefinidas";
+$text["global_default_keywords"] = "palabras claves globales";
+$text["personal_default_keywords"] = "personal palabras claves";
+$text["edit_personal_default_keywords"] = "Editar palabras claves personal";
+$text["default_keywords"] = "Disponible palabras clave";
+$text["default_keyword_category"] = "Categorias";
+$text["choose_category"] = "--seleccione--";
+$text["new_default_keyword_category"] = "Agregando categoria";
+$text["edit_default_keyword_category"] = "Editando categoria";
+$text["default_keyword_category_name"] = "Nombre";
+$text["rm_default_keyword_category"] = "Borrando esta categoria";
+$text["new_default_keywords"] = "Agregando palabras clave";
+$text["no_default_keywords"] = "Sin palabras claves disponible";
+$text["creating_new_default_keyword_category"] = "Agregendo categoria...";
+$text["removing_default_keyword_category"] = "Borrando categoria...";
+$text["editing_default_keyword_category"] = "cambiando categoria...";
+$text["adding_default_keywords"] = "Agregando categoria...";
+$text["rm_default_keywords"] = "Borrar palabras claves";
+$text["removing_default_keywords"] = "Borrando palabras claves...";
+$text["edit_default_keywords"] = "Editar palabras clave";
+$text["editing_default_keywords"] = "Cambiando palabras clave...";
+$text["accept"] = "Aceptar";
+$text["cancel"] = "Cancelar";
+?>
Index: /contrib/Dms/languages/English/lang.inc
===================================================================
--- /contrib/Dms/languages/English/lang.inc	(revision 3526)
+++ /contrib/Dms/languages/English/lang.inc	(revision 3526)
@@ -0,0 +1,253 @@
+<?php
+$text = array();
+$text["folder_title"] = "MyDMS - Carpeta [foldername]";
+$text["document_title"] = "MyDMS - Documento [documentname]";
+$text["folder_infos"] = "Informaciones";
+$text["document_infos"] = "Informaciones";
+$text["subfolder_list"] = "SubCarpetas";
+$text["document_list"] = "Documentos";
+$text["download"] = "Download";
+$text["document_versions"] = "Todas las versiones";
+$text["logged_in_as"] = "Login";
+$text["my_account"] = "Mi cuenta";
+$text["user_management"] = "Users";
+$text["user_list"] = "Lista de usuarios";
+$text["logout"] = "Logout";
+$text["foldertree"] = "Arbol de Carpetas";
+$text["selected_folder"] = "Carpeta seleccionada";
+$text["selected_document"] = "Documento seleccionado";
+$text["folder_path"] = "Path";
+$text["folder_overview"] = "Carpeta-Overview";
+$text["document_overview"] = "Documento-Overview";
+$text["comment"] = "Comentario";
+$text["name"] = "Nombre";
+$text["local_file"] = "Archivo local";
+$text["owner"] = "Due&ntilde;o";
+$text["no_subfolders"] = "sin subcarpeta";
+$text["no_documents"] = "sin documentos";
+$text["edit_folder"] = "Edit carpeta";
+$text["edit_document"] = "Edit documento";
+$text["add_subfolder"] = "Agregar Subcarpeta";
+$text["add_document"] = "Agregar Documento";
+$text["edit_folder_props"] = "Editar Carpeta";
+$text["edit_folder_notify"] = "Lista de Notificacion";
+$text["edit_existing_notify"] = "Editar lista de notificacion";
+$text["add_new_notify"] = "Agregar nueva notificacion";
+$text["rm_folder"] = "Borrar carpeta";
+$text["edit_folder_access"] = "Editar acceso";
+$text["creation_date"] = "Creado";
+$text["last_update"] = "Ultima actualizacion";
+$text["current_version"] = "Version actual";
+$text["comment_for_current_version"] = "comentario de la version actual";
+$text["uploaded_by"] = "Actualizado por";
+$text["file_size"] = "tama&ntilde;o de archivo";
+$text["mime_type"] = "Mime-Type";
+$text["exp_date"] = "Expira";
+$text["does_not_expire"] = "No expira";
+$text["lock_status"] = "Status";
+$text["lock_message"] = "Este documento esta bloqueado por <a href=\"mailto:[email]\">[username]</a>.<br>Solo usuaqrio autorizado puede desbloquear el documento (ver fin de pagina).";
+$text["version"] = "Version";
+$text["upload_date"] = "Upload-Fecha";
+$text["update_document"] = "Actualizado";
+$text["unlock_document"] = "Desbloqueado";
+$text["lock_document"] = "Bloqueado";
+$text["edit_document_props"] = "Editar documento";
+$text["edit_document_notify"] = "Lista de Notificacion";
+$text["rm_document"] = "Borrar documento";
+$text["rm_version"] = "Borrar version";
+$text["edit_document_access"] = "Editar accesso";
+$text["select_one"] = "Seleccione uno";
+$text["user"] = "Usuario";
+$text["group"] = "Grupo";
+$text["empty_notify_list"] = "No hay entrado";
+$text["access_mode_none"] = "No hay acceso";
+$text["access_mode_read"] = "Lectura";
+$text["access_mode_readwrite"] = "Lectura-Escritura";
+$text["access_mode_all"] = "Todos";
+$text["login"] = "Login";
+$text["user_login"] = "Nombre de Usuario";
+$text["password"] = "Password";
+$text["wrong_pwd"] = "Password incorrecto, intente otra vez.";
+$text["back"] = "retornar";
+$text["login_not_found"] = "no existe ese usuario";
+$text["content"] = "Contenido";
+$text["search"] = "Busqueda";
+$text["group_management"] = "Grupos";
+$text["search_query"] = "Busqueda por";
+$text["search_mode"] = "Modo";
+$text["search_mode_and"] = "Todas las palabras";
+$text["search_mode_or"] = "al menos una palabra";
+$text["search_in"] = "Buscar en";
+$text["search_in_all"] = "Todas las carpetas";
+$text["search_in_current"] = "solo esta ([foldername]) incluyendo subcarpetas";
+$text["search_results"] = "Resultado de la busqueda";
+$text["search_no_results"] = "No se encontraron documentos para esa busqueda (\"[query]\").";
+$text["search_time"] = "Tiempo transcurrido: [time] sec.";
+$text["search_report"] = "Encontrados [count] documentos para \"[query]\".";
+$text["email"] = "Email";
+$text["user_image"] = "Imagen";
+$text["new_user_image"] = "Nueva imagen";
+$text["goto"] = "Ir a";
+$text["editing_user_data"] = "Editando configuracion usuarios...";
+$text["op_finished"] = "done";
+$text["error_occured"] = "Un error a ocurrido";
+$text["add_user"] = "Agrega nuevo usuario";
+$text["edit_user"] = "Editar usuario";
+$text["choose_user"] = "--Seleccione usuario--";
+$text["user_name"] = "Nombre completo";
+$text["no_user_image"] = "No encontro imagen";
+$text["rm_user"] = "Borrar este usuario";
+$text["add_group"] = "Agrego nuevo usuario";
+$text["edit_group"] = "Editar grupo";
+$text["choose_group"] = "--Seleccione grupo--";
+$text["rm_group"] = "Borrar este grupo";
+$text["add_member"] = "Agregar un miembro";
+$text["adding_group"] = "Agregando grupo del sistema...";
+$text["no_group_members"] = "Este grupo no tiene miembros";
+$text["removing_group"] = "Borrando grupo del sistema...";
+$text["adding_member"] = "Agregando miembro al grupo...";
+$text["remove_member"] = "Borrando miembro";
+$text["removing_member"] = "Borrando miembro del grupo...";
+$text["adding_user"] = "Agregando usuario al sistema...";
+$text["editing_user"] = "Editando usuario...";
+$text["setting_user_image"] = "<br>Asignando imagen al usuario...";
+$text["removing_user"] = "Borrando usuario del sistema...";
+$text["adding_sub_folder"] = "Agregando subcarpeta \"[subfoldername]\" a la carpeta \"[foldername]\"...";
+$text["keywords"] = "Palabras clave";
+$text["expires"] = "Expira";
+$text["adding_document"] = "Agregando documento \"[documentname]\" en la carpeta \"[foldername]\"...";
+$text["updating_document"] = "Actualizando documento...";
+$text["locking_document"] = "Bloqueando documento...";
+$text["unlocking_document"] = "Desbloqueando documento...";
+$text["editing_document_props"] = "Editando documento...";
+$text["edit_document_props_again"] = "Editar documento nuevamente";
+$text["setting_expires"] = "Asignando  expiracion...";
+$text["adding_document_notify"] = "Agregando elementos a la lista de notificacion...";
+$text["document_notify_again"] = "Editar lista de notificacion nuevamente";
+$text["deleting_document_notify"] = "Borrando elemento de lista de notificacion...";
+$text["set_owner"] = "asignando due&ntilde;o";
+$text["edit_inherit_access"] = "Acceso Heredado";
+$text["inherits_access_msg"] = "acceso recursivo.<p><a class=\"inheritAccess\" href=\"[copyurl]\">creando lista de acceso recursiva</a><br><a class=\"inheritAccess\" href=\"[emptyurl]\">Inicializando vacio lista de acceso</a>";
+$text["setting_owner"] = "asignando due&ntilde;o...";
+$text["document_access_again"] = "Editar acceso al documento nuevamente";
+$text["document_set_not_inherit_copy"] = "creando lista de acceso...";
+$text["document_set_not_inherit_empty"] = "Borrando acceso heredado. Vaciando acceso ACL...";
+$text["does_not_inherit_access_msg"] = "<a class=\"inheritAccess\" href=\"[inheriturl]\">acceso recursivo</a>";
+$text["document_set_inherit"] = "Borrando ACL. Documento con acceso recursivo...";
+$text["default_access"] = "modo de acceso por defecto";
+$text["document_set_default_access"] = "guardando modo de acceso por defecto al documento...";
+$text["edit_existing_access"] = "Editando lista de  accesso";
+$text["empty_access_list"] = "Lista de acceso vacia";
+$text["add_access"] = "Agregando accesso";
+$text["access_mode"] = "Modo de Accesso";
+$text["document_add_access"] = "Agregando elemento a la lista de acceso...";
+$text["document_del_access"] = "Borrando elemento de lista de acceso...";
+$text["document_edit_access"] = "Cambiando mode de acceso...";
+$text["editing_folder_props"] = "Editando carpeta...";
+$text["edit_folder_props_again"] = "Editando carpeta nuevamente";
+$text["adding_folder_notify"] = "Agregando elemento a la lista de acceso...";
+$text["folder_notify_again"] = "Editando lista de notificacion";
+$text["deleting_folder_notify"] = "Borrando elemento de lista de notificacion...";
+$text["folder_access_again"] = "Editar carpeta de accesso nuevamente";
+$text["folder_set_not_inherit_copy"] = "Copiando lista de acceso...";
+$text["folder_set_not_inherit_empty"] = "Borrando acceso heredado. Iniciando vacio ACL...";
+$text["folder_set_inherit"] = "Borrando ACL. Todos los accesos heredados...";
+$text["folder_set_default_access"] = "Configurando modo de acceso a la carpeta...";
+$text["folder_add_access"] = "Agregando elemento a lista de acceso...";
+$text["folder_del_access"] = "Borrando elemento de lista de acceso...";
+$text["removing_document"] = "Borrando documento...";
+$text["removing_version"] = "Borrando version [version]...";
+$text["removing_folder"] = "Borrando carpeta...";
+$text["operation_not_allowed"] = "No tiene permiso";
+$text["msg_document_expired"] = "El documento \"[documentname]\" (Path: \"[path]\") expiro [expires]";
+$text["msg_document_updated"] = "El documento \"[documentname]\" (Path: \"[path]\") fue creado o actualizado [updated]";
+$text["notify_subject"] = "Nuevo o expiro documento en el DMS";
+$text["uploading_failed"] = "Fallo subir el archivo. Por favor contacte al administrator.";
+$text["update_locked_msg"] = "El documento esta bloqueado.";
+$text["unlock_cause_locking_user"] = "No se puede actualizar, esta bloqueado.";
+$text["unlock_cause_access_mode_all"] = "Puede actualizarlo \"all\". el bloqueo sera removido automaticamente.";
+$text["no_update_cause_locked"] = "No se puede actualizar el documento, contacte al usuario que lo tiene bloqueado.";
+$text["no_groups"] = "Sin grupos";
+$text["groups"] = "Grupos";
+$text["users"] = "Usuarios";
+$text["root_folder"] = "Carpeta raiz";
+$text["document_already_locked"] = "Documento bloqueado";
+$text["document_is_not_locked"] = "Documento no esta bloqueado";
+$text["unlocking_denied"] = "No tiene permiso para desbloquear documento";
+$text["only_jpg_user_images"] = "Solo .jpg-images puede ser usada como imagen del usuario";
+$text["folder_edit_access"] = "Editando acceso...";
+$text["editing_group"] = "Editando grupo...";
+$text["group_members"] = "Miembros del grupo";
+$text["confirm_pwd"] = "Confirma password";
+$text["js_no_file"] = "Seleccione un archivo";
+$text["js_no_name"] = "Indique un nombre";
+$text["js_no_comment"] = "No es un comentario";
+$text["js_no_keywords"] = "especifique algunas palabras clave";
+$text["js_select_user_or_group"] = "Select un usuario o grupo";
+$text["js_no_login"] = "escriba el nombre de usuario";
+$text["js_no_pwd"] = "debe indicar el password";
+$text["js_no_query"] = "escriba una busqueda";
+$text["js_pwd_not_conf"] = "Password y repetir password no son iguales";
+$text["js_no_email"] = "escriba el email";
+$text["js_select_user"] = "Seleccione un usuario";
+$text["guest_login"] = "Login ";
+$text["view_online"] = "Ver en linea";
+$text["confirm_rm_document"] = "realmente quiere borrar el documento \"[documentname]\"?<br>.";
+$text["confirm_rm_version"] = "realmente quiere borrar la vrsion [version] of document \"[documentname]\"?<br>.";
+$text["confirm_rm_folder"] = "realmente quiere borrar  \"[foldername]\" y su contenido?<br>.";
+$text["sequence"] = "Secuencia";
+$text["seq_end"] = "al final";
+$text["seq_start"] = "primera posicion";
+$text["seq_after"] = "Despues de \"[prevname]\"";
+$text["seq_keep"] = "posicion";
+$text["linked_documents"] = "Documentos relacionados";
+$text["document_link_by"] = "Link por";
+$text["no_document_links"] = "Sin documentos relacionados";
+$text["document_link_public"] = "Publico";
+$text["choose_target_document"] = "Seleccione el documento";
+$text["add_document_link"] = "Agregar link";
+$text["adding_document_link"] = "Agregar link de documento relacionado...";
+$text["remove_document_link"] = "Borrando link";
+$text["removing_document_link"] = "Borrando link de documento relacionado...";
+$text["yes"] = "Si";
+$text["no"] = "No";
+$text["save"] = "Guardar";
+$text["delete"] = "Borrar";
+$text["move_folder"] = "Mover Carpeta";
+$text["choose_target_folder"] = "Seleccione carpeta a cargar";
+$text["moving_folder"] = "Moviendo carpeta...";
+$text["move_document"] = "Moviendo documento";
+$text["moving_document"] = "Moviendo documento...";
+$text["under_folder"] = "En la carpeta";
+$text["all_users"] = "Todos los usuarios";
+$text["language"] = "Lenguaje";
+$text["theme"] = "Tema";
+$text["admin_tools"] = "Herramientas de administracion";
+$text["folders_and_documents_statistic"] = "Overview de carpetas y documentos";
+$text["start"] = "Inicio";
+$text["between"] = "entre";
+$text["and"] = "y";
+$text["use_default_keywords"] = "Usar palablas claves predefinidas";
+$text["global_default_keywords"] = "palabras claves globales";
+$text["personal_default_keywords"] = "personal palabras claves";
+$text["edit_personal_default_keywords"] = "Editar palabras claves personal";
+$text["default_keywords"] = "Disponible palabras clave";
+$text["default_keyword_category"] = "Categorias";
+$text["choose_category"] = "--seleccione--";
+$text["new_default_keyword_category"] = "Agregando categoria";
+$text["edit_default_keyword_category"] = "Editando categoria";
+$text["default_keyword_category_name"] = "Nombre";
+$text["rm_default_keyword_category"] = "Borrando esta categoria";
+$text["new_default_keywords"] = "Agregando palabras clave";
+$text["no_default_keywords"] = "Sin palabras claves disponible";
+$text["creating_new_default_keyword_category"] = "Agregendo categoria...";
+$text["removing_default_keyword_category"] = "Borrando categoria...";
+$text["editing_default_keyword_category"] = "cambiando categoria...";
+$text["adding_default_keywords"] = "Agregando categoria...";
+$text["rm_default_keywords"] = "Borrar palabras claves";
+$text["removing_default_keywords"] = "Borrando palabras claves...";
+$text["edit_default_keywords"] = "Editar palabras clave";
+$text["editing_default_keywords"] = "Cambiando palabras clave...";
+$text["accept"] = "Aceptar";
+$text["cancel"] = "Cancelar";
+?>
Index: /contrib/Dms/languages/German/lang.inc.dawnlinux.original
===================================================================
--- /contrib/Dms/languages/German/lang.inc.dawnlinux.original	(revision 3526)
+++ /contrib/Dms/languages/German/lang.inc.dawnlinux.original	(revision 3526)
@@ -0,0 +1,253 @@
+<?php
+$text = array();
+$text["login"] = "Anmeldung";
+$text["login_not_found"] = "Fehler: Benutzername nicht gefunden";
+$text["wrong_pwd"] = "Fehler: Falsches Passwort";
+$text["keywords"] = "Stichworte";
+$text["root_folder"] = "Übersicht";
+$text["search"] = "Suchen";
+$text["search_query"] = "Suchbegriffe";
+$text["search_mode"] = "Suchmodus";
+$text["search_mode_and"] = "alle Begriffe";
+$text["search_mode_or"] = "min. ein Begriff";
+$text["search_in"] = "Suchen in";
+$text["search_in_all"] = "allen Ordnern"; //weg damit
+$text["search_in_current"] = "diesem Ordner ([foldername])"; //weg damit
+$text["search_results"] = "Suchergebnisse";
+$text["search_report"] = "Die Suche nach \"[query]\" ergab [count] Treffer";
+$text["search_no_results"] = "Die Suche nach \"[query]\" ergab leider keine Treffer.";
+$text["search_time"] = "Dauer: [time] sek.";
+$text["folder_title"] = "MyDMS - Ordner [foldername]";
+$text["document_title"] = "MyDMS - Dokument [documentname]";
+$text["folder_infos"] = "Informationen";
+$text["document_infos"] = "Informationen";
+$text["subfolder_list"] = "Unterordner";
+$text["document_list"] = "Dokumente";
+$text["download"] = "Download";
+$text["logged_in_as"] = "Angemeldet als";
+$text["my_account"] = "Mein Profil";
+$text["user_management"] = "Benutzerverwaltung";
+$text["group_management"] = "Gruppenverwaltung";
+$text["user_list"] = "Benutzerübersicht";
+$text["logout"] = "Abmelden";
+$text["foldertree"] = "Ordnerstruktur";
+$text["selected_folder"] = "Aktueller Ordner";
+$text["selected_document"] = "Aktuelles Dokument";
+$text["folder_path"] = "Pfad";
+$text["folder_overview"] = "Ordnerübersicht";
+$text["document_overview"] = "Dokumentübersicht";
+$text["owner"] = "Besitzer";
+$text["set_owner"] = "Besitzer ändern";
+$text["setting_owner"] = "Ändere Besitzer...";
+$text["comment"] = "Kommentar";
+$text["name"] = "Name";
+$text["local_file"] = "Lokale Datei";
+$text["owner"] = "Besitzer";
+$text["no_subfolders"] = "Keine Unterordner";
+$text["no_documents"] = "Keine Dokumente";
+$text["edit_folder"] = "Ordner bearbeiten";
+$text["edit_document"] = "Dokument bearbeiten";
+$text["add_subfolder"] = "Unterordner anlegen";
+$text["add_document"] = "Dokument anlegen";
+$text["edit_folder_props"] = "Ordner bearbeiten";
+$text["edit_folder_props_again"] = "Ordner nochmals bearbeiten";
+$text["edit_folder_notify"] = "Benachrichtigungen";
+$text["edit_existing_notify"] = "Liste bearbeiten";
+$text["add_new_notify"] = "Neuen Eintrag";
+$text["rm_folder"] = "Ordner löschen";
+$text["edit_folder_access"] = "Zugriffsrechte bearbeiten";
+$text["creation_date"] = "Erstellt am";
+$text["last_update"] = "Letztes Update";
+$text["current_version"] = "Aktuelle Version";
+$text["document_versions"] = "Alle Versionen";
+$text["comment_for_current_version"] = "Kommentar zur<br>aktuellen Version";
+$text["uploaded_by"] = "Upload durch";
+$text["file_size"] = "Dateigröße";
+$text["mime_type"] = "Mime-Typ";
+$text["expires"] = "Gültigkeit";
+$text["does_not_expire"] = "Keine Gültigkeit";
+$text["setting_expires"] = "Setze neue Gültigkeit...";
+$text["lock_status"] = "Status";
+$text["lock_message"] = "Diese Datei wurde von Benutzer <a href=\"mailto:[email]\">[username]</a> gesperrt.<br>Die Sperrung kann von authorisierten Benutzern hier aufgehoben werden (siehe Ende der Seite).";
+$text["version"] = "Version";
+$text["upload_date"] = "Upload am";
+$text["update_document"] = "Update";
+$text["unlock_document"] = "Sperrung aufheben";
+$text["lock_document"] = "Sperren";
+$text["edit_document_props"] = "Bearbeiten";
+$text["edit_document_notify"] = "Benachrichtiungen";
+$text["rm_document"] = "Löschen";
+$text["rm_version"] = "Version löschen";
+$text["edit_document_access"] = "Zugriffsrechte bearbeiten";
+$text["select_one"] = "Bitte wählen";
+$text["user"] = "Benutzer";
+$text["users"] = "Benutzer";
+$text["group"] = "Gruppe";
+$text["groups"] = "Gruppen";
+$text["no_groups"] = "keine Gruppen";
+$text["empty_notify_list"] = "Keine Benachrichtigungen";
+$text["empty_access_list"] = "Keine Berechtigungen gesetzt";
+$text["access_mode"] = "Berechtigung";
+$text["access_mode_none"] = "Kein Zugriff";
+$text["access_mode_read"] = "Lesen";
+$text["access_mode_readwrite"] = "Lesen+Schreiben";
+$text["access_mode_all"] = "Keine Beschränkung";
+$text["edit_inherit_access"] = "Berechtigungen erben";
+$text["default_access"] = "Standardberechtigung";
+$text["edit_existing_access"] = "Bestehende Berechtigungen";
+$text["add_access"] = "Berechtigung hinzufügen";
+$text["inherits_access_msg"] = "Im Momemt werden die Rechte geerbt<p><a class=\"inheritAccess\" href=\"[copyurl]\">Berechtigungen kopieren</a><br><a class=\"inheritAccess\" href=\"[emptyurl]\">Leere ACL</a>";
+$text["does_not_inherit_access_msg"] = "<a class=\"inheritAccess\" href=\"[inheriturl]\">Berechtigungen wieder erben</a>";
+$text["update_locked_msg"] = "Dieses Dokument wurde gesperrt<p>Die Sperrung wurde von <a href=\"mailto:[email]\">[username]</a> eingerichtet.<br>";
+$text["unlock_cause_locking_user"] = "Sie sind im Moment mit demselben Benutzer angemeldet.<br>Daher wird die Sperrung beim Update automatisch aufgehoben";
+$text["unlock_cause_access_mode_all"] = "Sie verfügen jedoch über unbeschränken Zugriff auf dieses Dokument.<br>Daher wird die Sperrung beim Update automatisch aufgehoben";
+$text["no_update_cause_locked"] = "Sie können daher im Moment diese Datei nicht updaten. Wenden Sie sich an den Benutzer, der die Sperrung eingerichtet hat";
+$text["operation_not_allowed"] = "Sie besitzen nicht die nötigen Zugriffsrechte";
+$text["adding_sub_folder"] = "Erstelle Unterordner \"[subfoldername]\" in Ordner \"[foldername]\"...";
+$text["error_occured"] = "Ein Fehler ist aufgetreten.<br>Bitte Administrator benachrichtigen<p>";
+$text["op_finished"] = "fertig.<p>";
+$text["uploading_failed"] = "Der Datei-Upload ist fehlgeschlagen.<br>Bitte Administrator benachrichtigen<p>";
+$text["adding_document"] = "Erstelle Dokument \"[documentname]\" in Ordner \"[foldername]\"...";
+$text["editing_folder_props"] = "Bearbeite Ordner-Eigenschaften...";
+$text["deleting_folder_notify"] = "Lösche Benachrichtigung...";
+$text["adding_folder_notify"] = "Füge Benachrichtigung hinzu...";
+$text["folder_notify_again"] = "Benachrichtigungen anzeigen";
+$text["folder_set_not_inherit_copy"] = "Kopiere Berechtigungen...";
+$text["folder_set_not_inherit_empty"] = "Entferne Rechte-Vererbung (leere ACL)...";
+$text["folder_set_inherit"] = "Umstellen auf Rechte-Vererbung...";
+$text["folder_set_default_access"] = "Setze Standard-Berechtigung für Ordner...";
+$text["folder_edit_access"] = "Ändere Berechtigung...";
+$text["folder_del_access"] = "Enterne Berechtigung...";
+$text["folder_add_access"] = "Füge Berechtigung hinzu...";
+$text["folder_access_again"] = "Berechtigungen erneut bearbeiten";
+$text["removing_folder"] = "Entferne Ordner...";
+$text["updating_document"] = "Führe Update durch...";
+$text["document_already_locked"] = "Dieses Dokument ist bereits gesperrt";
+$text["locking_document"] = "Richte Sperre ein...";
+$text["document_is_not_locked"] = "Dieses Dokument ist überhaupt nicht gesperrt";
+$text["unlocking_denied"] = "Sie verfügen nicht über die nötigen Rechte um die Sperrung aufzuheben";
+$text["unlocking_document"] = "Hebe Sperrung des Dokumentes auf...";
+$text["editing_document_props"] = "Bearbeite Dokument-Eigenschaften...";
+$text["edit_document_props_again"] = "Erneut bearbeiten";
+$text["document_notify_again"] = "Benachrichtigungen anzeigen";
+$text["adding_document_notify"] = "Füge Benachrichtigung hinzu...";
+$text["deleting_document_notify"] = "Entferne Benachrichtigung...";
+$text["removing_document"] = "Entferne Dokument...";
+$text["removing_version"] = "Entferne Version [version]...";
+$text["document_add_access"] = "Füge Berechtigung hinzu...";
+$text["document_del_access"] = "Entferne Berechtigung...";
+$text["document_edit_access"] = "Bearbeite Berechtigung...";
+$text["document_set_default_access"] = "Setze Standard-Berechtigung...";
+$text["document_set_inherit"] = "Umstellen auf Rechte-Vererbung...";
+$text["document_set_not_inherit_empty"] = "Entferne Rechte-Vererbung (leere ACL)...";
+$text["document_set_not_inherit_copy"] = "Kopiere Berechtigungen...";
+$text["document_access_again"] = "Rechte erneut bearbeiten";
+$text["content"] = "Inhalt";
+$text["email"] = "Email";
+$text["password"] = "Password";
+$text["user_image"] = "Bild";
+$text["no_user_image"] = "Kein Bild vorhanden";
+$text["new_user_image"] = "Neues Bild";
+$text["editing_user_data"] = "Bearbeite Benutzerdaten...";
+$text["user_name"] = "Vollst. Name";
+$text["user_login"] = "Benutzername";
+$text["only_jpg_user_images"] = "Es sind nur JPG-Bilder erlaubt";
+$text["msg_document_expired"] = "Das Dokument \"[documentname]\" (Pfad: \"[path]\") ist nur gültig bis zum [expires]";
+$text["msg_document_updated"] = "Das Dokument \"[documentname]\" (Pfad: \"[path]\") wurde am [updated] neu erstellt oder erneurt";
+$text["notify_subject"] = "Neue oder veraltete Inhalte im DMS";
+$text["edit_user"] = "Benutzer bearbeiten";
+$text["choose_user"] = "--Benutzer wählen--";
+$text["add_user"] = "Neuen Benutzer anlegen";
+$text["rm_user"] = "Diesen Benutzer löschen";
+$text["adding_user"] = "Erstelle neuen Benutzer...";
+$text["removing_user"] = "Lösche Benutzer...";
+$text["setting_user_image"] = "Setze Benutzer-Bild...";
+$text["editing_user"] = "Bearbeite Benutzer...";
+$text["add_group"] = "Neue Gruppe anlegen";
+$text["edit_group"] = "Gruppe bearbeiten";
+$text["choose_group"] = "--Gruppe wählen--";
+$text["rm_group"] = "Diese Gruppe löschen";
+$text["adding_group"] = "Erstelle neue Gruppe...";
+$text["editing_group"] = "Bearbeite Gruppe...";
+$text["removing_group"] = "Lösche Gruppe...";
+$text["group_members"] = "Gruppenmitglieder";
+$text["no_group_members"] = "Diese Gruppe hat keine Mitglieder";
+$text["add_member"] = "Hinzufügen";
+$text["adding_member"] = "Hinzufügen des Benutzers zur Gruppe...";
+$text["remove_member"] = "Entfernen";
+$text["removing_member"] = "Entferne Benutzer aus Gruppe...";
+$text["goto"] = "Gehe zu";
+$text["back"] = "Zurück";
+$text["confirm_pwd"] = "Passwort-Bestätigung";
+$text["guest_login"] = "Als Gast anmelden";
+$text["view_online"] = "Online betrachten";
+$text["confirm_rm_document"] = "Wollen Sie das Dokument \"[documentname]\" wirklich löschen?<br>Achtung: Dieser Vorgang kann nicht rückgängig gemacht werden.";
+$text["confirm_rm_version"] = "Wollen Sie Version [version] des Dokumentes \"[documentname]\" wirklich löschen?<br>Achtung: Dieser Vorgang kann nicht rückgängig gemacht werden.";
+$text["confirm_rm_folder"] = "Wollen Sie den Ordner \"[foldername]\" mitsamt seines Inhalts wirklich löschen?<br>Achtung: Dieser Vorgang kann nicht rückgängig gemacht werden.";
+$text["js_no_file"] = "Bitte wählen Sie eine Datei";
+$text["js_no_name"] = "Sie haben den Namen vergessen";
+$text["js_no_comment"] = "Geben Sie einen Kommentar an";
+$text["js_no_keywords"] = "Geben Sie einige Schlüsselwörter an";
+$text["js_select_user_or_group"] = "Wählen Sie wenigstens einen Benutzer oder eine Gruppe";
+$text["js_no_login"] = "Geben Sie einen Benutzernamen ein";
+$text["js_no_pwd"] = "Sie müssen ein Passwort eingeben";
+$text["js_no_query"] = "Geben Sie einen Suchbegriff ein";
+$text["js_pwd_not_conf"] = "Passwort und -bestätigung stimmen nicht überein";
+$text["js_no_email"] = "Geben Sie eine Email-Addresse an";
+$text["js_select_user"] = "Bitte einen Benutzer auswählen";
+$text["sequence"] = "Reihenfolge";
+$text["seq_end"] = "Ans Ende";
+$text["seq_start"] = "An den Anfang";
+$text["seq_after"] = "Nach \"[prevname]\"";
+$text["seq_keep"] = "Beibehalten";
+$text["linked_documents"] = "Verwandte Dokumente";
+$text["document_link_by"] = "Verweis erstellt von";
+$text["no_document_links"] = "Keine verwandten Dokumente";
+$text["document_link_public"] = "Für alle sichtbar";
+$text["choose_target_document"] = "Dokument wählen";
+$text["add_document_link"] = "Verweis hinzufügen";
+$text["adding_document_link"] = "Erstelle Verweis zu verwandtem Dokument...";
+$text["remove_document_link"] = "Verweis entfernen";
+$text["removing_document_link"] = "Entferne Verweis auf verwandtes Dokument...";
+$text["yes"] = "Ja";
+$text["no"] = "Nein";
+$text["save"] = "Speichern";
+$text["delete"] = "Löschen";
+$text["move_folder"] = "Ordner verschieben";
+$text["choose_target_folder"] = "Zielordner wählen";
+$text["moving_folder"] = "Verschiebe Ordner...";
+$text["move_document"] = "Dokument verschieben";
+$text["moving_document"] = "Verschiebe Dokument...";
+$text["under_folder"] = "In Ordner";
+$text["all_users"] = "Alle Benutzer";
+$text["language"] = "Sprache";
+$text["theme"] = "Aussehen";
+$text["admin_tools"] = "Administrationsbereich";
+$text["folders_and_documents_statistic"] = "Ordner- und Dokumenten-Übersicht";
+$text["start"] = "Starten";
+$text["between"] = "zwischen";
+$text["and"] = "und";
+$text["use_default_keywords"] = "Stichwortvorlagen";
+$text["global_default_keywords"] = "Globale Kategorien";
+$text["personal_default_keywords"] = "Persönliche Kategorien";
+$text["edit_personal_default_keywords"] = "Persönliche Stichwortvorlagen bearbeiten";
+$text["default_keywords"] = "Vorlagen";
+$text["default_keyword_category"] = "Kategorien";
+$text["choose_category"] = "--Bitte wählen--";
+$text["new_default_keyword_category"] = "Neue Kategorie";
+$text["edit_default_keyword_category"] = "Kategorien bearbeiten";
+$text["default_keyword_category_name"] = "Kategorien-Name";
+$text["rm_default_keyword_category"] = "Kategorie löschen";
+$text["new_default_keywords"] = "Neue Vorlage";
+$text["no_default_keywords"] = "Keine Vorlagen vorhanden";
+$text["creating_new_default_keyword_category"] = "Erstelle neue Kategorie...";
+$text["removing_default_keyword_category"] = "Entferne Kategorie...";
+$text["editing_default_keyword_category"] = "Ändere Kategorie...";
+$text["adding_default_keywords"] = "Lege neue Stichwort-Vorlage an...";
+$text["rm_default_keywords"] = "Stichwort-Vorlage löschen";
+$text["removing_default_keywords"] = "Entferne Stichwort-Vorlage...";
+$text["edit_default_keywords"] = "Stichwort-Vorlage bearbeiten";
+$text["editing_default_keywords"] = "Ändere Stichwort-Vorlage...";
+$text["accept"] = "Übernehmen";
+$text["cancel"] = "Abbrechen";
+?>
Index: /contrib/Dms/languages/German/lang.inc
===================================================================
--- /contrib/Dms/languages/German/lang.inc	(revision 3526)
+++ /contrib/Dms/languages/German/lang.inc	(revision 3526)
@@ -0,0 +1,253 @@
+<?php
+$text = array();
+$text["login"] = "Anmeldung";
+$text["login_not_found"] = "Fehler: Benutzername nicht gefunden";
+$text["wrong_pwd"] = "Fehler: Falsches Passwort";
+$text["keywords"] = "Stichworte";
+$text["root_folder"] = "Übersicht";
+$text["search"] = "Suchen";
+$text["search_query"] = "Suchbegriffe";
+$text["search_mode"] = "Suchmodus";
+$text["search_mode_and"] = "alle Begriffe";
+$text["search_mode_or"] = "min. ein Begriff";
+$text["search_in"] = "Suchen in";
+$text["search_in_all"] = "allen Ordnern"; //weg damit
+$text["search_in_current"] = "diesem Ordner ([foldername])"; //weg damit
+$text["search_results"] = "Suchergebnisse";
+$text["search_report"] = "Die Suche nach \"[query]\" ergab [count] Treffer";
+$text["search_no_results"] = "Die Suche nach \"[query]\" ergab leider keine Treffer.";
+$text["search_time"] = "Dauer: [time] sek.";
+$text["folder_title"] = "MyDMS - Ordner [foldername]";
+$text["document_title"] = "MyDMS - Dokument [documentname]";
+$text["folder_infos"] = "Informationen";
+$text["document_infos"] = "Informationen";
+$text["subfolder_list"] = "Unterordner";
+$text["document_list"] = "Dokumente";
+$text["download"] = "Download";
+$text["logged_in_as"] = "Angemeldet als";
+$text["my_account"] = "Mein Profil";
+$text["user_management"] = "Benutzerverwaltung";
+$text["group_management"] = "Gruppenverwaltung";
+$text["user_list"] = "Benutzerübersicht";
+$text["logout"] = "Abmelden";
+$text["foldertree"] = "Ordnerstruktur";
+$text["selected_folder"] = "Aktueller Ordner";
+$text["selected_document"] = "Aktuelles Dokument";
+$text["folder_path"] = "Pfad";
+$text["folder_overview"] = "Ordnerübersicht";
+$text["document_overview"] = "Dokumentübersicht";
+$text["owner"] = "Besitzer";
+$text["set_owner"] = "Besitzer ändern";
+$text["setting_owner"] = "Ändere Besitzer...";
+$text["comment"] = "Kommentar";
+$text["name"] = "Name";
+$text["local_file"] = "Lokale Datei";
+$text["owner"] = "Besitzer";
+$text["no_subfolders"] = "Keine Unterordner";
+$text["no_documents"] = "Keine Dokumente";
+$text["edit_folder"] = "Ordner bearbeiten";
+$text["edit_document"] = "Dokument bearbeiten";
+$text["add_subfolder"] = "Unterordner anlegen";
+$text["add_document"] = "Dokument anlegen";
+$text["edit_folder_props"] = "Ordner bearbeiten";
+$text["edit_folder_props_again"] = "Ordner nochmals bearbeiten";
+$text["edit_folder_notify"] = "Benachrichtigungen";
+$text["edit_existing_notify"] = "Liste bearbeiten";
+$text["add_new_notify"] = "Neuen Eintrag";
+$text["rm_folder"] = "Ordner löschen";
+$text["edit_folder_access"] = "Zugriffsrechte bearbeiten";
+$text["creation_date"] = "Erstellt am";
+$text["last_update"] = "Letztes Update";
+$text["current_version"] = "Aktuelle Version";
+$text["document_versions"] = "Alle Versionen";
+$text["comment_for_current_version"] = "Kommentar zur<br>aktuellen Version";
+$text["uploaded_by"] = "Upload durch";
+$text["file_size"] = "Dateigröße";
+$text["mime_type"] = "Mime-Typ";
+$text["expires"] = "Gültigkeit";
+$text["does_not_expire"] = "Keine Gültigkeit";
+$text["setting_expires"] = "Setze neue Gültigkeit...";
+$text["lock_status"] = "Status";
+$text["lock_message"] = "Diese Datei wurde von Benutzer <a href=\"mailto:[email]\">[username]</a> gesperrt.<br>Die Sperrung kann von authorisierten Benutzern hier aufgehoben werden (siehe Ende der Seite).";
+$text["version"] = "Version";
+$text["upload_date"] = "Upload am";
+$text["update_document"] = "Update";
+$text["unlock_document"] = "Sperrung aufheben";
+$text["lock_document"] = "Sperren";
+$text["edit_document_props"] = "Bearbeiten";
+$text["edit_document_notify"] = "Benachrichtiungen";
+$text["rm_document"] = "Löschen";
+$text["rm_version"] = "Version löschen";
+$text["edit_document_access"] = "Zugriffsrechte bearbeiten";
+$text["select_one"] = "Bitte wählen";
+$text["user"] = "Benutzer";
+$text["users"] = "Benutzer";
+$text["group"] = "Gruppe";
+$text["groups"] = "Gruppen";
+$text["no_groups"] = "keine Gruppen";
+$text["empty_notify_list"] = "Keine Benachrichtigungen";
+$text["empty_access_list"] = "Keine Berechtigungen gesetzt";
+$text["access_mode"] = "Berechtigung";
+$text["access_mode_none"] = "Kein Zugriff";
+$text["access_mode_read"] = "Lesen";
+$text["access_mode_readwrite"] = "Lesen+Schreiben";
+$text["access_mode_all"] = "Keine Beschränkung";
+$text["edit_inherit_access"] = "Berechtigungen erben";
+$text["default_access"] = "Standardberechtigung";
+$text["edit_existing_access"] = "Bestehende Berechtigungen";
+$text["add_access"] = "Berechtigung hinzufügen";
+$text["inherits_access_msg"] = "Im Momemt werden die Rechte geerbt<p><a class=\"inheritAccess\" href=\"[copyurl]\">Berechtigungen kopieren</a><br><a class=\"inheritAccess\" href=\"[emptyurl]\">Leere ACL</a>";
+$text["does_not_inherit_access_msg"] = "<a class=\"inheritAccess\" href=\"[inheriturl]\">Berechtigungen wieder erben</a>";
+$text["update_locked_msg"] = "Dieses Dokument wurde gesperrt<p>Die Sperrung wurde von <a href=\"mailto:[email]\">[username]</a> eingerichtet.<br>";
+$text["unlock_cause_locking_user"] = "Sie sind im Moment mit demselben Benutzer angemeldet.<br>Daher wird die Sperrung beim Update automatisch aufgehoben";
+$text["unlock_cause_access_mode_all"] = "Sie verfügen jedoch über unbeschränken Zugriff auf dieses Dokument.<br>Daher wird die Sperrung beim Update automatisch aufgehoben";
+$text["no_update_cause_locked"] = "Sie können daher im Moment diese Datei nicht updaten. Wenden Sie sich an den Benutzer, der die Sperrung eingerichtet hat";
+$text["operation_not_allowed"] = "Sie besitzen nicht die nötigen Zugriffsrechte";
+$text["adding_sub_folder"] = "Erstelle Unterordner \"[subfoldername]\" in Ordner \"[foldername]\"...";
+$text["error_occured"] = "Ein Fehler ist aufgetreten.<br>Bitte Administrator benachrichtigen<p>";
+$text["op_finished"] = "fertig.<p>";
+$text["uploading_failed"] = "Der Datei-Upload ist fehlgeschlagen.<br>Bitte Administrator benachrichtigen<p>";
+$text["adding_document"] = "Erstelle Dokument \"[documentname]\" in Ordner \"[foldername]\"...";
+$text["editing_folder_props"] = "Bearbeite Ordner-Eigenschaften...";
+$text["deleting_folder_notify"] = "Lösche Benachrichtigung...";
+$text["adding_folder_notify"] = "Füge Benachrichtigung hinzu...";
+$text["folder_notify_again"] = "Benachrichtigungen anzeigen";
+$text["folder_set_not_inherit_copy"] = "Kopiere Berechtigungen...";
+$text["folder_set_not_inherit_empty"] = "Entferne Rechte-Vererbung (leere ACL)...";
+$text["folder_set_inherit"] = "Umstellen auf Rechte-Vererbung...";
+$text["folder_set_default_access"] = "Setze Standard-Berechtigung für Ordner...";
+$text["folder_edit_access"] = "Ändere Berechtigung...";
+$text["folder_del_access"] = "Enterne Berechtigung...";
+$text["folder_add_access"] = "Füge Berechtigung hinzu...";
+$text["folder_access_again"] = "Berechtigungen erneut bearbeiten";
+$text["removing_folder"] = "Entferne Ordner...";
+$text["updating_document"] = "Führe Update durch...";
+$text["document_already_locked"] = "Dieses Dokument ist bereits gesperrt";
+$text["locking_document"] = "Richte Sperre ein...";
+$text["document_is_not_locked"] = "Dieses Dokument ist überhaupt nicht gesperrt";
+$text["unlocking_denied"] = "Sie verfügen nicht über die nötigen Rechte um die Sperrung aufzuheben";
+$text["unlocking_document"] = "Hebe Sperrung des Dokumentes auf...";
+$text["editing_document_props"] = "Bearbeite Dokument-Eigenschaften...";
+$text["edit_document_props_again"] = "Erneut bearbeiten";
+$text["document_notify_again"] = "Benachrichtigungen anzeigen";
+$text["adding_document_notify"] = "Füge Benachrichtigung hinzu...";
+$text["deleting_document_notify"] = "Entferne Benachrichtigung...";
+$text["removing_document"] = "Entferne Dokument...";
+$text["removing_version"] = "Entferne Version [version]...";
+$text["document_add_access"] = "Füge Berechtigung hinzu...";
+$text["document_del_access"] = "Entferne Berechtigung...";
+$text["document_edit_access"] = "Bearbeite Berechtigung...";
+$text["document_set_default_access"] = "Setze Standard-Berechtigung...";
+$text["document_set_inherit"] = "Umstellen auf Rechte-Vererbung...";
+$text["document_set_not_inherit_empty"] = "Entferne Rechte-Vererbung (leere ACL)...";
+$text["document_set_not_inherit_copy"] = "Kopiere Berechtigungen...";
+$text["document_access_again"] = "Rechte erneut bearbeiten";
+$text["content"] = "Inhalt";
+$text["email"] = "Email";
+$text["password"] = "Password";
+$text["user_image"] = "Bild";
+$text["no_user_image"] = "Kein Bild vorhanden";
+$text["new_user_image"] = "Neues Bild";
+$text["editing_user_data"] = "Bearbeite Benutzerdaten...";
+$text["user_name"] = "Vollst. Name";
+$text["user_login"] = "Benutzername";
+$text["only_jpg_user_images"] = "Es sind nur JPG-Bilder erlaubt";
+$text["msg_document_expired"] = "Das Dokument \"[documentname]\" (Pfad: \"[path]\") ist nur gültig bis zum [expires]";
+$text["msg_document_updated"] = "Das Dokument \"[documentname]\" (Pfad: \"[path]\") wurde am [updated] neu erstellt oder erneurt";
+$text["notify_subject"] = "Neue oder veraltete Inhalte im DMS";
+$text["edit_user"] = "Benutzer bearbeiten";
+$text["choose_user"] = "--Benutzer wählen--";
+$text["add_user"] = "Neuen Benutzer anlegen";
+$text["rm_user"] = "Diesen Benutzer löschen";
+$text["adding_user"] = "Erstelle neuen Benutzer...";
+$text["removing_user"] = "Lösche Benutzer...";
+$text["setting_user_image"] = "Setze Benutzer-Bild...";
+$text["editing_user"] = "Bearbeite Benutzer...";
+$text["add_group"] = "Neue Gruppe anlegen";
+$text["edit_group"] = "Gruppe bearbeiten";
+$text["choose_group"] = "--Gruppe wählen--";
+$text["rm_group"] = "Diese Gruppe löschen";
+$text["adding_group"] = "Erstelle neue Gruppe...";
+$text["editing_group"] = "Bearbeite Gruppe...";
+$text["removing_group"] = "Lösche Gruppe...";
+$text["group_members"] = "Gruppenmitglieder";
+$text["no_group_members"] = "Diese Gruppe hat keine Mitglieder";
+$text["add_member"] = "Hinzufügen";
+$text["adding_member"] = "Hinzufügen des Benutzers zur Gruppe...";
+$text["remove_member"] = "Entfernen";
+$text["removing_member"] = "Entferne Benutzer aus Gruppe...";
+$text["goto"] = "Gehe zu";
+$text["back"] = "Zurück";
+$text["confirm_pwd"] = "Passwort-Bestätigung";
+$text["guest_login"] = "Als Gast anmelden";
+$text["view_online"] = "Online betrachten";
+$text["confirm_rm_document"] = "Wollen Sie das Dokument \"[documentname]\" wirklich löschen?<br>Achtung: Dieser Vorgang kann nicht rückgängig gemacht werden.";
+$text["confirm_rm_version"] = "Wollen Sie Version [version] des Dokumentes \"[documentname]\" wirklich löschen?<br>Achtung: Dieser Vorgang kann nicht rückgängig gemacht werden.";
+$text["confirm_rm_folder"] = "Wollen Sie den Ordner \"[foldername]\" mitsamt seines Inhalts wirklich löschen?<br>Achtung: Dieser Vorgang kann nicht rückgängig gemacht werden.";
+$text["js_no_file"] = "Bitte wählen Sie eine Datei";
+$text["js_no_name"] = "Sie haben den Namen vergessen";
+$text["js_no_comment"] = "Geben Sie einen Kommentar an";
+$text["js_no_keywords"] = "Geben Sie einige Schlüsselwörter an";
+$text["js_select_user_or_group"] = "Wählen Sie wenigstens einen Benutzer oder eine Gruppe";
+$text["js_no_login"] = "Geben Sie einen Benutzernamen ein";
+$text["js_no_pwd"] = "Sie müssen ein Passwort eingeben";
+$text["js_no_query"] = "Geben Sie einen Suchbegriff ein";
+$text["js_pwd_not_conf"] = "Passwort und -bestätigung stimmen nicht überein";
+$text["js_no_email"] = "Geben Sie eine Email-Addresse an";
+$text["js_select_user"] = "Bitte einen Benutzer auswählen";
+$text["sequence"] = "Reihenfolge";
+$text["seq_end"] = "Ans Ende";
+$text["seq_start"] = "An den Anfang";
+$text["seq_after"] = "Nach \"[prevname]\"";
+$text["seq_keep"] = "Beibehalten";
+$text["linked_documents"] = "Verwandte Dokumente";
+$text["document_link_by"] = "Verweis erstellt von";
+$text["no_document_links"] = "Keine verwandten Dokumente";
+$text["document_link_public"] = "Für alle sichtbar";
+$text["choose_target_document"] = "Dokument wählen";
+$text["add_document_link"] = "Verweis hinzufügen";
+$text["adding_document_link"] = "Erstelle Verweis zu verwandtem Dokument...";
+$text["remove_document_link"] = "Verweis entfernen";
+$text["removing_document_link"] = "Entferne Verweis auf verwandtes Dokument...";
+$text["yes"] = "Ja";
+$text["no"] = "Nein";
+$text["save"] = "Speichern";
+$text["delete"] = "Löschen";
+$text["move_folder"] = "Ordner verschieben";
+$text["choose_target_folder"] = "Zielordner wählen";
+$text["moving_folder"] = "Verschiebe Ordner...";
+$text["move_document"] = "Dokument verschieben";
+$text["moving_document"] = "Verschiebe Dokument...";
+$text["under_folder"] = "In Ordner";
+$text["all_users"] = "Alle Benutzer";
+$text["language"] = "Sprache";
+$text["theme"] = "Aussehen";
+$text["admin_tools"] = "Administrationsbereich";
+$text["folders_and_documents_statistic"] = "Ordner- und Dokumenten-Übersicht";
+$text["start"] = "Starten";
+$text["between"] = "zwischen";
+$text["and"] = "und";
+$text["use_default_keywords"] = "Stichwortvorlagen";
+$text["global_default_keywords"] = "Globale Kategorien";
+$text["personal_default_keywords"] = "Persönliche Kategorien";
+$text["edit_personal_default_keywords"] = "Persönliche Stichwortvorlagen bearbeiten";
+$text["default_keywords"] = "Vorlagen";
+$text["default_keyword_category"] = "Kategorien";
+$text["choose_category"] = "--Bitte wählen--";
+$text["new_default_keyword_category"] = "Neue Kategorie";
+$text["edit_default_keyword_category"] = "Kategorien bearbeiten";
+$text["default_keyword_category_name"] = "Kategorien-Name";
+$text["rm_default_keyword_category"] = "Kategorie löschen";
+$text["new_default_keywords"] = "Neue Vorlage";
+$text["no_default_keywords"] = "Keine Vorlagen vorhanden";
+$text["creating_new_default_keyword_category"] = "Erstelle neue Kategorie...";
+$text["removing_default_keyword_category"] = "Entferne Kategorie...";
+$text["editing_default_keyword_category"] = "Ändere Kategorie...";
+$text["adding_default_keywords"] = "Lege neue Stichwort-Vorlage an...";
+$text["rm_default_keywords"] = "Stichwort-Vorlage löschen";
+$text["removing_default_keywords"] = "Entferne Stichwort-Vorlage...";
+$text["edit_default_keywords"] = "Stichwort-Vorlage bearbeiten";
+$text["editing_default_keywords"] = "Ändere Stichwort-Vorlage...";
+$text["accept"] = "Übernehmen";
+$text["cancel"] = "Abbrechen";
+?>
Index: /contrib/Dms/languages/Chinese/lang.inc
===================================================================
--- /contrib/Dms/languages/Chinese/lang.inc	(revision 3526)
+++ /contrib/Dms/languages/Chinese/lang.inc	(revision 3526)
@@ -0,0 +1,291 @@
+<?php
+$text = array();
+$text["folder_title"] = "ææ¡£ç®¡ç - æä»¶å€¹ [foldername]";
+$text["document_title"] = "ææ¡£ç®¡ç - æä»¶ [documentname]";
+$text["folder_infos"] = "æä»¶å€¹ä¿¡æ¯";
+$text["document_infos"] = "æä»¶ä¿¡æ¯";
+$text["subfolder_list"] = "å­æä»¶å€¹";
+$text["document_list"] = "æä»¶";
+$text["download_document_content"] = "äžèœœ";
+$text["download"] = "æä»¶äžèœœ";
+$text["logged_in_as"] = "ç»é";
+$text["my_account"] = "æçåžæ·";
+$text["user_management"] = "çšæ·";
+$text["user_list"] = "çšæ·åè¡š";
+$text["logout"] = "éåº";
+$text["foldertree"] = "æä»¶å€¹æ ";
+$text["selected_folder"] = "éæ©çæä»¶å€¹";
+$text["selected_document"] = "éæ©çæä»¶";
+$text["folder_path"] = "è·¯åŸ";
+$text["folder_overview"] = "æä»¶å€¹-æŠåµ";
+$text["document_overview"] = "æä»¶-æŠåµ";
+$text["comment"] = "å€æ³š";
+$text["name"] = "åç§°";
+$text["local_file"] = "æ¬å°æä»¶";
+$text["owner"] = "ææäºº";
+$text["no_subfolders"] = "æ²¡æå­æä»¶å€¹";
+$text["no_documents"] = "æ²¡ææä»¶";
+$text["edit_folder"] = "çŒèŸæä»¶å€¹";
+$text["edit_document"] = "çŒèŸæä»¶";
+$text["add_subfolder"] = "å¢å å­æä»¶å€¹";
+$text["add_document"] = "å¢å æä»¶";
+$text["edit_folder_props"] = "çŒèŸæä»¶å€¹å±æ§";
+$text["edit_folder_notify"] = "æç€ºåè¡š";
+$text["edit_existing_notify"] = "çŒèŸæç€ºåè¡š";
+$text["add_new_notify"] = "å¢å æ°æç€º";
+$text["rm_folder"] = "å é€æä»¶å€¹";
+$text["edit_folder_access"] = "çŒèŸå­åæé";
+$text["creation_date"] = "å»ºç«æ¥æ";
+$text["last_update"] = "æŽæ°æ¥æ";
+$text["current_version"] = "åœåçæ¬";
+$text["comment_for_current_version"] = "åœåçæ¬è¯Žæ";
+$text["uploaded_by"] = "äžèœœäºº";
+$text["file_size"] = "æä»¶å€§å°";
+$text["mime_type"] = "Mimeç±»å";
+$text["exp_date"] = "è¿ææ¥æ";
+$text["does_not_expire"] = "è¿æ²¡è¿æ";
+$text["lock_status"] = "éå®ç¶æ";
+$text["lock_message"] = "æ¬æä»¶å·²è¢«<a href=\"mailto:[email]\">[username]</a>éå®ã<br>ä»
+ææçšæ·å¯ä»¥ä¿®æ¹éå®(è§é¡µæ«)ã";
+$text["version"] = "çæ¬";
+$text["upload_date"] = "äžèœœæ¥æ";
+$text["update_document"] = "æŽæ°";
+$text["unlock_document"] = "æªéå®";
+$text["lock_document"] = "éå®";
+$text["edit_document_props"] = "çŒèŸæä»¶å±æ§";
+$text["edit_document_notify"] = "æç€ºåè¡š";
+$text["rm_document"] = "å é€æä»¶";
+$text["edit_document_access"] = "ä¿®æ¹è®¿é®ææ";
+$text["select_one"] = "è¯·éå
+¶äž";
+$text["user"] = "çšæ·";
+$text["group"] = "ç»";
+$text["empty_notify_list"] = "æ²¡æå
+å®¹";
+$text["access_mode_none"] = "æ æè®¿é®";
+$text["access_mode_read"] = "åªè¯»";
+$text["access_mode_readwrite"] = "è¯»å";
+$text["access_mode_all"] = "å®å
+š";
+$text["login"] = "ç»é";
+$text["user_login"] = "çšæ·å";
+$text["password"] = "å£ä»€";
+$text["wrong_pwd"] = "å£ä»€éè¯¯ïŒè¯·éè¯ã";
+$text["back"] = "è¿å";
+$text["login_not_found"] = "çšæ·åäžå­åš";
+$text["content"] = "å
+å®¹";
+$text["search"] = "æçŽ¢";
+$text["group_management"] = "çšæ·ç»";
+$text["search_query"] = "æ¥æŸ";
+$text["search_mode"] = "æ¥æŸæš¡åŒ";
+$text["search_mode_and"] = "ææçè¯";
+$text["search_mode_or"] = "è³å°æäžäžªè¯";
+$text["search_in"] = "æ¥æŸèåŽ";
+$text["search_in_all"] = "æææä»¶å€¹";
+$text["search_in_current"] = "åªæ([foldername]) å
+å«å­æä»¶å€¹";
+$text["search_results"] = "æçŽ¢ç»æ";
+$text["search_no_results"] = "æ²¡ææä»¶æ»¡è¶³æåçæ¥è¯¢(\"[query]\")ã";
+$text["search_time"] = "æ¥è¯¢èæ¶: [time] ç§ã";
+$text["search_report"] = "æ [count] äžªæä»¶æ»¡è¶³æ¥è¯¢\"[query]\"ã";
+$text["email"] = "çµå­é®ä»¶";
+$text["user_image"] = "åŸè±¡";
+$text["new_user_image"] = "æ°åŸè±¡";
+$text["goto"] = "Goto";
+$text["editing_user_data"] = "çŒèŸçšæ·è®Ÿå®...";
+$text["op_finished"] = "æå";
+$text["error_occured"] = "éè¯¯ïŒ";
+$text["add_user"] = "æ°å¢çšæ·";
+$text["edit_user"] = "çŒèŸçšæ·\"[username]\"";
+$text["user_name"] = "å
+šå";
+$text["no_user_image"] = "æ²¡æŸå°åŸè±¡";
+$text["rm_user"] = "å é€æ­€çšæ·";
+$text["add_group"] = "æ°å¢ç»";
+$text["edit_group"] = "çŒèŸç»\"[groupname]\"";
+$text["rm_group"] = "å é€æ­€ç»";
+$text["add_member"] = "å¢å æå";
+$text["adding_group"] = "å°ç»å å
+¥å°ç³»ç»äž­...";
+$text["no_group_members"] = "æ­€ç»æ²¡ææå";
+$text["removing_group"] = "ä»ç³»ç»äž­å é€æ­€ç»...";
+$text["adding_member"] = "å¢å æåå°ç»äž­...";
+$text["remove_member"] = "å é€æå";
+$text["removing_member"] = "ä»ç»äž­å é€æå...";
+$text["adding_user"] = "å¢å çšæ·å°ç³»ç»äž­...";
+$text["editing_user"] = "çŒèŸçšæ·...";
+$text["setting_user_image"] = "<br>äžºçšæ·è®Ÿçœ®åŸè±¡...";
+$text["removing_user"] = "ä»ç³»ç»äž­å é€çšæ·...";
+$text["adding_sub_folder"] = "å¢å å­æä»¶å€¹\"[subfoldername]\"å°æä»¶å€¹\"[foldername]\"...";
+$text["keywords"] = "å
+³é®è¯";
+$text["expires"] = "è¿æè®Ÿçœ®";
+$text["adding_document"] = "æ­£åšæ·»å æä»¶\"[documentname]\"å°æä»¶å€¹\"[foldername]\"...";
+$text["updating_document"] = "æä»¶æŽæ°...";
+$text["locking_document"] = "æä»¶éå®...";
+$text["unlocking_document"] = "æä»¶è§£é...";
+$text["editing_document_props"] = "æä»¶çŒèŸ...";
+$text["edit_document_props_again"] = "åæ¬¡çŒèŸæä»¶";
+$text["setting_expires"] = "è®Ÿçœ®è¶
+æ¶...";
+$text["adding_document_notify"] = "æ·»å å°æç€ºåè¡š...";
+$text["document_notify_again"] = "åæ¬¡ä¿®æ¹æç€ºåè¡š";
+$text["deleting_document_notify"] = "ä»æç€ºåè¡šäž­å é€...";
+$text["set_owner"] = "è®Ÿçœ®ææäºº";
+$text["edit_inherit_access"] = "ç»§æ¿æ§å­å";
+$text["inherits_access_msg"] = "è¯»åæéè¢«ç»§æ¿ã<p><a class=\"inheritAccess\" href=\"[copyurl]\">å€å¶æéåè¡š</a><br><a class=\"inheritAccess\" href=\"[emptyurl]\">äœ¿çšç©ºçæéåè¡š</a>";
+$text["setting_owner"] = "è®Ÿçœ®ææäºº...";
+$text["document_access_again"] = "çŒèŸæä»¶çå­åæé";
+$text["document_set_not_inherit_copy"] = "æ­£åšå€å¶å­åæé...";
+$text["document_set_not_inherit_empty"] = "æ­£åšæž
+é€ç»§æ¿çå­åæéãå¯çšç©ºçè®¿é®æ§å¶è¡š...";
+$text["does_not_inherit_access_msg"] = "<a class=\"inheritAccess\" href=\"[inheriturl]\">äžæ¯ç»§æ¿çå­åè®¿é®</a>";
+$text["document_set_inherit"] = "æ­£åšæž
+é€è®¿é®æ§å¶è¡šïŒæä»¶å°ç»§æ¿å­åæé...";
+$text["default_access"] = "é»è®€çå­åæš¡åŒ";
+$text["document_set_default_access"] = "æ­£åšè®Ÿçœ®æä»¶é»è®€çå­åæé...";
+$text["edit_existing_access"] = "çŒèŸå­ååè¡š";
+$text["empty_access_list"] = "å­ååè¡šæ¯ç©ºç";
+$text["add_access"] = "å¢å å­å";
+$text["access_mode"] = "å­åæš¡åŒ";
+$text["document_add_access"] = "æ­£åšæ·»å å
+çŽ å°å­åæ§å¶è¡šäž­...";
+$text["document_del_access"] = "æ­£åšä»å­åæ§å¶è¡šäž­å é€å
+çŽ ...";
+$text["document_edit_access"] = "æ­£åšæ¹åå­åæš¡åŒ...";
+$text["editing_folder_props"] = "æ­£åšçŒèŸæä»¶å€¹...";
+$text["edit_folder_props_again"] = "çŒèŸæä»¶å€¹å±æ§";
+$text["adding_folder_notify"] = "æ­£åšåæç€ºåè¡šäž­æ·»å å
+çŽ ...";
+$text["folder_notify_again"] = "çŒèŸæç€ºåè¡š";
+$text["deleting_folder_notify"] = "ä»æç€ºåè¡šäž­å é€å
+çŽ ...";
+$text["folder_access_again"] = "çŒèŸæä»¶å€¹çå­åæé";
+$text["folder_set_not_inherit_copy"] = "å€å¶å­åæéåè¡š...";
+$text["folder_set_not_inherit_empty"] = "æ­£åšæž
+é€ç»§æ¿çæéãå¯çšç©ºçè®¿é®æ§å¶è¡š...";
+$text["folder_set_inherit"] = "æ­£åšæž
+é€è®¿é®æ§å¶è¡šãå¯çšç»§æ¿æé";
+$text["folder_set_default_access"] = "äžºæä»¶å€¹è®Ÿçœ®é»è®€çå­åæš¡åŒ...";
+$text["folder_add_access"] = "åå­ååè¡šäž­æ·»å å
+çŽ ...";
+$text["folder_del_access"] = "æ­£åšä»å­ååè¡šäž­å é€å
+çŽ ...";
+$text["removing_document"] = "å é€æä»¶...";
+$text["removing_folder"] = "å é€æä»¶å€¹...";
+$text["operation_not_allowed"] = "æšçæéäžå€";
+$text["msg_document_expired"] = "æä»¶\"[documentname]\" (è·¯åŸ: \"[path]\") å·²ç»åš[expires]æ¶è¶
+æ";
+$text["msg_document_updated"] = "æä»¶\"[documentname]\" (è·¯åŸ: \"[path]\") æ¯åš[updated]æ¶å»ºç«ææŽæ°ç";
+$text["notify_subject"] = "ææ¡£ç®¡çç³»ç»äž­ææ°çæè¶
+æçæä»¶";
+$text["uploading_failed"] = "äžèœœå€±èŽ¥ïŒè¯·äžç®¡çåèç³»ã";
+$text["update_locked_msg"] = "æ­€æä»¶å€äºå éç¶æã";
+$text["unlock_cause_locking_user"] = "å äžºæšä¹æ¯å éäººä¹äžïŒæšä»ç¶å¯ä»¥æŽæ°ãæŽæ°åéå®å°èªåšè§£é€ã";
+$text["unlock_cause_access_mode_all"] = "å äžºæšæå­åæé\"all\"ïŒæšä»ç¶å¯ä»¥æŽæ°ãæŽæ°åéå®å°èªåšè§£é€ã";
+$text["no_update_cause_locked"] = "æšäžèœæŽæ°æ­€æä»¶ïŒè¯·äžéå®äººèç³»ã";
+$text["no_groups"] = "æ²¡æçšæ·ç»";
+$text["groups"] = "çšæ·ç»";
+$text["users"] = "çšæ·";
+$text["root_folder"] = "æ ¹æä»¶å€¹";
+$text["document_already_locked"] = "æ­€æä»¶å·²è¢«éå®";
+$text["document_is_not_locked"] = "æ­€æä»¶æ²¡æè¢«éå®";
+$text["unlocking_denied"] = "æšçæéäžè¶³ä»¥è§£éæ­€æä»¶";
+$text["only_jpg_user_images"] = "ä»
+.JPG(JPEG)å¯ä»¥è¢«çšäœæ è¯åŸè±¡";
+$text["folder_edit_access"] = "çŒèŸå­åæé...";
+$text["editing_group"] = "çŒèŸçšæ·ç»...";
+$text["group_members"] = "ç»æå";
+$text["confirm_pwd"] = "ç¡®è®€å£ä»€";
+$text["js_no_file"] = "è¯·éæ©äžäžªæä»¶";
+$text["js_no_name"] = "è¯·èŸå
+¥åç§°";
+$text["js_no_comment"] = "æ²¡æè¯Žæ";
+$text["js_no_keywords"] = "æ¥è¯¢å
+³é®è¯";
+$text["js_select_user_or_group"] = "è³å°éæ©äžäžªç»æçšæ·";
+$text["js_no_login"] = "è¯·èŸå
+¥çšæ·åç§°";
+$text["js_no_pwd"] = "æšéèŠèŸå
+¥æšçå£ä»€";
+$text["js_no_query"] = "è¯·èŸå
+¥æ¥è¯¢å
+å®¹";
+$text["js_pwd_not_conf"] = "å£ä»€åå£ä»€ç¡®è®€å
+å®¹äžäžèŽ";
+$text["js_no_email"] = "èŸå
+¥äœ ççµå­é®ä»¶å°å";
+$text["js_select_user"] = "è¯·éæ©äžäžªçšæ·";
+$text["guest_login"] = "ä»¥guestèº«ä»œç»é";
+$text["view_online"] = "åšçº¿æ¥ç";
+$text["confirm_rm_document"] = "ç¡®è®€å é€æä»¶å\"[documentname]\"?<br>æ³šæ: æ­€æäœäžèœæ¢å€ã";
+$text["confirm_rm_folder"] = "ç¡®è®€å é€æä»¶å€¹\"[foldername]\" åå
+¶äž­çå
+å®¹å?<br>æ³šæ: æ­€æäœäžèœæ¢å€ã";
+$text["sequence"] = "å å
+¥é¡ºåº";
+$text["seq_end"] = "æåäžäžª";
+$text["seq_start"] = "ç¬¬äžäžª";
+$text["seq_after"] = "åš\"[prevname]\"ä¹å";
+$text["seq_keep"] = "åœåäœçœ®";
+$text["linked_documents"] = "çžå
+³æä»¶";
+$text["document_link_by"] = "éŸæ¥äºº";
+$text["no_document_links"] = "æ²¡æçžå
+³çéŸæ¥";
+$text["document_link_public"] = "å
+¬åŒ";
+$text["choose_target_document"] = "éæ©æä»¶";
+$text["add_document_link"] = "å¢å éŸæ¥";
+$text["adding_document_link"] = "å¢å äžçžå
+³æä»¶çéŸæ¥...";
+$text["remove_document_link"] = "å é€éŸæ¥";
+$text["removing_document_link"] = "å é€äžçžå
+³æä»¶çéŸæ¥...";
+$text["yes"] = "æ¯";
+$text["no"] = "åŠ";
+$text["move_folder"] = "ç§»åšæä»¶å€¹";
+$text["choose_target_folder"] = "éæ©ç®çæä»¶å€¹";
+$text["moving_folder"] = "æ­£åšç§»åšæä»¶å€¹...";
+$text["move_document"] = "ç§»åšæä»¶";
+$text["moving_document"] = "æ­£åšç§»åšæä»¶...";
+$text["under_folder"] = "åšæä»¶å€¹é";
+$text["all_users"] = "ææçšæ·";
+$text["language"] = "Language";
+$text["theme"] = "Theme";
+$text["admin_tools"] = "ç®¡çå·¥å
+·";
+$text["folders_and_documents_statistic"] = "æ¥çæä»¶äžæä»¶å€¹ä¿¡æ¯";
+$text["folders_and_documents_statistic_text"] = "Shows a hierarchical list of all folders and documents with additional information";
+$text["start"] = "Start";
+$text["between"] = "ä»";
+$text["and"] = "å°";
+$text["global_default_keywords"] = "å
+šå±å
+³é®å­";
+$text["use_default_keywords"] = "Use predefined keywords";
+$text["personal_default_keywords"] = "Personal keywords";
+$text["edit_personal_default_keywords"] = "Edit personal keywords";
+$text["default_keywords"] = "Available keywords";
+$text["default_keyword_category"] = "ç±»å«ïŒ";
+$text["choose_category"] = "--è¯·éæ©--";
+$text["new_default_keyword_category"] = "æ·»å ç±»å«";
+$text["edit_default_keyword_category"] = "çŒèŸç±»å«";
+$text["default_keyword_category_name"] = "Name";
+$text["rm_default_keyword_category"] = "å é€è¯¥ç±»å«";
+$text["new_default_keywords"] = "æ·»å å
+³é®å­";
+$text["no_default_keywords"] = "æ²¡æå¯çšçå
+³é®å­";
+$text["creating_new_default_keyword_category"] = "Adding category...";
+$text["removing_default_keyword_category"] = "Deleting category...";
+$text["editing_default_keyword_category"] = "Changing category...";
+$text["adding_default_keywords"] = "Adding keywords...";
+$text["rm_default_keywords"] = "Delete keywords";
+$text["removing_default_keywords"] = "Deleting keywords...";
+$text["edit_default_keywords"] = "Edit keywords";
+$text["editing_default_keywords"] = "Changing keywords...";
+$text["accept"] = "åæ";
+$text["cancel"] = "æŸåŒ";
+?>
Index: /contrib/Dms/out/out.SetExpires.php
===================================================================
--- /contrib/Dms/out/out.SetExpires.php	(revision 3526)
+++ /contrib/Dms/out/out.SetExpires.php	(revision 3526)
@@ -0,0 +1,53 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+
+if ($document->getAccessMode($user) < M_READWRITE)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("expires") . ": " . $document->getName());
+
+printStartBox(getMLText("expires"));
+?>
+
+<form action="../op/op.SetExpires.php">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<table>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("expires");?>:</td>
+			<td class="standardText">
+				<input type="Radio" name="expires" value="false"<?phpif (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
+				<input type="radio" name="expires" value="true"<?phpif ($document->expires()) print " checked";?>><?php if ($document->expires()) printDateChooser($document->getExpires(), "exp"); else printDateChooser(-1, "exp"); ?>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+</form>
+
+
+<?php
+
+printEndBox();
+printDocumentPageEnd($document);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.FolderAccess.php
===================================================================
--- /contrib/Dms/out/out.FolderAccess.php	(revision 3526)
+++ /contrib/Dms/out/out.FolderAccess.php	(revision 3526)
@@ -0,0 +1,255 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+
+function printAccessModeSelection($defMode)
+{
+	print "<select name=\"mode\">\n";
+	print "\t<option value=\"".M_NONE."\"" . (($defMode == M_NONE) ? " selected" : "") . ">" . getMLText("access_mode_none") . "\n";
+	print "\t<option value=\"".M_READ."\"" . (($defMode == M_READ) ? " selected" : "") . ">" . getMLText("access_mode_read") . "\n";
+	print "\t<option value=\"".M_READWRITE."\"" . (($defMode == M_READWRITE) ? " selected" : "") . ">" . getMLText("access_mode_readwrite") . "\n";
+	print "\t<option value=\"".M_ALL."\"" . (($defMode == M_ALL) ? " selected" : "") . ">" . getMLText("access_mode_all") . "\n";
+	print "</select>\n";
+}
+
+$folderid	= (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+$folder		= getFolder($folderid);
+
+$allUsers = getAllUsers();
+
+if ($folder->getAccessMode($user) < M_ALL)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if ((document.form1.userid.options[document.form1.userid.selectedIndex].value == 'none') && 
+		(document.form1.groupid.options[document.form1.groupid.selectedIndex].value == 'none'))
+			msg += "<?php printMLText("js_select_user_or_group");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($folder);
+printFolderPageStart($folder);
+printPageHeader(getMLText("edit_folder_access") . ": " . $folder->getName());
+
+
+//Nur admin darf Besitzer ändern
+if ($user->isAdmin())
+{
+	printStartBox(getMLText("set_owner"));
+	?>
+		<form action="../op/op.FolderAccess.php">
+		<input type="Hidden" name="action" value="setowner">
+		<input type="Hidden" name="folderid" value="<?php print $folderid;?>">
+		<table>
+			<tr>
+				<td class="inputDescription"><?php printMLText("owner");?></td>
+				<td>
+					<select name="ownerid">
+						<?php
+							$owner = $folder->getOwner();
+							foreach ($allUsers as $currUser)
+							{
+								if ($currUser->getID() == $settings->_guestID)
+									continue;
+								print "<option value=\"".$currUser->getID()."\"";
+								if ($currUser->getID() == $owner->getID())
+									print " selected";
+								print ">" . $currUser->getFullname() . "\n";
+							}
+						?>
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td colspan="2"><br><input type="Submit"></td>
+			</tr>
+		</table>
+		</form>
+	<?php
+	printNextBox(getMLText("edit_inherit_access"));
+}
+else
+	printStartBox(getMLText("edit_inherit_access"));
+
+print "<div class=\"inheritAccess\">";
+
+if ($folder->inheritsAccess())
+{
+	printMLText("inherits_access_msg", array(
+		"copyurl" => "../op/op.FolderAccess.php?folderid=".$folderid."&action=notinherit&mode=copy", 
+		"emptyurl" => "../op/op.FolderAccess.php?folderid=".$folderid."&action=notinherit&mode=empty"));
+	printEndBox();
+	printFolderPageEnd($folder);
+	printHTMLFoot();
+	exit();
+}
+
+printMLText("does_not_inherit_access_msg", array("inheriturl" => "../op/op.FolderAccess.php?folderid=".$folderid."&action=inherit"));
+print "</div>";
+
+
+$accessList = $folder->getAccessList();
+
+printNextBox(getMLText("default_access"));
+?>
+
+<div class="defaultAccess">
+<form action="../op/op.FolderAccess.php">
+	<input type="Hidden" name="folderid" value="<?php print $folderid;?>">
+	<input type="Hidden" name="action" value="setdefault">
+	
+	<?php printAccessModeSelection($folder->getDefaultAccess()); ?>
+	<p>
+	<input type="Submit">
+</form>
+</div>
+
+<?php
+printNextBox(getMLText("edit_existing_access"));
+?>
+
+<table border="0" cellpadding="0" cellspacing="5">
+	<?php
+		if ((count($accessList["users"]) == 0) && (count($accessList["groups"]) == 0))
+		{
+			print "<tr><td class=\"accessList\">".getMLText("empty_access_list")."</td></tr>";
+		}
+		else
+		{
+			$rownum = count($accessList["users"])+count($accessList["groups"])+1;
+			?>
+				<tr>
+					<td></td>
+					<td class="accessList" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("name");?></i></td>
+					<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+					<td class="accessList" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("access_mode");?></i></td>
+					<td></td>
+				</tr>
+				<?php
+					foreach ($accessList["users"] as $userAccess)
+					{
+						$userObj = $userAccess->getUser();
+						print "<form action=\"../op/op.FolderAccess.php\">\n";
+						print "<input type=\"Hidden\" name=\"folderid\" value=\"".$folderid."\">\n";
+						print "<input type=\"Hidden\" name=\"action\" value=\"editaccess\">\n";
+						print "<input type=\"Hidden\" name=\"userid\" value=\"".$userObj->getID()."\">\n";
+						print "<tr>\n";
+						print "<td><img src=\"images/usericon.gif\" width=16 height=16></td>\n";
+						print "<td class=\"accessList\">". $userObj->getFullName() . "</td>\n";
+						print "<td>\n";
+						printAccessModeSelection($userAccess->getMode());
+						print "</td>\n";
+						print "<td><input type=\"Image\" src=\"images/save.gif\"></td>\n";
+						print "<td><a href=\"../op/op.FolderAccess.php?folderid=".$folderid."&action=delaccess&userid=".$userObj->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a></td>\n";
+						print "</tr>\n";
+						print "</form>\n";
+					}
+					
+					foreach ($accessList["groups"] as $groupAccess)
+					{
+						$groupObj = $groupAccess->getGroup();
+						$mode = $groupAccess->getMode();
+						print "<form action=\"../op/op.FolderAccess.php\">";
+						print "<input type=\"Hidden\" name=\"folderid\" value=\"".$folderid."\">";
+						print "<input type=\"Hidden\" name=\"action\" value=\"editaccess\">";
+						print "<input type=\"Hidden\" name=\"groupid\" value=\"".$groupObj->getID()."\">";
+						print "<tr>";
+						print "<td><img src=\"images/groupicon.gif\" width=16 height=16 border=0></td>";
+						print "<td class=\"accessList\">". $groupObj->getName() . "</td>";
+						print "<td>";
+						printAccessModeSelection($groupAccess->getMode());						print "</td>\n";
+						print "<td><input type=\"Image\" src=\"images/save.gif\"></td>";
+						print "<td><a href=\"../op/op.FolderAccess.php?folderid=".$folderid."&action=delaccess&groupid=".$groupObj->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a></td>";
+						print "</tr>";
+						print "</form>";
+					}
+		}
+	?>
+</table>
+
+<?php
+printNextBox(getMLText("add_access"));
+?>
+
+<form action="../op/op.FolderAccess.php" name="form1" onsubmit="return checkForm();">
+	<input type="Hidden" name="folderid" value="<?php print $folderid?>">
+	<input type="Hidden" name="action" value="addaccess">
+	<table>
+	<tr>
+		<td class="inputDescription"><?php printMLText("user");?>:</td>
+		<td>
+			<select name="userid">
+				<option value="none"><?php printMLText("select_one");?>
+				<option value="none">-------------------------------
+				<?php
+					foreach ($allUsers as $userObj)
+					{
+						if ($userObj->getID() == $settings->_guestID)
+							continue;
+						print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
+					}
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("group");?>:</td>
+		<td>
+			<select name="groupid">
+				<option value="none"><?php printMLText("select_one");?>
+				<option value="none">-------------------------------
+				<?php
+					$allGroups = getAllGroups();
+					foreach ($allGroups as $groupObj)
+						print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n";
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("access_mode");?>:</td>
+		<td>
+			<?php
+				printAccessModeSelection(M_READ);
+			?>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2"><br><input type="Submit"></td>
+	</tr>
+</table>
+</form>
+
+<?php
+
+printEndBox();
+printFolderPageEnd($folder);
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.AddSubFolder.php
===================================================================
--- /contrib/Dms/out/out.AddSubFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.AddSubFolder.php	(revision 3526)
@@ -0,0 +1,82 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+
+
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
+$folder = getFolder($folderid);
+
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+	die("accesso denegado");
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
+	if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($folder);
+printFolderPageStart($folder);
+printPageHeader(lang(getMLText("add_subfolder")) . ": " . $folder->getName());
+
+printStartBox(lang(getMLText("add_subfolder")));
+?>
+
+<form action="../op/op.AddSubFolder.php" name="form1" onsubmit="return checkForm();">
+	<input type="Hidden" name="folderid" value="<?php print $folderid;?>">
+	<table border="0" width="100%">
+		<tr>
+			<td class="inputDescription" width="150px"><?php echo lang("name");?>:</td>
+			<td><input name="fname" style="width: 100%;"></td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php echo lang("comment");?>:</td>
+			<td><textarea name="comment" rows="4" style="width: 100%;"></textarea></td>
+		</tr>
+		<tr>
+			<td class="inputDescription"><?php echo lang("sequence");?>:</td>
+			<td><?php printSequenceChooser($folder->getSubFolders());?></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+</form>
+
+
+<?php
+
+printEndBox();
+printFolderPageEnd($folder);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.DocumentAccess.php
===================================================================
--- /contrib/Dms/out/out.DocumentAccess.php	(revision 3526)
+++ /contrib/Dms/out/out.DocumentAccess.php	(revision 3526)
@@ -0,0 +1,255 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+
+function printAccessModeSelection($defMode)
+{
+	print "<select name=\"mode\">\n";
+	print "\t<option value=\"".M_NONE."\"" . (($defMode == M_NONE) ? " selected" : "") . ">" . getMLText("access_mode_none") . "\n";
+	print "\t<option value=\"".M_READ."\"" . (($defMode == M_READ) ? " selected" : "") . ">" . getMLText("access_mode_read") . "\n";
+	print "\t<option value=\"".M_READWRITE."\"" . (($defMode == M_READWRITE) ? " selected" : "") . ">" . getMLText("access_mode_readwrite") . "\n";
+	print "\t<option value=\"".M_ALL."\"" . (($defMode == M_ALL) ? " selected" : "") . ">" . getMLText("access_mode_all") . "\n";
+	print "</select>\n";
+}
+
+
+$document = getDocument($documentid);
+$allUsers = getAllUsers();
+
+if ($document->getAccessMode($user) < M_ALL)
+	die("access denied");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if ((document.form1.userid.options[document.form1.userid.selectedIndex].value == -1) && 
+		(document.form1.groupid.options[document.form1.groupid.selectedIndex].value == -1))
+			msg += "<?php printMLText("js_select_user_or_group");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("edit_document_access") . ": " . $document->getName());
+
+
+
+//Nur admin darf Besitzer ändern
+if ($user->isAdmin())
+{
+	printStartBox(getMLText("set_owner"));
+	?>
+		<form action="../op/op.DocumentAccess.php">
+		<input type="Hidden" name="action" value="setowner">
+		<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+		<table>
+			<tr>
+				<td class="inputDescription"><?php printMLText("owner");?></td>
+				<td>
+					<select name="ownerid">
+						<?php
+							$owner = $document->getOwner();
+							foreach ($allUsers as $currUser)
+							{
+								if ($currUser->getID() == $settings->_guestID)
+									continue;
+								print "<option value=\"".$currUser->getID()."\"";
+								if ($currUser->getID() == $owner->getID())
+									print " selected";
+								print ">" . $currUser->getFullname() . "\n";
+							}
+						?>
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td colspan="2"><br><input type="Submit"></td>
+			</tr>
+		</table>
+		</form>
+	<?php
+	printNextBox(getMLText("edit_inherit_access"));
+}
+else
+	printStartBox(getMLText("edit_inherit_access"));
+
+
+print "<div class=\"inheritAccess\">";
+
+if ($document->inheritsAccess())
+{
+	printMLText("inherits_access_msg", array(
+		"copyurl" => "../op/op.DocumentAccess.php?documentid=".$documentid."&action=notinherit&mode=copy", 
+		"emptyurl" => "../op/op.DocumentAccess.php?documentid=".$documentid."&action=notinherit&mode=empty"));
+	printEndBox();
+	printDocumentPageEnd($document);
+	printHTMLFoot();
+	exit();
+}
+
+printMLText("does_not_inherit_access_msg", array("inheriturl" => "../op/op.DocumentAccess.php?documentid=".$documentid."&action=inherit"));
+print "</div>";
+
+
+$accessList = $document->getAccessList();
+
+printNextBox(getMLText("default_access"));
+?>
+
+<div class="defaultAccess">
+<form action="../op/op.DocumentAccess.php">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<input type="Hidden" name="action" value="setdefault">
+	
+	<?php printAccessModeSelection($document->getDefaultAccess()); ?>
+	<p>
+	<input type="Submit">
+</form>
+</div>
+
+<?php
+printNextBox(getMLText("edit_existing_access"));
+?>
+
+<table border="0" cellpadding="0" cellspacing="5">
+	<?php
+		if ((count($accessList["users"]) == 0) && (count($accessList["groups"]) == 0))
+		{
+			print "<tr><td class=\"accessList\">".getMLText("empty_access_list")."</td></tr>";
+		}
+		else
+		{
+			$rownum = count($accessList["users"])+count($accessList["groups"])+1;
+			?>
+				<tr>
+					<td></td>
+					<td class="accessList" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("name");?></i></td>
+					<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+					<td class="accessList" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("access_mode");?></i></td>
+					<td></td>
+				</tr>
+				<?php
+					foreach ($accessList["users"] as $userAccess)
+					{
+						$userObj = $userAccess->getUser();
+						print "<form action=\"../op/op.DocumentAccess.php\">\n";
+						print "<input type=\"Hidden\" name=\"documentid\" value=\"".$documentid."\">\n";
+						print "<input type=\"Hidden\" name=\"action\" value=\"editaccess\">\n";
+						print "<input type=\"Hidden\" name=\"userid\" value=\"".$userObj->getID()."\">\n";
+						print "<tr>\n";
+						print "<td><img src=\"images/usericon.gif\" width=16 height=16></td>\n";
+						print "<td class=\"accessList\">". $userObj->getFullName() . "</td>\n";
+						print "<td>\n";
+						printAccessModeSelection($userAccess->getMode());
+						print "</td>\n";
+						print "<td><input type=\"Image\" src=\"images/save.gif\"></td>\n";
+						print "<td><a href=\"../op/op.DocumentAccess.php?documentid=".$documentid."&action=delaccess&userid=".$userObj->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a></td>\n";
+						print "</tr>\n";
+						print "</form>\n";
+					}
+					
+					foreach ($accessList["groups"] as $groupAccess)
+					{
+						$groupObj = $groupAccess->getGroup();
+						$mode = $groupAccess->getMode();
+						print "<form action=\"../op/op.DocumentAccess.php\">";
+						print "<input type=\"Hidden\" name=\"documentid\" value=\"".$documentid."\">";
+						print "<input type=\"Hidden\" name=\"action\" value=\"editaccess\">";
+						print "<input type=\"Hidden\" name=\"groupid\" value=\"".$groupObj->getID()."\">";
+						print "<tr>";
+						print "<td><img src=\"images/groupicon.gif\" width=16 height=16 border=0></td>";
+						print "<td class=\"accessList\">". $groupObj->getName() . "</td>";
+						print "<td>";
+						printAccessModeSelection($groupAccess->getMode());						print "</td>\n";
+						print "<td><input type=\"Image\" src=\"images/save.gif\"></td>";
+						print "<td><a href=\"../op/op.DocumentAccess.php?documentid=".$documentid."&action=delaccess&groupid=".$groupObj->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a></td>";
+						print "</tr>";
+						print "</form>";
+					}
+		}
+	?>
+</table>
+
+<?php
+printNextBox(getMLText("add_access"));
+?>
+
+<form action="../op/op.DocumentAccess.php" name="form1" onsubmit="return checkForm();">
+	<input type="Hidden" name="documentid" value="<?php print $documentid?>">
+	<input type="Hidden" name="action" value="addaccess">
+	<table>
+	<tr>
+		<td class="inputDescription"><?php printMLText("user");?>:</td>
+		<td>
+			<select name="userid">
+				<option value="-1"><?php printMLText("select_one");?>
+				<option value="-1">-------------------------------
+				<?php
+					foreach ($allUsers as $userObj)
+					{
+						if ($userObj->getID() == $settings->_guestID)
+							continue;
+						print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
+					}
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("group");?>:</td>
+		<td>
+			<select name="groupid">
+				<option value="-1"><?php printMLText("select_one");?>
+				<option value="-1">-------------------------------
+				<?php
+					$allGroups = getAllGroups();
+					foreach ($allGroups as $groupObj)
+						print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n";
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("access_mode");?>:</td>
+		<td>
+			<?php
+				printAccessModeSelection(M_READ);
+			?>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2"><br><input type="Submit"></td>
+	</tr>
+</table>
+</form>
+
+<?php
+	printEndBox();
+	printDocumentPageEnd($document);
+	printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.DocumentChooser.php
===================================================================
--- /contrib/Dms/out/out.DocumentChooser.php	(revision 3526)
+++ /contrib/Dms/out/out.DocumentChooser.php	(revision 3526)
@@ -0,0 +1,124 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+
+function printTree($path, $level = 0)
+{
+	GLOBAL $user, $form;
+	
+	$folder = $path[$level];
+	$subFolders = filterAccess($folder->getSubFolders(), $user, M_READ);
+	$documents  = filterAccess($folder->getDocuments(), $user, M_READ);
+	
+	if ($level+1 < count($path))
+		$nextFolderID = $path[$level+1]->getID();
+	else
+		$nextFolderID = -1;
+	
+	print "<table cellpadding=0 cellspacing=0>\n";
+	print "  <tr>\n";
+	print "    <td valign=\"top\"";
+	if (count($subFolders) + count($documents) > 0)
+		print " background=\"".getImgPath("down.gif")."\"";
+	print "><img src=\"";
+	if ($level == 0) printImgPath("to_down.gif");
+	else if (count($subFolders) + count($documents) > 0) printImgPath("right_in_to_down.gif");
+	else printImgPath("right_in.gif");
+	print "\" border=0></td>\n";
+	print "    <td class=\"foldertree\">";
+	print "<img src=\"".getImgPath("folder_opened.gif")."\" width=18 height=18 border=0>".$folder->getName()."</td>\n";
+	print "  </tr>\n";
+	
+	for ($i = 0; $i < count($subFolders); $i++) {
+		print "<tr>";
+		if ($i +1 < count($subFolders) + count($documents))
+			print "<td background=\"".getImgPath("down.gif")."\" valign=\"top\"><img src=\"".getImgPath("right.gif")."\" border=0></td>";
+		else
+			print "<td valign=\"top\"><img src=\"".getImgPath("right_last.gif")."\" border=0></td>";
+		print "<td>";
+		if ($subFolders[$i]->getID() == $nextFolderID)
+			printTree($path, $level+1);
+		else {
+			$subFolders_ = filterAccess($subFolders[$i]->getSubFolders(), $user, M_READ);
+			$documents_  = filterAccess($subFolders[$i]->getDocuments(), $user, M_READ);
+			
+			print "<table cellpadding=0 cellspacing=0><tr>";
+			if (count($subFolders_) + count($documents_) > 0)
+				print "  <td valign=\"top\"><a href=\"out.DocumentChooser.php?form=$form&folderid=".$subFolders[$i]->getID()."\"><img src=\"".getImgPath("right_in_plus.gif")."\" border=0></a></td>";
+			else
+				print "  <td valign=\"top\"><img src=\"".getImgPath("right_in.gif")."\"></td>";
+			print "  <td class=\"foldertree\" valign=\"top\">";
+			print "<img src=\"".getImgPath("folder_closed.gif")."\" border=0>".$subFolders[$i]->getName()."</td>";
+			print "</tr></table>";
+		}
+		print "</td>";
+		print "</tr>";
+	}
+	for ($i = 0; $i < count($documents); $i++)
+	{
+		print "<tr>";
+		if ($i +1 < count($documents))
+			print "<td background=\"images/down.gif\" valign=\"top\"><img src=\"images/right.gif\" border=0></td>";
+		else
+			print "<td valign=\"top\"><img src=\"images/right_last.gif\" border=0></td>";
+		print "<td>";
+		print "  <table cellpadding=0 cellspacing=0><tr>";
+		print "    <td valign=\"top\"><img src=\"images/right_in.gif\"></td>";
+		print "    <td><a  class=\"foldertree_selectable\" href=\"javascript:documentSelected(".$documents[$i]->getID().",'".addslashes($documents[$i]->getName())."');\"><img src=\"images/file.gif\" border=0>".$documents[$i]->getName()."</a></td>";
+		print "  </tr></table>";
+		print "</td>";
+		print "</tr>";
+	}
+	
+	print "</table>\n";
+}
+
+
+
+?>
+
+
+<html>
+<head>
+<link rel="STYLESHEET" type="text/css" href="styles.css">
+<title><?php echo getMLText("choose_target_document")?></title>
+
+<script language="JavaScript">
+var targetName;
+var targetID;
+
+function documentSelected(id, name) {
+	targetName.value = name;
+	targetID.value = id;
+	window.close();
+	return true;
+}
+</script>
+
+</head>
+<body>
+
+<?php
+	$folder = getFolder($folderid);
+	printTree($folder->getPath());
+?>
+
+<script language="JavaScript">
+targetName = opener.document.<?php echo $form?>.docname;
+targetID   = opener.document.<?php echo $form?>.docid;
+</script>
+
+</body>
+</html>
Index: /contrib/Dms/out/out.MoveFolder.php
===================================================================
--- /contrib/Dms/out/out.MoveFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.MoveFolder.php	(revision 3526)
@@ -0,0 +1,52 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
+$folder = getFolder($folderid);
+
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printFolderPageStart($folder);
+printPageHeader(getMLText("move_folder") . ": " . $folder->getName());
+
+printStartBox(getMLText("move_folder"));
+?>
+
+<form action="../op/op.MoveFolder.php" name="form1">
+	<input type="Hidden" name="folderid" value="<?php print $folderid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("choose_target_folder");?>:</td>
+			<td><?php printFolderChooser("form1", M_READWRITE, $folder->getID());?></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+	</form>
+
+
+<?php
+
+printEndBox();
+printFolderPageEnd($folder);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.FolderNotify.php
===================================================================
--- /contrib/Dms/out/out.FolderNotify.php	(revision 3526)
+++ /contrib/Dms/out/out.FolderNotify.php	(revision 3526)
@@ -0,0 +1,138 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
+$folder = getFolder($folderid);
+
+$notifyList = $folder->getNotifyList();
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if ((document.form1.userid.options[document.form1.userid.selectedIndex].value == -1) && 
+		(document.form1.groupid.options[document.form1.groupid.selectedIndex].value == -1))
+			msg += "<?php printMLText("js_select_user_or_group");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($folder);
+printFolderPageStart($folder);
+printPageHeader(getMLText("edit_folder_notify") . ": " . $folder->getName());
+
+printStartBox(getMLText("edit_existing_notify"));
+?>
+
+<table border="0" cellpadding="5" cellspacing="0">
+	<?php
+		if ((count($notifyList["users"]) == 0) && (count($notifyList["groups"]) == 0))
+		{
+			print "<tr><td class=\"notifylist\">".getMLText("empty_notify_list")."</td></tr>";
+		}
+		else
+		{
+			print "<tr>\n";
+			print "	<td style=\"border-bottom: 1pt solid #000080;\">&nbsp;</td>\n";
+			print "	<td style=\"border-bottom: 1pt solid #000080;\" class=\"notifylist\"><i>".getMLText("name")."</i></td>\n";
+			print "	<td style=\"border-bottom: 1pt solid #000080;\">&nbsp;</td>\n";
+			print "</tr>\n";
+			foreach ($notifyList["users"] as $userNotify)
+			{
+				print "<tr>";
+				print "<td><img src=\"images/usericon.gif\" width=16 height=16></td>";
+				print "<td class=\"notifylist\">" . $userNotify->getFullName() . "</td>";
+				print "<td><a href=\"../op/op.FolderNotify.php?folderid=". $folderid . "&action=delnotify&userid=".$userNotify->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a>";
+				print "</tr>";
+			}
+			
+			foreach ($notifyList["groups"] as $groupNotify)
+			{
+				print "<tr>";
+				print "<td><img src=\"images/groupicon.gif\" width=16 height=16 border=0></td>";
+				print "<td class=\"notifylist\">" . $groupNotify->getName() . "</td>";
+				print "<td><a href=\"../op/op.FolderNotify.php?folderid=". $folderid . "&action=delnotify&groupid=".$groupNotify->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a>";
+				print "</tr>";
+			}
+		}
+	?>
+</table>
+
+<?php
+printNextBox(getMLText("add_new_notify"));
+?>
+
+
+<form action="../op/op.FolderNotify.php" name="form1" onsubmit="return checkForm();">
+<input type="Hidden" name="folderid" value="<?php print $folderid?>">
+<input type="Hidden" name="action" value="addnotify">
+<table>
+	<tr>
+		<td class="inputDescription"><?php printMLText("user");?>:</td>
+		<td>
+			<select name="userid">
+				<option value="-1"><?php printMLText("select_one");?>
+				<option value="-1">-------------------------------
+				<?php
+					$allUsers = getAllUsers();
+					foreach ($allUsers as $userObj)
+					{
+						if ($userObj->getID() == $settings->_guestID)
+							continue;
+						print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
+					}
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("group");?>:</td>
+		<td>
+			<select name="groupid">
+				<option value="-1"><?php printMLText("select_one");?>
+				<option value="-1">-------------------------------
+				<?php
+					$allGroups = getAllGroups();
+					foreach ($allGroups as $groupObj)
+						print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n";
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2"><br><input type="Submit"></td>
+	</tr>
+</table>
+</form>
+
+<?php
+printEndBox();
+printFolderPageEnd($folder);
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.MoveDocument.php
===================================================================
--- /contrib/Dms/out/out.MoveDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.MoveDocument.php	(revision 3526)
@@ -0,0 +1,50 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+
+if ($document->getAccessMode($user) < M_READWRITE)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("move_document") . ": " . $document->getName());
+
+printStartBox(getMLText("move_document"));
+?>
+
+<form action="../op/op.MoveDocument.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("choose_target_folder");?>:</td>
+			<td><?php printFolderChooser("form1", M_READWRITE, -1);?></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+	</form>
+
+
+<?php
+
+printEndBox();
+printDocumentPageEnd($document);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.ViewFolder.php
===================================================================
--- /contrib/Dms/out/out.ViewFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.ViewFolder.php	(revision 3526)
@@ -0,0 +1,160 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
+if(!$folder = getFolder($folderid)) {
+	//die ("Accesso denegado!".$folderid."  ".getFolder($folderid));
+
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+
+}
+
+if ($folder->getAccessMode($user) < M_READ) {
+	//die ("accesso denegado!"."  ".$folder->getAccessMode($user));
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+}
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printFolderPageStart($folder);
+
+?>
+
+
+<?php
+
+
+$parts = explode('/',$_SERVER['PHP_SELF']);
+array_pop($parts);	// remove config.php
+array_pop($parts);	// remove setup
+$tres=implode('/',$parts);
+array_pop($parts);	
+$raiz=implode('/',$parts);
+echo $_REQUEST['error'];
+
+printStartBox(getMLText("document_list"));
+?>
+
+<table cellpadding="0" cellspacing="10" style="width:100%;">
+               <tr>
+                        <td class="infos">Carpeta: <?php print $folder->getName();?></td>
+                </tr>
+                <tr>
+                        <td class="infos" valign="top"><?php printMLText("owner");?>:
+                                <?php 
+                                        $owner = $folder->getOwner();
+                                        print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".$owner->getFullName()."</a>";
+                                ?>
+                        </td>
+                </tr>
+                <tr>
+                        <td class="infos" valign="top"><?php printMLText("comment");?>:
+                        <?php print $folder->getComment();?></td>
+                </tr>
+        </table>
+
+
+
+
+
+
+
+	<div id="rightClickMenu" style="border:1px solid grey; position:absolute; display:none; background-color:silver; z-index:40;">el prox.</div>
+<table width="100%" cellspacing="0" cellpadding="0">
+		<tr class="divSideboxEntry">
+			<td width="20" align="center" valign="middle" class="textSidebox"><img class="sideboxstar" src="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/phpgwapi/templates/idots/images/orange-ball.png" width="9" height="9" alt="ball"/></td><td class="textSidebox"><a class="textSidebox" href="<?php echo $GLOBALS['phpgw_info']['server']['webserver_url']?>/mydms/out/out.AddSubFolder.php?folderid=<?php echo $folderid;?>">a&ntilde;adir subcarpeta</a></td>
+		</tr>
+		<tr class="divSideboxEntry">
+
+			<td width="20" align="center" valign="middle" class="textSidebox"><img class="sideboxstar" src="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/phpgwapi/templates/idots/images/orange-ball.png" width="9" height="9" alt="ball"/></td><td class="textSidebox"><a class="textSidebox" href="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/mydms/out/out.AddDocument.php?folderid=<?php echo $folderid;?>">a&ntilde;adir documento</a></td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td colspan="2" height="8" class="textSidebox">&nbsp;</td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td width="20" align="center" valign="middle" class="textSidebox"><img class="sideboxstar" src="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/phpgwapi/templates/idots/images/orange-ball.png" width="9" height="9" alt="ball"/></td><td class="textSidebox"><a class="textSidebox" href="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url'];?>/mydms/out/out.EditFolder.php?folderid=<?php echo $folderid;?>">editar carpeta</a></td>
+		</tr>
+
+		<tr class="divSideboxEntry">
+			<td colspan="2" height="8" class="textSidebox">&nbsp;</td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td width="20" align="center" valign="middle" class="textSidebox"><img class="sideboxstar" src="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/phpgwapi/templates/idots/images/orange-ball.png" width="9" height="9" alt="ball"/></td><td class="textSidebox"><a class="textSidebox" href="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url'];?>/mydms/out/out.FolderNotify.php?folderid=<?php echo $folderid;?>">notificaciones</a></td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td width="20" align="center" valign="middle" class="textSidebox"><img class="sideboxstar" src="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/phpgwapi/templates/idots/images/orange-ball.png" width="9" height="9" alt="ball"/></td><td class="textSidebox"><a class="textSidebox" href="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url'];?>/mydms/out/out.FolderAccess.php?folderid=<?php echo $folderid;?>">derechos de acceso</a></td>
+
+		</tr>
+		</table>	
+	<table cellspacing="5" cellpadding="0" border="0">
+	<?php
+		$documents = $folder->getDocuments();
+		$documents = filterAccess($documents, $user, M_READ);
+		if (count($documents) > 0)
+		{
+			$rownum = (count($documents)*2)+1;
+			print "<tr>\n";
+			print "<td></td>\n";
+			print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("name")."</i></td>\n";
+			print "<td rowspan=".$rownum." style=\"border-left: 1pt solid #000080;\">&nbsp;</td>\n";
+			print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("comment")."</i></td>\n";
+			print "<td rowspan=".$rownum." style=\"border-left: 1pt solid #000080;\">&nbsp;</td>\n";
+			print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("owner")."</i></td>\n";
+			print "</tr>\n";
+			foreach($documents as $document)
+			{
+				$owner = $document->getOwner();
+				$comment = $document->getComment();
+				if (strlen($comment) > 25) $comment = substr($comment, 0, 22) . "...";
+				
+				$linkData = array
+				(
+					'documentid'	=> $document->getID(),
+					'menuaction'	=> 'mydms.uimydms.viewDocument'
+				);
+				$editURL = $GLOBALS['phpgw']->link('/index.php',$linkData);
+				
+				// the old code
+				#print "<tr>";
+				#print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+				#print "<td class=\"filelist\"><a class=\"filelist\" href=\"out.ViewDocument.php?documentid=".$document->getID()."\">" . $document->getName() . "</a></td>\n";
+				#print "<td class=\"filelist\">" . $comment . "</td>";
+				#print "<td class=\"filelist\">".$owner->getFullName()."</td>";
+				#print "</tr>";
+				
+				// the new code
+				// onclick="window.open(this.href,this.target,'dependent=yes,width=750,height=400,scrollbars=yes,status=yes'); return false;"
+				print "<tr>";
+				print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+				print "<td class=\"filelist\"><a class=\"filelist\" href=\"#\" onclick=\"javascript:phpgw_openWindowCentered('$editURL','editDocument','680','630');\">" . $document->getName() . "</a></td>\n";
+				print "<td class=\"filelist\">" . $comment . "</td>";
+				print "<td class=\"filelist\">".$owner->getFullName()."</td>";
+				print "</tr>";
+			}
+		} else {
+			print "<tr><td class=\"filelist\">".getMLText("no_documents")."</td></tr>";
+		}
+	?>
+	</table>
+		
+<?php
+
+printEndBox();
+
+printFolderPageEnd($folder);
+
+?>
Index: /contrib/Dms/out/out.Statistic.php
===================================================================
--- /contrib/Dms/out/out.Statistic.php	(revision 3526)
+++ /contrib/Dms/out/out.Statistic.php	(revision 3526)
@@ -0,0 +1,137 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+if (!$user->isAdmin())
+	die ("access denied");
+
+printHTMLHead( getMLText("admin_tools") );
+?>
+
+<style type="text/css">
+.folderClass {
+	list-style-image : url(<?php printImgPath("folder_closed.gif");?>);
+	list-style : url(<?php printImgPath("folder_closed.gif");?>);
+}
+
+.documentClass {
+	list-style-image : url(<?php printImgPath("file.gif");?>);
+	list-style : url(<?php printImgPath("file.gif");?>);
+}
+</style>
+
+<script language="JavaScript">
+
+function showDocument(id) {
+	url = "out.DetailedStatistic.php?documentid=" + id;
+	alert(url);
+}
+
+function showFolder(id) {
+	url = "out.DetailedStatistic.php?folderid=" + id;
+	alert(url);
+}
+
+</script>
+
+<?php
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+printStartBox(getMLText("folders_and_documents_statistic"));
+	print "<div class=\"standardText\"><ul>";
+	printFolder(getFolder($settings->_rootFolderID));
+	print "</ul></div>";
+printEndBox();
+
+printCenterEnd();
+printHTMLFoot();
+
+
+function getAccessColor($mode)
+{
+	if ($mode == M_NONE)
+		return "red";
+	else if ($mode == M_READ)
+		return "orange";
+	else if ($mode == M_READWRITE)
+		return "green";
+	else // if ($mode == M_ALL)
+		return "blue";
+}
+
+
+function printFolder($folder)
+{
+	$color = $folder->inheritsAccess() ? "black" : getAccessColor($folder->getDefaultAccess());
+	
+	print "<li class=\"folderClass\">";
+	print "<a class=\"standardText\" style=\"color: $color\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."\">".$folder->getName() ."</a>";
+	
+	if (! $folder->inheritsAccess())
+		printAccessList($folder);
+	
+	print "</li>";
+	
+	$subFolders = $folder->getSubFolders();
+	$documents = $folder->getDocuments();
+	
+	print "<ul>";
+	foreach ($subFolders as $folder)
+		printFolder($folder);
+	
+	foreach ($documents as $document)
+		printDocument($document);
+	print "</ul>";
+}
+
+
+function printDocument($document)
+{
+	$color = $document->inheritsAccess() ? "black" : getAccessColor($document->getDefaultAccess());
+	print "<li class=\"documentClass\">";
+	print "<a class=\"standardText\" style=\"color: $color\" href=\"out.ViewDocument.php?documentid=".$document->getID()."\">".$document->getName()."</a>";
+	
+	if (! $document->inheritsAccess())
+		printAccessList($document);
+	
+	print "</li>";
+}
+
+function printAccessList($obj)
+{
+	$accessList = $obj->getAccessList();
+	if (count($accessList["users"]) == 0 && count($accessList["groups"]) == 0)
+		return;
+	
+	print " <span class=\"standardText\">(";
+	
+	for ($i = 0; $i < count($accessList["groups"]); $i++)
+	{
+		$group = $accessList["groups"][$i]->getGroup();
+		$color = getAccessColor($accessList["groups"][$i]->getMode());
+		print "<span style=\"color: $color\">".$group->getName()."</span>";
+		if ($i+1 < count($accessList["groups"]) || count($accessList["users"]) > 0)
+			print ", ";
+	}
+	for ($i = 0; $i < count($accessList["users"]); $i++)
+	{
+		$user = $accessList["users"][$i]->getUser();
+		$color = getAccessColor($accessList["users"][$i]->getMode());
+		print "<span style=\"color: $color\">".$user->getFullName()."</span>";
+		if ($i+1 < count($accessList["users"]))
+			print ", ";
+	}
+	print ")</span>";
+}
+?>
Index: /contrib/Dms/out/out.DocumentNotify.php
===================================================================
--- /contrib/Dms/out/out.DocumentNotify.php	(revision 3526)
+++ /contrib/Dms/out/out.DocumentNotify.php	(revision 3526)
@@ -0,0 +1,136 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+$notifyList = $document->getNotifyList();
+
+if ($document->getAccessMode($user) < M_READWRITE)
+	die("access denied");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if ((document.form1.userid.options[document.form1.userid.selectedIndex].value == -1) && 
+		(document.form1.groupid.options[document.form1.groupid.selectedIndex].value == -1))
+			msg += "<?php printMLText("js_select_user_or_group");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("edit_document_notify") . ": " . $document->getName());
+
+printStartBox(getMLText("edit_existing_notify"));
+?>
+
+<table border="0" cellpadding="5" cellspacing="0">
+	<?php
+		if ((count($notifyList["users"]) == 0) && (count($notifyList["groups"]) == 0))
+		{
+			print "<tr><td class=\"notifylist\">".getMLText("empty_notify_list")."</td></tr>";
+		}
+		else
+		{
+			print "<tr>\n";
+			print "	<td style=\"border-bottom: 1pt solid #000080;\">&nbsp;</td>\n";
+			print "	<td style=\"border-bottom: 1pt solid #000080;\" class=\"notifylist\"><i>".getMLText("name")."</i></td>\n";
+			print "	<td style=\"border-bottom: 1pt solid #000080;\">&nbsp;</td>\n";
+			print "</tr>\n";
+			foreach ($notifyList["users"] as $userNotify)
+			{
+				print "<tr>";
+				print "<td><img src=\"images/usericon.gif\" width=16 height=16></td>";
+				print "<td class=\"notifylist\">" . $userNotify->getFullName() . "</td>";
+				print "<td><a href=\"../op/op.DocumentNotify.php?documentid=". $documentid . "&action=delnotify&userid=".$userNotify->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a>";
+				print "</tr>";
+			}
+			
+			foreach ($notifyList["groups"] as $groupNotify)
+			{
+				print "<tr>";
+				print "<td><img src=\"images/groupicon.gif\" width=16 height=16 border=0></td>";
+				print "<td class=\"notifylist\">" . $groupNotify->getName() . "</td>";
+				print "<td><a href=\"../op/op.DocumentNotify.php?documentid=". $documentid . "&action=delnotify&groupid=".$groupNotify->getID()."\"><img src=\"images/del.gif\" width=15 height=15 border=0></a>";
+				print "</tr>";
+			}
+		}
+	?>
+</table>
+
+<?php
+printNextBox(getMLText("add_new_notify"));
+?>
+
+
+<form action="../op/op.DocumentNotify.php" name="form1" onsubmit="return checkForm();">
+<input type="Hidden" name="documentid" value="<?php print $documentid?>">
+<input type="Hidden" name="action" value="addnotify">
+<table>
+	<tr>
+		<td class="inputDescription"><?php printMLText("user");?>:</td>
+		<td>
+			<select name="userid">
+				<option value="-1"><?php printMLText("select_one");?>
+				<option value="-1">-------------------------------
+				<?php
+					$allUsers = getAllUsers();
+					foreach ($allUsers as $userObj)
+					{
+						if ($userObj->getID() == $settings->_guestID)
+							continue;
+						print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
+					}
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("group");?>:</td>
+		<td>
+			<select name="groupid">
+				<option value="-1"><?php printMLText("select_one");?>
+				<option value="-1">-------------------------------
+				<?php
+					$allGroups = getAllGroups();
+					foreach ($allGroups as $groupObj)
+						print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n";
+				?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2"><br><input type="Submit"></td>
+	</tr>
+</table>
+</form>
+
+<?php
+printEndBox();
+printDocumentPageEnd($document);
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.Login.php
===================================================================
--- /contrib/Dms/out/out.Login.php	(revision 3526)
+++ /contrib/Dms/out/out.Login.php	(revision 3526)
@@ -0,0 +1,106 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+
+printHTMLHead( getMLText("login") );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if (document.form1.login.value == "") msg += "<?php printMLText("js_no_login");?>\n";
+	if (document.form1.pwd.value == "") msg += "<?php printMLText("js_no_pwd");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+
+
+function guestLogin()
+{
+	url = "../op/op.Login.php?login=guest" + 
+		"&sesstheme=" + document.form1.sesstheme.options[document.form1.sesstheme.options.selectedIndex].value +
+		"&lang=" + document.form1.lang.options[document.form1.lang.options.selectedIndex].value;
+	document.location.href = url;
+}
+
+</script>
+
+<?php
+
+printCenterStart();
+printStartBox(getMLText("login"));
+?>
+
+<form action="../op/op.Login.php" method="post" name="form1" onsubmit="return checkForm();">
+<table>
+	<tr>
+		<td class="inputDescription"><?php printMLText("user_login");?></td>
+		<td><input name="login"></td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("password");?></td>
+		<td><input name="pwd" type="Password"></td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("language");?></td>
+		<td>
+			<?php
+				print "<select name=\"lang\">";
+				$languages = getLanguages();
+				foreach ($languages as $currLang)
+				{
+					print "<option value=\"$currLang\"";
+					if ($currLang == $settings->_language)
+						print " selected";
+					print ">$currLang";
+				}
+				print "</select>";
+			?>
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("theme");?></td>
+		<td>
+			<?php
+				print "<select name=\"sesstheme\">";
+				$themes = getThemes();
+				foreach ($themes as $currTheme)
+				{
+					print "<option value=\"$currTheme\"";
+					if ($currTheme == $settings->_theme)
+						print " selected";
+					print ">$currTheme";
+				}
+				print "</select>";
+			?>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2" class="standardText">
+			<br><input type="Submit">
+			<?php
+				if ($settings->_enableGuestLogin)
+					print "<p><a href=\"javascript:guestLogin()\">" . getMLText("guest_login") . "</a>";
+			?>
+		</td>
+	</tr>
+</table>
+</form>
+
+<script language="JavaScript">
+document.form1.login.focus();
+</script>
+
+<?php
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.ViewDocument.php
===================================================================
--- /contrib/Dms/out/out.ViewDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.ViewDocument.php	(revision 3526)
@@ -0,0 +1,261 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+
+$document = getDocument($documentid);
+$folder = $document->getFolder();
+
+if ($document->getAccessMode($user) < M_READ)
+	die ("Access denied");
+
+$latestContent = $document->getLatestContent();
+
+printHTMLHead(
+	getMLText("document_title",
+		array(
+			"documentname" => $document->getName()
+		)
+	)
+);
+
+printTitleBar($folder);
+printDocumentPageStart($document);
+
+printPageHeader(getMLText("document_overview") . ": " . $document->getName());
+
+?>
+	<p class="standardText">
+	<a href="../op/op.Download.php?documentid=<?php print $documentid;?>&version=<?php print $latestContent->getVersion();?>"><img src="images/download.gif" width=22 height=22 border=0 align="absmiddle"><?php printMLText("download"); ?></a>
+	<?php
+		if ($latestContent->viewOnline())
+			print "&nbsp;&nbsp;&nbsp;<a target=\"_blank\" href=\"../op/viewonline" . $latestContent->getURL()."\"><img src=\"images/view.gif\" width=18 height=18 border=0 align=\"absmiddle\">" . getMLText("view_online") . "</a>";
+	print "</p>";
+
+
+printStartBox(getMLText("document_infos"));
+?>
+	<table cellpadding="0" cellspacing="10">
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("owner");?>:</td>
+			<td style="border-left: 1pt solid #000080;" rowspan="13">&nbsp;</td>
+			<td class="infos">
+				<?php
+					$owner = $document->getOwner();
+					print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".$owner->getFullName()."</a>";
+				?>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("comment");?>:</td>
+			<td class="infos"><?php print $document->getComment();?></td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("creation_date");?>:</td>
+			<td class="infos"><?php print getLongReadableDate($document->getDate()); ?></td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("keywords");?>:</td>
+			<td class="infos"><?php print $document->getKeywords();?></td>
+		</tr>
+		<?php
+			if ($document->isLocked())
+			{
+				$lockingUser = $document->getLockingUser();
+				?>
+					<tr>
+						<td class="infos" valign="top"><?php printMLText("lock_status");?>:</td>
+						<td class="infos"><?php printMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => $lockingUser->getFullName()));?></td>
+					</tr>
+				<?php
+			}
+		?>
+		<tr>
+			<td style="border-bottom: 1pt solid #000080;">&nbsp;</td>
+			<td style="border-bottom: 1pt solid #000080;">&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("last_update");?></td>
+			<td class="infos"><?php print getLongReadableDate($latestContent->getDate());?></td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("current_version");?>:</td>
+			<td class="infos"><?php print $latestContent->getVersion();?></td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("comment_for_current_version");?>:</td>
+			<td class="infos" valign="top"><?php print $latestContent->getComment();?></td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("uploaded_by");?>:</td>
+			<td class="infos">
+				<?php
+					$updatingUser = $latestContent->getUser();
+					print "<a class=\"infos\" href=\"mailto:".$updatingUser->getEmail()."\">".$updatingUser->getFullName()."</a>";
+				?>
+			</td>
+		</tr>
+		<!--<tr>
+			<td class="infos" valign="top"><?php printMLText("file_size");?>:</td>
+			<td class="infos"><?php print filesize($settings->_contentDir . $latestContent->getPath());?> bytes</td>
+		</tr>-->
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("mime_type");?>:</td>
+			<td class="infos">
+				<?php print $latestContent->getMimeType();?>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top"><?php printMLText("expires");?>:</td>
+			<td class="infos" valign="top">
+			<?php
+				if (!$document->getExpires())
+					printMLText("does_not_expire");
+				else
+					print getReadableDate($document->getExpires());
+			?>
+			</td>
+		</tr>
+	</table>
+
+<?php
+printNextBox(getMLText("document_versions"));
+?>
+	
+	<table cellspacing="5" cellpadding="0" border="0">
+	<?php
+		$versions = $document->getContent();
+		$rownum = count($versions)+1;
+		print "<tr>\n";
+		print "<td></td>";
+		print "<td></td>";
+		print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("version")."</i></td>\n";
+		print "<td rowspan=".$rownum." style=\"border-left: 1pt solid #000080;\">&nbsp;</td>\n";
+		print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("upload_date")."</i></td>\n";
+		print "<td rowspan=".$rownum." style=\"border-left: 1pt solid #000080;\">&nbsp;</td>\n";
+		print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("comment")."</i></td>\n";
+		print "<td rowspan=".$rownum." style=\"border-left: 1pt solid #000080;\">&nbsp;</td>\n";
+		print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("uploaded_by")."</i></td>\n";
+		if (($document->getAccessMode($user) >= M_READWRITE) && (count($versions) > 1))
+			print "<td></td>";
+		print "</tr>\n";
+		for ($i = count($versions)-1; $i >= 0; $i--)
+		{
+			$version = $versions[$i];
+			$uploadingUser = $version->getUser();
+			$comment = $version->getComment();
+			//if (strlen($comment) > 25) $comment = substr($comment, 0, 22) . "...";
+			print "<tr>";
+			print "<td>";
+			if ($version->viewOnline())
+				print "<a target=\"_blank\" href=\"../op/viewonline" . $version->getURL()."\"><img src=\"images/view.gif\" width=18 height=18 border=0 title=\"".getMLText("view_online")."\"></a>";
+			print "</td>";
+			print "<td><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$version->getVersion()."\" class=\"oldcontent\"><img src=\"images/download.gif\" width=22 height=22 border=0 title=\"".getMLText("download")."\"></a></td>";
+			print "<td class=\"filelist\" align=\"center\">" . $version->getVersion() . "</td>\n";
+			print "<td class=\"filelist\">" . getLongReadableDate($version->getDate()) . "</td>";
+			print "<td class=\"filelist\">".$comment."</td>";
+			print "<td class=\"filelist\">". $uploadingUser->getFullName() . "</td>";
+			if (($document->getAccessMode($user) >= M_READWRITE) && (count($versions) > 1))
+				print "<td><a href=\"out.RemoveVersion.php?documentid=".$documentid."&version=".$version->getVersion()."\"><img src=\"images/del.gif\" width=15 height=15 border=0 title=\"".getMLText("delete")."\"></a></td>";
+			print "</tr>";
+		}
+	?>
+	</table>
+
+<?php
+printNextBox(getMLText("linked_documents"));
+
+$links = $document->getDocumentLinks();
+$links = filterDocumentLinks($user, $links);
+
+$rownum = count($links)+1;
+?>
+
+<table cellspacing="5" cellpadding="0" border="0">
+	<?php
+	if ($rownum > 1)
+	{
+		?>
+		<tr>
+		<td></td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("name");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("comment");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_by");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_public");?></i></td>
+		<td></td>
+		</tr>
+		<?php
+		foreach($links as $link)
+		{
+			$responsibleUser = $link->getUser();
+			$targetDoc = $link->getTarget();
+			
+			print "<tr>";
+			print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+			print "<td class=\"linklist\"><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
+			print "<td class=\"linklist\">".$targetDoc->getComment()."</td>";
+			print "<td class=\"linklist\">".$responsibleUser->getFullName()."</td>";
+			print "<td class=\"linklist\">" . (($link->isPublic()) ? getMLText("yes") : getMLText("no")) . "</td>";
+			print "<td>";
+			if (($user->getID() == $responsibleUser->getID()) || ($user->getID() == $settings->_adminID) || ($link->isPublic() && ($document->getAccessMode($user) >= M_READWRITE )))
+				print "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\"><img src=\"images/del.gif\" border=0></a>";
+			print "</td>";
+			print "</tr>";
+		}
+	}
+	else
+		print "<tr><td class=\"filelist\">".getMLText("no_document_links")."</td></tr>";
+	?>
+</table>
+
+<?php
+if ($user->getID() != $settings->_guestID)
+{
+?>
+	<form action="../op/op.AddDocumentLink.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("choose_target_document");?>:</td>
+			<td><?php printDocumentChooser("form1");?></td>
+		</tr>
+		<?php
+			if ($document->getAccessMode($user) >= M_READWRITE)
+			{
+				print "<tr><td class=\"inputDescription\">".getMLText("document_link_public")."</td><td class=\"inputDescription\">";
+				print "<input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes") . "&nbsp;&nbsp;";
+				print "<input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no");
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit" value="<?php printMLText("add_document_link");?>"></td>
+		</tr>
+	</table>
+	</form>
+<?php
+}
+
+printEndBox();
+
+
+printDocumentPageEnd($document);
+
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.DefaultKeywords.php
===================================================================
--- /contrib/Dms/out/out.DefaultKeywords.php	(revision 3526)
+++ /contrib/Dms/out/out.DefaultKeywords.php	(revision 3526)
@@ -0,0 +1,164 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.ClassKeywords.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+
+$categories = getAllKeywordCategories($user->getID());
+
+
+if ($user->isAdmin())
+	printHTMLHead( getMLText("global_default_keywords") );
+else
+	printHTMLHead( getMLText("personal_default_keywords"));
+?>
+
+<script language="JavaScript">
+obj = -1;
+function showKeywords(selectObj) {
+	if (obj != -1)
+		obj.style.display = "none";
+	
+	id = selectObj.options[selectObj.selectedIndex].value;
+	if (id == -1)
+		return;
+	
+	obj = document.getElementById("keywords" + id);
+	obj.style.display = "";
+}
+</script>
+<?php
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+
+printStartBox(getMLText("new_default_keyword_category"));
+?>
+	<form action="../op/op.DefaultKeywords.php" method="post">
+	<input type="Hidden" name="action" value="addcategory">
+	<table>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("name");?>:</td>
+			<td><input name="name"></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+	</form>
+
+<?php
+printNextBox(getMLText("edit_default_keyword_category"));
+?>
+	<table>
+	<tr>
+		<td class="inputDescription"><?php echo getMLText("default_keyword_category")?>:</td>
+		<td>
+			<select onchange="showKeywords(this)">
+				<option value="-1"><?php echo getMLText("choose_category")?>
+				<?php
+				foreach ($categories as $category) {
+					$owner = $category->getOwner();
+					if ((!$user->isAdmin()) && ($owner->getID() != $user->getID()))
+						continue;
+					
+					print "<option value=\"".$category->getID()."\">" . $category->getName();
+				}
+				?>
+			</select>
+		</td>
+	</tr>
+	<?php
+	foreach ($categories as $category) {
+		$owner = $category->getOwner();
+		if ((!$user->isAdmin()) && ($owner->getID() != $user->getID()))
+			continue;
+	?>
+		<tr id="keywords<?php echo $category->getID()?>" style="display : none;">
+		<td colspan="2">
+			<table cellpadding="5" cellspacing="0">
+				<tr>
+					<td colspan="2"><hr size="1" width="100%" color="#000080" noshade></td>
+				</tr>
+				<tr>
+					<td class="inputDescription"><?php echo getMLText("name")?>:</td>
+					<td>
+						<form action="../op/op.DefaultKeywords.php" method="post">
+							<input type="Hidden" name="action" value="editcategory">
+							<input type="Hidden" name="categoryid" value="<?php echo $category->getID()?>">
+							<input name="name" value="<?php echo $category->getName()?>">&nbsp; 
+							<input type="Image" src="images/save.gif" title="<?php echo getMLText("save")?>" border="0">
+						</form>
+					</td>
+				</tr>
+				<tr>
+					<td class="inputDescription" valign="top"><?php echo getMLText("default_keywords")?>:</td>
+					<td>
+						<table cellpadding="0" cellspacing="0">
+						<?php
+							$lists = $category->getKeywordLists();
+							if (count($lists) == 0)
+								print "<tr><td class=\"standardText\">" . getMLText("no_default_keywords") . "</td></tr>";
+							else
+								foreach ($lists as $list) {
+						?>
+									<tr>
+										<form action="../op/op.DefaultKeywords.php" method="post">
+										<input type="Hidden" name="categoryid" value="<?php echo $category->getID()?>">
+										<input type="Hidden" name="keywordsid" value="<?php echo $list["id"]?>">
+										<input type="Hidden" name="action" value="editkeywords">
+										<td>
+											<input name="keywords" value="<?php echo $list["keywords"]?>">
+										</td>
+										<td>&nbsp;
+											 <input name="action" value="editkeywords" type="Image" src="images/save.gif" title="<?php echo getMLText("save")?>" border="0"> &nbsp;
+										<!--	 <input name="action" value="removekeywords" type="Image" src="images/del.gif" title="<?php echo getMLText("delete")?>" border="0"> &nbsp; -->
+											<a href="../op/op.DefaultKeywords.php?categoryid=<?php echo $category->getID()?>&keywordsid=<?php echo $list["id"]?>&action=removekeywords"><img src="images/del.gif" title="<?php echo getMLText("delete")?>" border=0></a>
+										</td>
+										</form>
+									</tr>
+						<?php		}  ?>
+						</table>
+					</td>
+					<td></td>
+				</tr>
+				<tr>
+					<td class="inputDescription"><?php echo getMLText("new_default_keywords")?>:</td>
+					<td>
+						<form action="../op/op.DefaultKeywords.php" method="post">
+							<input type="Hidden" name="action" value="newkeywords">
+							<input type="Hidden" name="categoryid" value="<?php echo $category->getID()?>">
+							<input name="keywords">&nbsp;
+							<input type="Image" src="images/save.gif" title="<?php echo getMLText("save")?>" border="0">
+						</form>
+					</td>
+				</tr>
+				<tr>
+					<td colspan="2">
+						<br>
+						<a class="standardText" href="../op/op.DefaultKeywords.php?categoryid=<?php print $category->getID();?>&action=removecategory"><img src="images/del.gif" width="15" height="15" border="0" align="absmiddle" alt=""> <?php printMLText("rm_default_keyword_category");?></a>
+					</td>
+				</tr>
+			</table>
+		</td>
+		</tr>
+<?php	} ?>
+	</table>
+	
+<?php
+printEndBox();
+
+
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/styles.css
===================================================================
--- /contrib/Dms/out/styles.css	(revision 3526)
+++ /contrib/Dms/out/styles.css	(revision 3526)
@@ -0,0 +1,153 @@
+	a { text-decoration: none; }
+	a:hover { text-decoration: underline; }
+
+	.titlebar {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 12pt;
+		color : White;
+		font-weight: bold;
+	}
+
+	.header1 {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 11pt;
+		font-style : italic;
+		color : #000080;
+	}
+
+	.foldertree {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.foldertree_selectable {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: blue;
+	}
+	
+	.foldertree_inpath {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+		font-style: italic;
+	}
+	
+	.foldertree_active {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 9pt;
+		color: black;
+		font-weight: bold;
+	}
+	
+	.path {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.editfolder {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.editdocument {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.infos {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.filelist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+
+	.subfolderlist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.linklist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.boxHeader {
+			color : White;
+			font-style : italic;
+			font-size : 11pt;
+			font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+	}
+	
+	.pageHeader {
+			font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+			font-size: 13pt;
+			font-weight: bold;
+			color: #000080;
+	}
+	
+	 .inputDescription {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+		font-style: italic;
+	}
+	
+	.notifylist {
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.inheritAccess
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.accessList
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.defaultAccess
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.msgLocked
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.standardText
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
+	
+	.groupMembers
+	{
+		font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+		font-size : 10pt;
+		color: black;
+	}
Index: /contrib/Dms/out/out.EditFolder.php
===================================================================
--- /contrib/Dms/out/out.EditFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.EditFolder.php	(revision 3526)
@@ -0,0 +1,86 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
+$folder = getFolder($folderid);
+
+$parent = ($folder->getID() == $settings->_rootFolderID) ? false : $folder->getParent();
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if (document.form1.fname.value == "") msg += "<?php printMLText("js_no_name");?>\n";
+	if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($folder);
+printFolderPageStart($folder);
+printPageHeader(getMLText("edit_folder_props") . ": " . $folder->getName());
+
+printStartBox(getMLText("edit_folder_props"));
+?>
+
+<form action="../op/op.EditFolder.php" name="form1" onsubmit="return checkForm();">
+	<input type="Hidden" name="folderid" value="<?php print $folderid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("name");?>:</td>
+			<td><input name="fname" value="<?php print $folder->getName();?>"></td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("comment");?>:</td>
+			<td><textarea name="comment" rows="4" cols="30"><?php print $folder->getComment();?></textarea></td>
+		</tr>
+		<?php
+			if ($parent && $parent->getAccessMode($user) > M_READ)
+			{
+				print "<tr>";
+				print "<td class=\"inputDescription\">" . getMLText("sequence") . ":</td>";
+				print "<td>";
+				printSequenceChooser($parent->getSubFolders(), $folder->getID());
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+</form>
+
+
+<?php
+
+printEndBox();
+printFolderPageEnd($folder);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.UpdateDocument.php
===================================================================
--- /contrib/Dms/out/out.UpdateDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.UpdateDocument.php	(revision 3526)
@@ -0,0 +1,105 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+
+if ($document->getAccessMode($user) < M_READWRITE)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if (document.form1.userfile.value == "") msg += "<?php printMLText("js_no_file");?>\n";
+	if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("update_document") . ": " . $document->getName());
+
+printStartBox(getMLText("update_document"));
+
+if ($document->isLocked())
+{
+	print "<div class=\"msgLocked\">";
+	$lockingUser = $document->getLockingUser();
+	
+	printMLText("update_locked_msg", array("username" => $lockingUser->getFullName(), "email" => $lockingUser->getEmail()));
+	
+	if ($lockingUser->getID() == $user->getID())
+		printMLText("unlock_cause_locking_user");
+	else if ($document->getAccessMode($user) == M_ALL)
+		printMLText("unlock_cause_access_mode_all");
+	else
+	{
+		printMLText("no_update_cause_locked");
+		print "</div>";
+		printEndBox();
+		printFolderPageEnd($folder);
+		printHTMLFoot();
+		exit;
+	}
+	print "</div>";
+}
+
+?>
+
+<form action="../op/op.UpdateDocument.php" enctype="multipart/form-data" method="post" name="form1" onsubmit="return checkForm();">
+	<input type="Hidden" name="documentid" value="<?php print $documentid; ?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("local_file");?>:</td>
+			<td><input type="File" name="userfile"></td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("comment");?>:</td>
+			<td class="standardText">
+				<textarea name="comment" rows="4" cols="30"></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("expires");?>:</td>
+			<td class="standardText">
+				<input type="Radio" name="expires" value="false"<?phpif (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
+				<input type="radio" name="expires" value="true"<?phpif ($document->expires()) print " checked";?>><?php printDateChooser(-1, "exp");?>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+</form>
+
+<?php
+
+printEndBox();
+printDocumentPageEnd($document);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.EditDocument.php
===================================================================
--- /contrib/Dms/out/out.EditDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.EditDocument.php	(revision 3526)
@@ -0,0 +1,99 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$documentid = (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$document = getDocument($documentid);
+$folder = $document->getFolder();
+
+if ($document->getAccessMode($user) < M_READWRITE)
+	die ("Access denied");
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
+	if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	if (document.form1.keywords.value == "") msg += "<?php printMLText("js_no_keywords");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("edit_document_props") . ": " . $document->getName());
+
+printStartBox(getMLText("edit_document_props"));
+?>
+
+<form action="../op/op.EditDocument.php" name="form1" onsubmit="return checkForm();">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<table cellpadding="3">
+		<tr>
+			<td class="inputDescription"><?php printMLText("name");?>:</td>
+			<td><input name="fname" value="<?php print $document->getName();?>"></td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("comment");?>:</td>
+			<td><textarea name="comment" rows="4" cols="30"><?php print $document->getComment();?></textarea></td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("keywords");?>:</td>
+			<td class="standardText">
+				<textarea name="keywords" rows="4" cols="30"><?php print $document->getKeywords();?></textarea><br>
+				<a href="javascript:chooseKeywords();"><?php printMLText("use_default_keywords");?></a>
+				<script language="JavaScript">
+					var openDlg;
+					
+					function chooseKeywords() {
+						openDlg = open("out.KeywordChooser.php", "openDlg", "width=500,height=400,scrollbars=yes,resizable=yes");
+					}
+				</script>
+			</td>
+		</tr>
+		<?php
+			if ($folder->getAccessMode($user) > M_READ)
+			{
+				print "<tr>";
+				print "<td class=\"inputDescription\">" . getMLText("sequence") . ":</td>";
+				print "<td>";
+				printSequenceChooser($folder->getDocuments(), $document->getID());
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+</form>
+
+
+<?php
+
+printEndBox();
+printDocumentPageEnd($document);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.AddDocument.php
===================================================================
--- /contrib/Dms/out/out.AddDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.AddDocument.php	(revision 3526)
@@ -0,0 +1,104 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
+$folder = getFolder($folderid);
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+	die("access denied");
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+?>
+
+<script language="JavaScript">
+function checkForm()
+{
+	msg = "";
+	if (document.form1.userfile.value == "") msg += "<?php printMLText("js_no_file");?>\n";
+	//if (document.form1.fname.value == "") msg += "<?php printMLText("js_no_name");?>\n";
+	//if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	//if (document.form1.keywords.value == "") msg += "<?php printMLText("js_no_keywords");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($folder);
+printFolderPageStart($folder);
+printPageHeader(getMLText("add_document") . ": " . $folder->getName());
+
+printStartBox(getMLText("add_document"));
+?>
+
+<form action="../op/op.AddDocument.php" enctype="multipart/form-data" method="post" name="form1" onsubmit="return checkForm();">
+	<input type="Hidden" name="folderid" value="<?php print $folderid; ?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("local_file");?>:</td>
+			<td><input type="File" name="userfile"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription"><?php printMLText("name");?>:</td>
+			<td><input name="fname"></td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("comment");?>:</td>
+			<td><textarea name="comment" rows="4" cols="30"></textarea></td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("keywords");?>:</td>
+			<td class="standardText">
+				<textarea name="keywords" rows="4" cols="30"></textarea><br>
+				<a href="javascript:chooseKeywords();"><?php printMLText("use_default_keywords");?></a>
+				<script language="JavaScript">
+					var openDlg;
+					
+					function chooseKeywords() {
+						openDlg = open("out.KeywordChooser.php", "openDlg", "width=500,height=400,scrollbars=yes,resizable=yes");
+					}
+				</script>
+			</td>
+		</tr>
+		<tr>
+			<td valign="top" class="inputDescription"><?php printMLText("expires");?>:</td>
+			<td class="standardText">
+				<input type="Radio" name="expires" value="false" checked><?php printMLText("does_not_expire");?><br>
+				<input type="radio" name="expires" value="true"><?php printDateChooser(-1, "exp");?>
+			</td>
+		</tr>
+		<tr>
+			<td class="inputDescription"><?php printMLText("sequence");?>:</td>
+			<td><?php printSequenceChooser($folder->getDocuments());?></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+</form>
+
+
+<?php
+
+printEndBox();
+printFolderPageEnd($folder);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.RemoveFolder.php
===================================================================
--- /contrib/Dms/out/out.RemoveFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.RemoveFolder.php	(revision 3526)
@@ -0,0 +1,49 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+$folder = getFolder($folderid);
+
+if ($folder->getAccessMode($user) < M_ALL)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+
+printTitleBar($folder);
+printFolderPageStart($folder);
+printPageHeader(getMLText("rm_folder") . ": " . $folder->getName());
+
+printStartBox(getMLText("rm_folder"));
+?>
+
+<form action="../op/op.RemoveFolder.php" name="form1">
+	<input type="Hidden" name="folderid" value="<?php print $folderid;?>">
+	<div class="standardText">
+	<?php 
+		print lang('Do you really want to remove the folder "%1" and its content?<br>Be careful: This action cannot be undone.', $folder->getName());
+	?>
+	</div><br>
+	<input type="Submit" value="<?php printMLText("rm_folder");?>">
+</form>
+
+
+<?php
+
+printEndBox();
+printFolderPageEnd($folder);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.SearchForm.php
===================================================================
--- /contrib/Dms/out/out.SearchForm.php	(revision 3526)
+++ /contrib/Dms/out/out.SearchForm.php	(revision 3526)
@@ -0,0 +1,134 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+$currentFolder = getFolder($folderid);
+
+printHTMLHead( getMLText("search") );
+?>
+
+<script language="JavaScript">
+
+function checkForm()
+{
+	msg = "";
+	if (document.form1.query.value == "")
+	{
+		if (document.form1.creationdate.checked || document.form1.lastupdate.checked)
+			document.form1.query.value = "%"
+		else
+			msg += "<?php printMLText("js_no_query");?>\n";
+	}
+	
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar($currentFolder);
+printCenterStart();
+
+printStartBox(getMLText("search"));
+?>
+
+<form action="../op/op.Search.php" name="form1" onsubmit="return checkForm();">
+
+<table cellpadding="3">
+	<tr>
+		<td class="inputDescription"><?php printMLText("search_query");?>:</td>
+		<td>
+			<input name="query">
+			<select name="mode">
+				<option value="and" selected><?php printMLText("search_mode_and");?><br>
+				<option value="or"><?php printMLText("search_mode_or");?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td valign="top" class="inputDescription"><?php printMLText("search_in");?>:</td>
+		<td class="standardText">
+			<input type="Checkbox" name="searchin[]" value="keywords" checked><?php printMLText("keywords");?><br>
+			<input type="Checkbox" name="searchin[]" value="name"><?php printMLText("name");?><br>
+			<input type="Checkbox" name="searchin[]" value="comment"><?php printMLText("comment");?>
+		</td>
+	</tr>
+	<tr>
+		<td valign="top" class="inputDescription"><?php printMLText("owner");?>:</td>
+		<td class="standardText">
+			<select name="ownerid">
+			<option value="-1"><?php printMLText("all_users");?>
+			<?php
+				$allUsers = getAllUsers();
+				foreach ($allUsers as $userObj)
+				{
+					if ($userObj->getID() == $settings->_guestID)
+						continue;
+					print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
+				}
+			?>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td valign="top" class="inputDescription"><?php printMLText("under_folder")?>:</td>
+		<td class="standardText"><?php printFolderChooser("form1", M_READ, -1, $currentFolder);?></td>
+	</tr>
+	<tr>
+		<td valign="top" class="inputDescription"><?php printMLText("creation_date");?>:</td>
+		<td class="standardText">
+			<input type="Checkbox" name="creationdate" value="true">
+			<?php
+				printMLText("between");
+				print "&nbsp;&nbsp;";
+				printDateChooser(-1, "createstart");
+				print "&nbsp;&nbsp;";
+				printMLText("and");
+				print "&nbsp;&nbsp;";
+				printDateChooser(-1, "createend");
+			?>
+		</td>
+	</tr>
+	<tr>
+		<td valign="top" class="inputDescription"><?php printMLText("last_update");?>:</td>
+		<td class="standardText">
+			<input type="Checkbox" name="lastupdate" value="true">
+			<?php
+				printMLText("between");
+				print "&nbsp;&nbsp;";
+				printDateChooser(-1, "updatestart");
+				print "&nbsp;&nbsp;";
+				printMLText("and");
+				print "&nbsp;&nbsp;";
+				printDateChooser(-1, "updateend");
+			?>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2"><br><input type="Submit"></td>
+	</tr>
+
+</table>
+
+</form>
+
+<?php
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.RemoveDocument.php
===================================================================
--- /contrib/Dms/out/out.RemoveDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.RemoveDocument.php	(revision 3526)
@@ -0,0 +1,46 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+
+if ($document->getAccessMode($user) < M_ALL)
+	die ("Access denied");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("rm_document") . ": " . $document->getName());
+
+printStartBox(getMLText("rm_document"));
+?>
+
+<form action="../op/op.RemoveDocument.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<div class="standardText">
+	<?php printMLText("confirm_rm_document", array ("documentname" => $document->getName()));?>
+	</div><br>
+	<input type="Submit" value="<?php printMLText("rm_document");?>">
+</form>
+
+
+<?php
+
+printEndBox();
+printDocumentPageEnd($document);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.FolderChooser.php
===================================================================
--- /contrib/Dms/out/out.FolderChooser.php	(revision 3526)
+++ /contrib/Dms/out/out.FolderChooser.php	(revision 3526)
@@ -0,0 +1,123 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+
+
+function printTree($path, $accessMode, $exclude, $level = 0)
+{
+	GLOBAL $user, $form;
+	
+	$folder = $path[$level];
+	$subFolders = $folder->getSubFolders();
+	$subFolders = filterAccess($subFolders, $user, M_READ);
+	
+	if ($level+1 < count($path))
+		$nextFolderID = $path[$level+1]->getID();
+	else
+		$nextFolderID = -1;
+	
+	print "<table cellpadding=0 cellspacing=0>\n";
+	print "  <tr>\n";
+	print "    <td valign=\"top\"";
+	if (count($subFolders) > 0)
+		print " background=\"".getImgPath("down.gif")."\"";
+	print "><img src=\"";
+		if ($level == 0) printImgPath("to_down.gif");
+		else if (count($subFolders) > 0) printImgPath("right_in_to_down.gif");
+		else printImgPath("right_in.gif");
+	print "\" border=0></td>\n";
+	print "    <td class=\"foldertree\">";
+	if ($folder->getAccessMode($user) >= $accessMode) {
+		print "<a class=\"foldertree_selectable\" href=\"javascript:folderSelected(" . $folder->getID() . ", '" . addslashes($folder->getName()) . "')\">";
+		print "<img src=\"".getImgPath("folder_opened.gif")."\" border=0>".$folder->getName()."</a></td>\n";
+	}
+	else
+		print "<img src=\"".getImgPath("folder_opened.gif")."\" width=18 height=18 border=0>".$folder->getName()."</td>\n";
+	print "  </tr>\n";
+	
+	for ($i = 0; $i < count($subFolders); $i++) {
+		if ($subFolders[$i]->getID() == $exclude)
+			continue;
+		
+		print "<tr>";
+		if ($i +1 < count($subFolders))
+			print "<td background=\"".getImgPath("down.gif")."\" valign=\"top\"><img src=\"".getImgPath("right.gif")."\" border=0></td>";
+		else
+			print "<td valign=\"top\"><img src=\"".getImgPath("right_last.gif")."\" border=0></td>";
+		print "<td>";
+		if ($subFolders[$i]->getID() == $nextFolderID)
+			printTree($path, $accessMode, $exclude, $level+1);
+		else {
+			$subFolders_ = $subFolders[$i]->getSubFolders();
+			$subFolders_ = filterAccess($subFolders_, $user, M_READ);
+			
+			print "<table cellpadding=0 cellspacing=0><tr>";
+			if (count($subFolders_) > 0)
+				print "  <td valign=\"top\"><a href=\"out.FolderChooser.php?form=$form&mode=$accessMode&exclude=$exclude&folderid=".$subFolders[$i]->getID()."\"><img src=\"".getImgPath("right_in_plus.gif")."\" border=0></a></td>";
+			else
+				print "  <td valign=\"top\"><img src=\"".getImgPath("right_in.gif")."\"></td>";
+			print "  <td class=\"foldertree\" valign=\"top\">";
+			if ($subFolders[$i]->getAccessMode($user) >= $accessMode) {
+				print "<a class=\"foldertree_selectable\" href=\"javascript:folderSelected(" . $subFolders[$i]->getID() . ", '" . addslashes($subFolders[$i]->getName()) . "')\">";
+				print "<img src=\"".getImgPath("folder_closed.gif")."\" border=0>".$subFolders[$i]->getName()."</a></td>\n";
+			}
+			else
+				print "<img src=\"".getImgPath("folder_closed.gif")."\" border=0>".$subFolders[$i]->getName()."</td>";
+			print "</tr></table>";
+		}
+		print "</td>";
+		print "</tr>";
+	}
+	
+	print "</table>\n";
+}
+
+?>
+
+
+<html>
+<head>
+<link rel="STYLESHEET" type="text/css" href="styles.css">
+<title><?php echo getMLText("choose_target_folder")?></title>
+
+<script language="JavaScript">
+var targetName;
+var targetID;
+
+function folderSelected(id, name) {
+	targetName.value = name;
+	targetID.value = id;
+	window.close();
+	return true;
+}
+</script>
+
+</head>
+<body>
+
+<?php
+	$folder = getFolder($folderid);
+	printTree($folder->getPath(), $mode, $exclude);
+?>
+
+
+<script language="JavaScript">
+targetName = opener.document.<?php echo $form?>.targetname;
+targetID   = opener.document.<?php echo $form?>.targetid;
+</script>
+
+
+</body>
+</html>
Index: /contrib/Dms/out/out.GroupMgr.php
===================================================================
--- /contrib/Dms/out/out.GroupMgr.php	(revision 3526)
+++ /contrib/Dms/out/out.GroupMgr.php	(revision 3526)
@@ -0,0 +1,195 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$groups = getAllGroups();
+$allUsers = getAllUsers();
+
+
+printHTMLHead( getMLText("group_management") );
+?>
+<script language="JavaScript">
+
+function checkForm1(num) {
+	msg = "";
+	eval("var formObj = document.form" + num + "_1;");
+	
+	if (formObj.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
+	if (formObj.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+
+function checkForm2(num) {
+	msg = "";
+	eval("var formObj = document.form" + num + "_2;");
+	
+	if (formObj.userid.options[formObj.userid.selectedIndex].value == -1) msg += "<?php printMLText("js_select_user");?>\n";
+
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+
+
+obj = -1;
+function showUser(selectObj) {
+	if (obj != -1)
+		obj.style.display = "none";
+	
+	id = selectObj.options[selectObj.selectedIndex].value;
+	if (id == -1)
+		return;
+	
+	obj = document.getElementById("keywords" + id);
+	obj.style.display = "";
+}
+
+</script>
+<?php
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+printStartBox(getMLText("add_group"));
+?>
+	<form action="../op/op.GroupMgr.php" name="form0_1" onsubmit="return checkForm1('0');">
+	<input type="Hidden" name="action" value="addgroup">
+	<table>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("name");?>:</td>
+			<td><input name="name"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td>
+			<td><textarea name="comment" rows="4" cols="30"></textarea></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+	</form>
+
+<?php
+printNextBox(getMLText("edit_group"));
+?>
+	<table>
+	<tr>
+		<td class="inputDescription"><?php echo getMLText("name")?>:</td>
+		<td>
+			<select onchange="showUser(this)">
+				<option value="-1"><?php echo getMLText("choose_group")?>
+				<?php
+				foreach ($groups as $group) {
+					print "<option value=\"".$group->getID()."\">" . $group->getName();
+				}
+				?>
+			</select>
+		</td>
+	</tr>
+	<?php
+	foreach ($groups as $group) {
+	?>
+	<tr id="keywords<?php echo $group->getID()?>" style="display : none;">
+	<td colspan="2">
+	
+	<form action="../op/op.GroupMgr.php" name="form<?php print $group->getID();?>_1" onsubmit="return checkForm1('<?php print $group->getID();?>');">
+	<input type="Hidden" name="groupid" value="<?php print $group->getID();?>">
+	<input type="Hidden" name="action" value="editgroup">
+	<table border="0">
+		<tr>
+			<td colspan="2"><hr size="1" width="100%" color="#000080" noshade></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("name");?>:</td>
+			<td class="standardText"><input name="name" value="<?php print $group->getName();?>"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td>
+			<td class="standardText"><textarea name="comment" rows="4" cols="30"><?php print $group->getComment();?></textarea></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+	</form>
+	<hr size="1" width="100%" color="#000080" noshade>
+		<table border="0" cellpadding="5" cellspacing="0">
+		<?php
+			$members = $group->getUsers();
+			if (count($members) == 0)
+				print "<tr><td class=\"groupMembers\">".getMLText("no_group_members")."</td></tr>";
+			else
+			{
+				print "<tr>\n";
+				print "	<td style=\"border-bottom: 1pt solid #000080;\">&nbsp;</td>\n";
+				print "	<td style=\"border-bottom: 1pt solid #000080;\" class=\"groupMembers\"><i>".getMLText("name")."</i></td>\n";
+				print "	<td style=\"border-bottom: 1pt solid #000080;\">&nbsp;</td>\n";
+				print "</tr>\n";
+				foreach ($members as $member)
+				{
+					print "<tr>";
+					print "<td><img src=\"images/usericon.gif\" width=16 height=16></td>";
+					print "<td class=\"groupMembers\">" . $member->getFullName() . "</td>";
+					print "<td><a href=\"../op/op.GroupMgr.php?groupid=". $group->getID() . "&userid=".$member->getID()."&action=rmmember\"><img src=\"images/del.gif\" width=15 height=15 border=0></a>";
+					print "</tr>";
+				}
+			}
+		?>
+		</table>
+		<form action="../op/op.GroupMgr.php" name="form<?php print $group->getID();?>_2" onsubmit="return checkForm2('<?php print $group->getID();?>');">
+		<input type="Hidden" name="action" value="addmember">
+		<input type="Hidden" name="groupid" value="<?php print $group->getID();?>">
+		<table>
+			<tr>
+				<td class="inputDescription"><?php printMLText("add_member");?>:</td>
+				<td>
+					<select name="userid">
+						<option value="-1"><?php printMLText("select_one");?>
+						<option value="-1">-------------------------------
+						<?php
+							foreach ($allUsers as $currUser)
+								if (!$group->isMember($currUser))
+									print "<option value=\"".$currUser->getID()."\">" . $currUser->getFullName() . "\n";
+						?>
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td colspan="2"><br><input type="Submit"></td>
+			</tr>
+		</table>
+		</form>
+	</div>
+	<hr size="1" width="100%" color="#000080" noshade>
+	<a class="standardText" href="../op/op.GroupMgr.php?groupid=<?php print $group->getID();?>&action=removegroup"><img src="images/del.gif" width="15" height="15" border="0" align="absmiddle" alt=""> <?php printMLText("rm_group");?></a>
+	
+	</td>
+	</tr>
+<?php  } ?>
+</table>
+
+<?php
+printEndBox();
+
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.RemoveVersion.php
===================================================================
--- /contrib/Dms/out/out.RemoveVersion.php	(revision 3526)
+++ /contrib/Dms/out/out.RemoveVersion.php	(revision 3526)
@@ -0,0 +1,51 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+if (!$document) die("Error: could not get document");
+$version  = $document->getContentByVersion($version);
+if (!$version) die("error: could not get version $version");
+
+
+if ($document->getAccessMode($user) < M_ALL)
+	die("Access denied");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+
+printTitleBar($document->getFolder());
+printDocumentPageStart($document);
+printPageHeader(getMLText("rm_version") . ": " . $document->getName());
+
+printStartBox(getMLText("rm_version"));
+?>
+
+<form action="../op/op.RemoveVersion.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?php echo $documentid?>">
+	<input type="Hidden" name="version" value="<?php echo $version->getVersion()?>">
+	<div class="standardText">
+	<?php printMLText("confirm_rm_version", array ("documentname" => $document->getName(), "version" => $version->getVersion()));?>
+	</div><br>
+	<input type="Submit" value="<?php printMLText("rm_version");?>">
+</form>
+
+
+<?php
+
+printEndBox();
+printDocumentPageEnd($document);
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/out/out.KeywordChooser.php
===================================================================
--- /contrib/Dms/out/out.KeywordChooser.php	(revision 3526)
+++ /contrib/Dms/out/out.KeywordChooser.php	(revision 3526)
@@ -0,0 +1,185 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.ClassKeywords.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+
+include("../inc/inc.Authentication.php");
+
+
+$categories = getAllKeywordCategories($user->getID());
+
+printHTMLHead( getMLText("use_default_keywords") );
+?>
+
+
+<script language="JavaScript">
+var targetObj = opener.document.form1.keywords;
+var myTA;
+
+
+function insertKeywords(keywords) {
+
+	if (navigator.appName == "Microsoft Internet Explorer") {
+		myTA.value += " " + keywords;
+	}
+	//assuming Mozilla
+	else {
+		selStart = myTA.selectionStart;
+		
+		myTA.value = myTA.value.substring(0,myTA.selectionStart)
+	    	          + keywords
+					  + myTA.value.substring(myTA.selectionStart,myTA.value.length);
+		
+		myTA.selectionStart = selStart + keywords.length;
+		myTA.selectionEnd = selStart + keywords.length;
+	}				  
+	myTA.focus();
+}
+
+function cancel() {
+	window.close();
+	return true;
+}
+
+function acceptKeywords() {
+	targetObj.value = myTA.value;
+	window.close();
+	return true;
+}
+
+
+
+obj = new Array();
+obj[0] = -1;
+obj[1] = -1;
+function showKeywords(which) {
+	if (obj[which] != -1)
+		obj[which].style.display = "none";
+	
+	list = document.getElementById("categories" + which);
+	
+	id = list.options[list.selectedIndex].value;
+	if (id == -1)
+		return;
+	
+	obj[which] = document.getElementById("keywords" + id);
+	obj[which].style.display = "";
+}
+</script>
+
+<div style="margin-left: 10pt; margin-top: 10pt">
+<?php
+printStartBox(getMLText("use_default_keywords"));
+?>
+<table>
+	<tr>
+		<td class="inputDescription"><?php echo getMLText("global_default_keywords")?>:</td>
+		<td>
+			<select onchange="showKeywords(0)" id="categories0">
+				<option value="-1"><?php echo getMLText("choose_category")?>
+				<?php
+				foreach ($categories as $category) {
+					$owner = $category->getOwner();
+					if ($owner->getID() != $settings->_adminID)
+						continue;
+					
+					print "<option value=\"".$category->getID()."\">" . $category->getName();
+				}
+				?>
+			</select>
+		</td>
+	</tr>
+<?php
+	foreach ($categories as $category) {
+		$owner = $category->getOwner();
+		if ($owner->getID() != $settings->_adminID)
+			continue;
+?>
+	<tr id="keywords<?php echo $category->getID()?>" style="display : none;">
+		<td valign="top" class="inputDescription"><?php echo getMLText("default_keywords")?>:</td>
+		<td class="standardText">
+			<?php
+				$lists = $category->getKeywordLists();
+				foreach ($lists as $list) {
+					print "<li><a href='javascript:insertKeywords(\"$list[keywords]\");'>$list[keywords]</a></li>";
+				}
+			?>
+		</td>
+	</tr>
+<?php } ?>
+	<tr>
+		<td colspan="2"><hr></td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php echo getMLText("personal_default_keywords")?>:</td>
+		<td>
+			<select onchange="showKeywords(1)" id="categories1">
+				<option value="-1"><?php echo getMLText("choose_category")?>
+				<?php
+				foreach ($categories as $category) {
+					$owner = $category->getOwner();
+					if ($owner->getID() == $settings->_adminID)
+						continue;
+					
+					print "<option value=\"".$category->getID()."\">" . $category->getName();
+				}
+				?>
+			</select>
+		</td>
+	</tr>
+<?php
+	foreach ($categories as $category) {
+		$owner = $category->getOwner();
+		if ($owner->getID() == $settings->_adminID)
+			continue;
+?>
+	<tr id="keywords<?php echo $category->getID()?>" style="display : none;">
+		<td valign="top" class="inputDescription"><?php echo getMLText("default_keywords")?>:</td>
+		<td class="standardText">
+			<?php
+				$lists = $category->getKeywordLists();
+				foreach ($lists as $list) {
+					print "<li><a href='javascript:insertKeywords(\"$list[keywords]\");'>$list[keywords]</a></li>";
+				}
+			?>
+		</td>
+	</tr>
+<?php } ?>
+	<tr>
+		<td colspan="2"><hr></td>
+	</tr>
+	<tr>
+		<td valign="top" class="inputDescription"><?php echo getMLText("keywords")?>:</td>
+		<td><textarea id="keywordta" rows="5" cols="30"></textarea></td>
+	</tr>
+	<tr>
+		<td colspan="2">
+			<br>
+			<input type="Button" onclick="acceptKeywords();" value="<?php echo getMLText("accept")?>"> &nbsp;&nbsp;
+			<input type="Button" onclick="cancel();" value="<?php echo getMLText("cancel")?>">
+		</td>
+	</tr>
+</table>
+
+<?php
+printEndBox();
+?>
+</div>
+
+<script language="JavaScript">
+myTA = document.getElementById("keywordta");
+myTA.value = targetObj.value;
+myTA.focus();
+</script>
+
+</body>
+</html>
Index: /contrib/Dms/out/out.AdminTools.php
===================================================================
--- /contrib/Dms/out/out.AdminTools.php	(revision 3526)
+++ /contrib/Dms/out/out.AdminTools.php	(revision 3526)
@@ -0,0 +1,36 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+if (!$user->isAdmin())
+	die ("access denied");
+
+printHTMLHead( getMLText("admin_tools") );
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+printStartBox(getMLText("admin_tools"));
+?>
+	<div class="standardText">
+		<a href="out.Statistic.php"><?php echo getMLText("folders_and_documents_statistic")?></a><p>
+		<!--a href="out.UsrMgr.php"><?php echo getMLText("user_management")?></a><p>
+		<a href="out.GroupMgr.php"><?php echo getMLText("group_management")?></a><p-->
+		<a href="out.DefaultKeywords.php"><?php echo getMLText("global_default_keywords")?></a>
+	</div>
+<?php
+printEndBox();
+
+
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.UserList.php
===================================================================
--- /contrib/Dms/out/out.UserList.php	(revision 3526)
+++ /contrib/Dms/out/out.UserList.php	(revision 3526)
@@ -0,0 +1,86 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$users = getAllUsers();
+
+
+printHTMLHead( getMLText("user_list") );
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+for ($i = 0; $i < count($users); $i++)
+{
+	$currUser = $users[$i];
+	if ($currUser->getID() == $settings->_guestID)
+		continue;
+		
+	if ($i == 0)
+	 	printStartBox(getMLText("user") . ": \"" . $currUser->getFullName() . "\"");
+	else
+	 	printNextBox(getMLText("user") . ": \"" . $currUser->getFullName() . "\"");
+?>
+	<table border="0">
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_login");?>:</td>
+			<td class="standardText"><?php print $currUser->getLogin();?></td>
+		</tr>
+	<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_name");?>:</td>
+			<td class="standardText"><?php print $currUser->getFullName();?></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("email");?>:</td>
+			<td class="standardText"><a href="mailto:<?php print $currUser->getEmail();?>"><?php print $currUser->getEmail();?></a></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td>
+			<td class="standardText"><?php print $currUser->getComment();?></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("groups");?>:</td>
+			<td class="standardText">
+				<?php
+					$groups = $currUser->getGroups();
+					if (count($groups) == 0)
+						printMLText("no_groups");
+					else
+					{
+						for ($j = 0; $j < count($groups); $j++)
+						{
+							print $groups[$j]->getName();
+							if ($j +1 < count($groups))
+								print ", ";
+						}
+					}
+				?>
+			</td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_image");?>:</td>
+			<td class="standardText">
+				<?php
+					if ($currUser->hasImage())
+						print "<img src=\"".$currUser->getImageURL()."\">";
+					else
+						printMLText("no_user_image");
+				?>
+			</td>
+		</tr>
+	</table>
+<?php
+}
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.EditUserData.php
===================================================================
--- /contrib/Dms/out/out.EditUserData.php	(revision 3526)
+++ /contrib/Dms/out/out.EditUserData.php	(revision 3526)
@@ -0,0 +1,100 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+
+
+printHTMLHead( getMLText("my_account") );
+?>
+
+<script language="JavaScript">
+
+function checkForm()
+{
+	msg = "";
+	if (document.form1.pwd.value != document.form1.pwdconf.value) msg += "<?php printMLText("js_pwd_not_conf");?>\n";
+	if (document.form1.fullname.value == "") msg += "<?php printMLText("js_no_name");?>\n";
+	if (document.form1.email.value == "") msg += "<?php printMLText("js_no_email");?>\n";
+	if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+</script>
+
+<?php
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+printStartBox(getMLText("my_account"));
+?>
+
+<form action="../op/op.EditUserData.php" enctype="multipart/form-data" method="post" name="form1" onsubmit="return checkForm();">
+<table>
+	<tr>
+		<td class="inputDescription"><?php printMLText("password");?>:</td>
+		<td><input type="Password" name="pwd"></td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("confirm_pwd");?>:</td>
+		<td><input type="Password" name="pwdconf"></td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("name");?>:</td>
+		<td><input name="fullname" value="<?php print $user->getFullName();?>"></td>
+	</tr>
+	<tr>
+		<td class="inputDescription"><?php printMLText("email");?>:</td>
+		<td><input name="email" value="<?php print $user->getEmail();?>"></td>
+	</tr>
+	<tr>
+		<td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td>
+		<td><textarea name="comment" rows="4" cols="30"><?php print $user->getComment();?></textarea></td>
+	</tr>
+	<tr>
+		<td class="inputDescription" valign="top"><?php printMLText("user_image");?>:</td>
+		<td class="standardText">
+			<?php
+				if ($user->hasImage())
+					print "<img src=\"".$user->getImageURL()."\">";
+				else
+					printMLText("no_user_image");
+			?>
+			
+		</td>
+	</tr>
+	<tr>
+		<td class="inputDescription" valign="top"><?php printMLText("new_user_image");?>:</td>
+		<td class="standardText"><input type="file" name="userfile" accept="image/jpeg"></td>
+	</tr>
+	<tr>
+		<td colspan="2"><br><input type="Submit"></td>
+	</tr>
+</table>
+</form>
+
+<?php
+if (!$user->isAdmin()) {
+	printNextBox(getMLText("personal_default_keywords"));
+	print "<div class=\"standardText\">";
+	print "<a href=\"out.DefaultKeywords.php\">" . getMLText("edit_personal_default_keywords") . "</a>";
+	print "</div>";
+}
+
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.UsrMgr.php
===================================================================
--- /contrib/Dms/out/out.UsrMgr.php	(revision 3526)
+++ /contrib/Dms/out/out.UsrMgr.php	(revision 3526)
@@ -0,0 +1,192 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$users = getAllUsers();
+
+
+printHTMLHead( getMLText("user_management") );
+?>
+<script language="JavaScript">
+
+function checkForm(num)
+{
+	msg = "";
+	eval("var formObj = document.form" + num + ";");
+	
+	if (formObj.login.value == "") msg += "<?php printMLText("js_no_login");?>\n";
+	if ((num == '0') && (formObj.pwd.value == "")) msg += "<?php printMLText("js_no_pwd");?>\n";
+	if (formObj.pwd.value != formObj.pwdconf.value) msg += "<?php printMLText("js_pwd_not_conf");?>\n";
+	if (formObj.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
+	if (formObj.email.value == "") msg += "<?php printMLText("js_no_email");?>\n";
+	if (formObj.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
+	if (msg != "")
+	{
+		alert(msg);
+		return false;
+	}
+	else
+		return true;
+}
+
+
+obj = -1;
+function showUser(selectObj) {
+	if (obj != -1)
+		obj.style.display = "none";
+	
+	id = selectObj.options[selectObj.selectedIndex].value;
+	if (id == -1)
+		return;
+	
+	obj = document.getElementById("keywords" + id);
+	obj.style.display = "";
+}
+
+</script>
+<?php
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+printStartBox(getMLText("add_user"));
+?>
+	<form action="../op/op.UsrMgr.php" method="post" enctype="multipart/form-data" name="form0" onsubmit="return checkForm('0');">
+	<input type="Hidden" name="action" value="adduser">
+	<table>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_login");?>:</td>
+			<td><input name="login"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("password");?>:</td>
+			<td><input name="pwd" type="Password"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription"><?php printMLText("confirm_pwd");?>:</td>
+			<td><input type="Password" name="pwdconf"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_name");?>:</td>
+			<td><input name="name"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("email");?>:</td>
+			<td><input name="email"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td>
+			<td><textarea name="comment" rows="4" cols="30"></textarea></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_image");?>:</td>
+			<td><input type="File" name="userfile"></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+	</form>
+
+<?php
+printNextBox(getMLText("edit_user"));
+?>
+	<table>
+	<tr>
+		<td class="inputDescription"><?php echo getMLText("user_name")?>:</td>
+		<td>
+			<select onchange="showUser(this)">
+				<option value="-1"><?php echo getMLText("choose_user")?>
+				<?php
+				foreach ($users as $currUser) {
+					if (($currUser->getID() == $settings->_adminID) || ($currUser->getID() == $settings->_guestID))
+						continue;
+					
+					print "<option value=\"".$currUser->getID()."\">" . $currUser->getFullName();
+				}
+				?>
+			</select>
+		</td>
+	</tr>
+	<?php
+	foreach ($users as $currUser) {
+		if (($currUser->getID() == $settings->_adminID) || ($currUser->getID() == $settings->_guestID))
+			continue;
+	?>
+	<tr id="keywords<?php echo $currUser->getID()?>" style="display : none;">
+	<td colspan="2">
+	
+	<form action="../op/op.UsrMgr.php" method="post" enctype="multipart/form-data" name="form<?php print $currUser->getID();?>" onsubmit="return checkForm('<?php print $currUser->getID();?>');">
+	<input type="Hidden" name="userid" value="<?php print $currUser->getID();?>">
+	<input type="Hidden" name="action" value="edituser">
+	<table border="0">
+		<tr>
+			<td colspan="2"><hr size="1" width="100%" color="#000080" noshade></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_login");?>:</td>
+			<td class="standardText"><input name="login" value="<?php print $currUser->getLogin();?>"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("password");?>:</td>
+			<td><input type="Password" name="pwd"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription"><?php printMLText("confirm_pwd");?>:</td>
+			<td><input type="Password" name="pwdconf"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_name");?>:</td>
+			<td class="standardText"><input name="name" value="<?php print $currUser->getFullName();?>"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("email");?>:</td>
+			<td class="standardText"><input name="email" value="<?php print $currUser->getEmail();?>"></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td>
+			<td class="standardText"><textarea name="comment" rows="4" cols="30"><?php print $currUser->getComment();?></textarea></td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("user_image");?>:</td>
+			<td class="standardText">
+				<?php
+					if ($currUser->hasImage())
+						print "<img src=\"".$currUser->getImageURL()."\">";
+					else
+						printMLText("no_user_image");
+				?>
+			</td>
+		</tr>
+		<tr>
+			<td class="inputDescription" valign="top"><?php printMLText("new_user_image");?>:</td>
+			<td class="standardText"><input type="file" name="userfile" accept="image/jpeg"></td>
+		</tr>
+		<tr>
+			<td colspan="2"><br><input type="Submit"></td>
+		</tr>
+	</table>
+	</form>
+	<hr size="1" width="80%" color="#000080" noshade>
+	<a class="standardText" href="../op/op.UsrMgr.php?userid=<?php print $currUser->getID();?>&action=removeuser"><img src="images/del.gif" width="15" height="15" border="0" align="absmiddle" alt=""> <?php printMLText("rm_user");?></a>
+	
+	</td>
+	</tr>
+<?php  } ?>
+</table>
+
+<?php
+printEndBox();
+
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/out/out.UserImage.php
===================================================================
--- /contrib/Dms/out/out.UserImage.php	(revision 3526)
+++ /contrib/Dms/out/out.UserImage.php	(revision 3526)
@@ -0,0 +1,30 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Authentication.php");
+
+$myUser = getUser($userid); //es soll ja auch möglich sein, die bilder von anderen anzuzeigen
+
+if (!$myUser->hasImage())
+	die ("Kein Bild verfügbar");
+
+$queryStr = "SELECT * FROM phpgw_mydms_UserImages WHERE userID = " . $userid;
+$resArr = $db->getResultArray($queryStr);
+if (is_bool($resArr) && $resArr == false)
+	return false;
+
+$resArr = $resArr[0];
+
+header("ContentType: " . $resArr["mimeType"]);
+
+print base64_decode($resArr["image"]);
+exit;
+
+?>
Index: /contrib/Dms/TreeMenuSafe.php
===================================================================
--- /contrib/Dms/TreeMenuSafe.php	(revision 3526)
+++ /contrib/Dms/TreeMenuSafe.php	(revision 3526)
@@ -0,0 +1,122 @@
+<?php
+  // TreeMenuSafe.php
+  // Author: Chip Chapin <cchapin@chipchapin.com>
+  // This file is an extension to HTML_TreeMenu, by Richard Heyes.
+  // Much of the code is based on Heyes' client-side JavaScript code.
+  
+  include_once('TreeMenu.php');
+  include_once('ccBrowserInfo.php');
+  
+  // Browser detection determines whether we generate DHTML menus
+  static $tmsDoesMenus = 'maybe';
+  
+
+class HTML_TreeMenuSafe extends HTML_TreeMenu
+{
+  // Constructor
+  function HTML_TreeMenuSafe($layer=null, $images=null, $linkTarget = '_self', $usePersistence = true)
+  {
+    if ($GLOBALS['tmsDoesMenus'] == 'maybe') {
+      $tmb = new ccBrowserInfo();
+      $GLOBALS['tmsDoesMenus'] = ($tmb->is_ie5up() || $tmb->is_moz5up);
+    }
+    HTML_TreeMenu::HTML_TreeMenu($layer, $images, $linkTarget, $usePersistence);
+  } // HTML_TreeMenuSafe
+
+  function printMenu($images=null, $rigidmenu=false, $layer=null)
+  {
+    if (!$rigidmenu && $GLOBALS['tmsDoesMenus']) HTML_TreeMenu::printMenu($images, $layer);
+    elseif (!empty($this->items)) {
+      // Static menu
+      // $images could have been set in the constructor,
+      // so don't assign to it unless a value has been supplied here.
+      // $layer is not used for static menus.
+      if (!empty($images))     $this->images = $images;
+      for ($i=0; $i < count($this->items); $i++) {
+        $this->_printStaticMenu($this, $i);
+      }
+    } // static menu
+  } // printMenu
+
+
+  // 
+  // Helper Functions
+  //
+  
+  // Print HTML for a single menu node
+  // This code is based on the JavaScript function drawMenu().
+  function _printNode($thisnode, $currentlevel, $prepend='', $modifier='')
+  {
+    if (empty($this->images)) {
+      // No images in output
+      $iconimg = '';
+      $imgTag  = '';
+    }
+    else {
+      $gifname   = 'branch';
+      $iconimg   = $thisnode->icon ? sprintf('<img src="%s/%s" width="20" height="20" align="top">', 
+                                       $this->images, $thisnode->icon) : '';
+      $imgTag    = sprintf('<img src="%s/%s%s.gif" width="20" height="20" align="top" border="0" />', 
+                           $this->images, $gifname, $modifier);
+    }
+    $linkStart   = $thisnode->link ? sprintf('<a href="%s" target="%s">', 
+                                       $thisnode->link, $this->linkTarget) : '';
+    $linkEnd     = $thisnode->link ? '</a>' : '';
+    $titleString = $thisnode->text;
+    $styleStart  = '';
+    $styleEnd    = '';
+    if ($thisnode->style == 'auto') {
+      $styleInx = min($currentlevel, count($GLOBALS['_autostyles'])-1);
+      $styleStart = '<span class="' . $GLOBALS['_autostyles'][$styleInx] . '">';
+      $styleEnd   = '</span>';
+    }
+    echo '<nobr>'. $styleStart . $prepend . 
+         (parentLayerID == null && nodes.length == 1 ? '' : $imgTag) .
+         $iconimg .
+         $linkStart . $titleString . $linkEnd . 
+         $styleEnd . "</nobr><br>\n";
+  } // _printNode
+
+
+  // Static menu.
+  // Print current node and all subnodes
+  function _printStaticMenu($nodeParent, $nodeinx, $currentlevel=0, $prepend='')
+  {
+    $thisnode    = $nodeParent->items[$nodeinx];
+    $cntSubnodes = empty($thisnode->items) ? 0 : count($thisnode->items);
+    $cntSiblings = empty($nodeParent->items) ? 0 : count($nodeParent->items);
+
+    // Gif modifier
+    if ($nodeinx == 0 && $currentlevel == 0) $modifier = $cntSubnodes > 1 ? 'top' : 'single';
+    elseif ($nodeinx == ($cntSiblings - 1))  $modifier = 'bottom';
+    else                                     $modifier = '';  
+    $this->_printNode($thisnode, $currentlevel, $prepend, $modifier);
+    
+    // Print any subnodes
+    for ($i=0; $i<$cntSubnodes; $i++) {
+      // Determine what to prepend to child subnode entries.
+      $newPrepend = $prepend;
+      if (empty($this->images)) {
+        // No images.  Use spaces instead
+	$newPrepend .= '&nbsp;&nbsp;';
+      }
+      else {
+        // Prepend images to each menu entry
+        //if ($currentlevel == 0 && $cntSiblings == 1) $nppimg = '';
+	//^^^  This special case does not apply to static menus.
+	//     Why?  Bwaaa Ha Ha Ha Haaaaaaa!!  Try it and see.  Happy Halloween...
+        if ($nodeinx < ($cntSiblings - 1))       $nppimg = 'line.gif';
+        else                                     $nppimg = 'linebottom.gif';
+        $newPrepend .= sprintf('<img ninx=%d csn=%d src="%s/%s" width="20" height="20" align="top">', $nodeinx, $cntSubnodes, $this->images, $nppimg);
+      }
+
+      // Now print the menu entry for this node
+      $this->_printStaticMenu($thisnode, $i, $currentlevel+1, $newPrepend);
+    }
+  } // _printStaticMenu
+
+
+} // class HTML_TreeMenuSafe
+
+	
+?>
Index: /contrib/Dms/inc/inc.AccessUtils.php
===================================================================
--- /contrib/Dms/inc/inc.AccessUtils.php	(revision 3526)
+++ /contrib/Dms/inc/inc.AccessUtils.php	(revision 3526)
@@ -0,0 +1,36 @@
+<?php
+
+define("M_NONE", 1);		//Keine Rechte
+define("M_READ", 2);		//Lese-Recht
+define("M_READWRITE", 3);	//Schreib-Lese-Recht
+define("M_ALL", 4);		//Unbeschränkte Rechte
+
+define("T_FOLDER", 1);		//TargetType = Folder
+define("T_DOCUMENT", 2);	//    "      = Document
+
+//Sortiert aus dem Array $objArr (entweder Folder- oder Document-Objeckte) alle Elemente heraus, auf
+//die der Benutzer $user nicht mindestens den Zugriff $minMode hat und gib die restlichen Elemente zurück
+function filterAccess($objArr, $user, $minMode)
+{
+	$newArr = array();
+	foreach ($objArr as $obj)
+	{
+		if ($obj->getAccessMode($user) >= $minMode)
+			array_push($newArr, $obj);
+	}
+	return $newArr;
+}
+
+//Sortiert aus dem Benutzer-Array $users alle Benutzer heraus, die auf den Ordner oder das Dokument $obj
+//nicht mindestens den Zugriff $minMode haben und gibt die restlichen Benutzer zurück
+function filterUsersByAccess($obj, $users, $minMode)
+{
+	$newArr = array();
+	foreach ($users as $currUser)
+	{
+		if ($obj->getAccessMode($currUser) >= $minMode)
+			array_push($newArr, $currUser);
+	}
+	return $newArr;
+}
+?>
Index: /contrib/Dms/inc/inc.ClassGroup.php
===================================================================
--- /contrib/Dms/inc/inc.ClassGroup.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassGroup.php	(revision 3526)
@@ -0,0 +1,208 @@
+<?php
+
+/**********************************************************************\
+|                 statische, Group-bezogene Funktionen                 |
+\**********************************************************************/
+
+
+function getGroup($id)
+{
+	
+	$name = $GLOBALS['phpgw']->accounts->id2name($id);
+	
+	return new Group($id, $name, '');
+}
+
+
+function getAllGroups()
+{
+	
+	$phpgw_groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+	
+	$groups = array();
+	
+	for ($i = 0; $i < count($phpgw_groups); $i++)
+		$groups[$i] = new Group($phpgw_groups[$i]["account_id"], $phpgw_groups[$i]["account_lid"], '');
+	
+	return $groups;
+}
+
+
+function addGroup($name, $comment)
+{
+	GLOBAl $db;
+	
+	$queryStr = "INSERT INTO phpgw_mydms_Groups (name, comment) VALUES ('".$name."', '" . $comment . "')";
+	if (!$db->getResult($queryStr))
+		return false;
+	
+	return getGroup($db->getInsertID('phpgw_mydms_Groups','id'));
+}
+
+
+/**********************************************************************\
+|                           Group-Klasse                               |
+\**********************************************************************/
+
+class Group
+{
+	var $_id;
+	var $_name;
+
+	function Group($id, $name, $comment)
+	{
+		$this->_id = $id;
+		$this->_name = $name;
+		$this->_comment = $comment;
+	}
+
+	function getID() { return $this->_id; }
+
+	function getName() { return $this->_name; }
+
+	function setName($newName)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Groups SET name = '" . $newName . "' WHERE id = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		$this->_name = $newName;
+		return true;
+	}
+
+	function getComment() { return $this->_comment; }
+
+	function setComment($newComment)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Groups SET comment = '" . $newComment . "' WHERE id = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		$this->_comment = $newComment;
+		return true;
+	}
+
+	function getUsers()
+	{
+		$members = $GLOBALS['phpgw']->accounts->member($this->_id);	
+		$phpgw_group_member = array();
+
+		if (is_array($members))
+		{
+			foreach($members as $member)
+			{
+				if(!in_array($member['account_id'],$phpgw_group_member))
+				{
+					$phpgw_group_member[] = $member['account_id'];
+				}
+			}
+		}
+
+
+		$this->_users = array();
+
+		foreach($phpgw_group_member as $phpgw_member)
+		{
+			$user = getUser($phpgw_member);
+			array_push($this->_users, $user);
+		}
+	
+		return $this->_users;
+	}
+
+	function addUser($user)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "INSERT INTO phpgw_mydms_GroupMembers (groupID, userID) VALUES (".$this->_id.", ".$user->getID().")";
+		$res = $db->getResult($queryStr);
+		if ($res)
+			return false;
+		
+		unset($this->_users);
+		return true;
+	}
+
+	function removeUser($user)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "DELETE FROM phpgw_mydms_GroupMembers WHERE  groupID = ".$this->_id." AND userID = ".$user->getID();
+		$res = $db->getResult($queryStr);
+		if ($res)
+			return false;
+		
+		unset($this->_users);
+		return true;
+	}
+
+	function isMember($user)
+	{
+		//Wenn die User bereits abgefragt wurden, geht's so schneller:
+		if (isset($this->_users))
+		{
+			foreach ($this->_users as $usr)
+				if ($usr->getID() == $user->getID())
+					return true;
+			return false;
+		}
+		
+		
+		$members = $GLOBALS['phpgw']->accounts->member((int)$this->_id);
+                $phpgw_group_member = array();
+
+                if (is_array($members))
+                {
+                        foreach($members as $member)
+                        {
+                                if(!in_array($member['account_id'],$phpgw_group_member))
+                                {
+                                        $phpgw_group_member[] = $member['account_id'];
+                                }
+                        }
+                }
+						
+		if(!in_array($user->getID(),$phpgw_group_member))
+		{
+			return false;
+		}
+		else
+		{
+			return true;
+		}
+
+	}
+
+	/**
+	 * Entfernt die Gruppe aus dem System.
+	 * Dies ist jedoch nicht mit einem Lï¿œschen des entsprechenden Eintrags aus phpgw_mydms_Groups geschehen - vielmehr
+	 * muss dafï¿œr gesorgt werden, dass die Gruppe nirgendwo mehr auftaucht. D.h. auch die Tabellen phpgw_mydms_ACLs,
+	 * phpgw_mydms_Notify und phpgw_mydms_GroupMembers mï¿œssen berï¿œcksichtigt werden.
+	 */
+	function remove()
+	{
+		GLOBAl $db;
+		
+		$queryStr = "DELETE FROM phpgw_mydms_Groups WHERE id = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		$queryStr = "DELETE FROM phpgw_mydms_GroupMembers WHERE groupID = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE groupID = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE groupID = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		return true;
+	}
+}
+
+
+?>
Index: /contrib/Dms/inc/inc.Language.php
===================================================================
--- /contrib/Dms/inc/inc.Language.php	(revision 3526)
+++ /contrib/Dms/inc/inc.Language.php	(revision 3526)
@@ -0,0 +1,50 @@
+<?php
+
+function getLanguages()
+{
+	GLOBAL $settings;
+	
+	$languages = array();
+	
+	$path = $settings->_rootDir . "languages/";
+	$handle = opendir($path);
+	
+	while ($entry = readdir($handle) )
+	{
+		if ($entry == ".." || $entry == ".")
+			continue;
+		else if (is_dir($path . $entry))
+			array_push($languages, $entry);
+	}
+	closedir($handle);
+	
+	return $languages;
+}
+
+include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc";
+
+function getMLText($key, $replace = array())
+{
+	GLOBAL $settings, $text;
+
+	if (!isset($text[$key]))
+		return "Error getting Text: " . $key . " (" . $settings->_language . ")";
+	
+	$tmpText = $text[$key];
+	if (count($replace) == 0)
+		return $GLOBALS['phpgw']->translation->convert($tmpText,'iso-8859-1',$displayCharset);
+	
+	$keys = array_keys($replace);
+	foreach ($keys as $key)
+		$tmpText = str_replace("[".$key."]", $replace[$key], $tmpText);
+
+	return $GLOBALS['phpgw']->translation->convert($tmpText,'iso-8859-1',$displayCharset);
+}
+
+function printMLText($key, $replace = array())
+{
+
+	print getMLText($key, $replace);
+}
+
+?>
Index: /contrib/Dms/inc/inc.ClassAccess.php
===================================================================
--- /contrib/Dms/inc/inc.ClassAccess.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassAccess.php	(revision 3526)
@@ -0,0 +1,53 @@
+<?php
+
+/*
+ * Repräsentiert einen Eintrag in der phpgw_mydms_ACLs für einen User.
+ * Änderungen an der Berechtigung können nicht vorgenommen werden; dafür sind die Klassen Folder und Document selbst
+ * verantwortlich.
+ */
+class UserAccess
+{
+	var $_userID;
+	var $_mode;
+
+	function UserAccess($userID, $mode)
+	{
+		$this->_userID = $userID;
+		$this->_mode = $mode;
+	}
+
+	function getUserID() { return $this->_userID; }
+
+	function getMode() { return $this->_mode; }
+
+	function getUser()
+	{
+		if (!isset($this->_user))
+			$this->_user = getUser($this->_userID);
+		return $this->_user;
+	}
+}
+
+
+class GroupAccess
+{
+	var $_groupID;
+	var $_mode;
+
+	function GroupAccess($groupID, $mode)
+	{
+		$this->_groupID = $groupID;
+		$this->_mode = $mode;
+	}
+
+	function getGroupID() { return $this->_groupID; }
+
+	function getMode() { return $this->_mode; }
+
+	function getGroup()
+	{
+		if (!isset($this->_group))
+			$this->_group = getGroup($this->_groupID);
+		return $this->_group;
+	}
+}
Index: /contrib/Dms/inc/inc.OutUtils.php
===================================================================
--- /contrib/Dms/inc/inc.OutUtils.php	(revision 3526)
+++ /contrib/Dms/inc/inc.OutUtils.php	(revision 3526)
@@ -0,0 +1,533 @@
+<?php
+
+function getThemes()
+{
+	GLOBAL $settings;
+	
+	$themes = array();
+	
+	$path = $settings->_rootDir . "themes/";
+	$handle = opendir($path);
+	
+	while ($entry = readdir($handle) )
+	{
+		if ($entry == ".." || $entry == ".")
+			continue;
+		else if (is_dir($path . $entry))
+			array_push($themes, $entry);
+	}
+	closedir($handle);
+	
+	return $themes;
+}
+
+$theme = $settings->_theme;
+
+function printHTMLHead($title)
+{
+	global $theme;
+
+	$GLOBALS['phpgw_info']['flags'] = array(
+        'currentapp' => 'mydms',
+        'noheader'   => True,
+        'nonavbar'   => True
+);
+	include_once('../../header.inc.php');
+	
+	if(!@is_object($GLOBALS['phpgw']->js))
+	{
+		$GLOBALS['phpgw']->js =& CreateObject('phpgwapi.javascript');
+	}
+	$GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon');
+	$GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXTree');
+
+	$GLOBALS['phpgw']->js->validate_file('jscode','mydms','mydms');
+                        
+	$GLOBALS['phpgw']->common->phpgw_header();
+	echo parse_navbar();
+
+	if ( is_file("../themes/$theme/styles.css") )
+		$stylesheet="../themes/$theme/styles.css";
+	else
+		$stylesheet="../themes/default/styles.css";
+	
+	if ( is_file("../themes/$theme/HTMLHead.html" ) )
+		include("../themes/$theme/HTMLHead.html");
+	else
+		include("../themes/default/HTMLHead.html");
+}
+
+function printHTMLFoot()
+{
+	global $theme;
+
+	$GLOBALS['phpgw']->common->phpgw_footer();	
+	if ( is_file("../themes/$theme/HTMLFoot.html" ) )
+	{
+		include("../themes/$theme/HTMLFoot.html");
+	} else {
+		include("../themes/default/HTMLFoot.html");
+	}
+}
+
+function printStartBox($header)
+{
+	global $theme;
+	
+	if ( is_file("../themes/$theme/StartBox.html" ) )
+	{
+		include("../themes/$theme/StartBox.html");
+	} else {
+		include("../themes/default/StartBox.html");
+	}
+}
+
+function printNextBox($header)
+{
+	global $theme;
+	
+	if ( is_file("../themes/$theme/NextBox.html" ) )
+	{
+		include("../themes/$theme/NextBox.html");
+	} else {
+		include("../themes/default/NextBox.html");
+	}
+}
+
+function printEndBox()
+{
+	global $theme;
+	
+	if ( is_file("../themes/$theme/EndBox.html" ) )
+	{
+		include("../themes/$theme/EndBox.html");
+	} else {
+		include("../themes/default/EndBox.html");
+	}
+}
+
+function printCenterStart()
+{
+	print "<table width=\"100%\" height=\"60%\"><tr><td align=\"center\" valign=\"middle\">";
+}
+
+function printCenterEnd()
+{
+	print "</td></tr></table>";
+}
+
+function printGoBack()
+{
+	print "<p><a href=\"javascript:history.back()\">".getMLText("back")."</a>";
+}
+
+function printGoto($targets)
+{
+	print "<p>".getMLText("goto").": ";
+	for ($i = 0; $i < count($targets); $i++)
+	{
+		print "<a href=\"".$targets[$i][1]."\">".$targets[$i][0]."</a>";
+		if ($i+1 < count($targets))
+			print " | ";
+	}
+}
+
+
+function printTitleBar($folder)
+{
+	return; 
+	
+	global $user, $settings, $theme;
+	
+	$options=array();
+	$options[getMLText("content")]=$settings->_httpRoot . "out/out.ViewFolder.php?folderid=" . $folder->getID();
+	$options[getMLText("search")]=$settings->_httpRoot . "out/out.SearchForm.php?folderid=" . $folder->getID();
+	
+	if ($user->getID() != $settings->_guestID)
+		//$options[getMLText("my_account")]=$settings->_httpRoot . "out/out.EditUserData.php";
+	
+	if ($user->isAdmin())
+	{
+		$options[getMLText("admin_tools")] = $settings->_httpRoot . "out/out.AdminTools.php";
+	//	$options[getMLText("user_management")]=$settings->_httpRoot . "out/out.UsrMgr.php";
+	//	$options[getMLText("group_management")]=$settings->_httpRoot . "out/out.GroupMgr.php";
+	} else
+		$options[getMLText("user_list")]=$settings->_httpRoot . "out/out.UserList.php";
+	
+	//$options[getMLText("logout")]=$settings->_httpRoot . "op/op.Logout.php";
+	
+	$title=getMLText("logged_in_as")." ".$user->getFullName();
+	$menu = buildMenu( $options, "titlebar" );
+	
+	if ( is_file("../themes/$theme/TitleBar.html" ) )
+	{
+		include("../themes/$theme/TitleBar.html");
+	} else {
+		include("../themes/default/TitleBar.html");
+	}
+}
+
+
+function printFolderTree($path, $level = 0, $activeObj, $isFolder)
+{
+	GLOBAL $user;
+
+	#$folder = $path[$level];
+	#$subFolders = $folder->getSubFolders();
+	#$subFolders = filterAccess($subFolders, $user, M_READ);
+
+	$allSubFolders = array();
+	foreach($path as $folderObject)
+	{
+		$allSubFolders['_id'.$folderObject->getID()] = $folderObject;
+		$subFoldersL1 = $folderObject->getSubFolders();
+		foreach((array)$subFoldersL1 as $subFolderL1Object)
+		{
+			$allSubFolders['_id'.$subFolderL1Object->getID()] = $subFolderL1Object;
+			$subFoldersL2 = $subFolderL1Object->getSubFolders();
+			foreach((array)$subFoldersL2 as $subFolderL2Object)
+			{
+				$allSubFolders['_id'.$subFolderL2Object->getID()] = $subFolderL2Object;
+			}
+		}
+	}
+
+	$uimydms =& CreateObject('mydms.uimydms');
+	print $uimydms->folderChooser($allSubFolders, $activeObj);
+	
+	return; 
+}
+
+
+function printFolderPageStart($folder)
+{
+	global $theme;
+	
+	$uimydms =& CreateObject('mydms.uimydms');
+	
+	$title1 = getMLText("foldertree");
+	$title2 = "<img src='".getImgPath("folder_opened.gif")."' ".
+	               "width='18' height='18' alt='' border='0' align='absmiddle'> ".
+	  	  getMLText("selected_folder") . ": " . $folder->getName();
+	$path = $folder->getPathNew();
+
+	$txtpath = '';
+if($path!=''){
+	foreach($path as $folderObject)
+	{
+		if(!empty($txtpath)) $txtpath .= " / ";
+		$txtpath .= "<a class=\"path\" href=\"out.ViewFolder.php?folderid=".$folderObject->getID()."\">".
+		            $folderObject->getName()."</a>";
+	}
+}
+	
+	$txtpath = getMLText("folder_path") . ": " . $txtpath;
+	
+	if ( is_file("../themes/$theme/FolderPageStart.html" ) )
+	{
+		include("../themes/$theme/FolderPageStart.html");
+	} else {
+		include("../themes/default/FolderPageStart.html");
+	}
+	
+}
+
+function printFolderPageEnd($folder)
+{
+	GLOBAL $user, $theme;
+
+	$title = getMLText("edit_folder");
+	$options=array();
+	$accessMode = $folder->getAccessMode($user);
+	if ($accessMode >= M_READWRITE)
+	{
+		$options[getMLText("add_subfolder")] = "out.AddSubFolder.php?folderid=" . $folder->getID();
+		$options[getMLText("add_document")] = "out.AddDocument.php?folderid=" . $folder->getID();
+		$options[getMLText("edit_folder_props")] = "out.EditFolder.php?folderid=" . $folder->getID();
+		$options[getMLText("edit_folder_notify")] = "out.FolderNotify.php?folderid=" . $folder->getID();
+		$options[getMLText("move_folder")] = "out.MoveFolder.php?folderid=" . $folder->getID();
+	}
+	
+	if ($accessMode == M_ALL)
+	{
+		$options[getMLText("rm_folder")] = "out.RemoveFolder.php?folderid=" . $folder->getID();
+		$options[getMLText("edit_folder_access")] = "out.FolderAccess.php?folderid=" . $folder->getID();
+	}
+	
+	$menu=buildMenu( $options, "editfolder" );
+	
+	if ( is_file("../themes/$theme/FolderPageEnd.html" ) )
+	{
+		include("../themes/$theme/FolderPageEnd.html");
+	} else {
+		include("../themes/default/FolderPageEnd.html");
+	}
+}
+
+function printPageHeader($header)
+{
+	print "<p><div class=\"pageHeader\">".$header."</div></p>\n";
+}
+
+function printDocumentPageStart($document)
+{
+	global $theme;
+
+	$uimydms =& CreateObject('mydms.uimydms');
+	
+	$folder = $document->getFolder();
+	$title1 = getMLText("foldertree");
+	$title2 = "<img src='".getImgPath("file.gif")."' ".
+	               "width='18' height='18' alt='' border='0' align='absmiddle'> ".
+	  	  getMLText("selected_document") . ": " . $document->getName();
+
+	$path = $folder->getPathNew();
+
+	$txtpath = '';
+	foreach($path as $folderObject)
+	{
+		if(!empty($txtpath)) $txtpath .= " / ";
+		$txtpath .= "<a class=\"path\" href=\"out.ViewFolder.php?folderid=".$folderObject->getID()."\">".
+		            $folderObject->getName()."</a>";
+	}
+	
+	$txtpath = getMLText("folder_path") . ": " . $txtpath;
+
+	if ( is_file("../themes/$theme/DocumentPageStart.html" ) )
+	{
+		include("../themes/$theme/DocumentPageStart.html");
+	} else {
+		include("../themes/default/DocumentPageStart.html");
+	}
+}
+
+function printDocumentPageEnd($document)
+{
+	GLOBAL $user, $theme;
+	
+	$docid=".php?documentid=" . $document->getID();
+	$title = getMLText("edit_document");
+	$options=array();
+	$accessMode = $document->getAccessMode($user);
+	if ($accessMode >= M_READWRITE)
+	{
+	  if (!$document->isLocked())
+	  {
+	    $options[getMLText("update_document")]	= "out.UpdateDocument" . $docid;
+	    $options[getMLText("lock_document")]	= "../op/op.LockDocument" . $docid;
+	    $options[getMLText("edit_document_props")]	= "out.EditDocument" . $docid;
+	    $options[getMLText("expires")]		= "out.SetExpires" . $docid;
+	    $options[getMLText("edit_document_notify")]	= "out.DocumentNotify" . $docid;
+	    $options[getMLText("move_document")]	= "out.MoveDocument" . $docid;
+ 	  } else {
+	    $lockingUser = $document->getLockingUser();
+	    if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL))
+	    {
+	      $options[getMLText("update_document")]	= "out.UpdateDocument" . $docid;
+	      $options[getMLText("unlock_document")]	= "../op/op.UnlockDocument" . $docid;
+	      $options[getMLText("edit_document_props")]= "out.EditDocument" . $docid;
+	      $options[getMLText("expires")]		= "out.SetExpires" . $docid;
+	      $options[getMLText("edit_document_notify")]= "out.DocumentNotify" . $docid;
+	      $options[getMLText("move_document")]	= "out.MoveDocument" . $docid;
+	    }
+	  }
+	}
+	
+	if ($accessMode == M_ALL)
+	{
+	  $options[getMLText("rm_document")]		= "out.RemoveDocument" . $docid;
+	  $options[getMLText("edit_document_access")]	= "out.DocumentAccess" . $docid;
+	}
+	
+	$menu=buildMenu( $options, "editfolder" );
+	
+	if ( is_file("../themes/$theme/DocumentPageEnd.html" ) )
+	{
+		include("../themes/$theme/DocumentPageEnd.html");
+	} else {
+		include("../themes/default/DocumentPageEnd.html");
+	}
+}
+
+function printDateChooser($defDate = -1, $varName)
+{
+	if ($defDate == -1)
+		$defDate = mktime();
+	$day   = date("d", $defDate);
+	$month = date("m", $defDate);
+	$year  = date("Y", $defDate);
+	
+	print "<select name=\"" . $varName . "day\">\n";
+	for ($i = 1; $i <= 31; $i++)
+	{
+		print "<option value=\"" . $i . "\"";
+		if (intval($day) == $i)
+			print " selected";
+		print ">" . $i . "</option>\n";
+	}
+	print "</select>.\n";
+	print "<select name=\"" . $varName . "month\">\n";
+	for ($i = 1; $i <= 12; $i++)
+	{
+		print "<option value=\"" . $i . "\"";
+		if (intval($month) == $i)
+			print " selected";
+		print ">" . $i . "</option>\n";
+	}
+	print "</select>.\n";
+	print "<select name=\"" . $varName . "year\">\n";
+	for ($i = 2004; $i <= 2010; $i++)
+	{
+		print "<option value=\"" . $i . "\"";
+		if (intval($year) == $i)
+			print " selected";
+		print ">" . $i . "</option>\n";
+	}
+	print "</select>";
+}
+
+
+function printSequenceChooser($objArr, $keepID = -1)
+{
+	if (count($objArr) > 0)
+	{
+		$max = $objArr[count($objArr)-1]->getSequence() + 1;
+		$min = $objArr[0]->getSequence() - 1;
+	}
+	else
+		$max = 1.0;
+	
+	print "<select name=\"sequence\">\n";
+	if ($keepID != -1)
+		print "  <option value=\"keep\">" . getMLText("seq_keep");
+	print "  <option value=\"".$max."\">" . getMLText("seq_end");
+	if (count($objArr) > 0)
+		print "  <option value=\"".$min."\">" . getMLText("seq_start");
+	
+	for ($i = 0; $i < count($objArr) - 1; $i++)
+	{
+		if (($objArr[$i]->getID() == $keepID) || (($i + 1 < count($objArr)) && ($objArr[$i+1]->getID() == $keepID)))
+			continue;
+		$index = ($objArr[$i]->getSequence() + $objArr[$i+1]->getSequence()) / 2;
+		print "  <option value=\"".$index."\">" . getMLText("seq_after", array("prevname" => $objArr[$i]->getName() ) );
+	}
+	
+	print "</select>";
+}
+
+function printDocumentChooser($formName) {
+	GLOBAL $settings;
+	?>
+	<script language="JavaScript">
+	var openDlg;
+	function chooseDoc() {
+		openDlg = open("out.DocumentChooser.php?folderid=<?php echo $settings->_rootFolderID?>&form=<?php echo urlencode($formName)?>", "openDlg", "width=300,height=450,scrollbars=yes,resizable=yes,status=yes");
+	}
+	</script>
+	<?php
+	print "<input type=\"Hidden\" name=\"docid\">";
+	print "<input disabled name=\"docname\">";
+	print "&nbsp;&nbsp;<input type=\"Button\" value=\"Open...\" onclick=\"chooseDoc();\">";
+}
+
+
+function printFolderChooser($formName, $accessMode, $exclude = -1, $default = false) {
+	GLOBAL $settings;
+	
+	$linkData = array
+	(
+		'menuaction'	=> 'mydms.uimydms.folderChooser',
+		'form'		=> $formName,
+		'mode'		=> $accessMode,
+		'exlcude'	=> $exclude,
+		'folderid'	=> $settings->_rootFolderID
+	);
+	$link = $GLOBALS['phpgw']->link('/index.php',$linkData);
+	
+	?>
+	<script language="JavaScript">
+	var openDlg;
+	function chooseDoc() {
+		//openDlg = open("out.FolderChooser.php?form=<?php echo $formName?>&mode=<?php echo $accessMode?>&exclude=<?php echo $exclude?>&folderid=<?php echo $settings->_rootFolderID?>", "openDlg", "width=300,height=450,scrollbars=yes,resizable=yes,status=yes");
+		openDlg = open("<?php echo $link?>", "openDlg", "width=300,height=450,scrollbars=yes,resizable=yes,status=yes");
+	}
+	</script>
+	<?php
+	print "<input type=\"Hidden\" name=\"targetid\" value=\"". (($default) ? $default->getID() : "") ."\">";
+	print "<input disabled name=\"targetname\" value=\"". (($default) ? $default->getName() : "") ."\">";
+	print "&nbsp;&nbsp;<input type=\"Button\" value=\"Open...\" onclick=\"chooseDoc();\">";
+}
+
+/* ---------------------------------------- ICONS --------------------------------------------- */
+
+$icons = array();
+$icons["txt"]  = "txt.png";
+$icons["doc"]  = "word.png";
+$icons["rtf"]  = "document.png";
+$icons["xls"]  = "excel.png";
+$icons["ppt"]  = "powerpoint.png";
+$icons["exe"]  = "binary.png";
+$icons["html"] = "html.png";
+$icons["htm"]  = "html.png";
+$icons["gif"]  = "image.png";
+$icons["jpg"]  = "image.png";
+$icons["bmp"]  = "image.png";
+$icons["png"]  = "image.png";
+$icons["log"]  = "log.png";
+$icons["midi"] = "midi.png";
+$icons["pdf"]  = "pdf.png";
+$icons["wav"]  = "sound.png";
+$icons["mp3"]  = "sound.png";
+$icons["c"]    = "source_c.png";
+$icons["cpp"]  = "source_cpp.png";
+$icons["h"]    = "source_h.png";
+$icons["java"] = "source_java.png";
+$icons["py"]   = "source_py.png";
+$icons["tar"]  = "tar.png";
+$icons["gz"]   = "gz.png";
+$icons["zip"]  = "gz.png";
+$icons["mpg"]  = "video.png";
+$icons["avi"]  = "video.png";
+$icons["tex"]  = "tex.png";
+$icons["default"] = "default.png";
+
+function getImgPath($img) {
+  global $theme;
+  
+  if ( is_file("../themes/$theme/images/$img") )
+  {
+    return "../themes/$theme/images/$img";
+  }
+  return "../out/images/$img";
+}
+
+function printImgPath($img)
+{
+  print getImgPath($img);
+}
+
+function buildMenu( $options , $class="titlebar" )
+{
+    $sep = "";
+	$menu = "";
+	reset($options);
+	while ( list($desc,$url) = each($options) )
+	{
+		$menu.=$sep;
+		$menu.="<nobr><a href='$url' class='$class'>$desc</a></nobr>\n";
+		$sep=" | \n";
+	}
+	return $menu;
+}
+
+function getMimeIcon($fileType)
+{
+	GLOBAL $icons;
+	
+	$ext = substr($fileType, 1);
+	if (isset($icons[$ext]))
+		return $icons[$ext];
+	else
+		return $icons["default"];
+}
+?>
Index: /contrib/Dms/inc/class.uimydms.inc.php
===================================================================
--- /contrib/Dms/inc/class.uimydms.inc.php	(revision 3526)
+++ /contrib/Dms/inc/class.uimydms.inc.php	(revision 3526)
@@ -0,0 +1,1328 @@
+<?php
+	/***************************************************************************\
+	* eGroupWare - mydms                                                        *
+	* http://www.linux-at-work.de                                               *
+	* http://www.phpgw.de                                                       *
+	* http://www.egroupware.org                                                 *
+	* Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
+	* -------------------------------------------------                         *
+	* 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.                       *
+	\***************************************************************************/
+	
+	/* $Id: class.uimydms.inc.php 22794 2006-11-06 05:53:11Z lkneschke $ */
+
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.Settings.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.AccessUtils.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassAccess.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassUser.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassGroup.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassFolder.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassDocument.php');
+
+	class uimydms
+	{
+		var $icons = array(
+			'txt'	=> 'txt.png',
+			'doc'	=> 'word.png',
+			'rtf'	=> 'document.png',
+			'xls'	=> 'excel.png',
+			'ppt'	=> 'powerpoint.png',
+			'exe'	=> 'binary.png',
+			'html'	=> 'html.png',
+			'htm'	=> 'html.png',
+			'gif'	=> 'image.png',
+			'jpg'	=> 'image.png',
+			'bmp'	=> 'image.png',
+			'png'	=> 'image.png',
+			'log'	=> 'log.png',
+			'midi'	=> 'midi.png',
+			'pdf'	=> 'pdf.png',
+			'wav'	=> 'sound.png',
+			'mp3'	=> 'sound.png',
+			'c'	=> 'source_c.png',
+			'cpp'	=> 'source_cpp.png',
+			'h'	=> 'source_h.png',
+			'java'	=> 'source_java.png',
+			'py'	=> 'source_py.png',
+			'tar'	=> 'tar.png',
+			'gz'	=> 'gz.png',
+			'zip'	=> 'gz.png',
+			'mpg'	=> 'video.png',
+			'avi'	=> 'video.png',
+			'tex'	=> 'tex.png',
+			'default' => 'default.png',
+		);
+
+		var $public_functions = array
+		(
+			'addACL'		=> 'true',
+			'addNotification'	=> 'true',
+			'deleteACL'		=> 'true',
+			'deleteDocument'	=> 'true',
+			'deleteFile'		=> 'true',
+			'deleteNotification'	=> 'true',
+			'folderChooser'		=> 'true',
+			'inheritACL'		=> 'true',
+			'setDefaultAccess'	=> 'true',
+			'updateACL'		=> 'true',
+			'updateDocument'	=> 'true',
+			'updateFile'		=> 'true',
+			'setOwner'		=> 'true',
+			'viewDocument'		=> 'true',
+		);
+		
+		function uimydms()
+		{
+			$this->t 		=& CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+			$this->bomydms 		=& CreateObject('mydms.bomydms');
+
+			if (!is_object($GLOBALS['phpgw']->jscalendar))
+			{
+				$GLOBALS['phpgw']->jscalendar = CreateObject('phpgwapi.jscalendar');
+			}
+		}
+
+		function addACL()
+		{
+			$userID		= (int)$_POST['userid'];
+			$groupID	= (int)$_POST['groupid'];
+			$access		= (int)$_POST['access'];
+			
+			$documentID	= (int)$_GET['documentid'];
+
+			if($documentID)
+			{
+				$this->bomydms->addACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID), $access);
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function addNotification()
+		{
+			$userID		= $_POST['userid'];
+			$groupID	= $_POST['groupid'];
+			
+			$documentID	= (int)$_GET['documentid'];
+
+			if($documentID)
+			{
+				$this->bomydms->addNotification($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID));
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function folderChooser($_folderID=false)
+		{
+			$folderID = ($_folderID === false ? (int)$_GET['folderid'] : $_folderID);
+			$formName = $_GET['form'];
+			
+			$folder = getFolder($folderID);
+
+			$this->display_app_header();
+		
+			$this->t->set_file(array("folderChooser" => "folderChooser.tpl"));
+			$this->t->set_block('folderChooser', 'main', 'main');
+
+			$this->t->set_var('folderTree',$this->getFolderTree($folder->getPathNew(), 0, $folder, true));
+			$this->t->set_var('formName',$formName);
+
+			$this->t->parse("out","main");
+			
+			print $this->t->get('out','main');
+		}
+
+		/**
+		* create a folder tree
+		*
+		* this function will create a foldertree based on javascript
+		* on click the sorounding form gets submitted
+		*
+		* @param _folders array containing the list of folders
+		* @param _selected string containing the selected folder
+		* @param _topFolderName string containing the top folder name
+		* @param _topFolderDescription string containing the description for the top folder
+		* @param _formName string name of the sorounding form
+		* @param _hiddenVar string hidden form value, transports the selected folder
+		*
+		* @return string the html code, to be added into the template
+		*/
+		function createHTMLFolder($_folders, $_selected, $_divName, $_displayCheckBox=false)
+		{
+			
+
+?>
+<table border=0 padding=0 valign=top width=250px><tr><td valign=top>
+<div id=NAVTREE style="position:static">NAVTREE</div>
+</td></tr></table>
+<style>.navs_action {font-size: 8pt; font-family: Arial, Helvetica}.navs_tree {font-size: 8pt; font-family: Arial, Helvetica}.navs_content {border: 2 groove; padding: 5; font-size: 8pt; font-family: Arial, Helvetica}</style>
+
+
+<script language="JavaScript" type="text/javascript">
+
+// variables
+var nodes_array = new Array();
+var current_document = -1;
+
+var nav_div_id='NAVTREE';
+var nav_root = 0;
+var nav_tree = new Array();   // nav_tree
+var nav_type = new Array();
+
+var outmsg="";
+// var indentation
+var indent_width = 20;
+var indent_height = 10
+// image file
+var img_hsize = 40;
+var img_vsize = 20;
+var img_plus   = "../images/nav_plus.gif";
+var img_minus  = "../images/nav_minus.gif";
+var img_spacer  = "../images/nav_spacer.gif";
+var img_box  = "../images/nav_box.gif";
+
+//--------------------------------------------------------------
+// Define type of node
+
+function DefineType(tname, img_prefix)
+{   this.name = tname;
+    this.img_prefix = img_prefix;
+    // preload image
+    var temp_image = new Image(img_hsize, img_vsize);
+    temp_image.src = img_prefix + "_collapse.gif";
+    var temp_image = new Image(img_hsize, img_vsize);
+    temp_image.src = img_prefix + "_expand.gif";
+    var temp_image = new Image(img_hsize, img_vsize);
+    temp_image.src = img_prefix + "_open.gif";
+    var temp_image = new Image(img_hsize, img_vsize);
+    temp_image.src = img_prefix + "_close.gif";
+
+}
+
+function CreateType(tname, img_prefix)
+{   var tid = nav_type.length;
+    nav_type[tid] = new DefineType(tname, img_prefix);
+    return tid;
+}
+
+//--------------------------------------------------------------
+// This function creates a node in the tree with the following arguments:
+//    parent - parent node number
+//    Type   -  F: folder    D: document
+//    state - O: Open    C: Close
+//    header -  header to be displayed when closed
+//    content   -  detail data to be displayed when opened
+function DefineNode(parent, type, state, header, content)
+{   this.parent = parent;
+    this.state = state;
+    this.type = type;
+    this.header = header;
+    this.content = content;
+    this.child = 0;
+}
+
+function CreateNode(parent, type, state, header, content)
+{   var id = nav_tree.length;
+    nav_tree[id] = new DefineNode(parent, type, state, header, content);
+    if ( parent >= 0)
+        nav_tree[parent].child ++;
+    return id;
+}
+
+//--------------------------------------------------------------
+function output(msg)
+{   outmsg += msg;
+}
+
+//--------------------------------------------------------------
+function WriteActionAll(nav_root, nav_root_level, nav_div_id)
+{
+    outmsg="";
+    // Display collapse all, expand all icon
+    output('<span class=navs_action>');
+    output('<a href=\'javascript:change_all("open",'
+            + nav_root+ ',' + nav_root_level + ',"'+nav_div_id+'")\'>');
+    output('<img src='+img_plus+' border="0"></a>Expand All&nbsp;');
+    output('<a href=\'javascript:change_all("close",'
+            + nav_root+ ',' + nav_root_level + ',"'+nav_div_id+'")\'>');
+    output('<img src='+img_minus+' border="0"></a>Collapse All<p>');
+    output('<\/span>');
+    // now print it out
+    element = document.all[nav_div_id];
+    element.innerHTML = outmsg;
+}
+
+
+
+//--------------------------------------------------------------
+function WriteMenu(nav_root, nav_root_level, nav_div_id)
+{
+    outmsg="";
+    // Create a table for each node
+    WriteSubTree(nav_root, nav_root_level, nav_root, nav_root_level, nav_div_id);
+    // now print it out
+    element = document.all[nav_div_id];
+
+    element.innerHTML = outmsg;
+}
+
+//----------------------------------------------------------------
+// This function writes all the child node for whatever
+// parent node is specified as the argument. Note that
+// this function is called recursively whenever any
+// child node has children of its own.
+function WriteSubTree(id, level, nav_root, nav_root_level, nav_div_id)
+{
+    var child_id;
+    var indent_space;
+
+    // Write this node data first, don't write main node
+    if ( level >= 0 )
+    {   // use table for breaking up column
+        output('<table class=navs_tree border="0" cellspacing="0" cellpadding="0" width=100%>');
+        //--- determine indentation level
+        indent = level* indent_width + 1;
+        output('<tr><td width='+indent+'><img src='+img_spacer+
+           ' width=' +indent +
+           ' height='+indent_height+'>');
+        //--- display open/collapse action icon
+        output('<td width='+indent_width+'>');
+        if ( nav_tree[id].child == 0 )
+        {   output('<img src='+img_spacer+
+                   ' width=' + indent_width +
+                   ' height='+indent_height+'>');
+        }
+        else
+        {   // determine action
+            if (nav_tree[id].state == "open")
+                img_src = "_collapse.gif";
+            else
+                img_src = "_expand.gif";
+            // extract image node type
+            node_type = nav_tree[id].type;
+            img_src = nav_type[node_type].img_prefix + img_src;
+            // display it
+            output('<a href=\'javascript:toggle_state('
+                   + id + ',' + nav_root + "," + nav_root_level +
+                   ',"' + nav_div_id+ '")\'>');
+            output('<img src="'+img_src+'" border=0><\/a>')
+        }
+        //--- display item state
+        output('<td width='+indent_width+'>');
+        node_type = nav_tree[id].type;
+        img_src=nav_type[node_type].img_prefix + "_"+nav_tree[id].state+".gif";
+        output('<a href=\'javascript:toggle_state('
+                   + id + ',' + nav_root + "," + nav_root_level +
+                   ',"' + nav_div_id+ '")\'>');
+        output('<img src="'+img_src+'" border=0><\/a>')
+        //--- display header and detail
+        output("<td><b>"+nav_tree[id].header+"<\/b>");
+        if (nav_tree[id].state == "open" && nav_tree[id].content != "")
+        {   output("<tr><td colspan=3><td class=navs_content>"+nav_tree[id].content);
+        }
+        output("<\/table>");
+    }
+    //--- Run through all of the parent's child nodes
+    if (nav_tree[id].state == "open" || level < 0)
+    {   for (child_id = 0; child_id < nav_tree.length; child_id++)
+        {   // skip if the parent is different >
+            if ( nav_tree[child_id].parent == id && child_id != id )
+                WriteSubTree(child_id, level+1, nav_root, nav_root_level, nav_div_id);
+        } // for each node
+    }
+} // function WriteSubTree
+
+function toggle_state(id, root, root_level, nav_div_id)
+{   // toggle the state
+    current_state = nav_tree[id].state;
+    if (current_state == "open")
+        nav_tree[id].state = "close";
+    else
+        nav_tree[id].state = "open";
+    // Rewrite the menu
+    timeout_id = setTimeout('WriteMenu('+root+','+root_level+',"'+nav_div_id+'")', 50)
+}
+
+function change_all(new_state, root, root_level, nav_div_id)
+{   var current_node;
+    // change current nod
+    nav_tree[root].state = new_state;
+    // Run through the global nodes_array
+    for (counter = 0; counter < nav_tree.length; counter++)
+    {   if (nav_tree[counter].parent == root)
+            change_all(new_state, counter, 0, "")
+    }
+    // Rewrite the menu
+    if ( nav_div_id != "")
+        timeout_id = setTimeout('WriteMenu('+root+','+root_level+',"'+nav_div_id+'")', 50)
+}
+
+</script>
+
+
+
+<?php
+
+  // Menu01 -- This is from the original example
+
+$this->db = clone($GLOBALS['phpgw']->db);
+		$this->db->set_app('mydms');
+
+
+//$queryStr0 = "SELECT distinct parent FROM phpgw_mydms_Folders";
+$queryStr0 ="select parent,id,SEQUENCE,name  FROM phpgw_mydms_Folders ORDER BY parent,sequence";
+
+
+
+
+$resArr0 = $GLOBALS['mydms']->db->getResultArray($queryStr0);
+
+//$node0 = new HTML_TreeNode($resArr[$i]["name"], "mydms/out/out.ViewFolder.php?menuaction=dummy&folderid=1", $icon);
+
+
+$txt="<script language=\"JavaScript\" type=\"text/javascript\">nav_type0=CreateType('Folder', '../images/folder');";	
+
+$txt=$txt." "."nav_type1=CreateType('Document', '../images/document');";
+
+
+//$txt=$txt." "."nav_tree0=CreateNode(-1, 0, 'close', 'Carpetas Compartidas', '');";
+
+for ($i = 0; $i < count($resArr0); $i++)
+{
+
+//$n=$i-1;
+//$defaultpos[$i]=$n;
+$defaultposicion=$i;
+$defaultparent[$resArr0[$i]["id"]]=$resArr0[$i]["parent"];
+$defaultid[$resArr0[$i]["id"]]=$resArr0[$i]["id"];
+$defaultnombre[$resArr0[$i]["id"]]=$defaultposicion;
+if($i==0){
+	$defaultvalor[$resArr0[$i]["id"]]="-1";
+}else{
+
+$defaultvalor[$resArr0[$i]["id"]]=$defaultnombre[$resArr0[$i]["parent"]];
+}
+
+//echo $resArr0[$i]["name"]." , ".$defaultvalor[$i]." , ".$defaultparent[$i]." , ".$defaultid[$i]."   ".$defaultvalor[$resArr0[$i]["id"]]."<br>";
+
+}
+
+
+
+$queryStr0 = "SELECT distinct parent FROM phpgw_mydms_Folders";
+
+
+$resArr0 = $GLOBALS['mydms']->db->getResultArray($queryStr0);
+
+//$node0 = new HTML_TreeNode($resArr[$i]["name"], "mydms/out/out.ViewFolder.php?menuaction=dummy&folderid=1", $icon);
+
+
+$txt="<script language=\"JavaScript\" type=\"text/javascript\">nav_type0=CreateType('Folder', '../images/folder');";	
+
+$txt=$txt." "."nav_type1=CreateType('Document', '../images/document');";
+
+
+//$txt=$txt." "."nav_tree0=CreateNode(-1, 0, 'close', 'Carpetas Compartidas', '');";
+
+for ($i = 0; $i < count($resArr0); $i++)
+{
+
+
+if($valores=='')
+{
+$valores=$resArr0[$i]["parent"];
+}else
+{
+$valores=$valores.",".$resArr0[$i]["parent"];
+}
+
+}
+
+//$txt=$txt." "."nav_tree0=CreateNode(".$n.", 0, 'close', '".$resArr[$i]["name"]."', '');";
+//echo $resArr[$i]["parent"]."<br>";
+
+$queryStr = "SELECT * FROM phpgw_mydms_Folders WHERE parent in (".$valores.") ORDER BY parent,sequence";
+
+
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+	
+
+	
+			//$this->_subFolders = array();
+			for ($ii = 0; $ii < count($resArr); $ii++)
+			{
+				
+$valor0=$ii+1;
+
+$valor1="node";
+
+
+
+$valor2=$valor1.$ii;
+
+
+//echo "JJJJJJ".$_GET['folderid']."<br>";
+
+
+$Activo="close";
+if(($resArr[$ii]["id"]==$_GET['folderid'] )||($resArr[$ii]["id"]==1))
+{
+$Activo="open";
+}
+$ver=$_GET['folderid'];
+while ($ver!=''&&$ver!=1){
+
+//echo $ver."<br>";
+if($resArr[$ii]["id"]==$defaultparent[$ver]){
+$Activo="open";
+}
+$ver=$defaultparent[$ver];
+
+}
+
+
+
+$txt=$txt." "."nav_tree1=CreateNode(".$defaultvalor[$resArr[$ii]["id"]].",0, '".$Activo."', '<a href=out.ViewFolder.php?menuaction=dummy&folderid=".$resArr[$ii]["id"]." >".$resArr[$ii]["name"]."</a>', '');";
+
+
+
+
+//$txt=$txt." $".$valor1.$valor0."= $".$valor2."->addItem(new HTML_TreeNode(\"".$resArr[$ii]["name"]."\",\"mydms/out///out.ViewFolder.php?menuaction=dummy&folderid=".$resArr[$ii]["id"]."\",\"".$icon."\"));";
+
+
+
+//$valor2=$node0->addItem(new HTML_TreeNode($resArr[$ii]["name"], "mydms/out/out.ViewFolder.php?menuaction=dummy&folderid=".$resArr[$ii]["id"], $icon));
+//echo $resArr[$ii]["id"]."   ".$resArr[$ii]["name"]."  ". $n."_".$i. "<br>  ";
+
+
+			}	
+
+
+//}
+//$txt=$txt." "."$menu02  = new HTML_TreeMenu(\"menuLayer02\", '../imagesAlt', '_self');";
+
+
+ /* $node1 = new HTML_TreeNode("INBOX", "test.php", $icon);
+  $foo   = &$node1->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon));
+  $bar   = &$foo->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon));
+  $blaat = &$bar->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon));
+  $blaat1 = $blaat->addItem(new HTML_TreeNode("deleted-itemswww", "test.php", $icon));
+  $blaat1->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon));
+
+  $node1->addItem(new HTML_TreeNode("sent-items",    "test.php", $icon));
+  $node1->addItem(new HTML_TreeNode("drafts",        "test.php", $icon));	*/
+
+
+  // Menu02 -- This uses the "alternate" image directory
+
+	//echo "<script language=\"JavaScript\">.$txt."</script>";
+
+
+  
+$txt=$txt." "."</script><script language=\"JavaScript\" type=\"text/javascript\">WriteMenu(0, 0, 'NAVTREE');</script>";
+//$txt=$txt." "."</script><script language=\"JavaScript\" type=\"text/javascript\">WriteMenu(7, 0, 'NAVDATA');
+ 
+echo $txt;
+
+ ?>
+
+
+
+
+<?php
+return "";
+
+
+		}
+
+/*		function createHTMLFolder_old($_folders, $_selected, $_divName, $_displayCheckBox=false)
+		{
+			$allFolders = $_folders;
+			
+			$folderImageDir = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/templates/default/images/';
+			
+			$folder_tree_new  = '<link rel="STYLESHEET" type="text/css" href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js/dhtmlxtree/css/dhtmlXTree.css">';
+			$folder_tree_new .= "<script type='text/javascript'>";
+			$folder_tree_new .= "tree=new dhtmlXTreeObject('$_divName','100%','100%',0);";
+			$folder_tree_new .= "tree.setImagePath('$folderImageDir/dhtmlxtree/');";
+			$folder_tree_new .= "tree.setOnClickHandler('onNodeSelect');";
+
+			$linkData = array
+			(
+				'menuaction'	=> 'mydms.uifolder.getSubFolder',
+			);
+			$xmlAutoLoadURL = $GLOBALS['phpgw']->link('/index.php',$linkData);
+
+			$folder_tree_new .= "tree.setXMLAutoLoading('$xmlAutoLoadURL');";
+			if($_displayCheckBox)
+			{
+				$folder_tree_new .= "tree.enableCheckBoxes(1);";
+				$folder_tree_new .= "tree.setOnCheckHandler('onCheckHandler');";
+			}
+
+			#foreach($allFolders as $folderID => $folderObject)
+			#{
+				$folderObject = array_shift($allFolders);
+				$image1 = "'folderClosed.gif'";
+				$image2 = "0";
+				$image3 = "0";
+
+			$linkData = array
+			(
+				'menuaction'	=> 'mydms.uifolder.getInitialFolderView',
+				'id'		=> $folderObject->getID(),
+			);
+			$xmlAutoLoadURL = $GLOBALS['phpgw']->link('/index.php',$linkData);
+				
+				if(empty($parentName)) $parentName = '--topfolder--';
+				
+				$entryOptions = 'CHILD,CHECKED';
+
+				// highlight currently selected mailbox
+				if ($folderObject->getID() == $_selected->getID())
+				{
+					$entryOptions .= ',SELECT';
+				}
+				
+				$folderID	= $folderObject->getID();
+				$folderName	= $folderObject->getName();
+				$parentID	= ($folderObject->_parentID ? $folderObject->_parentID : 0);
+
+				$folder_tree_new .= "tree.insertNewItem('$parentID','$folderID','$folderName',onNodeSelect,$image1,$image2,$image3,'$entryOptions');\n";
+				$folder_tree_new .= "tree.openItem('$folderID');";
+				$folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=1');";
+				$folder_tree_new .= "tree.openItem(1);";
+				#$folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=6');";
+				#if($_displayCheckBox)
+				#	$folder_tree_new .= "tree.setCheck('$longName','".(int)$obj->subscribed."');";
+			#}
+	
+	
+#			foreach($allFolders as $folderID => $folderObject)
+#			{
+#				$folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=".$folderObject->getID()."');"; 
+#				$folder_tree_new .= "tree.openItem('".$folderObject->getID()."');";
+#			}
+			
+
+			#$selectedID = $_selected->getID();
+			#$folder_tree_new.= "tree.closeAllItems(0);tree.openItem('$selectedID');"
+			$folder_tree_new.= '</script><a href="#" onclick="javascript:tree.openItem(1); return false;">test</a><a href="#" onclick="javascript:tree.closeItem(1); return false;">test b</a>';
+
+			return $folder_tree_new;
+		}
+*/
+		function deleteACL()
+		{
+			$userID		= (int)$_GET['userid'];
+			$groupID	= (int)$_GET['groupid'];
+			
+			$documentID	= (int)$_GET['documentid'];
+
+			if($documentID)
+			{
+				$this->bomydms->deleteACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID));
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function deleteDocument()
+		{
+			$documentID	= (int)$_GET['documentid'];
+
+			if($documentID)
+			{
+				$this->bomydms->deleteDocument($documentID);
+			}
+			print '<script language="JavaScript">window.close();</script>';
+		}
+
+		function deleteFile()
+		{
+			$documentID	= (int)$_GET['documentid'];
+			$version	= (int)$_GET['version'];
+
+			if($documentID && $version)
+			{
+				$this->bomydms->deleteFile($documentID, $version);
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function deleteNotification()
+		{
+			$documentID	= (int)$_GET['documentid'];
+			$userID		= (int)$_GET['userid'];
+			$groupID	= (int)$_GET['groupid'];
+
+			if($documentID && ($userID || $groupID))
+			{
+				$this->bomydms->deleteNotification($documentID, (!$userID ? false : $userID), (!$groupID ? false : $groupID));
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function display_app_header()
+		{
+			if(!@is_object($GLOBALS['phpgw']->js))
+			{
+				$GLOBALS['phpgw']->js =& CreateObject('phpgwapi.javascript');
+			}
+			if (!is_object($GLOBALS['phpgw']->jscalendar))
+			{
+				$GLOBALS['phpgw']->jscalendar = CreateObject('phpgwapi.jscalendar');
+			}
+			$GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon');
+			$GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXTree');
+			switch($_GET['menuaction'])
+			{
+				case 'mydms.uimydms.addACL':
+				case 'mydms.uimydms.addNotification':
+				case 'mydms.uimydms.deleteACL':
+				case 'mydms.uimydms.deleteFile':
+				case 'mydms.uimydms.deleteNotification':
+				case 'mydms.uimydms.setDefaultAccess':
+				case 'mydms.uimydms.setOwner':
+				case 'mydms.uimydms.updateACL':
+				case 'mydms.uimydms.updateFile':
+				case 'mydms.uimydms.viewDocument':
+				case 'mydms.uimydms.inheritACL':
+					$GLOBALS['phpgw']->js->validate_file('tabs','tabs');
+					$GLOBALS['phpgw']->js->validate_file('jscode','viewDocument','mydms');
+					$GLOBALS['phpgw']->js->validate_file('jscode','mydms','mydms');
+
+					$GLOBALS['phpgw']->js->set_onload('javascript:initTabs();');
+					break;
+				case 'mydms.uimydms.folderChooser':
+					$GLOBALS['phpgw']->js->validate_file('jscode','mydms','mydms');
+					$GLOBALS['phpgw']->js->validate_file('jscode','folderChooser','mydms');
+					break;
+			}
+
+			$GLOBALS['phpgw_info']['flags']['include_xajax'] = True;
+
+			$GLOBALS['phpgw']->common->phpgw_header();
+			#if(!$this->mailPreferences['messageNewWindow'])
+			#	echo parse_navbar();
+		}
+
+		function getFolderTree($path, $level = 0, $_activeObj, $isFolder)
+		{
+			return $this->createHTMLFolder($path, $_activeObj, 'mydmstreebox');			
+		}
+		
+		function inheritACL()
+		{
+			$documentID	= (int)$_GET['documentid'];
+			$action		= $_GET['action'];
+			$mode		= $_GET['mode'];
+
+			if($documentID && $action)
+			{
+				$this->bomydms->inheritACL($documentID, $action, $mode);
+				$this->viewDocument($documentID);
+			}
+		}
+		
+		function setDefaultAccess()
+		{
+			$documentID	= (int)$_GET['documentid'];
+			$mode		= $_POST['defaultAccess'];
+
+			if($documentID && $mode)
+			{
+				$this->bomydms->setDefaultAccess($documentID, $mode);
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function setOwner()
+		{
+			$documentID	= (int)$_GET['documentid'];
+			$owner		= (int)$_POST['owner'];
+
+			if($documentID && $owner)
+			{
+				$this->bomydms->setOwner($documentID, $owner);
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function translate()
+		{
+			$this->t->set_var('lang_informations',lang('informations'));
+			$this->t->set_var('lang_all_versions',lang('all versions'));
+			$this->t->set_var('lang_linked_documents',lang('linked documents'));
+			$this->t->set_var('lang_owner',lang('owner'));
+			$this->t->set_var('lang_comment',lang('comment'));
+			$this->t->set_var('lang_keywords',lang('keywords'));
+			$this->t->set_var('lang_download',lang('download'));
+			$this->t->set_var('lang_last_update',lang('last update'));
+			$this->t->set_var('lang_current_version',lang('current version'));
+			$this->t->set_var('lang_uploaded_by',lang('uploaded by'));
+			$this->t->set_var('lang_file_size',lang('file size'));
+			$this->t->set_var('lang_filename',lang('filename'));
+			$this->t->set_var('lang_mime_type',lang('mime type'));
+			$this->t->set_var('lang_comment_for_current_version',lang('comment for current version'));
+			$this->t->set_var('lang_creation_date',lang('creation date'));
+			$this->t->set_var('lang_lock_status',lang('lock status'));
+			$this->t->set_var('lang_expires',lang('expires'));
+			$this->t->set_var('lang_version',lang('version'));
+			$this->t->set_var('lang_upload_date',lang('upload date'));
+			$this->t->set_var('lang_save',lang('save'));
+			$this->t->set_var('lang_cancel',lang('cancel'));
+			$this->t->set_var('lang_delete',lang('delete'));
+			$this->t->set_var('lang_view_online',lang('view online'));
+			$this->t->set_var('lang_confirm_delete',lang('Do you really want to delete this document?'));
+			$this->t->set_var('lang_update_document',lang('update document'));
+			$this->t->set_var('lang_update',lang('update'));
+			$this->t->set_var('lang_acl',lang('acl'));
+			$this->t->set_var('lang_name',lang('name'));
+			$this->t->set_var('lang_move_document',lang('move document'));
+			$this->t->set_var('lang_folder',lang('folder'));
+			$this->t->set_var('lang_user',lang('user'));
+			$this->t->set_var('lang_group',lang('group'));
+			$this->t->set_var('lang_acl',lang('acl'));
+			$this->t->set_var('lang_acl_get_inherited',lang('acl get inherited'));
+			$this->t->set_var('lang_notifications',lang('notifications'));
+			$this->t->set_var('lang_file_gets_unlocked',lang('this document gets unlocked by you.'));
+			$this->t->set_var('lang_file_gets_locked',lang('this document gets locked by you!'));
+			$this->t->set_var('lang_delete_this_notification',lang('delete this notification'));
+			$this->t->set_var('lang_add_notification',lang('add notification'));
+			$this->t->set_var('lang_information_about_last_update',lang('information about last update'));
+			$this->t->set_var('lang_general_information',lang('general information'));
+			$this->t->set_var('lang_copy_acl',lang('copy acl'));
+			$this->t->set_var('lang_create_empty_acl',lang('create empty acl'));
+			$this->t->set_var('lang_inherit_acl_again',lang('inherit acl again'));
+			$this->t->set_var('lang_default_access',lang('default access'));
+			$this->t->set_var('lang_permission',lang('permission'));
+			$this->t->set_var('lang_add_acl',lang('add acl'));
+			$this->t->set_var('lang_current_acl',lang('current acl'));
+			$this->t->set_var('lang_access_mode',lang('access mode'));
+			$this->t->set_var('lang_confirm_acl_delete',lang('Do you really want to delete this acl?'));
+		}
+		
+		function updateACL()
+		{
+			$userID		= (int)$_GET['userid'];
+			$groupID	= (int)$_GET['groupid'];
+			$access		= (int)$_POST['mode'];
+			
+			$documentID	= (int)$_GET['documentid'];
+
+			if($documentID)
+			{
+				$this->bomydms->updateACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID), $access);
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function updateDocument()
+		{
+			$fileName	= $_POST['fname'];
+			$comment	= $_POST['comment'];
+			$keywords	= $_POST['keywords'];
+			$expire		= $_POST['expire'];
+			$expire_date	= $GLOBALS['phpgw']->jscalendar->input2date($_POST['expire_date']);
+			$lockStatus	= $_POST['lockStatus'];
+			$targetID	= $_POST['targetid'];
+			
+			$documentID	= (int)$_GET['documentid'];
+
+			if($documentID)
+			{
+				$this->bomydms->updateDocument($documentID,$fileName,$comment,$keywords,($expire ? $expire_date['raw'] : 0));
+				if($lockStatus != 'unchanged')
+				{
+					$this->bomydms->updateLockStatus($documentID, $lockStatus);
+				}
+				if($targetID != 'unchanged')
+				{
+					$this->bomydms->moveDocument($documentID, (int)$targetID);
+				}
+			}
+			print '<script language="JavaScript">window.close();</script>';
+		}
+
+		function updateFile()
+		{
+			$comment	= $_POST['comment'];
+			$expire		= $_POST['expire'];
+			$expire_date	= $GLOBALS['phpgw']->jscalendar->input2date($_POST['expire_date_update']);
+			$documentID	= (int)$_GET['documentid'];
+			$userfile	= $_FILES['userfile'];
+
+			if($documentID && is_uploaded_file($userfile['tmp_name']))
+			{
+				$this->bomydms->updateFile($documentID, $userfile, $comment, ($expire ? $expire_date['raw'] : 0));
+				$this->viewDocument($documentID);
+			}
+		}
+
+		function viewDocument($_documentID=false)
+		{
+			$documentID = ($_documentID === false ? (int)$_GET['documentid'] : $_documentID);
+
+			if(!$document	= getDocument($documentID))
+			{
+				print "Access denied!"; exit;
+			}
+			$user 		= getUser($GLOBALS['phpgw_info']['user']['account_id']);
+			$accessMode	= $document->getAccessMode($user);
+			$owner		= $document->getOwner();
+			$folder		= $document->getFolder();
+			$latestContent	= $document->getLatestContent();
+			$versions	= $document->getContent();
+			$notifyList	= $document->getNotifyList();
+			$accessList	= $document->getAccessList();
+			$updatingUser	= $latestContent->getUser();
+			
+			#_debug_array($document);
+			
+			$this->display_app_header();
+		
+			$this->t->set_file(array("viewDocument" => "viewDocument.tpl"));
+			$this->t->set_block('viewDocument', 'main', 'main');
+			$this->t->set_block('viewDocument', 'acl_row', 'acl_row');
+			$this->t->set_block('viewDocument', 'lock_row', 'lock_row');
+			$this->t->set_block('viewDocument', 'version_row', 'version_row');
+			$this->t->set_block('viewDocument', 'notification_row', 'notification_row');
+			$this->t->set_block('viewDocument', 'information_ro', 'information_ro');
+			$this->t->set_block('viewDocument', 'information_rw', 'information_rw');
+			$this->t->set_block('viewDocument', 'block_download', 'block_download');
+			$this->t->set_block('viewDocument', 'block_view_online', 'block_view_online');
+			$this->t->set_block('viewDocument', 'block_delete', 'block_delete');
+			$this->t->set_block('viewDocument', 'block_change_owner', 'block_change_owner');
+			$this->t->set_block('viewDocument', 'block_acl_inherite', 'block_acl_inherite');
+			$this->t->set_block('viewDocument', 'block_acl_notinherite', 'block_acl_notinherite');
+
+			$downloadImage 	= $GLOBALS['phpgw']->common->image('mydms','download');
+			$viewImage 	= $GLOBALS['phpgw']->common->image('mydms','view');
+			$deleteImage 	= $GLOBALS['phpgw']->common->image('mydms','del');
+			$groupImage	= $GLOBALS['phpgw']->common->image('mydms','groupicon');
+			$userImage	= $GLOBALS['phpgw']->common->image('mydms','usericon');
+			$saveImage	= $GLOBALS['phpgw']->common->image('mydms','save');
+			$this->t->set_var('download_image',$downloadImage);
+			$this->t->set_var('view_image',$viewImage);
+			$this->t->set_var('delete_image',$deleteImage);
+			$this->t->set_var('save_image',$saveImage);
+
+
+			$this->translate();
+			
+			$linkData = array
+			(
+				'menuaction'	=> 'mydms.uimydms.folderChooser',
+			);
+			$this->t->set_var('folderChooserURL', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+			$linkData = array
+			(
+				'menuaction'	=> 'mydms.uimydms.updateDocument',
+				'documentid'	=> $documentID,
+			);
+			$this->t->set_var('action_informations', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+			// download link
+			$linkData = array
+			(
+				'documentid'	=> $documentID,
+				'version'	=> $latestContent->getVersion(),
+			);
+			$this->t->set_var('download_link', $GLOBALS['phpgw']->link('/mydms/op/op.Download.php',$linkData));
+			$this->t->parse('download','block_download',True);
+
+			// view Online
+			if ($latestContent->viewOnline())
+			{
+				$linkData = array
+				(
+					'documentid'	=> $documentID,
+					'version'	=> $latestContent->getVersion()
+				);
+				$this->t->set_var('view_link', $GLOBALS['phpgw']->link('/mydms/op/op.ViewOnline.php',$linkData));
+				$this->t->parse('view_online','block_view_online',True);
+			}
+
+			// delete link
+			if ($accessMode == M_ALL)
+			{
+				$linkData = array
+				(
+					'menuaction'	=> 'mydms.uimydms.deleteDocument',
+					'documentid'	=> $documentID,
+				);
+				$this->t->set_var('delete_link', $GLOBALS['phpgw']->link('/index.php',$linkData));
+				$this->t->parse('delete','block_delete',True);
+			}
+
+			$this->t->set_var('owner_fullname',	$owner->getFullName());
+			$this->t->set_var('owner_email',	$owner->getEmail());
+
+			$this->t->set_var('updater_fullname',	$updatingUser->getFullName());
+			$this->t->set_var('updater_email',	$updatingUser->getEmail());
+
+			$this->t->set_var('filename',		$document->getName());
+			$this->t->set_var('comment',		$document->getComment());
+			$this->t->set_var('keywords',		$document->getKeywords());
+			$this->t->set_var('creation_date',	date("d.m.Y - H:i:s",$document->getDate()));
+
+			$this->t->set_var('foldername',		$folder->getName());
+			$this->t->set_var('current_folder_id',	$folder->getID());
+			
+			// lock status
+			// lock select box
+			
+			if ($document->isLocked())
+			{
+				$lockingUser = $document->getLockingUser();
+
+				$this->t->set_var('lang_current_status', lang('this document is locked by <a href="mailto:%1">%2</a>.',$lockingUser->getEmail(),$lockingUser->getFullName()));
+				$this->t->set_var('checked_lock_status', 'checked');
+				$this->t->parse('locking','lock_row',True);
+			}
+			else
+			{
+				$this->t->set_var('lang_current_status', lang('this document is currently not locked.'));
+				
+				$this->t->parse('locking','lock_row', True);
+			}
+
+if (!is_object($GLOBALS['phpgw']->html))
+			{
+				$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
+			}
+
+			
+			// expire select box
+			$selectOptions = array('0' => lang('does not expire'), '1' => lang('expires after'));
+			$this->t->set_var('select_expire',$GLOBALS['phpgw']->html->select('expire',(!$document->getExpires() ? 0 : 1),$selectOptions,true,"onchange=\"toggleJSCal(this);\""));
+			#$this->t->set_var('select_expire',$GLOBALS['phpgw']->html->select('expire',(!$document->getExpires() ? 0 : 1),$selectOptions,true,"onchange=\"alert('test')\""));
+			
+			if (!$document->getExpires())
+			{
+				$this->t->set_var('expire_date_ro',lang('does not expire'));
+				$this->t->set_var('expire_date',$GLOBALS['phpgw']->jscalendar->input('expire_date',''));
+				$this->t->set_var('expire_class', 'inactive');
+			}
+			else
+			{
+				$this->t->set_var('expire_date_ro',lang('expires after').' '.date("d.m.Y",$document->getExpires()));
+				$this->t->set_var('expire_date',$GLOBALS['phpgw']->jscalendar->input('expire_date',$document->getExpires()));
+				$this->t->set_var('expire_class', 'active');
+			}
+				
+			$this->t->set_var('current_version',	$latestContent->getVersion());
+			$this->t->set_var('current_comment',	$latestContent->getComment());
+			$this->t->set_var('mime_type',		$latestContent->getMimeType());
+			$this->t->set_var('file_size',		filesize($GLOBALS['phpgw_info']['server']['files_dir'] . '/mydms/' . $latestContent->getPath()));
+			$this->t->set_var('last_update',	date("d.m.Y - H:i:s",$latestContent->getDate()));
+
+			$this->t->set_var('rownum',		count($versions)+1);
+
+			if (($accessMode >= M_READWRITE))
+			{
+				$this->t->parse('informations','information_rw',True);
+			}
+			else
+			{
+				$this->t->parse('informations','information_ro',True);
+			}
+
+			for ($i = count($versions)-1; $i >= 0; $i--)
+			{
+				$version = $versions[$i];
+				$uploadingUser = $version->getUser();
+				$comment = $version->getComment();
+				//if (strlen($comment) > 25) $comment = substr($comment, 0, 22) . "...";
+
+				$this->t->set_var('version_version',		$version->getVersion());
+				$this->t->set_var('version_comment',		$version->getComment());
+				$this->t->set_var('version_uploadingUser',	$uploadingUser->getFullName());
+				$this->t->set_var('version_date',		date("d.m.Y - H:i:s",$version->getDate()));
+				if ($version->viewOnline())
+					$this->t->set_var('url_view_online', "<a target=\"_blank\" href=\"../op/viewonline" . $version->getURL()."\"><img src=\"images/view.gif\" width=18 height=18 border=0 title=\"".lang('view online')."\"></a>");
+				else
+					$this->t->set_var('url_view_online',	'');
+				
+				$linkData = array
+				(
+					'documentid'	=> $documentID,
+					'version'	=> $version->getVersion()
+				);
+				$this->t->set_var('url_download_file', $GLOBALS['phpgw']->link('/mydms/op/op.Download.php',$linkData));
+				
+				if (($accessMode == M_ALL) && (count($versions) > 1))
+				{
+					$linkData = array
+					(
+						'menuaction'	=> 'mydms.uimydms.deleteFile',
+						'documentid'	=> $documentID,
+						'version'	=> $version->getVersion(),
+						'tabpage'	=> 2,
+					);
+					$this->t->set_var('url_delete_file',
+						"<a href=\"".$GLOBALS['phpgw']->link('/index.php',$linkData).
+							"\" onClick=\"return confirm('".lang('do you really want to delete this version of the document?').
+							"');\"><img src=\"$deleteImage\" width=15 height=15 border=0 title=\"".
+							lang("delete")."\"></a>");
+				}
+				
+				$this->t->parse('versions','version_row',True);
+			}
+			
+			// div 4 notifications
+			$linkData = array
+			(
+				'menuaction'	=> 'mydms.uimydms.addNotification',
+				'documentid'	=> $documentID,
+				'tabpage'	=> 4,
+			);
+			$this->t->set_var('notify_form_action', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+			foreach ((array)$notifyList["users"] as $userNotify)
+			{
+				$this->t->set_var('notify_username',$userNotify->getFullName());
+				$this->t->set_var('notify_image',$userImage);
+				
+				$linkData = array
+				(
+					'menuaction'	=> 'mydms.uimydms.deleteNotification',
+					'documentid'	=> $documentID,
+					'userid'	=> $userNotify->getID(),
+					'tabpage'	=> 4,
+				);
+				$this->t->set_var('link_notify_delete', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+				$this->t->parse('notifications','notification_row',True);
+			}
+			
+			foreach ((array)$notifyList["groups"] as $groupNotify)
+			{
+				$this->t->set_var('notify_username',$groupNotify->getName());
+				$this->t->set_var('notify_image',$groupImage);
+				
+				$linkData = array
+				(
+					'menuaction'	=> 'mydms.uimydms.deleteNotification',
+					'documentid'	=> $documentID,
+					'groupid'	=> $groupNotify->getID(),
+					'tabpage'	=> 4,
+				);
+				$this->t->set_var('link_notify_delete', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+				$this->t->parse('notifications','notification_row',True);
+			}
+			
+			$allUsers = getAllUsers();
+			$allUsersOptions = array('unselected' => lang('please select').'...');
+			foreach ($allUsers as $userObj)
+			{
+				$allUsersOptions[$userObj->getID()] = $userObj->getFullName();
+			}
+			$this->t->set_var('select_userid',$GLOBALS['phpgw']->html->select('userid',0,$allUsersOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.notify_form.submit();\""));
+			
+			$allGroups = getAllGroups();
+			$allGroupsOptions = array('unselected' => lang('please select').'...');
+			foreach ($allGroups as $groupObj)
+			{
+				$allGroupsOptions[$groupObj->getID()] = $groupObj->getName();
+			}
+			$this->t->set_var('select_groupid',$GLOBALS['phpgw']->html->select('groupid',0,$allGroupsOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.notify_form.submit();\""));
+			
+	// div 5 ACL
+			if ($accessMode == M_ALL)
+			{
+				if ($user->isAdmin())
+				{
+					$linkData = array
+					(
+						'menuaction'	=> 'mydms.uimydms.setOwner',
+						'documentid'	=> $documentID,
+						'tabpage'	=> 5,
+					);
+					$this->t->set_var('action_change_owner', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+					$allUsers = getAllUsers();
+					$allUsersOptions = array();
+					foreach ($allUsers as $userObj)
+					{
+						$allUsersOptions[$userObj->getID()] = $userObj->getFullName();
+					}
+					$this->t->set_var('select_ownerid',$GLOBALS['phpgw']->html->select('owner',$owner->getID(),$allUsersOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.change_owner.submit();\""));
+					
+					$this->t->parse('change_owner','block_change_owner',True);
+				}
+				
+				if ($document->inheritsAccess())
+				{
+					$linkData = array
+					(
+						'menuaction'	=> 'mydms.uimydms.inheritACL',
+						'documentid'	=> $documentID,
+						'action'	=> 'notinherit',
+						'mode'		=> 'copy',
+						'tabpage'	=> 5,
+					);
+					$this->t->set_var('link_acl_copy', $GLOBALS['phpgw']->link('/index.php',$linkData));
+					
+					$linkData = array
+					(
+						'menuaction'	=> 'mydms.uimydms.inheritACL',
+						'documentid'	=> $documentID,
+						'action'	=> 'notinherit',
+						'mode'		=> 'empty',
+						'tabpage'	=> 5,
+					);
+					$this->t->set_var('link_acl_empty', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+					$this->t->parse('display_acl','block_acl_inherite',True);
+				}
+				else
+				{
+					$linkData = array
+					(
+						'menuaction'	=> 'mydms.uimydms.inheritACL',
+						'documentid'	=> $documentID,
+						'action'	=> 'inherit',
+						'tabpage'	=> 5,
+					);
+					$this->t->set_var('link_acl_inherit_again', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+					$linkData = array
+					(
+						'menuaction'	=> 'mydms.uimydms.setDefaultAccess',
+						'documentid'	=> $documentID,
+						'tabpage'	=> 5,
+					);
+					$this->t->set_var('action_change_default_access', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+					$linkData = array
+					(
+						'menuaction'	=> 'mydms.uimydms.addACL',
+						'documentid'	=> $documentID,
+						'tabpage'	=> 5,
+					);
+					$this->t->set_var('action_add_acl', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+					
+					$defaultACL = array
+					(
+						M_NONE 		=> 'access_mode_none',
+						M_READ		=> 'access_mode_read',
+						M_READWRITE	=> 'access_mode_readwrite',
+						M_ALL		=> 'access_mode_all',
+					);
+					$this->t->set_var('select_default_access',$GLOBALS['phpgw']->html->select('defaultAccess',$document->getDefaultAccess(),$defaultACL,false,"style=\"width: 300px;\" onchange=\"javascript:document.change_default_access.submit();\""));
+
+					foreach ((array)$accessList["users"] as $userAccess)
+					{
+						$userObj	= $userAccess->getUser();
+						$userMode	= $userAccess->getMode();
+
+						$this->t->set_var('acl_username',$userObj->getFullName());
+						$this->t->set_var('acl_image',$userImage);
+
+						$linkData = array
+						(
+							'menuaction'	=> 'mydms.uimydms.updateACL',
+							'documentid'	=> $documentID,
+							'userid'	=> $userObj->getID(),
+							'tabpage'	=> 5,
+						);
+						$this->t->set_var('action_acl_row', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+						$linkData = array
+						(
+							'menuaction'	=> 'mydms.uimydms.deleteACL',
+							'documentid'	=> $documentID,
+							'userid'	=> $userObj->getID(),
+							'tabpage'	=> 5,
+						);
+						$this->t->set_var('link_acl_delete', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+						$this->t->set_var('acl_selectbox',$GLOBALS['phpgw']->html->select('mode',$userAccess->getMode(),$defaultACL,false,"style=\"width: 300px;\""));
+				
+						$this->t->parse('acls','acl_row',True);
+					}
+					
+					foreach ((array)$accessList["groups"] as $groupAccess)
+					{
+						$groupObj	= $groupAccess->getGroup();
+						$groupMode	= $groupAccess->getMode();
+
+						$this->t->set_var('acl_username',$groupObj->getName());
+						$this->t->set_var('acl_image',$groupImage);
+
+						$linkData = array
+						(
+							'menuaction'	=> 'mydms.uimydms.updateACL',
+							'documentid'	=> $documentID,
+							'groupid'	=> $groupObj->getID(),
+							'tabpage'	=> 5,
+						);
+						$this->t->set_var('action_acl_row', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+						$linkData = array
+						(
+							'menuaction'	=> 'mydms.uimydms.deleteACL',
+							'documentid'	=> $documentID,
+							'groupid'	=> $groupObj->getID(),
+							'tabpage'	=> 5,
+						);
+						$this->t->set_var('link_acl_delete', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+						$this->t->set_var('acl_selectbox',$GLOBALS['phpgw']->html->select('mode',$groupAccess->getMode(),$defaultACL,false,"style=\"width: 300px;\""));
+
+						$this->t->parse('acls','acl_row',True);
+					}
+
+
+					$allUsers = getAllUsers();
+					$allUsersOptions = array('unselected' => lang('please select').'...');
+					foreach ($allUsers as $userObj)
+					{
+						$allUsersOptions[$userObj->getID()] = $userObj->getFullName();
+					}
+					$this->t->set_var('select_add_acl_userid',$GLOBALS['phpgw']->html->select('userid',0,$allUsersOptions,true,"style=\"width: 300px;\" oonchange=\"javascript:document.notify_form.submit();\""));
+			
+					$allGroups = getAllGroups();
+					$allGroupsOptions = array('unselected' => lang('please select').'...');
+					foreach ($allGroups as $groupObj)
+					{
+						$allGroupsOptions[$groupObj->getID()] = $groupObj->getName();
+					}
+					$this->t->set_var('select_add_acl_groupid',$GLOBALS['phpgw']->html->select('groupid',0,$allGroupsOptions,true,"style=\"width: 300px;\" oonchange=\"javascript:document.notify_form.submit();\""));
+
+					$this->t->set_var('select_add_acl_permission',$GLOBALS['phpgw']->html->select('access',M_READ,$defaultACL,false,"style=\"width: 300px;\" oonchange=\"javascript:document.change_default_access.submit();\""));
+
+					$this->t->parse('display_acl','block_acl_notinherite',True);
+				}
+			}
+			
+	// div 6 update file
+			
+			$linkData = array
+			(
+				'menuaction'	=> 'mydms.uimydms.updateFile',
+				'documentid'	=> $documentID,
+			);
+			$this->t->set_var('action_update_file', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+			// expire select box
+			$this->t->set_var('select_expire_update',$GLOBALS['phpgw']->html->select('expire',0,$selectOptions,true,"onchange=\"toggleJSCalUpdate(this);\""));
+			
+			$this->t->set_var('expire_date_update',$GLOBALS['phpgw']->jscalendar->input('expire_date_update',''));
+			$this->t->set_var('expire_class_update', 'inactive');
+			
+			
+			$this->t->parse("out","main");
+			
+			print $this->t->get('out','main');
+		}
+
+	}
+
+?>
Index: /contrib/Dms/inc/inc.ClassKeywords.php
===================================================================
--- /contrib/Dms/inc/inc.ClassKeywords.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassKeywords.php	(revision 3526)
@@ -0,0 +1,142 @@
+<?php
+
+function getKeywordCategory($id)
+{
+	GLOBAL $db;
+	
+	if (!is_numeric($id))
+		die ("invalid id");
+	
+	$queryStr = "SELECT * FROM phpgw_mydms_KeywordCategories WHERE id = " . $id;
+	$resArr = $db->getResultArray($queryStr);
+	if ((is_bool($resArr) && !$resArr) || (count($resArr) != 1))
+		return false;
+	
+	$resArr = $resArr[0];
+	return new Keywordcategory($resArr["id"], $resArr["owner"], $resArr["name"]);
+}
+
+function getAllKeywordCategories($userID = -1)
+{
+	GLOBAL $db, $settings;
+	
+	$queryStr = "SELECT * FROM phpgw_mydms_KeywordCategories";
+	if ($userID != -1)
+		$queryStr .= " WHERE owner = $userID OR owner = " . $settings->_adminID;
+	
+	$resArr = $db->getResultArray($queryStr);
+	if (is_bool($resArr) && !$resArr)
+		return false;
+	
+	$categories = array();
+	foreach ($resArr as $row)
+		array_push($categories, new KeywordCategory($row["id"], $row["owner"], $row["name"]));
+	
+	return $categories;
+}
+
+function addKeywordCategory($owner, $name)
+{
+	GLOBAL $db;
+	
+	$queryStr = "INSERT INTO phpgw_mydms_KeywordCategories (owner, name) VALUES ($owner, '$name')";
+	if (!$db->getResult($queryStr))
+		return false;
+	
+	return getKeywordCategory($db->getInsertID('phpgw_mydms_KeywordCategories','id'));
+}
+
+//----------------------------------------------------------------------------------------------
+class KeywordCategory
+{
+	var $_id;
+	var $_ownerID;
+	var $_name;
+
+	function KeywordCategory($id, $ownerID, $name)
+	{
+		$this->_id = $id;
+		$this->_name = $name;
+		$this->_ownerID = $ownerID;
+	}
+
+	function getID() { return $this->_id; }
+
+	function getName() { return $this->_name; }
+
+	function getOwner() {
+		if (!isset($this->_owner))
+			$this->_owner = getUser($this->_ownerID);
+		return $this->_owner;
+	}
+
+	function setName($newName)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_KeywordCategories SET name = '$newName' WHERE id = ". $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		$this->_name = $newName;
+		return true;
+	}
+
+	function setOwner($user) {
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_KeywordCategories SET owner = " . $user->getID() . " WHERE id " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		$this->_ownerID = $user->getID();
+		$this->_owner = $user;
+		return true;
+	}
+
+	function getKeywordLists() {
+		GLOBAL $db;
+		
+		$queryStr = "SELECT * FROM phpgw_mydms_Keywords WHERE category = " . $this->_id;
+		return $db->getResultArray($queryStr);
+	}
+
+	function editKeywordList($listID, $keywords) {
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Keywords SET keywords = '$keywords' WHERE id = $listID";
+		return $db->getResult($queryStr);
+	}
+
+	function addKeywordList($keywords) {
+		GLOBAL $db;
+		
+		$queryStr = "INSERT INTO phpgw_mydms_Keywords (category, keywords) VALUES (" . $this->_id . ", '$keywords')";
+		return $db->getResult($queryStr);
+	}
+
+	function removeKeywordList($listID) {
+		GLOBAL $db;
+		
+		$queryStr = "DELETE FROM phpgw_mydms_Keywords WHERE id = $listID";
+		return $db->getResult($queryStr);
+	}
+
+	function remove()
+	{
+		GLOBAL $db;
+		
+		$queryStr = "DELETE FROM phpgw_mydms_Keywords WHERE category = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		$queryStr = "DELETE FROM phpgw_mydms_KeywordCategories WHERE id = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		return true;
+	}
+}
+
+
+?>
Index: /contrib/Dms/inc/inc.Utils.php
===================================================================
--- /contrib/Dms/inc/inc.Utils.php	(revision 3526)
+++ /contrib/Dms/inc/inc.Utils.php	(revision 3526)
@@ -0,0 +1,24 @@
+<?php
+
+
+function getReadableDate($timestamp) {
+	return date("d.m.Y", $timestamp);
+}
+
+function getLongReadableDate($timestamp) {
+	return date("d.m.Y - H:i:s", $timestamp);
+}
+
+function sanitizeString($string) {
+	#$string = str_replace("'",  "", $string);
+	$string = str_replace("--", "", $string);
+	$string = str_replace("<",  "", $string);
+	$string = str_replace(">",  "", $string);
+	$string = str_replace("/*", "", $string);
+	$string = str_replace("*/", "", $string);
+	#$string = str_replace("\"", "", $string);
+	
+	return $string;
+}
+
+?>
Index: /contrib/Dms/inc/inc.Settings.php
===================================================================
--- /contrib/Dms/inc/inc.Settings.php	(revision 3526)
+++ /contrib/Dms/inc/inc.Settings.php	(revision 3526)
@@ -0,0 +1,71 @@
+<?php
+if(!isset($GLOBALS['phpgw_info']) || !is_array($GLOBALS['phpgw_info']))
+{
+	$GLOBALS['phpgw_info']['flags'] = array(
+	        'currentapp' => 'mydms',
+	        'noheader'   => True,
+	        'nonavbar'   => True
+	);
+
+	include('../../header.inc.php');
+}
+
+class Settings
+{
+	//IDs of admin-user, guest-user and root-folder (no need to change)
+	var $_adminID = 1;
+	var $_guestID = 2;
+	var $_rootFolderID = 1;
+	
+	//If you don't want anybody to login as guest, set the following line to false
+	var $_enableGuestLogin = false;
+	
+	//default language (name of a subfolder in folder "languages")
+	var $_language = "English";
+	
+	//users are notified about document-changes that took place within the last $_updateNotifyTime seconds
+	var $_updateNotifyTime = 86400; //means 24 hours
+	
+	//files with one of the following endings can be viewed online
+	var $_viewOnlineFileTypes = array(".txt", ".html", ".htm", ".pdf", ".gif", ".png", ".jpg");
+	
+	//enable/disable converting of files
+	var $_enableConverting = false;
+	
+	//default theme (name of a subfolder in folder "themes")
+	var $_theme = "default";
+	
+	function Settings()
+	{
+		//path to where mydms is located
+		$this->_rootDir = PHPGW_SERVER_ROOT . '/mydms/';
+	
+		//where the uploaded files are stored (you better choose a directory that is not accessible through your web-server)
+		$this->_contentDir = $GLOBALS['phpgw_info']['server']['files_dir'] . "/mydms/";
+
+		//if the rootdir unexist or is not a directory, create it
+		if(!is_dir($this->_contentDir)) {
+			if($ret1 = is_writable($GLOBALS['phpgw_info']['server']['files_dir']))
+				$ret2 = mkdir($this->_contentDir,0755);
+			if(!$ret1 && $ret2)
+				die('The Root Dir does not exist or Can not be created');
+		}
+	
+		//the same as URL
+	//	$this->_httpRoot = $GLOBALS['phpgw_info']['server']['webserver_url'] . "/mydms/";   // we use the following more professional one
+		$this->_httpRoot = $GLOBALS['phpgw']->link('/mydms/');
+	
+		//files with one of the following endings will be converted with the given commands
+		//for windows users
+		$this->_convertFileTypes = array(".doc" => "cscript \"" . $this->_rootDir."op/convert_word.js\" {SOURCE} {TARGET}",
+										 ".xls" => "cscript \"".$this->_rootDir."op/convert_excel.js\" {SOURCE} {TARGET}",
+										 ".ppt" => "cscript \"".$this->_rootDir."op/convert_pp.js\" {SOURCE} {TARGET}");
+		//for linux users
+	//	$this->_convertFileTypes = array(".doc" => "mswordview -o {TARGET} {SOURCE}");
+	}
+}
+
+$settings = new Settings();
+$GLOBALS['mydms']->settings = $settings;
+
+?>
Index: /contrib/Dms/inc/class.bofolder.inc.php
===================================================================
--- /contrib/Dms/inc/class.bofolder.inc.php	(revision 3526)
+++ /contrib/Dms/inc/class.bofolder.inc.php	(revision 3526)
@@ -0,0 +1,61 @@
+<?php
+	/***************************************************************************\
+	* eGroupWare - mydms                                                        *
+	* http://www.linux-at-work.de                                               *
+	* http://www.phpgw.de                                                       *
+	* http://www.egroupware.org                                                 *
+	* Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
+	* -------------------------------------------------                         *
+	* 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.                       *
+	\***************************************************************************/
+	
+	/* $Id: class.bofolder.inc.php 19576 2005-11-03 14:24:31Z lkneschke $ */
+
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.Settings.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.AccessUtils.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassAccess.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassUser.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassGroup.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassFolder.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassDocument.php');
+
+	class bofolder
+	{
+		function copyFolder($_folderID, $_targetID, $_newFolderName, $_copySubFolder, $_copyDocuments)
+		{
+			//print "$_folderID, $_targetID, $_copySubFolder, $_copyDocuments";
+			$folder		= getFolder($_folderID);
+			$targetFolder	= getFolder($_targetID);
+			
+			$this->user		= getUser($GLOBALS['phpgw_info']['user']['account_id']);
+			
+			if (($folder->getAccessMode($this->user) < M_READWRITE) || ($targetFolder->getAccessMode($this->user) < M_READWRITE))
+			{
+				return false;
+			}
+			
+			$newFolder = $targetFolder->addSubFolder($_newFolderName, $folder->getComment(), $this->user, $folder->getSequence());
+			
+			if($_copySubFolder)
+			{
+				$this->copySubFolder($folder, $newFolder, $_copyDocuments);
+			}
+			
+			return $newFolder;
+		}
+		
+		function copySubFolder($_sourceFolder, $_newParentFolder, $_copyDocuments)
+		{
+			$subFolders = $_sourceFolder->getSubFolders();
+			
+			foreach($subFolders as $sourceSubFolder)
+			{
+				$newFolder = $_newParentFolder->addSubFolder($sourceSubFolder->getName(), $sourceSubFolder->getComment(), $this->user, $sourceSubFolder->getSequence());
+				$this->copySubFolder($sourceSubFolder, $newFolder, $_copyDocuments);
+			}
+		}
+	}
+?>
Index: /contrib/Dms/inc/inc.FileUtils.php
===================================================================
--- /contrib/Dms/inc/inc.FileUtils.php	(revision 3526)
+++ /contrib/Dms/inc/inc.FileUtils.php	(revision 3526)
@@ -0,0 +1,114 @@
+<?php
+
+function renameFile($old, $new)
+{
+	return rename($old, $new);
+}
+
+function removeFile($file)
+{
+	return unlink($file);
+}
+
+function copyFile($source, $target)
+{
+	return copy($source, $target);
+}
+
+function moveFile($source, $target)
+{
+	if (!copyFile($source, $target))
+		return false;
+	return removeFile($source);
+}
+
+function renameDir($old, $new)
+{
+	return rename($old, $new);
+}
+
+function makeDir($path)
+{
+	return mkdir($path, 0755);
+}
+
+function removeDir($path)
+{
+	$handle = opendir($path);
+	while ($entry = readdir($handle) )
+	{
+		if ($entry == ".." || $entry == ".")
+			continue;
+		else if (is_dir($path . $entry))
+		{
+			if (!removeDir($path . $entry . "/"))
+				return false;
+		}
+		else
+		{
+			if (!unlink($path . $entry))
+				return false;
+		}
+	}
+	closedir($handle);
+	return rmdir($path);
+}
+
+function copyDir($sourcePath, $targetPath)
+{
+	if (mkdir($targetPath, 0777))
+	{
+		$handle = opendir($sourcePath);
+		while ($entry = readdir($handle) )
+		{
+			if ($entry == ".." || $entry == ".")
+				continue;
+			else if (is_dir($sourcePath . $entry))
+			{
+				if (!copyDir($sourcePath . $entry . "/", $targetPath . $entry . "/"))
+					return false;
+			}
+			else
+			{
+				if (!copy($sourcePath . $entry, $targetPath . $entry))
+					return false;
+			}
+		}
+		closedir($handle);
+	}
+	else
+		return false;
+	
+	return true;
+}
+
+function moveDir($sourcePath, $targetPath)
+{
+	if (!copyDir($sourcePath, $targetPath))
+		return false;
+	return removeDir($sourcePath);
+}
+
+//To-DO: fehler abfangen
+function getSuitableDocumentDir()
+{
+	$maxVal = 0;
+	
+	$handle = opendir($GLOBALS['mydms']->settings->_contentDir);
+	while ($entry = readdir($handle))
+	{
+		if ($entry == ".." || $entry == ".")
+			continue;
+		else if (is_dir($GLOBALS['mydms']->settings->_contentDir . $entry))
+		{
+			$num = intval($entry);
+			if ($num >= $maxVal)
+				$maxVal = $num+1;
+		}
+	}
+	$name = "" . $maxVal . "";
+	while (strlen($name) < 5)
+		$name = "0" . $name;
+	return $name . "/";
+}
+?>
Index: /contrib/Dms/inc/hook_sidebox_menu.inc.php
===================================================================
--- /contrib/Dms/inc/hook_sidebox_menu.inc.php	(revision 3526)
+++ /contrib/Dms/inc/hook_sidebox_menu.inc.php	(revision 3526)
@@ -0,0 +1,57 @@
+<?php
+{ 
+	$folderID	= ((int)$_GET[folderid] ? (int)$_GET[folderid] : 1);
+	
+	if(function_exists(getFolder))
+	{
+		$folder		= getFolder($folderID);
+		$accessMode	= $folder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+	}
+	$menu_title = lang('mydms');
+	$file = Array(
+		'Content' => $GLOBALS['phpgw']->link('/mydms/out/out.ViewFolder.php', array('folderid' => 1)),
+		'Search'  => $GLOBALS['phpgw']->link('/mydms/out/out.SearchForm.php', array('folderid' => 1)),
+	);
+	display_sidebox($appname,$menu_title,$file); 
+	
+	if ($accessMode >= M_READWRITE)
+	{
+		$linkData = array
+		(
+			'folderid'	=> $folderID,
+		);
+	
+		$file = array();
+		$menu_title = lang('folder');
+		$file['add subfolder']	= $GLOBALS['phpgw']->link('/mydms/out/out.AddSubFolder.php',$linkData);
+		$file['add document']	= $GLOBALS['phpgw']->link('/mydms/out/out.AddDocument.php',$linkData);
+		$file[]			= '_NewLine_';
+		$file['edit folder']	= $GLOBALS['phpgw']->link('/mydms/out/out.EditFolder.php',$linkData);
+		if($folderID > 1)
+		{
+			$file['move folder']	= $GLOBALS['phpgw']->link('/mydms/out/out.MoveFolder.php',$linkData);
+			$file['copy folder']	= $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'mydms.uifolder.copyFolder')+$linkData);
+		}
+		if($accessMode == M_ALL && $folderID > 1)
+		{
+			$file['delete folder']	= $GLOBALS['phpgw']->link('/mydms/out/out.RemoveFolder.php',$linkData);
+		}
+		$file[]			= '_NewLine_';
+		$file['notifications']	= $GLOBALS['phpgw']->link('/mydms/out/out.FolderNotify.php',$linkData);
+		if($accessMode == M_ALL)
+		{
+			$file['access rights']	= $GLOBALS['phpgw']->link('/mydms/out/out.FolderAccess.php',$linkData);
+		}
+		display_sidebox($appname,$menu_title,$file); 
+	}
+	
+	if ($GLOBALS['phpgw_info']['user']['apps']['admin'])
+	{
+		$menu_title = 'Administration';
+		$file = Array(
+			'Admin-Tools'			=>  $settings->_httpRoot . "out.AdminTools.php"
+		);
+		display_sidebox($appname,$menu_title,$file);
+	}
+}
+?>
Index: /contrib/Dms/inc/inc.ClassFolder.php
===================================================================
--- /contrib/Dms/inc/inc.ClassFolder.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassFolder.php	(revision 3526)
@@ -0,0 +1,616 @@
+<?php
+function getFolder($id)
+{
+	if (!is_numeric($id))
+		die ("invalid folderid");
+
+	$queryStr = "SELECT * FROM phpgw_mydms_Folders WHERE id = " . $id;
+	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+		
+	if (is_bool($resArr) && $resArr == false)
+		return false;
+	else if (count($resArr) != 1)
+		return false;
+		
+	$resArr = $resArr[0];
+	if($id == 1) {
+		$resArr["defaultAccess"] = M_READ;
+	}
+	$newFolder =  new Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
+	
+	#print $resArr["name"]."<br>";
+	#print $newFolder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']))."<br>";
+	if($newFolder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id'])) > 1)
+        	return $newFolder;
+	else
+		return false;
+}
+
+
+/**********************************************************************\
+|                            Folder-Klasse                             |
+\**********************************************************************/
+
+class Folder
+{
+	var $_id;
+	var $_name;
+	var $_parentID;
+	var $_comment;
+	var $_ownerID;
+	var $_inheritAccess;
+	var $_defaultAccess;
+	var $_sequence;
+
+	function Folder($id, $name, $parentID, $comment, $ownerID, $inheritAccess, $defaultAccess, $sequence)
+	{
+		$this->_id = $id;
+		$this->_name = $name;
+		$this->_parentID = $parentID;
+		$this->_comment = $comment;
+		$this->_ownerID = $ownerID;
+		$this->_inheritAccess = $inheritAccess;
+		$this->_defaultAccess = $defaultAccess;
+		$this->_sequence = $sequence;
+		
+		$this->db = clone($GLOBALS['phpgw']->db);
+		$this->db->set_app('mydms');
+	}
+
+	function getID() { return $this->_id; }
+
+	function getName() { return $this->_name; }
+
+	function setName($newName)
+	{
+		$data 	= array('name' => $newName);
+		$where	= array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+			return false;
+		
+		$this->_name = $newName;
+		
+		return true;
+	}
+
+	function getComment() { return $this->_comment; }
+
+	function setComment($newComment)
+	{
+		$data 	= array('comment' => $newComment);
+		$where	= array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+			return false;
+		
+		$this->_comment = $newComment;
+		
+		return true;
+	}
+
+	function getParent()
+	{
+		if (!isset($this->_parentID) || ($this->_parentID == "") || ($this->_parentID == 0))
+			return false;
+		
+		if (!isset($this->_parent))
+			$this->_parent = getFolder($this->_parentID);
+		return $this->_parent;
+	}
+
+	function setParent($newParent)
+	{
+		$data 	= array('parent' => $newParent->getID());
+		$where	= array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+			return false;
+		
+		$this->_parentID = $newParent->getID();
+		$this->_parent = $newParent;
+		
+		return true;
+	}
+
+	function getOwner()
+	{
+		if (!isset($this->_owner))
+			$this->_owner = getUser($this->_ownerID);
+		return $this->_owner;
+	}
+
+	function setOwner($user)
+	{
+		$data 	= array('owner' => $user->getID());
+		$where	= array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+			return false;
+		
+		$this->_ownerID = $user->getID();
+		$this->_owner = $user;
+		return true;
+	}
+
+	function getDefaultAccess()
+	{
+		if ($this->inheritsAccess())
+		{
+			$res = $this->getParent();
+			if (!$res) return false;
+			return $this->_parent->getDefaultAccess();
+		}
+		
+		return $this->_defaultAccess;
+	}
+
+	function setDefaultAccess($mode)
+	{
+		$data 	= array('defaultAccess' => $mode);
+		$where	= array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+			return false;
+		
+		$this->_defaulAccess = $mode;
+		return true;
+	}
+
+	function inheritsAccess() { return $this->_inheritAccess; }
+
+	function setInheritAccess($inheritAccess)
+	{
+		$inheritAccess = $inheritAccess ? "1" : "0";
+
+		$data 	= array('inheritAccess' => $inheritAccess);
+		$where	= array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+			return false;
+		
+		$this->_inheritAccess = $inheritAccess;
+		return true;
+	}
+
+	function getSequence() { return $this->_sequence; }
+
+	function setSequence($seq)
+	{
+		$data 	= array('sequence' => $seq);
+		$where	= array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+			return false;
+
+		$this->_sequence = $seq;
+		return true;
+	}
+
+	function getSubFolders()
+	{
+		if (!isset($this->_subFolders))
+		{
+			$queryStr = "SELECT * FROM phpgw_mydms_Folders WHERE parent = " . $this->_id . " ORDER BY sequence";
+
+
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+			if (is_bool($resArr) && $resArr == false)
+				return false;
+			
+			$this->_subFolders = array();
+			for ($i = 0; $i < count($resArr); $i++)
+			{
+				$newSubFolder = new Folder($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["parent"], $resArr[$i]["comment"], $resArr[$i]["owner"], $resArr[$i]["inheritaccess"], $resArr[$i]["defaultaccess"], $resArr[$i]["sequence"]);
+
+				if($newSubFolder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id'])) > 1)
+        				$this->_subFolders[$i] = $newSubFolder;
+			}			
+		}
+		
+		return $this->_subFolders;
+	}
+
+	function addSubFolder($name, $comment, $owner, $sequence)
+	{
+		$ownerid = $GLOBALS['phpgw_info']['user']['account_id'];
+		//inheritAccess = true, defaultAccess = M_READ
+
+		$insertData = array(
+			'name'		=> $name,
+			'parent'	=> $this->_id,
+			'comment'	=> $comment,
+			'owner'		=> $ownerid,
+			'inheritAccess'	=> true,
+			'defaultAccess'	=> M_READ,
+			'sequence'	=> $sequence,
+		);
+		$res = $this->db->insert('phpgw_mydms_Folders', $insertData, '', __LINE__, __FILE__, 'mydms');
+
+		if (!$res)
+			return false;
+		
+		unset($this->_subFolders);
+		
+		return getFolder($this->db->get_last_insert_id('phpgw_mydms_Folders','id'));
+	}
+
+	/**
+	 * Gibt ein Array mit allen Eltern, "Groï¿œelter" usw bis zum RootFolder zurï¿œck
+	 * Der Ordner selbst ist das letzte Element dieses Arrays
+	 */
+	function getPath()
+	{
+		if (!isset($this->_parentID) || ($this->_parentID == "") || ($this->_parentID == 0))
+			return array($this);
+		else
+		{
+			$res = $this->getParent();
+			if (!$res) return false;
+			
+			$path = $this->_parent->getPath();
+			if (!$path) return false;
+			
+			array_push($path, $this);
+			return $path;
+		}
+	}
+
+	/**
+	 * Gibt ein Array mit allen Eltern, "Groï¿œelter" usw bis zum RootFolder zurï¿œck
+	 * Der Ordner selbst ist das letzte Element dieses Arrays
+	 */
+	function getPathNew()
+	{
+		if (!isset($this->_parentID) || ($this->_parentID == "") || ($this->_parentID == 0))
+			return array($this->_id => $this);
+		else
+		{
+			$res = $this->getParent();
+			if (!$res) return false;
+			
+			#print "search parent ".$this->_id."<br>";
+			$path = $this->_parent->getPathNew();
+			#print "_parent->getPathNew(".$this->_id."):<br>";
+			#print "my parent ".$this->_id."<br>";
+			#_debug_array($path);
+			if (!$path) return false;
+			
+			#$path = array_merge($path, array($this->_id => $this));
+			#$path[] = array($this);
+			unset($this->_parent);
+			#print "me ".$this->_id."<br>";
+			#_debug_array($this);
+			$path[$this->_id] = $this;
+			return $path;
+		}
+	}
+
+	/**
+	 * ï¿œberprï¿œft, ob dieser Ordner ein Unterordner von $folder ist
+	 */
+	function isDescendant($folder)
+	{
+		if ($this->_parentID == $folder->getID())
+			return true;
+		else if (isset($this->_parentID))
+		{
+			$res = $this->getParent();
+			if (!$res) return false;
+			
+			return $this->_parent->isDescendant($folder);
+		}
+		else
+			return false;
+	}
+
+	function getDocuments()
+	{
+		if (!isset($this->_documents))
+		{
+			$queryStr = "SELECT * FROM phpgw_mydms_Documents WHERE folder = " . $this->_id . " ORDER BY sequence";
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+			if (is_bool($resArr) && !$resArr)
+				return false;
+			
+			$this->_documents = array();
+			foreach ($resArr as $row)
+				array_push($this->_documents, new Document($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritaccess"], $row["defaultaccess"], $row["locked"], $row["keywords"], $row["sequence"]));
+		}
+		return $this->_documents;
+	}
+
+	function addDocument($name, $comment, $expires, $owner, $keywords, $tmpFile, $orgFileName, $fileType, $mimeType, $sequence)
+	{
+		$ownerid = $GLOBALS['phpgw_info']['user']['account_id'];		
+
+		$expires = (!$expires) ? 0 : $expires;
+
+
+		$insertData = array(
+			'name'		=> $name,
+			'comment'	=> $comment,
+			'date'		=> mktime(),
+			'expires'	=> $expires,
+			'owner'		=> $ownerid,
+			'folder'	=> $this->_id,
+			'inheritAccess'	=> true,
+			'defaultAccess'	=> M_READ,
+			'locked'	=> -1,
+			'keywords'	=> $keywords,
+			'sequence'	=> $sequence,
+		);
+		$res = $this->db->insert('phpgw_mydms_Documents', $insertData, '', __LINE__, __FILE__, 'mydms');
+
+		if (!$res)
+			return false;
+
+		#unset($this->_subFolders);
+		
+		#return getFolder($this->db->get_last_insert_id('phpgw_mydms_Folders','id'));
+
+		#$queryStr = "INSERT INTO phpgw_mydms_Documents (name, comment, date, expires, owner, folder, inheritAccess, defaultAccess, locked, keywords, sequence) VALUES ".
+		#			"('".$name."', '".$comment."', " . mktime().", ".$expires.", ".$ownerid.", ".$this->_id.", true, ".M_READ.", -1, '".$keywords."', " . $sequence . ")";
+		#if (!$GLOBALS['mydms']->db->getResult($queryStr))
+		#	return false;
+		
+		$document = getDocument($this->db->get_last_insert_id('phpgw_mydms_Documents','id'));
+		
+		$res = $document->addContent($comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType);
+		if (is_bool($res) && !$res)
+		{
+			$queryStr = "DELETE FROM phpgw_mydms_Documents WHERE id = " . $document->getID();
+			$GLOBALS['mydms']->db->getResult($queryStr);
+			return false;
+		}
+		
+		return $document;
+	}
+
+	function remove()
+	{
+		//Entfernen der Unterordner und Dateien
+		$res = $this->getSubFolders();
+		if (is_bool($res) && !$res) return false;
+		$res = $this->getDocuments();
+		if (is_bool($res) && !$res) return false;
+		
+		foreach ($this->_subFolders as $subFolder)
+		{
+			$res = $subFolder->remove();
+			if (!$res) return false;
+		}
+		
+		foreach ($this->_documents as $document)
+		{
+			$res = $document->remove();
+			if (!$res) return false;
+		}
+		
+		//Entfernen der Datenbankeintrï¿œge
+		$queryStr = "DELETE FROM phpgw_mydms_Folders WHERE id =  " . $this->_id;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		
+		return true;
+	}
+
+
+	function getAccessList()
+	{
+
+		if ($this->inheritsAccess())
+		{
+			$res = $this->getParent();
+			if (!$res) return false;
+			return $this->_parent->getAccessList();
+		}
+		
+		if (!isset($this->_accessList))
+		{
+			$queryStr = "SELECT * FROM phpgw_mydms_ACLs WHERE targetType = ".T_FOLDER." AND target = " . $this->_id . " ORDER BY targetType";
+
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+
+
+			if (is_bool($resArr) && !$resArr)
+				return false;
+			
+			$this->_accessList = array("groups" => array(), "users" => array());
+			foreach ($resArr as $row)
+			{
+				if ($row["userid"] != -1)
+					array_push($this->_accessList["users"], new UserAccess($row["userid"], $row["mode"]));
+				else //if ($row["groupID"] != -1)
+					array_push($this->_accessList["groups"], new GroupAccess($row["groupid"], $row["mode"]));
+			}
+		}
+
+		return $this->_accessList;
+	}
+
+	function clearAccessList()
+	{
+		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE targetType = " . T_FOLDER . " AND target = " . $this->_id;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	function addAccess($mode, $userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userid" : "groupid";
+		
+		$queryStr = "INSERT INTO phpgw_mydms_ACLs (target, targetType, ".$userOrGroup.", mode) VALUES 
+					(".$this->_id.", ".T_FOLDER.", " . $userOrGroupID . ", " .$mode. ")";
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	function changeAccess($newMode, $userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$queryStr = "UPDATE phpgw_mydms_ACLs SET mode = " . $newMode . " WHERE targetType = ".T_FOLDER." AND target = " . $this->_id . " AND " . $userOrGroup . " = " . $userOrGroupID;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	function removeAccess($userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE targetType = ".T_FOLDER." AND target = ".$this->_id." AND ".$userOrGroup." = " . $userOrGroupID;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	/*
+	 * Liefert die Art der Zugriffsberechtigung fï¿œr den User $user; Mï¿œgliche Rechte: n (keine), r (lesen), w (schreiben+lesen), a (alles)
+	 * Zunï¿œchst wird Geprï¿œft, ob die Berechtigung geerbt werden soll; in diesem Fall wird die Anfrage an den Eltern-Ordner weitergeleitet.
+	 * Ansonsten werden die ACLs durchgegangen: Die hï¿œchstwertige Berechtigung gilt.
+	 * Wird bei den ACLs nicht gefunden, wird die Standard-Berechtigung zurï¿œckgegeben.
+	 * Ach ja: handelt es sich bei $user um den Besitzer ist die Berechtigung automatisch "a".
+	 */
+	function getAccessMode($user)
+	{
+		GLOBAL $settings;
+
+
+		//Admin??
+		if ($user->isAdmin())
+			return M_ALL;
+		
+		//Besitzer ??
+		if ($user->getID() == $this->_ownerID)
+			return M_ALL;
+		
+		//Gast-Benutzer??
+		if (($user->getID() == $settings->_guestID) && ($settings->_enableGuestLogin))
+		{
+			$mode = $this->getDefaultAccess();
+			if ($mode >= M_READ)
+				return M_READ;
+			else
+				return M_NONE;
+		}
+
+		//Berechtigung erben??
+		// wird ï¿œber GetAccessList() bereits realisiert.
+		// durch das Verwenden der folgenden Zeilen wï¿œren auch Owner-Rechte vererbt worden.
+		/*
+		if ($this->inheritsAccess())
+		{
+			if (isset($this->_parentID))
+			{
+				if (!$this->getParent())
+					return false;
+				return $this->_parent->getAccessMode($user);
+			}
+		}
+		*/
+		
+		$highestPrivileged = M_NONE;
+		
+		//ACLs durchforsten
+		$foundInACL = false;
+		$accessList = $this->getAccessList();
+		if (!$accessList) {
+			return false;
+		}
+
+		foreach ($accessList["users"] as $userAccess)
+		{
+
+
+			if ($userAccess->getUserID() == $user->getID())
+			{
+				$foundInACL = true;
+				if ($userAccess->getMode() > $highestPrivileged)
+					$highestPrivileged = $userAccess->getMode();
+				if ($highestPrivileged == M_ALL) //hï¿œher geht's nicht -> wir kï¿œnnen uns die arbeit schenken
+					return $highestPrivileged;
+			}
+		}
+		foreach ($accessList["groups"] as $groupAccess)
+		{
+			if ($user->isMemberOfGroup($groupAccess->getGroup()))
+			{
+				$foundInACL = true;
+				if ($groupAccess->getMode() > $highestPrivileged)
+					$highestPrivileged = $groupAccess->getMode();
+				if ($highestPrivileged == M_ALL) //hï¿œher geht's nicht -> wir kï¿œnnen uns die arbeit schenken
+					return $highestPrivileged;
+			}
+		}
+		if ($foundInACL)
+			return $highestPrivileged;
+		
+		//Standard-Berechtigung verwenden
+		return $this->getDefaultAccess();
+	}
+
+	function getNotifyList()
+	{
+		if (!isset($this->_notifyList))
+		{
+			$queryStr ="SELECT * FROM phpgw_mydms_Notify WHERE targetType = " . T_FOLDER . " AND target = " . $this->_id;
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+			if (is_bool($resArr) && $resArr == false)
+				return false;
+			
+			$this->_notifyList = array("groups" => array(), "users" => array());
+			foreach ($resArr as $row)
+			{
+				if ($row["userid"] != -1)
+					array_push($this->_notifyList["users"], getUser($row["userid"]) );
+				else //if ($row["groupID"] != -1)
+					array_push($this->_notifyList["groups"], getGroup($row["groupid"]) );
+			}
+		}
+		return $this->_notifyList;
+	}
+
+	function addNotify($userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$queryStr = "INSERT INTO phpgw_mydms_Notify (target, targetType, " . $userOrGroup . ") VALUES (" . $this->_id . ", " . T_FOLDER . ", " . $userOrGroupID . ")";
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		
+		unset($this->_notifyList);
+		return true;
+	}
+
+	function removeNotify($userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE target = " . $this->_id . " AND targetType = " . T_FOLDER . " AND " . $userOrGroup . " = " . $userOrGroupID;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		
+		unset($this->_notifyList);
+		return true;
+	}
+}
+
+?>
Index: /contrib/Dms/inc/inc.ClassDocument.php
===================================================================
--- /contrib/Dms/inc/inc.ClassDocument.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassDocument.php	(revision 3526)
@@ -0,0 +1,1069 @@
+<?php
+
+function getDocument($id)
+{
+	if (!is_numeric($id))
+		die ("invalid documentid");
+	
+	$queryStr = "SELECT * FROM phpgw_mydms_Documents WHERE id = " . $id;
+	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+	if (is_bool($resArr) && $resArr == false)
+		return false;
+	
+	if (count($resArr) != 1)
+		return false;
+
+	$resArr = $resArr[0];
+	$newDocument = new Document($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["locked"], $resArr["keywords"], $resArr["sequence"]);
+
+	if($newDocument->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id'])) > M_NONE)
+		return $newDocument;
+	else
+		return false;
+}
+
+class Document
+{
+	var $_id;
+	var $_name;
+	var $_comment;
+	var $_ownerID;
+	var $_folderID;
+	var $_expires;
+	var $_inheritAccess;
+	var $_defaultAccess;
+	var $_locked;
+	var $_keywords;
+	var $_sequence;
+	
+	function Document($id, $name, $comment, $date, $expires, $ownerID, $folderID, $inheritAccess, $defaultAccess, $locked, $keywords, $sequence)
+	{
+		$this->_id = $id;
+		$this->_name = $name;
+		$this->_comment = $comment;
+		$this->_date = $date;
+		$this->_expires = $expires;
+		$this->_ownerID = $ownerID;
+		$this->_folderID = $folderID;
+		$this->_inheritAccess = $inheritAccess;
+		$this->_defaultAccess = $defaultAccess;
+		$this->_locked = $locked;
+		$this->_keywords = $keywords;
+		$this->_sequence = $sequence;
+
+		$this->db = clone($GLOBALS['phpgw']->db);
+		$this->db->set_app('mydms');
+	}
+
+	function getID() { return $this->_id; }
+
+	function getName() { return $this->_name; }
+
+	function setName($newName)
+	{
+		$data = array('name' => $newName);
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_name = $newName;
+		return true;
+	}
+
+	function getComment() { return $this->_comment; }
+
+	function setComment($newComment)
+	{
+		$data = array('comment' => $newComment);
+		$where = array('id' => $this->_id);
+
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		                        
+		$this->_comment = $newComment;
+		return true;
+	}
+
+	function getKeywords() { return $this->_keywords; }
+
+	function setKeywords($newKeywords)
+	{
+		$data = array('keywords' => $newKeywords);
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_keywords = $newKeywords;
+		return true;
+	}
+
+	function getDate()
+	{
+		return $this->_date;
+	}
+
+	function getFolder()
+	{
+		if (!isset($this->_folder))
+			$this->_folder = getFolder($this->_folderID);
+		return $this->_folder;
+	}
+
+	function setFolder($newFolder)
+	{
+		$data = array('folder' => $newFolder->getID());
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_folderID = $newFolder->getID();
+		$this->_folder = $newFolder;
+		return true;
+	}
+
+	function getOwner()
+	{
+		if (!isset($this->_owner))
+			$this->_owner = getUser($this->_ownerID);
+		return $this->_owner;
+	}
+
+	function setOwner($user)
+	{
+		$data = array('owner' => $user->getID());
+		$where = array('id' => $this->_id);
+
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_ownerID = $user->getID();
+		$this->_owner = $user;
+		return true;
+	}
+
+	function getDefaultAccess()
+	{
+		if ($this->inheritsAccess())
+		{
+			$res = $this->getFolder();
+			if (!$res) return false;
+			return $this->_folder->getDefaultAccess();
+		}
+		return $this->_defaultAccess;
+	}
+
+	function setDefaultAccess($mode)
+	{
+		$data = array('defaultAccess' => $mode);
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_defaulAccess = $mode;
+		return true;
+	}
+
+	function inheritsAccess() { return $this->_inheritAccess; }
+
+	function setInheritAccess($inheritAccess)
+	{
+		$inheritAccess = ($inheritAccess) ? "1" : "0";
+		$data = array('inheritAccess' => $inheritAccess);
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_inheritAccess = $inheritAccess;
+		return true;
+	}
+
+	function expires()
+	{
+		if (intval($this->_expires) == 0)
+			return false;
+		else
+			return true;
+	}
+
+	function getExpires()
+	{
+		if (intval($this->_expires) == 0)
+			return false;
+		else
+			return $this->_expires;
+	}
+
+	function setExpires($expires)
+	{
+		$expires = (!$expires) ? 0 : $expires;
+		$data = array('expires' => $expires);
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_expires = $expires;
+		return true;
+	}
+
+	function isLocked() { return $this->_locked != -1; }
+
+	function setLocked($falseOrUser)
+	{
+		$locked = (is_object($falseOrUser)) ? $falseOrUser->getID() : -1;
+		$data = array('locked' => $locked);
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		unset($this->_lockingUser);
+		$this->_locked = $locked;
+		return true;
+	}
+
+	function getLockingUser()
+	{
+		if (!$this->isLocked())
+			return false;
+		
+		if (!isset($this->_lockingUser))
+			$this->_lockingUser = getUser($this->_locked);
+		return $this->_lockingUser;
+	}
+
+	function getSequence() { return $this->_sequence; }
+
+	function setSequence($seq)
+	{
+		$data = array('sequence' => $seq);
+		$where = array('id' => $this->_id);
+		
+		if(!$this->db->update('phpgw_mydms_Documents', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		$this->_sequence = $seq;
+		return true;
+	}
+
+	function clearAccessList()
+	{
+		$where = array(
+			'targetType'	=> T_DOCUMENT,
+			'target'	=> $this->_id,
+		);
+		
+		if(!$this->db->delete('phpgw_mydms_ACLs', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	function getAccessList()
+	{
+		if ($this->inheritsAccess())
+		{
+			$res = $this->getFolder();
+			if (!$res) return false;
+			return $this->_folder->getAccessList();
+		}
+		
+		if (!isset($this->_accessList))
+		{
+			$cols = array('userID', 'groupID', 'mode');
+			$where = array(
+				'targetType'	=> T_DOCUMENT,
+				'target'	=> $this->_id,
+			);
+			
+			if(!$this->db->select('phpgw_mydms_ACLs', $cols, $where, __LINE__, __FILE__, false, 'ORDER BY targetType')) {
+				return false;
+			}
+
+			$this->_accessList = array("groups" => array(), "users" => array());
+			while ($this->db->next_record()) {
+				if ($this->db->f('userID') != -1)
+					array_push($this->_accessList["users"], new UserAccess($this->db->f('userid'), $this->db->f('mode')));
+				else //if ($row["groupID"] != -1)
+					array_push($this->_accessList["groups"], new GroupAccess($this->db->f('groupid'), $this->db->f('mode')));
+			}
+			
+		#	$queryStr = "SELECT * FROM phpgw_mydms_ACLs WHERE targetType = ".T_DOCUMENT." AND target = " . $this->_id . " ORDER BY targetType";
+		#	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+		#	if (is_bool($resArr) && !$resArr)
+		#		return false;
+		#	
+		#	$this->_accessList = array("groups" => array(), "users" => array());
+		#	foreach ($resArr as $row)
+		#	{
+		#		if ($row["userID"] != -1)
+		#			array_push($this->_accessList["users"], new UserAccess($row["userID"], $row["mode"]));
+		#		else //if ($row["groupID"] != -1)
+		#			array_push($this->_accessList["groups"], new GroupAccess($row["groupID"], $row["mode"]));
+		#	}
+		}
+
+		return $this->_accessList;
+	}
+
+	function addAccess($mode, $userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$data = array (
+			'target'	=> $this->_id,
+			'targetType'	=> T_DOCUMENT,
+			$userOrGroup	=> $userOrGroupID,
+			'mode'		=> $mode,
+		);
+		$res = $this->db->insert('phpgw_mydms_ACLs', $data, '', __LINE__, __FILE__);
+		if (!$res) {
+			return false;
+		}
+		
+		#$queryStr = "INSERT INTO phpgw_mydms_ACLs (target, targetType, ".$userOrGroup.", mode) VALUES 
+		#			(".$this->_id.", ".T_DOCUMENT.", " . $userOrGroupID . ", " .$mode. ")";
+		#if (!$GLOBALS['mydms']->db->getResult($queryStr))
+		#	return false;
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	function changeAccess($newMode, $userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$data	= array('mode'	=> $newMode);
+		$where	= array(
+			'targetType'	=> T_DOCUMENT, 
+			'target'	=> $this->_id, 
+			$userOrGroup	=> $userOrGroupID,
+		);
+		
+		if(!$this->db->update('phpgw_mydms_ACLs', $data, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+	#	$queryStr = "UPDATE phpgw_mydms_ACLs SET mode = " . $newMode . " WHERE targetType = ".T_DOCUMENT." AND target = " . $this->_id . " AND " . $userOrGroup . " = " . $userOrGroupID;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	function removeAccess($userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$where = array(
+			'targetType'	=> T_DOCUMENT,
+			'target'	=> $this->_id,
+			$userOrGroup	=> $userOrGroupID,
+		);
+		
+		if(!$this->db->delete('phpgw_mydms_ACLs', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+	#	$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE targetType = ".T_DOCUMENT." AND target = ".$this->_id." AND ".$userOrGroup." = " . $userOrGroupID;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		unset($this->_accessList);
+		return true;
+	}
+
+	/*
+	 * Liefert die Art der Zugriffsberechtigung fï¿œr den User $user; Mï¿œgliche Rechte: n (keine), r (lesen), w (schreiben+lesen), a (alles)
+	 * Zunï¿œchst wird Geprï¿œft, ob die Berechtigung geerbt werden soll; in diesem Fall wird die Anfrage an den Eltern-Ordner weitergeleitet.
+	 * Ansonsten werden die ACLs durchgegangen: Die hï¿œchstwertige Berechtigung gilt.
+	 * Wird bei den ACLs nicht gefunden, wird die Standard-Berechtigung zurï¿œckgegeben.
+	 * Ach ja: handelt es sich bei $user um den Besitzer ist die Berechtigung automatisch "a".
+	 */
+	function getAccessMode($user)
+	{
+		//Administrator??
+		if ($user->isAdmin())
+			return M_ALL;
+		
+		//Besitzer??
+		if ($user->getID() == $this->_ownerID)
+			return M_ALL;
+		
+		//Gast-Benutzer??
+		if (($user->getID() == $GLOBALS['mydms']->settings->_guestID) && ($GLOBALS['mydms']->settings->_enableGuestLogin))
+		{
+			$mode = $this->getDefaultAccess();
+			if ($mode >= M_READ)
+				return M_READ;
+			else
+				return M_NONE;
+		}
+		
+		//Berechtigung erben??
+		// wird ï¿œber GetAccessList() bereits realisiert.
+		// durch das Verwenden der folgenden Zeilen wï¿œren auch Owner-Rechte vererbt worden.
+		/*
+		if ($this->inheritsAccess())
+		{
+			if (!$this->getFolder())
+				return false;
+			return $this->_folder->getAccessMode($user);
+		}
+		*/
+		$highestPrivileged = M_NONE;
+		
+		//ACLs durchforsten
+		$foundInACL = false;
+		$accessList = $this->getAccessList();
+		if (!$accessList)
+			return false;
+		
+		foreach ($accessList["users"] as $userAccess)
+		{
+			if ($userAccess->getUserID() == $user->getID())
+			{
+				$foundInACL = true;
+				if ($userAccess->getMode() > $highestPrivileged)
+					$highestPrivileged = $userAccess->getMode();
+				if ($highestPrivileged == M_ALL) //hï¿œher geht's nicht -> wir kï¿œnnen uns die arbeit schenken
+					return $highestPrivileged;
+			}
+		}
+		foreach ($accessList["groups"] as $groupAccess)
+		{
+			if ($user->isMemberOfGroup($groupAccess->getGroup()))
+			{
+				$foundInACL = true;
+				if ($groupAccess->getMode() > $highestPrivileged)
+					$highestPrivileged = $groupAccess->getMode();
+				if ($highestPrivileged == M_ALL) //hï¿œher geht's nicht -> wir kï¿œnnen uns die arbeit schenken
+					return $highestPrivileged;
+			}
+		}
+		if ($foundInACL)
+			return $highestPrivileged;
+		
+		//Standard-Berechtigung verwenden
+		return $this->getDefaultAccess();
+	}
+
+	function getNotifyList()
+	{
+		if (!isset($this->_notifyList))
+		{
+			$cols = array('userID', 'groupID');
+			$where = array(
+				'targetType'	=> T_DOCUMENT,
+				'target'	=> $this->_id,
+			);
+			
+			if(!$this->db->select('phpgw_mydms_Notify', $cols, $where, __LINE__, __FILE__)) {
+				return false;
+			}
+
+			$this->_notifyList = array("groups" => array(), "users" => array());
+			while ($this->db->next_record()) {
+				if ($this->db->f('userID') != -1)
+					array_push($this->_notifyList["users"], getUser($this->db->f('userid')));
+				else //if ($row["groupID"] != -1)
+					array_push($this->_notifyList["groups"], getGroup($this->db->f('groupid')));
+			}
+			
+		#	$queryStr ="SELECT * FROM phpgw_mydms_Notify WHERE targetType = " . T_DOCUMENT . " AND target = " . $this->_id;
+		#	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+		#	if (is_bool($resArr) && $resArr == false)
+		#		return false;
+		#	
+		#	$this->_notifyList = array("groups" => array(), "users" => array());
+		#	foreach ($resArr as $row)
+		#	{
+		#		if ($row["userID"] != -1)
+		#			array_push($this->_notifyList["users"], getUser($row["userID"]) );
+		#		else //if ($row["groupID"] != -1)
+		#			array_push($this->_notifyList["groups"], getGroup($row["groupID"]) );
+		#	}
+		}
+		return $this->_notifyList;
+	}
+
+	function addNotify($userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+
+		$data = array (
+			'target'	=> $this->_id,
+			'targetType'	=> T_DOCUMENT,
+			$userOrGroup	=> $userOrGroupID,
+		);
+		$res = $this->db->insert('phpgw_mydms_Notify', $data, '', __LINE__, __FILE__);
+		if (!$res) {
+			return false;
+		}
+		
+	#	$queryStr = "INSERT INTO phpgw_mydms_Notify (target, targetType, " . $userOrGroup . ") VALUES (" . $this->_id . ", " . T_DOCUMENT . ", " . $userOrGroupID . ")";
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		unset($this->_notifyList);
+		return true;
+	}
+
+	function removeNotify($userOrGroupID, $isUser)
+	{
+		$userOrGroup = ($isUser) ? "userID" : "groupID";
+		
+		$where = array(
+			'targetType'	=> T_DOCUMENT,
+			'target'	=> $this->_id,
+			$userOrGroup	=> $userOrGroupID,
+		);
+		
+		if(!$this->db->delete('phpgw_mydms_Notify', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+	#	$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE target = " . $this->_id . " AND targetType = " . T_DOCUMENT . " AND " . $userOrGroup . " = " . $userOrGroupID;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		unset($this->_notifyList);
+		return true;
+	}
+
+
+	function addContent($comment, $user, $tmpFile, $orgFileName, $fileType, $mimeType)
+	{
+//		if ($this->isLocked() && ($user->getID() != $this->getLockingUser()->getID()))
+//			return false;
+		
+		$res = $this->getContent();
+		if (is_bool($res) && !$res)
+			return false;
+		
+		if (count($this->_content) == 0) {
+			$newVersion = 1;
+		} else {
+			$res = $this->getLatestContent();
+			if (is_bool($res) && !$res)
+				return false;
+			$newVersion = $this->_latestContent->getVersion()+1;
+		}
+
+		$dir = getSuitableDocumentDir();
+		if (is_bool($res) && !$res)
+			return false;
+
+		//Kopieren der temporï¿œren Datei
+		if(!file_exists($GLOBALS['mydms']->settings->_contentDir . $dir))
+		{
+			if (!makeDir($GLOBALS['mydms']->settings->_contentDir . $dir))
+				return false;
+		}
+
+		if (!copyFile($tmpFile, $GLOBALS['mydms']->settings->_contentDir . $dir . "data" . $fileType))
+			return false;
+
+		//Eintrag in phpgw_mydms_DocumentContent
+		$insertData = array(
+			'document'	=> $this->_id,
+			'version'	=> $newVersion,
+			'comment'	=> $comment,
+			'date'		=> mktime(),
+			'createdBy'	=> $user->getID(),
+			'dir'		=> $dir,
+			'orgFileName'	=> $orgFileName,
+			'fileType'	=> $fileType,
+			'mimeType'	=> $mimeType,
+		);
+		$res = $this->db->insert('phpgw_mydms_DocumentContent', $insertData, '', __LINE__, __FILE__);
+		if (!$res)
+			return false;
+			
+	#	$queryStr = "INSERT INTO phpgw_mydms_DocumentContent (document, version, comment, date, createdBy, dir, orgFileName, fileType, mimeType) VALUES ".
+	#				"(".$this->_id.", ".$newVersion.", '".$comment."', ".mktime().", ".$user->getID().", '".$dir."', '".$orgFileName."', '".$fileType."', '" . $mimeType . "')";
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		unset($this->_content);
+		unset($this->_latestContent);
+		
+		$this->getLatestContent();
+	#	if ($GLOBALS['mydms']->settings->_enableConverting && in_array($this->_latestContent->getFileType(), array_keys($GLOBALS['mydms']->settings->_convertFileTypes)))
+	#		$this->_latestContent->convert(); //Auch wenn das schiefgeht, wird deswegen nicht gleich alles "hingeschmissen" (sprich: false zurï¿œckgegeben)
+		
+//		$this->setLocked(false);
+		
+		return true;
+	}
+
+	function getContent()
+	{
+		if (!isset($this->_content))
+		{
+			$cols = array('id', 'document', 'version', 'comment', 'date', 'createdBy', 'dir', 'orgFileName', 'fileType', 'mimeType');
+			$where = array(
+				'document'	=> $this->_id,
+			);
+			
+			if(!$this->db->select('phpgw_mydms_DocumentContent', $cols, $where, __LINE__, __FILE__, false, 'ORDER BY version')) {
+				return false;
+			}
+
+			$this->_content = array();
+			while ($this->db->next_record()) {
+				array_push(
+					$this->_content, 
+					new DocumentContent(
+						$this->db->f('id'), 
+						$this->db->f('document'), 
+						$this->db->f('version'), 
+						$this->db->f('comment'), 
+						$this->db->f('date'), 
+						$this->db->f('createdby'), 
+						$this->db->f('dir'), 
+						$this->db->f('orgfilename'), 
+						$this->db->f('filetype'), 
+						$this->db->f('mimetype')
+					)
+				);
+			}
+			
+		#	$queryStr = "SELECT * FROM phpgw_mydms_DocumentContent WHERE document = ".$this->_id." ORDER BY version";
+		#	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+		#	if (is_bool($resArr) && !$res)
+		#		return false;
+		#	
+		#	$this->_content = array();
+		#	foreach ($resArr as $row)
+		#		array_push($this->_content, new DocumentContent($row["id"], $row["document"], $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"]));
+		}
+		
+		return $this->_content;
+	}
+
+	function getContentByVersion($version)
+	{
+		if (!is_numeric($version))
+			die ("invalid version");
+		
+		if (isset($this->_content))
+		{
+			foreach ($this->_content as $revision)
+			{
+				if ($revision->getVersion() == $version)
+					return $revision;
+			}
+			return false;
+		}
+		
+		$cols = array('id', 'document', 'version', 'comment', 'date', 'createdBy', 'dir', 'orgFileName', 'fileType', 'mimeType');
+		$where = array(
+			'document'	=> $this->_id,
+			'version'	=> $version,
+		);
+			
+		if(!$this->db->select('phpgw_mydms_DocumentContent', $cols, $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+		if ($this->db->next_record()) {
+			return new DocumentContent(
+				$this->db->f('id'), 
+				$this->db->f('document'), 
+				$this->db->f('version'), 
+				$this->db->f('comment'), 
+				$this->db->f('date'), 
+				$this->db->f('createdby'), 
+				$this->db->f('dir'), 
+				$this->db->f('orgfilename'), 
+				$this->db->f('filetype'), 
+				$this->db->f('mimetype')
+			);
+		} else {
+			return false;
+		}
+			
+	#	$queryStr = "SELECT * FROM phpgw_mydms_DocumentContent WHERE document = ".$this->_id." AND version = " . $version;
+	#	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+	#	if (is_bool($resArr) && !$res)
+	#		return false;
+	#	if (count($resArr) != 1)
+	#		return false;
+	#	
+	#	$resArr = $resArr[0];
+	#	return new DocumentContent($resArr["id"], $resArr["document"], $resArr["version"], $resArr["comment"], $resArr["date"], $resArr["createdBy"], $resArr["dir"], $resArr["orgFileName"], $resArr["fileType"], $resArr["mimeType"]);
+	}
+
+	function getLatestContent()
+	{
+		if (!isset($this->_latestContent))
+		{
+/*			if (isset($this->_content))
+			{
+				$this->getContent();
+				$this->_latestContent =  $this->_content[count($this->_content)-1];
+				return $this->_latestContent;
+			}
+			*/
+			$cols = array('id', 'document', 'version', 'comment', 'date', 'createdBy', 'dir', 'orgFileName', 'fileType', 'mimeType');
+			$where = array(
+				'document'	=> $this->_id,
+			);
+			
+			if(!$this->db->select('phpgw_mydms_DocumentContent', $cols, $where, __LINE__, __FILE__, false, 'ORDER BY version DESC')) {
+				return false;
+			}
+
+			$this->_latestContent = array();
+			if ($this->db->next_record()) {
+				$this->_latestContent = new DocumentContent(
+					$this->db->f('id'), 
+					$this->db->f('document'), 
+					$this->db->f('version'), 
+					$this->db->f('comment'), 
+					$this->db->f('date'), 
+					$this->db->f('createdby'), 
+					$this->db->f('dir'), 
+					$this->db->f('orgfilename'), 
+					$this->db->f('filetype'), 
+					$this->db->f('mimeType')
+				);
+			}
+	
+		#	$queryStr = "SELECT * FROM phpgw_mydms_DocumentContent WHERE document = ".$this->_id." ORDER BY version DESC";
+		#	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+		#	if (is_bool($resArr) && !$resArr)
+		#		return false;
+		#	
+		#	$resArr = $resArr[0];
+		#	$this->_latestContent = new DocumentContent($resArr["id"], $resArr["document"], $resArr["version"], $resArr["comment"], $resArr["date"], $resArr["createdBy"], $resArr["dir"], $resArr["orgFileName"], $resArr["fileType"], $resArr["mimeType"]);
+		}
+		return $this->_latestContent;
+	}
+
+	function getDocumentLinks()
+	{
+		if (!isset($this->_documentLinks))
+		{
+			$queryStr = "SELECT * FROM phpgw_mydms_DocumentLinks WHERE document = " . $this->_id;
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+			if (is_bool($resArr) && !$resArr)
+				return false;
+			$this->_documentLinks = array();
+			
+			foreach ($resArr as $row)
+				array_push($this->_documentLinks, new DocumentLink($row["id"], $row["document"], $row["target"], $row["userID"], $row["public"]));
+		}
+		return $this->_documentLinks;
+	}
+
+	function addDocumentLink($targetID, $userID, $public)
+	{
+		$data = array(
+			'document'	=> $this->_id,
+			'target'	=> $targetID,
+			'userID'	=> $userID,
+			'public'	=> $GLOBALS['phpgw']->db->quote($public,'bool'),
+		);
+		$res = $this->db->insert('phpgw_mydms_DocumentLinks', $data, '', __LINE__, __FILE__);
+		if (!$res)
+			return false;
+
+	#	$queryStr = "INSERT INTO phpgw_mydms_DocumentLinks(document, target, userID, public) VALUES (".$this->_id.", ".$targetID.", ".$userID.", " . $GLOBALS['phpgw']->db->quote($public,'bool').")";
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		unset($this->_documentLinks);
+		return true;
+	}
+
+	function removeDocumentLink($linkID)
+	{
+		$where = array(
+			'id'	=> $linkID,
+		);
+		
+		if(!$this->db->delete('phpgw_mydms_DocumentLinks', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+	#	$queryStr = "DELETE FROM phpgw_mydms_DocumentLinks WHERE id = " . $linkID;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		unset ($this->_documentLinks);
+		return true;
+	}
+
+
+	function remove()
+	{
+		$res = $this->getContent();
+		if (is_bool($res) && !$res) return false;
+
+		for ($i = 0; $i < count($this->_content); $i++) {
+			if (!$this->_content[$i]->remove()) {
+				return false;
+			}
+		}
+
+		$where = array('id' => $this->_id);
+		if(!$this->db->delete('phpgw_mydms_Documents', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+		$where = array('target'	=> $this->_id, 'targetType' => T_DOCUMENT);
+		if(!$this->db->delete('phpgw_mydms_ACLs', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		if(!$this->db->delete('phpgw_mydms_Notify', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+		$where = array('document' => $this->_id, 'target' => $this->_id);
+		if(!$this->db->delete('phpgw_mydms_DocumentLinks', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+
+	#	$queryStr = "DELETE FROM phpgw_mydms_Documents WHERE id = " . $this->_id;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+	#	$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE target = " . $this->_id . " AND targetType = " . T_DOCUMENT;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+	#	$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE target = " . $this->_id . " AND targetType = " . T_DOCUMENT;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+	#	$queryStr = "DELETE FROM phpgw_mydms_DocumentLinks WHERE document = " . $this->_id . " OR target = " . $this->_id;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		return true;
+	}
+}
+
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+/**
+ * Die Datei wird als "data.ext" (z.b. data.txt) gespeichert. Getrennt davon wird in der DB der ursprï¿œngliche
+ * Dateiname festgehalten (-> $orgFileName). Die Datei wird deshalb nicht unter diesem ursprï¿œnglichen Namen
+ * gespeichert, da es zu Problemen mit verschiedenen Dateisystemen kommen kann: Linux hat z.b. Probleme mit
+ * deutschen Umlauten, wï¿œhrend Windows wiederum den Doppelpunkt in Dateinamen nicht verwenden kann.
+ * Der ursprï¿œngliche Dateiname wird nur zum Download verwendet (siehe op.Download.pgp)
+ */
+class DocumentContent
+{
+
+	function DocumentContent($id, $documentID, $version, $comment, $date, $userID, $dir, $orgFileName, $fileType, $mimeType)
+	{
+		$this->_id = $id;
+		$this->_documentID = $documentID;
+		$this->_version = $version;
+		$this->_comment = $comment;
+		$this->_date = $date;
+		$this->_userID = $userID;
+		$this->_dir = $dir;
+		$this->_orgFileName = $orgFileName;
+		$this->_fileType = $fileType;
+		$this->_mimeType = $mimeType;
+
+		$this->db = clone($GLOBALS['phpgw']->db);
+		$this->db->set_app('mydms');
+	}
+
+	function getVersion() { return $this->_version; }
+	function getComment() { return $this->_comment; }
+	function getDate() { return $this->_date; }
+	function getOriginalFileName() { return $this->_orgFileName; }
+	function getFileType() { return $this->_fileType; }
+	function getFileName(){ return "data" . $this->_fileType; }
+	function getDir() { return $this->_dir; }
+	function getMimeType() { return $this->_mimeType; }
+	function getUser()
+	{
+		if (!isset($this->_user))
+			$this->_user = getUser($this->_userID);
+		return $this->_user;
+	}
+	function getPath() { return $this->_dir ."data" . $this->_fileType;  }
+
+	function convert()
+	{
+		if (file_exists($GLOBALS['mydms']->settings->_contentDir . $this->_dir . "index.html"))
+			return true;
+		
+		if (!in_array($this->_fileType, array_keys($GLOBALS['mydms']->settings->_convertFileTypes)))
+			return false;
+		
+		$source = $GLOBALS['mydms']->settings->_contentDir . $this->_dir . $this->getFileName();
+		$target = $GLOBALS['mydms']->settings->_contentDir . $this->_dir . "index.html";
+	//	$source = str_replace("/", "\\", $source);
+	//	$target = str_replace("/", "\\", $target);
+		
+		$command = $GLOBALS['mydms']->settings->_convertFileTypes[$this->_fileType];
+		$command = str_replace("{SOURCE}", "\"$source\"", $command);
+		$command = str_replace("{TARGET}", "\"$target\"", $command);
+		
+		$output = array();
+		$res = 0;
+		exec($command, $output, $res);
+		
+		if ($res != 0)
+		{
+			print (implode("\n", $output));
+			return false;
+		}
+		return true;
+	}
+
+	function viewOnline()
+	{
+		if (in_array($this->_fileType, $GLOBALS['mydms']->settings->_viewOnlineFileTypes))
+			return true;
+		if ($GLOBALS['mydms']->settings->_enableConverting && in_array($this->_fileType, array_keys($GLOBALS['mydms']->settings->_convertFileTypes)))
+			if ($this->wasConverted())
+				return true;
+		
+		return false;
+	}
+
+	function wasConverted()
+	{
+		return file_exists($GLOBALS['mydms']->settings->_contentDir . $this->_dir . "index.html");
+	}
+
+	function getURL()
+	{
+		if (!$this->viewOnline())
+			return false;
+		
+		if (in_array($this->_fileType, $GLOBALS['mydms']->settings->_viewOnlineFileTypes))
+			return "/" . $this->_documentID . "/" . $this->_version . "/" . $this->getOriginalFileName();
+		else
+			return "/" . $this->_documentID . "/" . $this->_version . "/index.html";
+	}
+
+	function remove()
+	{
+		# does this check make sense here??? Lars
+		#if (!removeDir($GLOBALS['mydms']->settings->_contentDir . $this->_dir)) {
+		#	return false;
+		#}
+
+		$where = array(
+			'id'	=> $this->_id,
+		);
+		
+		if(!$this->db->delete('phpgw_mydms_DocumentContent', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+		
+		return true;
+	}
+}
+
+
+ /* ---------------------------------------------------------------------------------------------------- */
+function getDocumentLink($linkID)
+{
+	if (!is_numeric($linkID))
+		die ("invalid linkID");
+	
+	$queryStr = "SELECT * FROM phpgw_mydms_DocumentLinks WHERE id = " . $linkID;
+	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+	if (is_bool($resArr) && !$resArr)
+		return false;
+	
+	$resArr = $resArr[0];
+	return new DocumentLink($resArr["id"], $resArr["document"], $resArr["target"], $resArr["userID"], $resArr["public"]);
+}
+
+function filterDocumentLinks($user, $links)
+{
+	$tmp = array();
+	foreach ($links as $link)
+		if ($link->isPublic() || ($link->_userID == $user->getID()) || ($user->getID() == $GLOBALS['mydms']->settings->_adminID) )
+			array_push($tmp, $link);
+	return $tmp;
+}
+
+class DocumentLink
+{
+	var $_id;
+	var $_documentID;
+	var $_targetID;
+	var $_userID;
+	var $_public;
+
+	function DocumentLink($id, $documentID, $targetID, $userID, $public)
+	{
+		$this->_id = $id;
+		$this->_documentID = $documentID;
+		$this->_targetID = $targetID;
+		$this->_userID = $userID;
+		$this->_public = $public;
+
+		$this->db = clone($GLOBALS['phpgw']->db);
+		$this->db->set_app('mydms');
+	}
+
+	function getID() { return $this->_id; }
+
+	function getDocument()
+	{
+		if (!isset($this->_document))
+			$this->_document = getDocument($this->_documentID);
+		return $this->_document;
+	}
+
+	function getTarget()
+	{
+		if (!isset($this->_target))
+			$this->_target = getDocument($this->_targetID);
+		return $this->_target;
+	}
+
+	function getUser()
+	{
+		if (!isset($this->_user))
+			$this->_user = getUser($this->_userID);
+		return $this->_user;
+	}
+
+	function isPublic() { return $this->_public; }
+
+	function remove()
+	{
+		$where = array(
+			'id'	=> $this->_id,
+		);
+		
+		if(!$this->db->delete('phpgw_mydms_DocumentLinks', $where, __LINE__, __FILE__)) {
+			return false;
+		}
+	#	$queryStr = "DELETE FROM phpgw_mydms_DocumentLinks WHERE id = " . $this->_id;
+	#	if (!$GLOBALS['mydms']->db->getResult($queryStr))
+	#		return false;
+		
+		return true;
+	}
+}
Index: /contrib/Dms/inc/inc.ClassUser.php
===================================================================
--- /contrib/Dms/inc/inc.ClassUser.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassUser.php	(revision 3526)
@@ -0,0 +1,393 @@
+<?php
+
+/**********************************************************************\
+|                  statische, User-bezogene Funktionen                 |
+\**********************************************************************/
+//added by dawnlinux to port mydms user management to egroupware
+function phpgw_name2id($login)
+{
+	$id = $GLOBALS['phpgw']->accounts->name2id($login);
+	return $id;
+}
+
+function phpgw_id2name($id)
+{
+	$login = $GLOBALS['phpgw']->accounts->id2name($id);
+        return $login;
+
+}
+
+function phpgw_get_accname($id)
+{
+	$GLOBALS['phpgw']->accounts->get_account_name($id,$lid,$fname,$lname);
+	$fullname = $fname.' '.$lname;
+	return $fullname;
+}
+
+function phpgw_get_accemail($id)
+{
+	$email = $GLOBALS['phpgw']->accounts->id2name($id, 'account_email');
+	return $email;
+}
+
+function phpgw_is_admin($id)
+{
+	if($id == 0)
+	{
+		$id = $GLOBALS['phpgw_info']['user']['account_id'];
+	}
+
+	$acl = CreateObject('phpgwapi.acl',$id);
+	if ($acl->check('run',1,'admin'))
+	{
+		return true;
+	}
+	else
+	{
+		return false;
+	}
+}
+
+function getUser($id)
+{
+	$resArr["id"] = $id;
+	$resArr["login"] = phpgw_id2name($id);
+	$resArr["fullName"] = phpgw_get_accname($id);
+	$resArr["email"] = phpgw_get_accemail($id);
+	$resArr["isAdmin"] = phpgw_is_admin($id);
+
+	$resArr["pwd"] = '';
+	$resArr["comment"] = '';
+	return new User($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["comment"], $resArr["isAdmin"]);
+}
+
+function getUserByLogin($login)
+{
+	$id = $this->phpgw_name2id($login);
+	$resArr["id"] = $id;
+        $resArr["login"] = $login;
+        $resArr["fullName"] = $this->phpgw_get_accname($id);
+        $resArr["email"] = $this->phpgw_get_accemail($id);
+        $resArr["isAdmin"] = $this->phpgw_is_admin($id);
+
+        $resArr["pwd"] = '';
+        $resArr["comment"] = '';
+		
+	return new User($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["comment"], $resArr["isAdmin"]);
+}
+
+
+function getAllUsers()
+{
+
+	$accounts = $GLOBALS['phpgw']->accounts->get_list('accounts'); 
+	
+	for ($i = 0; $i < count($accounts); $i++)
+	{
+		$id = $accounts[$i]["account_id"];
+		$login = $accounts[$i]["account_lid"];
+		$fullName = $accounts[$i]['account_firstname'].' '.$accounts[$i]['account_lastname'];
+		$email = $accounts[$i]["account_email"];
+		$isAdmin = phpgw_is_admin($id);
+		$pwd = '';
+		$comment = '';
+		$users[$i] = new User($id, $login, $pwd, $fullName, $email, $comment, $isAdmin);
+	}
+	
+	return $users;
+}
+
+
+function addUser($login, $pwd, $fullName, $email, $comment)
+{
+	echo "add user is disabled \n";
+	/*GLOBAl $db;
+	
+	$queryStr = "INSERT INTO phpgw_mydms_Users (login, pwd, fullName, email, comment, isAdmin) VALUES ('".$login."', '".$pwd."', '".$fullName."', '".$email."', '".$comment."', false)";
+	$res = $db->getResult($queryStr);
+	if (!$res)
+		return false;
+	
+	return getUser($db->getInsertID('phpgw_mydms_Users','id'));*/
+}
+
+
+/**********************************************************************\
+|                            User-Klasse                               |
+\**********************************************************************/
+
+class User
+{
+	var $_id;
+	var $_login;
+	var $_pwd;
+	var $_fullName;
+	var $_email;
+	var $_comment;
+	var $_isAdmin;
+
+	function User($id, $login, $pwd, $fullName, $email, $comment, $isAdmin)
+	{
+		$this->_id = $id;
+		$this->_login = $login;
+		$this->_pwd = $pwd;
+		$this->_fullName = $fullName;
+		$this->_email = $email;
+		$this->_comment = $comment;
+		$this->_isAdmin = $isAdmin;
+	}
+
+	function getID() { return $this->_id; }
+
+	function getLogin() { return $this->_login; }
+
+	function setLogin($newLogin)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Users SET login ='" . $newLogin . "' WHERE id = " . $this->_id;
+		$res = $db->getResult($queryStr);
+		if (!$res)
+			return false;
+		
+		$this->_login = $newLogin;
+		return true;
+	}
+
+	function getFullName() { return $this->_fullName; }
+
+	function setFullName($newFullName)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Users SET fullname = '" . $newFullName . "' WHERE id = " . $this->_id;
+		$res = $db->getResult($queryStr);
+		if (!$res)
+			return false;
+		
+		$this->_fullName = $newFullName;
+		return true;
+	}
+
+	function getPwd() { return $this->_pwd; }
+
+	function setPwd($newPwd)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Users SET pwd ='" . $newPwd . "' WHERE id = " . $this->_id;
+		$res = $db->getResult($queryStr);
+		if (!$res)
+			return false;
+		
+		$this->_pwd = $newPwd;
+		return true;
+	}
+
+	function getEmail() { return $this->_email; }
+
+	function setEmail($newEmail)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Users SET email ='" . $newEmail . "' WHERE id = " . $this->_id;
+		$res = $db->getResult($queryStr);
+		if (!$res)
+			return false;
+		
+		$this->_email = $newEmail;
+		return true;
+	}
+
+	function getComment() { return $this->_comment; }
+
+	function setComment($newComment)
+	{
+		GLOBAL $db;
+		
+		$queryStr = "UPDATE phpgw_mydms_Users SET comment ='" . $newComment . "' WHERE id = " . $this->_id;
+		$res = $db->getResult($queryStr);
+		if (!$res)
+			return false;
+		
+		$this->_comment = $newComment;
+		return true;
+	}
+
+	function isAdmin() { return $this->_isAdmin; }
+
+	function setAdmin($isAdmin)
+	{
+		GLOBAL $db;
+		
+		$isAdmin = $isAdmin ? "1" : "0";
+		$queryStr = "UPDATE phpgw_mydms_Users SET isAdmin = " . $GLOBALS['phpgw']->db->quote($isAdmin) . " WHERE id = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		$this->_isAdmin = $isAdmin;
+		return true;
+	}
+
+	/**
+	 * Entfernt den Benutzer aus dem System.
+	 * Dies ist jedoch nicht mit einem Lï¿œschen des entsprechenden Eintrags aus phpgw_mydms_Users geschehen - vielmehr
+	 * muss dafï¿œr gesorgt werden, dass der Benutzer nirgendwo mehr auftaucht. D.h. auch die Tabellen phpgw_mydms_ACLs,
+	 * phpgw_mydms_Notify, phpgw_mydms_GroupMembers, phpgw_mydms_Folders, phpgw_mydms_Documents und phpgw_mydms_DocumentContent mï¿œssen berï¿œcksichtigt werden.
+	 */
+	function remove()
+	{
+		GLOBAL $db, $settings;
+		
+		//Private Stichwortlisten lï¿œschen
+		$queryStr = "SELECT phpgw_mydms_Keywords.id FROM phpgw_mydms_Keywords, phpgw_mydms_KeywordCategories WHERE phpgw_mydms_Keywords.category = phpgw_mydms_KeywordCategories.id AND phpgw_mydms_KeywordCategories.owner = " . $this->_id;
+		$resultArr = $db->getResultArray($queryStr);
+		if (count($resultArr) > 0) {
+			$queryStr = "DELETE FROM phpgw_mydms_Keywords WHERE ";
+			for ($i = 0; $i < count($resultArr); $i++) {
+				$queryStr .= "id = " . $resultArr[$i]["id"];
+				if ($i + 1 < count($resultArr))
+					$queryStr .= " OR ";
+			}
+			if (!$db->getResult($queryStr))
+				return false;
+		}
+		$queryStr = "DELETE FROM phpgw_mydms_KeywordCategories WHERE owner = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		//Benachrichtigungen entfernen
+		$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE userID = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		//Der Besitz von Dokumenten oder Ordnern, deren bisheriger Besitzer der zu lï¿œschende war, geht an den Admin ï¿œber
+		$queryStr = "UPDATE phpgw_mydms_Folders SET owner = " . $settings->_adminID . " WHERE owner = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		$queryStr = "UPDATE phpgw_mydms_Documents SET owner = " . $settings->_adminID . " WHERE owner = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		$queryStr = "UPDATE phpgw_mydms_DocumentContent SET createdBy = " . $settings->_adminID . " WHERE createdBy = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		//Verweise auf Dokumente: Private lï¿œschen...
+		$queryStr = "DELETE FROM phpgw_mydms_DocumentLinks WHERE userID = " . $this->_id . " AND public = 0";
+		if (!$db->getResult($queryStr))
+			return false;
+		//... und ï¿œffentliche an Admin ï¿œbergeben
+		$queryStr = "UPDATE phpgw_mydms_DocumentLinks SET userID = " . $settings->_adminID . " WHERE userID = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		//Evtl. von diesem Benutzer gelockte Dokumente werden freigegeben
+		$queryStr = "UPDATE phpgw_mydms_Documents SET locked = -1 WHERE locked = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		//User aus allen Gruppen lï¿œschen
+		$queryStr = "DELETE FROM phpgw_mydms_GroupMembers WHERE userID = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		//User aus allen ACLs streichen
+		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE userID = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		//Eintrag aus phpgw_mydms_Users lï¿œschen
+		$queryStr = "DELETE FROM phpgw_mydms_Users WHERE id = " . $this->_id;
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		
+//		unset($this);
+		return true;
+	}
+
+	function joinGroup($group)
+	{
+		if ($group->isMember($this))
+			return false;
+		
+		if (!$group->addUser($this))
+			return false;
+		
+		unset($this->_groups);
+		return true;
+	}
+
+	function leaveGroup($group)
+	{
+		if (!$group->isMember($this))
+			return false;
+		
+		if (!$group->removeUser($this))
+			return false;
+		
+		unset($this->_groups);
+		return true;
+	}
+
+	function getGroups()
+	{
+		$usergroups = $GLOBALS['phpgw']->accounts->membership($this->_id);
+		$this->_groups = array();
+		foreach($usergroups as $phpgw_group)
+		{
+			$group = getGroup($phpgw_group['account_id']);
+			array_push($this->_groups, $group);
+		}		
+		return $this->_groups;
+	}
+
+	function isMemberOfGroup($group)
+	{
+		return $group->isMember($this);
+	}
+
+	function hasImage()
+	{
+		if (!isset($this->_hasImage))
+		{
+			GLOBAL $db;
+			
+			$queryStr = "SELECT COUNT(*) AS num FROM phpgw_mydms_UserImages WHERE userID = " . $this->_id;
+			$resArr = $db->getResultArray($queryStr);
+			if (is_bool($resArr) && $resArr == false)
+				return false;
+			
+			if ($resArr[0]["num"] == 0)	$this->_hasImage = false;
+			else $this->_hasImage = true;
+		}
+		
+		return $this->_hasImage;
+	}
+
+	function getImageURL()
+	{
+		GLOBAL $settings;
+		
+//		if (!$this->hasImage())
+//			return false;
+		return $settings->_httpRoot . "out/out.UserImage.php?userid=" . $this->_id;
+	}
+
+	function setImage($tmpfile, $mimeType)
+	{
+		GLOBAL $db;
+		
+		$fp = fopen($tmpfile, "rb");
+		if (!$fp) return false;
+		$content = fread($fp, filesize($tmpfile));
+		fclose($fp);
+		
+		if ($this->hasImage())
+			$queryStr = "UPDATE phpgw_mydms_UserImages SET image = '".base64_encode($content)."', mimeType = '". $mimeType."' WHERE userID = " . $this->_id;
+		else
+			$queryStr = "INSERT INTO phpgw_mydms_UserImages (userID, image, mimeType) VALUES (" . $this->_id . ", '".base64_encode($content)."', '".$mimeType."')";
+		if (!$db->getResult($queryStr))
+			return false;
+		
+		$this->_hasImage = true;
+		return true;
+	}
+}
+
+
+?>
Index: /contrib/Dms/inc/inc.DBAccess.php
===================================================================
--- /contrib/Dms/inc/inc.DBAccess.php	(revision 3526)
+++ /contrib/Dms/inc/inc.DBAccess.php	(revision 3526)
@@ -0,0 +1,70 @@
+<?php
+///////////////////////////////////////////////////////////////////////
+// We dont use ths db class any more, and use the egroupware db      //
+// class instead, rewritten by Shang Wenbin <wbsh@realss.com>        //
+///////////////////////////////////////////////////////////////////////
+
+//include $settings->_ADOdbPath . "adodb.inc.php";
+
+class DatabaseAccess
+{
+	var $db;
+	/**
+	 * just copy the existent class $GLOBALS['phpgw']->db 
+	 */
+	function connect()
+	{
+		copyobj($GLOBALS['phpgw']->db,$this->db);
+	}
+
+	/**
+	 * always return true
+	 */
+	function ensureConnected()
+	{
+		if(!is_object($this->db))
+		{
+			$this->connect();
+		}
+		return true;
+	}
+
+	function getResultArray($queryStr)
+	{
+		$resArr = array();
+
+		$res = $this->db->query($queryStr,__LINE__,__FILE__);
+		$resArr = $res->GetArray();
+		$res->Close();
+		return $resArr;
+	}
+
+	/**
+	 * seems only used for update query
+	 */
+	function getResult($queryStr)
+	{
+		return $this->db->query($queryStr,__LINE__,__FILE__);
+	}
+
+	/**
+	 * get the last insert id
+	 * @param string $table
+	 * @param string $column
+	 * @return int
+	 */
+	function getInsertID($table,$column)
+	{
+		return $this->db->get_last_insert_id($table,$column);
+	}
+
+}
+
+
+$db = new DatabaseAccess();
+$db->connect();
+
+$GLOBALS['mydms']->db = new DatabaseAccess();
+$GLOBALS['mydms']->db->connect();
+
+?>
Index: /contrib/Dms/inc/class.uifolder.inc.php
===================================================================
--- /contrib/Dms/inc/class.uifolder.inc.php	(revision 3526)
+++ /contrib/Dms/inc/class.uifolder.inc.php	(revision 3526)
@@ -0,0 +1,227 @@
+<?php
+	/***************************************************************************\
+	* eGroupWare - mydms                                                        *
+	* http://www.linux-at-work.de                                               *
+	* http://www.phpgw.de                                                       *
+	* http://www.egroupware.org                                                 *
+	* Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
+	* -------------------------------------------------                         *
+	* 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.                       *
+	\***************************************************************************/
+	
+	/* $Id: class.uifolder.inc.php 22760 2006-10-28 07:37:32Z lkneschke $ */
+
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.Settings.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.AccessUtils.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassAccess.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassUser.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassGroup.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassFolder.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassDocument.php');
+
+	class uifolder
+	{
+		var $public_functions = array
+		(
+			'copyFolder'		=> 'true',
+			'getInitialFolderView'	=> 'true',
+			'getSubFolder'		=> 'true',
+		);
+		
+		function uifolder() {
+			$this->charset  = $GLOBALS['phpgw']->translation->charset();
+		}
+		
+		function copyFolder()
+		{
+			if(isset($_GET['folderid']) && isset($_POST['targetid']) && isset($_POST['copy']))
+			{
+				$bo	=& CreateObject('mydms.bofolder');
+				
+				$folderID = (int)$_GET['folderid'];
+				$targetID = (int)$_POST['targetid'];
+				$newFolderName = $_POST['newfoldername'];
+				
+				//var_export($_POST);
+				//options
+				$copySubFolder = ($_POST['copy_subfolder'] == 'on' ? true : false);
+				$copyDocuments = ($_POST['copy_documents'] == 'on' ? true : false);
+				
+				if($newFolder = $bo->copyFolder($folderID, $targetID, $newFolderName, $copySubFolder, $copyDocuments))
+				{
+					$newFolderID = $newFolder->getID();
+				}
+				else
+				{
+					$newFolderID = 1;
+				}
+				$GLOBALS['phpgw']->redirect_link('/mydms/out/out.ViewFolder.php','folderid=' . $newFolderID);
+			}
+			elseif(isset($_GET['folderid']) && isset($_POST['cancel']))
+			{
+				$folderID = ((int)$_GET['folderid'] > 0 ? (int)$_GET['folderid'] : 1);
+				// redirect
+				$GLOBALS['phpgw']->redirect_link('/mydms/out/out.ViewFolder.php','folderid=' . $folderID);
+			}
+
+			$t 	=& CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+
+			$folderID = (int)$_GET['folderid'];
+			$formName = $_GET['form'];
+			
+			$folder = getFolder($folderID);
+			$parent = $folder->getParent();
+
+			$this->display_app_header();
+			$this->translate($t);
+		
+			$t->set_file(array("copyFolder" => "copyFolder.tpl"));
+			$t->set_block('copyFolder', 'main', 'main');
+
+			$t->set_var('current_folder_id',$folderID);
+			$t->set_var('newfoldername',$folder->getName());
+
+			$t->set_var('foldername',$parent->getName());
+			$t->set_var('folderid',$parent->getID());
+			
+			$linkData = array
+			(
+				'menuaction'    => 'mydms.uimydms.folderChooser',
+			);
+			$t->set_var('folderChooserURL', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+			$linkData = array
+			(
+				'menuaction'    => 'mydms.uimydms.folderChooser',
+			);
+			$t->set_var('folderChooserURL', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+			$linkData = array
+			(
+				'menuaction'    => 'mydms.uifolder.copyFolder',
+				'folderid'	=> $folderID,
+			);
+			$t->set_var('form_action', $GLOBALS['phpgw']->link('/index.php',$linkData));
+
+			$t->parse("out","main");
+			
+			print $t->get('out','main');
+		}
+		
+		function display_app_header()
+		{
+			if(!@is_object($GLOBALS['phpgw']->js))
+			{
+				$GLOBALS['phpgw']->js =& CreateObject('phpgwapi.javascript');
+			}
+			if (!is_object($GLOBALS['phpgw']->jscalendar))
+			{
+				$GLOBALS['phpgw']->jscalendar = CreateObject('phpgwapi.jscalendar');
+			}
+			$GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon');
+			$GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXTree');
+			$GLOBALS['phpgw']->js->validate_file('jscode','mydms','mydms');
+
+			$GLOBALS['phpgw_info']['flags']['include_xajax'] = True;
+
+			$GLOBALS['phpgw']->common->phpgw_header();
+			
+			echo parse_navbar();
+		}
+
+		function generateXML($_folder, $_childID, $_targetID, $_childContent) {
+			
+			$subFolders = $_folder->getSubFolders();
+			
+			foreach((array)$subFolders as $subFolderObject) {
+				$subFolderID	= $subFolderObject->getID();
+				$subFolderName	= htmlspecialchars($subFolderObject->getName(), ENT_QUOTES, $this->charset);
+				$hasSubfolder	= ($subFolderObject->getSubFolders() ? 1 : 0);
+				$childContent	= ($subFolderID == $_childID ? $_childContent : '');
+				$selectedNode	= ($subFolderID == $_targetID ? " select='1'" : '');
+				$openNode	= ($subFolderID == $_childID ? " open='1'" : '');
+				$retValue .="<item child='$hasSubfolder' id='$subFolderID' text='$subFolderName' im0='folderClosed.gif'$selectedNode$openNode>$childContent</item>";
+			}
+
+			return $retValue;
+		}
+		
+		function getInitialFolderView()
+		{
+			header("Content-type:text/xml"); 
+			print("<?xml version=\"1.0\" encoding=\"$this->charset\"?>");
+			
+			if (isset($_GET["id"]))
+				$folderID=$_GET["id"];
+			else
+				$folderID=1;
+
+			if($folderObject = getFolder($folderID)) {
+			
+				$path = $folderObject->getPathNew();
+			
+				$xmlContent	= '';
+				$clientID	= $folderID;
+			
+				// skip the last path part
+				array_pop($path);
+
+				while($subFolder = array_pop($path)) {
+					$xmlContent	= $this->generateXML($subFolder, $clientID, $folderID, $xmlContent);
+					$clientID	= $subFolder->getID();
+				}
+
+			}
+			print "<tree id='$clientID'>$xmlContent</tree>";
+			
+			$GLOBALS['phpgw']->common->phpgw_exit();
+		}
+			
+		function getSubFolder()
+		{
+			header("Content-type:text/xml");
+			print("<?xml version=\"1.0\" encoding=\"$this->charset\"?>");
+			if (isset($_GET["id"]))
+				$folderID=$_GET["id"];
+			else
+				$folderID=1;
+
+			print("<tree id='".$folderID."'>");
+
+			if($folderObject = getFolder($folderID)) {
+			
+				$subFolders = $folderObject->getSubFolders();
+			
+
+				foreach((array)$subFolders as $subFolderObject) {
+					$subFolderID	= $subFolderObject->getID();
+					$subFolderName	= lang(htmlspecialchars($subFolderObject->getName(), ENT_QUOTES, $this->charset));
+					$hasSubfolder	= ($subFolderObject->getSubFolders() ? 1 : 0);
+					print("<item child='$hasSubfolder' id='$subFolderID' text='$subFolderName' im0='folderClosed.gif'></item>");
+				}
+
+			}
+
+			print("</tree>");
+
+			$GLOBALS['phpgw']->common->phpgw_exit();
+		}
+
+		function translate(&$template)
+		{
+			$template->set_var('lang_cancel',lang('cancel'));
+			$template->set_var('lang_copy',lang('copy'));
+			$template->set_var('lang_copy_documents',lang('copy documents'));
+			$template->set_var('lang_copy_options',lang('copy options'));
+			$template->set_var('lang_copy_subfolders',lang('copy subfolders'));
+			$template->set_var('lang_folder',lang('folder'));
+			$template->set_var('lang_name',lang('name'));
+			$template->set_var('lang_select_folder',lang('select folder'));
+			$template->set_var('lang_select_target_folder',lang('Select target folder'));
+			$template->set_var('lang_target_folder',lang('target folder'));
+		}
+	}
+?>
Index: /contrib/Dms/inc/class.bomydms.inc.php
===================================================================
--- /contrib/Dms/inc/class.bomydms.inc.php	(revision 3526)
+++ /contrib/Dms/inc/class.bomydms.inc.php	(revision 3526)
@@ -0,0 +1,387 @@
+<?php
+	/***************************************************************************\
+	* eGroupWare - mydms                                                        *
+	* http://www.linux-at-work.de                                               *
+	* http://www.egroupware.org                                                 *
+	* Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
+	* -------------------------------------------------                         *
+	* 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; either version 2 of the License.                *
+	\***************************************************************************/
+	
+	/* $Id: class.bomydms.inc.php 22717 2006-10-24 10:12:31Z lkneschke $ */
+
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.AccessUtils.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassUser.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassFolder.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassDocument.php');
+	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.FileUtils.php');
+
+	class bomydms
+	{
+		function addACL($_documentID, $_userID, $_groupID, $_access)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+			
+			if($_userID !== false)
+			{
+				$document->addAccess($_access, $_userID, true);
+			}
+
+			if($_groupID !== false)
+			{
+				$document->addAccess($_access, $_groupID, false);
+			}
+		}
+	
+		function addNotification($_documentID, $_userID, $_groupID)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_READWRITE)	return false;
+			
+			if($_userID !== false)
+			{
+				$document->addNotify($_userID, true);
+			}
+
+			if($_groupID !== false)
+			{
+				$document->addNotify($_groupID, false);
+			}
+		}
+	
+		function deleteACL($_documentID, $_userID, $_groupID)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+			
+			if($_userID !== false)
+			{
+				$document->removeAccess($_userID, true);
+			}
+
+			if($_groupID !== false)
+			{
+				$document->removeAccess($_groupID, false);
+			}
+		}
+
+		function deleteDocument($_documentID)
+		{
+			if(!$_documentID)	return false;
+			
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+			
+			if (!$document->remove())
+			{
+				return false;
+			}
+			
+			return true;
+		}
+
+		function deleteFile($_documentID, $_version)
+		{
+			if(!$_documentID || !$_version)	return false;
+			
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+			
+			if(!$version  = $document->getContentByVersion($_version))
+			{
+				return false;
+			}
+			
+			if (!$version->remove())
+			{
+				return false;
+			}
+			
+			return true;
+		}
+
+		function deleteNotification($_documentID, $_userID, $_groupID)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_READWRITE)	return false;
+			
+			if($_userID !== false)
+			{
+				$document->removeNotify($_userID, true);
+			}
+
+			if($_groupID !== false)
+			{
+				$document->removeNotify($_groupID, false);
+			}
+		}
+		
+		function inheritACL($_documentID, $_action, $_mode)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+			
+			switch($_action)
+			{
+				case 'notinherit':
+					switch($_mode)
+					{
+						case 'copy':
+							$defAccess = $document->getDefaultAccess();
+							$document->setInheritAccess(false);
+							$document->setDefaultAccess($defAccess);
+							
+							$folder = $document->getFolder();
+							$accessList = $folder->getAccessList();
+							
+							foreach ($accessList["users"] as $userAccess)
+								$document->addAccess($userAccess->getMode(), $userAccess->getUserID(), true);
+								
+							foreach ($accessList["groups"] as $groupAccess)
+								$document->addAccess($groupAccess->getMode(), $groupAccess->getGroupID(), false);
+							                                
+							return true;
+							
+							break;
+							
+						case 'empty':
+							$defAccess = $document->getDefaultAccess();
+							$document->setInheritAccess(false);
+							$document->setDefaultAccess($defAccess);
+							                                
+							return true;
+							
+							break;
+					}
+					break;
+
+				case 'inherit':
+					$document->clearAccessList();
+					$document->setInheritAccess(true);
+					
+					return true;
+						
+					break;
+			}
+			
+			return false;
+		}
+		
+		function moveDocument($_documentID, $_targetID)
+		{
+			if(!$_documentID || !$_targetID)	return false;
+			
+			$document	= getDocument($_documentID);
+			
+			$oldFolder	= $document->getFolder();
+			$targetFolder	= getFolder($_targetID);
+
+
+			$accessModeDocument	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			$accessModeFolder	= $targetFolder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if (($accessModeDocument < M_READWRITE) || ($accessModeFolder < M_READWRITE))
+				return false;
+			
+			if ($document->setFolder($targetFolder))
+			{
+				return true;
+			}
+			
+			return false;
+		}
+
+		function setDefaultAccess($_documentID, $_mode)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+
+			$document->setDefaultAccess($_mode);
+			
+			return true;
+		}
+	
+		function setOwner($_documentID, $_owner)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+
+			$document->setOwner(getUser($_owner));
+			
+			return true;
+		}
+	
+		function updateACL($_documentID, $_userID, $_groupID, $_access)
+		{
+			if(!$_documentID)       return false;
+
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+			
+			if($accessMode < M_ALL)	return false;
+			
+			if($_userID !== false)
+			{
+				$document->changeAccess($_access, $_userID, true);
+			}
+
+			if($_groupID !== false)
+			{
+				$document->changeAccess($_access, $_groupID, false);
+			}
+		}
+
+		function updateDocument($_documentID, $_fileName, $_comment, $_keywords, $_expireDate)
+		{
+			if(!$_documentID)		return false;
+			
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']));
+
+			if($accessMode < M_READWRITE)	return false;
+			
+			if ( (($document->getName() == $_fileName) || $document->setName($_fileName))
+				&& (($document->getComment() == $_comment) || $document->setComment($_comment))
+				&& (($document->getKeywords() == $_keywords) || $document->setKeywords($_keywords))
+				&& (($document->getExpires() == $_expireDate) || $document->setExpires($_expireDate))
+			#	&& (($sequence == "keep") || $document->setSequence($sequence))
+			)
+			{
+				return true;
+			}
+			
+			return false;
+		}
+
+		function updateFile($_documentID, $_userfile, $_comment, $_expireDate)
+		{
+			if(!$_documentID)		return false;
+			
+			$user		= getUser($GLOBALS['phpgw_info']['user']['account_id']);
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode($user);
+
+			if($accessMode < M_READWRITE)	return false;
+			
+			if ($document->isLocked())
+			{
+				$lockingUser = $document->getLockingUser();
+				
+				if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL))
+				{
+					return false;
+				}
+				else
+				{
+					$document->setLocked(false);
+				}
+			}
+			
+			if(is_uploaded_file($_userfile['tmp_name']))
+			{
+				$lastDotIndex = strrpos(basename($_userfile['name']), ".");
+				if (is_bool($lastDotIndex) && !$lastDotIndex)
+					$fileType = ".";
+				else
+					$fileType = substr($_userfile['name'], $lastDotIndex);
+
+				if (!$document->addContent($_comment, $user, $_userfile['tmp_name'], basename($_userfile['name']), $fileType, $_userfile['type']))
+				{
+					return false;
+				}
+
+				if(!$document->setExpires($_expireDate))
+				{
+					return false;
+				}
+
+				return true;
+			}
+			
+			return false;
+		}
+		
+		function updateLockStatus($_documentID, $_lockStatus)
+		{
+			if(!$_documentID)	return false;
+			
+			$user		= getUser($GLOBALS['phpgw_info']['user']['account_id']);
+			$document	= getDocument($_documentID);
+			$accessMode	= $document->getAccessMode($user);
+
+			if($accessMode < M_READWRITE)	return false;
+			
+			if($_lockStatus == 'locked')
+			{
+				if ($document->isLocked())
+				{
+					// take over lock
+					if (($lockingUser->getID() == $user->getID()) || ($accessMode == M_ALL))
+					{
+						if ($document->setLocked($user))
+						{
+							return true;
+						}
+					}
+				}
+				else
+				{
+					if ($document->setLocked($user))
+					{
+						return true;
+					}
+				}
+			}
+			elseif($_lockStatus == 'unlocked')
+			{
+				$lockingUser = $document->getLockingUser();
+				
+				if (($lockingUser->getID() == $user->getID()) || ($accessMode == M_ALL))
+				{
+					if ($document->setLocked("false"))
+					{
+						return true;
+					}
+				}
+			}
+			
+			return false;
+		}
+	}
+?>
Index: /contrib/Dms/inc/inc.Authentication.php
===================================================================
--- /contrib/Dms/inc/inc.Authentication.php	(revision 3526)
+++ /contrib/Dms/inc/inc.Authentication.php	(revision 3526)
@@ -0,0 +1,24 @@
+<?php
+include_once("inc.Utils.php");
+
+switch($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
+{
+	case 'zh':
+	  $lang1 = 'Chinese';
+	  break;
+	case 'en':
+          $lang1 = 'English';
+          break;
+        case 'de':
+          $lang1 = 'German';
+          break;
+	default:
+	  $lang1 = "English";
+}
+
+$user = getUser($GLOBALS['phpgw_info']['user']['account_id']);
+
+$theme = 'English';
+include $settings->_rootDir . "languages/".$lang1."/lang.inc";
+
+?>
Index: /contrib/Dms/TreeMenu.php
===================================================================
--- /contrib/Dms/TreeMenu.php	(revision 3526)
+++ /contrib/Dms/TreeMenu.php	(revision 3526)
@@ -0,0 +1,321 @@
+<?php
+  // 2002-11-02 cchapin:
+  //   This version of the TreeMenu includes my HTML_TreeNodeStyle subclass extension,
+  //   as well as a few other changes.  It is based on release version v1.0.4.
+
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002, Richard Heyes, Harald Radi                        |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.| 
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard@phpguru.org>                           |
+// |         Harald Radi <harald.radi@nme.at>                              |
+// +-----------------------------------------------------------------------+
+//
+// $Id: TreeMenu.php,v 1.7 2002/07/27 12:43:15 richard Exp $
+
+/**
+* HTML_TreeMenu Class
+*
+* A simple couple of PHP classes and some not so simple
+* Jabbascript which produces a tree menu. In IE this menu
+* is dynamic, with branches being collapsable. In IE5+ the
+* status of the collapsed/open branches persists across page
+* refreshes.In any other browser the tree is static. Code is
+* based on work of Harald Radi.
+*
+* Usage.
+*
+* After installing the package, copy the example php script to
+* your servers document root. Also place the TreeMenu.js and the
+* images folder in the same place. Running the script should
+* then produce the tree.
+*
+* @author  Richard Heyes <richard@php.net>
+* @author  Harald Radi <harald.radi@nme.at>
+* @access  public
+* @package HTML_TreeMenu
+*/
+
+class HTML_TreeMenu
+{
+  /**
+    * Indexed array of subnodes
+  * @var array
+    */
+  var $items;
+
+  /**
+    * The layer ID
+  * @var string
+    */
+  var $layer;
+
+  /**
+    * Path to the images
+  * @var string
+    */
+  var $images;
+
+  /**
+    * Name of the object
+  * This should not be changed without changing
+  * the javascript.  (no longer true)
+  * @var string
+    */
+  var $menuobj;
+
+  /**
+    * Constructor
+  *
+  * @access public
+  * @param  string $layer          The name of the layer to add the HTML to.
+  *                                In browsers that do not support document.all
+  *                                or document.getElementById(), document.write()
+  *                                is used, and thus this layer name has no effect.
+  * @param  string $images         The path to the images folder.
+  * @param  string $linkTarget     The target for the link. Defaults to "_self"
+  * @param  string $usePersistence Whether to use clientside persistence. This option
+  *                                only affects ie5+.
+    */
+  function HTML_TreeMenu($layer=null, $images=null, $linkTarget = '_self', $usePersistence = true)
+  {
+    //$this->menuobj        = 'objTreeMenu';  // No longer used here. cc 2002-10-31
+    $this->layer          = $layer;
+    $this->images         = $images;
+    $this->linkTarget     = $linkTarget;
+    $this->usePersistence = $usePersistence;
+  }
+
+  /**
+    * This function adds an item to the the tree.
+  *
+  * @access public
+  * @param  object $menu The node to add. This object should be
+  *                      a HTML_TreeNode object.
+  * @return object       Returns a reference to the new node inside
+  *                      the tree.
+  */
+  function &addItem(&$menu)
+  {
+    $this->items[] = &$menu;
+    return $this->items[count($this->items) - 1];
+  }
+
+  /**
+    * This function prints the menu Jabbascript code. Should
+  * be called *AFTER* your layer tag has been printed. In the
+  * case of older browsers, eg Navigator 4, The menu HTML will
+  * appear where this function is called.
+  *
+  * @access public
+  * @param  string $layer          The name of the layer to add the HTML to.
+  *                                In browsers that do not support document.all
+  *                                or document.getElementById(), document.write()
+  *                                is used, and thus this layer name has no effect.
+  * @param  string $images         The path to the images folder.
+  */ 
+  function printMenu($images=null, $layer=null)
+  {
+    // Setting menuobj here, rather than in constructor, ensures that
+    // multiple copies of the menu have different JavaScript variable names.
+    static $_menuobjcnt=0;
+    $this->menuobj        = 'objTM'.$_menuobjcnt++;
+
+    // $images and $layer could have been set in the constructor,
+    // so don't assign to them unless a value has been supplied here.
+    if (!empty($images))     $this->images = $images;
+    if (!empty($layer))      $this->layer  = $layer;
+
+    echo "\n";
+
+    echo '<script language="javascript" type="text/javascript">' . "\n\t";
+    echo sprintf('%s = new TreeMenu("%s", "%s", "%s", "%s");',
+                 $this->menuobj,
+                 empty($this->layer) ? $this->menuobj : $this->layer,
+                 $this->images,
+                 $this->menuobj,
+                 $this->linkTarget);
+ 
+    echo "\n";
+
+    if (isset($this->items)) {
+      for ($i=0; $i<count($this->items); $i++) {
+        $this->items[$i]->_printMenu($this->menuobj . ".n[$i]");
+      }
+    }
+
+    echo sprintf("\n\t%s.drawMenu();", $this->menuobj);
+    if ($this->usePersistence) {
+      echo sprintf("\n\t%s.resetBranches();", $this->menuobj);
+    }
+    echo "\n</script>\n"; // cc 2002-10-29 add trailing \n
+  }
+  
+  function printMenu2($txt)
+  {
+    // Setting menuobj here, rather than in constructor, ensures that
+    // multiple copies of the menu have different JavaScript variable names.
+   echo $txt;
+  }
+
+} // HTML_TreeMenu
+
+/**
+* HTML_TreeNode class
+* 
+* This class is supplementary to the above and provides a way to
+* add nodes to the tree. A node can have other nodes added to it. 
+*
+* @author  Richard Heyes <richard@php.net>
+* @author  Harald Radi <harald.radi@nme.at>
+* @access  public
+* @package HTML_TreeMenu
+*/
+class HTML_TreeNode
+{
+  /**
+    * The text for this node.
+  * @var string
+    */
+  var $text;
+
+  /**
+    * The link for this node.
+  * @var string
+    */
+  var $link;
+
+  /**
+    * The icon for this node.
+  * @var string
+    */
+  var $icon;
+
+  /**
+    * Indexed array of subnodes
+  * @var array
+    */
+  var $items;
+
+  /**
+    * Whether this node is expanded or not
+  * @var bool
+    */
+  var $expanded;
+
+  /**
+    * Constructor
+  *
+  * @access public
+  * @param  string $text      The description text for this node
+  * @param  string $link      The link for the text
+  * @param  string $icon      Optional icon to appear to the left of the text
+  * @param  bool   $expanded  Whether this node is expanded or not (IE only)
+  * @param  bool   $isDynamic Whether this node is dynamic or not (no affect on non-supportive browsers)
+    */
+  function HTML_TreeNode($text = null, $link = null, $icon = null, $expanded = false, $isDynamic = true)
+  {
+    $this->text      = (string)$text;
+    $this->link      = (string)$link;
+    $this->icon      = (string)$icon;
+    $this->expanded  = $expanded;
+    $this->isDynamic = $isDynamic;
+  }
+
+  /**
+    * Adds a new subnode to this node.
+  *
+  * @access public
+  * @param  object $node The new node
+    */
+  function &addItem(&$node)
+  {
+    $this->items[] = &$node;
+    return $this->items[count($this->items) - 1];
+  }
+
+  /**
+    * Prints jabbascript for this particular node.
+  *
+  * @access private
+  * @param  string $prefix The jabbascript object to assign this node to.
+    */
+  function _printMenu($prefix)
+  {
+    echo sprintf("\t%s = new TreeNode('%s', %s, %s, %s, %s);\n",
+                 $prefix,
+                 addslashes($this->text), // cc 2002-11-01.  Text shouldn't 
+		                          // be slashed by user since static menus whill show the slashes.
+                 !empty($this->icon) ? "'" . $this->icon . "'" : 'null',
+                 !empty($this->link) ? "'" . $this->link . "'" : 'null',
+                 $this->expanded  ? 'true' : 'false',
+                 $this->isDynamic ? 'true' : 'false');
+
+    if (!empty($this->items)) {
+      for ($i=0; $i<count($this->items); $i++) {
+        $this->items[$i]->_printMenu($prefix . ".n[$i]");
+      }
+    }
+  }
+}
+
+
+
+// default style classes for use in tree text.
+static $_autostyles = array('tmenu0text', 'tmenu1text', 'tmenu2text', 'tmenu3text');
+  
+class HTML_TreeNodeStyle extends HTML_TreeNode
+{
+  var $style = false;
+
+  // Constructor
+  function HTML_TreeNodeStyle($text = null, $link = null, $icon = null, $expanded = false, $isDynamic = true, $style = false)
+  {
+    HTML_TreeNode::HTML_TreeNode($text, $link, $icon, $expanded, $isDynamic);
+    if ($style) $this->style = $style;
+    else {
+      // We want to use default style based on level in the tree
+      // Unfortunately, we cannot know our level yet so defer...
+      $this->style = 'auto';
+    }
+  } // HTML_TreeNodeStyle
+  
+  function style( $st )
+  {
+    $this->style = $st;
+  } // style
+  
+  function _printMenu($prefix)
+  {
+    HTML_TreeNode::_printMenu($prefix);
+    if ($this->style) echo "\t$prefix.style = '" . $this->style . "';\n";
+    else echo "\t$prefix.style = false;\n";
+  }	 // _printMenu	
+}
+?>
Index: /contrib/Dms/js/TreeMenu.js
===================================================================
--- /contrib/Dms/js/TreeMenu.js	(revision 3526)
+++ /contrib/Dms/js/TreeMenu.js	(revision 3526)
@@ -0,0 +1,480 @@
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002, Richard Heyes, Harald Radi                        |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.| 
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard@phpguru.org>                           |
+// |         Harald Radi <harald.radi@nme.at>                              |
+// +-----------------------------------------------------------------------+
+//
+// $Id: TreeMenu.js,v 1.6 2002/07/27 12:43:15 richard Exp $
+
+// cc 2002-10-29, default style classes for use in tree text.
+var autostyles = new Array('tmenu0text', 'tmenu1text', 'tmenu2text', 'tmenu3text');
+
+function TreeMenu(layer, iconpath, myname, linkTarget)
+{
+  // Properties
+  this.layer      = layer;
+  this.iconpath   = iconpath;
+  this.myname     = myname;
+  this.linkTarget = linkTarget;
+  this.n          = new Array();
+
+  this.branches       = new Array();
+  this.branchStatus   = new Array();
+  this.layerRelations = new Array();
+  this.childParents   = new Array();
+  
+  // Methods
+  this.preloadImages         = preloadImages;
+  this.drawMenu              = drawMenu;
+  this.toggleBranch          = toggleBranch;
+  this.swapImage             = swapImage;
+  this.doesMenu              = doesMenu;
+  this.doesPersistence       = doesPersistence;
+  this.getLayer              = getLayer;
+  this.saveExpandedStatus    = saveExpandedStatus;
+  this.loadExpandedStatus    = loadExpandedStatus;
+  this.resetBranches         = resetBranches;
+  this.checkParentVisibility = checkParentVisibility;
+  
+  this.preloadImages();
+}
+
+function TreeNode(title, icon, link, expanded, isDynamic)
+{
+  this.title     = title;
+  this.icon      = icon;
+  this.link      = link;
+  this.expanded  = expanded;
+  this.isDynamic = isDynamic;
+  this.n         = new Array();
+  this.style     = false;    // cc 2002-10-29
+}
+
+/**
+* Preload images hack for CrapZilla
+*/
+function preloadImages()
+{
+  var plustop    = new Image; plustop.src    = this.iconpath + '/plustop.gif';
+  var plusbottom = new Image; plusbottom.src = this.iconpath + '/plusbottom.gif';
+  var plus       = new Image; plus.src       = this.iconpath + '/plus.gif';
+
+  var minustop    = new Image; minustop.src    = this.iconpath + '/minustop.gif';
+  var minusbottom = new Image; minusbottom.src = this.iconpath + '/minusbottom.gif';
+  var minus       = new Image; minus.src       = this.iconpath + '/minus.gif';
+
+  var branchtop    = new Image; branchtop.src    = this.iconpath + '/branchtop.gif';
+  var branchbottom = new Image; branchbottom.src = this.iconpath + '/branchbottom.gif';
+  var branch       = new Image; branch.src       = this.iconpath + '/branch.gif';
+
+  var linebottom = new Image; linebottom.src = this.iconpath + '/linebottom.gif';
+  var line       = new Image; line.src       = this.iconpath + '/line.gif';
+}
+
+/**
+* Main function that draws the menu and assigns it
+* to the layer (or document.write()s it)
+*/
+function drawMenu()// OPTIONAL ARGS: nodes = [], level = [], prepend = '', expanded = false, visbility = 'inline', parentLayerID = null
+{
+  /**
+    * Necessary variables
+    */
+  var output        = '';
+  var modifier      = '';
+  var layerID       = 'mydmstreebox';
+  var parentLayerID = '';
+
+  /**
+    * Parse any optional arguments
+    */
+  var nodes         = arguments[0] ? arguments[0] : this.n
+  var level         = arguments[1] ? arguments[1] : [];
+  var prepend       = arguments[2] ? arguments[2] : '';
+  var expanded      = arguments[3] ? arguments[3] : false;
+  var visibility    = arguments[4] ? arguments[4] : 'inline';
+  var parentLayerID = arguments[5] ? arguments[5] : null;
+
+  var currentlevel  = level.length;
+
+  for (var i=0; i<nodes.length; i++) {
+  
+    level[currentlevel] = i+1;
+    layerID = this.layer + '_' + 'node_' + implode('_', level);
+
+    /**
+    * Store the child/parent relationship
+    */
+    this.childParents[layerID] = parentLayerID;
+
+    /**
+    * Gif modifier
+    */
+    if (i == 0 && parentLayerID == null) {
+      modifier = nodes.length > 1 ? "top" : 'single';
+    } else if(i == (nodes.length-1)) {
+      modifier = "bottom";
+    } else {
+      modifier = "";
+    }
+
+    /**
+    * Single root branch is always expanded
+    */
+    if (!doesMenu() || (parentLayerID == null && nodes.length == 1)) {
+      expanded = true;
+
+    } else if (nodes[i].expanded) {
+      expanded = true;
+
+    } else {
+      expanded = false;
+    }
+    /**
+    * Setup branch status and build an indexed array
+    * of branch layer ids
+    */
+    if (nodes[i].n.length > 0) {
+      this.branchStatus[layerID] = expanded;
+      this.branches[this.branches.length] = layerID;
+    }
+
+    /**
+    * Setup toggle relationship
+    */
+    if (!this.layerRelations[parentLayerID]) {
+      this.layerRelations[parentLayerID] = new Array();
+    }
+    this.layerRelations[parentLayerID][this.layerRelations[parentLayerID].length] = layerID;
+
+    /**
+    * Branch images
+    */
+    var gifname = nodes[i].n.length && this.doesMenu() && nodes[i].isDynamic ? (expanded ? 'minus' : 'plus') : 'branch';
+    var iconimg = nodes[i].icon ? sprintf('<img src="%s/%s" width="20" height="20" align="top">', this.iconpath, nodes[i].icon) : '';
+    
+
+    /**
+        * Build the html to write to the document
+        */
+    var divTag    = sprintf('<div id="%s" style="display: %s; behavior: url(#default#userdata)">', layerID, visibility);
+    var onMDown   = doesMenu() && nodes[i].n.length  && nodes[i].isDynamic ? sprintf('onmousedown="%s.toggleBranch(\'%s\', true)" style="cursor: pointer; cursor: hand"', this.myname, layerID) : '';
+    var imgTag    = sprintf('<img src="%s/%s%s.gif" width="20" height="20" align="top" border="0" name="img_%s" %s />', this.iconpath, gifname, modifier, layerID, onMDown);
+    var linkStart = nodes[i].link ? sprintf('<a href="%s" target="%s">', nodes[i].link, this.linkTarget) : '';
+    var linkEnd   = nodes[i].link ? '</a>' : '';
+
+    // cc 2002-10-29
+    var titleString = nodes[i].title;
+    var styleStart  = '';
+    var styleEnd    = '';
+    if (nodes[i].style == 'auto') {
+      styleInx = Math.min(currentlevel, autostyles.length-1);
+      styleStart = "<span class='"+autostyles[styleInx]+"'>"
+      styleEnd   = '</span>';
+    }
+    
+    output = sprintf('%s<nobr>%s%s%s%s%s%s%s%s</nobr><br></div>',
+                      divTag,
+		      styleStart,
+                      prepend,
+                      parentLayerID == null && nodes.length == 1 ? '' : imgTag,
+                      iconimg,
+                      linkStart,
+                      titleString,  // cc 2002-10-29
+                      linkEnd,
+		      styleEnd);
+
+    /**
+    * Write out the HTML. Uses document.write for speed over layers and
+    * innerHTML. This however means no dynamic adding/removing nodes on
+    * the client side. This could be conditional I guess if dynamic
+    * adding/removing is required.
+    */
+    if (this.doesMenu()) {
+      //this.getLayer(this.layer).innerHTML += output
+      document.write(output);
+
+    } else {
+      document.write(output);
+    }
+
+    /**
+    * Traverse sub nodes ?
+    */
+    if (nodes[i].n.length) {
+      /**
+      * Determine what to prepend. If there is only one root
+      * node then the prepend to pass to children is nothing.
+      * Otherwise it depends on where we are in the tree.
+      */
+      if (parentLayerID == null && nodes.length == 1) {
+        var newPrepend = '';
+
+      } else if (i < (nodes.length - 1)) {
+        var newPrepend = prepend + sprintf('<img src="%s/line.gif" width="20" height="20" align="top">', this.iconpath);
+
+      } else {
+        var newPrepend = prepend + sprintf('<img src="%s/linebottom.gif" width="20" height="20" align="top">', this.iconpath);
+      }
+
+      this.drawMenu(nodes[i].n,
+                    explode('_', implode('_', level)), // Seemingly necessary to enforce passing by value
+                    newPrepend,
+                    nodes[i].expanded,
+                    expanded ? 'inline' : 'none',
+                    layerID);
+    }
+  }
+}
+
+function toggleBranch(layerID, updateStatus) // OPTIONAL ARGS: noSave = false
+{
+  var currentDisplay = this.getLayer(layerID).style.display;
+  var newDisplay     = (this.branchStatus[layerID] && currentDisplay == 'inline') ? 'none' : 'inline'
+
+  for (var i=0; i<this.layerRelations[layerID].length; i++) {
+    if (this.branchStatus[this.layerRelations[layerID][i]]) {
+      this.toggleBranch(this.layerRelations[layerID][i], false);
+    }
+
+    this.getLayer(this.layerRelations[layerID][i]).style.display = newDisplay;
+  }
+
+  if (updateStatus) {
+    this.branchStatus[layerID] = !this.branchStatus[layerID];
+
+    /**
+    * Persistence
+    */
+    if (this.doesPersistence() && !arguments[2]) {
+      this.saveExpandedStatus(layerID, this.branchStatus[layerID]);
+    }
+
+    // Swap image
+    this.swapImage(layerID);
+  }
+}
+
+/**
+* Swaps the plus/minus branch images
+*/
+function swapImage(layerID)
+{
+  imgSrc = document.images['img_' + layerID].src;
+
+  re = /^(.*)(plus|minus)(bottom|top|single)?.gif$/
+  if (matches = imgSrc.match(re)) {
+
+    document.images['img_' + layerID].src = sprintf('%s%s%s%s',
+                                                    matches[1],
+                            matches[2] == 'plus' ? 'minus' : 'plus',
+                            matches[3] ? matches[3] : '',
+                            '.gif');
+  }
+}
+
+/**
+* Can the browser handle the dynamic menu?
+*/
+function doesMenu()
+{
+  return (is_ie5up || is_nav6up || is_gecko);
+}
+
+/**
+* Can the browser handle save the branch status
+*/
+function doesPersistence()
+{
+  return is_ie5up;
+}
+
+/**
+* Returns the appropriate layer accessor
+*/
+function getLayer(layerID)
+{
+  if (document.getElementById(layerID)) {
+    return document.getElementById(layerID);
+  } else if (document.all(layerID)) {
+    return document.all(layerID);
+  }
+}
+
+/**
+* Save the status of the layer
+*/
+function saveExpandedStatus(layerID, expanded)
+{
+  document.all(layerID).setAttribute("expandedStatus", expanded);
+  document.all(layerID).save(layerID);
+}
+
+/**
+* Load the status of the layer
+*/
+function loadExpandedStatus(layerID)
+{
+  document.all(layerID).load(layerID);
+  if (val = document.all(layerID).getAttribute("expandedStatus")) {
+    return val;
+  } else {
+    return null;
+  }
+}
+
+/**
+* Reset branch status
+*/
+function resetBranches()
+{
+  if (!this.doesPersistence()) {
+    return false;
+  }
+
+  for (var i=0; i<this.branches.length; i++) {
+    var status = this.loadExpandedStatus(this.branches[i]);
+    // Only update if it's supposed to be expanded and it's not already
+    if (status == 'true' && this.branchStatus[this.branches[i]] != true) {
+      if (this.checkParentVisibility(this.branches[i])) {
+        this.toggleBranch(this.branches[i], true, true);
+      } else {
+        this.branchStatus[this.branches[i]] = true;
+        this.swapImage(this.branches[i]);
+      }
+    }
+  }
+}
+
+/**
+* Checks whether a branch should be open 
+* or not based on its parents' status
+*/
+function checkParentVisibility(layerID)
+{
+  if (in_array(this.childParents[layerID], this.branches)
+      && this.branchStatus[this.childParents[layerID]]
+    && this.checkParentVisibility(this.childParents[layerID]) ) {
+    
+    return true;
+
+  } else if (this.childParents[layerID] == null) {
+    return true;
+  }
+  
+  return false;
+
+/*
+  if (this.childParents[layerID] == null) {
+    return this.branchStatus[layerID];
+  } else {
+    return this.branchStatus && this.checkVisibility(this.childParents[layerID]);
+  }
+*/
+}
+
+/**
+* Javascript mini implementation of sprintf()
+*/
+function sprintf(strInput)
+{
+  var strOutput  = '';
+  var currentArg = 1;
+
+  for (var i=0; i<strInput.length; i++) {
+    if (strInput.charAt(i) == '%' && i != (strInput.length - 1) && typeof(arguments[currentArg]) != 'undefined') {
+      switch (strInput.charAt(++i)) {
+        case 's':
+          strOutput += arguments[currentArg];
+          break;
+        case '%':
+          strOutput += '%';
+          break;
+      }
+      currentArg++;
+    } else {
+      strOutput += strInput.charAt(i);
+    }
+  }
+
+  return strOutput;
+}
+
+function explode(seperator, input)
+{
+  var output = [];
+  var tmp    = '';
+  skipEmpty  = arguments[2] ? true : false;
+  
+  for (var i=0; i<input.length; i++) {
+    if (input.charAt(i) == seperator) {
+      if (tmp == '' && skipEmpty) {
+        continue;
+      } else {
+        output[output.length] = tmp;
+        tmp = '';
+      }
+    } else {
+      tmp += input.charAt(i);
+    }
+  }
+  if (tmp != '' || !skipEmpty) {
+    output[output.length] = tmp;
+  }
+  
+  return output;
+}
+
+function implode(seperator, input)
+{
+  var output = '';
+
+  for (var i=0; i<input.length; i++) {
+    if (i == 0) {
+      output += input[i];
+    } else {
+      output += seperator + input[i];
+    }
+  }
+  
+  return output;
+}
+
+function in_array(item, arr)
+{
+  for (var i=0; i<arr.length; i++) {
+    if (arr[i] == item) {
+      return true;
+    }
+  }
+
+  return false;
+}
Index: /contrib/Dms/js/jscode/mydms.js
===================================================================
--- /contrib/Dms/js/jscode/mydms.js	(revision 3526)
+++ /contrib/Dms/js/jscode/mydms.js	(revision 3526)
@@ -0,0 +1,217 @@
+/**
+ * eGroupWare - API
+ * http://www.egroupware.org
+ *
+ * This file was originally created Tyamad, but their content is now completly removed!
+ * It still contains some commonly used javascript functions, always included by EGroupware.
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package api
+ * @subpackage jsapi
+ * @version $Id: jsapi.js 27380 2009-07-07 12:55:11Z ralfbecker $
+ */
+
+/***********************************************\
+*               INITIALIZATION                  *
+\***********************************************/
+if (document.all)
+{
+	navigator.userAgent.toLowerCase().indexOf('msie 5') != -1 ? is_ie5 = true : is_ie5 = false;
+	is_ie = true;
+	is_moz1_6 = false;
+	is_mozilla = false;
+	is_ns4 = false;
+}
+else if (document.getElementById)
+{
+	navigator.userAgent.toLowerCase().match('mozilla.*rv[:]1\.6.*gecko') ? is_moz1_6 = true : is_moz1_6 = false;
+	is_ie = false;
+	is_ie5 = false;
+	is_mozilla = true;
+	is_ns4 = false;
+}
+else if (document.layers)
+{
+	is_ie = false;
+	is_ie5 = false
+	is_moz1_6 = false;
+	is_mozilla = false;
+	is_ns4 = true;
+}
+
+// works only correctly in Mozilla/FF and Konqueror
+function phpgw_openWindowCentered2(_url, _windowName, _width, _height, _status)
+{
+	windowWidth = phpgw_getWindowOuterWidth();
+	windowHeight = phpgw_getWindowOuterHeight();
+
+	positionLeft = (windowWidth/2)-(_width/2)+phpgw_getWindowLeft();
+	positionTop  = (windowHeight/2)-(_height/2)+phpgw_getWindowTop();
+
+	windowID = window.open(_url, _windowName, "width=" + _width + ",height=" + _height +
+		",screenX=" + positionLeft + ",left=" + positionLeft + ",screenY=" + positionTop + ",top=" + positionTop +
+		",location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,status="+_status);
+
+	return windowID;
+}
+
+function phpgw_openWindowCentered(_url, _windowName, _width, _height)
+{
+	return phpgw_openWindowCentered2(_url, _windowName, _width, _height, 'no');
+}
+
+// return the left position of the window
+function phpgw_getWindowLeft()
+{
+	if(is_mozilla)
+	{
+		return window.screenX;
+	}
+	else
+	{
+		return window.screenLeft;
+	}
+}
+
+// return the left position of the window
+function phpgw_getWindowTop()
+{
+	if(is_mozilla)
+	{
+		return window.screenY;
+	}
+	else
+	{
+		//alert(window.screenTop);
+		return window.screenTop-90;
+	}
+}
+
+// get the outerWidth of the browser window. For IE we simply return the innerWidth
+function phpgw_getWindowInnerWidth()
+{
+	if (is_mozilla)
+	{
+		return window.innerWidth;
+	}
+	else
+	{
+		// works only after the body has parsed
+		//return document.body.offsetWidth;
+		return document.body.clientWidth;
+		//return document.documentElement.clientWidth;
+	}
+}
+
+// get the outerHeight of the browser window. For IE we simply return the innerHeight
+function phpgw_getWindowInnerHeight()
+{
+	if (is_mozilla)
+	{
+		return window.innerHeight;
+	}
+	else
+	{
+		// works only after the body has parsed
+		//return document.body.offsetHeight;
+		//return document.body.clientHeight;
+		return document.documentElement.clientHeight;
+	}
+}
+
+// get the outerWidth of the browser window. For IE we simply return the innerWidth
+function phpgw_getWindowOuterWidth()
+{
+	if (is_mozilla)
+	{
+		return window.outerWidth;
+	}
+	else
+	{
+		return phpgw_getWindowInnerWidth();
+	}
+}
+
+// get the outerHeight of the browser window. For IE we simply return the innerHeight
+function phpgw_getWindowOuterHeight()
+{
+	if (is_mozilla)
+	{
+		return window.outerHeight;
+	}
+	else
+	{
+		return phpgw_getWindowInnerHeight();
+	}
+}
+
+
+
+function changeSorting(_sort) {
+	resetMessageSelect();
+
+	document.getElementById('messageCounter').innerHTML = '<span style="font-weight: bold;">Change sorting ...</span>';
+	document.getElementById('divMessageList').innerHTML = '';
+	xajax_doXMLHTTP("felamimail.ajaxfelamimail.changeSorting",_sort);
+}
+
+function onNodeSelect(_nodeID) {
+	window.location.href = nodeSelectURL+'&folderid='+_nodeID;
+}
+
+function onNodeSelectRight(_nodeID) {
+	var nodeObject = false;
+	var domObject;
+	var top=0;
+	var left=0;
+
+	if(nodeObject = tree._globalIdStorageFind(_nodeID)) {
+		domObject = nodeObject.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0];
+		top = getPosTop(domObject) + domObject.offsetHeight;
+		left = getPosLeft(domObject) + 10;
+
+		resultBox = document.getElementById('rightClickMenu');
+		resultBox.style.top=top + 'px';
+		resultBox.style.left=left + 'px';
+		resultBox.style.display='block';
+	}
+}
+
+function selectFolder(_folderID, _formName) {
+	openDlg = phpgw_openWindowCentered(folderChooserURL+"&form="+_formName+"&mode=3&exlcude=-1&folderid="+_folderID,'openDlg',300,450);
+}
+
+function getPosLeft(_node) {
+	var left=0;
+	
+	if(_node.offsetParent) {
+		while (_node.offsetParent)
+		{
+			left += _node.offsetLeft;
+			_node = _node.offsetParent;
+		}
+	} else if (_node.x) {
+		left += _node.x;
+	}
+	
+	return left;
+}
+
+function getPosTop(_node) {
+	var top=0;
+	
+	if(_node.offsetParent) {
+		while (_node.offsetParent) {
+			top += _node.offsetTop;
+			if(_node.parentNode.scrollTop) {
+				top -= _node.parentNode.scrollTop
+			}
+			_node = _node.offsetParent;
+		}
+	} else if (_node.y) {
+		left += _node.y;
+	}
+	
+	return top;
+}
+
Index: /contrib/Dms/js/jscode/viewDocument.js
===================================================================
--- /contrib/Dms/js/jscode/viewDocument.js	(revision 3526)
+++ /contrib/Dms/js/jscode/viewDocument.js	(revision 3526)
@@ -0,0 +1,51 @@
+var tab = new Tabs(6,'activetab','inactivetab','tab','tabcontent','','','tabpage');
+
+function initTabs()
+{
+	tab.init();
+}
+
+function toggleJSCal(_selectBox)
+{
+	if(_selectBox.options[_selectBox.selectedIndex].value == 1)
+	{
+		document.getElementById("jscalspan").className = 'active';
+	}
+	else
+	{
+		document.getElementById("jscalspan").className = 'inactive';
+	}
+}
+
+function toggleLock(_checkBox)
+{
+	if(_checkBox.checked == true)
+	{
+		document.getElementById("currentLockStatus").className = 'inactive';
+
+		document.getElementById("unlockFile").className = 'active';
+		document.getElementById("lockFile").className = 'inactive';
+		document.getElementById("lockStatus").value = 'locked';
+	}
+	else
+	{
+		document.getElementById("currentLockStatus").className = 'inactive';
+
+		document.getElementById("unlockFile").className = 'inactive';
+		document.getElementById("lockFile").className = 'active';
+		document.getElementById("lockStatus").value = 'unlocked';
+	}
+}
+
+function toggleJSCalUpdate(_selectBox)
+{
+	if(_selectBox.options[_selectBox.selectedIndex].value == 1)
+	{
+		document.getElementById("jscalspan_update").className = 'active';
+	}
+	else
+	{
+		document.getElementById("jscalspan_update").className = 'inactive';
+	}
+}
+
Index: /contrib/Dms/js/jscode/folderChooser.js
===================================================================
--- /contrib/Dms/js/jscode/folderChooser.js	(revision 3526)
+++ /contrib/Dms/js/jscode/folderChooser.js	(revision 3526)
@@ -0,0 +1,7 @@
+function onNodeSelect(_nodeID)
+{
+	targetName.value = tree.getSelectedItemText();
+	targetID.value = _nodeID;
+	window.close();
+	return true;
+}
Index: /contrib/Dms/js/sniffer.js
===================================================================
--- /contrib/Dms/js/sniffer.js	(revision 3526)
+++ /contrib/Dms/js/sniffer.js	(revision 3526)
@@ -0,0 +1,204 @@
+//<!--
+// Ultimate client-side JavaScript client sniff. Version 3.03
+// (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.
+// Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
+// Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
+//                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
+// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, 
+//                      correct Opera 5 detection
+//                      add support for winME and win2k
+//                      synch with browser-type-oo.js
+// Revised 26 Mar 01 to correct Opera detection
+// Revised 02 Oct 01 to add IE6 detection
+
+// Everything you always wanted to know about your JavaScript client
+// but were afraid to ask. Creates "is_" variables indicating:
+// (1) browser vendor:
+//     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
+// (2) browser version number:
+//     is_major (integer indicating major version number: 2, 3, 4 ...)
+//     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
+// (3) browser vendor AND major version number
+//     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
+//     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_ie6, is_ie6up, is_hotjava3, is_hotjava3up,
+//     is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
+// (4) JavaScript version number:
+//     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
+// (5) OS platform and version:
+//     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
+//     is_os2
+//     is_mac, is_mac68k, is_macppc
+//     is_unix
+//     is_sun, is_sun4, is_sun5, is_suni86
+//     is_irix, is_irix5, is_irix6
+//     is_hpux, is_hpux9, is_hpux10
+//     is_aix, is_aix1, is_aix2, is_aix3, is_aix4
+//     is_linux, is_sco, is_unixware, is_mpras, is_reliant
+//     is_dec, is_sinix, is_freebsd, is_bsd
+//     is_vms
+//
+// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
+// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
+// for detailed lists of userAgent strings.
+//
+// Note: you don't want your Nav4 or IE4 code to "turn off" or
+// stop working when new versions of browsers are released, so
+// in conditional code forks, use is_ie5up ("IE 5.0 or greater") 
+// is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
+// to check version in code which you want to work on future
+// versions.
+
+    // convert all characters to lowercase to simplify testing
+    var agt=navigator.userAgent.toLowerCase();
+
+    // *** BROWSER VERSION ***
+    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
+    var is_major = parseInt(navigator.appVersion);
+    var is_minor = parseFloat(navigator.appVersion);
+
+    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
+    // If you want to allow spoofing, take out the tests for opera and webtv.
+    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
+                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
+                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
+    var is_nav2 = (is_nav && (is_major == 2));
+    var is_nav3 = (is_nav && (is_major == 3));
+    var is_nav4 = (is_nav && (is_major == 4));
+    var is_nav4up = (is_nav && (is_major >= 4));
+    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
+                          (agt.indexOf("; nav") != -1)) );
+    var is_nav6 = (is_nav && (is_major == 5));
+    var is_nav6up = (is_nav && (is_major >= 5));
+    var is_gecko = (agt.indexOf('gecko') != -1);
+
+
+    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
+    var is_ie3    = (is_ie && (is_major < 4));
+    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
+    var is_ie4up  = (is_ie && (is_major >= 4));
+    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
+    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
+    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
+    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
+    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
+    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
+
+    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
+    // or if this is the first browser window opened.  Thus the
+    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
+    var is_aol   = (agt.indexOf("aol") != -1);
+    var is_aol3  = (is_aol && is_ie3);
+    var is_aol4  = (is_aol && is_ie4);
+    var is_aol5  = (agt.indexOf("aol 5") != -1);
+    var is_aol6  = (agt.indexOf("aol 6") != -1);
+
+    var is_opera = (agt.indexOf("opera") != -1);
+    var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
+    var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
+    var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
+    var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
+    var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
+
+    var is_webtv = (agt.indexOf("webtv") != -1); 
+
+    var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
+    var is_AOLTV = is_TVNavigator;
+
+    var is_hotjava = (agt.indexOf("hotjava") != -1);
+    var is_hotjava3 = (is_hotjava && (is_major == 3));
+    var is_hotjava3up = (is_hotjava && (is_major >= 3));
+
+    // *** JAVASCRIPT VERSION CHECK ***
+    var is_js;
+    if (is_nav2 || is_ie3) is_js = 1.0;
+    else if (is_nav3) is_js = 1.1;
+    else if (is_opera5up) is_js = 1.3;
+    else if (is_opera) is_js = 1.1;
+    else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
+    else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
+    else if (is_hotjava3up) is_js = 1.4;
+    else if (is_nav6 || is_gecko) is_js = 1.5;
+    // NOTE: In the future, update this code when newer versions of JS
+    // are released. For now, we try to provide some upward compatibility
+    // so that future versions of Nav and IE will show they are at
+    // *least* JS 1.x capable. Always check for JS version compatibility
+    // with > or >=.
+    else if (is_nav6up) is_js = 1.5;
+    // NOTE: ie5up on mac is 1.4
+    else if (is_ie5up) is_js = 1.3
+
+    // HACK: no idea for other browsers; always check for JS version with > or >=
+    else is_js = 0.0;
+
+    // *** PLATFORM ***
+    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
+    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
+    //        Win32, so you can't distinguish between Win95 and WinNT.
+    var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
+
+    // is this a 16 bit compiled version?
+    var is_win16 = ((agt.indexOf("win16")!=-1) || 
+               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
+               (agt.indexOf("windows 16-bit")!=-1) );  
+
+    var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
+                    (agt.indexOf("windows 16-bit")!=-1));
+
+    var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
+    var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));
+
+    // NOTE: Reliable detection of Win98 may not be possible. It appears that:
+    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
+    //       - On Mercury client, the 32-bit version will return "Win98", but
+    //         the 16-bit version running on Win98 will still return "Win95".
+    var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
+    var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
+    var is_win32 = (is_win95 || is_winnt || is_win98 || 
+                    ((is_major >= 4) && (navigator.platform == "Win32")) ||
+                    (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
+
+    var is_os2   = ((agt.indexOf("os/2")!=-1) || 
+                    (navigator.appVersion.indexOf("OS/2")!=-1) ||   
+                    (agt.indexOf("ibm-webexplorer")!=-1));
+
+    var is_mac    = (agt.indexOf("mac")!=-1);
+    // hack ie5 js version for mac
+    if (is_mac && is_ie5up) is_js = 1.4;
+    var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
+                               (agt.indexOf("68000")!=-1)));
+    var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
+                                (agt.indexOf("powerpc")!=-1)));
+
+    var is_sun   = (agt.indexOf("sunos")!=-1);
+    var is_sun4  = (agt.indexOf("sunos 4")!=-1);
+    var is_sun5  = (agt.indexOf("sunos 5")!=-1);
+    var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
+    var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
+    var is_irix5 = (agt.indexOf("irix 5") !=-1);
+    var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
+    var is_hpux  = (agt.indexOf("hp-ux")!=-1);
+    var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
+    var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
+    var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
+    var is_aix1  = (agt.indexOf("aix 1") !=-1);    
+    var is_aix2  = (agt.indexOf("aix 2") !=-1);    
+    var is_aix3  = (agt.indexOf("aix 3") !=-1);    
+    var is_aix4  = (agt.indexOf("aix 4") !=-1);    
+    var is_linux = (agt.indexOf("inux")!=-1);
+    var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
+    var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
+    var is_mpras    = (agt.indexOf("ncr")!=-1); 
+    var is_reliant  = (agt.indexOf("reliantunix")!=-1);
+    var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
+           (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
+           (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
+    var is_sinix = (agt.indexOf("sinix")!=-1);
+    var is_freebsd = (agt.indexOf("freebsd")!=-1);
+    var is_bsd = (agt.indexOf("bsd")!=-1);
+    var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
+                 is_sco ||is_unixware || is_mpras || is_reliant || 
+                 is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);
+
+    var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));
+
+//--> end hide JavaScript
Index: /contrib/Dms/op/op.ViewOnline.php
===================================================================
--- /contrib/Dms/op/op.ViewOnline.php	(revision 3526)
+++ /contrib/Dms/op/op.ViewOnline.php	(revision 3526)
@@ -0,0 +1,51 @@
+<?php
+
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$documentid = (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$version = (isset($_GET['version'])) ? (int) $_GET['version'] : NULL;
+
+$document = getDocument($documentid);
+
+if ($document->getAccessMode($user) < M_READ)
+{
+	printHTMLHead( getMLText("download") );
+	printCenterStart();
+	printStartBox(getMLText("download"));
+	print "<div class=\"standardText\">";
+	printMLText("operation_not_allowed");
+	printGoBack();
+	print "</div>";
+	printEndBox();
+	printCenterEnd();
+	printHTMLFoot();
+	exit;
+}
+
+$content = $document->getContentByVersion($version);
+
+if (is_bool($content) && !$content)
+	die("Version " . $version . " of Document \"" . $document->getName() . "\" not found");
+
+if (in_array($content->getFileType(), $settings->_viewOnlineFileTypes))
+	header("Content-Type: " . $content->getMimeType());
+
+header("Content-Length: " . filesize($settings->_contentDir . $content->getDir() . $content->getFileName()));
+header("Expires: 0");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+
+readfile($settings->_contentDir . $content->getDir() . $content->getFileName());
+exit;
+
+?>
Index: /contrib/Dms/op/op.UpdateDocument.php
===================================================================
--- /contrib/Dms/op/op.UpdateDocument.php	(revision 3526)
+++ /contrib/Dms/op/op.UpdateDocument.php	(revision 3526)
@@ -0,0 +1,110 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$comment	= $_POST['comment'];
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$expires	= $_POST['expires'];
+$expday		= (int)$_POST['expday'];
+$expmonth	= (int)$_POST['expmonth'];
+$expyear	= (int)$_POST['expyear'];
+$userfile	= $_FILES['userfile']['tmp_name'];
+
+
+$document = getDocument($documentid);
+
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("update_document"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	if ($document->isLocked())
+	{
+		$lockingUser = $document->getLockingUser();
+		
+		if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL))
+		{
+			printMLText("update_locked_msg", array("username" => $lockingUser->getFullName(), "email" => $lockingUser->getEmail()));
+			printMLText("no_update_cause_locked");
+			printGoBack();
+			
+			print "</div>";
+			printEndBox();
+			printCenterEnd();
+			printHTMLFoot();
+			exit;
+		}
+		else
+			$document->setLocked(false);
+	}
+	
+	if (!isset($userfile) || ($userfile == "none") || ($userfile == ""))
+	{
+		printMLText("uploading_failed");
+		printGoBack();
+	}
+	else
+	{
+		printMLText("updating_document");
+		
+		$comment  = sanitizeString($comment);
+		$userfile_type = sanitizeString($userfile_type);
+		$userfile_name = sanitizeString($userfile_name);
+		
+		$lastDotIndex = strrpos(basename($userfile_name), ".");
+		if (is_bool($lastDotIndex) && !$lastDotIndex)
+			$fileType = ".";
+		else
+			$fileType = substr($userfile_name, $lastDotIndex);
+		
+		if (!$document->addContent($comment, $user, $userfile, basename($userfile_name), $fileType, $userfile_type))
+		{
+			printMLText("error_occured");
+			printGoBack();
+		}
+		else
+		{
+			$expires = ($expires == "true") ? mktime(0,0,0, $expmonth, $expday, $expyear) : false;
+			
+			if (!$document->setExpires($expires))
+			{
+				printMLText("error_occured");
+				printGoBack();
+			}
+			else
+			{
+				printMLText("op_finished");
+				printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID())));
+			}
+		}
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.EditFolder.php
===================================================================
--- /contrib/Dms/op/op.EditFolder.php	(revision 3526)
+++ /contrib/Dms/op/op.EditFolder.php	(revision 3526)
@@ -0,0 +1,71 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$folderid	= (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+$folder = getFolder($folderid);
+
+$fname		= $_GET['fname'];
+$comment	= $_GET['comment'];
+$sequence	= $_GET['sequence'];
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printCenterStart();
+
+printStartBox(getMLText("edit_folder_props"));
+
+print "<div class=\"standardText\">";
+
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("editing_folder_props");
+	
+	$fname =     sanitizeString($fname);
+
+	$comment =  sanitizeString($comment);
+	if (!is_numeric($sequence) && $sequence != "keep")
+		$sequence = "keep";
+	//	die ("invalid sequence value");
+	
+	if (
+			(($folder->getName() == $fname) || $folder->setName($fname))
+			&& (($folder->getComment() == $comment) || $folder->setComment($comment))
+			&& (($sequence == "keep") || $folder->setSequence($sequence))
+		)
+	{
+		printMLText("op_finished");
+		printGoto(array(array($folder->getName(), "../out/out.ViewFolder.php?folderid=".$folder->getID()), 
+				array(getMLText("edit_folder_props_again"), "../out/out.EditFolder.php?folderid=".$folder->getID())));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+
+?>
Index: /contrib/Dms/op/convert_word.js
===================================================================
--- /contrib/Dms/op/convert_word.js	(revision 3526)
+++ /contrib/Dms/op/convert_word.js	(revision 3526)
@@ -0,0 +1,15 @@
+//var logFile = fs.CreateTextFile("convertlog.txt", true);
+
+var source = WScript.Arguments(0);
+var target = WScript.Arguments(1);
+
+var WordApp;
+WordApp = new ActiveXObject("Word.Application");
+var Newdoc;
+Newdoc = WordApp.Documents.Open(source);
+Newdoc.SaveAs(target, 8);	// wdFormatHTML = 8
+WordApp.Quit();
+
+
+
+//logFile.Close();
Index: /contrib/Dms/op/op.EditDocument.php
===================================================================
--- /contrib/Dms/op/op.EditDocument.php	(revision 3526)
+++ /contrib/Dms/op/op.EditDocument.php	(revision 3526)
@@ -0,0 +1,70 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$fname		= $_GET['fname'];
+$comment	= $_GET['comment'];
+$keywords	= $_GET['keywords'];
+$sequence	= $_GET['sequence'];
+
+$document = getDocument($documentid);
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("edit_document_props"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("editing_document_props");
+	
+	$fname =     sanitizeString($fname);
+	$comment =  sanitizeString($comment);
+	$keywords = sanitizeString($keywords);
+	if (!is_numeric($sequence) && $sequence != "keep")
+		die ("invalid sequence value");
+	
+	if (
+			(($document->getName() == $fname) || $document->setName($fname))
+			&& (($document->getComment() == $comment) || $document->setComment($comment))
+			&& (($document->getKeywords() == $keywords) || $document->setKeywords($keywords))
+			&& (($sequence == "keep") || $document->setSequence($sequence))
+		)
+	{
+		printMLText("op_finished");
+		printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID()), 
+				array(getMLText("edit_document_props_again"), "../out/out.EditDocument.php?documentid=".$document->getID())));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/convert_pp.js
===================================================================
--- /contrib/Dms/op/convert_pp.js	(revision 3526)
+++ /contrib/Dms/op/convert_pp.js	(revision 3526)
@@ -0,0 +1,14 @@
+//var logFile = fs.CreateTextFile("convertlog.txt", true);
+
+var source = WScript.Arguments(0);
+var target = WScript.Arguments(1);
+
+var PPApp;
+PPApp = new ActiveXObject("Powerpoint.Application");
+var Newdoc;
+PPApp.Visible = true;
+Newdoc = PPApp.Presentations.Open(source);
+Newdoc.SaveAs(target, 12);	// ppSaveAsHTML = 12
+PPApp.Quit();
+
+//logFile.Close();
Index: /contrib/Dms/op/op.RemoveFolder.php
===================================================================
--- /contrib/Dms/op/op.RemoveFolder.php	(revision 3526)
+++ /contrib/Dms/op/op.RemoveFolder.php	(revision 3526)
@@ -0,0 +1,55 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+
+$folderid	= (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+$folder = getFolder($folderid);
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printCenterStart();
+
+printStartBox(getMLText("rm_folder"));
+
+print "<div class=\"standardText\">";
+
+
+if ($folder->getAccessMode($user) < M_ALL)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("removing_folder");
+	
+	$parent = $folder->getParent();
+	
+	if (!$folder->remove())
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+	else
+	{
+		printMLText("op_finished");
+		printGoto(array(array($parent->getName(), "../out/out.ViewFolder.php?folderid=".$parent->getID())));
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.RemoveDocument.php
===================================================================
--- /contrib/Dms/op/op.RemoveDocument.php	(revision 3526)
+++ /contrib/Dms/op/op.RemoveDocument.php	(revision 3526)
@@ -0,0 +1,54 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$document = getDocument($documentid);
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("rm_document"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_ALL)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("removing_document");
+	$folder = $document->getFolder();
+	
+	if (!$document->remove())
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+	else
+	{
+		printMLText("op_finished");
+		printGoto(array(array($folder->getName(), "../out/out.ViewFolder.php?folderid=".$folder->getID())));
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.GroupMgr.php
===================================================================
--- /contrib/Dms/op/op.GroupMgr.php	(revision 3526)
+++ /contrib/Dms/op/op.GroupMgr.php	(revision 3526)
@@ -0,0 +1,126 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+
+printHTMLHead( getMLText("group_management") );
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+if (!$user->isAdmin())
+	die("Only an Administrator may use this feature");
+
+//Neue Gruppe anlegen -----------------------------------------------------------------------------
+if ($action == "addgroup")
+{
+	printStartBox(getMLText("add_group"));
+	print "<div class=\"standardText\">";
+	printMLText("adding_group");
+	
+	$name    = sanitizeString($name);
+	$comment = sanitizeString($comment);
+	
+	$newGroup = addGroup($name, $comment);
+	if ($newGroup)
+	{
+		printMLText("op_finished");
+		printGoto(array(array(getMLText("group_management"), "../out/out.GroupMgr.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Gruppe löschen ----------------------------------------------------------------------------------
+else if ($action == "removegroup")
+{
+	printStartBox(getMLText("rm_group"));
+	print "<div class=\"standardText\">";
+	printMLText("removing_group");
+	
+	$group = getGroup($groupid);
+	
+	if ($group->remove())
+	{
+		printMLText("op_finished");
+		printGoto(array(array(getMLText("group_management"), "../out/out.GroupMgr.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Gruppe bearbeiten -------------------------------------------------------------------------------
+else if ($action == "editgroup")
+{
+	$group = getGroup($groupid);
+	
+	printStartBox(getMLText("edit_group", array("groupname" => $group->getName())));
+	print "<div class=\"standardText\">";
+	printMLText("editing_group");
+	
+	$name    = sanitizeString($name);
+	$comment = sanitizeString($comment);
+	
+	if ($group->getName() != $name)
+		$group->setName($name);
+	if ($group->getComment() != $comment)
+		$group->setComment($comment);
+	
+	printMLText("op_finished");
+	printGoto(array(array(getMLText("group_management"), "../out/out.GroupMgr.php")));
+}
+
+//Benutzer zu Gruppe hinzufügen -------------------------------------------------------------------
+else if ($action == "addmember")
+{
+	printStartBox(getMLText("add_member"));
+	print "<div class=\"standardText\">";
+	printMLText("adding_member");
+	
+	$group = getGroup($groupid);
+	$newMember = getUser($userid);
+	
+	$group->addUser($newMember);
+	
+	printMLText("op_finished");
+	printGoto(array(array(getMLText("group_management"), "../out/out.GroupMgr.php")));
+}
+
+//Benutzer aus Gruppe entfernen -------------------------------------------------------------------
+else if ($action == "rmmember")
+{
+	printStartBox(getMLText("remove_member"));
+	print "<div class=\"standardText\">";
+	printMLText("removing_member");
+	
+	$group = getGroup($groupid);
+	$oldMember = getUser($userid);
+	
+	$group->removeUser($oldMember);
+	
+	printMLText("op_finished");
+	printGoto(array(array(getMLText("group_management"), "../out/out.GroupMgr.php")));
+}
+
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/op/op.Login.php
===================================================================
--- /contrib/Dms/op/op.Login.php	(revision 3526)
+++ /contrib/Dms/op/op.Login.php	(revision 3526)
@@ -0,0 +1,41 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.DBAccess.php");
+
+
+$login = sanitizeString($login);
+
+if($GLOBALS['phpgw']->auth->authenticate($GLOBALS['phpgw_info']['user']['account_lid'], $GLOBALS['phpgw_info']['user']['passwd'], 'text')) {
+}
+
+
+$queryStr = "DELETE FROM phpgw_mydms_Sessions WHERE " . mktime() . " - lastAccess > 86400";
+if (!$db->getResult($queryStr))
+	die ("Error while removing old sessions from phpgw_mydms_Sessions: " . $db->getErrorMsg());
+
+//Erstellen einer Sitzungs-ID
+
+$id = "" . rand() . mktime() . rand() . "";
+$id = md5($id);
+
+$lang      = sanitizeString($lang);
+$sesstheme = sanitizeString($sesstheme);
+
+$userid = $GLOBALS['phpgw']->accounts->name2id($GLOBALS['phpgw_info']['user']['account_lid']);
+
+//Einfügen eines neuen Datensatzes in phpgw_mydms_Sessions
+$queryStr = "INSERT INTO phpgw_mydms_Sessions (id, userID, lastAccess, theme, language) VALUES ('$id', userid, ".mktime().", '$sesstheme', 'English')";
+if (!$db->getResult($queryStr))
+	die ("Error while adding Session to phpgw_mydms_Sessions: " . $db->getErrorMsg());
+
+//Setzen des Sitzungs-Cookies
+setcookie("mydms_session", $id, 0, $settings->_httpRoot);
+
+//Weiterleiten zur Startseite
+header("Location: ../out/out.ViewFolder.php?folderid=1");
+print "Login successful";
+
+?>
Index: /contrib/Dms/op/op.RemoveDocumentLink.php
===================================================================
--- /contrib/Dms/op/op.RemoveDocumentLink.php	(revision 3526)
+++ /contrib/Dms/op/op.RemoveDocumentLink.php	(revision 3526)
@@ -0,0 +1,62 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+$link = getDocumentLink($linkid);
+$responsibleUser = $link->getUser();
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("remove_document_link"));
+
+print "<div class=\"standardText\">";
+
+$accessMode = $document->getAccessMode($user);
+if (
+	($accessMode < M_READ)
+	|| (($accessMode == M_READ) && ($responsibleUser->getID() != $user->getID()))
+	|| (($accessMode > M_READ) && (!$user->isAdmin()) && ($responsibleUser->getID() != $user->getID()) && !$link->isPublic())
+   )
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("removing_document_link");
+	
+	if (!is_numeric($linkid))
+		die("invalid link id");
+	
+	if ($document->removeDocumentLink($linkid))
+	{
+		printMLText("op_finished");
+		printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID())));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/op/op.DefaultKeywords.php
===================================================================
--- /contrib/Dms/op/op.DefaultKeywords.php	(revision 3526)
+++ /contrib/Dms/op/op.DefaultKeywords.php	(revision 3526)
@@ -0,0 +1,206 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.ClassKeywords.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$action		= (isset($_POST['action']) ? $_POST['action'] : $_GET['action']);
+$name		= (isset($_POST['name']) ? $_POST['name'] : $_GET['name']);
+$categoryid	= sprintf("%d", (isset($_POST['categoryid']) ? $_POST['categoryid'] : $_GET['categoryid']));
+$keywords	= (isset($_POST['keywords']) ? $_POST['keywords'] : $_GET['keywords']);
+$keywordsid	= sprintf("%d", (isset($_POST['keywordsid']) ? $_POST['keywordsid'] : $_GET['keywordsid']));
+
+if ($user->isAdmin())
+	printHTMLHead( getMLText("global_default_keywords") );
+else
+	printHTMLHead( getMLText("personal_default_keywords"));
+
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+
+//Neue Kategorie anlegen -----------------------------------------------------------------------------
+if ($action == "addcategory")
+{
+	printStartBox(getMLText("new_default_keyword_category"));
+	print "<div class=\"standardText\">";
+	printMLText("creating_new_default_keyword_category");
+	
+	$name = sanitizeString($name);
+	
+	$newCategory = addKeywordCategory($user->getID(), $name);
+	if ($newCategory) {
+		printMLText("op_finished");
+		
+		if ($user->isAdmin())
+			printGoto(array(array(getMLText("global_default_keywords"), "../out/out.DefaultKeywords.php")));
+		else
+			printGoto(array(array(getMLText("personal_default_keywords"), "../out/out.DefaultKeywords.php")));
+	}
+	else {
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Kategorie löschen ----------------------------------------------------------------------------------
+else if ($action == "removecategory")
+{
+	printStartBox(getMLText("rm_default_keyword_category"));
+	print "<div class=\"standardText\">";
+	printMLText("removing_default_keyword_category");
+	
+	$category = getKeywordCategory($categoryid);
+	$owner    = $category->getOwner();
+	if (!$user->isAdmin() && $owner->getID() != $user->getID())
+		die("You're not allowed to delete this category");
+	
+	if ($category->remove()) {
+		printMLText("op_finished");
+		
+		if ($user->isAdmin())
+			printGoto(array(array(getMLText("global_default_keywords"), "../out/out.DefaultKeywords.php")));
+		else
+			printGoto(array(array(getMLText("personal_default_keywords"), "../out/out.DefaultKeywords.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Kategorie bearbeiten: Neuer Name --------------------------------------------------------------------
+else if ($action == "editcategory")
+{
+	printStartBox(getMLText("edit_default_keyword_category"));
+	print "<div class=\"standardText\">";
+	printMLText("editing_default_keyword_category");
+	
+	$category = getKeywordCategory($categoryid);
+	$owner    = $category->getOwner();
+	if (!$user->isAdmin() && $owner->getID() != $user->getID())
+		die("You're not allowed to edit this category");
+	
+	$name = sanitizeString($name);
+	
+	if ($category->setName($name)) {
+		printMLText("op_finished");
+		
+		if ($user->isAdmin())
+			printGoto(array(array(getMLText("global_default_keywords"), "../out/out.DefaultKeywords.php")));
+		else
+			printGoto(array(array(getMLText("personal_default_keywords"), "../out/out.DefaultKeywords.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Kategorie bearbeiten: Neue Stichwortliste  ----------------------------------------------------------
+else if ($action == "newkeywords")
+{
+	printStartBox(getMLText("new_default_keywords"));
+	print "<div class=\"standardText\">";
+	printMLText("adding_default_keywords");
+	
+	$category = getKeywordCategory($categoryid);
+	$owner    = $category->getOwner();
+	if (!$user->isAdmin() && $owner->getID() != $user->getID())
+		die("You're not allowed to add keywords to this category");
+	
+	$keywords = sanitizeString($keywords);
+	
+	if ($category->addKeywordList($keywords)) {
+		printMLText("op_finished");
+		
+		if ($user->isAdmin())
+			printGoto(array(array(getMLText("global_default_keywords"), "../out/out.DefaultKeywords.php")));
+		else
+			printGoto(array(array(getMLText("personal_default_keywords"), "../out/out.DefaultKeywords.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Kategorie bearbeiten: Stichwortliste bearbeiten ----------------------------------------------------------
+else if ($action == "editkeywords")
+{
+	printStartBox(getMLText("edit_default_keywords"));
+	print "<div class=\"standardText\">";
+	printMLText("editing_default_keywords");
+	
+	$category = getKeywordCategory($categoryid);
+	$owner    = $category->getOwner();
+	if (!$user->isAdmin() && $owner->getID() != $user->getID())
+		die("You're not allowed to edit keywords in this category");
+	
+	$keywords = sanitizeString($keywords);
+	if (!is_numeric($keywordsid))
+		die ("invalid keywords id");
+	
+	if ($category->editKeywordList($keywordsid, $keywords)) {
+		printMLText("op_finished");
+		
+		if ($user->isAdmin())
+			printGoto(array(array(getMLText("global_default_keywords"), "../out/out.DefaultKeywords.php")));
+		else
+			printGoto(array(array(getMLText("personal_default_keywords"), "../out/out.DefaultKeywords.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Kategorie bearbeiten: Neue Stichwortliste löschen ----------------------------------------------------------
+else if ($action == "removekeywords")
+{
+	printStartBox(getMLText("rm_default_keywords"));
+	print "<div class=\"standardText\">";
+	printMLText("removing_default_keywords");
+	
+	$category = getKeywordCategory($categoryid);
+	$owner    = $category->getOwner();
+	if (!$user->isAdmin() && $owner->getID() != $user->getID())
+		die("You're not allowed to remove keywords from this category");
+	
+	if (!is_numeric($keywordsid))
+		die ("invalid keywords id");
+	
+	if ($category->removeKeywordList($keywordsid)) {
+		printMLText("op_finished");
+		
+		if ($user->isAdmin())
+			printGoto(array(array(getMLText("global_default_keywords"), "../out/out.DefaultKeywords.php")));
+		else
+			printGoto(array(array(getMLText("personal_default_keywords"), "../out/out.DefaultKeywords.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/op/op.EditUserData.php
===================================================================
--- /contrib/Dms/op/op.EditUserData.php	(revision 3526)
+++ /contrib/Dms/op/op.EditUserData.php	(revision 3526)
@@ -0,0 +1,88 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+printHTMLHead( getMLText("my_account") );
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+printStartBox(getMLText("my_account"));
+print "<div class=\"standardText\">";
+
+printMLText("editing_user_data");
+
+$fullname = sanitizeString($fullname);
+$email    = sanitizeString($email);
+$comment  = sanitizeString($comment);
+
+if (isset($pwd) && ($pwd != ""))
+	$user->setPwd(md5($pwd));
+
+if ($user->getFullName() != $fullname)
+	$user->setFullName($fullname);
+
+if ($user->getEmail() != $email)
+	$user->setEmail($email);
+
+if ($user->getComment() != $comment)
+	$user->setComment($comment);
+
+if (isset($userfile) && ($userfile != "") && ($userfile != "none"))
+{
+	$lastDotIndex = strrpos(basename($userfile_name), ".");
+	$fileType = substr($userfile_name, $lastDotIndex);
+	if ($fileType != ".jpg")
+	{
+		printMLText("error_occured");
+		printMLText("only_jpg_user_images");
+		printGoBack();
+		print "</div>";
+		printEndBox();
+		printCenterEnd();
+		printHTMLFoot();
+		exit;
+	}
+	//verkleinern des Bildes, so dass es 150 Pixel hoch ist
+	if(file_exists($userfile))
+	{
+		// Originalbild einlesen
+		$origImg = imagecreatefromjpeg($userfile);
+		$width = imagesx($origImg);
+		$height = imagesy($origImg);
+		// Thumbnail im Speicher erzeugen
+		$newHeight = 150;
+		$newWidth = ($width/$height) * $newHeight;
+		$newImg = imagecreate($newWidth, $newHeight);
+		// Verkleinern
+		imagecopyresized($newImg, $origImg, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
+		// In File speichern 
+		imagejpeg($newImg, $userfile);
+		// Aufräumen
+		imagedestroy($origImg);
+		imagedestroy($newImg);
+	}
+	$user->setImage($userfile, $userfile_type);
+}
+
+printMLText("op_finished");
+printGoto(array(
+			array(getMLText("content"), "../out/out.ViewFolder.php?folderid=1"),
+			array(getMLText("my_account"), "../out/out.EditUserData.php")
+));
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/op/op.UsrMgr.php
===================================================================
--- /contrib/Dms/op/op.UsrMgr.php	(revision 3526)
+++ /contrib/Dms/op/op.UsrMgr.php	(revision 3526)
@@ -0,0 +1,162 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+
+function resizeImage($imageFile)
+{
+	// Originalbild einlesen
+	$origImg = imagecreatefromjpeg($imageFile);
+	$width = imagesx($origImg);
+	$height = imagesy($origImg);
+	// Thumbnail im Speicher erzeugen
+	$newHeight = 150;
+	$newWidth = ($width/$height) * $newHeight;
+	$newImg = imagecreate($newWidth, $newHeight);
+	// Verkleinern
+	imagecopyresized($newImg, $origImg, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
+	// In File speichern 
+	imagejpeg($newImg, $imageFile);
+	// Aufräumen
+	imagedestroy($origImg);
+	imagedestroy($newImg);
+	
+	return true;
+}
+
+
+printHTMLHead( getMLText("user_management") );
+printTitleBar(getFolder($settings->_rootFolderID));
+printCenterStart();
+
+if (!$user->isAdmin())
+	die("Only an Administrator may use this feature");
+
+
+//Neuen Benutzer anlegen --------------------------------------------------------------------------
+if ($action == "adduser")
+{
+	printStartBox(getMLText("add_user"));
+	print "<div class=\"standardText\">";
+	printMLText("adding_user");
+	
+	$login   = sanitizeString($login);
+	$name    = sanitizeString($name);
+	$email   = sanitizeString($email);
+	$comment = sanitizeString($comment);
+	
+	$newUser = addUser($login, md5($pwd), $name, $email, $comment);
+	if ($newUser)
+	{
+		printMLText("op_finished");
+		
+		if (isset($userfile) && ($userfile != "") && ($userfile != "none"))
+		{
+			printMLText("setting_user_image");
+			$lastDotIndex = strrpos(basename($userfile_name), ".");
+			$fileType = substr($userfile_name, $lastDotIndex);
+			if ($fileType != ".jpg")
+			{
+				printMLText("error_occured");
+				printMLText("only_jpg_user_images");
+			}
+			else
+			{
+				resizeImage($userfile);
+				$newUser->setImage($userfile, $userfile_type);
+				printMLText("op_finished");
+			}
+		}
+		printGoto(array(array(getMLText("user_management"), "../out/out.UsrMgr.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Benutzer löschen --------------------------------------------------------------------------------
+else if ($action == "removeuser")
+{
+	printStartBox(getMLText("rm_user"));
+	print "<div class=\"standardText\">";
+	printMLText("removing_user");
+	
+	$userToRemove = getUser($userid);
+	
+	if ($userToRemove->remove())
+	{
+		printMLText("op_finished");
+		printGoto(array(array(getMLText("user_management"), "../out/out.UsrMgr.php")));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+//Benutzer bearbeiten -----------------------------------------------------------------------------
+else if ($action == "edituser")
+{
+	$editedUser = getUser($userid);
+	
+	printStartBox(getMLText("edit_user", array("username" => $editedUser->getFullName())));
+	print "<div class=\"standardText\">";
+	printMLText("editing_user");
+	
+	$login   = sanitizeString($login);
+	$name    = sanitizeString($name);
+	$email   = sanitizeString($email);
+	$comment = sanitizeString($comment);
+	
+	if ($editedUser->getLogin() != $login)
+		$editedUser->setLogin($login);
+	if (isset($pwd) && ($pwd != ""))
+		$editedUser->setPwd(md5($pwd));
+	if ($editedUser->getFullName() != $name)
+		$editedUser->setFullName($name);
+	if ($editedUser->getEmail() != $email)
+		$editedUser->setEmail($email);
+	if ($editedUser->getComment() != $comment)
+		$editedUser->setComment($comment);
+	printMLText("op_finished");
+	
+	if (isset($userfile) && ($userfile != "") && ($userfile != "none"))
+	{
+		printMLText("setting_user_image");
+		$lastDotIndex = strrpos(basename($userfile_name), ".");
+		$fileType = substr($userfile_name, $lastDotIndex);
+		if ($fileType != ".jpg")
+		{
+			printMLText("error_occured");
+			printMLText("only_jpg_user_images");
+		}
+		else
+		{
+			resizeImage($userfile);
+			$editedUser->setImage($userfile, $userfile_type);
+			printMLText("op_finished");
+		}
+	}
+	printGoto(array(array(getMLText("user_management"), "../out/out.UsrMgr.php")));
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/op/op.LockDocument.php
===================================================================
--- /contrib/Dms/op/op.LockDocument.php	(revision 3526)
+++ /contrib/Dms/op/op.LockDocument.php	(revision 3526)
@@ -0,0 +1,62 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+
+$document = getDocument($documentid);
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("lock_document"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	if ($document->isLocked())
+	{
+		printMLText("document_already_locked");
+		printGoBack();
+	}
+	else
+	{
+		printMLText("locking_document");
+		if ($document->setLocked($user))
+		{
+			printMLText("op_finished");
+			printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID())));
+		}
+		else
+		{
+			printMLText("error_occured");
+			printGoBack();
+		}
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.AddDocument.php
===================================================================
--- /contrib/Dms/op/op.AddDocument.php	(revision 3526)
+++ /contrib/Dms/op/op.AddDocument.php	(revision 3526)
@@ -0,0 +1,95 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$folderid	= (isset($_POST['folderid'])) ? (int) $_POST['folderid'] : NULL;
+
+$folder		= getFolder($folderid);
+
+// form data
+$userfile	= $_FILES['userfile']['tmp_name'];
+$fname		= (!empty($_POST['fname']) ? $_POST['fname'] : $_FILES['userfile']['name']);
+$comment	= $_POST['comment'];
+$keywords	= $_POST['keywords'];
+$expires	= $_POST['expires'];
+$expday		= $_POST['expday'];
+$expmonth	= $_POST['expmonth'];
+$expyear	= $_POST['expyear'];
+$sequence	= $_POST['sequence'];
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printCenterStart();
+
+printStartBox(getMLText("add_document"));
+
+print "<div class=\"standardText\">";
+
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	if (!isset($userfile) || ($userfile == "none") || ($userfile == ""))
+	{
+		printMLText("uploading_failed");
+		printGoBack();
+	}
+	else
+	{
+		printMLText("adding_document", array("documentname" => $fname, "foldername" => $folder->getName()));
+		
+		$fname		= sanitizeString($fname);
+		$comment	= sanitizeString($comment);
+		$keywords	= sanitizeString($keywords);
+		$userfile_type	= sanitizeString($_FILES['userfile']['type']);
+		$userfile_name	= sanitizeString($_FILES['userfile']['name']);
+
+		if (!is_numeric($sequence))
+			die ("invalid sequence value");
+		
+		$lastDotIndex	= strrpos(basename($userfile_name), ".");
+		if (is_bool($lastDotIndex) && !$lastDotIndex)
+			$fileType = ".";
+		else
+			$fileType = substr($userfile_name, $lastDotIndex);
+		
+		$expires = ($expires == "true") ? mktime(0,0,0, $expmonth, $expday, $expyear) : false;
+		
+		$newDocument = $folder->addDocument($fname, $comment, $expires, $user, $keywords, $userfile, basename($userfile_name), $fileType, $userfile_type, $sequence);
+		
+		if (is_bool($newDocument) && !$newDocument)
+		{
+			printMLText("error_occured");
+			printGoBack();
+		}
+		else
+		{
+			printMLText("op_finished");
+			printGoto(array(array($folder->getName(), "../out/out.ViewFolder.php?folderid=".$folder->getID()), 
+					array($newDocument->getName(), "../out/out.ViewDocument.php?documentid=".$newDocument->getID())));
+		}
+	}
+}
+
+
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.UnlockDocument.php
===================================================================
--- /contrib/Dms/op/op.UnlockDocument.php	(revision 3526)
+++ /contrib/Dms/op/op.UnlockDocument.php	(revision 3526)
@@ -0,0 +1,68 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("unlock_document"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	if (!$document->isLocked())
+	{
+		printMLText("document_is_not_locked");
+		printGoBack();
+	}
+	else
+	{
+		$lockingUser = $document->getLockingUser();
+		if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL))
+		{
+			printMLText("unlocking_document");
+			if ($document->setLocked("false"))
+			{
+				printMLText("op_finished");
+				printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID())));
+			}
+			else
+			{
+				printMLText("error_occured");
+				printGoBack();
+			}
+		}
+		else
+		{
+			printMLText("unlocking_denied");
+			printGoBack();
+		}
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.SetExpires.php
===================================================================
--- /contrib/Dms/op/op.SetExpires.php	(revision 3526)
+++ /contrib/Dms/op/op.SetExpires.php	(revision 3526)
@@ -0,0 +1,58 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$expires	= $_GET['expires'];
+$expday		= $_GET['expday'];
+$expmonth	= $_GET['expmonth'];
+$expyear	= $_GET['expyear'];
+
+$document = getDocument($documentid);
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("expires"));
+
+print "<div class=\"standardText\">";
+
+if ($document->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("setting_expires");
+	
+	$expires = ($expires == "true") ? mktime(0,0,0, $expmonth, $expday, $expyear) : false;
+	
+	if (!$document->setExpires($expires))
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+	else
+	{
+		printMLText("op_finished");
+		printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID())));
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.FolderAccess.php
===================================================================
--- /contrib/Dms/op/op.FolderAccess.php	(revision 3526)
+++ /contrib/Dms/op/op.FolderAccess.php	(revision 3526)
@@ -0,0 +1,164 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$folderid	= isset($_GET['folderid']) ? (int) $_GET['folderid'] : NULL;
+
+$userid		= isset($_GET['userid']) ? (int) $_GET['userid'] : NULL;
+$groupid	= isset($_GET['groupid']) ? (int) $_GET['groupid'] : NULL;
+
+$action		= $_GET['action'];
+$mode		= $_GET['mode'];
+
+$ownerid	= isset($_GET['ownerid']) ? (int) $_GET['ownerid'] : NULL;
+
+$folder = getFolder($folderid);
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printCenterStart();
+
+printStartBox(getMLText("edit_folder_access"));
+
+print "<div class=\"standardText\">";
+
+
+if ($folder->getAccessMode($user) < M_ALL)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	//Ändern des Besitzers ----------------------------------------------------------------------------
+	if ($action == "setowner")
+	{
+		if (!$user->isAdmin())
+			die("Only an Administrator may set a new owner");
+		$newOwner = getUser($ownerid);
+		printMLText("setting_owner");
+		
+		$folder->setOwner($newOwner);
+	}
+
+	//Änderung auf nicht erben ------------------------------------------------------------------------
+	else if ($action == "notinherit")
+	{
+		if ($mode == "copy")
+			printMLText("folder_set_not_inherit_copy");
+		else
+			printMLText("folder_set_not_inherit_empty");
+		
+		$defAccess = $folder->getDefaultAccess();
+		$folder->setInheritAccess(false);
+		$folder->setDefaultAccess($defAccess);
+		
+		if ($mode == "copy")
+		{
+			$parent = $folder->getParent();
+			$accessList = $parent->getAccessList();
+			
+			foreach ($accessList["users"] as $userAccess)
+				$folder->addAccess($userAccess->getMode(), $userAccess->getUserID(), true);
+			foreach ($accessList["groups"] as $groupAccess)
+				$folder->addAccess($groupAccess->getMode(), $groupAccess->getGroupID(), false);
+		}
+	}
+
+	//Änderung auf erben ------------------------------------------------------------------------------
+	else if ($action == "inherit")
+	{
+		printMLText("folder_set_inherit");
+		
+		$folder->clearAccessList();
+		$folder->setInheritAccess(true);
+	}
+
+	//Standardberechtigung setzen----------------------------------------------------------------------
+	else if ($action == "setdefault")
+	{
+		if (!is_numeric($mode))
+			die ("invalid access mode");
+			
+		printMLText("folder_set_default_access");
+		$folder->setDefaultAccess($mode);
+	}
+
+	//Bestehende Berechtigung änndern -----------------------------------------------------------------
+	else if ($action == "editaccess")
+	{
+		printMLText("folder_edit_access");
+		
+		if (!is_numeric($mode))
+			die ("invalid access mode");
+		
+		if (isset($userid)) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$folder->changeAccess($mode, $userid, true);
+		}
+		else if (isset($groupid)) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$folder->changeAccess($mode, $groupid, false);
+		}
+	}
+
+	//Berechtigung löschen ----------------------------------------------------------------------------
+	else if ($action == "delaccess")
+	{
+		printMLText("folder_del_access");
+		if (isset($userid)) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$folder->removeAccess($userid, true);
+		}
+		else if (isset($groupid)) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$folder->removeAccess($groupid, false);
+		}
+	}
+
+	//Neue Berechtigung hinzufügen --------------------------------------------------------------------
+	else if ($action == "addaccess")
+	{
+		printMLText("folder_add_access");
+		
+		if (!is_numeric($mode))
+			die ("invalid access mode");
+		
+		if ($userid != 'none') {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$folder->addAccess($mode, $userid, true);
+		}
+		if ($groupid != 'none') {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$folder->addAccess($mode, $groupid, false);
+		}
+	}
+	
+	printMLText("op_finished");
+	printGoto(array(array($folder->getName(), "../out/out.ViewFolder.php?folderid=".$folder->getID()), 
+				array(getMLText("folder_access_again"), "../out/out.FolderAccess.php?folderid=".$folder->getID())));
+}
+
+
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.AddSubFolder.php
===================================================================
--- /contrib/Dms/op/op.AddSubFolder.php	(revision 3526)
+++ /contrib/Dms/op/op.AddSubFolder.php	(revision 3526)
@@ -0,0 +1,68 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+
+$fname		= get_var('fname', array('GET'));
+$comment	= get_var('comment', array('GET'));
+$sequence	= $_GET['sequence'];
+
+$folder = getFolder($folderid);
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printCenterStart();
+
+printStartBox(getMLText("add_subfolder"));
+
+print "<div class=\"standardText\">";
+
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	print lang('Agregando subcarpeta "%1" en la carpeta "%2"...', $fname, $folder->getName());
+
+	$fname = sanitizeString($fname);
+	$comment = sanitizeString($comment);
+	if (!is_numeric($sequence))
+		die ("valor de secuencia invalida");
+	
+
+ 	$subFolder = $folder->addSubFolder($fname, $comment, $user, $sequence);
+	
+	if (is_object($subFolder))
+	{
+		printMLText("op_finished");
+		printGoto(array(array($folder->getName(), "../out/out.ViewFolder.php?folderid=".$folder->getID()), 
+						array($subFolder->getName(), "../out/out.ViewFolder.php?folderid=".$subFolder->getID())));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/op/op.DocumentAccess.php
===================================================================
--- /contrib/Dms/op/op.DocumentAccess.php	(revision 3526)
+++ /contrib/Dms/op/op.DocumentAccess.php	(revision 3526)
@@ -0,0 +1,157 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("edit_document_access"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_ALL)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	//Ändern des Besitzers ----------------------------------------------------------------------------
+	if ($action == "setowner")
+	{
+		if (!$user->isAdmin())
+			die("Only an Administrator may set a new owner");
+		
+		$newOwner = getUser($ownerid);
+		printMLText("setting_owner");
+		
+		$document->setOwner($newOwner);
+	}
+
+	//Änderung auf nicht erben ------------------------------------------------------------------------
+	else if ($action == "notinherit")
+	{
+		if ($mode == "copy")
+			printMLText("document_set_not_inherit_copy");
+		else
+			printMLText("document_set_not_inherit_empty");
+		
+		$defAccess = $document->getDefaultAccess();
+		$document->setInheritAccess(false);
+		$document->setDefaultAccess($defAccess);
+		
+		//copy ACL of parent folder
+		if ($mode == "copy")
+		{
+			$folder = $document->getFolder();
+			$accessList = $folder->getAccessList();
+			
+			foreach ($accessList["users"] as $userAccess)
+				$document->addAccess($userAccess->getMode(), $userAccess->getUserID(), true);
+			foreach ($accessList["groups"] as $groupAccess)
+				$document->addAccess($groupAccess->getMode(), $groupAccess->getGroupID(), false);
+		}
+	}
+
+	//Änderung auf erben ------------------------------------------------------------------------------
+	else if ($action == "inherit")
+	{
+		printMLText("document_set_inherit");
+		
+		$document->clearAccessList();
+		$document->setInheritAccess(true);
+	}
+
+	//Standardberechtigung setzen----------------------------------------------------------------------
+	else if ($action == "setdefault")
+	{
+		printMLText("document_set_default_access");
+		
+		if (!is_numeric($mode))
+			die ("invalid access mode");
+		
+		$document->setDefaultAccess($mode);
+	}
+
+	//Bestehende Berechtigung änndern -----------------------------------------------------------------
+	else if ($action == "editaccess")
+	{
+		printMLText("document_edit_access");
+		
+		if (!is_numeric($mode))
+			die ("invalid access mode");
+		
+		if (isset($userid)) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$document->changeAccess($mode, $userid, true);
+		}
+		else if (isset($groupid)) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$document->changeAccess($mode, $groupid, false);
+		}
+	}
+
+	//Berechtigung löschen ----------------------------------------------------------------------------
+	else if ($action == "delaccess")
+	{
+		printMLText("document_del_access");
+		
+		if (isset($userid)) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$document->removeAccess($userid, true);
+		}
+		else if (isset($groupid)) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$document->removeAccess($groupid, false);
+		}
+	}
+
+	//Neue Berechtigung hinzufügen --------------------------------------------------------------------
+	else if ($action == "addaccess")
+	{
+		printMLText("document_add_access");
+		
+		if (!is_numeric($mode))
+			die ("invalid access mode");
+		
+		if ($userid != -1) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$document->addAccess($mode, $userid, true);
+		}
+		if ($groupid != -1) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$document->addAccess($mode, $groupid, false);
+		}
+	}
+	printMLText("op_finished");
+	printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID()), 
+				array(getMLText("document_access_again"), "../out/out.DocumentAccess.php?documentid=".$document->getID())));
+
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.MoveFolder.php
===================================================================
--- /contrib/Dms/op/op.MoveFolder.php	(revision 3526)
+++ /contrib/Dms/op/op.MoveFolder.php	(revision 3526)
@@ -0,0 +1,60 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$folderid	= (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+$targetid	= (isset($_GET['targetid'])) ? (int) $_GET['targetid'] : NULL;
+
+$folder = getFolder($folderid);
+$oldParent = $folder->getParent();
+$targetFolder = getFolder($targetid);
+
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printCenterStart();
+
+printStartBox(getMLText("move_folder"));
+
+print "<div class=\"standardText\">";
+
+
+if (($folder->getAccessMode($user) < M_READWRITE) || ($targetFolder->getAccessMode($user) < M_READWRITE))
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("moving_folder");
+	
+	if ($folder->setParent($targetFolder))
+	{
+		printMLText("op_finished");
+		printGoto(array(array($folder->getName(), "../out/out.ViewFolder.php?folderid=".$folder->getID()), 
+				array($oldParent->getName(), "../out/out.ViewFolder.php?folderid=".$oldParent->getID())));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+
+?>
Index: /contrib/Dms/op/op.NotifyMailer.php
===================================================================
--- /contrib/Dms/op/op.NotifyMailer.php	(revision 3526)
+++ /contrib/Dms/op/op.NotifyMailer.php	(revision 3526)
@@ -0,0 +1,156 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Utils.php");
+
+function addExpiredMsg($document, $users)
+{
+	GLOBAL $msgs;
+	
+	$folder = $document->getFolder();
+	$path = $folder->getPath();
+	$pathStr = "";
+	for ($i = 0; $i < count($path); $i++)
+	{
+		$pathStr .= $path[$i]->getName();
+		if ($i+1 < count($path))
+			$pathStr .= "/";
+	}
+	foreach ($users as $user)
+	{
+		if (!isset($msgs[$user->getEmail()]))
+			$msgs[$user->getEmail()] = array();
+		array_push(
+			$msgs[$user->getEmail()],
+			getMLText("msg_document_expired",
+				array(
+						"documentname" => $document->getName(),
+						"path" => $pathStr,
+						"documentid" => $document->getID(),
+						"expires" => getReadableDate($document->getExpires())
+				)
+			)
+		);
+	}
+}
+
+function addChangedMsg($document, $users)
+{
+	GLOBAL $msgs;
+	
+	$latestContent = $document->getLatestContent();
+	
+	$folder = $document->getFolder();
+	$path = $folder->getPath();
+	$pathStr = "";
+	for ($i = 0; $i < count($path); $i++)
+	{
+		$pathStr .= $path[$i]->getName();
+		if ($i+1 < count($path))
+			$pathStr .= "/";
+	}
+	
+	foreach ($users as $user)
+	{
+		if (!isset($msgs[$user->getEmail()]))
+			$msgs[$user->getEmail()] = array();
+		
+		array_push(
+			$msgs[$user->getEmail()],
+			getMLText("msg_document_updated",
+				array(
+					"documentname" => $document->getName(),
+					"path" => $pathStr,
+					"documentid" => $document->getID(), 
+					"updated" => getLongReadableDate($latestContent->getDate())
+				)
+			)
+		);
+	}
+}
+
+function getUserOnlyNotifyList($obj, $oldList, $mode)
+{
+	$newList = $oldList;
+	$listToAdd = $obj->getNotifyList();
+	
+	$tmpList = $listToAdd["users"];
+	foreach ($listToAdd["groups"] as $group)
+	{
+		$members = $group->getUsers();
+		foreach ($members as $member)
+			array_push($tmpList, $member);
+	}
+	unset($listToAdd);
+	foreach ($tmpList as $user)
+	{
+		$alreadyInList = false;
+		foreach ($newList as $_user)
+		{
+			if ($_user->getID() == $user->getID())
+			{
+				$alreadyInList = true;
+				break;
+			}
+		}
+		if (!$alreadyInList)
+			array_push($newList, $user);
+	}
+	return filterUsersByAccess($obj, $newList, $mode);
+}
+
+function notifyForDocument($document, $users)
+{
+	GLOBAl $settings;
+	
+	$newUsers = getUserOnlyNotifyList($document, $users, M_READ);
+	
+	//wenn das letzte update keine 24h (eher updateNotifyTime sek.) zurückliegt, werden
+	//alle Benutzer, die in der alten Liste sowie in der Liste für diese Datei enthalten sind,
+	//und mindestens Lese-Zugriff haben, benachrichtigt
+	$latestContent = $document->getLatestContent();
+	if (mktime() - $latestContent->getDate() < $settings->_updateNotifyTime)
+		addChangedMsg($document, $newUsers);
+	
+	//über veraltete Inhalte werden nur solche Benutzer informiert, die auch noch über Schreib-Rechte verfügen
+	if ($document->expires() && (mktime() > $document->getExpires()))
+		addExpiredMsg($document, filterUsersByAccess($document, $newUsers, M_READWRITE));
+}
+
+function notifyForFolder($folder, $users)
+{
+	$newUsers = getUserOnlyNotifyList($folder, $users, M_READ);
+	
+	$documents = $folder->getDocuments();
+	foreach ($documents as $document)
+		notifyForDocument($document, $newUsers);
+	
+	$subFolders = $folder->getSubFolders();
+	foreach ($subFolders as $subFolder)
+		notifyForFolder($subFolder, $newUsers);
+}
+
+$rootFolder = getFolder($settings->_rootFolderID);
+$msgs = array();
+notifyForFolder($rootFolder, array());
+
+print "<pre>";
+print_r($msgs);
+print "</pre>";
+
+$receivers = array_keys($msgs);
+foreach ($receivers as $receiver)
+{
+	$msg = implode("\n\n", $msgs[$receiver]);
+	mail($receiver, getMLText("notify_subject"), $msg);
+}
+?>
Index: /contrib/Dms/op/op.RemoveVersion.php
===================================================================
--- /contrib/Dms/op/op.RemoveVersion.php	(revision 3526)
+++ /contrib/Dms/op/op.RemoveVersion.php	(revision 3526)
@@ -0,0 +1,56 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+
+$document = getDocument($documentid);
+if (!$document) die("Error: could not get document");
+$version  = $document->getContentByVersion($version);
+if (!$version) die("error: could not get version $version");
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("rm_version"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_ALL)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("removing_version", array("version" => $version->getVersion()));
+	
+	if (!$version->remove())
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+	else
+	{
+		printMLText("op_finished");
+		printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID())));
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.FolderNotify.php
===================================================================
--- /contrib/Dms/op/op.FolderNotify.php	(revision 3526)
+++ /contrib/Dms/op/op.FolderNotify.php	(revision 3526)
@@ -0,0 +1,81 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$folderid	= (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
+$action		= $_GET['action'];
+$userid		= (isset($_GET['userid'])) ? (int) $_GET['userid'] : NULL;
+$groupid	= (isset($_GET['groupid'])) ? (int) $_GET['groupid'] : NULL;
+
+$folder = getFolder($folderid);
+
+printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
+printTitleBar($folder);
+printCenterStart();
+
+printStartBox(getMLText("edit_folder_notify"));
+
+print "<div class=\"standardText\">";
+
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	//Benachrichtigung löschen ------------------------------------------------------------------------
+	if ($action == "delnotify")
+	{
+		printMLText("deleting_folder_notify");
+		if (isset($userid)) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$folder->removeNotify($userid, true);
+		}
+		else if (isset($groupid)) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$folder->removeNotify($groupid, false);
+		}
+	}
+
+	//Benachrichtigung hinzufügen ---------------------------------------------------------------------
+	else if ($action == "addnotify")
+	{
+		printMLText("adding_folder_notify");
+		if ($userid != -1) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$folder->addNotify($userid, true);
+		}
+		if ($groupid != -1) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$folder->addNotify($groupid, false);
+		}
+	}
+	
+	printMLText("op_finished");
+	printGoto(array(array($folder->getName(), "../out/out.ViewFolder.php?folderid=".$folder->getID()), 
+				array(getMLText("folder_notify_again"), "../out/out.FolderNotify.php?folderid=".$folder->getID())));
+}
+
+
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.AddDocumentLink.php
===================================================================
--- /contrib/Dms/op/op.AddDocumentLink.php	(revision 3526)
+++ /contrib/Dms/op/op.AddDocumentLink.php	(revision 3526)
@@ -0,0 +1,62 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$document = getDocument($documentid);
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("add_document_link"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_READ)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("adding_document_link");
+	
+	$public = (isset($public) && $public == "true") ? true : false;
+	if ($public && ($document->getAccessMode($user) == M_READ))
+		$public = false;
+	
+	if (!is_numeric($docid))
+		die("invalid document id");
+	
+	if ($document->addDocumentLink($docid, $user->getID(), $public))
+	{
+		$targetDoc = getDocument($docid);
+		printMLText("op_finished");
+		printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID()), 
+						array($targetDoc->getName(), "../out/out.ViewDocument.php?documentid=".$targetDoc->getID())));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+?>
Index: /contrib/Dms/op/op.MoveDocument.php
===================================================================
--- /contrib/Dms/op/op.MoveDocument.php	(revision 3526)
+++ /contrib/Dms/op/op.MoveDocument.php	(revision 3526)
@@ -0,0 +1,60 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$targetid	= (isset($_GET['targetid'])) ? (int) $_GET['targetid'] : NULL;
+
+$document = getDocument($documentid);
+$oldFolder = $document->getFolder();
+$targetFolder = getFolder($targetid);
+
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("move_document"));
+
+print "<div class=\"standardText\">";
+
+
+if (($document->getAccessMode($user) < M_READWRITE) || ($targetFolder->getAccessMode($user) < M_READWRITE))
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	printMLText("moving_document");
+	
+	if ($document->setFolder($targetFolder))
+	{
+		printMLText("op_finished");
+		printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID()), 
+				array($oldFolder->getName(), "../out/out.ViewFolder.php?folderid=".$oldFolder->getID())));
+	}
+	else
+	{
+		printMLText("error_occured");
+		printGoBack();
+	}
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+
+
+?>
Index: /contrib/Dms/op/op.Search.php
===================================================================
--- /contrib/Dms/op/op.Search.php	(revision 3526)
+++ /contrib/Dms/op/op.Search.php	(revision 3526)
@@ -0,0 +1,203 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$query			= $_GET['query'];
+$mode			= $_GET['mode'];
+$searchin		= $_GET['searchin'];
+$ownerid		= $_GET['ownerid'];
+$creationdate		= $_GET['creationdate'];
+$lastupdate		= $_GET['lastupdate'];
+$createstartmonth	= $_GET['createstartmonth'];
+$createstartday		= $_GET['createstartday'];
+$createstartyear	= $_GET['createstartyear'];
+$createendmonth		= $_GET['createendmonth'];
+$createendday		= $_GET['createendday'];
+$createendyear		= $_GET['createendyear'];
+$updatestartmonth	= $_GET['updatestartmonth'];
+$updatestartday		= $_GET['updatestartday'];
+$updatestartyear	= $_GET['updatestartyear'];
+$updateendmonth		= $_GET['updateendmonth'];
+$updateendday		= $_GET['updateendday'];
+$updateendyear		= $_GET['updateendyear'];
+
+$query = sanitizeString($query);
+$mode  = sanitizeString($mode);
+
+$targetid = isset($targetid) ? $targetid : $settings->_rootFolderID;
+$startFolder = getFolder($targetid);
+
+
+function getTime() {
+	if (function_exists('microtime')) {
+		$tm = microtime();
+		$tm = explode(' ', $tm);
+		return (float) sprintf('%f', $tm[1] + $tm[0]);
+	}
+	return time();
+}
+
+function markQuery($str, $tag = "b") {
+	GLOBAL $query;
+	
+	$querywords = split(" ", $query);
+	
+	foreach ($querywords as $queryword)
+		$str = eregi_replace("($queryword)", "<" . $tag . ">\\1</" . $tag . ">", $str);
+	
+	return $str;
+}
+
+function matches($document) {
+	GLOBAL $query, $mode, $searchin, $ownerid,  $creationdate, $lastupdate;
+	GLOBAL $createstartmonth, $createstartday, $createstartyear;
+	GLOBAL $createendmonth, $createendday, $createendyear;
+	GLOBAL $updatestartmonth, $updatestartday, $updatestartyear;
+	GLOBAL $updateendmonth, $updateendday, $updateendyear;
+	
+	if ($ownerid != -1) {
+		if ($ownerid != $document->_ownerID)
+			return false;
+	}
+	
+	if ($creationdate == "true") {
+		$startdate = mktime(0,0,0, $createstartmonth, $createstartday, $createstartyear);
+		$stopdate  = mktime(23,59,59, $createendmonth, $createendday, $createendyear);
+		$date      = $document->getDate();
+		
+		if (($date < $startdate ) || ($date > $stopdate))
+			return false;
+	}
+	
+	if ($lastupdate == "true") {
+		$startdate = mktime(0,0,0, $updatestartmonth, $updatestartday, $updatestartyear);
+		$stopdate  = mktime(23,59,59, $updateendmonth, $updateendday, $updateendyear);
+		$latestContent = $document->getLatestContent();
+		$date = $latestContent->getDate();
+		
+		if (($date < $startdate) || ($date > $stopdate))
+			return false;
+	}
+	
+	$str = "";
+	if (in_array("keywords", $searchin))
+		$str .= $document->getKeywords() . " ";
+	if (in_array("name", $searchin))
+		$str .= $document->getName() . " ";
+	if (in_array("comment", $searchin))
+		$str .= $document->getComment();
+	
+	$querywords = split(" ", strtolower($query));
+	$keywords = split(" ", strtolower($str));
+	
+	$hitsCount = 0;
+	foreach ($querywords as $queryword) {
+		$found = false;
+		
+		foreach ($keywords as $keyword) {
+			if ((substr_count($keyword, $queryword) > 0) || ($queryword == "%")) {
+				$found = true;
+				if ($mode == "or")
+					return true;
+			}
+		}
+		if ($mode == "and" && !$found)
+			return false;
+	}
+	if ($mode == "and")
+		return true;
+	else
+		return false;
+}
+
+
+function searchInFolder($folder) {
+	GLOBAl $results, $user;
+	
+	$documents = $folder->getDocuments();
+	$documents = filterAccess($documents, $user, M_READ);
+	$subFolders = $folder->getSubFolders();
+	$subFolders = filterAccess($subFolders, $user, M_READ);
+	
+	foreach ($documents as $document) {
+		if (matches($document))
+			array_push($results, $document);
+	}
+	foreach ($subFolders as $subFolder)
+		searchInFolder($subFolder);
+}
+
+// ------------------------------------- Suche starten --------------------------------------------
+
+$startTime = getTime();
+$results = array();
+searchInFolder($startFolder);
+$searchTime = getTime() - $startTime;
+$searchTime = round($searchTime, 2);
+
+// ---------------------------------- Ausgabe der Ergebnisse --------------------------------------
+
+printHTMLHead( getMLText("search") );
+printTitleBar($startFolder);
+printCenterStart();
+
+printStartBox(getMLText("search_results"));
+
+?>
+
+<table width="100%">
+	<tr>
+		<td align="left" class="standardText">
+			<?php
+				if (count($results) == 0)
+					printMLText("search_no_results", array("query" => $query));
+				else
+					printMLText("search_report", array("query" => $query, "count" => count($results)));
+			?>
+		</td>
+		<td align="right" class="standardText"><?php printMLText("search_time", array("time" => $searchTime));?></td>
+	</tr>
+</table>
+
+<?php
+if (count($results) == 0)
+{
+	printEndBox();
+	printCenterEnd();
+	printHTMLFoot();
+	exit;
+}
+
+print "<p><ol>";
+
+foreach ($results as $document) {
+	print "<li class=\"standardText\"><b>" . getMLText("name") . ": " . "<a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">" . markQuery($document->getName(), "i") . "</a></b><br>";
+	$folder = $document->getFolder();
+	$path = $folder->getPath();
+	print getMLText("folder_path") . ": ";
+	for ($i = 0; $i  < count($path); $i++)
+	{
+		print $path[$i]->getName();
+		if ($i +1 < count($path))
+			print " / ";
+	}
+	print "<br>";
+	print markQuery($document->getComment());
+	print "<br>&nbsp;</li>";
+}
+
+print "</ol>";
+
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/op.Download.php
===================================================================
--- /contrib/Dms/op/op.Download.php	(revision 3526)
+++ /contrib/Dms/op/op.Download.php	(revision 3526)
@@ -0,0 +1,55 @@
+<?php
+//session_cache_limiter('none');
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$documentid = (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$version = (isset($_GET['version'])) ? (int) $_GET['version'] : NULL;
+
+$document = getDocument($documentid);
+
+
+if ($document->getAccessMode($user) < M_READ)
+{
+	printHTMLHead( getMLText("download") );
+	printCenterStart();
+	printStartBox(getMLText("download"));
+	print "<div class=\"standardText\">";
+	printMLText("operation_not_allowed");
+	printGoBack();
+	print "</div>";
+	printEndBox();
+	printCenterEnd();
+	printHTMLFoot();
+	exit;
+}
+
+$content = $document->getContentByVersion($version);
+
+if (is_bool($content) && !$content)
+	die("Version " . $version . " of Document \"" . $document->getName() . "\" not found");
+
+header("Pragma: public");
+header("Expires: 0");
+header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+header("Content-Type: " . $content->getMimeType());
+# Content-Length header does not work correctly on firefox and maybe other browser
+# the right filesize gets send(like reported by ls on the filesystem)
+# but the file stored by the firefox browser is about ~4000 ... 8000 bytes to small
+# disabling Content-Length header solves this problem
+#header("Content-Length: " . filesize($settings->_contentDir . $content->getPath() ) );
+header("Content-Disposition: attachment; filename=\"" . $content->getOriginalFileName() . "\"");
+header("Content-Transfer-Encoding: binary\n");
+
+readfile($settings->_contentDir . $content->getPath());
+exit();
+?>
Index: /contrib/Dms/op/op.DocumentNotify.php
===================================================================
--- /contrib/Dms/op/op.DocumentNotify.php	(revision 3526)
+++ /contrib/Dms/op/op.DocumentNotify.php	(revision 3526)
@@ -0,0 +1,78 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.AccessUtils.php");
+include("../inc/inc.ClassAccess.php");
+include("../inc/inc.ClassDocument.php");
+include("../inc/inc.ClassFolder.php");
+include("../inc/inc.ClassGroup.php");
+include("../inc/inc.ClassUser.php");
+include("../inc/inc.DBAccess.php");
+include("../inc/inc.FileUtils.php");
+include("../inc/inc.Language.php");
+include("../inc/inc.OutUtils.php");
+include("../inc/inc.Authentication.php");
+
+$documentid	= (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL;
+$userid = (isset($_GET['userid'])) ? (int) $_GET['userid'] : NULL;
+$groupid = (isset($_GET['groupid'])) ? (int) $_GET['groupid'] : NULL;
+$action = $_GET['action'];
+
+$document = getDocument($documentid);
+
+printHTMLHead( getMLText("document_title", array("documentname" => $document->getName()) ) );
+printTitleBar($document->getFolder());
+printCenterStart();
+
+printStartBox(getMLText("edit_document_notify"));
+
+print "<div class=\"standardText\">";
+
+
+if ($document->getAccessMode($user) < M_READWRITE)
+{
+	printMLText("operation_not_allowed");
+	printGoBack();
+}
+else
+{
+	//Benachrichtigung löschen ------------------------------------------------------------------------
+	if ($action == "delnotify")
+	{
+		printMLText("deleting_document_notify");
+		if (isset($userid)) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$document->removeNotify($userid, true);
+		}
+		else if (isset($groupid)) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$document->removeNotify($groupid, false);
+		}
+	}
+	
+	//Benachrichtigung hinzufügen ---------------------------------------------------------------------
+	else if ($action == "addnotify")
+	{
+		printMLText("adding_document_notify");
+		if ($userid != -1) {
+			if (!is_numeric($userid))
+				die ("invalid user id");
+			$document->addNotify($userid, true);
+		}
+		if ($groupid != -1) {
+			if (!is_numeric($groupid))
+				die ("invalid group id");
+			$document->addNotify($groupid, false);
+		}
+	}
+	printMLText("op_finished");
+	printGoto(array(array($document->getName(), "../out/out.ViewDocument.php?documentid=".$document->getID()), 
+				array(getMLText("document_notify_again"), "../out/out.DocumentNotify.php?documentid=".$document->getID())));
+}
+
+print "</div>";
+printEndBox();
+printCenterEnd();
+printHTMLFoot();
+?>
Index: /contrib/Dms/op/convert_excel.js
===================================================================
--- /contrib/Dms/op/convert_excel.js	(revision 3526)
+++ /contrib/Dms/op/convert_excel.js	(revision 3526)
@@ -0,0 +1,15 @@
+//var logFile = fs.CreateTextFile("convertlog.txt", true);
+
+var source = WScript.Arguments(0);
+var target = WScript.Arguments(1);
+
+var ExcelApp;
+ExcelApp = new ActiveXObject("Excel.Application");
+var Newdoc;
+Newdoc = ExcelApp.Workbooks.Open(source);
+Newdoc.SaveAs(target, 44); // xlHTML = 44
+ExcelApp.Quit();
+
+
+
+//logFile.Close();
Index: /contrib/Dms/op/op.Logout.php
===================================================================
--- /contrib/Dms/op/op.Logout.php	(revision 3526)
+++ /contrib/Dms/op/op.Logout.php	(revision 3526)
@@ -0,0 +1,33 @@
+<?php
+include("../inc/inc.Settings.php");
+include("../inc/inc.Utils.php");
+include("../inc/inc.DBAccess.php");
+
+//Code when running PHP as Module -----------------------------------------------------------------
+
+/*
+setcookie("mydms_logged_out", "true", 0, $settings->_httpRoot);
+header("Location: ../out/out.ViewFolder.php");
+print "Logout successful";
+*/
+
+//Code when running PHP in CGI-Mode ---------------------------------------------------------------
+
+//Delete from phpgw_mydms_Sessions
+
+$dms_session = $HTTP_COOKIE_VARS["mydms_session"];
+$dms_session = sanitizeString($dms_session);
+
+$queryStr = "DELETE FROM phpgw_mydms_Sessions WHERE id = '$dms_session'";
+if (!$db->getResult($queryStr))
+	die ("Error while removing session from phpgw_mydms_Sessions: " . $db->getErrorMsg());
+
+//Delete Cookie
+setcookie("mydms_session", $HTTP_COOKIE_VARS["mydms_session"], time()-3600, $settings->_httpRoot);
+
+//Forward to Login-page
+header("Location: ../out/out.Login.php");
+print "Logout successful";
+
+
+?>
Index: /contrib/Timesheet/todo
===================================================================
--- /contrib/Timesheet/todo	(revision 3526)
+++ /contrib/Timesheet/todo	(revision 3526)
@@ -0,0 +1,22 @@
+TODO:
+CREATE TABLE phpgw_timesheet
+(
+  ts_id integer NOT NULL DEFAULT nextval('seq_phpgw_timesheet'::regclass),
+  ts_project character varying(80) DEFAULT NULL::character varying,
+  ts_title character varying(80) NOT NULL,
+  ts_description text,
+  ts_start bigint NOT NULL,
+  ts_end bigint NOT NULL DEFAULT (0)::bigint,
+  ts_cat integer DEFAULT 0,
+  ts_owner integer NOT NULL,
+  ts_modified bigint NOT NULL,
+  ts_infolog character varying(255),
+  ts_modifier bigint NOT NULL DEFAULT 0,
+  ts_tracker character varying DEFAULT 255,
+  ts_owner_name character varying(255),
+  ts_modifier_name character varying(255),
+  CONSTRAINT phpgw_timesheet_pkey PRIMARY KEY (ts_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE phpgw_timesheet OWNER TO postgres;
+
Index: /contrib/Timesheet/inc/class.ts_admin_prefs_sidebox_hooks.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.ts_admin_prefs_sidebox_hooks.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.ts_admin_prefs_sidebox_hooks.inc.php	(revision 3526)
@@ -0,0 +1,132 @@
+<?php
+/**
+ * TimeSheet -  Admin-, Preferences- and SideboxMenu-Hooks
+ *
+ * @link http://www.egroupware.org
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @package timesheet
+ * @copyright (c) 2005 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id: class.ts_admin_prefs_sidebox_hooks.inc.php 23493 2007-03-08 11:22:57Z lkneschke $ 
+ */
+
+if (!defined('TIMESHEET_APP'))
+{
+	define('TIMESHEET_APP','timesheet');
+}
+
+class ts_admin_prefs_sidebox_hooks
+{
+	var $public_functions = array(
+//		'check_set_default_prefs' => true,
+	);
+	var $config = array();
+
+	function pm_admin_prefs_sidebox_hooks()
+	{
+		$config =& CreateObject('phpgwapi.config',TIMESHEET_APP);
+		$config->read_repository();
+		$this->config =& $config->config_data;
+		unset($config);
+	}
+
+	/**
+	 * hooks to build projectmanager's sidebox-menu plus the admin and preferences sections
+	 *
+	 * @param string/array $args hook args
+	 */
+	function all_hooks($args)
+	{
+		$appname = TIMESHEET_APP;
+		$location = is_array($args) ? $args['location'] : $args;
+		//echo "<p>ts_admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'</p>\n";
+
+		if ($location == 'sidebox_menu')
+		{
+			$file = array(
+			);
+			display_sidebox($appname,$GLOBALS['phpgw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file);
+		}
+
+		if ($GLOBALS['phpgw_info']['user']['apps']['preferences'] && $location != 'admin')
+		{
+			$file = array(
+//				'Preferences'     => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname),
+				'Grant Access'    => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
+				'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
+			);
+			if ($location == 'preferences')
+			{
+				display_section($appname,$file);
+			}
+			else
+			{
+				display_sidebox($appname,lang('Preferences'),$file);
+			}
+		}
+
+		if ($GLOBALS['phpgw_info']['user']['apps']['admin'] && $location != 'preferences')
+		{
+			$file = Array(
+				'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
+//				'Custom fields' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.customfields.edit&appname='.$appname),
+				'Global Categories'  => $GLOBALS['phpgw']->link('/index.php',array(
+					'menuaction' => 'admin.uicategories.index',
+					'appname'    => $appname,
+					'global_cats'=> True)),
+				'Custom fields'  => $GLOBALS['phpgw']->link('/index.php',array(
+					'menuaction' => 'timesheet.uicustomfields.edit',
+					'appname'    => $appname)),		
+			);
+			if ($location == 'admin')
+			{
+				display_section($appname,$file);
+			}
+			else
+			{
+				display_sidebox($appname,lang('Admin'),$file);
+			}
+		}
+	}
+	
+	/**
+	 * populates $GLOBALS['settings'] for the preferences
+	 */
+	function settings()
+	{
+		$this->check_set_default_prefs();
+
+		return true;	// otherwise prefs say it cant find the file ;-)
+	}
+	
+	/**
+	 * Check if reasonable default preferences are set and set them if not
+	 *
+	 * It sets a flag in the app-session-data to be called only once per session
+	 */
+	function check_set_default_prefs()
+	{
+		if ($GLOBALS['phpgw']->session->appsession('default_prefs_set',TIMESHEET_APP))
+		{
+			return;
+		}
+		$GLOBALS['phpgw']->session->appsession('default_prefs_set',TIMESHEET_APP,'set');
+
+		$default_prefs =& $GLOBALS['phpgw']->preferences->default[TIMESHEET_APP];
+
+		$defaults = array(
+		);
+		foreach($defaults as $var => $default)
+		{
+			if (!isset($default_prefs[$var]) || $default_prefs[$var] === '')
+			{
+				$GLOBALS['phpgw']->preferences->add(TIMESHEET_APP,$var,$default,'default');
+				$need_save = True;
+			}
+		}
+		if ($need_save)
+		{
+			$GLOBALS['phpgw']->preferences->save_repository(False,'default');
+		}
+	}
+}
Index: /contrib/Timesheet/inc/class.export_openoffice.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.export_openoffice.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.export_openoffice.inc.php	(revision 3526)
@@ -0,0 +1,515 @@
+<?php
+/**
+ * eGroupWare importexport
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package importexport
+ * @link http://www.egroupware.org
+ * @author Knut Moeller <k.moeller@metaways.de>
+ * @copyright Knut Moeller <k.moeller@metaways.de>
+ * @version $Id: $
+ */
+
+require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.iface_export_record.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.import_export_helper_functions.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.iface_phpgw_record.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/timesheet/inc/class.spreadsheet.inc.php');
+
+/**
+ * class export_cmslite
+ *
+ * special export class (metaways openoffice calc table)
+ * adapter to spreadsheet class
+ *
+ */
+class export_openoffice implements iface_export_record
+{
+
+	/**
+	 * array with field mapping in form phpgw_field_name => exported_field_name
+	 * @var array
+	 */
+	protected  $mapping = array();
+
+	/**
+	 * array with conversions to be done in form: phpgw_field_name => conversion_string
+	 * @var array
+	 */
+	protected  $conversion = array();
+
+	/**
+	 * array holding the current record
+	 * @access protected
+	 */
+	protected $record = array();
+
+	/**
+	 * holds (charset) translation object
+	 * @var object
+	 */
+	protected $translation;
+
+	/**
+	 * holds number of exported records
+	 * @var unknown_type
+	 */
+	protected $num_of_records = 0;
+
+	/**
+	 * stream resource of csv file
+	 * @var resource
+	 */
+	protected  $handle;
+
+	protected  $document;
+	protected  $table;
+
+	protected  $summarytable; 	// link to first table
+	protected  $summary; 		// array, project -> user -> time
+	protected  $summaryweekend; // same for weekend
+
+	private $tablecount;
+	private $columncount;
+	private $rowcount;
+
+
+
+	/**
+	 * constructor
+	 *
+	 * @param object _handle resource where records are exported to.
+	 * @param string _charset charset the records are exported to.
+	 * @param array _options options for specific backends
+	 * @return bool
+	 * @access public
+	 */
+	public function __construct( $_handle,  $_charset, array $_options=array() ) {
+		$this->handle = $_handle;
+	}
+
+	/**
+	 * sets field mapping
+	 *
+	 * @param array $_mapping phpgw_field_name => csv_field_name
+	 */
+	public function set_mapping( array $_mapping) {
+
+	}
+
+	/**
+	 * Sets conversion.
+	 * See import_export_helper_functions::conversion.
+	 *
+	 * @param array $_conversion
+	 */
+	public function set_conversion( array $_conversion) {
+
+	}
+
+	/**
+	 * exports a record into resource of handle
+	 *
+	 * @param iface_phpgw_record record
+	 * @return bool
+	 * @access public
+	 */
+	public function export_record( iface_phpgw_record $_record ) {
+
+	}
+
+	public function create_summarytable($_tablename='Gesamtzeiten') {
+		$this->summarytable = new SpreadSheetTable($this->document, $_tablename);
+		$this->tablecount++;
+		$this->summary = array();
+		$this->summaryweekend = array();
+	}
+
+
+	/**
+	 * @return weekdate array (1-7) for given week
+	 */
+	private function week_dates($_timestamp) {
+		$week_dates = array();
+		$day = (int) date("w", $_timestamp);
+
+		if ($day != 1) {
+			$diff = $day - 1;
+			if ($day==0) $diff = 6;
+			$monday = strtotime("-".$diff." days" , $_timestamp);
+		}
+		else {
+			$monday = $_timestamp;
+		}
+
+		for ($i=0; $i < 7; $i++) {
+			$week_dates[$i+1] = strtotime("+".$i." days", $monday);
+		}
+	   return($week_dates);
+	}
+
+
+	/**
+	 *
+	 *
+	 */
+	public function fill_summarytable($_tstamp_min, $_tstamp_max) {
+
+		// prepare data --------------------------
+
+		uksort($this->summary, "strnatcasecmp");
+		uksort($this->summaryweekend, "strnatcasecmp");
+
+			// get user-array
+		$users = array();
+		foreach ($this->summary as $project => $user_time) {
+			foreach($user_time as $user => $time) {
+				if (!in_array($user, $users)) $users[] = $user;
+			}
+		}
+		asort($users);
+		$usersweekend = array();
+		foreach ($this->summaryweekend as $project => $user_time) {
+			foreach($user_time as $user => $time) {
+				if (!in_array($user, $usersweekend)) $usersweekend[] = $user;
+			}
+		}
+		asort($usersweekend);
+
+
+			// get project-array (sites)
+		$projects = array();
+		foreach ($this->summary as $project => $user_time) {
+			if (!in_array($project ,$projects)) $projects[] = $project;
+		}
+		foreach ($this->summaryweekend as $project => $user_time) {
+			if (!in_array($project ,$projects)) $projects[] = $project;
+		}
+		asort($projects);
+
+		$this->summarytable->addColumn('co20');
+		for ($i=1; $i <=  count($users) + count($usersweekend) + 2; $i++) {
+			$this->summarytable->addColumn();
+		}
+
+
+		// populate table --------------------------
+
+
+			// create table-headlines
+		$row = $this->summarytable->addRow();
+		$this->summarytable->addCell($row, 'string', 'CMS Lite Support / Montag - Freitag / 08.00 Uhr - 18.00 Uhr', array('bold'));
+
+		for ($i=0; $i<count($users); $i++) {
+			$this->summarytable->addCell($row, 'string', '');
+		}
+		$this->summarytable->addCell($row, 'string', 'CMS Lite Support / Wochenende', array('bold'));
+
+
+			// headline, row 1
+		$row = $this->summarytable->addRow();
+		$this->summarytable->addCell($row, 'string', 'Mitarbeiter:', array('bold'));
+
+		foreach ($users as $user) {
+			$this->summarytable->addCell($row, 'string', $user, array('bold'));
+		}
+		$this->summarytable->addCell($row, 'string', 'Mitarbeiter:', array('bold'));
+		foreach ($usersweekend as $user) {
+			$this->summarytable->addCell($row, 'string', $user, array('bold'));
+		}
+
+			// fixed date rows, row 2
+		$row = $this->summarytable->addRow();
+		$this->summarytable->addCell($row, 'string', 'Zeitraum:', array('bold'));
+		$kw_min = strftime("%V", $_tstamp_min);
+		$kw_max = strftime("%V", $_tstamp_max);
+		$kw = ($kw_min == $kw_max) ? "KW $kw_min" : "KW $kw_min - KW $kw_max";
+		for ($i=0; $i < count($users); $i++) {
+			$this->summarytable->addCell($row, 'string', $kw, array('bold'));
+		}
+		$this->summarytable->addCell($row, 'string', 'Zeitraum:', array('bold'));
+		for ($i=0; $i < count ($usersweekend); $i++) {
+			$this->summarytable->addCell($row, 'string', $kw, array('bold'));
+		}
+
+
+			// weekdays,  row 3 left
+		$row = $this->summarytable->addRow();
+		$this->summarytable->addCell($row, 'string', '', array('bold'));
+
+		$week_dates = $this->week_dates($_tstamp_min);
+
+		if ($kw_min != $kw_max) {
+			$days = strftime("%d.%m.%y", $_tstamp_min).' - '.strftime("%d.%m.%y", $_tstamp_max);
+		}
+		else {
+			// monday-friday
+			$days = strftime("%d.%m.%y", $week_dates[1]).' - '.strftime("%d.%m.%y", $week_dates[5]);
+		}
+		for ($i=0; $i < count($users); $i++) {
+			$this->summarytable->addCell($row, 'string', $days, array('bold'));
+		}
+
+			// weekend,  row 3 right
+		$this->summarytable->addCell($row, 'string', '', array('bold'));
+		if ($kw_min != $kw_max) {
+			$days = strftime("%d.%m.%y", $_tstamp_min).' - '.strftime("%d.%m.%y", $_tstamp_max);
+		}
+		else {
+			$days = strftime("%d.%m.%y", $week_dates[6]).' - '.strftime("%d.%m.%y", $week_dates[7]);
+		}
+		for ($i=0; $i < count($usersweekend); $i++) {
+			$this->summarytable->addCell($row, 'string', $days, array('bold'));
+		}
+
+		$this->rowcount = 4;
+
+
+
+			// project lines (sitenames)
+		foreach ($projects as $project) {
+
+				// 1.Cell: projectname
+			$row = $this->summarytable->addRow();
+			$this->rowcount++;
+			$this->summarytable->addCell($row, 'string', $project);
+
+				// iterate all users for each line
+			foreach ($users as $user) {
+
+				if   (array_key_exists($project, $this->summary) && array_key_exists($user, $this->summary[$project])) {
+					$this->summarytable->addCell($row, 'float', (float) ($this->summary[$project][$user] / 60) );
+				}
+				else { // add empty cell if no user-entry
+					$this->summarytable->addCell($row, 'string', '');
+				}
+			}
+			$this->summarytable->addCell($row, 'string', '');
+			foreach ($usersweekend as $user) {
+
+					// weekend
+				if (array_key_exists($project, $this->summaryweekend) && array_key_exists($user, $this->summaryweekend[$project])) {
+						$this->summarytable->addCell($row, 'float', (float) ($this->summaryweekend[$project][$user] / 60) );
+				}
+				else {  // add empty cell if no user-entry
+					$this->summarytable->addCell($row, 'string', '');
+				}
+			}
+		}
+
+
+
+			// summary line 1
+		$row = $this->summarytable->addRow();
+		$this->rowcount++;
+		$row = $this->summarytable->addRow();
+		$this->rowcount++;
+		$this->summarytable->addCell($row, 'string', 'Summe:');
+		for ($i=1; $i <= count($users); $i++) {
+			$this->table->addCell($row, 'formula', 'SUM([.'.chr(65+$i).'5:.'.chr(65 + $i).($this->rowcount - 1).'])');
+		}
+		$this->summarytable->addCell($row, 'string', 'Summe:');
+		for ($i= count($users)+2; $i <= count($usersweekend)+count($users)+1; $i++) {
+			$this->table->addCell($row, 'formula', 'SUM([.'.chr(65+$i).'5:.'.chr(65 + $i).($this->rowcount - 1).'])');
+		}
+
+
+			// summary line 2
+		$row = $this->summarytable->addRow();
+		$this->rowcount++;
+		$row = $this->summarytable->addRow();
+		$this->rowcount++;
+		$this->summarytable->addCell($row, 'string', 'Gesamt:');
+		$this->table->addCell($row, 'formula', 'SUM([.B'. ($this->rowcount - 2) . ':.' . chr(65 + count($users)) . ($this->rowcount - 2) . '])');
+		for ($i=1; $i <= count($users)-1; $i++) {
+			$this->table->addCell($row, 'string', '');
+		}
+
+		$this->summarytable->addCell($row, 'string', 'Gesamt:');
+		$this->table->addCell($row, 'formula', 'SUM([.'.chr(65 + count($users) + 2) . ($this->rowcount - 2).
+												   ':.'.chr(65 + count($users) + 2 + count($usersweekend) - 1) . ($this->rowcount - 2).'])');
+	}
+
+
+	public function create_usertable($_tablename, $_username, $_tstamp_min, $_tstamp_max) {
+		$this->table = new SpreadSheetTable($this->document, $_tablename);
+		for ($i=10; $i < 19; $i++) {
+			$this->table->addColumn('co'.$i);
+		}
+
+		$row = $this->table->addRow();
+		$this->table->addCell($row, 'string', 'Monat:' . strftime("%m/%Y", $_tstamp_min), array('bold'));
+		$this->table->addCell($row, 'string', 'KW ' . strftime("%V", $_tstamp_min), array('bold'));
+
+		$row = $this->table->addRow();
+		$this->table->addCell($row, 'string', 'Mitarbeiter:', array('bold') );
+		$this->table->addCell($row, 'string', $_username, array('bold'));
+
+			// create table-headlines
+		$headlines = array(
+			'Datum',
+			'Site',
+			'Ansprechpartner',
+			'Projekttyp',
+			'Ticket#',
+			'Std.',
+			'Newsletter',
+//			'SOW-Nr.',
+			'Bemerkungen'
+			);
+		$row = $this->table->addRow('double');
+		$this->table->addCells($row, 'string', $headlines, array('bold', 'border'));
+
+		$this->tablecount++;
+		$this->rowcount = 3;
+		$this->columncount = count($headlines);
+	}
+
+
+
+	/**
+	 * exports a record into resource of handle
+	 *
+	 * @param iface_phpgw_record record
+	 * @return bool
+	 * @access public
+	 */
+	public function add_record( $_record, $_extras ) {
+
+		if (is_array($_record)) {
+			$row = $this->table->addRow();
+			$this->rowcount++;
+
+			$this->table->addCell($row, 'date', strftime("%d.%m.%Y", $_record['ts_start']));
+			$this->table->addCell($row, 'string', $_record['ts_project']);
+			$this->table->addCell($row, 'string', $_extras['asp']);
+			$this->table->addCell($row, 'string', $_record['cat_name']);// $_extras['typ']);
+			$this->table->addCell($row, 'string', $_extras['ticket']);
+			$this->table->addCell($row, 'float', (float) ($_record['ts_duration'] / 60) );
+			$this->table->addCell($row, 'string', $_extras['newsletter']);
+//			$this->table->addCell($row, 'string', $_extras['sow']);
+			$this->table->addCell($row, 'string', $_record['ts_description']);
+
+
+			// collect statistics
+
+				// username
+			$res = array();
+//			$nameRegex = '/\s(.*)\s(.*)$/';  // z.B. "[admin] Richard Blume"
+			$nameRegex = '/(.*),\s(.*)$/';  // z.B. "Blume, Richard"
+			preg_match($nameRegex, $GLOBALS['phpgw']->common->grab_owner_name($_record['ts_owner']), $res);
+//			$user = $res[1];
+			$user = $res[0];  // full name
+
+			$site = $_record['ts_project'];
+			$time = $_record['ts_duration'];
+			$weekday = (int) strftime("%w", $_record['ts_start']);
+
+			if ( $weekday == 0 || $weekday == 6 ) {
+
+				// weekend
+				if (!array_key_exists($site, $this->summaryweekend)) {
+					$this->summaryweekend[$site] = array();
+					$this->summaryweekend[$site][$user] = $time;
+				}
+				elseif (!array_key_exists($user, $this->summaryweekend[$site])) {
+					$this->summaryweekend[$site][$user] = $time;
+				}
+				else {
+					$this->summaryweekend[$site][$user] += $time;
+				}
+			}
+			else {
+				// site -> user -> sum
+				if (!array_key_exists($site, $this->summary)) {
+					$this->summary[$site] = array();
+					$this->summary[$site][$user] = $time;
+				}
+				elseif (!array_key_exists($user, $this->summary[$site])) {
+					$this->summary[$site][$user] = $time;
+				}
+				else {
+					$this->summary[$site][$user] += $time;
+				}
+			}
+
+			$this->num_of_records++;
+			$this->record = array();
+
+		}
+	}
+
+
+	/**
+	 *
+	 *
+	 */
+	public function summarize() {
+		if ($this->rowcount > 1) {
+			$row = $this->table->addRow();
+			$this->rowcount++;
+			$row = $this->table->addRow();
+			$this->rowcount++;
+
+			$this->table->addCell($row, 'string', '');
+			$this->table->addCell($row, 'string', '');
+			$this->table->addCell($row, 'string', '');
+			$this->table->addCell($row, 'string', '');
+			$this->table->addCell($row, 'string', '');
+			$this->table->addCell($row, 'formula', 'SUM([.F2:.F'.($this->rowcount-2).'])');
+		}
+	}
+
+
+
+	public function init() {
+		$this->document = new SpreadSheetDocument($this->handle);
+
+			// global usertable styles
+		$columnwidth = array(
+			'2.767cm',
+			'5.067cm',
+			'5.067cm',
+			'3.267cm',
+			'2.267cm',
+			'2.267cm',
+			'2.267cm',
+//			'2.267cm',
+			'6.267cm'
+			);
+
+		for ($i=0; $i < count($columnwidth); $i++) {
+			$this->document->addColumnStyle('co'.($i + 10), $columnwidth[$i]);
+		}
+
+			// first column, summary-table
+		$this->document->addColumnStyle('co20', '5.2cm');
+	}
+
+	public function finalize() {
+		$this->document->finalize();
+	}
+
+	/**
+	 * Returns total number of exported records.
+	 *
+	 * @return int
+	 * @access public
+	 */
+	public function get_num_of_records() {
+		return $this->num_of_records;
+	}
+
+	/**
+	 * destructor
+	 *
+	 * @return
+	 * @access public
+	 */
+	public function __destruct() {
+
+	}
+}
+
+
+
+?>
Index: /contrib/Timesheet/inc/class.bocustom_fields.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.bocustom_fields.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.bocustom_fields.inc.php	(revision 3526)
@@ -0,0 +1,92 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - Calendar - Custom fields and sorting                        *
+  * http://www.egroupware.org                                                *
+  * Written by Ralf Becker <RalfBecker@outdoor-training.de>                  *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class bocustom_fields
+	{
+		var $stock_fields = array(
+			
+			'title'    => 'title',
+			'category'    => 'Category',
+			'project'    => 'project',
+			
+			'tarea'    => 'tarea',
+			'accesso'      => 'accesso',
+			'description' => 'Description',
+'startdate'   => 'Start Date/Time',
+			'enddate'     => 'End Date/Time'//,
+
+//'enddate2'     => 'End Date2/End Time2'
+		);
+
+		function bocustom_fields()
+		{
+			$this->config = CreateObject('phpgwapi.config','calendar');
+			$this->config->read_repository();
+
+			$this->fields = &$this->config->config_data['fields'];
+
+			if (!is_array($this->fields)) {
+				$this->fields = array();
+			}
+
+			foreach ($this->fields as $field => $data)	// this can be removed after a while
+			{
+				if (!isset($this->stock_fields[$field]) && $field[0] != '#')
+				{
+					unset($this->fields[$field]);
+					$this->fields['#'.$field] = $data;
+				}
+			}
+
+			foreach($this->stock_fields as $field => $data)
+			{
+				if (!is_array($data))
+				{
+					$data = array('label' => $data);
+				}
+				if (!isset($this->fields[$field]))
+				{
+					$this->fields[$field] = array(
+						'name'     => $field,
+						'title'    => $data['title'],
+						'disabled' => $data['disabled']
+					);
+				}
+				$this->fields[$field]['label']  = $data['label'];
+				$this->fields[$field]['length'] = $data['length'];
+				$this->fields[$field]['shown']  = $data['shown'];
+			}
+		}
+
+		function set($data)
+		{
+			if (is_array($data) && strlen($data['name']) > 0)
+			{
+				if (!isset($this->stock_fields[$name = $data['name']]))
+				{
+					$name = '#'.$name;
+				}
+				$this->fields[$name] = $data;
+			}
+		}
+
+		function save($fields=False)
+		{
+			if ($fields)
+			{
+				$this->fields = $fields;
+			}
+			//echo "<pre>"; print_r($this->config->config_data); echo "</pre>\n";
+			$this->config->save_repository();
+		}
+	}
Index: /contrib/Timesheet/inc/class.botimesheetooo.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.botimesheetooo.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.botimesheetooo.inc.php	(revision 3526)
@@ -0,0 +1,746 @@
+<?php
+/**
+ * TimeSheet - business object
+ *
+ * @link http://www.egroupware.org
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @package timesheet
+ * @copyright (c) 2005/6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id: class.botimesheet.inc.php 24276 2007-07-10 07:35:18Z ralfbecker $ 
+ */
+
+require_once(PHPGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
+
+if (!defined('TIMESHEET_APP'))
+{
+	define('TIMESHEET_APP','timesheet');
+}
+
+/**
+ * Business object of the TimeSheet
+ *
+ * Uses eTemplate's so_sql as storage object (Table: phpgw_timesheet).
+ */
+class botimesheet extends so_sql
+{
+	/**
+	 * Timesheets config data
+	 * 
+	 * @var array
+	 */
+	var $config = array();
+
+
+	/**
+	 * Timesheets config data
+	 *
+	 * @var array
+	 */
+	var $config_data = array();
+	/**
+	 * Should we show a quantity sum, makes only sense if we sum up identical units (can be used to sum up negative (over-)time)
+	 *
+	 * @var boolean
+	 */
+	var $quantity_sum=false;
+	/**
+	 * Timestaps that need to be adjusted to user-time on reading or saving
+	 * 
+	 * @var array
+	 */
+	var $timestamps = array(
+		'ts_start','ts_modified'
+	);
+	/**
+	 * Offset in secconds between user and server-time,	it need to be add to a server-time to get the user-time 
+	 * or substracted from a user-time to get the server-time
+	 * 
+	 * @var int
+	 */
+	var $tz_offset_s;
+	/**
+	 * Current time as timestamp in user-time
+	 * 
+	 * @var int
+	 */
+	var $now;
+	/**
+	 * Start of today in user-time
+	 * 
+	 * @var int
+	 */
+	var $today;
+	/**
+	 * Filter for search limiting the date-range
+	 * 
+	 * @var array
+	 */
+	var $date_filters = array(	// Start: year,month,day,week, End: year,month,day,week
+		'Today'       => array(0,0,0,0,  0,0,1,0),
+		'Yesterday'   => array(0,0,-1,0, 0,0,0,0),
+		'This week'   => array(0,0,0,0,  0,0,0,1),
+		'Last week'   => array(0,0,0,-1, 0,0,0,0),
+		'This month'  => array(0,0,0,0,  0,1,0,0),
+		'Last month'  => array(0,-1,0,0, 0,0,0,0),
+		'2 month ago' => array(0,-2,0,0, 0,-1,0,0),
+		'This year'   => array(0,0,0,0,  1,0,0,0),
+		'Last year'   => array(-1,0,0,0, 0,0,0,0),
+		'2 years ago' => array(-2,0,0,0, -1,0,0,0),
+		'3 years ago' => array(-3,0,0,0, -2,0,0,0),
+	);
+	/**
+	 * Reference to the (bo)link class instanciated at $GLOBALS['phpgw']->link
+	 * 
+	 * @var bolink
+	 */
+	var $link;
+	/**
+	 * Grants: $GLOBALS['phpgw']->acl->get_grants(TIMESHEET_APP);
+	 * 
+	 * @var array
+	 */	
+	var $grants;
+	/**
+	 * Sums of the last search in keys duration and price
+	 * 
+	 * @var array
+	 */
+	var $summary;
+	/**
+	 * Array with boolean values in keys 'day', 'week' or 'month', for the sums to return in the search
+	 * 
+	 * @var array
+	 */
+	var $show_sums;
+
+	var $customfields=array();
+	
+	function botimesheet()
+	{
+		$this->so_sql(TIMESHEET_APP,'phpgw_timesheet');
+
+		$this->config =& CreateObject('phpgwapi.config',TIMESHEET_APP);
+		$this->config->read_repository();
+		$this->config_data =& $this->config->config_data;
+		$this->quantity_sum = $this->config_data['quantity_sum'] == 'true';
+
+		if (isset($this->config_data['customfields']) && is_array($this->config_data['customfields']))
+		{
+			$this->customfields = $this->config_data['customfields'];
+		}
+
+		if (!is_object($GLOBALS['phpgw']->datetime))
+		{
+			$GLOBALS['phpgw']->datetime =& CreateObject('phpgwapi.datetime');
+		}
+		$this->tz_offset_s = $GLOBALS['phpgw']->datetime->tz_offset;
+		$this->now = time() + $this->tz_offset_s;	// time() is server-time and we need a user-time
+		$this->today = mktime(0,0,0,date('m',$this->now),date('d',$this->now),date('Y',$this->now));
+
+		// save us in $GLOBALS['botimesheet'] for ExecMethod used in hooks
+		if (!is_object($GLOBALS['botimesheet']))
+		{
+			$GLOBALS['botimesheet'] =& $this;
+		}
+		// instanciation of link-class has to be after making us globaly availible, as it calls us to get the search_link
+		if (!is_object($GLOBALS['phpgw']->link))
+		{
+			$GLOBALS['phpgw']->link =& CreateObject('phpgwapi.bolink');
+		}
+		$this->link =& $GLOBALS['phpgw']->link;
+		
+		$this->grants = $GLOBALS['phpgw']->acl->get_grants(TIMESHEET_APP);
+	}
+	
+	/**
+	 * get list of specified grants as uid => Username pairs
+	 *
+	 * @param int $required=EGW_ACL_READ
+	 * @return array with uid => Username pairs
+	 */
+	function grant_list($required=EGW_ACL_READ)
+	{
+		$result = array();
+		foreach($this->grants as $uid => $grant)
+		{
+			if ($grant & $required)
+			{
+				$result[$uid] = $GLOBALS['phpgw']->common->grab_owner_name($uid);
+			}
+		}
+		natcasesort($result);
+
+		return $result;
+	}
+	
+	/**
+	 * checks if the user has enough rights for a certain operation
+	 *
+	 * Rights are given via owner grants or role based acl
+	 *
+	 * @param int $required EGW_ACL_READ, EGW_ACL_WRITE, EGW_ACL_ADD, EGW_ACL_DELETE, EGW_ACL_BUDGET, EGW_ACL_EDIT_BUDGET
+	 * @param array/int $data=null project or project-id to use, default the project in $this->data
+	 * @return boolean true if the rights are ok, null if not found, false if no rights
+	 */
+	function check_acl($required,$data=null)
+	{
+		if (!$data)
+		{
+			$data =& $this->data;
+		}
+		if (!is_array($data))
+		{
+			$save_data = $this->data;
+			$data = $this->read($data,true);
+			$this->data = $save_data;
+			
+			if (!$data) return null; 	// entry not found
+		}
+		$rights = $this->grants[$data['ts_owner']];
+		
+		return $data && !!($rights & $required);
+	}
+	
+	function date_filter($name,&$start,&$end_param)
+	{
+		$end = $end_param;
+
+		if ($name == 'custom' && $start)
+		{
+			if ($end)
+			{
+				$end += 24*60*60;
+			}
+			else
+			{
+				$end = $start + 8*24*60*60;
+			}
+		}
+		else
+		{
+			if (!isset($this->date_filters[$name]))
+			{
+				return '1=1';
+			}
+			$year  = (int) date('Y',$this->today);
+			$month = (int) date('m',$this->today);
+			$day   = (int) date('d',$this->today);
+	
+			list($syear,$smonth,$sday,$sweek,$eyear,$emonth,$eday,$eweek) = $this->date_filters[$name];
+			
+			if ($syear || $eyear)
+			{
+				$start = mktime(0,0,0,1,1,$syear+$year);
+				$end   = mktime(0,0,0,1,1,$eyear+$year);
+			}
+			elseif ($smonth || $emonth)
+			{
+				$start = mktime(0,0,0,$smonth+$month,1,$year);
+				$end   = mktime(0,0,0,$emonth+$month,1,$year);
+			}
+			elseif ($sday || $eday)
+			{
+				$start = mktime(0,0,0,$month,$sday+$day,$year);
+				$end   = mktime(0,0,0,$month,$eday+$day,$year);
+			}
+			elseif ($sweek || $eweek)
+			{
+				$wday = (int) date('w',$this->today); // 0=sun, ..., 6=sat
+				switch($GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts'])
+				{
+					case 'Sunday':
+						$weekstart = $this->today - $wday * 24*60*60;
+						break;
+					case 'Saturday':
+						$weekstart = $this->today - (6-$wday) * 24*60*60;
+						break;
+					case 'Moday':
+					default:
+						$weekstart = $this->today - ($wday ? $wday-1 : 6) * 24*60*60;
+						break;
+				}
+				$start = $weekstart + $sweek*7*24*60*60;
+				$end   = $weekstart + $eweek*7*24*60*60;
+			}
+			$end_param = $end - 24*60*60;
+		}
+		//echo "<p align='right'>date_filter($name,$start,$end) today=".date('l, Y-m-d H:i',$this->today)." ==> ".date('l, Y-m-d H:i:s',$start)." <= date < ".date('l, Y-m-d H:i:s',$end)."</p>\n"; 
+		// convert start + end from user to servertime for the filter
+		return '('.($start-$this->tz_offset_s).' <= ts_start AND ts_start < '.($end-$this->tz_offset_s).')';
+	}
+
+	/**
+	 * search the timesheet
+	 *
+	 * reimplemented to limit result to users we have grants from
+	 *
+	 * @param array/string $criteria array of key and data cols, OR a SQL query (content for WHERE), fully quoted (!)
+	 * @param boolean/string $only_keys=true True returns only keys, False returns all cols. comma seperated list of keys to return
+	 * @param string $order_by='' fieldnames + {ASC|DESC} separated by colons ',', can also contain a GROUP BY (if it contains ORDER BY)
+	 * @param string/array $extra_cols='' string or array of strings to be added to the SELECT, eg. "count(*) as num"
+	 * @param string $wildcard='' appended befor and after each criteria
+	 * @param boolean $empty=false False=empty criteria are ignored in query, True=empty have to be empty in row
+	 * @param string $op='AND' defaults to 'AND', can be set to 'OR' too, then criteria's are OR'ed together
+	 * @param mixed $start=false if != false, return only maxmatch rows begining with start, or array($start,$num)
+	 * @param array $filter=null if set (!=null) col-data pairs, to be and-ed (!) into the query without wildcards
+	 * @param string $join='' sql to do a join, added as is after the table-name, eg. ", table2 WHERE x=y" or 
+	 *	"LEFT JOIN table2 ON (x=y)", Note: there's no quoting done on $join!
+	 * @param boolean $need_full_no_count=false If true an unlimited query is run to determine the total number of rows, default false
+	 * @param boolean $only_summary=false If true only return the sums as array with keys duration and price, default false
+	 * @return array of matching rows (the row is an array of the cols) or False
+	 */
+	function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='',$need_full_no_count=false,$only_summary=false)
+	{
+		// postgres can't round from double precission, only from numeric ;-)
+		$total_sql = $this->db->Type != 'pgsql' ? "round(ts_quantity*ts_unitprice,2)" : "round(cast(ts_quantity*ts_unitprice AS numeric),2)";
+
+		if (!is_array($extra_cols))
+		{
+			$extra_cols = $extra_cols ? explode(',',$extra_cols) : array();
+		}
+		$extra_cols[] = $total_sql.' AS ts_total';
+
+		if (!isset($filter['ts_owner']) || !count($filter['ts_owner']))
+		{
+			$filter['ts_owner'] = array_keys($this->grants);
+		}
+		else
+		{
+			if (!is_array($filter['ts_owner'])) $filter['ts_owner'] = array($filter['ts_owner']);
+			
+			foreach($filter['ts_owner'] as $key => $owner)
+			{
+				if (!isset($this->grants[$owner]))
+				{
+					unset($filter['ts_owner'][$key]);
+				}
+			}
+		}
+		if (!count($filter['ts_owner']))
+		{
+			$this->total = 0;
+			$this->summary = array();
+			return array();
+		}
+		$this->summary = parent::search($criteria,"SUM(ts_duration) AS duration,SUM($total_sql) AS price".
+			($this->quantity_sum ? ",SUM(ts_quantity) AS quantity" : ''),
+			'','',$wildcard,$empty,$op,false,$filter,$join);
+		$this->summary = $this->summary[0];
+		
+		if ($only_summary) return $this->summary;
+
+		if ($this->show_sums && strpos($order_by,'ts_start') !== false && 	// sums only make sense if ordered by ts_start
+			$this->db->capabilities['union'] && ($from_unixtime_ts_start = $this->db->from_unixtime('ts_start')))
+		{
+			$sum_sql = array(
+				'year'  => $this->db->date_format($from_unixtime_ts_start,'%Y'),
+				'month' => $this->db->date_format($from_unixtime_ts_start,'%Y%m'),
+				'week'  => $this->db->date_format($from_unixtime_ts_start,$GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts'] == 'Sunday' ? '%X%V' : '%x%v'),
+				'day'   => $this->db->date_format($from_unixtime_ts_start,'%Y-%m-%d'),
+			);
+			foreach($this->show_sums as $type)
+			{
+				$extra_cols[] = $sum_sql[$type].' AS ts_'.$type;
+				$extra_cols[] = '0 AS is_sum_'.$type;
+				$sum_extra_cols[] = str_replace('ts_start','MIN(ts_start)',$sum_sql[$type]);	// as we dont group by ts_start
+				$sum_extra_cols[$type] = '0 AS is_sum_'.$type;
+			}
+			// regular entries
+			parent::search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,'UNION',$filter,$join,$need_full_no_count);
+			
+			$sort = substr($order_by,8);
+			$union_order = array();
+			$sum_ts_id = array('year' => -3,'month' => -2,'week' => -1,'day' => 0);
+			foreach($this->show_sums as $type)
+			{
+				$union_order[] = 'ts_'.$type . ' ' . $sort;
+				$union_order[] = 'is_sum_'.$type;
+				$sum_extra_cols[$type]{0} = '1';
+				// the $type sum
+				parent::search($criteria,$sum_ts_id[$type].",'','','',MIN(ts_start),SUM(ts_duration) AS ts_duration,".
+					($this->quantity_sum ? "SUM(ts_quantity) AS ts_quantity" : '0').",0,NULL,0,0,0,0,SUM($total_sql) AS ts_total",
+					'GROUP BY '.$sum_sql[$type],$sum_extra_cols,$wildcard,$empty,$op,'UNION',$filter,$join,$need_full_no_count);
+				$sum_extra_cols[$type]{0} = '0';
+			}
+			$union_order[] = 'ts_start '.$sort;
+			return parent::search('','',implode(',',$union_order),'','',false,'',$start);
+		}
+		return parent::search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,$start,$filter,$join,$need_full_no_count);
+	}
+
+	/**
+	 * read a timesheet entry
+	 *
+	 * @param int $ts_id
+	 * @param boolean $ignore_acl=false should the acl be checked
+	 * @return array/boolean array with timesheet entry, null if timesheet not found or false if no rights
+	 */
+	function read($ts_id,$ignore_acl=false)
+	{
+		$ret = null;
+		if (!(int)$ts_id || !$ignore_acl && !($ret = $this->check_acl(EGW_ACL_READ,$ts_id)) ||
+			$this->data['ts_id'] != (int)$ts_id && !parent::read((int)$ts_id))
+		{
+			return $ret;	// no read rights, or entry not found
+		}
+
+		//assign custom fields
+		foreach($this->customfields as $name => $value) {
+			$row = $this->read_extra($name);
+			$this->data['#'.$name] = $row['ts_extra_value'];
+		}
+
+		return $this->data;
+	}
+
+	/**
+	 * reads a timesheet extra entry of the current timesheet dataset
+	 *
+	 * @param int $name => name of the current timesheet extra entry
+	 * @param int $value => value of the current timesheet extra entry
+	 * @return array of resultset
+	 */
+	function read_extra($name='',$value='')
+	{
+		strlen($value) > 0 ? $where = ' and ts_extra_value ='.$this->db->quote($value) : '';
+		strlen($name) > 0 ? $where .= ' and ts_extra_name ='.$this->db->quote($name) : '';
+
+		$this->db->select('phpgw_timesheet_extra', 'ts_extra_name, ts_extra_value',$query,__LINE__,__FILE__,False,'',False,0,'where ts_id='.$this->data['ts_id'].$where);
+		$row = $this->db->row(true);
+
+		return $row;
+	}
+	
+	/**
+	 * saves a timesheet entry
+	 *
+	 * reimplemented to notify the link-class
+	 *
+	 * @param array $keys if given $keys are copied to data before saveing => allows a save as
+	 * @param boolean $touch_modified=true should modification date+user be set, default yes
+	 * @param boolean $ignore_acl=false should the acl be checked, returns true if no edit-rigts
+	 * @return int 0 on success and errno != 0 else
+	 */
+	function save($keys=null,$touch_modified=true,$ignore_acl=false)
+	{
+		if ($keys) $this->data_merge($keys);
+		
+		if (!$ignore_acl && $this->data['ts_id'] && !$this->check_acl(EGW_ACL_EDIT))
+		{
+			return true;
+		}
+		if ($touch_modified)
+		{
+			$this->data['ts_modifier'] = $GLOBALS['phpgw_info']['user']['account_id'];
+			$this->data['ts_modified'] = $this->now;
+		}
+		if (!($err = parent::save()))
+		{
+			//saves data of custom fields in timesheet_extra
+			$this->save_extra();
+
+			// notify the link-class about the update, as other apps may be subscribt to it
+			$this->link->notify_update(TIMESHEET_APP,$this->data['ts_id'],$this->data);
+		}
+		return $err;
+	}
+
+	/**
+	 * saves a timesheet extra entry based one the "custom fields" settings
+	 *
+	 * @param boolean  $updateNames => if true "change timesheet extra name", otherwise update existing datasets or insert new ones
+	 * @param boolean  $oldname => original name of the timesheet extra entry
+	 * @param boolean  $name => new name of the timesheet extra entry
+	 * @return int true on success else false
+	 */
+	function save_extra($updateNames=False,$oldname='',$name='')
+	{
+		if($updateNames) {
+			$keys = array('ts_extra_name' => $oldname);
+			$fieldAssign = array('ts_extra_name' => $name);
+			$this->db->update('phpgw_timesheet_extra',$fieldAssign,$keys,__LINE__,__FILE__);
+			return true;
+		}
+		else {
+			foreach($this->customfields as $namecf => $valuecf) {
+				//if entry not exist => insert
+				if(!$this->read_extra($namecf)) {
+					$fieldAssign = array('ts_id' => $this->data['ts_id'],'ts_extra_name' => $namecf,'ts_extra_value' => $this->data['#'.$namecf]);
+					$this->db->insert('phpgw_timesheet_extra',$fieldAssign,false,__LINE__,__FILE__);
+				}
+				//otherwise update existing dataset
+				else {
+					$keys = array('ts_extra_name' => $namecf, 'ts_id' => $this->data['ts_id']);
+					$fieldAssign = array('ts_extra_value' => $this->data['#'.$namecf]);
+					$this->db->update('phpgw_timesheet_extra',$fieldAssign,$keys,__LINE__,__FILE__);
+				}
+			}
+			return true;
+		}
+
+		return false;
+	}
+	
+	/**
+	 * deletes a timesheet entry identified by $keys or the loaded one, reimplemented to notify the link class (unlink)
+	 *
+	 * @param array $keys if given array with col => value pairs to characterise the rows to delete
+	 * @param boolean $ignore_acl=false should the acl be checked, returns false if no delete-rigts
+	 * @return int affected rows, should be 1 if ok, 0 if an error
+	 */
+	function delete($keys=null,$ignore_acl=false)
+	{
+		if (!is_array($keys) && (int) $keys)
+		{
+			$keys = array('ts_id' => (int) $keys);
+		}
+		$ts_id = is_null($keys) ? $this->data['ts_id'] : $keys['ts_id'];
+		
+		if (!$this->check_acl(EGW_ACL_DELETE,$ts_id))
+		{
+			return false;
+		}
+		if (($ret = parent::delete($keys)) && $ts_id)
+		{
+			//delete custom fields entries
+			$this->delete_extra($ts_id);
+
+			// delete all links to timesheet entry $ts_id
+			$this->link->unlink(0,TIMESHEET_APP,$ts_id);
+		}
+		return $ret;
+	}
+
+
+	/**
+	 * deletes a timesheet extra entry identified by $ts_id and/or $ts_exra_name
+	 *
+	 * @param int $ts_id => number of timesheet
+	 * @param string ts_extra_name => certain custom field name
+	 * @return int false if an error
+	 */
+	function delete_extra($ts_id='',$ts_extra_name='')
+	{
+		strlen($ts_id) > 0 ? $where['ts_id'] = $ts_id : '';
+		strlen($ts_extra_name) > 0 ? $where['ts_extra_name'] = $ts_extra_name : '';
+
+		if(count($where) > 0) {
+			return $this->db->delete('phpgw_timesheet_extra', $where,__LINE__,__FILE__);
+		}
+
+		return false;
+	}
+
+	/**
+	 * changes the data from the db-format to your work-format
+	 *
+	 * reimplemented to adjust the timezone of the timestamps (adding $this->tz_offset_s to get user-time)
+	 * Please note, we do NOT call the method of the parent so_sql !!!
+	 *
+	 * @param array $data if given works on that array and returns result, else works on internal data-array
+	 * @return array with changed data
+	 */
+	function db2data($data=null)
+	{
+		if (!is_array($data))
+		{
+			$data = &$this->data;
+		}
+		foreach($this->timestamps as $name)
+		{
+			if (isset($data[$name]) && $data[$name]) $data[$name] += $this->tz_offset_s;
+		}
+		return $data;
+	}
+
+	/**
+	 * changes the data from your work-format to the db-format
+	 *
+	 * reimplemented to adjust the timezone of the timestamps (subtraction $this->tz_offset_s to get server-time)
+	 * Please note, we do NOT call the method of the parent so_sql !!!
+	 *
+	 * @param array $data if given works on that array and returns result, else works on internal data-array
+	 * @return array with changed data
+	 */
+	function data2db($data=null)
+	{
+		if ($intern = !is_array($data))
+		{
+			$data = &$this->data;
+		}
+		foreach($this->timestamps as $name)
+		{
+			if (isset($data[$name]) && $data[$name]) $data[$name] -= $this->tz_offset_s;
+		}
+		return $data;
+	}
+	
+	/**
+	 * Get the time- and pricesum for the given timesheet entries
+	 *
+	 * @param array $ids array of timesheet id's
+	 * @return array with keys time and price
+	 */
+	function sum($ids)
+	{
+		return $this->search(array('ts_id'=>$ids),true,'','','',false,'AND',false,null,'',false,true);
+	}
+	
+	/**
+	 * get title for an timesheet entry identified by $entry
+	 * 
+	 * Is called as hook to participate in the linking
+	 *
+	 * @param int/array $entry int ts_id or array with timesheet entry
+	 * @return string/boolean string with title, null if timesheet not found, false if no perms to view it
+	 */
+	function link_title( $entry )
+	{
+		if (!is_array($entry))
+		{
+			$entry = $this->read( $entry );
+		}
+		if (!$entry)
+		{
+			return $entry;
+		}
+		$format = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+		if (date('H:i',$entry['ts_start']) != '00:00')	// dont show 00:00 time, as it means date only
+		{
+			$format .= ' '.($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i');
+		}
+		return date($format,$entry['ts_start']).': '.$entry['ts_title'];
+	}
+
+	/**
+	 * query timesheet for entries matching $pattern
+	 *
+	 * Is called as hook to participate in the linking
+	 *
+	 * @param string $pattern pattern to search
+	 * @return array with ts_id - title pairs of the matching entries
+	 */
+	function link_query( $pattern )
+	{
+		$criteria = array();
+		foreach(array('ts_project','ts_title','ts_description') as $col)
+		{
+			$criteria[$col] = $pattern;
+		}
+		$result = array();
+		foreach((array) $this->search($criteria,false,'','','%',false,'OR') as $ts )
+		{
+			if ($ts) $result[$ts['ts_id']] = $this->link_title($ts);
+		}
+		return $result;
+	}
+
+	/**
+	 * Hook called by link-class to include timesheet in the appregistry of the linkage
+	 *
+	 * @param array/string $location location and other parameters (not used)
+	 * @return array with method-names
+	 */
+	function search_link($location)
+	{
+		return array(
+			'query' => TIMESHEET_APP.'.botimesheet.link_query',
+			'title' => TIMESHEET_APP.'.botimesheet.link_title',
+			'view'  => array(
+				'menuaction' => TIMESHEET_APP.'.uitimesheet.view',
+			),
+			'view_id' => 'ts_id',
+			'view_popup'  => '600x400',			
+			'add' => array(
+				'menuaction' => TIMESHEET_APP.'.uitimesheet.edit',
+			),
+			'add_app'    => 'link_app',
+			'add_id'     => 'link_id',		
+			'add_popup'  => '600x400',			
+		);
+	}
+	
+	/**
+	 * Return the timesheets linked with given project(s) AND with entries of other apps, which are also linked to the same project
+	 * 
+	 * Projectmanager will cumulate them in the other apps entries.
+	 *
+	 * @param array $param int/array $param['pm_id'] project-id(s)
+	 * @return array with pm_id, pe_id, pe_app('timesheet'), pe_app_id(ts_id), other_id, other_app, other_app_id
+	 */
+	function cumulate($param)
+	{
+		$links = $this->link->get_3links(TIMESHEET_APP,'projectmanager',$param['pm_id']);
+		
+		$rows = array();
+		foreach($links as $link)
+		{
+			$rows[$link['id']] = array(
+				'pm_id'       => $link['id2'],
+				'pe_id'       => $link['id'],
+				'pe_app'      => $link['app1'],
+				'pe_app_id'   => $link['id1'],
+				'other_id'    => $link['link3'],
+				'other_app'   => $link['app3'],
+				'other_app_id'=> $link['id3'],
+			);
+		}
+		return $rows;
+	}
+
+	/**
+	 * updates the project titles in the timesheet application (called whenever a project name is changed in the project manager)
+	 *
+	 * Todo: implement via notification
+	 *
+	 * @param string $oldtitle => the origin title of the project
+	 * @param string $newtitle => the new title of the project
+	 * @return boolean true for success, false for invalid parameters
+	 */
+	 function update_ts_project($oldtitle='', $newtitle='')
+	 {
+		if(strlen($oldtitle) > 0 && strlen($newtitle) > 0) {
+			$keys = array('ts_project' => $oldtitle);
+			$fieldAssign = array('ts_project' => $newtitle,'ts_title' => $newtitle);
+			$this->db->update('phpgw_timesheet',$fieldAssign,$keys,__LINE__,__FILE__);
+
+			return true;
+		}
+
+		return false;
+	 }
+
+	/**
+	 * returns array with relation link_id and ts_id (necessary for project-selection)
+	 *
+	 * @param int $pm_id ID of selected project
+	 * @return array containing link_id and ts_id
+	 */	
+	function get_ts_links($pm_id=0) {
+		$tslist = array();		
+		if(strlen($pm_id) > 0) {
+			if(isset($GLOBALS['phpgw_info']['user']['apps']['projectmanager'])) {	
+				$bo_pm = CreateObject('projectmanager.boprojectmanager');
+				$childs = $bo_pm->children($pm_id);
+				$childs[] = $pm_id;
+				$pmChilds = implode(",",$childs);
+				$this->db->select(	'phpgw_links','link_id, link_id1',$query,
+							__LINE__,__FILE__,False,
+							'',False,0,
+							'JOIN phpgw_pm_projects ON (pm_id = link_id2)
+							 WHERE 
+								link_app1 = \'timesheet\' AND
+								link_app2 = \'projectmanager\' AND
+								link_id2 IN ('.$pmChilds.')');
+					
+				while($row = $this->db->row(true)) {
+					$tslist[$row['link_id']] = $row['link_id1'];
+				}
+					
+			}
+
+		} 
+		return $tslist;
+	}
+}
Index: /contrib/Timesheet/inc/class.export_timesheet_openoffice.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.export_timesheet_openoffice.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.export_timesheet_openoffice.inc.php	(revision 3526)
@@ -0,0 +1,205 @@
+<?php
+/**
+ * eGroupWare
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package timesheet
+ * @subpackage importexport
+ * @link http://www.egroupware.org
+ * @author Knut Moeller <k.moeller@metaways.de>
+ * @copyright Knut Moeller <k.moeller@metaways.de>
+ * @version $Id: $
+ */
+
+require_once(PHPGW_INCLUDE_ROOT. '/etemplate/inc/class.etemplate.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.iface_export_plugin.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/timesheet/inc/class.uitimesheet.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/timesheet/inc/class.botimesheet.inc.php');
+
+/**
+ * export plugin of addressbook
+ */
+class export_timesheet_openoffice implements iface_export_plugin {
+
+
+
+	/**
+	 * Exports records as defined in $_definition
+	 *
+	 * @param phpgw_record $_definition
+	 */
+	public static function export( $_stream, $_charset, definition $_definition) {
+
+		$options = $_definition->options;
+
+		$botimesheet = new botimesheet();
+
+			// get current display selection
+
+		$query = $GLOBALS['phpgw']->session->appsession('index',TIMESHEET_APP);
+
+		$bo_pm = CreateObject('projectmanager.boprojectmanager');
+	    $childs = $bo_pm->children( $query['col_filter']['pm_id'] );
+	    $childs[] = $query['col_filter']['pm_id'];
+	    $pmChilds = implode(",",$childs);
+	    $botimesheet->db->select(    'phpgw_links','link_id, link_id1','',
+	                   __LINE__,__FILE__,False,
+	                   '',False,0,
+	                   'JOIN phpgw_pm_projects ON (pm_id = link_id2)
+						JOIN phpgw_timesheet ON (ts_id=link_id1)
+	                    WHERE
+	                       link_app1 = \'timesheet\' AND
+	                       link_app2 = \'projectmanager\' AND
+	                       link_id2 IN ('.$pmChilds.') AND ts_start >= '.$query['startdate'].' AND ts_start < '.$query['enddate'] );
+
+		while($row = $botimesheet->db->row(true)) {
+	       $tslist[$row['link_id']] = $row['link_id1'];
+	    }
+
+//error_log(print_r($query,true));
+//error_log(print_r($tslist,true));
+
+		$ids = implode(',', $tslist);
+
+		// no result
+		if (strlen($ids)==0) return false;
+
+//error_log('IDS: '.$ids);
+
+			// get full result
+
+		$rows = $botimesheet->search(array("phpgw_timesheet.ts_id IN ($ids)"),
+									false, 'ts_owner,ts_start', array('cat_name') ,
+									'', false, 'AND', false, null,
+					'LEFT JOIN phpgw_categories ON (phpgw_categories.cat_id=phpgw_timesheet.cat_id AND phpgw_categories.cat_appname=\'timesheet\')');
+
+
+		if (is_array($rows) && count($rows)>0 ) {
+//error_log(print_r($rows,true));
+				// export rows
+
+			$export_object = new export_openoffice($_stream, $charset, (array)$options);
+			$export_object->init();
+
+
+				// get date values
+
+			$tstamp_min = 0; 				// date range for table date entries (KW...)
+			$tstamp_max = 0;
+
+			foreach($rows as $row)  {
+				if ($row['ts_start']<$tstamp_min || $tstamp_min == 0) $tstamp_min = $row['ts_start'];
+				if ($row['ts_start']>$tstamp_max || $tstamp_max == 0) $tstamp_max = $row['ts_start'];
+			}
+
+
+				// init summarytable
+			$export_object->create_summarytable();
+
+
+				// user tables
+			$last_username = 0;
+			$first_table = true;
+
+			foreach($rows as $row)  {
+
+					// read in extra values (custom fields)
+				$extrarows = $botimesheet->search(array("phpgw_timesheet.ts_id=".$row['ts_id']), false, '', 'ts_extra_name,ts_extra_value' ,
+											'', false, 'AND', false, null,
+											'LEFT JOIN phpgw_timesheet_extra ON (phpgw_timesheet_extra.ts_id=phpgw_timesheet.ts_id)'  );
+				$extras = array();
+				foreach($extrarows as $extrarow) {
+					$extras[$extrarow['ts_extra_name']] = $extrarow['ts_extra_value'];
+				}
+
+				// change projectname
+				$titleRegex = '/^.*:.*-\s(.*)$/';
+				preg_match($titleRegex,  $row['ts_project'], $title);
+				$row['ts_project'] = $title[1];
+
+				// get firstname, lastname
+				$res = array();
+//				$nameRegex = '/\s(.*)\s(.*)$/';  // z.B. "[admin] Richard Blume"
+				$nameRegex = '/(.*),\s(.*)$/';  // z.B. "Blume, Richard"
+				preg_match($nameRegex, $GLOBALS['phpgw']->common->grab_owner_name($row['ts_owner']), $res);
+// error_log('|'.$name . '| -> ' . print_r($res,true));
+				$firstname = $res[2];
+				$lastname = $res[1];
+				$fullname = $firstname.' '.$lastname;
+
+				// new table on username change
+				if ($row['ts_owner'] != $last_username) {
+
+						// create sum as last tablerow before creating new table
+					if (!$first_table) {
+						$export_object->summarize();
+					}
+					else {
+						$first_table = false;
+					}
+
+						// create new table sheet
+					$export_object->create_usertable($lastname,
+										$fullname, $tstamp_min, $tstamp_max);
+
+				}
+				$export_object->add_record($row, $extras);
+				$last_username = $row['ts_owner'];
+			}
+			$export_object->summarize();  // for last table
+
+				// fill collected sums into sum-table
+			$export_object->fill_summarytable($tstamp_min, $tstamp_max);
+
+				// write to zipfile, cleanup
+			$export_object->finalize();
+		}
+	}
+
+	/**
+	 * returns translated name of plugin
+	 *
+	 * @return string name
+	 */
+	public static function get_name() {
+		return lang('Timesheet OpenOffice export');
+	}
+
+	/**
+	 * returns translated (user) description of plugin
+	 *
+	 * @return string descriprion
+	 */
+	public static function get_description() {
+		return lang("Export to OpenOffice Spreadsheet");
+	}
+
+	/**
+	 * retruns file suffix for exported file
+	 *
+	 * @return string suffix
+	 */
+	public static function get_filesuffix() {
+		return 'ods';
+	}
+
+	/**
+	 * return html for options.
+	 * this way the plugin has all opertunities for options tab
+	 *
+	 * @return string html
+	 */
+	public static function get_options_etpl() {
+		return 'timesheet.export_openoffice_options';
+	}
+
+	/**
+	 * returns slectors of this plugin via xajax
+	 *
+	 */
+	public static function get_selectors_etpl() {
+		return '<b>Selectors:</b>';
+	}
+}
+
+
Index: /contrib/Timesheet/inc/class.uitimesheet.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.uitimesheet.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.uitimesheet.inc.php	(revision 3526)
@@ -0,0 +1,1439 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - timesheet                                                    *
+  * http://www.eGroupWare.org                                                *
+  * Maintained and further developed by RalfBecker@outdoor-training.de       *
+  * Based on Webtimesheet by Craig Knudsen <cknudsen@radix.net>               *
+  *          http://www.radix.net/~cknudsen                                  *
+  * Originaly modified by Mark Peters <skeeter@phpgroupware.org>             *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class uitimesheet
+	{
+		var $dbb;
+		var $template;
+		var $cat;
+		var $debug = False;
+		var $cat_id;
+		var $theme;
+		var $link_tpl;
+		var $public_functions = array(
+		'index' => True,		
+		'view' => True,
+		'edit' => True,
+		'update'=> True,				
+		'delete' => True,
+		'close'       => True,
+		'import_mail' => True,
+		'search' => True,
+		'header' => True,
+		'footer' => True			
+		);
+
+
+	var $prefs;
+	/**
+	 * instance of the bo-class
+	 * 
+	 * @var botimesheet
+	 */
+	var $bo;
+	/**
+	 * reference to instance of the link-class of bo
+	 * 
+	 * @var bolink
+	 */
+	var $link;
+	/**
+	 * instance of the etemplate class
+	 *
+	 * @var etemplate
+	 */
+	var $tmpl;
+	/**
+	 * reference to the html object of etemplate
+	 *
+	 * @var html
+	 */
+	var $html;
+	/**
+	 * allowed units and hours per day, can be overwritten by the projectmanager configuration, default all units, 8h
+	 * 
+	 * @var string
+	 */
+	var $duration_format = ',';	// comma is necessary!
+	
+	var $icons = array(
+		'type' => array(
+			'task'      => 'task.png',      'task_alt'      => 'Task',
+			'phone'     => 'phone.gpng',     'phone_alt'     => 'Phonecall',
+			'note'      => 'note.png',      'note_alt'      => 'Note',
+			'confirm'   => 'confirm.png',   'confirm_alt'   => 'Confirmation',
+			'reject'    => 'reject.png',    'reject_alt'    => 'Reject',
+			'email'     => 'email.png',     'email_alt'     => 'Email' ),
+		'action' => array(
+			'new'       => 'new.png',       'new_alt'       => 'Add Sub',
+			'view'      => 'view.png',      'view_alt'      => 'View Subs',
+			'parent'    => 'parent.png',    'parent_alt'    => 'View other Subs',
+			'edit'      => 'edit.png',      'edit_alt'      => 'Edit',
+			'addfile'   => 'addfile.png',   'addfile_alt'   => 'Add a file',
+			'delete'    => 'delete.png',    'delete_alt'    => 'Delete',
+			'close'     => 'done.png',      'close_alt'     => 'Close' ),
+		'status' => array(
+			'billed'    => 'billed.png',    'billed_alt'    => 'billed',
+			'done'      => 'done.png',      'done_alt'      => 'done',
+			'will-call' => 'will-call.png', 'will-call_alt' => 'will-call',
+			'call'      => 'call.png',      'call_alt'      => 'call',
+			'ongoing'   => 'ongoing.png',   'ongoing_alt'   => 'ongoing',
+			'offer'     => 'offer.png',     'offer_alt'     => 'offer' )
+	);
+	var $filters = array(
+		'none'                     => 'no Filter',
+		'done'                     => 'done',
+		'responsible'              => 'responsible',
+		'responsible-open-today'   => 'responsible open',
+		'responsible-open-overdue' => 'responsible overdue',
+		'responsible-upcoming'     => 'responsible upcoming',
+		'delegated'                => 'delegated',
+		'delegated-open-today'     => 'delegated open',
+		'delegated-open-overdue'   => 'delegated overdue',
+		'delegated-upcoming'       => 'delegated upcomming',
+		'own'                      => 'own',
+		'own-open-today'           => 'own open',
+		'own-open-overdue'         => 'own overdue',
+		'own-upcoming'             => 'own upcoming',
+		'open-today'               => 'open',
+		'open-overdue'             => 'overdue',
+		'upcoming'                 => 'upcoming',
+	);
+	var $messages = array(
+		'edit'    => 'timesheet - Edit',
+		'add'     => 'timesheet - New',
+		'add_sub' => 'timesheet - New Subproject',
+		'sp'      => '- Subprojects from',
+		're'      => 'Re:'
+	);
+
+
+var $optionldap;
+
+	/**
+	 * Constructor
+	 *
+	 * @return uitimesheet
+	 */
+
+
+
+		function uitimesheet()
+		{
+
+
+
+
+			
+ 
+//print_r($GLOBALS);
+
+			$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
+			$this->bo = CreateObject('timesheet.botimesheet',1);
+			$this->cat = &$this->bo->cat;
+			//echo "pwnre".$this->bo->owner."  ".$this->bo->today."  ".$this->bo->evento;
+			$this->dbb = CreateObject('class.DBAccess',1);
+			$this->cat = &$this->bo->cat;
+
+
+			$this->resources = &$this->bo->resources;
+
+			$this->project = &$this->bo->project;
+
+$this->tarea = &$this->bo->tarea;
+
+			print_debug('BO Owner',$this->bo->owner);
+
+			$this->template = $GLOBALS['phpgw']->template;
+			$this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('timesheet');
+
+			$this->cat_id   = $this->bo->cat_id;
+
+			$this->link_tpl = CreateObject('phpgwapi.Template',$this->template_dir);
+			$this->link_tpl->set_unknowns('remove');
+			$this->link_tpl->set_file(
+				Array(
+					'link_picture'	=> 'link_pict.tpl'
+				)
+			);
+			$this->link_tpl->set_block('link_picture','link_pict','link_pict');
+			$this->link_tpl->set_block('link_picture','pict','pict');
+			$this->link_tpl->set_block('link_picture','link_open','link_open');
+			$this->link_tpl->set_block('link_picture','link_close','link_close');
+			$this->link_tpl->set_block('link_picture','link_text','link_text');
+
+
+
+$this->ds = $GLOBALS['phpgw']->common->ldapConnect();
+			if(!$this->ds)
+				$this->ds = $GLOBALS['phpgw']->common->ldapConnect();
+			if(!@is_object($GLOBALS['phpgw']->translation))
+			{
+				$GLOBALS['phpgw']->translation = CreateObject('phpgwapi.translation');
+			}
+			$this->user_context  = $GLOBALS['phpgw_info']['server']['ldap_context'];
+			$this->group_context = $GLOBALS['phpgw_info']['server']['ldap_group_context'];
+		
+/*************************************************/
+
+			$this->always_app_header = $this->bo->prefs['common']['template_set'] == 'idots';
+
+			//print_debug('UI',$this->_debug_sqsof());
+
+			if (!is_object($GLOBALS['phpgw']->html))
+			{
+				$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
+			}
+			$this->html = &$GLOBALS['phpgw']->html;
+		}
+
+		/* Public functions */
+
+		
+
+		function index($params='')
+
+		{
+
+			if (!$params)
+			{
+				foreach(array('date','year','month','day') as $field)
+				{
+					if (isset($_GET[$field]))
+					{
+						$params[$field] = $_REQUEST[$field];
+					}
+				}
+			}
+//$todos = $this->get_todos($todo_label);
+
+			$GLOBALS['phpgw']->redirect($this->page('search',$params));
+			
+		}
+
+
+		
+function page($_page='',$params='')
+		{
+			if($_page == '')
+			{
+				$page_ = explode('.',$this->bo->prefs['timesheet']['defaulttimesheet']);
+				$_page = $page_[0];
+
+				if ($_page=='planner_cat' || $_page=='planner_user')
+				{
+					$_page = 'month';
+				}
+				elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner'))
+				{
+					$_page = 'month';
+					$GLOBALS['phpgw']->preferences->add('timesheet','defaulttimesheet','month');
+					$GLOBALS['phpgw']->preferences->save_repository();
+				}
+			}
+			if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' ||
+				strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail'))	// email, felamimail, ...
+			{
+				$page_app = 'timesheet';
+			}
+			else
+			{
+				$page_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
+			}
+			if (is_array($params))
+			{
+				$params['menuaction'] = $page_app.'.ui'.$page_app.'.'.$_page;
+			}
+			else
+			{
+				$params = 'menuaction='.$page_app.'.ui'.$page_app.'.'.$_page.$params;
+			}
+			return $GLOBALS['phpgw']->link('/index.php',$params);
+		}
+
+
+
+// NDEE: printer-friendly
+function printer_friendly($body,$app_header='')
+		{
+			$_SESSION['timesheet']['category'] = $this->cat->formated_list('select','all',$this->bo->cat_id,'True');
+$_SESSION['timesheet']['resources'] = $this->resources->formated_list('select','all',$this->bo->resources_id,'True');
+			if((!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && count($this->bo->grants) > 0)
+				$_SESSION['timesheet']['cals'] = $this->bo->list_cals();
+
+			
+				unset($GLOBALS['phpgw_info']['flags']['noheader']);
+				unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+				unset($GLOBALS['phpgw_info']['flags']['noappheader']);
+				unset($GLOBALS['phpgw_info']['flags']['noappfooter']);
+				if ($app_header && $this->always_app_header)
+				{
+					$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['timesheet']['title'].' - '.$app_header;
+				}
+				
+				$GLOBALS['phpgw']->common->phpgw_header();
+				
+			return $new_body;
+		}
+
+
+
+
+
+
+
+		function header()
+		{
+			$cols = 8;
+			if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True)
+			{
+				$cols++;
+			}
+
+			$tpl = $GLOBALS['phpgw']->template;
+			$tpl->set_unknowns('remove');
+
+			if (!file_exists($file = $this->template_dir.'/header.inc.php'))
+			{
+				$file = PHPGW_SERVER_ROOT . '/timesheet/templates/default/header.inc.php';
+			}
+
+			include($file);
+			$refer = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
+			if($refer[2] != 'view') {
+			$header = $tpl->fp('out','head');
+			unset($tpl);
+			echo $header;
+		}
+			unset($tpl);
+		}
+
+		function footer()
+		{
+			$menuaction = $_GET['menuaction'];
+			list(,,$method) = explode('.',$menuaction);
+
+			if (@$this->bo->printer_friendly)
+			{
+				return;
+			}
+
+			$p = $GLOBALS['phpgw']->template;
+
+			$p->set_file(
+				Array(
+					'footer'	=> 'footer.tpl',
+					'form_button'	=> 'form_button_script.tpl'
+				)
+			);
+			$p->set_block('footer','footer_table','footer_table');
+			$p->set_block('footer','footer_row','footer_row');
+			$p->set_block('footer','blank_row','blank_row');
+			$p->set_block('footer','num_dias','num_dias');
+
+			$m = $this->bo->month;
+			$y = $this->bo->year;
+
+			$hoje = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow);
+			$mes_hoje = (int)substr($hoje,4,2);
+			$mes_footer = (int)substr($_POST['date'],4,2);
+			if($_GET['sday'])
+			{
+				if($_GET['month'] == $mes_hoje)
+				{
+					$day = $this->bo->day;
+				} 
+				else
+				{
+					$day = $_GET['sday'];
+				}
+			}
+			else
+			{
+				$day = $this->bo->day;
+				$dia_ini = $day;
+			}
+			if($mes_footer == $mes_hoje)
+			{
+				$dia_ini = (int)substr($hoje,6,2);
+				$day = $dia_ini;
+			}
+			
+			/********************************************************************************************/
+
+		}
+
+		
+
+
+
+
+/****************************************************************************************/
+
+
+function edit($cd=0,$readsess=0)
+		{
+
+			$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+
+
+
+			if(!$this->bo->check_perms(PHPGW_ACL_ADD))
+			{
+				$this->index();
+			}
+			
+			if($readsess)
+			{
+
+				$event = $this->bo->restore_from_appsession;
+				if(!$event['owner'])
+				{
+					$this->bo->add_attribute('owner',$this->bo->owner);
+				}
+				$can_edit = True;
+			}
+			else
+			{
+
+
+				$this->bo->event_init();
+				$this->bo->add_attribute('id',0);
+
+				$can_edit = True;
+				$participants = (string)(get_var('participants',array('GET'),FALSE));
+				$starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['timesheet']['workdaystarts']));
+				$startmin  = (int)(get_var('minute',array('GET'),0));
+				$endmin    = $startmin + (int)$this->bo->prefs['timesheet']['defaultlength'];
+				$endhour   = $starthour + $this->bo->normalizeminutes($endmin);
+				
+				$subject	= (string)(get_var('title',array('GET'),0));
+				if ($subject != '0')
+				{
+					$description	= (string)(get_var('description',array('GET'),0));
+					$description1	= (string)(get_var('description1',array('GET'),0));
+					$location	= (string)(get_var('location',array('GET'),0));
+				}
+				else
+					unset($subject);
+				
+				$this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0);
+				$this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0);
+
+			//echo "kkkk".$this->bo->year;
+				if(@$this->bo->prefs['timesheet']['default_private'])
+				{
+					$this->bo->set_class(False);
+				}
+				else
+				{
+					$this->bo->set_class(True);
+				}
+				
+				$event = $this->bo->restore_from_appsession;
+				
+			}
+if(isset($_REQUEST['error'])){
+$cd=$_REQUEST['error'];
+}
+			$this->edit_form(
+				Array(
+					'event' => $event,
+					'cd' => $cd,
+					'plain' => $_GET['plain']
+				)
+			);
+			$GLOBALS['phpgw']->common->phpgw_footer();
+		}
+
+
+function edit_form($param)
+		{
+
+
+if(isset($_REQUEST['id'])){
+			$event=$this->select($_REQUEST['id']);
+}else{
+$event=$this->select_init();
+}
+
+unset($GLOBALS['phpgw_info']['flags']['noheader']);
+
+
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			
+	
+
+
+
+
+
+
+			if(!is_array($param))
+			{
+				$this->index();
+			}
+			
+			if(isset($param['event']))
+			{
+				$event = $param['event'];
+			}
+			
+			$hourformat = substr($this->bo->users_timeformat,0,1);
+			
+			$jscal = CreateObject('phpgwapi.jscalendar');	// before phpgw_header() !!!
+			
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+			$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding timesheet');
+			if ($param['plain'] != "True"){
+				$GLOBALS['phpgw']->common->phpgw_header();
+			}
+			else{
+				$GLOBALS['phpgw_info']['theme']['row_on'] = "F8F8F8";
+				$GLOBALS['phpgw_info']['theme']['row_off'] = "F8F8F8";
+			}
+
+			$p = &$GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'edit'		=> 'edit.tpl',
+					'form_button'	=> 'form_button_script.tpl'
+				)
+			);
+			$p->set_block('edit','edit_entry','edit_entry');
+			$p->set_block('edit','list','list');
+			$p->set_block('edit','hr','hr');
+
+			$vars = Array(
+				'font'			=> $this->theme['font'],
+				'bg_color'		=> $this->theme['bg_text'],
+				'action_url'		=> $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'timesheet.uitimesheet.update')),
+				'accounts_link'		=> $GLOBALS['phpgw']->link('/index.php','menuaction=timesheet.uitimesheet.accounts_popup'),
+				'common_hidden'	=> '<input type="hidden" name="timesheet[id]" value="'.$event['id'].'">'."\n".
+'<input type="hidden" name="timesheet[parent]" value="'.$event['parent'].'">'."\n"
+.'<input type="hidden" name="timesheet[infolog]" value="'.$event['infolog'].'">'."\n"
+.'<input type="hidden" name="timesheet[project]" value="'.$event['project'].'">'."\n"
+.'<input type="hidden" name="timesheet[tracker]" value="'.$event['tracker'].'">'."\n"
+					. '<input type="hidden" name="timesheet[owner]" value="'.$event['owner'].'">'."\n"
+					. (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access']?
+					'<input type="hidden" name="participants[]" value="'.$this->bo->owner.'">'."\n":''),
+				'errormsg'		=> ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):'')
+			);
+			
+			$p->set_var($vars);
+
+// ts_type
+	//echo $event['type'];		
+
+
+// Display Categories
+			if(strpos($event['category'],','))
+			{
+				$temp_cats = explode(',',$event['category']);
+				@reset($temp_cats);
+				while(list($key,$value) = each($temp_cats))
+				{
+					$check_cats[] = (int)$value;
+				}
+			}
+			elseif($event['category'])
+			{
+				$check_cats[] = (int)$event['category'];
+			}
+			else
+			{
+				$check_cats[] = 0;
+			}
+			$var['category'] = Array(
+				'field'	=> lang('Category'),
+				'data'	=> '<select name="timesheet[category]" onchange="javascript:updateTitleField(this)" >'.$this->cat->formated_list('select','all',$check_cats,True).'</select>'
+			);
+		
+
+// Display proyectos
+// Location
+
+
+
+// 
+	/*		if(strpos($event['project'],','))
+			{
+				$temp_cats = explode(',',$event['project']);
+				@reset($temp_cats);
+				while(list($key,$value) = each($temp_cats))
+				{
+					$check_cats[] = (int)$value;
+				}
+			}
+			elseif($event['project'])
+			{
+				$check_cats[] = (int)$event['project'];
+			}
+			else
+			{
+				$check_cats[] = 0;
+			}
+			$var['project'] = Array(
+				'field'	=> lang('project'),
+				'data'	=> '<select name="timesheet[project]" onchange="javascript:updateTitleField(this)" >'.$this->project->formated_list('select','name,name','',True).'</select>'
+			);*/
+
+
+// Display tarea
+// Location
+
+
+
+// 
+		/*	if(strpos($event['tarea'],','))
+			{
+				$temp_cats = explode(',',$event['tarea']);
+				@reset($temp_cats);
+				while(list($key,$value) = each($temp_cats))
+				{
+					$check_cats[] = (int)$value;
+				}
+			}
+			elseif($event['tarea'])
+			{
+				$check_cats[] = (int)$event['tarea'];
+			}
+			else
+			{
+				$check_cats[] = 0;
+			}
+			$var['tarea'] = Array(
+				'field'	=> lang('tarea'),
+				'data'	=> '<select name="timesheet[tarea]" onchange="javascript:updateTitleField(this)" >'.$this->tarea->formated_list('select','name,name','',True).'</select>'
+			);*/
+
+
+
+
+
+
+// asunto
+			$var['title'] = Array(
+				'field'	=> lang('title'),
+				'data'	=> '<input type="text" name="timesheet[title]" maxlength="255" value="'.$event['title'].'">'
+			);
+
+
+
+
+// Full Description
+			$var['description'] = Array(
+				'field'	=> lang('Description'),
+				'data'	=> '<textarea name="timesheet[description]" rows="5" cols="40" wrap="virtual" maxlength="2048">'.$event['descripcion'].'</textarea>'
+			);
+
+
+
+
+$valorfechainicio=$this->bo->time2array($event['fechainicio'],$alarm = 0);
+$start=$valorfechainicio['mday']."/".$valorfechainicio['month']."/".$valorfechainicio['year'];
+			$var['startdate'] = Array(
+				'field'	=> lang('Start Date'),
+
+				'data' => $jscal->input('start[str]',$start)
+			);
+
+// Time
+			if ($this->bo->prefs['common']['timeformat'] == '12')
+			{
+				$stra .= '<input type="radio" name="start[ampm]" value="am"'.($valorfechainicio['hourcompleta'] >= 12?'':' checked').'>am'."\n"
+					. '<input type="radio" name="start[ampm]" value="pm"'.($valorfechainicio['hourcompleta'] >= 12?' checked':'').'>pm'."\n";
+			}
+			$var['starttime'] = Array(
+				'field'	=> lang('Start Time'),
+				'data'	=> '<input name="start[hour]" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($event['fechainicio'],$hourformat).'" maxlength="2">:<input name="start[min]" size="2" value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" maxlength="2">'."\n".$stra
+			);
+
+// End Date
+			//$end = $this->bo->maketime($event['fechafin']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+
+$eee=$this->bo->maketime($GLOBALS['phpgw']->datetime->users_localtime);
+$valorfechaend=$this->bo->time2array($eee,$alarm = 0);
+
+//echo $valorfechaend['month']."rrr   ".$event['fechafin']."  ".$eee;
+$valorfechaend=$this->bo->time2array($event['fechafin'],$alarm = 0);
+$end=$valorfechaend['mday']."/".$valorfechaend['month']."/".$valorfechaend['year'];
+
+
+
+
+
+			$var['enddate'] = Array(
+				'field'	=> lang('End Date'),
+		'data' => $jscal->input('end[str]',$end)
+			);
+
+// End Time
+			if ($this->bo->prefs['common']['timeformat'] == '12')
+			{
+				$strb = '<input type="radio" name="end[ampm]" value="am"'.($valorfechaend['hourcompleta'] >= 12?'':' checked').'>am'."\n"
+					. '<input type="radio" name="end[ampm]" value="pm"'.($valorfechaend['hourcompleta'] >= 12?' checked':'').'>pm'."\n";
+			}
+			$var['endtime'] = Array(
+				'field'	=> lang('End Time'),
+				'data'	=> '<input name="end[hour]" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($event['fechafin'],$hourformat).'" maxlength="2">:<input name="end[min]" size="2" value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" maxlength="2">'."\n".$strb
+			);
+
+
+
+
+
+
+/*********************************************************************/
+
+
+
+
+
+
+//			$this->output_template_array($p,'row','list',Array('data' => '<script src="simple_show_hide.js" type="text/javascript"></script>'));
+
+			if (!isset($this->fields))
+			{
+				$this->custom_fields = CreateObject('timesheet.bocustom_fields');
+				$this->fields = &$this->custom_fields->fields;
+				$this->stock_fields = &$this->custom_fields->stock_fields;
+			}
+		//	$this->output_template_array($p,'row','list',$var['access']);
+			unset($var['access']);
+
+			$preserved = False;
+			foreach($this->fields as $field => $data)
+			{
+
+				if (!$data['disabled'])
+				{
+
+
+					if (isset($var[$field]))
+					{
+
+
+						switch($field)
+						{
+							case 'startdate':
+								$this->output_template_array($p,'row','list',$var['startdate']);
+								$this->output_template_array($p,'row','list',$var['starttime']);
+								break;
+							case 'enddate':
+								$this->output_template_array($p,'row','list',$var['enddate']);
+								$this->output_template_array($p,'row','list',$var['endtime']);
+								break;
+							case 'recure_type':
+								$p->set_var('tr_color',$this->theme['th_bg']);
+								$p->set_var('hr_text','<center id="rpt_label"><b>'.lang('Repeating Event Information').'</b></center>');
+								$p->parse('row','hr',True);
+								$this->output_template_array($p,'row','list',$var['recure_type']);
+								$this->output_template_array($p,'row','list',$var['recure_enddate']);
+								$this->output_template_array($p,'row','list',$var['recure_day']);
+								$this->output_template_array($p,'row','list',$var['recure_interval']);
+								break;
+							default:
+								$this->output_template_array($p,'row','list',$var[$field]);
+
+						}
+					}
+					elseif (!isset($this->stock_fields[$field]))	// Custom field
+					{
+
+
+						$lang = lang($name = substr($field,1));
+						$size = 'SIZE='.($data['shown'] ? $data['shown'] : ($data['length'] ? $data['length'] : 30)).
+							' MAXLENGTH='.($data['length'] ? $data['length'] : 255);
+						$v = array(
+							'field'	=> $lang == $name.'*' ? $name : $lang,
+							'data'	=> '<input name="cal['.htmlspecialchars($field).']" '.$size.' value="'.$event['#'.$name].'">'
+						);
+						if ($data['title'])
+						{
+							$v['tr_color'] = $this->theme['th_bg'];
+						}
+						if (!$data['length'] && $data['title'])
+						{
+							$p->set_var('tr_color',$this->theme['th_bg']);
+							$p->set_var('hr_text','<center><b>'.$v['field'].'</b></center>');
+							$p->parse('row','hr',True);
+						}
+						else
+						{
+							$this->output_template_array($p,'row','list',$v);
+						}
+					}
+				}
+				else	// preserve disabled fields
+				{
+
+
+					switch ($field)
+					{
+						case 'owner':
+							$preserved[$field] = $event['id'] ? $event['participants'][$event['owner']] : 'A';
+							break;
+						case 'recure_type':
+							foreach(array('recur_type','recur_enddate','recur_data','recur_interval') as $field)
+							{
+								$preserved[$field] = $event[$field];
+							}
+							break;
+						case 'startdate':
+						case 'enddate':
+							$field = substr($field,0,-4);
+						default:
+							$preserved[$field] = $event[$field];
+					}
+				}
+			}
+			unset($var);
+			if (is_array($preserved))
+			{
+				//echo "preserving<pre>"; print_r($preserved); echo "</pre>\n";
+				$p->set_var('common_hidden',$p->get_var('common_hidden').'<input type="hidden" name="preserved" value="'.htmlspecialchars(serialize($preserved)).'">'."\n");
+			}
+			$p->set_var('submit_button',lang('Save'));
+
+			$delete_button = $cancel_button = '';
+			if ($event['id'] > 0)
+			{
+				$var = Array(
+					'action_url_button'	=> $this->page('delete','&cal_id='.$event['id']),
+					'action_text_button'	=> lang('Delete'),
+					'action_confirm_button'	=> "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"",
+					'action_extra_field'	=> '',
+					'button_id'	=>	'delete_button'
+				);
+				$p->set_var($var);
+				$delete_button = $p->fp('out','form_button');
+			}
+			$p->set_var('delete_button',$delete_button);
+			$p->set_var('alert_msg',lang('Required field (category) is empty'));
+
+			if ($this->bo->return_to)
+			{
+				$var = Array(
+					'action_url_button'	=> $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to),
+					'action_text_button'	=> lang('Cancel'),
+					'action_confirm_button'	=> '',
+					'action_extra_field'	=> '',
+					'button_id'	=>	'cancel_button'
+				);
+				$p->set_var($var);
+				$cancel_button = $p->fp('out','form_button');
+			}
+			$p->set_var('cancel_button',$cancel_button);
+			$p->pparse('out','edit_entry');
+		}
+
+	function output_template_array(&$p,$row,$list,$var)
+		{
+			if (!isset($var['hidden_vars']))
+			{
+				$var['hidden_vars'] = '';
+			}
+			if (!isset($var['tr_color']))
+			{
+				$var['tr_color'] = $GLOBALS['phpgw']->nextmatchs->alternate_row_color();
+			}
+			$p->set_var($var);
+			$p->parse($row,$list,True);
+		}
+
+
+function get_organizations($context, $selected='', $recursive = false)
+		{
+			$s = CreateObject('phpgwapi.sector_search_ldap');
+						
+			return ($recursive ? 
+				$s->get_organizations($context, $selected, false ,true) :
+				$s->get_sectors($selected, false, false));
+		}	
+	
+
+
+
+/**********************************************/
+
+
+function _debug_sqsof()
+		{
+			$data = array(
+				'filter'     => $this->bo->filter,
+				'cat_id'     => $this->bo->cat_id,
+				'owner'      => $this->bo->owner,
+				'year'       => $this->bo->year,
+				'month'      => $this->bo->month,
+				'day'        => $this->bo->day,
+				'sortby'     => $this->bo->sortby,
+				'num_months' => $this->bo->num_months
+			);
+			Return _debug_array($data,False);
+		}
+
+
+
+
+/***********************************/
+
+
+
+
+function search()
+		{
+
+//print_r($_REQUEST); 
+
+
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['timesheet']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+			$matches = 0;
+
+		//$event = $this->bo->read_entry($ts_id);	
+$event = $this->get_event_ids($adicional);
+
+
+			//$event_ids = $this->bo->search_keywords($_POST['keywords']);
+
+			
+			$matches = count($event);
+
+//echo "matches" . $matches;
+
+			if ($matches == 1)
+			{
+				$quantity = lang('1 match found').'.';
+			}
+			elseif ($matches > 0)
+			{
+				$quantity = lang('%1 matches found',$matches).'.';
+			}
+			else
+			{
+				echo '<b>'.lang('Error').':</b>'.lang('no matches found');
+				return;
+			}
+
+			$p = $GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'search_form'	=> 'search.tpl'
+				)
+			);
+			$p->set_block('search_form','search','search');
+			$p->set_block('search_form','search_list_header','search_list_header');
+			$p->set_block('search_form','search_list','search_list');
+			$p->set_block('search_form','search_list_footer','search_list_footer');
+
+
+$script='';
+
+		
+
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_header',True);
+			}
+
+//if($info){
+			foreach($event  as $id => $data)
+			{
+
+
+				$datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+
+
+				$info = array(
+					'tr_color'	=> $GLOBALS['phpgw']->nextmatchs->alternate_row_color(),
+					'date'		=> $GLOBALS['phpgw']->common->show_date($datetime),
+
+
+'id'    => $data['id'],
+					'proyecto'         => $data['proyecto'],
+					'title'         => $data['title'],
+					'descripcion'         => $data['descripcion'],
+					'fechainicio' => $data['fechainicio'],
+					'fechafin'  => $data['fechafin'],
+'fechamodif'  => $data['fechamodif'],
+'category'  =>$data['category'],
+
+'actualizo'  => $data['actualizo'],
+'owner'  => $data['owner'],
+'ownername'  => $data['ownername'],
+'infolog'         => $data['infolog'],
+'tracker'         => $data['tracker'],
+
+
+'accionagregar'	=>'index.php?menuaction=timesheet.uitimesheet.edit&parent='. $data['id'],
+'accionmodificar'	=>'index.php?menuaction=timesheet.uitimesheet.edit&id='. $data['id'],
+'accioneditar'	=>'',
+'accionagregartimet'=>'',
+'accionborrar'	=> $data['id']
+				);
+
+
+
+//'accionagregar'	=>'index.php?menuaction=timesheet.uitimesheet.edit&parent='. $data['id']
+$p->set_var($info);
+				$p->set_var($data);
+				$p->parse('rows','search_list',True);
+			}
+//	}
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_footer',True);
+			}
+
+			$p->pparse('out','search');
+		}
+
+
+function get_event_ids($search)
+		{
+//echo "tamannn".count($search)."  ".$search[0];
+
+$from ="";
+//if (isset($_REQUEST['id'])){
+
+	//		$from = ' and t1.ts_id='.$_REQUEST['id'];
+	//		}
+
+			$sql = 'select t1.* from   phpgw_timesheet t1 where ts_owner='.$this->bo->owner
+					. $from;
+					//.$search;
+					//. 'WHERE (phpgw_cal_user.ts_id = phpgw_cal.ts_id) '
+					//. $where . $extra;
+
+
+//echo "FULL SQL : ".$sql."<br>\n";
+
+
+			if($this->debug)
+			{
+				echo "FULL SQL : ".$sql."<br>\n";
+			}
+
+ //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar");
+
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+while( $GLOBALS['phpgw']->db->next_record() )
+			{
+			//	
+
+$valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('ts_start'),$alarm = 0);
+$ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year'];
+
+$valorfechaend=$this->bo->time2array($GLOBALS['phpgw']->db->f('ts_end'),$alarm = 0);
+$end=$valorfechaend['mday']."/".$valorfechaend['month']."/".$valorfechaend['year'];
+
+$valorfechaend2=$this->bo->time2array($GLOBALS['phpgw']->db->f('ts_modified'),$alarm = 0);
+$end2=$valorfechaend2['mday']."/".$valorfechaend2['month']."/".$valorfechaend2['year'];
+
+$retval[] =  array(
+'id'    => $GLOBALS['phpgw']->db->f('ts_id'),
+					'proyecto'         => $GLOBALS['phpgw']->db->f('list_project'),
+					'title'         => $GLOBALS['phpgw']->db->f('ts_title'),
+					'descripcion'         => $GLOBALS['phpgw']->db->f('ts_description'),
+					'fechainicio' => $ini,
+					'fechafin'  => $end,
+'fechamodif'  => $end2,
+'category'  =>$GLOBALS['phpgw']->db->f('ts_cat'),
+
+'actualizo'  => $GLOBALS['phpgw']->db->f('ts_modifier'),
+'owner'  => $GLOBALS['phpgw']->db->f('ts_owner'),
+'infolog'         => $GLOBALS['phpgw']->db->f('list_infolog'),
+'tracker'         => $GLOBALS['phpgw']->db->f('list_tracker')
+
+
+					
+				);
+
+
+			}
+		
+
+
+			
+			return $retval;
+		}
+
+
+
+
+
+
+
+
+
+
+
+function update()
+		{
+
+
+
+#  $vars = get_defined_vars();  
+#   print_r($vars);
+/*foreach($_POST as $k=>$v){
+$$k=$v;
+echo $$k."<br>";
+} 
+foreach($_POST as $nombre_campo => $valor){
+   $asignacion = "\$" . $nombre_campo . "='" . $valor . "';";
+   echo $asignacion."<br>";
+} */
+
+
+
+
+unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['timesheet']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+			$matches = 0;
+
+
+
+
+
+list($dia,$mes,$ano)=split("/",$_POST['start']['str']);
+
+	$starttime = $this->bo->maketime2($_POST['start']['hour'],$_POST['start']['min'],0,$dia,$mes,$ano,$_POST['start']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset;
+//echo $starttime;
+
+list($dia2,$mes2,$ano2)=split("/",$_POST['end']['str']);
+
+	$endtime = $this->bo->maketime2($_POST['end']['hour'],$_POST['end']['min'],0,$dia2,$mes2,$ano2,$_POST['end']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset;
+//echo "gggg".$_POST['end2']['month'];
+if($_POST['end2']['str']['month']>0){
+list($dia3,$mes3,$ano3)=split("/",$_POST['end2']['str']);
+	$endtime2 = $this->bo->maketime2($_POST['end2']['hour'],$_POST['end2']['min'],0,$dia3,$mes3,$ano3,$_POST['end2']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset;
+}else{
+$endtime2=0;
+}
+ 
+			//$starttime = $this->bo->maketime2($starthora,$startmin,0,$startfecha) - $GLOBALS['phpgw']->datetime->tz_offset;
+//echo "kkkk3".$_POST['exec']['accesso'];
+if($_REQUEST['timesheet']['parent']==""){
+$parent=0;
+
+}else{
+$parent=$_REQUEST['timesheet']['parent'];
+
+}
+
+
+
+$valores="&title=".$_POST['timesheet']['title']."&description=".$_POST['timesheet']['description']."&category=".$_POST['timesheet']['category']."&project=".$_POST['project']."&infolog=".$_POST['infolog']."&tracker=".$_POST['tracker'];
+
+//$GLOBALS['phpgw']->redirect($this->page($valores,''));
+if($_POST['timesheet']['title']==""){
+$GLOBALS['phpgw']->redirect($this->page('edit&error=40'.$valores,''));
+
+}
+if($_POST['timesheet']['description']==""){
+$GLOBALS['phpgw']->redirect($this->page('edit&error=48'.$valores,''));
+}
+
+
+
+
+
+
+		//	$endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+if(isset($_POST['timesheet']['id'])&&$_POST['timesheet']['id']>0){
+			$sql = "update  phpgw_timesheet set  ts_project='".$_POST['timesheet']['project']."',ts_title='".$_POST['timesheet']['title']."',ts_description='".$_POST['timesheet']['description']."',ts_start=".$starttime." ,ts_end=".$endtime.",ts_cat='".$_POST['timesheet']['category']."' ,ts_modifier_name='".$this->get_account_name($_POST['timesheet']['owner'],"gecos")."',ts_modified=".$GLOBALS['phpgw']->datetime->users_localtime.",ts_modifier= ".$_POST['timesheet']['owner']." ,ts_owner_name='". $this->get_account_name($_POST['timesheet']['owner'],'gecos')."',ts_infolog='".$_POST['timesheet']['infolog']."',ts_tracker='".$_POST['timesheet']['tracker']."'  where ts_id='".$_POST['timesheet']['id']."'";
+}else{
+			$sql = "insert into  phpgw_timesheet (ts_project,ts_title,ts_description,ts_start ,ts_end,ts_cat ,ts_owner,ts_modified,ts_modifier,ts_infolog,ts_tracker,ts_owner_name,ts_modifier_name) 
+values ('".$_POST['timesheet']['project']."','".$_POST['timesheet']['title']."','".$_POST['timesheet']['description']."',".$starttime.",".$endtime.",'".$_POST['timesheet']['category']."',".$_POST['timesheet']['owner'].",".$GLOBALS['phpgw']->datetime->users_localtime.",".$_POST['timesheet']['owner'].",'".$_POST['timesheet']['infolog']."','".$_POST['timesheet']['tracker']."','". $this->get_account_name($_POST['timesheet']['owner'],'gecos')."','".$this->get_account_name($_POST['timesheet']['owner'],"gecos")."')";
+
+
+
+  
+}
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);	
+
+
+ExecMethod('timesheet.uitimesheet.index',$parms);
+	$GLOBALS['phpgw']->common->phpgw_exit();
+return "";
+		}
+
+
+
+
+function get_account_name($account_id,$valor)
+		{
+			$acct_type = $this->get_type($account_id);
+
+			/* jakjr: using justthese with ldap_search */
+			//$justthese = array("cn","uid","givenname","sn","gecos");
+
+			/* search the dn for the given uid */
+
+$justthese = array("uidnumber",  "cn",  "mail","gecos","dn");
+			//	$sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese);
+
+			if(($acct_type == 'g') && $this->group_context)
+			{
+				$sri = @ldap_search($this->ds, $this->group_context, '(gidnumber=' . (int)$account_id . ')', $justthese);
+			}
+			else
+			{
+				$sri = @ldap_search($this->ds, $this->user_context, '(uidnumber=' . (int)$account_id . ')', $justthese);
+			}
+
+//echo $this->ds.",". $this->user_context.",". '(uidnumber=' . (int)$account_id . ')'.",". $justthese;
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+$retorna="";
+			if($acct_type =='g')
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+			}
+			else
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+
+
+
+			}
+			return $retorna;
+		}
+
+
+
+
+
+function get_type($account_id)
+		{
+			$allValues = array();
+			/* jakjr: using justthese with ldap_search */
+			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype"));
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+
+			if ($allValues[0]['phpgwaccounttype'][0])
+			{
+				return $allValues[0]['phpgwaccounttype'][0];
+			}
+
+			$allValues = array();
+			/* jakjr: using justthese with ldap_search */
+			$sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))', array("phpgwaccounttype"));
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+
+			if ($allValues[0]['phpgwaccounttype'][0])
+			{
+				return $allValues[0]['phpgwaccounttype'][0];
+			}
+			return False;
+		}
+
+
+
+
+
+
+
+function select($id)
+		{
+
+
+			$sql = "select * from   phpgw_timesheet where ts_id='".$id."'";
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);	
+
+if( $GLOBALS['phpgw']->db->next_record() )
+			{
+
+
+			
+$retval =  array(
+					'id'    => $GLOBALS['phpgw']->db->f('ts_id'),
+					'proyecto'         => $GLOBALS['phpgw']->db->f('ts_project'),
+					'title'         => $GLOBALS['phpgw']->db->f('ts_title'),
+					'descripcion'         => $GLOBALS['phpgw']->db->f('ts_description'),
+					'fechainicio' => $GLOBALS['phpgw']->db->f('ts_start'),
+					'fechafin'  => $GLOBALS['phpgw']->db->f('ts_end'),
+'fechamodif'  => $GLOBALS['phpgw']->db->f('ts_modified'),
+'category'  =>$GLOBALS['phpgw']->db->f('ts_cat'),
+
+'actualizo'  => $GLOBALS['phpgw']->db->f('ts_modifier'),
+'owner'  => $GLOBALS['phpgw']->db->f('ts_owner'),
+'ownername'  => $GLOBALS['phpgw']->db->f('ts_owner_name'),
+'infolog'         => $GLOBALS['phpgw']->db->f('ts_infolog'),
+'tracker'         => $GLOBALS['phpgw']->db->f('ts_tracker')
+				);
+
+			}
+		
+//echo "iddd".$id."  56666 ".$retval['id'];
+
+
+return $retval;
+		
+		}
+
+
+function select_init()
+		{
+$name="";
+if(isset($_REQUEST['title'])){
+$name=$_REQUEST['title'];
+}
+
+
+$description="";
+if(isset($_REQUEST['description'])){
+$description=$_REQUEST['description'];
+}
+
+			
+$retval =  array(
+					'id'    => 0,
+					'proyecto'         => $_REQUEST['project'],
+					'asunto'         => $name,
+'title'         => $name,
+					'descripcion'         => $description,
+					'fechainicio' => $GLOBALS['phpgw']->datetime->users_localtime,
+					'fechafin'  => $GLOBALS['phpgw']->datetime->users_localtime,
+'fechamodif'  => $GLOBALS['phpgw']->datetime->users_localtime,
+'category'  =>0,
+'ownername'=>$this->get_account_name($this->bo->owner,"gecos"),
+'actualizo'  => $this->bo->owner,
+'owner'  => $this->bo->owner,
+'infolog'         => $_REQUEST['infolog'],
+'tracker'         => $_REQUEST['tracker']
+				);
+
+
+
+
+
+
+			
+
+
+return $retval;
+		
+		}
+
+
+function delete()
+		{
+
+
+
+#  $vars = get_defined_vars();  
+#   print_r($vars);
+/*foreach($_POST as $k=>$v){
+$$k=$v;
+echo $$k."<br>";
+} 
+foreach($_POST as $nombre_campo => $valor){
+   $asignacion = "\$" . $nombre_campo . "='" . $valor . "';";
+   echo $asignacion."<br>";
+} */
+
+
+
+
+unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+			$matches = 0;
+
+
+
+
+		//	$endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+			$sql = "delete from  phpgw_timesheet   where ts_id='".$_GET['id']."'";
+
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);	
+
+ExecMethod('timesheet.uitimesheet.index',$parms);
+	$GLOBALS['phpgw']->common->phpgw_exit();
+
+return "";
+		}
+
+
+}
+
+?>
Index: /contrib/Timesheet/inc/class.egw_timesheet_record.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.egw_timesheet_record.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.egw_timesheet_record.inc.php	(revision 3526)
@@ -0,0 +1,152 @@
+<?php
+/**
+ * eGroupWare - Addressbook - importexport
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package addressbook
+ * @subpackage importexport
+ * @link http://www.egroupware.org
+ * @author Cornelius Weiss <nelius@cwtech.de>, Knut Moeller <k.moeller@metaways.de>
+ * @copyright Cornelius Weiss <nelius@cwtech.de>, Knut Moeller <k.moeller@metaways.de>
+ * @version $Id: class.phpgw_addressbook_record.inc.php 22827 2006-11-10 15:35:35Z nelius_weiss $
+ */
+
+require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.iface_phpgw_record.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/timesheet/inc/class.botimesheet.inc.php');
+
+/**
+ * class phpgw_addressbook_record
+ * compability layer for iface_phpgw_record needet for importexport
+ */
+class phpgw_timesheet_record implements iface_phpgw_record
+{
+
+	private $identifier = '';
+	private $timesheetentry = array();
+	private $botimesheet;
+
+
+
+	/**
+	 * constructor
+	 * reads record from backend if identifier is given.
+	 *
+	 * @param string $_identifier
+	 */
+	public function __construct( $_identifier='' ){
+		$this->identifier = $_identifier;
+		$this->botimesheet = new botimesheet();
+		$this->timesheetentry = $this->botimesheet->read($this->identifier);
+	}
+
+	/**
+	 * magic method to set attributes of record
+	 *
+	 * @param string $_attribute_name
+	 */
+	public function __get($_attribute_name) {
+
+	}
+
+	/**
+	 * magig method to set attributes of record
+	 *
+	 * @param string $_attribute_name
+	 * @param data $data
+	 */
+	public function __set($_attribute_name, $data) {
+
+	}
+
+	/**
+	 * converts this object to array.
+	 * @abstract We need such a function cause PHP5
+	 * dosn't allow objects do define it's own casts :-(
+	 * once PHP can deal with object casts we will change to them!
+	 *
+	 * @return array complete record as associative array
+	 */
+	public function get_record_array() {
+		return $this->timesheetentry;
+	}
+
+	/**
+	 * gets title of record
+	 *
+	 *@return string title
+	 */
+	public function get_title() {
+// TODO get_record gibts nicht ?
+//		if (empty($this->timesheetentry)) {
+//			$this->get_record();
+//		}
+		return $this->timesheetentry['ts_project'] . ' - ' . $this->timesheetentry['ts_title'];
+	}
+
+	/**
+	 * sets complete record from associative array
+	 *
+	 * @todo add some checks
+	 * @return void
+	 */
+	public function set_record(array $_record){
+		$this->timesheetentry = $_record;
+	}
+
+	/**
+	 * gets identifier of this record
+	 *
+	 * @return string identifier of current record
+	 */
+	public function get_identifier() {
+		return $this->identifier;
+	}
+
+	/**
+	 * saves record into backend
+	 *
+	 * @return string identifier
+	 */
+	public function save ( $_dst_identifier ) {
+
+	}
+
+	/**
+	 * copies current record to record identified by $_dst_identifier
+	 *
+	 * @param string $_dst_identifier
+	 * @return string dst_identifier
+	 */
+	public function copy ( $_dst_identifier ) {
+
+	}
+
+	/**
+	 * moves current record to record identified by $_dst_identifier
+	 * $this will become moved record
+	 *
+	 * @param string $_dst_identifier
+	 * @return string dst_identifier
+	 */
+	public function move ( $_dst_identifier ) {
+
+	}
+
+	/**
+	 * delets current record from backend
+	 *
+	 */
+	public function delete () {
+
+	}
+
+	/**
+	 * destructor
+	 *
+	 */
+	public function __destruct() {
+		unset ($this->botimesheet);
+	}
+
+} // end of phpgw_timesheet_record
+?>
Index: /contrib/Timesheet/inc/class.sotimesheet.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.sotimesheet.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.sotimesheet.inc.php	(revision 3526)
@@ -0,0 +1,432 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - infolog                                                    *
+  * http://www.eGroupWare.org                                                *
+  * Maintained and further developed by RalfBecker@outdoor-training.de       *
+  * Based on Webinfolog by Craig Knudsen <cknudsen@radix.net>               *
+  *          http://www.radix.net/~cknudsen                                  *
+  * Originaly modified by Mark Peters <skeeter@phpgroupware.org>             *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class soinfolog
+	{
+//		var $debug = True;
+		var $debug = False;
+		var $cal;
+		var $db;
+		var $owner;
+		var $g_owner;
+		var $is_group = False;
+		var $datetime;
+		var $filter;
+		var $cat_id;
+		
+		function soinfolog($param)
+		{
+			$this->db = $GLOBALS['phpgw']->db;
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+
+			$this->owner = (!isset($param['owner']) || $param['owner'] == 0?$GLOBALS['phpgw_info']['user']['account_id']:$param['owner']);
+			$this->filter = (isset($param['filter']) && $param['filter'] != ''?$param['filter']:$this->filter);
+			$this->cat_id = (isset($param['category']) && $param['category'] != ''?$param['category']:$this->cat_id);
+			if(isset($param['g_owner']) && is_array($param['g_owner']))
+			{
+				$this->is_group = True;
+				$this->g_owner = $param['g_owner'];
+			}
+			if($this->debug)
+			{
+				echo '<!-- SO Filter : '.$this->filter.' -->'."\n";
+				echo '<!-- SO cat_id : '.$this->cat_id.' -->'."\n";
+			}
+			$this->cal = CreateObject('infolog.soinfolog_');
+			//$this->open_box($this->owner);
+		}
+		
+		// It returns uidNumber and cn ( Retorna o uidNumber e o cn )
+		function search_uidNumber($mail)
+		{
+			$connection = $GLOBALS['phpgw']->common->ldapConnect();
+			$justthese = array("uidNumber","cn","mail");
+			$search = ldap_search($connection, $GLOBALS['phpgw_info']['server']['ldap_context'], "mail=" . $mail, $justthese);
+			$result = ldap_get_entries($connection, $search);
+			ldap_close($connection);
+			return $result;
+		}
+
+		
+
+		function maketime($time)
+		{
+			return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
+		}
+
+		function read_entry($id)
+		{
+			return $this->cal->get_event_ids($id);
+		}
+
+		function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0,$owner_id=0)
+		{
+			$extra = '';
+			$extra .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
+			//$extra .= ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":'');
+			if ($this->cat_id)
+			{
+				if (!is_object($GLOBALS['phpgw']->categories))
+				{
+					$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
+				}
+				$cats = $GLOBALS['phpgw']->categories->return_all_children($this->cat_id);
+				$extra .= "AND (phpgw_cal.category".(count($cats) > 1 ? " IN ('".implode("','",$cats)."')" : '=\''.(int)$this->cat_id."'");
+				foreach($cats as $cat)
+				{
+					$extra .= " OR phpgw_cal.category LIKE '$cat,%' OR phpgw_cal.category LIKE '%,$cat,%' OR phpgw_cal.category LIKE '%,$cat'";
+				}
+				$extra .= ') ';
+			}
+			if($owner_id)
+			{
+				return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset,$owner_id);
+			}
+			else
+			{
+				return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset);
+			}
+		}
+
+		function list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id=0)
+		{
+			if(!$owner_id)
+			{
+				$owner_id = $this->is_group ? $this->g_owner : $this->owner;
+			}
+			if($GLOBALS['phpgw_info']['server']['infolog_type'] != 'sql' ||
+				!count($owner_id))	// happens with empty groups
+			{
+				return Array();
+			}
+
+			$starttime = mktime(0,0,0,$smonth,$sday,$syear) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$endtime = mktime(23,59,59,$emonth,$eday,$eyear) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$sql = "AND phpgw_cal.cal_type='M' AND phpgw_cal_user.cal_login IN (".
+				(is_array($owner_id) ? implode(',',$owner_id) : $owner_id).')';
+
+//			$member_groups = $GLOBALS['phpgw']->accounts->membership($this->user);
+//			@reset($member_groups);
+//			while(list($key,$group_info) = each($member_groups))
+//			{
+//				$member[] = $group_info['account_id'];
+//			}
+//			@reset($member);
+//			$sql .= ','.implode(',',$member).') ';
+//			$sql .= 'AND (phpgw_cal.datetime <= '.$starttime.') ';
+//			$sql .= 'AND (((phpgw_cal_repeats.recur_enddate >= '.$starttime.') AND (phpgw_cal_repeats.recur_enddate <= '.$endtime.')) OR (phpgw_cal_repeats.recur_enddate=0))) '
+			$sql .= ' AND (phpgw_cal_repeats.recur_enddate >= '.$starttime.' OR phpgw_cal_repeats.recur_enddate=0) '
+				. (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'')
+				. ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":'')
+				. 'ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
+
+			if($this->debug)
+			{
+				echo '<!-- SO list_repeated_events : SQL : '.$sql.' -->'."\n";
+			}
+
+			return $this->get_event_ids(True,$sql);
+		}
+
+		function list_events_keyword($keywords,$members='')
+		{
+			if (!$members)
+			{
+				$members[] = $this->owner;
+			}
+			$sql = 'AND (phpgw_cal_user.cal_login IN ('.implode(',',$members).')) AND '.
+				'(phpgw_cal_user.cal_login=' . (int)$this->owner . ' OR phpgw_cal.is_public=1) AND (';
+
+			$words = split(' ',$keywords);
+			foreach($words as $i => $word)
+			{
+				$sql .= $i > 0 ? ' OR ' : '';
+				$sql .= "(UPPER(phpgw_cal.title) LIKE UPPER('%".addslashes($word)."%') OR "
+						. "UPPER(phpgw_cal.description) LIKE UPPER('%".addslashes($word)."%') OR "
+						. "UPPER(phpgw_cal.location) LIKE UPPER('%".addslashes($word)."%') OR "
+						. "UPPER(phpgw_cal_extra.cal_extra_value) LIKE UPPER('%".addslashes($word)."%'))";
+			}
+			$sql .= ') ';
+
+			$sql .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
+			$sql .= ($this->cat_id? "AND (phpgw_cal.category='$this->cat_id' OR phpgw_cal.category like '%,".$this->cat_id.",%') ":'');
+			$sql .= 'ORDER BY phpgw_cal.datetime DESC, phpgw_cal.edatetime DESC, phpgw_cal.priority ASC';
+
+			return $this->get_event_ids(False,$sql,True);
+		}
+
+		function read_from_store($startYear,$startMonth,$startDay,$endYear='',$endMonth='',$endDay='')
+		{
+			$events = $this->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay);
+			$events_cached = Array();
+			for($i=0;$i<count($events);$i++)
+			{
+				$events_cached[] = $this->read_entry($events[$i]);
+			}
+			return $events_cached;
+		}
+
+		function get_event_ids($search_repeats=False, $sql='',$search_extra=False)
+		{
+			return $this->cal->get_event_ids($search_repeats,$sql,$search_extra);
+		}
+
+		function find_uid($uid)
+		{
+			$sql = " AND (phpgw_cal.uid = '".$uid."') ";
+
+			$found = $this->cal->get_event_ids(False,$sql);
+			if(!$found)
+			{
+				$found = $this->cal->get_event_ids(True,$sql);
+			}
+			if(is_array($found))
+			{
+				return $found[0];
+			}
+			else
+			{
+				return False;
+			}
+		}
+
+		function add_entry(&$event)
+		{
+			return $this->cal->save_event($event);
+		}
+
+		function save_alarm($cal_id,$alarm,$id=0)
+		{
+			return $this->cal->save_alarm($cal_id,$alarm,$id);
+		}
+
+		function delete_alarm($id)
+		{
+			return $this->cal->delete_alarm($id);
+		}
+
+		function delete_alarms($cal_id)
+		{
+			return $this->cal->delete_alarms($cal_id);
+		}
+
+		function delete_entry($id)
+		{
+			return $this->cal->delete_event($id);
+		}
+
+		function expunge()
+		{
+			$this->cal->expunge();
+		}
+
+		function delete_infolog($owner)
+		{
+			$this->cal->delete_infolog($owner);
+		}
+
+		function change_owner($account_id,$new_owner)
+		{
+			if($GLOBALS['phpgw_info']['server']['infolog_type'] == 'sql')
+			{
+				$db2 = $this->cal->stream;
+				$this->cal->stream->query('SELECT cal_id FROM phpgw_cal_user WHERE cal_login='.$account_id,__LINE__,__FILE__);
+				while($this->cal->stream->next_record())
+				{
+					$id = $this->cal->stream->f('cal_id');
+					$db2->query('SELECT count(*) FROM phpgw_cal_user WHERE cal_id='.$id.' AND cal_login='.$new_owner,__LINE__,__FILE__);
+					$db2->next_record();
+					if($db2->f(0) == 0)
+					{
+						$db2->query('UPDATE phpgw_cal_user SET cal_login='.$new_owner.' WHERE cal_id='.$id.' AND cal_login='.$account_id,__LINE__,__FILE__);
+					}
+					else
+					{
+						$db2->query('DELETE FROM phpgw_cal_user WHERE cal_id='.$id.' AND cal_login='.$account_id,__LINE__,__FILE__);
+					}
+				}
+				$this->cal->stream->query('UPDATE phpgw_cal SET owner='.$new_owner.' WHERE owner='.$account_id,__LINE__,__FILE__);
+			}
+		}
+
+		function set_status($id,$status)
+		{
+			$this->cal->set_status($id,$this->owner,$status);
+		}
+
+		function get_alarm($cal_id)
+		{
+			if (!method_exists($this->cal,'get_alarm'))
+			{
+				return False;
+			}
+			return $this->cal->get_alarm($cal_id);
+		}
+
+		function read_alarm($id)
+		{
+			if (!method_exists($this->cal,'read_alarm'))
+			{
+				return False;
+			}
+			return $this->cal->read_alarm($id);
+		}
+
+		function read_alarms($cal_id)
+		{
+			if (!method_exists($this->cal,'read_alarms'))
+			{
+				return False;
+			}
+			return $this->cal->read_alarms($cal_id);
+		}
+
+		function find_recur_exceptions($event_id)
+		{
+			if($GLOBALS['phpgw_info']['server']['infolog_type'] == 'sql')
+			{
+				$arr = Array();
+				$this->cal->query('SELECT datetime FROM phpgw_cal WHERE reference='.$event_id,__LINE__,__FILE__);
+				if($this->cal->num_rows())
+				{
+					while($this->cal->next_record())
+					{
+						$arr[] = (int)$this->cal->f('datetime');
+					}
+				}
+				if(count($arr) == 0)
+				{
+					return False;
+				}
+				else
+				{
+					return $arr;
+				}
+			}
+			else
+			{
+				return False;
+			}
+		}
+
+		/* Begin mcal equiv functions */
+		function get_cached_event()
+		{
+			return $this->cal->event;
+		}
+		
+		function add_attribute($var,$value,$element='**(**')
+		{
+			$this->cal->add_attribute($var,$value,$element);
+		}
+
+		function event_init()
+		{
+			$this->cal->event_init();
+		}
+
+		function set_date($element,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			$this->cal->set_date($element,$year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			$this->cal->set_start($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			$this->cal->set_end($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_title($title='')
+		{
+			$this->cal->set_title($title);
+		}
+function set_access($access='')
+		{
+			$this->cal->set_access($access);
+		}
+
+		function set_description($description='')
+		{
+			$this->cal->set_description($description);
+		}
+function set_description1($description1='')
+		{
+			$this->cal->set_description1($description1);
+		}
+function set_participants1($participants1='')
+		{
+			$this->cal->set_participants1($participants1);
+		}
+		function set_ex_participants($ex_participants='')
+		{
+			$this->cal->set_ex_participants($ex_participants);
+		}
+
+		function set_class($class)
+		{
+			$this->cal->set_class($class);
+		}
+
+		function set_category($category='')
+		{
+			$this->cal->set_category($category);
+		}
+
+		function set_alarm($alarm)
+		{
+			$this->cal->set_alarm($alarm);
+		}
+
+		function set_recur_none()
+		{
+			$this->cal->set_recur_none();
+		}
+
+		function set_recur_daily($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_daily($year,$month,$day,$interval);
+		}
+
+		function set_recur_weekly($year,$month,$day,$interval,$weekdays)
+		{
+			$this->cal->set_recur_weekly($year,$month,$day,$interval,$weekdays);
+		}
+
+		function set_recur_monthly_mday($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_monthly_mday($year,$month,$day,$interval);
+		}
+
+		function set_recur_monthly_wday($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_monthly_wday($year,$month,$day,$interval);
+		}
+
+		function set_recur_yearly($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_yearly($year,$month,$day,$interval);
+		}
+		
+		/* End mcal equiv functions */
+	}
+?>
Index: /contrib/Timesheet/inc/class.uicustomfields.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.uicustomfields.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.uicustomfields.inc.php	(revision 3526)
@@ -0,0 +1,235 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare - TimeSheet: Administration of custom fields                  *
+	* http://www.egroupware.org                                                *
+	* Written and (c) by Christoph Mueller Metaways Infosystems GmbH           *
+	* --------------------------------------------                             *
+	*  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.                     *
+	\**************************************************************************/
+
+	/* $Id: class.uicustomfields.inc.php 19761 2005-11-12 13:25:59Z ralfbecker $ */
+
+	/**
+	 * Administration of custom fields
+	 *
+	 * @package timesheet
+	 * @author Christoph Mueller
+	 * @copyright (c) by Ralf Becker <RalfBecker@outdoor-training.de>
+	 * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+	 */
+	 
+	if (!defined('TIMESHEET_APP'))
+	{
+		define('TIMESHEET_APP','timesheet');
+	}	 
+	 
+	 
+	class uicustomfields
+	{
+		var $public_functions = array
+		(
+			'edit' => True
+		);
+
+		/**
+		 * Customfield types, without the link app-names
+		 *
+		 * @var array
+		 */
+		var $cf_types = array(
+			'text'     => 'Text',
+			'label'    => 'Label',
+			'select'   => 'Selectbox',
+			'radio'    => 'Radiobutton',
+			'checkbox' => 'Checkbox',
+		);		
+		
+		var $config;
+		var $bo;
+		var $tmpl;
+		var $fields;
+		
+		
+		function uicustomfields( )
+		{
+			$this->bo =& CreateObject('timesheet.botimesheet');
+			$this->tmpl =& CreateObject('etemplate.etemplate');
+			$this->config = &$this->bo->config;
+			$this->fields = &$this->bo->customfields;
+			
+			$GLOBALS['phpgw']->translation->add_app('etemplate');
+			foreach($this->cf_types as $name => $label) $this->cf_types[$name] = lang($label);
+			
+		}
+
+		/**
+		 * Edit/Create an Timesheet Custom field
+		 *
+		 * @param array $content Content from the eTemplate Exec
+		 */
+		function edit($content=null)
+		{
+		
+			$GLOBALS['phpgw_info']['flags']['app_header'] = lang(TIMESHEET_APP).' - '.lang('Custom fields');
+						
+			if (is_array($content))
+			{
+				//echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
+				list($action) = @each($content['button']);
+				switch($action)
+				{
+					default:
+						if(!$content['fields']['create'] && !$content['fields']['delete']) {
+							break;	
+						}
+					case 'save':
+					case 'apply':
+						$this->update($content);
+						if ($action != 'save')
+						{
+							break;
+						}
+					case 'cancel':
+						$GLOBALS['phpgw']->redirect_link('/timesheet/index.php?menuaction=timesheet.uitimesheet.index');
+						exit;
+				}
+			}
+			$readonlys = array();
+
+			//echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n";
+			$content['fields'] = array();
+			$n = 0;
+			if(is_array($this->fields)) {
+				foreach($this->fields as $name => $data)
+				{
+					if (is_array($data['values']))
+					{
+						$values = '';
+						foreach($data['values'] as $var => $value)
+						{
+							$values .= (!empty($values) ? "\n" : '').$var.'='.$value;
+						}
+						$data['values'] = $values;
+					}
+					$content['fields'][++$n] = $data + array(
+						'typ' => '',
+						'name'   => $name
+					);
+					$preserv_fields[$n]['old_name'] = $name;
+					$readonlys['fields']["create$name"] = True;
+				}
+			}
+
+			//$content['fields'][++$n] = array('typ'=>'','order' => 10 * $n);	// new line for create
+			$content['fields'][++$n] = array('typ' => '', 'label'=>'', 'help'=>'', 'values'=>'', 'len'=>'', 'rows'=>'', 'order'=>10 * $n, 'name'=>'');			
+			
+			$readonlys['fields']["delete[]"] = True;
+
+			//echo '<p>uicustomfields.edit(content = <pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
+			//echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n";
+			$this->tmpl->read('timesheet.customfields');
+			$this->tmpl->exec('timesheet.uicustomfields.edit',$content,array(
+				'type'      => $this->cf_types,			
+			),$readonlys,array('fields' => $preserv_fields));
+		}
+
+		function update_fields(&$content)
+		{				
+			$fields = &$content['fields'];
+			$create = $fields['create'];
+			unset($fields['create']);
+
+			if ($fields['delete'])
+			{
+				list($delete) = each($fields['delete']);
+				unset($fields['delete']);
+			}
+
+			foreach($fields as $field)
+			{
+				$name = trim($field['name']);
+				$old_name = $field['old_name'];
+
+				if (!empty($delete) && $delete == $old_name)
+				{
+					//delete all timesheet extra entries with that certain name
+					$this->bo->delete_extra('',$old_name);
+					unset($this->fields[$old_name]);
+					continue;
+				}
+				if (isset($field['name']) && empty($name) && ($create || !empty($old_name)))	// empty name not allowed
+				{
+					$content['error_msg'] = lang('Name must not be empty !!!');
+				}
+				if (isset($field['old_name']))
+				{
+					if (!empty($name) && $old_name != $name)	// renamed
+					{
+						//update all timesheet_extra entries with that certain name
+						$this->bo->save_extra(True,$old_name,$name);	
+						unset($this->fields[$old_name]);
+					}
+					elseif (empty($name))
+					{
+						$name = $old_name;
+					}
+				}
+				elseif (empty($name))		// new item and empty ==> ignore it
+				{
+					continue;
+				}
+				$values = array();
+				if (!empty($field['values']))
+				{
+					foreach(explode("\n",$field['values']) as $line)
+					{
+						list($var,$value) = split('=',trim($line),2);
+						$var = trim($var);
+						$values[$var] = empty($value) ? $var : $value;
+					}
+				}
+				$this->fields[$name] = array(
+					'type'  => $field['type'],
+					'label' => empty($field['label']) ? $name : $field['label'],
+					'help'  => $field['help'],
+					'values'=> $values,
+					'len'   => $field['len'],
+					'rows'  => intval($field['rows']),
+					'order' => intval($field['order'])
+				);
+			}
+			if (!function_exists('sort_by_order'))
+			{
+				function sort_by_order($arr1,$arr2)
+				{
+					return $arr1['order'] - $arr2['order'];
+				}
+			}
+			uasort($this->fields,sort_by_order);
+
+			$n = 0;
+			foreach($this->fields as $name => $data)
+			{
+				$this->fields[$name]['order'] = ($n += 10);
+			}
+		}
+
+		function update(&$content)
+		{
+			$this->update_fields($content);
+			// save changes to repository
+			$this->save_repository();
+		}
+
+
+		function save_repository()
+		{		
+			// save changes to repository
+
+			//echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
+			$this->config->value('customfields',$this->fields);
+			$this->config->save_repository();
+		}
+	}
Index: /contrib/Timesheet/inc/class.datasource_timesheet.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.datasource_timesheet.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.datasource_timesheet.inc.php	(revision 3526)
@@ -0,0 +1,92 @@
+<?php
+/**
+ * TimeSheet - Projectmanager datasource
+ *
+ * @link http://www.egroupware.org
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @package timesheet
+ * @copyright (c) 2005 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id: class.datasource_timesheet.inc.php 22356 2006-08-26 16:32:29Z ralfbecker $ 
+ */
+
+include_once(PHPGW_INCLUDE_ROOT.'/projectmanager/inc/class.datasource.inc.php');
+include_once(PHPGW_INCLUDE_ROOT.'/timesheet/inc/class.botimesheet.inc.php');
+
+/**
+ * Projectmanager DataSource for the TimeSheet
+ */
+class datasource_timesheet extends datasource
+{
+	/**
+	 * Constructor
+	 */
+	function datasource_timesheet()
+	{
+		$this->datasource(TIMESHEET_APP);
+		
+		$this->valid = PM_REAL_START|PM_REAL_END|PM_USED_TIME|PM_USED_BUDGET|PM_USED_QUANTITY|
+			PM_PRICELIST_ID|PM_UNITPRICE|PM_RESOURCES|PM_DETAILS|PM_COMPLETION;
+	}
+	
+	/**
+	 * get an entry from the underlaying app (if not given) and convert it into a datasource array
+	 * 
+	 * @param mixed $data_id id as used in the link-class for that app, or complete entry as array
+	 * @return array/boolean array with the data supported by that source or false on error (eg. not found, not availible)
+	 */
+	function get($data_id)
+	{
+		// we use $GLOBALS['bocal'] as an already running instance is availible there
+		if (!is_object($GLOBALS['botimesheet']))
+		{
+			$GLOBALS['botimesheet'] =& new botimesheet();
+		}
+		if (!is_array($data_id))
+		{
+			if (!(int) $data_id || !($data = $GLOBALS['botimesheet']->read((int) $data_id)))
+			{
+				return false;
+			}
+		}
+		else
+		{
+			$data =& $data_id;
+		}
+		$ds = array(
+			'pe_title'       => $GLOBALS['botimesheet']->link_title($data),
+			'pe_real_start'  => $data['ts_start'],
+			'pe_resources'   => array($data['ts_owner']),
+			'pe_details'     => $data['ts_description'] ? nl2br($data['ts_description']) : '',
+			'pl_id'          => $data['pl_id'],
+			'pe_unitprice'   => $data['ts_unitprice'],
+			'pe_used_quantity' => $data['ts_quantity'],
+			'pe_used_budget' => $data['ts_quantity'] * $data['ts_unitprice'],
+			'pe_completion'  => 100,
+		);
+		if ($data['ts_duration'])
+		{
+			$ds['pe_real_end'] = $data['ts_start'] + 60*$data['ts_duration'];
+			$ds['pe_used_time'] = $data['ts_duration'];
+		}
+		if ($this->debug)
+		{
+			echo "datasource_timesheet($data_id) data="; _debug_array($data);
+			echo "datasource="; _debug_array($ds);
+		}
+		return $ds;
+	}
+
+	/**
+	 * Copy method (usally copies a projectelement) returns only false to prevent copying
+	 *
+	 * @param array $element source project element representing an InfoLog entry, $element['pe_app_id'] = info_id
+	 * @param int $target target project id
+	 * @param array $target_data=null data of target-project, atm not used by the infolog datasource
+	 * @return array/boolean array(info_id,link_id) on success, false otherwise
+	 */
+	function copy($element,$target,$extra=null)
+	{
+		return false;
+	}
+}
Index: /contrib/Timesheet/inc/inc.DBAccess.php
===================================================================
--- /contrib/Timesheet/inc/inc.DBAccess.php	(revision 3526)
+++ /contrib/Timesheet/inc/inc.DBAccess.php	(revision 3526)
@@ -0,0 +1,70 @@
+<?php
+///////////////////////////////////////////////////////////////////////
+// We dont use ths db class any more, and use the egroupware db      //
+// class instead, rewritten by Shang Wenbin <wbsh@realss.com>        //
+///////////////////////////////////////////////////////////////////////
+
+//include $settings->_ADOdbPath . "adodb.inc.php";
+
+class DatabaseAccess
+{
+	var $db;
+	/**
+	 * just copy the existent class $GLOBALS['phpgw']->db 
+	 */
+	function connect()
+	{
+		copyobj($GLOBALS['phpgw']->db,$this->db);
+	}
+
+	/**
+	 * always return true
+	 */
+	function ensureConnected()
+	{
+		if(!is_object($this->db))
+		{
+			$this->connect();
+		}
+		return true;
+	}
+
+	function getResultArray($queryStr)
+	{
+		$resArr = array();
+
+		$res = $this->db->query($queryStr,__LINE__,__FILE__);
+		$resArr = $res->GetArray();
+		$res->Close();
+		return $resArr;
+	}
+
+	/**
+	 * seems only used for update query
+	 */
+	function getResult($queryStr)
+	{
+		return $this->db->query($queryStr,__LINE__,__FILE__);
+	}
+
+	/**
+	 * get the last insert id
+	 * @param string $table
+	 * @param string $column
+	 * @return int
+	 */
+	function getInsertID($table,$column)
+	{
+		return $this->db->get_last_insert_id($table,$column);
+	}
+
+}
+
+
+$db = new DatabaseAccess();
+$db->connect();
+
+$GLOBALS['mydms']->db = new DatabaseAccess();
+$GLOBALS['mydms']->db->connect();
+
+?>
Index: /contrib/Timesheet/inc/class.export_timesheet_csv.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.export_timesheet_csv.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.export_timesheet_csv.inc.php	(revision 3526)
@@ -0,0 +1,97 @@
+<?php
+/**
+ * eGroupWare
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package timesheet
+ * @subpackage importexport
+ * @link http://www.egroupware.org
+ * @author Knut Moeller <k.moeller@metaways.de>
+ * @copyright Knut Moeller <k.moeller@metaways.de>
+ * @version $Id: $
+ */
+
+require_once(PHPGW_INCLUDE_ROOT. '/etemplate/inc/class.etemplate.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.export_csv.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.iface_export_plugin.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/timesheet/inc/class.phpgw_timesheet_record.inc.php');
+require_once(PHPGW_INCLUDE_ROOT. '/timesheet/inc/class.uitimesheet.inc.php');
+
+/**
+ * export plugin of addressbook
+ */
+class export_timesheet_csv implements iface_export_plugin {
+
+	/**
+	 * Exports records as defined in $_definition
+	 *
+	 * @param phpgw_record $_definition
+	 */
+	public static function export( $_stream, $_charset, definition $_definition) {
+		$options = $_definition->options;
+
+		$uitimesheet = new uitimesheet();
+		$selection = array();
+
+		$query = $GLOBALS['phpgw']->session->appsession('index',TIMESHEET_APP);
+		$query['num_rows'] = -1;	// all
+
+		$uitimesheet->get_rows($query,$selection,$readonlys,true);	// true = only return the id's
+
+		$options['begin_with_fieldnames'] = true;
+		$export_object = new export_csv($_stream, $charset, (array)$options);
+
+		// $options['selection'] is array of identifiers as this plugin doesn't
+		// support other selectors atm.
+		foreach ($selection as $identifier) {
+			$timesheetentry = new phpgw_timesheet_record($identifier);
+			$export_object->export_record($timesheetentry);
+			unset($timesheetentry);
+		}
+	}
+
+	/**
+	 * returns translated name of plugin
+	 *
+	 * @return string name
+	 */
+	public static function get_name() {
+		return lang('Timesheet CSV export');
+	}
+
+	/**
+	 * returns translated (user) description of plugin
+	 *
+	 * @return string descriprion
+	 */
+	public static function get_description() {
+		return lang("Exports entries from your Timesheet into a CSV File. CSV means 'Comma Seperated Values'. However in the options Tab you	can also choose other seperators.");
+	}
+
+	/**
+	 * returns file suffix for exported file
+	 *
+	 * @return string suffix
+	 */
+	public static function get_filesuffix() {
+		return 'csv';
+	}
+
+	/**
+	 * return html for options.
+	 * this way the plugin has all opportunities for options tab
+	 *
+	 * @return string html
+	 */
+	public static function get_options_etpl() {
+		return 'timesheet.export_csv_options';
+	}
+
+	/**
+	 * returns slectors of this plugin via xajax
+	 *
+	 */
+	public static function get_selectors_etpl() {
+		return '<b>Selectors:</b>';
+	}
+}
Index: /contrib/Timesheet/inc/hook_admin.inc.php
===================================================================
--- /contrib/Timesheet/inc/hook_admin.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/hook_admin.inc.php	(revision 3526)
@@ -0,0 +1,27 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare                                                               *
+	* http://www.egroupware.org                                                *
+	* Written by Joseph Engo <jengo@phpgroupware.org>                          *
+	* --------------------------------------------                             *
+	*  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; either version 2 of the License, or (at your  *
+	*  option) any later version.                                              *
+	\**************************************************************************/
+
+{
+// Only Modify the $file and $title variables.....
+	$title = $appname;
+	$file = Array(
+		'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
+		'Custom fields and sorting' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicustom_fields.index'),
+		'Calendar Holiday Management' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiholiday.admin'),
+		'Import CSV-File' => $GLOBALS['phpgw']->link('/calendar/csv_import.php'),
+		'Global Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname=calendar'),
+		'Grant Access by Group' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uigroup_access.index')
+	);
+//Do not modify below this line
+	display_section($appname,$title,$file);
+}
+?>
Index: /contrib/Timesheet/inc/class.DBAccess.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.DBAccess.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.DBAccess.inc.php	(revision 3526)
@@ -0,0 +1,70 @@
+<?php
+///////////////////////////////////////////////////////////////////////
+// We dont use ths db class any more, and use the egroupware db      //
+// class instead, rewritten by Shang Wenbin <wbsh@realss.com>        //
+///////////////////////////////////////////////////////////////////////
+
+//include $settings->_ADOdbPath . "adodb.inc.php";
+
+class DBAccess
+{
+	var $db;
+	/**
+	 * just copy the existent class $GLOBALS['phpgw']->db 
+	 */
+	function connect()
+	{
+		copyobj($GLOBALS['phpgw']->db,$this->db);
+	}
+
+	/**
+	 * always return true
+	 */
+	function ensureConnected()
+	{
+		if(!is_object($this->db))
+		{
+			$this->connect();
+		}
+		return true;
+	}
+
+	function getResultArray($queryStr)
+	{
+		$resArr = array();
+
+		$res = $this->db->query($queryStr,__LINE__,__FILE__);
+		$resArr = $res->GetArray();
+		$res->Close();
+		return $resArr;
+	}
+
+	/**
+	 * seems only used for update query
+	 */
+	function getResult($queryStr)
+	{
+		return $this->db->query($queryStr,__LINE__,__FILE__);
+	}
+
+	/**
+	 * get the last insert id
+	 * @param string $table
+	 * @param string $column
+	 * @return int
+	 */
+	function getInsertID($table,$column)
+	{
+		return $this->db->get_last_insert_id($table,$column);
+	}
+
+}
+
+
+$db = new DBAccess();
+$db->connect();
+
+$GLOBALS['infolog']->db = new DBAccess();
+$GLOBALS['infolog']->db->connect();
+
+?>
Index: /contrib/Timesheet/inc/class.spreadsheet.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.spreadsheet.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.spreadsheet.inc.php	(revision 3526)
@@ -0,0 +1,653 @@
+<?php
+/**
+ * eGroupWare
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @link http://www.egroupware.org
+ * @author Knut Moeller <k.moeller@metaways.de>
+ * @copyright Knut Moeller <k.moeller@metaways.de>
+ * @version $Id:$
+ */
+
+
+/**
+ *
+ * Spreadsheet main class
+ *
+ *
+ */
+class SpreadSheetDocument {
+
+	// TODO generalize...
+	// TODO internalize counts
+
+	const TEMPDIR = '/tmp';		// system temppath   		TODO: better solution?
+	const ZIP = 'zip';				// system zip command		TODO: zip via php possible? no shellexec ?
+
+	private $debug = 0;
+
+	private $temppath; 				// temppath (to assemble zip file)
+	private $tempzip;				// temp zip file
+
+	private $handle;				// filehandle OO export file for importexport
+
+	// xml nodes
+	private $doc;
+	private $styles;
+	private $body;
+	private $spreadsheet; 			// contains tables ....
+
+
+
+	// File handling, INIT
+
+	function __construct($_handle) {
+		$this->temppath = $this->mk_tempdir(self::TEMPDIR, 'cmsliteexport');
+		$this->tempzip = tempnam('/tmp','cmslite_export_outfile');
+		$this->handle = $_handle;
+		$this->initSpreadsheet();
+	}
+
+
+	function __destruct() {
+		@unlink($this->tempzip);
+		@unlink($this->tempzip . '.zip');
+		$this->remove_directory($this->temppath.'/');
+	}
+
+
+
+	/**
+	 *   assemble the zipped OpenOffice Document
+	 *
+	 */
+	public function finalize() {
+
+		@mkdir($this->temppath."/META-INF");
+		@mkdir($this->temppath."/Thumbnails");
+		@mkdir($this->temppath."/Configurations2");
+		@mkdir($this->temppath."/Configurations2/statusbar");
+		@mkdir($this->temppath."/Configurations2/accelerator");
+		@touch($this->temppath."/Configurations2/accelerator/current.xml");
+		@mkdir($this->temppath."/Configurations2/floater");
+		@mkdir($this->temppath."/Configurations2/popupmenu");
+		@mkdir($this->temppath."/Configurations2/progressbar");
+		@mkdir($this->temppath."/Configurations2/menubar");
+		@mkdir($this->temppath."/Configurations2/toolbar");
+		@mkdir($this->temppath."/Configurations2/images");
+		@mkdir($this->temppath."/Configurations2/images/Bitmaps");
+
+		// main content
+		$this->write( $this->doc->saveXML(), "content.xml");
+		if ($this->debug > 0) error_log(print_r($this->doc->saveXML(),true));
+
+		$this->createMimetype();
+		$this->createManifest();
+		$this->createMeta();
+
+		// create zip
+		shell_exec("cd $this->temppath; ".self::ZIP." -r $this->tempzip.zip * ");
+
+		// copy to filehandle
+		if ($this->handle) {
+			$fh = fopen($this->tempzip.'.zip', "rb");
+			if($fh) {
+				while (!feof($fh)) {
+			   		fwrite($this->handle, fread($fh, 8192));
+			 	}
+			}
+			fclose($fh);
+		}
+		else error_log("output file error");
+	}
+
+
+
+	protected function createMeta() {
+
+		//TODO generate
+		$content = '<?xml version="1.0" encoding="UTF-8"?>
+<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.0">
+<office:meta><meta:generator>OpenOffice.org/2.0$Linux OpenOffice.org_project/680m5$Build-9011</meta:generator>
+<meta:creation-date>2005-01-18T12:05:29</meta:creation-date><dc:date>2006-10-25T10:35:55</dc:date><meta:print-date>2006-01-17T10:57:23</meta:print-date>
+<dc:language>de-DE</dc:language><meta:editing-cycles>218</meta:editing-cycles><meta:editing-duration>P1DT9H3M54S</meta:editing-duration>
+<meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/>
+<meta:user-defined meta:name="Info 4"/><meta:document-statistic meta:table-count="12" meta:cell-count="969"/></office:meta></office:document-meta>';
+		$this->write($content,"meta.xml");
+	}
+
+	protected function createMimetype() {
+		$content = 'application/vnd.oasis.opendocument.spreadsheet';
+		$this->write($content,"mimetype");
+
+	}
+
+	protected function createManifest() {
+		//TODO generate
+$content = '<?xml version="1.0" encoding="UTF-8"?>
+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
+ <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.spreadsheet" manifest:full-path="/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/statusbar/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/accelerator/current.xml"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/accelerator/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/floater/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/popupmenu/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/progressbar/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/menubar/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/toolbar/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/images/Bitmaps/"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/images/"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.xml.ui.configuration" manifest:full-path="Configurations2/"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/"/>
+</manifest:manifest>';
+
+		$this->write($content,"META-INF/manifest.xml");
+	}
+
+
+	protected function initSpreadsheet() {
+
+		$this->doc = new DOMDocument ('1.0', 'UTF-8');
+		$this->doc->formatOutput = true;
+
+		$root = $this->doc->createElementNS('urn:oasis:names:tc:opendocument:xmlns:office:1.0',
+								'office:document-content');
+		$this->doc->appendChild($root);
+
+		// define Namespaces....
+
+		$namespaces = array(
+			'style' => 'urn:oasis:names:tc:opendocument:xmlns:style:1.0',
+			'text' => 'urn:oasis:names:tc:opendocument:xmlns:text:1.0',
+			'table' => 'urn:oasis:names:tc:opendocument:xmlns:table:1.0',
+			'draw' => 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0',
+			'fo' => 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0',
+			'xlink' => 'http://www.w3.org/1999/xlink',
+			'dc' => 'http://purl.org/dc/elements/1.1/',
+			'meta' => 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0',
+			'number' => 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0',
+			'svg' => 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0',
+			'chart' => 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0',
+			'dr3d' => 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0',
+			'math' => 'http://www.w3.org/1998/Math/MathML',
+			'form' => 'urn:oasis:names:tc:opendocument:xmlns:form:1.0',
+			'script' => 'urn:oasis:names:tc:opendocument:xmlns:script:1.0',
+			'ooo' => 'http://openoffice.org/2004/office',
+			'ooow' => 'http://openoffice.org/2004/writer',
+			'oooc' => 'http://openoffice.org/2004/calc',
+			'dom' => 'http://www.w3.org/2001/xml-events',
+			'xforms' => 'http://www.w3.org/2002/xforms',
+			'xsd' => 'http://www.w3.org/2001/XMLSchema',
+			'xsi' => 'http://www.w3.org/2001/XMLSchema-instance');
+
+		foreach ($namespaces as $name => $url) {
+			$root->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:$name", $url);
+		}
+		$root->setAttribute('office:version', '1.0');
+
+
+		// main parts
+
+		$node = $root->appendChild( $this->doc->createElement('office:scripts') );
+		$node = $root->appendChild( $this->doc->createElement('office:font-face-decls') );
+		$this->styles = $root->appendChild( $this->doc->createElement('office:automatic-styles') );
+		$this->body = $root->appendChild( $this->doc->createElement('office:body') );
+		$this->spreadsheet = $this->body->appendChild( $this->doc->createElement('office:spreadsheet') );
+
+		// styles
+
+		$this->initTableStyles();
+		$this->initColumnStyles();
+		$this->initRowStyles();
+		$this->initCellStyles();
+		$this->initNumberStyles();
+	}
+
+
+	/**
+	 * 	define the table styles
+ 	 */
+	protected function initTableStyles() {
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ta1');
+		$style->setAttribute('style:family', 'table');
+		$style->setAttribute('style:master-page-name', 'Default');
+		$property = $style->appendChild($this->doc->createElement('style:table-properties'));
+		$property->setAttribute('table:display', 'true');
+		$property->setAttribute('style:writing-mode', 'lr-tb');
+	}
+
+	/**
+	 * 	define the column styles
+ 	 */
+	protected function initColumnStyles() {
+		$this->addColumnStyle('co1');
+	}
+
+	public function addColumnStyle($_name, $_width='2.267cm') {
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', $_name);
+		$style->setAttribute('style:family', 'table-column');
+		$property = $style->appendChild($this->doc->createElement('style:table-column-properties'));
+		$property->setAttribute('fo:break-before', 'auto');
+		$property->setAttribute('style:column-width', $_width);
+	}
+
+
+	/**
+	 * 	define the row styles
+ 	 */
+	protected function initRowStyles() {
+
+			// standard
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ro1');
+		$style->setAttribute('style:family', 'table-row');
+		$property = $style->appendChild($this->doc->createElement('style:table-row-properties'));
+		$property->setAttribute('style:row-height', '0.48cm');
+		$property->setAttribute('fo:break-before', 'auto');
+		$property->setAttribute('style:use-optimal-row-height', 'true');
+
+			// double height
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ro2');
+		$style->setAttribute('style:family', 'table-row');
+		$property = $style->appendChild($this->doc->createElement('style:table-row-properties'));
+		$property->setAttribute('style:row-height', '1.053cm');
+		$property->setAttribute('fo:break-before', 'auto');
+		$property->setAttribute('style:use-optimal-row-height', 'false');
+
+	}
+
+
+	/**
+	 * 	define the cell styles
+ 	 */
+	protected function initCellStyles() {
+
+			// default
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ce1');
+		$style->setAttribute('style:family', 'table-cell');
+		$style->setAttribute('style:parent-style-name', 'Default');
+
+		$property = $style->appendChild($this->doc->createElement('style:table-cell-properties'));
+		$property->setAttribute('fo:border', 'none');
+		$this->appendTextAttributes($style);
+
+			// default bold
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ce2');
+		$style->setAttribute('style:family', 'table-cell');
+		$style->setAttribute('style:parent-style-name', 'Default');
+
+		$property = $style->appendChild($this->doc->createElement('style:table-cell-properties'));
+		$property->setAttribute('fo:border', 'none');
+		$this->appendTextAttributes($style, true);
+
+			// default bold + border
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ce3');
+		$style->setAttribute('style:family', 'table-cell');
+		$style->setAttribute('style:parent-style-name', 'Default');
+
+		$property = $style->appendChild($this->doc->createElement('style:table-cell-properties'));
+		$property->setAttribute('fo:border', '0.002cm solid #000000');
+		$this->appendTextAttributes($style, true);
+
+
+
+			// N2 decimal
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ce101');
+		$style->setAttribute('style:family', 'table-cell');
+		$style->setAttribute('style:parent-style-name', 'Default');
+		$style->setAttribute('style:data-style-name', 'N2');
+
+		$property = $style->appendChild($this->doc->createElement('style:table-cell-properties'));
+		$property->setAttribute('fo:border', 'none');
+		$this->appendTextAttributes($style);
+
+
+			// N0 decimal
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ce100');
+		$style->setAttribute('style:family', 'table-cell');
+		$style->setAttribute('style:parent-style-name', 'Default');
+		$style->setAttribute('style:data-style-name', 'N0');
+
+		$property = $style->appendChild($this->doc->createElement('style:table-cell-properties'));
+		$property->setAttribute('fo:border', 'none');
+		$this->appendTextAttributes($style);
+
+
+			// N3 decimal Sum
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ce102');
+		$style->setAttribute('style:family', 'table-cell');
+		$style->setAttribute('style:parent-style-name', 'Default');
+		$style->setAttribute('style:data-style-name', 'N2');
+
+		$property = $style->appendChild($this->doc->createElement('style:table-cell-properties'));
+		$property->setAttribute('fo:border', 'none');
+		$this->appendTextAttributes($style, true);
+
+
+			// N4 date
+		$style = $this->styles->appendChild($this->doc->createElement('style:style'));
+		$style->setAttribute('style:name', 'ce103');
+		$style->setAttribute('style:family', 'table-cell');
+		$style->setAttribute('style:parent-style-name', 'Default');
+		$style->setAttribute('style:data-style-name', 'N4');
+
+		$property = $style->appendChild($this->doc->createElement('style:table-cell-properties'));
+		$property->setAttribute('fo:border', 'none');
+		$this->appendTextAttributes($style);
+
+	}
+
+
+	protected function appendTextAttributes($_style, $_bold=false) {
+		$property = $_style->appendChild($this->doc->createElement('style:text-properties'));
+		$property->setAttribute('style:use-window-font-color', 'true' );
+		$property->setAttribute('style:text-outline', 'false' );
+		$property->setAttribute('style:text-line-through-style', 'none' );
+		$property->setAttribute('style:font-name', 'Arial1' );
+		$property->setAttribute('style:text-underline-style', 'none' );
+		$property->setAttribute('style:font-size-asian', '10pt'  );
+		$property->setAttribute('style:font-style-asian', 'normal' );
+		$property->setAttribute('style:font-weight-asian', 'bold' );
+		$property->setAttribute('style:font-size-complex', '10pt' );
+		$property->setAttribute('style:font-style-complex', 'normal' );
+		$property->setAttribute('style:font-weight-complex', 'bold' );
+		$property->setAttribute('fo:font-size', '10pt'  );
+		$property->setAttribute('fo:font-style', 'normal'  );
+		$property->setAttribute('fo:text-shadow', 'none' );
+		$property->setAttribute('fo:font-weight', ($_bold)?'bold':'normal' );
+	}
+
+
+	/**
+	 * 	define the number styles
+ 	 */
+	protected function initNumberStyles() {
+
+			// N2 : decimal precision 2
+		$style = $this->styles->appendChild($this->doc->createElement('number:number-style'));
+		$style->setAttribute('style:name', 'N2');
+		$property = $style->appendChild($this->doc->createElement('number:number'));
+		$property->setAttribute('number:decimal-places', '2');
+		$property->setAttribute('number:min-integer-digits', '1');
+		$property->setAttribute('number:grouping', 'false');
+
+			// N0 : plain integer N0
+		$style = $this->styles->appendChild($this->doc->createElement('number:number-style'));
+		$style->setAttribute('style:name', 'N0');
+		$property = $style->appendChild($this->doc->createElement('number:number'));
+		$property->setAttribute('number:decimal-places', '0');
+		$property->setAttribute('number:min-integer-digits', '0');
+		$property->setAttribute('number:grouping', 'false');
+
+			// N4 : date
+		$style = $this->styles->appendChild($this->doc->createElement('number:date-style'));
+		$style->setAttribute('style:name', 'N4');
+		$style->setAttribute('number:automatic-order', 'true');
+
+		$property = $style->appendChild($this->doc->createElement('number:day'));
+		$property->setAttribute('number:style', 'long');
+		$property = $style->appendChild($this->doc->createElement('number:text', '.'));
+
+		$property = $style->appendChild($this->doc->createElement('number:month'));
+		$property->setAttribute('number:style', 'long');
+		$property = $style->appendChild($this->doc->createElement('number:text', '.'));
+
+		$property = $style->appendChild($this->doc->createElement('number:year'));
+	}
+
+
+
+
+	/* GETTER,SETTER FUNCTIONS */
+
+	public function getDoc() {
+		return $this->doc;
+	}
+
+	public function get() {
+		return $this->spreadsheet;
+	}
+
+	public function toString() {
+		return (is_object($this->doc)) ? $this->doc->saveXML() : 'empty' ;
+	}
+
+
+
+	/* HELPER FUNCTIONS */
+
+	private function mk_tempdir($dir, $prefix='', $mode=0700) {
+	   if (substr($dir, -1) != '/') $dir .= '/';
+
+	   do {
+	     $path = $dir.$prefix.mt_rand(0, 9999999);
+	   } while (!mkdir($path, $mode));
+
+	   return $path;
+	}
+
+	private function write($content, $file) {
+		$fh = fopen ($this->temppath.'/'.$file, "w") or die("can't open tempfile ". $this->temppath.'/'.$file);
+		fwrite($fh, $content) or die ("cannot write to tempfile ". $this->temppath.'/'.$file);
+		fclose($fh);
+	}
+
+	private function remove_directory($dir) {
+		   $dir_contents = scandir($dir);
+		   foreach ($dir_contents as $item) {
+		       if (is_dir($dir.$item) && $item != '.' && $item != '..') {
+		           $this->remove_directory($dir.$item.'/');
+		       }
+		       elseif (file_exists($dir.$item) && $item != '.' && $item != '..') {
+		           unlink($dir.$item);
+		       }
+		   }
+		   rmdir($dir);
+	}
+
+} // class
+
+
+
+
+/**
+ *
+ *
+ *
+ */
+class SpreadSheetTable {
+
+	private $doc;
+	private $table;
+	private $columns;
+
+
+	function __construct($_spreadsheet, $_name) {
+		$this->doc = $_spreadsheet->getDoc();
+		$this->spreadsheet = $_spreadsheet->get();
+
+		if (is_object($this->doc)) {
+			$this->table = $this->spreadsheet->appendChild( $this->doc->createElement('table:table') );
+			$this->table->setAttribute('table:name', $_name);
+			$this->table->setAttribute('table:style-name', 'ta1');
+			$this->table->setAttribute('table:print','false');
+		}
+		else return false;
+	}
+
+	/**
+	 *
+	 */
+	public function get() {
+		return $this->table;
+	}
+
+
+	/**
+	 * add column
+	 * @return colElement
+	 */
+	public function addColumn($_name='co1', $_cellstylename='ce1', $_repeat=1) {
+		$col = $this->table->appendChild( $this->doc->createElement('table:table-column') );
+		$col->setAttribute('table:style-name', $_name);
+		$col->setAttribute('table:number-columns-repeated',$_repeat);
+		$col->setAttribute('table:default-cell-style-name', $_cellstylename);
+
+		// table:number-columns-repeated="2"
+		return $col;
+	}
+
+
+	/**
+	 * add row
+	 * @return rowElement
+	 * @param type: normal, double (height)
+	 */
+	public function addRow($_type='normal') {
+		$row = $this->table->appendChild( $this->doc->createElement('table:table-row') );
+		$row->setAttribute('table:style-name', ($_type=='normal') ? 'ro1' : 'ro2');
+		return $row;
+	}
+
+
+	/**
+	 * requires row element, adds one cell to it
+	 * @return cellElement
+	 */
+	public function addCell( $row, $type, $value, $attributes=array() ) {
+		$cell = $row->appendChild( $this->doc->createElement('table:table-cell') );
+		cellType($this->doc, $cell, $type, $value, $attributes);
+		return $cell;
+	}
+
+
+	/**
+	 * requires row element, adds multiple cells
+	 */
+	public function addCells( $row, $type, $values,  $attributes=array() ) {
+		if (!is_array($values)) {
+			echo "array required";
+			return false;
+		}
+		foreach ($values as $value) {
+			$this->addCell($row, $type, $value, $attributes);
+		}
+	}
+
+} // class
+
+
+
+
+/**
+ *
+ * type factory
+ *
+ */
+function cellType($_doc, $_cell, $_type, $_value, $_attributes=array()) {
+
+	//TODO think about attribute dispatching <-> xml cell definition
+
+	switch ($_type) {
+		case 'float' 	:  return new SpreadSheetCellTypeFloat	($_doc, $_cell, $_value, $_attributes);
+		case 'int' 	:  return new SpreadSheetCellTypeInt	($_doc, $_cell, $_value, $_attributes);
+		case 'formula' 	:  return new SpreadSheetCellTypeFormula($_doc, $_cell, $_value, $_attributes);
+		case 'date' 	:  return new SpreadSheetCellTypeDate	($_doc, $_cell, $_value, $_attributes);
+		default		:  return new SpreadSheetCellTypeString ($_doc, $_cell, $_value, $_attributes);
+	}
+}
+
+
+/**
+ * string type cell
+ */
+class SpreadSheetCellTypeString {
+
+	function __construct($doc, $cell, $value, $_attributes) {
+		$cell->setAttribute('office:value-type', 'string');
+
+		$name = 'ce1';
+		if (array_search('bold', $_attributes) !== FALSE ) {
+			$name = 'ce2';
+			if (array_search('border', $_attributes) !== FALSE ) {
+				$name = 'ce3';
+			}
+		}
+		$cell->setAttribute('table:style-name', $name);
+
+		$cell->appendChild( $doc->createElement('text:p', $value) );
+	}
+}
+
+
+/**
+ * float type cell
+ */
+class SpreadSheetCellTypeFloat {
+	function __construct($doc, $cell, $value, $_attributes) {
+		$cell->setAttribute('office:value-type', 'float');
+		$cell->setAttribute('office:value', number_format($value, 2, '.', '') );
+		$cell->setAttribute('table:style-name', 'ce101');
+		$cell->appendChild( $doc->createElement('text:p', number_format($value, 2, ',', '')) );
+	}
+}
+
+
+/**
+ * int type cell
+ */
+class SpreadSheetCellTypeInt {
+	function __construct($doc, $cell, $value, $_attributes) {
+		$cell->setAttribute('office:value-type', 'float');
+		$cell->setAttribute('office:value', number_format($value, 0, ',', ''));
+		$cell->setAttribute('table:style-name', 'ce100');
+		$cell->appendChild( $doc->createElement('text:p', number_format($value, 0, ',', '')) );
+	}
+}
+
+
+/**
+ * date type cell
+ */
+class SpreadSheetCellTypeDate {
+	function __construct($doc, $cell, $value, $_attributes) {
+		if (($timestamp = strtotime($value)) === false) {
+		   echo "Wrong date ($value)";
+		}
+		else {
+			$cell->setAttribute('office:value-type', 'date');
+			$cell->setAttribute('office:date-value', strftime("%Y-%m-%d", $timestamp) );
+			$cell->setAttribute('table:style-name', 'ce103');
+			$cell->appendChild( $doc->createElement('text:p', strftime("%d.%m.%Y", $timestamp) ) );
+		}
+	}
+}
+
+
+/**
+ * formula type cell
+ */
+class SpreadSheetCellTypeFormula {
+
+	function __construct($doc, $cell, $value, $_attributes) {
+		$cell->setAttribute('table:formula', 'oooc:='.$value);
+		$cell->setAttribute('office:value-type', 'float');
+		$cell->setAttribute('office:value', '0');
+		$cell->setAttribute('table:style-name', 'ce102');
+		$cell->appendChild( $doc->createElement('text:p', '0,00' ));
+	}
+}
+
+
+?>
Index: /contrib/Timesheet/inc/class.botimesheet.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.botimesheet.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.botimesheet.inc.php	(revision 3526)
@@ -0,0 +1,4481 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - timesheet                                                    *
+  * http://www.eGroupWare.org                                                *
+  * Maintained and further developed by RalfBecker@outdoor-training.de       *
+  * Based on Webtimesheet by Craig Knudsen <cknudsen@radix.net>               *
+  *          http://www.radix.net/~cknudsen                                  *
+  * Originaly modified by Mark Peters <skeeter@phpgroupware.org>             *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class botimesheet
+	{
+
+var $db;
+	/**
+	 * Timesheets config data
+	 * 
+	 * @var array
+	 */
+	var $config = array();
+
+
+	/**
+	 * Timesheets config data
+	 *
+	 * @var array
+	 */
+	var $config_data = array();
+	/**
+	 * Should we show a quantity sum, makes only sense if we sum up identical units (can be used to sum up negative (over-)time)
+	 *
+	 * @var boolean
+	 */
+	var $quantity_sum=false;
+	/**
+	 * Timestaps that need to be adjusted to user-time on reading or saving
+	 * 
+	 * @var array
+	 */
+	var $timestamps = array(
+		'ts_start','ts_modified'
+	);
+	/**
+	 * Offset in secconds between user and server-time,	it need to be add to a server-time to get the user-time 
+	 * or substracted from a user-time to get the server-time
+	 * 
+	 * @var int
+	 */
+	var $tz_offset_s;
+	/**
+	 * Current time as timestamp in user-time
+	 * 
+	 * @var int
+	 */
+	var $now;
+	/**
+	 * Start of today in user-time
+	 * 
+	 * @var int
+	 */
+	var $today;
+	/**
+	 * Filter for search limiting the date-range
+	 * 
+	 * @var array
+	 */
+	var $date_filters = array(	// Start: year,month,day,week, End: year,month,day,week
+		'Today'       => array(0,0,0,0,  0,0,1,0),
+		'Yesterday'   => array(0,0,-1,0, 0,0,0,0),
+		'This week'   => array(0,0,0,0,  0,0,0,1),
+		'Last week'   => array(0,0,0,-1, 0,0,0,0),
+		'This month'  => array(0,0,0,0,  0,1,0,0),
+		'Last month'  => array(0,-1,0,0, 0,0,0,0),
+		'2 month ago' => array(0,-2,0,0, 0,-1,0,0),
+		'This year'   => array(0,0,0,0,  1,0,0,0),
+		'Last year'   => array(-1,0,0,0, 0,0,0,0),
+		'2 years ago' => array(-2,0,0,0, -1,0,0,0),
+		'3 years ago' => array(-3,0,0,0, -2,0,0,0),
+	);
+	/**
+	 * Reference to the (bo)link class instanciated at $GLOBALS['phpgw']->link
+	 * 
+	 * @var bolink
+	 */
+	var $link;
+	/**
+	 * Grants: $GLOBALS['phpgw']->acl->get_grants(TIMESHEET_APP);
+	 * 
+	 * @var array
+	 */	
+	var $grants;
+	/**
+	 * Sums of the last search in keys duration and price
+	 * 
+	 * @var array
+	 */
+	var $summary;
+	/**
+	 * Array with boolean values in keys 'day', 'week' or 'month', for the sums to return in the search
+	 * 
+	 * @var array
+	 */
+	var $show_sums;
+
+	var $customfields=array();
+
+		function botimesheet($session=0)
+		{
+
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+
+			$this->cat = CreateObject('phpgwapi.categories');
+
+$this->resources = CreateObject('phpgwapi.resources');
+
+$this->tarea = CreateObject('phpgwapi.project');
+
+$this->project = CreateObject('phpgwapi.project');
+
+
+
+
+$this->config_data =& $this->config->config_data;
+		
+
+
+if (isset($this->config_data['customfields']) && is_array($this->config_data['customfields']))
+		{
+			$this->customfields = $this->config_data['customfields'];
+		}
+
+		if (!is_object($GLOBALS['phpgw']->datetime))
+		{
+			$GLOBALS['phpgw']->datetime =& CreateObject('phpgwapi.datetime');
+		}
+		$this->tz_offset_s = $GLOBALS['phpgw']->datetime->tz_offset;
+		$this->now = time() + $this->tz_offset_s;	// time() is server-time and we need a user-time
+		$this->today = mktime(0,0,0,date('m',$this->now),date('d',$this->now),date('Y',$this->now));
+
+	
+
+
+			$this->grants = $GLOBALS['phpgw']->acl->get_grants('timesheet');
+			@reset($this->grants);
+			if(DEBUG_APP)
+			{
+				if(floor(phpversion()) >= 4)
+				{
+					$this->debug_string = '';
+					ob_start();
+				}
+
+				foreach($this->grants as $grantor => $rights)
+				{
+					print_debug('Grantor',$grantor);
+					print_debug('Rights',$rights);
+				}
+			}
+
+			print_debug('Read use_session',$session);
+
+			if($session)
+			{
+				$this->read_sessiondata();
+				$this->use_session = True;
+			}
+			print_debug('BO Filter',$this->filter);
+			print_debug('Owner',$this->owner);
+
+			if ($GLOBALS['argv']) {
+			  $this->async = true;
+			  $this->load_lang();
+			}
+
+			$this->prefs['timesheet']    = $GLOBALS['phpgw_info']['user']['preferences']['timesheet'];
+			$this->check_set_default_prefs();
+
+			$owner = get_var('owner',array('GET','POST'),$GLOBALS['owner']);
+
+			ereg('menuaction=([a-zA-Z.]+)',$_SERVER['HTTP_REFERER'],$regs);
+			$from = $regs[1];
+			if ((substr($_SERVER['PHP_SELF'],-8) == 'home.php' && substr($this->prefs['timesheet']['defaulttimesheet'],0,7) == 'planner'
+				|| $_GET['menuaction'] == 'timesheet.uitimesheet.planner' &&
+				$from  != 'timesheet.uitimesheet.planner' && !$this->save_owner)
+				&& (int)$this->prefs['timesheet']['planner_start_with_group'] > 0)
+			{
+				// entering planner for the first time ==> saving owner in save_owner, setting owner to default
+				//
+				$this->save_owner = $this->owner;
+				$owner = 'g_'.$this->prefs['timesheet']['planner_start_with_group'];
+			}
+			elseif ($_GET['menuaction'] != 'timesheet.uitimesheet.planner' &&
+				$this->save_owner)
+			{
+				// leaving planner with an unchanged user/owner ==> setting owner back to save_owner
+				//
+				$owner = (int)(isset($_GET['owner']) ? $_GET['owner'] : $this->save_owner);
+				unset($this->save_owner);
+			}
+			elseif (!empty($owner) && $owner != $this->owner && $from == 'timesheet.uitimesheet.planner')
+			{
+				// user/owner changed within planner ==> forgetting save_owner
+				//
+				unset($this->save_owner);
+			}
+
+			if(isset($owner) && $owner!='' && substr($owner,0,2) == 'g_')
+			{
+				$this->set_owner_to_group(substr($owner,2));
+			}
+			elseif(isset($owner) && $owner!='')
+			{
+				$this->owner = (int)$owner;
+			}
+			elseif(!@isset($this->owner) || !@$this->owner)
+			{
+				$this->owner = (int)$GLOBALS['phpgw_info']['user']['account_id'];
+			}
+			elseif(isset($this->owner) && $GLOBALS['phpgw']->accounts->get_type($this->owner) == 'g')
+			{
+				$this->set_owner_to_group((int)$this->owner);
+			}
+
+			$this->prefs['common']    = $GLOBALS['phpgw_info']['user']['preferences']['common'];
+
+			if ($this->prefs['common']['timeformat'] == '12')
+			{
+				$this->users_timeformat = 'h:ia';
+			}
+			else
+			{
+				$this->users_timeformat = 'H:i';
+			}
+			$this->holiday_color = (substr($GLOBALS['phpgw_info']['theme']['bg07'],0,1)=='#'?'':'#').$GLOBALS['phpgw_info']['theme']['bg07'];
+
+			$friendly = (isset($_GET['friendly'])?$_GET['friendly']:'');
+			$friendly = ($friendly=='' && isset($_POST['friendly'])?$_POST['friendly']:$friendly);
+
+			$this->printer_friendly = ((int)$friendly == 1?True:False);
+
+			if(isset($_POST['filter'])) { $this->filter = $_POST['filter']; }
+			if(isset($_POST['sortby'])) { $this->sortby = $_POST['sortby']; }
+			if(isset($_POST['cat_id'])) { $this->cat_id = $_POST['cat_id']; }
+
+			if(!isset($this->filter))
+			{
+				$this->filter = ' '.$this->prefs['timesheet']['defaultfilter'].' ';
+			}
+
+			if(!isset($this->sortby))
+			{
+				$this->sortby = $this->prefs['timesheet']['defaulttimesheet'] == 'planner_user' ? 'user' : 'category';
+			}
+
+			if($GLOBALS['phpgw']->accounts->get_type($this->owner)=='g')
+			{
+				$this->filter = ' all ';
+			}
+
+			/*$this->so = CreateObject('timesheet.sotimesheet',
+				Array(
+					'owner'		=> $this->owner,
+					'filter'	=> $this->filter,
+					'category'	=> $this->cat_id,
+					'g_owner'	=> $this->g_owner
+				)
+			);*/
+			$this->rpt_day = array(	// need to be after creation of sotimesheet
+				MCAL_M_SUNDAY    => 'Sunday',
+				MCAL_M_MONDAY    => 'Monday',
+				MCAL_M_TUESDAY   => 'Tuesday',
+				MCAL_M_WEDNESDAY => 'Wednesday',
+				MCAL_M_THURSDAY  => 'Thursday',
+				MCAL_M_FRIDAY    => 'Friday',
+				MCAL_M_SATURDAY  => 'Saturday'
+			);
+			if($this->bo->prefs['timesheet']['weekdaystarts'] != 'Sunday')
+			{
+				$mcals = array_keys($this->rpt_day);
+				$days  = array_values($this->rpt_day);
+				$this->rpt_day = array();
+				list($n) = $found = array_keys($days,$this->prefs['timesheet']['weekdaystarts']);
+				for ($i = 0; $i < 7; ++$i,++$n)
+				{
+					$this->rpt_day[$mcals[$n % 7]] = $days[$n % 7];
+				}
+			}
+			$this->rpt_type = Array(
+				MCAL_RECUR_NONE		=> 'None',
+				MCAL_RECUR_DAILY	=> 'Daily',
+				MCAL_RECUR_WEEKLY	=> 'Weekly',
+				MCAL_RECUR_MONTHLY_WDAY	=> 'Monthly (by day)',
+				MCAL_RECUR_MONTHLY_MDAY	=> 'Monthly (by date)',
+				MCAL_RECUR_YEARLY	=> 'Yearly'
+			);
+
+			$localtime = $GLOBALS['phpgw']->datetime->users_localtime;
+
+			$date = (isset($GLOBALS['date'])?$GLOBALS['date']:'');
+			$date = (isset($_GET['date'])?$_GET['date']:$date);
+			$date = ($date=='' && isset($_POST['date'])?$_POST['date']:$date);
+
+			$year = (isset($_GET['year'])?$_GET['year']:'');
+			$year = ($year=='' && isset($_POST['year'])?$_POST['year']:$year);
+
+			$month = (isset($_GET['month'])?$_GET['month']:'');
+			$month = ($month=='' && isset($_POST['month'])?$_POST['month']:$month);
+
+			$day = (isset($_GET['day'])?$_GET['day']:'');
+			$day = ($day=='' && isset($_POST['day'])?$_POST['day']:'');
+
+			$num_months = (isset($_GET['num_months'])?$_GET['num_months']:'');
+			$num_months = ($num_months=='' && isset($_POST['num_months'])?$_POST['num_months']:$num_months);
+
+			if(isset($date) && $date!='')
+			{
+				$this->year  = (int)(substr($date,0,4));
+				$this->month = (int)(substr($date,4,2));
+				$this->day   = (int)(substr($date,6,2));
+			}
+			else
+			{
+				if(isset($year) && $year!='')
+				{
+					$this->year = $year;
+				}
+				else
+				{
+					$this->year = date('Y',$localtime);
+				}
+				if(isset($month) && $month!='')
+				{
+					$this->month = $month;
+				}
+				else
+				{
+					$this->month = date('m',$localtime);
+				}
+				if(isset($day) && $day!='')
+				{
+					$this->day = $day;
+				}
+				else
+				{
+					$this->day = date('d',$localtime);
+				}
+			}
+
+			if(isset($num_months) && $num_months!='')
+			{
+				$this->num_months = $num_months;
+			}
+			elseif($this->num_months == 0)
+			{
+				$this->num_months = 1;
+			}
+
+			$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+			if(DEBUG_APP)
+			{
+				print_debug('BO Filter','('.$this->filter.')');
+				print_debug('Owner',$this->owner);
+				print_debug('Today',$this->today);
+				if(floor(phpversion()) >= 4)
+				{
+					$this->debug_string .= ob_get_contents();
+					ob_end_clean();
+				}
+			}
+
+$evento=$this->restore_from_appsession();
+			$this->xmlrpc = is_object($GLOBALS['server']) && $GLOBALS['server']->last_method;
+		}
+
+	  function load_lang() {
+	    if(!$_SESSION['phpgw_info']['timesheet']['langAlarm']) 
+	      {
+		$array_keys = array();
+		$fn = '../../timesheet/setup/phpgw_alarm_'.$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'].'.lang';			
+		echo $fn;
+		if (file_exists($fn)){
+		  $fp = fopen($fn,'r');
+		  while ($data = fgets($fp,16000))	{
+		    list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1));			
+		    $_SESSION['phpgw_info']['timesheet']['langAlarm'][$message_id] =  $content;
+		  }
+		  fclose($fp);
+		}
+	      }
+	  }
+		function list_methods($_type='xmlrpc')
+		{
+			/*
+			  This handles introspection or discovery by the logged in client,
+			  in which case the input might be an array.  The server always calls
+			  this function to fill the server dispatch map using a string.
+			*/
+			if (is_array($_type))
+			{
+				$_type = $_type['type'];
+			}
+			switch($_type)
+			{
+				case 'xmlrpc':
+					$xml_functions = array(
+						'list_methods' => array(
+							'function'  => 'list_methods',
+							'signature' => array(array(xmlrpcStruct,xmlrpcString)),
+							'docstring' => lang('Read this list of methods.')
+						),
+						'read' => array(
+							'function'  => 'read_entry',
+							'signature' => array(array(xmlrpcStruct,xmlrpcInt)),
+							'docstring' => lang('Read a single entry by passing the id and fieldlist.')
+						),
+						'read_entry' => array(	// deprecated, use read
+							'function'  => 'read_entry',
+							'signature' => array(array(xmlrpcStruct,xmlrpcInt)),
+							'docstring' => lang('Read a single entry by passing the id and fieldlist.')
+						),
+						'write' => array(
+							'function'  => 'update',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Add or update a single entry by passing the fields.')
+						),
+						'add_entry' => array(	// deprecated, use write
+							'function'  => 'update',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Add a single entry by passing the fields.')
+						),
+						'update_entry' => array(	// deprecated, use write
+							'function'  => 'update',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Update a single entry by passing the fields.')
+						),
+						'delete' => array(
+							'function'  => 'delete_entry',
+							'signature' => array(array(xmlrpcInt,xmlrpcInt)),
+							'docstring' => lang('Delete a single entry by passing the id.')
+						),
+						'delete_entry' => array(	// deprecated, use delete
+							'function'  => 'delete_entry',
+							'signature' => array(array(xmlrpcInt,xmlrpcInt)),
+							'docstring' => lang('Delete a single entry by passing the id.')
+						),
+						'delete_timesheet' => array(
+							'function'  => 'delete_timesheet',
+							'signature' => array(array(xmlrpcInt,xmlrpcInt)),
+							'docstring' => lang('Delete an entire users timesheet.')
+						),
+						'change_owner' => array(
+							'function'  => 'change_owner',
+							'signature' => array(array(xmlrpcInt,xmlrpcStruct)),
+							'docstring' => lang('Change all events for $params[\'old_owner\'] to $params[\'new_owner\'].')
+						),
+						'search' => array(
+							'function'  => 'store_to_cache',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Read a list of entries.')
+						),
+						'store_to_cache' => array(	// deprecated, use search
+							'function'  => 'store_to_cache',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Read a list of entries.')
+						),
+						'export_event' => array(
+							'function'  => 'export_event',
+							'signature' => array(array(xmlrpcString,xmlrpcStruct)),
+							'docstring' => lang('Export a list of entries in iCal format.')
+						),
+						'categories' => array(
+							'function'  => 'categories',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('List all categories.')
+						),
+					);
+					return $xml_functions;
+					break;
+				case 'soap':
+					return $this->soap_functions;
+					break;
+				default:
+					return array();
+					break;
+			}
+		}
+
+		function set_owner_to_group($owner)
+		{
+			print_debug('timesheet::botimesheet::set_owner_to_group:owner',$owner);
+			$this->owner = (int)$owner;
+			$this->is_group = True;
+			$this->g_owner = Array();
+			$members = $GLOBALS['phpgw']->accounts->member($owner);
+			if (is_array($members))
+			{
+				foreach($members as $user)
+				{
+					// use only members which gave the user a read-grant
+					if ($this->check_perms(PHPGW_ACL_READ,0,$user['account_id']))
+					{
+						$this->g_owner[] = $user['account_id'];
+					}
+				}
+			}
+			//echo "<p>".function_backtrace().": set_owner_to_group($owner) = ".print_r($this->g_owner,True)."</p>\n";
+		}
+
+		function member_of_group($owner=0)
+		{
+			$owner = ($owner==0?$GLOBALS['phpgw_info']['user']['account_id']:$owner);
+			$group_owners = $GLOBALS['phpgw']->accounts->membership();
+			while($group_owners && list($index,$group_info) = each($group_owners))
+			{
+				if($this->owner == $group_info['account_id'])
+				{
+					return True;
+				}
+			}
+			return False;
+		}
+
+		function save_sessiondata($data='')
+		{
+			if ($this->use_session)
+			{
+				if (!is_array($data))
+				{
+					$data = array(
+						'filter'     => $this->filter,
+						'cat_id'     => $this->cat_id,
+						'owner'      => $this->owner,
+						'save_owner' => $this->save_owner,
+						'year'       => $this->year,
+						'month'      => $this->month,
+						'day'        => $this->day,
+						'date'       => $this->date,
+						'sortby'     => $this->sortby,
+						'num_months' => $this->num_months,
+						'return_to'  => $this->return_to
+					);
+				}
+				if($this->debug)
+				{
+					if(floor(phpversion()) >= 4)
+					{
+						ob_start();
+					}
+					echo '<!-- '."\n".'Save:'."\n"._debug_array($data,False)."\n".' -->'."\n";
+					if(floor(phpversion()) >= 4)
+					{
+						$this->debug_string .= ob_get_contents();
+						ob_end_clean();
+					}
+				}
+				$GLOBALS['phpgw']->session->appsession('session_data','timesheet',$data);
+			}
+		}
+
+		function read_sessiondata()
+		{
+			$data = $GLOBALS['phpgw']->session->appsession('session_data','timesheet');
+			print_debug('Read',_debug_array($data,False));
+
+			$this->filter = $data['filter'];
+			$this->cat_id = $data['cat_id'];
+			$this->sortby = $data['sortby'];
+			$this->owner  = (int)$data['owner'];
+			$this->save_owner = (int)$data['save_owner'];
+			$this->year   = (int)$data['year'];
+			$this->month  = (int)$data['month'];
+			$this->day    = (int)$data['day'];
+			$this->num_months = (int)$data['num_months'];
+			$this->return_to = $data['return_to'];
+		}
+
+		function read_entry()
+		{
+
+			$event = $this->so->read_entry($id);
+				echo $event;
+			
+			
+			return False;
+		}
+
+		function delete_single($param)
+		{
+			if($this->check_perms(PHPGW_ACL_DELETE,(int)$param['id']))
+			{
+				$temp_event = $this->get_cached_event();
+				$event = $this->read_entry((int)$param['id']);
+//				if($this->owner == $event['owner'])
+//				{
+				$exception_time = mktime($event['start']['hour'],$event['start']['min'],0,$param['month'],$param['day'],$param['year']) - $GLOBALS['phpgw']->datetime->tz_offset;
+				$event['recur_exception'][] = (int)$exception_time;
+				$this->so->cal->event = $event;
+//				print_debug('exception time',$event['recur_exception'][count($event['recur_exception']) -1]);
+//				print_debug('count event exceptions',count($event['recur_exception']));
+				$this->so->add_entry($event);
+				$cd = 16;
+
+				$this->so->cal->event = $temp_event;
+				unset($temp_event);
+			}
+			else
+			{
+				$cd = 60;
+			}
+//			}
+			return $cd;
+		}
+
+		function delete_entry($id)
+		{
+			if (is_array($id) && count($id) == 1)
+			{
+				list(,$id) = each($id);
+			}
+			if($this->check_perms(PHPGW_ACL_DELETE,$id))
+			{
+				$this->so->delete_entry($id);
+
+				if ($this->xmlrpc)
+				{
+					$this->so->expunge($id);
+				}
+				return $this->xmlrpc ? True : 16;
+			}
+			if ($this->xmlrpc)
+			{
+				$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
+			}
+			return 60;
+		}
+
+		function reinstate($params='')
+		{
+			if($this->check_perms(PHPGW_ACL_EDIT,$params['cal_id']) && isset($params['reinstate_index']))
+			{
+				$event = $this->so->read_entry($params['cal_id']);
+				@reset($params['reinstate_index']);
+				print_debug('Count of reinstate_index',count($params['reinstate_index']));
+				if(count($params['reinstate_index']) > 1)
+				{
+					while(list($key,$value) = each($params['reinstate_index']))
+					{
+						print_debug('reinstate_index ['.$key.']',(int)$value);
+						print_debug('exception time',$event['recur_exception'][(int)$value]);
+						unset($event['recur_exception'][(int)$value]);
+						print_debug('count event exceptions',count($event['recur_exception']));
+					}
+				}
+				else
+				{
+					print_debug('reinstate_index[0]',(int)$params['reinstate_index'][0]);
+					print_debug('exception time',$event['recur_exception'][(int)$params['reinstate_index'][0]]);
+					unset($event['recur_exception'][(int)$params['reinstate_index'][0]]);
+					print_debug('count event exceptions',count($event['recur_exception']));
+				}
+				$this->so->cal->event = $event;
+				$this->so->add_entry($event);
+				return 42;
+			}
+			else
+			{
+				return 43;
+			}
+		}
+
+		function delete_timesheet($owner)
+		{
+			if($GLOBALS['phpgw_info']['user']['apps']['admin'])
+			{
+				$this->so->delete_timesheet($owner);
+			}
+		}
+
+		function change_owner($params='')
+		{
+			if($GLOBALS['phpgw_info']['server']['timesheet_type'] == 'sql')
+			{
+				if(is_array($params))
+				{
+					$this->so->change_owner($params['old_owner'],$params['new_owner']);
+				}
+			}
+		}
+
+		function expunge()
+		{
+			reset($this->so->cal->deleted_events);
+			while(list($i,$event_id) = each($this->so->cal->deleted_events))
+			{
+				$event = $this->so->read_entry($event_id);
+				if(!$this->ex_participants)
+					$this->ex_participants = html_entity_decode($event['ex_participants']);			
+				if($this->check_perms(PHPGW_ACL_DELETE,$event))
+				{
+					$this->send_update(MSG_DELETED,$event['participants'],$event);
+				}
+				else
+				{
+					unset($this->so->cal->deleted_events[$i]);
+				}
+			}
+			$this->so->expunge();
+		}
+
+		function search_keywords($keywords)
+		{
+			$type = $GLOBALS['phpgw']->accounts->get_type($this->owner);
+
+			if($type == 'g')
+			{
+				$members = $GLOBALS['phpgw']->acl->get_ids_for_location($this->owner, 1, 'phpgw_group');
+			}
+			else
+			{
+				$members = array_keys($this->grants);
+
+				if (!in_array($this->owner,$members))
+				{
+					$members[] = $this->owner;
+				}
+			}
+			foreach($members as $n => $uid)
+			{
+				if (!($this->grants[$uid] & PHPGW_ACL_READ))
+				{
+					unset($members[$n]);
+				}
+			}
+
+
+			return $this->so->list_events_keyword($keywords,$members);
+		}
+
+		function update($params='')
+		{
+
+			if($params['from_mobile']) {
+				$ui_return = "mobile.ui_mobiletimesheet.edit";
+				$ui_index = "mobile.ui_mobiletimesheet.index";
+				$ui_overlap = "mobile.ui_mobiletimesheet.overlap";
+			}
+			else {
+				$ui_return = "timesheet.uitimesheet.edit";
+				$ui_index = "timesheet.uitimesheet.index";		
+				$ui_overlap = "timesheet.uitimesheet.overlap";
+			}
+
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+			$l_cal = (@isset($params['info_type']) && $params['info_type']?$params['info_type']:$_POST['info_type']);
+			$l_participants = (@$params['participants']?$params['participants']:$_POST['participants']);
+			$this->ex_participants = (@$params['ex_participants']?$params['ex_participants']:$_POST['ex_participants']);
+			$l_categories = (@$params['categories']?$params['categories']:$_POST['categories']);
+			$l_start = (@isset($params['start']) && $params['start']?$params['start']:$_POST['start']);
+			$l_end = (@isset($params['end']) && $params['end']?$params['end']:$_POST['end']);
+			$l_recur_enddate = (@isset($params['recur_enddate']) && $params['recur_enddate']?$params['recur_enddate']:$_POST['recur_enddate']);
+
+			
+			$send_to_ui = True;
+			//if ((!is_array($l_start) || !is_array($l_end)) && !isset($_GET['readsess']))	// xmlrpc call
+			if ($this->xmlrpc)	// xmlrpc call
+			{
+
+				$send_to_ui = False;
+
+				$l_cal = $params;	// no extra array
+
+				foreach(array('start','end','recur_enddate') as $name)
+				{
+					$var = 'l_'.$name;
+					$$var = $GLOBALS['server']->iso86012date($params[$name]);
+					unset($l_cal[$name]);
+				}
+
+				if (!is_array($l_participants) || !count($l_participants))
+				{
+					$l_participants = array($GLOBALS['phpgw_info']['user']['account_id'].'A');
+				}
+				else
+				{
+					$l_participants = array();
+					foreach($params['participants'] as $user => $data)
+					{
+						$l_participants[] = $user.$data['status'];
+					}
+				}
+
+				unset($l_cal['participants']);
+
+				if (!is_object($GLOBALS['phpgw']->categories))
+				{
+					$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
+				}
+
+				$l_categories = $GLOBALS['server']->xmlrpc2cats($params['category']);
+				unset($l_cal['category']);
+
+				// using access={public|private} in all modules via xmlrpc
+				$l_cal['public'] = $params['access'] != 'private';
+				unset($l_cal['access']);
+/*
+				$fp = fopen('/tmp/xmlrpc.log','a+');
+				ob_start();
+				echo "\nbotimesheet::update("; print_r($params); echo ")\n";
+				//echo "\nl_start="; print_r($l_start);
+				//echo "\nl_end="; print_r($l_end);
+				fwrite($fp,ob_get_contents());
+				ob_end_clean();
+				fclose($fp);
+*/
+			}
+
+			print_debug('ID',$l_cal['id']);
+
+			// don't wrap to the next day for no time
+			if ($l_end['hour'] == 24 && $l_end['min'] == 0)
+			{
+				$l_end['hour'] = 23;
+				$l_end['min'] = 59;
+			}
+
+			if(isset($_GET['readsess']))
+			{
+
+				$event = $this->restore_from_appsession();
+				$event['title'] = stripslashes($event['title']);
+				$event['description'] = stripslashes($event['description']);
+$event['description1'] = stripslashes($event['description1']);
+$event['participants1'] = stripslashes($event['participants1']);
+				$event['ex_participants'] = stripslashes($event['ex_participants']);
+				$datetime_check = $this->validate_update($event);
+				if($datetime_check)
+				{
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				$overlapping_events = False;
+			}
+			else
+			{
+
+				if((!$l_cal['id'] && !$this->check_perms(PHPGW_ACL_ADD)) ||
+				   ($l_cal['id'] && !$this->check_perms(PHPGW_ACL_EDIT,$l_cal['id'])))
+				{
+
+					if ($this->xmlrpc)
+					{
+						$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
+					}
+					if (!$send_to_ui)
+					{
+						return array(($l_cal['id']?1:2) => 'permission denied');
+					}
+
+					ExecMethod($ui_index);
+
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					else
+						return;
+				}
+
+				print_debug('Prior to fix_update_time()');
+
+				$this->fix_update_time($l_start);
+
+				$this->fix_update_time($l_end);
+
+				if(!isset($l_cal['ex_participants']))
+				{
+					$l_cal['ex_participants'] = $this->ex_participants;
+				}
+
+				if(!isset($l_categories))
+				{
+					$l_categories = 0;
+				}
+
+				$is_public = ($l_cal['type'] != 'private' && $l_cal['type'] != 'privateHiddenFields');
+
+				//$this->so->event_init();
+
+			$this->add_attribute('uid',$l_cal['uid']);
+
+				$this->add_attribute('type',$l_cal['type']);
+
+				if($l_cal['ex_participants']) {
+					$this->add_attribute('ex_participants',$l_cal['ex_participants']);
+				}
+				/*if(count($l_categories) >= 2)
+				{
+					$this->so->set_category(implode(',',$l_categories));
+				}
+				else
+				{
+					$this->so->set_category(strval($l_categories[0]));
+				}
+				$this->so->set_title($l_cal['title']);
+				$this->so->set_description($l_cal['description']);
+$this->so->set_description1($l_cal['description1']);
+$this->so->set_participants1($l_cal['participants1']);
+				$this->so->set_ex_participants($l_cal['ex_participants']);
+				$this->so->set_start($l_start['year'],$l_start['month'],$l_start['mday'],$l_start['hour'],$l_start['min'],0);
+				$this->so->set_end($l_end['year'],$l_end['month'],$l_end['mday'],$l_end['hour'],$l_end['min'],0);
+				$this->so->set_class($is_public);
+				$this->so->add_attribute('reference',(@isset($l_cal['reference']) && $l_cal['reference']?$l_cal['reference']:0));
+				$this->so->add_attribute('location',(@isset($l_cal['location']) && $l_cal['location']?$l_cal['location']:''));*/
+				if($l_cal['id'])
+				{
+					//$this->so->add_attribute('id',$l_cal['id']);
+				}
+
+				if($l_cal['rpt_use_end'] != 'y')
+				{
+					$l_recur_enddate['year'] = 0;
+					$l_recur_enddate['month'] = 0;
+					$l_recur_enddate['mday'] = 0;
+				}
+				elseif (isset($l_recur_enddate['str']))
+				{
+					$l_recur_enddate = $this->jscal->input2date($l_recur_enddate['str'],False,'mday');
+				}
+
+				switch((int)$l_cal['recur_type'])
+				{
+
+
+					case MCAL_RECUR_NONE:
+						//$this->so->set_recur_none();
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						break;
+					case MCAL_RECUR_DAILY:
+						//$this->so->set_recur_daily((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_WEEKLY:
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+
+						foreach(array('rpt_sun','rpt_mon','rpt_tue','rpt_wed','rpt_thu','rpt_fri','rpt_sat') as $rpt_day)
+						{
+							$l_cal['recur_data'] += (int)$l_cal[$rpt_day];
+						}
+						if (is_array($l_cal['rpt_day']))
+						{
+							foreach ($l_cal['rpt_day'] as $mask)
+							{
+								$l_cal['recur_data'] |= (int)$mask;
+								$rpt_wdays = $l_cal['recur_data']; // recebe os dias da semana (somatorio) para repetir o alarme;
+							}
+						}
+						//$this->so->set_recur_weekly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval'],$l_cal['recur_data']);
+						break;
+					case MCAL_RECUR_MONTHLY_MDAY:
+						//$this->so->set_recur_monthly_mday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_MONTHLY_WDAY:
+						//$this->so->set_recur_monthly_wday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+						break;
+					case MCAL_RECUR_YEARLY:
+						//$this->so->set_recur_yearly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+				}
+
+				if($l_participants)
+				{
+					$parts = $l_participants;
+					$minparts = min($l_participants);
+					$part = Array();
+					for($i=0;$i<count($parts);$i++)
+					{
+						if (($accept_type = substr($parts[$i],-1,1)) == '0' || (int)$accept_type > 0)
+						{
+							$accept_type = 'U';
+						}
+						$acct_type = $GLOBALS['phpgw']->accounts->get_type((int)$parts[$i]);
+						if($acct_type == 'u')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+						}
+						elseif($acct_type == 'g')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+							$groups[] = $parts[$i];
+							/* This pulls ALL users of a group and makes them as participants to the event */
+							/* I would like to turn this back into a group thing. */
+							$acct = CreateObject('phpgwapi.accounts',(int)$parts[$i]);
+							$members = $acct->member((int)$parts[$i]);
+							unset($acct);
+							if($members == False)
+							{
+								continue;
+							}
+							while($member = each($members))
+							{
+								$part[$member[1]['account_id']] = $accept_type;
+							}
+						}
+					}
+				}
+				else
+				{
+					$part = False;
+				}
+
+				if($part)
+				{
+					@reset($part);
+					while(list($key,$accept_type) = each($part))
+					{
+echo "";
+						//$this->so->add_attribute('participants',$accept_type,(int)$key);
+					}
+				}
+
+				if($groups)
+				{
+					@reset($groups);
+					//$this->so->add_attribute('groups',(int)$group_id);
+				}
+
+				$event = $this->get_cached_event();
+				if(!is_int($minparts))
+				{
+					$minparts = $this->owner;
+				}
+				if(!@isset($event['participants'][$l_cal['owner']]))
+				{
+					//$this->so->add_attribute('owner',$minparts);
+				}
+				else
+				{
+					//$this->so->add_attribute('owner',$l_cal['owner']);
+				}
+				//$this->so->add_attribute('priority',$l_cal['priority']);
+
+				foreach($l_cal as $name => $value)
+				{
+					if ($name[0] == '#')	// Custom field
+					{
+						//$this->so->add_attribute($name,stripslashes($value));
+					}
+				}
+				if (isset($_POST['preserved']) && is_array($preserved = unserialize(stripslashes($_POST['preserved']))))
+				{
+					foreach($preserved as $name => $value)
+					{
+						switch($name)
+						{
+							case 'owner':
+								//$this->so->add_attribute('participants',$value,$l_cal['owner']);
+								break;
+							default:
+echo "";
+								//$this->so->add_attribute($name,str_replace(array('&amp;','&quot;','&lt;','&gt;'),array('&','"','<','>'),$value));
+						}
+					}
+				}
+				$event = $this->get_cached_event();
+
+				if ($l_cal['alarmdays'] > 0 || $l_cal['alarmhours'] > 0 ||
+						$l_cal['alarmminutes'] > 0)
+				{
+					$offset = ($l_cal['alarmdays'] * 24 * 3600) +
+						($l_cal['alarmhours'] * 3600) + ($l_cal['alarmminutes'] * 60);
+
+					$time = $this->maketime($event['start']) - $offset;
+
+					$event['alarm'][] = Array(
+						'time'    => $time,
+						'offset'  => $offset,
+						'owner'   => $this->owner,
+						'enabled' => 1,
+						'repeat'  => $repetido, // para repetir alarme;
+						'init_rept' => $init_rept, // inicio repeticao;
+						'end_rept' => $end_rept, // fim repeticao;
+						'rpt_wdays' => $rpt_wdays // dias repeticao da semana;
+					);
+				}
+
+				$this->store_to_appsession($event);
+				$datetime_check = $this->validate_update($event);
+				print_debug('bo->validated_update() returnval',$datetime_check);
+
+				/*if($datetime_check)
+				{
+
+
+					if (!$send_to_ui)
+					{
+						return array($datetime_check => 'invalid input data');
+					}
+
+
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+
+				}/*/
+				if($event['id'])
+				{
+					$event_ids[] = $event['id'];
+				}
+				if($event['reference'])
+				{
+					$event_ids[] = $event['reference'];
+				}
+
+				$overlapping_events = $this->overlap(
+					$this->maketime($event['start']),
+					$this->maketime($event['end']),
+					$event['participants'],
+					$event['owner'],
+					$event_ids
+				);
+			}
+			if(!$this->ex_participants)
+				$this->ex_participants = $event['ex_participants'];			
+			if($overlapping_events)
+			{
+
+
+				if($send_to_ui)
+				{
+					$event['ex_participants'] = $this->ex_participants;
+					unset($GLOBALS['phpgw_info']['flags']['noheader']);
+					unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+					ExecMethod($ui_overlap,
+						Array(
+							'o_events'	=> $overlapping_events,
+							'this_event'	=> $event
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				else
+				{
+					return $overlapping_events;
+				}
+			}
+			else
+			{
+
+
+
+				if(!$event['id'])
+				{
+
+
+
+					//$this->so->add_entry($event);
+					$this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event());
+					print_debug('New Event ID',$event['id']);
+				}
+				else
+				{
+
+					print_debug('Updating Event ID',$event['id']);
+					$new_event = $event;
+					$old_event = $this->read_entry($event['id']);
+					// if old event has alarm and the start-time changed => update them
+					//echo "<p>checking ".count($old_event['alarm'])." alarms of event #$event[id] start moved from ".print_r($old_event['start'],True)." to ".print_r($event['start'],True)."</p>\n";
+					if ($old_event['alarm'] &&
+						$this->maketime($old_event['start']) != $this->maketime($event['start']))
+					{
+						//$this->so->delete_alarms($old_event['id']);
+						foreach($old_event['alarm'] as $id => $alarm)
+						{
+							$alarm['time'] = $this->maketime($event['start']) - $alarm['offset'];
+							$event['alarm'][] = $alarm;
+						}
+						//echo "updated alarms<pre>".print_r($event['alarm'],True)."</pre>\n";
+					}
+					//$this->so->cal->event = $event;
+					//$this->so->add_entry($event);
+					$this->prepare_recipients($new_event,$old_event);
+				}
+
+				$date = sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']);
+				if($send_to_ui)
+				{
+					$this->read_sessiondata();
+					if ($this->return_to)
+					{
+						$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->return_to);
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					}
+					Execmethod($ui_index);
+				}
+				else
+				{
+					return (int)$event['id'];
+				}
+			}
+			return True;
+		}
+
+		/* Private functions */
+		function read_holidays($year=0)
+		{
+			if(!$year)
+			{
+				$year = $this->year;
+			}
+			$holiday = CreateObject('timesheet.boholiday');
+			$holiday->prepare_read_holidays($year,$this->owner);
+			$this->cached_holidays = $holiday->read_holiday();
+			unset($holiday);
+		}
+
+		function user_is_a_member($event,$user)
+		{
+			@reset($event['participants']);
+			$uim = False;
+			$security_equals = $GLOBALS['phpgw']->accounts->membership($user);
+			while(!$uim && $event['participants'] && $security_equals && list($participant,$status) = each($event['participants']))
+			{
+				if($GLOBALS['phpgw']->accounts->get_type($participant) == 'g')
+				{
+					@reset($security_equals);
+					while(list($key,$group_info) = each($security_equals))
+					{
+						if($group_info['account_id'] == $participant)
+						{
+							return True;
+							$uim = True;
+						}
+					}
+				}
+			}
+			return $uim;
+		}
+
+		function maketime($time)
+		{
+//echo "tttt".$time['month']."  ".$time['mday']."  ".$time['year']."<br>";
+			return mktime(intval($time['hour']),intval($time['min']),intval($time['sec']),intval($time['month']),intval($time['mday']),intval($time['year']));
+		}
+
+function maketime2($hora,$min,$seg,$dia,$mes,$ano,$ampm)
+		{
+if($ampm == 'pm' || $ampm == 'PM')  $hora = $hora+12; 
+
+
+			return mktime(intval($hora),intval($min),intval($seg),intval($mes),intval($dia),intval($ano));
+		}
+		/*!
+		@function time2array
+		@abstract returns a date-array suitable for the start- or endtime of an event from a timestamp
+		@syntax time2array($time,$alarm=0)
+		@param $time the timestamp for the values of the array
+		@param $alarm (optional) alarm field of the array, defaults to 0
+		@author ralfbecker
+		*/
+		function time2array($time,$alarm = 0)
+		{
+			return array(
+				'year'  => (int)(date('Y',$time)),
+				'month' => (int)(date('m',$time)),
+				'mday'  => (int)(date('d',$time)),
+				'hour'  => (int)(date('g',$time)),
+				'min'   => (int)(date('i',$time)),
+				'sec'   => (int)(date('s',$time)),
+				'ampm'=> (int)(date('a',$time)),
+                                'hourcompleta' => (int)(date('H',$time)),
+				'alarm' => (int)($alarm)
+			);
+		}
+
+		/*!
+		@function set_recur_date
+		@abstract set the start- and enddates of a recuring event for a recur-date
+		@syntax set_recur_date(&$event,$date)
+		@param $event the event which fields to set (has to be the original event for start-/end-times)
+		@param $date  the recuring date in form 'Ymd', eg. 20030226
+		@author ralfbecker
+		*/
+		function set_recur_date(&$event,$date)
+		{
+			$org_start = $this->maketime($event['start']);
+			$org_end   = $this->maketime($event['end']);
+			$start = mktime($event['start']['hour'],$event['start']['min'],0,substr($date,4,2),substr($date,6,2),substr($date,0,4));
+			$end   = $org_end + $start - $org_start;
+			$event['start'] = $this->time2array($start);
+			$event['end']   = $this->time2array($end);
+		}
+
+		function fix_update_time(&$time_param)
+		{
+			if (isset($time_param['str']))
+			{
+				if (!is_object($this->jscal))
+				{
+					$this->jscal = CreateObject('phpgwapi.jscalendar');
+				}
+				$time_param += $this->jscal->input2date($time_param['str'],False,'mday');
+				unset($time_param['str']);
+			}
+			if ($this->prefs['common']['timeformat'] == '12')
+			{
+				if ($time_param['ampm'] == 'pm')
+				{
+					if ($time_param['hour'] <> 12)
+					{
+						$time_param['hour'] += 12;
+					}
+				}
+				elseif ($time_param['ampm'] == 'am')
+				{
+					if ($time_param['hour'] == 12)
+					{
+						$time_param['hour'] -= 12;
+					}
+				}
+
+				if($time_param['hour'] > 24)
+				{
+					$time_param['hour'] -= 12;
+				}
+			}
+		}
+
+		function validate_update($event)
+		{
+			$error = 0;
+			// do a little form verifying
+			if (!count($event['participants']))
+			{
+				$error = 43;
+			}
+			elseif ($event['title'] == '')
+			{
+				$error = 40;
+			}
+			elseif (($GLOBALS['phpgw']->datetime->time_valid($event['start']['hour'],$event['start']['min'],0) == False) || ($GLOBALS['phpgw']->datetime->time_valid($event['end']['hour'],$event['end']['min'],0) == False))
+			{
+				$error = 41;
+			}
+			elseif (($GLOBALS['phpgw']->datetime->date_valid($event['start']['year'],$event['start']['month'],$event['start']['mday']) == False) || ($GLOBALS['phpgw']->datetime->date_valid($event['end']['year'],$event['end']['month'],$event['end']['mday']) == False) || ($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 1))
+			{
+				$error = 42;
+			}
+			elseif ($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 0)
+			{
+				if ($GLOBALS['phpgw']->datetime->time_compare($event['start']['hour'],$event['start']['min'],0,$event['end']['hour'],$event['end']['min'],0) == 1)
+				{
+					$error = 42;
+				}
+			}
+			return $error;
+		}
+
+		/*!
+		@function participants_not_rejected($participants,$event)
+		@abstract checks if any of the $particpants participates in $event and has not rejected it
+		*/
+		function participants_not_rejected($participants,$event)
+		{
+			//echo "participants_not_rejected()<br>participants =<pre>"; print_r($participants); echo "</pre><br>event[participants]=<pre>"; print_r($event['participants']); echo "</pre>\n";
+			foreach($participants as $uid => $status)
+			{
+				//echo "testing event[participants][uid=$uid] = '".$event['participants'][$uid]."'<br>\n";
+				if (isset($event['participants'][$uid]) && $event['participants'][$uid] != 'R' &&
+					$status != 'R')
+				{
+					return True;	// found not rejected participant in event
+				}
+			}
+			return False;
+		}
+
+		function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False)
+		{
+//			$retval = Array();
+//			$ok = False;
+
+/* This needs some attention.. by commenting this chunk of code it will fix bug #444265 */
+
+			if($restore_cache)
+			{
+				$temp_cache_events = $this->cached_events;
+			}
+
+//			$temp_start = (int)$GLOBALS['phpgw']->common->show_date($starttime,'Ymd');
+//			$temp_start_time = (int)($GLOBALS['phpgw']->common->show_date($starttime,'Hi');
+//			$temp_end = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Ymd');
+//			$temp_end_time = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Hi');
+			$temp_start = (int)(date('Ymd',$starttime));
+			$temp_start_time = (int)(date('Hi',$starttime));
+			$temp_end = (int)(date('Ymd',$endtime));
+			$temp_end_time = (int)(date('Hi',$endtime));
+			if($this->debug)
+			{
+				echo '<!-- Temp_Start: '.$temp_start.' -->'."\n";
+				echo '<!-- Temp_End: '.$temp_end.' -->'."\n";
+			}
+
+			$users = Array();
+			if(count($participants))
+			{
+				while(list($user,$status) = each($participants))
+				{
+					$users[] = $user;
+				}
+			}
+			else
+			{
+				$users[] = $this->owner;
+			}
+
+			$possible_conflicts = $this->store_to_cache(
+				Array(
+					'smonth'	=> substr(strval($temp_start),4,2),
+					'sday'	=> substr(strval($temp_start),6,2),
+					'syear'	=> substr(strval($temp_start),0,4),
+					'emonth'	=> substr(strval($temp_end),4,2),
+					'eday'	=> substr(strval($temp_end),6,2),
+					'eyear'	=> substr(strval($temp_end),0,4),
+					'owner'	=> $users
+				)
+			);
+
+			if($this->debug)
+			{
+				echo '<!-- Possible Conflicts ('.($temp_start - 1).'): '.count($possible_conflicts[$temp_start - 1]).' -->'."\n";
+				echo '<!-- Possible Conflicts ('.$temp_start.'): '.count($possible_conflicts[$temp_start]).' '.count($id).' -->'."\n";
+			}
+
+			if($possible_conflicts[$temp_start] || $possible_conflicts[$temp_end])
+			{
+				if($temp_start == $temp_end)
+				{
+					if($this->debug)
+					{
+						echo '<!-- Temp_Start == Temp_End -->'."\n";
+					}
+					@reset($possible_conflicts[$temp_start]);
+					while(list($key,$event) = each($possible_conflicts[$temp_start]))
+					{
+						$found = False;
+						if($id)
+						{
+							@reset($id);
+							while(list($key,$event_id) = each($id))
+							{
+								if($this->debug)
+								{
+									echo '<!-- $id['.$key.'] = '.$id[$key].' = '.$event_id.' -->'."\n";
+									echo '<!-- '.$event['id'].' == '.$event_id.' -->'."\n";
+								}
+								if($event['id'] == $event_id)
+								{
+									$found = True;
+								}
+							}
+						}
+						if($this->debug)
+						{
+							echo '<!-- Item found: '.$found.' -->'."<br>\n";
+						}
+						if(!$found)
+						{
+							if($this->debug)
+							{
+								echo '<!-- Checking event id #'.$event['id'];
+							}
+							$temp_event_start = sprintf("%d%02d",$event['start']['hour'],$event['start']['min']);
+							$temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']);
+//							if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) ||
+							if(($temp_start_time <= $temp_event_start &&
+								$temp_end_time > $temp_event_start &&
+								$temp_end_time <= $temp_event_end ||
+								$temp_start_time >= $temp_event_start &&
+								$temp_start_time < $temp_event_end &&
+								$temp_end_time >= $temp_event_end ||
+								$temp_start_time <= $temp_event_start &&
+								$temp_end_time >= $temp_event_end ||
+								$temp_start_time >= $temp_event_start &&
+								$temp_end_time <= $temp_event_end) &&
+								$this->participants_not_rejected($participants,$event))
+							{
+								if($this->debug)
+								{
+									echo ' Conflicts';
+								}
+								$retval[] = $event['id'];
+							}
+							if($this->debug)
+							{
+								echo ' -->'."\n";
+							}
+						}
+					}
+				}
+			}
+			else
+			{
+				$retval = False;
+			}
+
+			if($restore_cache)
+			{
+				$this->cached_events = $temp_cache_events;
+			}
+
+			return $retval;
+		}
+
+		/*!
+		@function check_perms( )
+		@syntax check_perms($needed,$event=0,$other=0)
+		@abstract Checks if the current user has the necessary ACL rights
+		@author ralfbecker
+		@discussion The check is performed on an event or general on the cal of an other user
+		@param $needed necessary ACL right: PHPGW_ACL_{READ|EDIT|DELETE}
+		@param $event event as array or the event-id or 0 for general check
+		@param $other uid to check (if event==0) or 0 to check against $this->owner
+		@note Participating in an event is considered as haveing read-access on that event, \
+			even if you have no general read-grant from that user.
+		*/
+		function check_perms($needed,$event=0,$other=0)
+		{
+			$event_in = $event;
+			
+			if (is_int($event) && $event == 0)
+			{
+				$owner = $other > 0 ? $other : $this->owner;
+			}
+			else
+			{
+				if (!is_array($event))
+				{
+					$event = "";//$this->so->read_entry((int) $event);
+				}
+				if (!is_array($event))
+				{
+					if ($this->xmlrpc)
+					{
+						$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'],$GLOBALS['xmlrpcstr']['not_exist']);
+					}
+					return False;
+				}
+				$owner = $event['owner'];
+				$private = $event['public'] == False || $event['public'] == 0;
+			}
+			$user = $GLOBALS['phpgw_info']['user']['account_id'];
+			$grants = $this->grants[$owner];
+
+			if (is_array($event) && $needed == PHPGW_ACL_READ)
+			{
+				// Check if the $user is one of the participants or has a read-grant from one of them
+				//
+if($event['participants']){
+				foreach($event['participants'] as $uid => $accept)
+				{
+					if ($this->grants[$uid] & PHPGW_ACL_READ || $uid == $user)
+					{
+						$grants |= PHPGW_ACL_READ;
+						// if the $user is one of the participants read-grant private (restricted) too.
+						if($uid == $user || ($this->grants[$uid] & PHPGW_ACL_PRIVATE)) {
+							$grants |= PHPGW_ACL_PRIVATE;
+						}
+						//break;
+					}
+				}
+}
+			}
+
+			if ($GLOBALS['phpgw']->accounts->get_type($owner) == 'g' && $needed == PHPGW_ACL_ADD)
+			{
+				$access = False;	// a group can't be the owner of an event
+			}
+			else
+			{
+				$access = $user == $owner || $grants & $needed && (!$private || $grants & PHPGW_ACL_PRIVATE);
+			}
+			//echo "<p>".function_backtrace()." check_perms($needed,$event_id,$other) for user $user and needed_acl $needed: event='$event[title]': owner=$owner, private=$private, grants=$grants ==> access=$access</p>\n";
+
+			return $access;
+		}
+
+
+		function display_status($user_status)
+		{
+			if(@$this->prefs['timesheet']['display_status'] && $user_status)
+			{
+				$user_status = substr($this->get_long_status($user_status),0,1);
+
+				return ' ('.$user_status.')';
+			}
+			else
+			{
+				return '';
+			}
+		}
+
+		function get_long_status($status_short)
+		{
+			switch ($status_short)
+			{
+				case 'A':
+					$status = lang('Accepted');
+					break;
+				case 'R':
+					$status = lang('Rejected');
+					break;
+				case 'T':
+					$status = lang('Tentative');
+					break;
+				case 'U':
+					$status = lang('No Response');
+					break;
+			}
+			return $status;
+		}
+
+		function is_private($event,$owner)
+		{
+			if($owner == 0)
+			{
+				$owner = $this->owner;
+			}
+			if ($owner == $GLOBALS['phpgw_info']['user']['account_id'] || ($event['public']==1) || ($this->check_perms(PHPGW_ACL_PRIVATE,$event) && $event['public']==0) || $event['owner'] == $GLOBALS['phpgw_info']['user']['account_id'])
+			{
+				return False;
+			}
+			elseif($event['public'] == 0)
+			{
+				return True;
+			}
+			elseif($event['public'] == 2)
+			{
+				$is_private = True;
+				$groups = $GLOBALS['phpgw']->accounts->membership($owner);
+				while (list($key,$group) = each($groups))
+				{
+					if (strpos(' '.implode(',',$event['groups']).' ',$group['account_id']))
+					{
+						return False;
+					}
+				}
+			}
+			else
+			{
+				return False;
+			}
+
+			return $is_private;
+		}
+
+		function get_short_field($event,$is_private=True,$field='')
+		{
+
+
+			if($is_private)
+			{
+				return lang('private');
+			}
+
+// cut off too long titles
+			elseif(strlen($event[$field]) > 19 && !$this->printer_friendly && $field=="title")
+//			elseif(strlen($event[$field]) > 19 && $this->printer_friendly)
+			{
+// we dont use currently 160304
+//				return substr($event[$field], 0 , 19) . '&nbsp;...';
+				return $event[$field];
+			}
+			else
+			{
+				return $event[$field];
+			}
+		}
+
+		function long_date($first,$last=0)
+		{
+			if (!is_array($first))
+			{
+				$first = $this->time2array($raw = $first);
+				$first['raw'] = $raw;
+				$first['day'] = $first['mday'];
+			}
+			if ($last && !is_array($last))
+			{
+				$last = $this->time2array($raw = $last);
+				$last['raw'] = $raw;
+				$last['day'] = $last['mday'];
+			}
+			$datefmt = $this->prefs['common']['dateformat'];
+
+			$month_before_day = strtolower($datefmt[0]) == 'm' ||
+				strtolower($datefmt[2]) == 'm' && $datefmt[4] == 'd';
+
+			for ($i = 0; $i < 5; $i += 2)
+			{
+				switch($datefmt[$i])
+				{
+					case 'd':
+						$range .= $first['day'] . ($datefmt[1] == '.' ? '.' : '');
+						if ($first['month'] != $last['month'] || $first['year'] != $last['year'])
+						{
+							if (!$month_before_day)
+							{
+								$range .= ' '.lang(strftime('%B',$first['raw']));
+							}
+							if ($first['year'] != $last['year'] && $datefmt[0] != 'Y')
+							{
+								$range .= ($datefmt[0] != 'd' ? ', ' : ' ') . $first['year'];
+							}
+							if (!$last)
+							{
+								return $range;
+							}
+							$range .= ' - ';
+
+							if ($first['year'] != $last['year'] && $datefmt[0] == 'Y')
+							{
+								$range .= $last['year'] . ', ';
+							}
+
+							if ($month_before_day)
+							{
+								$range .= lang(strftime('%B',$last['raw']));
+							}
+						}
+						else
+						{
+							$range .= ' - ';
+						}
+						$range .= ' ' . $last['day'] . ($datefmt[1] == '.' ? '.' : '');
+						break;
+					case 'm':
+					case 'M':
+						$range .= ' '.lang(strftime('%B',$month_before_day ? $first['raw'] : $last['raw'])) . ' ';
+						break;
+					case 'Y':
+						$range .= ($datefmt[0] == 'm' ? ', ' : ' ') . ($datefmt[0] == 'Y' ? $first['year'].($datefmt[2] == 'd' ? ', ' : ' ') : $last['year'].' ');
+						break;
+				}
+			}
+			return $range;
+		}
+
+		function get_week_label()
+		{
+			$first = $GLOBALS['phpgw']->datetime->gmtdate($GLOBALS['phpgw']->datetime->get_weekday_start($this->year, $this->month, $this->day));
+			$last = $GLOBALS['phpgw']->datetime->gmtdate($first['raw'] + 518400);
+
+			return ($this->long_date($first,$last));
+		}
+
+		function normalizeminutes(&$minutes)
+		{
+			$hour = 0;
+			$min = (int)$minutes;
+			if($min >= 60)
+			{
+				$hour += $min / 60;
+				$min %= 60;
+			}
+			settype($minutes,'integer');
+			$minutes = $min;
+			return $hour;
+		}
+
+		function splittime($time,$follow_24_rule=True)
+		{
+			$temp = array('hour','minute','second','ampm');
+			$time = strrev($time);
+			$second = (int)(strrev(substr($time,0,2)));
+			$minute = (int)(strrev(substr($time,2,2)));
+			$hour   = (int)(strrev(substr($time,4)));
+			$hour += $this->normalizeminutes($minute);
+			$temp['second'] = $second;
+			$temp['minute'] = $minute;
+			$temp['hour']   = $hour;
+			$temp['ampm']   = '  ';
+			if($follow_24_rule == True)
+			{
+				if ($this->prefs['common']['timeformat'] == '24')
+				{
+					return $temp;
+				}
+
+				$temp['ampm'] = 'am';
+
+				if ((int)$temp['hour'] > 12)
+				{
+					$temp['hour'] = (int)((int)$temp['hour'] - 12);
+					$temp['ampm'] = 'pm';
+				}
+				elseif ((int)$temp['hour'] == 12)
+				{
+					$temp['ampm'] = 'pm';
+				}
+			}
+			return $temp;
+		}
+
+		function get_exception_array($exception_str='')
+		{
+			$exception = Array();
+			if(strpos(' '.$exception_str,','))
+			{
+				$exceptions = explode(',',$exception_str);
+				for($exception_count=0;$exception_count<count($exceptions);$exception_count++)
+				{
+					$exception[] = (int)$exceptions[$exception_count];
+				}
+			}
+			elseif($exception_str != '')
+			{
+				$exception[] = (int)$exception_str;
+			}
+			return $exception;
+		}
+
+		function build_time_for_display($fixed_time)
+		{
+			$time = $this->splittime($fixed_time);
+			$str = $time['hour'].':'.((int)$time['minute']<=9?'0':'').$time['minute'];
+
+			if ($this->prefs['common']['timeformat'] == '12')
+			{
+				$str .= ' ' . $time['ampm'];
+			}
+
+			return $str;
+		}
+
+		function sort_event($event,$date)
+		{
+			$inserted = False;
+			if(isset($event['recur_exception']))
+			{
+				$event_time = mktime($event['start']['hour'],$event['start']['min'],0,(int)(substr($date,4,2)),(int)(substr($date,6,2)),(int)(substr($date,0,4))) - $GLOBALS['phpgw']->datetime->tz_offset;
+				while($inserted == False && list($key,$exception_time) = each($event['recur_exception']))
+				{
+					if($this->debug)
+					{
+						echo '<!-- checking exception datetime '.$exception_time.' to event datetime '.$event_time.' -->'."\n";
+					}
+					if($exception_time == $event_time)
+					{
+						$inserted = True;
+					}
+				}
+			}
+			if($this->cached_events[$date] && $inserted == False)
+			{
+
+				if($this->debug)
+				{
+					echo '<!-- Cached Events found for '.$date.' -->'."\n";
+				}
+				$year = substr($date,0,4);
+				$month = substr($date,4,2);
+				$day = substr($date,6,2);
+
+				if($this->debug)
+				{
+					echo '<!-- Date : '.$date.' Count : '.count($this->cached_events[$date]).' -->'."\n";
+				}
+
+				for($i=0;$i<count($this->cached_events[$date]);$i++)
+				{
+					if($this->cached_events[$date][$i]['id'] == $event['id'] || $this->cached_events[$date][$i]['reference'] == $event['id'])
+					{
+						if($this->debug)
+						{
+							echo '<!-- Item already inserted! -->'."\n";
+						}
+						$inserted = True;
+						break;
+					}
+					/* This puts all spanning events across multiple days up at the top. */
+					if($this->cached_events[$date][$i]['recur_type'] == MCAL_RECUR_NONE)
+					{
+						if($this->cached_events[$date][$i]['start']['mday'] != $day && $this->cached_events[$date][$i]['end']['mday'] >= $day)
+						{
+							continue;
+						}
+					}
+					if(date('Hi',mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$day,$year)) < date('Hi',mktime($this->cached_events[$date][$i]['start']['hour'],$this->cached_events[$date][$i]['start']['min'],$this->cached_events[$date][$i]['start']['sec'],$month,$day,$year)))
+					{
+						for($j=count($this->cached_events[$date]);$j>=$i;$j--)
+						{
+							$this->cached_events[$date][$j] = $this->cached_events[$date][$j-1];
+						}
+						if($this->debug)
+						{
+							echo '<!-- Adding event ID: '.$event['id'].' to cached_events -->'."\n";
+						}
+						$inserted = True;
+						$this->cached_events[$date][$i] = $event;
+						break;
+					}
+				}
+			}
+			if(!$inserted)
+			{
+				if($this->debug)
+				{
+					echo '<!-- Adding event ID: '.$event['id'].' to cached_events -->'."\n";
+				}
+				$this->cached_events[$date][] = $event;
+			}
+		}
+
+		function check_repeating_events($datetime)
+		{
+			@reset($this->repeating_events);
+			$search_date_full = date('Ymd',$datetime);
+			$search_date_year = date('Y',$datetime);
+			$search_date_month = date('m',$datetime);
+			$search_date_day = date('d',$datetime);
+			$search_date_dow = date('w',$datetime);
+			$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
+			if($this->debug)
+			{
+				echo '<!-- Search Date Full = '.$search_date_full.' -->'."\n";
+			}
+			$repeated = $this->repeating_events;
+			$r_events = count($repeated);
+			for ($i=0;$i<$r_events;$i++)
+			{
+				$rep_events = $this->repeating_events[$i];
+				$id = $rep_events['id'];
+				$event_beg_day = mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']);
+				if($rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0)
+				{
+					$event_recur_time = $this->maketime($rep_events['recur_enddate']);
+				}
+				else
+				{
+					$event_recur_time = mktime(0,0,0,1,1,2030);
+				}
+				$end_recur_date = date('Ymd',$event_recur_time);
+				$full_event_date = date('Ymd',$event_beg_day);
+
+				if($this->debug)
+				{
+					echo '<!-- check_repeating_events - Processing ID - '.$id.' -->'."\n";
+					echo '<!-- check_repeating_events - Recurring End Date - '.$end_recur_date.' -->'."\n";
+				}
+
+				// only repeat after the beginning, and if there is an rpt_end before the end date
+				if (($search_date_full > $end_recur_date) || ($search_date_full < $full_event_date))
+				{
+					continue;
+				}
+
+				if ($search_date_full == $full_event_date)
+				{
+					$this->sort_event($rep_events,$search_date_full);
+					continue;
+				}
+				else
+				{
+					$freq = $rep_events['recur_interval'];
+					$freq = $freq ? $freq : 1;
+					$type = $rep_events['recur_type'];
+					switch($type)
+					{
+						case MCAL_RECUR_DAILY:
+							if($this->debug)
+							{
+								echo '<!-- check_repeating_events - MCAL_RECUR_DAILY - '.$id.' -->'."\n";
+							}
+							
+							if ($freq == 1 && $rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0 && $search_date_full <= $end_recur_date)
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							elseif (floor(($search_beg_day - $event_beg_day)/86400) % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							else
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_WEEKLY:
+							if (floor(($search_beg_day - $event_beg_day)/604800)  % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							$check = 0;
+							switch($search_date_dow)
+							{
+								case 0:
+									$check = MCAL_M_SUNDAY;
+									break;
+								case 1:
+									$check = MCAL_M_MONDAY;
+									break;
+								case 2:
+									$check = MCAL_M_TUESDAY;
+									break;
+								case 3:
+									$check = MCAL_M_WEDNESDAY;
+									break;
+								case 4:
+									$check = MCAL_M_THURSDAY;
+									break;
+								case 5:
+									$check = MCAL_M_FRIDAY;
+									break;
+								case 6:
+									$check = MCAL_M_SATURDAY;
+									break;
+							}
+							if ($rep_events['recur_data'] & $check)
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_MONTHLY_WDAY:
+							if ((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month - $rep_events['start']['month']) % $freq)
+							{
+								continue;
+							}
+
+							if (($GLOBALS['phpgw']->datetime->day_of_week($rep_events['start']['year'],$rep_events['start']['month'],$rep_events['start']['mday']) == $GLOBALS['phpgw']->datetime->day_of_week($search_date_year,$search_date_month,$search_date_day)) &&
+								(ceil($rep_events['start']['mday']/7) == ceil($search_date_day/7)))
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_MONTHLY_MDAY:
+							if ((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month - $rep_events['start']['month'])  % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							if ($search_date_day == $rep_events['start']['mday'])
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_YEARLY:
+							if (($search_date_year - $rep_events['start']['year']) % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							if (date('dm',$datetime) == date('dm',$event_beg_day))
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+					}
+				}
+			}	// end for loop
+		}	// end function
+
+		function store_to_cache($params)
+		{
+			if(!is_array($params))
+			{
+				return False;
+			}
+			if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start'])))
+			{
+				$syear = $datearr['year'];
+				$smonth = $datearr['month'];
+				$sday = $datearr['mday'];
+				$this->xmlrpc = True;
+			}
+			else
+			{
+				$syear = $params['syear'];
+				$smonth = $params['smonth'];
+				$sday = $params['sday'];
+			}
+			if (isset($params['end']) && ($datearr = $GLOBALS['server']->iso86012date($params['end'])))
+			{
+				$eyear = $datearr['year'];
+				$emonth = $datearr['month'];
+				$eday = $datearr['mday'];
+				$this->xmlrpc = True;
+			}
+			else
+			{
+				$eyear = (isset($params['eyear'])?$params['eyear']:0);
+				$emonth = (isset($params['emonth'])?$params['emonth']:0);
+				$eday = (isset($params['eday'])?$params['eday']:0);
+			}
+			if (!isset($params['owner']) && @$this->xmlrpc)
+			{
+				$owner_id = $GLOBALS['phpgw_info']['user']['user_id'];
+			}
+			else
+			{
+				$owner_id = (isset($params['owner'])?$params['owner']:0);
+				if($owner_id==0 && $this->is_group)
+				{
+					unset($owner_id);
+					$owner_id = $this->g_owner;
+					if($this->debug)
+					{
+						echo '<!-- owner_id in ('.implode(',',$owner_id).') -->'."\n";
+					}
+				}
+			}
+			if(!$eyear && !$emonth && !$eday)
+			{
+				$edate = mktime(23,59,59,$smonth + 1,$sday + 1,$syear);
+				$eyear = date('Y',$edate);
+				$emonth = date('m',$edate);
+				$eday = date('d',$edate);
+			}
+			else
+			{
+				if(!$eyear)
+				{
+					$eyear = $syear;
+				}
+				//Tratamento do valor final (mes) da pesquisa de eventos feita em $this->so->list_events.
+				//Se $emonth nao tem valor, recebe o valor de $smonth (que recebe $params['smonth']) e soma 1.
+				//O valor $params['emonth'] indica o mes final para a pesquisa de eventos, e passou a ser
+				//informado na a impressao de eventos mensais. Mudancas feitas em class.uitimesheet.inc.php, 
+				//function display_month_print();
+				if(!$emonth)
+				{
+					$emonth = $smonth + 1;
+					if($emonth > 12)
+					{
+						$emonth = 1;
+						$eyear++;
+					}
+				}
+				if(!$eday)
+				{
+					$eday = $sday + 1;
+				}
+				$edate = mktime(23,59,59,$emonth,$eday,$eyear);
+			}
+			//echo "<p>botimesheet::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n";
+			if($this->debug)
+			{
+				echo '<!-- Start Date : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+				echo '<!-- End   Date : '.sprintf("%04d%02d%02d",$eyear,$emonth,$eday).' -->'."\n";
+			}
+			//A variavel $month_print recebe o parametro 'saux' com o mes de inicio da pesquisa de eventos por
+			//$this->so->list_events. O valor do mes final da pesquisa e tratado no codigo acima;
+			//$month_ini = $params['saux'];
+
+			if($owner_id)
+			{
+				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
+				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
+			}
+			else
+			{
+				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
+				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
+			}
+
+			$c_cached_ids = count($cached_event_ids);
+			$c_cached_ids_repeating = count($cached_event_ids_repeating);
+
+			if($this->debug)
+			{
+				echo '<!-- events cached : '.$c_cached_ids.' : for : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+				echo '<!-- repeating events cached : '.$c_cached_ids_repeating.' : for : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+			}
+
+			$this->cached_events = Array();
+
+			if($c_cached_ids == 0 && $c_cached_ids_repeating == 0)
+			{
+				return;
+			}
+
+			$cache_start = (int)(sprintf("%04d%02d%02d",$syear,$smonth,$sday));
+			$cached_event=$this->get_cached_event();
+			if($c_cached_ids)
+			{
+				for($i=0;$i<$c_cached_ids;$i++)
+				{
+					$event = "";//$this->so->read_entry($cached_event_ids[$i]);
+					if ($event['recur_type'])
+					{
+						continue;	// fetch recuring events only in 2. loop
+					}
+					$startdate = (int)(date('Ymd',$this->maketime($event['start'])));
+					$enddate = (int)(date('Ymd',$this->maketime($event['end'])));
+					$this->cached_events[$startdate][] = $event;
+					if($startdate != $enddate)
+					{
+						$start['year'] = (int)(substr($startdate,0,4));
+						$start['month'] = (int)(substr($startdate,4,2));
+						$start['mday'] = (int)(substr($startdate,6,2));
+						for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=(int)(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year']))))
+						{
+							$c_evt_day = count($this->cached_events[$j]) - 1;
+							if($c_evt_day < 0)
+							{
+								$c_evt_day = 0;
+							}
+							if($this->debug)
+							{
+								echo '<!-- Date: '.$j.' Count : '.$c_evt_day.' -->'."\n";
+							}
+							if($this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
+							{
+								if($this->debug)
+								{
+									echo '<!-- Adding Event for Date: '.$j.' -->'."\n";
+								}
+								$this->cached_events[$j][] = $event;
+							}
+							if ($j >= $cache_start && (@$params['no_doubles'] || @$this->xmlrpc))
+							{
+								break;	// add event only once on it's startdate
+							}
+						}
+					}
+				}
+			}
+
+			$this->repeating_events = Array();
+			if($c_cached_ids_repeating)
+			{
+				for($i=0;$i<$c_cached_ids_repeating;$i++)
+				{
+					$this->repeating_events[$i] = "";//$this->so->read_entry($cached_event_ids_repeating[$i]);
+					if($this->debug)
+					{
+						echo '<!-- Cached Events ID: '.$cached_event_ids_repeating[$i].' ('.sprintf("%04d%02d%02d",$this->repeating_events[$i]['start']['year'],$this->repeating_events[$i]['start']['month'],$this->repeating_events[$i]['start']['mday']).') -->'."\n";
+					}
+				}
+				for($date=mktime(0,0,0,$smonth,$sday,$syear);$date<=$edate;$date += 86400)
+				{
+					if($this->debug)
+					{
+						$search_date = date('Ymd',$date);
+						echo '<!-- Calling check_repeating_events('.$search_date.') -->'."\n";
+					}
+					$this->check_repeating_events($date);
+					if($this->debug)
+					{
+						echo '<!-- Total events found matching '.$search_date.' = '.count($this->cached_events[$search_date]).' -->'."\n";
+						for($i=0;$i<count($this->cached_events[$search_date]);$i++)
+						{
+							echo '<!-- Date: '.$search_date.' ['.$i.'] = '.$this->cached_events[$search_date][$i]['id'].' -->'."\n";
+						}
+					}
+				}
+			}
+			$retval = Array();
+			for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday + $k,$syear)))
+			{
+				if(is_array($this->cached_events[$j]))
+				{
+					if ($this->xmlrpc)
+					{
+						foreach($this->cached_events[$j] as $event)
+						{
+							$retval[] = $this->xmlrpc_prepare($event);
+						}
+					}
+					else
+					{
+						$retval[$j] = $this->cached_events[$j];
+					}
+				}
+			}
+			//echo "store_to_cache(".print_r($params,True).")=<pre>".print_r($retval,True)."</pre>\n";
+			//$this->so->cal->event = $cached_event;
+			return $retval;
+		}
+
+		function xmlrpc_prepare(&$event)
+		{
+			$event['rights'] = $this->grants[$event['owner']];
+
+			foreach(array('start','end','modtime','recur_enddate') as $name)
+			{
+				if (isset($event[$name]))
+				{
+					$event[$name] = $GLOBALS['server']->date2iso8601($event[$name]);
+				}
+			}
+			if (is_array($event['recur_exception']))
+			{
+				foreach($event['recur_exception'] as $key => $timestamp)
+				{
+					$event['recur_exception'][$key] = $GLOBALS['server']->date2iso8601($timestamp);
+				}
+			}
+			static $user_cache = array();
+
+			if (!is_object($GLOBALS['phpgw']->perferences))
+			{
+				$GLOBALS['phpgw']->perferences = CreateObject('phpgwapi.preferences');
+			}
+			foreach($event['participants'] as $user_id => $status)
+			{
+				if (!isset($user_cache[$user_id]))
+				{
+					$user_cache[$user_id] = array(
+						'name'   => $GLOBALS['phpgw']->common->grab_owner_name($user_id),
+						'email'  => $GLOBALS['phpgw']->perferences->email_address($user_id)
+					);
+				}
+				$event['participants'][$user_id] = $user_cache[$user_id] + array(
+					'status' => $status,
+				);
+			}
+			if (is_array($event['alarm']))
+			{
+				foreach($event['alarm'] as $id => $alarm)
+				{
+					$event['alarm'][$id]['time'] = $GLOBALS['server']->date2iso8601($alarm['time']);
+					if ($alarm['owner'] != $GLOBALS['phpgw_info']['user']['account_id'])
+					{
+						unset($event['alarm'][$id]);
+					}
+				}
+			}
+			$event['category'] = $GLOBALS['server']->cats2xmlrpc(explode(',',$event['category']));
+
+			// using access={public|privat} in all modules via xmlrpc
+			$event['access'] = $event['public'] ? 'public' : 'privat';
+			unset($event['public']);
+
+			return $event;
+		}
+
+		/* Begin Appsession Data */
+		function store_to_appsession($event)
+		{
+			$GLOBALS['phpgw']->session->appsession('entry','timesheet',$event);
+		}
+
+		function restore_from_appsession()
+		{
+//echo "quees";
+			$this->event_init();
+			$event = $GLOBALS['phpgw']->session->appsession('entry','timesheet');
+//echo "quees".$event;
+			//$this->so->cal->event = $event;
+			return $event;
+		}
+		/* End Appsession Data */
+
+		/* Begin of SO functions */
+		function get_cached_event()
+		{
+			return "";//$this->so->get_cached_event();
+		}
+
+		function add_attribute($var,$value,$index='**(**')
+		{
+			//$this->so->add_attribute($var,$value,$index);
+		}
+
+		function event_init()
+		{
+			//$this->so->event_init();
+		}
+
+		function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			//$this->so->set_start($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			//$this->so->set_end($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_title($title='')
+		{
+			//$this->so->set_title($title);
+		}
+
+		function set_description($description='')
+		{
+			//$this->so->set_description($description);
+		}
+
+		function set_description1($description1='')
+		{
+			//$this->so->set_description1($description1);
+		}
+function set_participants1($participants1='')
+		{
+			//$this->so->set_participants1($participants1);
+		}
+		function set_ex_participants($ex_participants='')
+		{
+			//$this->so->set_ex_participants($ex_participants);
+		}
+
+		function set_class($class)
+		{
+			//$this->so->set_class($class);
+		}
+
+		function set_category($category='')
+		{
+			//$this->so->set_category($category);
+		}
+
+		function set_alarm($alarm)
+		{
+			//$this->so->set_alarm($alarm);
+		}
+
+		function set_recur_none()
+		{
+			//$this->so->set_recur_none();
+		}
+
+		function set_recur_daily($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_daily($year,$month,$day,$interval);
+		}
+
+		function set_recur_weekly($year,$month,$day,$interval,$weekdays)
+		{
+			//$this->so->set_recur_weekly($year,$month,$day,$interval,$weekdays);
+		}
+
+		function set_recur_monthly_mday($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_monthly_mday($year,$month,$day,$interval);
+		}
+
+		function set_recur_monthly_wday($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_monthly_wday($year,$month,$day,$interval);
+		}
+
+		function set_recur_yearly($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_yearly($year,$month,$day,$interval);
+		}
+		/* End of SO functions */
+
+		function prepare_matrix($interval,$increment,$part,$fulldate)
+		{
+			for($h=0;$h<24;$h++)
+			{
+				for($m=0;$m<$interval;$m++)
+				{
+					$index = (($h * 10000) + (($m * $increment) * 100));
+					$time_slice[$index]['marker'] = '&nbsp';
+					$time_slice[$index]['description'] = '';
+$time_slice[$index]['description1'] = '';
+				}
+			}
+			foreach($this->cached_events[$fulldate] as $event)
+			{
+				if ($event['participants'][$part] == 'R')
+				{
+					continue;	// dont show rejected invitations, as they are free time
+				}
+				$eventstart = $GLOBALS['phpgw']->datetime->localdates($this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset);
+				$eventend = $GLOBALS['phpgw']->datetime->localdates($this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset);
+				$start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100);
+				$starttemp = $this->splittime("$start",False);
+				$subminute = 0;
+				for($m=0;$m<$interval;$m++)
+				{
+					$minutes = $increment * $m;
+					if((int)$starttemp['minute'] > $minutes && (int)$starttemp['minute'] < ($minutes + $increment))
+					{
+						$subminute = ($starttemp['minute'] - $minutes) * 100;
+					}
+				}
+				$start -= $subminute;
+				$end =  ($eventend['hour'] * 10000) + ($eventend['minute'] * 100);
+				$endtemp = $this->splittime("$end",False);
+				$addminute = 0;
+				for($m=0;$m<$interval;$m++)
+				{
+					$minutes = ($increment * $m);
+					if($endtemp['minute'] < ($minutes + $increment) && $endtemp['minute'] > $minutes)
+					{
+						$addminute = ($minutes + $increment - $endtemp['minute']) * 100;
+					}
+				}
+				$end += $addminute;
+				$starttemp = $this->splittime("$start",False);
+				$endtemp = $this->splittime("$end",False);
+
+				for($h=$starttemp['hour'];$h<=$endtemp['hour'];$h++)
+				{
+					$startminute = 0;
+					$endminute = $interval;
+					$hour = $h * 10000;
+					if($h == (int)$starttemp['hour'])
+					{
+						$startminute = ($starttemp['minute'] / $increment);
+					}
+					if($h == (int)$endtemp['hour'])
+					{
+						$endminute = ($endtemp['minute'] / $increment);
+					}
+					$private = $this->is_private($event,$part);
+					$time_display = $GLOBALS['phpgw']->common->show_date($eventstart['raw'],$this->users_timeformat).'-'.$GLOBALS['phpgw']->common->show_date($eventend['raw'],$this->users_timeformat);
+					$time_description = '('.$time_display.') '.$this->get_short_field($event,$private,'title').$this->display_status($event['participants'][$part]);
+					for($m=$startminute;$m<$endminute;$m++)
+					{
+						$index = ($hour + (($m * $increment) * 100));
+						$time_slice[$index]['marker'] = '-';
+						$time_slice[$index]['description'] = $time_description;
+						$time_slice[$index]['id'] = $event['id'];
+					}
+				}
+			}
+			return $time_slice;
+		}
+
+		/*!
+		@function set_status
+		@abstract set the participant response $status for event $cal_id and notifies the owner of the event
+		*/
+		function set_status($cal_id,$status)
+		{
+			$status2msg = array(
+				REJECTED  => MSG_REJECTED,
+				TENTATIVE => MSG_TENTATIVE,
+				ACCEPTED  => MSG_ACCEPTED
+			);
+			if (!isset($status2msg[$status]))
+			{
+				return False;
+			}
+			$event = "";//$this->so->read_entry($cal_id);
+			$account_id = $GLOBALS['phpgw_info']['user']['account_id'];
+			if(($status2msg[$status] == "5" && $event['participants'][$account_id] == "A") ||
+			 ($status2msg[$status] == "3" && $event['participants'][$account_id] == "R")) {
+				return True;
+			}
+			//$this->so->set_status($cal_id,$status);
+			$event = "";//$this->so->read_entry($cal_id);
+			$this->send_update($status2msg[$status],$event['participants'],$event);
+
+		}
+
+		/*!
+		@function update_requested
+		@abstract checks if $userid has requested (in $part_prefs) updates for $msg_type
+		@syntax update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event)
+		@param $userid numerical user-id
+		@param $part_prefs preferces of the user $userid
+		@param $msg_type type of the notification: MSG_ADDED, MSG_MODIFIED, MSG_ACCEPTED, ...
+		@param $old_event Event before the change
+		@param $new_event Event after the change
+		@returns 0 = no update requested, > 0 update requested
+		*/
+		function update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event)
+		{
+			if ($msg_type == MSG_ALARM)
+			{
+				return True;	// always True for now
+			}
+			$want_update = 0;
+
+			// the following switch fall-through all cases, as each included the following too
+			//
+			$msg_is_response = $msg_type == MSG_REJECTED || $msg_type == MSG_ACCEPTED || $msg_type == MSG_TENTATIVE;
+
+			switch($ru = $part_prefs['timesheet']['receive_updates'])
+			{
+				case 'responses':
+					if ($msg_is_response)
+					{
+						++$want_update;
+					}
+				case 'modifications':
+					if ($msg_type == MSG_MODIFIED)
+					{
+						++$want_update;
+					}
+				case 'time_change_4h':
+				case 'time_change':
+					$diff = max(abs($this->maketime($old_event['start'])-$this->maketime($new_event['start'])),
+						abs($this->maketime($old_event['end'])-$this->maketime($new_event['end'])));
+					$check = $ru == 'time_change_4h' ? 4 * 60 * 60 - 1 : 0;
+					if ($msg_type == MSG_MODIFIED && $diff > $check)
+					{
+						++$want_update;
+					}
+				case 'add_cancel':
+					if ($old_event['owner'] == $userid && $msg_is_response ||
+						$msg_type == MSG_DELETED || $msg_type == MSG_ADDED)
+					{
+						++$want_update;
+					}
+					break;
+				case 'no':
+					break;
+			}
+			//echo "<p>botimesheet::update_requested(user=$userid,pref=".$part_prefs['timesheet']['receive_updates'] .",msg_type=$msg_type,".($old_event?$old_event['title']:'False').",".($old_event?$old_event['title']:'False').") = $want_update</p>\n";
+			return $want_update > 0;
+		}
+
+	function create_vcard($event_array)
+	{
+	if(!is_array($event_array))
+		return null;
+	$tmpattach="BEGIN:Vtimesheet\n"
+	."PRODID:-//Expresso Livre//timesheet//EN\n"
+	."VERSION:1.0\n";
+		foreach ($event_array as $event)
+		{
+			// It translates int to string
+			if (!is_object($event) && !is_array($event) || !array_key_exists  ('end', $event))
+				$event = $event_array;
+			if ( $event['end']['month'] < 10 )
+				$end_event_month="0".$event['end']['month'];
+			else
+				$end_event_month=$event['end']['month'];
+			if ( $event['start']['month'] < 10 )
+				$start_event_month="0".$event['start']['month'];
+			else
+				$start_event_month=$event['start']['month'];
+			if ( $event['end']['mday'] < 10 )
+				$end_event_day="0".$event['end']['mday'];
+			else
+				$end_event_day=$event['end']['mday'];
+			if ( $event['start']['mday'] < 10 )
+				$start_event_day="0".$event['start']['mday'];
+			else
+				$start_event_day=$event['start']['mday'];
+			if ( $event['start']['hour'] < 10)
+				$start_event_hour="0".$event['start']['hour'];
+			else
+				$start_event_hour=$event['start']['hour'];
+			if ( $event['end']['hour'] < 10)
+				$end_event_hour="0".$event['end']['hour'];
+			else
+				$end_event_hour=$event['end']['hour'];
+				
+			if ( $event['start']['min'] < 10)
+				$start_event_min="0".$event['start']['min'];
+			else
+				$start_event_min=$event['start']['min'];
+			if ( $event['end']['min'] < 10)
+				$end_event_min="0".$event['end']['min'];
+			else
+				$end_event_min=$event['end']['min'];	
+		
+
+			$tmpattach.="BEGIN:VEVENT\n"
+			."DTSTART:".$event['start'][year].$start_event_month.$start_event_day."T".$start_event_hour.$start_event_min."00Z\n"
+			."DTEND:".$event[end][year].$end_event_month.$end_event_day."T".$end_event_hour.$end_event_min."00Z\n"
+			."UID:Expresso-".$event[id].$event[uid]."\n"
+			."LAST-MODIFIED:".time()."\n"
+			."DESCRIPTION:".$event[description]."\n"
+."DESCRIPTION1:".$event[description1]."\n"
+."PARTICIPANTS1:".$event[participants1]."\n"
+			."SUMMARY:".$event[title]."\n"
+			."LOCATION:".$event[location]."\n"
+			."END:VEVENT"."\n";
+		}
+			$tmpattach.="END:Vtimesheet\n";
+			return $tmpattach;
+}
+
+		/*!
+		@function send_update
+		@abstract sends update-messages to certain participants of an event
+		@syntax send_update($msg_type,$to_notify,$old_event,$new_event=False)
+		@param $msg_type type of the notification: MSG_ADDED, MSG_MODIFIED, MSG_ACCEPTED, ...
+		@param $to_notify array with numerical user-ids as keys (!) (value is not used)
+		@param $old_event Event before the change
+		@param $new_event Event after the change
+		*/
+		function send_update($msg_type,$to_notify,$old_event,$new_event=False,$user=False)
+		{
+			
+			//echo "<p>botimesheet::send_update(type=$msg_type,to_notify="; print_r($to_notify); echo ", old_event="; print_r($old_event); echo ", new_event="; print_r($new_event); echo ", user=$user)</p>\n";
+			if (!is_array($to_notify))
+			{
+				$to_notify = array();
+			}
+			$owner = $old_event ? $old_event['owner'] : $new_event['owner'];
+			if ($owner && !isset($to_notify[$owner]) && $msg_type != MSG_ALARM)
+			{
+				$to_notify[$owner] = 'owner';	// always include the event-owner
+			}
+			$version = $GLOBALS['phpgw_info']['apps']['timesheet']['version'];
+
+			$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences();
+			$sender = $GLOBALS['phpgw_info']['user']['email'];
+
+			$temp_tz_offset = $this->prefs['common']['tz_offset'];
+			$temp_timeformat = $this->prefs['common']['timeformat'];
+			$temp_dateformat = $this->prefs['common']['dateformat'];
+
+			$tz_offset = ((60 * 60) * (int)$temp_tz_offset);
+
+			if($old_event != False)
+			{
+				$t_old_start_time = $this->maketime($old_event['start']);
+				if($t_old_start_time < (time() - 86400))
+				{
+					return False;
+				}
+			}
+
+			$temp_user = $GLOBALS['phpgw_info']['user'];
+
+			if (!$user)
+			{
+				$user = $this->owner;
+			}
+			$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences($user);
+
+			$event = $msg_type == MSG_ADDED || $msg_type == MSG_MODIFIED ? $new_event : $old_event;
+			if($old_event != False)
+			{
+				$old_starttime = $t_old_start_time - $GLOBALS['phpgw']->datetime->tz_offset;
+			}
+			$starttime = $this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$endtime   = $this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+			switch($msg_type)
+			{
+				case MSG_DELETED:
+					$action = lang('Canceled');
+					$msg = 'Canceled';
+					$msgtype = '"timesheet";';
+					$method = 'cancel';
+					$typesend = 1;
+					break;
+				case MSG_MODIFIED:
+					$action = lang('Modified');
+					$msg = 'Modified';
+					$msgtype = '"timesheet"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
+					$method = 'request';
+					$typesend = 2;
+					break;
+				case MSG_ADDED:
+					$action = lang('Added');
+					$msg = 'Added';
+					$msgtype = '"timesheet"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
+					$method = 'request';
+					$typesend = 3;
+					break;
+				case MSG_REJECTED:
+					$action = lang('Rejected');
+					$msg = 'Response';
+					$msgtype = '"timesheet";';
+					$method = 'reply';
+					$typesend = 4;
+					break;
+				case MSG_TENTATIVE:
+					$action = lang('Tentative');
+					$msg = 'Response';
+					$msgtype = '"timesheet";';
+					$method = 'reply';
+					$typesend = 5;
+					break;
+				case MSG_ACCEPTED:
+					$action = lang('Accepted');
+					$msg = 'Response';
+					$msgtype = '"timesheet";';
+					$method = 'reply';
+					$typesend = 6;
+					break;
+				case MSG_ALARM:
+					$action = lang('Alarm');
+					$msg = 'Alarm';
+					$msgtype = '"timesheet";';
+					$method = 'publish';	// duno if thats right
+					$typesend = 7;
+					break;
+				default:
+					$method = 'publish';
+					$typesend = 8;
+			}
+			$notify_msg = $this->prefs['timesheet']['notify'.$msg];
+			if (empty($notify_msg))
+			{
+				$notify_msg = $this->prefs['timesheet']['notifyAdded'];	// use a default
+			}
+			$details = array(			// event-details for the notify-msg
+				'id'          => $msg_type == MSG_ADDED ? $new_event['id'] : $old_event['id'],
+				'action'      => $action,
+			);
+			$event_arr = $this->event2array($event);
+			foreach($event_arr as $key => $val)
+			{
+				$details[$key] = $val['data'];
+			}
+			
+			$details['participants'] = implode("\n",$details['participants']);
+
+			$details['link'] = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=timesheet.uitimesheet.view&cal_id='.$event['id'];
+			// if url is only a path, try guessing the rest ;-)
+			if ($GLOBALS['phpgw_info']['server']['webserver_url'][0] == '/')
+			{
+				$details['link'] = ($GLOBALS['phpgw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
+					($GLOBALS['phpgw_info']['server']['hostname'] ? $GLOBALS['phpgw_info']['server']['hostname'] : 'localhost').
+					$details['link'];
+			}
+			
+			//Seta o email usando phpmailer
+			define('PHPGW_INCLUDE_ROOT','../');	
+			define('PHPGW_API_INC','../phpgwapi/inc');	
+			include_once(PHPGW_API_INC.'/class.phpmailer.inc.php');
+			$mail = new PHPMailer();
+			$mail->IsSMTP();
+			$boemailadmin = CreateObject('emailadmin.bo');
+			$emailadmin_profile = $boemailadmin->getProfileList();
+			$emailadmin = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
+		
+			$mail->Host = $emailadmin['smtpServer'];
+			$mail->Port = $emailadmin['smtpPort'];
+			$mail->From = $GLOBALS['phpgw']->preferences->values['email'];
+			$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+			$mail->IsHTML(true);
+
+			// Aqui ï¿œ enviado o email
+			foreach($to_notify as $userid => $statusid) 
+			{
+			 	$mail->ClearAttachments();
+			 	
+				$userid = (int)$userid;
+
+				if ($statusid == 'R' || $GLOBALS['phpgw']->accounts->get_type($userid) == 'g')
+				{
+					continue;	// dont notify rejected participants
+				}
+				if($userid != $GLOBALS['phpgw_info']['user']['account_id'] ||  $msg_type == MSG_ALARM)
+				{
+					print_debug('Msg Type',$msg_type);
+					print_debug('UserID',$userid);
+
+					$preferences = CreateObject('phpgwapi.preferences',$userid);
+					$part_prefs = $preferences->read_repository();
+
+					if (!$this->update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event))
+					{
+						continue;
+					}
+					$GLOBALS['phpgw']->accounts->get_account_name($userid,$lid,$details['to-firstname'],$details['to-lastname']);
+					$details['to-fullname'] = $GLOBALS['phpgw']->common->display_fullname('',$details['to-firstname'],$details['to-lastname']);
+
+					$to = $preferences->email_address($userid);
+					
+					if (empty($to) || $to[0] == '@' || $to[0] == '$')	// we have no valid email-address
+					{
+						//echo "<p>botimesheet::send_update: Empty email adress for user '".$details['to-fullname']."' ==> ignored !!!</p>\n";
+						continue;
+					}
+					print_debug('Email being sent to',$to);
+
+					$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $part_prefs['common']['tz_offset'];
+					$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat'];
+					$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat'];
+
+					$GLOBALS['phpgw']->datetime->tz_offset = ((60 * 60) * (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']);
+
+					if($old_starttime)
+					{
+						$details['olddate'] = $GLOBALS['phpgw']->common->show_date($old_starttime);
+					}
+					$details['startdate'] = $GLOBALS['phpgw']->common->show_date($starttime);
+					$details['enddate']   = $GLOBALS['phpgw']->common->show_date($endtime);
+					
+					
+					list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2);
+					
+					switch($part_prefs['timesheet']['update_format'])
+ 					{
+						case  'extended':
+							//$body .= "\n\n".lang('Event Details follow').":\n";
+							$body = '';
+							$body .= "<br>".lang('Event Details follow')." :: ";
+							foreach($event_arr as $key => $val)
+							{
+								// titulo
+								if($key =='title')
+								{
+									$var1 = $val['field'];
+									$vardata1 = $details[$key];
+								}
+								//descricao
+								if($key =='description')
+								{
+									$var2 = $val['field'];
+									$vardata2 = $details[$key];
+								}
+if($key =='description1')
+								{
+									$var2 = $val['field'];
+									$vardata2 = $details[$key];
+								}
+
+if($key =='participants1')
+								{
+									$var2 = $val['field'];
+									$vardata2 = $details[$key];
+								}
+
+								//dt inicio
+								if($key =='startdate')
+								{
+									switch(trim($part_prefs['common']['dateformat']))
+									{
+										
+										case ($part_prefs['common']['dateformat'] === "m/d/Y" || $part_prefs['common']['dateformat'] === "m-d-Y" || $part_prefs['common']['dateformat'] === "m.d.Y"):
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newmounth3 = substr($vardata3,0,2);
+											$newday3 = substr($vardata3,3,2);
+											$newyear3 = substr($vardata3,6,4);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+											
+										case	($part_prefs['common']['dateformat'] === "Y/d/m" || $part_prefs['common']['dateformat'] === "Y-d-m" || $part_prefs['common']['dateformat'] === "Y.d.m"):
+
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newyear3 = substr($vardata3,0,4);
+											$newday3 = substr($vardata3,5,2);
+											$newmounth3 = substr($vardata3,8,2);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+
+										case ($part_prefs['common']['dateformat'] === "Y/m/d" || $part_prefs['common']['dateformat'] === "Y-m-d" || $part_prefs['common']['dateformat'] === "Y.m.d"):
+
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newyear3 = substr($vardata3,0,4);
+											$newmounth3 = substr($vardata3,5,2);
+											$newday3 = substr($vardata3,8,2);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+
+										case ($part_prefs['common']['dateformat'] === "d/m/Y" || $part_prefs['common']['dateformat'] === "d-m-Y" || $part_prefs['common']['dateformat'] === "d.m.Y" || $part_prefs['common']['dateformat'] === "d-M-Y"):
+										
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newday3 = substr($vardata3,0,2);
+											$newmounth3 = substr($vardata3,3,2);
+											$newyear3 = substr($vardata3,6,4);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+									
+									}
+									
+								}
+								//dt final
+								if($key =='enddate')
+								{
+									$var4 = $val['field'];
+									$vardata4 = $details[$key];
+								}
+								//localizacao
+								if($key =='location')
+								{
+									$var8 = $val['field'];
+									$vardata8 = $details[$key];
+								}
+								//participantes
+								if($key =='participants')
+								{
+									$var5 = $val['field'];
+									foreach($val['data'] as $NewKey => $NewVal)
+									{
+										//Research inside of ldap ( Pesquisa dentro do ldap )
+										$newvalue = "";//$this->so->search_uidNumber($to);
+										foreach($newvalue as $tmp)
+										{
+											$tmpmail = $tmp['mail'][0];
+											$tmpuid = $tmp['uidnumber'][0];
+											if( trim($tmpmail) == trim($to) & trim($tmpuid) == trim($NewKey))
+											{
+													if($typesend == 3)
+													{
+
+														$lang1 = lang("To See Commitment");
+														$varbuttom = "<form action=".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=timesheet.uitimesheet.view&cal_id=$event[id]&date=$newall3' method='POST'>
+																		  		  <input type='submit' value='$lang1'>
+																		  		   </form>";
+														$lang2 = lang("To accept");
+														$varbuttom1 ="<input type='submit' value='$lang2' onClick='javascript:window.open(\"".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=timesheet.uitimesheet.set_action&cal_id=$event[id]&action=3&response=1\",\"frontpage\",\"height=100,width=400,statusbar=no,toolbar=no,scrollbars=no,menubar=no,left=300,top=200\")'>";
+
+														$lang3 = lang("To reject");
+														$varbuttom2 ="<input type='submit' value='$lang3' onClick='javascript:window.open(\"".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=timesheet.uitimesheet.set_action&cal_id=$event[id]&action=0&response=0\",\"frontpage\",\"height=100,width=400,statusbar=no,toolbar=no,scrollbars=no,menubar=no,left=300,top=200\")'>";
+														
+														$lang4 = lang("Alarm");
+														$varbuttom3 = "<form action=".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=timesheet.uialarm.manager method='POST'>
+																		  		  <input type='submit' value='$lang4'>
+																		  		  <input type='hidden' name='cal_id' value=$event[id]>
+																		  		   </form>";
+													}
+													else
+													{
+															$varbuttom  = "";
+															$varbuttom1 = "";
+															$varbuttom2 = "";
+															$varbuttom3 = "";
+													}
+											}
+											// It only mounts variavel with the name of the participants of the list ( Monta a variavel somente com o nome dos participantes da lista)
+											if($typesend == 3)
+											{
+												list($tmpvardata5,$tmp2vardata5) = explode("(",$NewVal);
+												$vardata5 = $tmpvardata5."<br>";
+											}
+											else
+											{
+												$vardata5 = $NewVal."<br>";
+											}
+										
+										}
+										$vardata6 .= $vardata5;
+										unset($vardata5);
+									}
+								}		
+							}
+							//To mount the message as text/html (Para montar a mensagem como text/html - /phpgwapi/inc/class.send.inc.php )
+							$content_type = "text/html";
+							//It mounts the body of the message (Monta o corpo da mensagem)
+							
+							// A constante PHPGW_APP_TPL nao existe para envio de alarmes (cront, asyncservice).
+							define ("PHPGW_APP_TPL",PHPGW_API_INC . "/../../timesheet/templates/".$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']."");
+							
+							$body = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+							$body->set_file(Array('timesheet' => 'body_email.tpl'));
+							$body->set_block('timesheet','list');
+							$var = Array(
+								'script'			=> $script,
+								'subject'			=> $body1,
+								'var1'				=> $var1,
+								'vardata1'			=> $vardata1,
+								'var2'				=> $var2,
+								'vardata2'			=> $vardata2,
+								'var3'				=> $var3,
+								'vardata3'			=> $vardata3,
+								'var4'				=> $var4,
+								'vardata4'			=> $vardata4,
+								'var5'				=> $var5,
+								'vardata6'			=> $vardata6,
+								'var8'				=> $var8,
+								'vardata8'			=> $vardata8,							
+								'varbuttom'			=> $varbuttom,
+								'varbuttom1'		=> $varbuttom1,
+								'varbuttom2'		=> $varbuttom2,
+								'varbuttom3'		=> $varbuttom3 
+								
+							);
+							$body->set_var($var);
+							$tmpbody = $body->fp('out','list');
+														
+							break;
+
+						case 'ical':
+							$content_type = "timesheet; method=$method; name=timesheet.ics";
+/*							if ($body != '')
+							{
+								$boundary = '----Message-Boundary';
+								$body .= "\n\n\n$boundary\nContent-type: text/$content_type\n".
+									"Content-Disposition: inline\nContent-transfer-encoding: 7BIT\n\n";
+								$content_type = '';
+							}
+*/
+							$body = ExecMethod('timesheet.boitimesheet.export',array(
+								'l_event_id'  => $event['id'],
+								'method'      => $method,
+								'chunk_split' => False
+							));
+							break;
+					}
+					$mail->AddAddress($to);
+					$mail->Body = $tmpbody;
+					$mail->From = $sender;
+					$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+					$mail->Sender = $mail->From;
+					$mail->SenderName = $mail->FromName;
+					$mail->Subject = $subject;
+					unset($vardata5);
+					unset($vardata6);
+				}
+			}
+
+			//Inicializa variï¿œvel de retorno.
+			$returncode=true;			
+			if(count($mail->to)) {				
+				// Envia aviso a todos os participantes.
+				if(!$mail->Send()) {				
+					$returncode = false;
+					$errorInfo['participants'] = $mail->ErrorInfo;
+				}
+				else
+					$returncode =  true;
+			}
+			
+			if(count($to_notify) && $this->ex_participants){
+				$mail->ClearAllRecipients();
+				$var = explode(",",trim($this->ex_participants));
+				$to = array();
+				if(!$subject) {
+					$details['startdate'] = $GLOBALS['phpgw']->common->show_date($starttime);
+					$details['enddate']   = $GLOBALS['phpgw']->common->show_date($endtime);
+					list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2);
+				}
+				
+				foreach($var as $index => $ex_participant){
+					$ex_participant = trim($ex_participant);
+					$ex_participant = preg_replace('#"(.*)" <(.*)\@(.*)\.(.*)>#','\\2@\\3.\\4',$ex_participant);
+						if($ex_participant)
+							$to[] = $ex_participant;
+				}		
+				
+				foreach($to as $i => $to_array)
+					$mail->AddAddress($to_array);
+				
+				$_body = explode("<hr size='1' width='100%'>",$tmpbody);
+				$tmpbody = $_body[0] ? $_body[0] : $subject ;
+				$tmpbody.= "<br><b>".lang("external participants").":: </b> ".htmlentities($this->ex_participants);
+				$tmpbody.= "<br>".lang("Summary").": "."";//$this->so->cal->event[title]."<br>";
+				$tmpbody.= "<br>".lang("Start time").": ".$GLOBALS['phpgw']->common->show_date($starttime)."<br>".lang("End date").": ".$GLOBALS['phpgw']->common->show_date($endtime)."<br>";
+				$tmpbody.= "<br><br><hr size='1' width='100%'><font color='red'>"
+				.lang("This message was sent by server. You must send a message to sender to confirm this event")."<br>"
+				.lang("This is an external event. Even if it added to your expresso its can be changed any time at all")."</font><br>";
+				
+				if ($GLOBALS['botimesheet']->so->cal->event[start][month] > 10)
+					$event_month=$GLOBALS['botimesheet']->so->cal->event[start][month];
+				else
+					$event_month="0".$GLOBALS['botimesheet']->so->cal->event[start][month];
+				//attach extern vcard			
+				// define('context','$GLOBALS.botimesheet.so.cal.event');
+				$tmpattach = $this->create_vcard($GLOBALS['botimesheet']->so->cal->event);
+				if($tmpattach){					
+					$tmpbody .="<a href='../index.php?menuaction=timesheet.uitimesheet.add&date="
+					.$GLOBALS['botimesheet']->so->cal->event[start][year]
+				.$event_month
+				.$GLOBALS['botimesheet']->so->cal->event[start][mday]
+					."&hour=".$GLOBALS['botimesheet']->so->cal->event[start][hour]
+					."&minute=".$GLOBALS['botimesheet']->so->cal->event[start][min]
+					."&title=".$GLOBALS['botimesheet']->so->cal->event['title']
+					."&description=".$GLOBALS['botimesheet']->so->cal->event['description']
+."&description1=".$GLOBALS['botimesheet']->so->cal->event['description1']
+."&participants1=".$GLOBALS['botimesheet']->so->cal->event['participants1']
+					."&location=".$GLOBALS['botimesheet']->so->cal->event['location']."'>"
+					."<h2>".lang("Add to my expresso")."</h2>";
+					$tempdir = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP;
+					srand((double)microtime()*1000000);
+					$random_number = rand(100000000,999999999);
+					$newfilename = md5(time() . getenv("REMOTE_ADDR") . $random_number );
+					$filename = $tempdir . $newfilename;
+					$attach_fd = fopen($filename,"w+");
+					fwrite($attach_fd,$tmpattach);
+					$mail->AddAttachment($filename, "extern.vcard", "base64", "text/plain"); // "application/octet-stream"
+					fclose($attach_fd);
+				}
+				$mail->From = $sender;
+				$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+				$mail->Sender = $mail->From;
+				$mail->SenderName = $mail->FromName;
+				$mail->Subject = lang("External event from Expresso");
+				$mail->Body = $tmpbody;
+																		
+				if(!$mail->Send()) 
+				{
+					$returncode=false;
+					$errorInfo['ex_participants'] = $mail->ErrorInfo;
+				}
+				else
+				{
+					$returncode=true;
+				}
+			}
+
+
+			if((is_int($this->user) && $this->user != $temp_user['account_id']) ||
+				(is_string($this->user) && $this->user != $temp_user['account_lid']))
+			{
+				$GLOBALS['phpgw_info']['user'] = $temp_user;
+			}	
+
+			$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $temp_tz_offset;
+			$GLBOALS['phpgw']->datetime->tz_offset = ((60 * 60) * $temp_tz_offset);
+			$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $temp_timeformat;
+			$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
+			
+			// Notifica por email o criador do compromisso, com as possï¿œveis falhas.						
+			if($errorInfo) {
+				$tmpbody = "<font color='red'>".lang("The following commitment had problems for DELIVERING the NOTIFICATION messages.").".</font><br>";
+				$tmpbody.= "<br>".lang("Summary").": "."";//$this->so->cal->event[title]."<br>";
+				$tmpbody.= "<br>".lang("Start time").": ".$GLOBALS['phpgw']->common->show_date($starttime)."<br>".lang("End date").": ".$GLOBALS['phpgw']->common->show_date($endtime)."<br>";				
+				$tmpbody.= "<br><u>".lang("Failed to delivery")."</u><br>";
+				$failed = false;				
+				if(strstr($errorInfo['participants'],"recipients_failed")){
+					$failed	= explode("recipients_failed",$errorInfo['participants']);
+					$tmpbody.= lang("to").": ".$failed[1];
+				}
+				if(strstr($errorInfo['ex_participants'],"recipients_failed")){
+					$failed = explode("recipients_failed",$errorInfo['ex_participants']);
+					$tmpbody.= lang("to").": ".$failed[1];
+				}			
+				if(!$failed) {
+					$tmpbody.= lang("Description").":<br>";
+$tmpbody.= lang("Description1").":<br>";
+$tmpbody.= lang("participants1").":<br>";
+					$tmpbody.= $errorInfo['participants'];
+					$tmpbody.= "<br>".$errorInfo['ex_participants'];
+				}
+				$tmpbody.= "<br>".lang("Subject").": ".$subject;
+				// Reinicializa o objeto, devido ao erro anterior na entrega.
+				
+				$mail = new PHPMailer();
+				$mail->IsSMTP();
+				$mail->Host = $emailadmin['smtpServer'];
+				$mail->Port = $emailadmin['smtpPort'];
+				$mail->From = $sender;
+				$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+				$mail->Sender = $mail->From;
+				$mail->SenderName = $mail->FromName;
+				$mail->IsHTML(True);
+				$mail->Subject = lang("timesheet event")." - ".lang("email notification");							
+				$mail->Body = $tmpbody;					
+				$mail->AddAddress($sender);
+				if(!$mail->Send())			
+					$returncode = false;
+				else
+					$returncode =  true;
+			}
+			return $returncode;
+		}
+		
+		function send_alarm($alarm)
+		{
+			//echo "<p>botimesheet::send_alarm("; print_r($alarm); echo ")</p>\n";
+			
+			$GLOBALS['phpgw_info']['user']['account_id'] = $this->owner = $alarm['owner'];
+
+			if (!$alarm['enabled'] || !$alarm['owner'] || !$alarm['cal_id'] )
+			{
+				return False;	// event not found
+			}
+			if ($alarm['all'])
+			{
+				$to_notify = $event['participants'];
+			}
+			elseif ($this->check_perms(PHPGW_ACL_READ,$event))	// checks agains $this->owner set to $alarm[owner]
+			{
+				$to_notify[$alarm['owner']] = 'A';
+			}
+			else
+			{
+				return False;	// no rights
+			}
+			return $this->send_update(MSG_ALARM,$to_notify,$event,False,$alarm['owner']);
+		}
+
+		function get_alarms($event_id)
+		{
+			return "";//$this->so->get_alarm($event_id);
+		}
+
+		function alarm_today($event,$today,$starttime)
+		{
+			$found = False;
+			@reset($event['alarm']);
+			$starttime_hi = $GLOBALS['phpgw']->common->show_date($starttime,'Hi');
+			$t_appt['month'] =$GLOBALS['phpgw']->common->show_date($today,'m');
+			$t_appt['mday'] = $GLOBALS['phpgw']->common->show_date($today,'d');
+			$t_appt['year'] = $GLOBALS['phpgw']->common->show_date($today,'Y');
+			$t_appt['hour'] = $GLOBALS['phpgw']->common->show_date($starttime,'H');
+			$t_appt['min']  = $GLOBALS['phpgw']->common->show_date($starttime,'i');
+			$t_appt['sec']  = 0;
+			$t_time = $this->maketime($t_appt) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$y_time = $t_time - 86400;
+			$tt_time = $t_time + 86399;
+			print_debug('T_TIME',$t_time.' : '.$GLOBALS['phpgw']->common->show_date($t_time));
+			print_debug('Y_TIME',$y_time.' : '.$GLOBALS['phpgw']->common->show_date($y_time));
+			print_debug('TT_TIME',$tt_time.' : '.$GLOBALS['phpgw']->common->show_date($tt_time));
+			while(list($key,$alarm) = each($event['alarm']))
+			{
+				if($alarm['enabled'])
+				{
+					print_debug('TIME',$alarm['time'].' : '.$GLOBALS['phpgw']->common->show_date($alarm['time']).' ('.$event['id'].')');
+					if($event['recur_type'] != MCAL_RECUR_NONE)   /* Recurring Event */
+					{
+						print_debug('Recurring Event');
+						if($alarm['time'] > $y_time && $GLOBALS['phpgw']->common->show_date($alarm['time'],'Hi') < $starttime_hi && $alarm['time'] < $t_time)
+						{
+							$found = True;
+						}
+					}
+					elseif($alarm['time'] > $y_time && $alarm['time'] < $t_time)
+					{
+						$found = True;
+					}
+				}
+			}
+			print_debug('Found',$found);
+			return $found;
+		}
+
+		function prepare_recipients(&$new_event,$old_event)
+		{
+						
+			// Find modified and deleted users.....
+			while(list($old_userid,$old_status) = each($old_event['participants']))
+			{
+				if(isset($new_event['participants'][$old_userid]))
+				{
+					print_debug('Modifying event for user',$old_userid);
+					$this->modified[(int)$old_userid] = $new_status;
+				}
+				else
+				{
+					print_debug('Deleting user from the event',$old_userid);
+					$this->deleted[(int)$old_userid] = $old_status;
+				}
+			}
+			// Find new users.....
+			while(list($new_userid,$new_status) = each($new_event['participants']))
+			{
+				if(!isset($old_event['participants'][$new_userid]))
+				{
+					print_debug('Adding event for user',$new_userid);
+					$this->added[$new_userid] = 'U';
+					$new_event['participants'][$new_userid] = 'U';
+				}
+			}
+			
+			if(count($this->added) > 0 || count($this->modified) > 0 || count($this->deleted) > 0)
+			{
+				if(count($this->added) > 0)
+				{
+					$this->ex_participants = '';
+					$this->send_update(MSG_ADDED,$this->added,'',$new_event);
+				}
+				if(count($this->modified) > 0)
+				{
+					$this->send_update(MSG_MODIFIED,$this->modified,$old_event,$new_event);
+				}
+				if(count($this->deleted) > 0)
+				{
+					$this->ex_participants = '';
+					$this->send_update(MSG_DELETED,$this->deleted,$old_event);
+				}
+			}
+		}
+
+		function remove_doubles_in_cache($firstday,$lastday)
+		{
+			$already_moved = Array();
+			for($v=$firstday;$v<=$lastday;$v++)
+			{
+				if (!$this->cached_events[$v])
+				{
+					continue;
+				}
+				$cached = $this->cached_events[$v];
+				$this->cached_events[$v] = array();
+				while (list($g,$event) = each($cached))
+				{
+					$end = date('Ymd',$this->maketime($event['end']));
+					print_debug('EVENT',_debug_array($event,False));
+					print_debug('start',$start);
+					print_debug('v',$v);
+
+					if (!isset($already_moved[$event['id']]) || $event['recur_type'] && $v > $end)
+					{
+						$this->cached_events[$v][] = $event;
+						$already_moved[$event['id']] = 1;
+						print_debug('Event moved');
+					}
+				}
+			}
+		}
+
+		function get_dirty_entries($lastmod=-1)
+		{
+			$events = false;
+			$event_ids = "";//$this->so->cal->list_dirty_events($lastmod);
+			if(is_array($event_ids))
+			{
+				foreach($event_ids as $key => $id)
+				{
+					$events[$id] = "";//$this->so->cal->fetch_event($id);
+				}
+			}
+			unset($event_ids);
+
+			$rep_event_ids = "";//$this->so->cal->list_dirty_events($lastmod,$true);
+			if(is_array($rep_event_ids))
+			{
+				foreach($rep_event_ids as $key => $id)
+				{
+					$events[$id] = "";//$this->so->cal->fetch_event($id);
+				}
+			}
+			unset($rep_event_ids);
+
+			return $events;
+		}
+
+		function _debug_array($data)
+		{
+			echo '<br>UI:';
+			_debug_array($data);
+		}
+
+		/*!
+		@function rejected_no_show
+		@abstract checks if event is rejected from user and he's not the owner and dont want rejected
+		@param $event to check
+		@returns True if event should not be shown
+		*/
+		function rejected_no_show($event)
+		{
+			$ret = !$this->prefs['timesheet']['show_rejected'] &&
+				$event['owner'] != $this->owner &&
+				$event['participants'][$this->owner] == 'R';
+			//echo "<p>rejected_no_show($event[title])='$ret': user=$this->owner, event-owner=$event[owner], status='".$event['participants'][$this->owner]."', show_rejected='".$this->prefs['timesheet']['show_rejected']."'</p>\n";
+			return $ret;
+		}
+
+		/* This is called only by list_cals().  It was moved here to remove fatal error in php5 beta4 */
+		function list_cals_add($id,&$users,&$groups)
+		{
+			$name = $GLOBALS['phpgw']->common->grab_owner_name($id);
+			if (($type = $GLOBALS['phpgw']->accounts->get_type($id)) == 'g')
+			{
+				$arr = &$groups;
+			}
+			else
+			{
+				$arr = &$users;
+			}
+			$arr[$name] = Array(
+				'grantor' => $id,
+				'value'   => ($type == 'g' ? 'g_' : '') . $id,
+				'name'    => $name
+			);
+		}
+
+		/*!
+		@function list_cals
+		@abstract generate list of user- / group-timesheets for the selectbox in the header
+		@returns alphabeticaly sorted array with groups first and then users
+		*/
+		function list_cals()
+		{
+			$users = $groups = array();
+			foreach($this->grants as $id => $rights)
+			{
+				$this->list_cals_add($id,$users,$groups);
+			}
+			
+			//by JakJr, melhora de performance na abertura da agenda
+			/*if ($memberships = $GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']))
+			{
+				foreach($memberships as $group_info)
+				{
+					$this->list_cals_add($group_info['account_id'],$users,$groups);
+
+					if ($account_perms = $GLOBALS['phpgw']->acl->get_ids_for_location($group_info['account_id'],PHPGW_ACL_READ,'timesheet'))
+					{
+						foreach($account_perms as $id)
+						{
+							$this->list_cals_add($id,$users,$groups);
+						}
+					}
+				}
+			}*/
+			uksort($users,'strnatcasecmp');
+			uksort($groups,'strnatcasecmp');
+
+			return $users + $groups;	// users first and then groups, both alphabeticaly
+		}
+
+	  function translate($key,$vars=false, $not_found='*' )
+	  {
+    	    if ($this->async)
+	      return $GLOBALS['phpgw']->translation->translate_async($key, $vars);
+	    return lang($key, $vars);
+	  }
+
+		/*!
+		@function event2array
+		@abstract create array with name, translated name and readable content of each attributes of an event
+		@syntax event2array($event,$sep='<br>')
+		@param $event event to use
+		@returns array of attributes with fieldname as key and array with the 'field'=translated name \
+			'data' = readable content (for participants this is an array !)
+		*/
+		function event2array($event)
+		{
+			
+			
+		  $var['title'] = Array(
+				'field'		=> $this->translate('Title'),
+				'data'		=> $event['title']
+			);
+
+			// Some browser add a \n when its entered in the database. Not a big deal
+			// this will be printed even though its not needed.
+			$var['description'] = Array(
+				'field'	=> $this->translate('Description'),
+				'data'	=> $event['description']
+			);
+$var['description1'] = Array(
+				'field'	=> $this->translate('Description1'),
+				'data'	=> $event['description1']
+			);
+
+
+$var['participants1'] = Array(
+				'field'	=> $this->translate('participants1'),
+				'data'	=> $event['participants1']
+			);
+
+			$var['ex_participants'] = Array(
+				'field'	=> $this->translate('External Participants'),
+				'data'	=> $event['ex_participants']
+			);
+			
+			$cats = Array();
+			$this->cat->categories($this->bo->owner,'timesheet');
+			if(strpos($event['category'],','))
+			{
+				$cats = explode(',',$event['category']);
+			}
+			else
+			{
+				$cats[] = $event['category'];
+			}
+			foreach($cats as $cat_id)
+			{
+				list($cat) = $this->cat->return_single($cat_id);
+				$cat_string[] = $cat['name'];
+			}
+			$var['category'] = Array(
+				'field'	=> $this->translate('Category'),
+				'data'	=> implode(', ',$cat_string)
+			);
+
+			$var['location'] = Array(
+				'field'	=> $this->translate('Location'),
+				'data'	=> $event['location']
+			);
+
+			$var['startdate'] = Array(
+				'field'	=> $this->translate('Start Date/Time'),
+				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset),
+			);
+
+			$var['enddate'] = Array(
+				'field'	=> $this->translate('End Date/Time'),
+				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset)
+			);
+
+			$pri = Array(
+				1	=> lang('Low'),
+				2	=> lang('Normal'),
+				3	=> lang('High')
+			);
+			$var['priority'] = Array(
+				'field'	=> lang('Priority'),
+				'data'	=> $pri[$event['priority']]
+			);
+
+			$var['owner'] = Array(
+				'field'	=> lang('Created By'),
+				'data'	=> $GLOBALS['phpgw']->common->grab_owner_name($event['owner'])
+			);
+
+			$var['updated'] = Array(
+				'field'	=> lang('Updated'),
+				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['modtime']) - $GLOBALS['phpgw']->datetime->tz_offset)
+			);
+
+			$var['access'] = Array(
+				'field'	=> lang('Access'),
+				'data'	=> $event['public'] ? lang('Public') : lang('Private')
+			);
+
+			if(@isset($event['groups'][0]))
+			{
+				$cal_grps = '';
+				for($i=0;$i<count($event['groups']);$i++)
+				{
+					if($GLOBALS['phpgw']->accounts->exists($event['groups'][$i]))
+					{
+						$cal_grps .= ($i>0?'<br>':'').$GLOBALS['phpgw']->accounts->id2name($event['groups'][$i]);
+					}
+				}
+
+				$var['groups'] = Array(
+					'field'	=> lang('Groups'),
+					'data'	=> $cal_grps
+				);
+			}
+
+			$participants = array();
+			foreach($event['participants'] as $user => $short_status)
+			{
+				if($GLOBALS['phpgw']->accounts->exists($user))
+				{
+					$participants[$user] = $GLOBALS['phpgw']->common->grab_owner_name($user).' ('.$this->get_long_status($short_status).')';
+				}
+			}
+			$var['participants'] = Array(
+				'field'	=> $this->translate('Participants'),
+				'data'	=> $participants
+			);
+
+			// Repeated Events
+			if($event['recur_type'] != MCAL_RECUR_NONE)
+			{
+				$str = lang($this->rpt_type[$event['recur_type']]);
+
+				$str_extra = array();
+				if ($event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['month'] != 0 && $event['recur_enddate']['year'] != 0)
+				{
+					$recur_end = $this->maketime($event['recur_enddate']);
+					if($recur_end != 0)
+					{
+						$recur_end -= $GLOBALS['phpgw']->datetime->tz_offset;
+						$str_extra[] = lang('ends').': '.lang($GLOBALS['phpgw']->common->show_date($recur_end,'l')).', '.$this->long_date($recur_end).' ';
+					}
+				}
+				// only weekly uses the recur-data (days) !!!
+				if($event['recur_type'] == MCAL_RECUR_WEEKLY)
+				{
+					$repeat_days = array();
+					foreach ($this->rpt_day as $mcal_mask => $dayname)
+					{
+						if ($event['recur_data'] & $mcal_mask)
+						{
+							$repeat_days[] = lang($dayname);
+						}
+					}
+					if(count($repeat_days))
+					{
+						$str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days);
+					}
+				}
+				if($event['recur_interval'] != 0)
+				{
+					$str_extra[] = lang('Interval').': '.$event['recur_interval'];
+				}
+
+				if(count($str_extra))
+				{
+					$str .= ' ('.implode(', ',$str_extra).')';
+				}
+
+				$var['recure_type'] = Array(
+					'field'	=> lang('Repetition'),
+					'data'	=> $str,
+				);
+			}
+
+			if (!isset($this->fields))
+			{
+				$this->custom_fields = CreateObject('timesheet.bocustom_fields');
+				$this->fields = &$this->custom_fields->fields;
+				$this->stock_fields = &$this->custom_fields->stock_fields;
+			}
+			foreach($this->fields as $field => $data)
+			{
+				if (!$data['disabled'])
+				{
+					if (isset($var[$field]))
+					{
+						$sorted[$field] = $var[$field];
+					}
+					elseif (!isset($this->stock_fields[$field]) && strlen($event[$field]))	// Custom field
+					{
+						$lang = lang($name = substr($field,1));
+						$sorted[$field] = array(
+							'field' => $lang == $name.'*' ? $name : $lang,
+							'data'  => $event[$field]
+						);
+					}
+				}
+				unset($var[$field]);
+			}
+			foreach($var as $name => $v)
+			{
+				$sorted[$name] = $v;
+
+			}
+			return $sorted;
+		}
+
+		/*!
+		@function check_set_default_prefs
+		@abstract sets the default prefs, if they are not already set (on a per pref. basis)
+		@note It sets a flag in the app-session-data to be called only once per session
+		*/
+		function check_set_default_prefs()
+		{
+			if (($set = $GLOBALS['phpgw']->session->appsession('default_prefs_set','timesheet')))
+			{
+				return;
+			}
+			$GLOBALS['phpgw']->session->appsession('default_prefs_set','timesheet','set');
+
+			//$default_prefs = $GLOBALS['phpgw']->preferences->default['timesheet']; jakjr
+
+			$subject = $this->translate('timesheet Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
+			$defaults = array(
+				'defaulttimesheet' => 'week',
+				'mainscreen_showevents' => '0',
+				'summary'         => 'no',
+				'receive_updates' => 'no',
+				'update_format'   => 'extended',	// leave it to extended for now, as iCal kills the message-body
+				'notifyAdded'     => $subject . $this->translate ('You have a meeting scheduled for %1',array('$$startdate$$')),
+				'notifyCanceled'  => $subject . $this->translate ('Your meeting scheduled for %1 has been canceled',array('$$startdate$$')),
+				'notifyModified'  => $subject . $this->translate ('Your meeting that had been scheduled for %1 has been rescheduled to %2',array('$$olddate$$','$$startdate$$')),
+				'notifyResponse'  => $subject . $this->translate ('On %1 %2 %3 your meeting request for %4', array('$$date$$','$$fullname$$','$$action$$','$$startdate$$')),
+				'notifyAlarm'     => $this->translate('Alarm for %1 at %2 in %3',array('$$title$$','$$startdate$$','$$location$$')) . "\n" . $this->translate('Here is your requested alarm.'),
+				'show_rejected'   => '0',
+				'hide_event_conflict'   => '0',
+				'display_status'  => '1',
+				'weekdaystarts'   => 'Monday',
+				'workdaystarts'   => '9',
+				'workdayends'     => '17',
+				'interval'        => '30',
+				'defaultlength'   => '60',
+				'planner_start_with_group' => $GLOBALS['phpgw']->accounts->name2id('Default'),
+				'planner_intervals_per_day'=> '4',
+				'defaultfilter'   => 'all',
+				'default_private' => '0',
+				'display_minicals'=> '1',
+				'print_black_white'=>'0'
+			);
+			foreach($defaults as $var => $default)
+			{
+				if (!isset($default_prefs[$var]) || $default_prefs[$var] == '')
+				{
+					$GLOBALS['phpgw']->preferences->add('timesheet',$var,$default,'default');
+					$need_save = True;
+				}
+			}
+			if ($need_save)
+			{
+				$prefs = $GLOBALS['phpgw']->preferences->save_repository(False,'default');
+				$this->prefs['timesheet'] = $prefs['timesheet'];
+			}
+			if ($this->prefs['timesheet']['send_updates'] && !isset($this->prefs['timesheet']['receive_updates']))
+			{
+				$this->prefs['timesheet']['receive_updates'] = $this->prefs['timesheet']['send_updates'];
+				$GLOBALS['phpgw']->preferences->add('timesheet','receive_updates',$this->prefs['timesheet']['send_updates']);
+				$GLOBALS['phpgw']->preferences->delete('timesheet','send_updates');
+				$prefs = $GLOBALS['phpgw']->preferences->save_repository();
+			}
+		}
+
+		// return array with all timesheet categories (for xmlrpc)
+		function categories($complete = False)
+		{
+			return $GLOBALS['server']->categories($complete);
+		}
+/******************************************/
+
+function insert($params='')
+		{
+
+			if($params['from_mobile']) {
+				$ui_return = "mobile.ui_mobiletimesheet.edit";
+				$ui_index = "mobile.ui_mobiletimesheet.index";
+				$ui_overlap = "mobile.ui_mobiletimesheet.overlap";
+			}
+			else {
+				$ui_return = "timesheet.uitimesheet.edit";
+				$ui_index = "timesheet.uitimesheet.index";		
+				$ui_overlap = "timesheet.uitimesheet.overlap";
+			}
+
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+			//$l_cal = (@isset($params['info_type']) && $params['info_type']?$params['info_type']:$_POST['info_type']);
+			$l_participants = (@$params['participants']?$params['participants']:$_POST['participants']);
+			$this->ex_participants = (@$params['ex_participants']?$params['ex_participants']:$_POST['ex_participants']);
+			$l_categories = (@$params['categories']?$params['categories']:$_POST['categories']);
+			$l_start = (@isset($params['start']) && $params['start']?$params['start']:$_POST['start']);
+			$l_end = (@isset($params['end']) && $params['end']?$params['end']:$_POST['end']);
+			$l_recur_enddate = (@isset($params['recur_enddate']) && $params['recur_enddate']?$params['recur_enddate']:$_POST['recur_enddate']);
+
+			
+			$send_to_ui = True;
+			//if ((!is_array($l_start) || !is_array($l_end)) && !isset($_GET['readsess']))	// xmlrpc call
+			if ($this->xmlrpc)	// xmlrpc call
+			{
+
+				$send_to_ui = False;
+
+				$l_cal = $params;	// no extra array
+
+				foreach(array('start','end','recur_enddate') as $name)
+				{
+					$var = 'l_'.$name;
+					$$var = $GLOBALS['server']->iso86012date($params[$name]);
+					unset($l_cal[$name]);
+				}
+
+				if (!is_array($l_participants) || !count($l_participants))
+				{
+					$l_participants = array($GLOBALS['phpgw_info']['user']['account_id'].'A');
+				}
+				else
+				{
+					$l_participants = array();
+					foreach($params['participants'] as $user => $data)
+					{
+						$l_participants[] = $user.$data['status'];
+					}
+				}
+
+				unset($l_cal['participants']);
+
+				if (!is_object($GLOBALS['phpgw']->categories))
+				{
+					$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
+				}
+
+				$l_categories = $GLOBALS['server']->xmlrpc2cats($params['category']);
+				unset($l_cal['category']);
+
+				// using access={public|private} in all modules via xmlrpc
+				$l_cal['public'] = $params['access'] != 'private';
+				unset($l_cal['access']);
+/*
+				$fp = fopen('/tmp/xmlrpc.log','a+');
+				ob_start();
+				echo "\nbotimesheet::update("; print_r($params); echo ")\n";
+				//echo "\nl_start="; print_r($l_start);
+				//echo "\nl_end="; print_r($l_end);
+				fwrite($fp,ob_get_contents());
+				ob_end_clean();
+				fclose($fp);
+*/
+			}
+
+			print_debug('ID',$l_cal['id']);
+
+			// don't wrap to the next day for no time
+			if ($l_end['hour'] == 24 && $l_end['min'] == 0)
+			{
+				$l_end['hour'] = 23;
+				$l_end['min'] = 59;
+			}
+
+			if(isset($_GET['readsess']))
+			{
+
+				$event = $this->restore_from_appsession();
+				$event['title'] = stripslashes($event['title']);
+				$event['description'] = stripslashes($event['description']);
+$event['description1'] = stripslashes($event['description1']);
+$event['participants1'] = stripslashes($event['participants1']);
+				$event['ex_participants'] = stripslashes($event['ex_participants']);
+				$datetime_check = $this->validate_update($event);
+				if($datetime_check)
+				{
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				$overlapping_events = False;
+			}
+			else
+			{
+
+				if((!$l_cal['id'] && !$this->check_perms(PHPGW_ACL_ADD)) ||
+				   ($l_cal['id'] && !$this->check_perms(PHPGW_ACL_EDIT,$l_cal['id'])))
+				{
+
+					if ($this->xmlrpc)
+					{
+						$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
+					}
+					if (!$send_to_ui)
+					{
+						return array(($l_cal['id']?1:2) => 'permission denied');
+					}
+
+					ExecMethod($ui_index);
+
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					else
+						return;
+				}
+
+				print_debug('Prior to fix_update_time()');
+
+				$this->fix_update_time($l_start);
+
+				$this->fix_update_time($l_end);
+
+				if(!isset($l_cal['ex_participants']))
+				{
+					$l_cal['ex_participants'] = $this->ex_participants;
+				}
+
+				if(!isset($l_categories))
+				{
+					$l_categories = 0;
+				}
+
+				$is_public = ($l_cal['type'] != 'private' && $l_cal['type'] != 'privateHiddenFields');
+
+				//$this->so->event_init();
+
+			$this->add_attribute('uid',$l_cal['uid']);
+
+				$this->add_attribute('type',$l_cal['type']);
+
+				if($l_cal['ex_participants']) {
+					$this->add_attribute('ex_participants',$l_cal['ex_participants']);
+				}
+				if(count($l_categories) >= 2)
+				{
+					//$this->so->set_category(implode(',',$l_categories));
+				}
+				else
+				{
+					//$this->so->set_category(strval($l_categories[0]));
+				}
+				/*$this->so->set_title($l_cal['title']);
+				$this->so->set_description($l_cal['description']);
+$this->so->set_description1($l_cal['description1']);
+$this->so->set_participants1($l_cal['participants1']);
+				$this->so->set_ex_participants($l_cal['ex_participants']);
+				$this->so->set_start($l_start['year'],$l_start['month'],$l_start['mday'],$l_start['hour'],$l_start['min'],0);
+				$this->so->set_end($l_end['year'],$l_end['month'],$l_end['mday'],$l_end['hour'],$l_end['min'],0);
+				$this->so->set_class($is_public);
+				$this->so->add_attribute('reference',(@isset($l_cal['reference']) && $l_cal['reference']?$l_cal['reference']:0));
+				$this->so->add_attribute('location',(@isset($l_cal['location']) && $l_cal['location']?$l_cal['location']:''));*/
+				if($l_cal['id'])
+				{
+					//$this->so->add_attribute('id',$l_cal['id']);
+				}
+
+				if($l_cal['rpt_use_end'] != 'y')
+				{
+					$l_recur_enddate['year'] = 0;
+					$l_recur_enddate['month'] = 0;
+					$l_recur_enddate['mday'] = 0;
+				}
+				elseif (isset($l_recur_enddate['str']))
+				{
+					$l_recur_enddate = $this->jscal->input2date($l_recur_enddate['str'],False,'mday');
+				}
+
+				switch((int)$l_cal['recur_type'])
+				{
+
+
+					case MCAL_RECUR_NONE:
+						//$this->so->set_recur_none();
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						break;
+					case MCAL_RECUR_DAILY:
+						//$this->so->set_recur_daily((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_WEEKLY:
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+
+						foreach(array('rpt_sun','rpt_mon','rpt_tue','rpt_wed','rpt_thu','rpt_fri','rpt_sat') as $rpt_day)
+						{
+							$l_cal['recur_data'] += (int)$l_cal[$rpt_day];
+						}
+						if (is_array($l_cal['rpt_day']))
+						{
+							foreach ($l_cal['rpt_day'] as $mask)
+							{
+								$l_cal['recur_data'] |= (int)$mask;
+								$rpt_wdays = $l_cal['recur_data']; // recebe os dias da semana (somatorio) para repetir o alarme;
+							}
+						}
+						//$this->so->set_recur_weekly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval'],$l_cal['recur_data']);
+						break;
+					case MCAL_RECUR_MONTHLY_MDAY:
+						//$this->so->set_recur_monthly_mday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_MONTHLY_WDAY:
+						//$this->so->set_recur_monthly_wday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+						break;
+					case MCAL_RECUR_YEARLY:
+						//$this->so->set_recur_yearly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+				}
+
+				if($l_participants)
+				{
+					$parts = $l_participants;
+					$minparts = min($l_participants);
+					$part = Array();
+					for($i=0;$i<count($parts);$i++)
+					{
+						if (($accept_type = substr($parts[$i],-1,1)) == '0' || (int)$accept_type > 0)
+						{
+							$accept_type = 'U';
+						}
+						$acct_type = $GLOBALS['phpgw']->accounts->get_type((int)$parts[$i]);
+						if($acct_type == 'u')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+						}
+						elseif($acct_type == 'g')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+							$groups[] = $parts[$i];
+							/* This pulls ALL users of a group and makes them as participants to the event */
+							/* I would like to turn this back into a group thing. */
+							$acct = CreateObject('phpgwapi.accounts',(int)$parts[$i]);
+							$members = $acct->member((int)$parts[$i]);
+							unset($acct);
+							if($members == False)
+							{
+								continue;
+							}
+							while($member = each($members))
+							{
+								$part[$member[1]['account_id']] = $accept_type;
+							}
+						}
+					}
+				}
+				else
+				{
+					$part = False;
+				}
+
+				if($part)
+				{
+					@reset($part);
+					while(list($key,$accept_type) = each($part))
+					{
+						//$this->so->add_attribute('participants',$accept_type,(int)$key);
+					}
+				}
+
+				if($groups)
+				{
+					@reset($groups);
+					//$this->so->add_attribute('groups',(int)$group_id);
+				}
+
+				$event = $this->get_cached_event();
+				if(!is_int($minparts))
+				{
+					$minparts = $this->owner;
+				}
+				if(!@isset($event['participants'][$l_cal['owner']]))
+				{
+					//$this->so->add_attribute('owner',$minparts);
+				}
+				else
+				{
+					//$this->so->add_attribute('owner',$l_cal['owner']);
+				}
+				//$this->so->add_attribute('priority',$l_cal['priority']);
+
+				foreach($l_cal as $name => $value)
+				{
+					if ($name[0] == '#')	// Custom field
+					{
+						//$this->so->add_attribute($name,stripslashes($value));
+					}
+				}
+				if (isset($_POST['preserved']) && is_array($preserved = unserialize(stripslashes($_POST['preserved']))))
+				{
+					foreach($preserved as $name => $value)
+					{
+						switch($name)
+						{
+							case 'owner':
+								//$this->so->add_attribute('participants',$value,$l_cal['owner']);
+								break;
+							default:
+								//$this->so->add_attribute($name,str_replace(array('&amp;','&quot;','&lt;','&gt;'),array('&','"','<','>'),$value));
+						}
+					}
+				}
+				$event = $this->get_cached_event();
+
+				if ($l_cal['alarmdays'] > 0 || $l_cal['alarmhours'] > 0 ||
+						$l_cal['alarmminutes'] > 0)
+				{
+					$offset = ($l_cal['alarmdays'] * 24 * 3600) +
+						($l_cal['alarmhours'] * 3600) + ($l_cal['alarmminutes'] * 60);
+
+					$time = $this->maketime($event['start']) - $offset;
+
+					$event['alarm'][] = Array(
+						'time'    => $time,
+						'offset'  => $offset,
+						'owner'   => $this->owner,
+						'enabled' => 1,
+						'repeat'  => $repetido, // para repetir alarme;
+						'init_rept' => $init_rept, // inicio repeticao;
+						'end_rept' => $end_rept, // fim repeticao;
+						'rpt_wdays' => $rpt_wdays // dias repeticao da semana;
+					);
+				}
+
+				$this->store_to_appsession($event);
+				$datetime_check = $this->validate_update($event);
+				print_debug('bo->validated_update() returnval',$datetime_check);
+
+				/*if($datetime_check)
+				{
+
+
+					if (!$send_to_ui)
+					{
+						return array($datetime_check => 'invalid input data');
+					}
+
+
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+
+				}/*/
+				if($event['id'])
+				{
+					$event_ids[] = $event['id'];
+				}
+				if($event['reference'])
+				{
+					$event_ids[] = $event['reference'];
+				}
+
+				$overlapping_events = $this->overlap(
+					$this->maketime($event['start']),
+					$this->maketime($event['end']),
+					$event['participants'],
+					$event['owner'],
+					$event_ids
+				);
+			}
+			if(!$this->ex_participants)
+				$this->ex_participants = $event['ex_participants'];			
+			if($overlapping_events)
+			{
+
+
+				if($send_to_ui)
+				{
+					$event['ex_participants'] = $this->ex_participants;
+					unset($GLOBALS['phpgw_info']['flags']['noheader']);
+					unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+					ExecMethod($ui_overlap,
+						Array(
+							'o_events'	=> $overlapping_events,
+							'this_event'	=> $event
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				else
+				{
+					return $overlapping_events;
+				}
+			}
+			else
+			{
+
+
+
+				if(!$event['id'])
+				{
+
+
+
+					//$this->so->add_entry($event);
+					$this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event());
+					print_debug('New Event ID',$event['id']);
+				}
+				else
+				{
+
+					print_debug('Updating Event ID',$event['id']);
+					$new_event = $event;
+					$old_event = $this->read_entry($event['id']);
+					// if old event has alarm and the start-time changed => update them
+					//echo "<p>checking ".count($old_event['alarm'])." alarms of event #$event[id] start moved from ".print_r($old_event['start'],True)." to ".print_r($event['start'],True)."</p>\n";
+					if ($old_event['alarm'] &&
+						$this->maketime($old_event['start']) != $this->maketime($event['start']))
+					{
+						//$this->so->delete_alarms($old_event['id']);
+						foreach($old_event['alarm'] as $id => $alarm)
+						{
+							$alarm['time'] = $this->maketime($event['start']) - $alarm['offset'];
+							$event['alarm'][] = $alarm;
+						}
+						//echo "updated alarms<pre>".print_r($event['alarm'],True)."</pre>\n";
+					}
+					//$this->so->cal->event = $event;
+					//$this->so->add_entry($event);
+					$this->prepare_recipients($new_event,$old_event);
+				}
+
+				$date = sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']);
+				if($send_to_ui)
+				{
+					$this->read_sessiondata();
+					if ($this->return_to)
+					{
+						$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->return_to);
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					}
+					Execmethod($ui_index);
+				}
+				else
+				{
+					return (int)$event['id'];
+				}
+			}
+			return True;
+		}
+
+function date_filter($name,&$start,&$end_param)
+	{
+		$end = $end_param;
+
+		if ($name == 'custom' && $start)
+		{
+			if ($end)
+			{
+				$end += 24*60*60;
+			}
+			else
+			{
+				$end = $start + 8*24*60*60;
+			}
+		}
+		else
+		{
+			if (!isset($this->date_filters[$name]))
+			{
+				return '1=1';
+			}
+			$year  = (int) date('Y',$this->today);
+			$month = (int) date('m',$this->today);
+			$day   = (int) date('d',$this->today);
+	
+			list($syear,$smonth,$sday,$sweek,$eyear,$emonth,$eday,$eweek) = $this->date_filters[$name];
+			
+			if ($syear || $eyear)
+			{
+				$start = mktime(0,0,0,1,1,$syear+$year);
+				$end   = mktime(0,0,0,1,1,$eyear+$year);
+			}
+			elseif ($smonth || $emonth)
+			{
+				$start = mktime(0,0,0,$smonth+$month,1,$year);
+				$end   = mktime(0,0,0,$emonth+$month,1,$year);
+			}
+			elseif ($sday || $eday)
+			{
+				$start = mktime(0,0,0,$month,$sday+$day,$year);
+				$end   = mktime(0,0,0,$month,$eday+$day,$year);
+			}
+			elseif ($sweek || $eweek)
+			{
+				$wday = (int) date('w',$this->today); // 0=sun, ..., 6=sat
+				switch($GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts'])
+				{
+					case 'Sunday':
+						$weekstart = $this->today - $wday * 24*60*60;
+						break;
+					case 'Saturday':
+						$weekstart = $this->today - (6-$wday) * 24*60*60;
+						break;
+					case 'Moday':
+					default:
+						$weekstart = $this->today - ($wday ? $wday-1 : 6) * 24*60*60;
+						break;
+				}
+				$start = $weekstart + $sweek*7*24*60*60;
+				$end   = $weekstart + $eweek*7*24*60*60;
+			}
+			$end_param = $end - 24*60*60;
+		}
+		//echo "<p align='right'>date_filter($name,$start,$end) today=".date('l, Y-m-d H:i',$this->today)." ==> ".date('l, Y-m-d H:i:s',$start)." <= date < ".date('l, Y-m-d H:i:s',$end)."</p>\n"; 
+		// convert start + end from user to servertime for the filter
+		return '('.($start-$this->tz_offset_s).' <= ts_start AND ts_start < '.($end-$this->tz_offset_s).')';
+	}
+/***********************************************/
+	}
+?>
Index: /contrib/Timesheet/inc/class.boholiday.inc.php
===================================================================
--- /contrib/Timesheet/inc/class.boholiday.inc.php	(revision 3526)
+++ /contrib/Timesheet/inc/class.boholiday.inc.php	(revision 3526)
@@ -0,0 +1,453 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - Holiday                                                     *
+  * http://www.egroupware.org                                                *
+  * Written by Mark Peters <skeeter@phpgroupware.org>                        *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class boholiday
+	{
+		var $public_functions = Array(
+			'add'		=> True,
+			'delete_holiday'	=> True,
+			'delete_locale'	=> True,
+			'accept_holiday'	=> True,
+			
+			'read_entries'	=> True,
+			'read_entry'	=> True,
+			'add_entry'	=> True,
+			'update_entry'	=> True
+		);
+
+		var $debug = False;
+		var $base_url = '/index.php';
+
+		var $ui;
+		var $so;
+		var $owner;
+		var $year;
+
+		var $id;
+		var $total;
+		var $start;
+		var $query;
+		var $sort;
+
+		var $locales = Array();
+		var $holidays;
+		var $cached_holidays;
+
+		function boholiday()
+		{
+			$this->so = CreateObject('calendar.soholiday');
+
+			$this->start  = (int)get_var('start',array('POST','GET'));
+			$this->query  = get_var('query',array('POST','GET'));
+			$this->sort   = get_var('sort',array('POST','GET'));
+			$this->order  = get_var('order',array('POST','GET'));
+			$this->id     = get_var('id',array('POST','GET'));
+			$this->year   = get_var('year',array('POST','GET'),date('Y'));
+			$this->locale = get_var('locale',array('POST','GET'));
+			if ($this->locale)
+			{
+				$this->locales[] = $this->locale;
+			}
+
+			if($this->debug)
+			{
+				echo '<-- Locale = '.$this->locales[0].' -->'."\n";
+			}
+
+			$this->total = $this->so->holiday_total($this->locales[0],$this->query,$this->year);
+		}
+
+		/* Begin Calendar functions */
+		function read_entry($id=0)
+		{
+			if($this->debug)
+			{
+				echo "BO : Reading Holiday ID : ".$id."<br>\n";
+			}
+
+			if(!$id)
+			{
+				if(!$this->id)
+				{
+					return Array();
+				}
+				else
+				{
+					$id = $this->id;
+				}
+			}
+
+			return $this->so->read_holiday($id);
+		}
+
+		function delete_holiday($id=0)
+		{
+			if(!$id)
+			{
+				if($this->id)
+				{
+					$id = $this->id;
+				}
+			}
+
+			$this->ui = CreateObject('calendar.uiholiday');
+			if($id)
+			{
+				$this->so->delete_holiday($id);
+				$this->ui->edit_locale();
+			}
+			else
+			{
+				$this->ui->admin();
+			}
+		}
+
+		function delete_locale($locale='')
+		{
+			if(!$locale)
+			{
+				if($this->locales[0])
+				{
+					$locale = $this->locales[0];
+				}
+			}
+
+			if($locale)
+			{
+				$this->so->delete_locale($locale);
+			}
+			$this->ui = CreateObject('calendar.uiholiday');
+			$this->ui->admin();
+		}
+
+		function accept_holiday()
+		{
+			$send_back_to = str_replace('submitlocale','holiday_admin',$_SERVER['HTTP_REFERER']);
+			if(!@$this->locales[0])
+			{
+				Header('Location: '.$send_back_to);
+			}
+
+			$send_back_to = str_replace('&locale='.$this->locales[0],'',$send_back_to);
+			$file = './holidays.'.$this->locales[0];
+			if(!file_exists($file) && count($_POST['name']))
+			{
+				$c_holidays = count($_POST['name']);
+				$fp = fopen($file,'w');
+				for($i=0;$i<$c_holidays;$i++)
+				{
+					fwrite($fp,$this->locales[0]."\t".$_POST['name'][$i]."\t".$_POST['day'][$i]."\t".$_POST['month'][$i]."\t".$_POST['occurence'][$i]."\t".$_POST['dow'][$i]."\t".$_POST['observance'][$i]."\n");
+				}
+				fclose($fp);
+			}
+			Header('Location: '.$send_back_to);
+		}
+
+		function get_holiday_list($locale='', $sort='', $order='', $query='', $total='', $year=0)
+		{
+			$locale = ($locale?$locale:$this->locales[0]);
+			$sort = ($sort?$sort:$this->sort);
+			$order = ($order?$order:$this->order);
+			$query = ($query?$query:$this->query);
+			$year = ($$year?$$year:$this->year);
+			return $this->so->read_holidays($locale,$query,$order,$year);
+		}
+
+		function get_locale_list($sort='', $order='', $query='')
+		{
+			$sort = ($sort?$sort:$this->sort);
+			$order = ($order?$order:$this->order);
+			$query = ($query?$query:$this->query);
+			return $this->so->get_locale_list($sort,$order,$query);
+		}
+
+		function prepare_read_holidays($year=0,$owner=0)
+		{
+			$this->year = (isset($year) && $year > 0?$year:$GLOBALS['phpgw']->common->show_date(time() - $GLOBALS['phpgw']->datetime->tz_offset,'Y'));
+			$this->owner = ($owner?$owner:$GLOBALS['phpgw_info']['user']['account_id']);
+
+			if($this->debug)
+			{
+				echo 'Setting Year to : '.$this->year.'<br>'."\n";
+			}
+
+			if(@$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
+			{
+				$this->locales[] = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
+			}
+			elseif(@$GLOBALS['phpgw_info']['user']['preferences']['calendar']['locale'])
+			{
+				$this->locales[] = $GLOBALS['phpgw_info']['user']['preferences']['calendar']['locale'];
+			}
+			else
+			{
+				$this->locales[] = 'US';
+			}
+
+			if($this->owner != $GLOBALS['phpgw_info']['user']['account_id'])
+			{
+				$owner_pref = CreateObject('phpgwapi.preferences',$owner);
+				$owner_prefs = $owner_pref->read_repository();
+				if(@$owner_prefs['common']['country'])
+				{
+					$this->locales[] = $owner_prefs['common']['country'];
+				}
+				elseif(@$owner_prefs['calendar']['locale'])
+				{
+					$this->locales[] = $owner_prefs['calendar']['locale'];
+				}
+				unset($owner_pref);
+			}
+
+			@reset($this->locales);
+			if($GLOBALS['phpgw_info']['server']['auto_load_holidays'] == True)
+			{
+				while(list($key,$value) = each($this->locales))
+				{
+					$this->auto_load_holidays($value);
+				}
+			}
+		}
+
+		function auto_load_holidays($locale)
+		{
+			if($this->so->holiday_total($locale) == 0)
+			{
+				@set_time_limit(0);
+
+				/* get the file that contains the calendar events for your locale */
+				/* "http://www.egroupware.org/cal/holidays.US.csv";                 */
+				$network = CreateObject('phpgwapi.network');
+				if(isset($GLOBALS['phpgw_info']['server']['holidays_url_path']) && $GLOBALS['phpgw_info']['server']['holidays_url_path'] != 'localhost')
+				{
+					$load_from = $GLOBALS['phpgw_info']['server']['holidays_url_path'];
+				}
+				else
+				{
+					$pos = strpos(' '.$GLOBALS['phpgw_info']['server']['webserver_url'],$_SERVER['HTTP_HOST']);
+					if($pos == 0)
+					{
+						switch($_SERVER['SERVER_PORT'])
+						{
+							case 80:
+								$http_protocol = 'http://';
+								break;
+							case 443:
+								$http_protocol = 'https://';
+								break;
+						}
+						$server_host = $http_protocol.$_SERVER['HTTP_HOST'].$GLOBALS['phpgw_info']['server']['webserver_url'];
+					}
+					else
+					{
+						$server_host = $GLOBALS['phpgw_info']['server']['webserver_url'];
+					}
+					$load_from = $server_host.'/calendar/egroupware.org';
+				}
+//				echo 'Loading from: '.$load_from.'/holidays.'.strtoupper($locale).'.csv'."<br>\n";
+				$lines = $network->gethttpsocketfile($load_from.'/holidays.'.strtoupper($locale).'.csv');
+				if (!$lines)
+				{
+					return false;
+				}
+				$c_lines = count($lines);
+				for($i=0;$i<$c_lines;$i++)
+				{
+//					echo 'Line #'.$i.' : '.$lines[$i]."<br>\n";
+					$holiday = explode("\t",$lines[$i]);
+					if(count($holiday) == 7)
+					{
+						$holiday['locale'] = $holiday[0];
+						$holiday['name'] = $GLOBALS['phpgw']->db->db_addslashes($holiday[1]);
+						$holiday['mday'] = (int)$holiday[2];
+						$holiday['month_num'] = (int)$holiday[3];
+						$holiday['occurence'] = (int)$holiday[4];
+						$holiday['dow'] = (int)$holiday[5];
+						$holiday['observance_rule'] = (int)$holiday[6];
+						$holiday['hol_id'] = 0;
+						$this->so->save_holiday($holiday);
+					}
+				}
+			}
+		}
+
+		function save_holiday($holiday)
+		{
+			$this->so->save_holiday($holiday);
+		}
+
+		function add()
+		{
+			if(@$_POST['submit'])
+			{
+				$holiday = $_POST['holiday'];
+
+				if(empty($holiday['mday']))
+				{
+					$holiday['mday'] = 0;
+				}
+				if(!isset($this->bo->locales[0]) || $this->bo->locales[0]=='')
+				{
+					$this->bo->locales[0] = $holiday['locale'];
+				}
+				elseif(!isset($holiday['locale']) || $holiday['locale']=='')
+				{
+					$holiday['locale'] = $this->bo->locales[0];
+				}
+				if(!isset($holiday['hol_id']))
+				{
+					$holiday['hol_id'] = $this->bo->id;
+				}
+
+				// some input validation
+
+				if (!$holiday['mday'] == !$holiday['occurence'])
+				{
+					$errors[] = lang('You need to set either a day or a occurence !!!');
+				}
+				if($holiday['year'] && $holiday['occurence'])
+				{
+					$errors[] = lang('You can only set a year or a occurence !!!');
+				}
+				else
+				{
+					$holiday['occurence'] = (int)($holiday['occurence'] ? $holiday['occurence'] : $holiday['year']);
+					unset($holiday['year']);
+				}
+
+	// Still need to put some validation in here.....
+
+				$this->ui = CreateObject('calendar.uiholiday');
+
+				if (is_array($errors))
+				{
+					$holiday['month'] = $holiday['month_num'];
+					$holiday['day']   = $holiday['mday'];
+					$this->ui->edit_holiday($errors,$holiday);
+				}
+				else
+				{
+					$this->so->save_holiday($holiday);
+					$this->ui->edit_locale($holiday['locale']);
+				}
+			}
+		}
+
+		function sort_holidays_by_date($holidays)
+		{
+			$c_holidays = count($holidays);
+			for($outer_loop=0;$outer_loop<($c_holidays - 1);$outer_loop++)
+			{
+				for($inner_loop=$outer_loop;$inner_loop<$c_holidays;$inner_loop++)
+				{
+					if($holidays[$outer_loop]['date'] > $holidays[$inner_loop]['date'])
+					{
+						$temp = $holidays[$inner_loop];
+						$holidays[$inner_loop] = $holidays[$outer_loop];
+						$holidays[$outer_loop] = $temp;
+					}
+				}
+			}
+			return $holidays;
+		}
+
+		function set_holidays_to_date($holidays)
+		{
+			$new_holidays = Array();
+			for($i=0;$i<count($holidays);$i++)
+			{
+//	echo "Setting Holidays Date : ".date('Ymd',$holidays[$i]['date'])."<br>\n";
+				$new_holidays[date('Ymd',$holidays[$i]['date'])][] = $holidays[$i];
+			}
+			return $new_holidays;
+		}
+
+		function read_holiday()
+		{
+			if(isset($this->cached_holidays))
+			{
+				return $this->cached_holidays;
+			}
+			$holidays = $this->so->read_holidays($this->locales,'','',$this->year);
+
+			if(count($holidays) == 0)
+			{
+				return $holidays;
+			}
+
+			$temp_locale = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
+			for($i=0;$i<count($holidays);$i++)
+			{
+				$c = $i;
+				if($i == 0 || $holidays[$i]['locale'] != $holidays[$i - 1]['locale'])
+				{
+					if(is_object($holidaycalc))
+					{
+						unset($holidaycalc);
+					}
+					$GLOBALS['phpgw_info']['user']['preferences']['common']['country'] = $holidays[$i]['locale'];
+					$holidaycalc = CreateObject('calendar.holidaycalc');
+				}
+				$holidays[$i]['date'] = $holidaycalc->calculate_date($holidays[$i], $holidays, $this->year, $c);
+				if($c != $i)
+				{
+					$i = $c;
+				}
+			}
+			unset($holidaycalc);
+			$this->holidays = $this->sort_holidays_by_date($holidays);
+			$this->cached_holidays = $this->set_holidays_to_date($this->holidays);
+			$GLOBALS['phpgw_info']['user']['preferences']['common']['country'] = $temp_locale;
+			return $this->cached_holidays;
+		}
+		/* End Calendar functions */
+
+		function check_admin()
+		{
+			if(!@$GLOBALS['phpgw_info']['user']['apps']['admin'])
+			{
+				Header('Location: ' . $GLOBALS['phpgw']->link('/index.php'));
+			}
+		}
+
+		function rule_string($holiday)
+		{
+			if (!is_array($holiday))
+			{
+				return false;
+			}
+			$sbox = CreateObject('phpgwapi.sbox');
+			$month = $holiday['month'] ? lang($sbox->monthnames[$holiday['month']]) : '';
+			unset($sbox);
+
+			if (!$holiday['day'])
+			{
+				$occ = $holiday['occurence'] == 99 ? lang('last') : $holiday['occurence'].'.';
+
+				$dow_str = Array(lang('Sun'),lang('Mon'),lang('Tue'),lang('Wed'),lang('Thu'),lang('Fri'),lang('Sat'));
+				$dow = $dow_str[$holiday['dow']];
+				
+				$str = lang('%1 %2 in %3',$occ,$dow,$month);
+			}
+			else
+			{
+				$str = $GLOBALS['phpgw']->common->dateformatorder($holiday['occurence']>1900?$holiday['occurence']:'',$month,$holiday[day]);
+			}
+			if ($holiday['observance_rule'])
+			{
+				$str .= ' ('.lang('Observance Rule').')';
+			}
+			return $str;
+		}
+	}
+?>
Index: /contrib/Timesheet/templates/default/form_button_script.tpl
===================================================================
--- /contrib/Timesheet/templates/default/form_button_script.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/form_button_script.tpl	(revision 3526)
@@ -0,0 +1,12 @@
+
+<!-- BEGIN form_button -->
+<nobr>
+<form action="{action_url_button}" method="post" name="{action_text_button}form">
+<div style="padding-top:15px; padding-right: 2px">
+	{action_extra_field} 
+	<input id="{button_id}" style="font-size:10px" type="submit" value="{action_text_button}" {action_confirm_button}>
+</div>
+</form>
+</nobr>
+
+<!-- END form_button -->
Index: /contrib/Timesheet/templates/default/locales.tpl
===================================================================
--- /contrib/Timesheet/templates/default/locales.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/locales.tpl	(revision 3526)
@@ -0,0 +1,60 @@
+<!-- BEGIN list -->
+<p>
+ <table border="0" width="45%" align="center">
+  <tr>
+   <td align="left">{left_next_matchs}</td>
+   {center}
+   <td align="right">{right_next_matchs}</td>
+  </tr>
+ </table>
+
+ <table border="0" width="70%" align="center">
+  <tr bgcolor="{th_bg}">
+   <td>&nbsp;{sort_name}</td>
+   {header_rule}
+   <td>{header_edit}</td>
+   <td>{header_delete}</td>
+   <td>{header_extra}</td>
+  </tr>
+
+  {rows}
+
+ </table>
+
+ <table border="0" width="70%" cellspacing="5" align="center">
+  <tr>
+   <td align="left">
+    <form method="POST" action="{new_action}">
+     <input type="submit" value="{lang_add}">
+    </form>
+   </td>
+   {back_button}
+   <td width="80%" align="right">
+    <form method="POST" action="{search_action}">
+     {lang_search}&nbsp;<input name="query">
+    </form>
+   </td>
+  </tr>
+ </table>
+<!-- END list -->
+<!-- BEGIN row -->
+ <tr bgcolor="{tr_color}">
+  <td>&nbsp;{group_name}</td>
+  {rule}
+  <td width="5%">{edit_link}</td>
+  <td width="5%">{delete_link}</td>
+  <td align="center" {extra_width}>{extra_link}</td>
+ </tr>
+<!-- END row -->
+<!-- BEGIN row_empty -->
+   <tr>
+    <td colspan="5" align="center">{message}</td>
+   </tr>
+<!-- END row_empty -->
+<!-- BEGIN back_button_form -->
+   <td align="center">
+    <form method="POST" action="{back_action}">
+     <input type="submit" value="{lang_back}">
+    </form>
+   </td>
+<!-- END back_button_form -->
Index: /contrib/Timesheet/templates/default/listUsers.php
===================================================================
--- /contrib/Timesheet/templates/default/listUsers.php	(revision 3526)
+++ /contrib/Timesheet/templates/default/listUsers.php	(revision 3526)
@@ -0,0 +1,167 @@
+<?php			
+	
+	$GLOBALS['phpgw_info']['flags'] = array(
+		'noheader' => True,
+		'nonavbar' => True,
+		'currentapp' => 'calendar'		
+	);
+	
+	include('../../../header.inc.php');
+	include('../../../phpgwapi/templates/default/head.inc.php');
+
+	$owner = $GLOBALS['_GET']['owner'];
+	
+	if(!@is_object($GLOBALS['phpgw']->js))	{
+		$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
+	}
+	
+	$GLOBALS['phpgw']->js->validate_file('jscode','scripts','preferences');		
+	$t = &$GLOBALS['phpgw']->template;						
+	// seta o Template
+	$t->set_file(array('addUser_t' => '../../../calendar/templates/default/listUsers.tpl'));
+	
+	$obj_account = CreateObject('phpgwapi.accounts',$this->bo->owner);
+
+	$post_select_organization = $_POST['select_organization'];
+	$post_select_sector = $_POST['select_sector'];
+	$change_organization = $_POST['change_organization'];
+	
+	$obj_org_sector = CreateObject('phpgwapi.sector_search_ldap');
+	if ((!$post_select_organization) && (!$post_select_sector)) //primeira vez
+	{
+		$user_org = $obj_account->get_organization($GLOBALS['phpgw_info']['user']['account_dn']);
+		$user_sector = $obj_account->get_sector($GLOBALS['phpgw_info']['user']['account_dn']);
+		$user_context = $obj_account->get_context($GLOBALS['phpgw_info']['user']['account_dn']);
+		
+		$organizations_info = $obj_org_sector->organization_search($GLOBALS['phpgw_info']['server']['ldap_context']);
+		@asort($organizations_info);
+		@reset($organizations_info);					
+		$sectors_info = $obj_org_sector->sector_search('ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context']);
+	}
+	else //mudou uma das combos
+	{
+		$user_org = $post_select_organization;
+		$user_sector = $post_select_sector;
+		if ($change_organization == "True")
+			$user_context = 'ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context'];
+		else
+			$user_context = $post_select_sector;
+		$organizations_info = $obj_org_sector->organization_search($GLOBALS['phpgw_info']['server']['ldap_context']);
+		@asort($organizations_info);
+		@reset($organizations_info);					
+		$sectors_info = $obj_org_sector->sector_search('ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context']);
+	}
+		
+	foreach($organizations_info as $organization)
+	{
+		$combo_organization .= '<option value="' . $organization . '"'; 	
+		
+		if (!$post_select_organization)
+		{
+			if(strtolower($organization) == strtolower($user_org))
+			{
+				$combo_organization .= ' selected';
+			}
+		}
+		else
+		{
+			if(strtolower($organization) == strtolower($post_select_organization))
+			{
+				$combo_organization .= ' selected';
+			}
+		}	
+		$combo_organization .= '>' .$organization.'</option>'."\n";
+	}
+	
+	$combo_sector .= '<option value="ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context'].'"> --------- </option>'."\n";
+	foreach($sectors_info as $sector)
+	{
+		if ($sector->sector_level == 1)
+		{
+			$sector->sector_name = '- '.$sector->sector_name;
+		}
+		else
+		{
+			$sector_space = '';
+			for ($i=1; $i < $sector->sector_level; $i++)
+				$sector_space = '---'.$sector_space;
+			$sector->sector_name = $sector_space.' '.$sector->sector_name;
+		}
+	
+		$combo_sector .= '<option value="' . $sector->sector_context . '"';
+
+		if (!$post_select_sector)
+		{
+			if($sector->sector_name == $user_sector)
+				$combo_sector .= ' selected';
+		}
+		else
+		{
+			if($sector->sector_context == $post_select_sector)
+				$combo_sector .= ' selected';
+		}
+		$combo_sector .= '>' .$sector->sector_name.'</option>'."\n";
+	}			
+	
+	// Monta lista de Grupos e Usuários
+	$users = Array();
+	$groups = Array();
+
+	$ds = $GLOBALS['phpgw']->common->ldapConnect();
+    if ($ds) 
+    {
+		$sr=ldap_list($ds, $user_context, ("(&(cn=*)(phpgwaccounttype=g))"));
+		$info = ldap_get_entries($ds, $sr);
+		for ($i=0; $i<$info["count"]; $i++)
+			$groups[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g);
+
+		$sr=ldap_list($ds, $user_context, ("(&(cn=*)(phpgwaccounttype=u)(!(cn=lista*)))"));
+		$info = ldap_get_entries($ds, $sr);
+		for ($i=0; $i<$info["count"]; $i++)
+		{
+			if ($info[$i]["phpgwaccountvisible"][0] == '-1')
+				continue;
+			$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u);
+		}
+	}
+	ldap_close($ds);
+    	
+	@asort($users);
+	@reset($users);	
+	@asort($groups);
+	@reset($groups);
+
+	$options ='';
+	if(count($groups))
+		$options .= '<option  value="-1" disabled>--------------------&nbsp;&nbsp;&nbsp;&nbsp;Grupos&nbsp;&nbsp;&nbsp;&nbsp;------------------- </option>'."\n";
+		
+	foreach($groups as $id => $user_array) {
+			$newId = $id.'U';
+			$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).$array_app.'</option>'."\n";
+	}
+	
+	if(count($users))
+		$options .= '<option  value="-1" disabled>-------------------&nbsp;&nbsp;&nbsp;&nbsp;Usuários&nbsp;&nbsp;&nbsp;&nbsp;------------------ </option>'."\n";
+	
+	foreach($users as $id => $user_array) {
+		if($owner != $id){
+			$newId = $id.'U';
+			$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).$array_app.'</option>'."\n";
+		}
+	}
+
+	$t->set_var ('lang_Organization',lang('Organization'));
+	$t->set_var ('lang_Sector',lang('Sector'));
+	$t->set_var ('lang_Calendar',lang('Calendar'));
+	$t->set_var ('lang_Add_Participants',lang('Add Participants'));
+	$t->set_var ('lang_to_Search',lang('to Search'));
+	$t->set_var ('lang_Close',lang('Close'));
+	$t->set_var ('lang_Add',lang('Add'));
+	
+	$t->set_var('options',$options);
+	$t->set_var('combo_organization', $combo_organization);
+	$t->set_var('combo_sector', $combo_sector);
+	$t->parse('out','addUser_t',true);
+	$t->p('out');
+	$GLOBALS['phpgw']->common->phpgw_exit();	
+?>
Index: /contrib/Timesheet/templates/default/app_print.css
===================================================================
--- /contrib/Timesheet/templates/default/app_print.css	(revision 3526)
+++ /contrib/Timesheet/templates/default/app_print.css	(revision 3526)
@@ -0,0 +1,294 @@
+/* Este documento é um css somente para impressão do calendário no papel!
+O seu efeito não aparece na tela  */
+
+.calendar_print_main {
+	text-align:center;
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 8px;
+	color: #000066;
+	background-color: #F7F7F7;
+	border: 1px solid #CCCCCC;
+	margin: 5px;
+	padding: 5px;
+	height: 700px;
+	width: 600px;
+}
+.button {
+	display: none;
+}
+
+
+.to_continue
+{
+	font-size: 9px;
+}
+
+A.minicalendar 
+{ 
+	color: #000000; 
+	font-size: 9px;
+	
+}
+
+A.bminicalendar 
+{ 
+	color: #336699; 
+	font-style: italic;
+	font-weight: bold;
+	font-size: 9px; 
+}
+
+A.minicalendargrey 
+{ 
+	color: #999999; 
+	font-size: 10px;
+	font-weight: bold;
+}
+
+A.bminicalendargrey 
+{ 
+	color: #336699; 
+	font-style: italic; 
+	font-size:10px; 
+}
+
+A.minicalhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #000000; 
+	font-size: 10px; 
+}
+
+A.bminicalhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #336699; 
+	font-size: 10px; 
+}
+
+A.minicalgreyhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #999999; 
+	font-size: 10px; 
+}
+
+A.bminicalgreyhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #999999; 
+	font-size: 10px; 
+}
+
+
+.event-on
+{ 
+	background: #D3DCE3;
+	border: #E8F0F0 1px solid;
+}
+
+.event-off
+{ 
+	background: #E8F0F0;
+	border: #D3DCE3 1px solid;
+}
+
+.event-holiday
+{
+	font-size: 100%;
+	background: #dac0c0;
+	color:#000000;
+	vertical-align: middle;
+}
+
+.time
+{
+	background: #D3DCE3;
+	color:#000000;
+	font-size: 10px;
+	font-weight: bold;
+	vertical-align: middle;
+	width: 5.2%;
+	text-align: right;
+	padding-right: 5px;
+	line-height: 11px;
+	border: #E8F0F0 1px solid;
+}
+
+
+.planner-cell
+{
+	cursor: pointer;
+	cursor: hand;
+	border: thin solid black;
+}
+
+/* common */
+.calendar_link_print
+{
+	text-align: center;
+	font-size: 10px;
+}
+
+//Mini Calendar
+
+.calendar_minical_table
+{
+	width: 180px;
+	font-weight: bold;
+}
+
+.calendar_minical_daytable
+{
+	width: 100%;
+}
+
+.calendar_minical_dayname
+{
+	font-size: 9px;
+	text-align: right;
+}
+
+.calendar_minical_hrule
+{
+	width: 96%;
+}
+
+/* Header */
+.calendar_dropbuttons
+{
+	align: center;
+	text-align: center;
+	vertical-align: bottom;
+	font-weight: bold;
+	font-size: 8px;
+}
+
+.calendar-weekidentifier
+{
+	font-size:16px;
+	font-weight: bold;
+	text-align: center;
+}
+
+.calendar_header
+{
+	font-size: 16px;
+	font-weight: bold;
+	text-align: center;
+}
+
+.calendar_dayview_table_header
+{
+	font-size: 13px;
+	font-weight: bold;
+	text-align: center;
+}
+
+.calendar_dayview_todo_header
+{
+	margin: 0px; 
+	padding: 2px;
+	font-weight: bold;
+}
+
+/* week view */
+.calendar_week_identifier_table
+{
+	border: 0px solid black;
+	width: 100%;
+}
+
+.calendar_week_identifier
+{
+	font-size: 13px;
+	text-align: center;
+	font-weight: bold;
+}
+
+.calendar_weekview_daytitle
+{
+	font-weight: bold;
+	font-size: 12px;
+	background: #D3DCE3;
+}
+
+.calendar_m_w_table
+{
+	table-layout:fixed;
+	overflow:hidden;
+	height: 90%;
+	width: 100%;
+	border: 0px #000000 solid;
+}
+
+.calendar_m_w_tablecell
+{
+	overflow:hidden;
+	vertical-align: top;
+	padding-left: 4px;
+	padding-right: 4px;
+	padding-bottom: 6px;
+	border: 1px solid #000000;
+}
+
+.screen_only
+{
+	display:none;
+}
+
+.calendar_m_w_table_daynumber
+{
+	font-weight: bold;
+	font-family: Arial;
+	font-size: 10px;
+	vertical-align: top;
+	background-color: #778899;
+	border: 1px solid #000000;
+	margin: 1px;
+	padding: 1px;
+}
+
+A.event_entry
+{
+	font-size:10px;
+}
+
+/* month view */
+
+.calendar_month_identifier
+{
+	font-size:18px;
+	font-weight: bold;
+}
+
+.calendar_user_identifier
+{
+	font-size:12px;
+	color: #009999;
+	font-weight: bold;
+}
+
+.calendar_week_minical_table
+{
+	width:100%;
+	border: 0px solid #000000
+}
+
+.calendar_weekinfo
+{
+	color: #000000;
+	padding-left: 2px;
+	padding-right: 2px;
+	font-size: 10px;
+	font-weight: bold;
+	font-style: italic;
+}
Index: /contrib/Timesheet/templates/default/csv_import.tpl
===================================================================
--- /contrib/Timesheet/templates/default/csv_import.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/csv_import.tpl	(revision 3526)
@@ -0,0 +1,74 @@
+<!-- BEGIN filename -->
+	  		<TR>
+	    		<TD>{lang_csvfile}</td>
+				<td><INPUT NAME="csvfile" SIZE=30 TYPE="file" VALUE="{csvfile}"></td>
+			</tr>
+			<tr>
+				<td>{lang_fieldsep}</td>
+				<td><input name="fieldsep" size=1 value="{fieldsep}"></td>
+			</tr>
+			<tr>
+				<td>{lang_charset}</td>
+				<td>
+			{select_charset}
+				</td>
+			</tr>
+			<tr><td>&nbsp;</td>
+				<td><INPUT NAME="convert" TYPE="submit" VALUE="{submit}"></TD>
+			</TR>
+<!-- END filename -->
+
+<!-- BEGIN fheader -->
+			<tr>
+				<td><b>{lang_csv_fieldname}</b></td>
+				<td><b>{lang_info_fieldname}</b></td>
+				<td><b>{lang_translation}</b></td>
+			</tr>
+<!-- END fheader -->
+
+<!-- BEGIN fields -->
+			<tr>
+				<td>{csv_field}</td>
+				<td><SELECT name="cal_fields[{csv_idx}]">{cal_fields}</select></td>
+				<td><input name="trans[{csv_idx}]" size=60 value="{trans}"></td>
+			</tr>
+<!-- END fields -->
+
+<!-- BEGIN ffooter -->
+			<tr>
+				<td rowspan="2" valign="middle" nowrap><br>{submit}</TD>
+				<td colspan="2"><br>
+					{lang_start} <INPUT name="start" type="text" size="5" value="{start}"> &nbsp; &nbsp;
+					{lang_max} <INPUT name="max" type="text" size="3" value="{max}"><td>
+			</tr>
+			<tr>
+				<td colspan="2"><INPUT name="debug" type="checkbox" value="1"{debug}> {lang_debug}</td>
+			</TR>
+			<tr><td colspan="3">&nbsp;<p>
+				{help_on_trans}
+			</td></tr>
+<!-- END ffooter -->
+
+<!-- BEGIN imported -->
+			<tr>
+				<td colspan=2 align=center>
+					{log}<p>
+					{anz_imported}
+				</td>
+			</TR>
+<!-- END imported -->
+
+<!-- BEGIN import -->
+<br/>
+<center>
+		<form {enctype} action="{action_url}" method="post">
+		<table>
+
+		{rows}
+
+		</table>
+		{hiddenvars}
+		</form>
+
+</center>
+<!-- END import -->
Index: /contrib/Timesheet/templates/default/month.tpl
===================================================================
--- /contrib/Timesheet/templates/default/month.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/month.tpl	(revision 3526)
@@ -0,0 +1,6 @@
+
+<table id="calendar_month_table" width="100%" border="0" bordercolor="#FFFFFF" cellspacing="2" cellpadding="2" cols={cols}>
+	{row}
+</table>
+
+
Index: /contrib/Timesheet/templates/default/viewDocument.tpll
===================================================================
--- /contrib/Timesheet/templates/default/viewDocument.tpll	(revision 3526)
+++ /contrib/Timesheet/templates/default/viewDocument.tpll	(revision 3526)
@@ -0,0 +1,499 @@
+<!-- BEGIN main -->
+
+<table width="100%" border="0" cellspacing="0" cellpading="0" bgcolor="white" hheight="100px">
+	<tr class="topRow">
+		<th width="33%">{download}</th>
+		<th width="33%">{view_online}</th>
+		<th width="33%">{delete}</th>
+	</tr>
+</table>
+<br>
+<table width="100%" border="0" cellspacing="0" cellpading="0">
+	<tr>
+		<th width="20%" id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);" style="font-size:10px;">{lang_informations}</a></th>
+		<th width="20%" id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);" style="font-size:10px;">{lang_all_versions}</a></th>
+		<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">{lang_linked_documents}</a></th>
+		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">{lang_notifications}</a></th>
+		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>
+	</tr>
+</table>
+<div style="border-left: dotted 1px grey; border-bottom: dotted 1px grey; border-right: dotted 1px grey; background: white;">
+<div id="tabcontent1" class="inactivetab" bgcolor="white">
+	{informations}
+</div>
+
+<div id="tabcontent2" class="inactivetab">
+
+	<table cellspacing="5" cellpadding="0" border="0" width="100%">
+		<tr>
+			<td></td>
+			<td></td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_version}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_upload_date}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_comment}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_uploaded_by}</i></td>
+			<!-- if (($document->getAccessMode($user) >= M_READWRITE) && (count($versions) > 1))
+ -->
+			<td></td>
+		</tr>
+		{versions}
+	</table>
+</div>
+
+<div id="tabcontent3" class="inactivetab">
+<!--
+<table cellspacing="5" cellpadding="0" border="1">
+	<?
+	if ($rownum > 1)
+	{
+		?>
+		<tr>
+		<td></td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("name");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("comment");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("document_link_by");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("document_link_public");?></i></td>
+		<td></td>
+		</tr>
+		<?
+		foreach($links as $link)
+		{
+			$responsibleUser = $link->getUser();
+			$targetDoc = $link->getTarget();
+			
+			print "<tr>";
+			print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+			print "<td class=\"linklist\"><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
+			print "<td class=\"linklist\">".$targetDoc->getComment()."</td>";
+			print "<td class=\"linklist\">".$responsibleUser->getFullName()."</td>";
+			print "<td class=\"linklist\">" . (($link->isPublic()) ? getMLText("yes") : getMLText("no")) . "</td>";
+			print "<td>";
+			if (($user->getID() == $responsibleUser->getID()) || ($user->getID() == $settings->_adminID) || ($link->isPublic() && ($document->getAccessMode($user) >= M_READWRITE )))
+				print "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\"><img src=\"images/del.gif\" border=0></a>";
+			print "</td>";
+			print "</tr>";
+		}
+	}
+	else
+		print "<tr><td class=\"filelist\">".getMLText("no_document_links")."</td></tr>";
+	?>
+</table>
+
+
+if ($user->getID() != $settings->_guestID)
+
+	<form action="../op/op.AddDocumentLink.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?printMLText("choose_target_document");?>:</td>
+			<td><?printDocumentChooser("form1");?></td>
+		</tr>
+		<?
+			if ($document->getAccessMode($user) >= M_READWRITE)
+			{
+				print "<tr><td class=\"inputDescription\">".getMLText("document_link_public")."</td><td class=\"inputDescription\">";
+				print "<input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes") . "&nbsp;&nbsp;";
+				print "<input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no");
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit" value="<?printMLText("add_document_link");?>"></td>
+		</tr>
+	</table>
+	</form>-->
+</div>
+
+<div id="tabcontent4" class="inactivetab">
+	<table cellspacing="0" cellpadding="5" border="0" width="100%">
+		<tr>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+			<td style="border-bottom: 1pt solid #000080;" class="notifylist"><i>{lang_name}</i></td>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+		</tr>
+		{notifications}
+		<tr>
+			<td colspan="3">&nbsp;</td>
+		</tr>
+	</table>
+
+	<form action="{notify_form_action}" method="post" name="notify_form">
+		<fieldset><legend>{lang_add_notification}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_userid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_groupid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+	</form>
+</div>
+
+<div id="tabcontent5" class="inactivetab">
+	{change_owner}
+	{display_acl}
+</div>
+
+<div id="tabcontent6" class="inactivetab">
+	<form enctype="multipart/form-data" name="update_file_form" method="post" action="{action_update_file}">
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input type="file" name="userfile"></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;"></textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire_update}
+				<span id="jscalspan_update" class="{expire_class_update}">{expire_date_update}</span>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_update}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="javascript:tab.display(1);">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</form>
+</div>
+
+
+
+</div>
+<!-- END main -->
+
+<!-- BEGIN lock_row -->
+	<tr class="row_off">
+		<td class="description" valign="top">{lang_lock_status}:</td>
+		<td class="infos" colspan="2">
+			<input id="lockStatus" type="hidden" name="lockStatus" value="unchanged">
+			<input type="checkbox" onchange="javascript:toggleLock(this);" {checked_lock_status}>
+			<div id="currentLockStatus" class="active">
+				{lang_current_status}
+			</div>
+			<div id="lockFile" class="inactive">
+				{lang_file_gets_unlocked}
+			</div>
+			<div id="unlockFile" class="inactive">
+				{lang_file_gets_locked}
+			</div>
+		</td>
+	</tr>
+<!-- END lock_row -->
+
+<!-- BEGIN version_row -->
+	<tr>
+		<td>
+			{url_view_online}
+		</td>
+		<td>
+			<a href="{url_download_file}" class="oldcontent"><img src="{download_image}" width=22 height=22 border=0 title="{lang_download}"></a>
+		</td>
+		<td class="filelist" align="center">{version_version}</td>
+		<td class="filelist">{version_date}</td>
+		<td class="filelist">{version_comment}</td>
+		<td class="filelist">{version_uploadingUser}</td>
+		<td>{url_delete_file}</td>
+	</tr>
+<!-- END version_row -->
+
+<!-- BEGIN information_ro -->
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr>
+			<td class="infos" valign="top" width="150px">{lang_filename}:</td>
+			<td style="border-left: 1pt solid #000080;" rowspan="14" width="1px">&nbsp;</td>
+			<td class="infos">{filename}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_owner}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment}:</td>
+			<td class="infos">{comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_creation_date}:</td>
+			<td class="infos">{creation_date}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_keywords}:</td>
+			<td class="infos">{keywords}</td>
+		</tr>
+		{locking}
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_mime_type}:</td>
+			<td class="infos">
+				<img align="absmiddle" src="images/icons/<?print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top">
+				{expire_date_ro}
+			</td>
+		</tr>
+	</table>
+<!-- END information_ro -->
+
+<!-- BEGIN information_rw -->
+	<form name="info_form" method="post" action="{action_informations}">
+	<fieldset><legend>{lang_general_information}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos"><input style="width: 100%; border: dotted 1px silver;" type="text" name="fname" value="{filename}"></td>
+			<td align="center" width="150px"><a href="#" tabindex="0" onfocus="tab.display(6);" onclick="tab.display(6); return(false);" style="font-size:10px;">{lang_update_document}</a></td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos">
+				<input id="targetname" style="width: 100%; border: dotted 1px silver;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="unchanged">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder({current_folder_id},'info_form'); return(false);" style="font-size:10px;">{lang_move_document}</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_owner}:</td>
+			<td class="infos" colspan="2">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_creation_date}:</td>
+			<td class="infos" colspan="2">{creation_date}</td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;">{comment}</textarea></td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_keywords}:</td>
+			<td class="infos" colspan="2"><textarea name="keywords" style="width: 100%;">{keywords}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire}
+				<span id="jscalspan" class="{expire_class}">{expire_date}</span>
+			</td>
+		</tr>
+		{locking}
+		<tr class="row_on">
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_save}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="window.close()">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_information_about_last_update}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+			<td class="description" valign="top" width="150px">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+			<td class="description" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top" colspan="3">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="description" valign="top">{lang_mime_type}:</td>
+			<td class="infos" colspan="3">
+				<img align="absmiddle" src="images/icons/<?print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	</form>
+<!-- END information_rw -->
+
+<!-- BEGIN block_download -->
+<a href="{download_link}"><img src="{download_image}" align="middle" border="0">{lang_download}</a>
+<!-- END block_download -->
+
+<!-- BEGIN block_view_online -->
+<a target="_blank" href="{view_link}"><img src="{view_image}" align="middle" border="0">{lang_view_online}</a>
+<!-- END block_view_online -->
+
+<!-- BEGIN block_delete -->
+<a href="{delete_link}" onClick="return confirm('{lang_confirm_delete}');"><img src="{delete_image}" align="middle" border="0">{lang_delete}</a>
+<!-- END block_delete -->
+
+<!-- BEGIN notification_row -->
+	<tr>
+		<td><img src="{notify_image}" width=16 height=16></td>
+		<td class="notifylist">{notify_username}</td>
+		<td align="right"><a href="{link_notify_delete}"><img title="{lang_delete_this_notification}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+<!-- END notification_row -->
+
+<!-- BEGIN block_change_owner -->
+	<form name="change_owner" action="{action_change_owner}" method="post">
+		<fieldset><legend>{lang_owner}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_ownerid}
+				</td>
+				<td><input type="Submit"></td>
+			</tr>
+		</table>
+		</fieldset>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>&nbsp;</td>
+			</tr>
+		</table>
+	</form>
+<!-- END block_change_owner -->
+
+<!-- BEGIN block_acl_inherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_acl_get_inherited}</div>
+	<p>
+	<a href="{link_acl_copy}">{lang_copy_acl}</a><br>
+	<a href="{link_acl_empty}">{lang_create_empty_acl}</a><br>
+	</fieldset>
+<!-- END block_acl_inherite -->
+
+<!-- BEGIN block_acl_notinherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_inherite_acl_again}</div>
+	<p>
+	<a href="{link_acl_inherit_again}">{lang_inherit_acl_again}</a><br>
+
+	<fieldset><legend>{lang_default_access}</legend>
+	<form name="change_default_access" action="{action_change_default_access}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_default_access}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	<fieldset><legend>{lang_current_acl}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td></td>
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_name}</i></td>
+				<!-- <td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td> -->
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_access_mode}</i></td>
+				<td></td>
+				<td></td>
+			</tr>
+			{acls}
+		</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_add_acl}</legend>
+	<form name="add_acl" action="{action_add_acl}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_add_acl_userid}
+				</td>
+				<td rowspan="3">
+					<input type="Submit">
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_add_acl_groupid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_permission}:</td>
+				<td>
+					{select_add_acl_permission}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	</fieldset>
+<!-- END block_acl_notinherite -->
+
+<!-- BEGIN acl_row -->
+	<form method="post" action="{action_acl_row}">
+	<tr>
+		<td width="20px"><img src="{acl_image}" width=16 height=16></td>
+		<td class="acllist">{acl_username}</td>
+		<td class="acllist" width="310px">{acl_selectbox}</td>
+		<td width="20px"><input type="Image" src="{save_image}" alt="{lang_save}"></td>
+		<td width="20px" align="right"><a href="{link_acl_delete}" onClick="return confirm('{lang_confirm_acl_delete}');"><img title="{lang_delete_this_acl}" alt="{lang_delete}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+	</form>
+<!-- END acl_row -->
+
Index: /contrib/Timesheet/templates/default/edit.xet
===================================================================
--- /contrib/Timesheet/templates/default/edit.xet	(revision 3526)
+++ /contrib/Timesheet/templates/default/edit.xet	(revision 3526)
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<!-- $Id: edit.xet 23270 2007-01-12 01:27:37Z ralfbecker $ -->
+<overlay>
+	<template id="timesheet.edit.general" template="" lang="" group="0" version="1.3.001">
+		<grid width="100%" height="150">
+			<columns>
+				<column width="95"/>
+				<column width="120"/>
+				<column width="80"/>
+				<column/>
+			</columns>
+			<rows>
+				<row class="row">
+					<description options=",,,ts_title" value="Title"/>
+					<textbox size="65" maxlength="80" id="ts_title" blur="@ts_title_blur" span="all"/>
+				</row>
+				<row class="row">
+					<description options=",,,cat_id" value="Category"/>
+					<menulist span="all">
+						<menupopup type="select-cat" id="cat_id" options="None"/>
+					</menulist>
+				</row>
+				<row class="row">
+					<description options=",,,ts_start" value="Date"/>
+					<date id="ts_start" needed="1" options=",8"/>
+					<description value="Starttime"/>
+					<date-timeonly id="start_time"/>
+				</row>
+				<row class="row">
+					<description options=",,,ts_duration" value="Duration"/>
+					<date-duration id="ts_duration" options=",hm"/>
+					<description value="or endtime" class="noWrap"/>
+					<date-timeonly id="end_time"/>
+				</row>
+				<row class="row">
+					<description options=",,,ts_quantity" value="Quantity"/>
+					<textbox type="float" id="ts_quantity" statustext="empty if identical to duration" blur="@ts_quantity_blur" precision="3" span="all"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.edit.notes" template="" lang="" group="0" version="0.1.001">
+		<grid width="100%" height="150">
+			<columns>
+				<column/>
+			</columns>
+			<rows>
+				<row class="row" valign="top">
+					<textbox multiline="true" rows="8" cols="70" id="ts_description"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.edit.links" template="" lang="" group="0" version="0.1.001">
+		<grid width="100%" height="150" overflow="auto">
+			<columns>
+				<column width="100"/>
+				<column/>
+			</columns>
+			<rows>
+				<row class="th" disabled="@view">
+					<description span="all" value="Create new links"/>
+				</row>
+				<row class="row" disabled="@status_only">
+					<link-to span="all" id="link_to"/>
+				</row>
+				<row class="th">
+					<description span="all" value="Existing links"/>
+				</row>
+				<row class="row_off" valign="top">
+					<link-list span="all" id="link_to"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.edit" template="" lang="" group="0" version="1.3.002">
+		<grid width="100%">
+			<columns>
+				<column width="100"/>
+				<column/>
+			</columns>
+			<rows>
+				<row disabled="!@msg">
+					<description span="all" class="redItalic" id="msg" no_lang="1" align="center"/>
+					<description/>
+				</row>
+				<row class="th" height="28">
+					<description options=",,,ts_owner" value="User"/>
+					<menulist span="all">
+						<menupopup id="ts_owner" no_lang="1"/>
+					</menulist>
+				</row>
+				<row class="row">
+					<description options=",,,ts_project" value="Project"/>
+					<grid spacing="1" padding="1">
+						<columns>
+							<column/>
+						</columns>
+						<rows>
+							<row disabled="@pm_integration=none">
+								<projectmanager-select options="None" id="pm_id" span="all" statustext="Select a project" onchange="1"/>
+							</row>
+							<row disabled="@pm_integration=full">
+								<textbox id="ts_project" blur="@ts_project_blur" size="65" maxlength="80"/>
+							</row>
+						</rows>
+					</grid>
+				</row>
+				<row class="row">
+					<description options=",,ts_unitprice" value="Unitprice"/>
+					<grid>
+						<columns>
+							<column disabled="@pm_integration=none"/>
+							<column/>
+						</columns>
+						<rows>
+							<row>
+								<projectmanager-pricelist id="pl_id" options="None,all_pm_ids,ts_unitprice" onchange="this.form['exec[ts_unitprice]'].value=this.options[this.selectedIndex].text.lastIndexOf('(') &lt; 0 ? '' : this.options[this.selectedIndex].text.slice(this.options[this.selectedIndex].text.lastIndexOf('(')+1,-1);"/>
+								<textbox type="float" id="ts_unitprice" span="all"/>
+							</row>
+						</rows>
+					</grid>
+				</row>
+				<row>
+					<tabbox span="all">
+						<tabs>
+							<tab label="General" statustext=""/>
+							<tab label="Notes" statustext=""/>
+							<tab label="Links" statustext=""/>
+						</tabs>
+						<tabpanels>
+							<template id="timesheet.edit.general"/>
+							<template id="timesheet.edit.notes"/>
+							<template id="timesheet.edit.links"/>
+						</tabpanels>
+					</tabbox>
+				</row>
+				<row class="row" disabled="!@ts_modified">
+					<description value="Last modified"/>
+					<hbox>
+						<date-time id="ts_modified" readonly="true"/>
+						<menulist>
+							<menupopup type="select-account" id="ts_modifier" label="by" readonly="true"/>
+						</menulist>
+					</hbox>
+				</row>
+				<row>
+					<hbox options="0" span="2" orient="0">
+						<hbox>
+							<button label="Edit" id="button[edit]" statustext="Edit this entry"/>
+							<button id="button[save_new]" label="Save &amp; New" statustext="Saves this entry and add a new one"/>
+							<button id="button[save]" label="Save" statustext="Saves the changes made"/>
+							<button id="button[apply]" label="Apply" statustext="Applies the changes made"/>
+							<button id="button[cancel]" label="Cancel" statustext="closes the window without saving the changes" onclick="window.close();"/>
+							<html id="js"/>
+						</hbox>
+						<button label="Delete" align="right" id="button[delete]" statustext="Delete this entry" onclick="return confirm('Delete this entry');"/>
+					</hbox>
+				</row>
+			</rows>
+		</grid>
+	</template>
+</overlay>
Index: /contrib/Timesheet/templates/default/header.inc.php
===================================================================
--- /contrib/Timesheet/templates/default/header.inc.php	(revision 3526)
+++ /contrib/Timesheet/templates/default/header.inc.php	(revision 3526)
@@ -0,0 +1,54 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare                                                               *
+  * http://www.egroupware.org                                                *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	function add_col(&$tpl,$str)
+	{
+		$tpl->set_var('str',$str);
+		$tpl->parse('header_column','head_col',True);
+	}
+
+	function add_image_ahref($link,$image,$alt)
+	{
+		return '<a href="'.$link.'"><img src="'.$GLOBALS['phpgw']->common->image('calendar',$image).'" alt="'.$alt.'" title="'.$alt.'" border="0"></a>';
+	}
+
+	$refer = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
+	$referrer = $refer[2];
+
+	$templates = Array(
+		'head_tpl'	=> 'head.tpl',
+		'form_button_dropdown'	=> 'form_button_dropdown.tpl',
+		'form_button_script'	=> 'form_button_script.tpl'
+	);
+	$tpl->set_file($templates);
+	$tpl->set_block('head_tpl','head','head');
+	$tpl->set_block('head_tpl','head_table','head_table');
+	$tpl->set_block('head_tpl','head_col','head_col');
+	$tpl->set_block('form_button_script','form_button');
+
+	
+		$tpl->set_var('cols',3);
+	
+
+	$today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+	//$col_width = 12;
+//add_col($tpl,'  <td >&nbsp;</td>');
+
+
+	$tpl->parse('row','head_table',True);
+
+	$tpl->set_var('header_column','');
+	$tpl->set_var('cols',$cols);
+
+	
+?>
Index: /contrib/Timesheet/templates/default/holiday.tpl
===================================================================
--- /contrib/Timesheet/templates/default/holiday.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/holiday.tpl	(revision 3526)
@@ -0,0 +1,33 @@
+<!-- BEGIN form -->
+<center>
+{message}<br>
+<table border="0" width="80%" cellspacing="2" cellpadding="2"> 
+ <form name="form" action="{actionurl}" method="POST">
+  {hidden_vars}
+{rows}
+ <tr>
+  <td colspan="2">
+   <table width="100%" border="0" cellspacing="5">
+    <tr>
+     <td>
+      <input type="submit" name="submit" value="{lang_add}"></form>
+     </td>
+     <td>
+      {cancel_button}
+     </td>
+     <td align="right" width="80%">
+      {delete_button}
+     </td>
+    </tr>
+   </table>
+  <td>
+ </tr>
+</table>
+</center>
+<!-- END form -->
+<!-- BEGIN list -->
+ <tr bgcolor="{tr_color}">
+  <td valign="top" width="35%"><b>{field}:</b></td>
+  <td valign="top" width="65%">{data}</td>
+ </tr>
+<!-- END list -->
Index: /contrib/Timesheet/templates/default/alarm.tpl
===================================================================
--- /contrib/Timesheet/templates/default/alarm.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/alarm.tpl	(revision 3526)
@@ -0,0 +1,62 @@
+<!-- BEGIN alarm_management -->
+<form id="calendar_alarmform" action="{action_url}" method="post" name="alarmform">
+{hidden_vars}
+	<table id="calendar_alarmform_table" border="0" width="90%" align="center">
+		{rows}
+		<tr>
+			<td colspan="4">
+				<br>&nbsp;{input_days}&nbsp;{input_hours}&nbsp;{input_minutes}&nbsp;{input_owner}&nbsp;{input_add}<br>&nbsp;
+			</td>
+			<td align="right">
+				{input_cancel}
+			</td>
+		</tr>
+	</table>
+</form>
+<!-- END alarm_management -->
+
+<!-- BEGIN alarm_headers -->
+	<tr bgcolor="{tr_color}">
+		<th align="left" width="25%">{lang_time}</th>
+		<th align="left" width="30%">{lang_text}</th>
+		<th align="left" width="25%">{lang_owner}</th>
+		<th width="10%">{lang_enabled}</th>
+		<th width="10%">{lang_select}</th>
+	</tr>
+<!-- END alarm_headers -->
+
+<!-- BEGIN list -->
+	<tr bgcolor="{tr_color}">
+		<td>
+			<b>{field}:</b>
+		</td>
+		<td>
+			{data}
+		</td>
+		<td>
+			{owner}
+		</td>
+		<td align="center">
+			{enabled}
+		</td>
+		<td align="center">
+			{select}
+		</td>
+	</tr>
+<!-- END list -->
+
+<!-- BEGIN hr -->
+	<tr bgcolor="{th_bg}">
+		<td colspan="5" align="center">
+			<b>{hr_text}</b>
+		</td>
+	</tr>
+<!-- END hr -->
+
+<!-- BEGIN buttons -->
+	<tr>
+		<td colspan="6" align="right">
+			{enable_button}&nbsp;{disable_button}&nbsp;{delete_button}
+		</td>
+	</tr>
+<!-- END buttons -->
Index: /contrib/Timesheet/templates/default/pref.tpl
===================================================================
--- /contrib/Timesheet/templates/default/pref.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/pref.tpl	(revision 3526)
@@ -0,0 +1,22 @@
+<!-- BEGIN pref -->
+<p><b>{title}:</b><hr><p>
+<form action="{action_url}" method="POST">
+ <table border="0" align="center" width="90%">
+  {row}
+ </table>
+ <center><input type="submit" name="submit" value="{submit_lang}"></center>
+</form>
+<!-- END pref -->
+
+<!-- BEGIN pref_colspan -->
+  <tr bgcolor="{bg_color}">
+   <td colspan="2">{text}</td>
+  </tr>
+<!-- END pref_colspan -->
+
+<!-- BEGIN pref_list -->
+  <tr bgcolor="{bg_color}">
+   <td align="right">{field}</td>
+   <td align="center">{data}</td>
+  </tr>
+<!-- END pref_list -->
Index: /contrib/Timesheet/templates/default/confirm.tpl
===================================================================
--- /contrib/Timesheet/templates/default/confirm.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/confirm.tpl	(revision 3526)
@@ -0,0 +1,31 @@
+<!-- BEGIN list -->
+<html>
+<head>
+<title> .: Expresso :. </title>
+<link href='/phpgwapi/templates/classic/login.css' rel='stylesheet' type='text/css'>
+</head>
+<body class='body'>
+<br>
+<center>
+<table border='0' cellpading='0' cellspacing='0'>
+	<tr>
+		<td class='td'><b><font face='Verdana, Arial, Helvetica, sans-serif'>{notify_message}</font></b></td>
+	</tr>
+	<tr>
+</table>
+</center>
+<br>
+<center>
+<table border='0' cellpading='0' cellspacing='0'>
+<tr>
+	<td>
+		<form>
+		<input type='submit' value='Ok' onclick='javascript:window.close()'>
+		</form>
+	</td>
+</tr>
+</table>
+</center>
+</body>
+</html>
+<!-- END list -->
Index: /contrib/Timesheet/templates/default/month_header.tpl
===================================================================
--- /contrib/Timesheet/templates/default/month_header.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/month_header.tpl	(revision 3526)
@@ -0,0 +1,12 @@
+<!-- BEGIN monthly_header -->
+<tr class="calendar_m_w_table_header" colspan="{cols}" width="{col_width}%">
+{column_header}</tr>
+<!-- END monthly_header -->
+
+<!-- BEGIN column_title -->
+<th bGCOLOR="#D3DCE3" width="14.28%">{col_title}</th>
+<!-- END column_title -->
+
+<!-- BEGIN month_column -->
+<td class="calendar_m_w_tablecell" colspan="1" width="{col_width}%"{extra}>{column_data}</td>
+<!-- END month_column -->
Index: /contrib/Timesheet/templates/default/footer.tpl
===================================================================
--- /contrib/Timesheet/templates/default/footer.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/footer.tpl	(revision 3526)
@@ -0,0 +1,64 @@
+<!-- BEGIN footer_table -->
+       <hr clear="all">
+       <font size="-1">
+       <table border="0" width="100%" cellpadding="0" cellspacing="0">
+        <tr>
+{table_row}
+	</tr>
+       </table>
+<!-- END footer_table -->
+<!-- BEGIN footer_row -->
+         <td valign="top" width="30%">
+          <font size="-1">
+           <form action="{action_url}" method="post" name="{form_name}">
+            <B>{label}:</B>
+			{hidden_vars}
+            <select name="{form_label}" onchange="{form_onchange}">
+	     {row}
+	    </select>
+	    <input type="hidden" name="user" value="{user}">
+	    <input type="hidden" name="dia_ini" value="{dia_ini}">
+            <noscript><input type="submit" value="{go}"></noscript>
+	   </form>
+	  </font>
+	 </td>
+<!-- END footer_row -->
+<!-- BEGIN blank_row -->
+         <td>
+         {b_row}
+         </td>
+         <td>
+         {b_row2}
+         </td>
+<!-- END blank_row -->
+
+<!-- BEGIN num_dias -->
+<td valign="top" width="30%">
+ <font size="-1">
+    <form action="{acao}" method="post" name="{formname}">
+    <span style="display: {display}" >
+ 
+	<label>
+		<b>{num_dias_label}:</b>
+	</label>
+	<select name="{num_dias_name}" onchange="{formonchange}"/>
+		{row_qtd}
+	</select>
+	<br />
+	<span style="font-size: 9px;">
+		{tip}
+	</span>
+	<br /> <br />
+    </span>
+<span style="display: {display}">
+	<b>{day_ini_label}:</b>
+	<select name="{day_ini_name}" onchange="{formonchange}">
+	{row_ini}
+	</select>
+	</span>
+<input type="hidden" name="user" value="{user}">
+	<noscript><input type="submit" value="{go}"></noscript>
+     </form>
+ </font>
+</td>
+<!-- END num_dias -->
Index: /contrib/Timesheet/templates/default/month_day_print.tpl
===================================================================
--- /contrib/Timesheet/templates/default/month_day_print.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/month_day_print.tpl	(revision 3526)
@@ -0,0 +1,26 @@
+
+<!-- BEGIN m_w_table -->
+
+<table id="calendar_m_w_table" class="calendar_m_w_table" border="0" width="100%">
+	<!-- from month_header.tpl -->
+	{row}
+</table>
+<!-- END m_w_table -->
+
+
+<table>
+<!-- BEGIN month_daily -->
+<tr><td style="font-size: 10px; font-weight: bold; text-decoration: underline;" width="10px">{day_number}</td>
+<td>{daily_events}</td>
+<!-- END month_daily -->
+
+<!-- BEGIN day_event -->
+
+<td>{events}</td>
+<!-- END day_event -->
+
+<!-- BEGIN event -->
+<td>{day_events}</td></tr>
+<!-- END event -->
+<br />
+</table>
Index: /contrib/Timesheet/templates/default/custom_fields.tpl
===================================================================
--- /contrib/Timesheet/templates/default/custom_fields.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/custom_fields.tpl	(revision 3526)
@@ -0,0 +1,45 @@
+<!-- BEGIN custom_fields -->
+{lang_error}<br>
+<form action="{action_url}" method="post">
+ {hidden_vars}
+ <center>
+  <table border="0" width="90%">
+   <tr class="th">
+    <th align="left" width="30%">{lang_name}</th>
+    <th>{lang_length}</th>
+    <th>{lang_shown}</th>
+    <th>{lang_order}</th>
+    <th>{lang_title}</th>
+    <th>{lang_disabled}</th>
+    <th>&nbsp;</th>
+   </tr>
+   {rows}
+   <tr class="th">
+    <td>{name}</td>
+    <td align="center">{length}</td>
+    <td align="center">{shown}</td>
+    <td align="center">{order}</td>
+    <td align="center">{title}</td>
+    <td align="center">{disabled}</td>
+    <td align="center">{button}</td>
+   </tr>
+   <tr>
+    <td>{save_button} &nbsp; {cancel_button}</td>
+   </tr>
+  </table>
+ </center>
+</form>
+<br>
+<!-- END custom_fields -->
+
+<!-- BEGIN row -->
+   <tr bgcolor="{tr_color}">
+    <td>{name}</td>
+    <td align="center">{length}</td>
+    <td align="center">{shown}</td>
+    <td align="center">{order}</td>
+    <td align="center">{title}</td>
+    <td align="center">{disabled}</td>
+    <td align="center">{button}</td>
+   </tr>
+<!-- END row -->
Index: /contrib/Timesheet/templates/default/publicView.php
===================================================================
--- /contrib/Timesheet/templates/default/publicView.php	(revision 3526)
+++ /contrib/Timesheet/templates/default/publicView.php	(revision 3526)
@@ -0,0 +1,89 @@
+<?php 	
+	$user = $_POST['user'] ? $_POST['user'] : 
+		($_GET['user'] ? $_GET['user']: '');
+	
+	if($user) {
+		$organization = $_POST['organization'] ? $_POST['organization'] : 
+		($_GET['organization'] ? $_GET['organization']: '');
+		
+		if($organization)
+			$arg1 = $organization."-".$user;
+		else
+			$arg1 = $user;
+		
+		$params = "&account_name=".$arg1;
+	}
+	else
+		$params = '';
+?>
+<html>
+	<head><title>Visualizar Agenda</title>
+	<head>
+	<style type="text/css">
+		.grid_right{
+		border-style: groove;
+		border-width: 0px;
+		border-right-width: 1px;		
+		border-color: BLACK;		
+		}
+		.grid_top{
+		border-style: groove;
+		border-width: 0px;
+		border-top-width: 1px;		
+		border-color: BLACK;		
+		}
+	</style>
+	<LINK href="../../../phpgwapi/templates/default/css/azul.css" type=text/css rel=StyleSheet>
+	<script language="Javascript">
+		function validate(){
+			if(document.login.user.value =="")	{
+				alert('Você deve digitar um nome no campo Usuário.');
+				document.login.user.focus();
+				return false;
+			}
+			
+			return true;
+		}
+	</script>
+	</head>
+	<body>
+	  <div align="center" valign="center">
+		<table cellspacing="0" cellpadding="5" width="100%" height="100%">			
+			<tr><td width="10%" valign="center"  class="grid_right"><br>
+				<table border="0" cellpadding="0" cellspacing="0" class="login" height="100%" width="100%">
+					<tr>
+						<td valign="top">
+	  					<FORM name="login" method="post" action="publicView.php" onSubmit="javascript:return validate()">
+							<table border="0" cellpadding="0" cellspacing="0" class="tableLogin">
+								<tr>
+									<td width="66" class="loginLabel" align="center"><b>Organização</b><br><input type="text" value="<?=$organization?>" name="organization" size="15"></td>
+								</tr>
+								<tr>									
+									<td>&nbsp;</td>
+								</tr>
+								<tr>
+									<td width="136" align="center" class="loginLabel"><b>Usuário</b><br><input name="user" size="15" value="<?=$user?>"></td>
+								</tr>
+								<tr>									
+									<td height="16">&nbsp;</td>
+								</tr>
+								<tr>
+									<td width="135" colspan="2" align="center">						
+									<input type="submit" value="Visualizar" name="submitit" class=button >
+									</td>
+									</tr>
+							</table>
+							</FORM>
+						</td>
+					</tr>
+				</table>								
+			</td>
+				<td width="90%" valign="top">
+					<iframe  width="100%" height="95%" src="../../../index.php?menuaction=calendar.uipublicview.publicView<?=$params?>"
+						marginwidth="0" marginheight="0"  topmargin="0" leftmargin="0" frameborder="0" scrolling="auto" noresize>
+					</iframe>
+			</td></tr>
+		</table>
+	  </div>
+	</body>
+</html>
Index: /contrib/Timesheet/templates/default/search.tpl
===================================================================
--- /contrib/Timesheet/templates/default/search.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/search.tpl	(revision 3526)
@@ -0,0 +1,123 @@
+<!-- BEGIN search -->
+
+<script language="Javascript">
+  
+    function submitit(form,campo)
+{
+	//alert(name+' pressed');
+ var texto;
+  //  texto = "El numero de opciones del select: " + document.form.search_info_type.length;
+    var indice = document.form.search_info_type.selectedIndex;
+    //texto += "\nIndice de la opcion escogida: " + indice;
+    var valor = document.form.search_info_type.options[indice].value;
+   // texto += "\nValor de la opcion escogida: " + valor;
+    var textoEscogido = document.form.search_info_type.options[indice].text;
+  //  texto += "\nTexto de la opcion escogida: " + textoEscogido;
+  //  alert(texto) ;
+	//document.form.ordena.value = name;
+form.action='/index.php?menuaction=infolog.uiinfolog.search&ordenar='+campo+'&valor='+valor;
+	form.submit();
+	//form.submit_button.value = '';
+	return false;
+}
+  function submitit2(id)
+{
+
+location.href='/index.php?menuaction=timesheet.uitimesheet.delete&id='+id;
+return false;	
+}
+</script>
+<center>
+
+<table id="calendar_search_table" width="90%">
+
+<tr><td align=left>
+<form  METHOD=POST name="form">
+<input type=hidden name=ordena value="">
+	<table><tr class="th">
+	<td>
+		<table>
+			
+			<tr>
+				<td class="inactiv_sortcolumn" align="left"><a href="" onclick="return submitit(this.form,'percent asc')">T&iacute;tulo</a></td>
+			</tr>
+		</table>
+
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left"><a href="" onclick="return submitit(this.form,'percent asc')">Descripci&oacute;n</a></td>
+			
+			</tr>
+			
+		</table>
+	</td>
+	
+	<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left"><a href="" onclick="return submitit(this.form,'percent asc')">Inicio</a></td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left"><a href="" onclick="return submitit(this.form,'percent asc')">Fin</a></td>
+			
+			</tr>
+			
+		</table>
+	</td>
+	
+	<td class="noPrint" align="left" width="3%">Acci&oacute;n </td>
+
+	</td>
+	</tr>
+
+	<tr>
+		<td colspan="2" align="center" bgcolor="{th_bg}">
+			<b></b>
+		</td>
+	</tr>
+	{rows}
+</form>
+</table>
+<!-- END search -->
+
+<!-- BEGIN search_list_header -->
+
+<!-- END search_list_header -->
+
+<!-- BEGIN search_list -->
+	<tr bgcolor="{tr_color}">
+		
+<td>	{title}</td>
+<td>{descripcion}</td>
+
+
+<td>{fechainicio}</td>
+<td>	{fechafin}</td>
+
+
+
+
+<td>
+<a href="{accionmodificar}"><img src=/infolog/templates/default/images/edit.png alt="modificar"></a>&nbsp;&nbsp;&nbsp;
+
+<a href="" onClick="if ( 0 || confirm('eliminar esta entrada?')) return submitit2('{accionborrar}');; "><img src=/infolog/templates/default/images/delete.png alt="borrar"></a><br>
+
+
+</td>
+	</tr>
+<!-- END search_list -->
+
+<!-- BEGIN search_list_footer -->
+
+<!-- END search_list_footer -->
Index: /contrib/Timesheet/templates/default/copyFolder.tpl
===================================================================
--- /contrib/Timesheet/templates/default/copyFolder.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/copyFolder.tpl	(revision 3526)
@@ -0,0 +1,51 @@
+<!-- BEGIN main -->
+<script type='text/javascript'>
+	var folderChooserURL ='{folderChooserURL}';
+</script>
+
+<form name="copy_form" method="post" action="{form_action}">
+<fieldset><legend>{lang_target_folder}</legend>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos">
+				<input id="targetname" style="width: 100%;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="{folderid}">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder(1,'copy_form'); return(false);" style="font-size:10px;">{lang_select_target_folder}...</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_name}:</td>
+			<td class="infos">
+				<input id="newfoldername" style="width: 100%;" type="text" name="newfoldername" value="{newfoldername}">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder(1,'copy_form'); return(false);" style="font-size:10px;">&nbsp;</td>
+		</tr>
+	</table>
+</fieldset>
+<p>
+<fieldset><legend>{lang_copy_options}</legend>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_off">
+			<td class="infos">
+				<input type="checkbox" name="copy_subfolder" id="copy_subfolder"> <label for="copy_subfolder">{lang_copy_subfolders}</label>
+			</td>
+		</tr>
+		<tr class="row_off">
+			<td class="infos">
+				<input type="checkbox" name="copy_documents" id="copy_documents" disabled> <label for="copy_documents">{lang_copy_documents}</label>
+			</td>
+		</tr>
+	</table>
+</fieldset>
+<p>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_off">
+			<td class="infos">
+				<button type="submit" name="cancel">{lang_cancel}</button>
+				<button type="submit" name="copy">{lang_copy}</button>
+			</td>
+		</tr>
+	</table>
+</form>
+<!-- END main -->
Index: /contrib/Timesheet/templates/default/images/buttons/atualizar.sh
===================================================================
--- /contrib/Timesheet/templates/default/images/buttons/atualizar.sh	(revision 3526)
+++ /contrib/Timesheet/templates/default/images/buttons/atualizar.sh	(revision 3526)
@@ -0,0 +1,14 @@
+cp /public/home/desenvolvimento/arte/imagens_file_manager/up.png uplvl_big.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/refresh.png fs_refresh.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/new_folder.png new_folder.png
+
+cp /public/home/desenvolvimento/arte/imagens_file_manager/up_load.png upload.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/lixeira.png delete_big.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/cut.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/copy.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/sharing.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/searching.png ab_search.png
+
+cp /public/home/desenvolvimento/arte/imagens_file_manager/compress.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/decompress.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/home.png .
Index: /contrib/Timesheet/templates/default/images/index.html
===================================================================
--- /contrib/Timesheet/templates/default/images/index.html	(revision 3526)
+++ /contrib/Timesheet/templates/default/images/index.html	(revision 3526)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+	<title>eGroupWare Info Log Icons</title>
+</head>
+
+<body bgcolor=Silver>
+	Types:<br>
+	<img src="phone.gif" width="20" height="20" alt="Telefon" border="0"> &nbsp;
+	<img src="task.gif" width="20" height="20" alt="Aufgabe" border="0"> &nbsp;
+	<img src="note.gif" width="20" height="20" alt="Notiz" border="0"> &nbsp;
+	<img src="confirm.gif" width="20" height="20" alt="Bestätigung" border="0"> &nbsp;
+	<img src="reject.gif" width="20" height="20" alt="Absage" border="0">
+	<p>
+	Status:<br>
+	<img src="offer.gif" width="20" height="20" alt="Angebot" border="0"> &nbsp;
+	<img src="ongoing.gif" width="20" height="20" alt="läuft" border="0"> &nbsp;
+	<img src="call.gif" width="20" height="20" alt="anrufen" border="0"> &nbsp;
+	<img src="will-call.gif" width="20" height="20" alt="ruft zurück" border="0"> 
+&nbsp;
+	<img src="done.gif" width="20" height="20" alt="erledigt" border="0"> &nbsp;
+	<img src="billed.gif" width="20" height="20" alt="abgerechnet" border="0">
+	<p>
+	Actions:<br>
+	<img src="new.gif" width="20" height="20" alt="neue Teilaufgabe" border="0"> 
+&nbsp;
+	<img src="view.gif" width="20" height="20" alt="Teilaufgagen anzeigen" 
+border="0"> &nbsp;
+	<img src="edit.gif" width="20" height="20" alt="bearbeiten" border="0"> &nbsp;
+	<img src="delete.gif" width="20" height="20" alt="löschen" border="0">
+</body>
+</html>
+
Index: /contrib/Timesheet/templates/default/overlap.tpl
===================================================================
--- /contrib/Timesheet/templates/default/overlap.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/overlap.tpl	(revision 3526)
@@ -0,0 +1,30 @@
+<!-- BEGIN overlap -->
+<center><br />
+<table id="calendar_overlap_table">
+	<tr>
+		<td>
+			{overlap_text}
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<ul>{overlap_list}</ul>
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<table id="calendar_overlap_table2" cellspacing="5">
+				<tr>
+					<td>
+						{resubmit_button}
+					</td>
+					<td>
+						{reedit_button}
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
+</center>
+<!-- END overlap -->
Index: /contrib/Timesheet/templates/default/day_list.tpl
===================================================================
--- /contrib/Timesheet/templates/default/day_list.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/day_list.tpl	(revision 3526)
@@ -0,0 +1,28 @@
+<!-- BEGIN day -->
+<div class="event-off">
+<table border="0" width="100%" cellpadding="0">
+	<tr>
+		<td class="event-on">
+{row}
+		</td>
+	</tr>
+</table>
+</div>
+<!-- END day -->
+<!-- BEGIN day_row -->
+    <font style="font-size: 8pt;">{event}</font>
+<!-- END day_row -->
+<!-- BEGIN day_event_on -->
+	<font class="event-on">{event}</font>
+<!-- END day_event_on -->
+<!-- BEGIN day_event_off -->
+	<font class="event-on">{event}</font>
+<!-- END day_event_off -->
+<!-- BEGIN day_event_holiday -->
+	{event}
+<!-- END day_event_holiday -->
+<!-- BEGIN day_time -->
+	{time}
+     <!--<td class="time" nowrap>{open_link}{time}{close_link}</td>-->
+<!-- END day_time -->
+
Index: /contrib/Timesheet/templates/default/grant_group_access.tpl
===================================================================
--- /contrib/Timesheet/templates/default/grant_group_access.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/grant_group_access.tpl	(revision 3526)
@@ -0,0 +1,65 @@
+<div align="center" style="width:100%">
+<input type="hidden" id="txt_loading" value="{lang_Loading}">
+<input type="hidden" id="txt_searching" value="{lang_Searching}">
+<input type="hidden" id="txt_users" value="{lang_Users}">
+<input type="hidden" id="txt_groups" value="{lang_Groups}">
+<input type="hidden" id="txt_confirm" value="{lang_confirm}">
+<input type="hidden" id="txt_success" value="{lang_success}">
+<input type="hidden" id="txt_exist" value="{lang_exist}">
+<input type="hidden" id="txt_nouser" value="{lang_nouser}">
+<input type="hidden" id="txt_nogroup" value="{lang_nogroup}">
+<input type="hidden" id="txt_nopermissiontype" value="{lang_nopermissiontype}">
+<input type="hidden" id="txt_typemoreletters" value="{lang_typemoreletters}">
+<input type="hidden" id="template_set" value="{template_set}">
+<table width="80%" border="0">
+<tr>
+<td align='center' valign="bottom"><br><b>{lang_User_to_grant_access}</b><br>
+	<font color="red"><span id="cal_span_searching1">&nbsp;</span></font>
+	<br>{lang_Search_for}: <input type="text" id="cal_input_searchUser1" name="cal_input_searchUser1" value="" size=30 autocomplete="off" onkeyup="javascript:search_object(this,'cal_span_searching1','user','u')"/>
+	<br><br>
+	<select id="user" style="width: 300px" size="13"></select>
+</td>
+<td width="20px" valign="middle" align="left"><br><br><br><br>
+<button type="button" onClick="javascript:add_user();"><img src="{template_set}/images/add.png" style="vertical-align: middle;" >{lang_Add}</button>
+<br><br><b>{lang_access_type}</b><br>
+<input type="checkbox" id="right_L" value="L"/>{lang_read}<br>
+<input type="checkbox" id="right_A" value="A"/>{lang_add}<br>
+<input type="checkbox" id="right_E" value="E"/>{lang_edit}<br>
+<input type="checkbox" id="right_R" value="R"/>{lang_delete}<br>
+<input type="checkbox" id="right_P" value="P"/>{lang_private}
+</td>
+<td align='center' valign="bottom"><br><b>{lang_Group_to_share_calendar}</b><br>
+	<font color="red"><span id="cal_span_searching2">&nbsp;</span></font>
+	<br>{lang_Search_for}:	<input type="text" id="cal_input_searchUser2" name="cal_input_searchUser2" value="" size=30 autocomplete="off" onkeyup="javascript:search_object(this,'cal_span_searching2','group','g')"/><br><br>
+	<select id="group" style="width: 300px" size="13"></select>
+</td>
+</tr>
+	<tr height="20px"></tr>
+	<tr bgcolor="{tr_color}" style="font-size:0.8em">
+		<th align="left" width="25%" nowrap>&nbsp;{lang_granted_user}</th>
+		<th align="center" width="1%">{lang_access_type}</th>
+		<th align="left" width="40%" nowrap>&nbsp;{lang_shared_group}</th>
+		<th width="1%">&nbsp;</th>
+	</tr>
+<tbody id='tbody_list' >
+<!-- BEGIN list -->
+	<tr id='{select}' bgcolor="{tr_color_header}">
+		<td>
+			<b>&nbsp;&nbsp;{granted_user}</b>
+		</td>
+		<td align="center">
+			{access_type}
+		</td>		
+		<td>
+			&nbsp;&nbsp;{shared_group}
+		</td>
+		<td align="center">
+			<button  title="{lang_Remove}" type="button" onClick="javascript:remove_user('{select}');"><img alt="{lang_Remove}" src="{template_set}/images/delete.png" style="vertical-align: middle;"/></button>
+		</td>
+	</tr>
+<!-- END list -->
+</tbody>
+</table>
+<br><br>
+</div>
+{scripts}
Index: /contrib/Timesheet/templates/default/index.xet
===================================================================
--- /contrib/Timesheet/templates/default/index.xet	(revision 3526)
+++ /contrib/Timesheet/templates/default/index.xet	(revision 3526)
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<!-- $Id: index.xet 24276 2007-07-10 07:35:18Z ralfbecker $ -->
+<overlay>
+	<template id="timesheet.index.dates" template="" lang="" group="0" version="1.2.001">
+		<hbox rows="1" cols="1" class="custom_hide">
+			<description value="Start"/>
+			<date id="startdate"/>
+			<description value="End"/>
+			<date id="enddate" statustext="Leave it empty for a full week"/>
+		</hbox>
+		<styles>
+			.custom_hide { visibility: hidden; }
+		</styles>
+	</template>
+	<template id="timesheet.index.add" template="" lang="" group="0" version="1.3.001">
+		<button label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.edit'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;"/>
+	</template>
+	<template id="timesheet.index.rows" template="" lang="" group="0" version="1.3.002">
+		<grid width="100%">
+			<columns>
+				<column width="15%"/>
+				<column width="50%"/>
+				<column/>
+				<column/>
+				<column disabled="@ts_viewtype"/>
+				<column disabled="@ts_viewtype"/>
+				<column disabled="@ts_viewtype"/>
+				<column disabled="@no_owner_col"/>
+				<column/>
+			</columns>
+			<rows>
+				<row class="th">
+					<nextmatch-sortheader label="Date" id="ts_start"/>
+					<grid spacing="1" padding="1">
+						<columns>
+							<column/>
+						</columns>
+						<rows>
+							<row disabled="@pm_integration=full">
+								<nextmatch-filterheader options="All projects" id="ts_project" no_lang="1"/>
+							</row>
+							<row disabled="!@pm_integration=full">
+								<nextmatch-customfilter options="projectmanager-select,All projects" id="pm_id" onchange="1"/>
+							</row>
+							<row>
+								<nextmatch-sortheader label="Title" id="ts_title"/>
+							</row>
+						</rows>
+					</grid>
+					<nextmatch-sortheader label="Category" id="cat_id"/>
+					<vbox>
+						<nextmatch-sortheader label="Duration" id="ts_duration"/>
+						<date-duration id="duration" options=",h,,,1" readonly="true"/>
+					</vbox>
+					<vbox options="0,0">
+						<nextmatch-sortheader label="Quantity" id="ts_quantity"/>
+						<textbox type="float" id="quantity" readonly="true" precision="3"/>
+					</vbox>
+					<nextmatch-sortheader label="Price" id="ts_unitprice"/>
+					<vbox>
+						<nextmatch-sortheader label="Total" id="ts_total"/>
+						<textbox type="float" id="price" readonly="true" precision="2"/>
+					</vbox>
+					<nextmatch-filterheader id="ts_owner" options="User" no_lang="1" class="$cont[ownerClass]"/>
+					<description value="Actions" class="noPrint"/>
+				</row>
+				<row class="$row_cont[class]">
+					<date-time id="${row}[ts_start]" readonly="true" options=",8"/>
+					<vbox>
+						<link id="${row}[ts_link]" no_lang="1"/>
+						<description id="${row}[ts_title]" no_lang="1" class="$row_cont[titleClass]"/>
+						<description id="${row}[ts_description]" no_lang="1"/>
+					</vbox>
+					<menulist class="noWrap">
+						<menupopup type="select-cat" readonly="true" id="${row}[cat_id]"/>
+					</menulist>
+					<date-duration id="${row}[ts_duration]" readonly="true" options=",h,,,1"/>
+					<textbox type="float" id="${row}[ts_quantity]" no_lang="1" precision="3" readonly="true"/>
+					<description no_lang="1" id="${row}[ts_unitprice]"/>
+					<textbox type="float" no_lang="1" id="${row}[ts_total]" precision="2" readonly="true"/>
+					<menulist class="$cont[ownerClass]">
+						<menupopup type="select-account" id="${row}[ts_owner]" readonly="true"/>
+					</menulist>
+					<hbox class="noPrint">
+						<button image="view" label="View" id="view[$row_cont[ts_id]]" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.view&amp;ts_id=$row_cont[ts_id]'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;" statustext="View this entry"/>
+						<button image="edit" label="Edit" id="edit[$row_cont[ts_id]]" statustext="Edit this entry" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.edit&amp;ts_id=$row_cont[ts_id]'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;"/>
+						<button image="delete" label="Delete" id="delete[$row_cont[ts_id]]" statustext="Delete this entry" onclick="return confirm('Delete this entry');"/>
+					</hbox>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.index" template="" lang="" group="0" version="1.3.002">
+		<grid width="100%">
+			<columns>
+				<column/>
+			</columns>
+			<rows>
+				<row disabled="!@msg">
+					<description span="all" class="redItalic" no_lang="1" id="msg" align="center"/>
+				</row>
+				<row disabled="1">
+					<hbox>
+						<template id="timesheet.index.dates"/>
+						<template id="timesheet.index.add" align="right"/>
+					</hbox>
+				</row>
+				<row>
+					<nextmatch id="nm" options="timesheet.index.rows"/>
+				</row>
+				<row class="noPrint">
+					<button label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.edit'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;"/>
+				</row>
+				<row>
+					<button label="Export" onclick="timesheet_export(); return false;" id="export"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+</overlay>
Index: /contrib/Timesheet/templates/default/viewDocument.tpl
===================================================================
--- /contrib/Timesheet/templates/default/viewDocument.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/viewDocument.tpl	(revision 3526)
@@ -0,0 +1,499 @@
+<!-- BEGIN main -->
+<script type='text/javascript'>
+	var folderChooserURL ='{folderChooserURL}';
+</script>
+
+<table width="100%" border="0" cellspacing="0" cellpading="0" bgcolor="white" hheight="100px">
+	<tr class="topRow">
+		<th width="33%">{delete}</th>
+		<th width="33%">{view_online}</th>
+		<th width="33%">{download}</th>
+	</tr>
+</table>
+<br>
+<table width="100%" border="0" cellspacing="0" cellpading="0">
+	<tr>
+		<th width="20%" id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);" style="font-size:10px;">{lang_informations}</a></th>
+		<th width="20%" id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);" style="font-size:10px;">{lang_all_versions}</a></th>
+		<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">{lang_linked_documents}</a></th>
+		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">{lang_notifications}</a></th>
+		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>
+	</tr>
+</table>
+<div style="border-left: dotted 1px grey; border-bottom: dotted 1px grey; border-right: dotted 1px grey; background: white;">
+<div id="tabcontent1" class="inactivetab" bgcolor="white">
+	{informations}
+</div>
+
+<div id="tabcontent2" class="inactivetab">
+
+	<table cellspacing="5" cellpadding="0" border="0" width="100%">
+		<tr>
+			<td></td>
+			<td></td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_version}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_upload_date}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_comment}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_uploaded_by}</i></td>
+			<td></td>
+		</tr>
+		{versions}
+	</table>
+</div>
+
+<div id="tabcontent3" class="inactivetab">
+<!--
+<table cellspacing="5" cellpadding="0" border="1">
+	<?php
+	if ($rownum > 1)
+	{
+		?>
+		<tr>
+		<td></td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("name");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("comment");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_by");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_public");?></i></td>
+		<td></td>
+		</tr>
+		<?php 
+		foreach($links as $link)
+		{
+			$responsibleUser = $link->getUser();
+			$targetDoc = $link->getTarget();
+			
+			print "<tr>";
+			print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+			print "<td class=\"linklist\"><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
+			print "<td class=\"linklist\">".$targetDoc->getComment()."</td>";
+			print "<td class=\"linklist\">".$responsibleUser->getFullName()."</td>";
+			print "<td class=\"linklist\">" . (($link->isPublic()) ? getMLText("yes") : getMLText("no")) . "</td>";
+			print "<td>";
+			if (($user->getID() == $responsibleUser->getID()) || ($user->getID() == $settings->_adminID) || ($link->isPublic() && ($document->getAccessMode($user) >= M_READWRITE )))
+				print "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\"><img src=\"images/del.gif\" border=0></a>";
+			print "</td>";
+			print "</tr>";
+		}
+	}
+	else
+		print "<tr><td class=\"filelist\">".getMLText("no_document_links")."</td></tr>";
+	?>
+</table>
+
+
+if ($user->getID() != $settings->_guestID)
+
+	<form action="../op/op.AddDocumentLink.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("choose_target_document");?>:</td>
+			<td><?php printDocumentChooser("form1");?></td>
+		</tr>
+		<?php 
+			if ($document->getAccessMode($user) >= M_READWRITE)
+			{
+				print "<tr><td class=\"inputDescription\">".getMLText("document_link_public")."</td><td class=\"inputDescription\">";
+				print "<input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes") . "&nbsp;&nbsp;";
+				print "<input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no");
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit" value="<?php printMLText("add_document_link");?>"></td>
+		</tr>
+	</table>
+	</form>-->
+</div>
+
+<div id="tabcontent4" class="inactivetab">
+	<table cellspacing="0" cellpadding="5" border="0" width="100%">
+		<tr>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+			<td style="border-bottom: 1pt solid #000080;" class="notifylist"><i>{lang_name}</i></td>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+		</tr>
+		{notifications}
+		<tr>
+			<td colspan="3">&nbsp;</td>
+		</tr>
+	</table>
+
+	<form action="{notify_form_action}" method="post" name="notify_form">
+		<fieldset><legend>{lang_add_notification}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_userid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_groupid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+	</form>
+</div>
+
+<div id="tabcontent5" class="inactivetab">
+	{change_owner}
+	{display_acl}
+</div>
+
+<div id="tabcontent6" class="inactivetab">
+	<form enctype="multipart/form-data" name="update_file_form" method="post" action="{action_update_file}">
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input type="file" name="userfile"></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;"></textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire_update}
+				<span id="jscalspan_update" class="{expire_class_update}">{expire_date_update}</span>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_update}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="javascript:tab.display(1);">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</form>
+</div>
+
+
+
+</div>
+<!-- END main -->
+
+<!-- BEGIN lock_row -->
+	<tr class="row_on">
+		<td class="description" valign="top">{lang_lock_status}:</td>
+		<td class="infos" colspan="3">
+			<input id="lockStatus" type="hidden" name="lockStatus" value="unchanged">
+			<input type="checkbox" onClick="javascript:toggleLock(this);" {checked_lock_status}>
+			<div id="currentLockStatus" class="active">
+				{lang_current_status}
+			</div>
+			<div id="lockFile" class="inactive">
+				{lang_file_gets_unlocked}
+			</div>
+			<div id="unlockFile" class="inactive">
+				{lang_file_gets_locked}
+			</div>
+		</td>
+	</tr>
+<!-- END lock_row -->
+
+<!-- BEGIN version_row -->
+	<tr>
+		<td>
+			{url_view_online}
+		</td>
+		<td>
+			<a href="{url_download_file}" class="oldcontent"><img src="{download_image}" width=22 height=22 border=0 title="{lang_download}"></a>
+		</td>
+		<td class="filelist" align="center">{version_version}</td>
+		<td class="filelist">{version_date}</td>
+		<td class="filelist">{version_comment}</td>
+		<td class="filelist">{version_uploadingUser}</td>
+		<td>{url_delete_file}</td>
+	</tr>
+<!-- END version_row -->
+
+<!-- BEGIN information_ro -->
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr>
+			<td class="infos" valign="top" width="150px">{lang_filename}:</td>
+			<td style="border-left: 1pt solid #000080;" rowspan="14" width="1px">&nbsp;</td>
+			<td class="infos">{filename}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_owner}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment}:</td>
+			<td class="infos">{comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_creation_date}:</td>
+			<td class="infos">{creation_date}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_keywords}:</td>
+			<td class="infos">{keywords}</td>
+		</tr>
+		{locking}
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_mime_type}:</td>
+			<td class="infos">
+				<img align="absmiddle" src="images/icons/<?php print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top">
+				{expire_date_ro}
+			</td>
+		</tr>
+	</table>
+<!-- END information_ro -->
+
+<!-- BEGIN information_rw -->
+	<form name="info_form" method="post" action="{action_informations}">
+	<fieldset><legend>{lang_general_information}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input style="width: 100%;" type="text" name="fname" value="{filename}"></td>
+			<td align="center" width="150px"><a href="#" tabindex="0" onfocus="tab.display(6);" onclick="tab.display(6); return(false);" style="font-size:10px;">{lang_update_document}</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos" colspan="2">
+				<input id="targetname" style="width: 100%;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="unchanged">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder({current_folder_id},'info_form'); return(false);" style="font-size:10px;">{lang_move_document}</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="3"><textarea name="comment" style="width: 100%; height: 80px;">{comment}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_keywords}:</td>
+			<td class="infos" colspan="3"><textarea name="keywords" style="width: 100%; height: 30px;">{keywords}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="3">
+				{select_expire}
+				<span id="jscalspan" class="{expire_class}">{expire_date}</span>
+			</td>
+		</tr>
+		{locking}
+		<tr class="row_on">
+			<td class="description_small" valign="top">{lang_owner}:</td>
+			<td class="infos" colspan="1">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+			<td class="description_small" valign="top">{lang_creation_date}:</td>
+			<td class="infos" colspan="1">{creation_date}</td>
+		</tr>
+		<tr class="row_on">
+			<td colspan="4" valign="top">
+				<button type="submit" name="save" value="save">
+					{lang_save}
+				</button>
+				<button style="margin-left: 10px;" type="button" name="cancel" value="cancel" onClick="window.close()">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	<p>
+	<fieldset style="border: 1px solid silver;"><legend>{lang_information_about_last_update}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_off">
+			<td class="description_small" valign="top" width="150px">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+			<td class="description_small" valign="top" width="150px">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description_small" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+			<td class="description_small" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description_small" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top" colspan="3">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="description_small" valign="top">{lang_mime_type}:</td>
+			<td class="infos" colspan="3">
+				<img align="absmiddle" src="images/icons/<?php print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	</form>
+<!-- END information_rw -->
+
+<!-- BEGIN block_download -->
+<a href="{download_link}"><img src="{download_image}" align="middle" border="0">{lang_download}</a>
+<!-- END block_download -->
+
+<!-- BEGIN block_view_online -->
+<a target="_blank" href="{view_link}"><img src="{view_image}" align="middle" border="0">{lang_view_online}</a>
+<!-- END block_view_online -->
+
+<!-- BEGIN block_delete -->
+<a href="{delete_link}" onClick="return confirm('{lang_confirm_delete}');"><img src="{delete_image}" align="middle" border="0">{lang_delete}</a>
+<!-- END block_delete -->
+
+<!-- BEGIN notification_row -->
+	<tr>
+		<td><img src="{notify_image}" width=16 height=16></td>
+		<td class="notifylist">{notify_username}</td>
+		<td align="right"><a href="{link_notify_delete}"><img title="{lang_delete_this_notification}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+<!-- END notification_row -->
+
+<!-- BEGIN block_change_owner -->
+	<form name="change_owner" action="{action_change_owner}" method="post">
+		<fieldset><legend>{lang_owner}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_ownerid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>&nbsp;</td>
+			</tr>
+		</table>
+	</form>
+<!-- END block_change_owner -->
+
+<!-- BEGIN block_acl_inherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_acl_get_inherited}</div>
+	<p>
+	<a href="{link_acl_copy}">{lang_copy_acl}</a><br>
+	<a href="{link_acl_empty}">{lang_create_empty_acl}</a><br>
+	</fieldset>
+<!-- END block_acl_inherite -->
+
+<!-- BEGIN block_acl_notinherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_inherite_acl_again}</div>
+	<p>
+	<a href="{link_acl_inherit_again}">{lang_inherit_acl_again}</a><br>
+
+	<fieldset><legend>{lang_default_access}</legend>
+	<form name="change_default_access" action="{action_change_default_access}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_default_access}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	<fieldset><legend>{lang_current_acl}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td></td>
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_name}</i></td>
+				<!-- <td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td> -->
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_access_mode}</i></td>
+				<td></td>
+				<td></td>
+			</tr>
+			{acls}
+		</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_add_acl}</legend>
+	<form name="add_acl" action="{action_add_acl}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_add_acl_userid}
+				</td>
+				<td rowspan="3">
+					<input type="Submit">
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_add_acl_groupid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_permission}:</td>
+				<td>
+					{select_add_acl_permission}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	</fieldset>
+<!-- END block_acl_notinherite -->
+
+<!-- BEGIN acl_row -->
+	<form method="post" action="{action_acl_row}">
+	<tr>
+		<td width="20px"><img src="{acl_image}" width=16 height=16></td>
+		<td class="acllist">{acl_username}</td>
+		<td class="acllist" width="310px">{acl_selectbox}</td>
+		<td width="20px"><input type="Image" src="{save_image}" alt="{lang_save}"></td>
+		<td width="20px" align="right"><a href="{link_acl_delete}" onClick="return confirm('{lang_confirm_acl_delete}');"><img title="{lang_delete_this_acl}" alt="{lang_delete}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+	</form>
+<!-- END acl_row -->
+
Index: /contrib/Timesheet/templates/default/app.css
===================================================================
--- /contrib/Timesheet/templates/default/app.css	(revision 3526)
+++ /contrib/Timesheet/templates/default/app.css	(revision 3526)
@@ -0,0 +1,5 @@
+/* $Id: app.css 22414 2006-09-12 10:37:13Z ralfbecker $ */
+.redItalic { color: red; font-style: italics; }
+.titleSum,.titleDetails { font-weight: bold; }
+.noWrap { white-space: nowrap; }
+.width100 { width: 100%; }
Index: /contrib/Timesheet/templates/default/hr.tpl
===================================================================
--- /contrib/Timesheet/templates/default/hr.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/hr.tpl	(revision 3526)
@@ -0,0 +1,6 @@
+ <tr>
+  <td colspan="2">
+   {hr_text}
+  </td>
+ </tr>
+
Index: /contrib/Timesheet/templates/default/view.tpl
===================================================================
--- /contrib/Timesheet/templates/default/view.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/view.tpl	(revision 3526)
@@ -0,0 +1,46 @@
+
+<!-- BEGIN view_event -->
+<center>
+<table id="calendar_view_event" border="0" width="90%">
+	{row}
+	<tr>
+		<td>
+			<table id="calendar_viewevent_button_left" cellspacing="5">
+				<tr>
+					{button_left}
+				</tr>
+			</table>
+		</td>
+	   <td align="center">
+			<table id="calendar_viewevent_button_center" cellspacing="5">
+				<tr>
+					{button_center}
+				</tr>
+			</table>
+		</td>
+		<td align="right">
+			<table id="calendar_viewevent_button_right" cellspacing="5">
+				<tr>
+					{button_right}
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
+</center>
+<!-- END view_event -->
+
+<!-- BEGIN list -->
+	<tr bgcolor="{tr_color}">
+		<td valign="top" width="30%">&nbsp;<b>{field}:</b></td>
+		<td colspan="2" valign="top" width="70%">{data}</td>
+	</tr>
+<!-- END list -->
+
+<!-- BEGIN hr -->
+	<tr>
+		<td colspan="3" bgcolor="{th_bg}" align="center">
+			<b>{hr_text}</b>
+		</td>
+	</tr>
+<!-- END hr -->
Index: /contrib/Timesheet/templates/default/delete_common.tpl
===================================================================
--- /contrib/Timesheet/templates/default/delete_common.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/delete_common.tpl	(revision 3526)
@@ -0,0 +1,16 @@
+<!-- BEGIN form -->
+ <center>
+  <table border="0" with="65%">
+   <tr>
+    <td colspan="2" align="center">
+     {messages}
+    </td>
+   </tr>
+   <tr>
+    <td align="center">{no}</td>
+    <td align="center">{yes}</td>
+   </tr>
+  </table>
+ </center>
+<!-- END form -->
+
Index: /contrib/Timesheet/templates/default/mini_cal.tpl
===================================================================
--- /contrib/Timesheet/templates/default/mini_cal.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/mini_cal.tpl	(revision 3526)
@@ -0,0 +1,42 @@
+
+<!-- BEGIN mini_cal -->
+
+	<table id="calendar_minical_table" class="calendar_minical_table" border=0 cellspacing="0" cellpadding="0">
+		<tr>
+			<td style="padding-left: 8px; font-weight: bold; text-align: left;">
+				{month}
+			</td>
+			<td align="right">
+				<!-- why empty? -->
+				{prevmonth}&nbsp;&nbsp;{nextmonth}
+			</td>
+		</tr>
+		<tr>
+			<td  style="padding-left: 8px; text-align: left;">
+<!--				<img src="{cal_img_root}" width="90%" height="1"> -->
+					<hr class="calendar_minical_hrule">
+			</td>
+		</tr>
+		<tr valign="top">
+			<td>
+				<table id="calendar_minical_daytable" class="calendar_minical_daytable" cellspacing="5" cellpadding="0">
+					<tr>{daynames}</tr>
+						{display_monthweek}
+				</table>
+
+			</td>
+	 	</tr>
+	</table>
+<!-- END mini_cal -->
+
+<!-- BEGIN mini_week -->
+	<tr>
+		{monthweek_day}
+	</tr>
+<!-- END mini_week -->
+
+<!-- BEGIN mini_day -->
+		<td class="calendar_minical_dayname" {day_image}>
+			{dayname}
+		</td>
+<!-- END mini_day -->
Index: /contrib/Timesheet/templates/default/list.tpl
===================================================================
--- /contrib/Timesheet/templates/default/list.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/list.tpl	(revision 3526)
@@ -0,0 +1,6 @@
+<!-- BEGIN list -->
+ <tr>
+  <td valign="top" width="35%"><b>{field}:</b></td>
+  <td valign="top" width="65%">{data}</td>
+ </tr>
+<!-- END list -->
Index: /contrib/Timesheet/templates/default/link_pict.tpl
===================================================================
--- /contrib/Timesheet/templates/default/link_pict.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/link_pict.tpl	(revision 3526)
@@ -0,0 +1,25 @@
+
+<!-- BEGIN link_pict -->
+{picture}
+<!-- END link_pict -->
+
+<!-- BEGIN link_open -->
+<div id="calendar_event_entry" style="overflow:hidden;">
+<a class="event_entry" href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;" onMouseOut="window.status=''; return true;" title="{desc} {location}"><br>
+<!-- END link_open -->
+
+<!-- BEGIN pict -->
+ <img src="{pic_image}" width="{width}" height="{height}" title="{title}" border="0" />
+<!-- END pict -->
+
+<!-- BEGIN link_text_old -->
+<nobr>&nbsp;{time}&nbsp;</nobr> {title}&nbsp;{users_status}: <i>{desc}</i><!--({location})-->
+<!-- END link_text_old -->
+
+<!-- BEGIN link_text -->
+&nbsp;<FONT SIZE=1><span style="color: black">{time}</span> {users_status}<br><b>{title}</b><br><i>{desc}</i> {location}
+<!-- END link_text -->
+
+<!-- BEGIN link_close -->
+</a></div>
+<!-- END link_close -->
Index: /contrib/Timesheet/templates/default/day.tpl
===================================================================
--- /contrib/Timesheet/templates/default/day.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/day.tpl	(revision 3526)
@@ -0,0 +1,39 @@
+<!-- BEGIN day -->
+{printer_friendly}
+<table id="calendar_dayview_table" class="calendar_dayview_table" border="0" width="100%">
+	<tr>
+		<td valign="top" width="70%">
+			<table id="calendar_dayview1" border="0" width=100%>
+				<tr>
+					<td class="calendar_dayview_table_header">
+      					{date}&nbsp;<span class="calendar_user_identifier">:&nbsp;{username}&nbsp;:</span>
+						<br />
+     				</td>
+    			</tr>
+				{day_events}
+   			</table>
+   			<p align="center">{print}</p>
+  		</td>
+ 		 <td align="center" valign="top">
+  			 <table id="calendar_dayview2" width="100%">
+    			<tr>
+     				<td align="center">
+						{small_calendar}
+     				</td>
+    			</tr>
+
+   			</table>
+  		</td>
+ 	</tr>
+</table>
+<!-- END day -->
+
+<!-- BEGIN day_event -->
+	<tr>
+		<td>
+
+			{daily_events}
+
+		</td>
+	</tr>
+<!-- END day_event -->
Index: /contrib/Timesheet/templates/default/js/edit_exmail.js
===================================================================
--- /contrib/Timesheet/templates/default/js/edit_exmail.js	(revision 3526)
+++ /contrib/Timesheet/templates/default/js/edit_exmail.js	(revision 3526)
@@ -0,0 +1,393 @@
+/******************************************************************************\
+|**************************   CALENDAR MODULE   *******************************|
+|********** INCLUDE PARTICIPANTS - PLUGIN USING AJAX EXPRESSOMAIL COMPONENT  **|
+\******************************************************************************/
+var contacts = '';
+var expresso_offline = '';
+var array_lang = new Array();
+var finderTimeout = '';
+// onUnload edit message
+if(!document.all)
+{
+	var beforeunload = window.onbeforeunload;
+	window.onbeforeunload = function()
+	{
+		if ( typeof beforeunload == 'function' )
+			beforeunload();
+	};
+}
+	
+// Verifica versão do Firefox
+var agt = navigator.userAgent.toLowerCase();
+var is_firefox_0 = agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.') ? true : false;
+
+var handler_get_available_users = function(data)
+{	
+	select_available_users = Element('user_list_in');
+	
+	for(var i=0; i<select_available_users.options.length; i++){
+		select_available_users.options[i] = null;
+		i--;
+	}
+	var options = '###';
+	if (data) {
+		if(data.groups && data.groups.length > 0) {
+			data.groups = '<option  value="-1" disabled>------------------- '+Element("txt_groups").value+' ------------------ </option>' + data.groups;
+		}		
+		if(data.users && data.users.length > 0) {
+			data.users = '<option  value="-1" disabled>------------------- '+Element("txt_users").value+' ------------------ </option>' + data.users;
+		}
+		options +=  data.groups && data.groups.length > 0 ? data.groups : '';
+		options +=  data.users  && data.users.length  > 0 ? data.users  : '';
+		
+		if(is_firefox_0)
+			fixBugInnerSelect(select_available_users,options);
+		else
+			select_available_users.innerHTML = options;
+
+		select_available_users.outerHTML = select_available_users.outerHTML;
+		select_available_users.disabled = false;
+		select_available_users_clone = Element('user_list_in').cloneNode(true);		
+	}
+}	
+
+function get_available_users(module,context,type, autoSearch){
+	Element('cal_input_searchUser').value = '';
+	if(autoSearch != 'True'){
+		return true;
+	}
+	var context = document.getElementById('combo_org').value;	
+	cExecute (module+'.ldap_functions.get_available_users&context='+context+'&type='+type, handler_get_available_users);
+}
+
+function optionFinderTimeout(obj, numMin, type, autoSearch){
+	var oWait = Element("cal_span_searching");
+	oWait.innerHTML = 'Buscando...';
+	clearTimeout(finderTimeout);		
+	
+	if(autoSearch == "True"){
+		finderTimeout = setTimeout("optionFinderLocal('"+obj.id+"')",500);
+	}
+	else if (obj.value.length >= numMin){
+		finderTimeout = setTimeout("optionFinderLdap('"+obj.id+"','"+numMin+"','"+type+"')",500);
+	}else {
+		oWait.innerHTML = 'Mínimo de '+numMin+' letras para pesquisa';
+		var select_available_users_tmp = document.getElementById('user_list_in');
+		for(var i = 0;i < select_available_users_tmp.options.length; i++)
+		select_available_users_tmp.options[i--] = null;
+	}
+}
+// Pesquisa Javascript
+function optionFinderLocal(id){
+	var oText = Element(id);
+	var oWait = Element("cal_span_searching");
+	var select_available_users_tmp = Element('user_list_in');
+	for(var i = 0;i < select_available_users_tmp.options.length; i++)
+		select_available_users_tmp.options[i--] = null;
+	var RegExp_name = new RegExp("\\b"+oText.value, "i");
+
+	for(i = 0; i < select_available_users_clone.length; i++){
+		if (RegExp_name.test(select_available_users_clone[i].text) || select_available_users_clone[i].value =="-1")
+		{
+			sel = select_available_users_tmp.options;
+			option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value);
+			if( select_available_users_clone[i].value == "-1") option.disabled = true;
+			sel[sel.length] = option;
+		}
+	}
+	oWait.innerHTML = '&nbsp;';	
+}
+
+// Pesquisa LDAP
+function optionFinderLdap(id,numMin, type){
+		var oWait = Element("cal_span_searching");
+		var oText = Element(id);
+			
+		if (oText.value.length < numMin) {
+				oWait.innerHTML = '';
+				var select_available_users_tmp = document.getElementById('user_list_in');
+				for(var i = 0;i < select_available_users_tmp.options.length; i++)
+					select_available_users_tmp.options[i--] = null;
+		}
+		
+		if (oText.value.length >= numMin){
+			var context = document.getElementById('combo_org').value;
+			cExecute ('expressoMail1_2.ldap_functions.search_users&context='+(context)+'&type='+(type == '' ? 'list' : 'search')+'&filter='+oText.value, handler_get_available_users);
+			oWait.innerHTML = '&nbsp;';
+		}
+}
+
+function add_user()
+{
+	var select_available_users = document.getElementById('user_list_in');
+	var select_users = document.getElementById('user_list');
+	var count_available_users = select_available_users.length;
+	var count_users = select_users.options.length;
+	var new_options = '';
+	
+	for (i = 0 ; i < count_available_users ; i++) {
+		if (select_available_users.options[i].selected)	{
+			if(document.all) {
+				if ( (select_users.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) {
+					new_options +=  '<option value='
+								+ select_available_users.options[i].value
+								+ '>'
+								+ select_available_users.options[i].text
+								+ '</option>';
+				}
+			}
+			else if ( (select_users.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) {
+					new_options +=  '<option value='
+								+ select_available_users.options[i].value
+								+ '>'
+								+ select_available_users.options[i].text
+								+ '</option>';
+			}
+		}
+	}
+
+	if (new_options != '') {
+
+		if(is_firefox_0)
+			fixBugInnerSelect(select_users,'###' + new_options + select_users.innerHTML);
+		else
+			select_users.innerHTML = '###' + new_options + select_users.innerHTML;
+
+		select_users.outerHTML = select_users.outerHTML;
+	}
+}
+
+function remove_user(){
+	select_users = document.getElementById('user_list');
+	
+	for(var i = 0;i < select_users.options.length; i++)
+		if(select_users.options[i].selected)
+			select_users.options[i--] = null;
+}
+
+function submitValues(){
+	var typeField = document.getElementById('cal[type]');
+	if (typeField && typeField.value == 'hourAppointment') {
+		if(document.getElementsByName('categories[]')[0].value == ""){
+			alert(alert_msg);
+			return false;
+		}
+	}
+	var select_in = document.getElementById('user_list');
+	for(i = 0; i < select_in.length; i++)
+	 	select_in.options[i].selected = true;
+}	
+
+function Element(id){
+	return document.getElementById(id);
+}
+
+function loadScript(scriptPath){
+
+	if(!connector)
+		throw new Error("Error : Connector is not loaded.");
+		
+  	if (document.getElementById('uploadscript_'+scriptPath)) {
+  		return;
+   	}
+  	
+	connector.oxmlhttp.open("GET", scriptPath, false);
+    connector.oxmlhttp.setRequestHeader('Content-Type','text/plain');
+	connector.oxmlhttp.send(null);
+	if(connector.oxmlhttp.status != 0 && connector.oxmlhttp.status != 200 || 	connector.oxmlhttp.status == 0 && connector.oxmlhttp.responseText.length == 0)
+		throw new Error("Error " + connector.oxmlhttp.status + "("+connector.oxmlhttp.statusText+") when loading script file '"+scriptPath+"'");
+	
+	var head = document.getElementsByTagName("head")[0];
+	var script = document.createElement("SCRIPT");
+	script.id = 'uploadscript_'+scriptPath;
+	script.type = 'text/javascript';		
+	script.text = connector.oxmlhttp.responseText;
+	head.appendChild(script);
+	return;	
+}
+
+function showExParticipants(el,path){
+	Element('tbl_ext_participants').style.display='';
+	el.style.display='none';
+	loadScript(path+"/js/DropDownContacts.js");
+	loadScript(path+"/js/common_functions.js");
+	loadScript(path+"/js/QuickCatalogSearch.js");
+	loadScript("calendar/templates/default/js/over_fn_exmail.js");
+	if(!contacts)
+		cExecute (path+'.db_functions.get_dropdown_contacts', save_contacts);
+}
+
+function hideExParticipants(el,path){
+	Element('a_ext_participants').style.display = '';
+	Element('tbl_ext_participants').style.display ='none';
+}
+
+function save_contacts(data){
+	contacts = data;	
+	var input_to = Element("ex_participants");
+	input_to.style.width = "100%";
+	input_to.setAttribute("wrap","soft");	
+	input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);};
+	input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);};
+	if (!is_ie)
+	{
+		input_to.rows = 2;
+		input_to.onkeypress = function (e)
+		{
+			if ((e.keyCode) == 120) //F9
+			{
+				emQuickSearch(input_to);
+			}
+			else 
+			{ 
+				if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden'))
+				{
+					e.preventDefault();
+					search_contacts(e.keyCode,this.id);
+				}
+			}
+		}
+		input_to.onkeyup = function (e)
+		{
+			if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40))
+			{
+				search_contacts(e.keyCode,this.id);
+			}
+		}
+	}
+	else
+	{
+		input_to.rows = 3;
+		input_to.onkeyup = function (e)
+		{
+			if ((window.event.keyCode) == 120) //F9
+			{
+				emQuickSearch(input_to);
+			}
+			else 
+			{ 
+				search_contacts(window.event.keyCode,this.id);
+			}	
+		}
+	}
+}
+
+function fixBugInnerSelect(objeto,innerHTML){
+/******
+* select_innerHTML - altera o innerHTML de um select independente se é FF ou IE
+* Corrige o problema de não ser possível usar o innerHTML no IE corretamente
+* Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228
+* Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email.
+* Versão: 1.0 - 06/04/2006
+* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br
+* Parametros:
+* objeto(tipo object): o select a ser alterado
+* innerHTML(tipo string): o novo valor do innerHTML
+*******/
+    objeto.innerHTML = ""
+    var selTemp = document.createElement("micoxselect")
+    var opt;
+    selTemp.id="micoxselect1"
+    document.body.appendChild(selTemp)
+    selTemp = document.getElementById("micoxselect1")
+    selTemp.style.display="none"
+    if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto
+        innerHTML = "<option>" + innerHTML + "</option>"
+    }
+    innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span")
+    selTemp.innerHTML = innerHTML
+    for(var i=0;i<selTemp.childNodes.length;i++){
+        if(selTemp.childNodes[i].tagName){
+            opt = document.createElement("OPTION")
+            for(var j=0;j<selTemp.childNodes[i].attributes.length;j++){
+                opt.setAttributeNode(selTemp.childNodes[i].attributes[j].cloneNode(true))
+            }
+            opt.value = selTemp.childNodes[i].getAttribute("value")
+            opt.text = selTemp.childNodes[i].innerHTML
+            if(document.all){ //IEca
+                objeto.add(opt)
+            }else{
+                objeto.appendChild(opt)
+            }                    
+        }    
+    }
+    document.body.removeChild(selTemp)
+    selTemp = null
+}
+
+function changeViewMode(eltype){
+	var chValue = eltype;
+	switch (chValue){
+		case 'hourAppointment':
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "none";
+			}
+
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			Field[1].parentNode.parentNode.style.display = "none";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "none";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			break;
+		case 'privateHiddenFields':
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "";
+			}
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			Field[1].parentNode.parentNode.style.display = "none";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "none";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "";
+			break;
+		default:
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "";
+			}
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "";
+			Field[1].parentNode.parentNode.style.display = "";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "";
+			break;
+	}
+
+}
+function updateTitleField(select){
+	var typeField = document.getElementsByName('cal[type]');
+	if (typeField[0].value != 'hourAppointment')
+		return;
+	var titleField = document.getElementsByName('cal[title]');
+	var optionsArray = select.childNodes;
+	titleField[0].value = '';
+	for(option in optionsArray)
+		if (optionsArray[option].selected)
+			titleField[0].value += optionsArray[option].text + ' ';
+}
+
+var __onLoad = window.onload;
+window.onload = function(){ 
+	__onLoad();
+	var cal_type = document.getElementById('cal[type]').value;
+	changeViewMode(cal_type);
+	if(cal_type == 'hourAppointment'){
+		clearTimeout(timeout_get_available_users);
+	}
+};
Index: /contrib/Timesheet/templates/default/js/edit.js
===================================================================
--- /contrib/Timesheet/templates/default/js/edit.js	(revision 3526)
+++ /contrib/Timesheet/templates/default/js/edit.js	(revision 3526)
@@ -0,0 +1,101 @@
+/******************************************************************************\
+|**************************   MODULO   AGENDA   *******************************|
+|********** SCRIPT REFERENTE A CAIXA DE INCLUSAO DE PARTICIPANTES  ************|
+\******************************************************************************/
+
+// Variaveis Locais 
+	var select_in  = document.getElementById('user_list');
+	var select_out  = document.getElementById('user_list_in');	
+	var users_out = select_out ? select_out.cloneNode(true) : '';
+	var finderTimeout = '';
+																		
+// Funcoes				
+	function showExParticipants(el,path){
+		document.getElementById('tbl_ext_participants').style.display='';
+		el.style.display='none';
+	}
+	
+	function hideExParticipants(el,path){
+		document.getElementById('a_ext_participants').style.display = '';
+		document.getElementById('tbl_ext_participants').style.display ='none';
+	}
+							
+	function optionFinderTimeout(obj){
+
+		clearTimeout(finderTimeout);	
+		var oWait = document.getElementById("wait");
+		oWait.innerHTML = 'Buscando...';
+		finderTimeout = setTimeout("optionFinder('"+obj.id+"')",500);
+	}
+	function optionFinder(id) {	
+		var oWait = document.getElementById("wait");
+		var oText = document.getElementById(id);
+		for(var i = 0;i < select_out.options.length; i++)				
+			select_out.options[i--] = null;
+																							
+		for(i = 0; i < users_out.length; i++){																							
+			if(users_out[i].text.substring(0 ,oText.value.length).toUpperCase() == oText.value.toUpperCase()) {
+				sel = select_out.options;						
+				option = new Option(users_out[i].text,users_out[i].value);				
+				sel[sel.length] = option;
+			}
+		}
+		oWait.innerHTML = '&nbsp;';
+	}			
+									
+	function rem()
+	{
+		for(var i = 0;i < select_in.options.length; i++)				
+			if(select_in.options[i].selected)
+				select_in.options[i--] = null;																	
+	}
+		
+	function submitValues(alert_msg){
+		var typeField = document.getElementById('cal[type]');
+		if (typeField && typeField.value == 'hourAppointment')
+			if(document.getElementsByName('categories[]')[0].value == ""){
+				alert(alert_msg);
+				return false;
+				}
+		for(i = 0; i < select_in.length; i++)
+		 	select_in.options[i].selected = true;
+	}
+	
+	
+	
+	function openListUsers(newWidth,newHeight, owner){					
+		newScreenX  = screen.width - newWidth;		
+		newScreenY  = 0;		
+		window.open('calendar/templates/default/listUsers.php?owner='+owner,"","width="+newWidth+",height="+newHeight+",screenX="+newScreenX+",left="+newScreenX+",screenY="+newScreenY+",top="+newScreenY+",toolbar=no,scrollbars=yes,resizable=no");
+	}
+
+ 	function adicionaListaCalendar() 
+ 	{
+		var select = window.document.getElementById('user_list_in');
+		var selectOpener = window.opener.document.getElementById('user_list');
+		for (i = 0 ; i < select.length ; i++) {				
+
+			if (select.options[i].selected) {
+				isSelected = false;
+
+				for(var j = 0;j < selectOpener.options.length; j++) {																			
+					if(selectOpener.options[j].value == select.options[i].value){
+						isSelected = true;						
+						break;	
+					}
+				}
+
+				if(!isSelected){
+
+					option = window.opener.document.createElement('option');
+					option.value =select.options[i].value;
+					option.text = select.options[i].text;
+					selectOpener.options[selectOpener.options.length] = option;	
+				}
+				
+			}
+		}
+		selectOpener.options[selectOpener.options.length-1].selected = true;
+ 	}
+	
+// Fim        
Index: /contrib/Timesheet/templates/default/js/search.js
===================================================================
--- /contrib/Timesheet/templates/default/js/search.js	(revision 3526)
+++ /contrib/Timesheet/templates/default/js/search.js	(revision 3526)
@@ -0,0 +1,108 @@
+var searchTimeout;
+
+function lang(key){
+	return document.getElementById("txt_"+key).value;
+}
+
+function remove_user(id){
+	if(!confirm(lang("confirm")))
+		return true;	
+	var handler_rem_user = function(data){
+		if(data) {
+			var tr = document.getElementById(id);
+			tr.parentNode.removeChild(tr);
+		}
+	}	
+	cExecute ('calendar.uigroup_access.rem_user&id='+id, handler_rem_user);
+}
+function add_user(){
+	var select_users = document.getElementById("user");
+	var select_groups = document.getElementById("group");
+	var a_rights = new Array("L","A","E","R","P");
+	var rights = '';
+	for(var z = 0; z < a_rights.length; z++){
+		var check = document.getElementById("right_"+a_rights[z]);
+		if(check.checked){
+			rights += check.value;
+		}
+	}
+	if(!select_users.value){
+		alert(lang("nouser"));
+		return;
+	}
+	else if(!select_groups.value){
+		alert(lang("nogroup"));
+		return;
+	}
+	else if(!rights){
+		alert(lang("nopermissiontype"));
+		return;
+	}
+	
+	var str = select_users.value+";"+select_groups.value;
+	var handler_add_user = function(data){
+		
+		if(data){
+			var t = document.getElementById('tbody_list');
+			var tr = document.createElement("TR");
+			tr.bgColor = "#DCDCDC";
+			var td1 = document.createElement("TD");
+			var td2 = document.createElement("TD");
+			var td3 = document.createElement("TD");
+			var td4 = document.createElement("TD");
+			tr.id = str;
+			td1.innerHTML = "<b>&nbsp;&nbsp;"+select_users[select_users.selectedIndex].text+"</b>";
+			td2.innerHTML = rights;
+			td2.align = "center";
+			td3.innerHTML = "&nbsp;&nbsp;"+select_groups[select_groups.selectedIndex].text;
+			td4.innerHTML = "<button  title='remove' type='button' onClick='javascript:remove_user(\""+str+"\");'><img src='"+document.getElementById("template_set").value+"/images/delete.png' style='vertical-align: middle;'/></button>";
+			tr.appendChild(td1);
+			tr.appendChild(td2);
+			tr.appendChild(td3);
+			tr.appendChild(td4);
+			t.appendChild(tr);
+			alert(lang("success"));
+		}
+		else{
+			alert(lang("exist"));
+		}
+	}
+	cExecute ('calendar.uigroup_access.add_user&id='+str+"&rights="+rights, handler_add_user);
+	return true;
+		
+}
+function search_object(input, id_span, id_select, type)
+{
+	clearTimeout(searchTimeout);	
+	var spam = document.getElementById(id_span);
+	if (input.value.length <= 3){
+		spam.innerHTML = lang("typemoreletters").replace("X",4 - input.value.length);
+	}else{
+		spam.innerHTML = lang("searching")+'...';
+		searchTimeout = setTimeout("search_ldap('"+input.id+"','"+id_span+"','"+id_select+"','"+type+"')",750);
+	}
+}
+
+function search_ldap(id_input, id_span, id_select, type)
+{
+	var search = document.getElementById(id_input).value;
+	
+	var handler_search_user = function(data)
+	{
+		var spam = document.getElementById(id_span);
+		select_available_users = document.getElementById(id_select);
+		if (data.status == 'false')
+		{
+			spam.innerHTML = data.msg;
+			// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+			select_available_users.innerHTML = '#';
+			select_available_users.outerHTML = select_available_users.outerHTML;
+			return;
+		}	
+		spam.innerHTML = '';
+		// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+		select_available_users.innerHTML = '#' + data;
+		select_available_users.outerHTML = select_available_users.outerHTML;
+	}
+	cExecute ('calendar.uigroup_access.search_user&search='+search+"&type="+type, handler_search_user);
+}
Index: /contrib/Timesheet/templates/default/js/over_fn_exmail.js
===================================================================
--- /contrib/Timesheet/templates/default/js/over_fn_exmail.js	(revision 3526)
+++ /contrib/Timesheet/templates/default/js/over_fn_exmail.js	(revision 3526)
@@ -0,0 +1,163 @@
+/******************************************************************************\
+|**************************   CALENDAR MODULE   *******************************|
+|********** PLUGIN USING AJAX EXPRESSOMAIL COMPONENT - OVERWRITE FUNCTIONS   **|
+\******************************************************************************/
+
+/******************************************************************************\
+|** Function      : emQuickSearch *********************************************|
+|** Original File : <expressoMail_module>/js/common_functions.js **************|
+\******************************************************************************/
+window.onresize = function(){};
+function emQuickSearch(el){
+
+	var emailList = el.value;
+	var field = el.id;
+	var ex_participants = Element("ex_participants");
+	var quickSearchKeyBegin;
+	var quickSearchKeyEnd;
+	
+	var handler_emQuickSearch = function(data){
+		window_DropDownContacts = Element('tipDiv');
+		if (window_DropDownContacts.style.visibility != 'hidden'){
+			window_DropDownContacts.style.visibility = 'hidden';
+		}
+		
+		if ((!data.status) && (data.error == "many results")){
+			alert(get_lang('More than %1 results. Please, try to refine your search.',200));
+			return false;
+		}
+			
+		if (data.length > 0){
+			QuickCatalogSearch.showList(data, quickSearchKeyBegin, quickSearchKeyEnd);
+		}
+		else
+			alert(get_lang('None result was found.'));
+		return true;
+	}
+	ex_participants.focus(); 				//mecessary for IE.
+	var i = getPosition(ex_participants); //inputBox.selectionStart;
+	var j = --i;
+
+    while ((j >= 0) && (emailList.charAt(j) != ',')){j--};
+    quickSearchKeyBegin = ++j;
+
+    while ((i <= emailList.length) && (emailList.charAt(i) != ',')){i++};
+    quickSearchKeyEnd = i;
+
+    var search_for = trim(emailList.substring(quickSearchKeyBegin, quickSearchKeyEnd));
+
+	if (search_for.length < 4){
+		alert(get_lang('Your search argument must be longer than 4 characters.'));
+		return false;
+	}
+	
+	cExecute ("expressoMail1_2.ldap_functions.quicksearch&search_for="+search_for+"&field="+field, handler_emQuickSearch);
+}
+
+/******************************************************************************\
+|** Function      : emQuickCatalogSearch.prototype.transfer_result ************|
+|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
+\******************************************************************************/
+emQuickCatalogSearch.prototype.transfer_result = function (field, ID, begin, end){
+	cm = document.getElementById('select_QuickCatalogSearch');
+	option_selected = cm.options[cm.selectedIndex].value + ", ";
+	emailList = Element("ex_participants").value;		
+	new_emailList = emailList.substring(0, begin) + option_selected + emailList.substring((parseInt(end) + 2), emailList.length);
+	document.getElementById("ex_participants").value = new_emailList;
+	if(is_ie)
+		Element("i_blank").style.display = "none";
+	document.getElementById("ex_participants").focus();
+	this.arrayWin['window_QuickCatalogSearch'].close();
+}
+
+/******************************************************************************\
+|** Function      : emQuickCatalogSearch.prototype.close_QuickSearch_window ***|
+|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
+\******************************************************************************/
+emQuickCatalogSearch.prototype.close_QuickSearch_window = function (field, ID){
+	if(is_ie)
+		Element("i_blank").style.display = "none";
+	document.getElementById("ex_participants").focus();
+	this.arrayWin['window_QuickCatalogSearch'].close();
+}
+
+/******************************************************************************\
+|** Function      : emQuickCatalogSearch.prototype.showWindow *****************|
+|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
+\******************************************************************************/
+emQuickCatalogSearch.prototype.showWindow = function (div)
+{
+	if(! div) {
+		alert(get_lang('The list has no participant.'));
+		return;
+	}
+						
+	if(! this.arrayWin[div.id]) {
+		div.style.width = "700px";
+		div.style.height = "230px";
+		var title = get_lang('The results were found in the Global Catalog')+':';
+		var wHeight = div.offsetHeight + "px";
+		var wWidth =  div.offsetWidth   + "px";
+		div.style.width = div.offsetWidth - 5;
+
+		win = new dJSWin({			
+			id: 'QuickCatalogSearch_'+div.id,
+			content_id: div.id,
+			width: wWidth,
+			height: wHeight,
+			y:'300px',
+			top: '300px',
+			title_color: '#3978d6',
+			bg_color: '#eee',
+			title: title,						
+			title_text_color: 'white',
+			button_x_img: 'phpgwapi/images/winclose.gif',
+			border: true });
+		
+		this.arrayWin[div.id] = win;
+		win.draw();
+	}
+	else {
+		win = this.arrayWin[div.id];
+	}
+
+	if(is_ie) {	
+		var _IFrame = Element("i_blank");
+		if(_IFrame){
+    		_IFrame.style.display  = '' ;		
+		}
+		else {
+			_IFrame = document.body.appendChild(document.createElement('iframe'));
+			_IFrame.src = 'about:blank' ;
+		    _IFrame.frameBorder		= '0';
+		    _IFrame.scrolling		= 'no' ;
+		    _IFrame.style.left		= findPosX(div)  + document.body.scrollLeft -5;
+			_IFrame.style.top		= findPosY(div)  + document.body.scrollTop  -20;
+		    _IFrame.width			= 610;
+   		    _IFrame.style.border	= 0;
+			_IFrame.height			= 285;
+			_IFrame.border			= 0;
+			_IFrame.id				= "i_blank";
+		    _IFrame.style.position	= 'absolute';
+	   	    _IFrame.style.zIndex	= '5';
+    		_IFrame.style.display  = '' ;
+		}
+	}
+
+	win.open();
+	document.getElementById('select_QuickCatalogSearch').focus();
+}	
+
+
+/******************************************************************************\
+|** Function      :  DRAG *****************************************************|
+|** Original File : phpgwapi/js/wz_dragdrop/wz_dragdrop.js ********************|
+\******************************************************************************/
+var over_fn_DRAG = DRAG;
+DRAG = function (event){
+
+		if(is_ie)
+			return false;
+		else
+			over_fn_DRAG(event);
+}		
Index: /contrib/Timesheet/templates/default/vcal_import.tpl
===================================================================
--- /contrib/Timesheet/templates/default/vcal_import.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/vcal_import.tpl	(revision 3526)
@@ -0,0 +1,10 @@
+<!-- vcardin form -->
+{vcal_header}
+    <form ENCTYPE="multipart/form-data" method="POST" action="{action_url}">
+      <table border=0>
+      <tr>
+       <td>{ical_lang}: <input type="file" name="uploadedfile"></td>
+       <td><input type="submit" name="action" value="{load_vcal}"></td>
+      </tr>
+      </table>
+     </form>
Index: /contrib/Timesheet/templates/default/month_day.tpl
===================================================================
--- /contrib/Timesheet/templates/default/month_day.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/month_day.tpl	(revision 3526)
@@ -0,0 +1,21 @@
+
+<!-- BEGIN m_w_table -->
+
+<table id="calendar_m_w_table" class="calendar_m_w_table" border="0" width="100%">
+	<! from month_header.tpl -->
+	{row}
+</table>
+<!-- END m_w_table -->
+
+<!-- BEGIN month_daily -->
+<span class="screen_only">[ </span><span class="calendar_m_w_table_daynumber" >{day_number}</span><span class="screen_only"> ]</span>{new_event_link}<br />
+    {daily_events}
+<!-- END month_daily -->
+
+<!-- BEGIN day_event -->
+{events}
+<!-- END day_event -->
+
+<!-- BEGIN event -->
+{day_events}
+<!-- END event -->
Index: /contrib/Timesheet/templates/default/preference_acl_row.tpl
===================================================================
--- /contrib/Timesheet/templates/default/preference_acl_row.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/preference_acl_row.tpl	(revision 3526)
@@ -0,0 +1,7 @@
+<!-- $Id: preference_acl_row.tpl 20159 2005-12-19 04:23:14Z ralfbecker $ -->
+   <tr class="{row_class}">
+    <td>{user}</td>
+    <td align="center"><input type="checkbox" name="{read}" value="Y"{read_selected}></td>
+    <td align="center"><input type="checkbox" name="{edit}" value="Y"{edit_selected}></td>
+    <td align="center"><input type="checkbox" name="{delete}" value="Y"{delete_selected}></td>
+   </tr>
Index: /contrib/Timesheet/templates/default/edit.tpl
===================================================================
--- /contrib/Timesheet/templates/default/edit.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/edit.tpl	(revision 3526)
@@ -0,0 +1,123 @@
+<!-- BEGIN edit_entry -->
+<style type="text/css">
+div#tipDiv {
+  position:absolute; visibility:hidden; left:0; top:0; z-index:10000;
+  background-color:#EFEFEF; border:1px solid #337;
+  width:220px; padding:3px;
+  color:#000; font-size:11px; line-height:1.2;
+  cursor: default;
+}
+</style>
+
+
+
+<style type="text/css">
+<!--
+.hideFrom input { display: none; }
+.link_select select { width: 250px; }
+-->
+</style>
+
+
+
+
+<div class="sideboxSpace"></div>
+
+<table id="calendar_head_table" class="calendar_head_table" border="0" width="100%" cols="{cols}" cellpadding="6" cellspacing="0">
+	<tr>
+		<td rowspan=10>
+	
+	<div id="divSubContainer">
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr>
+		<!-- Sidebox Column -->
+<td id="tdSidebox" valign="top"><div id="thesideboxcolumn" style="width: 203px;"><div id="sideresize"></div>
+<div class="divSidebox">
+	<div class="divSideboxHeader"><span>Registro de Hoja de presencia Men&uacute;</span></div>
+
+	<div>
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/timesheet/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href="index.php?menuaction=timesheet.uitimesheet.search">Lista del registro</a></td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/timesheet/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href=""></a><a class="textSidebox" href="index.php?menuaction=timesheet.uitimesheet.edit"  >A&ntilde;adir</a></td>
+		</tr>
+
+		</tbody></table>	
+	</div>
+</div>
+
+<div class="sideboxSpace"></div>
+
+</td> <td>  
+<font color="#000000" face="{font}">
+
+<form action="{action_url}" method="post" name="app_form">
+{common_hidden}
+<table id="editFormTable" border="0" width="90%"   class="prefTable">
+ <tr>
+  <td colspan="2">
+   <center><font size="+1"><b id="formStatus">{errormsg}</b></font></center>
+  </td>
+ </tr>
+{row}
+
+ <tr>
+  <td>
+  <table><tr valign="top">
+  <td>
+  <div style="padding-top:15px; padding-right: 2px">
+  	<script language="JavaScript">
+		var alert_field = '{alert_msg}';
+	</script>
+  	<center><input id="submit_button" style="font-size:10px" type="submit" value="{submit_button}" onClick="return submitValues(alert_field);"></center></div></form>
+  </td>
+  <td>{cancel_button}</td>
+  </tr></table>
+  </td>
+  <td align="right"></td>
+ </tr>
+</table>
+</font>
+</center>
+
+<table width="100%">
+	<tbody>
+
+<!-- END edit_entry -->
+<!-- BEGIN list -->
+ <tr bgcolor="{tr_color}">
+  <td valign="top" width="25%">&nbsp;<b>{field}:</b></td>
+  <td valign="top" width="75%">{data}</td>
+ </tr>
+
+<!-- END list -->
+
+<tr>
+<td>
+
+</td>
+</tr>
+<!-- BEGIN hr -->
+ <tr bgcolor="{tr_color}">
+  <td colspan="2">
+  {hr_text}
+  </td>
+ </tr>
+<!-- END hr -->
+</tbody>
+</table>
+
+
+
+
+
+
+
+
+
+</td>
+	</tr>
+</table>
+
Index: /contrib/Timesheet/templates/default/matrix_query.tpl
===================================================================
--- /contrib/Timesheet/templates/default/matrix_query.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/matrix_query.tpl	(revision 3526)
@@ -0,0 +1,25 @@
+<!-- BEGIN matrix_query -->
+<center>
+<form action="{action_url}" method="post" name="matrixform">
+<table border="0" width="90%">
+ <tr bgcolor="{th_bg}">
+  <td colspan="2" align="center"><b>{title}</b></td>
+ </tr>
+ {rows}
+ <tr>
+  <td>
+   <table cellspacing="5"><tr>
+    <td><input type="submit" value="{submit_button}"></form></td>
+    <td>{cancel_button}</td>
+   </tr></table>
+  </td>
+ </tr>
+</table>
+</center>
+<!-- END matrix_query -->
+<!-- BEGIN list -->
+ <tr bgcolor="{tr_color}">
+  <td valign="top" width="35%"><b>&nbsp;{field}:</b></td>
+  <td valign="top" width="65%">{data}</td>
+ </tr>
+<!-- END list -->
Index: /contrib/Timesheet/templates/default/week.tpl
===================================================================
--- /contrib/Timesheet/templates/default/week.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/week.tpl	(revision 3526)
@@ -0,0 +1,3 @@
+{week_display}
+<!-- from month_day.tpl -->
+<p align="center">{printer_friendly}</p>
Index: /contrib/Timesheet/templates/default/day_cal.tpl
===================================================================
--- /contrib/Timesheet/templates/default/day_cal.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/day_cal.tpl	(revision 3526)
@@ -0,0 +1,24 @@
+<!-- BEGIN day -->
+<div class="th">
+ <table class="calendar_dayview_maintable" width="100%" cellpadding="0">
+{row}
+</table>
+ </div>
+<!-- END day -->
+<!-- BEGIN day_row -->
+    <tr>{time}{event}
+    </tr>
+<!-- END day_row -->
+<!-- BEGIN day_event_on -->
+     <td class="event-on"{extras}>&nbsp;{event}</td>
+<!-- END day_event_on -->
+<!-- BEGIN day_event_off -->
+     <td class="event-off"{extras}>&nbsp;{event}</td>
+<!-- END day_event_off -->
+<!-- BEGIN day_event_holiday -->
+     <td class="event-holiday"{extras}>&nbsp;{event}</td>
+<!-- END day_event_holiday -->
+<!-- BEGIN day_time -->
+     <td class="time" nowrap>{open_link}{time}{close_link}</td>
+<!-- END day_time -->
+
Index: /contrib/Timesheet/templates/default/preference_acl.tpl
===================================================================
--- /contrib/Timesheet/templates/default/preference_acl.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/preference_acl.tpl	(revision 3526)
@@ -0,0 +1,27 @@
+{errors}
+{title}
+<table border="0" align="center" width="70%">
+ <tr>
+  {nml}
+  <td width="40%">
+   <div align="center">
+    <form method="POST" action="{action_url}">
+{common_hidden_vars}
+     <input type="text" name="query" value="{search_value}">
+     <input type="submit" name="search" value="{search}">
+    </form>
+   </div>
+  </td>
+  {nmr}
+ </tr>
+</table>
+<form method="POST" action="{action_url}">
+ <table border="0" align="center" width="50%" cols="4">
+{row}
+ </table>
+{common_hidden_vars_form}
+ <input type="hidden" name="processed" value="{processed}">
+ <center><input type="submit" name="submit" value="{submit_lang}"></center>
+</form>
+
+
Index: /contrib/Timesheet/templates/default/preference_colspan.tpl
===================================================================
--- /contrib/Timesheet/templates/default/preference_colspan.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/preference_colspan.tpl	(revision 3526)
@@ -0,0 +1,6 @@
+  <tr class="th">
+    <td>{string}</td>
+    <td align="center" width="8%">{lang_read}</td>
+    <td align="center" width="8%">{lang_edit}</td>
+    <td align="center" width="8%">{lang_delete}</td>
+  </tr>
Index: /contrib/Timesheet/templates/default/folderChooser.tpl
===================================================================
--- /contrib/Timesheet/templates/default/folderChooser.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/folderChooser.tpl	(revision 3526)
@@ -0,0 +1,11 @@
+<!-- BEGIN main -->
+<script language="JavaScript">
+
+var targetName = opener.document.{formName}.targetname;
+var targetID   = opener.document.{formName}.targetid;
+
+</script>
+
+<div id="mydmstreebox" style="top:0px; left:0px; width:200px; height:400px; border:dotted 0px silver; text-align:left;"></div>
+{folderTree}
+<!-- END main -->
Index: /contrib/Timesheet/templates/default/event_link.tpl
===================================================================
--- /contrib/Timesheet/templates/default/event_link.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/event_link.tpl	(revision 3526)
@@ -0,0 +1,41 @@
+
+<!-- BEGIN link_event_pict -->
+{picture}
+<!-- END link_event_pict -->
+
+<!-- BEGIN link_event_open -->
+<table>
+
+<!--<div id="calendar_event_entry" style="overflow:hidden;">-->
+<!--<a class="event_entry" href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;" onMouseOut="window.status=''; return true;" title="{desc} {location}"><br />--><br />
+<!-- END link_event_open -->
+
+<!-- BEGIN event_pict -->
+<!--<img src="{pic_image}" width="{width}" height="{height}" title="{title}" border="0" />-->
+<!-- END event_pict -->
+
+<!-- BEGIN link_event_text_old -->
+<!--<nobr>&nbsp;{time}&nbsp;</nobr> {title}&nbsp;{users_status}: <i>{desc}</i>({location}) -->
+<!-- END link_event_text_old -->
+
+<!-- BEGIN link_event_text -->
+	<tr style="font-size: 10px;background: #dddddd;">
+		<td valign="top" style="color: black; font-size: 11px;">
+			<span>
+				{time}
+			</span>
+		</td>
+		<td style="font-size: 11px; border: #E8F0F0 1px solid;" colspan="3">
+			<span><b>{title}</b></span>
+			<br />
+			<span><i>{desc}</i></span>
+			<span>{location}</span>
+			<br />
+		</td>
+	</tr>
+<!-- END link_event_text -->
+
+<!-- BEGIN link_event_close -->
+<!--</a></div><br />-->
+</table>
+<!-- END link_event_close -->
Index: /contrib/Timesheet/templates/default/year.tpl
===================================================================
--- /contrib/Timesheet/templates/default/year.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/year.tpl	(revision 3526)
@@ -0,0 +1,35 @@
+<!-- BEGIN year -->
+{print}
+<center>
+<table id="calendar_year_table" border="0" cellspacing="3" cellpadding="4" cols=4>
+	<tr>
+		<td align="center">
+			{left_link}
+		</td>
+		<td align="center">
+			<font face="{font}" size="+1">{year_text}</font>
+		</td>
+		<td align="center">
+			{right_link}
+		</td>
+		{row}
+	</tr>
+</table>
+</center>
+<p>
+<div class="calendar_link_print">
+{printer_friendly}
+</div>
+<!-- END year -->
+
+<!-- BEGIN month -->
+<td valign="top">
+	{mini_month}
+</td>
+<!-- END month -->
+
+<!-- BEGIN month_sep -->
+</tr>
+<tr valign="top">
+<!-- END month_sep -->
+
Index: /contrib/Timesheet/templates/default/head.tpl
===================================================================
--- /contrib/Timesheet/templates/default/head.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/head.tpl	(revision 3526)
@@ -0,0 +1,52 @@
+<!-- BEGIN head -->
+<script language="Javascript">
+function openwindow(url)
+{ 
+	
+	var window_features = 	"scrollbars=yes,resizable=yes,location=no,menubar=no," + 
+							"personalbar=no,status=no,titlebar=no,toolbar=no," + 
+							"screenX=screen.width/3,screenY=screen.height/3,top=screen.height/3,left=screen.width/3,width=" + 
+							screen.width/4*3 + ",height=" + screen.height/8*3; 
+	
+	self.open(url,'', window_features); 
+}
+</script>
+{row}<br />
+<!-- END head -->
+<!-- BEGIN head_table -->
+<table id="calendar_head_table" class="calendar_head_table" border="0" width="100%" cols="{cols}" cellpadding="6" cellspacing="0">
+	<tr>
+		<td rowspan=10>
+	
+	<div id="divSubContainer">
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr>
+		<!-- Sidebox Column -->
+<td id="tdSidebox" valign="top"><div id="thesideboxcolumn" style="width: 203px;"><div id="sideresize"></div>
+<div class="divSidebox">
+	<div class="divSideboxHeader"><span>Registro de Hoja de presencia Men&uacute;</span></div>
+
+	<div>
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/timesheet/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href="index.php?menuaction=timesheet.uitimesheet.search">Lista del registro</a></td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/timesheet/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href=""></a><a class="textSidebox" href="index.php?menuaction=timesheet.uitimesheet.edit"  >A&ntilde;adir</a></td>
+		</tr>
+
+		</tbody></table>	
+	</div>
+</div>
+
+<div class="sideboxSpace"></div>
+
+</td> <td> 
+
+
+
+
+<!-- END head_table -->
+<!-- BEGIN head_col -->
+
+<!-- END head_col -->
Index: /contrib/Timesheet/templates/default/month_print.tpl
===================================================================
--- /contrib/Timesheet/templates/default/month_print.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/month_print.tpl	(revision 3526)
@@ -0,0 +1,26 @@
+{printer_friendly}
+<table class="calendar_index_table" id="calendar_index_table"  width="100%" cols="5">
+	<tr>
+		<td align="left" width="33%">
+			<span class="calendar_user_identifier">
+					{username}
+			</span>
+		</td>
+		<td align="center" width="33%">
+			<span class="calendar_month_identifier">
+				{month_identifier}
+			</span>
+		</td>
+		<td align="right" style="width: 33%; font-size: 14px;">
+			<span class="calendar_user_identifier">
+				<p>Agenda de Eventos</p>
+			</span>
+		</td>
+	</tr>
+</table>
+{large_month}
+<p>
+<p>
+<div class="calendar_link_print">
+	{print}
+</div>
Index: /contrib/Timesheet/templates/default/month_column.tpl
===================================================================
--- /contrib/Timesheet/templates/default/month_column.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/month_column.tpl	(revision 3526)
@@ -0,0 +1,4 @@
+
+<td valign="top" colspan="1" width="{col_width}%"{extra}>
+	{column_data}
+</td>
Index: /contrib/Timesheet/templates/default/body_email.tpl
===================================================================
--- /contrib/Timesheet/templates/default/body_email.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/body_email.tpl	(revision 3526)
@@ -0,0 +1,32 @@
+<html>
+<head>
+<meta http-equiv="Content-Language" content="en" />
+<meta name="GENERATOR" content="PHPEclipse 1.0" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>title</title>
+</head>
+<body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99">
+<!-- BEGIN list -->
+<b><p align='left'>{subject}</p></b>
+<br>
+<table border='0' cellpadding='0' cellspacing='0' width='100%'>
+<tr><td width='30%' valign='top'><b>{var1} ::</b></td><td>{vardata1}</td></tr>	
+<tr><td width='30%' valign='top'><b>{var2} ::</b></td><td>{vardata2}</td></tr>
+<tr><td width='30%' valign='top'><b>{var3} ::</b></td><td>{vardata3}</td></tr>
+<tr><td width='30%' valign='top'><b>{var4} ::</b></td><td>{vardata4}</td></tr>
+<tr><td width='25%' valign='top'><b>{var8} ::</b></td><td>{vardata8}</td></tr>
+<tr><td width='25%' valign='top'><b>{var5} ::</b></td><td>{vardata6}</td></tr>
+</table>
+<br>
+<hr size='1' width='100%'>
+<table border='0' cellpadding='4' cellspacing='4' width='100%'>
+<tr>
+<td width='2%' align='left'>{varbuttom}</td>
+<td width='2%' align='left' valign='top'>{varbuttom1}</td>
+<td width='2%' align='left' valign='top'>{varbuttom2}</td>
+<td width='94%' align='left' valign='top'>{varbuttom3}</td>
+</tr>
+</table>
+<!-- END list -->
+</body>
+</html>
Index: /contrib/Timesheet/templates/default/config.tpl
===================================================================
--- /contrib/Timesheet/templates/default/config.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/config.tpl	(revision 3526)
@@ -0,0 +1,56 @@
+<!-- BEGIN header -->
+<p style="text-align: center; color: {th_err};">{error}</p>
+<form name=frm method="POST" action="{action_url}">
+{hidden_vars}
+<table border="0" align="left">
+   <tr class="th">
+    <td colspan="2">&nbsp;<b>{title}</b></td>
+   </tr>
+<!-- END header -->
+
+<!-- BEGIN body -->
+<tr class="row_on">
+<td>{lang_ProjectManager_integration}:</td>
+<td>
+<select name="newsettings[pm_integration]">
+<option value="">{lang_Both:_allow_to_use_ProjectManager_and_free_project-names}</option>
+<option value="none"{selected_pm_integration_none}>{lang_None:_use_only_free_project-names}</option>
+<option value="full"{selected_pm_integration_full}>{lang_Full:_use_only_ProjectManager}</option>
+</select>
+</td>
+</tr>
+<tr class="row_on">
+<td>{lang_Mode}:</td>
+<td>
+<select name="newsettings[ts_viewtype]">
+<option value="normal"{selected_ts_viewtype_normal}>{lang_Regular}</option>
+<option value="short"{selected_ts_viewtype_short}>{lang_Simple}</option>
+</select>
+</td>
+</tr>
+<tr class="row_on">
+<td>{lang_Show_a_quantity_sum_(eg._to_sum_up_negative_overtime)}:</td>
+<td>
+<select name="newsettings[quantity_sum]">
+<option value="">{lang_No}</option>
+<option value="true"{selected_quantity_sum_true}>{lang_Yes}</option>
+</select>
+</td>
+</tr>
+<!-- END body -->
+
+<!-- BEGIN footer -->
+  <tr class="th">
+    <td colspan="2">
+&nbsp;
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" align="center">
+      <input type="submit" name="submit" value="{lang_submit}">
+      <input type="submit" name="cancel" value="{lang_cancel}">
+    </td>
+  </tr>
+</table>
+</form>
+<!-- END footer -->
Index: /contrib/Timesheet/templates/default/index.tpl
===================================================================
--- /contrib/Timesheet/templates/default/index.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/index.tpl	(revision 3526)
@@ -0,0 +1,32 @@
+{printer_friendly}
+<table id="calendar_index_table" border="0" width="100%" cols="5">
+	<tr>
+		<td align="left" valign="top" width="20%">
+			{small_calendar_prev}
+		</td>
+		<td align="center" valign="middle" width="15%">
+			<b>{prev_month_link}</b>
+		</td>
+		<td align="center" width="30%">
+			<span class="calendar_month_identifier">
+				{month_identifier}
+			</span>
+				<br />
+			<span class="calendar_user_identifier">
+				:&nbsp;{username}&nbsp;:
+			</span>
+		</td>
+		<td align="center" valign="middle" width="15%">
+			{next_month_link}
+		</td>
+		<td align="right" valign="top" width="20%">
+			{small_calendar_next}
+		</td>
+	</tr>
+</table>
+{large_month}
+<p>
+<p>
+<div class="calendar_link_print">
+	{print}
+</div>
Index: /contrib/Timesheet/templates/default/month_header_print.tpl
===================================================================
--- /contrib/Timesheet/templates/default/month_header_print.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/month_header_print.tpl	(revision 3526)
@@ -0,0 +1,12 @@
+<!-- BEGIN monthly_header -->
+<tr class="calendar_m_w_table_header" colspan="{cols}" width="{col_width}%">
+{column_header}</tr>
+<!-- END monthly_header -->
+
+<!-- BEGIN column_title -->
+<tr bGCOLOR="#D3DCE3" width="14.28%">{col_title}</tr>
+<!-- END column_title -->
+
+<!-- BEGIN month_column -->
+<tr class="calendar_m_w_tablecell" colspan="1" width="{col_width}%"{extra}>{column_data}</tr>
+<!-- END month_column -->
Index: /contrib/Timesheet/templates/default/form_button_dropdown.tpl
===================================================================
--- /contrib/Timesheet/templates/default/form_button_dropdown.tpl	(revision 3526)
+++ /contrib/Timesheet/templates/default/form_button_dropdown.tpl	(revision 3526)
@@ -0,0 +1,13 @@
+<form action="{form_link}" method="post" name="{form_name}form">
+<td width="{form_width}%" align="center" valign="top" style="padding-top:16px">
+	<span style="font-size:10px"><b>{title}:</b>
+    {hidden_vars}    
+    <select name="{form_name}" onchange="document.{form_name}form.submit()">
+		{form_options}
+	</select>
+    <noscript>
+    	<input type="submit" value="{button_value}">
+    </noscript>
+	</span>
+</td>
+</form>
Index: /contrib/Resources/todo
===================================================================
--- /contrib/Resources/todo	(revision 3526)
+++ /contrib/Resources/todo	(revision 3526)
@@ -0,0 +1,36 @@
+TODO:
+- some artwork : general resource pictures like (room, car, beamer ...) (Benkom)
+- sitemgr module
+
+- list 
+	select all button --> add actions for selected: move to other cat,...
+	
+Long Term todo's:
+---------------------------
+advanced search dialog, accessable via sideboxmenu
+add buy and prize functionality
+add location functionality
+
+
+CREATE TABLE phpgw_resources
+(
+  res_id integer NOT NULL DEFAULT nextval('seq_phpgw_resources'::regclass),
+  "name" character varying(100),
+  short_description character varying(100),
+  cat_id integer NOT NULL,
+  quantity integer,
+  useable integer,
+  "location" character varying(100),
+  bookable character(1),
+  prize character varying(200),
+  picture_src character varying(20),
+  accessory_of integer,
+  storage_info character varying(200),
+  inventory_number character varying(20),
+  administrador character varying(255),
+  email character varying(255),
+  "owner" character varying(255),
+  CONSTRAINT phpgw_resources_pkey PRIMARY KEY (res_id)
+)
+WITH (OIDS=TRUE);
+ALTER TABLE phpgw_resources OWNER TO postgres;
Index: /contrib/Resources/inc/class.resources_hooks.inc.php
===================================================================
--- /contrib/Resources/inc/class.resources_hooks.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.resources_hooks.inc.php	(revision 3524)
@@ -0,0 +1,136 @@
+<?php
+/**
+ * eGroupWare - resources
+ * General hook object for resources
+ * It encapsulats all the diffent hook methods
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package resources
+ * @link http://www.egroupware.org
+ * @version $Id: class.resources_hooks.inc.php 19821 2005-11-14 18:16:56Z nelius_weiss $
+ */
+
+/**
+ * General hook object for resources
+ * It encapsulats all the diffent hook methods
+ * @package resources
+ */
+class resources_hooks
+{
+	function admin_prefs_sidebox($args)
+	{
+		$this->acl =& CreateObject('resources.bo_acl');
+		
+		$appname = 'resources';
+		$location = is_array($args) ? $args['location'] : $args;
+		
+		if ($location == 'sidebox_menu')
+		{
+			$title = $GLOBALS['phpgw_info']['apps']['resources']['title'].' '.lang('Menu');
+			$file[] = array(
+					'text' => lang('resources list'),
+					'no_lang' => true,
+					'link' => $GLOBALS['phpgw']->link('/index.php',array('menuaction' => 'resources.ui_resources.index' )),
+// 					'icon' => 
+			);
+			
+			if($this->acl->get_cats(phpgw_ACL_ADD))
+			{
+				$file[] = array(
+					'text' => '<a class="textSidebox" href="'.$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 'resources.ui_resources.edit')).
+						'" onclick="window.open(this.href,\'_blank\',\'dependent=yes,width=800,height=600,scrollbars=yes,status=yes\'); 
+						return false;">'.lang('add resource').'</a>',
+					'no_lang' => true,
+					'link' => false
+				);
+			}
+// 			$file[] = array(
+// 					'text' => lang('planer'),
+// 					'no_lang' => true,
+// 					'link' => $GLOBALS['phpgw']->link('/index.php',array('menuaction' => 'resources.ui_calviews.planer' )),
+// 					'icon' => 
+// 			);
+			display_sidebox($appname,$title,$file);
+		}
+
+/*		if ($GLOBALS['phpgw_info']['user']['apps']['preferences'] && $location != 'admin')
+		{
+			$file = array(
+				'Preferences'     => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname),
+				'Grant Access'    => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
+				'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
+			);
+			if ($location == 'preferences')
+			{
+				display_section($appname,$file);
+			}
+			else
+			{
+				display_sidebox($appname,lang('Preferences'),$file);
+			}
+		}
+*/
+		if ($GLOBALS['phpgw_info']['user']['apps']['admin'] && $location != 'preferences')
+		{
+			$file = Array(
+				'Site configuration' => $GLOBALS['phpgw']->link('/index.php',array(
+					'menuaction' => 'resources.ui_resources.admin' )),
+				'Global Categories'  => $GLOBALS['phpgw']->link('/index.php',array(
+					'menuaction' => 'admin.uicategories.index',
+					'appname'    => $appname,
+					'global_cats'=> true)),
+				'Configure Access Permissions' => $GLOBALS['phpgw']->link('/index.php',
+					'menuaction=resources.ui_acl.acllist'),
+				'Custom Fields'=>$GLOBALS['phpgw']->link('/index.php',
+					'menuaction=admin.customfields.edit&appname=resources'),
+// 				'CSV-Import'         => $GLOBALS['phpgw']->link('/infolog/csv_import.php')
+			);
+			if ($location == 'admin')
+			{
+				display_section($appname,$file);
+			}
+			else
+			{
+				display_sidebox($appname,lang('Admin'),$file);
+			}
+		}
+	}
+	
+	function search_link($args)
+	{
+		return array(
+			'query' => 'resources.bo_resources.link_query',
+			'title' => 'resources.bo_resources.link_title',
+			'view' => array(
+				'menuaction' => 'resources.ui_resources.show'
+			),
+			'view_id' => 'res_id',
+			'view_popup' => '850x600',
+			'add'        => array(
+				'menuaction' => 'resources.ui_resources.edit',
+			),
+			'add_app'    => 'link_app',
+			'add_id'     => 'link_id',	
+			'add_popup'  => '800x600',
+		);
+	}
+
+	function calendar_resources($args)
+	{
+		return array(	
+			'widget' => 'resources_select',// widget to use for the selection of resources
+			'info' => 'resources.bo_resources.get_calendar_info',// info method, returns array with id, type & name for a given id
+			'max_quantity' => 'useable',// if set, key for max. quantity in array returned by info method
+			'new_status' => 'resources.bo_resources.get_calendar_new_status',// method returning the status for new items, else 'U' is used
+			'type' => 'r',// one char type-identifiy for this resources
+			'icon' => 'calicon',//icon 
+			'participants_header' => lang('resources'), // header of participants from this type
+			'cal_sidebox' => array(
+				'menu_title' => lang('Select resources'),
+				'file' => 'resources.ui_resources.get_calendar_sidebox'
+			)
+		);
+	}
+}
+
+?>
Index: /contrib/Resources/inc/class.bo_acl.inc.php
===================================================================
--- /contrib/Resources/inc/class.bo_acl.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.bo_acl.inc.php	(revision 3524)
@@ -0,0 +1,208 @@
+<?php
+/**
+ * eGroupWare - resources
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+ * @package resources
+ * @link http://www.egroupware.org
+ * @version $Id: class.bo_acl.inc.php 22893 2006-12-07 08:12:19Z nelius_weiss $
+ */
+
+/**
+ * ACL business object for resources
+ *
+ * @package resources
+ */
+class bo_acl
+{
+	/**
+	* @var $permissions Holds alls permissions for resources of user 
+	*/
+	var $permissions;
+	
+	var $acl;
+	var $start = 0;
+	var $query = '';
+	var $sort  = '';
+	var $total = 0;
+	var $cats;
+
+	var $debug;
+	var $use_session = False;
+
+	function bo_acl($session=False)
+	{
+		define('phpgw_ACL_CAT_ADMIN',64);
+		define('phpgw_ACL_DIRECT_BOOKING',128);
+		define('phpgw_ACL_CALREAD',256);
+
+		$this->permissions = $GLOBALS['phpgw']->acl->get_all_location_rights($GLOBALS['phpgw_info']['user']['account_id'],'resources',true);
+		$this->phpgw_cats =& CreateObject('phpgwapi.categories','','resources');
+		$this->debug = False;
+		
+		//all this is only needed when called from uiacl.
+		if($session)
+		{
+			$this->read_sessiondata();
+			$this->use_session = True;
+			foreach(array('start','query','sort','order') as $var)
+			{
+				if (isset($_POST[$var]))
+				{
+					$this->$var = $_POST[$var];
+				}
+				elseif (isset($_GET[$var]))
+				{
+					$this->$var = $_GET[$var];
+				}
+			}
+			$this->save_sessiondata();
+			$this->cats = $this->phpgw_cats->return_sorted_array(0,false,'','','',true);
+		}
+	}
+
+	/**
+	* get list of cats where current user has given rights
+	*
+	* @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	* @param int $perm_type one of phpgw_ACL_READ, phpgw_ACL_ADD, phpgw_ACL_EDIT, phpgw_ACL_DELETE, phpgw_ACL_DIRECT_BOOKING
+	* @return array cat_id => cat_name
+	* TODO mark subcats and so on!
+	*/
+	function get_cats($perm_type)
+	{
+		$cats = $this->phpgw_cats->return_sorted_array(0,false,'','','',true);
+		while (list(,$cat) = @each($cats))
+		{
+			if($this->is_permitted($cat['id'],$perm_type))
+			{
+				for ($j=0,$s=''; $j < $cat['level']; $j++)
+				{
+					$s .= '&nbsp;';
+				}
+				$s .= $GLOBALS['phpgw']->strip_html($cat['name']);
+				if ($cat['app_name'] == 'phpgw')
+				{
+					$s .= '&nbsp;&lt;' . lang('Global') . '&gt;';
+				}
+				if ($cat['owner'] == '-1')
+				{
+					$s .= '&nbsp;&lt;' . lang('Global') . '&nbsp;' . lang($cat['app_name']) . '&gt;';
+				}
+				$perm_cats[$cat['id']] = $s;
+			}
+		}
+		return $perm_cats;
+	}
+	
+	
+	/**
+	* gets name of category 
+	*
+	* @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
+	* @param int $cat_id
+	* @return mixed name of category
+	*/
+	function get_cat_name($cat_id)
+	{
+		return $this->phpgw_cats->id2name($cat_id);
+	}
+	
+	/**
+	* gets userid of admin for given category
+	*
+	* @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	* @param int $cat_id
+	* @return int userid of cat admin
+	*/
+	function get_cat_admin($cat_id)
+	{
+		$cat_rights = $this->get_rights($cat_id);
+		foreach ($cat_rights as $userid => $right)
+		{
+			if ($right & phpgw_ACL_CAT_ADMIN)
+			{
+				return $userid;
+			}
+		}
+		return lang('none');
+	}
+	
+	/**
+	* cheks one of the following rights for current user:
+	*
+	* phpgw_ACL_READ, phpgw_ACL_ADD, phpgw_ACL_EDIT, phpgw_ACL_DELETE, phpgw_ACL_DIRECT_BOOKING
+	*
+	* @param int $cat_id
+	* @param int $right
+	* @return bool user is permitted or not for right
+	*/
+	function is_permitted($cat_id,$right)
+	{
+		return $this->permissions['L'.$cat_id] & $right;
+	}
+	
+	/**
+	* gets all rights from all user for given cat
+	*
+	* @param int $cat_id
+	* @return array userid => right
+	*/
+	function get_rights($cat_id)
+	{
+		return $GLOBALS['phpgw']->acl->get_all_rights('L'.$cat_id,'resources');
+	}
+
+
+	// privat functions from here on -------------------------------------------------------------------------
+	function save_sessiondata()
+	{
+		$data = array(
+			'start' => $this->start,
+			'query' => $this->query,
+			'sort'  => $this->sort,
+			'order' => $this->order,
+			'limit' => $this->limit,
+		);
+		if($this->debug) { echo '<br>Read:'; _debug_array($data); }
+		$GLOBALS['phpgw']->session->appsession('session_data','resources_acl',$data);
+	}
+
+	function read_sessiondata()
+	{
+		$data = $GLOBALS['phpgw']->session->appsession('session_data','resources_acl');
+		if($this->debug) { echo '<br>Read:'; _debug_array($data); }
+
+		$this->start  = $data['start'];
+		$this->query  = $data['query'];
+		$this->sort   = $data['sort'];
+		$this->order  = $data['order'];
+		$this->limit = $data['limit'];
+	}
+
+	function set_rights($cat_id,$read,$write,$calread,$calbook,$admin)
+	{
+		$readcat = $read ? $read : array();
+		$writecat = $write ? $write : array();
+		$calreadcat = $calread ? $calread : array();
+		$calbookcat = $calbook ? $calbook : array();
+		$admincat = $admin ? $admin : array();
+
+		$GLOBALS['phpgw']->acl->delete_repository('resources','L' . $cat_id,false);
+
+		foreach($GLOBALS['phpgw']->accounts->get_list() as $num => $account)
+		{
+			$account_id = $account['account_id'];
+			$rights = false;
+			$rights = in_array($account_id,$readcat) ? ($rights | phpgw_ACL_READ) : false;
+			$rights = in_array($account_id,$writecat) ? ($rights | phpgw_ACL_READ | phpgw_ACL_ADD | phpgw_ACL_EDIT | phpgw_ACL_DELETE): $rights;
+			$rights = in_array($account_id,$calreadcat) ? ($rights | phpgw_ACL_CALREAD) : $rights;
+			$rights = in_array($account_id,$calbookcat) ? ($rights | phpgw_ACL_DIRECT_BOOKING | phpgw_ACL_CALREAD) : $rights;
+			$rights = in_array($account_id,$admincat) ? ($rights = 511) : $rights;
+			if ($rights)
+			{
+				$GLOBALS['phpgw']->acl->add_repository('resources','L'.$cat_id,$account_id,$rights);
+			}
+		}
+	}
+}
Index: /contrib/Resources/inc/class.uicustomfields.inc.php
===================================================================
--- /contrib/Resources/inc/class.uicustomfields.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.uicustomfields.inc.php	(revision 3524)
@@ -0,0 +1,235 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare - TimeSheet: Administration of custom fields                  *
+	* http://www.egroupware.org                                                *
+	* Written and (c) by Christoph Mueller Metaways Infosystems GmbH           *
+	* --------------------------------------------                             *
+	*  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.                     *
+	\**************************************************************************/
+
+	/* $Id: class.uicustomfields.inc.php 19761 2005-11-12 13:25:59Z ralfbecker $ */
+
+	/**
+	 * Administration of custom fields
+	 *
+	 * @package timesheet
+	 * @author Christoph Mueller
+	 * @copyright (c) by Ralf Becker <RalfBecker@outdoor-training.de>
+	 * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+	 */
+	 
+	if (!defined('TIMESHEET_APP'))
+	{
+		define('TIMESHEET_APP','timesheet');
+	}	 
+	 
+	 
+	class uicustomfields
+	{
+		var $public_functions = array
+		(
+			'edit' => True
+		);
+
+		/**
+		 * Customfield types, without the link app-names
+		 *
+		 * @var array
+		 */
+		var $cf_types = array(
+			'text'     => 'Text',
+			'label'    => 'Label',
+			'select'   => 'Selectbox',
+			'radio'    => 'Radiobutton',
+			'checkbox' => 'Checkbox',
+		);		
+		
+		var $config;
+		var $bo;
+		var $tmpl;
+		var $fields;
+		
+		
+		function uicustomfields( )
+		{
+			$this->bo =& CreateObject('timesheet.botimesheet');
+			$this->tmpl =& CreateObject('etemplate.etemplate');
+			$this->config = &$this->bo->config;
+			$this->fields = &$this->bo->customfields;
+			
+			$GLOBALS['phpgw']->translation->add_app('etemplate');
+			foreach($this->cf_types as $name => $label) $this->cf_types[$name] = lang($label);
+			
+		}
+
+		/**
+		 * Edit/Create an Timesheet Custom field
+		 *
+		 * @param array $content Content from the eTemplate Exec
+		 */
+		function edit($content=null)
+		{
+		
+			$GLOBALS['phpgw_info']['flags']['app_header'] = lang(TIMESHEET_APP).' - '.lang('Custom fields');
+						
+			if (is_array($content))
+			{
+				//echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
+				list($action) = @each($content['button']);
+				switch($action)
+				{
+					default:
+						if(!$content['fields']['create'] && !$content['fields']['delete']) {
+							break;	
+						}
+					case 'save':
+					case 'apply':
+						$this->update($content);
+						if ($action != 'save')
+						{
+							break;
+						}
+					case 'cancel':
+						$GLOBALS['phpgw']->redirect_link('/timesheet/index.php?menuaction=timesheet.uitimesheet.index');
+						exit;
+				}
+			}
+			$readonlys = array();
+
+			//echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n";
+			$content['fields'] = array();
+			$n = 0;
+			if(is_array($this->fields)) {
+				foreach($this->fields as $name => $data)
+				{
+					if (is_array($data['values']))
+					{
+						$values = '';
+						foreach($data['values'] as $var => $value)
+						{
+							$values .= (!empty($values) ? "\n" : '').$var.'='.$value;
+						}
+						$data['values'] = $values;
+					}
+					$content['fields'][++$n] = $data + array(
+						'typ' => '',
+						'name'   => $name
+					);
+					$preserv_fields[$n]['old_name'] = $name;
+					$readonlys['fields']["create$name"] = True;
+				}
+			}
+
+			//$content['fields'][++$n] = array('typ'=>'','order' => 10 * $n);	// new line for create
+			$content['fields'][++$n] = array('typ' => '', 'label'=>'', 'help'=>'', 'values'=>'', 'len'=>'', 'rows'=>'', 'order'=>10 * $n, 'name'=>'');			
+			
+			$readonlys['fields']["delete[]"] = True;
+
+			//echo '<p>uicustomfields.edit(content = <pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
+			//echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n";
+			$this->tmpl->read('timesheet.customfields');
+			$this->tmpl->exec('timesheet.uicustomfields.edit',$content,array(
+				'type'      => $this->cf_types,			
+			),$readonlys,array('fields' => $preserv_fields));
+		}
+
+		function update_fields(&$content)
+		{				
+			$fields = &$content['fields'];
+			$create = $fields['create'];
+			unset($fields['create']);
+
+			if ($fields['delete'])
+			{
+				list($delete) = each($fields['delete']);
+				unset($fields['delete']);
+			}
+
+			foreach($fields as $field)
+			{
+				$name = trim($field['name']);
+				$old_name = $field['old_name'];
+
+				if (!empty($delete) && $delete == $old_name)
+				{
+					//delete all timesheet extra entries with that certain name
+					$this->bo->delete_extra('',$old_name);
+					unset($this->fields[$old_name]);
+					continue;
+				}
+				if (isset($field['name']) && empty($name) && ($create || !empty($old_name)))	// empty name not allowed
+				{
+					$content['error_msg'] = lang('Name must not be empty !!!');
+				}
+				if (isset($field['old_name']))
+				{
+					if (!empty($name) && $old_name != $name)	// renamed
+					{
+						//update all timesheet_extra entries with that certain name
+						$this->bo->save_extra(True,$old_name,$name);	
+						unset($this->fields[$old_name]);
+					}
+					elseif (empty($name))
+					{
+						$name = $old_name;
+					}
+				}
+				elseif (empty($name))		// new item and empty ==> ignore it
+				{
+					continue;
+				}
+				$values = array();
+				if (!empty($field['values']))
+				{
+					foreach(explode("\n",$field['values']) as $line)
+					{
+						list($var,$value) = split('=',trim($line),2);
+						$var = trim($var);
+						$values[$var] = empty($value) ? $var : $value;
+					}
+				}
+				$this->fields[$name] = array(
+					'type'  => $field['type'],
+					'label' => empty($field['label']) ? $name : $field['label'],
+					'help'  => $field['help'],
+					'values'=> $values,
+					'len'   => $field['len'],
+					'rows'  => intval($field['rows']),
+					'order' => intval($field['order'])
+				);
+			}
+			if (!function_exists('sort_by_order'))
+			{
+				function sort_by_order($arr1,$arr2)
+				{
+					return $arr1['order'] - $arr2['order'];
+				}
+			}
+			uasort($this->fields,sort_by_order);
+
+			$n = 0;
+			foreach($this->fields as $name => $data)
+			{
+				$this->fields[$name]['order'] = ($n += 10);
+			}
+		}
+
+		function update(&$content)
+		{
+			$this->update_fields($content);
+			// save changes to repository
+			$this->save_repository();
+		}
+
+
+		function save_repository()
+		{		
+			// save changes to repository
+
+			//echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
+			$this->config->value('customfields',$this->fields);
+			$this->config->save_repository();
+		}
+	}
Index: /contrib/Resources/inc/class.bocustom_fields.inc.php
===================================================================
--- /contrib/Resources/inc/class.bocustom_fields.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.bocustom_fields.inc.php	(revision 3524)
@@ -0,0 +1,90 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - Calendar - Custom fields and sorting                        *
+  * http://www.egroupware.org                                                *
+  * Written by Ralf Becker <RalfBecker@outdoor-training.de>                  *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class bocustom_fields
+	{
+		var $stock_fields = array(
+			
+			'name'    => 'name',
+			'category'    => 'Category',
+			'location'    => 'location',			
+			'cantidad'    => 'cantidad',
+			'administrador'      => 'administrador',
+			'email'	=>'email',
+			'description' => 'Description'//,
+
+//'enddate2'     => 'End Date2/End Time2'
+		);
+
+		function bocustom_fields()
+		{
+			$this->config = CreateObject('phpgwapi.config','calendar');
+			$this->config->read_repository();
+
+			$this->fields = &$this->config->config_data['fields'];
+
+			if (!is_array($this->fields)) {
+				$this->fields = array();
+			}
+
+			foreach ($this->fields as $field => $data)	// this can be removed after a while
+			{
+				if (!isset($this->stock_fields[$field]) && $field[0] != '#')
+				{
+					unset($this->fields[$field]);
+					$this->fields['#'.$field] = $data;
+				}
+			}
+
+			foreach($this->stock_fields as $field => $data)
+			{
+				if (!is_array($data))
+				{
+					$data = array('label' => $data);
+				}
+				if (!isset($this->fields[$field]))
+				{
+					$this->fields[$field] = array(
+						'name'     => $field,
+						'title'    => $data['title'],
+						'disabled' => $data['disabled']
+					);
+				}
+				$this->fields[$field]['label']  = $data['label'];
+				$this->fields[$field]['length'] = $data['length'];
+				$this->fields[$field]['shown']  = $data['shown'];
+			}
+		}
+
+		function set($data)
+		{
+			if (is_array($data) && strlen($data['name']) > 0)
+			{
+				if (!isset($this->stock_fields[$name = $data['name']]))
+				{
+					$name = '#'.$name;
+				}
+				$this->fields[$name] = $data;
+			}
+		}
+
+		function save($fields=False)
+		{
+			if ($fields)
+			{
+				$this->fields = $fields;
+			}
+			//echo "<pre>"; print_r($this->config->config_data); echo "</pre>\n";
+			$this->config->save_repository();
+		}
+	}
Index: /contrib/Resources/inc/inc.DBAccess.php
===================================================================
--- /contrib/Resources/inc/inc.DBAccess.php	(revision 3524)
+++ /contrib/Resources/inc/inc.DBAccess.php	(revision 3524)
@@ -0,0 +1,70 @@
+<?php
+///////////////////////////////////////////////////////////////////////
+// We dont use ths db class any more, and use the egroupware db      //
+// class instead, rewritten by Shang Wenbin <wbsh@realss.com>        //
+///////////////////////////////////////////////////////////////////////
+
+//include $settings->_ADOdbPath . "adodb.inc.php";
+
+class DatabaseAccess
+{
+	var $db;
+	/**
+	 * just copy the existent class $GLOBALS['phpgw']->db 
+	 */
+	function connect()
+	{
+		copyobj($GLOBALS['phpgw']->db,$this->db);
+	}
+
+	/**
+	 * always return true
+	 */
+	function ensureConnected()
+	{
+		if(!is_object($this->db))
+		{
+			$this->connect();
+		}
+		return true;
+	}
+
+	function getResultArray($queryStr)
+	{
+		$resArr = array();
+
+		$res = $this->db->query($queryStr,__LINE__,__FILE__);
+		$resArr = $res->GetArray();
+		$res->Close();
+		return $resArr;
+	}
+
+	/**
+	 * seems only used for update query
+	 */
+	function getResult($queryStr)
+	{
+		return $this->db->query($queryStr,__LINE__,__FILE__);
+	}
+
+	/**
+	 * get the last insert id
+	 * @param string $table
+	 * @param string $column
+	 * @return int
+	 */
+	function getInsertID($table,$column)
+	{
+		return $this->db->get_last_insert_id($table,$column);
+	}
+
+}
+
+
+$db = new DatabaseAccess();
+$db->connect();
+
+$GLOBALS['mydms']->db = new DatabaseAccess();
+$GLOBALS['mydms']->db->connect();
+
+?>
Index: /contrib/Resources/inc/hook_admin.inc.php
===================================================================
--- /contrib/Resources/inc/hook_admin.inc.php	(revision 3524)
+++ /contrib/Resources/inc/hook_admin.inc.php	(revision 3524)
@@ -0,0 +1,27 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare                                                               *
+	* http://www.egroupware.org                                                *
+	* Written by Joseph Engo <jengo@phpgroupware.org>                          *
+	* --------------------------------------------                             *
+	*  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; either version 2 of the License, or (at your  *
+	*  option) any later version.                                              *
+	\**************************************************************************/
+
+{
+// Only Modify the $file and $title variables.....
+	$title = $appname;
+	$file = Array(
+		'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
+		'Custom fields and sorting' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicustom_fields.index'),
+		'Calendar Holiday Management' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiholiday.admin'),
+		'Import CSV-File' => $GLOBALS['phpgw']->link('/calendar/csv_import.php'),
+		'Global Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname=calendar'),
+		'Grant Access by Group' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uigroup_access.index')
+	);
+//Do not modify below this line
+	display_section($appname,$title,$file);
+}
+?>
Index: /contrib/Resources/inc/class.DBAccess.inc.php
===================================================================
--- /contrib/Resources/inc/class.DBAccess.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.DBAccess.inc.php	(revision 3524)
@@ -0,0 +1,70 @@
+<?php
+///////////////////////////////////////////////////////////////////////
+// We dont use ths db class any more, and use the egroupware db      //
+// class instead, rewritten by Shang Wenbin <wbsh@realss.com>        //
+///////////////////////////////////////////////////////////////////////
+
+//include $settings->_ADOdbPath . "adodb.inc.php";
+
+class DBAccess
+{
+	var $db;
+	/**
+	 * just copy the existent class $GLOBALS['phpgw']->db 
+	 */
+	function connect()
+	{
+		copyobj($GLOBALS['phpgw']->db,$this->db);
+	}
+
+	/**
+	 * always return true
+	 */
+	function ensureConnected()
+	{
+		if(!is_object($this->db))
+		{
+			$this->connect();
+		}
+		return true;
+	}
+
+	function getResultArray($queryStr)
+	{
+		$resArr = array();
+
+		$res = $this->db->query($queryStr,__LINE__,__FILE__);
+		$resArr = $res->GetArray();
+		$res->Close();
+		return $resArr;
+	}
+
+	/**
+	 * seems only used for update query
+	 */
+	function getResult($queryStr)
+	{
+		return $this->db->query($queryStr,__LINE__,__FILE__);
+	}
+
+	/**
+	 * get the last insert id
+	 * @param string $table
+	 * @param string $column
+	 * @return int
+	 */
+	function getInsertID($table,$column)
+	{
+		return $this->db->get_last_insert_id($table,$column);
+	}
+
+}
+
+
+$db = new DBAccess();
+$db->connect();
+
+$GLOBALS['infolog']->db = new DBAccess();
+$GLOBALS['infolog']->db->connect();
+
+?>
Index: /contrib/Resources/inc/class.ui_resources.inc.php
===================================================================
--- /contrib/Resources/inc/class.ui_resources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.ui_resources.inc.php	(revision 3524)
@@ -0,0 +1,562 @@
+<?php
+/**
+ * eGroupWare - resources
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package resources
+ * @link http://www.egroupware.org
+ * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+ * @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
+ * @version $Id: class.ui_resources.inc.php 23852 2007-05-09 16:29:32Z lkneschke $
+ */
+
+/**
+ * General userinterface object for resources
+ *
+ * @package resources
+ */
+class ui_resources
+{
+	var $public_functions = array(
+		'index'		=> True,
+		'edit'		=> True,
+		'show'		=> True,
+		'select'	=> True,
+		'admin'		=> True,
+		'writeLangFile'	=> True
+		);
+
+	/**
+	 * constructor of class ui_resources
+	 *
+	 */
+	function ui_resources()
+	{
+// 		print_r($GLOBALS['phpgw_info']); die();
+		$this->tmpl	=& CreateObject('etemplate.etemplate','resources.show');
+		$this->bo	=& CreateObject('resources.bo_resources');
+		$this->html	=& $GLOBALS['phpgw']->html;
+// 		$this->calui	= CreateObject('resources.ui_calviews');
+		
+		if(!@is_object($GLOBALS['phpgw']->js))
+		{
+			$GLOBALS['phpgw']->js =& CreateObject('phpgwapi.javascript');
+		}
+	}
+
+	/**
+	 * main resources list.
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param array $content content from eTemplate callback
+	 * 
+	 * FIXME don't translate cats in nextmach
+	 */
+	function index($content='')
+	{
+		if (is_array($content))
+		{
+			$sessiondata = $content['nm'];
+			unset($sessiondata['rows']);
+			$GLOBALS['phpgw']->session->appsession('session_data','resources_index_nm',$sessiondata);
+			
+			if (isset($content['back']))
+			{
+				unset($sessiondata['view_accs_of']);
+				$GLOBALS['phpgw']->session->appsession('session_data','resources_index_nm',$sessiondata);
+				return $this->index();
+			}
+			if (isset($content['btn_delete_selected']))
+			{
+				foreach($content['nm']['rows'] as $row)
+				{
+					if($res_id = $row['checkbox'][0])
+					{
+						$msg .= '<p>'. $this->bo->delete($res_id). '</p><br>';
+					}
+				}
+				return $this->index($msg);
+			}
+			
+			foreach($content['nm']['rows'] as $row)
+			{
+				if(isset($row['delete']))
+				{
+					$res_id = array_search('pressed',$row['delete']);
+					return $this->index($this->bo->delete($res_id));
+				}
+				if(isset($row['view_acc']))
+				{
+					$sessiondata['view_accs_of'] = array_search('pressed',$row['view_acc']);
+					$GLOBALS['phpgw']->session->appsession('session_data','resources_index_nm',$sessiondata);
+					return $this->index();
+				}
+			}
+		}
+		$msg = $content;
+		$content = array();
+		$content['msg'] = $msg;
+		
+		$content['nm']['header_left']	= 'resources.resource_select.header';
+		$content['nm']['get_rows'] 	= 'resources.bo_resources.get_rows';
+		$content['nm']['no_filter'] 	= False;
+		$content['nm']['filter_label']	= lang('Category');
+		$content['nm']['filter_help']	= lang('Select a category'); // is this used???
+		$content['nm']['no_filter2']	= true;
+		$content['nm']['filter_no_lang'] = true;
+		$content['nm']['no_cat']	= true;
+		$content['nm']['bottom_too']	= true;
+		$content['nm']['order']		= 'name';
+		$content['nm']['sort']		= 'ASC';
+		
+		$nm_session_data = $GLOBALS['phpgw']->session->appsession('session_data','resources_index_nm');
+		if($nm_session_data)
+		{
+			$content['nm'] = $nm_session_data;
+		}
+		$content['nm']['options-filter']= array(''=>lang('all categories'))+(array)$this->bo->acl->get_cats(phpgw_ACL_READ);
+		
+		// check if user is permitted to add resources
+		if(!$this->bo->acl->get_cats(phpgw_ACL_ADD))
+		{
+			$no_button['add'] = true;
+		}
+		$no_button['back'] = true;
+		$no_button['add_sub'] = true;
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('resources');
+		
+		$GLOBALS['phpgw_info']['flags']['java_script'] .= "<script LANGUAGE=\"JavaScript\">
+			function js_btn_book_selected(form)
+			{
+				resources = '';
+				
+				el = form.getElementsByTagName(\"input\");
+				for (var i = 0; i < el.length; i++)
+				{
+					if(el[i].name.substr(el[i].name.length-12,el[i].name.length) == '[checkbox][]' && el[i].checked)
+					{
+						if(resources.length > 0)
+						{
+							resources += ',';
+						}
+						resources += 'r' + el[i].value;
+					}
+				}
+				if(resources.length == 0)
+				{
+					alert('". lang('No resources selected'). "');
+					return false;
+				}
+				return resources;
+			}
+		</script>";
+
+		if($content['nm']['view_accs_of'])
+		{
+			$master = $this->bo->so->read(array('res_id' => $content['nm']['view_accs_of']));
+			$content['view_accs_of'] = $content['nm']['view_accs_of'];
+			$content['nm']['get_rows'] 	= 'resources.bo_resources.get_rows';
+			$content['nm']['no_filter'] 	= true;
+			$content['nm']['no_filter2'] 	= true;
+			$no_button['back'] = false;
+			$no_button['add'] = true;
+			$no_button['add_sub'] = false;
+			$GLOBALS['phpgw_info']['flags']['app_header'] = lang('resources') . ' - ' . lang('accessories of '). ' '. $master['name'] .
+				($master['short_description'] ? ' [' . $master['short_description'] . ']' : '');
+		}
+		$preserv = $content;
+		$GLOBALS['phpgw']->session->appsession('session_data','resources_index_nm',$content['nm']);
+		$this->tmpl->read('resources.show');
+		return $this->tmpl->exec('resources.ui_resources.index',$content,$sel_options,$no_button,$preserv);
+	}
+
+	/**
+	 * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * invokes add or edit dialog for resources
+	 *
+	 * @param $content   Content from the eTemplate Exec call or id on inital call
+	 */
+	function edit($content=0,$accessory_of = -1)
+	{	
+		if (is_array($content))
+		{
+			if(isset($content['save']) || isset($content['delete']))
+			{
+				if(isset($content['save']))
+				{
+					unset($content['save']);
+// 					if($content['id'] != 0)
+// 					{
+// 						// links are already saved by eTemplate
+// 						unset($resource['link_to']['to_id']);
+// 					}
+					$content['msg'] = $this->bo->save($content);
+				}
+				if(isset($content['delete']))
+				{
+					unset($content['delete']);
+					$content['msg'] = $this->bo->delete($content['res_id']);
+				}
+				
+				if($content['msg'])
+				{
+					return $this->edit($content);
+				}
+				$js = "opener.location.href='".$GLOBALS['phpgw']->link('/index.php',
+					array('menuaction' => 'resources.ui_resources.index'))."';";
+				$js .= 'window.close();';
+				echo "<html><body><script>$js</script></body></html>\n";
+				$GLOBALS['phpgw']->common->phpgw_exit();
+			}
+		}
+		else
+		{
+			$res_id = $content;
+			if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
+			if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of'];
+			$content = array('res_id' => $res_id);
+			
+			if ($res_id > 0)
+			{
+				$content = $this->bo->read($res_id);
+				$content['gen_src_list'] = strpos($content['picture_src'],'.') !== false ? $content['picture_src'] : false;
+				$content['picture_src'] = strpos($content['picture_src'],'.') !== false ? 'gen_src' : $content['picture_src'];
+				$content['link_to'] = array(
+					'to_id' => $res_id,
+					'to_app' => 'resources'
+				);
+			}
+			
+		}
+		// some presetes
+		$content['resource_picture'] = $this->bo->get_picture($content['res_id'],$content['picture_src'],$size=true);
+		$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
+		$content['useable'] = $content['useable'] ? $content['useable'] : 1;
+		$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
+		
+		$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
+		$sel_options['cat_id'] =  $this->bo->acl->get_cats(phpgw_ACL_ADD);
+		$sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : 
+			$content['cat_id'] ? $sel_options['cat_id'] : array('' => lang('select one')) + $sel_options['cat_id'];
+		if($accessory_of > 0 || $content['accessory_of'] > 0)
+		{
+			$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
+			$catofmaster = $this->bo->so->get_value('cat_id',$content['accessory_of']);
+			$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
+		}
+		
+// 		$content['general|page|pictures|links'] = 'resources.edit_tabs.page';  //debug
+		$no_button = array(); // TODO: show delete button only if allowed to delete resource
+		$preserv = $content;
+		$this->tmpl->read('resources.edit');
+		return $this->tmpl->exec('resources.ui_resources.edit',$content,$sel_options,$no_button,$preserv,2);
+		
+	}
+	
+	/**
+	 * adminsection of resources
+	 *
+	 * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 */
+	function admin($content='')
+	{
+		if(is_array($content))
+		{
+			if(isset($content['save']))
+			{
+				$this->bo->conf->read_repository();
+				$this->bo->conf->save_value('dont_use_vfs',$content['dont_use_vfs']);
+			}
+			else
+			{
+				return $GLOBALS['phpgw']->redirect_link('/admin/index.php');
+			}
+		}
+		$content = $this->bo->conf->read_repository();
+		$this->tmpl->read('resources.admin');
+		$this->tmpl->exec('resources.ui_resources.admin',$content,$sel_options,$no_button,$preserv);
+	}
+
+	/**
+	 * showes a single resource
+	 *
+	 * @param int $res_id resource id
+	 * @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
+	 */
+	function show($res_id=0)
+	{
+		if (is_array($content = $res_id))
+		{
+			if(isset($content['btn_delete']))
+			{
+				$content['msg'] = $this->bo->delete($content['res_id']);
+				if($content['msg'])
+				{
+					return $this->show($content);
+				}
+				$js = "opener.location.href='".$GLOBALS['phpgw']->link('/index.php',
+					array('menuaction' => 'resources.ui_resources.index'))."';";
+				$js .= 'window.close();';
+				echo "<html><body><script>$js</script></body></html>\n";
+				$GLOBALS['phpgw']->common->phpgw_exit();
+			}
+			if(isset($content['btn_edit']))
+			{
+				return $this->edit($content['res_id']);
+			}
+			
+		}
+		if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
+
+		$content = array('res_id' => $res_id);
+		$content = $this->bo->read($res_id);
+		$content['gen_src_list'] = strpos($content['picture_src'],'.') !== false ? $content['picture_src'] : false;
+		$content['picture_src'] = strpos($content['picture_src'],'.') !== false ? 'gen_src' : $content['picture_src'];
+		$content['link_to'] = array(
+				'to_id' => $res_id,
+				'to_app' => 'resources'
+		);
+	
+		$content['resource_picture'] = $this->bo->get_picture($content['res_id'],$content['picture_src'],$size=true);
+		$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
+		$content['useable'] = $content['useable'] ? $content['useable'] : 1;
+		
+		$content['quantity'] = ($content['useable'] == $content['quantity']) ? $content['quantity'] : $content['quantity'].' ('.lang('useable').' '.$content['useable'].')';
+		
+		//$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
+				
+		$content['cat_name'] =  $this->bo->acl->get_cat_name($content['cat_id']);
+		$content['cat_admin'] = $this->bo->acl->get_cat_admin($content['cat_id']);
+		
+/*		if($content['accessory_of'] > 0)
+		{
+			$catofmaster = $this->bo->so->get_value('cat_id',$content['accessory_of']);
+			$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
+		} 
+*/
+		$content['description'] = chop($content['long_description']) ? $content['long_description'] : (chop($content['short_description']) ? $content['short_description'] : lang("no description available"));
+		$content['description'] = $content['description'] ? $content['description'] : lang('no description available');
+		$content['link_to'] = array(
+					'to_id' => $res_id,
+					'to_app' => 'resources'
+				);
+		$sel_options = array();
+		$no_button = array(
+			'btn_buy' => !$content['buyable'],
+			'btn_book' => !$content['bookable'],
+			'btn_calendar' => !$content['bookable'],
+			'btn_edit' => !$this->bo->acl->is_permitted($content['cat_id'],phpgw_ACL_EDIT),
+			'btn_delete' => !$this->bo->acl->is_permitted($content['cat_id'],phpgw_ACL_DELETE)
+			);
+		$preserv = $content;
+		$this->tmpl->read('resources.showdetails');
+		return $this->tmpl->exec('resources.ui_resources.show',$content,$sel_options,$no_button,$preserv,2);
+		
+	}
+	
+	/**
+	 * select resources
+	 *
+	 * @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
+	 */
+	function select($content='')
+	{
+		if (!is_object($GLOBALS['phpgw']->js))
+		{
+			$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
+		}
+		$GLOBALS['phpgw']->js->set_onload("copyOptions('exec[resources][selectbox]');");
+		
+		$GLOBALS['phpgw_info']['flags']['java_script'] .= "<script LANGUAGE=\"JavaScript\">
+			window.focus();
+			
+			openerid='resources_selectbox';
+			id='exec[nm][rows][selectbox]';
+		
+			function addOption(label,value,button_id,useable)
+			{
+				quantity = document.getElementById(button_id+'[default_qty]').value;
+				value = value+':'+quantity;
+				if(quantity>useable) {
+					alert('".lang('You chose more resources than available')."');
+					return false;
+				}
+				label = label+'['+quantity+'/'+useable+']';
+				openerSelectBox = opener.document.getElementById(openerid);
+				if (openerSelectBox) {
+					select = '';
+					for(i=0; i < openerSelectBox.length; i++) {
+						with (openerSelectBox.options[i]) {
+							if (selected || openerSelectBox.selectedIndex == i) {
+								select += (value.slice(0,1)==',' ? '' : ',')+value;
+							}
+						}
+					}
+					select += (select ? ',' : '')+value;
+					opener.selectbox_add_option(openerid,label,value,0);
+				}
+				selectBox = document.getElementById(id);
+				if (selectBox) {
+					var resource_value = value.split(':');
+					for (i=0; i < selectBox.length; i++) {
+						var selectvalue = selectBox.options[i].value.split(':');
+						if (selectvalue[0] == resource_value[0]) {
+							selectBox.options[i] = null; 
+							selectBox.options[selectBox.length] = new Option(label,value,false,true);	
+							break;
+						}
+					}
+					if (i >= selectBox.length) {
+						selectBox.options[selectBox.length] = new Option(label,value,false,true);
+					}
+				}
+			}
+		
+			function removeSelectedOptions()
+			{
+				openerSelectBox = opener.document.getElementById(openerid);
+				if (openerSelectBox == null) window.close();
+				selectBox = document.getElementById(id);
+				for (i=0; i < selectBox.length; i++) {
+					if (selectBox.options[i].selected) {
+						for (j=0; j < openerSelectBox.length; j++) {
+							if (openerSelectBox[j].value == selectBox.options[i].value) {
+								openerSelectBox.removeChild(openerSelectBox[j]);
+							}
+						}
+						selectBox.options[i--] = null;
+					}
+				}
+			}
+		
+			function copyOptions()
+			{
+				openerSelectBox = opener.document.getElementById(openerid);
+				selectBox = document.getElementById(id);
+				for (i=0; i < openerSelectBox.length; i++) {
+					with (openerSelectBox.options[i]) {
+						if (selected && value.slice(0,1) != ',') {
+							selectBox.options[selectBox.length] =  new Option(text,value);
+						}
+					}
+				}
+			}
+			
+			function oneLineSubmit()
+			{
+			/*
+				openerSelectBox = opener.document.getElementById(openerid);
+		
+				if (openerSelectBox) {
+					if (openerSelectBox.selectedIndex >= 0) {
+						selected = openerSelectBox.options[openerSelectBox.selectedIndex].value;
+						if (selected.slice(0,1) == ',') selected = selected.slice(1);
+						opener.selectbox_add_option(openerid,'multiple*',selected,1);
+					}
+					else {
+						for (i=0; i < openerSelectBox.length; i++) {
+							with (openerSelectBox.options[i]) {
+								if (selected) {
+									opener.selectbox_add_option(openerid,text,value,1);
+									break;
+								}
+							}
+						}	
+					}
+				}
+			*/
+				window.close();
+			}</script>";
+		
+		$content['nm']['header_left'] = 'resources.resource_select.header';
+		$content['nm']['show_bookable'] = true;
+		$content['nm']['get_rows'] 	= 'resources.bo_resources.get_rows';
+		$content['nm']['no_filter'] 	= False;
+		$content['nm']['filter_label']	= 'Category';
+		$content['nm']['filter_help']	= lang('Select a category'); // is this used???
+		$content['nm']['options-filter']= array(''=>lang('all categories'))+(array)$this->bo->acl->get_cats(phpgw_ACL_READ);
+		$content['nm']['no_filter2']	= true;
+		$content['nm']['filter_no_lang'] = true;
+		$content['nm']['no_cat']	= true;
+		$content['nm']['rows']['js_id'] = 1;
+
+		$sel_options = array();
+		$no_button = array();
+		$this->tmpl->read('resources.resource_select');
+		return $this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
+	}
+	
+	/**
+	 * get_calendar_sidebox
+	 * get data fÃŒr calendar sidebox
+	 *
+	 * @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
+	 * @param array $param with keys menuaction, owner and optional date
+	 * @return array with: label=>link or array with text
+	 */
+	function get_calendar_sidebox($param)
+	{
+		$cats = $this->bo->acl->get_cats(phpgw_ACL_READ);
+		if (!$cats) return array();
+		
+		$owners = explode(',',$param['owner']);
+		unset($param['owner']);
+		$res_cats = $selected = array();
+
+		// this gets the resource-ids of the cats and implodes them to the array-key of the selectbox,
+		// so it is possible to select all resources of a category
+		foreach($cats as $cat_id => $cat_name) 
+		{
+			if ($resources = $this->bo->so->search(array('cat_id' => $cat_id, 'bookable' => '1'),'res_id'))
+			{
+				$keys = array();
+				foreach($resources as $res)
+				{
+					$keys[] = 'r'.$res['res_id'];
+				}
+				$res_cats[implode(',',$keys)] = $cat_name;
+				
+				if (count(array_intersect($keys,$owners)) == count($keys))
+				{
+					$selected[] = implode(',',$keys);
+					$owners = array_diff($owners,$keys);
+				}
+			}
+		}
+		// add already selected single resources to the selectbox, eg. call of the resource-calendar from the resources app
+		$resources = array('r0' => lang('none'));
+		$res_ids = array();
+		foreach($owners as $key => $owner)
+		{
+			if ($owner{0} == 'r')
+			{
+				$res_ids[] = (int) substr($owner,1);
+				$selected[] = $owner;
+			}
+		}
+		if (count($res_ids))
+		{
+			foreach($this->bo->so->search(array('res_id' => $res_ids),'res_id,name') as $data)
+			{
+				$resources['r'.$data['res_id']] = $data['name'];
+			}
+		}		
+		$selectbox = $this->html->select(
+			'owner',
+			$selected,
+			array_merge($resources,$res_cats),
+			$no_lang=true,
+			$options='style="width: 165px;" onchange="load_cal(\''.
+				$GLOBALS['phpgw']->link('/index.php',$param).'\',\'uical_select_resource\');" id="uical_select_resource"',
+			$multiple=count($selected) ? 4 : 0
+		);
+		return array(
+			array(
+				'text' => $selectbox,
+				'no_lang' => True,
+				'link' => False
+			)
+		);
+	}
+}
+
Index: /contrib/Resources/inc/class.uiresources.inc.php
===================================================================
--- /contrib/Resources/inc/class.uiresources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.uiresources.inc.php	(revision 3524)
@@ -0,0 +1,1653 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - resources                                                    *
+  * http://www.eGroupWare.org                                                *
+  * Maintained and further developed by RalfBecker@outdoor-training.de       *
+  * Based on Webresources by Craig Knudsen <cknudsen@radix.net>               *
+  *          http://www.radix.net/~cknudsen                                  *
+  * Originaly modified by Mark Peters <skeeter@phpgroupware.org>             *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class uiresources
+	{
+		var $dbb;
+		var $template;
+		var $cat;
+		var $debug = False;
+		var $cat_id;
+		var $theme;
+		var $link_tpl;
+		var $public_functions = array(
+		'index' => True,		
+		'view' => True,
+		'edit' => True,
+		'update'=> True,				
+		'delete' => True,
+		'close'       => True,
+		'import_mail' => True,
+		'search' => True,
+		'search2' => True,
+		'header' => True,
+		'footer' => True			
+		);
+
+
+	var $prefs;
+	/**
+	 * instance of the bo-class
+	 * 
+	 * @var boresources
+	 */
+	var $bo;
+	/**
+	 * reference to instance of the link-class of bo
+	 * 
+	 * @var bolink
+	 */
+	var $link;
+	/**
+	 * instance of the etemplate class
+	 *
+	 * @var etemplate
+	 */
+	var $tmpl;
+	/**
+	 * reference to the html object of etemplate
+	 *
+	 * @var html
+	 */
+	var $html;
+	/**
+	 * allowed units and hours per day, can be overwritten by the projectmanager configuration, default all units, 8h
+	 * 
+	 * @var string
+	 */
+	var $duration_format = ',';	// comma is necessary!
+	
+	var $icons = array(
+		'type' => array(
+			'task'      => 'task.png',      'task_alt'      => 'Task',
+			'phone'     => 'phone.gpng',     'phone_alt'     => 'Phonecall',
+			'note'      => 'note.png',      'note_alt'      => 'Note',
+			'confirm'   => 'confirm.png',   'confirm_alt'   => 'Confirmation',
+			'reject'    => 'reject.png',    'reject_alt'    => 'Reject',
+			'email'     => 'email.png',     'email_alt'     => 'Email' ),
+		'action' => array(
+			'new'       => 'new.png',       'new_alt'       => 'Add Sub',
+			'view'      => 'view.png',      'view_alt'      => 'View Subs',
+			'parent'    => 'parent.png',    'parent_alt'    => 'View other Subs',
+			'edit'      => 'edit.png',      'edit_alt'      => 'Edit',
+			'addfile'   => 'addfile.png',   'addfile_alt'   => 'Add a file',
+			'delete'    => 'delete.png',    'delete_alt'    => 'Delete',
+			'close'     => 'done.png',      'close_alt'     => 'Close' ),
+		'status' => array(
+			'billed'    => 'billed.png',    'billed_alt'    => 'billed',
+			'done'      => 'done.png',      'done_alt'      => 'done',
+			'will-call' => 'will-call.png', 'will-call_alt' => 'will-call',
+			'call'      => 'call.png',      'call_alt'      => 'call',
+			'ongoing'   => 'ongoing.png',   'ongoing_alt'   => 'ongoing',
+			'offer'     => 'offer.png',     'offer_alt'     => 'offer' )
+	);
+	var $filters = array(
+		'none'                     => 'no Filter',
+		'done'                     => 'done',
+		'responsible'              => 'responsible',
+		'responsible-open-today'   => 'responsible open',
+		'responsible-open-overdue' => 'responsible overdue',
+		'responsible-upcoming'     => 'responsible upcoming',
+		'delegated'                => 'delegated',
+		'delegated-open-today'     => 'delegated open',
+		'delegated-open-overdue'   => 'delegated overdue',
+		'delegated-upcoming'       => 'delegated upcomming',
+		'own'                      => 'own',
+		'own-open-today'           => 'own open',
+		'own-open-overdue'         => 'own overdue',
+		'own-upcoming'             => 'own upcoming',
+		'open-today'               => 'open',
+		'open-overdue'             => 'overdue',
+		'upcoming'                 => 'upcoming',
+	);
+	var $messages = array(
+		'edit'    => 'resources - Edit',
+		'add'     => 'resources - New',
+		'add_sub' => 'resources - New Subproject',
+		'sp'      => '- Subprojects from',
+		're'      => 'Re:'
+	);
+
+
+var $optionldap;
+
+	/**
+	 * Constructor
+	 *
+	 * @return uiresources
+	 */
+
+
+
+		function uiresources()
+		{
+
+
+
+
+			
+ 
+//print_r($GLOBALS);
+
+			$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
+			$this->bo = CreateObject('resources.boresources',1);
+			$this->cat = &$this->bo->cat;
+			//echo "pwnre".$this->bo->owner."  ".$this->bo->today."  ".$this->bo->evento;
+			$this->dbb = CreateObject('class.DBAccess',1);
+			$this->cat = &$this->bo->cat;
+
+
+			$this->resources = &$this->bo->resources;
+
+			$this->project = &$this->bo->project;
+
+$this->tarea = &$this->bo->tarea;
+
+			print_debug('BO Owner',$this->bo->owner);
+
+			$this->template = $GLOBALS['phpgw']->template;
+			$this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('resources');
+
+			$this->cat_id   = $this->bo->cat_id;
+
+			$this->link_tpl = CreateObject('phpgwapi.Template',$this->template_dir);
+			$this->link_tpl->set_unknowns('remove');
+			$this->link_tpl->set_file(
+				Array(
+					'link_picture'	=> 'link_pict.tpl'
+				)
+			);
+			$this->link_tpl->set_block('link_picture','link_pict','link_pict');
+			$this->link_tpl->set_block('link_picture','pict','pict');
+			$this->link_tpl->set_block('link_picture','link_open','link_open');
+			$this->link_tpl->set_block('link_picture','link_close','link_close');
+			$this->link_tpl->set_block('link_picture','link_text','link_text');
+
+
+
+$this->ds = $GLOBALS['phpgw']->common->ldapConnect();
+			if(!$this->ds)
+				$this->ds = $GLOBALS['phpgw']->common->ldapConnect();
+			if(!@is_object($GLOBALS['phpgw']->translation))
+			{
+				$GLOBALS['phpgw']->translation = CreateObject('phpgwapi.translation');
+			}
+			$this->user_context  = $GLOBALS['phpgw_info']['server']['ldap_context'];
+			$this->group_context = $GLOBALS['phpgw_info']['server']['ldap_group_context'];
+		
+/*************************************************/
+
+			$this->always_app_header = $this->bo->prefs['common']['template_set'] == 'idots';
+
+			//print_debug('UI',$this->_debug_sqsof());
+
+			if (!is_object($GLOBALS['phpgw']->html))
+			{
+				$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
+			}
+			$this->html = &$GLOBALS['phpgw']->html;
+		}
+
+		/* Public functions */
+
+		
+
+		function index($params='')
+
+		{
+
+			if (!$params)
+			{
+				foreach(array('date','year','month','day') as $field)
+				{
+					if (isset($_GET[$field]))
+					{
+						$params[$field] = $_REQUEST[$field];
+					}
+				}
+			}
+//$todos = $this->get_todos($todo_label);
+
+			$GLOBALS['phpgw']->redirect($this->page('search',$params));
+			
+		}
+
+
+		
+function page($_page='',$params='')
+		{
+			if($_page == '')
+			{
+				$page_ = explode('.',$this->bo->prefs['resources']['defaultresources']);
+				$_page = $page_[0];
+
+				if ($_page=='planner_cat' || $_page=='planner_user')
+				{
+					$_page = 'month';
+				}
+				elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner'))
+				{
+					$_page = 'month';
+					$GLOBALS['phpgw']->preferences->add('resources','defaultresources','month');
+					$GLOBALS['phpgw']->preferences->save_repository();
+				}
+			}
+			if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' ||
+				strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail'))	// email, felamimail, ...
+			{
+				$page_app = 'resources';
+			}
+			else
+			{
+				$page_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
+			}
+			if (is_array($params))
+			{
+				$params['menuaction'] = $page_app.'.ui'.$page_app.'.'.$_page;
+			}
+			else
+			{
+				$params = 'menuaction='.$page_app.'.ui'.$page_app.'.'.$_page.$params;
+			}
+			return $GLOBALS['phpgw']->link('/index.php',$params);
+		}
+
+
+
+// NDEE: printer-friendly
+function printer_friendly($body,$app_header='')
+		{
+			$_SESSION['resources']['category'] = $this->cat->formated_list('select','all',$this->bo->cat_id,'True');
+$_SESSION['resources']['resources'] = $this->resources->formated_list('select','all',$this->bo->resources_id,'True');
+			if((!isset($GLOBALS['phpgw_info']['server']['deny_user_granres_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_granres_access']) && count($this->bo->grants) > 0)
+				$_SESSION['resources']['cals'] = $this->bo->list_cals();
+
+			
+				unset($GLOBALS['phpgw_info']['flags']['noheader']);
+				unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+				unset($GLOBALS['phpgw_info']['flags']['noappheader']);
+				unset($GLOBALS['phpgw_info']['flags']['noappfooter']);
+				if ($app_header && $this->always_app_header)
+				{
+					$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.$app_header;
+				}
+				
+				$GLOBALS['phpgw']->common->phpgw_header();
+				
+			return $new_body;
+		}
+
+
+
+
+
+function normalizeminutes(&$minutes)
+		{
+			$hour = 0;
+			$min = (int)$minutes;
+			if($min >= 60)
+			{
+				$hour += $min / 60;
+				$min %= 60;
+			}
+			settype($minutes,'integer');
+			$minutes = $min;
+			return $hour;
+		}
+
+		function header()
+		{
+			$cols = 8;
+			if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True)
+			{
+				$cols++;
+			}
+
+			$tpl = $GLOBALS['phpgw']->template;
+			$tpl->set_unknowns('remove');
+
+			if (!file_exists($file = $this->template_dir.'/header.inc.php'))
+			{
+				$file = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/resources/templates/default/header.inc.php';
+			}
+
+			include($file);
+			$refer = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
+			if($refer[2] != 'view') {
+			$header = $tpl->fp('out','head');
+			unset($tpl);
+			echo $header;
+		}
+			unset($tpl);
+		}
+
+		function footer()
+		{
+			$menuaction = $_GET['menuaction'];
+			list(,,$method) = explode('.',$menuaction);
+
+			if (@$this->bo->printer_friendly)
+			{
+				return;
+			}
+
+			$p = $GLOBALS['phpgw']->template;
+
+			$p->set_file(
+				Array(
+					'footer'	=> 'footer.tpl',
+					'form_button'	=> 'form_button_script.tpl'
+				)
+			);
+			$p->set_block('footer','footer_table','footer_table');
+			$p->set_block('footer','footer_row','footer_row');
+			$p->set_block('footer','blank_row','blank_row');
+			$p->set_block('footer','num_dias','num_dias');
+
+			$m = $this->bo->month;
+			$y = $this->bo->year;
+
+			$hoje = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow);
+			$mes_hoje = (int)substr($hoje,4,2);
+			$mes_footer = (int)substr($_POST['date'],4,2);
+			if($_GET['sday'])
+			{
+				if($_GET['month'] == $mes_hoje)
+				{
+					$day = $this->bo->day;
+				} 
+				else
+				{
+					$day = $_GET['sday'];
+				}
+			}
+			else
+			{
+				$day = $this->bo->day;
+				$dia_ini = $day;
+			}
+			if($mes_footer == $mes_hoje)
+			{
+				$dia_ini = (int)substr($hoje,6,2);
+				$day = $dia_ini;
+			}
+			
+			/********************************************************************************************/
+
+		}
+
+		
+
+
+
+
+/****************************************************************************************/
+
+
+function edit($cd=0,$readsess=0)
+		{
+
+			$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+
+
+
+			if(!$this->bo->check_perms(PHPGW_ACL_ADD))
+			{
+				$this->index();
+			}
+			
+			if($readsess)
+			{
+
+				$event = $this->bo->restore_from_appsession;
+				if(!$event['owner'])
+				{
+					$this->bo->add_attribute('owner',$this->bo->owner);
+				}
+				$can_edit = True;
+			}
+			else
+			{
+
+
+				$this->bo->event_init();
+				$this->bo->add_attribute('id',0);
+
+				$can_edit = True;
+				$participants = (string)(get_var('participants',array('GET'),FALSE));
+				$starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['resources']['workdaystarts']));
+				$startmin  = (int)(get_var('minute',array('GET'),0));
+				$endmin    = $startmin + (int)$this->bo->prefs['resources']['defaultlength'];
+				$endhour   = $starthour + $this->bo->normalizeminutes($endmin);
+				
+				$subject	= (string)(get_var('title',array('GET'),0));
+				if ($subject != '0')
+				{
+					$description	= (string)(get_var('description',array('GET'),0));
+					$description1	= (string)(get_var('description1',array('GET'),0));
+					$location	= (string)(get_var('location',array('GET'),0));
+				}
+				else
+					unset($subject);
+				
+				$this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0);
+				$this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0);
+
+
+				if(@$this->bo->prefs['resources']['default_private'])
+				{
+					$this->bo->set_class(False);
+				}
+				else
+				{
+					$this->bo->set_class(True);
+				}
+				
+				$event = $this->bo->restore_from_appsession;
+				
+			}
+if(isset($_REQUEST['error'])){
+$cd=$_REQUEST['error'];
+}
+			$this->edit_form(
+				Array(
+					'event' => $event,
+					'cd' => $cd,
+					'plain' => $_GET['plain']
+				)
+			);
+			$GLOBALS['phpgw']->common->phpgw_footer();
+		}
+
+
+function edit_form($param)
+		{
+
+
+if(isset($_REQUEST['id'])){
+			$event=$this->select($_REQUEST['id']);
+}else{
+$event=$this->select_init();
+}
+
+                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
+
+
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			
+	
+$justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail","telephonenumber","gecos","dn");
+				$sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese);
+		
+
+if(!$sri)
+				return null;
+			$allValues = ldap_get_entries($this->ds, $sri);
+
+
+
+$ttt=count($allValues);
+
+for($i=0;$i<$ttt;$i++){
+
+							if(isset($allValues[$i]['mail'][0]))
+				{
+								$option = '    <option  value="' . $allValues[$i]['uidnumber'][0] . '" >'.$allValues[$i]['gecos'][0].'</option>'."\n";
+								$optionldap .= $option;
+								$option2 = '    <option  value="' . $allValues[$i]['uidnumber'][0] . '" >'.$allValues[$i]['gecos'][0].'</option>'."\n";
+								$optionldap2 .= $option2;
+}
+
+
+
+
+}
+
+
+
+
+
+			if(!is_array($param))
+			{
+				$this->index();
+			}
+			
+			if(isset($param['event']))
+			{
+				$event = $param['event'];
+			}
+			
+			$hourformat = substr($this->bo->users_timeformat,0,1);
+			
+			$jscal = CreateObject('phpgwapi.jscalendar');	// before phpgw_header() !!!
+			
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+			$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding resources');
+			if ($param['plain'] != "True"){
+				$GLOBALS['phpgw']->common->phpgw_header();
+			}
+			else{
+				$GLOBALS['phpgw_info']['theme']['row_on'] = "F8F8F8";
+				$GLOBALS['phpgw_info']['theme']['row_off'] = "F8F8F8";
+			}
+
+			$p = &$GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'edit'		=> 'edit.tpl',
+					'form_button'	=> 'form_button_script.tpl'
+				)
+			);
+			$p->set_block('edit','edit_entry','edit_entry');
+			$p->set_block('edit','list','list');
+			$p->set_block('edit','hr','hr');
+
+			$vars = Array(
+				'font'			=> $this->theme['font'],
+				'bg_color'		=> $this->theme['bg_text'],
+				'action_url'		=> $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'resources.uiresources.update')),
+				'accounres_link'		=> $GLOBALS['phpgw']->link('/index.php','menuaction=resources.uiresources.accounres_popup'),
+				'common_hidden'	=> '<input type="hidden" name="resources[id]" value="'.$event['id'].'">'."\n"
+					. '<input type="hidden" name="resources[owner]" value="'.$event['owner'].'">'."\n"
+					. (@isset($GLOBALS['phpgw_info']['server']['deny_user_granres_access']) && $GLOBALS['phpgw_info']['server']['deny_user_granres_access']?
+					'<input type="hidden" name="participants[]" value="'.$this->bo->owner.'">'."\n":''),
+				'errormsg'		=> ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):'')
+			);
+			
+			$p->set_var($vars);
+
+// res_type
+	//echo $event['type'];		
+
+
+// Display Categories
+			if(strpos($event['category'],','))
+			{
+				$temp_cats = explode(',',$event['category']);
+				@reset($temp_cats);
+				while(list($key,$value) = each($temp_cats))
+				{
+					$check_cats[] = (int)$value;
+				}
+			}
+			elseif($event['category'])
+			{
+				$check_cats[] = (int)$event['category'];
+			}
+			else
+			{
+				$check_cats[] = 0;
+			}
+			$var['category'] = Array(
+				'field'	=> lang('Category'),
+				'data'	=> '<select name="resources[category]" onchange="javascript:updateTitleField(this)" >'.$this->cat->formated_list('select','all',$check_cats,True).'</select>'
+			);
+	
+
+
+
+
+// nombre
+			$var['name'] = Array(
+				'field'	=> lang('name'),
+				'data'	=> '<input type="text" name="resources[name]" maxlength="255" value="'.$event['name'].'">'
+			);
+
+
+// location
+			$var['location'] = Array(
+				'field'	=> lang('location'),
+				'data'	=> '<input type="text" name="resources[location]" maxlength="255" value="'.$event['location'].'">'
+			);
+
+
+//cantidad
+			$var['cantidad'] = Array(
+				'field'	=> lang('quantity'),
+				'data'	=> '<input type="text" name="resources[cantidad]" maxlength="255" value="'.$event['cantidad'].'">'
+			);
+
+
+
+
+// Full Description
+			$var['description'] = Array(
+				'field'	=> lang('Description'),
+				'data'	=> '<textarea name="resources[description]" rows="5" cols="40" wrap="virtual" maxlength="2048">'.$event['descripcion'].'</textarea>'
+			);
+
+
+
+
+//responsable
+			if(!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access'])
+			{
+				
+					
+						$str2 = utf8_decode($optionldap2);
+						
+						$var['administrador'] = array
+						(
+							'field'	=> lang('Responsable'),							
+							'data'	=> "
+									<select id='user_list' name='resources[administrador]' style='width: 220px' ><option value=0>seleccione</option>".$str2."</select>										
+											
+									
+									"
+						);
+									
+						
+						
+						
+						
+				}
+
+//email
+			$var['email'] = Array(
+				'field'	=> lang('email'),
+				'data'	=> '<input type="text" name="resources[email]" maxlength="255" value="'.$event['email'].'">'
+			);
+
+
+$valorfechainicio=$this->bo->time2array($event['fechainicio'],$alarm = 0);
+$start=$valorfechainicio['mday']."/".$valorfechainicio['month']."/".$valorfechainicio['year'];
+			$var['startdate'] = Array(
+				'field'	=> lang('Start Date'),
+
+				'data' => $jscal->input('start[str]',$start)
+			);
+
+
+//			$this->output_template_array($p,'row','list',Array('data' => '<script src="simple_show_hide.js" type="text/javascript"></script>'));
+
+			if (!isset($this->fields))
+			{
+				$this->custom_fields = CreateObject('resources.bocustom_fields');
+				$this->fields = &$this->custom_fields->fields;
+				$this->stock_fields = &$this->custom_fields->stock_fields;
+			}
+		//	$this->output_template_array($p,'row','list',$var['access']);
+			unset($var['access']);
+
+			$preserved = False;
+			foreach($this->fields as $field => $data)
+			{
+
+				if (!$data['disabled'])
+				{
+
+
+					if (isset($var[$field]))
+					{
+
+
+						switch($field)
+						{
+							case 'startdate':
+								$this->output_template_array($p,'row','list',$var['startdate']);
+								$this->output_template_array($p,'row','list',$var['starttime']);
+								break;
+							case 'enddate':
+								$this->output_template_array($p,'row','list',$var['enddate']);
+								$this->output_template_array($p,'row','list',$var['endtime']);
+								break;
+							case 'recure_type':
+								$p->set_var('tr_color',$this->theme['th_bg']);
+								$p->set_var('hr_text','<center id="rpt_label"><b>'.lang('Repeating Event Information').'</b></center>');
+								$p->parse('row','hr',True);
+								$this->output_template_array($p,'row','list',$var['recure_type']);
+								$this->output_template_array($p,'row','list',$var['recure_enddate']);
+								$this->output_template_array($p,'row','list',$var['recure_day']);
+								$this->output_template_array($p,'row','list',$var['recure_interval']);
+								break;
+							default:
+								$this->output_template_array($p,'row','list',$var[$field]);
+
+						}
+					}
+					elseif (!isset($this->stock_fields[$field]))	// Custom field
+					{
+
+
+						$lang = lang($name = substr($field,1));
+						$size = 'SIZE='.($data['shown'] ? $data['shown'] : ($data['length'] ? $data['length'] : 30)).
+							' MAXLENGTH='.($data['length'] ? $data['length'] : 255);
+						$v = array(
+							'field'	=> $lang == $name.'*' ? $name : $lang,
+							'data'	=> '<input name="cal['.htmlspecialchars($field).']" '.$size.' value="'.$event['#'.$name].'">'
+						);
+						if ($data['title'])
+						{
+							$v['tr_color'] = $this->theme['th_bg'];
+						}
+						if (!$data['length'] && $data['title'])
+						{
+							$p->set_var('tr_color',$this->theme['th_bg']);
+							$p->set_var('hr_text','<center><b>'.$v['field'].'</b></center>');
+							$p->parse('row','hr',True);
+						}
+						else
+						{
+							$this->output_template_array($p,'row','list',$v);
+						}
+					}
+				}
+				else	// preserve disabled fields
+				{
+
+
+					switch ($field)
+					{
+						case 'owner':
+							$preserved[$field] = $event['id'] ? $event['participants'][$event['owner']] : 'A';
+							break;
+						case 'recure_type':
+							foreach(array('recur_type','recur_enddate','recur_data','recur_interval') as $field)
+							{
+								$preserved[$field] = $event[$field];
+							}
+							break;
+						case 'startdate':
+						case 'enddate':
+							$field = substr($field,0,-4);
+						default:
+							$preserved[$field] = $event[$field];
+					}
+				}
+			}
+			unset($var);
+			if (is_array($preserved))
+			{
+				//echo "preserving<pre>"; print_r($preserved); echo "</pre>\n";
+				$p->set_var('common_hidden',$p->get_var('common_hidden').'<input type="hidden" name="preserved" value="'.htmlspecialchars(serialize($preserved)).'">'."\n");
+			}
+			$p->set_var('submit_button',lang('Save'));
+
+			$delete_button = $cancel_button = '';
+			if ($event['id'] > 0)
+			{
+				$var = Array(
+					'action_url_button'	=> $this->page('delete','&cal_id='.$event['id']),
+					'action_text_button'	=> lang('Delete'),
+					'action_confirm_button'	=> "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"",
+					'action_extra_field'	=> '',
+					'button_id'	=>	'delete_button'
+				);
+				$p->set_var($var);
+				$delete_button = $p->fp('out','form_button');
+			}
+			$p->set_var('delete_button',$delete_button);
+			$p->set_var('alert_msg',lang('Required field (category) is empty'));
+
+			if ($this->bo->return_to)
+			{
+				$var = Array(
+					'action_url_button'	=> $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to),
+					'action_text_button'	=> lang('Cancel'),
+					'action_confirm_button'	=> '',
+					'action_extra_field'	=> '',
+					'button_id'	=>	'cancel_button'
+				);
+				$p->set_var($var);
+				$cancel_button = $p->fp('out','form_button');
+			}
+			$p->set_var('cancel_button',$cancel_button);
+			$p->pparse('out','edit_entry');
+		}
+
+	function output_template_array(&$p,$row,$list,$var)
+		{
+			if (!isset($var['hidden_vars']))
+			{
+				$var['hidden_vars'] = '';
+			}
+			if (!isset($var['tr_color']))
+			{
+				$var['tr_color'] = $GLOBALS['phpgw']->nextmatchs->alternate_row_color();
+			}
+			$p->set_var($var);
+			$p->parse($row,$list,True);
+		}
+
+
+function get_organizations($context, $selected='', $recursive = false)
+		{
+			$s = CreateObject('phpgwapi.sector_search_ldap');
+						
+			return ($recursive ? 
+				$s->get_organizations($context, $selected, false ,true) :
+				$s->get_sectors($selected, false, false));
+		}	
+	
+
+
+
+/**********************************************/
+
+
+function _debug_sqsof()
+		{
+			$data = array(
+				'filter'     => $this->bo->filter,
+				'cat_id'     => $this->bo->cat_id,
+				'owner'      => $this->bo->owner,
+				'year'       => $this->bo->year,
+				'month'      => $this->bo->month,
+				'day'        => $this->bo->day,
+				'sortby'     => $this->bo->sortby,
+				'num_months' => $this->bo->num_months
+			);
+			Return _debug_array($data,False);
+		}
+
+
+
+
+/***********************************/
+
+
+
+
+function search()
+		{
+
+//print_r($_REQUEST); 
+//echo "kkkkkkkkkkk".$_REQUEST['errormsg'];
+
+
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+			$matches = 0;
+
+		//$event = $this->bo->read_entry($res_id);	
+$event = $this->get_event_ids($adicional);
+
+
+			//$event_ids = $this->bo->search_keywords($_POST['keywords']);
+
+			
+			$matches = count($event);
+
+//echo "matches" . $matches;
+
+			if ($matches == 1)
+			{
+				$quantity = lang('1 match found').'.';
+			}
+			elseif ($matches > 0)
+			{
+				$quantity = lang('%1 matches found',$matches).'.';
+			}
+			else
+			{
+				echo lang('no matches found');
+				return;
+			}
+
+			$p = $GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'search_form'	=> 'search.tpl'
+				)
+			);
+			$p->set_block('search_form','search','search');
+			$p->set_block('search_form','search_list_header','search_list_header');
+			$p->set_block('search_form','search_list','search_list');
+			$p->set_block('search_form','search_list_footer','search_list_footer');
+
+
+$script='';
+
+		
+
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_header',True);
+			}
+
+//if($info){
+			foreach($event  as $id => $data)
+			{
+
+
+				$datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+
+
+				$info = array(
+					'tr_color'	=> $GLOBALS['phpgw']->nextmatchs->alternate_row_color(),
+					'date'		=> $GLOBALS['phpgw']->common->show_date($datetime),
+'id'    => $data['id'],
+					'name'         => $data['name'],
+					'description'         => $data['short_description'],
+					'category'         => $data['cat_name'],
+					'picture_src' => $data['picture_src'],
+					'administrador'=>$data['administrador'],
+					'email'=>$data['email'],
+					'owner'=>$data['owner'],
+
+
+
+'accionmodificar'	=>'index.php?menuaction=resources.uiresources.edit&id='. $data['id'],
+'accionlistar'	=>'index.php?menuaction=resources.uiresources.search2&id='.  $data['name'],
+'accionborrar'	=>'index.php?menuaction=resources.uiresources.delete&id='. $data['id'],
+'accionreservar'	=>'index.php?menuaction=calendar.uicalendar.add&location='. $data['name']
+				);
+
+
+
+//'accionagregar'	=>'index.php?menuaction=resources.uiresources.edit&parent='. $data['id']
+$p->set_var($info);
+				$p->set_var($data);
+				$p->parse('rows','search_list',True);
+			}
+//	}
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_footer',True);
+			}
+
+			$p->pparse('out','search');
+		}
+
+
+function get_event_ids($search)
+		{
+//echo "tamannn".count($search)."  ".$search[0];
+
+$from ="";
+//if (isset($_REQUEST['id'])){
+
+	//		$from = ' and t1.res_id='.$_REQUEST['id'];
+	//		}
+
+			$sql = 'select t1.*,t2.cat_name from   phpgw_resources t1 ,phpgw_categories t2 where t1.cat_id=t2.cat_id '
+					. $from;
+					//.$search;
+					//. 'WHERE (phpgw_cal_user.res_id = phpgw_cal.res_id) '
+					//. $where . $extra;
+
+
+//echo "FULL SQL : ".$sql."<br>\n";
+
+
+			if($this->debug)
+			{
+				echo "FULL SQL : ".$sql."<br>\n";
+			}
+
+ //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar");
+
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+while( $GLOBALS['phpgw']->db->next_record() )
+			{
+			//	
+
+$valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('res_start'),$alarm = 0);
+$ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year'];
+
+$valorfechaend=$this->bo->time2array($GLOBALS['phpgw']->db->f('res_end'),$alarm = 0);
+$end=$valorfechaend['mday']."/".$valorfechaend['month']."/".$valorfechaend['year'];
+
+$valorfechaend2=$this->bo->time2array($GLOBALS['phpgw']->db->f('res_modified'),$alarm = 0);
+$end2=$valorfechaend2['mday']."/".$valorfechaend2['month']."/".$valorfechaend2['year'];
+
+$imagen2="";
+if($GLOBALS['phpgw']->db->f('picture_src')!=""){
+$imagen2="<img src='".$GLOBALS['phpgw_info']['server']['webserver_url']."/resources/templates/default/images/resource_icons/".$GLOBALS['phpgw']->db->f('picture_src')."'>";
+}
+
+
+
+$retval[] =  array(
+
+'id'    => $GLOBALS['phpgw']->db->f('res_id'),
+					'name'         => $GLOBALS['phpgw']->db->f('name'),
+					'description'         => $GLOBALS['phpgw']->db->f('short_description'),
+					'category'         => $GLOBALS['phpgw']->db->f('cat_name'),
+					'picture_src' => $imagen2,
+					'administrador'=>$GLOBALS['phpgw']->db->f('administrador'),
+					'location'=>$GLOBALS['phpgw']->db->f('location'),
+					'email'=>$GLOBALS['phpgw']->db->f('email'),
+					'owner'=>$GLOBALS['phpgw']->db->f('owner')
+
+					
+				);
+
+
+			}
+		
+
+
+			
+			return $retval;
+		}
+
+
+
+
+
+
+
+
+
+
+
+function update()
+		{
+
+
+
+#  $vars = get_defined_vars();  
+#   print_r($vars);
+/*foreach($_POST as $k=>$v){
+$$k=$v;
+echo $$k."<br>";
+} 
+foreach($_POST as $nombre_campo => $valor){
+   $asignacion = "\$" . $nombre_campo . "='" . $valor . "';";
+   echo $asignacion."<br>";
+} */
+
+
+
+
+
+
+
+unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+			$matches = 0;
+
+
+
+
+
+list($dia,$mes,$ano)=split("/",$_POST['start']['str']);
+
+	$starttime = $this->bo->maketime2($_POST['start']['hour'],$_POST['start']['min'],0,$dia,$mes,$ano,$_POST['start']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset;
+//echo $starttime;
+
+list($dia2,$mes2,$ano2)=split("/",$_POST['end']['str']);
+
+	$endtime = $this->bo->maketime2($_POST['end']['hour'],$_POST['end']['min'],0,$dia2,$mes2,$ano2,$_POST['end']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset;
+//echo "gggg".$_POST['end2']['month'];
+if($_POST['end2']['str']['month']>0){
+list($dia3,$mes3,$ano3)=split("/",$_POST['end2']['str']);
+	$endtime2 = $this->bo->maketime2($_POST['end2']['hour'],$_POST['end2']['min'],0,$dia3,$mes3,$ano3,$_POST['end2']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset;
+}else{
+$endtime2=0;
+}
+ 
+			//$starttime = $this->bo->maketime2($starthora,$startmin,0,$startfecha) - $GLOBALS['phpgw']->datetime->tz_offset;
+//echo "kkkk3".$_POST['exec']['accesso'];
+if($_REQUEST['resources']['parent']==""){
+$parent=0;
+
+}else{
+$parent=$_REQUEST['resources']['parent'];
+
+}
+$resources=Array(
+name=>$_POST['resources']['name'],
+descripction=>$_POST['resources']['description']
+);
+$valores="&name=".$_POST['resources']['name']."&description=".$_POST['resources']['description']."&category=".$_POST['resources']['category']."&cantidad=".$_POST['resources']['cantidad']."&email=".$_POST['resources']['email']."&administrador=".$_POST['resources']['administrador']."&location=".$_POST['resources']['location']."";
+
+//$GLOBALS['phpgw']->redirect($this->page($valores,''));
+if($_POST['resources']['name']==""){
+$GLOBALS['phpgw']->redirect($this->page('edit&error=44'.$valores,''));
+}
+if($_POST['resources']['location']==""){
+$GLOBALS['phpgw']->redirect($this->page('edit&error=45'.$valores,''));
+}
+if($_POST['resources']['cantidad']==""){
+$GLOBALS['phpgw']->redirect($this->page('edit&error=46'.$valores,''));
+}
+if($_POST['resources']['email']==""){
+$GLOBALS['phpgw']->redirect($this->page('edit&error=47'.$valores,''));
+}
+if($_POST['resources']['description']==""){
+$GLOBALS['phpgw']->redirect($this->page('edit&error=48'.$valores,''));
+}
+
+/*ExecMethod('resources.uiresources.edit',			Array(
+							'cd'		=> 13,
+							'readsess'	=> 1
+						)
+					);*/
+
+//$parms['errormsg']=$GLOBALS['phpgw']->common->check_code(13);
+//echo $GLOBALS['phpgw']->common->check_code(13);
+//ExecMethod('resources.uiresources.index',$parms);
+//	$GLOBALS['phpgw']->common->phpgw_exit();
+
+		//	$endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+if(isset($_POST['resources']['id'])&&$_POST['resources']['id']>0){
+			$sql = "update  phpgw_resources set  name='".$_POST['resources']['name']."',short_description='".$_POST['resources']['description']."',cat_id=".$_POST['resources']['category'].",quantity=".$_POST['resources']['cantidad'].",location='".$_POST['resources']['location']."',picture_src='".$_POST['resources']['picture_src']."',  administrador='". $this->get_account_name($_POST['resources']['administrador'],'gecos')."',email='".$_POST['resources']['email']."',owner=".$_POST['resources']['owner']."  where res_id='".$_POST['resources']['id']."'";
+}else{
+			$sql = "insert into  phpgw_resources (name,short_description,cat_id,quantity,location,picture_src,  administrador,email,owner) 
+values ('".$_POST['resources']['name']."','".$_POST['resources']['description']."',".$_POST['resources']['category'].",".$_POST['resources']['cantidad'].",'". $this->get_account_name($_POST['resources']['administrador'],'gecos')."','".$_POST['resources']['picture_src']."','".$_POST['resources']['administrador']."','".$_POST['resources']['email']."',".$_POST['resources']['owner'].")";
+
+
+
+  
+}
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);	
+$GLOBALS['phpgw']->redirect($this->page('edit&error=14',''));
+
+
+return "";
+		}
+
+
+
+
+function get_account_name($account_id,$valor)
+		{
+			$acct_type = $this->get_type($account_id);
+
+			/* jakjr: using justthese with ldap_search */
+			//$justthese = array("cn","uid","givenname","sn","gecos");
+
+			/* search the dn for the given uid */
+
+$justthese = array("uidnumber",  "cn",  "mail","gecos","dn");
+			//	$sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese);
+
+			if(($acct_type == 'g') && $this->group_context)
+			{
+				$sri = @ldap_search($this->ds, $this->group_context, '(gidnumber=' . (int)$account_id . ')', $justthese);
+			}
+			else
+			{
+				$sri = @ldap_search($this->ds, $this->user_context, '(uidnumber=' . (int)$account_id . ')', $justthese);
+			}
+
+//echo $this->ds.",". $this->user_context.",". '(uidnumber=' . (int)$account_id . ')'.",". $justthese;
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+$retorna="";
+			if($acct_type =='g')
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+			}
+			else
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+
+
+
+			}
+			return $retorna;
+		}
+
+
+
+
+
+function get_type($account_id)
+		{
+			$allValues = array();
+			/* jakjr: using justthese with ldap_search */
+			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype"));
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+
+			if ($allValues[0]['phpgwaccounttype'][0])
+			{
+				return $allValues[0]['phpgwaccounttype'][0];
+			}
+
+			$allValues = array();
+			/* jakjr: using justthese with ldap_search */
+			$sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))', array("phpgwaccounttype"));
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+
+			if ($allValues[0]['phpgwaccounttype'][0])
+			{
+				return $allValues[0]['phpgwaccounttype'][0];
+			}
+			return False;
+		}
+
+
+
+
+
+
+
+function select($id)
+		{
+
+
+			$sql = "select * from   phpgw_resources where res_id='".$id."'";
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);	
+
+if( $GLOBALS['phpgw']->db->next_record() )
+			{
+
+
+
+
+$retval =  array(
+					'id'    => $GLOBALS['phpgw']->db->f('res_id'),
+					'name'         => $GLOBALS['phpgw']->db->f('name'),
+					'descripcion'         => $GLOBALS['phpgw']->db->f('short_description'),
+					'category'         => $GLOBALS['phpgw']->db->f('cat_id'),
+					'picture_src' => $GLOBALS['phpgw']->db->f('picture_src'),
+					'administrador'=>$GLOBALS['phpgw']->db->f('administrador'),
+					'email'=>$GLOBALS['phpgw']->db->f('email'),
+                                        'location'=>$GLOBALS['phpgw']->db->f('location'),
+					'cantidad'=>$GLOBALS['phpgw']->db->f('quantity'),
+					'owner'=>$GLOBALS['phpgw']->db->f('owner')
+				);
+
+			}
+		
+//echo "iddd".$id."  56666 ".$retval['id'];
+
+
+return $retval;
+		
+		}
+
+
+function select_init()
+		{
+
+$id=0;
+if(isset($_REQUEST['resources[id]'])){
+$id=$_REQUEST['resources[id]'];
+}
+
+$name="";
+if(isset($_REQUEST['name'])){
+$name=$_REQUEST['name'];
+}
+
+
+$description="";
+if(isset($_REQUEST['description'])){
+$description=$_REQUEST['description'];
+}
+
+$catgory=0;
+if(isset($_REQUEST['category'])){
+$category=$_REQUEST['category'];
+}
+$administrador="";
+if(isset($_REQUEST['administrador'])){
+$administrador=$_REQUEST['administrador'];
+}
+$email="";
+if(isset($_REQUEST['email'])){
+$email=$_REQUEST['email'];
+}
+$cantidad=0;
+if(isset($_REQUEST['cantidad'])){
+$cantidad=$_REQUEST['cantidad'];
+}
+
+$location="";
+if(isset($_REQUEST['location'])){
+$location=$_REQUEST['location'];
+}
+			
+$retval =  array(
+
+					'id'    => $id,
+					'name'         => $name,
+					'descripcion'         => $description,
+					'category'         => $category,
+					'picture_src' => 'generic.png',
+					'administrador'=>$administrador,
+					'location'=>$location,
+					'email'=>$email,
+                                        'cantidad'=>$cantidad,
+					'owner'=>$this->bo->owner
+
+
+					
+				);
+
+
+
+
+
+
+			
+
+
+return $retval;
+		
+		}
+
+
+function delete()
+		{
+
+
+
+#  $vars = get_defined_vars();  
+#   print_r($vars);
+/*foreach($_POST as $k=>$v){
+$$k=$v;
+echo $$k."<br>";
+} 
+foreach($_POST as $nombre_campo => $valor){
+   $asignacion = "\$" . $nombre_campo . "='" . $valor . "';";
+   echo $asignacion."<br>";
+} */
+
+
+
+
+unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+			$matches = 0;
+
+
+
+
+		//	$endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+			$sql = "delete from  phpgw_resources   where res_id='".$_GET['id']."'";
+
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);	
+
+$params['errormsg'] = '';
+$GLOBALS['phpgw']->redirect($this->page('search',$params));
+return "";
+		}
+
+
+ function translate($key,$vars=false, $not_found='*' )
+	  {
+    	    if ($this->async)
+	      return $GLOBALS['phpgw']->translation->translate_async($key, $vars);
+	    return lang($key, $vars);
+	  }
+
+function maketime($time)
+		{
+			return mktime(intval($time['hour']),intval($time['min']),intval($time['sec']),intval($time['month']),intval($time['mday']),intval($time['year']));
+		}
+
+function search2()
+		{
+
+//print_r($_REQUEST); 
+
+			$jscal = CreateObject('phpgwapi.jscalendar');	// before phpgw_header() !!!
+
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+
+
+			$matches = 0;
+
+//echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288884600);
+
+//echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288886400);
+if (isset($_REQUEST['fecha'])){
+list($dia,$mes,$ano)=split("/",$_REQUEST['fecha']);
+
+	$starttime = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset;
+///echo $starttime;
+$starttime2 = $this->bo->maketime2(23,59,59,$dia,$mes,$ano,'pm') - $GLOBALS['phpgw']->datetime->tz_offset;
+///echo $starttime2;
+}
+		//$event = $this->bo->read_entry($res_id);	
+$event = $this->get_event_ids2($_REQUEST['id'],$starttime,$starttime2);
+
+
+			//$event_ids = $this->bo->search_keywords($_POST['keywords']);
+
+			
+			$matches = count($event);
+
+//echo "matches" . $matches;
+
+			if ($matches == 1)
+			{
+				$quantity = lang('1 match found').'.';
+			}
+			elseif ($matches > 0)
+			{
+				$quantity = lang('%1 matches found',$matches).'.';
+			}
+			else
+			{
+				echo lang('no matches found');
+				return;
+			}
+
+			$p = $GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'search_form'	=> 'search2.tpl'
+				)
+			);
+			$p->set_block('search_form','search','search');
+			$p->set_block('search_form','search_list_header','search_list_header');
+			$p->set_block('search_form','search_list','search_list');
+			$p->set_block('search_form','search_list_footer','search_list_footer');
+
+
+$script='';
+
+		
+
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_header',True);
+			}
+
+//if($info){
+			foreach($event  as $id => $data)
+			{
+
+
+				$datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+
+
+				$info = array(
+					'tr_color'	=> $GLOBALS['phpgw']->nextmatchs->alternate_row_color(),
+					'date'		=> $GLOBALS['phpgw']->common->show_date($datetime),
+'id'    => $data['id'],
+					'name'         => $data['name'],
+					'description'         => $data['short_description'],
+					'location'         =>$data['namelocation'],
+				
+					'owner'=>$this->get_account_name($data['owner'],'gecos'),
+					'fecha'=>$data['fech'],
+					'priority'=>$data['priority'],
+					'ispublic'=>$data['ispublic'],
+
+'accionmodificar'	=>'index.php?menuaction=resources.uiresources.edit&id='. $data['id'],
+'accionlistar'	=>'index.php?menuaction=resources.uiresources.search2&id='. $data['id'],
+'accionborrar'	=>$data['id'],
+'accionreservar'	=>'index.php?menuaction=calendar.uicalendar.add&location='. $data['id']
+				);
+
+
+
+//'accionagregar'	=>'index.php?menuaction=resources.uiresources.edit&parent='. $data['id']
+$p->set_var($info);
+				$p->set_var($data);
+				$p->parse('rows','search_list',True);
+			}
+//	}
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_footer',True);
+			}
+
+			$p->pparse('out','search');
+		}
+
+
+
+
+function get_event_ids2($idd,$starttime,$starttime2)
+		{
+////echo "tamannn".count($search)."  ".$search[0];
+
+$from ="";
+if (isset($idd)){
+
+			$from = ' and t1.location=\''.$idd.'\' ';
+			}
+
+if (isset($starttime)){
+if (isset($starttime2)){
+
+			$from =$from .' and t1.datetime>=\''.$starttime.'\' and t1.datetime<=\''.$starttime2.'\' ';
+}
+			}
+
+			$sql = 'select t1.cal_id ,t1.owner,t1.groups,t1.datetime,t1.edatetime,
+t1.priority ,t1.cal_type, t1.is_public ,
+t1.title,t1.description,t1.location ,
+t2.list_descripcion as publico,t3.list_descripcion as priority ,t4.name as namelocation from   phpgw_cal  t1, phpgw_listas t2, phpgw_listas t3 ,phpgw_resources t4
+where t1.is_public =t2.list_id and t2.list_name=\'visibility\' 
+and t1.priority=t3.list_id and t3.list_name=\'priority\' 
+and t1.location=t4.name '
+					. $from. "order by t1.datetime desc ";
+					//.$search;
+					//. 'WHERE (phpgw_cal_user.res_id = phpgw_cal.res_id) '
+					//. $where . $extra;
+
+
+
+
+
+			if($this->debug)
+			{
+				echo "FULL SQL : ".$sql."<br>\n";
+			}
+
+ //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar");
+
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+while( $GLOBALS['phpgw']->db->next_record() )
+			{
+			//	
+
+//$valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('datetime'),$alarm = 0);
+//$ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year'];
+$ini=$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('datetime'))."-".$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('edatetime'));
+
+
+
+$retval[] =  array(
+
+'id'    => $GLOBALS['phpgw']->db->f('cat_id'),
+					'name'         => $GLOBALS['phpgw']->db->f('title'),
+					'description'         => $GLOBALS['phpgw']->db->f('description'),					
+					'location'=>$GLOBALS['phpgw']->db->f('namelocation'),
+					'groups'=>$GLOBALS['phpgw']->db->f('groups'),
+					'owner'=>$this->get_account_name($GLOBALS['phpgw']->db->f('owner'),'gecos'),
+					'fecha'=>$ini,
+					'priority'=>$GLOBALS['phpgw']->db->f('priority'),
+					'ispublic'=>$GLOBALS['phpgw']->db->f('publico')
+
+					
+				);
+
+
+			}
+		
+
+
+			
+			return $retval;
+		}
+
+
+
+}
+
+?>
Index: /contrib/Resources/inc/class.bo_resources.inc.php
===================================================================
--- /contrib/Resources/inc/class.bo_resources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.bo_resources.inc.php	(revision 3524)
@@ -0,0 +1,548 @@
+<?php
+/**
+ * eGroupWare - resources
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package resources
+ * @link http://www.egroupware.org
+ * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+ * @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
+ * @version $Id: class.bo_resources.inc.php 24207 2007-06-25 16:44:20Z ralfbecker $
+ */
+
+
+/**
+ * General business object for resources
+ *
+ * @package resources
+ */
+class bo_resources
+{
+	var $vfs_basedir = '/resources/';
+	var $pictures_dir = '/resources/pictures/';
+	var $thumbs_dir = '/resources/pictures/thumbs/';
+	var $resource_icons = '/resources/templates/default/images/resource_icons/';
+	var $debug = 0;
+	/**
+	 * Instance of resources so object
+	 *
+	 * @var so_resources
+	 */
+	var $so;
+	
+	function bo_resources()
+	{
+		$this->so =& CreateObject('resources.so_resources');
+		$this->acl =& CreateObject('resources.bo_acl');
+		$this->cats = $this->acl->phpgw_cats;
+		$this->vfs =& CreateObject('phpgwapi.vfs');
+		$this->link =& CreateObject('phpgwapi.bolink');
+		$this->conf =& CreateObject('phpgwapi.config');
+		$this->conf->read_repository();
+		
+		$this->cal_right_transform = array(	
+			phpgw_ACL_CALREAD 	=> phpgw_ACL_READ,
+			phpgw_ACL_DIRECT_BOOKING 	=> phpgw_ACL_READ | phpgw_ACL_ADD | phpgw_ACL_EDIT | phpgw_ACL_DELETE,
+			phpgw_ACL_CAT_ADMIN 	=> phpgw_ACL_READ | phpgw_ACL_ADD | phpgw_ACL_EDIT | phpgw_ACL_DELETE,
+		);
+	}
+
+	/**
+	 * get rows for resources list
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 */
+	function get_rows($query,&$rows,&$readonlys)
+	{
+		if ($this->debug) _debug_array($query);
+		$query['search'] = $query['search'] ? $query['search'] : '*';
+		$criteria = array('name' => $query['search'], 'short_description' => $query['search'], 'inventory_number' => $query['search']);
+		$read_onlys = 'res_id,name,short_description,quantity,useable,bookable,buyable,cat_id,location,storage_info';
+		
+		$accessory_of = $query['view_accs_of'] ? $query['view_accs_of'] : -1;
+ 		$filter = array('accessory_of' => $accessory_of);
+		if ($query['filter'])
+		{
+			$filter = $filter + array('cat_id' => $query['filter']);
+		}
+		else
+		{
+			$readcats = array_flip((array)$this->acl->get_cats(phpgw_ACL_READ));
+			if($readcats) $filter = $filter + array('cat_id' => $readcats);
+		}
+		if($query['show_bookable']) $filter = $filter + array('bookable' => true);
+		$order_by = $query['order'] ? $query['order'].' '. $query['sort'] : '';
+		$start = (int)$query['start'];
+		
+		$rows = $this->so->search($criteria,$read_onlys,$order_by,'','%',$empty=False,$op='OR',$start,$filter,$join='',$need_full_no_count=false);
+		$nr = $this->so->total;
+		
+		// we are called to serve bookable resources (e.g. calendar-dialog)
+		if($query['show_bookable'])
+		{
+			// This is somehow ugly, i know...
+			foreach((array)$rows as $num => $resource)
+			{
+				$rows[$num]['default_qty'] = 1;
+			}
+			// we don't need all the following testing
+			return $nr;
+		}
+		
+		foreach((array)$rows as $num => $resource)
+		{
+			if (!$this->acl->is_permitted($resource['cat_id'],phpgw_ACL_EDIT))
+			{
+				$readonlys["edit[$resource[res_id]]"] = true;
+			}
+			if (!$this->acl->is_permitted($resource['cat_id'],phpgw_ACL_DELETE))
+			{
+				$readonlys["delete[$resource[res_id]]"] = true;
+			}
+			if ((!$this->acl->is_permitted($resource['cat_id'],phpgw_ACL_ADD)) || $accessory_of != -1)
+			{
+				$readonlys["new_acc[$resource[res_id]]"] = true;
+			}
+			if (!$resource['bookable'])
+			{
+				$readonlys["bookable[$resource[res_id]]"] = true;
+				$readonlys["calendar[$resource[res_id]]"] = true;
+			}
+			if(!$this->acl->is_permitted($resource['cat_id'],phpgw_ACL_CALREAD))
+			{
+				$readonlys["calendar[$resource[res_id]]"] = true;
+			}
+			if (!$resource['buyable'])
+			{
+				$readonlys["buyable[$resource[res_id]]"] = true;
+			}
+			$readonlys["view_acc[$resource[res_id]]"] = true;
+			$links = $this->link->get_links('resources',$resource['res_id']);
+			if(count($links) != 0 && $accessory_of == -1)
+			{
+				foreach ($links as $link_num => $link)
+				{
+					if($link['app'] == 'resources')
+					{
+						if($this->so->get_value('accessory_of',$link['res_id']) != -1)
+						{
+							$readonlys["view_acc[$resource[res_id]]"] = false;
+						}
+					}
+				}
+			}
+			$rows[$num]['picture_thumb'] = $this->get_picture($resource['res_id']);
+			$rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']);
+		}
+		return $nr;
+	}
+
+	/**
+	 * reads a resource exept binary datas
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param int $res_id resource id
+	 * @return array with key => value or false if not found or allowed
+	 */
+	function read($res_id)
+	{
+		if(!$this->acl->is_permitted($this->so->get_value('cat_id',$res_id),phpgw_ACL_READ))
+		{
+			echo lang('You are not permitted to get information about this resource!') . '<br>';
+			echo lang('Notify your administrator to correct this situation') . '<br>';
+			return false;
+		}
+		return $this->so->read(array('res_id' => $res_id));
+	}
+	
+	/**
+	 * saves a resource. pictures are saved in vfs
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param array $resource array with key => value of all needed datas
+	 * @return string msg if somthing went wrong; nothing if all right
+	 */
+	function save($resource)
+	{
+		if(!$this->acl->is_permitted($resource['cat_id'],phpgw_ACL_EDIT))
+		{
+			return lang('You are not permitted to edit this reource!');
+		}
+		
+		// we need an id to save pictures and make links...
+		if(!$resource['res_id'])
+		{
+			$resource['res_id'] = $this->so->save($resource);
+		}
+
+		switch ($resource['picture_src'])
+		{
+			case 'own_src':
+				$vfs_data = array('string' => $this->pictures_dir.$resource['res_id'].'.jpg','relatives' => array(RELATIVE_ROOT));
+				if($resource['own_file']['size'] > 0)
+				{
+					$msg = $this->save_picture($resource['own_file'],$resource['res_id']);
+					break;
+				}
+				elseif($this->vfs->file_exists($vfs_data))
+				{
+					break;
+				}
+				$resource['picture_src'] = 'cat_src';
+			case 'cat_src':
+				break;
+			case 'gen_src':
+				$resource['picture_src'] = $resource['gen_src_list'];
+				break;
+			default:
+				if($resource['own_file']['size'] > 0)
+				{
+					$resource['picture_src'] = 'own_src';
+					$msg = $this->save_picture($resource['own_file'],$resource['res_id']);
+				}
+				else
+				{
+					$resource['picture_src'] = 'cat_src';
+				}
+		}
+		// somthing went wrong on saving own picture
+		if($msg)
+		{
+			return $msg;
+		}
+		
+		// delete old pictures
+		if($resource['picture_src'] != 'own_src')
+		{
+			$this->remove_picture($resource['res_id']);
+		}
+
+		// save links
+		if(is_array($resource['link_to']['to_id']))
+		{
+			$this->link->link('resources',$resource['res_id'],$resource['link_to']['to_id']);
+		}
+		if($resource['accessory_of'] != -1)
+		{
+			$this->link->link('resources',$resource['res_id'],'resources',$resource['accessory_of']);
+		}
+		
+		if(!empty($resource['res_id']) && $this->so->get_value("cat_id",$resource['res_id']) != $resource['cat_id'] && $resource['accessory_of'] == -1)
+		{
+			$accessories = $this->get_acc_list($resource['res_id']);
+			foreach($accessories as $accessory => $name)
+			{
+				$acc = $this->so->read($accessory);
+				$acc['cat_id'] = $resource['cat_id'];
+				$this->so->data = $acc;
+				$this->so->save();
+			}
+		}
+		
+		return $this->so->save($resource) ? false : lang('Something went wrong by saving resource');
+	}
+
+	/**
+	 * deletes resource including pictures and links
+	 *
+	 * @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
+	 * @param int $res_id id of resource
+	 */
+	function delete($res_id)
+	{
+		if(!$this->acl->is_permitted($this->so->get_value('cat_id',$res_id),phpgw_ACL_DELETE))
+		{
+			return lang('You are not permitted to delete this reource!');
+		}
+		
+		if ($this->so->delete(array('res_id'=>$res_id)))
+		{
+			$this->remove_picture($res_id);
+	 		$this->link->unlink(0,'resources',$res_id);
+	 		// delete the resource from the calendar
+	 		ExecMethod('calendar.socal.change_delete_user','r'.$res_id);
+	 		return false;
+		}
+		return lang('Something went wrong by deleting resource');
+	}
+	
+	/**
+	 * gets list of accessories for resource
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param int $res_id id of resource
+	 * @return array
+	 */
+	function get_acc_list($res_id)
+	{
+		if($res_id < 1){return;}
+		$data = $this->so->search('','res_id,name','','','','','',$start,array('accessory_of' => $res_id),'',$need_full_no_count=true);
+		foreach($data as $num => $resource)
+		{
+			$acc_list[$resource['res_id']] = $resource['name'];
+		}
+		return $acc_list;
+	}
+	
+	/**
+	 * returns info about resource for calender
+	 * @author Cornelius Weiss<phpgw@von-und-zu-weiss.de>
+	 * @param int/array $res_id single id or array $num => $res_id
+	 * @return array 
+	 */
+	function get_calendar_info($res_id)
+	{
+		//echo "<p>bo_resources::get_calendar_info(".print_r($res_id,true).")</p>\n";
+		if(!is_array($res_id) && $res_id < 1) return;
+
+		$data = $this->so->search(array('res_id' => $res_id),'res_id,cat_id,name,useable');
+		
+		foreach($data as $num => $resource)
+		{
+			$data[$num]['rights'] = false;
+			foreach($this->cal_right_transform as $res_right => $cal_right)
+			{
+				if($this->acl->is_permitted($resource['cat_id'],$res_right))
+				{
+					$data[$num]['rights'] = $cal_right;
+				}
+			}
+			$data[$num]['responsible'] = $this->acl->get_cat_admin($resource['cat_id']);
+		}
+		return $data;
+	}
+	
+	/**
+	 * returns status for a new calendar entry depending on resources ACL
+	 * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param int $res_id single id
+	 * @return array 
+	 */
+	function get_calendar_new_status($res_id)
+	{
+		$data = $this->so->search(array('res_id' => $res_id),'res_id,cat_id,bookable');
+		if($data[0]['bookable'] == 0) return 'x';
+		return $this->acl->is_permitted($data[0]['cat_id'],phpgw_ACL_DIRECT_BOOKING) ? A : U;
+	}
+	
+	/**
+	 * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * query infolog for entries matching $pattern
+	 *
+	 */
+	function link_query( $pattern )
+	{
+		$criteria = array('name' => $pattern, 'short_description' => $pattern);
+		$only_keys = 'res_id,name,short_description';
+		$filter = array(
+			'cat_id' => array_flip((array)$this->acl->get_cats(phpgw_ACL_READ)),
+			//'accessory_of' => '-1'
+		);
+		$data = $this->so->search($criteria,$only_keys,$order_by='',$extra_cols='',$wildcard='%',$empty,$op='OR',false,$filter);
+		foreach($data as $num => $resource)
+		{
+			$list[$resource['res_id']] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
+		}
+		return $list;
+	}
+		
+	/**
+	 * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * get title for an infolog entry identified by $res_id
+	 *
+	 * @return string/boolean string with title, null if resource does not exist or false if no perms to view it
+	 */
+	function link_title( $resource )
+	{
+		if (!is_array($resource))
+		{
+			if (!($resource  = $this->so->read(array('res_id' => $resource)))) return null;
+		}
+		if(!$this->acl->is_permitted($resource['cat_id'],phpgw_ACL_READ)) return false;
+
+		return $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
+	}
+	
+	/**
+	 * resizes and saves an pictures in vfs
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param array $file array with key => value
+	 * @param int $resource_id
+	 * @return mixed string with msg if somthing went wrong; nothing if all right
+	 * TODO make thumb an picture sizes choosable by preferences
+	 */	
+	function save_picture($file,$resouce_id)
+	{
+		// test upload dir
+		$vfs_data = array('string'=>$this->vfs_basedir,'relatives'=>array(RELATIVE_ROOT));
+		if (!($this->vfs->file_exists($vfs_data)))
+		{
+			$this->vfs->override_acl = 1;
+			$this->vfs->mkdir($vfs_data);
+			$vfs_data['string'] = $this->pictures_dir;
+			$this->vfs->mkdir($vfs_data);
+			$vfs_data['string'] = $this->thumbs_dir;
+			$this->vfs->mkdir($vfs_data);
+			$this->vfs->override_acl = 0;
+		}
+		
+		switch($file['type'])
+		{
+			case 'image/gif':
+				$src_img = imagecreatefromgif($file['tmp_name']);
+				break;
+			case 'image/jpeg':
+			case 'image/pjpeg':
+				$src_img = imagecreatefromjpeg($file['tmp_name']);
+				break;
+			case 'image/png':
+			case 'image/x-png':
+				$src_img = imagecreatefrompng($file['tmp_name']);
+				break;
+			default:
+				return lang('Picture type is not supported, sorry!');
+		}
+		
+		$src_img_size = getimagesize($file['tmp_name']);
+		$dst_img_size = array( 0 => 320, 1 => 240);
+		$thumb_size = array( 0 => 64, 1 => 48);
+		
+		$tmp_dir = $GLOBALS['phpgw_info']['server']['temp_dir'].'/';
+		if($src_img_size[0] > 64 || $src_img_size[1] > 48)
+		{
+			$f = $thumb_size[0] / $src_img_size[0];
+			$f = $thumb_size[1] / $src_img_size[1] < $f ? $thumb_size[1] / $src_img_size[1] : $f;
+			$dst_img = imagecreatetruecolor($src_img_size[0] * $f, $src_img_size[1] * $f);
+			imagecopyresized($dst_img,$src_img,0,0,0,0,$src_img_size[0] * $f,$src_img_size[1] * $f,$src_img_size[0],$src_img_size[1]);
+			imagejpeg($dst_img,$tmp_dir.$resouce_id.'.thumb.jpg');
+			if($src_img_size[0] > $dst_img_size[0] || $src_img_size[1] > $dst_img_size[1])
+			{
+				$f = $dst_img_size[0] / $src_img_size[0];
+				$f = $dst_img_size[1] / $src_img_size[1] < $f ? $dst_img_size[1] / $src_img_size[1] : $f;
+				$dst_img = imagecreatetruecolor($src_img_size[0] * $f, $src_img_size[1] * $f);
+				imagecopyresized($dst_img,$src_img,0,0,0,0,$src_img_size[0] * $f,$src_img_size[1] * $f,$src_img_size[0],$src_img_size[1]);
+				imagejpeg($dst_img,$tmp_dir.$resouce_id.'.jpg');
+			}
+			else
+			{
+				imagejpeg($src_img,$tmp_dir.$resouce_id.'.jpg');
+			}
+			imagedestroy($dst_img);
+		}
+		else
+		{
+				imagejpeg($src_img,$tmp_dir.$resouce_id.'.jpg');
+				imagejpeg($src_img,$tmp_dir.$resouce_id.'.thumb.jpg');
+		}
+		imagedestroy($src_img);
+			
+		$this->vfs->override_acl = 1;
+		$this->vfs->cp(array(
+			'from' => $tmp_dir.$resouce_id.'.jpg',
+			'to'   => $this->pictures_dir.$resouce_id.'.jpg',
+			'relatives' => array(RELATIVE_NONE|VFS_REAL,RELATIVE_ROOT)
+		));
+		$this->vfs->set_attributes(array(
+			'string' => $this->pictures_dir.$resouce_id.'.jpg',
+			'relatives' => array (RELATIVE_ROOT),
+			'attributes' => array (
+				'mime_type' => 'image/jpeg',
+				'comment' => 'picture of resource no.'.$resouce_id,
+				'app' => $GLOBALS['phpgw_info']['flags']['currentapp']
+		)));
+		$this->vfs->cp(array(
+			'from' => $tmp_dir.$resouce_id.'.thumb.jpg',
+			'to'   => $this->thumbs_dir.$resouce_id.'.jpg',
+			'relatives' => array(RELATIVE_NONE|VFS_REAL,RELATIVE_ROOT)
+			));
+		$this->vfs->set_attributes(array(
+			'string' => $this->thumbs_dir.$resouce_id.'.jpg',
+			'relatives' => array (RELATIVE_ROOT),
+			'attributes' => array (
+				'mime_type' => 'image/jpeg',
+				'comment' => 'thumbnail of resource no.'.$resouce_id,
+				'app' => $GLOBALS['phpgw_info']['flags']['currentapp']
+		)));
+		$this->vfs->override_acl = 0;
+		return;
+	}
+	
+	/**
+	 * get resource picture either from vfs or from symlink
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param int $res_id id of resource
+	 * @param bool $size false = thumb, true = full pic
+	 * @return string url of picture
+	 */
+	function get_picture($res_id=0,$size=false)
+	{
+		if ($res_id > 0)
+		{
+			$src = $this->so->get_value('picture_src',$res_id);
+		}
+		switch($src)
+		{
+			case 'own_src':
+				$picture = $this->conf->config_data['dont_use_vfs'] ? $GLOBALS['phpgw_info']['server']['webserver_url'] : 'vfs:';
+				$picture .= $size ? $this->pictures_dir.$res_id.'.jpg' : $this->thumbs_dir.$res_id.'.jpg';
+				break;
+			case 'cat_src':
+				list($picture) = $this->cats->return_single($this->so->get_value('cat_id',$res_id));
+				$picture = unserialize($picture['data']);
+				if($picture['icon'])
+				{
+					$picture = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/images/'.$picture['icon'];
+					break;
+				}
+			case 'gen_src':
+			default :
+				$picture = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->resource_icons;
+				$picture .= strpos($src,'.') !== false ? $src : 'generic.png';
+		}
+		return $picture;
+	}
+	
+	/**
+	 * remove_picture
+	 * removes picture from vfs
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @param int $res_id id of resource
+	 * @return bool succsess or not
+	 */
+	function remove_picture($res_id)
+	{
+		$vfs_data = array('string' => $this->pictures_dir.$res_id.'.jpg','relatives' => array(RELATIVE_ROOT));
+		$this->vfs->override_acl = 1;
+		if($this->vfs->file_exists($vfs_data))
+		{
+			$this->vfs->rm($vfs_data);
+			$vfs_data['string'] = $this->thumbs_dir.$res_id.'.jpg';
+			$this->vfs->rm($vfs_data);
+		}
+		$this->vfs->override_acl = 0;
+	}
+
+	/**
+	 * get_genpicturelist
+	 * gets all pictures from 'generic picutres dir' in selectbox style for eTemplate
+	 *
+	 * Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+	 * @return array directory contens in eTemplates selectbox style
+	 */
+	function get_genpicturelist()
+	{
+		$icons['generic.png'] = lang('gernal resource');
+		$dir = dir(phpgw_SERVER_ROOT.$this->resource_icons);
+		while($file = $dir->read())
+		{
+			if (preg_match('/\\.(png|gif|jpe?g)$/i',$file) && $file != 'generic.png')
+			{
+				$icons[$file] = substr($file,0,strpos($file,'.'));
+			}
+		}
+		$dir->close();
+		return $icons;
+	}
+}
Index: /contrib/Resources/inc/class.boresources.inc.php
===================================================================
--- /contrib/Resources/inc/class.boresources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.boresources.inc.php	(revision 3524)
@@ -0,0 +1,4482 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - resources                                                    *
+  * http://www.eGroupWare.org                                                *
+  * Maintained and further developed by RalfBecker@outdoor-training.de       *
+  * Based on Webresources by Craig Knudsen <cknudsen@radix.net>               *
+  *          http://www.radix.net/~cknudsen                                  *
+  * Originaly modified by Mark Peters <skeeter@phpgroupware.org>             *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class boresources
+	{
+
+var $db;
+	/**
+	 * resourcess config data
+	 * 
+	 * @var array
+	 */
+	var $config = array();
+
+
+	/**
+	 * resourcess config data
+	 *
+	 * @var array
+	 */
+	var $config_data = array();
+	/**
+	 * Should we show a quantity sum, makes only sense if we sum up identical units (can be used to sum up negative (over-)time)
+	 *
+	 * @var boolean
+	 */
+	var $quantity_sum=false;
+	/**
+	 * Timestaps that need to be adjusted to user-time on reading or saving
+	 * 
+	 * @var array
+	 */
+	var $timestamps = array(
+		'ts_start','ts_modified'
+	);
+	/**
+	 * Offset in secconds between user and server-time,	it need to be add to a server-time to get the user-time 
+	 * or substracted from a user-time to get the server-time
+	 * 
+	 * @var int
+	 */
+	var $tz_offset_s;
+	/**
+	 * Current time as timestamp in user-time
+	 * 
+	 * @var int
+	 */
+	var $now;
+	/**
+	 * Start of today in user-time
+	 * 
+	 * @var int
+	 */
+	var $today;
+	/**
+	 * Filter for search limiting the date-range
+	 * 
+	 * @var array
+	 */
+	var $date_filters = array(	// Start: year,month,day,week, End: year,month,day,week
+		'Today'       => array(0,0,0,0,  0,0,1,0),
+		'Yesterday'   => array(0,0,-1,0, 0,0,0,0),
+		'This week'   => array(0,0,0,0,  0,0,0,1),
+		'Last week'   => array(0,0,0,-1, 0,0,0,0),
+		'This month'  => array(0,0,0,0,  0,1,0,0),
+		'Last month'  => array(0,-1,0,0, 0,0,0,0),
+		'2 month ago' => array(0,-2,0,0, 0,-1,0,0),
+		'This year'   => array(0,0,0,0,  1,0,0,0),
+		'Last year'   => array(-1,0,0,0, 0,0,0,0),
+		'2 years ago' => array(-2,0,0,0, -1,0,0,0),
+		'3 years ago' => array(-3,0,0,0, -2,0,0,0),
+	);
+	/**
+	 * Reference to the (bo)link class instanciated at $GLOBALS['phpgw']->link
+	 * 
+	 * @var bolink
+	 */
+	var $link;
+	/**
+	 * Grants: $GLOBALS['phpgw']->acl->get_grants(resources_APP);
+	 * 
+	 * @var array
+	 */	
+	var $grants;
+	/**
+	 * Sums of the last search in keys duration and price
+	 * 
+	 * @var array
+	 */
+	var $summary;
+	/**
+	 * Array with boolean values in keys 'day', 'week' or 'month', for the sums to return in the search
+	 * 
+	 * @var array
+	 */
+	var $show_sums;
+
+	var $customfields=array();
+
+		function boresources($session=0)
+		{
+
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+
+			$this->cat = CreateObject('phpgwapi.categories');
+
+$this->resources = CreateObject('phpgwapi.resources');
+
+$this->tarea = CreateObject('phpgwapi.project');
+
+$this->project = CreateObject('phpgwapi.project');
+
+
+
+
+$this->config_data =& $this->config->config_data;
+		
+
+
+if (isset($this->config_data['customfields']) && is_array($this->config_data['customfields']))
+		{
+			$this->customfields = $this->config_data['customfields'];
+		}
+
+		if (!is_object($GLOBALS['phpgw']->datetime))
+		{
+			$GLOBALS['phpgw']->datetime =& CreateObject('phpgwapi.datetime');
+		}
+		$this->tz_offset_s = $GLOBALS['phpgw']->datetime->tz_offset;
+		$this->now = time() + $this->tz_offset_s;	// time() is server-time and we need a user-time
+		$this->today = mktime(0,0,0,date('m',$this->now),date('d',$this->now),date('Y',$this->now));
+
+	
+
+
+			$this->grants = $GLOBALS['phpgw']->acl->get_grants('resources');
+			@reset($this->grants);
+			if(DEBUG_APP)
+			{
+				if(floor(phpversion()) >= 4)
+				{
+					$this->debug_string = '';
+					ob_start();
+				}
+
+				foreach($this->grants as $grantor => $rights)
+				{
+					print_debug('Grantor',$grantor);
+					print_debug('Rights',$rights);
+				}
+			}
+
+			print_debug('Read use_session',$session);
+
+			if($session)
+			{
+				$this->read_sessiondata();
+				$this->use_session = True;
+			}
+			print_debug('BO Filter',$this->filter);
+			print_debug('Owner',$this->owner);
+
+			if ($GLOBALS['argv']) {
+			  $this->async = true;
+			  $this->load_lang();
+			}
+
+			$this->prefs['resources']    = $GLOBALS['phpgw_info']['user']['preferences']['resources'];
+			$this->check_set_default_prefs();
+
+			$owner = get_var('owner',array('GET','POST'),$GLOBALS['owner']);
+
+			ereg('menuaction=([a-zA-Z.]+)',$_SERVER['HTTP_REFERER'],$regs);
+			$from = $regs[1];
+			if ((substr($_SERVER['PHP_SELF'],-8) == 'home.php' && substr($this->prefs['resources']['defaultresources'],0,7) == 'planner'
+				|| $_GET['menuaction'] == 'resources.uiresources.planner' &&
+				$from  != 'resources.uiresources.planner' && !$this->save_owner)
+				&& (int)$this->prefs['resources']['planner_start_with_group'] > 0)
+			{
+				// entering planner for the first time ==> saving owner in save_owner, setting owner to default
+				//
+				$this->save_owner = $this->owner;
+				$owner = 'g_'.$this->prefs['resources']['planner_start_with_group'];
+			}
+			elseif ($_GET['menuaction'] != 'resources.uiresources.planner' &&
+				$this->save_owner)
+			{
+				// leaving planner with an unchanged user/owner ==> setting owner back to save_owner
+				//
+				$owner = (int)(isset($_GET['owner']) ? $_GET['owner'] : $this->save_owner);
+				unset($this->save_owner);
+			}
+			elseif (!empty($owner) && $owner != $this->owner && $from == 'resources.uiresources.planner')
+			{
+				// user/owner changed within planner ==> forgetting save_owner
+				//
+				unset($this->save_owner);
+			}
+
+			if(isset($owner) && $owner!='' && substr($owner,0,2) == 'g_')
+			{
+				$this->set_owner_to_group(substr($owner,2));
+			}
+			elseif(isset($owner) && $owner!='')
+			{
+				$this->owner = (int)$owner;
+			}
+			elseif(!@isset($this->owner) || !@$this->owner)
+			{
+				$this->owner = (int)$GLOBALS['phpgw_info']['user']['account_id'];
+			}
+			elseif(isset($this->owner) && $GLOBALS['phpgw']->accounts->get_type($this->owner) == 'g')
+			{
+				$this->set_owner_to_group((int)$this->owner);
+			}
+
+			$this->prefs['common']    = $GLOBALS['phpgw_info']['user']['preferences']['common'];
+
+			if ($this->prefs['common']['timeformat'] == '12')
+			{
+				$this->users_timeformat = 'h:ia';
+			}
+			else
+			{
+				$this->users_timeformat = 'H:i';
+			}
+			$this->holiday_color = (substr($GLOBALS['phpgw_info']['theme']['bg07'],0,1)=='#'?'':'#').$GLOBALS['phpgw_info']['theme']['bg07'];
+
+			$friendly = (isset($_GET['friendly'])?$_GET['friendly']:'');
+			$friendly = ($friendly=='' && isset($_POST['friendly'])?$_POST['friendly']:$friendly);
+
+			$this->printer_friendly = ((int)$friendly == 1?True:False);
+
+			if(isset($_POST['filter'])) { $this->filter = $_POST['filter']; }
+			if(isset($_POST['sortby'])) { $this->sortby = $_POST['sortby']; }
+			if(isset($_POST['cat_id'])) { $this->cat_id = $_POST['cat_id']; }
+
+			if(!isset($this->filter))
+			{
+				$this->filter = ' '.$this->prefs['resources']['defaultfilter'].' ';
+			}
+
+			if(!isset($this->sortby))
+			{
+				$this->sortby = $this->prefs['resources']['defaultresources'] == 'planner_user' ? 'user' : 'category';
+			}
+
+			if($GLOBALS['phpgw']->accounts->get_type($this->owner)=='g')
+			{
+				$this->filter = ' all ';
+			}
+
+			/*$this->so = CreateObject('resources.soresources',
+				Array(
+					'owner'		=> $this->owner,
+					'filter'	=> $this->filter,
+					'category'	=> $this->cat_id,
+					'g_owner'	=> $this->g_owner
+				)
+			);*/
+			$this->rpt_day = array(	// need to be after creation of soresources
+				MCAL_M_SUNDAY    => 'Sunday',
+				MCAL_M_MONDAY    => 'Monday',
+				MCAL_M_TUESDAY   => 'Tuesday',
+				MCAL_M_WEDNESDAY => 'Wednesday',
+				MCAL_M_THURSDAY  => 'Thursday',
+				MCAL_M_FRIDAY    => 'Friday',
+				MCAL_M_SATURDAY  => 'Saturday'
+			);
+			if($this->bo->prefs['resources']['weekdaystarts'] != 'Sunday')
+			{
+				$mcals = array_keys($this->rpt_day);
+				$days  = array_values($this->rpt_day);
+				$this->rpt_day = array();
+				list($n) = $found = array_keys($days,$this->prefs['resources']['weekdaystarts']);
+				for ($i = 0; $i < 7; ++$i,++$n)
+				{
+					$this->rpt_day[$mcals[$n % 7]] = $days[$n % 7];
+				}
+			}
+			$this->rpt_type = Array(
+				MCAL_RECUR_NONE		=> 'None',
+				MCAL_RECUR_DAILY	=> 'Daily',
+				MCAL_RECUR_WEEKLY	=> 'Weekly',
+				MCAL_RECUR_MONTHLY_WDAY	=> 'Monthly (by day)',
+				MCAL_RECUR_MONTHLY_MDAY	=> 'Monthly (by date)',
+				MCAL_RECUR_YEARLY	=> 'Yearly'
+			);
+
+			$localtime = $GLOBALS['phpgw']->datetime->users_localtime;
+
+			$date = (isset($GLOBALS['date'])?$GLOBALS['date']:'');
+			$date = (isset($_GET['date'])?$_GET['date']:$date);
+			$date = ($date=='' && isset($_POST['date'])?$_POST['date']:$date);
+
+			$year = (isset($_GET['year'])?$_GET['year']:'');
+			$year = ($year=='' && isset($_POST['year'])?$_POST['year']:$year);
+
+			$month = (isset($_GET['month'])?$_GET['month']:'');
+			$month = ($month=='' && isset($_POST['month'])?$_POST['month']:$month);
+
+			$day = (isset($_GET['day'])?$_GET['day']:'');
+			$day = ($day=='' && isset($_POST['day'])?$_POST['day']:'');
+
+			$num_months = (isset($_GET['num_months'])?$_GET['num_months']:'');
+			$num_months = ($num_months=='' && isset($_POST['num_months'])?$_POST['num_months']:$num_months);
+
+			if(isset($date) && $date!='')
+			{
+				$this->year  = (int)(substr($date,0,4));
+				$this->month = (int)(substr($date,4,2));
+				$this->day   = (int)(substr($date,6,2));
+			}
+			else
+			{
+				if(isset($year) && $year!='')
+				{
+					$this->year = $year;
+				}
+				else
+				{
+					$this->year = date('Y',$localtime);
+				}
+				if(isset($month) && $month!='')
+				{
+					$this->month = $month;
+				}
+				else
+				{
+					$this->month = date('m',$localtime);
+				}
+				if(isset($day) && $day!='')
+				{
+					$this->day = $day;
+				}
+				else
+				{
+					$this->day = date('d',$localtime);
+				}
+			}
+
+			if(isset($num_months) && $num_months!='')
+			{
+				$this->num_months = $num_months;
+			}
+			elseif($this->num_months == 0)
+			{
+				$this->num_months = 1;
+			}
+
+			$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+			if(DEBUG_APP)
+			{
+				print_debug('BO Filter','('.$this->filter.')');
+				print_debug('Owner',$this->owner);
+				print_debug('Today',$this->today);
+				if(floor(phpversion()) >= 4)
+				{
+					$this->debug_string .= ob_get_contents();
+					ob_end_clean();
+				}
+			}
+
+$evento=$this->restore_from_appsession();
+			$this->xmlrpc = is_object($GLOBALS['server']) && $GLOBALS['server']->last_method;
+		}
+
+	  function load_lang() {
+	    if(!$_SESSION['phpgw_info']['resources']['langAlarm']) 
+	      {
+		$array_keys = array();
+		$fn = '../../resources/setup/phpgw_alarm_'.$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'].'.lang';			
+		echo $fn;
+		if (file_exists($fn)){
+		  $fp = fopen($fn,'r');
+		  while ($data = fgets($fp,16000))	{
+		    list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1));			
+		    $_SESSION['phpgw_info']['resources']['langAlarm'][$message_id] =  $content;
+		  }
+		  fclose($fp);
+		}
+	      }
+	  }
+		function list_methods($_type='xmlrpc')
+		{
+			/*
+			  This handles introspection or discovery by the logged in client,
+			  in which case the input might be an array.  The server always calls
+			  this function to fill the server dispatch map using a string.
+			*/
+			if (is_array($_type))
+			{
+				$_type = $_type['type'];
+			}
+			switch($_type)
+			{
+				case 'xmlrpc':
+					$xml_functions = array(
+						'list_methods' => array(
+							'function'  => 'list_methods',
+							'signature' => array(array(xmlrpcStruct,xmlrpcString)),
+							'docstring' => lang('Read this list of methods.')
+						),
+						'read' => array(
+							'function'  => 'read_entry',
+							'signature' => array(array(xmlrpcStruct,xmlrpcInt)),
+							'docstring' => lang('Read a single entry by passing the id and fieldlist.')
+						),
+						'read_entry' => array(	// deprecated, use read
+							'function'  => 'read_entry',
+							'signature' => array(array(xmlrpcStruct,xmlrpcInt)),
+							'docstring' => lang('Read a single entry by passing the id and fieldlist.')
+						),
+						'write' => array(
+							'function'  => 'update',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Add or update a single entry by passing the fields.')
+						),
+						'add_entry' => array(	// deprecated, use write
+							'function'  => 'update',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Add a single entry by passing the fields.')
+						),
+						'update_entry' => array(	// deprecated, use write
+							'function'  => 'update',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Update a single entry by passing the fields.')
+						),
+						'delete' => array(
+							'function'  => 'delete_entry',
+							'signature' => array(array(xmlrpcInt,xmlrpcInt)),
+							'docstring' => lang('Delete a single entry by passing the id.')
+						),
+						'delete_entry' => array(	// deprecated, use delete
+							'function'  => 'delete_entry',
+							'signature' => array(array(xmlrpcInt,xmlrpcInt)),
+							'docstring' => lang('Delete a single entry by passing the id.')
+						),
+						'delete_resources' => array(
+							'function'  => 'delete_resources',
+							'signature' => array(array(xmlrpcInt,xmlrpcInt)),
+							'docstring' => lang('Delete an entire users resources.')
+						),
+						'change_owner' => array(
+							'function'  => 'change_owner',
+							'signature' => array(array(xmlrpcInt,xmlrpcStruct)),
+							'docstring' => lang('Change all events for $params[\'old_owner\'] to $params[\'new_owner\'].')
+						),
+						'search' => array(
+							'function'  => 'store_to_cache',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Read a list of entries.')
+						),
+						'store_to_cache' => array(	// deprecated, use search
+							'function'  => 'store_to_cache',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('Read a list of entries.')
+						),
+						'export_event' => array(
+							'function'  => 'export_event',
+							'signature' => array(array(xmlrpcString,xmlrpcStruct)),
+							'docstring' => lang('Export a list of entries in iCal format.')
+						),
+						'categories' => array(
+							'function'  => 'categories',
+							'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
+							'docstring' => lang('List all categories.')
+						),
+					);
+					return $xml_functions;
+					break;
+				case 'soap':
+					return $this->soap_functions;
+					break;
+				default:
+					return array();
+					break;
+			}
+		}
+
+		function set_owner_to_group($owner)
+		{
+			print_debug('resources::boresources::set_owner_to_group:owner',$owner);
+			$this->owner = (int)$owner;
+			$this->is_group = True;
+			$this->g_owner = Array();
+			$members = $GLOBALS['phpgw']->accounts->member($owner);
+			if (is_array($members))
+			{
+				foreach($members as $user)
+				{
+					// use only members which gave the user a read-grant
+					if ($this->check_perms(PHPGW_ACL_READ,0,$user['account_id']))
+					{
+						$this->g_owner[] = $user['account_id'];
+					}
+				}
+			}
+			//echo "<p>".function_backtrace().": set_owner_to_group($owner) = ".print_r($this->g_owner,True)."</p>\n";
+		}
+
+		function member_of_group($owner=0)
+		{
+			$owner = ($owner==0?$GLOBALS['phpgw_info']['user']['account_id']:$owner);
+			$group_owners = $GLOBALS['phpgw']->accounts->membership();
+			while($group_owners && list($index,$group_info) = each($group_owners))
+			{
+				if($this->owner == $group_info['account_id'])
+				{
+					return True;
+				}
+			}
+			return False;
+		}
+
+		function save_sessiondata($data='')
+		{
+			if ($this->use_session)
+			{
+				if (!is_array($data))
+				{
+					$data = array(
+						'filter'     => $this->filter,
+						'cat_id'     => $this->cat_id,
+						'owner'      => $this->owner,
+						'save_owner' => $this->save_owner,
+						'year'       => $this->year,
+						'month'      => $this->month,
+						'day'        => $this->day,
+						'date'       => $this->date,
+						'sortby'     => $this->sortby,
+						'num_months' => $this->num_months,
+						'return_to'  => $this->return_to
+					);
+				}
+				if($this->debug)
+				{
+					if(floor(phpversion()) >= 4)
+					{
+						ob_start();
+					}
+					echo '<!-- '."\n".'Save:'."\n"._debug_array($data,False)."\n".' -->'."\n";
+					if(floor(phpversion()) >= 4)
+					{
+						$this->debug_string .= ob_get_contents();
+						ob_end_clean();
+					}
+				}
+				$GLOBALS['phpgw']->session->appsession('session_data','resources',$data);
+			}
+		}
+
+		function read_sessiondata()
+		{
+			$data = $GLOBALS['phpgw']->session->appsession('session_data','resources');
+			print_debug('Read',_debug_array($data,False));
+
+			$this->filter = $data['filter'];
+			$this->cat_id = $data['cat_id'];
+			$this->sortby = $data['sortby'];
+			$this->owner  = (int)$data['owner'];
+			$this->save_owner = (int)$data['save_owner'];
+			$this->year   = (int)$data['year'];
+			$this->month  = (int)$data['month'];
+			$this->day    = (int)$data['day'];
+			$this->num_months = (int)$data['num_months'];
+			$this->return_to = $data['return_to'];
+		}
+
+		function read_entry()
+		{
+
+			$event = $this->so->read_entry($id);
+				echo $event;
+			
+			
+			return False;
+		}
+
+		function delete_single($param)
+		{
+			if($this->check_perms(PHPGW_ACL_DELETE,(int)$param['id']))
+			{
+				$temp_event = $this->get_cached_event();
+				$event = $this->read_entry((int)$param['id']);
+//				if($this->owner == $event['owner'])
+//				{
+				$exception_time = mktime($event['start']['hour'],$event['start']['min'],0,$param['month'],$param['day'],$param['year']) - $GLOBALS['phpgw']->datetime->tz_offset;
+				$event['recur_exception'][] = (int)$exception_time;
+				$this->so->cal->event = $event;
+//				print_debug('exception time',$event['recur_exception'][count($event['recur_exception']) -1]);
+//				print_debug('count event exceptions',count($event['recur_exception']));
+				$this->so->add_entry($event);
+				$cd = 16;
+
+				$this->so->cal->event = $temp_event;
+				unset($temp_event);
+			}
+			else
+			{
+				$cd = 60;
+			}
+//			}
+			return $cd;
+		}
+
+		function delete_entry($id)
+		{
+			if (is_array($id) && count($id) == 1)
+			{
+				list(,$id) = each($id);
+			}
+			if($this->check_perms(PHPGW_ACL_DELETE,$id))
+			{
+				$this->so->delete_entry($id);
+
+				if ($this->xmlrpc)
+				{
+					$this->so->expunge($id);
+				}
+				return $this->xmlrpc ? True : 16;
+			}
+			if ($this->xmlrpc)
+			{
+				$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
+			}
+			return 60;
+		}
+
+		function reinstate($params='')
+		{
+			if($this->check_perms(PHPGW_ACL_EDIT,$params['cal_id']) && isset($params['reinstate_index']))
+			{
+				$event = $this->so->read_entry($params['cal_id']);
+				@reset($params['reinstate_index']);
+				print_debug('Count of reinstate_index',count($params['reinstate_index']));
+				if(count($params['reinstate_index']) > 1)
+				{
+					while(list($key,$value) = each($params['reinstate_index']))
+					{
+						print_debug('reinstate_index ['.$key.']',(int)$value);
+						print_debug('exception time',$event['recur_exception'][(int)$value]);
+						unset($event['recur_exception'][(int)$value]);
+						print_debug('count event exceptions',count($event['recur_exception']));
+					}
+				}
+				else
+				{
+					print_debug('reinstate_index[0]',(int)$params['reinstate_index'][0]);
+					print_debug('exception time',$event['recur_exception'][(int)$params['reinstate_index'][0]]);
+					unset($event['recur_exception'][(int)$params['reinstate_index'][0]]);
+					print_debug('count event exceptions',count($event['recur_exception']));
+				}
+				$this->so->cal->event = $event;
+				$this->so->add_entry($event);
+				return 42;
+			}
+			else
+			{
+				return 43;
+			}
+		}
+
+		function delete_resources($owner)
+		{
+			if($GLOBALS['phpgw_info']['user']['apps']['admin'])
+			{
+				$this->so->delete_resources($owner);
+			}
+		}
+
+		function change_owner($params='')
+		{
+			if($GLOBALS['phpgw_info']['server']['resources_type'] == 'sql')
+			{
+				if(is_array($params))
+				{
+					$this->so->change_owner($params['old_owner'],$params['new_owner']);
+				}
+			}
+		}
+
+		function expunge()
+		{
+			reset($this->so->cal->deleted_events);
+			while(list($i,$event_id) = each($this->so->cal->deleted_events))
+			{
+				$event = $this->so->read_entry($event_id);
+				if(!$this->ex_participants)
+					$this->ex_participants = html_entity_decode($event['ex_participants']);			
+				if($this->check_perms(PHPGW_ACL_DELETE,$event))
+				{
+					$this->send_update(MSG_DELETED,$event['participants'],$event);
+				}
+				else
+				{
+					unset($this->so->cal->deleted_events[$i]);
+				}
+			}
+			$this->so->expunge();
+		}
+
+		function search_keywords($keywords)
+		{
+			$type = $GLOBALS['phpgw']->accounts->get_type($this->owner);
+
+			if($type == 'g')
+			{
+				$members = $GLOBALS['phpgw']->acl->get_ids_for_location($this->owner, 1, 'phpgw_group');
+			}
+			else
+			{
+				$members = array_keys($this->grants);
+
+				if (!in_array($this->owner,$members))
+				{
+					$members[] = $this->owner;
+				}
+			}
+			foreach($members as $n => $uid)
+			{
+				if (!($this->grants[$uid] & PHPGW_ACL_READ))
+				{
+					unset($members[$n]);
+				}
+			}
+
+
+			return $this->so->list_events_keyword($keywords,$members);
+		}
+
+		function update($params='')
+		{
+
+			if($params['from_mobile']) {
+				$ui_return = "mobile.ui_mobileresources.edit";
+				$ui_index = "mobile.ui_mobileresources.index";
+				$ui_overlap = "mobile.ui_mobileresources.overlap";
+			}
+			else {
+				$ui_return = "resources.uiresources.edit";
+				$ui_index = "resources.uiresources.index";		
+				$ui_overlap = "resources.uiresources.overlap";
+			}
+
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+			$l_cal = (@isset($params['info_type']) && $params['info_type']?$params['info_type']:$_POST['info_type']);
+			$l_participants = (@$params['participants']?$params['participants']:$_POST['participants']);
+			$this->ex_participants = (@$params['ex_participants']?$params['ex_participants']:$_POST['ex_participants']);
+			$l_categories = (@$params['categories']?$params['categories']:$_POST['categories']);
+			$l_start = (@isset($params['start']) && $params['start']?$params['start']:$_POST['start']);
+			$l_end = (@isset($params['end']) && $params['end']?$params['end']:$_POST['end']);
+			$l_recur_enddate = (@isset($params['recur_enddate']) && $params['recur_enddate']?$params['recur_enddate']:$_POST['recur_enddate']);
+
+			
+			$send_to_ui = True;
+			//if ((!is_array($l_start) || !is_array($l_end)) && !isset($_GET['readsess']))	// xmlrpc call
+			if ($this->xmlrpc)	// xmlrpc call
+			{
+
+				$send_to_ui = False;
+
+				$l_cal = $params;	// no extra array
+
+				foreach(array('start','end','recur_enddate') as $name)
+				{
+					$var = 'l_'.$name;
+					$$var = $GLOBALS['server']->iso86012date($params[$name]);
+					unset($l_cal[$name]);
+				}
+
+				if (!is_array($l_participants) || !count($l_participants))
+				{
+					$l_participants = array($GLOBALS['phpgw_info']['user']['account_id'].'A');
+				}
+				else
+				{
+					$l_participants = array();
+					foreach($params['participants'] as $user => $data)
+					{
+						$l_participants[] = $user.$data['status'];
+					}
+				}
+
+				unset($l_cal['participants']);
+
+				if (!is_object($GLOBALS['phpgw']->categories))
+				{
+					$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
+				}
+
+				$l_categories = $GLOBALS['server']->xmlrpc2cats($params['category']);
+				unset($l_cal['category']);
+
+				// using access={public|private} in all modules via xmlrpc
+				$l_cal['public'] = $params['access'] != 'private';
+				unset($l_cal['access']);
+/*
+				$fp = fopen('/tmp/xmlrpc.log','a+');
+				ob_start();
+				echo "\nboresources::update("; print_r($params); echo ")\n";
+				//echo "\nl_start="; print_r($l_start);
+				//echo "\nl_end="; print_r($l_end);
+				fwrite($fp,ob_get_contents());
+				ob_end_clean();
+				fclose($fp);
+*/
+			}
+
+			print_debug('ID',$l_cal['id']);
+
+			// don't wrap to the next day for no time
+			if ($l_end['hour'] == 24 && $l_end['min'] == 0)
+			{
+				$l_end['hour'] = 23;
+				$l_end['min'] = 59;
+			}
+
+			if(isset($_GET['readsess']))
+			{
+
+				$event = $this->restore_from_appsession();
+				$event['title'] = stripslashes($event['title']);
+				$event['description'] = stripslashes($event['description']);
+$event['description1'] = stripslashes($event['description1']);
+$event['participants1'] = stripslashes($event['participants1']);
+				$event['ex_participants'] = stripslashes($event['ex_participants']);
+				$datetime_check = $this->validate_update($event);
+				if($datetime_check)
+				{
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				$overlapping_events = False;
+			}
+			else
+			{
+
+				if((!$l_cal['id'] && !$this->check_perms(PHPGW_ACL_ADD)) ||
+				   ($l_cal['id'] && !$this->check_perms(PHPGW_ACL_EDIT,$l_cal['id'])))
+				{
+
+					if ($this->xmlrpc)
+					{
+						$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
+					}
+					if (!$send_to_ui)
+					{
+						return array(($l_cal['id']?1:2) => 'permission denied');
+					}
+
+					ExecMethod($ui_index);
+
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					else
+						return;
+				}
+
+				print_debug('Prior to fix_update_time()');
+
+				$this->fix_update_time($l_start);
+
+				$this->fix_update_time($l_end);
+
+				if(!isset($l_cal['ex_participants']))
+				{
+					$l_cal['ex_participants'] = $this->ex_participants;
+				}
+
+				if(!isset($l_categories))
+				{
+					$l_categories = 0;
+				}
+
+				$is_public = ($l_cal['type'] != 'private' && $l_cal['type'] != 'privateHiddenFields');
+
+				//$this->so->event_init();
+
+			$this->add_attribute('uid',$l_cal['uid']);
+
+				$this->add_attribute('type',$l_cal['type']);
+
+				if($l_cal['ex_participants']) {
+					$this->add_attribute('ex_participants',$l_cal['ex_participants']);
+				}
+				/*if(count($l_categories) >= 2)
+				{
+					$this->so->set_category(implode(',',$l_categories));
+				}
+				else
+				{
+					$this->so->set_category(strval($l_categories[0]));
+				}
+				$this->so->set_title($l_cal['title']);
+				$this->so->set_description($l_cal['description']);
+$this->so->set_description1($l_cal['description1']);
+$this->so->set_participants1($l_cal['participants1']);
+				$this->so->set_ex_participants($l_cal['ex_participants']);
+				$this->so->set_start($l_start['year'],$l_start['month'],$l_start['mday'],$l_start['hour'],$l_start['min'],0);
+				$this->so->set_end($l_end['year'],$l_end['month'],$l_end['mday'],$l_end['hour'],$l_end['min'],0);
+				$this->so->set_class($is_public);
+				$this->so->add_attribute('reference',(@isset($l_cal['reference']) && $l_cal['reference']?$l_cal['reference']:0));
+				$this->so->add_attribute('location',(@isset($l_cal['location']) && $l_cal['location']?$l_cal['location']:''));*/
+				if($l_cal['id'])
+				{
+					//$this->so->add_attribute('id',$l_cal['id']);
+				}
+
+				if($l_cal['rpt_use_end'] != 'y')
+				{
+					$l_recur_enddate['year'] = 0;
+					$l_recur_enddate['month'] = 0;
+					$l_recur_enddate['mday'] = 0;
+				}
+				elseif (isset($l_recur_enddate['str']))
+				{
+					$l_recur_enddate = $this->jscal->input2date($l_recur_enddate['str'],False,'mday');
+				}
+
+				switch((int)$l_cal['recur_type'])
+				{
+
+
+					case MCAL_RECUR_NONE:
+						//$this->so->set_recur_none();
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						break;
+					case MCAL_RECUR_DAILY:
+						//$this->so->set_recur_daily((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_WEEKLY:
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+
+						foreach(array('rpt_sun','rpt_mon','rpt_tue','rpt_wed','rpt_thu','rpt_fri','rpt_sat') as $rpt_day)
+						{
+							$l_cal['recur_data'] += (int)$l_cal[$rpt_day];
+						}
+						if (is_array($l_cal['rpt_day']))
+						{
+							foreach ($l_cal['rpt_day'] as $mask)
+							{
+								$l_cal['recur_data'] |= (int)$mask;
+								$rpt_wdays = $l_cal['recur_data']; // recebe os dias da semana (somatorio) para repetir o alarme;
+							}
+						}
+						//$this->so->set_recur_weekly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval'],$l_cal['recur_data']);
+						break;
+					case MCAL_RECUR_MONTHLY_MDAY:
+						//$this->so->set_recur_monthly_mday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_MONTHLY_WDAY:
+						//$this->so->set_recur_monthly_wday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+						break;
+					case MCAL_RECUR_YEARLY:
+						//$this->so->set_recur_yearly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+				}
+
+				if($l_participants)
+				{
+					$parts = $l_participants;
+					$minparts = min($l_participants);
+					$part = Array();
+					for($i=0;$i<count($parts);$i++)
+					{
+						if (($accept_type = substr($parts[$i],-1,1)) == '0' || (int)$accept_type > 0)
+						{
+							$accept_type = 'U';
+						}
+						$acct_type = $GLOBALS['phpgw']->accounts->get_type((int)$parts[$i]);
+						if($acct_type == 'u')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+						}
+						elseif($acct_type == 'g')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+							$groups[] = $parts[$i];
+							/* This pulls ALL users of a group and makes them as participants to the event */
+							/* I would like to turn this back into a group thing. */
+							$acct = CreateObject('phpgwapi.accounts',(int)$parts[$i]);
+							$members = $acct->member((int)$parts[$i]);
+							unset($acct);
+							if($members == False)
+							{
+								continue;
+							}
+							while($member = each($members))
+							{
+								$part[$member[1]['account_id']] = $accept_type;
+							}
+						}
+					}
+				}
+				else
+				{
+					$part = False;
+				}
+
+				if($part)
+				{
+					@reset($part);
+					while(list($key,$accept_type) = each($part))
+					{
+echo "";
+						//$this->so->add_attribute('participants',$accept_type,(int)$key);
+					}
+				}
+
+				if($groups)
+				{
+					@reset($groups);
+					//$this->so->add_attribute('groups',(int)$group_id);
+				}
+
+				$event = $this->get_cached_event();
+				if(!is_int($minparts))
+				{
+					$minparts = $this->owner;
+				}
+				if(!@isset($event['participants'][$l_cal['owner']]))
+				{
+					//$this->so->add_attribute('owner',$minparts);
+				}
+				else
+				{
+					//$this->so->add_attribute('owner',$l_cal['owner']);
+				}
+				//$this->so->add_attribute('priority',$l_cal['priority']);
+
+				foreach($l_cal as $name => $value)
+				{
+					if ($name[0] == '#')	// Custom field
+					{
+						//$this->so->add_attribute($name,stripslashes($value));
+					}
+				}
+				if (isset($_POST['preserved']) && is_array($preserved = unserialize(stripslashes($_POST['preserved']))))
+				{
+					foreach($preserved as $name => $value)
+					{
+						switch($name)
+						{
+							case 'owner':
+								//$this->so->add_attribute('participants',$value,$l_cal['owner']);
+								break;
+							default:
+echo "";
+								//$this->so->add_attribute($name,str_replace(array('&amp;','&quot;','&lt;','&gt;'),array('&','"','<','>'),$value));
+						}
+					}
+				}
+				$event = $this->get_cached_event();
+
+				if ($l_cal['alarmdays'] > 0 || $l_cal['alarmhours'] > 0 ||
+						$l_cal['alarmminutes'] > 0)
+				{
+					$offset = ($l_cal['alarmdays'] * 24 * 3600) +
+						($l_cal['alarmhours'] * 3600) + ($l_cal['alarmminutes'] * 60);
+
+					$time = $this->maketime($event['start']) - $offset;
+
+					$event['alarm'][] = Array(
+						'time'    => $time,
+						'offset'  => $offset,
+						'owner'   => $this->owner,
+						'enabled' => 1,
+						'repeat'  => $repetido, // para repetir alarme;
+						'init_rept' => $init_rept, // inicio repeticao;
+						'end_rept' => $end_rept, // fim repeticao;
+						'rpt_wdays' => $rpt_wdays // dias repeticao da semana;
+					);
+				}
+
+				$this->store_to_appsession($event);
+				$datetime_check = $this->validate_update($event);
+				print_debug('bo->validated_update() returnval',$datetime_check);
+
+				/*if($datetime_check)
+				{
+
+
+					if (!$send_to_ui)
+					{
+						return array($datetime_check => 'invalid input data');
+					}
+
+
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+
+				}/*/
+				if($event['id'])
+				{
+					$event_ids[] = $event['id'];
+				}
+				if($event['reference'])
+				{
+					$event_ids[] = $event['reference'];
+				}
+
+				$overlapping_events = $this->overlap(
+					$this->maketime($event['start']),
+					$this->maketime($event['end']),
+					$event['participants'],
+					$event['owner'],
+					$event_ids
+				);
+			}
+			if(!$this->ex_participants)
+				$this->ex_participants = $event['ex_participants'];			
+			if($overlapping_events)
+			{
+
+
+				if($send_to_ui)
+				{
+					$event['ex_participants'] = $this->ex_participants;
+					unset($GLOBALS['phpgw_info']['flags']['noheader']);
+					unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+					ExecMethod($ui_overlap,
+						Array(
+							'o_events'	=> $overlapping_events,
+							'this_event'	=> $event
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				else
+				{
+					return $overlapping_events;
+				}
+			}
+			else
+			{
+
+
+
+				if(!$event['id'])
+				{
+
+
+
+					//$this->so->add_entry($event);
+					$this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event());
+					print_debug('New Event ID',$event['id']);
+				}
+				else
+				{
+
+					print_debug('Updating Event ID',$event['id']);
+					$new_event = $event;
+					$old_event = $this->read_entry($event['id']);
+					// if old event has alarm and the start-time changed => update them
+					//echo "<p>checking ".count($old_event['alarm'])." alarms of event #$event[id] start moved from ".print_r($old_event['start'],True)." to ".print_r($event['start'],True)."</p>\n";
+					if ($old_event['alarm'] &&
+						$this->maketime($old_event['start']) != $this->maketime($event['start']))
+					{
+						//$this->so->delete_alarms($old_event['id']);
+						foreach($old_event['alarm'] as $id => $alarm)
+						{
+							$alarm['time'] = $this->maketime($event['start']) - $alarm['offset'];
+							$event['alarm'][] = $alarm;
+						}
+						//echo "updated alarms<pre>".print_r($event['alarm'],True)."</pre>\n";
+					}
+					//$this->so->cal->event = $event;
+					//$this->so->add_entry($event);
+					$this->prepare_recipients($new_event,$old_event);
+				}
+
+				$date = sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']);
+				if($send_to_ui)
+				{
+					$this->read_sessiondata();
+					if ($this->return_to)
+					{
+						$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->return_to);
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					}
+					Execmethod($ui_index);
+				}
+				else
+				{
+					return (int)$event['id'];
+				}
+			}
+			return True;
+		}
+
+		/* Private functions */
+		function read_holidays($year=0)
+		{
+			if(!$year)
+			{
+				$year = $this->year;
+			}
+			$holiday = CreateObject('resources.boholiday');
+			$holiday->prepare_read_holidays($year,$this->owner);
+			$this->cached_holidays = $holiday->read_holiday();
+			unset($holiday);
+		}
+
+		function user_is_a_member($event,$user)
+		{
+			@reset($event['participants']);
+			$uim = False;
+			$security_equals = $GLOBALS['phpgw']->accounts->membership($user);
+			while(!$uim && $event['participants'] && $security_equals && list($participant,$status) = each($event['participants']))
+			{
+				if($GLOBALS['phpgw']->accounts->get_type($participant) == 'g')
+				{
+					@reset($security_equals);
+					while(list($key,$group_info) = each($security_equals))
+					{
+						if($group_info['account_id'] == $participant)
+						{
+							return True;
+							$uim = True;
+						}
+					}
+				}
+			}
+			return $uim;
+		}
+
+		function maketime($time)
+		{
+//echo "tttt".$time['month']."  ".$time['mday']."  ".$time['year']."<br>";
+			return mktime(intval($time['hour']),intval($time['min']),intval($time['sec']),intval($time['month']),intval($time['mday']),intval($time['year']));
+		}
+
+function maketime2($hora,$min,$seg,$dia,$mes,$ano,$ampm)
+		{
+if($ampm == 'pm' || $ampm == 'PM')  $hora = $hora+12; 
+
+
+			return mktime(intval($hora),intval($min),intval($seg),intval($mes),intval($dia),intval($ano));
+		}
+		/*!
+		@function time2array
+		@abstract returns a date-array suitable for the start- or endtime of an event from a timestamp
+		@syntax time2array($time,$alarm=0)
+		@param $time the timestamp for the values of the array
+		@param $alarm (optional) alarm field of the array, defaults to 0
+		@author ralfbecker
+		*/
+		function time2array($time,$alarm = 0)
+		{
+			return array(
+				'year'  => (int)(date('Y',$time)),
+				'month' => (int)(date('m',$time)),
+				'mday'  => (int)(date('d',$time)),
+				'hour'  => (int)(date('g',$time)),
+				'min'   => (int)(date('i',$time)),
+				'sec'   => (int)(date('s',$time)),
+				'ampm'=> (int)(date('a',$time)),
+                                'hourcompleta' => (int)(date('H',$time)),
+				'alarm' => (int)($alarm)
+			);
+		}
+
+
+		/*!
+		@function set_recur_date
+		@abstract set the start- and enddates of a recuring event for a recur-date
+		@syntax set_recur_date(&$event,$date)
+		@param $event the event which fields to set (has to be the original event for start-/end-times)
+		@param $date  the recuring date in form 'Ymd', eg. 20030226
+		@author ralfbecker
+		*/
+		function set_recur_date(&$event,$date)
+		{
+			$org_start = $this->maketime($event['start']);
+			$org_end   = $this->maketime($event['end']);
+			$start = mktime($event['start']['hour'],$event['start']['min'],0,substr($date,4,2),substr($date,6,2),substr($date,0,4));
+			$end   = $org_end + $start - $org_start;
+			$event['start'] = $this->time2array($start);
+			$event['end']   = $this->time2array($end);
+		}
+
+		function fix_update_time(&$time_param)
+		{
+			if (isset($time_param['str']))
+			{
+				if (!is_object($this->jscal))
+				{
+					$this->jscal = CreateObject('phpgwapi.jscalendar');
+				}
+				$time_param += $this->jscal->input2date($time_param['str'],False,'mday');
+				unset($time_param['str']);
+			}
+			if ($this->prefs['common']['timeformat'] == '12')
+			{
+				if ($time_param['ampm'] == 'pm')
+				{
+					if ($time_param['hour'] <> 12)
+					{
+						$time_param['hour'] += 12;
+					}
+				}
+				elseif ($time_param['ampm'] == 'am')
+				{
+					if ($time_param['hour'] == 12)
+					{
+						$time_param['hour'] -= 12;
+					}
+				}
+
+				if($time_param['hour'] > 24)
+				{
+					$time_param['hour'] -= 12;
+				}
+			}
+		}
+
+		function validate_update($event)
+		{
+			$error = 0;
+			// do a little form verifying
+			if (!count($event['participants']))
+			{
+				$error = 43;
+			}
+			elseif ($event['title'] == '')
+			{
+				$error = 40;
+			}
+			elseif (($GLOBALS['phpgw']->datetime->time_valid($event['start']['hour'],$event['start']['min'],0) == False) || ($GLOBALS['phpgw']->datetime->time_valid($event['end']['hour'],$event['end']['min'],0) == False))
+			{
+				$error = 41;
+			}
+			elseif (($GLOBALS['phpgw']->datetime->date_valid($event['start']['year'],$event['start']['month'],$event['start']['mday']) == False) || ($GLOBALS['phpgw']->datetime->date_valid($event['end']['year'],$event['end']['month'],$event['end']['mday']) == False) || ($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 1))
+			{
+				$error = 42;
+			}
+			elseif ($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 0)
+			{
+				if ($GLOBALS['phpgw']->datetime->time_compare($event['start']['hour'],$event['start']['min'],0,$event['end']['hour'],$event['end']['min'],0) == 1)
+				{
+					$error = 42;
+				}
+			}
+			return $error;
+		}
+
+		/*!
+		@function participants_not_rejected($participants,$event)
+		@abstract checks if any of the $particpants participates in $event and has not rejected it
+		*/
+		function participants_not_rejected($participants,$event)
+		{
+			//echo "participants_not_rejected()<br>participants =<pre>"; print_r($participants); echo "</pre><br>event[participants]=<pre>"; print_r($event['participants']); echo "</pre>\n";
+			foreach($participants as $uid => $status)
+			{
+				//echo "testing event[participants][uid=$uid] = '".$event['participants'][$uid]."'<br>\n";
+				if (isset($event['participants'][$uid]) && $event['participants'][$uid] != 'R' &&
+					$status != 'R')
+				{
+					return True;	// found not rejected participant in event
+				}
+			}
+			return False;
+		}
+
+		function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False)
+		{
+//			$retval = Array();
+//			$ok = False;
+
+/* This needs some attention.. by commenting this chunk of code it will fix bug #444265 */
+
+			if($restore_cache)
+			{
+				$temp_cache_events = $this->cached_events;
+			}
+
+//			$temp_start = (int)$GLOBALS['phpgw']->common->show_date($starttime,'Ymd');
+//			$temp_start_time = (int)($GLOBALS['phpgw']->common->show_date($starttime,'Hi');
+//			$temp_end = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Ymd');
+//			$temp_end_time = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Hi');
+			$temp_start = (int)(date('Ymd',$starttime));
+			$temp_start_time = (int)(date('Hi',$starttime));
+			$temp_end = (int)(date('Ymd',$endtime));
+			$temp_end_time = (int)(date('Hi',$endtime));
+			if($this->debug)
+			{
+				echo '<!-- Temp_Start: '.$temp_start.' -->'."\n";
+				echo '<!-- Temp_End: '.$temp_end.' -->'."\n";
+			}
+
+			$users = Array();
+			if(count($participants))
+			{
+				while(list($user,$status) = each($participants))
+				{
+					$users[] = $user;
+				}
+			}
+			else
+			{
+				$users[] = $this->owner;
+			}
+
+			$possible_conflicts = $this->store_to_cache(
+				Array(
+					'smonth'	=> substr(strval($temp_start),4,2),
+					'sday'	=> substr(strval($temp_start),6,2),
+					'syear'	=> substr(strval($temp_start),0,4),
+					'emonth'	=> substr(strval($temp_end),4,2),
+					'eday'	=> substr(strval($temp_end),6,2),
+					'eyear'	=> substr(strval($temp_end),0,4),
+					'owner'	=> $users
+				)
+			);
+
+			if($this->debug)
+			{
+				echo '<!-- Possible Conflicts ('.($temp_start - 1).'): '.count($possible_conflicts[$temp_start - 1]).' -->'."\n";
+				echo '<!-- Possible Conflicts ('.$temp_start.'): '.count($possible_conflicts[$temp_start]).' '.count($id).' -->'."\n";
+			}
+
+			if($possible_conflicts[$temp_start] || $possible_conflicts[$temp_end])
+			{
+				if($temp_start == $temp_end)
+				{
+					if($this->debug)
+					{
+						echo '<!-- Temp_Start == Temp_End -->'."\n";
+					}
+					@reset($possible_conflicts[$temp_start]);
+					while(list($key,$event) = each($possible_conflicts[$temp_start]))
+					{
+						$found = False;
+						if($id)
+						{
+							@reset($id);
+							while(list($key,$event_id) = each($id))
+							{
+								if($this->debug)
+								{
+									echo '<!-- $id['.$key.'] = '.$id[$key].' = '.$event_id.' -->'."\n";
+									echo '<!-- '.$event['id'].' == '.$event_id.' -->'."\n";
+								}
+								if($event['id'] == $event_id)
+								{
+									$found = True;
+								}
+							}
+						}
+						if($this->debug)
+						{
+							echo '<!-- Item found: '.$found.' -->'."<br>\n";
+						}
+						if(!$found)
+						{
+							if($this->debug)
+							{
+								echo '<!-- Checking event id #'.$event['id'];
+							}
+							$temp_event_start = sprintf("%d%02d",$event['start']['hour'],$event['start']['min']);
+							$temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']);
+//							if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) ||
+							if(($temp_start_time <= $temp_event_start &&
+								$temp_end_time > $temp_event_start &&
+								$temp_end_time <= $temp_event_end ||
+								$temp_start_time >= $temp_event_start &&
+								$temp_start_time < $temp_event_end &&
+								$temp_end_time >= $temp_event_end ||
+								$temp_start_time <= $temp_event_start &&
+								$temp_end_time >= $temp_event_end ||
+								$temp_start_time >= $temp_event_start &&
+								$temp_end_time <= $temp_event_end) &&
+								$this->participants_not_rejected($participants,$event))
+							{
+								if($this->debug)
+								{
+									echo ' Conflicts';
+								}
+								$retval[] = $event['id'];
+							}
+							if($this->debug)
+							{
+								echo ' -->'."\n";
+							}
+						}
+					}
+				}
+			}
+			else
+			{
+				$retval = False;
+			}
+
+			if($restore_cache)
+			{
+				$this->cached_events = $temp_cache_events;
+			}
+
+			return $retval;
+		}
+
+		/*!
+		@function check_perms( )
+		@syntax check_perms($needed,$event=0,$other=0)
+		@abstract Checks if the current user has the necessary ACL rights
+		@author ralfbecker
+		@discussion The check is performed on an event or general on the cal of an other user
+		@param $needed necessary ACL right: PHPGW_ACL_{READ|EDIT|DELETE}
+		@param $event event as array or the event-id or 0 for general check
+		@param $other uid to check (if event==0) or 0 to check against $this->owner
+		@note Participating in an event is considered as haveing read-access on that event, \
+			even if you have no general read-grant from that user.
+		*/
+		function check_perms($needed,$event=0,$other=0)
+		{
+			$event_in = $event;
+			
+			if (is_int($event) && $event == 0)
+			{
+				$owner = $other > 0 ? $other : $this->owner;
+			}
+			else
+			{
+				if (!is_array($event))
+				{
+					$event = "";//$this->so->read_entry((int) $event);
+				}
+				if (!is_array($event))
+				{
+					if ($this->xmlrpc)
+					{
+						$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'],$GLOBALS['xmlrpcstr']['not_exist']);
+					}
+					return False;
+				}
+				$owner = $event['owner'];
+				$private = $event['public'] == False || $event['public'] == 0;
+			}
+			$user = $GLOBALS['phpgw_info']['user']['account_id'];
+			$grants = $this->grants[$owner];
+
+			if (is_array($event) && $needed == PHPGW_ACL_READ)
+			{
+				// Check if the $user is one of the participants or has a read-grant from one of them
+				//
+if($event['participants']){
+				foreach($event['participants'] as $uid => $accept)
+				{
+					if ($this->grants[$uid] & PHPGW_ACL_READ || $uid == $user)
+					{
+						$grants |= PHPGW_ACL_READ;
+						// if the $user is one of the participants read-grant private (restricted) too.
+						if($uid == $user || ($this->grants[$uid] & PHPGW_ACL_PRIVATE)) {
+							$grants |= PHPGW_ACL_PRIVATE;
+						}
+						//break;
+					}
+				}
+}
+			}
+
+			if ($GLOBALS['phpgw']->accounts->get_type($owner) == 'g' && $needed == PHPGW_ACL_ADD)
+			{
+				$access = False;	// a group can't be the owner of an event
+			}
+			else
+			{
+				$access = $user == $owner || $grants & $needed && (!$private || $grants & PHPGW_ACL_PRIVATE);
+			}
+			//echo "<p>".function_backtrace()." check_perms($needed,$event_id,$other) for user $user and needed_acl $needed: event='$event[title]': owner=$owner, private=$private, grants=$grants ==> access=$access</p>\n";
+
+			return $access;
+		}
+
+
+		function display_status($user_status)
+		{
+			if(@$this->prefs['resources']['display_status'] && $user_status)
+			{
+				$user_status = substr($this->get_long_status($user_status),0,1);
+
+				return ' ('.$user_status.')';
+			}
+			else
+			{
+				return '';
+			}
+		}
+
+		function get_long_status($status_short)
+		{
+			switch ($status_short)
+			{
+				case 'A':
+					$status = lang('Accepted');
+					break;
+				case 'R':
+					$status = lang('Rejected');
+					break;
+				case 'T':
+					$status = lang('Tentative');
+					break;
+				case 'U':
+					$status = lang('No Response');
+					break;
+			}
+			return $status;
+		}
+
+		function is_private($event,$owner)
+		{
+			if($owner == 0)
+			{
+				$owner = $this->owner;
+			}
+			if ($owner == $GLOBALS['phpgw_info']['user']['account_id'] || ($event['public']==1) || ($this->check_perms(PHPGW_ACL_PRIVATE,$event) && $event['public']==0) || $event['owner'] == $GLOBALS['phpgw_info']['user']['account_id'])
+			{
+				return False;
+			}
+			elseif($event['public'] == 0)
+			{
+				return True;
+			}
+			elseif($event['public'] == 2)
+			{
+				$is_private = True;
+				$groups = $GLOBALS['phpgw']->accounts->membership($owner);
+				while (list($key,$group) = each($groups))
+				{
+					if (strpos(' '.implode(',',$event['groups']).' ',$group['account_id']))
+					{
+						return False;
+					}
+				}
+			}
+			else
+			{
+				return False;
+			}
+
+			return $is_private;
+		}
+
+		function get_short_field($event,$is_private=True,$field='')
+		{
+
+
+			if($is_private)
+			{
+				return lang('private');
+			}
+
+// cut off too long titles
+			elseif(strlen($event[$field]) > 19 && !$this->printer_friendly && $field=="title")
+//			elseif(strlen($event[$field]) > 19 && $this->printer_friendly)
+			{
+// we dont use currently 160304
+//				return substr($event[$field], 0 , 19) . '&nbsp;...';
+				return $event[$field];
+			}
+			else
+			{
+				return $event[$field];
+			}
+		}
+
+		function long_date($first,$last=0)
+		{
+			if (!is_array($first))
+			{
+				$first = $this->time2array($raw = $first);
+				$first['raw'] = $raw;
+				$first['day'] = $first['mday'];
+			}
+			if ($last && !is_array($last))
+			{
+				$last = $this->time2array($raw = $last);
+				$last['raw'] = $raw;
+				$last['day'] = $last['mday'];
+			}
+			$datefmt = $this->prefs['common']['dateformat'];
+
+			$month_before_day = strtolower($datefmt[0]) == 'm' ||
+				strtolower($datefmt[2]) == 'm' && $datefmt[4] == 'd';
+
+			for ($i = 0; $i < 5; $i += 2)
+			{
+				switch($datefmt[$i])
+				{
+					case 'd':
+						$range .= $first['day'] . ($datefmt[1] == '.' ? '.' : '');
+						if ($first['month'] != $last['month'] || $first['year'] != $last['year'])
+						{
+							if (!$month_before_day)
+							{
+								$range .= ' '.lang(strftime('%B',$first['raw']));
+							}
+							if ($first['year'] != $last['year'] && $datefmt[0] != 'Y')
+							{
+								$range .= ($datefmt[0] != 'd' ? ', ' : ' ') . $first['year'];
+							}
+							if (!$last)
+							{
+								return $range;
+							}
+							$range .= ' - ';
+
+							if ($first['year'] != $last['year'] && $datefmt[0] == 'Y')
+							{
+								$range .= $last['year'] . ', ';
+							}
+
+							if ($month_before_day)
+							{
+								$range .= lang(strftime('%B',$last['raw']));
+							}
+						}
+						else
+						{
+							$range .= ' - ';
+						}
+						$range .= ' ' . $last['day'] . ($datefmt[1] == '.' ? '.' : '');
+						break;
+					case 'm':
+					case 'M':
+						$range .= ' '.lang(strftime('%B',$month_before_day ? $first['raw'] : $last['raw'])) . ' ';
+						break;
+					case 'Y':
+						$range .= ($datefmt[0] == 'm' ? ', ' : ' ') . ($datefmt[0] == 'Y' ? $first['year'].($datefmt[2] == 'd' ? ', ' : ' ') : $last['year'].' ');
+						break;
+				}
+			}
+			return $range;
+		}
+
+		function get_week_label()
+		{
+			$first = $GLOBALS['phpgw']->datetime->gmtdate($GLOBALS['phpgw']->datetime->get_weekday_start($this->year, $this->month, $this->day));
+			$last = $GLOBALS['phpgw']->datetime->gmtdate($first['raw'] + 518400);
+
+			return ($this->long_date($first,$last));
+		}
+
+		function normalizeminutes(&$minutes)
+		{
+			$hour = 0;
+			$min = (int)$minutes;
+			if($min >= 60)
+			{
+				$hour += $min / 60;
+				$min %= 60;
+			}
+			settype($minutes,'integer');
+			$minutes = $min;
+			return $hour;
+		}
+
+		function splittime($time,$follow_24_rule=True)
+		{
+			$temp = array('hour','minute','second','ampm');
+			$time = strrev($time);
+			$second = (int)(strrev(substr($time,0,2)));
+			$minute = (int)(strrev(substr($time,2,2)));
+			$hour   = (int)(strrev(substr($time,4)));
+			$hour += $this->normalizeminutes($minute);
+			$temp['second'] = $second;
+			$temp['minute'] = $minute;
+			$temp['hour']   = $hour;
+			$temp['ampm']   = '  ';
+			if($follow_24_rule == True)
+			{
+				if ($this->prefs['common']['timeformat'] == '24')
+				{
+					return $temp;
+				}
+
+				$temp['ampm'] = 'am';
+
+				if ((int)$temp['hour'] > 12)
+				{
+					$temp['hour'] = (int)((int)$temp['hour'] - 12);
+					$temp['ampm'] = 'pm';
+				}
+				elseif ((int)$temp['hour'] == 12)
+				{
+					$temp['ampm'] = 'pm';
+				}
+			}
+			return $temp;
+		}
+
+		function get_exception_array($exception_str='')
+		{
+			$exception = Array();
+			if(strpos(' '.$exception_str,','))
+			{
+				$exceptions = explode(',',$exception_str);
+				for($exception_count=0;$exception_count<count($exceptions);$exception_count++)
+				{
+					$exception[] = (int)$exceptions[$exception_count];
+				}
+			}
+			elseif($exception_str != '')
+			{
+				$exception[] = (int)$exception_str;
+			}
+			return $exception;
+		}
+
+		function build_time_for_display($fixed_time)
+		{
+			$time = $this->splittime($fixed_time);
+			$str = $time['hour'].':'.((int)$time['minute']<=9?'0':'').$time['minute'];
+
+			if ($this->prefs['common']['timeformat'] == '12')
+			{
+				$str .= ' ' . $time['ampm'];
+			}
+
+			return $str;
+		}
+
+		function sort_event($event,$date)
+		{
+			$inserted = False;
+			if(isset($event['recur_exception']))
+			{
+				$event_time = mktime($event['start']['hour'],$event['start']['min'],0,(int)(substr($date,4,2)),(int)(substr($date,6,2)),(int)(substr($date,0,4))) - $GLOBALS['phpgw']->datetime->tz_offset;
+				while($inserted == False && list($key,$exception_time) = each($event['recur_exception']))
+				{
+					if($this->debug)
+					{
+						echo '<!-- checking exception datetime '.$exception_time.' to event datetime '.$event_time.' -->'."\n";
+					}
+					if($exception_time == $event_time)
+					{
+						$inserted = True;
+					}
+				}
+			}
+			if($this->cached_events[$date] && $inserted == False)
+			{
+
+				if($this->debug)
+				{
+					echo '<!-- Cached Events found for '.$date.' -->'."\n";
+				}
+				$year = substr($date,0,4);
+				$month = substr($date,4,2);
+				$day = substr($date,6,2);
+
+				if($this->debug)
+				{
+					echo '<!-- Date : '.$date.' Count : '.count($this->cached_events[$date]).' -->'."\n";
+				}
+
+				for($i=0;$i<count($this->cached_events[$date]);$i++)
+				{
+					if($this->cached_events[$date][$i]['id'] == $event['id'] || $this->cached_events[$date][$i]['reference'] == $event['id'])
+					{
+						if($this->debug)
+						{
+							echo '<!-- Item already inserted! -->'."\n";
+						}
+						$inserted = True;
+						break;
+					}
+					/* This puts all spanning events across multiple days up at the top. */
+					if($this->cached_events[$date][$i]['recur_type'] == MCAL_RECUR_NONE)
+					{
+						if($this->cached_events[$date][$i]['start']['mday'] != $day && $this->cached_events[$date][$i]['end']['mday'] >= $day)
+						{
+							continue;
+						}
+					}
+					if(date('Hi',mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$day,$year)) < date('Hi',mktime($this->cached_events[$date][$i]['start']['hour'],$this->cached_events[$date][$i]['start']['min'],$this->cached_events[$date][$i]['start']['sec'],$month,$day,$year)))
+					{
+						for($j=count($this->cached_events[$date]);$j>=$i;$j--)
+						{
+							$this->cached_events[$date][$j] = $this->cached_events[$date][$j-1];
+						}
+						if($this->debug)
+						{
+							echo '<!-- Adding event ID: '.$event['id'].' to cached_events -->'."\n";
+						}
+						$inserted = True;
+						$this->cached_events[$date][$i] = $event;
+						break;
+					}
+				}
+			}
+			if(!$inserted)
+			{
+				if($this->debug)
+				{
+					echo '<!-- Adding event ID: '.$event['id'].' to cached_events -->'."\n";
+				}
+				$this->cached_events[$date][] = $event;
+			}
+		}
+
+		function check_repeating_events($datetime)
+		{
+			@reset($this->repeating_events);
+			$search_date_full = date('Ymd',$datetime);
+			$search_date_year = date('Y',$datetime);
+			$search_date_month = date('m',$datetime);
+			$search_date_day = date('d',$datetime);
+			$search_date_dow = date('w',$datetime);
+			$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
+			if($this->debug)
+			{
+				echo '<!-- Search Date Full = '.$search_date_full.' -->'."\n";
+			}
+			$repeated = $this->repeating_events;
+			$r_events = count($repeated);
+			for ($i=0;$i<$r_events;$i++)
+			{
+				$rep_events = $this->repeating_events[$i];
+				$id = $rep_events['id'];
+				$event_beg_day = mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']);
+				if($rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0)
+				{
+					$event_recur_time = $this->maketime($rep_events['recur_enddate']);
+				}
+				else
+				{
+					$event_recur_time = mktime(0,0,0,1,1,2030);
+				}
+				$end_recur_date = date('Ymd',$event_recur_time);
+				$full_event_date = date('Ymd',$event_beg_day);
+
+				if($this->debug)
+				{
+					echo '<!-- check_repeating_events - Processing ID - '.$id.' -->'."\n";
+					echo '<!-- check_repeating_events - Recurring End Date - '.$end_recur_date.' -->'."\n";
+				}
+
+				// only repeat after the beginning, and if there is an rpt_end before the end date
+				if (($search_date_full > $end_recur_date) || ($search_date_full < $full_event_date))
+				{
+					continue;
+				}
+
+				if ($search_date_full == $full_event_date)
+				{
+					$this->sort_event($rep_events,$search_date_full);
+					continue;
+				}
+				else
+				{
+					$freq = $rep_events['recur_interval'];
+					$freq = $freq ? $freq : 1;
+					$type = $rep_events['recur_type'];
+					switch($type)
+					{
+						case MCAL_RECUR_DAILY:
+							if($this->debug)
+							{
+								echo '<!-- check_repeating_events - MCAL_RECUR_DAILY - '.$id.' -->'."\n";
+							}
+							
+							if ($freq == 1 && $rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0 && $search_date_full <= $end_recur_date)
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							elseif (floor(($search_beg_day - $event_beg_day)/86400) % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							else
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_WEEKLY:
+							if (floor(($search_beg_day - $event_beg_day)/604800)  % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							$check = 0;
+							switch($search_date_dow)
+							{
+								case 0:
+									$check = MCAL_M_SUNDAY;
+									break;
+								case 1:
+									$check = MCAL_M_MONDAY;
+									break;
+								case 2:
+									$check = MCAL_M_TUESDAY;
+									break;
+								case 3:
+									$check = MCAL_M_WEDNESDAY;
+									break;
+								case 4:
+									$check = MCAL_M_THURSDAY;
+									break;
+								case 5:
+									$check = MCAL_M_FRIDAY;
+									break;
+								case 6:
+									$check = MCAL_M_SATURDAY;
+									break;
+							}
+							if ($rep_events['recur_data'] & $check)
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_MONTHLY_WDAY:
+							if ((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month - $rep_events['start']['month']) % $freq)
+							{
+								continue;
+							}
+
+							if (($GLOBALS['phpgw']->datetime->day_of_week($rep_events['start']['year'],$rep_events['start']['month'],$rep_events['start']['mday']) == $GLOBALS['phpgw']->datetime->day_of_week($search_date_year,$search_date_month,$search_date_day)) &&
+								(ceil($rep_events['start']['mday']/7) == ceil($search_date_day/7)))
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_MONTHLY_MDAY:
+							if ((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month - $rep_events['start']['month'])  % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							if ($search_date_day == $rep_events['start']['mday'])
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_YEARLY:
+							if (($search_date_year - $rep_events['start']['year']) % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							if (date('dm',$datetime) == date('dm',$event_beg_day))
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+					}
+				}
+			}	// end for loop
+		}	// end function
+
+		function store_to_cache($params)
+		{
+			if(!is_array($params))
+			{
+				return False;
+			}
+			if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start'])))
+			{
+				$syear = $datearr['year'];
+				$smonth = $datearr['month'];
+				$sday = $datearr['mday'];
+				$this->xmlrpc = True;
+			}
+			else
+			{
+				$syear = $params['syear'];
+				$smonth = $params['smonth'];
+				$sday = $params['sday'];
+			}
+			if (isset($params['end']) && ($datearr = $GLOBALS['server']->iso86012date($params['end'])))
+			{
+				$eyear = $datearr['year'];
+				$emonth = $datearr['month'];
+				$eday = $datearr['mday'];
+				$this->xmlrpc = True;
+			}
+			else
+			{
+				$eyear = (isset($params['eyear'])?$params['eyear']:0);
+				$emonth = (isset($params['emonth'])?$params['emonth']:0);
+				$eday = (isset($params['eday'])?$params['eday']:0);
+			}
+			if (!isset($params['owner']) && @$this->xmlrpc)
+			{
+				$owner_id = $GLOBALS['phpgw_info']['user']['user_id'];
+			}
+			else
+			{
+				$owner_id = (isset($params['owner'])?$params['owner']:0);
+				if($owner_id==0 && $this->is_group)
+				{
+					unset($owner_id);
+					$owner_id = $this->g_owner;
+					if($this->debug)
+					{
+						echo '<!-- owner_id in ('.implode(',',$owner_id).') -->'."\n";
+					}
+				}
+			}
+			if(!$eyear && !$emonth && !$eday)
+			{
+				$edate = mktime(23,59,59,$smonth + 1,$sday + 1,$syear);
+				$eyear = date('Y',$edate);
+				$emonth = date('m',$edate);
+				$eday = date('d',$edate);
+			}
+			else
+			{
+				if(!$eyear)
+				{
+					$eyear = $syear;
+				}
+				//Tratamento do valor final (mes) da pesquisa de eventos feita em $this->so->list_events.
+				//Se $emonth nao tem valor, recebe o valor de $smonth (que recebe $params['smonth']) e soma 1.
+				//O valor $params['emonth'] indica o mes final para a pesquisa de eventos, e passou a ser
+				//informado na a impressao de eventos mensais. Mudancas feitas em class.uiresources.inc.php, 
+				//function display_month_print();
+				if(!$emonth)
+				{
+					$emonth = $smonth + 1;
+					if($emonth > 12)
+					{
+						$emonth = 1;
+						$eyear++;
+					}
+				}
+				if(!$eday)
+				{
+					$eday = $sday + 1;
+				}
+				$edate = mktime(23,59,59,$emonth,$eday,$eyear);
+			}
+			//echo "<p>boresources::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n";
+			if($this->debug)
+			{
+				echo '<!-- Start Date : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+				echo '<!-- End   Date : '.sprintf("%04d%02d%02d",$eyear,$emonth,$eday).' -->'."\n";
+			}
+			//A variavel $month_print recebe o parametro 'saux' com o mes de inicio da pesquisa de eventos por
+			//$this->so->list_events. O valor do mes final da pesquisa e tratado no codigo acima;
+			//$month_ini = $params['saux'];
+
+			if($owner_id)
+			{
+				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
+				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
+			}
+			else
+			{
+				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
+				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
+			}
+
+			$c_cached_ids = count($cached_event_ids);
+			$c_cached_ids_repeating = count($cached_event_ids_repeating);
+
+			if($this->debug)
+			{
+				echo '<!-- events cached : '.$c_cached_ids.' : for : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+				echo '<!-- repeating events cached : '.$c_cached_ids_repeating.' : for : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+			}
+
+			$this->cached_events = Array();
+
+			if($c_cached_ids == 0 && $c_cached_ids_repeating == 0)
+			{
+				return;
+			}
+
+			$cache_start = (int)(sprintf("%04d%02d%02d",$syear,$smonth,$sday));
+			$cached_event=$this->get_cached_event();
+			if($c_cached_ids)
+			{
+				for($i=0;$i<$c_cached_ids;$i++)
+				{
+					$event = "";//$this->so->read_entry($cached_event_ids[$i]);
+					if ($event['recur_type'])
+					{
+						continue;	// fetch recuring events only in 2. loop
+					}
+					$startdate = (int)(date('Ymd',$this->maketime($event['start'])));
+					$enddate = (int)(date('Ymd',$this->maketime($event['end'])));
+					$this->cached_events[$startdate][] = $event;
+					if($startdate != $enddate)
+					{
+						$start['year'] = (int)(substr($startdate,0,4));
+						$start['month'] = (int)(substr($startdate,4,2));
+						$start['mday'] = (int)(substr($startdate,6,2));
+						for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=(int)(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year']))))
+						{
+							$c_evt_day = count($this->cached_events[$j]) - 1;
+							if($c_evt_day < 0)
+							{
+								$c_evt_day = 0;
+							}
+							if($this->debug)
+							{
+								echo '<!-- Date: '.$j.' Count : '.$c_evt_day.' -->'."\n";
+							}
+							if($this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
+							{
+								if($this->debug)
+								{
+									echo '<!-- Adding Event for Date: '.$j.' -->'."\n";
+								}
+								$this->cached_events[$j][] = $event;
+							}
+							if ($j >= $cache_start && (@$params['no_doubles'] || @$this->xmlrpc))
+							{
+								break;	// add event only once on it's startdate
+							}
+						}
+					}
+				}
+			}
+
+			$this->repeating_events = Array();
+			if($c_cached_ids_repeating)
+			{
+				for($i=0;$i<$c_cached_ids_repeating;$i++)
+				{
+					$this->repeating_events[$i] = "";//$this->so->read_entry($cached_event_ids_repeating[$i]);
+					if($this->debug)
+					{
+						echo '<!-- Cached Events ID: '.$cached_event_ids_repeating[$i].' ('.sprintf("%04d%02d%02d",$this->repeating_events[$i]['start']['year'],$this->repeating_events[$i]['start']['month'],$this->repeating_events[$i]['start']['mday']).') -->'."\n";
+					}
+				}
+				for($date=mktime(0,0,0,$smonth,$sday,$syear);$date<=$edate;$date += 86400)
+				{
+					if($this->debug)
+					{
+						$search_date = date('Ymd',$date);
+						echo '<!-- Calling check_repeating_events('.$search_date.') -->'."\n";
+					}
+					$this->check_repeating_events($date);
+					if($this->debug)
+					{
+						echo '<!-- Total events found matching '.$search_date.' = '.count($this->cached_events[$search_date]).' -->'."\n";
+						for($i=0;$i<count($this->cached_events[$search_date]);$i++)
+						{
+							echo '<!-- Date: '.$search_date.' ['.$i.'] = '.$this->cached_events[$search_date][$i]['id'].' -->'."\n";
+						}
+					}
+				}
+			}
+			$retval = Array();
+			for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday + $k,$syear)))
+			{
+				if(is_array($this->cached_events[$j]))
+				{
+					if ($this->xmlrpc)
+					{
+						foreach($this->cached_events[$j] as $event)
+						{
+							$retval[] = $this->xmlrpc_prepare($event);
+						}
+					}
+					else
+					{
+						$retval[$j] = $this->cached_events[$j];
+					}
+				}
+			}
+			//echo "store_to_cache(".print_r($params,True).")=<pre>".print_r($retval,True)."</pre>\n";
+			//$this->so->cal->event = $cached_event;
+			return $retval;
+		}
+
+		function xmlrpc_prepare(&$event)
+		{
+			$event['rights'] = $this->grants[$event['owner']];
+
+			foreach(array('start','end','modtime','recur_enddate') as $name)
+			{
+				if (isset($event[$name]))
+				{
+					$event[$name] = $GLOBALS['server']->date2iso8601($event[$name]);
+				}
+			}
+			if (is_array($event['recur_exception']))
+			{
+				foreach($event['recur_exception'] as $key => $timestamp)
+				{
+					$event['recur_exception'][$key] = $GLOBALS['server']->date2iso8601($timestamp);
+				}
+			}
+			static $user_cache = array();
+
+			if (!is_object($GLOBALS['phpgw']->perferences))
+			{
+				$GLOBALS['phpgw']->perferences = CreateObject('phpgwapi.preferences');
+			}
+			foreach($event['participants'] as $user_id => $status)
+			{
+				if (!isset($user_cache[$user_id]))
+				{
+					$user_cache[$user_id] = array(
+						'name'   => $GLOBALS['phpgw']->common->grab_owner_name($user_id),
+						'email'  => $GLOBALS['phpgw']->perferences->email_address($user_id)
+					);
+				}
+				$event['participants'][$user_id] = $user_cache[$user_id] + array(
+					'status' => $status,
+				);
+			}
+			if (is_array($event['alarm']))
+			{
+				foreach($event['alarm'] as $id => $alarm)
+				{
+					$event['alarm'][$id]['time'] = $GLOBALS['server']->date2iso8601($alarm['time']);
+					if ($alarm['owner'] != $GLOBALS['phpgw_info']['user']['account_id'])
+					{
+						unset($event['alarm'][$id]);
+					}
+				}
+			}
+			$event['category'] = $GLOBALS['server']->cats2xmlrpc(explode(',',$event['category']));
+
+			// using access={public|privat} in all modules via xmlrpc
+			$event['access'] = $event['public'] ? 'public' : 'privat';
+			unset($event['public']);
+
+			return $event;
+		}
+
+		/* Begin Appsession Data */
+		function store_to_appsession($event)
+		{
+			$GLOBALS['phpgw']->session->appsession('entry','resources',$event);
+		}
+
+		function restore_from_appsession()
+		{
+//echo "quees";
+			$this->event_init();
+			$event = $GLOBALS['phpgw']->session->appsession('entry','resources');
+//echo "quees".$event;
+			//$this->so->cal->event = $event;
+			return $event;
+		}
+		/* End Appsession Data */
+
+		/* Begin of SO functions */
+		function get_cached_event()
+		{
+			return "";//$this->so->get_cached_event();
+		}
+
+		function add_attribute($var,$value,$index='**(**')
+		{
+			//$this->so->add_attribute($var,$value,$index);
+		}
+
+		function event_init()
+		{
+			//$this->so->event_init();
+		}
+
+		function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			//$this->so->set_start($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			//$this->so->set_end($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_title($title='')
+		{
+			//$this->so->set_title($title);
+		}
+
+		function set_description($description='')
+		{
+			//$this->so->set_description($description);
+		}
+
+		function set_description1($description1='')
+		{
+			//$this->so->set_description1($description1);
+		}
+function set_participants1($participants1='')
+		{
+			//$this->so->set_participants1($participants1);
+		}
+		function set_ex_participants($ex_participants='')
+		{
+			//$this->so->set_ex_participants($ex_participants);
+		}
+
+		function set_class($class)
+		{
+			//$this->so->set_class($class);
+		}
+
+		function set_category($category='')
+		{
+			//$this->so->set_category($category);
+		}
+
+		function set_alarm($alarm)
+		{
+			//$this->so->set_alarm($alarm);
+		}
+
+		function set_recur_none()
+		{
+			//$this->so->set_recur_none();
+		}
+
+		function set_recur_daily($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_daily($year,$month,$day,$interval);
+		}
+
+		function set_recur_weekly($year,$month,$day,$interval,$weekdays)
+		{
+			//$this->so->set_recur_weekly($year,$month,$day,$interval,$weekdays);
+		}
+
+		function set_recur_monthly_mday($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_monthly_mday($year,$month,$day,$interval);
+		}
+
+		function set_recur_monthly_wday($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_monthly_wday($year,$month,$day,$interval);
+		}
+
+		function set_recur_yearly($year,$month,$day,$interval)
+		{
+			//$this->so->set_recur_yearly($year,$month,$day,$interval);
+		}
+		/* End of SO functions */
+
+		function prepare_matrix($interval,$increment,$part,$fulldate)
+		{
+			for($h=0;$h<24;$h++)
+			{
+				for($m=0;$m<$interval;$m++)
+				{
+					$index = (($h * 10000) + (($m * $increment) * 100));
+					$time_slice[$index]['marker'] = '&nbsp';
+					$time_slice[$index]['description'] = '';
+$time_slice[$index]['description1'] = '';
+				}
+			}
+			foreach($this->cached_events[$fulldate] as $event)
+			{
+				if ($event['participants'][$part] == 'R')
+				{
+					continue;	// dont show rejected invitations, as they are free time
+				}
+				$eventstart = $GLOBALS['phpgw']->datetime->localdates($this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset);
+				$eventend = $GLOBALS['phpgw']->datetime->localdates($this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset);
+				$start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100);
+				$starttemp = $this->splittime("$start",False);
+				$subminute = 0;
+				for($m=0;$m<$interval;$m++)
+				{
+					$minutes = $increment * $m;
+					if((int)$starttemp['minute'] > $minutes && (int)$starttemp['minute'] < ($minutes + $increment))
+					{
+						$subminute = ($starttemp['minute'] - $minutes) * 100;
+					}
+				}
+				$start -= $subminute;
+				$end =  ($eventend['hour'] * 10000) + ($eventend['minute'] * 100);
+				$endtemp = $this->splittime("$end",False);
+				$addminute = 0;
+				for($m=0;$m<$interval;$m++)
+				{
+					$minutes = ($increment * $m);
+					if($endtemp['minute'] < ($minutes + $increment) && $endtemp['minute'] > $minutes)
+					{
+						$addminute = ($minutes + $increment - $endtemp['minute']) * 100;
+					}
+				}
+				$end += $addminute;
+				$starttemp = $this->splittime("$start",False);
+				$endtemp = $this->splittime("$end",False);
+
+				for($h=$starttemp['hour'];$h<=$endtemp['hour'];$h++)
+				{
+					$startminute = 0;
+					$endminute = $interval;
+					$hour = $h * 10000;
+					if($h == (int)$starttemp['hour'])
+					{
+						$startminute = ($starttemp['minute'] / $increment);
+					}
+					if($h == (int)$endtemp['hour'])
+					{
+						$endminute = ($endtemp['minute'] / $increment);
+					}
+					$private = $this->is_private($event,$part);
+					$time_display = $GLOBALS['phpgw']->common->show_date($eventstart['raw'],$this->users_timeformat).'-'.$GLOBALS['phpgw']->common->show_date($eventend['raw'],$this->users_timeformat);
+					$time_description = '('.$time_display.') '.$this->get_short_field($event,$private,'title').$this->display_status($event['participants'][$part]);
+					for($m=$startminute;$m<$endminute;$m++)
+					{
+						$index = ($hour + (($m * $increment) * 100));
+						$time_slice[$index]['marker'] = '-';
+						$time_slice[$index]['description'] = $time_description;
+						$time_slice[$index]['id'] = $event['id'];
+					}
+				}
+			}
+			return $time_slice;
+		}
+
+		/*!
+		@function set_status
+		@abstract set the participant response $status for event $cal_id and notifies the owner of the event
+		*/
+		function set_status($cal_id,$status)
+		{
+			$status2msg = array(
+				REJECTED  => MSG_REJECTED,
+				TENTATIVE => MSG_TENTATIVE,
+				ACCEPTED  => MSG_ACCEPTED
+			);
+			if (!isset($status2msg[$status]))
+			{
+				return False;
+			}
+			$event = "";//$this->so->read_entry($cal_id);
+			$account_id = $GLOBALS['phpgw_info']['user']['account_id'];
+			if(($status2msg[$status] == "5" && $event['participants'][$account_id] == "A") ||
+			 ($status2msg[$status] == "3" && $event['participants'][$account_id] == "R")) {
+				return True;
+			}
+			//$this->so->set_status($cal_id,$status);
+			$event = "";//$this->so->read_entry($cal_id);
+			$this->send_update($status2msg[$status],$event['participants'],$event);
+
+		}
+
+		/*!
+		@function update_requested
+		@abstract checks if $userid has requested (in $part_prefs) updates for $msg_type
+		@syntax update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event)
+		@param $userid numerical user-id
+		@param $part_prefs preferces of the user $userid
+		@param $msg_type type of the notification: MSG_ADDED, MSG_MODIFIED, MSG_ACCEPTED, ...
+		@param $old_event Event before the change
+		@param $new_event Event after the change
+		@returns 0 = no update requested, > 0 update requested
+		*/
+		function update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event)
+		{
+			if ($msg_type == MSG_ALARM)
+			{
+				return True;	// always True for now
+			}
+			$want_update = 0;
+
+			// the following switch fall-through all cases, as each included the following too
+			//
+			$msg_is_response = $msg_type == MSG_REJECTED || $msg_type == MSG_ACCEPTED || $msg_type == MSG_TENTATIVE;
+
+			switch($ru = $part_prefs['resources']['receive_updates'])
+			{
+				case 'responses':
+					if ($msg_is_response)
+					{
+						++$want_update;
+					}
+				case 'modifications':
+					if ($msg_type == MSG_MODIFIED)
+					{
+						++$want_update;
+					}
+				case 'time_change_4h':
+				case 'time_change':
+					$diff = max(abs($this->maketime($old_event['start'])-$this->maketime($new_event['start'])),
+						abs($this->maketime($old_event['end'])-$this->maketime($new_event['end'])));
+					$check = $ru == 'time_change_4h' ? 4 * 60 * 60 - 1 : 0;
+					if ($msg_type == MSG_MODIFIED && $diff > $check)
+					{
+						++$want_update;
+					}
+				case 'add_cancel':
+					if ($old_event['owner'] == $userid && $msg_is_response ||
+						$msg_type == MSG_DELETED || $msg_type == MSG_ADDED)
+					{
+						++$want_update;
+					}
+					break;
+				case 'no':
+					break;
+			}
+			//echo "<p>boresources::update_requested(user=$userid,pref=".$part_prefs['resources']['receive_updates'] .",msg_type=$msg_type,".($old_event?$old_event['title']:'False').",".($old_event?$old_event['title']:'False').") = $want_update</p>\n";
+			return $want_update > 0;
+		}
+
+	function create_vcard($event_array)
+	{
+	if(!is_array($event_array))
+		return null;
+	$tmpattach="BEGIN:Vresources\n"
+	."PRODID:-//Expresso Livre//resources//EN\n"
+	."VERSION:1.0\n";
+		foreach ($event_array as $event)
+		{
+			// It translates int to string
+			if (!is_object($event) && !is_array($event) || !array_key_exists  ('end', $event))
+				$event = $event_array;
+			if ( $event['end']['month'] < 10 )
+				$end_event_month="0".$event['end']['month'];
+			else
+				$end_event_month=$event['end']['month'];
+			if ( $event['start']['month'] < 10 )
+				$start_event_month="0".$event['start']['month'];
+			else
+				$start_event_month=$event['start']['month'];
+			if ( $event['end']['mday'] < 10 )
+				$end_event_day="0".$event['end']['mday'];
+			else
+				$end_event_day=$event['end']['mday'];
+			if ( $event['start']['mday'] < 10 )
+				$start_event_day="0".$event['start']['mday'];
+			else
+				$start_event_day=$event['start']['mday'];
+			if ( $event['start']['hour'] < 10)
+				$start_event_hour="0".$event['start']['hour'];
+			else
+				$start_event_hour=$event['start']['hour'];
+			if ( $event['end']['hour'] < 10)
+				$end_event_hour="0".$event['end']['hour'];
+			else
+				$end_event_hour=$event['end']['hour'];
+				
+			if ( $event['start']['min'] < 10)
+				$start_event_min="0".$event['start']['min'];
+			else
+				$start_event_min=$event['start']['min'];
+			if ( $event['end']['min'] < 10)
+				$end_event_min="0".$event['end']['min'];
+			else
+				$end_event_min=$event['end']['min'];	
+		
+
+			$tmpattach.="BEGIN:VEVENT\n"
+			."DTSTART:".$event['start'][year].$start_event_month.$start_event_day."T".$start_event_hour.$start_event_min."00Z\n"
+			."DTEND:".$event[end][year].$end_event_month.$end_event_day."T".$end_event_hour.$end_event_min."00Z\n"
+			."UID:Expresso-".$event[id].$event[uid]."\n"
+			."LAST-MODIFIED:".time()."\n"
+			."DESCRIPTION:".$event[description]."\n"
+."DESCRIPTION1:".$event[description1]."\n"
+."PARTICIPANTS1:".$event[participants1]."\n"
+			."SUMMARY:".$event[title]."\n"
+			."LOCATION:".$event[location]."\n"
+			."END:VEVENT"."\n";
+		}
+			$tmpattach.="END:Vresources\n";
+			return $tmpattach;
+}
+
+		/*!
+		@function send_update
+		@abstract sends update-messages to certain participants of an event
+		@syntax send_update($msg_type,$to_notify,$old_event,$new_event=False)
+		@param $msg_type type of the notification: MSG_ADDED, MSG_MODIFIED, MSG_ACCEPTED, ...
+		@param $to_notify array with numerical user-ids as keys (!) (value is not used)
+		@param $old_event Event before the change
+		@param $new_event Event after the change
+		*/
+		function send_update($msg_type,$to_notify,$old_event,$new_event=False,$user=False)
+		{
+			
+			//echo "<p>boresources::send_update(type=$msg_type,to_notify="; print_r($to_notify); echo ", old_event="; print_r($old_event); echo ", new_event="; print_r($new_event); echo ", user=$user)</p>\n";
+			if (!is_array($to_notify))
+			{
+				$to_notify = array();
+			}
+			$owner = $old_event ? $old_event['owner'] : $new_event['owner'];
+			if ($owner && !isset($to_notify[$owner]) && $msg_type != MSG_ALARM)
+			{
+				$to_notify[$owner] = 'owner';	// always include the event-owner
+			}
+			$version = $GLOBALS['phpgw_info']['apps']['resources']['version'];
+
+			$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences();
+			$sender = $GLOBALS['phpgw_info']['user']['email'];
+
+			$temp_tz_offset = $this->prefs['common']['tz_offset'];
+			$temp_timeformat = $this->prefs['common']['timeformat'];
+			$temp_dateformat = $this->prefs['common']['dateformat'];
+
+			$tz_offset = ((60 * 60) * (int)$temp_tz_offset);
+
+			if($old_event != False)
+			{
+				$t_old_start_time = $this->maketime($old_event['start']);
+				if($t_old_start_time < (time() - 86400))
+				{
+					return False;
+				}
+			}
+
+			$temp_user = $GLOBALS['phpgw_info']['user'];
+
+			if (!$user)
+			{
+				$user = $this->owner;
+			}
+			$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences($user);
+
+			$event = $msg_type == MSG_ADDED || $msg_type == MSG_MODIFIED ? $new_event : $old_event;
+			if($old_event != False)
+			{
+				$old_starttime = $t_old_start_time - $GLOBALS['phpgw']->datetime->tz_offset;
+			}
+			$starttime = $this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$endtime   = $this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+			switch($msg_type)
+			{
+				case MSG_DELETED:
+					$action = lang('Canceled');
+					$msg = 'Canceled';
+					$msgtype = '"resources";';
+					$method = 'cancel';
+					$typesend = 1;
+					break;
+				case MSG_MODIFIED:
+					$action = lang('Modified');
+					$msg = 'Modified';
+					$msgtype = '"resources"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
+					$method = 'request';
+					$typesend = 2;
+					break;
+				case MSG_ADDED:
+					$action = lang('Added');
+					$msg = 'Added';
+					$msgtype = '"resources"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
+					$method = 'request';
+					$typesend = 3;
+					break;
+				case MSG_REJECTED:
+					$action = lang('Rejected');
+					$msg = 'Response';
+					$msgtype = '"resources";';
+					$method = 'reply';
+					$typesend = 4;
+					break;
+				case MSG_TENTATIVE:
+					$action = lang('Tentative');
+					$msg = 'Response';
+					$msgtype = '"resources";';
+					$method = 'reply';
+					$typesend = 5;
+					break;
+				case MSG_ACCEPTED:
+					$action = lang('Accepted');
+					$msg = 'Response';
+					$msgtype = '"resources";';
+					$method = 'reply';
+					$typesend = 6;
+					break;
+				case MSG_ALARM:
+					$action = lang('Alarm');
+					$msg = 'Alarm';
+					$msgtype = '"resources";';
+					$method = 'publish';	// duno if thats right
+					$typesend = 7;
+					break;
+				default:
+					$method = 'publish';
+					$typesend = 8;
+			}
+			$notify_msg = $this->prefs['resources']['notify'.$msg];
+			if (empty($notify_msg))
+			{
+				$notify_msg = $this->prefs['resources']['notifyAdded'];	// use a default
+			}
+			$details = array(			// event-details for the notify-msg
+				'id'          => $msg_type == MSG_ADDED ? $new_event['id'] : $old_event['id'],
+				'action'      => $action,
+			);
+			$event_arr = $this->event2array($event);
+			foreach($event_arr as $key => $val)
+			{
+				$details[$key] = $val['data'];
+			}
+			
+			$details['participants'] = implode("\n",$details['participants']);
+
+			$details['link'] = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=resources.uiresources.view&cal_id='.$event['id'];
+			// if url is only a path, try guessing the rest ;-)
+			if ($GLOBALS['phpgw_info']['server']['webserver_url'][0] == '/')
+			{
+				$details['link'] = ($GLOBALS['phpgw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
+					($GLOBALS['phpgw_info']['server']['hostname'] ? $GLOBALS['phpgw_info']['server']['hostname'] : 'localhost').
+					$details['link'];
+			}
+			
+			//Seta o email usando phpmailer
+			define('PHPGW_INCLUDE_ROOT','../');	
+			define('PHPGW_API_INC','../phpgwapi/inc');	
+			include_once(PHPGW_API_INC.'/class.phpmailer.inc.php');
+			$mail = new PHPMailer();
+			$mail->IsSMTP();
+			$boemailadmin = CreateObject('emailadmin.bo');
+			$emailadmin_profile = $boemailadmin->getProfileList();
+			$emailadmin = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
+		
+			$mail->Host = $emailadmin['smtpServer'];
+			$mail->Port = $emailadmin['smtpPort'];
+			$mail->From = $GLOBALS['phpgw']->preferences->values['email'];
+			$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+			$mail->IsHTML(true);
+
+			// Aqui ï¿œ enviado o email
+			foreach($to_notify as $userid => $statusid) 
+			{
+			 	$mail->ClearAttachments();
+			 	
+				$userid = (int)$userid;
+
+				if ($statusid == 'R' || $GLOBALS['phpgw']->accounts->get_type($userid) == 'g')
+				{
+					continue;	// dont notify rejected participants
+				}
+				if($userid != $GLOBALS['phpgw_info']['user']['account_id'] ||  $msg_type == MSG_ALARM)
+				{
+					print_debug('Msg Type',$msg_type);
+					print_debug('UserID',$userid);
+
+					$preferences = CreateObject('phpgwapi.preferences',$userid);
+					$part_prefs = $preferences->read_repository();
+
+					if (!$this->update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event))
+					{
+						continue;
+					}
+					$GLOBALS['phpgw']->accounts->get_account_name($userid,$lid,$details['to-firstname'],$details['to-lastname']);
+					$details['to-fullname'] = $GLOBALS['phpgw']->common->display_fullname('',$details['to-firstname'],$details['to-lastname']);
+
+					$to = $preferences->email_address($userid);
+					
+					if (empty($to) || $to[0] == '@' || $to[0] == '$')	// we have no valid email-address
+					{
+						//echo "<p>boresources::send_update: Empty email adress for user '".$details['to-fullname']."' ==> ignored !!!</p>\n";
+						continue;
+					}
+					print_debug('Email being sent to',$to);
+
+					$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $part_prefs['common']['tz_offset'];
+					$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat'];
+					$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat'];
+
+					$GLOBALS['phpgw']->datetime->tz_offset = ((60 * 60) * (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']);
+
+					if($old_starttime)
+					{
+						$details['olddate'] = $GLOBALS['phpgw']->common->show_date($old_starttime);
+					}
+					$details['startdate'] = $GLOBALS['phpgw']->common->show_date($starttime);
+					$details['enddate']   = $GLOBALS['phpgw']->common->show_date($endtime);
+					
+					
+					list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2);
+					
+					switch($part_prefs['resources']['update_format'])
+ 					{
+						case  'extended':
+							//$body .= "\n\n".lang('Event Details follow').":\n";
+							$body = '';
+							$body .= "<br>".lang('Event Details follow')." :: ";
+							foreach($event_arr as $key => $val)
+							{
+								// titulo
+								if($key =='title')
+								{
+									$var1 = $val['field'];
+									$vardata1 = $details[$key];
+								}
+								//descricao
+								if($key =='description')
+								{
+									$var2 = $val['field'];
+									$vardata2 = $details[$key];
+								}
+if($key =='description1')
+								{
+									$var2 = $val['field'];
+									$vardata2 = $details[$key];
+								}
+
+if($key =='participants1')
+								{
+									$var2 = $val['field'];
+									$vardata2 = $details[$key];
+								}
+
+								//dt inicio
+								if($key =='startdate')
+								{
+									switch(trim($part_prefs['common']['dateformat']))
+									{
+										
+										case ($part_prefs['common']['dateformat'] === "m/d/Y" || $part_prefs['common']['dateformat'] === "m-d-Y" || $part_prefs['common']['dateformat'] === "m.d.Y"):
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newmounth3 = substr($vardata3,0,2);
+											$newday3 = substr($vardata3,3,2);
+											$newyear3 = substr($vardata3,6,4);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+											
+										case	($part_prefs['common']['dateformat'] === "Y/d/m" || $part_prefs['common']['dateformat'] === "Y-d-m" || $part_prefs['common']['dateformat'] === "Y.d.m"):
+
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newyear3 = substr($vardata3,0,4);
+											$newday3 = substr($vardata3,5,2);
+											$newmounth3 = substr($vardata3,8,2);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+
+										case ($part_prefs['common']['dateformat'] === "Y/m/d" || $part_prefs['common']['dateformat'] === "Y-m-d" || $part_prefs['common']['dateformat'] === "Y.m.d"):
+
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newyear3 = substr($vardata3,0,4);
+											$newmounth3 = substr($vardata3,5,2);
+											$newday3 = substr($vardata3,8,2);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+
+										case ($part_prefs['common']['dateformat'] === "d/m/Y" || $part_prefs['common']['dateformat'] === "d-m-Y" || $part_prefs['common']['dateformat'] === "d.m.Y" || $part_prefs['common']['dateformat'] === "d-M-Y"):
+										
+											$var3 = $val['field'];
+											$vardata3 = $details[$key];
+											$newday3 = substr($vardata3,0,2);
+											$newmounth3 = substr($vardata3,3,2);
+											$newyear3 = substr($vardata3,6,4);
+											$newall3 =$newyear3.$newmounth3.$newday3;
+											break;
+									
+									}
+									
+								}
+								//dt final
+								if($key =='enddate')
+								{
+									$var4 = $val['field'];
+									$vardata4 = $details[$key];
+								}
+								//localizacao
+								if($key =='location')
+								{
+									$var8 = $val['field'];
+									$vardata8 = $details[$key];
+								}
+								//participantes
+								if($key =='participants')
+								{
+									$var5 = $val['field'];
+									foreach($val['data'] as $NewKey => $NewVal)
+									{
+										//Research inside of ldap ( Pesquisa dentro do ldap )
+										$newvalue = "";//$this->so->search_uidNumber($to);
+										foreach($newvalue as $tmp)
+										{
+											$tmpmail = $tmp['mail'][0];
+											$tmpuid = $tmp['uidnumber'][0];
+											if( trim($tmpmail) == trim($to) & trim($tmpuid) == trim($NewKey))
+											{
+													if($typesend == 3)
+													{
+
+														$lang1 = lang("To See Commitment");
+														$varbuttom = "<form action=".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=resources.uiresources.view&cal_id=$event[id]&date=$newall3' method='POST'>
+																		  		  <input type='submit' value='$lang1'>
+																		  		   </form>";
+														$lang2 = lang("To accept");
+														$varbuttom1 ="<input type='submit' value='$lang2' onClick='javascript:window.open(\"".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=resources.uiresources.set_action&cal_id=$event[id]&action=3&response=1\",\"frontpage\",\"height=100,width=400,statusbar=no,toolbar=no,scrollbars=no,menubar=no,left=300,top=200\")'>";
+
+														$lang3 = lang("To reject");
+														$varbuttom2 ="<input type='submit' value='$lang3' onClick='javascript:window.open(\"".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=resources.uiresources.set_action&cal_id=$event[id]&action=0&response=0\",\"frontpage\",\"height=100,width=400,statusbar=no,toolbar=no,scrollbars=no,menubar=no,left=300,top=200\")'>";
+														
+														$lang4 = lang("Alarm");
+														$varbuttom3 = "<form action=".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=resources.uialarm.manager method='POST'>
+																		  		  <input type='submit' value='$lang4'>
+																		  		  <input type='hidden' name='cal_id' value=$event[id]>
+																		  		   </form>";
+													}
+													else
+													{
+															$varbuttom  = "";
+															$varbuttom1 = "";
+															$varbuttom2 = "";
+															$varbuttom3 = "";
+													}
+											}
+											// It only mounts variavel with the name of the participants of the list ( Monta a variavel somente com o nome dos participantes da lista)
+											if($typesend == 3)
+											{
+												list($tmpvardata5,$tmp2vardata5) = explode("(",$NewVal);
+												$vardata5 = $tmpvardata5."<br>";
+											}
+											else
+											{
+												$vardata5 = $NewVal."<br>";
+											}
+										
+										}
+										$vardata6 .= $vardata5;
+										unset($vardata5);
+									}
+								}		
+							}
+							//To mount the message as text/html (Para montar a mensagem como text/html - /phpgwapi/inc/class.send.inc.php )
+							$content_type = "text/html";
+							//It mounts the body of the message (Monta o corpo da mensagem)
+							
+							// A constante PHPGW_APP_TPL nao existe para envio de alarmes (cront, asyncservice).
+							define ("PHPGW_APP_TPL",PHPGW_API_INC . "/../../resources/templates/".$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']."");
+							
+							$body = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+							$body->set_file(Array('resources' => 'body_email.tpl'));
+							$body->set_block('resources','list');
+							$var = Array(
+								'script'			=> $script,
+								'subject'			=> $body1,
+								'var1'				=> $var1,
+								'vardata1'			=> $vardata1,
+								'var2'				=> $var2,
+								'vardata2'			=> $vardata2,
+								'var3'				=> $var3,
+								'vardata3'			=> $vardata3,
+								'var4'				=> $var4,
+								'vardata4'			=> $vardata4,
+								'var5'				=> $var5,
+								'vardata6'			=> $vardata6,
+								'var8'				=> $var8,
+								'vardata8'			=> $vardata8,							
+								'varbuttom'			=> $varbuttom,
+								'varbuttom1'		=> $varbuttom1,
+								'varbuttom2'		=> $varbuttom2,
+								'varbuttom3'		=> $varbuttom3 
+								
+							);
+							$body->set_var($var);
+							$tmpbody = $body->fp('out','list');
+														
+							break;
+
+						case 'ical':
+							$content_type = "resources; method=$method; name=resources.ics";
+/*							if ($body != '')
+							{
+								$boundary = '----Message-Boundary';
+								$body .= "\n\n\n$boundary\nContent-type: text/$content_type\n".
+									"Content-Disposition: inline\nContent-transfer-encoding: 7BIT\n\n";
+								$content_type = '';
+							}
+*/
+							$body = ExecMethod('resources.boiresources.export',array(
+								'l_event_id'  => $event['id'],
+								'method'      => $method,
+								'chunk_split' => False
+							));
+							break;
+					}
+					$mail->AddAddress($to);
+					$mail->Body = $tmpbody;
+					$mail->From = $sender;
+					$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+					$mail->Sender = $mail->From;
+					$mail->SenderName = $mail->FromName;
+					$mail->Subject = $subject;
+					unset($vardata5);
+					unset($vardata6);
+				}
+			}
+
+			//Inicializa variï¿œvel de retorno.
+			$returncode=true;			
+			if(count($mail->to)) {				
+				// Envia aviso a todos os participantes.
+				if(!$mail->Send()) {				
+					$returncode = false;
+					$errorInfo['participants'] = $mail->ErrorInfo;
+				}
+				else
+					$returncode =  true;
+			}
+			
+			if(count($to_notify) && $this->ex_participants){
+				$mail->ClearAllRecipients();
+				$var = explode(",",trim($this->ex_participants));
+				$to = array();
+				if(!$subject) {
+					$details['startdate'] = $GLOBALS['phpgw']->common->show_date($starttime);
+					$details['enddate']   = $GLOBALS['phpgw']->common->show_date($endtime);
+					list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2);
+				}
+				
+				foreach($var as $index => $ex_participant){
+					$ex_participant = trim($ex_participant);
+					$ex_participant = preg_replace('#"(.*)" <(.*)\@(.*)\.(.*)>#','\\2@\\3.\\4',$ex_participant);
+						if($ex_participant)
+							$to[] = $ex_participant;
+				}		
+				
+				foreach($to as $i => $to_array)
+					$mail->AddAddress($to_array);
+				
+				$_body = explode("<hr size='1' width='100%'>",$tmpbody);
+				$tmpbody = $_body[0] ? $_body[0] : $subject ;
+				$tmpbody.= "<br><b>".lang("external participants").":: </b> ".htmlentities($this->ex_participants);
+				$tmpbody.= "<br>".lang("Summary").": "."";//$this->so->cal->event[title]."<br>";
+				$tmpbody.= "<br>".lang("Start time").": ".$GLOBALS['phpgw']->common->show_date($starttime)."<br>".lang("End date").": ".$GLOBALS['phpgw']->common->show_date($endtime)."<br>";
+				$tmpbody.= "<br><br><hr size='1' width='100%'><font color='red'>"
+				.lang("This message was sent by server. You must send a message to sender to confirm this event")."<br>"
+				.lang("This is an external event. Even if it added to your expresso its can be changed any time at all")."</font><br>";
+				
+				if ($GLOBALS['boresources']->so->cal->event[start][month] > 10)
+					$event_month=$GLOBALS['boresources']->so->cal->event[start][month];
+				else
+					$event_month="0".$GLOBALS['boresources']->so->cal->event[start][month];
+				//attach extern vcard			
+				// define('context','$GLOBALS.boresources.so.cal.event');
+				$tmpattach = $this->create_vcard($GLOBALS['boresources']->so->cal->event);
+				if($tmpattach){					
+					$tmpbody .="<a href='../index.php?menuaction=resources.uiresources.add&date="
+					.$GLOBALS['boresources']->so->cal->event[start][year]
+				.$event_month
+				.$GLOBALS['boresources']->so->cal->event[start][mday]
+					."&hour=".$GLOBALS['boresources']->so->cal->event[start][hour]
+					."&minute=".$GLOBALS['boresources']->so->cal->event[start][min]
+					."&title=".$GLOBALS['boresources']->so->cal->event['title']
+					."&description=".$GLOBALS['boresources']->so->cal->event['description']
+."&description1=".$GLOBALS['boresources']->so->cal->event['description1']
+."&participants1=".$GLOBALS['boresources']->so->cal->event['participants1']
+					."&location=".$GLOBALS['boresources']->so->cal->event['location']."'>"
+					."<h2>".lang("Add to my expresso")."</h2>";
+					$tempdir = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP;
+					srand((double)microtime()*1000000);
+					$random_number = rand(100000000,999999999);
+					$newfilename = md5(time() . getenv("REMOTE_ADDR") . $random_number );
+					$filename = $tempdir . $newfilename;
+					$attach_fd = fopen($filename,"w+");
+					fwrite($attach_fd,$tmpattach);
+					$mail->AddAttachment($filename, "extern.vcard", "base64", "text/plain"); // "application/octet-stream"
+					fclose($attach_fd);
+				}
+				$mail->From = $sender;
+				$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+				$mail->Sender = $mail->From;
+				$mail->SenderName = $mail->FromName;
+				$mail->Subject = lang("External event from Expresso");
+				$mail->Body = $tmpbody;
+																		
+				if(!$mail->Send()) 
+				{
+					$returncode=false;
+					$errorInfo['ex_participants'] = $mail->ErrorInfo;
+				}
+				else
+				{
+					$returncode=true;
+				}
+			}
+
+
+			if((is_int($this->user) && $this->user != $temp_user['account_id']) ||
+				(is_string($this->user) && $this->user != $temp_user['account_lid']))
+			{
+				$GLOBALS['phpgw_info']['user'] = $temp_user;
+			}	
+
+			$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $temp_tz_offset;
+			$GLBOALS['phpgw']->datetime->tz_offset = ((60 * 60) * $temp_tz_offset);
+			$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $temp_timeformat;
+			$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
+			
+			// Notifica por email o criador do compromisso, com as possï¿œveis falhas.						
+			if($errorInfo) {
+				$tmpbody = "<font color='red'>".lang("The following commitment had problems for DELIVERING the NOTIFICATION messages.").".</font><br>";
+				$tmpbody.= "<br>".lang("Summary").": "."";//$this->so->cal->event[title]."<br>";
+				$tmpbody.= "<br>".lang("Start time").": ".$GLOBALS['phpgw']->common->show_date($starttime)."<br>".lang("End date").": ".$GLOBALS['phpgw']->common->show_date($endtime)."<br>";				
+				$tmpbody.= "<br><u>".lang("Failed to delivery")."</u><br>";
+				$failed = false;				
+				if(strstr($errorInfo['participants'],"recipients_failed")){
+					$failed	= explode("recipients_failed",$errorInfo['participants']);
+					$tmpbody.= lang("to").": ".$failed[1];
+				}
+				if(strstr($errorInfo['ex_participants'],"recipients_failed")){
+					$failed = explode("recipients_failed",$errorInfo['ex_participants']);
+					$tmpbody.= lang("to").": ".$failed[1];
+				}			
+				if(!$failed) {
+					$tmpbody.= lang("Description").":<br>";
+$tmpbody.= lang("Description1").":<br>";
+$tmpbody.= lang("participants1").":<br>";
+					$tmpbody.= $errorInfo['participants'];
+					$tmpbody.= "<br>".$errorInfo['ex_participants'];
+				}
+				$tmpbody.= "<br>".lang("Subject").": ".$subject;
+				// Reinicializa o objeto, devido ao erro anterior na entrega.
+				
+				$mail = new PHPMailer();
+				$mail->IsSMTP();
+				$mail->Host = $emailadmin['smtpServer'];
+				$mail->Port = $emailadmin['smtpPort'];
+				$mail->From = $sender;
+				$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
+				$mail->Sender = $mail->From;
+				$mail->SenderName = $mail->FromName;
+				$mail->IsHTML(True);
+				$mail->Subject = lang("resources event")." - ".lang("email notification");							
+				$mail->Body = $tmpbody;					
+				$mail->AddAddress($sender);
+				if(!$mail->Send())			
+					$returncode = false;
+				else
+					$returncode =  true;
+			}
+			return $returncode;
+		}
+		
+		function send_alarm($alarm)
+		{
+			//echo "<p>boresources::send_alarm("; print_r($alarm); echo ")</p>\n";
+			
+			$GLOBALS['phpgw_info']['user']['account_id'] = $this->owner = $alarm['owner'];
+
+			if (!$alarm['enabled'] || !$alarm['owner'] || !$alarm['cal_id'] )
+			{
+				return False;	// event not found
+			}
+			if ($alarm['all'])
+			{
+				$to_notify = $event['participants'];
+			}
+			elseif ($this->check_perms(PHPGW_ACL_READ,$event))	// checks agains $this->owner set to $alarm[owner]
+			{
+				$to_notify[$alarm['owner']] = 'A';
+			}
+			else
+			{
+				return False;	// no rights
+			}
+			return $this->send_update(MSG_ALARM,$to_notify,$event,False,$alarm['owner']);
+		}
+
+		function get_alarms($event_id)
+		{
+			return "";//$this->so->get_alarm($event_id);
+		}
+
+		function alarm_today($event,$today,$starttime)
+		{
+			$found = False;
+			@reset($event['alarm']);
+			$starttime_hi = $GLOBALS['phpgw']->common->show_date($starttime,'Hi');
+			$t_appt['month'] =$GLOBALS['phpgw']->common->show_date($today,'m');
+			$t_appt['mday'] = $GLOBALS['phpgw']->common->show_date($today,'d');
+			$t_appt['year'] = $GLOBALS['phpgw']->common->show_date($today,'Y');
+			$t_appt['hour'] = $GLOBALS['phpgw']->common->show_date($starttime,'H');
+			$t_appt['min']  = $GLOBALS['phpgw']->common->show_date($starttime,'i');
+			$t_appt['sec']  = 0;
+			$t_time = $this->maketime($t_appt) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$y_time = $t_time - 86400;
+			$tt_time = $t_time + 86399;
+			print_debug('T_TIME',$t_time.' : '.$GLOBALS['phpgw']->common->show_date($t_time));
+			print_debug('Y_TIME',$y_time.' : '.$GLOBALS['phpgw']->common->show_date($y_time));
+			print_debug('TT_TIME',$tt_time.' : '.$GLOBALS['phpgw']->common->show_date($tt_time));
+			while(list($key,$alarm) = each($event['alarm']))
+			{
+				if($alarm['enabled'])
+				{
+					print_debug('TIME',$alarm['time'].' : '.$GLOBALS['phpgw']->common->show_date($alarm['time']).' ('.$event['id'].')');
+					if($event['recur_type'] != MCAL_RECUR_NONE)   /* Recurring Event */
+					{
+						print_debug('Recurring Event');
+						if($alarm['time'] > $y_time && $GLOBALS['phpgw']->common->show_date($alarm['time'],'Hi') < $starttime_hi && $alarm['time'] < $t_time)
+						{
+							$found = True;
+						}
+					}
+					elseif($alarm['time'] > $y_time && $alarm['time'] < $t_time)
+					{
+						$found = True;
+					}
+				}
+			}
+			print_debug('Found',$found);
+			return $found;
+		}
+
+		function prepare_recipients(&$new_event,$old_event)
+		{
+						
+			// Find modified and deleted users.....
+			while(list($old_userid,$old_status) = each($old_event['participants']))
+			{
+				if(isset($new_event['participants'][$old_userid]))
+				{
+					print_debug('Modifying event for user',$old_userid);
+					$this->modified[(int)$old_userid] = $new_status;
+				}
+				else
+				{
+					print_debug('Deleting user from the event',$old_userid);
+					$this->deleted[(int)$old_userid] = $old_status;
+				}
+			}
+			// Find new users.....
+			while(list($new_userid,$new_status) = each($new_event['participants']))
+			{
+				if(!isset($old_event['participants'][$new_userid]))
+				{
+					print_debug('Adding event for user',$new_userid);
+					$this->added[$new_userid] = 'U';
+					$new_event['participants'][$new_userid] = 'U';
+				}
+			}
+			
+			if(count($this->added) > 0 || count($this->modified) > 0 || count($this->deleted) > 0)
+			{
+				if(count($this->added) > 0)
+				{
+					$this->ex_participants = '';
+					$this->send_update(MSG_ADDED,$this->added,'',$new_event);
+				}
+				if(count($this->modified) > 0)
+				{
+					$this->send_update(MSG_MODIFIED,$this->modified,$old_event,$new_event);
+				}
+				if(count($this->deleted) > 0)
+				{
+					$this->ex_participants = '';
+					$this->send_update(MSG_DELETED,$this->deleted,$old_event);
+				}
+			}
+		}
+
+		function remove_doubles_in_cache($firstday,$lastday)
+		{
+			$already_moved = Array();
+			for($v=$firstday;$v<=$lastday;$v++)
+			{
+				if (!$this->cached_events[$v])
+				{
+					continue;
+				}
+				$cached = $this->cached_events[$v];
+				$this->cached_events[$v] = array();
+				while (list($g,$event) = each($cached))
+				{
+					$end = date('Ymd',$this->maketime($event['end']));
+					print_debug('EVENT',_debug_array($event,False));
+					print_debug('start',$start);
+					print_debug('v',$v);
+
+					if (!isset($already_moved[$event['id']]) || $event['recur_type'] && $v > $end)
+					{
+						$this->cached_events[$v][] = $event;
+						$already_moved[$event['id']] = 1;
+						print_debug('Event moved');
+					}
+				}
+			}
+		}
+
+		function get_dirty_entries($lastmod=-1)
+		{
+			$events = false;
+			$event_ids = "";//$this->so->cal->list_dirty_events($lastmod);
+			if(is_array($event_ids))
+			{
+				foreach($event_ids as $key => $id)
+				{
+					$events[$id] = "";//$this->so->cal->fetch_event($id);
+				}
+			}
+			unset($event_ids);
+
+			$rep_event_ids = "";//$this->so->cal->list_dirty_events($lastmod,$true);
+			if(is_array($rep_event_ids))
+			{
+				foreach($rep_event_ids as $key => $id)
+				{
+					$events[$id] = "";//$this->so->cal->fetch_event($id);
+				}
+			}
+			unset($rep_event_ids);
+
+			return $events;
+		}
+
+		function _debug_array($data)
+		{
+			echo '<br>UI:';
+			_debug_array($data);
+		}
+
+		/*!
+		@function rejected_no_show
+		@abstract checks if event is rejected from user and he's not the owner and dont want rejected
+		@param $event to check
+		@returns True if event should not be shown
+		*/
+		function rejected_no_show($event)
+		{
+			$ret = !$this->prefs['resources']['show_rejected'] &&
+				$event['owner'] != $this->owner &&
+				$event['participants'][$this->owner] == 'R';
+			//echo "<p>rejected_no_show($event[title])='$ret': user=$this->owner, event-owner=$event[owner], status='".$event['participants'][$this->owner]."', show_rejected='".$this->prefs['resources']['show_rejected']."'</p>\n";
+			return $ret;
+		}
+
+		/* This is called only by list_cals().  It was moved here to remove fatal error in php5 beta4 */
+		function list_cals_add($id,&$users,&$groups)
+		{
+			$name = $GLOBALS['phpgw']->common->grab_owner_name($id);
+			if (($type = $GLOBALS['phpgw']->accounts->get_type($id)) == 'g')
+			{
+				$arr = &$groups;
+			}
+			else
+			{
+				$arr = &$users;
+			}
+			$arr[$name] = Array(
+				'grantor' => $id,
+				'value'   => ($type == 'g' ? 'g_' : '') . $id,
+				'name'    => $name
+			);
+		}
+
+		/*!
+		@function list_cals
+		@abstract generate list of user- / group-resourcess for the selectbox in the header
+		@returns alphabeticaly sorted array with groups first and then users
+		*/
+		function list_cals()
+		{
+			$users = $groups = array();
+			foreach($this->grants as $id => $rights)
+			{
+				$this->list_cals_add($id,$users,$groups);
+			}
+			
+			//by JakJr, melhora de performance na abertura da agenda
+			/*if ($memberships = $GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']))
+			{
+				foreach($memberships as $group_info)
+				{
+					$this->list_cals_add($group_info['account_id'],$users,$groups);
+
+					if ($account_perms = $GLOBALS['phpgw']->acl->get_ids_for_location($group_info['account_id'],PHPGW_ACL_READ,'resources'))
+					{
+						foreach($account_perms as $id)
+						{
+							$this->list_cals_add($id,$users,$groups);
+						}
+					}
+				}
+			}*/
+			uksort($users,'strnatcasecmp');
+			uksort($groups,'strnatcasecmp');
+
+			return $users + $groups;	// users first and then groups, both alphabeticaly
+		}
+
+	  function translate($key,$vars=false, $not_found='*' )
+	  {
+    	    if ($this->async)
+	      return $GLOBALS['phpgw']->translation->translate_async($key, $vars);
+	    return lang($key, $vars);
+	  }
+
+		/*!
+		@function event2array
+		@abstract create array with name, translated name and readable content of each attributes of an event
+		@syntax event2array($event,$sep='<br>')
+		@param $event event to use
+		@returns array of attributes with fieldname as key and array with the 'field'=translated name \
+			'data' = readable content (for participants this is an array !)
+		*/
+		function event2array($event)
+		{
+			
+			
+		  $var['title'] = Array(
+				'field'		=> $this->translate('Title'),
+				'data'		=> $event['title']
+			);
+
+			// Some browser add a \n when its entered in the database. Not a big deal
+			// this will be printed even though its not needed.
+			$var['description'] = Array(
+				'field'	=> $this->translate('Description'),
+				'data'	=> $event['description']
+			);
+$var['description1'] = Array(
+				'field'	=> $this->translate('Description1'),
+				'data'	=> $event['description1']
+			);
+
+
+$var['participants1'] = Array(
+				'field'	=> $this->translate('participants1'),
+				'data'	=> $event['participants1']
+			);
+
+			$var['ex_participants'] = Array(
+				'field'	=> $this->translate('External Participants'),
+				'data'	=> $event['ex_participants']
+			);
+			
+			$cats = Array();
+			$this->cat->categories($this->bo->owner,'resources');
+			if(strpos($event['category'],','))
+			{
+				$cats = explode(',',$event['category']);
+			}
+			else
+			{
+				$cats[] = $event['category'];
+			}
+			foreach($cats as $cat_id)
+			{
+				list($cat) = $this->cat->return_single($cat_id);
+				$cat_string[] = $cat['name'];
+			}
+			$var['category'] = Array(
+				'field'	=> $this->translate('Category'),
+				'data'	=> implode(', ',$cat_string)
+			);
+
+			$var['location'] = Array(
+				'field'	=> $this->translate('Location'),
+				'data'	=> $event['location']
+			);
+
+			$var['startdate'] = Array(
+				'field'	=> $this->translate('Start Date/Time'),
+				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset),
+			);
+
+			$var['enddate'] = Array(
+				'field'	=> $this->translate('End Date/Time'),
+				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset)
+			);
+
+			$pri = Array(
+				1	=> lang('Low'),
+				2	=> lang('Normal'),
+				3	=> lang('High')
+			);
+			$var['priority'] = Array(
+				'field'	=> lang('Priority'),
+				'data'	=> $pri[$event['priority']]
+			);
+
+			$var['owner'] = Array(
+				'field'	=> lang('Created By'),
+				'data'	=> $GLOBALS['phpgw']->common->grab_owner_name($event['owner'])
+			);
+
+			$var['updated'] = Array(
+				'field'	=> lang('Updated'),
+				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['modtime']) - $GLOBALS['phpgw']->datetime->tz_offset)
+			);
+
+			$var['access'] = Array(
+				'field'	=> lang('Access'),
+				'data'	=> $event['public'] ? lang('Public') : lang('Private')
+			);
+
+			if(@isset($event['groups'][0]))
+			{
+				$cal_grps = '';
+				for($i=0;$i<count($event['groups']);$i++)
+				{
+					if($GLOBALS['phpgw']->accounts->exists($event['groups'][$i]))
+					{
+						$cal_grps .= ($i>0?'<br>':'').$GLOBALS['phpgw']->accounts->id2name($event['groups'][$i]);
+					}
+				}
+
+				$var['groups'] = Array(
+					'field'	=> lang('Groups'),
+					'data'	=> $cal_grps
+				);
+			}
+
+			$participants = array();
+			foreach($event['participants'] as $user => $short_status)
+			{
+				if($GLOBALS['phpgw']->accounts->exists($user))
+				{
+					$participants[$user] = $GLOBALS['phpgw']->common->grab_owner_name($user).' ('.$this->get_long_status($short_status).')';
+				}
+			}
+			$var['participants'] = Array(
+				'field'	=> $this->translate('Participants'),
+				'data'	=> $participants
+			);
+
+			// Repeated Events
+			if($event['recur_type'] != MCAL_RECUR_NONE)
+			{
+				$str = lang($this->rpt_type[$event['recur_type']]);
+
+				$str_extra = array();
+				if ($event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['month'] != 0 && $event['recur_enddate']['year'] != 0)
+				{
+					$recur_end = $this->maketime($event['recur_enddate']);
+					if($recur_end != 0)
+					{
+						$recur_end -= $GLOBALS['phpgw']->datetime->tz_offset;
+						$str_extra[] = lang('ends').': '.lang($GLOBALS['phpgw']->common->show_date($recur_end,'l')).', '.$this->long_date($recur_end).' ';
+					}
+				}
+				// only weekly uses the recur-data (days) !!!
+				if($event['recur_type'] == MCAL_RECUR_WEEKLY)
+				{
+					$repeat_days = array();
+					foreach ($this->rpt_day as $mcal_mask => $dayname)
+					{
+						if ($event['recur_data'] & $mcal_mask)
+						{
+							$repeat_days[] = lang($dayname);
+						}
+					}
+					if(count($repeat_days))
+					{
+						$str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days);
+					}
+				}
+				if($event['recur_interval'] != 0)
+				{
+					$str_extra[] = lang('Interval').': '.$event['recur_interval'];
+				}
+
+				if(count($str_extra))
+				{
+					$str .= ' ('.implode(', ',$str_extra).')';
+				}
+
+				$var['recure_type'] = Array(
+					'field'	=> lang('Repetition'),
+					'data'	=> $str,
+				);
+			}
+
+			if (!isset($this->fields))
+			{
+				$this->custom_fields = CreateObject('resources.bocustom_fields');
+				$this->fields = &$this->custom_fields->fields;
+				$this->stock_fields = &$this->custom_fields->stock_fields;
+			}
+			foreach($this->fields as $field => $data)
+			{
+				if (!$data['disabled'])
+				{
+					if (isset($var[$field]))
+					{
+						$sorted[$field] = $var[$field];
+					}
+					elseif (!isset($this->stock_fields[$field]) && strlen($event[$field]))	// Custom field
+					{
+						$lang = lang($name = substr($field,1));
+						$sorted[$field] = array(
+							'field' => $lang == $name.'*' ? $name : $lang,
+							'data'  => $event[$field]
+						);
+					}
+				}
+				unset($var[$field]);
+			}
+			foreach($var as $name => $v)
+			{
+				$sorted[$name] = $v;
+
+			}
+			return $sorted;
+		}
+
+		/*!
+		@function check_set_default_prefs
+		@abstract sets the default prefs, if they are not already set (on a per pref. basis)
+		@note It sets a flag in the app-session-data to be called only once per session
+		*/
+		function check_set_default_prefs()
+		{
+			if (($set = $GLOBALS['phpgw']->session->appsession('default_prefs_set','resources')))
+			{
+				return;
+			}
+			$GLOBALS['phpgw']->session->appsession('default_prefs_set','resources','set');
+
+			//$default_prefs = $GLOBALS['phpgw']->preferences->default['resources']; jakjr
+
+			$subject = $this->translate('resources Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
+			$defaults = array(
+				'defaultresources' => 'week',
+				'mainscreen_showevents' => '0',
+				'summary'         => 'no',
+				'receive_updates' => 'no',
+				'update_format'   => 'extended',	// leave it to extended for now, as iCal kills the message-body
+				'notifyAdded'     => $subject . $this->translate ('You have a meeting scheduled for %1',array('$$startdate$$')),
+				'notifyCanceled'  => $subject . $this->translate ('Your meeting scheduled for %1 has been canceled',array('$$startdate$$')),
+				'notifyModified'  => $subject . $this->translate ('Your meeting that had been scheduled for %1 has been rescheduled to %2',array('$$olddate$$','$$startdate$$')),
+				'notifyResponse'  => $subject . $this->translate ('On %1 %2 %3 your meeting request for %4', array('$$date$$','$$fullname$$','$$action$$','$$startdate$$')),
+				'notifyAlarm'     => $this->translate('Alarm for %1 at %2 in %3',array('$$title$$','$$startdate$$','$$location$$')) . "\n" . $this->translate('Here is your requested alarm.'),
+				'show_rejected'   => '0',
+				'hide_event_conflict'   => '0',
+				'display_status'  => '1',
+				'weekdaystarts'   => 'Monday',
+				'workdaystarts'   => '9',
+				'workdayends'     => '17',
+				'interval'        => '30',
+				'defaultlength'   => '60',
+				'planner_start_with_group' => $GLOBALS['phpgw']->accounts->name2id('Default'),
+				'planner_intervals_per_day'=> '4',
+				'defaultfilter'   => 'all',
+				'default_private' => '0',
+				'display_minicals'=> '1',
+				'print_black_white'=>'0'
+			);
+			foreach($defaults as $var => $default)
+			{
+				if (!isset($default_prefs[$var]) || $default_prefs[$var] == '')
+				{
+					$GLOBALS['phpgw']->preferences->add('resources',$var,$default,'default');
+					$need_save = True;
+				}
+			}
+			if ($need_save)
+			{
+				$prefs = $GLOBALS['phpgw']->preferences->save_repository(False,'default');
+				$this->prefs['resources'] = $prefs['resources'];
+			}
+			if ($this->prefs['resources']['send_updates'] && !isset($this->prefs['resources']['receive_updates']))
+			{
+				$this->prefs['resources']['receive_updates'] = $this->prefs['resources']['send_updates'];
+				$GLOBALS['phpgw']->preferences->add('resources','receive_updates',$this->prefs['resources']['send_updates']);
+				$GLOBALS['phpgw']->preferences->delete('resources','send_updates');
+				$prefs = $GLOBALS['phpgw']->preferences->save_repository();
+			}
+		}
+
+		// return array with all resources categories (for xmlrpc)
+		function categories($complete = False)
+		{
+			return $GLOBALS['server']->categories($complete);
+		}
+/******************************************/
+
+function insert($params='')
+		{
+
+			if($params['from_mobile']) {
+				$ui_return = "mobile.ui_mobileresources.edit";
+				$ui_index = "mobile.ui_mobileresources.index";
+				$ui_overlap = "mobile.ui_mobileresources.overlap";
+			}
+			else {
+				$ui_return = "resources.uiresources.edit";
+				$ui_index = "resources.uiresources.index";		
+				$ui_overlap = "resources.uiresources.overlap";
+			}
+
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+			//$l_cal = (@isset($params['info_type']) && $params['info_type']?$params['info_type']:$_POST['info_type']);
+			$l_participants = (@$params['participants']?$params['participants']:$_POST['participants']);
+			$this->ex_participants = (@$params['ex_participants']?$params['ex_participants']:$_POST['ex_participants']);
+			$l_categories = (@$params['categories']?$params['categories']:$_POST['categories']);
+			$l_start = (@isset($params['start']) && $params['start']?$params['start']:$_POST['start']);
+			$l_end = (@isset($params['end']) && $params['end']?$params['end']:$_POST['end']);
+			$l_recur_enddate = (@isset($params['recur_enddate']) && $params['recur_enddate']?$params['recur_enddate']:$_POST['recur_enddate']);
+
+			
+			$send_to_ui = True;
+			//if ((!is_array($l_start) || !is_array($l_end)) && !isset($_GET['readsess']))	// xmlrpc call
+			if ($this->xmlrpc)	// xmlrpc call
+			{
+
+				$send_to_ui = False;
+
+				$l_cal = $params;	// no extra array
+
+				foreach(array('start','end','recur_enddate') as $name)
+				{
+					$var = 'l_'.$name;
+					$$var = $GLOBALS['server']->iso86012date($params[$name]);
+					unset($l_cal[$name]);
+				}
+
+				if (!is_array($l_participants) || !count($l_participants))
+				{
+					$l_participants = array($GLOBALS['phpgw_info']['user']['account_id'].'A');
+				}
+				else
+				{
+					$l_participants = array();
+					foreach($params['participants'] as $user => $data)
+					{
+						$l_participants[] = $user.$data['status'];
+					}
+				}
+
+				unset($l_cal['participants']);
+
+				if (!is_object($GLOBALS['phpgw']->categories))
+				{
+					$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
+				}
+
+				$l_categories = $GLOBALS['server']->xmlrpc2cats($params['category']);
+				unset($l_cal['category']);
+
+				// using access={public|private} in all modules via xmlrpc
+				$l_cal['public'] = $params['access'] != 'private';
+				unset($l_cal['access']);
+/*
+				$fp = fopen('/tmp/xmlrpc.log','a+');
+				ob_start();
+				echo "\nboresources::update("; print_r($params); echo ")\n";
+				//echo "\nl_start="; print_r($l_start);
+				//echo "\nl_end="; print_r($l_end);
+				fwrite($fp,ob_get_contents());
+				ob_end_clean();
+				fclose($fp);
+*/
+			}
+
+			print_debug('ID',$l_cal['id']);
+
+			// don't wrap to the next day for no time
+			if ($l_end['hour'] == 24 && $l_end['min'] == 0)
+			{
+				$l_end['hour'] = 23;
+				$l_end['min'] = 59;
+			}
+
+			if(isset($_GET['readsess']))
+			{
+
+				$event = $this->restore_from_appsession();
+				$event['title'] = stripslashes($event['title']);
+				$event['description'] = stripslashes($event['description']);
+$event['description1'] = stripslashes($event['description1']);
+$event['participants1'] = stripslashes($event['participants1']);
+				$event['ex_participants'] = stripslashes($event['ex_participants']);
+				$datetime_check = $this->validate_update($event);
+				if($datetime_check)
+				{
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				$overlapping_events = False;
+			}
+			else
+			{
+
+				if((!$l_cal['id'] && !$this->check_perms(PHPGW_ACL_ADD)) ||
+				   ($l_cal['id'] && !$this->check_perms(PHPGW_ACL_EDIT,$l_cal['id'])))
+				{
+
+					if ($this->xmlrpc)
+					{
+						$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
+					}
+					if (!$send_to_ui)
+					{
+						return array(($l_cal['id']?1:2) => 'permission denied');
+					}
+
+					ExecMethod($ui_index);
+
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					else
+						return;
+				}
+
+				print_debug('Prior to fix_update_time()');
+
+				$this->fix_update_time($l_start);
+
+				$this->fix_update_time($l_end);
+
+				if(!isset($l_cal['ex_participants']))
+				{
+					$l_cal['ex_participants'] = $this->ex_participants;
+				}
+
+				if(!isset($l_categories))
+				{
+					$l_categories = 0;
+				}
+
+				$is_public = ($l_cal['type'] != 'private' && $l_cal['type'] != 'privateHiddenFields');
+
+				//$this->so->event_init();
+
+			$this->add_attribute('uid',$l_cal['uid']);
+
+				$this->add_attribute('type',$l_cal['type']);
+
+				if($l_cal['ex_participants']) {
+					$this->add_attribute('ex_participants',$l_cal['ex_participants']);
+				}
+				if(count($l_categories) >= 2)
+				{
+					//$this->so->set_category(implode(',',$l_categories));
+				}
+				else
+				{
+					//$this->so->set_category(strval($l_categories[0]));
+				}
+				/*$this->so->set_title($l_cal['title']);
+				$this->so->set_description($l_cal['description']);
+$this->so->set_description1($l_cal['description1']);
+$this->so->set_participants1($l_cal['participants1']);
+				$this->so->set_ex_participants($l_cal['ex_participants']);
+				$this->so->set_start($l_start['year'],$l_start['month'],$l_start['mday'],$l_start['hour'],$l_start['min'],0);
+				$this->so->set_end($l_end['year'],$l_end['month'],$l_end['mday'],$l_end['hour'],$l_end['min'],0);
+				$this->so->set_class($is_public);
+				$this->so->add_attribute('reference',(@isset($l_cal['reference']) && $l_cal['reference']?$l_cal['reference']:0));
+				$this->so->add_attribute('location',(@isset($l_cal['location']) && $l_cal['location']?$l_cal['location']:''));*/
+				if($l_cal['id'])
+				{
+					//$this->so->add_attribute('id',$l_cal['id']);
+				}
+
+				if($l_cal['rpt_use_end'] != 'y')
+				{
+					$l_recur_enddate['year'] = 0;
+					$l_recur_enddate['month'] = 0;
+					$l_recur_enddate['mday'] = 0;
+				}
+				elseif (isset($l_recur_enddate['str']))
+				{
+					$l_recur_enddate = $this->jscal->input2date($l_recur_enddate['str'],False,'mday');
+				}
+
+				switch((int)$l_cal['recur_type'])
+				{
+
+
+					case MCAL_RECUR_NONE:
+						//$this->so->set_recur_none();
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						break;
+					case MCAL_RECUR_DAILY:
+						//$this->so->set_recur_daily((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_WEEKLY:
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+
+						foreach(array('rpt_sun','rpt_mon','rpt_tue','rpt_wed','rpt_thu','rpt_fri','rpt_sat') as $rpt_day)
+						{
+							$l_cal['recur_data'] += (int)$l_cal[$rpt_day];
+						}
+						if (is_array($l_cal['rpt_day']))
+						{
+							foreach ($l_cal['rpt_day'] as $mask)
+							{
+								$l_cal['recur_data'] |= (int)$mask;
+								$rpt_wdays = $l_cal['recur_data']; // recebe os dias da semana (somatorio) para repetir o alarme;
+							}
+						}
+						//$this->so->set_recur_weekly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval'],$l_cal['recur_data']);
+						break;
+					case MCAL_RECUR_MONTHLY_MDAY:
+						//$this->so->set_recur_monthly_mday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+					case MCAL_RECUR_MONTHLY_WDAY:
+						//$this->so->set_recur_monthly_wday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+						break;
+					case MCAL_RECUR_YEARLY:
+						//$this->so->set_recur_yearly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
+
+						$repetido = (int)$l_cal['recur_type']; // recebe o tipo de repeticao;
+
+						$tmp_init = explode("/",$_POST['start']['str']); // recebe a data inicial da repeticao;
+						$init_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_init[1]),$tmp_init[0],$tmp_init[2]); // transforma a data inicial + hora + minuto em UNIX timestamp;
+
+						if($l_cal['rpt_use_end'] == 'y') // verifica se foi indicada data final da repeticao, se sim:
+						{
+
+							$tmp_end = explode("/",$_POST['recur_enddate']['str']); // recebe data final da repeticao;
+							$end_rept = mktime($_POST['start']['hour'],$_POST['start']['min'],0,intval($tmp_end[1]),$tmp_end[0],$tmp_end[2]); // transforma a data inicial + hora e minuto de inicio da repeticao em UNIX timestamp;
+
+						}else { // se nao existe data final da repeticao (agendamento infinito):
+
+							$end_rept = 0; // variavel recebe zero e nao sera adicionado nenhum alarme para o agendamento;
+						}
+						break;
+				}
+
+				if($l_participants)
+				{
+					$parts = $l_participants;
+					$minparts = min($l_participants);
+					$part = Array();
+					for($i=0;$i<count($parts);$i++)
+					{
+						if (($accept_type = substr($parts[$i],-1,1)) == '0' || (int)$accept_type > 0)
+						{
+							$accept_type = 'U';
+						}
+						$acct_type = $GLOBALS['phpgw']->accounts->get_type((int)$parts[$i]);
+						if($acct_type == 'u')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+						}
+						elseif($acct_type == 'g')
+						{
+							$part[(int)$parts[$i]] = $accept_type;
+							$groups[] = $parts[$i];
+							/* This pulls ALL users of a group and makes them as participants to the event */
+							/* I would like to turn this back into a group thing. */
+							$acct = CreateObject('phpgwapi.accounts',(int)$parts[$i]);
+							$members = $acct->member((int)$parts[$i]);
+							unset($acct);
+							if($members == False)
+							{
+								continue;
+							}
+							while($member = each($members))
+							{
+								$part[$member[1]['account_id']] = $accept_type;
+							}
+						}
+					}
+				}
+				else
+				{
+					$part = False;
+				}
+
+				if($part)
+				{
+					@reset($part);
+					while(list($key,$accept_type) = each($part))
+					{
+						//$this->so->add_attribute('participants',$accept_type,(int)$key);
+					}
+				}
+
+				if($groups)
+				{
+					@reset($groups);
+					//$this->so->add_attribute('groups',(int)$group_id);
+				}
+
+				$event = $this->get_cached_event();
+				if(!is_int($minparts))
+				{
+					$minparts = $this->owner;
+				}
+				if(!@isset($event['participants'][$l_cal['owner']]))
+				{
+					//$this->so->add_attribute('owner',$minparts);
+				}
+				else
+				{
+					//$this->so->add_attribute('owner',$l_cal['owner']);
+				}
+				//$this->so->add_attribute('priority',$l_cal['priority']);
+
+				foreach($l_cal as $name => $value)
+				{
+					if ($name[0] == '#')	// Custom field
+					{
+						//$this->so->add_attribute($name,stripslashes($value));
+					}
+				}
+				if (isset($_POST['preserved']) && is_array($preserved = unserialize(stripslashes($_POST['preserved']))))
+				{
+					foreach($preserved as $name => $value)
+					{
+						switch($name)
+						{
+							case 'owner':
+								//$this->so->add_attribute('participants',$value,$l_cal['owner']);
+								break;
+							default:
+								//$this->so->add_attribute($name,str_replace(array('&amp;','&quot;','&lt;','&gt;'),array('&','"','<','>'),$value));
+						}
+					}
+				}
+				$event = $this->get_cached_event();
+
+				if ($l_cal['alarmdays'] > 0 || $l_cal['alarmhours'] > 0 ||
+						$l_cal['alarmminutes'] > 0)
+				{
+					$offset = ($l_cal['alarmdays'] * 24 * 3600) +
+						($l_cal['alarmhours'] * 3600) + ($l_cal['alarmminutes'] * 60);
+
+					$time = $this->maketime($event['start']) - $offset;
+
+					$event['alarm'][] = Array(
+						'time'    => $time,
+						'offset'  => $offset,
+						'owner'   => $this->owner,
+						'enabled' => 1,
+						'repeat'  => $repetido, // para repetir alarme;
+						'init_rept' => $init_rept, // inicio repeticao;
+						'end_rept' => $end_rept, // fim repeticao;
+						'rpt_wdays' => $rpt_wdays // dias repeticao da semana;
+					);
+				}
+
+				$this->store_to_appsession($event);
+				$datetime_check = $this->validate_update($event);
+				print_debug('bo->validated_update() returnval',$datetime_check);
+
+				/*if($datetime_check)
+				{
+
+
+					if (!$send_to_ui)
+					{
+						return array($datetime_check => 'invalid input data');
+					}
+
+
+					ExecMethod($ui_return,
+						Array(
+							'cd'		=> $datetime_check,
+							'readsess'	=> 1
+						)
+					);
+
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+
+				}/*/
+				if($event['id'])
+				{
+					$event_ids[] = $event['id'];
+				}
+				if($event['reference'])
+				{
+					$event_ids[] = $event['reference'];
+				}
+
+				$overlapping_events = $this->overlap(
+					$this->maketime($event['start']),
+					$this->maketime($event['end']),
+					$event['participants'],
+					$event['owner'],
+					$event_ids
+				);
+			}
+			if(!$this->ex_participants)
+				$this->ex_participants = $event['ex_participants'];			
+			if($overlapping_events)
+			{
+
+
+				if($send_to_ui)
+				{
+					$event['ex_participants'] = $this->ex_participants;
+					unset($GLOBALS['phpgw_info']['flags']['noheader']);
+					unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+					ExecMethod($ui_overlap,
+						Array(
+							'o_events'	=> $overlapping_events,
+							'this_event'	=> $event
+						)
+					);
+					if(!$params['from_mobile'])
+						$GLOBALS['phpgw']->common->phpgw_exit(True);
+					else
+						return;
+				}
+				else
+				{
+					return $overlapping_events;
+				}
+			}
+			else
+			{
+
+
+
+				if(!$event['id'])
+				{
+
+
+
+					//$this->so->add_entry($event);
+					$this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event());
+					print_debug('New Event ID',$event['id']);
+				}
+				else
+				{
+
+					print_debug('Updating Event ID',$event['id']);
+					$new_event = $event;
+					$old_event = $this->read_entry($event['id']);
+					// if old event has alarm and the start-time changed => update them
+					//echo "<p>checking ".count($old_event['alarm'])." alarms of event #$event[id] start moved from ".print_r($old_event['start'],True)." to ".print_r($event['start'],True)."</p>\n";
+					if ($old_event['alarm'] &&
+						$this->maketime($old_event['start']) != $this->maketime($event['start']))
+					{
+						//$this->so->delete_alarms($old_event['id']);
+						foreach($old_event['alarm'] as $id => $alarm)
+						{
+							$alarm['time'] = $this->maketime($event['start']) - $alarm['offset'];
+							$event['alarm'][] = $alarm;
+						}
+						//echo "updated alarms<pre>".print_r($event['alarm'],True)."</pre>\n";
+					}
+					//$this->so->cal->event = $event;
+					//$this->so->add_entry($event);
+					$this->prepare_recipients($new_event,$old_event);
+				}
+
+				$date = sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']);
+				if($send_to_ui)
+				{
+					$this->read_sessiondata();
+					if ($this->return_to)
+					{
+						$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->return_to);
+						$GLOBALS['phpgw']->common->phpgw_exit();
+					}
+					Execmethod($ui_index);
+				}
+				else
+				{
+					return (int)$event['id'];
+				}
+			}
+			return True;
+		}
+
+function date_filter($name,&$start,&$end_param)
+	{
+		$end = $end_param;
+
+		if ($name == 'custom' && $start)
+		{
+			if ($end)
+			{
+				$end += 24*60*60;
+			}
+			else
+			{
+				$end = $start + 8*24*60*60;
+			}
+		}
+		else
+		{
+			if (!isset($this->date_filters[$name]))
+			{
+				return '1=1';
+			}
+			$year  = (int) date('Y',$this->today);
+			$month = (int) date('m',$this->today);
+			$day   = (int) date('d',$this->today);
+	
+			list($syear,$smonth,$sday,$sweek,$eyear,$emonth,$eday,$eweek) = $this->date_filters[$name];
+			
+			if ($syear || $eyear)
+			{
+				$start = mktime(0,0,0,1,1,$syear+$year);
+				$end   = mktime(0,0,0,1,1,$eyear+$year);
+			}
+			elseif ($smonth || $emonth)
+			{
+				$start = mktime(0,0,0,$smonth+$month,1,$year);
+				$end   = mktime(0,0,0,$emonth+$month,1,$year);
+			}
+			elseif ($sday || $eday)
+			{
+				$start = mktime(0,0,0,$month,$sday+$day,$year);
+				$end   = mktime(0,0,0,$month,$eday+$day,$year);
+			}
+			elseif ($sweek || $eweek)
+			{
+				$wday = (int) date('w',$this->today); // 0=sun, ..., 6=sat
+				switch($GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts'])
+				{
+					case 'Sunday':
+						$weekstart = $this->today - $wday * 24*60*60;
+						break;
+					case 'Saturday':
+						$weekstart = $this->today - (6-$wday) * 24*60*60;
+						break;
+					case 'Moday':
+					default:
+						$weekstart = $this->today - ($wday ? $wday-1 : 6) * 24*60*60;
+						break;
+				}
+				$start = $weekstart + $sweek*7*24*60*60;
+				$end   = $weekstart + $eweek*7*24*60*60;
+			}
+			$end_param = $end - 24*60*60;
+		}
+		//echo "<p align='right'>date_filter($name,$start,$end) today=".date('l, Y-m-d H:i',$this->today)." ==> ".date('l, Y-m-d H:i:s',$start)." <= date < ".date('l, Y-m-d H:i:s',$end)."</p>\n"; 
+		// convert start + end from user to servertime for the filter
+		return '('.($start-$this->tz_offset_s).' <= ts_start AND ts_start < '.($end-$this->tz_offset_s).')';
+	}
+/***********************************************/
+	}
+?>
Index: /contrib/Resources/inc/class.so_resources.inc.php
===================================================================
--- /contrib/Resources/inc/class.so_resources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.so_resources.inc.php	(revision 3524)
@@ -0,0 +1,104 @@
+<?php
+/**
+ * eGroupWare - resources
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package resources
+ * @link http://www.egroupware.org
+ * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+ * @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
+ * @version $Id: class.so_resources.inc.php 19821 2005-11-14 18:16:56Z nelius_weiss $
+ */
+
+
+include_once(PHPGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
+
+/**
+ * General storage object for resources
+ *
+ * @author Cornelius Weiss <phpgw@von-und-zu-weiss.de>
+ * @package resources
+ */
+class so_resources extends so_sql
+{
+	function so_resources()
+	{
+		$this->so_sql('resources','phpgw_resources');
+		
+		$custom =& CreateObject('admin.customfields',$contact_app);
+		$this->customfields = $custom->get_customfields();
+		$this->soextra =& CreateObject('etemplate.so_sql');
+		$this->soextra->so_sql('resources','egw_resources_extra');
+	}
+
+	/**
+	 * gets the value of $key from resource of $res_id
+	 *
+	 * @param string $key key of value to get
+	 * @param int $res_id resource id
+	 * @return mixed value of key and resource, false if key or id not found.
+	 */
+	function get_value($key,$res_id)
+	{
+		if($this->db->select($this->table_name,$key,array('res_id' => $res_id),__LINE__,__FILE__))
+		{
+			$value = $this->db->row(row);
+			return $value[$key];
+		}
+		return false;
+	}
+	
+	/**
+	 * reads resource including custom fields
+	 *
+	 * @param interger $res_id res_id
+	 * @return array/boolean data if row could be retrived else False
+	 */
+	function read($res_id)
+	{
+		// read main data
+		$resource = parent::read($res_id);
+		
+		// read customfields
+		$keys = array(
+			'extra_id' => $res_id,
+			'extra_owner' => -1,
+		);
+		$customfields = $this->soextra->search($keys,false);
+		foreach ((array)$customfields as $field)
+		{
+			$resource['#'.$field['extra_name']] = $field['extra_value'];
+		}
+		return $resource;
+	}
+
+	/**
+	 * saves a resource including extra fields
+	 *
+	 * @param array $resource key => value 
+	 * @return mixed id of resource if all right, false if fale
+	 */
+	function save($resource)
+	{
+		$this->data = $resource;
+		if(parent::save() != 0) return false;
+		$res_id = $this->data['res_id'];
+		
+		// save customfields
+		foreach ($this->customfields as $field => $options)
+		{
+			$value = $resource['#'.$field];
+			$data = array(
+				'extra_id' => $res_id,
+				'extra_name' => $field,
+				'extra_owner' => -1,
+				'extra_value' => $value,
+			);
+			$this->soextra->data = $data;
+			$error_nr = $this->soextra->save();
+			if($error_nr) return false;
+		}
+		return $res_id;
+	}
+	
+}
Index: /contrib/Resources/inc/class.resources_select_widget.inc.php
===================================================================
--- /contrib/Resources/inc/class.resources_select_widget.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.resources_select_widget.inc.php	(revision 3524)
@@ -0,0 +1,106 @@
+<?php
+/**
+ * eGroupWare - eTemplate Extension - Resource Select Widgets
+ *
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @package resources
+ * @link http://www.egroupware.org
+ * @author RalfBecker-AT-outdoor-training.de
+ * @version $Id: class.resources_select_widget.inc.php 22438 2006-09-15 19:37:19Z nelius_weiss $
+ */
+
+/**
+ * eTemplate Extension: select a resource
+ *
+ * @package resources
+ */
+class resources_select_widget
+{
+	/** 
+	* exported methods of this class
+	* @var array
+	*/
+	var $public_functions = array(
+		'pre_process' => True,
+	);
+	/**
+	* availible extensions and there names for the editor
+	* @var array
+	*/
+	var $human_name = 'Select Resources';
+
+	/**
+	* Constructor of the extension
+	*
+	* @param string $ui '' for html
+	*/
+	function resources_select_widget($ui)
+	{
+		$this->ui = $ui;
+	}
+
+	/**
+	* pre-processing of the extension
+	*
+	* This function is called before the extension gets rendered
+	*
+	* @param string $name form-name of the control
+	* @param mixed &$value value / existing content, can be modified
+	* @param array &$cell array with the widget, can be modified for ui-independent widgets 
+	* @param array &$readonlys names of widgets as key, to be made readonly
+	* @param mixed &$extension_data data the extension can store persisten between pre- and post-process
+	* @param object &$tmpl reference to the template we belong too
+	* @return boolean true if extra label is allowed, false otherwise
+	*/
+	function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
+	{
+		if ($cell['readonly'] && !is_array($value))
+		{
+			// no acl check here cause names are allways viewable
+			list($res_id,$quantity) = explode(':',$value);
+			$data = ExecMethod('resources.bo_resources.get_calendar_info',$res_id);
+			$cell['type'] = 'label';
+			$value = $data[0]['name']. ($data[0]['useable'] > 1 ? ' ['. ($quantity > 1 ? $quantity : 1). '/'. $data[0]['useable']. ']' : '');
+			return true;
+		}
+		
+		if (!$GLOBALS['phpgw_info']['user']['apps']['resources'])
+		{
+			$cell = $tmpl->empty_cell();
+			$cell['label'] = 'no resources';
+			return false;
+		}
+		$tpl =& new etemplate('resources.resource_selectbox');
+		// keep the editor away from the generated tmpls
+		$tpl->no_onclick = true;			
+		
+		if ($value)
+		{
+			$value = is_array($value) ? $value : explode(',',$value);
+			foreach((array)$value as $id)
+			{
+				list($res_id,$quantity) = explode(':',$id);
+				$data = ExecMethod('resources.bo_resources.get_calendar_info',$res_id);
+				$sel_options[$data[0]['res_id'].($quantity > 1 ? (':'.$quantity) : '')] = 
+					$data[0]['name'].' ['.($quantity > 1 ? $quantity : 1).'/'.$data[0]['useable'].']';
+			}
+			$tpl->set_cell_attribute('resources','sel_options',$sel_options);
+		}
+		
+		$tpl->set_cell_attribute('resources','size',(int)$cell['size'].'+');
+		$tpl->set_cell_attribute('resources','label',$cell['label']);
+		$tpl->set_cell_attribute('resources','id','resources_selectbox');
+		$tpl->set_cell_attribute('resources','name',$cell['name']);
+		if ($cell['help'])
+		{
+			$tpl->set_cell_attribute('resources','help',$cell['help']);
+			$tpl->set_cell_attribute('popup','label',$cell['help']);
+		}
+		$cell['type'] = 'template';
+		$cell['size'] = $cell['label'] = '';
+		$cell['name'] = 'resources.resource_selectbox';
+		$cell['obj'] =& $tpl;
+
+		return True;	// extra Label Ok
+	}
+}
Index: /contrib/Resources/inc/class.soresources.inc.php
===================================================================
--- /contrib/Resources/inc/class.soresources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.soresources.inc.php	(revision 3524)
@@ -0,0 +1,432 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - infolog                                                    *
+  * http://www.eGroupWare.org                                                *
+  * Maintained and further developed by RalfBecker@outdoor-training.de       *
+  * Based on Webinfolog by Craig Knudsen <cknudsen@radix.net>               *
+  *          http://www.radix.net/~cknudsen                                  *
+  * Originaly modified by Mark Peters <skeeter@phpgroupware.org>             *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	class soinfolog
+	{
+//		var $debug = True;
+		var $debug = False;
+		var $cal;
+		var $db;
+		var $owner;
+		var $g_owner;
+		var $is_group = False;
+		var $datetime;
+		var $filter;
+		var $cat_id;
+		
+		function soinfolog($param)
+		{
+			$this->db = $GLOBALS['phpgw']->db;
+			if(!is_object($GLOBALS['phpgw']->datetime))
+			{
+				$GLOBALS['phpgw']->datetime = createobject('phpgwapi.date_time');
+			}
+
+			$this->owner = (!isset($param['owner']) || $param['owner'] == 0?$GLOBALS['phpgw_info']['user']['account_id']:$param['owner']);
+			$this->filter = (isset($param['filter']) && $param['filter'] != ''?$param['filter']:$this->filter);
+			$this->cat_id = (isset($param['category']) && $param['category'] != ''?$param['category']:$this->cat_id);
+			if(isset($param['g_owner']) && is_array($param['g_owner']))
+			{
+				$this->is_group = True;
+				$this->g_owner = $param['g_owner'];
+			}
+			if($this->debug)
+			{
+				echo '<!-- SO Filter : '.$this->filter.' -->'."\n";
+				echo '<!-- SO cat_id : '.$this->cat_id.' -->'."\n";
+			}
+			$this->cal = CreateObject('infolog.soinfolog_');
+			//$this->open_box($this->owner);
+		}
+		
+		// It returns uidNumber and cn ( Retorna o uidNumber e o cn )
+		function search_uidNumber($mail)
+		{
+			$connection = $GLOBALS['phpgw']->common->ldapConnect();
+			$justthese = array("uidNumber","cn","mail");
+			$search = ldap_search($connection, $GLOBALS['phpgw_info']['server']['ldap_context'], "mail=" . $mail, $justthese);
+			$result = ldap_get_entries($connection, $search);
+			ldap_close($connection);
+			return $result;
+		}
+
+		
+
+		function maketime($time)
+		{
+			return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
+		}
+
+		function read_entry($id)
+		{
+			return $this->cal->get_event_ids($id);
+		}
+
+		function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0,$owner_id=0)
+		{
+			$extra = '';
+			$extra .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
+			//$extra .= ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":'');
+			if ($this->cat_id)
+			{
+				if (!is_object($GLOBALS['phpgw']->categories))
+				{
+					$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
+				}
+				$cats = $GLOBALS['phpgw']->categories->return_all_children($this->cat_id);
+				$extra .= "AND (phpgw_cal.category".(count($cats) > 1 ? " IN ('".implode("','",$cats)."')" : '=\''.(int)$this->cat_id."'");
+				foreach($cats as $cat)
+				{
+					$extra .= " OR phpgw_cal.category LIKE '$cat,%' OR phpgw_cal.category LIKE '%,$cat,%' OR phpgw_cal.category LIKE '%,$cat'";
+				}
+				$extra .= ') ';
+			}
+			if($owner_id)
+			{
+				return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset,$owner_id);
+			}
+			else
+			{
+				return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset);
+			}
+		}
+
+		function list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id=0)
+		{
+			if(!$owner_id)
+			{
+				$owner_id = $this->is_group ? $this->g_owner : $this->owner;
+			}
+			if($GLOBALS['phpgw_info']['server']['infolog_type'] != 'sql' ||
+				!count($owner_id))	// happens with empty groups
+			{
+				return Array();
+			}
+
+			$starttime = mktime(0,0,0,$smonth,$sday,$syear) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$endtime = mktime(23,59,59,$emonth,$eday,$eyear) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$sql = "AND phpgw_cal.cal_type='M' AND phpgw_cal_user.cal_login IN (".
+				(is_array($owner_id) ? implode(',',$owner_id) : $owner_id).')';
+
+//			$member_groups = $GLOBALS['phpgw']->accounts->membership($this->user);
+//			@reset($member_groups);
+//			while(list($key,$group_info) = each($member_groups))
+//			{
+//				$member[] = $group_info['account_id'];
+//			}
+//			@reset($member);
+//			$sql .= ','.implode(',',$member).') ';
+//			$sql .= 'AND (phpgw_cal.datetime <= '.$starttime.') ';
+//			$sql .= 'AND (((phpgw_cal_repeats.recur_enddate >= '.$starttime.') AND (phpgw_cal_repeats.recur_enddate <= '.$endtime.')) OR (phpgw_cal_repeats.recur_enddate=0))) '
+			$sql .= ' AND (phpgw_cal_repeats.recur_enddate >= '.$starttime.' OR phpgw_cal_repeats.recur_enddate=0) '
+				. (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'')
+				. ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":'')
+				. 'ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
+
+			if($this->debug)
+			{
+				echo '<!-- SO list_repeated_events : SQL : '.$sql.' -->'."\n";
+			}
+
+			return $this->get_event_ids(True,$sql);
+		}
+
+		function list_events_keyword($keywords,$members='')
+		{
+			if (!$members)
+			{
+				$members[] = $this->owner;
+			}
+			$sql = 'AND (phpgw_cal_user.cal_login IN ('.implode(',',$members).')) AND '.
+				'(phpgw_cal_user.cal_login=' . (int)$this->owner . ' OR phpgw_cal.is_public=1) AND (';
+
+			$words = split(' ',$keywords);
+			foreach($words as $i => $word)
+			{
+				$sql .= $i > 0 ? ' OR ' : '';
+				$sql .= "(UPPER(phpgw_cal.title) LIKE UPPER('%".addslashes($word)."%') OR "
+						. "UPPER(phpgw_cal.description) LIKE UPPER('%".addslashes($word)."%') OR "
+						. "UPPER(phpgw_cal.location) LIKE UPPER('%".addslashes($word)."%') OR "
+						. "UPPER(phpgw_cal_extra.cal_extra_value) LIKE UPPER('%".addslashes($word)."%'))";
+			}
+			$sql .= ') ';
+
+			$sql .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
+			$sql .= ($this->cat_id? "AND (phpgw_cal.category='$this->cat_id' OR phpgw_cal.category like '%,".$this->cat_id.",%') ":'');
+			$sql .= 'ORDER BY phpgw_cal.datetime DESC, phpgw_cal.edatetime DESC, phpgw_cal.priority ASC';
+
+			return $this->get_event_ids(False,$sql,True);
+		}
+
+		function read_from_store($startYear,$startMonth,$startDay,$endYear='',$endMonth='',$endDay='')
+		{
+			$events = $this->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay);
+			$events_cached = Array();
+			for($i=0;$i<count($events);$i++)
+			{
+				$events_cached[] = $this->read_entry($events[$i]);
+			}
+			return $events_cached;
+		}
+
+		function get_event_ids($search_repeats=False, $sql='',$search_extra=False)
+		{
+			return $this->cal->get_event_ids($search_repeats,$sql,$search_extra);
+		}
+
+		function find_uid($uid)
+		{
+			$sql = " AND (phpgw_cal.uid = '".$uid."') ";
+
+			$found = $this->cal->get_event_ids(False,$sql);
+			if(!$found)
+			{
+				$found = $this->cal->get_event_ids(True,$sql);
+			}
+			if(is_array($found))
+			{
+				return $found[0];
+			}
+			else
+			{
+				return False;
+			}
+		}
+
+		function add_entry(&$event)
+		{
+			return $this->cal->save_event($event);
+		}
+
+		function save_alarm($cal_id,$alarm,$id=0)
+		{
+			return $this->cal->save_alarm($cal_id,$alarm,$id);
+		}
+
+		function delete_alarm($id)
+		{
+			return $this->cal->delete_alarm($id);
+		}
+
+		function delete_alarms($cal_id)
+		{
+			return $this->cal->delete_alarms($cal_id);
+		}
+
+		function delete_entry($id)
+		{
+			return $this->cal->delete_event($id);
+		}
+
+		function expunge()
+		{
+			$this->cal->expunge();
+		}
+
+		function delete_infolog($owner)
+		{
+			$this->cal->delete_infolog($owner);
+		}
+
+		function change_owner($account_id,$new_owner)
+		{
+			if($GLOBALS['phpgw_info']['server']['infolog_type'] == 'sql')
+			{
+				$db2 = $this->cal->stream;
+				$this->cal->stream->query('SELECT cal_id FROM phpgw_cal_user WHERE cal_login='.$account_id,__LINE__,__FILE__);
+				while($this->cal->stream->next_record())
+				{
+					$id = $this->cal->stream->f('cal_id');
+					$db2->query('SELECT count(*) FROM phpgw_cal_user WHERE cal_id='.$id.' AND cal_login='.$new_owner,__LINE__,__FILE__);
+					$db2->next_record();
+					if($db2->f(0) == 0)
+					{
+						$db2->query('UPDATE phpgw_cal_user SET cal_login='.$new_owner.' WHERE cal_id='.$id.' AND cal_login='.$account_id,__LINE__,__FILE__);
+					}
+					else
+					{
+						$db2->query('DELETE FROM phpgw_cal_user WHERE cal_id='.$id.' AND cal_login='.$account_id,__LINE__,__FILE__);
+					}
+				}
+				$this->cal->stream->query('UPDATE phpgw_cal SET owner='.$new_owner.' WHERE owner='.$account_id,__LINE__,__FILE__);
+			}
+		}
+
+		function set_status($id,$status)
+		{
+			$this->cal->set_status($id,$this->owner,$status);
+		}
+
+		function get_alarm($cal_id)
+		{
+			if (!method_exists($this->cal,'get_alarm'))
+			{
+				return False;
+			}
+			return $this->cal->get_alarm($cal_id);
+		}
+
+		function read_alarm($id)
+		{
+			if (!method_exists($this->cal,'read_alarm'))
+			{
+				return False;
+			}
+			return $this->cal->read_alarm($id);
+		}
+
+		function read_alarms($cal_id)
+		{
+			if (!method_exists($this->cal,'read_alarms'))
+			{
+				return False;
+			}
+			return $this->cal->read_alarms($cal_id);
+		}
+
+		function find_recur_exceptions($event_id)
+		{
+			if($GLOBALS['phpgw_info']['server']['infolog_type'] == 'sql')
+			{
+				$arr = Array();
+				$this->cal->query('SELECT datetime FROM phpgw_cal WHERE reference='.$event_id,__LINE__,__FILE__);
+				if($this->cal->num_rows())
+				{
+					while($this->cal->next_record())
+					{
+						$arr[] = (int)$this->cal->f('datetime');
+					}
+				}
+				if(count($arr) == 0)
+				{
+					return False;
+				}
+				else
+				{
+					return $arr;
+				}
+			}
+			else
+			{
+				return False;
+			}
+		}
+
+		/* Begin mcal equiv functions */
+		function get_cached_event()
+		{
+			return $this->cal->event;
+		}
+		
+		function add_attribute($var,$value,$element='**(**')
+		{
+			$this->cal->add_attribute($var,$value,$element);
+		}
+
+		function event_init()
+		{
+			$this->cal->event_init();
+		}
+
+		function set_date($element,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			$this->cal->set_date($element,$year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			$this->cal->set_start($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
+		{
+			$this->cal->set_end($year,$month,$day,$hour,$min,$sec);
+		}
+
+		function set_title($title='')
+		{
+			$this->cal->set_title($title);
+		}
+function set_access($access='')
+		{
+			$this->cal->set_access($access);
+		}
+
+		function set_description($description='')
+		{
+			$this->cal->set_description($description);
+		}
+function set_description1($description1='')
+		{
+			$this->cal->set_description1($description1);
+		}
+function set_participants1($participants1='')
+		{
+			$this->cal->set_participants1($participants1);
+		}
+		function set_ex_participants($ex_participants='')
+		{
+			$this->cal->set_ex_participants($ex_participants);
+		}
+
+		function set_class($class)
+		{
+			$this->cal->set_class($class);
+		}
+
+		function set_category($category='')
+		{
+			$this->cal->set_category($category);
+		}
+
+		function set_alarm($alarm)
+		{
+			$this->cal->set_alarm($alarm);
+		}
+
+		function set_recur_none()
+		{
+			$this->cal->set_recur_none();
+		}
+
+		function set_recur_daily($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_daily($year,$month,$day,$interval);
+		}
+
+		function set_recur_weekly($year,$month,$day,$interval,$weekdays)
+		{
+			$this->cal->set_recur_weekly($year,$month,$day,$interval,$weekdays);
+		}
+
+		function set_recur_monthly_mday($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_monthly_mday($year,$month,$day,$interval);
+		}
+
+		function set_recur_monthly_wday($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_monthly_wday($year,$month,$day,$interval);
+		}
+
+		function set_recur_yearly($year,$month,$day,$interval)
+		{
+			$this->cal->set_recur_yearly($year,$month,$day,$interval);
+		}
+		
+		/* End mcal equiv functions */
+	}
+?>
Index: /contrib/Resources/inc/class.ui_acl.inc.php
===================================================================
--- /contrib/Resources/inc/class.ui_acl.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.ui_acl.inc.php	(revision 3524)
@@ -0,0 +1,138 @@
+<?php
+/**
+ * eGroupWare - resources
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+ * @package resources
+ * @link http://www.egroupware.org
+ * @version $Id: class.ui_acl.inc.php 22893 2006-12-07 08:12:19Z nelius_weiss $
+ */
+
+/**
+ * ACL userinterface object for resources
+ *
+ * @package resources
+ */
+class ui_acl
+{
+	var $start = 0;
+	var $query = '';
+	var $sort  = '';
+	var $order = '';
+	var $bo;
+	var $nextmatchs = '';
+	var $rights;
+	var $public_functions = array(
+		'acllist' 	=> True,
+		);
+
+	function ui_acl()
+	{
+		$this->bo =& createobject('resources.bo_acl',True);
+		$this->nextmatchs =& createobject('phpgwapi.nextmatchs');
+		$this->start = $this->bo->start;
+		$this->query = $this->bo->query;
+		$this->order = $this->bo->order;
+		$this->sort = $this->bo->sort;
+		$this->cat_id = $this->bo->cat_id;
+	}
+	
+	function acllist()
+	{
+		if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
+		{
+			$this->deny();
+		}
+
+		if ($_POST['btnDone'])
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+
+		if ($_POST['btnSave'])
+		{
+			foreach($_POST['catids'] as $cat_id)
+			{
+				$this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id],
+					$_POST['inputcalread'][$cat_id],$_POST['inputcalbook'][$cat_id],$_POST['inputadmin'][$cat_id]);
+			}
+		}
+
+		$GLOBALS['phpgw']->template->set_file('acl', 'acl.tpl');
+		$GLOBALS['phpgw']->template->set_block('acl','cat_list','Cblock');
+		$GLOBALS['phpgw']->template->set_var(array(
+			'title' => $GLOBALS['phpgw_info']['apps']['resources']['title'] . ' - ' . lang('Configure Access Permissions'),
+			'lang_search' => lang('Search'),
+			'lang_save' => lang('Save'),
+			'lang_done' => lang('Done'),
+			'lang_read' => lang('Read permissions'),
+			'lang_write' => lang('Write permissions'),
+			'lang_implies_read' => lang('implies read permission'),
+			'lang_calread' => lang('Read Calendar permissions'),
+			'lang_calbook' => lang('Direct booking permissions'),
+			'lang_implies_book' => lang('implies booking permission'),
+			'lang_cat_admin' => lang('Categories admin')
+		));
+
+		$left  = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=resources.uiacl.acllist');
+		$right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=resources.uiacl.acllist');
+		
+		$GLOBALS['phpgw']->template->set_var(array(
+			'left' => $left,
+			'right' => $right,
+			'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records,$this->start),
+			'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
+			'sort_cat' => $this->nextmatchs->show_sort_order(
+				$this->sort,'cat_name','cat_name','/index.php',lang('Category'),'&menuaction=resources.uiacl.acllist'
+			),
+			'query' => $this->query,
+		));
+
+		@reset($this->bo->cats);
+		while (list(,$cat) = @each($this->bo->cats))
+		{
+			$this->rights = $this->bo->get_rights($cat['id']);
+
+			$tr_color = $this->nextmatchs->alternate_row_color($tr_color);
+			$GLOBALS['phpgw']->template->set_var(array(
+				'tr_color' => $tr_color,
+				'catname' => $cat['name'],
+				'catid' => $cat['id'],
+				'read' => $this->selectlist(phpgw_ACL_READ),
+				'write' => $this->selectlist(phpgw_ACL_ADD),
+				'calread' => $this->selectlist(phpgw_ACL_CALREAD),
+				'calbook' =>$this->selectlist(phpgw_ACL_DIRECT_BOOKING),
+				'admin' => '<option value="" selected="1">'.lang('choose categories admin').'</option>'.$this->selectlist(phpgw_ACL_CAT_ADMIN,true)
+			));
+			$GLOBALS['phpgw']->template->parse('Cblock','cat_list',True);
+		}
+		$GLOBALS['phpgw']->template->pfp('out','acl',True);
+	}
+
+	function selectlist($right,$users_only=false)
+	{
+		foreach ($GLOBALS['phpgw']->accounts->get_list() as $num => $account)
+		{
+			if(!($users_only && $account['account_lastname'] == 'Group'))
+			{
+				$selectlist .= '<option value="' . $account['account_id'] . '"';
+					if($this->rights[$account['account_id']] & $right)
+				{
+					$selectlist .= ' selected="selected"';
+				}
+				$selectlist .= '>' . $account['account_firstname'] . ' ' . $account['account_lastname']
+									. ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n";
+			}
+		}
+		return $selectlist;
+	}
+
+	function deny()
+	{
+		echo '<p><center><b>'.lang('Access not permitted').'</b></center>';
+		$GLOBALS['phpgw']->common->phpgw_exit(True);
+	}
+}
Index: /contrib/Resources/sitemgr/class.module_resources.inc.php
===================================================================
--- /contrib/Resources/sitemgr/class.module_resources.inc.php	(revision 3524)
+++ /contrib/Resources/sitemgr/class.module_resources.inc.php	(revision 3524)
@@ -0,0 +1,25 @@
+<?php
+	/**
+	 * eGroupWare - resources
+	 * http://www.egroupware.org 
+	 *
+	 * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+	 * @package resources
+	 * @author Cornelius Weiss <egw@von-und-zu-weiss.de>
+	 * @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
+	 * @version $Id: class.module_resources.inc.php 19735 2005-11-10 23:35:55Z nelius_weiss $
+	 */
+	
+	require_once (EGW_INCLUDE_ROOT.'/etemplate/inc/class.sitemgr_module.inc.php');
+	
+	class module_resources extends sitemgr_module
+	{
+		function module_resources()
+		{
+			$this->arguments = array();
+			$this->properties = array();
+			$this->title = lang('Resources');
+			$this->description = lang('This module displays the resources app');
+			$this->etemplate_method = 'resources.ui_resources.index';
+		}
+	}
Index: /contrib/Resources/fix_lost_links.php
===================================================================
--- /contrib/Resources/fix_lost_links.php	(revision 3524)
+++ /contrib/Resources/fix_lost_links.php	(revision 3524)
@@ -0,0 +1,42 @@
+<?php
+/**
+ * TimeSheet - fixing links lost by the bug in the links-class
+ *
+ * @link http://www.egroupware.org
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @package timesheet
+ * @copyright (c) 2005 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id$ 
+ */
+
+$GLOBALS['phpgw_info'] = array(
+	'flags' => array(
+		'currentapp'	=> 'admin', 
+));
+include('../header.inc.php');
+
+require_once(PHPGW_INCLUDE_ROOT.'/timesheet/inc/class.botimesheet.inc.php');
+
+$bots =& new botimesheet();
+$so_sql =& new so_sql('timesheet',$bots->table_name);
+
+// search timesheet which have a project-field identical to an exiting PM project, but no link to it
+$rows = $so_sql->search(false,'ts_id,ts_project,ts_title','','pm_id,link_id','',false,'AND',false,array('link_id IS NULL'),
+	' JOIN phpgw_pm_projects ON ts_project='.$so_sql->db->concat('pm_number',"': '",'pm_title').
+	" LEFT JOIN phpgw_links ON (link_app1='timesheet' AND link_id1=ts_id AND link_app2='projectmanager' AND link_id2=pm_id".
+	" OR link_app1='projectmanager' AND link_id1=pm_id AND link_app2='timesheet' and link_id2=ts_id)");
+
+echo "<h1>Fixing links to ProjectManager lost by the bug in the links-class</h1>\n";
+
+if ($rows)
+{
+	foreach($rows as $row)
+	{
+		if ($bots->link->link('timesheet',$row['ts_id'],'projectmanager',$row['pm_id']))
+		{
+			echo "<p>relinked timesheet '$row[ts_title]' with project '$row[ts_project]'</p>\n";
+		}
+	}
+}
+echo "<h3>".(is_array($rows) ? count($rows) : 0)." missing links found.</h3>\n";
Index: /contrib/Resources/index.php
===================================================================
--- /contrib/Resources/index.php	(revision 3524)
+++ /contrib/Resources/index.php	(revision 3524)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * TimeSheet - index
+ *
+ * @link http://www.egroupware.org
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @package timesheet
+ * @copyright (c) 2005 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id: index.php 22356 2006-08-26 16:32:29Z ralfbecker $ 
+ */
+
+
+
+
+	$phpgw_flags = Array(
+		'currentapp'	=>	'resources',
+		'noheader'	=>	True,
+		'nonavbar'	=>	True,
+		'noappheader'	=>	True,
+		'noappfooter'	=>	True,
+		'nofooter'	=>	True
+	);
+
+	$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
+	include('../header.inc.php');
+	
+
+
+
+	ExecMethod('resources.uiresources.index',$parms);
+	$GLOBALS['phpgw']->common->phpgw_exit();
+
+?>
+
Index: /contrib/Resources/templates/default/form_button_script.tpl
===================================================================
--- /contrib/Resources/templates/default/form_button_script.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/form_button_script.tpl	(revision 3524)
@@ -0,0 +1,12 @@
+
+<!-- BEGIN form_button -->
+<nobr>
+<form action="{action_url_button}" method="post" name="{action_text_button}form">
+<div style="padding-top:15px; padding-right: 2px">
+	{action_extra_field} 
+	<input id="{button_id}" style="font-size:10px" type="submit" value="{action_text_button}" {action_confirm_button}>
+</div>
+</form>
+</nobr>
+
+<!-- END form_button -->
Index: /contrib/Resources/templates/default/locales.tpl
===================================================================
--- /contrib/Resources/templates/default/locales.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/locales.tpl	(revision 3524)
@@ -0,0 +1,60 @@
+<!-- BEGIN list -->
+<p>
+ <table border="0" width="45%" align="center">
+  <tr>
+   <td align="left">{left_next_matchs}</td>
+   {center}
+   <td align="right">{right_next_matchs}</td>
+  </tr>
+ </table>
+
+ <table border="0" width="70%" align="center">
+  <tr bgcolor="{th_bg}">
+   <td>&nbsp;{sort_name}</td>
+   {header_rule}
+   <td>{header_edit}</td>
+   <td>{header_delete}</td>
+   <td>{header_extra}</td>
+  </tr>
+
+  {rows}
+
+ </table>
+
+ <table border="0" width="70%" cellspacing="5" align="center">
+  <tr>
+   <td align="left">
+    <form method="POST" action="{new_action}">
+     <input type="submit" value="{lang_add}">
+    </form>
+   </td>
+   {back_button}
+   <td width="80%" align="right">
+    <form method="POST" action="{search_action}">
+     {lang_search}&nbsp;<input name="query">
+    </form>
+   </td>
+  </tr>
+ </table>
+<!-- END list -->
+<!-- BEGIN row -->
+ <tr bgcolor="{tr_color}">
+  <td>&nbsp;{group_name}</td>
+  {rule}
+  <td width="5%">{edit_link}</td>
+  <td width="5%">{delete_link}</td>
+  <td align="center" {extra_width}>{extra_link}</td>
+ </tr>
+<!-- END row -->
+<!-- BEGIN row_empty -->
+   <tr>
+    <td colspan="5" align="center">{message}</td>
+   </tr>
+<!-- END row_empty -->
+<!-- BEGIN back_button_form -->
+   <td align="center">
+    <form method="POST" action="{back_action}">
+     <input type="submit" value="{lang_back}">
+    </form>
+   </td>
+<!-- END back_button_form -->
Index: /contrib/Resources/templates/default/app_print.css
===================================================================
--- /contrib/Resources/templates/default/app_print.css	(revision 3524)
+++ /contrib/Resources/templates/default/app_print.css	(revision 3524)
@@ -0,0 +1,294 @@
+/* Este documento é um css somente para impressão do calendário no papel!
+O seu efeito não aparece na tela  */
+
+.calendar_print_main {
+	text-align:center;
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 8px;
+	color: #000066;
+	background-color: #F7F7F7;
+	border: 1px solid #CCCCCC;
+	margin: 5px;
+	padding: 5px;
+	height: 700px;
+	width: 600px;
+}
+.button {
+	display: none;
+}
+
+
+.to_continue
+{
+	font-size: 9px;
+}
+
+A.minicalendar 
+{ 
+	color: #000000; 
+	font-size: 9px;
+	
+}
+
+A.bminicalendar 
+{ 
+	color: #336699; 
+	font-style: italic;
+	font-weight: bold;
+	font-size: 9px; 
+}
+
+A.minicalendargrey 
+{ 
+	color: #999999; 
+	font-size: 10px;
+	font-weight: bold;
+}
+
+A.bminicalendargrey 
+{ 
+	color: #336699; 
+	font-style: italic; 
+	font-size:10px; 
+}
+
+A.minicalhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #000000; 
+	font-size: 10px; 
+}
+
+A.bminicalhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #336699; 
+	font-size: 10px; 
+}
+
+A.minicalgreyhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #999999; 
+	font-size: 10px; 
+}
+
+A.bminicalgreyhol
+{ 
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #999999; 
+	font-size: 10px; 
+}
+
+
+.event-on
+{ 
+	background: #D3DCE3;
+	border: #E8F0F0 1px solid;
+}
+
+.event-off
+{ 
+	background: #E8F0F0;
+	border: #D3DCE3 1px solid;
+}
+
+.event-holiday
+{
+	font-size: 100%;
+	background: #dac0c0;
+	color:#000000;
+	vertical-align: middle;
+}
+
+.time
+{
+	background: #D3DCE3;
+	color:#000000;
+	font-size: 10px;
+	font-weight: bold;
+	vertical-align: middle;
+	width: 5.2%;
+	text-align: right;
+	padding-right: 5px;
+	line-height: 11px;
+	border: #E8F0F0 1px solid;
+}
+
+
+.planner-cell
+{
+	cursor: pointer;
+	cursor: hand;
+	border: thin solid black;
+}
+
+/* common */
+.calendar_link_print
+{
+	text-align: center;
+	font-size: 10px;
+}
+
+//Mini Calendar
+
+.calendar_minical_table
+{
+	width: 180px;
+	font-weight: bold;
+}
+
+.calendar_minical_daytable
+{
+	width: 100%;
+}
+
+.calendar_minical_dayname
+{
+	font-size: 9px;
+	text-align: right;
+}
+
+.calendar_minical_hrule
+{
+	width: 96%;
+}
+
+/* Header */
+.calendar_dropbuttons
+{
+	align: center;
+	text-align: center;
+	vertical-align: bottom;
+	font-weight: bold;
+	font-size: 8px;
+}
+
+.calendar-weekidentifier
+{
+	font-size:16px;
+	font-weight: bold;
+	text-align: center;
+}
+
+.calendar_header
+{
+	font-size: 16px;
+	font-weight: bold;
+	text-align: center;
+}
+
+.calendar_dayview_table_header
+{
+	font-size: 13px;
+	font-weight: bold;
+	text-align: center;
+}
+
+.calendar_dayview_todo_header
+{
+	margin: 0px; 
+	padding: 2px;
+	font-weight: bold;
+}
+
+/* week view */
+.calendar_week_identifier_table
+{
+	border: 0px solid black;
+	width: 100%;
+}
+
+.calendar_week_identifier
+{
+	font-size: 13px;
+	text-align: center;
+	font-weight: bold;
+}
+
+.calendar_weekview_daytitle
+{
+	font-weight: bold;
+	font-size: 12px;
+	background: #D3DCE3;
+}
+
+.calendar_m_w_table
+{
+	table-layout:fixed;
+	overflow:hidden;
+	height: 90%;
+	width: 100%;
+	border: 0px #000000 solid;
+}
+
+.calendar_m_w_tablecell
+{
+	overflow:hidden;
+	vertical-align: top;
+	padding-left: 4px;
+	padding-right: 4px;
+	padding-bottom: 6px;
+	border: 1px solid #000000;
+}
+
+.screen_only
+{
+	display:none;
+}
+
+.calendar_m_w_table_daynumber
+{
+	font-weight: bold;
+	font-family: Arial;
+	font-size: 10px;
+	vertical-align: top;
+	background-color: #778899;
+	border: 1px solid #000000;
+	margin: 1px;
+	padding: 1px;
+}
+
+A.event_entry
+{
+	font-size:10px;
+}
+
+/* month view */
+
+.calendar_month_identifier
+{
+	font-size:18px;
+	font-weight: bold;
+}
+
+.calendar_user_identifier
+{
+	font-size:12px;
+	color: #009999;
+	font-weight: bold;
+}
+
+.calendar_week_minical_table
+{
+	width:100%;
+	border: 0px solid #000000
+}
+
+.calendar_weekinfo
+{
+	color: #000000;
+	padding-left: 2px;
+	padding-right: 2px;
+	font-size: 10px;
+	font-weight: bold;
+	font-style: italic;
+}
Index: /contrib/Resources/templates/default/csv_import.tpl
===================================================================
--- /contrib/Resources/templates/default/csv_import.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/csv_import.tpl	(revision 3524)
@@ -0,0 +1,74 @@
+<!-- BEGIN filename -->
+	  		<TR>
+	    		<TD>{lang_csvfile}</td>
+				<td><INPUT NAME="csvfile" SIZE=30 TYPE="file" VALUE="{csvfile}"></td>
+			</tr>
+			<tr>
+				<td>{lang_fieldsep}</td>
+				<td><input name="fieldsep" size=1 value="{fieldsep}"></td>
+			</tr>
+			<tr>
+				<td>{lang_charset}</td>
+				<td>
+			{select_charset}
+				</td>
+			</tr>
+			<tr><td>&nbsp;</td>
+				<td><INPUT NAME="convert" TYPE="submit" VALUE="{submit}"></TD>
+			</TR>
+<!-- END filename -->
+
+<!-- BEGIN fheader -->
+			<tr>
+				<td><b>{lang_csv_fieldname}</b></td>
+				<td><b>{lang_info_fieldname}</b></td>
+				<td><b>{lang_translation}</b></td>
+			</tr>
+<!-- END fheader -->
+
+<!-- BEGIN fields -->
+			<tr>
+				<td>{csv_field}</td>
+				<td><SELECT name="cal_fields[{csv_idx}]">{cal_fields}</select></td>
+				<td><input name="trans[{csv_idx}]" size=60 value="{trans}"></td>
+			</tr>
+<!-- END fields -->
+
+<!-- BEGIN ffooter -->
+			<tr>
+				<td rowspan="2" valign="middle" nowrap><br>{submit}</TD>
+				<td colspan="2"><br>
+					{lang_start} <INPUT name="start" type="text" size="5" value="{start}"> &nbsp; &nbsp;
+					{lang_max} <INPUT name="max" type="text" size="3" value="{max}"><td>
+			</tr>
+			<tr>
+				<td colspan="2"><INPUT name="debug" type="checkbox" value="1"{debug}> {lang_debug}</td>
+			</TR>
+			<tr><td colspan="3">&nbsp;<p>
+				{help_on_trans}
+			</td></tr>
+<!-- END ffooter -->
+
+<!-- BEGIN imported -->
+			<tr>
+				<td colspan=2 align=center>
+					{log}<p>
+					{anz_imported}
+				</td>
+			</TR>
+<!-- END imported -->
+
+<!-- BEGIN import -->
+<br/>
+<center>
+		<form {enctype} action="{action_url}" method="post">
+		<table>
+
+		{rows}
+
+		</table>
+		{hiddenvars}
+		</form>
+
+</center>
+<!-- END import -->
Index: /contrib/Resources/templates/default/listUsers.php
===================================================================
--- /contrib/Resources/templates/default/listUsers.php	(revision 3524)
+++ /contrib/Resources/templates/default/listUsers.php	(revision 3524)
@@ -0,0 +1,167 @@
+<?php			
+	
+	$GLOBALS['phpgw_info']['flags'] = array(
+		'noheader' => True,
+		'nonavbar' => True,
+		'currentapp' => 'calendar'		
+	);
+	
+	include('../../../header.inc.php');
+	include('../../../phpgwapi/templates/default/head.inc.php');
+
+	$owner = $GLOBALS['_GET']['owner'];
+	
+	if(!@is_object($GLOBALS['phpgw']->js))	{
+		$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
+	}
+	
+	$GLOBALS['phpgw']->js->validate_file('jscode','scripts','preferences');		
+	$t = &$GLOBALS['phpgw']->template;						
+	// seta o Template
+	$t->set_file(array('addUser_t' => '../../../calendar/templates/default/listUsers.tpl'));
+	
+	$obj_account = CreateObject('phpgwapi.accounts',$this->bo->owner);
+
+	$post_select_organization = $_POST['select_organization'];
+	$post_select_sector = $_POST['select_sector'];
+	$change_organization = $_POST['change_organization'];
+	
+	$obj_org_sector = CreateObject('phpgwapi.sector_search_ldap');
+	if ((!$post_select_organization) && (!$post_select_sector)) //primeira vez
+	{
+		$user_org = $obj_account->get_organization($GLOBALS['phpgw_info']['user']['account_dn']);
+		$user_sector = $obj_account->get_sector($GLOBALS['phpgw_info']['user']['account_dn']);
+		$user_context = $obj_account->get_context($GLOBALS['phpgw_info']['user']['account_dn']);
+		
+		$organizations_info = $obj_org_sector->organization_search($GLOBALS['phpgw_info']['server']['ldap_context']);
+		@asort($organizations_info);
+		@reset($organizations_info);					
+		$sectors_info = $obj_org_sector->sector_search('ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context']);
+	}
+	else //mudou uma das combos
+	{
+		$user_org = $post_select_organization;
+		$user_sector = $post_select_sector;
+		if ($change_organization == "True")
+			$user_context = 'ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context'];
+		else
+			$user_context = $post_select_sector;
+		$organizations_info = $obj_org_sector->organization_search($GLOBALS['phpgw_info']['server']['ldap_context']);
+		@asort($organizations_info);
+		@reset($organizations_info);					
+		$sectors_info = $obj_org_sector->sector_search('ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context']);
+	}
+		
+	foreach($organizations_info as $organization)
+	{
+		$combo_organization .= '<option value="' . $organization . '"'; 	
+		
+		if (!$post_select_organization)
+		{
+			if(strtolower($organization) == strtolower($user_org))
+			{
+				$combo_organization .= ' selected';
+			}
+		}
+		else
+		{
+			if(strtolower($organization) == strtolower($post_select_organization))
+			{
+				$combo_organization .= ' selected';
+			}
+		}	
+		$combo_organization .= '>' .$organization.'</option>'."\n";
+	}
+	
+	$combo_sector .= '<option value="ou='.$user_org.','.$GLOBALS['phpgw_info']['server']['ldap_context'].'"> --------- </option>'."\n";
+	foreach($sectors_info as $sector)
+	{
+		if ($sector->sector_level == 1)
+		{
+			$sector->sector_name = '- '.$sector->sector_name;
+		}
+		else
+		{
+			$sector_space = '';
+			for ($i=1; $i < $sector->sector_level; $i++)
+				$sector_space = '---'.$sector_space;
+			$sector->sector_name = $sector_space.' '.$sector->sector_name;
+		}
+	
+		$combo_sector .= '<option value="' . $sector->sector_context . '"';
+
+		if (!$post_select_sector)
+		{
+			if($sector->sector_name == $user_sector)
+				$combo_sector .= ' selected';
+		}
+		else
+		{
+			if($sector->sector_context == $post_select_sector)
+				$combo_sector .= ' selected';
+		}
+		$combo_sector .= '>' .$sector->sector_name.'</option>'."\n";
+	}			
+	
+	// Monta lista de Grupos e Usuários
+	$users = Array();
+	$groups = Array();
+
+	$ds = $GLOBALS['phpgw']->common->ldapConnect();
+    if ($ds) 
+    {
+		$sr=ldap_list($ds, $user_context, ("(&(cn=*)(phpgwaccounttype=g))"));
+		$info = ldap_get_entries($ds, $sr);
+		for ($i=0; $i<$info["count"]; $i++)
+			$groups[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g);
+
+		$sr=ldap_list($ds, $user_context, ("(&(cn=*)(phpgwaccounttype=u)(!(cn=lista*)))"));
+		$info = ldap_get_entries($ds, $sr);
+		for ($i=0; $i<$info["count"]; $i++)
+		{
+			if ($info[$i]["phpgwaccountvisible"][0] == '-1')
+				continue;
+			$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u);
+		}
+	}
+	ldap_close($ds);
+    	
+	@asort($users);
+	@reset($users);	
+	@asort($groups);
+	@reset($groups);
+
+	$options ='';
+	if(count($groups))
+		$options .= '<option  value="-1" disabled>--------------------&nbsp;&nbsp;&nbsp;&nbsp;Grupos&nbsp;&nbsp;&nbsp;&nbsp;------------------- </option>'."\n";
+		
+	foreach($groups as $id => $user_array) {
+			$newId = $id.'U';
+			$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).$array_app.'</option>'."\n";
+	}
+	
+	if(count($users))
+		$options .= '<option  value="-1" disabled>-------------------&nbsp;&nbsp;&nbsp;&nbsp;Usuários&nbsp;&nbsp;&nbsp;&nbsp;------------------ </option>'."\n";
+	
+	foreach($users as $id => $user_array) {
+		if($owner != $id){
+			$newId = $id.'U';
+			$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).$array_app.'</option>'."\n";
+		}
+	}
+
+	$t->set_var ('lang_Organization',lang('Organization'));
+	$t->set_var ('lang_Sector',lang('Sector'));
+	$t->set_var ('lang_Calendar',lang('Calendar'));
+	$t->set_var ('lang_Add_Participants',lang('Add Participants'));
+	$t->set_var ('lang_to_Search',lang('to Search'));
+	$t->set_var ('lang_Close',lang('Close'));
+	$t->set_var ('lang_Add',lang('Add'));
+	
+	$t->set_var('options',$options);
+	$t->set_var('combo_organization', $combo_organization);
+	$t->set_var('combo_sector', $combo_sector);
+	$t->parse('out','addUser_t',true);
+	$t->p('out');
+	$GLOBALS['phpgw']->common->phpgw_exit();	
+?>
Index: /contrib/Resources/templates/default/month.tpl
===================================================================
--- /contrib/Resources/templates/default/month.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/month.tpl	(revision 3524)
@@ -0,0 +1,6 @@
+
+<table id="calendar_month_table" width="100%" border="0" bordercolor="#FFFFFF" cellspacing="2" cellpadding="2" cols={cols}>
+	{row}
+</table>
+
+
Index: /contrib/Resources/templates/default/viewDocument.tpll
===================================================================
--- /contrib/Resources/templates/default/viewDocument.tpll	(revision 3524)
+++ /contrib/Resources/templates/default/viewDocument.tpll	(revision 3524)
@@ -0,0 +1,499 @@
+<!-- BEGIN main -->
+
+<table width="100%" border="0" cellspacing="0" cellpading="0" bgcolor="white" hheight="100px">
+	<tr class="topRow">
+		<th width="33%">{download}</th>
+		<th width="33%">{view_online}</th>
+		<th width="33%">{delete}</th>
+	</tr>
+</table>
+<br>
+<table width="100%" border="0" cellspacing="0" cellpading="0">
+	<tr>
+		<th width="20%" id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);" style="font-size:10px;">{lang_informations}</a></th>
+		<th width="20%" id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);" style="font-size:10px;">{lang_all_versions}</a></th>
+		<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">{lang_linked_documents}</a></th>
+		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">{lang_notifications}</a></th>
+		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>
+	</tr>
+</table>
+<div style="border-left: dotted 1px grey; border-bottom: dotted 1px grey; border-right: dotted 1px grey; background: white;">
+<div id="tabcontent1" class="inactivetab" bgcolor="white">
+	{informations}
+</div>
+
+<div id="tabcontent2" class="inactivetab">
+
+	<table cellspacing="5" cellpadding="0" border="0" width="100%">
+		<tr>
+			<td></td>
+			<td></td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_version}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_upload_date}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_comment}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_uploaded_by}</i></td>
+			<!-- if (($document->getAccessMode($user) >= M_READWRITE) && (count($versions) > 1))
+ -->
+			<td></td>
+		</tr>
+		{versions}
+	</table>
+</div>
+
+<div id="tabcontent3" class="inactivetab">
+<!--
+<table cellspacing="5" cellpadding="0" border="1">
+	<?
+	if ($rownum > 1)
+	{
+		?>
+		<tr>
+		<td></td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("name");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("comment");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("document_link_by");?></i></td>
+		<td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?printMLText("document_link_public");?></i></td>
+		<td></td>
+		</tr>
+		<?
+		foreach($links as $link)
+		{
+			$responsibleUser = $link->getUser();
+			$targetDoc = $link->getTarget();
+			
+			print "<tr>";
+			print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+			print "<td class=\"linklist\"><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
+			print "<td class=\"linklist\">".$targetDoc->getComment()."</td>";
+			print "<td class=\"linklist\">".$responsibleUser->getFullName()."</td>";
+			print "<td class=\"linklist\">" . (($link->isPublic()) ? getMLText("yes") : getMLText("no")) . "</td>";
+			print "<td>";
+			if (($user->getID() == $responsibleUser->getID()) || ($user->getID() == $settings->_adminID) || ($link->isPublic() && ($document->getAccessMode($user) >= M_READWRITE )))
+				print "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\"><img src=\"images/del.gif\" border=0></a>";
+			print "</td>";
+			print "</tr>";
+		}
+	}
+	else
+		print "<tr><td class=\"filelist\">".getMLText("no_document_links")."</td></tr>";
+	?>
+</table>
+
+
+if ($user->getID() != $settings->_guestID)
+
+	<form action="../op/op.AddDocumentLink.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?printMLText("choose_target_document");?>:</td>
+			<td><?printDocumentChooser("form1");?></td>
+		</tr>
+		<?
+			if ($document->getAccessMode($user) >= M_READWRITE)
+			{
+				print "<tr><td class=\"inputDescription\">".getMLText("document_link_public")."</td><td class=\"inputDescription\">";
+				print "<input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes") . "&nbsp;&nbsp;";
+				print "<input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no");
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit" value="<?printMLText("add_document_link");?>"></td>
+		</tr>
+	</table>
+	</form>-->
+</div>
+
+<div id="tabcontent4" class="inactivetab">
+	<table cellspacing="0" cellpadding="5" border="0" width="100%">
+		<tr>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+			<td style="border-bottom: 1pt solid #000080;" class="notifylist"><i>{lang_name}</i></td>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+		</tr>
+		{notifications}
+		<tr>
+			<td colspan="3">&nbsp;</td>
+		</tr>
+	</table>
+
+	<form action="{notify_form_action}" method="post" name="notify_form">
+		<fieldset><legend>{lang_add_notification}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_userid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_groupid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+	</form>
+</div>
+
+<div id="tabcontent5" class="inactivetab">
+	{change_owner}
+	{display_acl}
+</div>
+
+<div id="tabcontent6" class="inactivetab">
+	<form enctype="multipart/form-data" name="update_file_form" method="post" action="{action_update_file}">
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input type="file" name="userfile"></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;"></textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire_update}
+				<span id="jscalspan_update" class="{expire_class_update}">{expire_date_update}</span>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_update}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="javascript:tab.display(1);">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</form>
+</div>
+
+
+
+</div>
+<!-- END main -->
+
+<!-- BEGIN lock_row -->
+	<tr class="row_off">
+		<td class="description" valign="top">{lang_lock_status}:</td>
+		<td class="infos" colspan="2">
+			<input id="lockStatus" type="hidden" name="lockStatus" value="unchanged">
+			<input type="checkbox" onchange="javascript:toggleLock(this);" {checked_lock_status}>
+			<div id="currentLockStatus" class="active">
+				{lang_current_status}
+			</div>
+			<div id="lockFile" class="inactive">
+				{lang_file_gets_unlocked}
+			</div>
+			<div id="unlockFile" class="inactive">
+				{lang_file_gets_locked}
+			</div>
+		</td>
+	</tr>
+<!-- END lock_row -->
+
+<!-- BEGIN version_row -->
+	<tr>
+		<td>
+			{url_view_online}
+		</td>
+		<td>
+			<a href="{url_download_file}" class="oldcontent"><img src="{download_image}" width=22 height=22 border=0 title="{lang_download}"></a>
+		</td>
+		<td class="filelist" align="center">{version_version}</td>
+		<td class="filelist">{version_date}</td>
+		<td class="filelist">{version_comment}</td>
+		<td class="filelist">{version_uploadingUser}</td>
+		<td>{url_delete_file}</td>
+	</tr>
+<!-- END version_row -->
+
+<!-- BEGIN information_ro -->
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr>
+			<td class="infos" valign="top" width="150px">{lang_filename}:</td>
+			<td style="border-left: 1pt solid #000080;" rowspan="14" width="1px">&nbsp;</td>
+			<td class="infos">{filename}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_owner}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment}:</td>
+			<td class="infos">{comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_creation_date}:</td>
+			<td class="infos">{creation_date}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_keywords}:</td>
+			<td class="infos">{keywords}</td>
+		</tr>
+		{locking}
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_mime_type}:</td>
+			<td class="infos">
+				<img align="absmiddle" src="images/icons/<?print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top">
+				{expire_date_ro}
+			</td>
+		</tr>
+	</table>
+<!-- END information_ro -->
+
+<!-- BEGIN information_rw -->
+	<form name="info_form" method="post" action="{action_informations}">
+	<fieldset><legend>{lang_general_information}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos"><input style="width: 100%; border: dotted 1px silver;" type="text" name="fname" value="{filename}"></td>
+			<td align="center" width="150px"><a href="#" tabindex="0" onfocus="tab.display(6);" onclick="tab.display(6); return(false);" style="font-size:10px;">{lang_update_document}</a></td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos">
+				<input id="targetname" style="width: 100%; border: dotted 1px silver;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="unchanged">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder({current_folder_id},'info_form'); return(false);" style="font-size:10px;">{lang_move_document}</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_owner}:</td>
+			<td class="infos" colspan="2">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_creation_date}:</td>
+			<td class="infos" colspan="2">{creation_date}</td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;">{comment}</textarea></td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_keywords}:</td>
+			<td class="infos" colspan="2"><textarea name="keywords" style="width: 100%;">{keywords}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire}
+				<span id="jscalspan" class="{expire_class}">{expire_date}</span>
+			</td>
+		</tr>
+		{locking}
+		<tr class="row_on">
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_save}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="window.close()">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_information_about_last_update}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+			<td class="description" valign="top" width="150px">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+			<td class="description" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top" colspan="3">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="description" valign="top">{lang_mime_type}:</td>
+			<td class="infos" colspan="3">
+				<img align="absmiddle" src="images/icons/<?print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	</form>
+<!-- END information_rw -->
+
+<!-- BEGIN block_download -->
+<a href="{download_link}"><img src="{download_image}" align="middle" border="0">{lang_download}</a>
+<!-- END block_download -->
+
+<!-- BEGIN block_view_online -->
+<a target="_blank" href="{view_link}"><img src="{view_image}" align="middle" border="0">{lang_view_online}</a>
+<!-- END block_view_online -->
+
+<!-- BEGIN block_delete -->
+<a href="{delete_link}" onClick="return confirm('{lang_confirm_delete}');"><img src="{delete_image}" align="middle" border="0">{lang_delete}</a>
+<!-- END block_delete -->
+
+<!-- BEGIN notification_row -->
+	<tr>
+		<td><img src="{notify_image}" width=16 height=16></td>
+		<td class="notifylist">{notify_username}</td>
+		<td align="right"><a href="{link_notify_delete}"><img title="{lang_delete_this_notification}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+<!-- END notification_row -->
+
+<!-- BEGIN block_change_owner -->
+	<form name="change_owner" action="{action_change_owner}" method="post">
+		<fieldset><legend>{lang_owner}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_ownerid}
+				</td>
+				<td><input type="Submit"></td>
+			</tr>
+		</table>
+		</fieldset>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>&nbsp;</td>
+			</tr>
+		</table>
+	</form>
+<!-- END block_change_owner -->
+
+<!-- BEGIN block_acl_inherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_acl_get_inherited}</div>
+	<p>
+	<a href="{link_acl_copy}">{lang_copy_acl}</a><br>
+	<a href="{link_acl_empty}">{lang_create_empty_acl}</a><br>
+	</fieldset>
+<!-- END block_acl_inherite -->
+
+<!-- BEGIN block_acl_notinherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_inherite_acl_again}</div>
+	<p>
+	<a href="{link_acl_inherit_again}">{lang_inherit_acl_again}</a><br>
+
+	<fieldset><legend>{lang_default_access}</legend>
+	<form name="change_default_access" action="{action_change_default_access}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_default_access}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	<fieldset><legend>{lang_current_acl}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td></td>
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_name}</i></td>
+				<!-- <td rowspan="<?print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td> -->
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_access_mode}</i></td>
+				<td></td>
+				<td></td>
+			</tr>
+			{acls}
+		</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_add_acl}</legend>
+	<form name="add_acl" action="{action_add_acl}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_add_acl_userid}
+				</td>
+				<td rowspan="3">
+					<input type="Submit">
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_add_acl_groupid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_permission}:</td>
+				<td>
+					{select_add_acl_permission}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	</fieldset>
+<!-- END block_acl_notinherite -->
+
+<!-- BEGIN acl_row -->
+	<form method="post" action="{action_acl_row}">
+	<tr>
+		<td width="20px"><img src="{acl_image}" width=16 height=16></td>
+		<td class="acllist">{acl_username}</td>
+		<td class="acllist" width="310px">{acl_selectbox}</td>
+		<td width="20px"><input type="Image" src="{save_image}" alt="{lang_save}"></td>
+		<td width="20px" align="right"><a href="{link_acl_delete}" onClick="return confirm('{lang_confirm_acl_delete}');"><img title="{lang_delete_this_acl}" alt="{lang_delete}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+	</form>
+<!-- END acl_row -->
+
Index: /contrib/Resources/templates/default/edit.xet
===================================================================
--- /contrib/Resources/templates/default/edit.xet	(revision 3524)
+++ /contrib/Resources/templates/default/edit.xet	(revision 3524)
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<!-- $Id: edit.xet 23270 2007-01-12 01:27:37Z ralfbecker $ -->
+<overlay>
+	<template id="timesheet.edit.general" template="" lang="" group="0" version="1.3.001">
+		<grid width="100%" height="150">
+			<columns>
+				<column width="95"/>
+				<column width="120"/>
+				<column width="80"/>
+				<column/>
+			</columns>
+			<rows>
+				<row class="row">
+					<description options=",,,ts_title" value="Title"/>
+					<textbox size="65" maxlength="80" id="ts_title" blur="@ts_title_blur" span="all"/>
+				</row>
+				<row class="row">
+					<description options=",,,cat_id" value="Category"/>
+					<menulist span="all">
+						<menupopup type="select-cat" id="cat_id" options="None"/>
+					</menulist>
+				</row>
+				<row class="row">
+					<description options=",,,ts_start" value="Date"/>
+					<date id="ts_start" needed="1" options=",8"/>
+					<description value="Starttime"/>
+					<date-timeonly id="start_time"/>
+				</row>
+				<row class="row">
+					<description options=",,,ts_duration" value="Duration"/>
+					<date-duration id="ts_duration" options=",hm"/>
+					<description value="or endtime" class="noWrap"/>
+					<date-timeonly id="end_time"/>
+				</row>
+				<row class="row">
+					<description options=",,,ts_quantity" value="Quantity"/>
+					<textbox type="float" id="ts_quantity" statustext="empty if identical to duration" blur="@ts_quantity_blur" precision="3" span="all"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.edit.notes" template="" lang="" group="0" version="0.1.001">
+		<grid width="100%" height="150">
+			<columns>
+				<column/>
+			</columns>
+			<rows>
+				<row class="row" valign="top">
+					<textbox multiline="true" rows="8" cols="70" id="ts_description"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.edit.links" template="" lang="" group="0" version="0.1.001">
+		<grid width="100%" height="150" overflow="auto">
+			<columns>
+				<column width="100"/>
+				<column/>
+			</columns>
+			<rows>
+				<row class="th" disabled="@view">
+					<description span="all" value="Create new links"/>
+				</row>
+				<row class="row" disabled="@status_only">
+					<link-to span="all" id="link_to"/>
+				</row>
+				<row class="th">
+					<description span="all" value="Existing links"/>
+				</row>
+				<row class="row_off" valign="top">
+					<link-list span="all" id="link_to"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.edit" template="" lang="" group="0" version="1.3.002">
+		<grid width="100%">
+			<columns>
+				<column width="100"/>
+				<column/>
+			</columns>
+			<rows>
+				<row disabled="!@msg">
+					<description span="all" class="redItalic" id="msg" no_lang="1" align="center"/>
+					<description/>
+				</row>
+				<row class="th" height="28">
+					<description options=",,,ts_owner" value="User"/>
+					<menulist span="all">
+						<menupopup id="ts_owner" no_lang="1"/>
+					</menulist>
+				</row>
+				<row class="row">
+					<description options=",,,ts_project" value="Project"/>
+					<grid spacing="1" padding="1">
+						<columns>
+							<column/>
+						</columns>
+						<rows>
+							<row disabled="@pm_integration=none">
+								<projectmanager-select options="None" id="pm_id" span="all" statustext="Select a project" onchange="1"/>
+							</row>
+							<row disabled="@pm_integration=full">
+								<textbox id="ts_project" blur="@ts_project_blur" size="65" maxlength="80"/>
+							</row>
+						</rows>
+					</grid>
+				</row>
+				<row class="row">
+					<description options=",,ts_unitprice" value="Unitprice"/>
+					<grid>
+						<columns>
+							<column disabled="@pm_integration=none"/>
+							<column/>
+						</columns>
+						<rows>
+							<row>
+								<projectmanager-pricelist id="pl_id" options="None,all_pm_ids,ts_unitprice" onchange="this.form['exec[ts_unitprice]'].value=this.options[this.selectedIndex].text.lastIndexOf('(') &lt; 0 ? '' : this.options[this.selectedIndex].text.slice(this.options[this.selectedIndex].text.lastIndexOf('(')+1,-1);"/>
+								<textbox type="float" id="ts_unitprice" span="all"/>
+							</row>
+						</rows>
+					</grid>
+				</row>
+				<row>
+					<tabbox span="all">
+						<tabs>
+							<tab label="General" statustext=""/>
+							<tab label="Notes" statustext=""/>
+							<tab label="Links" statustext=""/>
+						</tabs>
+						<tabpanels>
+							<template id="timesheet.edit.general"/>
+							<template id="timesheet.edit.notes"/>
+							<template id="timesheet.edit.links"/>
+						</tabpanels>
+					</tabbox>
+				</row>
+				<row class="row" disabled="!@ts_modified">
+					<description value="Last modified"/>
+					<hbox>
+						<date-time id="ts_modified" readonly="true"/>
+						<menulist>
+							<menupopup type="select-account" id="ts_modifier" label="by" readonly="true"/>
+						</menulist>
+					</hbox>
+				</row>
+				<row>
+					<hbox options="0" span="2" orient="0">
+						<hbox>
+							<button label="Edit" id="button[edit]" statustext="Edit this entry"/>
+							<button id="button[save_new]" label="Save &amp; New" statustext="Saves this entry and add a new one"/>
+							<button id="button[save]" label="Save" statustext="Saves the changes made"/>
+							<button id="button[apply]" label="Apply" statustext="Applies the changes made"/>
+							<button id="button[cancel]" label="Cancel" statustext="closes the window without saving the changes" onclick="window.close();"/>
+							<html id="js"/>
+						</hbox>
+						<button label="Delete" align="right" id="button[delete]" statustext="Delete this entry" onclick="return confirm('Delete this entry');"/>
+					</hbox>
+				</row>
+			</rows>
+		</grid>
+	</template>
+</overlay>
Index: /contrib/Resources/templates/default/search2.tpl
===================================================================
--- /contrib/Resources/templates/default/search2.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/search2.tpl	(revision 3524)
@@ -0,0 +1,174 @@
+<!-- BEGIN search -->
+
+<script language="Javascript">
+  
+    function submitit(form,campo)
+{
+
+ var texto;
+ 
+texto=document.form.start.value;
+
+
+      var url = document.location.href;
+
+      partes = url.split('/');
+
+      page=partes[partes.length-1];
+
+      partes2=page.split('&');
+
+     
+form.action=page+'&fecha='+texto;
+form.action='index.php?menuaction=resources.uiresources.search2&fecha='+texto+'&'+partes2[partes2.length-1];
+//self.location.href=page+'&fecha='+texto;
+form.submit();
+	//form.submit_button.value = '';
+	return false;
+	
+}
+ 
+</script>
+<center>
+
+<table id="calendar_search_table" width="90%">
+
+<tr><td align=left>
+<form  METHOD=POST name="form">
+<input type=hidden name=ordena value="">
+	<table><tr class="th">
+	
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Nombre</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Descripci&oacute;n</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+	
+	
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Ubicaci&oacute;n</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Grupos</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+	<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Prioridad</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Public</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Fecha
+
+<input id="start[str]" name="start" size="10"  onchange="return submitit(this.form)" type="text">
+<script type="text/javascript">
+	document.writeln('<img id="start[str]-trigger" src="phpgwapi/templates/default/images/datepopup.gif" title="Seleccionar fecha" style="cursor:pointer; cursor:hand;"/>');
+	Calendar.setup(
+	{
+		inputField  : "start[str]",
+		button      : "start[str]-trigger"
+	}
+	);
+</script>
+
+</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Due&ntilde;o</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+					
+	
+	</tr>
+
+	<tr>
+		<td colspan="2" align="center" bgcolor="{th_bg}">
+			<b></b>
+		</td>
+	</tr>
+	{rows}
+</form>
+</table>
+<!-- END search -->
+
+<!-- BEGIN search_list_header -->
+
+<!-- END search_list_header -->
+
+<!-- BEGIN search_list -->
+	<tr bgcolor="{tr_color}">
+		
+<td>	{name}</td>
+<td>{description}</td>
+<td>	{location}</td>
+<td>	{groups}</td>
+<td>	{priority}</td>
+<td>	{ispublic}</td>
+<td>	{fecha}</td>
+<td>{owner}</td>
+
+
+
+
+	</tr>
+<!-- END search_list -->
+
+<!-- BEGIN search_list_footer -->
+
+<!-- END search_list_footer -->
Index: /contrib/Resources/templates/default/header.inc.php
===================================================================
--- /contrib/Resources/templates/default/header.inc.php	(revision 3524)
+++ /contrib/Resources/templates/default/header.inc.php	(revision 3524)
@@ -0,0 +1,54 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare                                                               *
+  * http://www.egroupware.org                                                *
+  * --------------------------------------------                             *
+  *  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; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	function add_col(&$tpl,$str)
+	{
+		$tpl->set_var('str',$str);
+		$tpl->parse('header_column','head_col',True);
+	}
+
+	function add_image_ahref($link,$image,$alt)
+	{
+		return '<a href="'.$link.'"><img src="'.$GLOBALS['phpgw']->common->image('calendar',$image).'" alt="'.$alt.'" title="'.$alt.'" border="0"></a>';
+	}
+
+	$refer = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
+	$referrer = $refer[2];
+
+	$templates = Array(
+		'head_tpl'	=> 'head.tpl',
+		'form_button_dropdown'	=> 'form_button_dropdown.tpl',
+		'form_button_script'	=> 'form_button_script.tpl'
+	);
+	$tpl->set_file($templates);
+	$tpl->set_block('head_tpl','head','head');
+	$tpl->set_block('head_tpl','head_table','head_table');
+	$tpl->set_block('head_tpl','head_col','head_col');
+	$tpl->set_block('form_button_script','form_button');
+
+	
+		$tpl->set_var('cols',3);
+	
+
+	$today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+	//$col_width = 12;
+//add_col($tpl,'  <td >&nbsp;</td>');
+
+
+	$tpl->parse('row','head_table',True);
+
+	$tpl->set_var('header_column','');
+	$tpl->set_var('cols',$cols);
+
+	
+?>
Index: /contrib/Resources/templates/default/holiday.tpl
===================================================================
--- /contrib/Resources/templates/default/holiday.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/holiday.tpl	(revision 3524)
@@ -0,0 +1,33 @@
+<!-- BEGIN form -->
+<center>
+{message}<br>
+<table border="0" width="80%" cellspacing="2" cellpadding="2"> 
+ <form name="form" action="{actionurl}" method="POST">
+  {hidden_vars}
+{rows}
+ <tr>
+  <td colspan="2">
+   <table width="100%" border="0" cellspacing="5">
+    <tr>
+     <td>
+      <input type="submit" name="submit" value="{lang_add}"></form>
+     </td>
+     <td>
+      {cancel_button}
+     </td>
+     <td align="right" width="80%">
+      {delete_button}
+     </td>
+    </tr>
+   </table>
+  <td>
+ </tr>
+</table>
+</center>
+<!-- END form -->
+<!-- BEGIN list -->
+ <tr bgcolor="{tr_color}">
+  <td valign="top" width="35%"><b>{field}:</b></td>
+  <td valign="top" width="65%">{data}</td>
+ </tr>
+<!-- END list -->
Index: /contrib/Resources/templates/default/alarm.tpl
===================================================================
--- /contrib/Resources/templates/default/alarm.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/alarm.tpl	(revision 3524)
@@ -0,0 +1,62 @@
+<!-- BEGIN alarm_management -->
+<form id="calendar_alarmform" action="{action_url}" method="post" name="alarmform">
+{hidden_vars}
+	<table id="calendar_alarmform_table" border="0" width="90%" align="center">
+		{rows}
+		<tr>
+			<td colspan="4">
+				<br>&nbsp;{input_days}&nbsp;{input_hours}&nbsp;{input_minutes}&nbsp;{input_owner}&nbsp;{input_add}<br>&nbsp;
+			</td>
+			<td align="right">
+				{input_cancel}
+			</td>
+		</tr>
+	</table>
+</form>
+<!-- END alarm_management -->
+
+<!-- BEGIN alarm_headers -->
+	<tr bgcolor="{tr_color}">
+		<th align="left" width="25%">{lang_time}</th>
+		<th align="left" width="30%">{lang_text}</th>
+		<th align="left" width="25%">{lang_owner}</th>
+		<th width="10%">{lang_enabled}</th>
+		<th width="10%">{lang_select}</th>
+	</tr>
+<!-- END alarm_headers -->
+
+<!-- BEGIN list -->
+	<tr bgcolor="{tr_color}">
+		<td>
+			<b>{field}:</b>
+		</td>
+		<td>
+			{data}
+		</td>
+		<td>
+			{owner}
+		</td>
+		<td align="center">
+			{enabled}
+		</td>
+		<td align="center">
+			{select}
+		</td>
+	</tr>
+<!-- END list -->
+
+<!-- BEGIN hr -->
+	<tr bgcolor="{th_bg}">
+		<td colspan="5" align="center">
+			<b>{hr_text}</b>
+		</td>
+	</tr>
+<!-- END hr -->
+
+<!-- BEGIN buttons -->
+	<tr>
+		<td colspan="6" align="right">
+			{enable_button}&nbsp;{disable_button}&nbsp;{delete_button}
+		</td>
+	</tr>
+<!-- END buttons -->
Index: /contrib/Resources/templates/default/pref.tpl
===================================================================
--- /contrib/Resources/templates/default/pref.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/pref.tpl	(revision 3524)
@@ -0,0 +1,22 @@
+<!-- BEGIN pref -->
+<p><b>{title}:</b><hr><p>
+<form action="{action_url}" method="POST">
+ <table border="0" align="center" width="90%">
+  {row}
+ </table>
+ <center><input type="submit" name="submit" value="{submit_lang}"></center>
+</form>
+<!-- END pref -->
+
+<!-- BEGIN pref_colspan -->
+  <tr bgcolor="{bg_color}">
+   <td colspan="2">{text}</td>
+  </tr>
+<!-- END pref_colspan -->
+
+<!-- BEGIN pref_list -->
+  <tr bgcolor="{bg_color}">
+   <td align="right">{field}</td>
+   <td align="center">{data}</td>
+  </tr>
+<!-- END pref_list -->
Index: /contrib/Resources/templates/default/confirm.tpl
===================================================================
--- /contrib/Resources/templates/default/confirm.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/confirm.tpl	(revision 3524)
@@ -0,0 +1,31 @@
+<!-- BEGIN list -->
+<html>
+<head>
+<title> .: Expresso :. </title>
+<link href='/phpgwapi/templates/classic/login.css' rel='stylesheet' type='text/css'>
+</head>
+<body class='body'>
+<br>
+<center>
+<table border='0' cellpading='0' cellspacing='0'>
+	<tr>
+		<td class='td'><b><font face='Verdana, Arial, Helvetica, sans-serif'>{notify_message}</font></b></td>
+	</tr>
+	<tr>
+</table>
+</center>
+<br>
+<center>
+<table border='0' cellpading='0' cellspacing='0'>
+<tr>
+	<td>
+		<form>
+		<input type='submit' value='Ok' onclick='javascript:window.close()'>
+		</form>
+	</td>
+</tr>
+</table>
+</center>
+</body>
+</html>
+<!-- END list -->
Index: /contrib/Resources/templates/default/month_header.tpl
===================================================================
--- /contrib/Resources/templates/default/month_header.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/month_header.tpl	(revision 3524)
@@ -0,0 +1,12 @@
+<!-- BEGIN monthly_header -->
+<tr class="calendar_m_w_table_header" colspan="{cols}" width="{col_width}%">
+{column_header}</tr>
+<!-- END monthly_header -->
+
+<!-- BEGIN column_title -->
+<th bGCOLOR="#D3DCE3" width="14.28%">{col_title}</th>
+<!-- END column_title -->
+
+<!-- BEGIN month_column -->
+<td class="calendar_m_w_tablecell" colspan="1" width="{col_width}%"{extra}>{column_data}</td>
+<!-- END month_column -->
Index: /contrib/Resources/templates/default/month_day_print.tpl
===================================================================
--- /contrib/Resources/templates/default/month_day_print.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/month_day_print.tpl	(revision 3524)
@@ -0,0 +1,26 @@
+
+<!-- BEGIN m_w_table -->
+
+<table id="calendar_m_w_table" class="calendar_m_w_table" border="0" width="100%">
+	<!-- from month_header.tpl -->
+	{row}
+</table>
+<!-- END m_w_table -->
+
+
+<table>
+<!-- BEGIN month_daily -->
+<tr><td style="font-size: 10px; font-weight: bold; text-decoration: underline;" width="10px">{day_number}</td>
+<td>{daily_events}</td>
+<!-- END month_daily -->
+
+<!-- BEGIN day_event -->
+
+<td>{events}</td>
+<!-- END day_event -->
+
+<!-- BEGIN event -->
+<td>{day_events}</td></tr>
+<!-- END event -->
+<br />
+</table>
Index: /contrib/Resources/templates/default/footer.tpl
===================================================================
--- /contrib/Resources/templates/default/footer.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/footer.tpl	(revision 3524)
@@ -0,0 +1,64 @@
+<!-- BEGIN footer_table -->
+       <hr clear="all">
+       <font size="-1">
+       <table border="0" width="100%" cellpadding="0" cellspacing="0">
+        <tr>
+{table_row}
+	</tr>
+       </table>
+<!-- END footer_table -->
+<!-- BEGIN footer_row -->
+         <td valign="top" width="30%">
+          <font size="-1">
+           <form action="{action_url}" method="post" name="{form_name}">
+            <B>{label}:</B>
+			{hidden_vars}
+            <select name="{form_label}" onchange="{form_onchange}">
+	     {row}
+	    </select>
+	    <input type="hidden" name="user" value="{user}">
+	    <input type="hidden" name="dia_ini" value="{dia_ini}">
+            <noscript><input type="submit" value="{go}"></noscript>
+	   </form>
+	  </font>
+	 </td>
+<!-- END footer_row -->
+<!-- BEGIN blank_row -->
+         <td>
+         {b_row}
+         </td>
+         <td>
+         {b_row2}
+         </td>
+<!-- END blank_row -->
+
+<!-- BEGIN num_dias -->
+<td valign="top" width="30%">
+ <font size="-1">
+    <form action="{acao}" method="post" name="{formname}">
+    <span style="display: {display}" >
+ 
+	<label>
+		<b>{num_dias_label}:</b>
+	</label>
+	<select name="{num_dias_name}" onchange="{formonchange}"/>
+		{row_qtd}
+	</select>
+	<br />
+	<span style="font-size: 9px;">
+		{tip}
+	</span>
+	<br /> <br />
+    </span>
+<span style="display: {display}">
+	<b>{day_ini_label}:</b>
+	<select name="{day_ini_name}" onchange="{formonchange}">
+	{row_ini}
+	</select>
+	</span>
+<input type="hidden" name="user" value="{user}">
+	<noscript><input type="submit" value="{go}"></noscript>
+     </form>
+ </font>
+</td>
+<!-- END num_dias -->
Index: /contrib/Resources/templates/default/acl.tpl
===================================================================
--- /contrib/Resources/templates/default/acl.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/acl.tpl	(revision 3524)
@@ -0,0 +1,54 @@
+<center>
+  <table border="0" cellspacing="2" cellpadding="2" width="100%">
+   <tr>
+    <td colspan="5" align="center" bgcolor="#c9c9c9"><b>{title}<b/></td>
+   </tr>
+   <tr>
+    <td colspan="5" align="left">
+     <table border="0" width="100%">
+      <tr>
+	   {left}
+       <td align="center">{lang_showing}</td>
+	   {right}
+      </tr>
+     </table>
+    </td>
+   </tr>
+   <tr>
+    <td>&nbsp;</td>
+    <td colspan="5" align="right">
+	<form method="POST"><input type="text" name="query"  value="{query}" />&nbsp;<input type="submit" name="btnSearch" value="{lang_search}" /></form>
+	</td>
+  </tr>
+ </table>
+ <form method="POST">
+  <table border="0" cellspacing="2" cellpadding="2" width="100%">
+   <tr bgcolor="{th_bg}" valign="middle" align="center">
+	<td>{sort_cat}<br>{lang_cat_admin}</td>
+	<td>{lang_read}</td>
+	<td>{lang_write}<br>({lang_implies_read})</td>
+	<td>{lang_calread}</td>
+	<td>{lang_calbook}<br>({lang_implies_book})</td>
+   </tr>
+   <!-- BEGIN cat_list -->
+   <tr bgcolor="{tr_color}">
+	<td>
+		{catname}<input type="hidden" name="catids[]" value="{catid}" /><br>
+		<select name="inputadmin[{catid}][]">{admin}</select>
+	</td>
+	<td align="center"><select multiple="multiple" size="5" name="inputread[{catid}][]">{read}</select></td>
+	<td align="center"><select multiple="multiple" size="5" name="inputwrite[{catid}][]">{write}</select></td>
+	<td align="center"><select multiple="multiple" size="5" name="inputcalread[{catid}][]">{calread}</select></td>
+	<td align="center"><select multiple="multiple" size="5" name="inputcalbook[{catid}][]">{calbook}</select></td>
+   </tr>
+   <!-- END cat_list -->
+   <tr>
+    <td colspan="5" align="left">
+	<br>
+	<input type="submit" name="btnSave" value="{lang_save}"> &nbsp;
+	<input type="submit" name="btnDone" value="{lang_done}">
+    </td>
+   </tr>
+  </table>
+ </form>
+</center>
Index: /contrib/Resources/templates/default/custom_fields.tpl
===================================================================
--- /contrib/Resources/templates/default/custom_fields.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/custom_fields.tpl	(revision 3524)
@@ -0,0 +1,45 @@
+<!-- BEGIN custom_fields -->
+{lang_error}<br>
+<form action="{action_url}" method="post">
+ {hidden_vars}
+ <center>
+  <table border="0" width="90%">
+   <tr class="th">
+    <th align="left" width="30%">{lang_name}</th>
+    <th>{lang_length}</th>
+    <th>{lang_shown}</th>
+    <th>{lang_order}</th>
+    <th>{lang_title}</th>
+    <th>{lang_disabled}</th>
+    <th>&nbsp;</th>
+   </tr>
+   {rows}
+   <tr class="th">
+    <td>{name}</td>
+    <td align="center">{length}</td>
+    <td align="center">{shown}</td>
+    <td align="center">{order}</td>
+    <td align="center">{title}</td>
+    <td align="center">{disabled}</td>
+    <td align="center">{button}</td>
+   </tr>
+   <tr>
+    <td>{save_button} &nbsp; {cancel_button}</td>
+   </tr>
+  </table>
+ </center>
+</form>
+<br>
+<!-- END custom_fields -->
+
+<!-- BEGIN row -->
+   <tr bgcolor="{tr_color}">
+    <td>{name}</td>
+    <td align="center">{length}</td>
+    <td align="center">{shown}</td>
+    <td align="center">{order}</td>
+    <td align="center">{title}</td>
+    <td align="center">{disabled}</td>
+    <td align="center">{button}</td>
+   </tr>
+<!-- END row -->
Index: /contrib/Resources/templates/default/publicView.php
===================================================================
--- /contrib/Resources/templates/default/publicView.php	(revision 3524)
+++ /contrib/Resources/templates/default/publicView.php	(revision 3524)
@@ -0,0 +1,89 @@
+<?php 	
+	$user = $_POST['user'] ? $_POST['user'] : 
+		($_GET['user'] ? $_GET['user']: '');
+	
+	if($user) {
+		$organization = $_POST['organization'] ? $_POST['organization'] : 
+		($_GET['organization'] ? $_GET['organization']: '');
+		
+		if($organization)
+			$arg1 = $organization."-".$user;
+		else
+			$arg1 = $user;
+		
+		$params = "&account_name=".$arg1;
+	}
+	else
+		$params = '';
+?>
+<html>
+	<head><title>Visualizar Agenda</title>
+	<head>
+	<style type="text/css">
+		.grid_right{
+		border-style: groove;
+		border-width: 0px;
+		border-right-width: 1px;		
+		border-color: BLACK;		
+		}
+		.grid_top{
+		border-style: groove;
+		border-width: 0px;
+		border-top-width: 1px;		
+		border-color: BLACK;		
+		}
+	</style>
+	<LINK href="../../../phpgwapi/templates/default/css/azul.css" type=text/css rel=StyleSheet>
+	<script language="Javascript">
+		function validate(){
+			if(document.login.user.value =="")	{
+				alert('Você deve digitar um nome no campo Usuário.');
+				document.login.user.focus();
+				return false;
+			}
+			
+			return true;
+		}
+	</script>
+	</head>
+	<body>
+	  <div align="center" valign="center">
+		<table cellspacing="0" cellpadding="5" width="100%" height="100%">			
+			<tr><td width="10%" valign="center"  class="grid_right"><br>
+				<table border="0" cellpadding="0" cellspacing="0" class="login" height="100%" width="100%">
+					<tr>
+						<td valign="top">
+	  					<FORM name="login" method="post" action="publicView.php" onSubmit="javascript:return validate()">
+							<table border="0" cellpadding="0" cellspacing="0" class="tableLogin">
+								<tr>
+									<td width="66" class="loginLabel" align="center"><b>Organização</b><br><input type="text" value="<?=$organization?>" name="organization" size="15"></td>
+								</tr>
+								<tr>									
+									<td>&nbsp;</td>
+								</tr>
+								<tr>
+									<td width="136" align="center" class="loginLabel"><b>Usuário</b><br><input name="user" size="15" value="<?=$user?>"></td>
+								</tr>
+								<tr>									
+									<td height="16">&nbsp;</td>
+								</tr>
+								<tr>
+									<td width="135" colspan="2" align="center">						
+									<input type="submit" value="Visualizar" name="submitit" class=button >
+									</td>
+									</tr>
+							</table>
+							</FORM>
+						</td>
+					</tr>
+				</table>								
+			</td>
+				<td width="90%" valign="top">
+					<iframe  width="100%" height="95%" src="../../../index.php?menuaction=calendar.uipublicview.publicView<?=$params?>"
+						marginwidth="0" marginheight="0"  topmargin="0" leftmargin="0" frameborder="0" scrolling="auto" noresize>
+					</iframe>
+			</td></tr>
+		</table>
+	  </div>
+	</body>
+</html>
Index: /contrib/Resources/templates/default/search.tpl
===================================================================
--- /contrib/Resources/templates/default/search.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/search.tpl	(revision 3524)
@@ -0,0 +1,139 @@
+<!-- BEGIN search -->
+
+<script language="Javascript">
+  
+    function submitit(form,campo)
+{
+	//alert(name+' pressed');
+ var texto;
+  //  texto = "El numero de opciones del select: " + document.form.search_info_type.length;
+    var indice = document.form.search_info_type.selectedIndex;
+    //texto += "\nIndice de la opcion escogida: " + indice;
+    var valor = document.form.search_info_type.options[indice].value;
+   // texto += "\nValor de la opcion escogida: " + valor;
+    var textoEscogido = document.form.search_info_type.options[indice].text;
+  //  texto += "\nTexto de la opcion escogida: " + textoEscogido;
+  //  alert(texto) ;
+	//document.form.ordena.value = name;
+form.action='/index.php?menuaction=resources.uiresources.search&ordenar='+campo+'&valor='+valor;
+	form.submit();
+	//form.submit_button.value = '';
+	return false;
+}
+   function submitit2(id)
+{
+
+location.href='/index.php?menuaction=resources.uiresources.delete&id='+id;
+return false;	
+}
+</script>
+<center>
+
+<table id="calendar_search_table" width="90%">
+
+<tr><td align=left>
+<form  METHOD=POST name="form">
+<input type=hidden name=ordena value="">
+	<table><tr class="th">
+	<td>
+		<table>
+			
+			<tr>
+				<td class="inactiv_sortcolumn" align="left"></td>
+			</tr>
+		</table>
+
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Descripci&oacute;n</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+	
+	<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Categor&iacute;a <br>Administrador</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Ubicaci&oacute;n</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+	
+	<td class="noPrint" align="left" width="3%">Acci&oacute;n </td>
+
+	</td>
+	</tr>
+
+	<tr>
+		<td colspan="2" align="center" bgcolor="{th_bg}">
+			<b></b>
+		</td>
+	</tr>
+	{rows}
+</form>
+</table>
+<!-- END search -->
+
+<!-- BEGIN search_list_header -->
+
+<!-- END search_list_header -->
+
+<!-- BEGIN search_list -->
+	<tr bgcolor="{tr_color}">
+		
+<td>	{picture_src}</td>
+<td>{name}<br>{description}</td>
+
+
+<td>{category}<br>{administrador}</td>
+<td>	{location}</td>
+
+<td><table><tr>
+
+
+<td>
+<a href="{accionmodificar}"><img src=/resources/templates/default/images/edit.png alt="modificar"></a>&nbsp;&nbsp;&nbsp;
+</td>
+<td>
+<a href="{accionlistar}"><img src=/resources/templates/default/images/calendar.png alt="ver recursos asignados"></a>&nbsp;&nbsp;&nbsp;
+
+</td>
+<td>
+
+
+<a href="{accionreservar}"><img src=/resources/templates/default/images/bookable.png alt="reservar"></a>&nbsp;&nbsp;&nbsp;
+</td>
+<td>
+
+<a href="" onClick="if ( 0 || confirm('eliminar esta entrada?')) return submitit2('{accionborrar}');; "><img src=/infolog/templates/default/images/delete.png alt="borrar"></a><br>
+
+
+<br>
+
+</td>
+
+
+</tr></table></td>
+	</tr>
+<!-- END search_list -->
+
+<!-- BEGIN search_list_footer -->
+
+<!-- END search_list_footer -->
Index: /contrib/Resources/templates/default/copyFolder.tpl
===================================================================
--- /contrib/Resources/templates/default/copyFolder.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/copyFolder.tpl	(revision 3524)
@@ -0,0 +1,51 @@
+<!-- BEGIN main -->
+<script type='text/javascript'>
+	var folderChooserURL ='{folderChooserURL}';
+</script>
+
+<form name="copy_form" method="post" action="{form_action}">
+<fieldset><legend>{lang_target_folder}</legend>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos">
+				<input id="targetname" style="width: 100%;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="{folderid}">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder(1,'copy_form'); return(false);" style="font-size:10px;">{lang_select_target_folder}...</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_name}:</td>
+			<td class="infos">
+				<input id="newfoldername" style="width: 100%;" type="text" name="newfoldername" value="{newfoldername}">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder(1,'copy_form'); return(false);" style="font-size:10px;">&nbsp;</td>
+		</tr>
+	</table>
+</fieldset>
+<p>
+<fieldset><legend>{lang_copy_options}</legend>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_off">
+			<td class="infos">
+				<input type="checkbox" name="copy_subfolder" id="copy_subfolder"> <label for="copy_subfolder">{lang_copy_subfolders}</label>
+			</td>
+		</tr>
+		<tr class="row_off">
+			<td class="infos">
+				<input type="checkbox" name="copy_documents" id="copy_documents" disabled> <label for="copy_documents">{lang_copy_documents}</label>
+			</td>
+		</tr>
+	</table>
+</fieldset>
+<p>
+	<table border="0" cellspacing="0" cellpadding="5" width="100%">
+		<tr class="row_off">
+			<td class="infos">
+				<button type="submit" name="cancel">{lang_cancel}</button>
+				<button type="submit" name="copy">{lang_copy}</button>
+			</td>
+		</tr>
+	</table>
+</form>
+<!-- END main -->
Index: /contrib/Resources/templates/default/images/buttons/atualizar.sh
===================================================================
--- /contrib/Resources/templates/default/images/buttons/atualizar.sh	(revision 3524)
+++ /contrib/Resources/templates/default/images/buttons/atualizar.sh	(revision 3524)
@@ -0,0 +1,14 @@
+cp /public/home/desenvolvimento/arte/imagens_file_manager/up.png uplvl_big.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/refresh.png fs_refresh.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/new_folder.png new_folder.png
+
+cp /public/home/desenvolvimento/arte/imagens_file_manager/up_load.png upload.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/lixeira.png delete_big.png
+cp /public/home/desenvolvimento/arte/imagens_file_manager/cut.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/copy.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/sharing.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/searching.png ab_search.png
+
+cp /public/home/desenvolvimento/arte/imagens_file_manager/compress.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/decompress.png .
+cp /public/home/desenvolvimento/arte/imagens_file_manager/home.png .
Index: /contrib/Resources/templates/default/images/index.html
===================================================================
--- /contrib/Resources/templates/default/images/index.html	(revision 3524)
+++ /contrib/Resources/templates/default/images/index.html	(revision 3524)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+	<title>eGroupWare Info Log Icons</title>
+</head>
+
+<body bgcolor=Silver>
+	Types:<br>
+	<img src="phone.gif" width="20" height="20" alt="Telefon" border="0"> &nbsp;
+	<img src="task.gif" width="20" height="20" alt="Aufgabe" border="0"> &nbsp;
+	<img src="note.gif" width="20" height="20" alt="Notiz" border="0"> &nbsp;
+	<img src="confirm.gif" width="20" height="20" alt="Bestätigung" border="0"> &nbsp;
+	<img src="reject.gif" width="20" height="20" alt="Absage" border="0">
+	<p>
+	Status:<br>
+	<img src="offer.gif" width="20" height="20" alt="Angebot" border="0"> &nbsp;
+	<img src="ongoing.gif" width="20" height="20" alt="läuft" border="0"> &nbsp;
+	<img src="call.gif" width="20" height="20" alt="anrufen" border="0"> &nbsp;
+	<img src="will-call.gif" width="20" height="20" alt="ruft zurück" border="0"> 
+&nbsp;
+	<img src="done.gif" width="20" height="20" alt="erledigt" border="0"> &nbsp;
+	<img src="billed.gif" width="20" height="20" alt="abgerechnet" border="0">
+	<p>
+	Actions:<br>
+	<img src="new.gif" width="20" height="20" alt="neue Teilaufgabe" border="0"> 
+&nbsp;
+	<img src="view.gif" width="20" height="20" alt="Teilaufgagen anzeigen" 
+border="0"> &nbsp;
+	<img src="edit.gif" width="20" height="20" alt="bearbeiten" border="0"> &nbsp;
+	<img src="delete.gif" width="20" height="20" alt="löschen" border="0">
+</body>
+</html>
+
Index: /contrib/Resources/templates/default/overlap.tpl
===================================================================
--- /contrib/Resources/templates/default/overlap.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/overlap.tpl	(revision 3524)
@@ -0,0 +1,30 @@
+<!-- BEGIN overlap -->
+<center><br />
+<table id="calendar_overlap_table">
+	<tr>
+		<td>
+			{overlap_text}
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<ul>{overlap_list}</ul>
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<table id="calendar_overlap_table2" cellspacing="5">
+				<tr>
+					<td>
+						{resubmit_button}
+					</td>
+					<td>
+						{reedit_button}
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
+</center>
+<!-- END overlap -->
Index: /contrib/Resources/templates/default/day_list.tpl
===================================================================
--- /contrib/Resources/templates/default/day_list.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/day_list.tpl	(revision 3524)
@@ -0,0 +1,28 @@
+<!-- BEGIN day -->
+<div class="event-off">
+<table border="0" width="100%" cellpadding="0">
+	<tr>
+		<td class="event-on">
+{row}
+		</td>
+	</tr>
+</table>
+</div>
+<!-- END day -->
+<!-- BEGIN day_row -->
+    <font style="font-size: 8pt;">{event}</font>
+<!-- END day_row -->
+<!-- BEGIN day_event_on -->
+	<font class="event-on">{event}</font>
+<!-- END day_event_on -->
+<!-- BEGIN day_event_off -->
+	<font class="event-on">{event}</font>
+<!-- END day_event_off -->
+<!-- BEGIN day_event_holiday -->
+	{event}
+<!-- END day_event_holiday -->
+<!-- BEGIN day_time -->
+	{time}
+     <!--<td class="time" nowrap>{open_link}{time}{close_link}</td>-->
+<!-- END day_time -->
+
Index: /contrib/Resources/templates/default/grant_group_access.tpl
===================================================================
--- /contrib/Resources/templates/default/grant_group_access.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/grant_group_access.tpl	(revision 3524)
@@ -0,0 +1,65 @@
+<div align="center" style="width:100%">
+<input type="hidden" id="txt_loading" value="{lang_Loading}">
+<input type="hidden" id="txt_searching" value="{lang_Searching}">
+<input type="hidden" id="txt_users" value="{lang_Users}">
+<input type="hidden" id="txt_groups" value="{lang_Groups}">
+<input type="hidden" id="txt_confirm" value="{lang_confirm}">
+<input type="hidden" id="txt_success" value="{lang_success}">
+<input type="hidden" id="txt_exist" value="{lang_exist}">
+<input type="hidden" id="txt_nouser" value="{lang_nouser}">
+<input type="hidden" id="txt_nogroup" value="{lang_nogroup}">
+<input type="hidden" id="txt_nopermissiontype" value="{lang_nopermissiontype}">
+<input type="hidden" id="txt_typemoreletters" value="{lang_typemoreletters}">
+<input type="hidden" id="template_set" value="{template_set}">
+<table width="80%" border="0">
+<tr>
+<td align='center' valign="bottom"><br><b>{lang_User_to_grant_access}</b><br>
+	<font color="red"><span id="cal_span_searching1">&nbsp;</span></font>
+	<br>{lang_Search_for}: <input type="text" id="cal_input_searchUser1" name="cal_input_searchUser1" value="" size=30 autocomplete="off" onkeyup="javascript:search_object(this,'cal_span_searching1','user','u')"/>
+	<br><br>
+	<select id="user" style="width: 300px" size="13"></select>
+</td>
+<td width="20px" valign="middle" align="left"><br><br><br><br>
+<button type="button" onClick="javascript:add_user();"><img src="{template_set}/images/add.png" style="vertical-align: middle;" >{lang_Add}</button>
+<br><br><b>{lang_access_type}</b><br>
+<input type="checkbox" id="right_L" value="L"/>{lang_read}<br>
+<input type="checkbox" id="right_A" value="A"/>{lang_add}<br>
+<input type="checkbox" id="right_E" value="E"/>{lang_edit}<br>
+<input type="checkbox" id="right_R" value="R"/>{lang_delete}<br>
+<input type="checkbox" id="right_P" value="P"/>{lang_private}
+</td>
+<td align='center' valign="bottom"><br><b>{lang_Group_to_share_calendar}</b><br>
+	<font color="red"><span id="cal_span_searching2">&nbsp;</span></font>
+	<br>{lang_Search_for}:	<input type="text" id="cal_input_searchUser2" name="cal_input_searchUser2" value="" size=30 autocomplete="off" onkeyup="javascript:search_object(this,'cal_span_searching2','group','g')"/><br><br>
+	<select id="group" style="width: 300px" size="13"></select>
+</td>
+</tr>
+	<tr height="20px"></tr>
+	<tr bgcolor="{tr_color}" style="font-size:0.8em">
+		<th align="left" width="25%" nowrap>&nbsp;{lang_granted_user}</th>
+		<th align="center" width="1%">{lang_access_type}</th>
+		<th align="left" width="40%" nowrap>&nbsp;{lang_shared_group}</th>
+		<th width="1%">&nbsp;</th>
+	</tr>
+<tbody id='tbody_list' >
+<!-- BEGIN list -->
+	<tr id='{select}' bgcolor="{tr_color_header}">
+		<td>
+			<b>&nbsp;&nbsp;{granted_user}</b>
+		</td>
+		<td align="center">
+			{access_type}
+		</td>		
+		<td>
+			&nbsp;&nbsp;{shared_group}
+		</td>
+		<td align="center">
+			<button  title="{lang_Remove}" type="button" onClick="javascript:remove_user('{select}');"><img alt="{lang_Remove}" src="{template_set}/images/delete.png" style="vertical-align: middle;"/></button>
+		</td>
+	</tr>
+<!-- END list -->
+</tbody>
+</table>
+<br><br>
+</div>
+{scripts}
Index: /contrib/Resources/templates/default/index.xet
===================================================================
--- /contrib/Resources/templates/default/index.xet	(revision 3524)
+++ /contrib/Resources/templates/default/index.xet	(revision 3524)
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<!-- $Id: index.xet 24276 2007-07-10 07:35:18Z ralfbecker $ -->
+<overlay>
+	<template id="timesheet.index.dates" template="" lang="" group="0" version="1.2.001">
+		<hbox rows="1" cols="1" class="custom_hide">
+			<description value="Start"/>
+			<date id="startdate"/>
+			<description value="End"/>
+			<date id="enddate" statustext="Leave it empty for a full week"/>
+		</hbox>
+		<styles>
+			.custom_hide { visibility: hidden; }
+		</styles>
+	</template>
+	<template id="timesheet.index.add" template="" lang="" group="0" version="1.3.001">
+		<button label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.edit'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;"/>
+	</template>
+	<template id="timesheet.index.rows" template="" lang="" group="0" version="1.3.002">
+		<grid width="100%">
+			<columns>
+				<column width="15%"/>
+				<column width="50%"/>
+				<column/>
+				<column/>
+				<column disabled="@ts_viewtype"/>
+				<column disabled="@ts_viewtype"/>
+				<column disabled="@ts_viewtype"/>
+				<column disabled="@no_owner_col"/>
+				<column/>
+			</columns>
+			<rows>
+				<row class="th">
+					<nextmatch-sortheader label="Date" id="ts_start"/>
+					<grid spacing="1" padding="1">
+						<columns>
+							<column/>
+						</columns>
+						<rows>
+							<row disabled="@pm_integration=full">
+								<nextmatch-filterheader options="All projects" id="ts_project" no_lang="1"/>
+							</row>
+							<row disabled="!@pm_integration=full">
+								<nextmatch-customfilter options="projectmanager-select,All projects" id="pm_id" onchange="1"/>
+							</row>
+							<row>
+								<nextmatch-sortheader label="Title" id="ts_title"/>
+							</row>
+						</rows>
+					</grid>
+					<nextmatch-sortheader label="Category" id="cat_id"/>
+					<vbox>
+						<nextmatch-sortheader label="Duration" id="ts_duration"/>
+						<date-duration id="duration" options=",h,,,1" readonly="true"/>
+					</vbox>
+					<vbox options="0,0">
+						<nextmatch-sortheader label="Quantity" id="ts_quantity"/>
+						<textbox type="float" id="quantity" readonly="true" precision="3"/>
+					</vbox>
+					<nextmatch-sortheader label="Price" id="ts_unitprice"/>
+					<vbox>
+						<nextmatch-sortheader label="Total" id="ts_total"/>
+						<textbox type="float" id="price" readonly="true" precision="2"/>
+					</vbox>
+					<nextmatch-filterheader id="ts_owner" options="User" no_lang="1" class="$cont[ownerClass]"/>
+					<description value="Actions" class="noPrint"/>
+				</row>
+				<row class="$row_cont[class]">
+					<date-time id="${row}[ts_start]" readonly="true" options=",8"/>
+					<vbox>
+						<link id="${row}[ts_link]" no_lang="1"/>
+						<description id="${row}[ts_title]" no_lang="1" class="$row_cont[titleClass]"/>
+						<description id="${row}[ts_description]" no_lang="1"/>
+					</vbox>
+					<menulist class="noWrap">
+						<menupopup type="select-cat" readonly="true" id="${row}[cat_id]"/>
+					</menulist>
+					<date-duration id="${row}[ts_duration]" readonly="true" options=",h,,,1"/>
+					<textbox type="float" id="${row}[ts_quantity]" no_lang="1" precision="3" readonly="true"/>
+					<description no_lang="1" id="${row}[ts_unitprice]"/>
+					<textbox type="float" no_lang="1" id="${row}[ts_total]" precision="2" readonly="true"/>
+					<menulist class="$cont[ownerClass]">
+						<menupopup type="select-account" id="${row}[ts_owner]" readonly="true"/>
+					</menulist>
+					<hbox class="noPrint">
+						<button image="view" label="View" id="view[$row_cont[ts_id]]" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.view&amp;ts_id=$row_cont[ts_id]'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;" statustext="View this entry"/>
+						<button image="edit" label="Edit" id="edit[$row_cont[ts_id]]" statustext="Edit this entry" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.edit&amp;ts_id=$row_cont[ts_id]'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;"/>
+						<button image="delete" label="Delete" id="delete[$row_cont[ts_id]]" statustext="Delete this entry" onclick="return confirm('Delete this entry');"/>
+					</hbox>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="timesheet.index" template="" lang="" group="0" version="1.3.002">
+		<grid width="100%">
+			<columns>
+				<column/>
+			</columns>
+			<rows>
+				<row disabled="!@msg">
+					<description span="all" class="redItalic" no_lang="1" id="msg" align="center"/>
+				</row>
+				<row disabled="1">
+					<hbox>
+						<template id="timesheet.index.dates"/>
+						<template id="timesheet.index.add" align="right"/>
+					</hbox>
+				</row>
+				<row>
+					<nextmatch id="nm" options="timesheet.index.rows"/>
+				</row>
+				<row class="noPrint">
+					<button label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=timesheet.uitimesheet.edit'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;"/>
+				</row>
+				<row>
+					<button label="Export" onclick="timesheet_export(); return false;" id="export"/>
+				</row>
+			</rows>
+		</grid>
+	</template>
+</overlay>
Index: /contrib/Resources/templates/default/viewDocument.tpl
===================================================================
--- /contrib/Resources/templates/default/viewDocument.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/viewDocument.tpl	(revision 3524)
@@ -0,0 +1,499 @@
+<!-- BEGIN main -->
+<script type='text/javascript'>
+	var folderChooserURL ='{folderChooserURL}';
+</script>
+
+<table width="100%" border="0" cellspacing="0" cellpading="0" bgcolor="white" hheight="100px">
+	<tr class="topRow">
+		<th width="33%">{delete}</th>
+		<th width="33%">{view_online}</th>
+		<th width="33%">{download}</th>
+	</tr>
+</table>
+<br>
+<table width="100%" border="0" cellspacing="0" cellpading="0">
+	<tr>
+		<th width="20%" id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);" style="font-size:10px;">{lang_informations}</a></th>
+		<th width="20%" id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);" style="font-size:10px;">{lang_all_versions}</a></th>
+		<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">{lang_linked_documents}</a></th>
+		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">{lang_notifications}</a></th>
+		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>
+	</tr>
+</table>
+<div style="border-left: dotted 1px grey; border-bottom: dotted 1px grey; border-right: dotted 1px grey; background: white;">
+<div id="tabcontent1" class="inactivetab" bgcolor="white">
+	{informations}
+</div>
+
+<div id="tabcontent2" class="inactivetab">
+
+	<table cellspacing="5" cellpadding="0" border="0" width="100%">
+		<tr>
+			<td></td>
+			<td></td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_version}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_upload_date}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_comment}</i></td>
+			<td rowspan="{rownum}" style="border-left: 1pt solid #000080;">&nbsp;</td>
+			<td class="filelist" style="border-bottom: 1pt solid #000080;"><i>{lang_uploaded_by}</i></td>
+			<td></td>
+		</tr>
+		{versions}
+	</table>
+</div>
+
+<div id="tabcontent3" class="inactivetab">
+<!--
+<table cellspacing="5" cellpadding="0" border="1">
+	<?php
+	if ($rownum > 1)
+	{
+		?>
+		<tr>
+		<td></td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("name");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("comment");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_by");?></i></td>
+		<td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td>
+		<td class="filelist" style="border-bottom: 1pt solid #000080;"><i><?php printMLText("document_link_public");?></i></td>
+		<td></td>
+		</tr>
+		<?php 
+		foreach($links as $link)
+		{
+			$responsibleUser = $link->getUser();
+			$targetDoc = $link->getTarget();
+			
+			print "<tr>";
+			print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
+			print "<td class=\"linklist\"><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
+			print "<td class=\"linklist\">".$targetDoc->getComment()."</td>";
+			print "<td class=\"linklist\">".$responsibleUser->getFullName()."</td>";
+			print "<td class=\"linklist\">" . (($link->isPublic()) ? getMLText("yes") : getMLText("no")) . "</td>";
+			print "<td>";
+			if (($user->getID() == $responsibleUser->getID()) || ($user->getID() == $settings->_adminID) || ($link->isPublic() && ($document->getAccessMode($user) >= M_READWRITE )))
+				print "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\"><img src=\"images/del.gif\" border=0></a>";
+			print "</td>";
+			print "</tr>";
+		}
+	}
+	else
+		print "<tr><td class=\"filelist\">".getMLText("no_document_links")."</td></tr>";
+	?>
+</table>
+
+
+if ($user->getID() != $settings->_guestID)
+
+	<form action="../op/op.AddDocumentLink.php" name="form1">
+	<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
+	<table>
+		<tr>
+			<td class="inputDescription"><?php printMLText("choose_target_document");?>:</td>
+			<td><?php printDocumentChooser("form1");?></td>
+		</tr>
+		<?php 
+			if ($document->getAccessMode($user) >= M_READWRITE)
+			{
+				print "<tr><td class=\"inputDescription\">".getMLText("document_link_public")."</td><td class=\"inputDescription\">";
+				print "<input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes") . "&nbsp;&nbsp;";
+				print "<input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no");
+				print "</td></tr>";
+			}
+		?>
+		<tr>
+			<td colspan="2"><br><input type="Submit" value="<?php printMLText("add_document_link");?>"></td>
+		</tr>
+	</table>
+	</form>-->
+</div>
+
+<div id="tabcontent4" class="inactivetab">
+	<table cellspacing="0" cellpadding="5" border="0" width="100%">
+		<tr>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+			<td style="border-bottom: 1pt solid #000080;" class="notifylist"><i>{lang_name}</i></td>
+			<td style="border-bottom: 1pt solid #000080;" width="50px">&nbsp;</td>
+		</tr>
+		{notifications}
+		<tr>
+			<td colspan="3">&nbsp;</td>
+		</tr>
+	</table>
+
+	<form action="{notify_form_action}" method="post" name="notify_form">
+		<fieldset><legend>{lang_add_notification}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_userid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_groupid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+	</form>
+</div>
+
+<div id="tabcontent5" class="inactivetab">
+	{change_owner}
+	{display_acl}
+</div>
+
+<div id="tabcontent6" class="inactivetab">
+	<form enctype="multipart/form-data" name="update_file_form" method="post" action="{action_update_file}">
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input type="file" name="userfile"></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="2"><textarea name="comment" style="width: 100%;"></textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="2">
+				{select_expire_update}
+				<span id="jscalspan_update" class="{expire_class_update}">{expire_date_update}</span>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="3" valign="top">
+				<input type="submit" name="save" value="{lang_update}">
+				<button type="button" name="cancel" value="{lang_cancel}" onClick="javascript:tab.display(1);">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</form>
+</div>
+
+
+
+</div>
+<!-- END main -->
+
+<!-- BEGIN lock_row -->
+	<tr class="row_on">
+		<td class="description" valign="top">{lang_lock_status}:</td>
+		<td class="infos" colspan="3">
+			<input id="lockStatus" type="hidden" name="lockStatus" value="unchanged">
+			<input type="checkbox" onClick="javascript:toggleLock(this);" {checked_lock_status}>
+			<div id="currentLockStatus" class="active">
+				{lang_current_status}
+			</div>
+			<div id="lockFile" class="inactive">
+				{lang_file_gets_unlocked}
+			</div>
+			<div id="unlockFile" class="inactive">
+				{lang_file_gets_locked}
+			</div>
+		</td>
+	</tr>
+<!-- END lock_row -->
+
+<!-- BEGIN version_row -->
+	<tr>
+		<td>
+			{url_view_online}
+		</td>
+		<td>
+			<a href="{url_download_file}" class="oldcontent"><img src="{download_image}" width=22 height=22 border=0 title="{lang_download}"></a>
+		</td>
+		<td class="filelist" align="center">{version_version}</td>
+		<td class="filelist">{version_date}</td>
+		<td class="filelist">{version_comment}</td>
+		<td class="filelist">{version_uploadingUser}</td>
+		<td>{url_delete_file}</td>
+	</tr>
+<!-- END version_row -->
+
+<!-- BEGIN information_ro -->
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr>
+			<td class="infos" valign="top" width="150px">{lang_filename}:</td>
+			<td style="border-left: 1pt solid #000080;" rowspan="14" width="1px">&nbsp;</td>
+			<td class="infos">{filename}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_owner}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment}:</td>
+			<td class="infos">{comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_creation_date}:</td>
+			<td class="infos">{creation_date}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_keywords}:</td>
+			<td class="infos">{keywords}</td>
+		</tr>
+		{locking}
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_mime_type}:</td>
+			<td class="infos">
+				<img align="absmiddle" src="images/icons/<?php print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+		<tr>
+			<td class="infos" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top">
+				{expire_date_ro}
+			</td>
+		</tr>
+	</table>
+<!-- END information_ro -->
+
+<!-- BEGIN information_rw -->
+	<form name="info_form" method="post" action="{action_informations}">
+	<fieldset><legend>{lang_general_information}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_filename}:</td>
+			<td class="infos" colspan="2"><input style="width: 100%;" type="text" name="fname" value="{filename}"></td>
+			<td align="center" width="150px"><a href="#" tabindex="0" onfocus="tab.display(6);" onclick="tab.display(6); return(false);" style="font-size:10px;">{lang_update_document}</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top" width="150px">{lang_folder}:</td>
+			<td class="infos" colspan="2">
+				<input id="targetname" style="width: 100%;" type="text" name="targetname" value="{foldername}" disabled>
+				<input type="hidden" id="targetid" name="targetid" value="unchanged">
+			</td>
+			<td align="center" width="150px"><a href="#" onclick="selectFolder({current_folder_id},'info_form'); return(false);" style="font-size:10px;">{lang_move_document}</a></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_comment}:</td>
+			<td class="infos" colspan="3"><textarea name="comment" style="width: 100%; height: 80px;">{comment}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_keywords}:</td>
+			<td class="infos" colspan="3"><textarea name="keywords" style="width: 100%; height: 30px;">{keywords}</textarea></td>
+		</tr>
+		<tr class="row_on">
+			<td class="description" valign="top">{lang_expires}:</td>
+			<td class="infos" valign="top" colspan="3">
+				{select_expire}
+				<span id="jscalspan" class="{expire_class}">{expire_date}</span>
+			</td>
+		</tr>
+		{locking}
+		<tr class="row_on">
+			<td class="description_small" valign="top">{lang_owner}:</td>
+			<td class="infos" colspan="1">
+				<a class="infos" href="mailto:{owner_email}">{owner_fullname}</a>
+			</td>
+			<td class="description_small" valign="top">{lang_creation_date}:</td>
+			<td class="infos" colspan="1">{creation_date}</td>
+		</tr>
+		<tr class="row_on">
+			<td colspan="4" valign="top">
+				<button type="submit" name="save" value="save">
+					{lang_save}
+				</button>
+				<button style="margin-left: 10px;" type="button" name="cancel" value="cancel" onClick="window.close()">
+					{lang_cancel}
+				</button>
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	<p>
+	<fieldset style="border: 1px solid silver;"><legend>{lang_information_about_last_update}</legend>
+	<table cellpadding="5" cellspacing="0" border="0" width="100%">
+		<tr class="row_off">
+			<td class="description_small" valign="top" width="150px">{lang_last_update}</td>
+			<td class="infos">{last_update}</td>
+			<td class="description_small" valign="top" width="150px">{lang_current_version}:</td>
+			<td class="infos">{current_version}</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description_small" valign="top">{lang_uploaded_by}:</td>
+			<td class="infos">
+				<a class="infos" href="mailto:{updater_email}">{updater_fullname}</a>
+			</td>
+			<td class="description_small" valign="top">{lang_file_size}:</td>
+			<td class="infos">{file_size} bytes</td>
+		</tr>
+		<tr class="row_off">
+			<td class="description_small" valign="top">{lang_comment_for_current_version}:</td>
+			<td class="infos" valign="top" colspan="3">{current_comment}</td>
+		</tr>
+		<tr>
+			<td class="description_small" valign="top">{lang_mime_type}:</td>
+			<td class="infos" colspan="3">
+				<img align="absmiddle" src="images/icons/<?php print getMimeIcon($latestContent->getFileType());?>"> 
+				{mime_type}
+			</td>
+		</tr>
+	</table>
+	</fieldset>
+	</form>
+<!-- END information_rw -->
+
+<!-- BEGIN block_download -->
+<a href="{download_link}"><img src="{download_image}" align="middle" border="0">{lang_download}</a>
+<!-- END block_download -->
+
+<!-- BEGIN block_view_online -->
+<a target="_blank" href="{view_link}"><img src="{view_image}" align="middle" border="0">{lang_view_online}</a>
+<!-- END block_view_online -->
+
+<!-- BEGIN block_delete -->
+<a href="{delete_link}" onClick="return confirm('{lang_confirm_delete}');"><img src="{delete_image}" align="middle" border="0">{lang_delete}</a>
+<!-- END block_delete -->
+
+<!-- BEGIN notification_row -->
+	<tr>
+		<td><img src="{notify_image}" width=16 height=16></td>
+		<td class="notifylist">{notify_username}</td>
+		<td align="right"><a href="{link_notify_delete}"><img title="{lang_delete_this_notification}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+<!-- END notification_row -->
+
+<!-- BEGIN block_change_owner -->
+	<form name="change_owner" action="{action_change_owner}" method="post">
+		<fieldset><legend>{lang_owner}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_ownerid}
+				</td>
+			</tr>
+		</table>
+		</fieldset>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>&nbsp;</td>
+			</tr>
+		</table>
+	</form>
+<!-- END block_change_owner -->
+
+<!-- BEGIN block_acl_inherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_acl_get_inherited}</div>
+	<p>
+	<a href="{link_acl_copy}">{lang_copy_acl}</a><br>
+	<a href="{link_acl_empty}">{lang_create_empty_acl}</a><br>
+	</fieldset>
+<!-- END block_acl_inherite -->
+
+<!-- BEGIN block_acl_notinherite -->
+	<fieldset><legend>{lang_acl}</legend>
+	<div>{lang_inherite_acl_again}</div>
+	<p>
+	<a href="{link_acl_inherit_again}">{lang_inherit_acl_again}</a><br>
+
+	<fieldset><legend>{lang_default_access}</legend>
+	<form name="change_default_access" action="{action_change_default_access}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td>
+					{select_default_access}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	<fieldset><legend>{lang_current_acl}</legend>
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td></td>
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_name}</i></td>
+				<!-- <td rowspan="<?php print $rownum;?>" style="border-left: 1pt solid #000080;">&nbsp;</td> -->
+				<td class="accessList" style="border-bottom: 1pt solid #000080;"><i>{lang_access_mode}</i></td>
+				<td></td>
+				<td></td>
+			</tr>
+			{acls}
+		</table>
+	</fieldset>
+
+	<fieldset><legend>{lang_add_acl}</legend>
+	<form name="add_acl" action="{action_add_acl}" method="post">
+		<table cellspacing="0" cellpadding="5" border="0" width="100%">
+			<tr>
+				<td class="inputDescription">{lang_user}:</td>
+				<td>
+					{select_add_acl_userid}
+				</td>
+				<td rowspan="3">
+					<input type="Submit">
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_group}:</td>
+				<td>
+					{select_add_acl_groupid}
+				</td>
+			</tr>
+			<tr>
+				<td class="inputDescription">{lang_permission}:</td>
+				<td>
+					{select_add_acl_permission}
+				</td>
+			</tr>
+		</table>
+	</form>
+	</fieldset>
+
+	</fieldset>
+<!-- END block_acl_notinherite -->
+
+<!-- BEGIN acl_row -->
+	<form method="post" action="{action_acl_row}">
+	<tr>
+		<td width="20px"><img src="{acl_image}" width=16 height=16></td>
+		<td class="acllist">{acl_username}</td>
+		<td class="acllist" width="310px">{acl_selectbox}</td>
+		<td width="20px"><input type="Image" src="{save_image}" alt="{lang_save}"></td>
+		<td width="20px" align="right"><a href="{link_acl_delete}" onClick="return confirm('{lang_confirm_acl_delete}');"><img title="{lang_delete_this_acl}" alt="{lang_delete}" src="{delete_image}" width=15 height=15 border=0></a>
+	</tr>
+	</form>
+<!-- END acl_row -->
+
Index: /contrib/Resources/templates/default/app.css
===================================================================
--- /contrib/Resources/templates/default/app.css	(revision 3524)
+++ /contrib/Resources/templates/default/app.css	(revision 3524)
@@ -0,0 +1,5 @@
+/* $Id: app.css 22414 2006-09-12 10:37:13Z ralfbecker $ */
+.redItalic { color: red; font-style: italics; }
+.titleSum,.titleDetails { font-weight: bold; }
+.noWrap { white-space: nowrap; }
+.width100 { width: 100%; }
Index: /contrib/Resources/templates/default/hr.tpl
===================================================================
--- /contrib/Resources/templates/default/hr.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/hr.tpl	(revision 3524)
@@ -0,0 +1,6 @@
+ <tr>
+  <td colspan="2">
+   {hr_text}
+  </td>
+ </tr>
+
Index: /contrib/Resources/templates/default/view.tpl
===================================================================
--- /contrib/Resources/templates/default/view.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/view.tpl	(revision 3524)
@@ -0,0 +1,46 @@
+
+<!-- BEGIN view_event -->
+<center>
+<table id="calendar_view_event" border="0" width="90%">
+	{row}
+	<tr>
+		<td>
+			<table id="calendar_viewevent_button_left" cellspacing="5">
+				<tr>
+					{button_left}
+				</tr>
+			</table>
+		</td>
+	   <td align="center">
+			<table id="calendar_viewevent_button_center" cellspacing="5">
+				<tr>
+					{button_center}
+				</tr>
+			</table>
+		</td>
+		<td align="right">
+			<table id="calendar_viewevent_button_right" cellspacing="5">
+				<tr>
+					{button_right}
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
+</center>
+<!-- END view_event -->
+
+<!-- BEGIN list -->
+	<tr bgcolor="{tr_color}">
+		<td valign="top" width="30%">&nbsp;<b>{field}:</b></td>
+		<td colspan="2" valign="top" width="70%">{data}</td>
+	</tr>
+<!-- END list -->
+
+<!-- BEGIN hr -->
+	<tr>
+		<td colspan="3" bgcolor="{th_bg}" align="center">
+			<b>{hr_text}</b>
+		</td>
+	</tr>
+<!-- END hr -->
Index: /contrib/Resources/templates/default/delete_common.tpl
===================================================================
--- /contrib/Resources/templates/default/delete_common.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/delete_common.tpl	(revision 3524)
@@ -0,0 +1,16 @@
+<!-- BEGIN form -->
+ <center>
+  <table border="0" with="65%">
+   <tr>
+    <td colspan="2" align="center">
+     {messages}
+    </td>
+   </tr>
+   <tr>
+    <td align="center">{no}</td>
+    <td align="center">{yes}</td>
+   </tr>
+  </table>
+ </center>
+<!-- END form -->
+
Index: /contrib/Resources/templates/default/list.tpl
===================================================================
--- /contrib/Resources/templates/default/list.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/list.tpl	(revision 3524)
@@ -0,0 +1,6 @@
+<!-- BEGIN list -->
+ <tr>
+  <td valign="top" width="35%"><b>{field}:</b></td>
+  <td valign="top" width="65%">{data}</td>
+ </tr>
+<!-- END list -->
Index: /contrib/Resources/templates/default/mini_cal.tpl
===================================================================
--- /contrib/Resources/templates/default/mini_cal.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/mini_cal.tpl	(revision 3524)
@@ -0,0 +1,42 @@
+
+<!-- BEGIN mini_cal -->
+
+	<table id="calendar_minical_table" class="calendar_minical_table" border=0 cellspacing="0" cellpadding="0">
+		<tr>
+			<td style="padding-left: 8px; font-weight: bold; text-align: left;">
+				{month}
+			</td>
+			<td align="right">
+				<!-- why empty? -->
+				{prevmonth}&nbsp;&nbsp;{nextmonth}
+			</td>
+		</tr>
+		<tr>
+			<td  style="padding-left: 8px; text-align: left;">
+<!--				<img src="{cal_img_root}" width="90%" height="1"> -->
+					<hr class="calendar_minical_hrule">
+			</td>
+		</tr>
+		<tr valign="top">
+			<td>
+				<table id="calendar_minical_daytable" class="calendar_minical_daytable" cellspacing="5" cellpadding="0">
+					<tr>{daynames}</tr>
+						{display_monthweek}
+				</table>
+
+			</td>
+	 	</tr>
+	</table>
+<!-- END mini_cal -->
+
+<!-- BEGIN mini_week -->
+	<tr>
+		{monthweek_day}
+	</tr>
+<!-- END mini_week -->
+
+<!-- BEGIN mini_day -->
+		<td class="calendar_minical_dayname" {day_image}>
+			{dayname}
+		</td>
+<!-- END mini_day -->
Index: /contrib/Resources/templates/default/link_pict.tpl
===================================================================
--- /contrib/Resources/templates/default/link_pict.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/link_pict.tpl	(revision 3524)
@@ -0,0 +1,25 @@
+
+<!-- BEGIN link_pict -->
+{picture}
+<!-- END link_pict -->
+
+<!-- BEGIN link_open -->
+<div id="calendar_event_entry" style="overflow:hidden;">
+<a class="event_entry" href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;" onMouseOut="window.status=''; return true;" title="{desc} {location}"><br>
+<!-- END link_open -->
+
+<!-- BEGIN pict -->
+ <img src="{pic_image}" width="{width}" height="{height}" title="{title}" border="0" />
+<!-- END pict -->
+
+<!-- BEGIN link_text_old -->
+<nobr>&nbsp;{time}&nbsp;</nobr> {title}&nbsp;{users_status}: <i>{desc}</i><!--({location})-->
+<!-- END link_text_old -->
+
+<!-- BEGIN link_text -->
+&nbsp;<FONT SIZE=1><span style="color: black">{time}</span> {users_status}<br><b>{title}</b><br><i>{desc}</i> {location}
+<!-- END link_text -->
+
+<!-- BEGIN link_close -->
+</a></div>
+<!-- END link_close -->
Index: /contrib/Resources/templates/default/day.tpl
===================================================================
--- /contrib/Resources/templates/default/day.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/day.tpl	(revision 3524)
@@ -0,0 +1,39 @@
+<!-- BEGIN day -->
+{printer_friendly}
+<table id="calendar_dayview_table" class="calendar_dayview_table" border="0" width="100%">
+	<tr>
+		<td valign="top" width="70%">
+			<table id="calendar_dayview1" border="0" width=100%>
+				<tr>
+					<td class="calendar_dayview_table_header">
+      					{date}&nbsp;<span class="calendar_user_identifier">:&nbsp;{username}&nbsp;:</span>
+						<br />
+     				</td>
+    			</tr>
+				{day_events}
+   			</table>
+   			<p align="center">{print}</p>
+  		</td>
+ 		 <td align="center" valign="top">
+  			 <table id="calendar_dayview2" width="100%">
+    			<tr>
+     				<td align="center">
+						{small_calendar}
+     				</td>
+    			</tr>
+
+   			</table>
+  		</td>
+ 	</tr>
+</table>
+<!-- END day -->
+
+<!-- BEGIN day_event -->
+	<tr>
+		<td>
+
+			{daily_events}
+
+		</td>
+	</tr>
+<!-- END day_event -->
Index: /contrib/Resources/templates/default/js/edit_exmail.js
===================================================================
--- /contrib/Resources/templates/default/js/edit_exmail.js	(revision 3524)
+++ /contrib/Resources/templates/default/js/edit_exmail.js	(revision 3524)
@@ -0,0 +1,393 @@
+/******************************************************************************\
+|**************************   CALENDAR MODULE   *******************************|
+|********** INCLUDE PARTICIPANTS - PLUGIN USING AJAX EXPRESSOMAIL COMPONENT  **|
+\******************************************************************************/
+var contacts = '';
+var expresso_offline = '';
+var array_lang = new Array();
+var finderTimeout = '';
+// onUnload edit message
+if(!document.all)
+{
+	var beforeunload = window.onbeforeunload;
+	window.onbeforeunload = function()
+	{
+		if ( typeof beforeunload == 'function' )
+			beforeunload();
+	};
+}
+	
+// Verifica versão do Firefox
+var agt = navigator.userAgent.toLowerCase();
+var is_firefox_0 = agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.') ? true : false;
+
+var handler_get_available_users = function(data)
+{	
+	select_available_users = Element('user_list_in');
+	
+	for(var i=0; i<select_available_users.options.length; i++){
+		select_available_users.options[i] = null;
+		i--;
+	}
+	var options = '###';
+	if (data) {
+		if(data.groups && data.groups.length > 0) {
+			data.groups = '<option  value="-1" disabled>------------------- '+Element("txt_groups").value+' ------------------ </option>' + data.groups;
+		}		
+		if(data.users && data.users.length > 0) {
+			data.users = '<option  value="-1" disabled>------------------- '+Element("txt_users").value+' ------------------ </option>' + data.users;
+		}
+		options +=  data.groups && data.groups.length > 0 ? data.groups : '';
+		options +=  data.users  && data.users.length  > 0 ? data.users  : '';
+		
+		if(is_firefox_0)
+			fixBugInnerSelect(select_available_users,options);
+		else
+			select_available_users.innerHTML = options;
+
+		select_available_users.outerHTML = select_available_users.outerHTML;
+		select_available_users.disabled = false;
+		select_available_users_clone = Element('user_list_in').cloneNode(true);		
+	}
+}	
+
+function get_available_users(module,context,type, autoSearch){
+	Element('cal_input_searchUser').value = '';
+	if(autoSearch != 'True'){
+		return true;
+	}
+	var context = document.getElementById('combo_org').value;	
+	cExecute (module+'.ldap_functions.get_available_users&context='+context+'&type='+type, handler_get_available_users);
+}
+
+function optionFinderTimeout(obj, numMin, type, autoSearch){
+	var oWait = Element("cal_span_searching");
+	oWait.innerHTML = 'Buscando...';
+	clearTimeout(finderTimeout);		
+	
+	if(autoSearch == "True"){
+		finderTimeout = setTimeout("optionFinderLocal('"+obj.id+"')",500);
+	}
+	else if (obj.value.length >= numMin){
+		finderTimeout = setTimeout("optionFinderLdap('"+obj.id+"','"+numMin+"','"+type+"')",500);
+	}else {
+		oWait.innerHTML = 'Mínimo de '+numMin+' letras para pesquisa';
+		var select_available_users_tmp = document.getElementById('user_list_in');
+		for(var i = 0;i < select_available_users_tmp.options.length; i++)
+		select_available_users_tmp.options[i--] = null;
+	}
+}
+// Pesquisa Javascript
+function optionFinderLocal(id){
+	var oText = Element(id);
+	var oWait = Element("cal_span_searching");
+	var select_available_users_tmp = Element('user_list_in');
+	for(var i = 0;i < select_available_users_tmp.options.length; i++)
+		select_available_users_tmp.options[i--] = null;
+	var RegExp_name = new RegExp("\\b"+oText.value, "i");
+
+	for(i = 0; i < select_available_users_clone.length; i++){
+		if (RegExp_name.test(select_available_users_clone[i].text) || select_available_users_clone[i].value =="-1")
+		{
+			sel = select_available_users_tmp.options;
+			option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value);
+			if( select_available_users_clone[i].value == "-1") option.disabled = true;
+			sel[sel.length] = option;
+		}
+	}
+	oWait.innerHTML = '&nbsp;';	
+}
+
+// Pesquisa LDAP
+function optionFinderLdap(id,numMin, type){
+		var oWait = Element("cal_span_searching");
+		var oText = Element(id);
+			
+		if (oText.value.length < numMin) {
+				oWait.innerHTML = '';
+				var select_available_users_tmp = document.getElementById('user_list_in');
+				for(var i = 0;i < select_available_users_tmp.options.length; i++)
+					select_available_users_tmp.options[i--] = null;
+		}
+		
+		if (oText.value.length >= numMin){
+			var context = document.getElementById('combo_org').value;
+			cExecute ('expressoMail1_2.ldap_functions.search_users&context='+(context)+'&type='+(type == '' ? 'list' : 'search')+'&filter='+oText.value, handler_get_available_users);
+			oWait.innerHTML = '&nbsp;';
+		}
+}
+
+function add_user()
+{
+	var select_available_users = document.getElementById('user_list_in');
+	var select_users = document.getElementById('user_list');
+	var count_available_users = select_available_users.length;
+	var count_users = select_users.options.length;
+	var new_options = '';
+	
+	for (i = 0 ; i < count_available_users ; i++) {
+		if (select_available_users.options[i].selected)	{
+			if(document.all) {
+				if ( (select_users.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) {
+					new_options +=  '<option value='
+								+ select_available_users.options[i].value
+								+ '>'
+								+ select_available_users.options[i].text
+								+ '</option>';
+				}
+			}
+			else if ( (select_users.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) {
+					new_options +=  '<option value='
+								+ select_available_users.options[i].value
+								+ '>'
+								+ select_available_users.options[i].text
+								+ '</option>';
+			}
+		}
+	}
+
+	if (new_options != '') {
+
+		if(is_firefox_0)
+			fixBugInnerSelect(select_users,'###' + new_options + select_users.innerHTML);
+		else
+			select_users.innerHTML = '###' + new_options + select_users.innerHTML;
+
+		select_users.outerHTML = select_users.outerHTML;
+	}
+}
+
+function remove_user(){
+	select_users = document.getElementById('user_list');
+	
+	for(var i = 0;i < select_users.options.length; i++)
+		if(select_users.options[i].selected)
+			select_users.options[i--] = null;
+}
+
+function submitValues(){
+	var typeField = document.getElementById('cal[type]');
+	if (typeField && typeField.value == 'hourAppointment') {
+		if(document.getElementsByName('categories[]')[0].value == ""){
+			alert(alert_msg);
+			return false;
+		}
+	}
+	var select_in = document.getElementById('user_list');
+	for(i = 0; i < select_in.length; i++)
+	 	select_in.options[i].selected = true;
+}	
+
+function Element(id){
+	return document.getElementById(id);
+}
+
+function loadScript(scriptPath){
+
+	if(!connector)
+		throw new Error("Error : Connector is not loaded.");
+		
+  	if (document.getElementById('uploadscript_'+scriptPath)) {
+  		return;
+   	}
+  	
+	connector.oxmlhttp.open("GET", scriptPath, false);
+    connector.oxmlhttp.setRequestHeader('Content-Type','text/plain');
+	connector.oxmlhttp.send(null);
+	if(connector.oxmlhttp.status != 0 && connector.oxmlhttp.status != 200 || 	connector.oxmlhttp.status == 0 && connector.oxmlhttp.responseText.length == 0)
+		throw new Error("Error " + connector.oxmlhttp.status + "("+connector.oxmlhttp.statusText+") when loading script file '"+scriptPath+"'");
+	
+	var head = document.getElementsByTagName("head")[0];
+	var script = document.createElement("SCRIPT");
+	script.id = 'uploadscript_'+scriptPath;
+	script.type = 'text/javascript';		
+	script.text = connector.oxmlhttp.responseText;
+	head.appendChild(script);
+	return;	
+}
+
+function showExParticipants(el,path){
+	Element('tbl_ext_participants').style.display='';
+	el.style.display='none';
+	loadScript(path+"/js/DropDownContacts.js");
+	loadScript(path+"/js/common_functions.js");
+	loadScript(path+"/js/QuickCatalogSearch.js");
+	loadScript("calendar/templates/default/js/over_fn_exmail.js");
+	if(!contacts)
+		cExecute (path+'.db_functions.get_dropdown_contacts', save_contacts);
+}
+
+function hideExParticipants(el,path){
+	Element('a_ext_participants').style.display = '';
+	Element('tbl_ext_participants').style.display ='none';
+}
+
+function save_contacts(data){
+	contacts = data;	
+	var input_to = Element("ex_participants");
+	input_to.style.width = "100%";
+	input_to.setAttribute("wrap","soft");	
+	input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);};
+	input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);};
+	if (!is_ie)
+	{
+		input_to.rows = 2;
+		input_to.onkeypress = function (e)
+		{
+			if ((e.keyCode) == 120) //F9
+			{
+				emQuickSearch(input_to);
+			}
+			else 
+			{ 
+				if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden'))
+				{
+					e.preventDefault();
+					search_contacts(e.keyCode,this.id);
+				}
+			}
+		}
+		input_to.onkeyup = function (e)
+		{
+			if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40))
+			{
+				search_contacts(e.keyCode,this.id);
+			}
+		}
+	}
+	else
+	{
+		input_to.rows = 3;
+		input_to.onkeyup = function (e)
+		{
+			if ((window.event.keyCode) == 120) //F9
+			{
+				emQuickSearch(input_to);
+			}
+			else 
+			{ 
+				search_contacts(window.event.keyCode,this.id);
+			}	
+		}
+	}
+}
+
+function fixBugInnerSelect(objeto,innerHTML){
+/******
+* select_innerHTML - altera o innerHTML de um select independente se é FF ou IE
+* Corrige o problema de não ser possível usar o innerHTML no IE corretamente
+* Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228
+* Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email.
+* Versão: 1.0 - 06/04/2006
+* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br
+* Parametros:
+* objeto(tipo object): o select a ser alterado
+* innerHTML(tipo string): o novo valor do innerHTML
+*******/
+    objeto.innerHTML = ""
+    var selTemp = document.createElement("micoxselect")
+    var opt;
+    selTemp.id="micoxselect1"
+    document.body.appendChild(selTemp)
+    selTemp = document.getElementById("micoxselect1")
+    selTemp.style.display="none"
+    if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto
+        innerHTML = "<option>" + innerHTML + "</option>"
+    }
+    innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span")
+    selTemp.innerHTML = innerHTML
+    for(var i=0;i<selTemp.childNodes.length;i++){
+        if(selTemp.childNodes[i].tagName){
+            opt = document.createElement("OPTION")
+            for(var j=0;j<selTemp.childNodes[i].attributes.length;j++){
+                opt.setAttributeNode(selTemp.childNodes[i].attributes[j].cloneNode(true))
+            }
+            opt.value = selTemp.childNodes[i].getAttribute("value")
+            opt.text = selTemp.childNodes[i].innerHTML
+            if(document.all){ //IEca
+                objeto.add(opt)
+            }else{
+                objeto.appendChild(opt)
+            }                    
+        }    
+    }
+    document.body.removeChild(selTemp)
+    selTemp = null
+}
+
+function changeViewMode(eltype){
+	var chValue = eltype;
+	switch (chValue){
+		case 'hourAppointment':
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "none";
+			}
+
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			Field[1].parentNode.parentNode.style.display = "none";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "none";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			break;
+		case 'privateHiddenFields':
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "";
+			}
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			Field[1].parentNode.parentNode.style.display = "none";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "none";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "";
+			break;
+		default:
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "";
+			}
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "";
+			Field[1].parentNode.parentNode.style.display = "";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "";
+			break;
+	}
+
+}
+function updateTitleField(select){
+	var typeField = document.getElementsByName('cal[type]');
+	if (typeField[0].value != 'hourAppointment')
+		return;
+	var titleField = document.getElementsByName('cal[title]');
+	var optionsArray = select.childNodes;
+	titleField[0].value = '';
+	for(option in optionsArray)
+		if (optionsArray[option].selected)
+			titleField[0].value += optionsArray[option].text + ' ';
+}
+
+var __onLoad = window.onload;
+window.onload = function(){ 
+	__onLoad();
+	var cal_type = document.getElementById('cal[type]').value;
+	changeViewMode(cal_type);
+	if(cal_type == 'hourAppointment'){
+		clearTimeout(timeout_get_available_users);
+	}
+};
Index: /contrib/Resources/templates/default/js/edit.js
===================================================================
--- /contrib/Resources/templates/default/js/edit.js	(revision 3524)
+++ /contrib/Resources/templates/default/js/edit.js	(revision 3524)
@@ -0,0 +1,101 @@
+/******************************************************************************\
+|**************************   MODULO   AGENDA   *******************************|
+|********** SCRIPT REFERENTE A CAIXA DE INCLUSAO DE PARTICIPANTES  ************|
+\******************************************************************************/
+
+// Variaveis Locais 
+	var select_in  = document.getElementById('user_list');
+	var select_out  = document.getElementById('user_list_in');	
+	var users_out = select_out ? select_out.cloneNode(true) : '';
+	var finderTimeout = '';
+																		
+// Funcoes				
+	function showExParticipants(el,path){
+		document.getElementById('tbl_ext_participants').style.display='';
+		el.style.display='none';
+	}
+	
+	function hideExParticipants(el,path){
+		document.getElementById('a_ext_participants').style.display = '';
+		document.getElementById('tbl_ext_participants').style.display ='none';
+	}
+							
+	function optionFinderTimeout(obj){
+
+		clearTimeout(finderTimeout);	
+		var oWait = document.getElementById("wait");
+		oWait.innerHTML = 'Buscando...';
+		finderTimeout = setTimeout("optionFinder('"+obj.id+"')",500);
+	}
+	function optionFinder(id) {	
+		var oWait = document.getElementById("wait");
+		var oText = document.getElementById(id);
+		for(var i = 0;i < select_out.options.length; i++)				
+			select_out.options[i--] = null;
+																							
+		for(i = 0; i < users_out.length; i++){																							
+			if(users_out[i].text.substring(0 ,oText.value.length).toUpperCase() == oText.value.toUpperCase()) {
+				sel = select_out.options;						
+				option = new Option(users_out[i].text,users_out[i].value);				
+				sel[sel.length] = option;
+			}
+		}
+		oWait.innerHTML = '&nbsp;';
+	}			
+									
+	function rem()
+	{
+		for(var i = 0;i < select_in.options.length; i++)				
+			if(select_in.options[i].selected)
+				select_in.options[i--] = null;																	
+	}
+		
+	function submitValues(alert_msg){
+		var typeField = document.getElementById('cal[type]');
+		if (typeField && typeField.value == 'hourAppointment')
+			if(document.getElementsByName('categories[]')[0].value == ""){
+				alert(alert_msg);
+				return false;
+				}
+		for(i = 0; i < select_in.length; i++)
+		 	select_in.options[i].selected = true;
+	}
+	
+	
+	
+	function openListUsers(newWidth,newHeight, owner){					
+		newScreenX  = screen.width - newWidth;		
+		newScreenY  = 0;		
+		window.open('calendar/templates/default/listUsers.php?owner='+owner,"","width="+newWidth+",height="+newHeight+",screenX="+newScreenX+",left="+newScreenX+",screenY="+newScreenY+",top="+newScreenY+",toolbar=no,scrollbars=yes,resizable=no");
+	}
+
+ 	function adicionaListaCalendar() 
+ 	{
+		var select = window.document.getElementById('user_list_in');
+		var selectOpener = window.opener.document.getElementById('user_list');
+		for (i = 0 ; i < select.length ; i++) {				
+
+			if (select.options[i].selected) {
+				isSelected = false;
+
+				for(var j = 0;j < selectOpener.options.length; j++) {																			
+					if(selectOpener.options[j].value == select.options[i].value){
+						isSelected = true;						
+						break;	
+					}
+				}
+
+				if(!isSelected){
+
+					option = window.opener.document.createElement('option');
+					option.value =select.options[i].value;
+					option.text = select.options[i].text;
+					selectOpener.options[selectOpener.options.length] = option;	
+				}
+				
+			}
+		}
+		selectOpener.options[selectOpener.options.length-1].selected = true;
+ 	}
+	
+// Fim        
Index: /contrib/Resources/templates/default/js/search.js
===================================================================
--- /contrib/Resources/templates/default/js/search.js	(revision 3524)
+++ /contrib/Resources/templates/default/js/search.js	(revision 3524)
@@ -0,0 +1,108 @@
+var searchTimeout;
+
+function lang(key){
+	return document.getElementById("txt_"+key).value;
+}
+
+function remove_user(id){
+	if(!confirm(lang("confirm")))
+		return true;	
+	var handler_rem_user = function(data){
+		if(data) {
+			var tr = document.getElementById(id);
+			tr.parentNode.removeChild(tr);
+		}
+	}	
+	cExecute ('calendar.uigroup_access.rem_user&id='+id, handler_rem_user);
+}
+function add_user(){
+	var select_users = document.getElementById("user");
+	var select_groups = document.getElementById("group");
+	var a_rights = new Array("L","A","E","R","P");
+	var rights = '';
+	for(var z = 0; z < a_rights.length; z++){
+		var check = document.getElementById("right_"+a_rights[z]);
+		if(check.checked){
+			rights += check.value;
+		}
+	}
+	if(!select_users.value){
+		alert(lang("nouser"));
+		return;
+	}
+	else if(!select_groups.value){
+		alert(lang("nogroup"));
+		return;
+	}
+	else if(!rights){
+		alert(lang("nopermissiontype"));
+		return;
+	}
+	
+	var str = select_users.value+";"+select_groups.value;
+	var handler_add_user = function(data){
+		
+		if(data){
+			var t = document.getElementById('tbody_list');
+			var tr = document.createElement("TR");
+			tr.bgColor = "#DCDCDC";
+			var td1 = document.createElement("TD");
+			var td2 = document.createElement("TD");
+			var td3 = document.createElement("TD");
+			var td4 = document.createElement("TD");
+			tr.id = str;
+			td1.innerHTML = "<b>&nbsp;&nbsp;"+select_users[select_users.selectedIndex].text+"</b>";
+			td2.innerHTML = rights;
+			td2.align = "center";
+			td3.innerHTML = "&nbsp;&nbsp;"+select_groups[select_groups.selectedIndex].text;
+			td4.innerHTML = "<button  title='remove' type='button' onClick='javascript:remove_user(\""+str+"\");'><img src='"+document.getElementById("template_set").value+"/images/delete.png' style='vertical-align: middle;'/></button>";
+			tr.appendChild(td1);
+			tr.appendChild(td2);
+			tr.appendChild(td3);
+			tr.appendChild(td4);
+			t.appendChild(tr);
+			alert(lang("success"));
+		}
+		else{
+			alert(lang("exist"));
+		}
+	}
+	cExecute ('calendar.uigroup_access.add_user&id='+str+"&rights="+rights, handler_add_user);
+	return true;
+		
+}
+function search_object(input, id_span, id_select, type)
+{
+	clearTimeout(searchTimeout);	
+	var spam = document.getElementById(id_span);
+	if (input.value.length <= 3){
+		spam.innerHTML = lang("typemoreletters").replace("X",4 - input.value.length);
+	}else{
+		spam.innerHTML = lang("searching")+'...';
+		searchTimeout = setTimeout("search_ldap('"+input.id+"','"+id_span+"','"+id_select+"','"+type+"')",750);
+	}
+}
+
+function search_ldap(id_input, id_span, id_select, type)
+{
+	var search = document.getElementById(id_input).value;
+	
+	var handler_search_user = function(data)
+	{
+		var spam = document.getElementById(id_span);
+		select_available_users = document.getElementById(id_select);
+		if (data.status == 'false')
+		{
+			spam.innerHTML = data.msg;
+			// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+			select_available_users.innerHTML = '#';
+			select_available_users.outerHTML = select_available_users.outerHTML;
+			return;
+		}	
+		spam.innerHTML = '';
+		// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+		select_available_users.innerHTML = '#' + data;
+		select_available_users.outerHTML = select_available_users.outerHTML;
+	}
+	cExecute ('calendar.uigroup_access.search_user&search='+search+"&type="+type, handler_search_user);
+}
Index: /contrib/Resources/templates/default/js/over_fn_exmail.js
===================================================================
--- /contrib/Resources/templates/default/js/over_fn_exmail.js	(revision 3524)
+++ /contrib/Resources/templates/default/js/over_fn_exmail.js	(revision 3524)
@@ -0,0 +1,163 @@
+/******************************************************************************\
+|**************************   CALENDAR MODULE   *******************************|
+|********** PLUGIN USING AJAX EXPRESSOMAIL COMPONENT - OVERWRITE FUNCTIONS   **|
+\******************************************************************************/
+
+/******************************************************************************\
+|** Function      : emQuickSearch *********************************************|
+|** Original File : <expressoMail_module>/js/common_functions.js **************|
+\******************************************************************************/
+window.onresize = function(){};
+function emQuickSearch(el){
+
+	var emailList = el.value;
+	var field = el.id;
+	var ex_participants = Element("ex_participants");
+	var quickSearchKeyBegin;
+	var quickSearchKeyEnd;
+	
+	var handler_emQuickSearch = function(data){
+		window_DropDownContacts = Element('tipDiv');
+		if (window_DropDownContacts.style.visibility != 'hidden'){
+			window_DropDownContacts.style.visibility = 'hidden';
+		}
+		
+		if ((!data.status) && (data.error == "many results")){
+			alert(get_lang('More than %1 results. Please, try to refine your search.',200));
+			return false;
+		}
+			
+		if (data.length > 0){
+			QuickCatalogSearch.showList(data, quickSearchKeyBegin, quickSearchKeyEnd);
+		}
+		else
+			alert(get_lang('None result was found.'));
+		return true;
+	}
+	ex_participants.focus(); 				//mecessary for IE.
+	var i = getPosition(ex_participants); //inputBox.selectionStart;
+	var j = --i;
+
+    while ((j >= 0) && (emailList.charAt(j) != ',')){j--};
+    quickSearchKeyBegin = ++j;
+
+    while ((i <= emailList.length) && (emailList.charAt(i) != ',')){i++};
+    quickSearchKeyEnd = i;
+
+    var search_for = trim(emailList.substring(quickSearchKeyBegin, quickSearchKeyEnd));
+
+	if (search_for.length < 4){
+		alert(get_lang('Your search argument must be longer than 4 characters.'));
+		return false;
+	}
+	
+	cExecute ("expressoMail1_2.ldap_functions.quicksearch&search_for="+search_for+"&field="+field, handler_emQuickSearch);
+}
+
+/******************************************************************************\
+|** Function      : emQuickCatalogSearch.prototype.transfer_result ************|
+|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
+\******************************************************************************/
+emQuickCatalogSearch.prototype.transfer_result = function (field, ID, begin, end){
+	cm = document.getElementById('select_QuickCatalogSearch');
+	option_selected = cm.options[cm.selectedIndex].value + ", ";
+	emailList = Element("ex_participants").value;		
+	new_emailList = emailList.substring(0, begin) + option_selected + emailList.substring((parseInt(end) + 2), emailList.length);
+	document.getElementById("ex_participants").value = new_emailList;
+	if(is_ie)
+		Element("i_blank").style.display = "none";
+	document.getElementById("ex_participants").focus();
+	this.arrayWin['window_QuickCatalogSearch'].close();
+}
+
+/******************************************************************************\
+|** Function      : emQuickCatalogSearch.prototype.close_QuickSearch_window ***|
+|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
+\******************************************************************************/
+emQuickCatalogSearch.prototype.close_QuickSearch_window = function (field, ID){
+	if(is_ie)
+		Element("i_blank").style.display = "none";
+	document.getElementById("ex_participants").focus();
+	this.arrayWin['window_QuickCatalogSearch'].close();
+}
+
+/******************************************************************************\
+|** Function      : emQuickCatalogSearch.prototype.showWindow *****************|
+|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
+\******************************************************************************/
+emQuickCatalogSearch.prototype.showWindow = function (div)
+{
+	if(! div) {
+		alert(get_lang('The list has no participant.'));
+		return;
+	}
+						
+	if(! this.arrayWin[div.id]) {
+		div.style.width = "700px";
+		div.style.height = "230px";
+		var title = get_lang('The results were found in the Global Catalog')+':';
+		var wHeight = div.offsetHeight + "px";
+		var wWidth =  div.offsetWidth   + "px";
+		div.style.width = div.offsetWidth - 5;
+
+		win = new dJSWin({			
+			id: 'QuickCatalogSearch_'+div.id,
+			content_id: div.id,
+			width: wWidth,
+			height: wHeight,
+			y:'300px',
+			top: '300px',
+			title_color: '#3978d6',
+			bg_color: '#eee',
+			title: title,						
+			title_text_color: 'white',
+			button_x_img: 'phpgwapi/images/winclose.gif',
+			border: true });
+		
+		this.arrayWin[div.id] = win;
+		win.draw();
+	}
+	else {
+		win = this.arrayWin[div.id];
+	}
+
+	if(is_ie) {	
+		var _IFrame = Element("i_blank");
+		if(_IFrame){
+    		_IFrame.style.display  = '' ;		
+		}
+		else {
+			_IFrame = document.body.appendChild(document.createElement('iframe'));
+			_IFrame.src = 'about:blank' ;
+		    _IFrame.frameBorder		= '0';
+		    _IFrame.scrolling		= 'no' ;
+		    _IFrame.style.left		= findPosX(div)  + document.body.scrollLeft -5;
+			_IFrame.style.top		= findPosY(div)  + document.body.scrollTop  -20;
+		    _IFrame.width			= 610;
+   		    _IFrame.style.border	= 0;
+			_IFrame.height			= 285;
+			_IFrame.border			= 0;
+			_IFrame.id				= "i_blank";
+		    _IFrame.style.position	= 'absolute';
+	   	    _IFrame.style.zIndex	= '5';
+    		_IFrame.style.display  = '' ;
+		}
+	}
+
+	win.open();
+	document.getElementById('select_QuickCatalogSearch').focus();
+}	
+
+
+/******************************************************************************\
+|** Function      :  DRAG *****************************************************|
+|** Original File : phpgwapi/js/wz_dragdrop/wz_dragdrop.js ********************|
+\******************************************************************************/
+var over_fn_DRAG = DRAG;
+DRAG = function (event){
+
+		if(is_ie)
+			return false;
+		else
+			over_fn_DRAG(event);
+}		
Index: /contrib/Resources/templates/default/vcal_import.tpl
===================================================================
--- /contrib/Resources/templates/default/vcal_import.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/vcal_import.tpl	(revision 3524)
@@ -0,0 +1,10 @@
+<!-- vcardin form -->
+{vcal_header}
+    <form ENCTYPE="multipart/form-data" method="POST" action="{action_url}">
+      <table border=0>
+      <tr>
+       <td>{ical_lang}: <input type="file" name="uploadedfile"></td>
+       <td><input type="submit" name="action" value="{load_vcal}"></td>
+      </tr>
+      </table>
+     </form>
Index: /contrib/Resources/templates/default/show.xet
===================================================================
--- /contrib/Resources/templates/default/show.xet	(revision 3524)
+++ /contrib/Resources/templates/default/show.xet	(revision 3524)
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+<!-- $Id: show.xet 22492 2006-09-25 08:50:53Z ralfbecker $ -->
+<overlay>
+	<template id="resources.show.rows" template="" lang="" group="0" version="">
+		<grid>
+			<columns>
+				<column/>
+				<column/>
+				<column width="3%"/>
+				<column/>
+				<column/>
+				<column width="5%"/>
+			</columns>
+			<rows>
+				<row class="nmh">
+					<description/>
+					<vbox>
+						<nextmatch-sortheader label="Name" id="name"/>
+						<nextmatch-sortheader label="Short description" id="short_description"/>
+					</vbox>
+					<vbox>
+						<nextmatch-sortheader label="Useable" id="useable" statustext="How many of this resource are usable"/>
+						<nextmatch-sortheader label="Quantity" id="quantity" statustext="How many of this resource exists"/>
+					</vbox>
+					<vbox>
+						<nextmatch-sortheader label="Category" id="cat_id"/>
+						<description value="Administrator"/>
+					</vbox>
+					<vbox>
+						<nextmatch-sortheader label="Location" id="location"/>
+						<description value="Storage Inforation"/>
+					</vbox>
+					<hbox align="right">
+						<description value="Actions"/>
+						<description/>
+						<description needed="1"/>
+						<button image="check.png" label="Check all" align="right" id="check_all" statustext="Check all" needed="1" onclick="toggle_all(this.form,form::name('nm[rows][checkbox][]'),true); return false;"/>
+					</hbox>
+				</row>
+				<row class="nmr" valign="top">
+					<button align="center" id="${row}[picture_thumb]" image="$row_cont[picture_thumb]" onclick="window.open(egw::link('/index.php','menuaction=resources.ui_resources.show&amp;res_id=$row_cont[res_id]'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes');return false;"/>
+					<vbox>
+						<description no_lang="1" id="${row}[name]"/>
+						<description no_lang="1" id="${row}[short_description]"/>
+					</vbox>
+					<vbox align="right">
+						<description no_lang="1" align="right" id="${row}[useable]"/>
+						<description no_lang="1" align="right" id="${row}[quantity]"/>
+					</vbox>
+					<vbox>
+						<menulist>
+							<menupopup type="select-cat" no_lang="1" id="${row}[cat_id]" readonly="true"/>
+						</menulist>
+						<menulist>
+							<menupopup type="select-account" no_lang="1" id="${row}[admin]" readonly="true"/>
+						</menulist>
+					</vbox>
+					<vbox>
+						<description no_lang="1" id="${row}[location]"/>
+						<description no_lang="1" id="${row}[storage_info]"/>
+					</vbox>
+					<grid>
+						<columns>
+							<column/>
+							<column/>
+							<column/>
+							<column/>
+						</columns>
+						<rows>
+							<row>
+								<button image="bookable" ro_image="trams16x16" label="Book this resource" align="center" statustext="Book this resource" onclick="window.open(egw::link('/index.php','menuaction=calendar.uiforms.edit&amp;participants=r$cont[res_id]'),'','dependent=yes,width=750,height=400,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;" id="bookable[$cont[res_id]]"/>
+								<button image="edit" ro_image="trans16x16" label="Edit" align="center" statustext="Edit this entry" onclick="window.open(egw::link('/index.php','menuaction=resources.ui_resources.edit&amp;res_id=$cont[res_id]'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;" id="edit[$cont[res_id]]"/>
+								<button image="new" ro_image="trans16x16" label="Create new accessory for this resource" align="center" id="new_acc[$cont[res_id]]" statustext="Create new accessory for this resource" onclick="window.open(egw::link('/index.php','menuaction=resources.ui_resources.edit&amp;res_id=0&amp;accessory_of=$cont[res_id]'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;"/>
+								<button image="view" ro_image="trans16x16" label="View" align="right" id="view[$cont[res_id]]" statustext="View this entry" onclick="window.open(egw::link('/index.php','menuaction=resources.ui_resources.show&amp;res_id=$cont[res_id]'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;"/>
+							</row>
+							<row>
+								<button image="calendar" ro_image="trans16x16" label="Show calendar of resource" align="center" statustext="Show calendar of resource" id="calendar[$cont[res_id]]" onclick="location=egw::link('/index.php','menuaction=calendar.uiviews.planner&amp;sortby=user&amp;owner=0,r$cont[res_id]'); return false;"/>
+								<button label="Delete" align="center" id="delete[$cont[res_id]]" statustext="Delete this entry" onclick="return confirm('Do you really want do delte this resource?');" image="delete" ro_image="trans16x16"/>
+								<button image="view_acc" ro_image="trans16x16" label="View accessories for this resource" align="center" id="view_acc[$cont[res_id]]" statustext="View accessories for this resource"/>
+								<checkbox align="right" id="checkbox[]" options="$cont[res_id]"/>
+							</row>
+						</rows>
+					</grid>
+				</row>
+			</rows>
+		</grid>
+	</template>
+	<template id="resources.show" template="" lang="" group="0" version="">
+		<grid width="100%">
+			<columns>
+				<column width="100%"/>
+			</columns>
+			<rows>
+				<row>
+					<nextmatch options="resources.show.rows" no_lang="1" id="nm"/>
+				</row>
+				<row>
+					<grid width="100%">
+						<columns>
+							<column/>
+							<column width="1%"/>
+							<column width="1%"/>
+							<column width="1%"/>
+							<column width="47px"/>
+						</columns>
+						<rows>
+							<row>
+								<description/>
+								<button image="bookable" ro_image="trans16x16" label="book selected resources" statustext="book selected resources" align="right" onclick="var resources = js_btn_book_selected(this.form); if(resources == false) { return false; } else { window.open(egw::link('/index.php','menuaction=calendar.uiforms.edit')+'&amp;participants='+resources,'','dependent=yes,width=750,height=400,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false; }" needed="1" id="btn_book_selected"/>
+								<button label="Show calendar of resource" image="calendar" ro_image="trans16x16" id="btn_cal_selected" statustext="Show calendar of resource" align="right" onclick="var resources = js_btn_book_selected(this.form); if(resources == false) { return false; } else { location=egw::link('/index.php','menuaction=calendar.uiviews.planner')+'&amp;sortby=user&amp;owner=0,'+resources; return false; }" needed="1"/>
+								<button image="delete" label="delete selected resources" id="btn_delete_selected" statustext="delete selected resources" align="right" onclick="var resources = js_btn_book_selected(this.form); if(resources == false) { return false; } else { return confirm('Do you really want do delete the selected resources?'); }" needed="1"/>
+								<vbox>
+									<description/>
+									<button image="arrow_ltr" label="select/deselect all" statustext="select/deselect all" onclick="toggle_all(this.form,form::name('nm[rows][checkbox][]'),true); return false;" needed="1"/>
+									<description/>
+								</vbox>
+							</row>
+						</rows>
+					</grid>
+				</row>
+				<row>
+					<hbox>
+						<button label="Add" onclick="window.open(egw::link('/index.php','menuaction=resources.ui_resources.edit'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false; return false;" id="add"/>
+						<button label="Add accessory" id="add_sub" onclick="window.open(egw::link('/index.php','menuaction=resources.ui_resources.edit&amp;content=0&amp;accessory_of=$cont[view_accs_of]'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;"/>
+						<button label="Back" id="back"/>
+					</hbox>
+				</row>
+			</rows>
+		</grid>
+	</template>
+</overlay>
Index: /contrib/Resources/templates/default/month_day.tpl
===================================================================
--- /contrib/Resources/templates/default/month_day.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/month_day.tpl	(revision 3524)
@@ -0,0 +1,21 @@
+
+<!-- BEGIN m_w_table -->
+
+<table id="calendar_m_w_table" class="calendar_m_w_table" border="0" width="100%">
+	<! from month_header.tpl -->
+	{row}
+</table>
+<!-- END m_w_table -->
+
+<!-- BEGIN month_daily -->
+<span class="screen_only">[ </span><span class="calendar_m_w_table_daynumber" >{day_number}</span><span class="screen_only"> ]</span>{new_event_link}<br />
+    {daily_events}
+<!-- END month_daily -->
+
+<!-- BEGIN day_event -->
+{events}
+<!-- END day_event -->
+
+<!-- BEGIN event -->
+{day_events}
+<!-- END event -->
Index: /contrib/Resources/templates/default/preference_acl_row.tpl
===================================================================
--- /contrib/Resources/templates/default/preference_acl_row.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/preference_acl_row.tpl	(revision 3524)
@@ -0,0 +1,7 @@
+<!-- $Id: preference_acl_row.tpl 20159 2005-12-19 04:23:14Z ralfbecker $ -->
+   <tr class="{row_class}">
+    <td>{user}</td>
+    <td align="center"><input type="checkbox" name="{read}" value="Y"{read_selected}></td>
+    <td align="center"><input type="checkbox" name="{edit}" value="Y"{edit_selected}></td>
+    <td align="center"><input type="checkbox" name="{delete}" value="Y"{delete_selected}></td>
+   </tr>
Index: /contrib/Resources/templates/default/edit.tpl
===================================================================
--- /contrib/Resources/templates/default/edit.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/edit.tpl	(revision 3524)
@@ -0,0 +1,123 @@
+<!-- BEGIN edit_entry -->
+<style type="text/css">
+div#tipDiv {
+  position:absolute; visibility:hidden; left:0; top:0; z-index:10000;
+  background-color:#EFEFEF; border:1px solid #337;
+  width:220px; padding:3px;
+  color:#000; font-size:11px; line-height:1.2;
+  cursor: default;
+}
+</style>
+
+
+
+<style type="text/css">
+<!--
+.hideFrom input { display: none; }
+.link_select select { width: 250px; }
+-->
+</style>
+
+
+
+
+<div class="sideboxSpace"></div>
+
+<table id="calendar_head_table" class="calendar_head_table" border="0" width="100%" cols="{cols}" cellpadding="6" cellspacing="0">
+	<tr>
+		<td rowspan=10>
+	
+	<div id="divSubContainer">
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr>
+		<!-- Sidebox Column -->
+<td id="tdSidebox" valign="top"><div id="thesideboxcolumn" style="width: 203px;"><div id="sideresize"></div>
+<div class="divSidebox">
+	<div class="divSideboxHeader"><span>Recursos Men&uacute;</span></div>
+
+	<div>
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/resources/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href="index.php?menuaction=resources.uiresources.search">Lista del registro</a></td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/resources/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href=""></a><a class="textSidebox" href="index.php?menuaction=resources.uiresources.edit"  >A&ntilde;adir</a></td>
+		</tr>
+
+		</tbody></table>	
+	</div>
+</div>
+
+<div class="sideboxSpace"></div>
+
+</td> <td>  
+<font color="#000000" face="{font}">
+
+<form action="{action_url}" method="post" name="app_form">
+{common_hidden}
+<table id="editFormTable" border="0" width="90%"   class="prefTable">
+ <tr>
+  <td colspan="2">
+   <center><font size="+1"><b id="formStatus">{errormsg}</b></font></center>
+  </td>
+ </tr>
+{row}
+
+ <tr>
+  <td>
+  <table><tr valign="top">
+  <td>
+  <div style="padding-top:15px; padding-right: 2px">
+  	<script language="JavaScript">
+		var alert_field = '{alert_msg}';
+	</script>
+  	<center><input id="submit_button" style="font-size:10px" type="submit" value="{submit_button}" onClick="return submitValues(alert_field);"></center></div></form>
+  </td>
+  <td>{cancel_button}</td>
+  </tr></table>
+  </td>
+  <td align="right"></td>
+ </tr>
+</table>
+</font>
+</center>
+
+<table width="100%">
+	<tbody>
+
+<!-- END edit_entry -->
+<!-- BEGIN list -->
+ <tr bgcolor="{tr_color}">
+  <td valign="top" width="25%">&nbsp;<b>{field}:</b></td>
+  <td valign="top" width="75%">{data}</td>
+ </tr>
+
+<!-- END list -->
+
+<tr>
+<td>
+
+</td>
+</tr>
+<!-- BEGIN hr -->
+ <tr bgcolor="{tr_color}">
+  <td colspan="2">
+  {hr_text}
+  </td>
+ </tr>
+<!-- END hr -->
+</tbody>
+</table>
+
+
+
+
+
+
+
+
+
+</td>
+	</tr>
+</table>
+
Index: /contrib/Resources/templates/default/showdetails.xet
===================================================================
--- /contrib/Resources/templates/default/showdetails.xet	(revision 3524)
+++ /contrib/Resources/templates/default/showdetails.xet	(revision 3524)
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<!-- $Id: showdetails.xet 19840 2005-11-14 21:40:50Z nelius_weiss $ -->
+<overlay>
+	<template id="resources.showdetails" template="" lang="" group="0" version="">
+		<grid width="750" height="480">
+			<columns>
+				<column width="43%"/>
+				<column width="100%"/>
+			</columns>
+			<rows>
+				<row class="nmh" height="240px">
+					<image src="resource_picture" align="center"/>
+					<grid>
+						<columns>
+							<column/>
+							<column/>
+						</columns>
+						<rows>
+							<row>
+								<description options="b" value="Name:"/>
+								<description options="b" no_lang="1" id="name"/>
+							</row>
+							<row>
+								<description value="Inventory number:"/>
+								<description no_lang="1" id="inventory_number"/>
+							</row>
+							<row>
+								<description value="Category:"/>
+								<menulist>
+									<menupopup type="select-cat" id="cat_id" readonly="true"/>
+								</menulist>
+							</row>
+							<row>
+								<description value="Responsible: "/>
+								<menulist>
+									<menupopup type="select-account" id="cat_admin" readonly="true"/>
+								</menulist>
+							</row>
+							<row valign="top">
+								<description value="Quantity: "/>
+								<description id="quantity"/>
+							</row>
+							<row>
+								<description value="Useable:"/>
+								<description id="useable"/>
+							</row>
+							<row>
+								<description value="Location:"/>
+								<description no_lang="1" id="location"/>
+							</row>
+							<row>
+								<description value="Storage information:"/>
+								<description id="storage_info"/>
+							</row>
+						</rows>
+					</grid>
+				</row>
+				<row>
+					<description/>
+					<description/>
+				</row>
+				<row height="1%">
+					<html span="2" id="description" readonly="true"/>
+				</row>
+				<row>
+					<description/>
+					<description/>
+				</row>
+				<row class="th" disabled="@!link_to">
+					<description span="2" data="" rows="1" cols="4" value="Related links"/>
+				</row>
+				<row class="row_off" valign="top">
+					<link-list span="all" id="link_to" readonly="true"/>
+				</row>
+				<row>
+					<hbox label="Cancel" span="2" 3="label" 4="button">
+						<hbox label="Edit" span="2" id="btn_edit">
+							<button label="Edit" span="2" id="btn_edit" statustext="Buy this article"/>
+							<button label="Cancel" onclick="window.close()"/>
+							<button label="Calendar" span="2" id="btn_calendar" statustext="Show calendar of resource" onclick="opener.location=egw::link('/index.php','menuaction=calendar.uiviews.month&amp;owner=r$cont[res_id]'); return false;"/>
+							<button label="Book" onclick="window.open(egw::link('/index.php','menuaction=calendar.uiforms.edit&amp;participants=r$cont[res_id]'),'','dependent=yes,width=750,height=400,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes');" id="btn_book" statustext="Book this resource"/>
+						</hbox>
+						<hbox align="right">
+							<button label="Delete" onclick="return confirm('Do you really want do delte this resource?');" id="btn_delete"/>
+						</hbox>
+					</hbox>
+				</row>
+			</rows>
+		</grid>
+	</template>
+</overlay>
Index: /contrib/Resources/templates/default/matrix_query.tpl
===================================================================
--- /contrib/Resources/templates/default/matrix_query.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/matrix_query.tpl	(revision 3524)
@@ -0,0 +1,25 @@
+<!-- BEGIN matrix_query -->
+<center>
+<form action="{action_url}" method="post" name="matrixform">
+<table border="0" width="90%">
+ <tr bgcolor="{th_bg}">
+  <td colspan="2" align="center"><b>{title}</b></td>
+ </tr>
+ {rows}
+ <tr>
+  <td>
+   <table cellspacing="5"><tr>
+    <td><input type="submit" value="{submit_button}"></form></td>
+    <td>{cancel_button}</td>
+   </tr></table>
+  </td>
+ </tr>
+</table>
+</center>
+<!-- END matrix_query -->
+<!-- BEGIN list -->
+ <tr bgcolor="{tr_color}">
+  <td valign="top" width="35%"><b>&nbsp;{field}:</b></td>
+  <td valign="top" width="65%">{data}</td>
+ </tr>
+<!-- END list -->
Index: /contrib/Resources/templates/default/week.tpl
===================================================================
--- /contrib/Resources/templates/default/week.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/week.tpl	(revision 3524)
@@ -0,0 +1,3 @@
+{week_display}
+<!-- from month_day.tpl -->
+<p align="center">{printer_friendly}</p>
Index: /contrib/Resources/templates/default/day_cal.tpl
===================================================================
--- /contrib/Resources/templates/default/day_cal.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/day_cal.tpl	(revision 3524)
@@ -0,0 +1,24 @@
+<!-- BEGIN day -->
+<div class="th">
+ <table class="calendar_dayview_maintable" width="100%" cellpadding="0">
+{row}
+</table>
+ </div>
+<!-- END day -->
+<!-- BEGIN day_row -->
+    <tr>{time}{event}
+    </tr>
+<!-- END day_row -->
+<!-- BEGIN day_event_on -->
+     <td class="event-on"{extras}>&nbsp;{event}</td>
+<!-- END day_event_on -->
+<!-- BEGIN day_event_off -->
+     <td class="event-off"{extras}>&nbsp;{event}</td>
+<!-- END day_event_off -->
+<!-- BEGIN day_event_holiday -->
+     <td class="event-holiday"{extras}>&nbsp;{event}</td>
+<!-- END day_event_holiday -->
+<!-- BEGIN day_time -->
+     <td class="time" nowrap>{open_link}{time}{close_link}</td>
+<!-- END day_time -->
+
Index: /contrib/Resources/templates/default/preference_acl.tpl
===================================================================
--- /contrib/Resources/templates/default/preference_acl.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/preference_acl.tpl	(revision 3524)
@@ -0,0 +1,27 @@
+{errors}
+{title}
+<table border="0" align="center" width="70%">
+ <tr>
+  {nml}
+  <td width="40%">
+   <div align="center">
+    <form method="POST" action="{action_url}">
+{common_hidden_vars}
+     <input type="text" name="query" value="{search_value}">
+     <input type="submit" name="search" value="{search}">
+    </form>
+   </div>
+  </td>
+  {nmr}
+ </tr>
+</table>
+<form method="POST" action="{action_url}">
+ <table border="0" align="center" width="50%" cols="4">
+{row}
+ </table>
+{common_hidden_vars_form}
+ <input type="hidden" name="processed" value="{processed}">
+ <center><input type="submit" name="submit" value="{submit_lang}"></center>
+</form>
+
+
Index: /contrib/Resources/templates/default/preference_colspan.tpl
===================================================================
--- /contrib/Resources/templates/default/preference_colspan.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/preference_colspan.tpl	(revision 3524)
@@ -0,0 +1,6 @@
+  <tr class="th">
+    <td>{string}</td>
+    <td align="center" width="8%">{lang_read}</td>
+    <td align="center" width="8%">{lang_edit}</td>
+    <td align="center" width="8%">{lang_delete}</td>
+  </tr>
Index: /contrib/Resources/templates/default/folderChooser.tpl
===================================================================
--- /contrib/Resources/templates/default/folderChooser.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/folderChooser.tpl	(revision 3524)
@@ -0,0 +1,11 @@
+<!-- BEGIN main -->
+<script language="JavaScript">
+
+var targetName = opener.document.{formName}.targetname;
+var targetID   = opener.document.{formName}.targetid;
+
+</script>
+
+<div id="mydmstreebox" style="top:0px; left:0px; width:200px; height:400px; border:dotted 0px silver; text-align:left;"></div>
+{folderTree}
+<!-- END main -->
Index: /contrib/Resources/templates/default/event_link.tpl
===================================================================
--- /contrib/Resources/templates/default/event_link.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/event_link.tpl	(revision 3524)
@@ -0,0 +1,41 @@
+
+<!-- BEGIN link_event_pict -->
+{picture}
+<!-- END link_event_pict -->
+
+<!-- BEGIN link_event_open -->
+<table>
+
+<!--<div id="calendar_event_entry" style="overflow:hidden;">-->
+<!--<a class="event_entry" href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;" onMouseOut="window.status=''; return true;" title="{desc} {location}"><br />--><br />
+<!-- END link_event_open -->
+
+<!-- BEGIN event_pict -->
+<!--<img src="{pic_image}" width="{width}" height="{height}" title="{title}" border="0" />-->
+<!-- END event_pict -->
+
+<!-- BEGIN link_event_text_old -->
+<!--<nobr>&nbsp;{time}&nbsp;</nobr> {title}&nbsp;{users_status}: <i>{desc}</i>({location}) -->
+<!-- END link_event_text_old -->
+
+<!-- BEGIN link_event_text -->
+	<tr style="font-size: 10px;background: #dddddd;">
+		<td valign="top" style="color: black; font-size: 11px;">
+			<span>
+				{time}
+			</span>
+		</td>
+		<td style="font-size: 11px; border: #E8F0F0 1px solid;" colspan="3">
+			<span><b>{title}</b></span>
+			<br />
+			<span><i>{desc}</i></span>
+			<span>{location}</span>
+			<br />
+		</td>
+	</tr>
+<!-- END link_event_text -->
+
+<!-- BEGIN link_event_close -->
+<!--</a></div><br />-->
+</table>
+<!-- END link_event_close -->
Index: /contrib/Resources/templates/default/year.tpl
===================================================================
--- /contrib/Resources/templates/default/year.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/year.tpl	(revision 3524)
@@ -0,0 +1,35 @@
+<!-- BEGIN year -->
+{print}
+<center>
+<table id="calendar_year_table" border="0" cellspacing="3" cellpadding="4" cols=4>
+	<tr>
+		<td align="center">
+			{left_link}
+		</td>
+		<td align="center">
+			<font face="{font}" size="+1">{year_text}</font>
+		</td>
+		<td align="center">
+			{right_link}
+		</td>
+		{row}
+	</tr>
+</table>
+</center>
+<p>
+<div class="calendar_link_print">
+{printer_friendly}
+</div>
+<!-- END year -->
+
+<!-- BEGIN month -->
+<td valign="top">
+	{mini_month}
+</td>
+<!-- END month -->
+
+<!-- BEGIN month_sep -->
+</tr>
+<tr valign="top">
+<!-- END month_sep -->
+
Index: /contrib/Resources/templates/default/head.tpl
===================================================================
--- /contrib/Resources/templates/default/head.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/head.tpl	(revision 3524)
@@ -0,0 +1,52 @@
+<!-- BEGIN head -->
+<script language="Javascript">
+function openwindow(url)
+{ 
+	
+	var window_features = 	"scrollbars=yes,resizable=yes,location=no,menubar=no," + 
+							"personalbar=no,status=no,titlebar=no,toolbar=no," + 
+							"screenX=screen.width/3,screenY=screen.height/3,top=screen.height/3,left=screen.width/3,width=" + 
+							screen.width/4*3 + ",height=" + screen.height/8*3; 
+	
+	self.open(url,'', window_features); 
+}
+</script>
+{row}<br />
+<!-- END head -->
+<!-- BEGIN head_table -->
+<table id="calendar_head_table" class="calendar_head_table" border="0" width="100%" cols="{cols}" cellpadding="6" cellspacing="0">
+	<tr>
+		<td rowspan=10>
+	
+	<div id="divSubContainer">
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr>
+		<!-- Sidebox Column -->
+<td id="tdSidebox" valign="top"><div id="thesideboxcolumn" style="width: 203px;"><div id="sideresize"></div>
+<div class="divSidebox">
+	<div class="divSideboxHeader"><span>Recursos Men&uacute;</span></div>
+
+	<div>
+		<table cellpadding="0" cellspacing="0" width="100%">
+		<tbody><tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/resources/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href="index.php?menuaction=resources.uiresources.search">Lista del registro</a></td>
+		</tr>
+		<tr class="divSideboxEntry">
+			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/resources/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href=""></a><a class="textSidebox" href="index.php?menuaction=resources.uiresources.edit"  >A&ntilde;adir</a></td>
+		</tr>
+
+		</tbody></table>	
+	</div>
+</div>
+
+<div class="sideboxSpace"></div>
+
+</td> <td> 
+
+
+
+
+<!-- END head_table -->
+<!-- BEGIN head_col -->
+
+<!-- END head_col -->
Index: /contrib/Resources/templates/default/month_print.tpl
===================================================================
--- /contrib/Resources/templates/default/month_print.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/month_print.tpl	(revision 3524)
@@ -0,0 +1,26 @@
+{printer_friendly}
+<table class="calendar_index_table" id="calendar_index_table"  width="100%" cols="5">
+	<tr>
+		<td align="left" width="33%">
+			<span class="calendar_user_identifier">
+					{username}
+			</span>
+		</td>
+		<td align="center" width="33%">
+			<span class="calendar_month_identifier">
+				{month_identifier}
+			</span>
+		</td>
+		<td align="right" style="width: 33%; font-size: 14px;">
+			<span class="calendar_user_identifier">
+				<p>Agenda de Eventos</p>
+			</span>
+		</td>
+	</tr>
+</table>
+{large_month}
+<p>
+<p>
+<div class="calendar_link_print">
+	{print}
+</div>
Index: /contrib/Resources/templates/default/month_column.tpl
===================================================================
--- /contrib/Resources/templates/default/month_column.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/month_column.tpl	(revision 3524)
@@ -0,0 +1,4 @@
+
+<td valign="top" colspan="1" width="{col_width}%"{extra}>
+	{column_data}
+</td>
Index: /contrib/Resources/templates/default/body_email.tpl
===================================================================
--- /contrib/Resources/templates/default/body_email.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/body_email.tpl	(revision 3524)
@@ -0,0 +1,32 @@
+<html>
+<head>
+<meta http-equiv="Content-Language" content="en" />
+<meta name="GENERATOR" content="PHPEclipse 1.0" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>title</title>
+</head>
+<body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99">
+<!-- BEGIN list -->
+<b><p align='left'>{subject}</p></b>
+<br>
+<table border='0' cellpadding='0' cellspacing='0' width='100%'>
+<tr><td width='30%' valign='top'><b>{var1} ::</b></td><td>{vardata1}</td></tr>	
+<tr><td width='30%' valign='top'><b>{var2} ::</b></td><td>{vardata2}</td></tr>
+<tr><td width='30%' valign='top'><b>{var3} ::</b></td><td>{vardata3}</td></tr>
+<tr><td width='30%' valign='top'><b>{var4} ::</b></td><td>{vardata4}</td></tr>
+<tr><td width='25%' valign='top'><b>{var8} ::</b></td><td>{vardata8}</td></tr>
+<tr><td width='25%' valign='top'><b>{var5} ::</b></td><td>{vardata6}</td></tr>
+</table>
+<br>
+<hr size='1' width='100%'>
+<table border='0' cellpadding='4' cellspacing='4' width='100%'>
+<tr>
+<td width='2%' align='left'>{varbuttom}</td>
+<td width='2%' align='left' valign='top'>{varbuttom1}</td>
+<td width='2%' align='left' valign='top'>{varbuttom2}</td>
+<td width='94%' align='left' valign='top'>{varbuttom3}</td>
+</tr>
+</table>
+<!-- END list -->
+</body>
+</html>
Index: /contrib/Resources/templates/default/config.tpl
===================================================================
--- /contrib/Resources/templates/default/config.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/config.tpl	(revision 3524)
@@ -0,0 +1,56 @@
+<!-- BEGIN header -->
+<p style="text-align: center; color: {th_err};">{error}</p>
+<form name=frm method="POST" action="{action_url}">
+{hidden_vars}
+<table border="0" align="left">
+   <tr class="th">
+    <td colspan="2">&nbsp;<b>{title}</b></td>
+   </tr>
+<!-- END header -->
+
+<!-- BEGIN body -->
+<tr class="row_on">
+<td>{lang_ProjectManager_integration}:</td>
+<td>
+<select name="newsettings[pm_integration]">
+<option value="">{lang_Both:_allow_to_use_ProjectManager_and_free_project-names}</option>
+<option value="none"{selected_pm_integration_none}>{lang_None:_use_only_free_project-names}</option>
+<option value="full"{selected_pm_integration_full}>{lang_Full:_use_only_ProjectManager}</option>
+</select>
+</td>
+</tr>
+<tr class="row_on">
+<td>{lang_Mode}:</td>
+<td>
+<select name="newsettings[ts_viewtype]">
+<option value="normal"{selected_ts_viewtype_normal}>{lang_Regular}</option>
+<option value="short"{selected_ts_viewtype_short}>{lang_Simple}</option>
+</select>
+</td>
+</tr>
+<tr class="row_on">
+<td>{lang_Show_a_quantity_sum_(eg._to_sum_up_negative_overtime)}:</td>
+<td>
+<select name="newsettings[quantity_sum]">
+<option value="">{lang_No}</option>
+<option value="true"{selected_quantity_sum_true}>{lang_Yes}</option>
+</select>
+</td>
+</tr>
+<!-- END body -->
+
+<!-- BEGIN footer -->
+  <tr class="th">
+    <td colspan="2">
+&nbsp;
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" align="center">
+      <input type="submit" name="submit" value="{lang_submit}">
+      <input type="submit" name="cancel" value="{lang_cancel}">
+    </td>
+  </tr>
+</table>
+</form>
+<!-- END footer -->
Index: /contrib/Resources/templates/default/index.tpl
===================================================================
--- /contrib/Resources/templates/default/index.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/index.tpl	(revision 3524)
@@ -0,0 +1,32 @@
+{printer_friendly}
+<table id="calendar_index_table" border="0" width="100%" cols="5">
+	<tr>
+		<td align="left" valign="top" width="20%">
+			{small_calendar_prev}
+		</td>
+		<td align="center" valign="middle" width="15%">
+			<b>{prev_month_link}</b>
+		</td>
+		<td align="center" width="30%">
+			<span class="calendar_month_identifier">
+				{month_identifier}
+			</span>
+				<br />
+			<span class="calendar_user_identifier">
+				:&nbsp;{username}&nbsp;:
+			</span>
+		</td>
+		<td align="center" valign="middle" width="15%">
+			{next_month_link}
+		</td>
+		<td align="right" valign="top" width="20%">
+			{small_calendar_next}
+		</td>
+	</tr>
+</table>
+{large_month}
+<p>
+<p>
+<div class="calendar_link_print">
+	{print}
+</div>
Index: /contrib/Resources/templates/default/month_header_print.tpl
===================================================================
--- /contrib/Resources/templates/default/month_header_print.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/month_header_print.tpl	(revision 3524)
@@ -0,0 +1,12 @@
+<!-- BEGIN monthly_header -->
+<tr class="calendar_m_w_table_header" colspan="{cols}" width="{col_width}%">
+{column_header}</tr>
+<!-- END monthly_header -->
+
+<!-- BEGIN column_title -->
+<tr bGCOLOR="#D3DCE3" width="14.28%">{col_title}</tr>
+<!-- END column_title -->
+
+<!-- BEGIN month_column -->
+<tr class="calendar_m_w_tablecell" colspan="1" width="{col_width}%"{extra}>{column_data}</tr>
+<!-- END month_column -->
Index: /contrib/Resources/templates/default/form_button_dropdown.tpl
===================================================================
--- /contrib/Resources/templates/default/form_button_dropdown.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/form_button_dropdown.tpl	(revision 3524)
@@ -0,0 +1,13 @@
+<form action="{form_link}" method="post" name="{form_name}form">
+<td width="{form_width}%" align="center" valign="top" style="padding-top:16px">
+	<span style="font-size:10px"><b>{title}:</b>
+    {hidden_vars}    
+    <select name="{form_name}" onchange="document.{form_name}form.submit()">
+		{form_options}
+	</select>
+    <noscript>
+    	<input type="submit" value="{button_value}">
+    </noscript>
+	</span>
+</td>
+</form>
