Skip to content

Commit 0f59fae

Browse files
committed
Added more files
1 parent cf68b5c commit 0f59fae

File tree

20 files changed

+714
-54
lines changed

20 files changed

+714
-54
lines changed

admin/menu.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@
4545
$adminmenu[$i]['icon'] = 'assets/icons/32/fields.png';
4646
$i++;
4747
$adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU6;
48+
$adminmenu[$i]['link'] = 'admin/morefiles.php';
49+
$adminmenu[$i]['icon'] = 'assets/icons/32/files.png';
50+
$i++;
51+
$adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU7;
4852
$adminmenu[$i]['link'] = 'admin/building.php';
4953
$adminmenu[$i]['icon'] = 'assets/icons/32/builder.png';
5054
$i++;
51-
$adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU7;
55+
$adminmenu[$i]['title'] = _MI_TDMCREATE_ABOUT;
5256
$adminmenu[$i]['link'] = 'admin/about.php';
5357
$adminmenu[$i]['icon'] = $sysPathIcon32 . '/about.png';
5458
unset($i);

admin/morefiles.php

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
/**
12+
* tdmcreate module
13+
*
14+
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
15+
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
16+
* @package tdmcreate
17+
* @since 2.5.5
18+
* @author Txmod Xoops <[email protected]>
19+
* @version $Id: 1.59 morefiles.php 11297 2013-03-24 10:58:10Z timgno $
20+
*/
21+
include __DIR__ . '/header.php';
22+
// Recovered value of argument op in the URL $
23+
$op = XoopsRequest::getString('op', 'list');
24+
//
25+
$fileId = XoopsRequest::getInt('file_id');
26+
//
27+
switch ($op) {
28+
case 'list':
29+
default:
30+
$start = XoopsRequest::getInt('start', 0);
31+
$limit = XoopsRequest::getInt('limit', $tdmcreate->getConfig('morefiles_adminpager'));
32+
// Define main template
33+
$templateMain = 'tdmcreate_morefiles.tpl';
34+
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
35+
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
36+
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('morefiles.php'));
37+
$adminMenu->addItemButton(_AM_TDMCREATE_ADD_MORE_FILE, 'morefiles.php?op=new', 'add');
38+
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
39+
$GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL);
40+
$GLOBALS['xoopsTpl']->assign('tdmc_upload_imgfile_url', TDMC_UPLOAD_IMGMOD_URL);
41+
$GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16);
42+
$GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32);
43+
$modulesCount = $tdmcreate->getHandler('modules')->getCountModules();
44+
// Redirect if there aren't modules
45+
if (0 == $modulesCount) {
46+
redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOT_MODULES);
47+
}
48+
$morefilesCount = $tdmcreate->getHandler('morefiles')->getCountMoreFiles();
49+
$morefilesAll = $tdmcreate->getHandler('morefiles')->getAllMoreFiles($start, $limit);
50+
// Display morefiles list
51+
if ($morefilesCount > 0) {
52+
foreach (array_keys($morefilesAll) as $i) {
53+
$files = $morefilesAll[$i]->getValues();
54+
$GLOBALS['xoopsTpl']->append('files_list', $files);
55+
unset($files);
56+
}
57+
if ($morefilesCount > $limit) {
58+
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
59+
$pagenav = new XoopsPageNav($morefilesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
60+
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
61+
}
62+
} else {
63+
$GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_MODULES);
64+
}
65+
break;
66+
67+
case 'new':
68+
// Define main template
69+
$templateMain = 'tdmcreate_morefiles.tpl';
70+
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
71+
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('morefiles.php'));
72+
$adminMenu->addItemButton(_AM_TDMCREATE_MORE_FILES_LIST, 'morefiles.php', 'list');
73+
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
74+
75+
$morefilesObj =& $tdmcreate->getHandler('morefiles')->create();
76+
$form = $morefilesObj->getForm();
77+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
78+
break;
79+
80+
case 'save':
81+
if (!$GLOBALS['xoopsSecurity']->check()) {
82+
redirect_header('morefiles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
83+
}
84+
if (isset($fileId)) {
85+
$morefilesObj =& $tdmcreate->getHandler('morefiles')->get($fileId);
86+
} else {
87+
$morefilesObj =& $tdmcreate->getHandler('morefiles')->create();
88+
}
89+
// Form file save
90+
$morefilesObj->setVars(array(
91+
'file_mid' => $_POST['file_mid'],
92+
'file_name' => $_POST['file_name'],
93+
'file_extension' => $_POST['file_extension'],
94+
'file_infolder' => $_POST['file_infolder']));
95+
96+
if ($tdmcreate->getHandler('morefiles')->insert($morefilesObj)) {
97+
if ($morefilesObj->isNew()) {
98+
redirect_header('morefiles.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_CREATED_OK, $_POST['file_name']));
99+
} else {
100+
redirect_header('morefiles.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_UPDATED_OK, $_POST['file_name']));
101+
}
102+
}
103+
104+
$GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors());
105+
$form =& $morefilesObj->getForm();
106+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
107+
break;
108+
109+
case 'edit':
110+
// Define main template
111+
$templateMain = 'tdmcreate_morefiles.tpl';
112+
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
113+
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('morefiles.php'));
114+
$adminMenu->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'morefiles.php?op=new', 'add');
115+
$adminMenu->addItemButton(_AM_TDMCREATE_MORE_FILES_LIST, 'morefiles.php', 'list');
116+
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
117+
118+
$morefilesObj = $tdmcreate->getHandler('morefiles')->get($fileId);
119+
$form = $morefilesObj->getForm();
120+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
121+
break;
122+
123+
case 'delete':
124+
$morefilesObj =& $tdmcreate->getHandler('morefiles')->get($fileId);
125+
if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
126+
if (!$GLOBALS['xoopsSecurity']->check()) {
127+
redirect_header('morefiles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
128+
}
129+
if ($tdmcreate->getHandler('morefiles')->delete($morefilesObj)) {
130+
redirect_header('morefiles.php', 3, _AM_TDMCREATE_FORM_DELETED_OK);
131+
} else {
132+
$GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors());
133+
}
134+
} else {
135+
xoops_confirm(array('ok' => 1, 'file_id' => $fileId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TDMCREATE_FORM_SURE_DELETE, $morefilesObj->getVar('file_name')));
136+
}
137+
break;
138+
}
139+
140+
include __DIR__ . '/footer.php';

