|
From: <txm...@us...> - 2014-04-15 17:29:41
|
Revision: 12449
http://sourceforge.net/p/xoops/svn/12449
Author: txmodxoops
Date: 2014-04-15 17:29:33 +0000 (Tue, 15 Apr 2014)
Log Message:
-----------
Toggle temporarily disabled, display problems in the lists Table and Fields
Browsers: Firefox and Opera.
Possible conflicts with class="<{cycle values='even,odd'}>"
Work in progress
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/css/admin/style.css
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/common.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_fields.html
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_modules.html
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_tables.html
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/xoops_version.php
Added Paths:
-----------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tdmcreate.php
Removed Paths:
-------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/themeform.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -47,6 +47,7 @@
$adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add');
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
$GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL);
+ $GLOBALS['xoopsTpl']->assign('tdmc_icons_url', TDMC_ICONS_URL);
$GLOBALS['xoopsTpl']->assign('tdmc_upload_url', TDMC_UPLOAD_URL);
$GLOBALS['xoopsTpl']->assign('pathIcon32', $pathIcon32);
// Redirect if there aren't modules
@@ -128,7 +129,7 @@
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
$obj =& $fieldsHandler->create();
- $form = $obj->getForm($field_tid, $field_mid, $field_numb, $field_name);
+ $form = $obj->getForm($field_mid, $field_tid, $field_numb, $field_name);
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
@@ -140,36 +141,40 @@
$obj =& $fieldsHandler->get($field_id);
} else {
$obj =& $fieldsHandler->create();
+ }
+ $datas = array();
+ for( $i = 0; $i < $table_nbfields; $i++ ) {
+ $datas = array('field_mid' => $table_mid[$i],
+ 'field_tid' => $table_id[$i],
+ 'field_numb' => $table_nbfields[$i],
+ 'field_name' => $_POST['field_name'][$i],
+ 'field_type' => $_POST['field_type'][$i],
+ 'field_value' => $_POST['field_value'][$i],
+ 'field_attribute' => $_POST['field_attribute'][$i],
+ 'field_null' => $_POST['field_null'][$i],
+ 'field_default' => $_POST['field_default'][$i],
+ 'field_key' => $_POST['field_key'][$i],
+ 'field_autoincrement' => (($_REQUEST['field_autoincrement'][$i] == 1) ? '1' : '0'),
+ 'field_element' => $_REQUEST['fieldelement_name'][$i],
+ 'field_inlist' => (($_REQUEST['field_inlist'][$i] == 1) ? '1' : '0'),
+ 'field_inform' => (($_REQUEST['field_inform'][$i] == 1) ? '1' : '0'),
+ 'field_admin' => (($_REQUEST['field_admin'][$i] == 1) ? '1' : '0'),
+ 'field_user' => (($_REQUEST['field_user'][$i] == 1) ? '1' : '0'),
+ 'field_block' => (($_REQUEST['field_block'][$i] == 1) ? '1' : '0'),
+ 'field_main' => (($i == $_REQUEST['field_main']) ? '1' : '0'),
+ 'field_search' => (($_REQUEST['field_search'][$i] == 1) ? '1' : '0'),
+ 'field_required' => (($_REQUEST['field_required'][$i] == 1) ? '1' : '0')
+ );
+
+ }
+ foreach ($datas as $data => $value) {
+ $obj->setVars(array($data, $value));
}
- for( $i = 0; $i < $table_nbfields; $i++ ) {
- $obj->setVars(array('field_mid' => $table_mid[$i],
- 'field_tid' => $table_id[$i],
- 'field_numb' => $table_nbfields[$i],
- 'field_name' => $_POST['field_name'][$i],
- 'field_type' => $_POST['field_type'][$i],
- 'field_value' => $_POST['field_value'][$i],
- 'field_attribute' => $_POST['field_attribute'][$i],
- 'field_null' => $_POST['field_null'][$i],
- 'field_default' => $_POST['field_default'][$i],
- 'field_key' => $_POST['field_key'][$i],
- 'field_autoincrement' => (($_REQUEST['field_autoincrement'][$i] == 1) ? '1' : '0'),
- 'field_element' => $_REQUEST['fieldelement_name'][$i],
- 'field_inlist' => (($_REQUEST['field_inlist'][$i] == 1) ? '1' : '0'),
- 'field_inform' => (($_REQUEST['field_inform'][$i] == 1) ? '1' : '0'),
- 'field_admin' => (($_REQUEST['field_admin'][$i] == 1) ? '1' : '0'),
- 'field_user' => (($_REQUEST['field_user'][$i] == 1) ? '1' : '0'),
- 'field_block' => (($_REQUEST['field_block'][$i] == 1) ? '1' : '0'),
- 'field_main' => (($i == $_REQUEST['field_main']) ? '1' : '0'),
- 'field_search' => (($_REQUEST['field_search'][$i] == 1) ? '1' : '0'),
- 'field_required' => (($_REQUEST['field_required'][$i] == 1) ? '1' : '0')
- )
- );
- }
if ($fieldsHandler->insert($obj)) {
redirect_header('fields.php', 2, _AM_TDMCREATE_FORMOK);
- }
- $GLOBALS['xoopsTpl']->assign('error', $obj->getHtmlErrors());
- $form = $obj->getForm();
+ }
+ $GLOBALS['xoopsTpl']->assign('error', $obj->getHtmlErrors());
+ $form = $obj->getForm($field_mid, $field_tid, $field_numb, $field_name);
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
@@ -183,7 +188,7 @@
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
$obj = $fieldsHandler->get($field_id);
- $form = $obj->getForm($field_tid, $field_mid, $field_numb, $field_name);
+ $form = $obj->getForm($field_mid, $field_tid, $field_numb, $field_name);
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -42,6 +42,7 @@
$adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add');
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
$GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL);
+ $GLOBALS['xoopsTpl']->assign('tdmc_icons_url', TDMC_ICONS_URL);
$GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL);
//$GLOBALS['xoopsTpl']->assign('tdmc_upload_table_url', TDMC_UPLOAD_IMGTAB_URL);
$GLOBALS['xoopsTpl']->assign('pathIcon32', $pathIcon32);
@@ -105,9 +106,9 @@
$GLOBALS['xoopsTpl']->append('modules_list', $mod);
unset($mod);
}
- if ( $numrows_modules > $limit ) {
+ if ( $nb_modules > $limit ) {
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($numrows_modules, $limit, $start, 'start', 'op=list&limit=' . $limit);
+ $pagenav = new XoopsPageNav($nb_modules, $limit, $start, 'start', 'op=list&limit=' . $limit);
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
}
} else {
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -77,13 +77,13 @@
/*
* @public function getForm
*
- * @param integer $table_id
- * @param integer $table_mid
- * @param integer $table_nbfields
- * @param string $table_fieldname
+ * @param integer $f_mid
+ * @param integer $f_tid
+ * @param integer $f_numb
+ * @param string $f_name
* @param mixed $action
*/
- public function getForm($f_tid = null, $f_mid = null, $f_numb = null, $f_name = null, $action = false)
+ public function getForm($f_mid = null, $f_tid = null, $f_numb = null, $f_name = null, $action = false)
{
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
@@ -105,7 +105,11 @@
$form->setExtra('enctype="multipart/form-data"');
$tablesHandler = xoops_getModuleHandler('tables');
- $fieldelementsHandler =& xoops_getModuleHandler('fieldelements');
+ $fieldelementsHandler =& xoops_getModuleHandler('fieldelements');
+ $fieldtypeHandler =& xoops_getModuleHandler('fieldtype');
+ $fieldattrsHandler =& xoops_getModuleHandler('fieldattributes');
+ $fieldnullHandler =& xoops_getModuleHandler('fieldnull');
+ $fieldkeyHandler =& xoops_getModuleHandler('fieldkey');
// New Object HtmlTable
$form->addElement(new TDMCreateFormLabel('<table class="outer">'));
$form->addElement(new TDMCreateFormLabel('<thead class="center"><tr class="width5">'));
@@ -132,21 +136,18 @@
$field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$i.']', 15, 255, $field_name);
// Field Name
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_name->render().'</td>'));
- // Field Type
- $fieldtypeHandler =& xoops_getModuleHandler('fieldtype');
+ // Field Type
$fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$i.']', $this->getVar('field_type'));
$fieldtype_select->addOptionArray($fieldtypeHandler->getList());
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$fieldtype_select->render().'</td>'));
// Field Value
$field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value['.$i.']', 5, 20, $this->getVar('field_value'));
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_value->render().'</td>'));
- // Field Attributes
- $fieldattrsHandler =& xoops_getModuleHandler('fieldattributes');
+ // Field Attributes
$field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute['.$i.']', $this->getVar('field_attribute'));
$field_attributes_select->addOptionArray($fieldattrsHandler->getList());
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_attributes_select->render().'</td>'));
- // Field Null
- $fieldnullHandler =& xoops_getModuleHandler('fieldnull');
+ // Field Null
$field_null_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null['.$i.']', $this->getVar('field_null'));
$field_null_select->addOptionArray($fieldnullHandler->getList());
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_null_select->render().'</td>'));
@@ -154,7 +155,6 @@
$field_default = new XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default['.$i.']', 15, 25, $this->getVar('field_default'));
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_default->render().'</td>'));
// Field Key
- $fieldkeyHandler =& xoops_getModuleHandler('fieldkey');
$field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key['.$i.']', $this->getVar('field_key'));
$field_key_select->addOptionArray($fieldkeyHandler->getList());
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_key_select->render().'</td>'));
@@ -226,7 +226,7 @@
$parameters_tray->addElement($check_field_required);
$form->addElement(new TDMCreateFormLabel('<td>'.$parameters_tray->render().'</td></tr>'));
- }
+ }
$form->addElement(new XoopsFormHidden('field_id['.$i.']', $i));
}
@@ -242,6 +242,20 @@
$form->addElement(new TDMCreateFormLabel('</tr></tfoot></table>'));
return $form;
}
+
+ /*
+ * @public function toArray
+ * @param null
+ */
+ public function toArray() {
+ $ret = parent::toArray();
+ $f_tid = $this->table->getVar('table_id');
+ $f_mid = $this->table->getVar('table_mid');
+ $f_numb = $this->table->getVar('table_nbfields');
+ $f_name = $this->table->getVar('table_fieldname');
+ $ret['edit_form'] = $this->getForm($f_tid, $f_mid, $f_numb, $f_name);
+ return $ret;
+ }
}
/*
* @Class TDMCreateFieldsHandler
@@ -263,4 +277,312 @@
$this->table = TDMCreateTables::getInstance();
parent::__construct($db, 'mod_tdmcreate_fields', 'tdmcreatefields', 'field_id', 'field_tid');
}
+
+ /*
+ * @public function getFieldModuleId
+ * @param integer $field_id
+ */
+ public function getFieldModuleId($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ return $obj[0]['field_mid'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldTableId
+ * @param integer $field_id
+ */
+ public function getFieldTableId($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ return $obj[0]['field_tid'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldName
+ * @param integer $field_id
+ */
+ public function getFieldName($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (!empty($obj[0]['field_name']))
+ return strtolower($obj[0]['field_name']);
+ else
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldType
+ * @param integer $field_id
+ */
+ public function getFieldType($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_type']))
+ return $obj[0]['field_type'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldValue
+ * @param integer $field_id
+ */
+ public function getFieldValue($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (!empty($obj[0]['field_value']) && is_numeric($obj[0]['field_value']))
+ return intval($obj[0]['field_value']);
+ else
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldAttribute
+ * @param integer $field_id
+ */
+ public function getFieldAttribute($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_attribute']))
+ return $obj[0]['field_attribute'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldNull
+ * @param integer $field_id
+ */
+ public function getFieldNull($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_null']))
+ return $obj[0]['field_null'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldDefault
+ * @param integer $field_id
+ */
+ public function getFieldDefault($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (!empty($obj[0]['field_default']))
+ return strtolower($obj[0]['field_default']);
+ else
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldKey
+ * @param integer $field_id
+ */
+ public function getFieldKey($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_key']))
+ return $obj[0]['field_key'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldAutoIncrement
+ * @param integer $field_id
+ */
+ public function getFieldAutoIncrement($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_autoincrement']))
+ return $obj[0]['field_autoincrement'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldElement
+ * @param integer $field_id
+ */
+ public function getFieldElement($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_element']))
+ return $obj[0]['field_element'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldInLst
+ * @param integer $field_id
+ */
+ public function getFieldInLst($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_inlist']))
+ return $obj[0]['field_inlist'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldInForm
+ * @param integer $field_id
+ */
+ public function getFieldInForm($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_inform']))
+ return $obj[0]['field_inform'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldAdmin
+ * @param integer $field_id
+ */
+ public function getFieldAdmin($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_admin']))
+ return $obj[0]['field_admin'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldUser
+ * @param integer $field_id
+ */
+ public function getFieldUser($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_user']))
+ return $obj[0]['field_user'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldBlock
+ * @param integer $field_id
+ */
+ public function getFieldBlock($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_block']))
+ return $obj[0]['field_block'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldMain
+ * @param integer $field_id
+ */
+ public function getFieldMain($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_main']))
+ return $obj[0]['field_main'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldSearch
+ * @param integer $field_id
+ */
+ public function getFieldSearch($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_search']))
+ return $obj[0]['field_search'];
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @public function getFieldRequired
+ * @param integer $field_id
+ */
+ public function getFieldRequired($field_id)
+ {
+ $criteria = new Criteria('field_id', $field_id );
+ if ($this->getCount($criteria) > 0) {
+ $obj = $this->getObjects($criteria, false, false );
+ if (isset($obj[0]['field_required']))
+ return $obj[0]['field_required'];
+ } else {
+ return false;
+ }
+ }
}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -91,11 +91,13 @@
$form->setExtra('enctype="multipart/form-data"');
//
$modulesHandler =& xoops_getModuleHandler('modules');
+ $modules = $modulesHandler->getObjects(null);
$mods_select = new XoopsFormSelect(_AM_TDMCREATE_TABLE_MODULES, 'table_mid', $table_mid);
//$mods_select->setExtra('onchange="window.location=\'\'+this.options[this.selectedIndex].value"');
+ //$mods_select->setValue('table.php?op=new&table_mid='.$table_mid);$action.'table.php?op=new&table_mid='.
$mods_select->addOption($action, _AM_TDMCREATE_TABLE_MODSELOPT);
- foreach ($modulesHandler->getList() as $mod_id => $mod_name) {
- $mods_select->addOption($mod_id, $mod_name);
+ foreach ($modules as $mod) {
+ $mods_select->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name'));
}
//$mods_select->addOptionArray();
$form->addElement($mods_select, true);
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tdmcreate.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tdmcreate.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tdmcreate.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -0,0 +1,173 @@
+<?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 trabis <lus...@gm...>
+ * @version $Id: tdmcreate.php 12258 2014-04-12 23:45:12Z timgno $
+ */
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+class TDMCreate
+{
+ /**
+ * @var string
+ */
+ private $dirname = null;
+ /**
+ * @var string
+ */
+ private $module = null;
+ /**
+ * @var string
+ */
+ private $handler = null;
+ /**
+ * @var string
+ */
+ private $config = null;
+ /**
+ * @var string
+ */
+ private $debug = null;
+ /**
+ * @var array
+ */
+ private $debugArray = array();
+ /*
+ * @protected function constructor class
+ * @param mixed $debug
+ */
+ protected function __construct($debug)
+ {
+ $this->debug = $debug;
+ $this->dirname = basename(dirname(dirname(__FILE__)));
+ }
+ /*
+ * @static function &getInstance
+ * @param mixed $debug
+ */
+ public static function &getInstance($debug = false)
+ {
+ static $instance = false;
+ if (!$instance) {
+ $instance = new self($debug);
+ }
+ return $instance;
+ }
+ /*
+ * @static function getModule
+ * @param null
+ */
+ public function &getModule()
+ {
+ if ($this->module == null) {
+ $this->initModule();
+ }
+ return $this->module;
+ }
+ /*
+ * @static function getConfig
+ * @param string $name
+ */
+ public function getConfig($name = null)
+ {
+ if ($this->config == null) {
+ $this->initConfig();
+ }
+ if (!$name) {
+ $this->addLog("Getting all config");
+ return $this->config;
+ }
+ if (!isset($this->config[$name])) {
+ $this->addLog("ERROR :: CONFIG '{$name}' does not exist");
+ return null;
+ }
+ $this->addLog("Getting config '{$name}' : " . $this->config[$name]);
+ return $this->config[$name];
+ }
+ /*
+ * @static function setConfig
+ * @param string $name
+ * @param mixed $value
+ */
+ public function setConfig($name = null, $value = null)
+ {
+ if ($this->config == null) {
+ $this->initConfig();
+ }
+ $this->config[$name] = $value;
+ $this->addLog("Setting config '{$name}' : " . $this->config[$name]);
+ return $this->config[$name];
+ }
+ /*
+ * @static function getHandler
+ * @param string $name
+ */
+ public function &getHandler($name)
+ {
+ if (!isset($this->handler[$name . '_handler'])) {
+ $this->initHandler($name);
+ }
+ $this->addLog("Getting handler '{$name}'");
+ return $this->handler[$name . '_handler'];
+ }
+ /*
+ * @static function initModule
+ * @param null
+ */
+ public function initModule()
+ {
+ global $xoopsModule;
+ if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $this->dirname) {
+ $this->module = $xoopsModule;
+ } else {
+ $hModule = xoops_gethandler('module');
+ $this->module = $hModule->getByDirname($this->dirname);
+ }
+ $this->addLog('INIT MODULE');
+ }
+ /*
+ * @static function initConfig
+ * @param null
+ */
+ public function initConfig()
+ {
+ $this->addLog('INIT CONFIG');
+ $hModConfig = xoops_gethandler('config');
+ $this->config = $hModConfig->getConfigsByCat(0, $this->getModule()->getVar('mid'));
+ }
+ /*
+ * @static function initHandler
+ * @param string $name
+ */
+ public function initHandler($name)
+ {
+ $this->addLog('INIT ' . $name . ' HANDLER');
+ $this->handler[$name . '_handler'] = xoops_getModuleHandler($name, $this->dirname);
+ }
+ /*
+ * @static function addLog
+ * @param string $log
+ */
+ public function addLog($log)
+ {
+ if ($this->debug) {
+ if (is_object($GLOBALS['xoopsLogger'])) {
+ $GLOBALS['xoopsLogger']->addExtra($this->module->name(), $log);
+ }
+ }
+ }
+}
\ No newline at end of file
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/themeform.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/themeform.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/themeform.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -1,65 +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.5
- * @author Txmod Xoops <su...@tx...>
- * @version $Id: 1.59 themeform.php 11297 2013-03-24 10:58:10Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-xoops_load('XoopsFormLoader');
-
-/**
- * Form that will output as a theme-enabled HTML table
- *
- * Also adds JavaScript to validate required fields
- */
-class TDMCreateThemeForm extends XoopsForm
-{
- /**
- * create HTML to output the form as a theme-enabled table with validation.
- *
- * YOU SHOULD AVOID TO USE THE FOLLOWING Nocolspan METHOD, IT WILL BE REMOVED
- *
- * To use the noColspan simply use the following example:
- *
- * $colspan = new XoopsFormDhtmlTextArea( '', 'key', $value, '100%', '100%' );
- * $colspan->setNocolspan();
- * $form->addElement( $colspan );
- *
- * @return string
- */
- public function render()
- {
- $ele_name = $this->getName();
- $ret = ($this->getTitle() ? '<div class=" center head ">' . $this->getTitle() . '</div>' : '');
- $ret .= NWLINE . '<form name="' . $ele_name . '" id="' . $ele_name . '" action="' . $this->getAction() . '" method="' . $this->getMethod() . '" onsubmit="return xoopsFormValidate_' . $ele_name . '();"' . $this->getExtra() . '>' . NWLINE;
- $hidden = '';
- $class = 'even';
- foreach ($this->getElements() as $ele) {
- if (!is_object($ele)) {
- $ret .= $ele;
- } else if (!$ele->isHidden()) {
- $ret .= $ele->render();
- } else {
- $hidden .= $ele->render();
- }
- }
- $ret .= NWLINE . ' ' . $hidden . NWLINE . '</form>';
- $ret .= $this->renderValidationJS(true);
- return $ret;
- }
-}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/css/admin/style.css
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/css/admin/style.css 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/css/admin/style.css 2014-04-15 17:29:33 UTC (rev 12449)
@@ -28,10 +28,12 @@
}
img.imageToggle {
- width: 16px;
- height: 16px;
+ width: 16px;
+ height: 16px;
}
+.move { cursor: move; }
+
.width6{ width: 6%; }
.bred {background-color:rgba(255,0,0,0.3);} / * red */
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/common.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/common.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/common.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -22,8 +22,14 @@
die('XOOPS root path not defined');
}
$dirname = $GLOBALS['xoopsModule']->getVar('dirname');
+// Local Directories
define('TDMC_PATH', XOOPS_ROOT_PATH . '/modules/' . $dirname );
define('TDMC_URL', XOOPS_URL . '/modules/' . $dirname );
+define('TDMC_IMAGE_PATH', TDMC_PATH . '/images' );
+define('TDMC_IMAGE_URL', TDMC_URL . '/images' );
+define('TDMC_ICONS_PATH', TDMC_IMAGE_PATH . '/icons' );
+define('TDMC_ICONS_URL', TDMC_IMAGE_URL . '/icons' );
+// Uploads Directories
define('TDMC_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $dirname );
define('TDMC_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $dirname );
define('TDMC_UPLOAD_MODULES_PATH', TDMC_UPLOAD_PATH . '/modules' );
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -54,6 +54,49 @@
if (!$r) return false;
return true;
}
+
+/**
+ * Copy a file, or a folder and its contents
+ *
+ * @author Aidan Lister <ai...@ph...>
+ * @version 1.0.0
+ * @param string $source The source
+ * @param string $dest The destination
+ * @return bool Returns true on success, false on failure
+ */
+function TDMCreate_copyr($source, $dest)
+{
+ // Simple copy for a file
+ if (is_file($source)) {
+ return copy($source, $dest);
+ }
+
+ // Make destination directory
+ if (!is_dir($dest)) {
+ mkdir($dest);
+ }
+
+ // Loop through the folder
+ $dir = dir($source);
+ while (false !== $entry = $dir->read()) {
+ // Skip pointers
+ if ($entry == '.' || $entry == '..') {
+ continue;
+ }
+
+ // Deep copy directories
+ if (is_dir("$source/$entry") && ($dest !== "$source/$entry")) {
+ copyr("$source/$entry", "$dest/$entry");
+ } else {
+ copy("$source/$entry", "$dest/$entry");
+ }
+ }
+
+ // Clean up
+ $dir->close();
+ return true;
+}
+
/*
if(function_exists(isset($_GET['f']))) { // get function name and parameter $_GET['f']($_GET["p"]);
include_once TDMC_PATH . '/class/modules.php';
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_fields.html
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_fields.html 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_fields.html 2014-04-15 17:29:33 UTC (rev 12449)
@@ -22,9 +22,9 @@
</thead>
<tbody>
<{foreach item=table from=$tables_list}>
- <tr class="<{cycle values='even,odd'}> toggleMain">
+ <tr id="table<{$table.id}>" class="<{cycle values='even,odd'}>">
<td class='center'><{$table.id}><br />
- <a href="#" title="Toggle"><img class="imageToggle" src="<{$tdmc_url}>/images/icons/16/toggle.png" alt="Toggle" /></a>
+ <a href="#" title="Toggle"><img class="imageToggle" src="<{$tdmc_icons_url}>/16/toggle.png" alt="Toggle" /></a>
</td>
<td class='center'><u><{$table.name}></u></td>
<td class='center'><img src="<{$pathIcon32}>/<{$table.image}>" alt="<{$table.name}>" height="30" /></td>
@@ -82,8 +82,8 @@
</td>
</tr>
<{foreach item=field from=$table.fields}>
- <tr class="<{cycle values='even,odd'}> toggleChild">
- <td class='center'><{$field.id}> <img src="<{$tdmc_url}>/images/icons/16/drag.png" alt="<{$field.name}>" height="16" /></td>
+ <tr class="<{cycle values='even,odd'}>">
+ <td class='center'><{$field.id}> <img class="move" src="<{$tdmc_icons_url}>/16/drag.png" alt="<{$field.name}>" /></td>
<td class='center'><{$field.name}></td>
<td class='center' colspan="11"> </td>
</tr>
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_modules.html
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_modules.html 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_modules.html 2014-04-15 17:29:33 UTC (rev 12449)
@@ -19,7 +19,7 @@
<th class='center width5'><{$smarty.const._AM_TDMCREATE_FORMACTION}></th>
</tr>
<{foreach item=module from=$modules_list}>
- <tr class="<{cycle values='even,odd'}>">
+ <tr id="module<{$module.id}>" class="<{cycle values='even,odd'}>">
<td class='center'><{$module.id}></td>
<td class='center'><{$module.name}></td>
<td class='center'><{$module.version}></td>
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_tables.html
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_tables.html 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_tables.html 2014-04-15 17:29:33 UTC (rev 12449)
@@ -22,9 +22,9 @@
</thead>
<tbody>
<{foreach item=module from=$modules_list}>
- <tr id="module<{$module.id}>" class="<{cycle values='even,odd'}> toggleMain">
+ <tr id="module<{$module.id}>" class="<{cycle values='even,odd'}>">
<td class='center'><{$module.id}><br />
- <a href="#" title="Toggle"><img class="imageToggle" src="<{$tdmc_url}>/images/icons/16/toggle.png" alt="Toggle" /></a>
+ <a href="#" title="Toggle"><img class="imageToggle" src="<{$tdmc_icons_url}>/16/toggle.png" alt="Toggle" /></a>
</td>
<td class='center'><{$module.name}></td>
<td class='center'><img src="<{$tdmc_upload_imgmod_url}>/<{$module.image}>" height="32" /></td>
@@ -71,7 +71,7 @@
</td>
</tr>
<{foreach item=table from=$module.tables}>
- <tr class="<{cycle values='even,odd'}> toggleChild">
+ <tr id="table<{$table.id}>" class="<{cycle values='even,odd'}>">
<td class='center'><{$table.id}></td>
<td class='center'><{$table.name}></td>
<td class='center'><img src="<{xoModuleIcons32}><{$table.image}>" alt="<{$table.name}>" height="30" /></td>
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/xoops_version.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/xoops_version.php 2014-04-15 09:16:07 UTC (rev 12448)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/xoops_version.php 2014-04-15 17:29:33 UTC (rev 12449)
@@ -411,5 +411,5 @@
$modversion['config'][$i]['description'] = "";
$modversion['config'][$i]['formtype'] = "textbox";
$modversion['config'][$i]['valuetype'] = "text";
-$modversion['config'][$i]['default'] = '12435';
+$modversion['config'][$i]['default'] = '12443';
unset($i);
\ No newline at end of file
|