Project

General

Profile

Bug #16655 » ws_publishing.txt

Administrator Admin, 2006-10-19 08:15

 
Index: t3lib/stddb/tables.sql
===================================================================
--- t3lib/stddb/tables.sql (revision 1740)
+++ t3lib/stddb/tables.sql (working copy)
@@ -49,7 +49,7 @@
ses_hashlock int(11) DEFAULT '0' NOT NULL,
ses_userid int(11) unsigned DEFAULT '0' NOT NULL,
ses_tstamp int(11) unsigned DEFAULT '0' NOT NULL,
- ses_data mediumblob NOT NULL,
+ ses_data longblob NOT NULL,
ses_backuserid int(11) NOT NULL default '0',
PRIMARY KEY (ses_id,ses_name)
);
Index: typo3/mod/user/ws/workspaceforms.php
===================================================================
--- typo3/mod/user/ws/workspaceforms.php (revision 1740)
+++ typo3/mod/user/ws/workspaceforms.php (working copy)
@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
-* (c) 1999-2005 Dmitry Dulepov (typo3@accio.lv)
+* (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@@ -645,8 +645,8 @@
}
// Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.mod_user_ws_workspaceForms.php']) {
- include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.mod_user_ws_workspaceforms.php']);
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/workspaceforms.php']) {
+ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/workspaceForms.php']);
}
// Make instance:
Index: typo3/mod/user/ws/.htaccess
===================================================================
--- typo3/mod/user/ws/.htaccess (revision 0)
+++ typo3/mod/user/ws/.htaccess (revision 0)
@@ -0,0 +1,7 @@
+<FilesMatch "\.(gif|png)">
+ <IfModule mod_expires.c>
+ ExpiresActive on
+ ExpiresDefault "access plus 7 days"
+ </IfModule>
+ FileETag MTime Size
+</FilesMatch>
Index: typo3/mod/user/ws/publish.php
===================================================================
--- typo3/mod/user/ws/publish.php (revision 0)
+++ typo3/mod/user/ws/publish.php (revision 0)
@@ -0,0 +1,251 @@
+<?php
+/***************************************************************
+* Copyright notice
+*
+* (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
+* 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!
+***************************************************************/
+/**
+ * Module: Workspace publisher
+ *
+ * $Id: index.php 1613 2006-07-10 09:42:27Z liels_bugs $
+ *
+ * @author Dmitry Dulepov <typo3@accio.lv>
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ */
+
+
+// Initialize module:
+unset($MCONF);
+require('conf.php');
+require($BACK_PATH . 'init.php');
+require($BACK_PATH . 'template.php');
+$BE_USER->modAccess($MCONF, 1);
+
+// Include libraries of various kinds used inside:
+$LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
+require_once(PATH_t3lib . 'class.t3lib_scbase.php');
+require_once(PATH_typo3 . 'mod/user/ws/class.wslib.php');
+require_once(PATH_t3lib . 'class.t3lib_tcemain.php');
+
+define('MAX_RECORDS_TO_PUBLISH', 30);
+
+class SC_mod_user_ws_publish extends t3lib_SCbase {
+
+ var $isSwap;
+ var $title;
+ var $nextRecordNumber;
+ var $publishData;
+ var $recordCount;
+
+ /**
+ * Initializes the module. See <code>t3lib_SCbase::init()</code> for more information.
+ *
+ * @return void
+ */
+ function init() {
+ // Setting module configuration:
+ $this->MCONF = $GLOBALS['MCONF'];
+
+ $this->isSwap = t3lib_div::_GP('swap');
+ $this->nextRecordNumber = t3lib_div::_GP('continue_publish');
+
+ // Initialize Document Template object:
+ $this->doc = t3lib_div::makeInstance('mediumDoc');
+ $this->doc->backPath = $GLOBALS['BACK_PATH'];
+ $this->doc->docType = 'xhtml_trans';
+ $this->doc->JScode = '<script type="text/javascript">/*<![CDATA[*/
+ function closeAndReload() {
+ //window.opener.location.reload(); window.close();
+ window.location.href = \'index.php\';
+ }
+ function nextPortion(val) {
+ setTimeout(\'window.location.href = "publish.php?continue_publish=\' + val + \'&swap=' . ($this->isSwap ? 1 : 0) . '"\', 750);
+ }
+ /*]]>*/</script>
+ ';
+ $this->doc->inDocStyles = '
+ #progress-block { width: 450px; margin: 50px auto; text-align: center; }
+ H3 { margin-bottom: 20px; }
+ P, IMG { margin-bottom: 20px; }
+ #progress-block A { text-decoration: underline; }
+';
+
+ // Parent initialization:
+ t3lib_SCbase::init();
+ }
+
+ /**
+ * Creates module content.
+ *
+ * @return void
+ */
+ function main() {
+ $this->title = $GLOBALS['LANG']->getLL($this->isSwap ? 'swap_title' : 'publish_title');
+
+ $content = $this->getContent(); // sets body parts to doc!
+
+ $this->content .= $this->doc->startPage($this->title);
+ $this->content .= $content;
+ $this->content .= $this->doc->endPage();
+ }
+
+ /**
+ * Outputs content.
+ *
+ * @return void
+ */
+ function printContent() {
+ echo $this->content;
+ }
+
+ /**
+ * Performs action and generates content.
+ *
+ * @return string Generated content
+ */
+ function getContent() {
+ $content = '';
+ if ($this->nextRecordNumber) {
+ // Prepare limited set of records
+ $this->publishData = $GLOBALS['BE_USER']->getSessionData('workspacePublisher');
+ $this->recordCount = $GLOBALS['BE_USER']->getSessionData('workspacePublisher_count');
+ $limitedCmd = array(); $numRecs = 0;
+ foreach ($this->publishData as $table => $recs) {
+ foreach ($recs as $key => $value) {
+ $numRecs++;
+ $limitedCmd[$table][$key] = $value;
+ //$this->content .= $table.':'.$key.'<br />';
+ if ($numRecs == MAX_RECORDS_TO_PUBLISH) {
+ break;
+ }
+ }
+ if ($numRecs == MAX_RECORDS_TO_PUBLISH) {
+ break;
+ }
+ }
+
+ if ($numRecs == 0) {
+ // All done
+ $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher', null);
+ $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher_count', 0);
+ $content .= '<div id="progress-block"><h3>' . $this->title . '</h3><p>';
+ $content .= $GLOBALS['LANG']->getLL($this->isSwap ? 'workspace_swapped' : 'workspace_published');
+ $content .= '</p><p><a href="index.php">' . $GLOBALS['LANG']->getLL('return_to_index') . '</a>';
+ $content .= '</p></div>';
+ }
+ else {
+ // Execute the commands:
+ $tce = t3lib_div::makeInstance('t3lib_TCEmain');
+ $tce->stripslashes_values = 0;
+ $tce->start(array(), $limitedCmd);
+ $tce->process_cmdmap();
+
+ $errors = $tce->errorLog;
+ if (count($errors) > 0) {
+ $content .= '<h3>' . $LANG->getLL('label_errors') . '</h3><br/>' . implode('<br/>',$errors);
+ $content .= '<br /><br /><a href="index.php">' . $GLOBALS['LANG']->getLL('return_to_index') . '</a>';
+ }
+ else {
+
+ // Unset processed records
+ foreach ($limitedCmd as $table => $recs) {
+ foreach ($recs as $key => $value) {
+ unset($this->publishData[$table][$key]);
+ }
+ }
+ $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher', $this->publishData);
+ $content .= $this->formatProgressBlock($this->isSwap ? 'swap_status' : 'publish_status');
+ $this->doc->bodyTagAdditions = 'onload="nextPortion(' . ($this->nextRecordNumber + MAX_RECORDS_TO_PUBLISH) . ')"';
+ }
+ }
+ }
+ else {
+ $this->getRecords();
+ if ($this->recordCount > 0) {
+ $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher', $this->publishData);
+ $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher_count', $this->recordCount);
+ $content .= $this->formatProgressBlock($this->isSwap ? 'swap_prepare' : 'publish_prepare');
+ $this->doc->bodyTagAdditions = 'onload="nextPortion(1)"';
+ }
+ else {
+ $this->doc->bodyTagAdditions = 'onload="closeAndReload()"';
+ }
+ }
+ return $content;
+ }
+
+ /**
+ * Fetches command array for publishing and calculates number of records in it. Sets class members accordingly.
+ *
+ * @return void
+ */
+ function getRecords() {
+ $wslibObj = t3lib_div::makeInstance('wslib');
+ $this->publishData = $wslibObj->getCmdArrayForPublishWS($GLOBALS['BE_USER']->workspace, $this->isSwap);
+
+ $numRecs = 0;
+ foreach ($this->publishData as $table => $recs) {
+ foreach ($recs as $key => $value) {
+ $numRecs++;
+ }
+ }
+ $this->recordCount = $numRecs;
+ }
+
+ /**
+ * Creates block with progress bar
+ *
+ * @param string $messageLabel Message label to display
+ * @return string Generated content
+ */
+ function formatProgressBlock($messageLabel) {
+ return '<div id="progress-block"><h3>' . $this->title . '</h3><p>' .
+ sprintf($GLOBALS['LANG']->getLL($messageLabel),
+ $this->nextRecordNumber,
+ min($this->recordCount, $this->nextRecordNumber - 1 + MAX_RECORDS_TO_PUBLISH),
+ $this->recordCount) . '<br />' .
+ $GLOBALS['LANG']->getLL('please_wait') .
+ '</p><img src="progress.gif" width="225" height="20" alt="" />' .
+ '<p>' .
+ $GLOBALS['LANG']->getLL('do_not_interrupt_publishing_1') .
+ '<br />' .
+ $GLOBALS['LANG']->getLL('do_not_interrupt_publishing_2') .
+ '</p></div>';
+ }
+}
+
+
+// Include extension?
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/publish.php']) {
+ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/publish.php']);
+}
+
+// Make instance:
+$SOBE = t3lib_div::makeInstance('SC_mod_user_ws_publish');
+$SOBE->init();
+$SOBE->main();
+$SOBE->printContent();
+?>
\ No newline at end of file
Index: typo3/mod/user/ws/index.php
===================================================================
--- typo3/mod/user/ws/index.php (revision 1740)
+++ typo3/mod/user/ws/index.php (working copy)
@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
-* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+* (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@@ -83,9 +83,6 @@
* 1964: function versionsInOtherWS($table,$uid)
* 1994: function showStageChangeLog($table,$id,$stageCommands)
*
- * SECTION: Processing
- * 2055: function publishAction()
- *
* TOTAL FUNCTIONS: 37
* (This index is automatically created/updated by the extension "extdeveval")
*
@@ -290,9 +287,6 @@
$this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . 'alt_main.php";');
}
else {
- // Perform workspace publishing action if buttons are pressed:
- $errors = $this->publishAction();
-
// Starting page:
$this->content.=$this->doc->startPage($LANG->getLL('title'));
$this->content.=$this->doc->header($LANG->getLL('title'));
@@ -302,7 +296,7 @@
$menuItems = array();
$menuItems[] = array(
'label' => $LANG->getLL('menuitem_review'),
- 'content' => (count($errors) ? '<h3>' . $LANG->getLL('label_errors') . '</h3><br/>'.implode('<br/>',$errors).'<hr/>' : '').$this->moduleContent_publish()
+ 'content' => $this->moduleContent_publish()
);
$menuItems[] = array(
'label' => $LANG->getLL('menuitem_workspaces'),
@@ -396,10 +390,10 @@
if ($GLOBALS['BE_USER']->workspace!==0) {
if ($this->publishAccess) {
$confirmation = $LANG->JScharCode($LANG->getLL(($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1) ? 'submit_publish_workspace_confirmation_1' : 'submit_publish_workspace_confirmation_2'));
- $actionLinks.= '<input type="submit" name="_publish" value="' . $LANG->getLL('submit_publish_workspace') . '" onclick="return confirm(' . $confirmation . ');"/>';
+ $actionLinks.= '<input type="submit" name="_publish" value="' . $LANG->getLL('submit_publish_workspace') . '" onclick="if (confirm(' . $confirmation . ')) window.location.href=\'publish.php?swap=0\';return false"/>';
if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
$confirmation = $LANG->JScharCode($LANG->getLL(($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1) ? 'submit_swap_workspace_confirmation_1' : 'submit_swap_workspace_confirmation_2'));
- $actionLinks.= '<input type="submit" name="_swap" value="' . $LANG->getLL('submit_swap_workspace') . '" onclick="return confirm(' . $confirmation . ');" />';
+ $actionLinks.= '<input type="submit" name="_swap" value="' . $LANG->getLL('submit_swap_workspace') . '" onclick="if (confirm(' . $confirmation . ')) window.location.href=\'publish.php?swap=1\';return false ;" />';
}
} else {
$actionLinks.= $this->doc->icons(1) . $LANG->getLL('no_publish_permission');
@@ -2040,36 +2034,6 @@
-
- /**********************************
- *
- * Processing
- *
- **********************************/
-
- /**
- * Will publish workspace if buttons are pressed
- *
- * @return void
- */
- function publishAction() {
-
- // If "Publish" or "Swap" buttons are pressed:
- if (t3lib_div::_POST('_publish') || t3lib_div::_POST('_swap')) {
-
- // Initialize workspace object and request all pending versions:
- $wslibObj = t3lib_div::makeInstance('wslib');
- $cmd = $wslibObj->getCmdArrayForPublishWS($GLOBALS['BE_USER']->workspace, t3lib_div::_POST('_swap'));
-
- // Execute the commands:
- $tce = t3lib_div::makeInstance('t3lib_TCEmain');
- $tce->stripslashes_values = 0;
- $tce->start(array(), $cmd);
- $tce->process_cmdmap();
-
- return $tce->errorLog;
- }
- }
}
// Include extension?
Index: typo3/sysext/lang/locallang_mod_user_ws.xml
===================================================================
--- typo3/sysext/lang/locallang_mod_user_ws.xml (revision 1740)
+++ typo3/sysext/lang/locallang_mod_user_ws.xml (working copy)
@@ -100,6 +100,18 @@
<label index="workspace_list_db_mount_point_live">Mount points from user profile are used.</label>
<label index="workspace_list_db_mount_point_draft">Mount points from user profile are used.</label>
<label index="workspace_list_db_mount_point_custom">Mount points from user profile are used.</label>
+ <label index="publish_title">Publish workspace</label>
+ <label index="swap_title">Swap workspace</label>
+ <label index="publish_status">Published records &lt;strong&gt;%d&lt;/strong&gt; to &lt;strong&gt;%d&lt;/strong&gt; of &lt;strong&gt;%d&lt;/strong&gt;.</label>
+ <label index="swap_status">Swapped records &lt;strong&gt;%d&lt;/strong&gt; to &lt;strong&gt;%d&lt;/strong&gt; of &lt;strong&gt;%d&lt;/strong&gt;.</label>
+ <label index="publish_prepare">TYPO3 is preparing to publish records.</label>
+ <label index="swap_prepare">TYPO3 is preparing to swap records.</label>
+ <label index="please_wait">Please, wait...</label>
+ <label index="return_to_index">Return to Workspace module</label>
+ <label index="do_not_interrupt_publishing_1">Do not interrupt publishing process or</label>
+ <label index="do_not_interrupt_publishing_2">workspace may be left in half-published state!</label>
+ <label index="workspace_published">Workspace has been published.</label>
+ <label index="workspace_swapped">Workspace has been swapped.</label>
</languageKey>
</data>
</T3locallang>
\ No newline at end of file
(1-1/2)