|
From: <txm...@us...> - 2014-06-28 09:56:03
|
Revision: 12660
http://sourceforge.net/p/xoops/svn/12660
Author: txmodxoops
Date: 2014-06-28 09:55:59 +0000 (Sat, 28 Jun 2014)
Log Message:
-----------
- Fixed bugs
- Still work to do
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/comment_functions.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/install.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php 2014-06-27 15:47:48 UTC (rev 12659)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/abstract.php 2014-06-28 09:55:59 UTC (rev 12660)
@@ -95,9 +95,9 @@
* @param mixed $tables
*/
public function setTables($tables) {
- //if (is_object($tables) && ($tables instanceof TDMCreateTables)) {
+ if (is_array($tables)) {
$this->tables = $tables;
- //}
+ }
}
/*
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php 2014-06-27 15:47:48 UTC (rev 12659)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php 2014-06-28 09:55:59 UTC (rev 12660)
@@ -55,11 +55,11 @@
$this->setTables($tables);
}
/*
- * @public function render
+ * @private function getPermissionsCodeHeader
* @param string $module_name
* @param string $language
*/
- public function getHeaderPermissionsCode($module_name, $language)
+ private function getPermissionsCodeHeader($module_name, $language)
{
$ret = <<<PRM
\ninclude_once 'header.php';
@@ -77,12 +77,13 @@
echo \$adminMenu->addNavigation('permissions.php');
-\$permission = {$module_name}_CleanVars(\$_POST, 'permission', 1, 'int');
+\$permission = {$module_name}_CleanVars(\$_REQUEST, 'permission', 1, 'int');
\$selected = array('', '', '', '');
\$selected[\$permission-1] = ' selected';
-
-\$permTableForm = new XoopsTableForm('fselperm', 'permissions.php', 'post');
-\$formSelect = new XoopsFormSelect('', 'permission', onChange='javascript: document.fselperm.submit()');
+xoops_load('XoopsFormLoader');
+\$permTableForm = new XoopsSimpleForm('', 'fselperm', 'permissions.php', 'get');
+\$formSelect = new XoopsFormSelect('', 'permission', \$permission);
+\$formSelect->setExtra('onchange="document.forms.fselperm.submit()"');
\$formSelect->addOption(\$selected[0], {$language}GLOBAL);
\$formSelect->addOption(\$selected[1], {$language}APPROVE);
\$formSelect->addOption(\$selected[2], {$language}SUBMIT);
@@ -94,11 +95,11 @@
}
/*
- * @public function render
+ * @private function getPermissionsCodeSwitch
* @param string $module_name
* @param string $language
*/
- public function getSwitchPermissionsCode($module_name, $language)
+ private function getPermissionsCodeSwitch($module_name, $language)
{
$ret = <<<PRM
\$module_id = \$xoopsModule->getVar('mid');
@@ -133,12 +134,12 @@
}
/*
- * @public function render
+ * @private function getPermissionsCodeBody
* @param string $module_name
* @param string $table_name
* @param string $language
*/
- public function getBodyPermissionsCode($module_name, $language)
+ private function getPermissionsCodeBody($module_name, $language)
{
$tables = $this->getTables();
foreach(array_keys($tables) as $t)
@@ -189,10 +190,10 @@
}
/*
- * @public function getFooterPermissionsCode
+ * @private function getPermissionsCodeFooter
* @param null
*/
- public function getFooterPermissionsCode() {
+ private function getPermissionsCodeFooter() {
$ret = <<<PRM
}
unset(\$permform);
@@ -211,10 +212,10 @@
$module_name = strtolower($module->getVar('mod_name'));
$language = $this->getLanguage($module_name, 'AM');
$content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getHeaderPermissionsCode($module_name, $language);
- $content .= $this->getSwitchPermissionsCode($module_name, $language);
- $content .= $this->getBodyPermissionsCode($module_name, $language);
- $content .= $this->getFooterPermissionsCode();
+ $content .= $this->getPermissionsCodeHeader($module_name, $language);
+ $content .= $this->getPermissionsCodeSwitch($module_name, $language);
+ $content .= $this->getPermissionsCodeBody($module_name, $language);
+ $content .= $this->getPermissionsCodeFooter();
//
$this->tdmcfile->create($module_name, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-06-27 15:47:48 UTC (rev 12659)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-06-28 09:55:59 UTC (rev 12660)
@@ -350,7 +350,7 @@
}
// Include Install File
$includeInstall = IncludeInstall::getInstance();
- $includeInstall->write($module, $tables, 'install.php');
+ $includeInstall->write($module, $table, $tables, 'install.php');
$ret[] = $includeInstall->render();
// Creation of sql file
if ( $table->getVar('table_name') != null) {
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/comment_functions.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/comment_functions.php 2014-06-27 15:47:48 UTC (rev 12659)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/comment_functions.php 2014-06-28 09:55:59 UTC (rev 12660)
@@ -64,6 +64,7 @@
$table_name = $table->getVar('table_name');
$ucf_module_name = ucfirst($module_name);
$ucf_table_name = ucfirst($table_name);
+ $filename = $this->getFileName();
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
defined('XOOPS_ROOT_PATH') or die('Restricted access');
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/install.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/install.php 2014-06-27 15:47:48 UTC (rev 12659)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/install.php 2014-06-28 09:55:59 UTC (rev 12660)
@@ -48,112 +48,159 @@
* @param mixed $tables
* @param string $filename
*/
- public function write($module, $tables, $filename) {
+ public function write($module, $table, $tables, $filename) {
$this->setModule($module);
+ $this->setTable($table);
$this->setTables($tables);
$this->setFileName($filename);
}
/*
- * @private function getHeaderInstall
+ * @private function getInstallModuleFolder
* @param string $module_name
*/
- private function getHeaderInstall($module_name) {
+ private function getInstallModuleFolder($module_name) {
$ret = <<<EOT
+//
defined('XOOPS_ROOT_PATH') or die('Restricted access');
+// Copy base file
\$indexFile = XOOPS_UPLOAD_PATH.'/index.html';
\$blankFile = XOOPS_UPLOAD_PATH.'/blank.gif';
-
// Making of "uploads/{$module_name}" folder
\${$module_name} = XOOPS_UPLOAD_PATH.'/{$module_name}';
if(!is_dir(\${$module_name}))
mkdir(\${$module_name}, 0777);
chmod(\${$module_name}, 0777);
-copy(\$indexFile, \${$module_name}.'/index.html');
+copy(\$indexFile, \${$module_name}.'/index.html');\n
EOT;
return $ret;
}
/*
- * @public function render
- * @param null
+ * @private function getHeaderTableFolder
+ * @param string $module_name
+ * @param string $table_name
*/
- public function render()
- {
- $module = $this->getModule();
- $module_name = strtolower($module->getVar('mod_name'));
- $tables = $this->getTables();
- $filename = $this->getFileName();
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= <<<EOT
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-\$indexFile = XOOPS_UPLOAD_PATH.'/index.html';
-\$blankFile = XOOPS_UPLOAD_PATH.'/blank.gif';
-
-// Making of "uploads/{$module_name}" folder
-\${$module_name} = XOOPS_UPLOAD_PATH.'/{$module_name}';
-if(!is_dir(\${$module_name}))
- mkdir(\${$module_name}, 0777);
- chmod(\${$module_name}, 0777);
-copy(\$indexFile, \${$module_name}.'/index.html');
-EOT;
- $field_element = '';
- foreach (array_keys($tables) as $t)
- {
- $table_name = $tables[$t]->getVar('table_name');
- $fields = $this->getTableFields($tables[$t]->getVar('table_id'));
- foreach(array_keys($fields) as $f)
- {
- $field_name = $fields[$f]->getVar('field_name');
- if ( ($f > 0) && ($tables[$t]->getVar('table_autoincrement') == 1) ) {
- $field_element = $fields[$f]->getVar('field_element');
- }
- if ( $f == 0 ) {
- $content .= <<<EOT
-\n// Making of {$table_name} uploads folder
+ private function getInstallTableFolder($module_name, $table_name) {
+ $ret = <<<EOT
+// Making of {$table_name} uploads folder
\${$table_name} = \${$module_name}.'/{$table_name}';
if(!is_dir(\${$table_name}))
mkdir(\${$table_name}, 0777);
chmod(\${$table_name}, 0777);
copy(\$indexFile, \${$table_name}.'/index.html');\n
EOT;
- } else {
- if ( $field_element == 9 ) {
- $content .= <<<EOT
-// Making of "{$field_name}" images folder
-\${$table_name} = \${$module_name}.'/images';
+ return $ret;
+ }
+ /*
+ * @private function getInstallImagesFolder
+ * @param string $module_name
+ */
+ private function getInstallImagesFolder($module_name) {
+ $ret = <<<EOT
+// Making of images folder
+\$images = \${$module_name}.'/images';
+if(!is_dir(\$images))
+ mkdir(\$images, 0777);
+ chmod(\$images, 0777);
+copy(\$indexFile, \$images.'/index.html');
+copy(\$blankFile, \$images.'/blank.gif');\n
+EOT;
+ return $ret;
+ }
+ /*
+ * @private function getInstallTableImagesFolder
+ * @param string $table_name
+ */
+ private function getInstallTableImagesFolder($table_name) {
+ $ret = <<<EOT
+// Making of "{$table_name}" images folder
+\${$table_name} = \$images.'/{$table_name}';
if(!is_dir(\${$table_name}))
mkdir(\${$table_name}, 0777);
chmod(\${$table_name}, 0777);
copy(\$indexFile, \${$table_name}.'/index.html');
-copy(\$blankFile, \${$table_name}.'/blank.gif');
-
-// Making of "{$field_name}" images folder
-\${$table_name} = \${$module_name}.'/images/{$table_name}';
-if(!is_dir(\${$table_name}))
- mkdir(\${$table_name}, 0777);
- chmod(\${$table_name}, 0777);
-copy(\$indexFile, \${$table_name}.'/index.html');
-copy(\$blankFile, \${$table_name}.'/blank.gif');
+copy(\$blankFile, \${$table_name}.'/blank.gif');\n
EOT;
- } elseif ( $field_element == 10 ) {
- $content .= <<<EOT
-// Making of "{$field_name}" files folder
-\${$table_name} = \${$module_name}.'/files';
+ return $ret;
+ }
+ /*
+ * @private function getInstallFilesFolder
+ * @param string $module_name
+ */
+ private function getInstallFilesFolder($module_name) {
+ $ret = <<<EOT
+// Making of files folder
+\$files = \${$module_name}.'/files';
+if(!is_dir(\$files))
+ mkdir(\$files, 0777);
+ chmod(\$files, 0777);
+copy(\$indexFile, \$files.'/index.html');\n
+EOT;
+ return $ret;
+ }
+ /*
+ * @private function getInstallTableFilesFolder
+ * @param string $table_name
+ */
+ private function getInstallTableFilesFolder($table_name) {
+ $ret = <<<EOT
+// Making of "{$table_name}" files folder
+\${$table_name} = \$files.'/{$table_name}';
if(!is_dir(\${$table_name}))
mkdir(\${$table_name}, 0777);
chmod(\${$table_name}, 0777);
-copy(\$indexFile, \${$table_name}.'/index.html');
-
-// Making of "{$field_name}" files folder
-\${$table_name} = \${$module_name}.'/files/{$table_name}';
-if(!is_dir(\${$table_name}))
- mkdir(\${$table_name}, 0777);
- chmod(\${$table_name}, 0777);
-copy(\$indexFile, \${$table_name}.'/index.html');
+copy(\$indexFile, \${$table_name}.'/index.html');\n
EOT;
- }
- }
+ return $ret;
+ }
+ /*
+ * @private function getInstallFooter
+ * @param null
+ */
+ private function getInstallFooter() {
+ $ret = <<<EOT
+// ---------- Install Footer ---------- //
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function render
+ * @param null
+ */
+ public function render()
+ {
+ $module = $this->getModule();
+ $module_name = strtolower($module->getVar('mod_name'));
+ $table = $this->getTable();
+ $tables = $this->getTables();
+ $filename = $this->getFileName();
+ $content = $this->getHeaderFilesComments($module, $filename);
+ $content .= $this->getInstallModuleFolder($module_name);
+ $fields = $this->getTableFields($table->getVar('table_id'));
+ foreach(array_keys($fields) as $f)
+ {
+ $field_element = $fields[$f]->getVar('field_element');
+ // All fields elements selected
+ switch( $field_element ) {
+ case 9:
+ $content .= $this->getInstallImagesFolder($module_name);
+ foreach(array_keys($tables) as $t)
+ {
+ $table_name = $tables[$t]->getVar('table_name');
+ $content .= $this->getInstallTableImagesFolder($table_name);
+ }
+ break;
+ case 10:
+ $content .= $this->getInstallFileFolder($module_name);
+ foreach(array_keys($tables) as $t)
+ {
+ $table_name = $tables[$t]->getVar('table_name');
+ $content .= $this->getInstallTableFilesFolder($table_name);
+ }
+ break;
}
- }
+ }
+ $content .= $this->getInstallFooter();
+ //
$this->tdmcfile->create($module_name, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php 2014-06-27 15:47:48 UTC (rev 12659)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php 2014-06-28 09:55:59 UTC (rev 12660)
@@ -129,8 +129,8 @@
'dirmoduleadmin' => "Frameworks/moduleclasses/moduleadmin",
'sysicons16' => "../../Frameworks/moduleclasses/icons/16",
'sysicons32' => "../../Frameworks/moduleclasses/icons/32",
- 'modicons16' => 'assets/images/icons/16',
- 'modicons32' => 'assets/images/icons/32',
+ 'modicons16' => "assets/images/icons/16",
+ 'modicons32' => "assets/images/icons/32",
//About
'demo_site_url' => "{$module->getVar('mod_demo_site_url')}",
'demo_site_name' => "{$module->getVar('mod_demo_site_name')}",
@@ -139,19 +139,12 @@
'module_website_url' => "{$module->getVar('mod_website_url')}",
'module_website_name' => "{$module->getVar('mod_website_name')}",
'release' => "{$module->getVar('mod_release')}",
- 'module_status' => "{$module->getVar('mod_status')}",
- // Admin system menu
- 'system_menu' => 1,\n
+ 'module_status' => "{$module->getVar('mod_status')}",\n
EOT;
- if(is_object($table)) {
- $table_admin = $table->getVar('table_admin');
- $table_user = $table->getVar('table_user');
- } else {
- $table_admin = null;
- $table_user = null;
- }
- if ( $module->getVar('mod_admin') == 1 && $table_admin == 1 ) {
+ if ( $table->getVar('table_admin') == 1 ) {
$ret .= <<<EOT
+ // Admin system menu
+ 'system_menu' => 1,
// Admin things
'hasAdmin' => 1,
'adminindex' => "admin/index.php",
@@ -165,22 +158,24 @@
'hasAdmin' => 0,\n
EOT;
}
- if ( $module->getVar('mod_user') == 1 && $table_user == 1 ) {
+ if ( $table->getVar('table_user') == 1 )
+ {
$ret .= <<<EOT
// Menu
- 'hasMain' => 1,
- // Scripts to run upon installation or update
- 'onInstall' => "include/install.php",
- 'onUpdate' => "include/update.php"
-);\n
+ 'hasMain' => 1,\n
EOT;
} else {
$ret .= <<<EOT
// Menu
- 'hasMain' => 0
+ 'hasMain' => 0,\n
+EOT;
+ }
+ $ret .= <<<EOT
+ // Install/Update
+ 'onInstall' => "include/install.php",
+ 'onUpdate' => "include/update.php"
);\n
EOT;
- }
return $ret;
}
/*
@@ -219,15 +214,12 @@
{
$module_name = $module->getVar('mod_name');
$stl_mod_name = strtolower($module_name);
- $ret = '';
- if ( $module->getVar('mod_search') == 1 ) {
- $ret .= <<<EOT
+ $ret = <<<EOT
// Search
\$modversion['hasSearch'] = 1;
\$modversion['search']['file'] = "include/search.inc.php";
\$modversion['search']['func'] = "{$stl_mod_name}_search";\n
EOT;
- }
return $ret;
}
/*
@@ -238,9 +230,7 @@
{
$module_name = $module->getVar('mod_name');
$stl_mod_name = strtolower($module_name);
- $ret = '';
- if ( $module->getVar('mod_comments') == 1 ) {
- $ret .= <<<EOT
+ $ret = <<<EOT
// Comments
\$modversion['comments']['pageName'] = "comments.php";
\$modversion['comments']['itemName'] = "com_id";
@@ -249,7 +239,6 @@
\$modversion['comments']['callback']['approve'] = "{$stl_mod_name}_com_approve";
\$modversion['comments']['callback']['update'] = "{$stl_mod_name}_com_update";\n
EOT;
- }
return $ret;
}
/*
@@ -435,7 +424,7 @@
'default' => "{$stl_mod_name}, {$keyword}");\n
EOT;
unset($this->keywords);
- if ($table->getVar('table_name') != '')
+ if( $field_element == 9 )
{
$ret .= <<<EOT
\n//Uploads : maxsize of image
@@ -518,24 +507,22 @@
{
$module_name = $module->getVar('mod_name');
$stl_mod_name = strtolower($module_name);
- $ret = '';
- if ( $module->getVar('mod_notifications') == 1 )
- {
- $notify_file = '';
- $tables = $this->getTables();
- foreach (array_keys($tables) as $i)
- {
- $table_name = $tables[$i]->getVar('table_name');
- $count = count($table_name);
- if($tables[$i]->getVar('table_notifications') == 1) {
- if($i <= $count) {
- $notify_file .= "'".$table_name.".php', ";
- } else {
- $notify_file .= "'".$table_name.".php'";
- }
+ $ret = '';
+ $notify_file = '';
+ $tables = $this->getTables();
+ foreach(array_keys($tables) as $t)
+ {
+ $table_name = $tables[$t]->getVar('table_name');
+ $count = count($table_name);
+ if($tables[$t]->getVar('table_notifications') == 1) {
+ if($t <= $count) {
+ $notify_file .= "'".$table_name.".php', ";
+ } else {
+ $notify_file .= "'".$table_name.".php'";
}
- }
- $ret .= <<<EOT
+ }
+ }
+ $ret .= <<<EOT
\n// Notifications {$stl_mod_name}
\$modversion['hasNotification'] = 1;
\$modversion['notification']['lookup_file'] = 'include/notification.inc.php';
@@ -640,7 +627,6 @@
'mail_template' => "file_approve_notify",
'mail_subject' => {$language}FILE_APPROVE_NOTIFY_SUBJECT);
EOT;
- }
return $ret;
}
@@ -664,9 +650,9 @@
if ($table->getVar('table_comments') == 1) {
$content .= $this->getXoopsVersionComments($module);
}
- if($table->getVar('table_admin') == 1) {
+ /*if($table->getVar('table_admin') == 1) {
$content .= $this->getXoopsVersionTemplatesAdmin($module_name);
- }
+ }*/
if($table->getVar('table_user') == 1) {
$content .= $this->getXoopsVersionTemplatesUser($module_name);
}
|