|
From: <txm...@us...> - 2014-06-06 15:19:14
|
Revision: 12567
http://sourceforge.net/p/xoops/svn/12567
Author: txmodxoops
Date: 2014-06-06 15:19:10 +0000 (Fri, 06 Jun 2014)
Log Message:
-----------
Fixed bugs
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php
Added Paths:
-----------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php
Removed Paths:
-------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstractfiles.php
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php 2014-06-06 15:19:10 UTC (rev 12567)
@@ -0,0 +1,106 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program 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.
+ */
+/**
+ * tdmcreate module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package tdmcreate
+ * @since 2.5.0
+ * @author Txmod Xoops http://www.txmodxoops.org
+ * @version $Id: abstract.php 12258 2014-01-02 09:33:29Z timgno $
+ */
+
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+/**
+ * Abstract base class
+ */
+abstract class TDMCreateAbstract
+{
+ /**
+ * "module" attribute of the files
+ *
+ * @var mixed
+ */
+ private $module = null;
+
+ /**
+ * "table" attribute of the files
+ *
+ * @var mixed
+ */
+ private $table = null;
+
+ /**
+ * "field" attribute of the files
+ *
+ * @var mixed
+ */
+ private $fields = null;
+
+ /**
+ * public function setFileName
+ * @param mixed $module
+ */
+ public function setModule($module) {
+ $this->module = $module;
+ }
+
+ /*
+ * @public function getModule
+ * @param null
+ */
+ public function getModule() {
+ return $this->module;
+ }
+
+ /**
+ * public function setTable
+ * @param mixed $table
+ */
+ public function setTable($table) {
+ $this->table = $table;
+ }
+
+ /*
+ * @public function getTable
+ * @param null
+ */
+ public function getTable() {
+ return $this->table;
+ }
+
+ /**
+ * @public function setFields
+ * @param mixed $fields
+ */
+ public function setFields($fields) {
+ $this->fields = $fields;
+ }
+
+ /*
+ * @public function getFields
+ * @param null
+ */
+ public function getFields() {
+ return $this->fields;
+ }
+
+ /**
+ * Generates output for the files.
+ *
+ * This method is abstract and must be overwritten by the child classes.
+ *
+ * @abstract
+ */
+ public function render() {}
+}
\ No newline at end of file
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstractfiles.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstractfiles.php 2014-06-05 20:34:13 UTC (rev 12566)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstractfiles.php 2014-06-06 15:19:10 UTC (rev 12567)
@@ -1,102 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program 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.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: abstractfiles.php 12258 2014-01-02 09:33:29Z timgno $
- */
-
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-/**
- * Abstract base class for files
- */
-abstract class TDMCreateAbstractFiles
-{
- /**
- * "path" attribute of the files
- *
- * @var string
- */
- private $path = TDMC_PATH;
-
- /**
- * "upload_path" attribute of the files
- *
- * @var string
- */
- private $upload_path = TDMC_UPLOAD_REPOSITORY_PATH;
-
- /**
- * "module" attribute of the files
- *
- * @var mixed
- */
- private $module = null;
-
- /**
- * "table" attribute of the files
- *
- * @var mixed
- */
- private $table = null;
-
- /**
- * "field" attribute of the files
- *
- * @var mixed
- */
- private $fields = null;
-
- /**
- * "folder" attribute of the files
- *
- * @var mixed
- */
- private $folder = null;
-
- /**
- * "filename" attribute of the files
- *
- * @var mixed
- */
- private $filename = null;
-
- /*
- * @public function getHeader
- * @param string $path
- * @param string $module
- * @param string $folder
- * @param string $file_name
- */
- public function getHeader($path, $module, $folder, $filename) {
- $this->path = $path;
- $this->folder = $folder;
- $this->module = $module;
- $this->filename = $filename;
- $ret = $this->path . DIRECTORY_SEPARATOR . $this->module . DIRECTORY_SEPARATOR . $this->folder . DIRECTORY_SEPARATOR . $this->filename;
- return $ret;
- }
-
- /**
- * Generates output for the files.
- *
- * This method is abstract and must be overwritten by the child classes.
- *
- * @abstract
- */
- public function render() {}
-}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php 2014-06-05 20:34:13 UTC (rev 12566)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php 2014-06-06 15:19:10 UTC (rev 12567)
@@ -70,8 +70,8 @@
//$filename = $this->getFileName();
$module_name = $module->getVar('mod_name');
$language = $this->getLanguage($module_name, 'MB');
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= <<<EOT
+ //$content = $this->getHeaderFilesComments($module, $filename);
+ $content = <<<EOT
<table class="outer">
<tr class="head">\n
EOT;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php 2014-06-05 20:34:13 UTC (rev 12566)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php 2014-06-06 15:19:10 UTC (rev 12567)
@@ -299,7 +299,7 @@
foreach(array_keys($fields_all) as $f)
{
$field_name = $fields_all[$f]->getVar('field_name');
- if(($f == 1) && ($this->table->getVar('table_autoincrement') == 1)) {
+ if(($f == 0) && ($this->table->getVar('table_autoincrement') == 1)) {
$fpif = $field_name;
}
if($fields_all[$f]->getVar('field_main') == 1) {
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php 2014-06-05 20:34:13 UTC (rev 12566)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php 2014-06-06 15:19:10 UTC (rev 12567)
@@ -20,37 +20,16 @@
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
-require_once 'abstractfiles.php';
+require_once 'abstract.php';
xoops_load('XoopsFile');
-class TDMCreateFile extends TDMCreateAbstractFiles
+class TDMCreateFile extends TDMCreateAbstract
{
/*
* @var string
*/
private $xoopsfile = null;
-
+
/**
- * "module" attribute of the files
- *
- * @var mixed
- */
- private $module = null;
-
- /**
- * "table" attribute of the files
- *
- * @var mixed
- */
- private $table = null;
-
- /**
- * "fields" attribute of the files
- *
- * @var mixed
- */
- private $fields = null;
-
- /**
* "filename" attribute of the files
*
* @var mixed
@@ -103,7 +82,7 @@
* @param null
*/
public function __construct() {
- $this->xoopsfile = XoopsFile::getHandler();
+ $this->xoopsfile = XoopsFile::getHandler();
}
/*
@@ -121,6 +100,7 @@
/*
* @public function create
* @param string $module_name
+ * @param string $subdir
* @param string $filename
* @param string $content
* @param mixed $created
@@ -188,83 +168,8 @@
private function getSubDir() {
return $this->subdir;
}
-
- /**
- * public function setFileName
- * @param mixed $module
- */
- public function setModule($module) {
- $this->module = $module;
- }
- /*
- * @public function getModule
- * @param null
- */
- public function getModule()
- {
- return $this->module;
- }
-
/**
- * public function setTable
- * @param mixed $table
- */
- public function setTable($table) {
- $this->table = null;
- if (!is_object($table) || ($table instanceof TDMCreateTables)) {
- $this->table = (object)$table;
- } elseif (is_array($table)) {
- $this->table[] = $table;
- }
- }
-
- /*
- * @public function getTable
- * @param null
- */
- public function getTable() {
- if (is_array($this->table)) {
- $ret = array();
- foreach($this->table as $table) {
- $ret[] = $table;
- }
- return $ret;
- } elseif (!is_object($this->table)) {
- return (object)$this->table;
- }
- }
-
- /**
- * @public function setFields
- * @param mixed $fields
- */
- public function setFields($fields) {
- $this->fields = null;
- if (is_object($fields) || ($fields instanceof TDMCreateFields)) {
- $this->fields = $fields;
- } elseif (is_array($fields)) {
- $this->fields[] = $fields;
- }
- }
-
- /*
- * @public function getFields
- * @param null
- */
- public function getFields() {
- if (is_array($this->fields)) {
- $ret = array();
- foreach ($this->fields as $fields) {
- $ret[] = $fields;
- }
- return $ret;
- } else {
- return $this->fields;
- }
- }
-
- /**
* public function setFileName
* @param mixed $file_name
*/
@@ -302,9 +207,9 @@
*/
private function getFolderName() {
$path = $this->getUploadPath();
- if(strrpos($path, '/'))
+ if(strrpos($path, '\\'))
{
- $str = strrpos($path, '/');
+ $str = strrpos($path, '\\');
if($str !== false){
return substr($path, $str + 1, strlen($path));
} else {
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php 2014-06-05 20:34:13 UTC (rev 12566)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php 2014-06-06 15:19:10 UTC (rev 12567)
@@ -76,7 +76,7 @@
*/
public function getXoopsFormText($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormText({$language}, '{$field_name}', 50, 255, \$this->getVar('{$field_name}')), {$required});\n
+ \$form->addElement(new XoopsFormText({$language}, '{$field_name}', 50, 255, \$this->getVar('{$field_name}')){$required});\n
EOT;
return $ret;
}
@@ -88,7 +88,7 @@
*/
public function getXoopsFormTextArea($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormTextArea({$language}, '{$field_name}', \$this->getVar('{$field_name}'), 4, 47), {$required});\n
+ \$form->addElement(new XoopsFormTextArea({$language}, '{$field_name}', \$this->getVar('{$field_name}'), 4, 47){$required});\n
EOT;
return $ret;
}
@@ -109,7 +109,7 @@
\$editor_configs['width'] = '100%';
\$editor_configs['height'] = '400px';
\$editor_configs['editor'] = xoops_getModuleOption('{$module_name}_editor', '{$module_name}');
- \$form->addElement( new XoopsFormEditor({$language}, '{$field_name}', \$editor_configs), {$required} );\n
+ \$form->addElement( new XoopsFormEditor({$language}, '{$field_name}', \$editor_configs){$required});\n
EOT;
return $ret;
}
@@ -124,7 +124,7 @@
\${$field_name} = \$this->isNew() ? 0 : \$this->getVar('{$field_name}');
\$check_{$field_name} = new XoopsFormCheckBox({$language}, '{$field_name}', \${$field_name});
\$check_{$field_name}->addOption(1, " ");
- \$form->addElement(\$check_{$field_name}, {$required});\n
+ \$form->addElement(\$check_{$field_name}{$required});\n
EOT;
return $ret;
}
@@ -146,7 +146,7 @@
*/
public function getXoopsFormUploadFile($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormUploadFile({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});\n
+ \$form->addElement(new XoopsFormUploadFile({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']){$required});\n
EOT;
return $ret;
}
@@ -158,7 +158,7 @@
*/
public function getXoopsFormUploadImage($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormUploadImage({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});\n
+ \$form->addElement(new XoopsFormUploadImage({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']){$required});\n
EOT;
return $ret;
}
@@ -170,11 +170,26 @@
*/
public function getXoopsFormColorPicker($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormColorPicker({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});\n
+ \$form->addElement(new XoopsFormColorPicker({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']){$required});\n
EOT;
return $ret;
}
/*
+ * @public function getXoopsFormSelect
+ * @param string $language
+ * @param string $table_name
+ * @param string $field_name
+ * @param string $required
+ */
+ public function getXoopsFormSelect($language, $table_name, $field_name, $required = 'false') {
+ $ret = <<<EOT
+ \${$field_name}_select = new XoopsFormSelect({$language}, '{$field_name}', \$this->getVar('{$field_name}'));
+ \${$field_name}_select->addOptionArray({$table_name}Handler->getList());
+ \$form->addElement(\${$field_name}_select{$required});\n
+EOT;
+ return $ret;
+ }
+ /*
* @public function getXoopsFormSelectUser
* @param string $language
* @param string $field_name
@@ -182,7 +197,7 @@
*/
public function getXoopsFormSelectUser($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormSelectUser({$language}, '{$field_name}', false, \$this->getVar('{$field_name}'), 1, false), {$required});\n
+ \$form->addElement(new XoopsFormSelectUser({$language}, '{$field_name}', false, \$this->getVar('{$field_name}'), 1, false){$required});\n
EOT;
return $ret;
}
@@ -195,7 +210,7 @@
public function getXoopsFormRadioYN($language, $field_name, $required = 'false') {
$ret = <<<EOT
${$field_name} = \$this->isNew() ? 0 : \$this->getVar('{$field_name}');
- \$form->addElement(new XoopsFormRadioYN({$language}, '{$field_name}', ${$field_name}), {$required});\n
+ \$form->addElement(new XoopsFormRadioYN({$language}, '{$field_name}', ${$field_name}){$required});\n
EOT;
return $ret;
}
@@ -207,7 +222,7 @@
*/
public function getXoopsFormTextDateSelect($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormTextDateSelect({$language}, '{$field_name}', '', \$this->getVar('{$field_name}')), {$required});\n
+ \$form->addElement(new XoopsFormTextDateSelect({$language}, '{$field_name}', '', \$this->getVar('{$field_name}')){$required});\n
EOT;
return $ret;
}
@@ -216,6 +231,7 @@
* @param string $language
* @param string $module_name
* @param string $table_name
+ * @param string $fields
* @param string $required
*/
public function getXoopsFormTable($language, $module_name, $table_name, $fields, $required = 'false')
@@ -231,7 +247,7 @@
\${$table_name}Handler =& xoops_getModuleHandler('{$table_name}', '{$module_name}');
\${$field_name}_select = new XoopsFormSelect({$language}, '{$field_name}', \$this->getVar('{$field_name}'));
\${$field_name}_select->addOptionArray(\${$field_name}Handler->getList());
- \$form->addElement(\${$field_name}_select, {$required});\n
+ \$form->addElement(\${$field_name}_select{$required});\n
XFT;
return $ret;
}
@@ -265,7 +281,7 @@
if(\${$table_name}) {
\${$table_name}_tree = new XoopsObjectTree( \${$table_name}, '{$field_id}', '{$field_pid}' );
\${$field_pid} = \${$table_name}_tree->makeSelBox( '{$field_pid}', '{$field_main}','--', \$this->getVar('{$field_pid}', 'e' ), true );
- \$form->addElement( new XoopsFormLabel ( {$language}, \${$field_pid} ), {$required} );
+ \$form->addElement( new XoopsFormLabel ( {$language}, \${$field_pid} ){$required});
}\n
XFT;
return $ret;
@@ -277,7 +293,8 @@
public function renderElement() {
$module_name = $this->module->getVar('mod_name');
$table_name = $this->table->getVar('table_name');
- $language = $this->getLanguage($module_name, 'AM');
+ $language_funct = $this->getLanguage($module_name, 'AM');
+ $language_table = $language_funct . strtoupper($table_name);
$ret = '';
$table_id = $this->table->getVar('table_id');
$criteria_fields = new CriteriaCompo();
@@ -288,8 +305,8 @@
{
$field_name = $fields_all[$f]->getVar('field_name');
$field_element = $fields_all[$f]->getVar('field_element');
- $language = $language . strtoupper($table_name) . '_' . strtoupper($field_name);
- $required = ( $fields_all[$f]->getVar('field_required') == 1 ) ? 'true' : 'false';
+ $language = $language_funct . strtoupper($field_name);
+ $required = ( $fields_all[$f]->getVar('field_required') == 1 ) ? ', true' : '';
//
switch($field_element)
{
@@ -306,27 +323,28 @@
$ret .= $this->getXoopsFormCheckBox($language, $field_name, $required);
break;
case 5:
- $ret .= $this->getXoopsFormHidden($field_name);
+ $ret .= $this->getXoopsFormRadioYN($language, $field_name, $required);
break;
case 6:
- $ret .= $this->getXoopsFormUploadFile($language, $field_name, $required);
+ $ret .= $this->getXoopsFormSelect($language, $table_name, $field_name, $required);
break;
case 7:
- $ret .= $this->getXoopsFormUploadImage($language, $field_name, $required);
+ $ret .= $this->getXoopsFormSelectUser($language, $field_name, $required);
break;
case 8:
$ret .= $this->getXoopsFormColorPicker($language, $field_name, $required);
break;
case 9:
- $ret .= $this->getXoopsFormSelectUser($language, $field_name, $required);
+ $ret .= $this->getXoopsFormUploadImage($language, $field_name, $required);
break;
case 10:
- $ret .= $this->getXoopsFormRadioYN($language, $field_name, $required);
+ $ret .= $this->getXoopsFormUploadFile($language, $field_name, $required);
break;
case 11:
$ret .= $this->getXoopsFormTextDateSelect($language, $field_name, $required);
break;
- default:
+ default:
+ $ret .= $this->getXoopsFormHidden($field_name);
break;
}
if ($field_element > 11) {
|