[TYPO3-german] TCE-Forms in BE-Modul (loadJavascriptLib -> Fatal Error)

Cornelius Illi cornelius.illi at student.hpi.uni-potsdam.de
Sat May 8 17:30:19 CEST 2010


Wow... vielen Dank! Ich wühl mich mal durch :-P

Am 08.05.2010 17:11, schrieb Kay Strobach:
> Hi Cornelius,
>
> leider klappt derzeit der Upload nicht. - Ich muss es dann nochmal von
> einem anderen Rechner aus probieren.
>
> Ich hoffe ja, dass mit Fluid auch standardisierte Formulare möglich
> werden ...
>
> Deswegen kommt hier der Code der Helferklasse und unten dann eine
> Beispielklasse, die ein be_user Form rendert. Das ist auch kombinierbar.
>
> Grüße
> Kay
>
> Beispiel
> $f.=$this->helper->TCEforms->getListedFields('be_users',$user[0],'username,disable,realName,email,lastlogin,password,starttime,endtime');
> $content.=$this->helper->TCEforms->wrapTotal($f, $user[0], 'be_users');
> $content.=$this->helper->TCEforms->printNeededJSFunctions();
>
> AJAX Helper
>
> <?php
> /***************************************************************
> *  Copyright notice
> *
> *  (c) 2008-2009 Kay Strobach (typo3 at kay-strobach.de)
> *  All rights reserved
> *
> *  This script is part of the TYPO3 project. The TYPO3 project 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.
> *
> *  The GNU General Public License can be found at
> *  http://www.gnu.org/copyleft/gpl.html.
> *  A copy is found in the textfile GPL.txt and important notices to the
> license
> *  from the author is found in LICENSE.txt distributed with these scripts.
> *
> *
> *  This script is distributed in the hope that it will be useful,
> *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> *  GNU General Public License for more details.
> *
> *  This copyright notice MUST APPEAR in all copies of the script!
> ***************************************************************/
> /**
>   * This class holds some functions used by the TYPO3 backend
>   *
>   *
>   * @Kay Strobach<typo3 at kay-strobach.de>
>   */
> /**
>   * [CLASS/FUNCTION INDEX of SCRIPT]
>   */
>          /*required libraries*/
> require_once(PATH_t3lib.'class.t3lib_tcemain.php');
> require_once(PATH_t3lib.'class.t3lib_tceforms.php');
> require_once (PATH_t3lib.'class.t3lib_transferdata.php');
> require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
> require_once(PATH_t3lib . 'class.t3lib_scbase.php');
>          /*create the related class*/
>          class tx_ks_sitemgr_ajaxHelper {
>                  var $user=NULL;
>                  var $storagePID = NULL;
>                  var $parentStoragePID = NULL;
>                  var $TCEforms = NULL;
>                  function main() {
>                          $this->id=intval(t3lib_div::_GP('id'));
>                          $this->initTCEforms();
>                          $content='<script language="JavaScript">window.status=("nur gui
> geändert, demo modus");</script>';
>                  }
>                  static function getIframe($uri) {
>                          return '<iframe src="'.htmlspecialchars($uri).'" frameborder="0"
> style="margin:0px;" width="100%" height="97%"></iframe>';
>                  }
>                  function initTCEforms() {
>                          $this->TCEforms = t3lib_div::makeInstance('t3lib_TCEforms');
>                          $this->TCEforms->initDefaultBEMode();
>                          $this->TCEforms->setNewBEDesign();
>                          $this->TCEforms->backPath = $GLOBALS['BACK_PATH'];
>                          $this->TCEforms->doSaveFieldName = 'doSave';
>                          $this->TCEforms->localizationMode =
> t3lib_div::inList('text,media',$this->localizationMode) ?
> $this->localizationMode : '';   // text,media is keywords defined in TYPO3
> Core API..., see "l10n_cat"
>                          $this->TCEforms->returnUrl = $this->R_URI;
>                          $this->TCEforms->palettesCollapsed =
> !$this->MOD_SETTINGS['showPalettes'];
>                          $this->TCEforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
>                          $this->TCEforms->enableClickMenu = true;
>                          $this->TCEforms->enableTabMenu = true;
>
>                          // Setting external variables:
>                          if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']!='text'&&
> $this->MOD_SETTINGS['showDescriptions']) {
>                                  $this->tceforms->edit_showFieldHelp='text';
>                          }
>                          //thanks to dimitry dupelov
>                          /*$content.='
>                                          <script type="text/javascript"
> src="../../../../typo3/contrib/prototype/prototype.js"></script>
>                                          <script type="text/javascript"
> src="../../../../typo3/js/iecompatibility.js"></script>
>                                          <script type="text/javascript"
> src="../../../../typo3/js/clickmenu.js"></script>
>                                          <script type="text/javascript" src="../../../../typo3/md5.js"></script>
>                                          <script type="text/javascript"
> src="../../../../t3lib/jsfunc.evalfield.js"></script>
>                          ';*/
>                          #$content=$this->TCEforms->printNeededJSFunctions_top();;
>                          #$content.='<form action="" method="post"
> enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"
> name="editform"
> onsubmit="document.editform._scrollPosition.value=(document.documentElement.scrollTop
> || document.body.scrollTop); return TBE_EDITOR.checkSubmit(1);">';
>                          $content.='<form action="" method="post" id="typo3form"
> enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"
> name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
>                          #$content.='<form action="" method="post"
> enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"
> name="editform">';
>                          $content.='<input type="hidden" name="uid"
> value="'.intval(t3lib_div::_GP('uid')).'">';
>
>                          return $content;
>                  }
>                  function TCEFormsField($field) {
>                          $fieldHTML =@$this->TCEforms->getSingleField_SW('','',array(),$field);
>                          $fieldLabel=$field['label'];
>                          $fieldName
> =substr($field['itemFormElName'],1+strrpos($field['itemFormElName'],'['),-1);
>                          $content.=$this->TCEforms->fieldTemplate;
>                          $content=str_replace('###BGCOLOR###'
> ,$this->TCEforms->colorScheme[0],$content);
>                          $content=str_replace('###CLASSATTR_1###'
> ,'class="'.$this->TCEforms->classScheme[0].'1"',$content);
>                          $content=str_replace('###FIELD_ITEM###' ,$fieldHTML       ,$content);
>                          $content=str_replace('###BGCOLOR_HEAD###'
> ,$this->TCEforms->colorScheme[0],$content);
>                          $content=str_replace('###CLASSATTR_2###'
> ,'class="'.$this->TCEforms->classScheme[0].'2"',$content);
>                          $content=str_replace('###FIELD_NAME###'  ,$fieldLabel      ,$content);
>                          $content=str_replace('###FIELD_HELP_ICON###'  ,''      ,$content);
>                          $content=str_replace('###FIELD_HELP_TEXT###'  ,''      ,$content);
>                          $content=str_replace('###FIELD_PAL_LINK_ICON###'  ,''      ,$content);
>                          $content=str_replace('###FIELD_TABLE###','custom',$content);
>                          $content=str_replace('###FIELD_FIELD###',$fieldName,$content);
>                          $content=str_replace('###FIELD_ID###',t3lib_div::_GP('uid'),$content);
>
>                          return $content;
>                  }
>                  function initPageInfo() {
>                          $tce=t3lib_div::makeInstance('t3lib_TCEmain');
>                          $this->pageinfo=$tce->recordInfo('pages',$this->id,'*');
>                          return true;
>                  }
>                  function script($script) {
>                          return '<script type="text/javascript"
> language="javaScript">'.$script.'</script>';
>                  }
>                  function ajaxify($action, $uid,$inner,$confirm='') {
>                          $pos=strpos($action,'|');
>                          if(!$pos===FALSE) {
>                                  $id     = substr($action,$pos+1);
>                                  $action = substr($action,0,$pos);
>                          } else {
>                                  $id     = $action.'_'.$uid;
>                          }
>                          $action = str_replace('->','|',$action);
>                          if(!$confirm) {
>                                  return '<span id="'.htmlspecialchars($action).'_'.intval($uid).'"
> onClick="new Ajax.Updater(\''.$id.'\',
> \'index.php?eID=ks_sitemgr_eid&action='.$action.'&uid='.$uid.'\', {
> method: \'get\' ,evalScripts:true});" class="clickable">'.$inner.'</span>';
>                          } else {
>                                  return '<span id="'.htmlspecialchars($action).'_'.intval($uid).'"
> onClick="if(confirm(\''.$confirm.'\')){new Ajax.Updater(\''.$id.'\',
> \'index.php?eID=ks_sitemgr_eid&action='.$action.'&uid='.$uid.'\', {
> method: \'get\' ,evalScripts:true});}" class="clickable">'.$inner.'</span>';
>                          }
>                  }
>                  function getTSConstantValue($pid,$name) {
>                          $template_uid = 0;
>                          $pageId = $pid;
>                          $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext");  // Defined
> global here!
>                          $tmpl->tt_track = 0;    // Do not log time-performance information
>                          $tmpl->init();
>
>                          $tplRow = $tmpl->ext_getFirstTemplate($pageId,$template_uid);
>                          if (is_array($tplRow) || 1)     {       // IF there was a template...
>                                          // Gets the rootLine
>                                  $sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
>                                  $rootLine = $sys_page->getRootLine($pageId);
>                                  $tmpl->runThroughTemplates($rootLine,$template_uid);    // This
> generates the constants/config + hierarchy info for the template.
>                                  $theConstants = $tmpl->generateConfig_constants();      // The editable
> constants are returned in an array.
>                                  $tmpl->ext_categorizeEditableConstants($theConstants);  // The
> returned constants are sorted in categories, that goes into the
> $tmpl->categories array
>                                  $tmpl->ext_regObjectPositions($tplRow["constants"]);            // This array
> will contain key=[expanded constantname], value=linenumber in template.
> (after edit_divider, if any)
>                          } else {
>                                  throw new Exception('No Template found!!!');
>                          }
>                          return $tmpl->setup['constants'][$name];
>                  }
>                  function setTSConstantValue($pid,$name,$value) {
>
>                          $template_uid = 0;
>                          $pageId = $pid;
>                          $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext");  // Defined
> global here!
>                          $tmpl->tt_track = 0;    // Do not log time-performance information
>                          $tmpl->init();
>
>                          $pageId = $this->getTSConstantValue($pageId,'usr_root');
>                          if(intval($pageId)===0) {
>                                  throw new Exception('TSConstant usr_root must be defined');
>                          }
>
>                          $tplRow = $tmpl->ext_getFirstTemplate($pageId,$template_uid);
>
>                          if (is_array($tplRow) || 1)     {
>                                  $userStatus = $GLOBALS['BE_USER']->user['admin'];
>                                  $GLOBALS['BE_USER']->user['admin']=1;
>
>                                  $sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
>                                  $rootLine = $sys_page->getRootLine($pageId);
>                                  $tmpl->runThroughTemplates($rootLine,$template_uid);    // This
> generates the constants/config + hierarchy info for the template.
>                                  $theConstants = $tmpl->generateConfig_constants();      // The editable
> constants are returned in an array.
>                                  $tmpl->ext_categorizeEditableConstants($theConstants);  // The
> returned constants are sorted in categories, that goes into the
> $tmpl->categories array
>                                  $tmpl->ext_regObjectPositions($tplRow["constants"]);            // This array
> will contain key=[expanded constantname], value=linenumber in template.
> (after edit_divider, if any)
>
>                                  $tmpl->ext_putValueInConf($name,$value);
>
>                                  $recData=array();
>                                  $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
>                                  $recData["sys_template"][$saveId]["constants"] =
> implode($tmpl->raw,chr(10));
>
>                                  // Create new  tce-object
>                                  $tce = t3lib_div::makeInstance("t3lib_TCEmain");
>                                  $tce->stripslashes_values=0;
>                                  // Initialize
>                                  $tce->start($recData,Array());
>                                  // Saved the stuff
>                                  $tce->process_datamap();
>                                  // Clear the cache (note: currently only admin-users can clear the
> cache in tce_main.php)
>                                  $tce->clear_cacheCmd("all");
>
>                                  $GLOBALS['BE_USER']->user['admin']=$userStatus;
>
>                          } else {
>                                  throw new Exception('No Template found!!!');
>                          }
>                  }
>                  function ajaxAutoloader($action,$uid) {
>                          $content.='<div id="'.$action.'"><img
> src="../../../../typo3/gfx/spinner.gif">  Bitte warten, Daten werden
> geladen.</div>';
>                          $content.=$this->script('new Ajax.Updater(\''.$action.'\',
> \'index.php?eID=ks_sitemgr_eid&action='.$action.'&uid='.$uid.'\', {
> method: \'get\' ,evalScripts:true});');
>                          return $content;
>                  }
>                  function warning($text) {
>                          global $LANG;
>                          $content = '<table border="0" cellpadding="0" cellspacing="0"
> class="warningbox" style="width:500px;"><tr><td>'.
>                                                  '<h5>'.$LANG->getLL('hint').'!</h5>'.
>                                                  $text.
>                                                  '</td></tr></table>';
>                          $content = '<p style="margin:20px;margin-left:0px;clear:both;">'.
>                                                  '<img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
> 'gfx/icon_fatalerror.gif', '').' title="Hinweis">  '.
>                                                  '<strong>'.$text.'</strong>';
>                                                  '</p>';
>
>
>                          return $content;
>                  }
>                  function hint($text) {
>                          $content.='<p style="margin:10px;margin-left:0px;clear:both;">';
>                          $content.='<img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
> 'gfx/icon_note.gif', '').' title="Hinweis">';
>                          $content.=$text;
>                          $content.='</p>';
>                          return $content;
>                  }
>                  function dialogTitle($title) {
>                          return '
>                                  <script language="JavaScript" type="text/JavaScript">
>                                          parent.setDialogTitle("'.addslashes($title).'");
>                                  </script>
>                          ';
>                  }
>
>                  function exp_u_endisable() {
>                          if($this->allowedToModifyUser(t3lib_div::_GP('uid'))) {
>                                  $users=$GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
>                                          'disable',
>                                          'be_users',
>                                          'uid='.intval(t3lib_div::_GP('uid'))
>                                  );
>                                  if($users[0]['disable']==1) {
>                                          $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
>                                                  'be_users',
>                                                  'uid='.intval(t3lib_div::_GP('uid')),
>                                                  array(
>                                                          'disable'=>'0'
>                                                  )
>                                          );
>                                  } else {
>                                          $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
>                                                  'be_users',
>                                                  'uid='.intval(t3lib_div::_GP('uid')),
>                                                  array(
>                                                          'disable'=>'1'
>                                                  )
>                                          );
>                                  }
>                          }
>                          return $this->exp_tabUser();
>                  }
>                  function exp_u_perms() {
>                          return 'P';
>                  }
>                  function tceForm($inner) {
>                          $content.= '<table class="typo3-TCEforms">';
>                          $content.='<tr><td>';
>                          $content.= $inner;
>                          $content.='</td></tr>';
>                          $content.= '</table>';
>                          return $content;
>                  }
>                  function tceFormWrap($inner) {
>                          return $inner;
>                          $content.= '<table class="wrapperTable1" width="100%" cellspacing="0"
> cellpadding="0" border="0">';
>                          $content.='<tr><td>';
>                          $content.= $inner;
>                          $content.='</td></tr>';
>                          $content.= '</table>';
>                          return $content;
>                  }
>                  function tceFormWrapInner($caption,$inner,$img='') {
>                          $content.= '<table class="wrapperTable1" width="100%" cellspacing="0"
> cellpadding="0" border="0">';
>                          $content.='<tr>';
>                          $content.='<td class="class-main12" width="16">';
>                          if($img!='') {
>                                  $content.= '<img src="'.$img.'" width="16" height="16"
> class="absmiddle" hspace="2" vspace="2">';
>                          }
>                          $content.='</td>';
>                          $content.='<td class="class-main12"><span class="class-main14"><b>';
>                          $content.= $caption;
>                          $content.='</b></span></td>';
>                          $content.='</tr><tr>';
>                          $content.='<td>&nbsp;</td>';
>                          $content.='<td>';
>                          $content.= $inner;
>                          $content.='</td></tr>';
>                          $content.= '</table>';
>                          return $content;
>                  }
>
>          }
>          /*XCLASS declaration*/
>
>
> ?>
>
>
>
>
>
>
>
> ---------------------------------------------------------
>
>
>
> <?php
> /***************************************************************
> *  Copyright notice
> *
> *  (c) 2008-2009 Kay Strobach (typo3 at kay-strobach.de)
> *  All rights reserved
> *
> *  This script is part of the TYPO3 project. The TYPO3 project 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.
> *
> *  The GNU General Public License can be found at
> *  http://www.gnu.org/copyleft/gpl.html.
> *  A copy is found in the textfile GPL.txt and important notices to the
> license
> *  from the author is found in LICENSE.txt distributed with these scripts.
> *
> *
> *  This script is distributed in the hope that it will be useful,
> *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> *  GNU General Public License for more details.
> *
> *  This copyright notice MUST APPEAR in all copies of the script!
> ***************************************************************/
> /**
>   * This class holds some functions used by the TYPO3 backend
>   *
>   *
>   * @Kay Strobach<typo3 at kay-strobach.de>
>   */
> /**
>   * [CLASS/FUNCTION INDEX of SCRIPT]
>   */
> require_once(dirname(__FILE__).'/class.tx_ks_sitemgr_customer.php');
> class  tx_ks_sitemgr_action_user extends t3lib_SCbase {
>                                  var $pageinfo;
>
>                                  /**
>                                   * Initializes the Module
>                                   * @return      void
>                                   */
>                                  function init() {
>                                          global
> $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
>                                          parent::init();
>                                  }
>                                  function accessable($pageinfo) {
>                                          try {
>                                                  $customer = new tx_ks_sitemgr_customer();
>                                                  $customer->getCustomerForPage($_GET['id']);
>
>
> if(in_array($GLOBALS['BE_USER']->user['uid'],$customer->getAdminUsersUids())
> || $GLOBALS['BE_USER']->user['admin']==1) {
>                                                          return true;
>                                                  } else {
>                                                          return false;
>                                                  }
>                                          } catch(Exception $e) {
>                                                  return false;
>                                          }
>                                  }
>                                  function main() {
>                                          global
> $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
>                                          // Draw the header.
>
>                                          $content.='<div id="user">';
>                                          $content.= '<table class="typo3-dblist" border="0" cellpadding="2"
> cellspacing="0">';
>                                          $content.= '<tr class="c-headLineTable">';
>                                                  $content.= '<td></td>';
>                                                  $content.= '<td colspan="3"><a>Benutzerverwaltung</a></td>';
>                                          $content.= '</tr>';
>                                          $content.= '<tr class="c-headLine">';
>                                                  $content.= '<td class="col-icon">';
>                                                  $content.= '</td>';
>                                                  $content.= '<td class="col-title">Benutzername</td>';
>                                                  $content.= '<td class="col-title">Realname</td>';
>                                                  $content.= '<td class="col-control">Werkzeuge</td>';
>                                          $content.= '</tr>';
>                                          #$users=$this->helper->getManageableUsers();
>                                          $customer = new tx_ks_sitemgr_customer();
>                                          $customer->getCustomerForPage($_GET['id']);
>                                          $users = $customer->getAllUsers();
>                                          foreach($users as $user) {
>                                                  $content.='<tr id="user'.$user['uid'].'" class="db_list_normal">';
>                                                  $content.='<td class="col-icon"><img
> src="../../../../typo3/sysext/t3skin/icons/gfx/i/'
>                                                          .($user['disable'] ? 'be_users__h.gif' : 'be_users.gif')
>                                                          .'" title="'.htmlspecialchars($user['uid']).'"></td>';
>                                                  $content.='<td
> class="col-title">'.htmlspecialchars($user['username']).'</td>';
>                                                  $content.='<td
> class="col-title">'.htmlspecialchars($user['realName']).'</td>';
>                                                  $content.='<td class="col-control">';
>                                                  if($user['uid']!=$BE_USER->user['uid']) {
>                                                          $content.='<a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user&method=editFormContent&uid='.$user['uid'].'"><img
> '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif', '').'
> title="Benutzer ändern"></a>';
>                                                          if(!$user['disable']) {
>                                                                  $content.='<a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user&method=switchVisibility&uid='.$user['uid'].'"><img
> '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/button_hide.gif',
> '').' title="Benutzer deaktivieren"></a>';
>                                                          } else {
>                                                                  $content.='<a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user&method=switchVisibility&uid='.$user['uid'].'"><img
> '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
> 'gfx/button_unhide.gif', '').' title="Benutzer aktivieren"></a>';
>                                                          }
>                                                          $content.='<a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=sitemanager&method=editFormContent&uid='.intval($this->id).'"
>    
>> <img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/perm.gif',
>>      
> '').' title="Rechte verwalten"></a>';
>                                                          $content.='<a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user&method=delete&uid='.$user['uid'].'"
> onCLick="return confirm(\'Wollen Sie wirklich den Benutzer
> '.htmlspecialchars($user['username']).' löschen?\')"><img
> '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/garbage.gif',
> '').' title="Benutzer löschen"></a>';
>                                                          if($GLOBALS['BE_USER']->user['admin']==1) {
>                                                                  $content.='<a
> href="mod.php?M=tools_beuser&SwitchUser='.$user['uid'].'"
> target="_top"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
> 'gfx/su.gif', '').' title="Rechte verwalten"></a>';
>                                                                  $content.='<a
> href="mod.php?M=tools_beuser&SwitchUser='.$user['uid'].'&switchBackUser=1"
> target="_top"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
> 'gfx/su_back.gif', '').' title="Rechte verwalten"></a>';
>                                                          }
>                                                  } else {
>                                                          $content.=$this->helper->hint('Sie können Sich nicht selbst
> bearbeiten.');
>                                                  }
>                                                  $content.='</td>';
>                                                  $content.='</tr>';
>                                          }
>                                          $content.='</table>';
>                                          $content.='</div>';
>                                          $this->content=$content;
>
>                                  }
>                                  function switchVisibility() {
>                                          global
> $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
>                                          $uid=intval(t3lib_div::_GP('uid'));
>                                          $customer = new tx_ks_sitemgr_customer();
>                                          $customer->getCustomerForPage($_GET['id']);
>                                          if($customer->isAllowedToModifyUser($uid)&&
> $uid!=$BE_USER->user['uid']) {
>                                                  $users=$GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
>                                                          'disable',
>                                                          'be_users',
>                                                          'uid='.$uid
>                                                  );
>                                                  if($users[0]['disable']==1) {
>                                                          $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
>                                                                  'be_users',
>                                                                  'uid='.$uid,
>                                                                  array(
>                                                                          'disable'=>'0'
>                                                                  )
>                                                          );
>                                                  } else {
>                                                          $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
>                                                                  'be_users',
>                                                                  'uid='.$uid,
>                                                                  array(
>                                                                          'disable'=>'1'
>                                                                  )
>                                                          );
>                                                  }
>                                          }
>                                          return $this->main();
>                                  }
>                                  function delete() {
>                                          global
> $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
>                                          $uid=intval(t3lib_div::_GP('uid'));
>                                          $customer = new tx_ks_sitemgr_customer();
>                                          $customer->getCustomerForPage($_GET['id']);
>
>                                          if($customer->isAllowedToModifyUser($uid)&&
> $uid!=$BE_USER->user['uid']) {
>                                                  $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
>                                                          'be_users',
>                                                          'uid='.$uid,
>                                                          array(
>                                                                  'deleted'=>'1'
>                                                          )
>                                                  );
>                                                  return $this->main();
>                                          } else {
>                                                  return $this->main();
>                                          }
>                                  }
>                                  function editFormContent() {
>                                          global
> $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
>                                          $uid=intval(t3lib_div::_GP('uid'));
>                                          $customer = new tx_ks_sitemgr_customer();
>                                          $customer->getCustomerForPage($_GET['id']);
>                                          $data=t3lib_div::_GP('data');
>                                          // Access check!
>                                          // The page will show only if there is a valid page and if this
> page may be viewed by the user
>
> if(($uid!==0)&&(!$customer->isAllowedToModifyUser(t3lib_div::_GP('uid')))) {
>                                                  $this->content= 'Zugriff verweigert auf
> '.htmlspecialchars(t3lib_div::_GP('uid'));
>                                                  return;
>                                          }
>
>                                          if ($customer->isAllowedToModifyUser($uid) || $uid ==0 ||
> ($BE_USER->user['admin']))      {
>                                                  //need to check wether the user may edit the active user
>                                                  if((t3lib_div::_GP('submit') == 'Update') ||
> (t3lib_div::_GP('submit') == 'UpdateClose')) {
>                                                          $update = array();
>                                                          $update['disable']   = $data['be_users'][$uid]['disable'];
>                                                          $update['realName']  = $data['be_users'][$uid]['realName'];
>                                                          $update['email']     = $data['be_users'][$uid]['email'];
>                                                          $update['lastlogin'] = $data['be_users'][$uid]['lastlogin'];
>                                                          $update['password']  = $data['be_users'][$uid]['password'];
>                                                          $update['starttime'] = $data['be_users'][$uid]['starttime'];
>                                                          $update['endtime']   = $data['be_users'][$uid]['endtime'];
>                                                          if($uid!==0) {
>                                                                  $user = new tx_ks_sitemgr_user($uid);
>                                                                  $user->updateUserData($update);
>                                                          } else {
>
>                                                                  try {
>                                                                          $update['username']       = $data['be_users'][$uid]['username'];
>                                                                          $update['options']        = 2;
>                                                                          $update['lang']           = $BE_USER->uc['lang'];
>                                                                          $update['usergroup']      = $customer->getGroups();
>                                                                          $update['tstamp']         = time();
>                                                                          $update['crdate']         = time();
>                                                                          $update['fileoper_perms'] = 15;
>                                                                          $user = new tx_ks_sitemgr_user(null);
>                                                                          $user->updateUserData($update);
>                                                                          $customer->getCustomerForPage($this->id);
>                                                                          $customer->addUserById($user->userId);
>                                                                          if(t3lib_div::_GP('submit') == 'UpdateClose') {
>                                                                                  header('Location:
> '.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user');
>                                                                          } else {
>                                                                                  header('Location:
> '.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user&method=editFormContent&uid='.intval($user->userId));
>                                                                          }
>                                                                          return;
>                                                                  } catch(Exception $e) {
>                                                                          $content.= $this->helper->warning($e->getMessage());
>                                                                          return;
>                                                                  }
>                                                          }
>
>
>
>                                                  }
>
>                                                  if(t3lib_div::_GP('submit') == 'UpdateClose') {
>                                                          header('Location:
> '.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user');
>                                                          return;
>                                                  }
>                                                  // Draw the header.
>                                                  $this->doc->bodyTagId='typo3-alt-doc-php';
>                                                  #$this->doc->form     =$this->helper->initTCEForms();
>                                                  // JavaScript
>
>                                                  if($uid!=0) {
>                                                          $user = t3lib_BEfunc::getRecordsByField(
>                                                                  'be_users',
>                                                                  'uid',
>                                                                  $uid
>                                                          );
>                                                          $TCA['be_users']['columns']['username' ]['config']['type']='none';
>                                                  } else {
>                                                          $user = array();
>                                                          //todo: change to customer name ...
>                                                          $user[0]['username'] = $customer->getMainUserName().'-';
>                                                          $user[0]['uid'] = '0';
>                                                          $TCA['be_users']['columns']['username' ]['label']='Benutzername,
> setzt sich zusammen aus dem Schulkürzel und einem frei wählbaren Namen
> (Bsp.: '.$customer->getMainUserName().'-fach)';
>                                                  }
>
>
>                                                  #t3lib_div::debug($_REQUEST);
>                                                  $TCA['be_users']['columns']['starttime']['config']['wizards']=NULL;
>                                                  $TCA['be_users']['columns']['endtime'  ]['config']['wizards']=NULL;
>
> $f.=$this->helper->TCEforms->getListedFields('be_users',$user[0],'username,disable,realName,email,lastlogin,password,starttime,endtime');
>                                                  $content.=$this->helper->TCEforms->wrapTotal($f, $user[0],
> 'be_users');
>                                                  $content.=$this->helper->TCEforms->printNeededJSFunctions();
>                                                  $content.=$this->helper->hint('<img
> '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/perm.gif', '').'
> title="Rechte verwalten"><a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=sitemanager&method=editFormContent&uid='.intval($this->id).'">Vergessen
> Sie nicht dem Benutzer auch noch Rechte zuzuordnen ...</a>');
>
>                                                  $this->content.=$content;
>                                                  #t3lib_div::debug($GLOBALS['TCA']['be_users']);
>                                          }
>                                          else {
>                                                  $this->content.='Zugriff verweigert. Bitte wählen Sie einen
> anderen Benutzer.';
>                                          }
>                                  }
>                                  /**
>                                   * Prints out the module HTML
>                                   *
>                                   * @return      void
>                                   */
>                                  function printContent() {
>                                          if($this->ajax) {
>                                                  echo $this->content;
>                                          } else {
>                                                  $this->content.=$this->doc->endPage();
>                                                  echo $this->content;
>                                          }
>                                  }
>                                  function getContent() {
>                                          return $this->content;
>                                  }
>                                  function getButtons()   {
>                                          $buttons = array(
>                                                  'csh' =>  '',
>                                                  'shortcut' =>  '',
>                                                  'save' =>  '',
>                                                  'ADD' =>'',
>                                                  'NEWWINDOW' =>  '',
>                                          );
>                                                  // CSH
>                                          $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '',
> $GLOBALS['BACK_PATH']);
>
>                                                  // SAVE button or add Button
>                                          if(t3lib_div::_GP('method')=='editFormContent') {
>                                                  $buttons['save']      = '<input type="image" class="c-inputButton"
> name="submit" value="Update"' .
> t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/savedok.gif', '') .
> ' title="' .
> $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) .
> '" />';
>                                                  $buttons['SAVEANDCLOSE'] = '<input type="image"
> class="c-inputButton" name="submit" value="UpdateClose"' .
> t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
> 'gfx/saveandclosedok.gif', '') . ' title="' .
> $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',
> 1) . '" />';
>                                                  $buttons['CLOSE'] ='<a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user"><img
> '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/closedok.gif',
> '').' title="'.
> $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1)
> .'">';
>                                          } else {
>                                                  $buttons['ADD'] ='<a
> href="'.htmlspecialchars($GLOBALS['MCONF']['_']).'&id='.intval($this->id).'&action=user&method=editFormContent&uid=0"><img
> '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_record.gif',
> '').' title="...">';
>                                          }
>
>                                                  // Shortcut
>                                          if ($GLOBALS['BE_USER']->mayMakeShortcut())     {
>                                                  $buttons['shortcut'] = $this->doc->makeShortcutIcon('id,method',
> 'function', $this->MCONF['name']);
>                                          }
>
>                                          return $buttons;
>                                  }
>
>                          }
>
> ?>
>
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
>    



More information about the TYPO3-german mailing list