diff -ru TYPO3core_orig_cvs/t3lib/class.t3lib_clipboard.php TYPO3core_patch1078/t3lib/class.t3lib_clipboard.php --- TYPO3core_orig_cvs/t3lib/class.t3lib_clipboard.php 2005-10-21 10:06:58.000000000 +0200 +++ TYPO3core_patch1078/t3lib/class.t3lib_clipboard.php 2005-10-25 16:21:53.000000000 +0200 @@ -333,11 +333,16 @@ } // Delete: if ($elCount) { - $opt[]=''; + "; + } else { + $js = " document.location='".$this->deleteUrl(0,$this->fileMode?1:0)."&redirect='+top.rawurlencode(document.location); "; + } + $opt[]=''; } $selector_menu = ''; @@ -625,6 +630,7 @@ * @return string JavaScript "confirm" message */ function confirmMsg($table,$rec,$type,$clElements) { + if($GLOBALS['BE_USER']->jsConfirmation(2)) { $labelKey = 'LLL:EXT:lang/locallang_core.php:mess.'.($this->currentMode()=='copy'?'copy':'move').($this->current=='normal'?'':'cb').'_'.$type; $msg = $GLOBALS['LANG']->sL($labelKey); @@ -658,6 +664,9 @@ t3lib_div::fixed_lgd_cs($selRecTitle,30), t3lib_div::fixed_lgd_cs($thisRecTitle,30) )).')'; + } else { + $conf = ''; + } return $conf; } diff -ru TYPO3core_orig_cvs/t3lib/class.t3lib_tceforms.php TYPO3core_patch1078/t3lib/class.t3lib_tceforms.php --- TYPO3core_orig_cvs/t3lib/class.t3lib_tceforms.php 2005-10-21 10:06:58.000000000 +0200 +++ TYPO3core_patch1078/t3lib/class.t3lib_tceforms.php 2005-10-25 16:25:51.000000000 +0200 @@ -736,9 +736,11 @@ if ( (($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) || ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) - && !$BE_USER->uc['noOnChangeAlertInTypeFields']) { + && $GLOBALS['BE_USER']->jsConfirmation(1)) { $alertMsgOnChange = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };'; - } else {$alertMsgOnChange='';} + } else { + $alertMsgOnChange = 'if(TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm();}'; + } // Render as a hidden field? if (in_array($field,$this->hiddenFieldListArr)) { @@ -2022,7 +2024,12 @@ $tCells =array(); $pct = round(100/count($sArr)); foreach($sArr as $sKey => $sheetCfg) { - $onClick = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){'.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm()};"; + if ($GLOBALS['BE_USER']->jsConfirmation(1)) { + $onClick = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){'.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm()};"; + } else { + $onClick = 'if(TBE_EDITOR_checkSubmit(-1)){ '.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm();}"; + } + $tCells[]=''. ($sheetCfg['ROOT']['TCEforms']['sheetTitle'] ? $this->sL($sheetCfg['ROOT']['TCEforms']['sheetTitle']) : $sKey). @@ -2174,13 +2181,14 @@ 'rows' => 2 ); } + if ( (($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key,$GLOBALS['TCA'][$table]['ctrl']['type'])) || ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'],$key))) - && !$GLOBALS['BE_USER']->uc['noOnChangeAlertInTypeFields']) { + && $GLOBALS['BE_USER']->jsConfirmation(1)) { $alertMsgOnChange = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };'; } else { - $alertMsgOnChange=''; + $alertMsgOnChange = 'if(TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm();}'; } $fakePA['fieldChangeFunc']=$PA['fieldChangeFunc']; diff -ru TYPO3core_orig_cvs/t3lib/class.t3lib_userauthgroup.php TYPO3core_patch1078/t3lib/class.t3lib_userauthgroup.php --- TYPO3core_orig_cvs/t3lib/class.t3lib_userauthgroup.php 2005-10-21 10:06:58.000000000 +0200 +++ TYPO3core_patch1078/t3lib/class.t3lib_userauthgroup.php 2005-10-25 16:23:51.000000000 +0200 @@ -738,8 +738,32 @@ return $this->groupData['filemounts']; } - - + /** + * Returns true or false, depending if an alert popup (a javascript confirmation) should be shown + * call like $GLOBALS['BE_USER']->jsConfirmation($BITMASK) + * + * @param $bitmask int Bitmask + * 1 - typeChange + * 2 - copy/move/paste + * 4 - delete + * 8 - frontend editing + * 128 - other (not used yet) + * @return boolean true if the confirmation should be shown + **/ + function jsConfirmation($bitmask) { + $alertPopup = $GLOBALS['BE_USER']->getTSConfig('options.alertPopups'); + $alertPopup = (int)$alertPopup['value']; + + if(!$alertPopup) { + $alertPopup = 255; // default: show all warnings + } + + if(($alertPopup&$bitmask) == $bitmask) { // show confirmation + return 1; + } else { // don't show confirmation + return 0; + } + } diff -ru TYPO3core_orig_cvs/tslib/class.tslib_content.php TYPO3core_patch1078/tslib/class.tslib_content.php --- TYPO3core_orig_cvs/tslib/class.tslib_content.php 2005-10-21 10:06:59.000000000 +0200 +++ TYPO3core_patch1078/tslib/class.tslib_content.php 2005-10-25 16:21:53.000000000 +0200 @@ -6816,7 +6816,7 @@ $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'alt_doc.php?edit['.$rParts[0].']['.$nPid.']=new&noView='.$nV,$currentRecord); } } else { - if ($confirm) { + if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) { $cf1="if (confirm(unescape('".t3lib_div::rawurlencodeJS($confirm)."'))){"; $cf2='}'; } else { diff -ru TYPO3core_orig_cvs/typo3/alt_clickmenu.php TYPO3core_patch1078/typo3/alt_clickmenu.php --- TYPO3core_orig_cvs/typo3/alt_clickmenu.php 2005-10-21 10:06:59.000000000 +0200 +++ TYPO3core_patch1078/typo3/alt_clickmenu.php 2005-10-25 16:21:53.000000000 +0200 @@ -432,7 +432,11 @@ function DB_paste($table,$uid,$type,$elInfo) { $editOnClick = ''; $loc = 'top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':''); + if($GLOBALS['BE_USER']->jsConfirmation(2)) { $conf = $loc.' && confirm('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.'.($elInfo[2]=='copy'?'copy':'move').'_'.$type),$elInfo[0],$elInfo[1])).')'; + } else { + $conf = $loc; + } $editOnClick = 'if('.$conf.'){'.$loc.'.document.location=top.TS.PATH_typo3+\''.$this->clipObj->pasteUrl($table,$uid,0).'&redirect=\'+top.rawurlencode('.$this->frameLocation($loc.'.document').'); hideCM();}'; return $this->linkItem( @@ -673,7 +677,12 @@ function DB_delete($table,$uid,$elInfo) { $editOnClick=''; $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':''); - $editOnClick='if('.$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),$elInfo[0])).")){".$loc.".document.location=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'". + if($GLOBALS['BE_USER']->jsConfirmation(4)) { + $conf = "confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),$elInfo[0])).")"; + } else { + $conf = '1==1'; + } + $editOnClick='if('.$loc." && ".$conf." ){".$loc.".document.location=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'". "&cmd[".$table.']['.$uid.'][delete]=1&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}"; return $this->linkItem( @@ -900,7 +909,12 @@ function FILE_delete($path) { $editOnClick=''; $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':''); - $editOnClick='if('.$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),basename($path))).")){".$loc.".document.location=top.TS.PATH_typo3+'tce_file.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'". + if($GLOBALS['BE_USER']->jsConfirmation(4)) { + $conf = "confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),basename($path))).")"; + } else { + $conf = '1==1'; + } + $editOnClick='if('.$loc." && ".$conf." ){".$loc.".document.location=top.TS.PATH_typo3+'tce_file.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'". "&file[delete][0][data]=".rawurlencode($path).'&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}"; return $this->linkItem( @@ -922,7 +936,12 @@ function FILE_paste($path,$target,$elInfo) { $editOnClick=''; $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':''); + if($GLOBALS['BE_USER']->jsConfirmation(2)) { $conf=$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.'.($elInfo[2]=='copy'?'copy':'move').'_into'),$elInfo[0],$elInfo[1])).")"; + } else { + $conf=$loc; + } + $editOnClick='if('.$conf.'){'.$loc.".document.location=top.TS.PATH_typo3+'".$this->clipObj->pasteUrl('_FILE',$path,0). "&redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').'); hideCM();}'; diff -ru TYPO3core_orig_cvs/typo3/alt_doc.php TYPO3core_patch1078/typo3/alt_doc.php --- TYPO3core_orig_cvs/typo3/alt_doc.php 2005-10-21 10:06:59.000000000 +0200 +++ TYPO3core_patch1078/typo3/alt_doc.php 2005-10-25 16:21:53.000000000 +0200 @@ -431,7 +431,9 @@ } } function deleteRecord(table,id,url) { // - if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) { + if ( + '.($GLOBALS['BE_USER']->jsConfirmation(4)?'confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')':'1==1').' + ) { document.location = "tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1"; } return false; diff -ru TYPO3core_orig_cvs/typo3/file_upload.php TYPO3core_patch1078/typo3/file_upload.php --- TYPO3core_orig_cvs/typo3/file_upload.php 2005-10-21 10:06:59.000000000 +0200 +++ TYPO3core_patch1078/typo3/file_upload.php 2005-10-25 16:21:53.000000000 +0200 @@ -138,11 +138,17 @@ $this->doc->docType = 'xhtml_trans'; $this->doc->backPath = $BACK_PATH; $this->doc->form='
'; + + if($GLOBALS['BE_USER']->jsConfirmation(1)) { + $confirm = ' && confirm('.$LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')).')'; + } else { + $confirm = ''; + } $this->doc->JScode=$this->doc->wrapScriptTags(' var path = "'.$this->target.'"; function reload(a) { // - if (!changed || (changed && confirm('.$LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')).'))) { + if (!changed || (changed '.$confirm.')) { var params = "&target="+escape(path)+"&number="+a+"&returnUrl='.htmlspecialchars($this->returnUrl).'"; document.location = "file_upload.php?"+params; } diff -ru TYPO3core_orig_cvs/typo3/sysext/cms/tslib/class.tslib_content.php TYPO3core_patch1078/typo3/sysext/cms/tslib/class.tslib_content.php --- TYPO3core_orig_cvs/typo3/sysext/cms/tslib/class.tslib_content.php 2005-10-21 10:06:59.000000000 +0200 +++ TYPO3core_patch1078/typo3/sysext/cms/tslib/class.tslib_content.php 2005-10-25 16:21:53.000000000 +0200 @@ -6816,7 +6816,7 @@ $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'alt_doc.php?edit['.$rParts[0].']['.$nPid.']=new&noView='.$nV,$currentRecord); } } else { - if ($confirm) { + if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) { $cf1="if (confirm(unescape('".t3lib_div::rawurlencodeJS($confirm)."'))){"; $cf2='}'; } else { diff -ru TYPO3core_orig_cvs/typo3/t3lib/class.t3lib_clipboard.php TYPO3core_patch1078/typo3/t3lib/class.t3lib_clipboard.php --- TYPO3core_orig_cvs/typo3/t3lib/class.t3lib_clipboard.php 2005-10-21 10:06:58.000000000 +0200 +++ TYPO3core_patch1078/typo3/t3lib/class.t3lib_clipboard.php 2005-10-25 16:21:53.000000000 +0200 @@ -333,11 +333,16 @@ } // Delete: if ($elCount) { - $opt[]=''; + "; + } else { + $js = " document.location='".$this->deleteUrl(0,$this->fileMode?1:0)."&redirect='+top.rawurlencode(document.location); "; + } + $opt[]=''; } $selector_menu = ''; @@ -625,6 +630,7 @@ * @return string JavaScript "confirm" message */ function confirmMsg($table,$rec,$type,$clElements) { + if($GLOBALS['BE_USER']->jsConfirmation(2)) { $labelKey = 'LLL:EXT:lang/locallang_core.php:mess.'.($this->currentMode()=='copy'?'copy':'move').($this->current=='normal'?'':'cb').'_'.$type; $msg = $GLOBALS['LANG']->sL($labelKey); @@ -658,6 +664,9 @@ t3lib_div::fixed_lgd_cs($selRecTitle,30), t3lib_div::fixed_lgd_cs($thisRecTitle,30) )).')'; + } else { + $conf = ''; + } return $conf; } diff -ru TYPO3core_orig_cvs/typo3/t3lib/class.t3lib_tceforms.php TYPO3core_patch1078/typo3/t3lib/class.t3lib_tceforms.php --- TYPO3core_orig_cvs/typo3/t3lib/class.t3lib_tceforms.php 2005-10-21 10:06:58.000000000 +0200 +++ TYPO3core_patch1078/typo3/t3lib/class.t3lib_tceforms.php 2005-10-25 16:25:51.000000000 +0200 @@ -736,9 +736,11 @@ if ( (($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) || ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) - && !$BE_USER->uc['noOnChangeAlertInTypeFields']) { + && $GLOBALS['BE_USER']->jsConfirmation(1)) { $alertMsgOnChange = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };'; - } else {$alertMsgOnChange='';} + } else { + $alertMsgOnChange = 'if(TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm();}'; + } // Render as a hidden field? if (in_array($field,$this->hiddenFieldListArr)) { @@ -2022,7 +2024,12 @@ $tCells =array(); $pct = round(100/count($sArr)); foreach($sArr as $sKey => $sheetCfg) { - $onClick = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){'.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm()};"; + if ($GLOBALS['BE_USER']->jsConfirmation(1)) { + $onClick = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){'.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm()};"; + } else { + $onClick = 'if(TBE_EDITOR_checkSubmit(-1)){ '.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm();}"; + } + $tCells[]=''. ($sheetCfg['ROOT']['TCEforms']['sheetTitle'] ? $this->sL($sheetCfg['ROOT']['TCEforms']['sheetTitle']) : $sKey). @@ -2174,13 +2181,14 @@ 'rows' => 2 ); } + if ( (($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key,$GLOBALS['TCA'][$table]['ctrl']['type'])) || ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'],$key))) - && !$GLOBALS['BE_USER']->uc['noOnChangeAlertInTypeFields']) { + && $GLOBALS['BE_USER']->jsConfirmation(1)) { $alertMsgOnChange = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };'; } else { - $alertMsgOnChange=''; + $alertMsgOnChange = 'if(TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm();}'; } $fakePA['fieldChangeFunc']=$PA['fieldChangeFunc']; diff -ru TYPO3core_orig_cvs/typo3/t3lib/class.t3lib_userauthgroup.php TYPO3core_patch1078/typo3/t3lib/class.t3lib_userauthgroup.php --- TYPO3core_orig_cvs/typo3/t3lib/class.t3lib_userauthgroup.php 2005-10-21 10:06:58.000000000 +0200 +++ TYPO3core_patch1078/typo3/t3lib/class.t3lib_userauthgroup.php 2005-10-25 16:23:51.000000000 +0200 @@ -738,8 +738,32 @@ return $this->groupData['filemounts']; } - - + /** + * Returns true or false, depending if an alert popup (a javascript confirmation) should be shown + * call like $GLOBALS['BE_USER']->jsConfirmation($BITMASK) + * + * @param $bitmask int Bitmask + * 1 - typeChange + * 2 - copy/move/paste + * 4 - delete + * 8 - frontend editing + * 128 - other (not used yet) + * @return boolean true if the confirmation should be shown + **/ + function jsConfirmation($bitmask) { + $alertPopup = $GLOBALS['BE_USER']->getTSConfig('options.alertPopups'); + $alertPopup = (int)$alertPopup['value']; + + if(!$alertPopup) { + $alertPopup = 255; // default: show all warnings + } + + if(($alertPopup&$bitmask) == $bitmask) { // show confirmation + return 1; + } else { // don't show confirmation + return 0; + } + }