assets/icons/32/files.png

1.93 KB
Loading

class/fieldattributes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
1515
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
1616
* @package tdmcreate
17-
* @since 2.5.5
18-
* @author Txmod Xoops <support@txmodxoops.org>
19-
* @version $Id: 1.91 fieldattributes.php 11297 2014-05-14 10:58:10Z timgno $
17+
* @since 2.5.7
18+
* @author Txmod Xoops <webmaster@txmodxoops.org> - <http://www.txmodxoops.org/>
19+
* @version $Id: 1.91 fieldattributes.php 13027 2015-02-14 12:18:10Z timgno $
2020
*/
2121
defined('XOOPS_ROOT_PATH') or die('Restricted access');
2222

class/fields.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
1616
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
1717
* @package tdmcreate
18-
* @since 2.5.0
19-
* @author Txmod Xoops http://www.txmodxoops.org
18+
* @since 2.5.7
19+
* @author Txmod Xoops <[email protected]> - <http://www.txmodxoops.org/>
2020
* @version $Id: 1.91 fields.php 12258 2014-01-02 09:33:29Z timgno $
2121
*/
2222
defined('XOOPS_ROOT_PATH') or die('Restricted access');

class/files/TDMCreateArchitecture.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ public function createBaseFoldersFiles($module)
9393
}
9494
//
9595
$indexFile = XOOPS_UPLOAD_PATH . '/index.html';
96-
$cache1 = TDMC_CLASSES_PATH . '/cache';
97-
$cache2 = TDMC_CLASSES_PATH . '/files/cache';
9896
$stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author')));
9997
$this->structure->setModuleName($module->getVar('mod_dirname'));
10098
$uploadPath = $this->structure->getUploadPath();
10199
// Creation of "module" folder in the Directory repository
102100
$this->structure->makeDir($uploadPath . '/' . $this->structure->getModuleName());
103-
// Copied of index.html file in "root module" folder
104-
//$this->structure->copyFile('', $indexFile, 'index.html');
101+
if (1 != $module->getVar('mod_user')) {
102+
// Copied of index.html file in "root module" folder
103+
$this->structure->copyFile('', $indexFile, 'index.html');
104+
}
105105
if (1 == $module->getVar('mod_admin')) {
106106
// Creation of "admin" folder and index.html file
107107
$this->structure->makeDirAndCopyFile('admin', $indexFile, 'index.html');

class/files/admin/AdminPages.php

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ private function getAdminPagesHeader($moduleDirname, $tableName, $fieldId)
8282
{
8383
$ucfModuleDirname = ucfirst($moduleDirname);
8484
$ucfTableName = ucfirst($tableName);
85+
$ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true);
8586
$ret = <<<EOT
8687
include __DIR__ . '/header.php';
8788
//It recovered the value of argument op in URL$
8889
\$op = XoopsRequest::getString('op', 'list');
8990
// Request {$fieldId}
90-
\${$fieldId} = XoopsRequest::getInt('{$fieldId}');
91+
\${$ccFieldId} = XoopsRequest::getInt('{$fieldId}');
9192
// Switch options
9293
switch (\$op)
9394
{\n
@@ -200,13 +201,14 @@ private function getAdminPagesNew($moduleDirname, $tableName, $language)
200201
*/
201202
private function getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fieldId, $fieldMain)
202203
{
203-
$ret = <<<EOT
204+
$ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true);
205+
$ret = <<<EOT
204206
case 'save':
205207
if ( !\$GLOBALS['xoopsSecurity']->check() ) {
206208
redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors()));
207209
}
208-
if (isset(\${$fieldId})) {
209-
\${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
210+
if (isset(\${$ccFieldId})) {
211+
\${$tableName}Obj =& \${$tableName}Handler->get(\${$ccFieldId});
210212
} else {
211213
\${$tableName}Obj =& \${$tableName}Handler->create();
212214
}
@@ -277,6 +279,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId)
277279
$stuTableName = strtoupper($tableName);
278280
$stuTableSoleName = strtoupper($tableSoleName);
279281
$stuTableFieldname = strtoupper($tableFieldname);
282+
$ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true);
280283
$ret = <<<EOT
281284
case 'edit':
282285
\$templateMain = '{$moduleDirname}_admin_{$tableName}.tpl';
@@ -285,7 +288,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId)
285288
\$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
286289
\$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
287290
// Get Form
288-
\${$tableName}Obj = \${$tableName}Handler->get(\${$fieldId});
291+
\${$tableName}Obj = \${$tableName}Handler->get(\${$ccFieldId});
289292
\$form = \${$tableName}Obj->getForm();
290293
\$GLOBALS['xoopsTpl']->assign('form', \$form->render());
291294
break;\n
@@ -304,20 +307,21 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId)
304307
*/
305308
private function getAdminPagesDelete($tableName, $language, $fieldId, $fieldMain)
306309
{
307-
$ret = <<<EOT
310+
$ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true);
311+
$ret = <<<EOT
308312
case 'delete':
309-
\${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
313+
\${$tableName}Obj =& \${$tableName}Handler->get(\${$ccFieldId});
310314
if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) {
311315
if ( !\$GLOBALS['xoopsSecurity']->check() ) {
312316
redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors()));
313317
}
314318
if (\${$tableName}Handler->delete(\${$tableName}Obj)) {
315319
redirect_header('{$tableName}.php', 3, {$language}FORM_DELETE_OK);
316320
} else {
317-
echo \${$tableName}Obj->getHtmlErrors();
321+
\$GLOBALS['xoopsTpl']->assign('error', \${$tableName}Obj->getHtmlErrors());
318322
}
319323
} else {
320-
xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORM_SURE_DELETE, \${$tableName}Obj->getVar('{$fieldMain}')));
324+
xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORM_SURE_DELETE, \${$tableName}Obj->getVar('{$fieldMain}')));
321325
}
322326
break;\n
323327
EOT;
@@ -336,17 +340,17 @@ private function getAdminPagesDelete($tableName, $language, $fieldId, $fieldMain
336340
private function getAdminPagesUpdate($moduleDirname, $tableName, $fieldId, $fieldName)
337341
{
338342
$stuModuleName = strtoupper($moduleDirname);
343+
$ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true);
339344
$ret = <<<EOT
340345
case 'update':
341-
if (isset(\${$fieldId})) {
342-
\${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
346+
if (isset(\${$ccFieldId})) {
347+
\${$tableName}Obj =& \${$tableName}Handler->get(\${$ccFieldId});
343348
}
344-
\${$tableName}Obj->setVar("\${$fieldName}", \$_POST["\${$fieldName}"]);
345-
349+
\${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);
346350
if (\${$tableName}Handler->insert(\${$tableName}Obj)) {
347-
redirect_header("\${$tableName}.php", 3, _AM_{$stuModuleName}_FORM_OK);
351+
redirect_header('{$tableName}.php', 3, _AM_{$stuModuleName}_FORM_OK);
348352
}
349-
echo \${$tableName}Obj->getHtmlErrors();
353+
\$GLOBALS['xoopsTpl']->assign('error', \${$tableName}Obj->getHtmlErrors());
350354
break;\n
351355
EOT;
352356

class/files/classes/ClassFiles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ private function getClassGetInsertId()
658658
public function &getInsertId()
659659
{
660660
return \$this->db->getInsertId();
661-
}\n\n
661+
}\n\n
662662
EOT;
663663

664664
return $ret;

class/files/classes/ClassFormElements.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,33 @@ private function getXoopsFormTopic($language, $moduleDirname, $topicTableName, $
617617

618618
return $ret;
619619
}
620+
621+
/*
622+
* @private function getXoopsFormTag
623+
* @param string $moduleDirname
624+
* @param string $fieldId
625+
* @param string $required
626+
*/
627+
/**
628+
* @param $moduleDirname
629+
* @param $fieldId
630+
* @param string $required
631+
* @return string
632+
*/
633+
private function getXoopsFormTag($moduleDirname, $fieldId, $required = 'false')
634+
{
635+
$ret = <<<EOT
636+
// Use tag module
637+
\$dirTag = is_dir(XOOPS_ROOT_PATH . '/modules/tag') ? true : false;
638+
if ((\$this->{$moduleDirname}->getConfig('usetag') == 1) && \$dirTag){
639+
\$tagId = \$this->isNew() ? 0 : \$this->getVar('{$fieldId}');
640+
include_once XOOPS_ROOT_PATH.'/modules/tag/include/formtag.php';
641+
\$form->addElement(new XoopsFormTag('tag', 60, 255, \$tagId, 0){$required});
642+
}\n
643+
EOT;
644+
645+
return $ret;
646+
}
620647

621648
/*
622649
* @public function renderElements
@@ -707,7 +734,11 @@ public function renderElements()
707734
$ret .= $this->getXoopsFormTextDateSelect($language, $moduleDirname, $fieldName, $required);
708735
break;
709736
default:
710-
// If we want to hide XoopsFormHidden() or field id
737+
// If we use tag module
738+
if (1 == $table->getVar('table_tag')) {
739+
$ret .= $this->getXoopsFormTag($moduleDirname, $fieldId, $required);
740+
}
741+
// If we want to hide XoopsFormHidden() or field id
711742
if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) {
712743
$ret .= $this->getXoopsFormHidden($fieldName);
713744
}

class/files/language/LanguageAdmin.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function getLanguageAdminClass($language, $tables)
174174
$fieldNameDesc = substr($fieldElementName, strrpos($fieldElementName, ':'), strlen($fieldElementName));
175175
$fieldNameDesc = str_replace(': ', '', $fieldNameDesc);
176176
} else {
177-
$fieldNameDesc = ucfirst($rpFieldName);
177+
$fieldNameDesc = strstr($rpFieldName, '_') ? str_replace('_', ' ', ucfirst($rpFieldName)) : ucfirst($rpFieldName);
178178
}
179179
//
180180
$ret .= $this->defines->getDefine($language, $tableSoleName . '_' . $rpFieldName, $fieldNameDesc);
@@ -259,6 +259,7 @@ public function getLanguageAdminFoot($language)
259259
public function render()
260260
{
261261
$module = $this->getModule();
262+
$table = $this->getTable();
262263
$tables = $this->getTables();
263264
$filename = $this->getFileName();
264265
$moduleDirname = $module->getVar('mod_dirname');
@@ -267,9 +268,11 @@ public function render()
267268
if (is_array($tables)) {
268269
$content .= $this->getLanguageAdminIndex($language, $tables);
269270
$content .= $this->getLanguageAdminPages($language, $tables);
270-
$content .= $this->getLanguageAdminClass($language, $tables);
271-
$content .= $this->getLanguageAdminPermissions($language);
271+
$content .= $this->getLanguageAdminClass($language, $tables);
272272
}
273+
if (1 == $table->getVar('table_permissions')) {
274+
$content .= $this->getLanguageAdminPermissions($language);
275+
}
273276
$content .= $this->getLanguageAdminFoot($language);
274277
//
275278
$this->tdmcfile->create($moduleDirname, 'language/english', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);

0 commit comments

Comments
 (0)