00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00063 unset($MCONF);
00064 require('conf.php');
00065 require($BACK_PATH.'init.php');
00066 require($BACK_PATH.'template.php');
00067
00068
00069 unset($MCONF);
00070 unset($MLANG);
00071
00072
00073 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
00074 $LOCAL_LANG_orig = $LOCAL_LANG;
00075 $LANG->includeLLFile('EXT:cms/layout/locallang_db_new_content_el.xml');
00076 $LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG_orig,$LOCAL_LANG);
00077
00078
00079 t3lib_extMgm::isLoaded('cms',1);
00080
00081
00082 require_once(PATH_t3lib.'class.t3lib_page.php');
00083 require_once(PATH_t3lib.'class.t3lib_positionmap.php');
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00101 class ext_posMap extends t3lib_positionMap {
00102 var $dontPrintPageInsertIcons = 1;
00103
00111 function wrapRecordTitle($str,$row) {
00112 return $str;
00113 }
00114
00125 function onClickInsertRecord($row,$vv,$moveUid,$pid,$sys_lang=0) {
00126 $table='tt_content';
00127
00128 $location=$this->backPath.'alt_doc.php?edit[tt_content]['.(is_array($row)?-$row['uid']:$pid).']=new&defVals[tt_content][colPos]='.$vv.'&defVals[tt_content][sys_language_uid]='.$sys_lang.'&returnUrl='.rawurlencode($GLOBALS['SOBE']->R_URI);
00129
00130 return 'window.location.href=\''.$location.'\'+document.editForm.defValues.value; return false;';
00131 }
00132 }
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00153 class SC_db_new_content_el {
00154
00155
00156 var $id;
00157 var $sys_language=0;
00158 var $R_URI='';
00159 var $colPos;
00160 var $uid_pid;
00161
00162
00163 var $modTSconfig=array();
00164 var $doc;
00165
00166
00167 var $include_once = array();
00168 var $content;
00169 var $access;
00170
00176 function init() {
00177 global $BE_USER,$BACK_PATH,$TBE_MODULES_EXT;
00178
00179
00180 if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) {
00181 $this->include_once = array_merge($this->include_once,$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']);
00182 }
00183
00184
00185 $this->id = intval(t3lib_div::_GP('id'));
00186 $this->sys_language = intval(t3lib_div::_GP('sys_language_uid'));
00187 $this->R_URI = t3lib_div::_GP('returnUrl');
00188 $this->colPos = t3lib_div::_GP('colPos');
00189 $this->uid_pid = intval(t3lib_div::_GP('uid_pid'));
00190
00191 $this->MCONF['name'] = 'xMOD_db_new_content_el';
00192 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
00193
00194
00195 $this->doc = t3lib_div::makeInstance('mediumDoc');
00196 $this->doc->docType= 'xhtml_trans';
00197 $this->doc->backPath = $BACK_PATH;
00198 $this->doc->JScode='';
00199 $this->doc->form='<form action="" name="editForm"><input type="hidden" name="defValues" value="" />';
00200
00201
00202 $perms_clause = $BE_USER->getPagePermsClause(1);
00203 $pageinfo = t3lib_BEfunc::readPageAccess($this->id,$perms_clause);
00204 $this->access = is_array($pageinfo) ? 1 : 0;
00205 }
00206
00212 function main() {
00213 global $LANG,$BACK_PATH;
00214
00215 if ($this->id && $this->access) {
00216
00217
00218 $posMap = t3lib_div::makeInstance('ext_posMap');
00219 $posMap->cur_sys_language = $this->sys_language;
00220 $posMap->backPath = $BACK_PATH;
00221
00222 if ((string)$this->colPos!='') {
00223 if ($this->uid_pid<0) {
00224 $row=array();
00225 $row['uid']=abs($this->uid_pid);
00226 } else {
00227 $row='';
00228 }
00229 $onClickEvent = $posMap->onClickInsertRecord($row,$this->colPos,'',$this->uid_pid,$this->sys_language);
00230 } else {
00231 $onClickEvent='';
00232 }
00233
00234 $this->doc->JScode=$this->doc->wrapScriptTags('
00235 function goToalt_doc() {
00236 '.$onClickEvent.'
00237 }
00238 ');
00239
00240
00241
00242
00243
00244 $this->content='';
00245 $this->content.=$this->doc->startPage($LANG->getLL('newContentElement'));
00246 $this->content.=$this->doc->header($LANG->getLL('newContentElement'));
00247 $this->content.=$this->doc->spacer(5);
00248
00249 $elRow = t3lib_BEfunc::getRecordWSOL('pages',$this->id);
00250 $hline = t3lib_iconWorks::getIconImage('pages',$elRow,$BACK_PATH,' title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow,'pages')).'" align="top"');
00251 $hline.= t3lib_BEfunc::getRecordTitle('pages',$elRow,TRUE);
00252 $this->content.=$this->doc->section('',$hline,0,1);
00253 $this->content.=$this->doc->spacer(10);
00254
00255
00256
00257 $code='';
00258 $lines=array();
00259 $wizardItems = $this->getWizardItems();
00260
00261
00262
00263 $cc=0;
00264 foreach ($wizardItems as $k => $wInfo) {
00265 if ($wInfo['header']) {
00266 if ($cc>0) $lines[]='
00267 <tr>
00268 <td colspan="3"><br /></td>
00269 </tr>';
00270 $lines[]='
00271 <tr class="bgColor5">
00272 <td colspan="3"><strong>'.htmlspecialchars($wInfo['header']).'</strong></td>
00273 </tr>';
00274 } else {
00275 $tL=array();
00276
00277
00278 $oC = "document.editForm.defValues.value=unescape('".rawurlencode($wInfo['params'])."');goToalt_doc();".(!$onClickEvent?"window.location.hash='#sel2';":'');
00279 $tL[]='<input type="radio" name="tempB" value="'.htmlspecialchars($k).'" onclick="'.htmlspecialchars($this->doc->thisBlur().$oC).'" />';
00280
00281
00282 $aOnClick = 'document.editForm.tempB['.$cc.'].checked=1;'.$this->doc->thisBlur().$oC.'return false;';
00283
00284
00285 $iInfo = @getimagesize($wInfo['icon']);
00286 $tL[]='<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,$wInfo['icon'],'').' alt="" /></a>';
00287
00288
00289 $tL[]='<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><strong>'.htmlspecialchars($wInfo['title']).'</strong><br />'.nl2br(htmlspecialchars(trim($wInfo['description']))).'</a>';
00290
00291
00292 $lines[]='
00293 <tr>
00294 <td valign="top">'.implode('</td>
00295 <td valign="top">',$tL).'</td>
00296 </tr>';
00297 $cc++;
00298 }
00299 }
00300
00301 $code.=$LANG->getLL('sel1',1).'<br /><br />
00302
00303
00304 <!--
00305 Content Element wizard table:
00306 -->
00307 <table border="0" cellpadding="1" cellspacing="2" id="typo3-ceWizardTable">
00308 '.implode('',$lines).'
00309 </table>';
00310 $this->content.= $this->doc->section(!$onClickEvent?$LANG->getLL('1_selectType'):'',$code,0,1);
00311
00312
00313
00314
00315 if (!$onClickEvent) {
00316
00317
00318 $this->content.= $this->doc->section('','<a name="sel2"></a>');
00319 $this->content.= $this->doc->spacer(20);
00320
00321
00322 $code = $LANG->getLL('sel2',1).'<br /><br />';
00323
00324
00325 $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED');
00326 $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']),'') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
00327 $colPosList = implode(',',array_unique(t3lib_div::intExplode(',',$colPosList)));
00328
00329
00330 $code.= $posMap->printContentElementColumns($this->id,0,$colPosList,1,$this->R_URI);
00331 $this->content.= $this->doc->section($LANG->getLL('2_selectPosition'),$code,0,1);
00332 }
00333
00334
00335 if ($this->R_URI) {
00336 $code='<br /><br /><a href="'.htmlspecialchars($this->R_URI).'" class="typo3-goBack"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />'.$LANG->getLL('goBack',1).'</a>';
00337 $this->content.= $this->doc->section('',$code,0,1);
00338 }
00339
00340
00341 $this->content.= $this->doc->section('',t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_ce', $GLOBALS['BACK_PATH'],'<br/>'),0,1);
00342
00343
00344 $this->content.= $this->doc->section('','<img src="clear.gif" width="1" height="700" alt="" />',0,1);
00345
00346 } else {
00347 $this->content = '';
00348 $this->content.= $this->doc->startPage($LANG->getLL('newContentElement'));
00349 $this->content.= $this->doc->header($LANG->getLL('newContentElement'));
00350 $this->content.= $this->doc->spacer(5);
00351 }
00352 }
00353
00359 function printContent() {
00360 global $SOBE;
00361
00362 $this->content.= $this->doc->endPage();
00363 echo $this->content;
00364 }
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00388 function getWizardItems() {
00389 return $this->wizardArray();
00390 }
00391
00398 function wizardArray() {
00399 global $LANG,$TBE_MODULES_EXT;
00400
00401 $wizardItems = array(
00402 'common' => array('header'=>$LANG->getLL('common')),
00403 'common_regularText' => array(
00404 'icon'=>'gfx/c_wiz/regular_text.gif',
00405 'title'=>$LANG->getLL('common_regularText_title'),
00406 'description'=>$LANG->getLL('common_regularText_description'),
00407 'tt_content_defValues' => array(
00408 'CType' => 'text'
00409 )
00410 ),
00411 'common_textImage' => array(
00412 'icon'=>'gfx/c_wiz/text_image_right.gif',
00413 'title'=>$LANG->getLL('common_textImage_title'),
00414 'description'=>$LANG->getLL('common_textImage_description'),
00415 'tt_content_defValues' => array(
00416 'CType' => 'textpic',
00417 'imageorient' => 17
00418 )
00419 ),
00420 'common_imagesOnly' => array(
00421 'icon'=>'gfx/c_wiz/images_only.gif',
00422 'title'=>$LANG->getLL('common_imagesOnly_title'),
00423 'description'=>$LANG->getLL('common_imagesOnly_description'),
00424 'tt_content_defValues' => array(
00425 'CType' => 'image',
00426 'imagecols' => 2
00427 )
00428 ),
00429 'common_bulletList' => array(
00430 'icon'=>'gfx/c_wiz/bullet_list.gif',
00431 'title'=>$LANG->getLL('common_bulletList_title'),
00432 'description'=>$LANG->getLL('common_bulletList_description'),
00433 'tt_content_defValues' => array(
00434 'CType' => 'bullets',
00435 )
00436 ),
00437 'common_table' => array(
00438 'icon'=>'gfx/c_wiz/table.gif',
00439 'title'=>$LANG->getLL('common_table_title'),
00440 'description'=>$LANG->getLL('common_table_description'),
00441 'tt_content_defValues' => array(
00442 'CType' => 'table',
00443 )
00444 ),
00445 'special' => array('header'=>$LANG->getLL('special')),
00446 'special_filelinks' => array(
00447 'icon'=>'gfx/c_wiz/filelinks.gif',
00448 'title'=>$LANG->getLL('special_filelinks_title'),
00449 'description'=>$LANG->getLL('special_filelinks_description'),
00450 'tt_content_defValues' => array(
00451 'CType' => 'uploads',
00452 )
00453 ),
00454 'special_multimedia' => array(
00455 'icon'=>'gfx/c_wiz/multimedia.gif',
00456 'title'=>$LANG->getLL('special_multimedia_title'),
00457 'description'=>$LANG->getLL('special_multimedia_description'),
00458 'tt_content_defValues' => array(
00459 'CType' => 'multimedia',
00460 )
00461 ),
00462 'special_sitemap' => array(
00463 'icon'=>'gfx/c_wiz/sitemap2.gif',
00464 'title'=>$LANG->getLL('special_sitemap_title'),
00465 'description'=>$LANG->getLL('special_sitemap_description'),
00466 'tt_content_defValues' => array(
00467 'CType' => 'menu',
00468 'menu_type' => 2
00469 )
00470 ),
00471 'special_plainHTML' => array(
00472 'icon'=>'gfx/c_wiz/html.gif',
00473 'title'=>$LANG->getLL('special_plainHTML_title'),
00474 'description'=>$LANG->getLL('special_plainHTML_description'),
00475 'tt_content_defValues' => array(
00476 'CType' => 'html',
00477 )
00478 ),
00479 'forms' => array('header'=>$LANG->getLL('forms')),
00480 'forms_mail' => array(
00481 'icon'=>'gfx/c_wiz/mailform.gif',
00482 'title'=>$LANG->getLL('forms_mail_title'),
00483 'description'=>$LANG->getLL('forms_mail_description'),
00484 'tt_content_defValues' => array(
00485 'CType' => 'mailform',
00486 'bodytext' => trim('
00487 # Example content:
00488 Name: | *name = input,40 | Enter your name here
00489 Email: | *email=input,40 |
00490 Address: | address=textarea,40,5 |
00491 Contact me: | tv=check | 1
00492
00493 |formtype_mail = submit | Send form!
00494 |html_enabled=hidden | 1
00495 |subject=hidden| This is the subject
00496 ')
00497 )
00498 ),
00499 'forms_search' => array(
00500 'icon'=>'gfx/c_wiz/searchform.gif',
00501 'title'=>$LANG->getLL('forms_search_title'),
00502 'description'=>$LANG->getLL('forms_search_description'),
00503 'tt_content_defValues' => array(
00504 'CType' => 'search',
00505 )
00506 ),
00507 'forms_login' => array(
00508 'icon'=>'gfx/c_wiz/login_form.gif',
00509 'title'=>$LANG->getLL('forms_login_title'),
00510 'description'=>$LANG->getLL('forms_login_description'),
00511 'tt_content_defValues' => array(
00512 'CType' => 'login',
00513 )
00514 ),
00515 'plugins' => array('header'=>$LANG->getLL('plugins')),
00516 'plugins_general' => array(
00517 'icon'=>'gfx/c_wiz/user_defined.gif',
00518 'title'=>$LANG->getLL('plugins_general_title'),
00519 'description'=>$LANG->getLL('plugins_general_description'),
00520 'tt_content_defValues' => array(
00521 'CType' => 'list',
00522 )
00523 ),
00524 );
00525
00526
00527
00528 if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) {
00529 reset($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']);
00530 while(list($class,$path)=each($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) {
00531 $modObj = t3lib_div::makeInstance($class);
00532 $wizardItems = $modObj->proc($wizardItems);
00533 }
00534 }
00535
00536
00537 $this->removeInvalidElements($wizardItems);
00538
00539 return $wizardItems;
00540 }
00541
00549 function removeInvalidElements(&$wizardItems) {
00550 global $TCA;
00551
00552
00553 t3lib_div::loadTCA('tt_content');
00554
00555
00556 $row = array('pid'=>$this->id);
00557 $TCEFORM_TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig('tt_content',$row);
00558 $removeItems = t3lib_div::trimExplode(',',$TCEFORM_TSconfig['CType']['removeItems'],1);
00559
00560 $headersUsed = Array();
00561
00562 foreach($wizardItems as $key => $cfg) {
00563
00564
00565 if ($wizardItems[$key]['params']) {
00566
00567 $tempGetVars = t3lib_div::explodeUrl2Array($wizardItems[$key]['params'],TRUE);
00568
00569 if (is_array($tempGetVars['defVals']['tt_content'])) {
00570 $wizardItems[$key]['tt_content_defValues'] = array_merge(is_array($wizardItems[$key]['tt_content_defValues']) ? $wizardItems[$key]['tt_content_defValues'] : array(), $tempGetVars['defVals']['tt_content']);
00571 unset($tempGetVars['defVals']['tt_content']);
00572 $wizardItems[$key]['params'] = t3lib_div::implodeArrayForUrl('',$tempGetVars);
00573 }
00574 }
00575
00576
00577 if (is_array($wizardItems[$key]['tt_content_defValues'])) {
00578
00579
00580 foreach($wizardItems[$key]['tt_content_defValues'] as $fN => $fV) {
00581 if (is_array($TCA['tt_content']['columns'][$fN])) {
00582
00583 $config = &$TCA['tt_content']['columns'][$fN]['config'];
00584 $authModeDeny = $config['type']=='select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode('tt_content',$fN,$fV,$config['authMode']);
00585
00586 if ($authModeDeny || in_array($fV,$removeItems)) {
00587
00588 unset($wizardItems[$key]);
00589 break;
00590 } else {
00591
00592 $wizardItems[$key]['params'].= '&defVals[tt_content]['.$fN.']='.rawurlencode($fV);
00593 $tmp = explode('_', $key);
00594 $headersUsed[$tmp[0]] = $tmp[0];
00595 }
00596 }
00597 }
00598 }
00599 }
00600
00601 foreach ($wizardItems as $key => $cfg) {
00602 $tmp = explode('_',$key);
00603 if ($tmp[0] && !$tmp[1] && !in_array($tmp[0], $headersUsed)) {
00604 unset($wizardItems[$key]);
00605 }
00606 }
00607 }
00608 }
00609
00610
00611 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/db_new_content_el.php']) {
00612 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/db_new_content_el.php']);
00613 }
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627 $SOBE = t3lib_div::makeInstance('SC_db_new_content_el');
00628 $SOBE->init();
00629
00630
00631 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
00632
00633 $SOBE->main();
00634 $SOBE->printContent();
00635 ?>