Documentation TYPO3 par Ameos

class.tx_sysmessages.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *  
00005 *  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is 
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 * 
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license 
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 * 
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00032 class tx_sysmessages extends mod_user_task {
00033         var $charWidth=60;
00034 
00035         function modMenu()      {
00036                 global $LANG;
00037                 return Array(
00038                         "tx_sysmessages_box" => array(
00039                                 "inbox" => $LANG->getLL("messages_inbox"),
00040                                 "archive" => $LANG->getLL("messages_archive"),
00041                                 "sent" => $LANG->getLL("messages_sent")
00042                         )
00043                 );
00044         }
00045         function overview_main(&$pObj)  {
00046                 $icon = '<img src="'.$this->backPath.t3lib_extMgm::extRelPath("sys_messages").'ext_icon.gif" width=18 height=16 class="absmiddle">';
00047                 $content.=$pObj->doc->section($icon."&nbsp;".$this->headLink("tx_sysmessages",0,"&SET[tx_sysmessages_box]=inbox"),$this->renderMessagesList(),1,1,0,1);
00048                 return $content;
00049         }
00050         function main() {
00051                 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00052 
00053                 return $this->renderMessages();
00054                 
00055         }
00056 
00057 
00058 
00059 
00060         // ************************
00061         // MESSAGES
00062         // ***********************
00063         function messages_insertRel($mes_id,$mRow,$brow,$sAE,&$emRec,$status=0) {
00064                 $fields_values = array(
00065                         "uid_local" => $mes_id,
00066                         "uid_foreign" => $brow["uid"],
00067                         "tstamp" => time(),
00068                         "status" => $status
00069                 );
00070                 if ($status==126)       {       // If the relation is for the user himself (sent) set the is_read flag.
00071                         $fields_values["is_read"] = 1;
00072                 }
00073                 
00074                 $GLOBALS['TYPO3_DB']->exec_INSERTquery("sys_messages_users_mm", $fields_values);
00075 
00076                 if ($sAE && strstr($brow["email"],"@")) {
00077                         $this->sendEmail($brow["email"],$mRow["title"],$mRow["note"]);
00078                         $emRec[] = $brow["username"]." (".$brow["email"].")";
00079                 } else {
00080                         $emRec[] = $brow["username"];
00081                 }
00082         }
00083         function exec_messages_selectFromStatus($ss,$fields="sys_messages.*,sys_messages_users_mm.*",$where="") {
00084                 return $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
00085                                                 $fields,
00086                                                 "sys_messages",
00087                                                 "sys_messages_users_mm",
00088                                                 "be_users",
00089                                                 " AND sys_messages_users_mm.uid_foreign=".intval($this->BE_USER->user["uid"])." AND sys_messages_users_mm.status=".$ss.$where,
00090                                                 '',
00091                                                 "sys_messages.crdate DESC"
00092                                         );
00093         }
00094         function renderMessagesList()   {
00095                 global $LANG;
00096 
00097                 $res = $this->exec_messages_selectFromStatus(0,"sys_messages.*,sys_messages_users_mm.*"," AND sys_messages_users_mm.is_read=0");
00098                 $lines = array();
00099                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
00100                         $lines[]='<nobr>'.$this->messages_link('<img src="'.$this->backPath.'gfx/mailicon.gif" width="18" hspace=6 height="10" align=top border=0><b>'.$this->fixed_lgd($row["title"]),$row["mm_uid"]).'</b></nobr><BR>';
00101                 }
00102 
00103                 $res = $this->exec_messages_selectFromStatus(0,"count(*)");
00104                 list($mc) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00105                 $lines[]='<nobr>'.$this->messages_link(sprintf($LANG->getLL("messages_index_msgs"),$mc),"0").'</nobr><BR>';
00106 
00107                 $out = implode("",$lines);
00108                 return $out;
00109         }
00110         function messages_link($str,$id,$box="inbox")   {
00111                 $str='<a href="index.php?SET[function]=tx_sysmessages&SET[tx_sysmessages_box]='.$box.'&sys_messages_MM_uid='.$id.'#msg" target="list_frame" onClick="this.blur();">'.$str.'</a>';
00112                 return $str;
00113         }
00114         function renderMessages()       {
00115                 global $LANG;
00116                 $theCode="";
00117                         
00118                         // Setting up general things for the function:
00119                 $this->pObj->doc->tableLayout = Array (
00120                         "defRow" => Array (
00121                                 "0" => Array('<TD valign=top nowrap>','</td>'),
00122                                 "defCol" => Array('<td valign="top" width=99%>','</td>')
00123                         )
00124                 );
00125                 $this->pObj->doc->table_TR = '<TR class="bgColor-10">';
00126                 $this->pObj->doc->table_TABLE = '<TABLE border=0 cellspacing=1 cellpadding=2 width=100%>';
00127                 
00128                         // This is the id of the relation record which connects the mails with the user
00129                 $mUid_MM = t3lib_div::intInRange(t3lib_div::_GP("sys_messages_MM_uid"),0);
00130 
00131                         // PROCESSING:
00132                 $data = t3lib_div::_GP("data");
00133                         
00134                         // Deleted and marked mails
00135                 if (t3lib_div::_GP("marked_mails") || t3lib_div::_GP("marked_mails"))   {
00136                         $marked_mails = @array_keys(t3lib_div::_GP("MARKED"));
00137                         if (is_array($marked_mails))    {
00138                                 $ss = t3lib_div::_GP("marked_mails_action");
00139                                 if (t3lib_div::inList("0,1,127",$ss))   {
00140                                         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_messages_users_mm', 'mm_uid IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($marked_mails)).') AND uid_foreign='.intval($this->BE_USER->user["uid"]), array('status' => $ss));
00141                                 }
00142                         }
00143                         // Create mails (new and replys)
00144                 } elseif (is_array($data["sys_messages"]))      {
00145                         reset($data["sys_messages"]);
00146                         $key = key($data["sys_messages"]);
00147 
00148                         // If "key" is an integer it's a reply
00149                         $rres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
00150                                                 "sys_messages.*",
00151                                                 "sys_messages",
00152                                                 "sys_messages_users_mm",
00153                                                 "be_users",
00154                                                 " AND sys_messages_users_mm.mm_uid=".intval($key)." AND be_users.uid=".intval($this->BE_USER->user["uid"])
00155                                         );
00156                         if ($r_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($rres))      {
00157                         } else {
00158                                 $key=="NEW";
00159                         }
00160 
00161                         if ($data["sys_messages"][$key]["recipient"] && $data["sys_messages"][$key]["title"] && $data["sys_messages"][$key]["note"])    {
00162                                 $fields_values = array(
00163                                         "title" => $data["sys_messages"][$key]["title"],
00164                                         "note" => $data["sys_messages"][$key]["note"],
00165                                         "parent" => is_array($r_row)?($r_row["parent"]?$r_row["parent"]:$r_row["uid"]):0,
00166                                         "orig_recipient" => $data["sys_messages"][$key]["recipient"],
00167                                         "crdate" => time(),
00168                                         "cruser_id" => $this->BE_USER->user["uid"]
00169                                 );
00170                                 $GLOBALS['TYPO3_DB']->exec_INSERTquery("sys_messages", $fields_values);
00171 
00172                                 $mes_id = $GLOBALS['TYPO3_DB']->sql_insert_id();
00173                                 
00174                                         // Relation:
00175                                 $tempQ = FALSE;
00176                                 $emRec = array();
00177                                 if ($data["sys_messages"][$key]["recipient"]>0)         {       // Ordinary user
00178                                         $tempQ = TRUE;
00179                                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,username,realName,email', 'be_users', 'uid='.intval($data['sys_messages'][$key]['recipient']).t3lib_BEfunc::deleteClause('be_users'));
00180                                 } 
00181                                 if ($data["sys_messages"][$key]["recipient"]<0)         {       // Users in group
00182                                         $tempQ = TRUE;
00183                                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,username,realName,email', 'be_users', $GLOBALS['TYPO3_DB']->listQuery('usergroup_cached_list', abs($data['sys_messages'][$key]['recipient']), 'be_users').t3lib_BEfunc::deleteClause('be_users'));
00184                                 }
00185                                 if ($tempQ)     {
00186                                         $sAE = t3lib_div::_GP("sendAsEmail");
00187                                         while($brow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
00188                                                 if ($brow["uid"]!=$this->BE_USER->user["uid"] || $data["sys_messages"][$key]["recipient"]>0)    {       // Send mail to all in group except user himself (unless the mail is targeted directly to the user!)
00189                                                         $this->messages_insertRel($mes_id,$fields_values,$brow,$sAE,$emRec);
00190                                                 }
00191                                         }       
00192                                                 // Sending to whole group (REPLYs only)
00193                                         if (is_array($r_row) && t3lib_div::_GP("replyAll"))     {
00194                                                 $rres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
00195                                                                 "be_users.username,be_users.realName,be_users.uid,be_users.email",
00196                                                                 "sys_messages",
00197                                                                 "sys_messages_users_mm",
00198                                                                 "be_users",
00199                                                                 " AND sys_messages_users_mm.uid_local=".intval($r_row["uid"])." AND sys_messages_users_mm.status!=126"
00200                                                         );
00201                                                 while($brow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($rres))     {
00202                                                         if ($brow["uid"]!=$this->BE_USER->user["uid"])  {       // Send mail to all in group except user himself (unless the mail is targeted directly to the user!)
00203                                                                 $this->messages_insertRel($mes_id,$fields_values,$brow,$sAE,$emRec);
00204                                                         }
00205                                                 }
00206                                         }
00207 
00208                                                 // Setting the sent mail at the sending user
00209                                         $temp=array();
00210                                         $this->messages_insertRel($mes_id,$fields_values,$this->BE_USER->user,0,$temp,126);
00211                                 }
00212                                 if (count($emRec))      {
00213                                         $emailList=implode("<BR>&nbsp;&nbsp;",$emRec);
00214                                         $theCode.= $this->pObj->doc->section($LANG->getLL("messages_sent"),$LANG->getLL("messages_sent_msg")."<BR>&nbsp;&nbsp;".$emailList,0,1,1);
00215                                 }
00216                         } else {
00217                                 $theCode.= $this->pObj->doc->section($LANG->getLL("messages_sent"),$this->errorIcon().'<span class="typo3-red">'.$LANG->getLL("messages_sentError_msg").'</span>',0,1);
00218                         }
00219                         $mUid_MM=0;     // No display of messages if one is just created og replied to.
00220                 }
00221                 
00222                         // Get groupnames for todo-tasks
00223                 list($be_user_Array,$be_group_Array,$be_user_Array_o)=$this->getUserAndGroupArrays();
00224 
00225                         // Display message:
00226                 $msg_buffer="";
00227                 $currentSender="";
00228                 $doUpdate=0;
00229                 if ($mUid_MM)   {
00230                         $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
00231                                                 'sys_messages.*,sys_messages_users_mm.*',
00232                                                 'sys_messages',
00233                                                 'sys_messages_users_mm',
00234                                                 'be_users',
00235                                                 ' AND sys_messages_users_mm.uid_foreign='.intval($this->BE_USER->user['uid']).
00236                                                         ' AND mm_uid='.intval($mUid_MM)
00237                                         );
00238                         $msg = array();
00239                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
00240                                         // Update 'is_read' flag:
00241                                 if (!$row["is_read"])   {
00242                                         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_messages_users_mm', 'mm_uid='.intval($row["mm_uid"]), array('is_read' => 1));
00243                                         $row["is_read"]=1;
00244                                         $doUpdate=1;
00245                                 }
00246 
00247                                 $currentSender = $row["cruser_id"];
00248                                 $currentSubject = $row["title"];
00249                                 $currentUid = $row["uid"];
00250                                 $currentSenderName = $be_user_Array_o[$row["cruser_id"]]["username"]." (".$be_user_Array_o[$row["cruser_id"]]["realName"].")";
00251                                 $replySep=" \n\n".$LANG->getLL("messages_replySeparator").chr(10);
00252                                 $currentContent = $replySep.$row["note"];
00253                                 $currentContent_formatted = $replySep."> ".implode(chr(10)."> ",explode(chr(10),$this->breakLines($row["note"])));
00254                                 
00255                                         // Getting recipient list (all relations which are not 126 (sent)):
00256                                 $recipArray = array();
00257                                 $rres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
00258                                                 "be_users.username,be_users.realName,be_users.uid,sys_messages_users_mm.is_read",
00259                                                 "sys_messages",
00260                                                 "sys_messages_users_mm",
00261                                                 "be_users",
00262                                                 " AND sys_messages_users_mm.uid_local=".intval($row["uid"])." AND sys_messages_users_mm.status!=126"
00263                                         );
00264                                 while($r_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($rres))    {
00265                                         $recipArray[$r_row["uid"]]=$r_row["username"]." (".$r_row["realName"].") ";
00266                                         if (!$r_row["is_read"]) {$recipArray[$r_row["uid"]]=$GLOBALS["TBE_TEMPLATE"]->dfw($recipArray[$r_row["uid"]]);}
00267                                 }
00268 
00269                                 // Getting thread:
00270                                 $pUid = $row["parent"] ? $row["parent"] : $row["uid"];
00271                                 $rres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
00272                                                 "sys_messages.*,sys_messages_users_mm.*",
00273                                                 "sys_messages",
00274                                                 "sys_messages_users_mm",
00275                                                 "be_users",
00276                                                 " AND (sys_messages.uid=".intval($pUid)." OR sys_messages.parent=".intval($pUid).") AND sys_messages_users_mm.uid_foreign=".intval($this->BE_USER->user["uid"]),
00277                                                 '',
00278                                                 'sys_messages.crdate'
00279                                         );
00280                                 while($r_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($rres))    {
00281                                         if ($mUid_MM==$r_row["mm_uid"]) {
00282                                                 $active='<img src="'.$this->backPath.'gfx/content_client.gif" width="7" height="10" border="0" align=top>';
00283                                         } else {
00284                                                 $active='';
00285                                         }
00286                                         $thSender = $be_user_Array_o[$r_row["cruser_id"]]["username"]." (".$be_user_Array_o[$r_row["cruser_id"]]["realName"]."), ".$this->dateTimeAge($r_row["crdate"]);
00287                                         $thread_lines[]=$this->linkMessage('<img src="'.$this->backPath.'gfx/i/'.($r_row["orig_recipient"]<0?'tc_mails_group.gif':'tc_mails.gif').'" width="18" height="16" hspace=2 border=0 align=top>'.$active."&nbsp;".$thSender,$r_row["mm_uid"]);
00288                                         //debug($r_row);
00289                                 }
00290 //                              debug($recipArray);
00291                                 
00292 
00293                                 $header=fw('<img src="'.$this->backPath.'gfx/i/'.($row["orig_recipient"]<0?'tc_mails_group.gif':'tc_mails.gif').'" width="18" height="16" hspace=2 border=0 align=top> <strong>'.$row["title"].'</strong><BR>');
00294                                 $formA=array();
00295                                 $formA[]=array($LANG->getLL("messages_lSender").":&nbsp;", $currentSenderName);
00296 //                              if (count($recipArray)>1)               {
00297                                         $formA[]=array($LANG->getLL("messages_lRecipients").":&nbsp;", implode("<BR>",$recipArray));
00298 //                              }
00299                                 $formA[]=array($LANG->getLL("messages_lDateTime").":&nbsp;", $this->dateTimeAge($row["crdate"]));
00300                                 $formA[]=array($LANG->getLL("messages_message").":&nbsp;", nl2br($row["note"]));
00301                                 if (count($thread_lines)>1)     {
00302                                         $formA[]=array($LANG->getLL("messages_thread").":&nbsp;", implode("<BR>",$thread_lines));
00303                                 }
00304 
00305                                 $msg[] = $header.$this->pObj->doc->table($formA);
00306                         }
00307                         $msg_buffer.= $this->pObj->doc->spacer(20);
00308                         $msg_buffer.= $this->pObj->doc->section('<a name="msg"></a>'.$LANG->getLL("messages_content"),implode("",$msg),0,1,0,1);
00309                 }
00310 
00311 
00312                         // SELECT messages for list:
00313                 switch($this->pObj->MOD_SETTINGS["tx_sysmessages_box"]) {
00314                         case "archive":
00315                                 $ss = 1;
00316                         break;
00317                         case "deleted":
00318                                 $ss = 127;
00319                         break;
00320                         case "sent":
00321                                 $ss = 126;
00322                         break;
00323                         default:
00324                                 $ss = 0;
00325                         break;
00326                 }
00327                 
00328                 
00329                 $res = $this->exec_messages_selectFromStatus($ss);
00330                 $out = "";
00331                 $marked_code = $this->pObj->MOD_SETTINGS["tx_sysmessages_box"]=="sent" ? "" : '<strong>'.fw($LANG->getLL("messages_lMark").":").'</strong>';
00332                 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res))   {
00333                         $lines=array();
00334                         $lines[]='<tr>
00335                                 <td class="bgColor5">'.fw("&nbsp;").'</td>
00336                                 <td class="bgColor5" width=33%><strong>'.fw($LANG->getLL("messages_lSubject").":").'</strong></td>
00337                                 <td class="bgColor5" width=33%><strong>'.fw($LANG->getLL("messages_lSender").":").'</strong></td>
00338                                 <td class="bgColor5" width=33%><strong>'.fw($LANG->getLL("messages_lDateTime").":").'</strong></td>
00339                                 <td class="bgColor5">'.$marked_code.'</td>
00340                         </tr>';
00341 
00342                         $c=0;
00343                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
00344 //                      debug($row);
00345                                 $c++;
00346                                 $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
00347                                 if ($mUid_MM==$row["mm_uid"])   {
00348                                         $active='<img src="'.$this->backPath.'gfx/content_client.gif" width="7" height="10" border="0" align=top>';
00349                                 } else {
00350                                         $bTb=$bTe="";
00351                                         $active='';
00352                                 }
00353                                 if (!$row["is_read"])   {
00354                                         $bTb="<B>";
00355                                         $bTe="</B>";
00356                                 } else {
00357                                         $bTb=$bTe="";
00358                                 }
00359                                 $marked_code = $this->pObj->MOD_SETTINGS["tx_sysmessages_box"]=="sent" ? "" : '<input type="checkbox" name="MARKED['.$row["mm_uid"].']" value="1">';
00360                                 $lines[]='<tr>
00361                                         <td class="'.$bgColorClass.'">'.$this->linkMessage('<img src="'.$this->backPath.'gfx/i/'.($row["orig_recipient"]<0?'tc_mails_group.gif':'tc_mails.gif').'" width="18" height="16" hspace=2 border=0>',$row["mm_uid"]).'</td>
00362                                         <td class="'.$bgColorClass.'" nowrap>'.$this->linkMessage($active.$bTb."&nbsp;".$this->fixed_lgd($row["title"])."&nbsp;".$bTe,$row["mm_uid"]).'</td>
00363                                         <td class="'.$bgColorClass.'" nowrap>'.$this->linkMessage($bTb."&nbsp;".$this->fixed_lgd($be_user_Array_o[$row["cruser_id"]]["username"]." (".$be_user_Array_o[$row["cruser_id"]]["realName"].")")."&nbsp;".$bTb,$row["mm_uid"]).'</td>
00364                                         <td class="'.$bgColorClass.'" nowrap>'.$this->dateTimeAge($row["crdate"]).'</td>
00365                                         <td class="'.$bgColorClass.'" align=right>'.$marked_code.'</td>
00366                                 </tr>';
00367                         }
00368                         $out = '<table border=0 cellpadding=0 cellspacing=0>'.implode("",$lines).'</table>';
00369                 }
00370                 $labelKey = $LANG->getLL("messages_".$this->pObj->MOD_SETTINGS["tx_sysmessages_box"]);
00371                 $lMenu = t3lib_BEfunc::getFuncMenu("","SET[tx_sysmessages_box]",$this->pObj->MOD_SETTINGS["tx_sysmessages_box"],$this->pObj->MOD_MENU["tx_sysmessages_box"]);
00372                 if ($c && $this->pObj->MOD_SETTINGS["tx_sysmessages_box"]!="sent")      {
00373                         $bMenu = '<BR><div align=right><select name="marked_mails_action">
00374                         <option value=-1></option>
00375                         <option value=0>'.$LANG->getLL("messages_moveTo").' '.$LANG->getLL("messages_inbox").'</option>
00376                         <option value=1>'.$LANG->getLL("messages_moveTo").' '.$LANG->getLL("messages_archive").'</option>
00377                         <option value=127>'.$LANG->getLL("messages_moveDelete").'</option>
00378                         </select><input type="submit" name="marked_mails" value="'.$LANG->getLL("messages_moveMarked").'"></div>';
00379                 } else $bMenu = "";
00380                 $theCode.= $this->pObj->doc->section($labelKey,$lMenu.$out.$bMenu,0,1);
00381                 $theCode.=$msg_buffer;
00382 
00383                         
00384                         // CREATE MAIL:
00385                 // New mail/reply form:
00386                 $opt=array();
00387                 $opt[]='<option value="0"></option>';
00388                 reset($be_user_Array);
00389                 while(list($uid,$dat)=each($be_user_Array))     {
00390                         $opt[]='<option value="'.$uid.'">'.htmlspecialchars($dat["username"].($dat["uid"]==$this->BE_USER->user["uid"]?' ['.$LANG->getLL("lSelf").']':' ('.$dat["realName"].')')).'</option>';
00391                 }
00392                 if (count($be_group_Array))     {
00393                         $opt[]='<option value="0">'.$LANG->getLL("listSeparator_Groups").'</option>';
00394                         reset($be_group_Array);
00395                         while(list($uid,$dat)=each($be_group_Array))    {
00396                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'be_users', $GLOBALS['TYPO3_DB']->listQuery('usergroup_cached_list', $uid, 'be_users').t3lib_BEfunc::deleteClause('be_users'));
00397                                 list($grCount) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00398                                 $opt[] = '<option value="-'.$uid.'">'.htmlspecialchars($dat["title"]." (".$grCount." recipients)").'</option>';
00399                         }
00400                 }
00401 
00402                 $type = ($currentSender && $this->pObj->MOD_SETTINGS["tx_sysmessages_box"]!="sent") ? $mUid_MM : "NEW";
00403                 $replyContent="";
00404                 $formA=array();
00405                 if ($type=="NEW")       {
00406                         $formA[]=array($LANG->getLL("messages_recipient").":&nbsp;", '<select name="data[sys_messages]['.$type.'][recipient]">'.implode("",$opt).'</select>');
00407                         $formA[]=array($LANG->getLL("messages_subject").":&nbsp;", '<input type="text" name="data[sys_messages]['.$type.'][title]" max=255'.$this->pObj->doc->formWidth(40).'>');
00408                 } else {
00409                         $formA[]=array($LANG->getLL("messages_recipient").":&nbsp;", '<input type="hidden" name="data[sys_messages]['.$type.'][recipient]" value="'.$currentSender.'">'.$currentSenderName);
00410                         $currentSubject = $LANG->getLL("messages_RE").": ".ereg_replace("[[:alnum:]]:[ ]*","",$currentSubject);
00411                         $formA[]=array($LANG->getLL("messages_subject").":&nbsp;", '<input type="hidden" name="data[sys_messages]['.$type.'][title]" value="'.htmlspecialchars($currentSubject).'">'.$this->fixed_lgd($currentSubject,50));
00412                 }
00413                 $insert = $type=="NEW" ? '' : '<BR><input type=hidden name="insertContentStore" value="'.htmlspecialchars($currentContent).'"><input type=hidden name="insertContentStore_formatted" value="'.htmlspecialchars($currentContent_formatted).'"><strong><a href="#" onClick="document.forms[0][\'data[sys_messages]['.$type.'][note]\'].value+=document.forms[0].insertContentStore.value; return false;">Insert original</a> - <a href="#"  onClick="document.forms[0][\'data[sys_messages]['.$type.'][note]\'].value+=document.forms[0].insertContentStore_formatted.value; return false;">Insert formatted</a></strong>';
00414                 $formA[]=array($LANG->getLL("messages_message").":&nbsp;", '<textarea wrap="virtual" rows="10" name="data[sys_messages]['.$type.'][note]"'.$this->pObj->doc->formWidthText(40,"","virtual").'>'.t3lib_div::formatForTextarea($replyContent).'</textarea>'.$insert);
00415                 if ($this->BE_USER->user["email"])      {
00416                         $formA[]=array("&nbsp;", '<input type="checkbox" name="sendAsEmail" value=1>'.$LANG->getLL("messages_email").'<BR>('.$LANG->getLL("lReplyAddress").': '.$this->BE_USER->user["email"].')');
00417                 }
00418                 if ($type!="NEW" && count($recipArray)>1)       {
00419                         $formA[]=array("&nbsp;", '<input type="checkbox" name="replyAll" value=1>'.sprintf($LANG->getLL("messages_replyAll"),count($recipArray)));
00420                 }
00421 
00422                 $formA[]=array("&nbsp;","&nbsp;");
00423                 $onClick = "if (document.forms[0]['data[sys_messages][".$type."][title]'].value=='' || document.forms[0]['data[sys_messages][".$type."][note]'].value=='' || document.forms[0]['data[sys_messages][".$type."][recipient]'].options[document.forms[0]['data[sys_messages][".$type."][recipient]'].selectedIndex].value==0) {alert(".$GLOBALS['LANG']->JScharCode($LANG->getLL("messages_mustFillIn")).");return false;}";
00424                 if ($type=="NEW")       {
00425                         $formA[]=array("&nbsp;", '<input type="submit" name="submit" value="'.$LANG->getLL("lSendNew").'" onClick="'.$onClick.'">');
00426                 } else {
00427                         $formA[]=array("&nbsp;", '<input type="submit" name="submit" value="'.$LANG->getLL("lSendReply").'">');
00428                 }
00429                         
00430                 $update = $doUpdate ? '<script language="javascript" type="text/javascript">if (parent.list_frame) {parent.nav_frame.document.location = "overview.php";}</script>' : '';
00431                 $theCode.= $this->pObj->doc->spacer(20);
00432                 $theCode.= $this->pObj->doc->section($LANG->getLL($type=="NEW"?"messages_new":"messages_reply"),$this->pObj->doc->table($formA).$update,0,1);
00433                 return $theCode;
00434         }
00435         function linkMessage($str,$id)  {
00436                 $str='<a href="index.php?sys_messages_MM_uid='.$id.'#msg">'.$str.'</a>';
00437                 return $str;
00438         }
00439         function breakLines($str,$implChar="\n",$charWidth=0)   {
00440                 return t3lib_div::breakLinesForEmail($str,$implChar,$charWidth?$charWidth:$this->charWidth);
00441         }
00442 }
00443 
00444 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/sys_messages/class.tx_sysmessages.php"])       {
00445         include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/sys_messages/class.tx_sysmessages.php"]);
00446 }
00447 
00448 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6