Index: classes/class.tx_staticdstools.php
===================================================================
--- classes/class.tx_staticdstools.php (revision 35761)
+++ classes/class.tx_staticdstools.php (working copy)
@@ -1,264 +0,0 @@
-
- */
-class tx_staticDStools {
-
- /**
- * Step for the wizard. Can be manipulated by internal function
- *
- * @var int $step
- */
- protected $step = 0;
-
- /**
- *
- * @param array Parameter array. Contains fieldName and fieldValue.
- * @param object Instance of the class t3lib_tsStyleConfig
- */
- function staticDsWizard($params, $pObj) {
- $this->step = t3lib_div::_GP('dsWizardDoIt') ? intval(t3lib_div::_GP('dsWizardStep')) : 0;
- $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['templavoila']);
-
- $title = $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.title.' . $this->step);
- $description = $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.description.' . $this->step);
- $out = '
' . htmlspecialchars($title) . '
';
-
- switch($this->step) {
- case 1:
- $ok = array(TRUE, TRUE);
- if (t3lib_div::_GP('dsWizardDoIt')) {
-
- if (!isset($conf['staticDS.']['path_fce']) || !strlen($conf['staticDS.']['path_fce'])) {
- $ok[0] = FALSE;
- $description .= sprintf('||' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.dircheck.notset'), 'staticDS.path_fce');
- } else {
- $ok[0] = $this->checkDirectory($conf['staticDS.']['path_fce']);
- if ($ok[0]) {
- $description .= sprintf('||' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.dircheck.ok'), htmlspecialchars($conf['staticDS.']['path_fce']));
- } else {
- $description .= sprintf('||' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.dircheck.notok'), htmlspecialchars($conf['staticDS.']['path_fce']));
- }
- }
-
- if (!isset($conf['staticDS.']['path_page']) || !strlen($conf['staticDS.']['path_page'])) {
- $ok[0] = FALSE;
- $description .= sprintf('||' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.dircheck.notset'), 'staticDS.path_page');
- } else {
- $ok[1] = $this->checkDirectory($conf['path_page']);
- if ($ok[1]) {
- $description .= sprintf('|' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.dircheck.ok'), htmlspecialchars($conf['staticDS.']['path_page']));
- } else {
- $description .= sprintf('|' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.dircheck.notok'), htmlspecialchars($conf['staticDS.']['path_page']));
- }
- }
- if ($ok == array(TRUE, TRUE)) {
- $controls .= $this->getDsRecords($conf['staticDS.']);
- }
- }
- if ($ok == array(TRUE, TRUE) && $this->step < 3) {
- $submitText = $conf['staticDS.']['enable'] ? $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.submit3') : $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.submit2');
- $controls .= '
- ';
- }
- break;
- default:
- $controls .= '
- ';
- break;
- }
-
-
- $out .= '' . str_replace('|', '
', $description) . '
' .
- '' . $controls . '
';
-
- return $out;
- }
-
- /**
- *
- * @param string $path
- */
- protected function checkDirectory($path) {
- $path = $path . (substr($path, -1) == '/' ? '' : '/');
- if (!is_dir(PATH_site . $path)) {
- t3lib_div::mkdir_deep(PATH_site, $path);
- }
- return TRUE; #is_dir(path_site . substr($path, 0, -1));
- }
-
- /**
- *
- * @param array $conf
- */
- protected function getDsRecords($conf) {
- $updateMessage = '';
- $writeDsIds = array();
- $writeIds = t3lib_div::_GP('staticDSwizard');
- $options = t3lib_div::_GP('staticDSwizardoptions');
- $checkAll = t3lib_div::_GP('sdw-checkall');
-
- if (count($writeIds)) {
- $writeDsIds = array_keys($writeIds);
- }
- $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
- '*',
- 'tx_templavoila_datastructure',
- 'deleted=0',
- '',
- 'scope, title'
- );
- $out = '
-
- ' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.uid') . ' |
- ' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.pid') . ' |
- ' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.title') . ' |
- ' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.scope') . ' |
- ' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.usage') . ' |
-
-
- |
-
';
- foreach($rows as $row) {
- $dirPath = PATH_site . ($row['scope'] == 2 ? $conf['path_fce'] : $conf['path_page']);
- $dirPath = $dirPath . (substr($dirPath, -1) == '/' ? '' : '/');
- $title = preg_replace('|[/,\."\']+|', '_', $row['title']);
- $path = $dirPath . $title . ' (' . ($row['scope'] == 1 ? 'page' : 'fce') . ').xml';
- $outPath = substr($path, strlen(PATH_site));
-
- $usage = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
- 'count(*)',
- 'tx_templavoila_tmplobj',
- 'datastructure=' . $row['uid'] . t3lib_BEfunc::BEenableFields('tx_templavoila_tmplobj')
- );
- if (count($writeDsIds) && in_array($row['uid'], $writeDsIds)) {
- t3lib_div::writeFile($path, $row['dataprot']);
- if ($row['previewicon']) {
- copy(PATH_site . 'uploads/tx_templavoila/' . $row['previewicon'], $dirPath . $title . ' (' . ($row['scope'] == 1 ? 'page' : 'fce') . ').gif');
- }
- if ($options['updateRecords']) {
- // update TO records
- $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
- 'tx_templavoila_tmplobj',
- 'datastructure="' . $row['uid'] . '"',
- array('datastructure' => $outPath)
- );
- // update page records
- $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
- 'pages',
- 'tx_templavoila_ds="' . $row['uid'] . '"',
- array('tx_templavoila_ds' => $outPath)
- );
- $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
- 'pages',
- 'tx_templavoila_next_ds="' . $row['uid'] . '"',
- array('tx_templavoila_next_ds' => $outPath)
- );
- // update tt_content records
- $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
- 'tt_content',
- 'tx_templavoila_ds="' . $row['uid'] . '"',
- array('tx_templavoila_ds' => $outPath)
- );
- // delete DS records
- $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_templavoila_datastructure', 'uid=' . $row['uid'], array('deleted' => 1));
- $updateMessage = $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.updated');
- $this->step = 3;
- }
-
-
- }
- $out .= '
- ' .$row['uid'] . ' |
- ' .$row['pid'] . ' |
- ' .htmlspecialchars($row['title']) . ' |
- ' .($row['scope'] == 1 ? 'Page' : 'FCE') . ' |
- ' .$usage[0]['count(*)'] . ' | ';
- if (count($writeDsIds) && in_array($row['uid'], $writeDsIds)) {
- $out .= 'written to "' . $outPath . '" | ';
- } else {
- $out .= ' | ';
- }
- $out .= '
';
- }
- $out .= '
';
-
- if ($conf['enable']) {
- if ($updateMessage) {
- $out .= '' . $updateMessage . '
' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.clearcache') . '
';
- } else {
- $out .= '' . $GLOBALS['LANG']->sL('LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard.description2.1') . '
';
- $out .= '
-
-
-
';
- }
- }
- return $out;
- }
-
- /**
- *
- * @param unknown_type $conf
- */
- public function readStaticDsFilesIntoArray($conf) {
- $paths = array_unique(array('fce' => $conf['staticDS.']['path_fce'], 'page' => $conf['staticDS.']['path_page']));
- foreach ($paths as $type => $path) {
- $absolutePath = t3lib_div::getFileAbsFileName($path);
- $files = t3lib_div::getFilesInDir($absolutePath, 'xml', true);
- // if all files are in the same folder, don't resolve the scope by path type
- if (count($paths) == 1) {
- $type = FALSE;
- }
- foreach($files as $filePath) {
- $staticDataStructure = array();
- $pathInfo = pathinfo($filePath);
-
- $staticDataStructure['title'] = $pathInfo['filename'];
- $staticDataStructure['path'] = substr($filePath, strlen(PATH_site));
- $iconPath = $pathInfo['dirname'] . '/' . $pathInfo['filename'] . '.gif';
- if (file_exists($iconPath)) {
- $staticDataStructure['icon'] = substr($iconPath, strlen(PATH_site));
- }
-
- if (($type !== FALSE && $type === 'fce') || strpos($pathInfo['filename'], '(fce)') !== FALSE) {
- $staticDataStructure['scope'] = tx_templavoila_datastructure::SCOPE_FCE;
- } else {
- $staticDataStructure['scope'] = tx_templavoila_datastructure::SCOPE_PAGE;
- }
-
- $GLOBALS['TBE_MODULES_EXT']['xMOD_tx_templavoila_cm1']['staticDataStructures'][] = $staticDataStructure;
- }
- }
- }
-}
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/classes/class.tx_staticdstools.php']) {
- include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/classes/class.tx_staticdstools.php']);
-}
-?>
Index: classes/class.tx_templavoila_staticdstools.php
===================================================================
--- classes/class.tx_templavoila_staticdstools.php (revision 35760)
+++ classes/class.tx_templavoila_staticdstools.php (working copy)
@@ -27,7 +27,7 @@
*
* @author Steffen Kamper
*/
-class tx_staticDStools {
+class tx_templavoila_staticDStools {
/**
* Step for the wizard. Can be manipulated by internal function
@@ -258,7 +258,7 @@
}
}
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/classes/class.tx_staticdstools.php']) {
- include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/classes/class.tx_staticdstools.php']);
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/classes/class.tx_templavoila_staticdstools.php']) {
+ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/classes/class.tx_templavoila_staticdstools.php']);
}
-?>
+?>
\ No newline at end of file
Index: ext_conf_template.txt
===================================================================
--- ext_conf_template.txt (revision 35761)
+++ ext_conf_template.txt (working copy)
@@ -16,5 +16,5 @@
#cat=static DS;type=string;label=LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.path_page
staticDS.path_page = fileadmin/templates/ds/page/
- #cat=static DS;type=user[EXT:templavoila/classes/class.tx_staticdstools.php:&tx_staticDStools->staticDsWizard];label=LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard
+ #cat=static DS;type=user[EXT:templavoila/classes/class.tx_templavoila_staticdstools.php:&tx_templavoila_staticDStools->staticDsWizard];label=LLL:EXT:templavoila/res1/language/template_conf.xml:staticDS.wizard
staticDS.wizard =
Index: ext_tables.php
===================================================================
--- ext_tables.php (revision 35761)
+++ ext_tables.php (working copy)
@@ -45,8 +45,8 @@
}
// Static DS
if ($_EXTCONF['staticDS.']['enable']) {
- include_once(t3lib_extMgm::extPath('templavoila') . 'classes/class.tx_staticdstools.php');
- tx_staticDStools::readStaticDsFilesIntoArray($_EXTCONF);
+ include_once(t3lib_extMgm::extPath('templavoila') . 'classes/class.tx_templavoila_staticdstools.php');
+ tx_templavoila_staticDStools::readStaticDsFilesIntoArray($_EXTCONF);
}
// Adding tables: