|
From: <txm...@us...> - 2014-06-26 16:32:08
|
Revision: 12649
http://sourceforge.net/p/xoops/svn/12649
Author: txmodxoops
Date: 2014-06-26 16:32:04 +0000 (Thu, 26 Jun 2014)
Log Message:
-----------
- Fixed bugs
- Still work to do
Modified Paths:
--------------
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/logoGenerator.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-06-26 10:30:26 UTC (rev 12648)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-06-26 16:32:04 UTC (rev 12649)
@@ -139,8 +139,8 @@
$adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list');
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
- $obj =& $tdmcreate->getHandler('tables')->create();
- $form = $obj->getForm();
+ $tablesObj =& $tdmcreate->getHandler('tables')->create();
+ $form = $tablesObj->getForm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
@@ -148,68 +148,77 @@
if ( !$GLOBALS['xoopsSecurity']->check() ) {
redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
- $tables =& $tdmcreate->getHandler('tables');
- // Checking if table name exist
- $table_name_search = $tables->getObjects(null);
- foreach (array_keys($table_name_search) as $t)
- {
- if( ($table_name_search[$t]->getVar('table_name') === $_POST['table_name']) &&
- ($table_name_search[$t]->getVar('table_mid') === $table_mid) &&
- ($table_name_search[$t]->getVar('table_id') === $table_id)) {
- redirect_header('tables.php?op=new', 10, sprintf(_AM_TDMCREATE_ERROR_TABLE_NAME_EXIST, $_POST['table_name']));
- }
- }
- if (isset($table_id)) {
- $obj =& $tables->get($table_id);
- } else {
- $obj =& $tables->create();
- }
- // Form save tables
- $obj->setVars(array('table_mid' => $table_mid,
- 'table_name' => $_POST['table_name'],
- 'table_category' => (($_REQUEST['table_category'] == 1) ? '1' : '0'),
- 'table_nbfields' => $table_nbfields,
- 'table_fieldname' => $table_fieldname));
- //Form table_image
- include_once XOOPS_ROOT_PATH.'/class/uploader.php';
- $uploaddir = is_dir($sysPathIcon32) ? $sysPathIcon32 : TDMC_UPLOAD_IMGTAB_PATH;
- $uploader = new XoopsMediaUploader($uploaddir, $tdmcreate->getConfig('mimetypes'),
- $tdmcreate->getConfig('maxsize'), null, null);
- if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
- $extension = preg_replace( '/^.+\.([^.]+)$/sU' , '\\1' , $_FILES['attachedfile']['name']);
- $name_img = $_POST['table_name'].'.'.$extension;
- $uploader->setPrefix($name_img);
- $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
- if (!$uploader->upload()) {
- $errors = $uploader->getErrors();
- redirect_header('javascript:history.go(-1)', 3, $errors);
+ $tables =& $tdmcreate->getHandler('tables');
+ if (!isset($table_id)) {
+ // Checking if table name exist
+ $table_name_search = $tables->getObjects(null);
+ foreach (array_keys($table_name_search) as $t)
+ {
+ if( ($table_name_search[$t]->getVar('table_name') === $_POST['table_name']) &&
+ ($table_name_search[$t]->getVar('table_mid') === $table_mid) &&
+ ($table_name_search[$t]->getVar('table_id') === $table_id)) {
+ redirect_header('tables.php?op=new', 10, sprintf(_AM_TDMCREATE_ERROR_TABLE_NAME_EXIST, $_POST['table_name']));
+ exit();
+ }
+ }
+ } else {
+ if (isset($table_id)) {
+ $tablesObj =& $tables->get($table_id);
+ } else {
+ $tablesObj =& $tables->create();
+ }
+ // Form save tables
+ $tablesObj->setVars(array('table_mid' => $table_mid,
+ 'table_name' => $_POST['table_name'],
+ 'table_category' => (($_REQUEST['table_category'] == 1) ? '1' : '0'),
+ 'table_nbfields' => $table_nbfields,
+ 'table_fieldname' => $table_fieldname));
+ //Form table_image
+ include_once XOOPS_ROOT_PATH.'/class/uploader.php';
+ $uploaddir = is_dir($sysPathIcon32) ? $sysPathIcon32 : TDMC_UPLOAD_IMGTAB_PATH;
+ $uploader = new XoopsMediaUploader($uploaddir, $tdmcreate->getConfig('mimetypes'),
+ $tdmcreate->getConfig('maxsize'), null, null);
+ if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
+ $extension = preg_replace( '/^.+\.([^.]+)$/sU' , '\\1' , $_FILES['attachedfile']['name']);
+ $name_img = $_POST['table_name'].'.'.$extension;
+ $uploader->setPrefix($name_img);
+ $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
+ if (!$uploader->upload()) {
+ $errors = $uploader->getErrors();
+ redirect_header('javascript:history.go(-1)', 3, $errors);
+ } else {
+ $tablesObj->setVar('table_image', $uploader->getSavedFileName());
+ }
} else {
- $obj->setVar('table_image', $uploader->getSavedFileName());
+ $tablesObj->setVar('table_image', $_POST['table_image']);
+ }
+ $tablesObj->setVars(array('table_blocks' => (($_REQUEST['table_blocks'] == 1) ? '1' : '0'),
+ 'table_admin' => (($_REQUEST['table_admin'] == 1) ? '1' : '0'),
+ 'table_user' => (($_REQUEST['table_user'] == 1) ? '1' : '0'),
+ 'table_submenu' => (($_REQUEST['table_submenu'] == 1) ? '1' : '0'),
+ 'table_search' => (($_REQUEST['table_search'] == 1) ? '1' : '0'),
+ 'table_comments' => (($_REQUEST['table_comments'] == 1) ? '1' : '0'),
+ 'table_notifications' => (($_REQUEST['table_notifications'] == 1) ? '1' : '0'),
+ 'table_permissions' => (($_REQUEST['table_permissions'] == 1) ? '1' : '0')));
+ //
+ if( $tables->insert($tablesObj) ) {
+ if( $tablesObj->isNew() ) {
+ $table_iid = $GLOBALS['xoopsDB']->getInsertId();
+ $table_action='&field_mid='.$table_mid.'&field_tid='.$table_iid.'&field_numb='.$table_nbfields.'&field_name='.$table_fieldname;
+ redirect_header('fields.php?op=new'.$table_action, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_SAVED_OK, $_POST['table_name']));
+ } else {
+ // Get fields where table id
+ $fields =& $tdmcreate->getHandler('fields');
+ $fieldsObj = $fields->get($table_id);
+ $fieldsObj->setVar('field_numb', $table_nbfields);
+ $fields->insert($fieldsObj);
+ redirect_header('tables.php', 5, sprintf(_AM_TDMCREATE_TABLE_FORM_UPDATED_OK, $_POST['table_name']));
+ }
}
- } else {
- $obj->setVar('table_image', $_POST['table_image']);
- }
- $obj->setVars(array('table_blocks' => (($_REQUEST['table_blocks'] == 1) ? '1' : '0'),
- 'table_admin' => (($_REQUEST['table_admin'] == 1) ? '1' : '0'),
- 'table_user' => (($_REQUEST['table_user'] == 1) ? '1' : '0'),
- 'table_submenu' => (($_REQUEST['table_submenu'] == 1) ? '1' : '0'),
- 'table_search' => (($_REQUEST['table_search'] == 1) ? '1' : '0'),
- 'table_comments' => (($_REQUEST['table_comments'] == 1) ? '1' : '0'),
- 'table_notifications' => (($_REQUEST['table_notifications'] == 1) ? '1' : '0'),
- 'table_permissions' => (($_REQUEST['table_permissions'] == 1) ? '1' : '0')));
- //
- if( $tdmcreate->getHandler('tables')->insert($obj) ) {
- if( $obj->isNew() ) {
- $table_iid = $GLOBALS['xoopsDB']->getInsertId();
- $table_action='&field_mid='.$table_mid.'&field_tid='.$table_iid.'&field_numb='.$table_nbfields.'&field_name='.$table_fieldname;
- redirect_header('fields.php?op=new'.$table_action, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_SAVED_OK, $_POST['table_name']));
- } else {
- redirect_header('tables.php', 5, sprintf(_AM_TDMCREATE_TABLE_FORM_UPDATED_OK, $_POST['table_name']));
- }
}
//
- $GLOBALS['xoopsTpl']->assign('error', $obj->getHtmlErrors());
- $form = $obj->getForm();
+ $GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors());
+ $form = $tablesObj->getForm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
@@ -221,24 +230,24 @@
$adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php?op=list', 'list');
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
- $obj = $tdmcreate->getHandler('tables')->get($table_id);
- $form = $obj->getForm();
+ $tablesObj = $tdmcreate->getHandler('tables')->get($table_id);
+ $form = $tablesObj->getForm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
case 'delete':
- $obj =& $tdmcreate->getHandler('tables')->get($table_id);
+ $tablesObj =& $tdmcreate->getHandler('tables')->get($table_id);
if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) {
if ( !$GLOBALS['xoopsSecurity']->check() ) {
redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
- if ($tdmcreate->getHandler('tables')->delete($obj)) {
+ if ($tdmcreate->getHandler('tables')->delete($tablesObj)) {
redirect_header('tables.php', 3, _AM_TDMCREATE_FORMDELOK);
} else {
- echo $obj->getHtmlErrors();
+ echo $tablesObj->getHtmlErrors();
}
} else {
- xoops_confirm(array('ok' => 1, 'table_id' => $table_id, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TDMCREATE_FORMSUREDEL, $obj->getVar('table_name')));
+ xoops_confirm(array('ok' => 1, 'table_id' => $table_id, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TDMCREATE_FORMSUREDEL, $tablesObj->getVar('table_name')));
}
break;
@@ -253,25 +262,25 @@
$table_permissions = XoopsRequest::getInt('table_permissions');
if ( $table_id > 0 ) {
- $obj =& $tdmcreate->getHandler('tables')->get($table_id);
+ $tablesObj =& $tdmcreate->getHandler('tables')->get($table_id);
if(isset($table_blocks)) {
- $obj->setVar('table_blocks', $table_blocks);
+ $tablesObj->setVar('table_blocks', $table_blocks);
} elseif(isset($table_adminm)) {
- $obj->setVar('table_admin', $table_admin);
+ $tablesObj->setVar('table_admin', $table_admin);
} elseif(isset($table_user)) {
- $obj->setVar('table_user', $table_user);
+ $tablesObj->setVar('table_user', $table_user);
} elseif(isset($table_submenu)) {
- $obj->setVar('table_submenu', $table_submenu);
+ $tablesObj->setVar('table_submenu', $table_submenu);
} elseif(isset($table_search)) {
- $obj->setVar('table_search', $table_search);
+ $tablesObj->setVar('table_search', $table_search);
} elseif(isset($table_comments)) {
- $obj->setVar('table_comments', $table_comments);
+ $tablesObj->setVar('table_comments', $table_comments);
} elseif(isset($table_notifications)) {
- $obj->setVar('table_notifications', $table_notifications);
+ $tablesObj->setVar('table_notifications', $table_notifications);
} elseif(isset($table_permissions)) {
- $obj->setVar('table_permissions', $table_permissions);
+ $tablesObj->setVar('table_permissions', $table_permissions);
}
- if ($tdmcreate->getHandler('tables')->insert($obj, true)) {
+ if ($tdmcreate->getHandler('tables')->insert($tablesObj, true)) {
redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_SUCCESS);
} else {
redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_FAILED);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-06-26 10:30:26 UTC (rev 12648)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-06-26 16:32:04 UTC (rev 12649)
@@ -209,15 +209,15 @@
if(($i == 1) && ($table_autoincrement->getVar('table_autoincrement') == 1)) {
$field_main = 0;
- $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']', $field_main);
+ $check_field_main = new XoopsFormRadio('', 'field_main', $field_main);
$check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD );
} elseif(($i == 2) && ($table_autoincrement->getVar('table_autoincrement') == 1)) {
$field_main = 1;
- $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']', $field_main);
+ $check_field_main = new XoopsFormRadio('', 'field_main', $field_main);
$check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD );
} else {
$field_main = 0;
- $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']');
+ $check_field_main = new XoopsFormRadio('', 'field_main');
$check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD );
}
$parameters_tray->addElement($check_field_main);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/logoGenerator.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/logoGenerator.php 2014-06-26 10:30:26 UTC (rev 12648)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/logoGenerator.php 2014-06-26 16:32:04 UTC (rev 12649)
@@ -71,7 +71,7 @@
imagecopy($imageModule, $imageIcon, 29, 2, 0, 0, 32, 32);
//$targetImage = TDMC_UPLOAD_IMGMOD_URL . "/" . $moduleName . "_logo.png";
- $targetImage = "/uploads/" . $dirname . "/images/modules/" . $moduleName . "_logo.png";
+ $targetImage = "/uploads/" . $dirname . "/images/repository/" . $moduleName . "_logo.png";
imagepng($imageModule, XOOPS_ROOT_PATH . $targetImage );
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php 2014-06-26 10:30:26 UTC (rev 12648)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php 2014-06-26 16:32:04 UTC (rev 12649)
@@ -253,9 +253,9 @@
$field_main = $field->getVar('field_main');
if($field_main == 1) {
- $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']', $field_main);
+ $check_field_main = new XoopsFormRadio('', 'field_main', $field_main);
} else {
- $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']');
+ $check_field_main = new XoopsFormRadio('', 'field_main');
}
$check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD );
$parameters_tray->addElement($check_field_main);
|