• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

mail_options.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00033 require_once "./include/inc.header.php";
00034 require_once "./include/inc.mail.php";
00035 require_once "./classes/class.ilMailbox.php";
00036 require_once "./classes/class.ilFormatMail.php";
00037 
00038 $lng->loadLanguageModule("mail");
00039 
00040 $mbox = new ilMailBox($_SESSION["AccountId"]);
00041 $umail = new ilFormatMail($_SESSION["AccountId"]);
00042 
00043 // catch hack attempts
00044 if (!$rbacsystem->checkAccess("mail_visible",$umail->getMailObjectReferenceId()))
00045 {
00046         $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->WARNING);
00047 }
00048 
00049 // CREATE OUTPUT
00050 $tpl->addBlockFile("CONTENT", "content", "tpl.mail_options.html");
00051 $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00052 $tpl->setVariable("TXT_OPTIONS_OF",$lng->txt("mail_options_of"));
00053 infoPanel();
00054 
00055 setLocator($_GET["mobj_id"],$_SESSION["AccountId"],"");
00056 
00057 // RENAME FOLDER
00058 if(isset($_POST["cmd"]["rename"]))
00059 {
00060         $tmp_data = $mbox->getFolderData($_GET["mobj_id"]);
00061         if($tmp_data["title"] != $_POST["folder_name"])
00062         {
00063                 if($mbox->renameFolder($_GET["mobj_id"],$_POST["folder_name"]))
00064                 {
00065                         sendInfo($lng->txt("mail_folder_name_changed"));
00066                 }
00067                 else
00068                 {
00069                         sendInfo($lng->txt("mail_folder_exists"));
00070                 }
00071         }
00072 }
00073 // DELETE FOLDER ask for confirmation
00074 if(isset($_POST["cmd"]["delete"]))
00075 {
00076         sendInfo($lng->txt("mail_sure_delete_folder"));
00077 }
00078 
00079 
00080 // SAVE OPTIONS
00081 if(isset($_POST["cmd"]["save"]))
00082 {
00083         $umail->mail_options->updateOptions($_POST["signature"],(int) $_POST["linebreak"],(int) $_POST["incoming_type"]);
00084         sendInfo($lng->txt("mail_options_saved"),true);
00085         header("location: mail.php?mobj_id=$_GET[mobj_id]");
00086         exit;
00087 }
00088         
00089 
00090 // GET FOLDER DATA
00091 $folder_data = $mbox->getFolderData($_GET["mobj_id"]);
00092 
00093 include "./include/inc.mail_buttons.php";
00094 
00095 $tpl->setVariable("TXT_MAIL", $lng->txt("mail"));
00096 
00097 $tpl->setCurrentBlock("content");
00098 
00099 // CONFIRM DELETE
00100 if(isset($_POST["cmd"]["delete"]))
00101 {
00102         $tpl->setCurrentBlock("confirm_delete");
00103         $tpl->setVariable("ACTION_DELETE","mail_frameset.php?mobj_id=$_GET[mobj_id]");
00104         $tpl->setVariable("TXT_DELETE_CONFIRM",$lng->txt("confirm"));
00105         $tpl->setVariable("TXT_DELETE_CANCEL",$lng->txt("cancel"));
00106         $tpl->parseCurrentBlock();
00107 }
00108 
00109 // FORM EDIT FOLDER
00110 if($folder_data["type"] == 'user_folder' and !isset($_POST["cmd"]["delete"]))
00111 {
00112         $tpl->setCurrentBlock('edit');
00113         $tpl->setVariable("FOLDER_OPTIONS",$lng->txt("mail_folder_options"));
00114         $tpl->setVariable("TXT_DELETE",$lng->txt("delete"));
00115         $tpl->setVariable("ACTION","mail_options.php?mobj_id=".$_GET["mobj_id"]);
00116         $tpl->setVariable("TXT_NAME",$lng->txt("mail_folder_name"));
00117         $tpl->setVariable("FOLDER_NAME",$folder_data["title"]);
00118         $tpl->setVariable("TXT_RENAME",$lng->txt("rename"));
00119         $tpl->parseCurrentBlock();
00120 }
00121 
00122 // FORM ADD FOLDER
00123 if(($folder_data["type"] == 'user_folder' or $folder_data["type"] == 'local') 
00124         and !isset($_POST["cmd"]["delete"]))
00125 {
00126         $tpl->setCurrentBlock('add');
00127         $tpl->setVariable("ACTION_ADD","mail_frameset.php?mobj_id=$_GET[mobj_id]");
00128         $tpl->setVariable("TXT_NAME_ADD",$lng->txt("mail_folder_name"));
00129         $tpl->setVariable("TXT_FOLDER_ADD",$lng->txt("add"));
00130         $tpl->parseCurrentBlock();
00131 }
00132 
00133 // FORM GLOBAL OPTIONS
00134 if(!isset($_POST["cmd"]["delete"]))
00135 {
00136         $tpl->setCurrentBlock("options");
00137 
00138         // BEGIN INCOMING
00139         $tpl->setCurrentBlock("option_inc_line");
00140 
00141         $inc = array($lng->txt("mail_incoming_local"),$lng->txt("mail_incoming_smtp"),$lng->txt("mail_incoming_both"));
00142         foreach($inc as $key => $option)
00143         {
00144                 $tpl->setVariable("OPTION_INC_VALUE",$key);
00145                 $tpl->setVariable("OPTION_INC_NAME",$option);
00146                 $tpl->setVariable("OPTION_INC_SELECTED",$umail->mail_options->getIncomingType() == $key ? "selected=\"selected\"" : "");
00147                 $tpl->parseCurrentBlock();
00148         }
00149 
00150         // BEGIN LINEBREAK_OPTIONS
00151         $tpl->setCurrentBlock("option_line");
00152         $linebreak = $umail->mail_options->getLinebreak();
00153         
00154         for($i = 50; $i <= 80;$i++)
00155         {
00156                 $tpl->setVariable("OPTION_VALUE",$i);
00157                 $tpl->setVariable("OPTION_NAME",$i);
00158                 if( $i == $linebreak)
00159                 {
00160                         $tpl->setVariable("OPTION_SELECTED","selected");
00161                 }
00162                 $tpl->parseCurrentBlock();
00163         }
00164         $tpl->setVariable("GLOBAL_OPTIONS",$lng->txt("mail_global_options"));
00165         $tpl->setVariable("TXT_INCOMING", $lng->txt("mail_incoming"));
00166         $tpl->setVariable("TXT_LINEBREAK", $lng->txt("linebreak"));
00167         $tpl->setVariable("TXT_SIGNATURE", $lng->txt("signature"));
00168         $tpl->setVariable("CONTENT",$umail->mail_options->getSignature());
00169         $tpl->setVariable("TXT_SAVE", $lng->txt("save"));
00170         $tpl->parseCurrentBlock();
00171 }
00172 $tpl->show();
00173 ?>

Generated on Fri Dec 13 2013 09:06:37 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1