|
### Eclipse Workspace Patch 1.0
|
|
#P igeworkspace42
|
|
Index: typo3/sysext/version/mod2/locallang.xml
|
|
===================================================================
|
|
--- typo3/sysext/version/mod2/locallang.xml (revision 0)
|
|
+++ typo3/sysext/version/mod2/locallang.xml (revision 0)
|
|
@@ -0,0 +1,14 @@
|
|
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
|
+<T3locallang>
|
|
+ <meta type="array">
|
|
+ <type>module</type>
|
|
+ <description>Language labels for module "user_txversionM2" - header, description</description>
|
|
+ </meta>
|
|
+ <data type="array">
|
|
+ <languageKey index="default" type="array">
|
|
+ <label index="function1">Workspace Advanced Staging</label>
|
|
+ <label index="stage_editing">Editing</label>
|
|
+ <label index="stage_publish">Publish</label>
|
|
+ </languageKey>
|
|
+ </data>
|
|
+</T3locallang>
|
|
\ No newline at end of file
|
|
Index: typo3/sysext/version/mod2/conf.php
|
|
===================================================================
|
|
--- typo3/sysext/version/mod2/conf.php (revision 0)
|
|
+++ typo3/sysext/version/mod2/conf.php (revision 0)
|
|
@@ -0,0 +1,10 @@
|
|
+<?php
|
|
+ // DO NOT REMOVE OR CHANGE THESE 2 LINES:
|
|
+$MCONF['name'] = 'user_txversionM2';
|
|
+$MCONF['script'] = '_DISPATCH';
|
|
+
|
|
+$MCONF['access'] = 'user,group';
|
|
+
|
|
+$MLANG['default']['tabs_images']['tab'] = 'moduleicon.png';
|
|
+$MLANG['default']['ll_ref'] = 'LLL:EXT:version/mod2/locallang_mod.xml';
|
|
+?>
|
|
\ No newline at end of file
|
|
Index: typo3/sysext/version/mod2/index.php
|
|
===================================================================
|
|
--- typo3/sysext/version/mod2/index.php (revision 0)
|
|
+++ typo3/sysext/version/mod2/index.php (revision 0)
|
|
@@ -0,0 +1,570 @@
|
|
+<?php
|
|
+/***************************************************************
|
|
+* Copyright notice
|
|
+*
|
|
+* (c) 2009 cab services ag <admin@cabag.ch>
|
|
+* 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.
|
|
+*
|
|
+* 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!
|
|
+***************************************************************/
|
|
+/**
|
|
+ * [CLASS/FUNCTION INDEX of SCRIPT]
|
|
+ *
|
|
+ * Hint: use extdeveval to insert/update function index above.
|
|
+ */
|
|
+
|
|
+//unset($MCONF);
|
|
+//require ('conf.php');
|
|
+//require ($BACK_PATH.'init.php');
|
|
+//require ($BACK_PATH.'template.php');
|
|
+$LANG->includeLLFile('EXT:version/mod2/locallang.xml');
|
|
+require_once(PATH_t3lib . 'class.t3lib_scbase.php');
|
|
+require_once(PATH_typo3 . 'mod/user/ws/class.wsstagelib.php');
|
|
+$BE_USER->modAccess($MCONF,1); // This checks permissions and exits if the users has no permission for entry.
|
|
+ // DEFAULT initialization of a module [END]
|
|
+
|
|
+/**
|
|
+ * Module 'Maintenance' for the 'cabag_sla' extension.
|
|
+ *
|
|
+ * @author cab services ag <admin@cabag.ch>
|
|
+ * @package TYPO3
|
|
+ * @subpackage tx_cabagsla
|
|
+ */
|
|
+class tx_version_module2 extends t3lib_SCbase{
|
|
+
|
|
+
|
|
+ /**
|
|
+ * Initializes the Module
|
|
+ * @return void
|
|
+ */
|
|
+ function init() {
|
|
+ global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
|
|
+
|
|
+ parent::init();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Adds items to the ->MOD_MENU array. Used for the function menu selector.
|
|
+ *
|
|
+ * @return void
|
|
+ */
|
|
+ function menuConfig() {
|
|
+ global $LANG;
|
|
+ $this->MOD_MENU = Array (
|
|
+ 'function' => Array (
|
|
+ '1' => $LANG->getLL('function1'),
|
|
+ '2' => $LANG->getLL('function2'),
|
|
+ '3' => $LANG->getLL('function3'),
|
|
+ )
|
|
+ );
|
|
+ parent::menuConfig();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Main function of the module. Write the content to $this->content
|
|
+ * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
|
|
+ *
|
|
+ * @return [type] ...
|
|
+ */
|
|
+ function main() {
|
|
+ global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
|
|
+
|
|
+ // Access check!
|
|
+ // The page will show only if there is a valid page and if this page may be viewed by the user
|
|
+ //$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
|
|
+ //$access = is_array($this->pageinfo) ? 1 : 0;
|
|
+
|
|
+ // initialize doc
|
|
+ $this->doc = t3lib_div::makeInstance('template');
|
|
+ $this->doc->setModuleTemplate(t3lib_extMgm::extPath('version') . 'mod2//mod_template.html');
|
|
+ $this->doc->backPath = $BACK_PATH;
|
|
+ $docHeaderButtons = $this->getButtons();
|
|
+
|
|
+ //if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) {
|
|
+
|
|
+ // Decide if the menu button was clicked or it was called by workspace module
|
|
+ if(!t3lib_div::GPvar('changeItems') && !t3lib_div::GPvar('items')) {
|
|
+ header('Location: '.$this->doc->packPath.'mod/user/ws/index.php');
|
|
+ }
|
|
+
|
|
+ // Draw the form
|
|
+ $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">';
|
|
+
|
|
+ // JavaScript
|
|
+ $this->doc->JScode = '
|
|
+ <script language="javascript" type="text/javascript">
|
|
+ script_ended = 0;
|
|
+ function jumpToUrl(URL) {
|
|
+ document.location = URL;
|
|
+ }
|
|
+ </script>
|
|
+ ';
|
|
+ $this->doc->postCode='
|
|
+ <script language="javascript" type="text/javascript">
|
|
+ script_ended = 1;
|
|
+ if (top.fsMod) top.fsMod.recentIds["web"] = 0;
|
|
+ </script>
|
|
+ ';
|
|
+ // Render content:
|
|
+ $this->moduleContent();
|
|
+ /*} else {
|
|
+ // If no access or if ID == zero
|
|
+ $docHeaderButtons['save'] = '';
|
|
+ $this->content.=$this->doc->spacer(10);
|
|
+ }*/
|
|
+
|
|
+ // compile document
|
|
+ $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
|
|
+ $markers['CONTENT'] = $this->content;
|
|
+
|
|
+ // Build the <body> for the module
|
|
+ $this->content = $this->doc->startPage($LANG->getLL('title'));
|
|
+ $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
|
|
+ $this->content.= $this->doc->endPage();
|
|
+ $this->content = $this->doc->insertStylesAndJS($this->content);
|
|
+
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Prints out the module HTML
|
|
+ *
|
|
+ * @return void
|
|
+ */
|
|
+ function printContent() {
|
|
+
|
|
+ $this->content.=$this->doc->endPage();
|
|
+ echo $this->content;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Generates the module content
|
|
+ *
|
|
+ * @return void
|
|
+ */
|
|
+ function moduleContent() {
|
|
+ global $LANG;
|
|
+
|
|
+ // Initialize workspace stage object
|
|
+ $wsstagelibObj = t3lib_div::makeInstance('wsstagelib');
|
|
+
|
|
+ // header
|
|
+ $this->content .= '<h2>'.$LANG->getLL('function1').'</h2>';
|
|
+
|
|
+ // debug
|
|
+ //$this->content .= '<pre>'.print_r($_REQUEST,1).'</pre>';
|
|
+
|
|
+ // Check if form was submitted and all needed informations are available
|
|
+ if(t3lib_div::GPvar('sendMailSubmit') && t3lib_div::GPvar('setStage') &&
|
|
+ (t3lib_div::GPvar('NextStageRecipient') || t3lib_div::GPvar('PrevStageRecipient'))) {
|
|
+
|
|
+ // Set submited stage id and change mode - prev or next stage id
|
|
+ list($changeMode,$setStageId) = explode(':',t3lib_div::GPvar('setStage'),2);
|
|
+ $setStageId = str_replace('editing_','',$setStageId);
|
|
+
|
|
+ // merge recipients and choose right comments
|
|
+ switch($changeMode) {
|
|
+ case 'prev':
|
|
+ // Set comments
|
|
+ $comments = t3lib_div::GPvar('prevStageComments');
|
|
+ $additionalRecipients = explode("\n",t3lib_div::GPvar('PrevStageAddRecipients'));
|
|
+ $recipients = array_merge(t3lib_div::GPvar('PrevStageRecipient'),$additionalRecipients);
|
|
+ $recipients = array_unique($recipients);
|
|
+ break;
|
|
+ case 'next':
|
|
+ // Set comments
|
|
+ $comments = t3lib_div::GPvar('nextStageComments');
|
|
+ $additionalRecipients = explode("\n",t3lib_div::GPvar('NextStageAddRecipients'));
|
|
+ $recipients = array_merge(t3lib_div::GPvar('NextStageRecipient'),$additionalRecipients);
|
|
+ $recipients = array_unique($recipients);
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ // Create URL to forward to
|
|
+ if(t3lib_div::GPvar('diffOnly')) { // If module was called by preview mode - return to it
|
|
+ $cmdArray = array();
|
|
+ $URL = $this->doc->packPath.'sysext/version/cm1/index.php?diffOnly=1&id='.t3lib_div::GPvar('pageId');
|
|
+
|
|
+ foreach(t3lib_div::GPvar('changeItems') as $tableKey => $boolValue) {
|
|
+ list($table,$uid) = explode(':',$tableKey,2);
|
|
+ $cmdArray[$table][$uid]['version']['action'] = 'setStage';
|
|
+ $cmdArray[$table][$uid]['version']['stageId'] = $setStageId;
|
|
+ $cmdArray[$table][$uid]['version']['comment'] = $comments;
|
|
+ }
|
|
+ } else {
|
|
+ $URL = $this->doc->packPath.'mod/user/ws/index.php?';
|
|
+
|
|
+ foreach(t3lib_div::GPvar('changeItems') as $tableKey => $boolValue) {
|
|
+ $URL .= 'items['.$tableKey.']='.$boolValue.'&';
|
|
+ }
|
|
+
|
|
+ $URL .= '_with_selected_do=stage_'.$setStageId.'&wsid='.t3lib_div::GPvar('wsid');
|
|
+
|
|
+ // Set comments
|
|
+ $URL .= '&comments='.$comments;
|
|
+ }
|
|
+
|
|
+ // Send information mail to selected recipients
|
|
+ $sendMail = $this->sendInformationMail($recipients,t3lib_div::GPvar('changeItems'),t3lib_div::GPvar('wsid'),$setStageId,$comments);
|
|
+ if($sendMail === true) {
|
|
+ if(t3lib_div::GPvar('diffOnly')) { // If module was called by preview mode - return to it
|
|
+ $tce = t3lib_div::makeInstance('t3lib_TCEmain');
|
|
+ $tce->stripslashes_values = 0;
|
|
+ $tce->start(array(), $cmdArray);
|
|
+ $tce->process_cmdmap();
|
|
+ }
|
|
+
|
|
+ // Forward back to workspace module to save the new stage
|
|
+ header('Location: '.$this->doc->packPath.$URL);
|
|
+ } else {
|
|
+ $this->content .= '<span style="color: red;">'.$sendMail.' <a href="'.$this->doc->packPath.'mod/user/ws/index.php"><strong>Go back</strong></a></span>';
|
|
+ return false;
|
|
+ }
|
|
+ } else {
|
|
+ // --- list of records to change ---
|
|
+ $changeRecords = t3lib_div::GPvar('items');
|
|
+ $firstRun = 1;
|
|
+ $stageId = null;
|
|
+ $workspaceId = null;
|
|
+
|
|
+ // Check if one or more checkboxes where selected in workspace module
|
|
+ if(empty($changeRecords)) {
|
|
+ $this->content .= '<span style="color: red;">You have to select one or more records. <a href="'.$this->doc->packPath.'mod/user/ws/index.php"><strong>Go back</strong></a></span>';
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ $content = '<ul>';
|
|
+ foreach($changeRecords as $item => $v) {
|
|
+ list($recordTable,$recordInfos['uid'],$recordInfos['stage'],$recordInfos['wsid']) = explode(':',$item,4);
|
|
+
|
|
+ if($firstRun == 1) {
|
|
+ $stageId = $recordInfos['stage'];
|
|
+ $workspaceId = $recordInfos['wsid'];
|
|
+ $firstRun = 0;
|
|
+ }
|
|
+
|
|
+ // show an error if records have not all the same stage
|
|
+ if($recordInfos['stage'] !== $stageId) {
|
|
+ $this->content .= '<span style="color: red;">You can only change records with the same stage. <a href="'.$this->doc->packPath.'mod/user/ws/index.php"><strong>Go back</strong></a></span>';
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ if($recordInfos['wsid'] !== $workspaceId) {
|
|
+ $this->content .= '<span style="color: red;">You can only change records with the same workspace. <a href="'.$this->doc->packPath.'mod/user/ws/index.php"><strong>Go back</strong></a></span>';
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ // get records from db
|
|
+ $singleRecord = t3lib_BEfunc::getRecord($recordTable,$recordInfos['uid']);
|
|
+
|
|
+ if(!empty($singleRecord) && is_array($singleRecord)) {
|
|
+ if($recordTable == 'tt_content' || ($recordTable == 'pages' && $singleRecord['doktype'] == 1)) {
|
|
+ $page_id = ($recordTable == 'pages') ? $singleRecord['t3_origuid'] : $singleRecord['pid'];
|
|
+ $content .= '<li>'.t3lib_BEfunc::getRecordTitle($recordTable,$singleRecord,true).'</li>';
|
|
+ } else {
|
|
+ $content .= '<li>'.t3lib_BEfunc::getRecordTitle($recordTable,$singleRecord,true).'</li>';
|
|
+ }
|
|
+
|
|
+ // Add hidden informations about the element to the form - needed to forward to workspace module after submit
|
|
+ $content .= '<input type="hidden" name="changeItems['.$recordTable.':'.$singleRecord['uid'].']" value="1"/>';
|
|
+ } else {
|
|
+ $content .= '<span style="color: red;">No valid record <a href="'.$this->doc->packPath.'mod/user/ws/index.php"><strong>Go back</strong></a></span>';
|
|
+ }
|
|
+
|
|
+
|
|
+ }
|
|
+ $content .= '</ul>';
|
|
+ $this->content .= $this->doc->section('Change elements:',$content,0,1);
|
|
+
|
|
+ // --- Current stage label ---
|
|
+ if($stageId !== '0' && $stageId !== '10') {
|
|
+ $currentStageRecord = t3lib_BEfunc::getRecord('sys_workspace_stage',$stageId-20);
|
|
+ $content = '';
|
|
+ $this->content .= $this->doc->section('Current stage: "'.t3lib_BEfunc::getRecordTitle('sys_workspace_stage',$currentStageRecord,true).'"',$content,0,1);
|
|
+ } elseif($stageId == '10') {
|
|
+ $content = '';
|
|
+ $this->content .= $this->doc->section('Current stage: "'.$LANG->getLL('stage_publish').'"',$content,0,1);
|
|
+ } else {
|
|
+ $content = '';
|
|
+ $this->content .= $this->doc->section('Current stage: "'.$LANG->getLL('stage_editing').'"',$content,0,1);
|
|
+ }
|
|
+
|
|
+ // --- show stage switch possibilities ---
|
|
+ $content = '';
|
|
+
|
|
+ // If the current stage is the standart edit stage, there is no prev stage
|
|
+ if($stageId !== '0') {
|
|
+ $prevStageRecord = $wsstagelibObj->getPrevStage($workspaceId,$stageId);
|
|
+ if(empty($prevStageRecord) || !is_array($prevStageRecord)) {
|
|
+ $content .= '<span style="color: red;">There is no pevior stage.</span>';
|
|
+ } else {
|
|
+ // prev stage checkbox
|
|
+ if($prevStageRecord['uid'] == '0') {
|
|
+ // prev stage would be 0 = editing
|
|
+ $content .= '<input type="radio" name="setStage" value="prev:editing_'.$prevStageRecord['uid'].'"><strong> Set back to "'.$LANG->getLL('stage_editing').'"</strong>';
|
|
+ } else {
|
|
+ $content .= '<input type="radio" name="setStage" value="prev:'.$prevStageRecord['uid'].'"><strong> Set back to "'.t3lib_BEfunc::getRecordTitle('sys_workspace_stage',$prevStageRecord,true).'"</strong>';
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // Show recipient list for prev stage
|
|
+ if(t3lib_div::GPvar('sendMailSubmit')) {
|
|
+ $content .= '<br /><span style="color: red;">Recipients for information mail:</span>';
|
|
+ } else {
|
|
+ $content .= '<br />Recipients for information mail:';
|
|
+ }
|
|
+ if($prevStageRecord['uid'] == '0') {
|
|
+ // The prev stage would be the standart edit stage use possible recipients from workspace config field adminusers
|
|
+ $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace',$workspaceId);
|
|
+ $prevUserRecords = t3lib_BEfunc::getUserNames('username, uid, email','AND uid IN ('.str_replace('be_users_','',$workspaceRec['adminusers']).')');
|
|
+ if(!empty($prevUserRecords) && is_array($prevUserRecords)) {
|
|
+ foreach($prevUserRecords as $prevUserUid => $prevUserRecord) {
|
|
+ $content .= '<br /><input type="checkbox" name="PrevStageRecipient[]" value="'.$prevUserRecord['email'].'"> '.$prevUserRecord['email'].'';
|
|
+ }
|
|
+ } else {
|
|
+ $content .= '<span style="color: red;">There are no recipients defined for this stage.</span>';
|
|
+ }
|
|
+ } else {
|
|
+ $prevUserRecords = t3lib_BEfunc::getUserNames('username, uid, email','AND uid IN ('.$prevStageRecord['responsible_persons'].')');
|
|
+ if(!empty($prevUserRecords) && is_array($prevUserRecords)) {
|
|
+ foreach($prevUserRecords as $prevUserUid => $prevUserRecord) {
|
|
+ $content .= '<br /><input type="checkbox" name="PrevStageRecipient[]" value="'.$prevUserRecord['email'].'"> '.$prevUserRecord['email'].'';
|
|
+ }
|
|
+ } else {
|
|
+ $content .= '<span style="color: red;">There are no recipients defined for this stage.</span>';
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ $content .= '<br />Additional recipients: <br /><textarea name="PrevStageAddRecipients" cols="50" rows="5"></textarea>';
|
|
+ $prevStageComments = (!empty($prevStageRecord['default_mailcomment'])) ? $prevStageRecord['default_mailcomment'] : '';
|
|
+ $content .= '<br />Comments: <br /><textarea name="prevStageComments" cols="50" rows="5">'.$prevStageComments.'</textarea><br/>';
|
|
+ }
|
|
+
|
|
+ $content .= '<br />';
|
|
+ $nextStageRecord = $wsstagelibObj->getNextStage($workspaceId,$stageId);
|
|
+ if(empty($nextStageRecord) || !is_array($nextStageRecord)) {
|
|
+ $content .= '<span style="color: red;">There is no next stage.</span>';
|
|
+ } else {
|
|
+ // next stage checkbox
|
|
+ if($nextStageRecord['uid'] == '10') {
|
|
+ $content .= '<input type="radio" checked="checked" name="setStage" value="next:'.$nextStageRecord['uid'].'"><strong> Set to "'.$LANG->getLL('stage_publish').'"</strong>';
|
|
+ } else {
|
|
+ $content .= '<input type="radio" checked="checked" name="setStage" value="next:'.$nextStageRecord['uid'].'"><strong> Set to "'.t3lib_BEfunc::getRecordTitle('sys_workspace_stage',$nextStageRecord,true).'"</strong>';
|
|
+ }
|
|
+
|
|
+ // Show recipient list for next stage
|
|
+ if(t3lib_div::GPvar('sendMailSubmit')) {
|
|
+ $content .= '<br /><span style="color: red;">Recipients for information mail:</span>';
|
|
+ } else {
|
|
+ $content .= '<br />Recipients for information mail:';
|
|
+ }
|
|
+ if($nextStageRecord['uid'] == '10') {
|
|
+ // The prev stage would be the standart edit stage use possible recipients from workspace config field adminusers
|
|
+ $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace',$workspaceId);
|
|
+ $nextUserRecords = t3lib_BEfunc::getUserNames('username, uid, email','AND uid IN ('.str_replace('be_users_','',$workspaceRec['adminusers']).')');
|
|
+ if(!empty($nextUserRecords) && is_array($nextUserRecords)) {
|
|
+ foreach($nextUserRecords as $nextUserUid => $nextUserRecord) {
|
|
+ $content .= '<br /><input type="checkbox" name="NextStageRecipient[]" value="'.$nextUserRecord['email'].'"> '.$nextUserRecord['email'].'';
|
|
+ }
|
|
+ } else {
|
|
+ $content .= '<span style="color: red;">There are no recipients defined for this stage.</span>';
|
|
+ }
|
|
+ } else {
|
|
+ $nextUserRecords = t3lib_BEfunc::getUserNames('username, uid, email','AND uid IN ('.$nextStageRecord['responsible_persons'].')');
|
|
+ if(!empty($nextUserRecords) && is_array($nextUserRecords)) {
|
|
+ foreach($nextUserRecords as $nextUserUid => $nextUserRecord) {
|
|
+ $content .= '<br /><input type="checkbox" name="NextStageRecipient[]" value="'.$nextUserRecord['email'].'"> '.$nextUserRecord['email'].'';
|
|
+ }
|
|
+ } else {
|
|
+ $content .= '<span style="color: red;">There are no recipients defined for this stage.</span>';
|
|
+ }
|
|
+ }
|
|
+
|
|
+ $content .= '<br />Additional recipients: <br /><textarea name="NextStageAddRecipients" cols="50" rows="5" ></textarea>';
|
|
+ $nextStageComments = (!empty($nextStageRecord['default_mailcomment'])) ? $nextStageRecord['default_mailcomment'] : '';
|
|
+ $content .= '<br />Comments: <br /><textarea name="nextStageComments" cols="50" rows="5">'.$nextStageComments.'</textarea>';
|
|
+ }
|
|
+
|
|
+ // --- form fields ---
|
|
+ $content .= '<input type="hidden" name="wsid" value="'.$workspaceId.'" />';
|
|
+ if(t3lib_div::GPvar('diffOnly')) {
|
|
+ $content .= '<input type="hidden" name="diffOnly" value="1" />';
|
|
+ $content .= '<input type="hidden" name="pageId" value="'.t3lib_div::GPvar('pageId').'" />';
|
|
+ }
|
|
+ $content .= '<br /><br /><input type="submit" name="sendMailSubmit" value="Send mail and change stage!" />';
|
|
+
|
|
+ $this->content .= $this->doc->section('Switch stage:',$content,0,1);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Send the informationmail if custom staging is activated and a stage was changed
|
|
+ *
|
|
+ * @param array mail recipients
|
|
+ * @param array elements to change the stage
|
|
+ * @param int workspace uid
|
|
+ * @param int uid
|
|
+ * @return bool true on success or error message on failure
|
|
+ */
|
|
+ protected function sendInformationMail($recipients, $changeItems, $wsid, $newStageId, $comments) {
|
|
+ global $LANG;
|
|
+
|
|
+ $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace', $wsid);
|
|
+ if($newStageId !== '0' && $newStageId !== '10') {
|
|
+ $stageRec = t3lib_BEfunc::getRecord('sys_workspace_stage', $newStageId-20);
|
|
+ $title = t3lib_BEfunc::getRecordTitle('sys_workspace_stage',$stageRec,true);
|
|
+ } else {
|
|
+ $title = ($newStageId == '0') ? $LANG->getLL('stage_editing') : $LANG->getLL('stage_publish');
|
|
+ }
|
|
+
|
|
+ $elements = '';
|
|
+ foreach($changeItems as $tableKey => $boolValue) {
|
|
+ list($eTable,$eUid) = explode(':',$tableKey);
|
|
+ $eUid = intval($eUid);
|
|
+ $rr = t3lib_BEfunc::getRecord($eTable,$eUid);
|
|
+ $recTitle = t3lib_BEfunc::getRecordTitle($eTable,$rr);
|
|
+ if ($eTable!='pages') {
|
|
+ t3lib_BEfunc::fixVersioningPid($eTable,$rr);
|
|
+ $eUid=$rr['pid'];
|
|
+ }
|
|
+ $path = t3lib_BEfunc::getRecordPath($eUid,'',20);
|
|
+
|
|
+ $page_id = ($eTable =='pages') ? $rr['t3_origuid'] : $rr['pid'];
|
|
+ $previewURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL').'typo3/mod/user/ws/wsol_preview.php?id='.$page_id;
|
|
+
|
|
+ // Create rows
|
|
+ $elements .= sprintf('"%s" (%s) at location "%s - preview: %s
|
|
+',$recTitle, $tableKey, $path, $previewURL);
|
|
+ }
|
|
+
|
|
+ /*
|
|
+ *
|
|
+ *
|
|
+ * 3.) send mail
|
|
+ * 3.6.) set from address to current user
|
|
+ * 3.7.) add inital text "automated generated mail from TYPO3"
|
|
+ *
|
|
+ */
|
|
+
|
|
+ $body = '
|
|
+TYPO3 site "%s" - workspace "%s" (#%s)
|
|
+
|
|
+The stage has changed for the element(s)
|
|
+
|
|
+%s
|
|
+
|
|
+New Stage:
|
|
+==> %s
|
|
+
|
|
+User Comment:
|
|
+"%s"
|
|
+
|
|
+Please do the following now:
|
|
+Step 1: Login into the TYPO3 backend: %s
|
|
+
|
|
+Step 2: Klick on the preview links above or check the changed elements via backend.
|
|
+
|
|
+Step 3: Please set the stage for the elements to the next stage,
|
|
+if the changes are ok for you or reject the stage back to the previous stage if they\'re not.
|
|
+
|
|
+State was changed by %s (username: %s)
|
|
+
|
|
+This mail was automated generated by TYPO3.
|
|
+ ';
|
|
+ $subject = 'TYPO3 Workspace Note: Stage Change for %s';
|
|
+
|
|
+ // Send email:
|
|
+ $message = sprintf($body,
|
|
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
|
|
+ $workspaceRec['title'],
|
|
+ $workspaceRec['uid'],
|
|
+ $elements,
|
|
+ $title,
|
|
+ $comments,
|
|
+ t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir,
|
|
+ $GLOBALS['BE_USER']->user['realName'],
|
|
+ $GLOBALS['BE_USER']->user['username']);
|
|
+
|
|
+ $headers = 'From: '. $GLOBALS['BE_USER']->user['email'] . "\r\n" .
|
|
+ 'Reply-To: ' . $GLOBALS['BE_USER']->user['email'];
|
|
+
|
|
+ if(t3lib_div::plainMailEncoded(
|
|
+ implode(',',$recipients),
|
|
+ sprintf($subject,$tableKey),
|
|
+ trim($message),
|
|
+ $headers
|
|
+ )) {
|
|
+ return true;
|
|
+ } else {
|
|
+ return 'Information mail could not be send. Stages were <strong>not</strong> changed.';
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Create the panel of buttons for submitting the form or otherwise perform operations.
|
|
+ *
|
|
+ * @return array all available buttons as an assoc. array
|
|
+ */
|
|
+ protected function getButtons() {
|
|
+
|
|
+ $buttons = array(
|
|
+ 'csh' => '',
|
|
+ 'shortcut' => '',
|
|
+ 'save' => ''
|
|
+ );
|
|
+ // CSH
|
|
+ $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
|
|
+
|
|
+ // SAVE button
|
|
+ //$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) . '" />';
|
|
+
|
|
+ // Shortcut
|
|
+ if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
|
|
+ $buttons['shortcut'] = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
|
|
+ }
|
|
+
|
|
+ return $buttons;
|
|
+ }
|
|
+}
|
|
+
|
|
+
|
|
+
|
|
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/version/mod2/index.php']) {
|
|
+ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/version/mod2/index.php']);
|
|
+}
|
|
+
|
|
+
|
|
+
|
|
+try {
|
|
+
|
|
+ // Make instance:
|
|
+ $SOBE = t3lib_div::makeInstance('tx_version_module2');
|
|
+ $SOBE->init();
|
|
+
|
|
+ // Include files?
|
|
+ foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
|
|
+
|
|
+ $SOBE->main();
|
|
+ $SOBE->printContent();
|
|
+
|
|
+
|
|
+} catch (Exception $ex){
|
|
+ echo '<pre>'.htmlspecialchars($ex->getMessage()).'</pre>';
|
|
+ echo '<pre>'.htmlspecialchars($ex->getTraceAsString()).'</pre>';
|
|
+}
|
|
+?>
|
|
\ No newline at end of file
|
|
Index: typo3/sysext/version/mod2/moduleicon.gif
|
|
===================================================================
|
|
Cannot display: file marked as a binary type.
|
|
svn:mime-type = application/octet-stream
|
|
|
|
Property changes on: typo3/sysext/version/mod2/moduleicon.gif
|
|
___________________________________________________________________
|
|
Added: svn:mime-type
|
|
+ application/octet-stream
|
|
|
|
Index: typo3/sysext/version/mod2/mod_template.html
|
|
===================================================================
|
|
--- typo3/sysext/version/mod2/mod_template.html (revision 0)
|
|
+++ typo3/sysext/version/mod2/mod_template.html (revision 0)
|
|
@@ -0,0 +1,35 @@
|
|
+<!-- ###FULLDOC### begin -->
|
|
+<div class="typo3-fullDoc">
|
|
+ <!-- Page header with buttons, path details and csh -->
|
|
+ <div id="typo3-docheader">
|
|
+ <div id="typo3-docheader-row1">
|
|
+ <div class="buttonsleft">###BUTTONLIST_LEFT###</div>
|
|
+ <div class="buttonsright">###BUTTONLIST_RIGHT###</div>
|
|
+ </div>
|
|
+ <div id="typo3-docheader-row2">
|
|
+ <div class="docheader-row2-left"><div class="docheader-funcmenu">###FUNC_MENU###</div></div>
|
|
+ <div class="docheader-row2-right">###PAGEPATH######PAGEINFO###</div>
|
|
+ </div>
|
|
+ </div>
|
|
+ <!-- Content of module, for instance listing, info or editing -->
|
|
+ <div id="typo3-docbody">
|
|
+ <div id="typo3-inner-docbody">
|
|
+ ###CONTENT###
|
|
+ </div>
|
|
+ </div>
|
|
+</div>
|
|
+<!-- ###FULLDOC### end -->
|
|
+
|
|
+<!-- Grouping the icons on top -->
|
|
+
|
|
+<!-- ###BUTTON_GROUP_WRAP### -->
|
|
+ <div class="buttongroup">###BUTTONS###</div>
|
|
+<!-- ###BUTTON_GROUP_WRAP### -->
|
|
+
|
|
+<!-- ###BUTTON_GROUPS_LEFT### -->
|
|
+<!-- ###BUTTON_GROUP1### -->###SAVE###<!-- ###BUTTON_GROUP1### -->
|
|
+<!-- ###BUTTON_GROUPS_LEFT### -->
|
|
+
|
|
+<!-- ###BUTTON_GROUPS_RIGHT### -->
|
|
+<!-- ###BUTTON_GROUP1### -->###SHORTCUT###<!-- ###BUTTON_GROUP1### -->
|
|
+<!-- ###BUTTON_GROUPS_RIGHT### -->
|
|
\ No newline at end of file
|
|
Index: typo3/sysext/version/mod2/clear.gif
|
|
===================================================================
|
|
Index: typo3/sysext/version/mod2/moduleicon.png
|
|
===================================================================
|
|
Cannot display: file marked as a binary type.
|
|
svn:mime-type = application/octet-stream
|
|
|
|
Property changes on: typo3/sysext/version/mod2/moduleicon.png
|
|
___________________________________________________________________
|
|
Added: svn:mime-type
|
|
+ application/octet-stream
|
|
|
|
Index: typo3/sysext/version/ext_tables.php
|
|
===================================================================
|
|
--- typo3/sysext/version/ext_tables.php (revision 270)
|
|
+++ typo3/sysext/version/ext_tables.php (working copy)
|
|
@@ -7,6 +7,15 @@
|
|
'path' => t3lib_extMgm::extPath($_EXTKEY).'class.tx_version_cm1.php'
|
|
);
|
|
|
|
+ // add version module to the module navigation
|
|
t3lib_extMgm::addModule('web','txversionM1','',t3lib_extMgm::extPath($_EXTKEY).'cm1/');
|
|
+
|
|
+ // add mod2 to the mod.php? module list
|
|
+ t3lib_extMgm::addModulePath('user_txversionM2', t3lib_extMgm::extPath($_EXTKEY) . 'mod2/');
|
|
+
|
|
+ // add version module to the module navigation
|
|
+ t3lib_extMgm::addModule('user', 'txversionM2', 'first', t3lib_extMgm::extPath($_EXTKEY).'mod2/');
|
|
}
|
|
+
|
|
+
|
|
?>
|
|
\ No newline at end of file
|
|
Index: typo3/sysext/version/ext_emconf.php
|
|
===================================================================
|
|
--- typo3/sysext/version/ext_emconf.php (revision 270)
|
|
+++ typo3/sysext/version/ext_emconf.php (working copy)
|
|
@@ -20,7 +20,7 @@
|
|
'dependencies' => '',
|
|
'conflicts' => '',
|
|
'priority' => '',
|
|
- 'module' => 'cm1',
|
|
+ 'module' => 'cm1,mod2',
|
|
'state' => 'beta',
|
|
'internal' => '',
|
|
'uploadfolder' => 0,
|
|
Index: typo3/sysext/version/mod2/locallang_mod.xml
|
|
===================================================================
|
|
--- typo3/sysext/version/mod2/locallang_mod.xml (revision 0)
|
|
+++ typo3/sysext/version/mod2/locallang_mod.xml (revision 0)
|
|
@@ -0,0 +1,14 @@
|
|
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
|
+<T3locallang>
|
|
+ <meta type="array">
|
|
+ <type>module</type>
|
|
+ <description>Language labels for module "user_txversionM2" - header, description</description>
|
|
+ </meta>
|
|
+ <data type="array">
|
|
+ <languageKey index="default" type="array">
|
|
+ <label index="mlang_tabs_tab">Staging</label>
|
|
+ <label index="mlang_labels_tabdescr">Staging.</label>
|
|
+ <label index="mlang_labels_tablabel">Staging</label>
|
|
+ </languageKey>
|
|
+ </data>
|
|
+</T3locallang>
|
|
\ No newline at end of file
|