Skip to content

Commit f0fae3b

Browse files
authored
Merge pull request #22 from ggoffy/master
fixed bug for active settings
2 parents 2e4710e + 3208686 commit f0fae3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2811
-415
lines changed

_TODO.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ this file currently is not rating
1717

1818

1919

20-
21-
2220
Permissions:
23-
check handling for different groups
2421
implement autoapprove
2522

2623

2724

25+
2826
*****************************
2927
Open questions:
3028
***************
3129

3230
search.php:
3331
what should this file do, additionally to regular search?
3432
UserSearch has to be adapted
33+
34+
35+
Parent:
36+
what is the idea behind this?

admin/addfiles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
// $templateMain = 'modulebuilder_addfiles.tpl';
117117
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
118118
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addfiles.php'));
119-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'addfiles.php?op=new', 'add');
119+
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_ADD, 'addfiles.php?op=new', 'add');
120120
$adminObject->addItemButton(_AM_MODULEBUILDER_ADDFILES_LIST, 'addfiles.php', 'list');
121121
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
122122

admin/building.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
// Redirect if there aren't modules
175175
$nbModules = $helper->getHandler('Modules')->getCount();
176176
if (0 == $nbModules) {
177-
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES);
177+
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_THEREARENT_MODULES2);
178178
}
179179
unset($nbModules);
180180
// include_once TDMC_CLASS_PATH . '/building.php';

admin/fields.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@
5353
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
5454
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/sortable.js');
5555
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php'));
56-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add');
56+
$adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add');
5757
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
5858
$GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16);
5959
// Redirect if there aren't modules
6060
$modulesCount = $helper->getHandler('Modules')->getCountModules();
6161
if (0 == $modulesCount) {
62-
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES);
62+
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_THEREARENT_MODULES2);
6363
}
6464
unset($modulesCount);
6565
// Redirect if there aren't tables
6666
$tablesCount = $helper->getHandler('Tables')->getCountTables();
6767
if (0 == $tablesCount) {
68-
redirect_header('tables.php?op=new', 2, _AM_MODULEBUILDER_NOTTABLES);
68+
redirect_header('tables.php?op=new', 2, _AM_MODULEBUILDER_THEREARENT_TABLES2);
6969
}
7070
// Get the list of tables
7171
$tablesAll = $helper->getHandler('Tables')->getAllTables($start, $limit, 'table_order');
@@ -190,7 +190,7 @@
190190
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
191191
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
192192
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php'));
193-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add');
193+
$adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add');
194194
$adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_LIST, 'tables.php', 'list');
195195
$adminObject->addItemButton(_AM_MODULEBUILDER_FIELDS_LIST, 'fields.php', 'list');
196196
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));

admin/modules.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
3939
$GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css');
4040
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php'));
41-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'modules.php?op=new', 'add');
41+
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_ADD, 'modules.php?op=new', 'add');
4242
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
4343
$GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL);
4444
$GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL);
@@ -47,7 +47,7 @@
4747
$modulesAll = $helper->getHandler('Modules')->getAllModules($start, $limit);
4848
// Redirect if there aren't modules
4949
if (0 == $modulesCount) {
50-
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES);
50+
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_THEREARENT_MODULES2);
5151
}
5252
// Display modules list
5353
if ($modulesCount > 0) {
@@ -72,6 +72,10 @@
7272
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list');
7373
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
7474

75+
$settings = $helper->getHandler('Settings')->getActiveSetting();
76+
if (0 == count($settings)) {
77+
redirect_header('settings.php', 5, _AM_MODULEBUILDER_MODULE_NOACTSET);
78+
}
7579
$modulesObj = $helper->getHandler('Modules')->create();
7680
$form = $modulesObj->getFormModules();
7781
$GLOBALS['xoopsTpl']->assign('form', $form->render());
@@ -166,7 +170,7 @@
166170
case 'edit':
167171
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
168172
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php'));
169-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'modules.php?op=new', 'add');
173+
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_ADD, 'modules.php?op=new', 'add');
170174
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list');
171175
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
172176

admin/morefiles.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
4040
$GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css');
4141
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php'));
42-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MORE_FILE, 'morefiles.php?op=new', 'add');
42+
$adminObject->addItemButton(_AM_MODULEBUILDER_MORE_FILES_ADD, 'morefiles.php?op=new', 'add');
4343
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
4444
$GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL);
4545
$GLOBALS['xoopsTpl']->assign('tdmc_upload_imgfile_url', TDMC_UPLOAD_IMGMOD_URL);
@@ -48,7 +48,7 @@
4848
$modulesCount = $helper->getHandler('Modules')->getCountModules();
4949
// Redirect if there aren't modules
5050
if (0 == $modulesCount) {
51-
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES);
51+
redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_THEREARENT_MODULES2);
5252
}
5353
$morefilesCount = $helper->getHandler('Morefiles')->getCountMorefiles();
5454
$morefilesAll = $helper->getHandler('Morefiles')->getAllMorefiles($start, $limit);
@@ -114,7 +114,7 @@
114114
// $templateMain = 'modulebuilder_morefiles.tpl';
115115
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
116116
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php'));
117-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'morefiles.php?op=new', 'add');
117+
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_ADD, 'morefiles.php?op=new', 'add');
118118
$adminObject->addItemButton(_AM_MODULEBUILDER_MORE_FILES_LIST, 'morefiles.php', 'list');
119119
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
120120

admin/settings.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
4040
$GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css');
4141
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php'));
42-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_SETTING, 'settings.php?op=new', 'add');
42+
$adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new', 'add');
4343
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
4444
$GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL);
4545
$GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL);
@@ -132,10 +132,14 @@
132132
$settingsObj->setVar('set_comments', in_array('comments', $settingOption));
133133
$settingsObj->setVar('set_notifications', in_array('notifications', $settingOption));
134134
$settingsObj->setVar('set_permissions', in_array('permissions', $settingOption));
135-
//$settingsObj->setVar('set_inroot_copy', in_array('inroot', $settingOption));
136-
if (\Xmf\Request::hasVar('set_type')) {
137-
$settingsObj->setVar('set_type', \Xmf\Request::getString('set_type', '', 'POST'));
135+
$settingsObj->setVar('set_inroot_copy', in_array('inroot', $settingOption));
136+
$setType = \Xmf\Request::getString('set_type', '', 'POST');
137+
if (1 == $setType) {
138+
// reset all
139+
$strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 0';
140+
$GLOBALS['xoopsDB']->queryF($strSQL);
138141
}
142+
$settingsObj->setVar('set_type', $setType);
139143

140144
if ($helper->getHandler('Settings')->insert($settingsObj)) {
141145
redirect_header('settings.php', 5, sprintf(_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('set_name', '', 'POST')));
@@ -147,7 +151,7 @@
147151
break;
148152
case 'edit':
149153
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php'));
150-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_SETTING, 'settings.php?op=new', 'add');
154+
$adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new', 'add');
151155
$adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_LIST, 'settings.php', 'list');
152156
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
153157
$settingsObj = $helper->getHandler('Settings')->get($setId);
@@ -170,12 +174,17 @@
170174
}
171175
break;
172176
case 'display':
173-
$id = \Xmf\Request::getInt('set_id', 0, 'POST');
174-
if ($id > 0) {
175-
$settingsObj = $helper->getHandler('Settings')->get($id);
176-
if (isset($_POST['set_type'])) {
177-
$setType = $settingsObj->getVar('set_type');
178-
$settingsObj->setVar('set_type', !$setType);
177+
$setId = \Xmf\Request::getInt('set_id', 0);
178+
if ($setId > 0) {
179+
$settingsHandler = $helper->getHandler('Settings');
180+
$settingsObj = $settingsHandler->get($id);
181+
$setType = $settingsObj->getVar('set_type');
182+
// reset all
183+
$strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 0';
184+
$GLOBALS['xoopsDB']->queryF($strSQL);
185+
$strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 1 WHERE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_id = ' . $setId;
186+
if ($GLOBALS['xoopsDB']->queryF($strSQL)) {
187+
redirect_header('settings.php', 5, sprintf(_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('set_name', '', 'POST')));
179188
}
180189
$GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors());
181190
}

admin/tables.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@
4747
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
4848
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/sortable.js');
4949
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php'));
50-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add');
50+
$adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add');
5151
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
5252
$GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL);
5353
$GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16);
5454
// Get the list of modules
5555
$modulesCount = $helper->getHandler('Modules')->getCountModules();
5656
// Redirect if there aren't modules
5757
if (0 == $modulesCount) {
58-
redirect_header('modules.php?op=new', 10, _AM_MODULEBUILDER_NOTMODULES);
58+
redirect_header('modules.php?op=new', 10, _AM_MODULEBUILDER_THEREARENT_MODULES2);
5959
}
6060
$modulesAll = $helper->getHandler('Modules')->getAllModules($start, $limit);
6161
$tablesCount = $helper->getHandler('Tables')->getObjects(null);
6262
// Redirect if there aren't tables
6363
if (0 == $tablesCount) {
64-
redirect_header('tables.php?op=new', 10, _AM_MODULEBUILDER_NOTTABLES);
64+
redirect_header('tables.php?op=new', 10, _AM_MODULEBUILDER_THEREARENT_TABLES2);
6565
}
6666
unset($tablesCount);
6767
// Display modules list
@@ -125,7 +125,7 @@
125125
//unset($criteria);
126126
foreach (array_keys($tableNameSearch) as $t) {
127127
if ($tableNameSearch[$t]->getVar('table_name') === \Xmf\Request::getString('table_name', '', 'POST')) {
128-
redirect_header('tables.php?op=new', 3, sprintf(_AM_MODULEBUILDER_ERROR_TABLE_NAME_EXIST, \Xmf\Request::getString('table_name', '', 'POST')));
128+
redirect_header('tables.php?op=new', 3, sprintf(_AM_MODULEBUILDER_TABLE_ERROR_NAME_EXIST, \Xmf\Request::getString('table_name', '', 'POST')));
129129
}
130130
}
131131
$tablesObj = $tables->create();
@@ -210,7 +210,7 @@
210210
break;
211211
case 'edit':
212212
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php'));
213-
$adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add');
213+
$adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add');
214214
$adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_LIST, 'tables.php?op=list', 'list');
215215
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
216216

assets/js/functions.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,26 +76,6 @@ $(document).ready(function () {
7676
});
7777
});
7878

79-
function modulebuilder_setStatus(data, img, file) {
80-
// Post request
81-
$.post(file, data, function (reponse, textStatus) {
82-
if (textStatus == 'success') {
83-
$('img#' + img).hide();
84-
$('#loading_' + img).show();
85-
setTimeout(function () {
86-
$('#loading_' + img).hide();
87-
$('img#' + img).fadeIn('fast');
88-
}, 500);
89-
// Change image src
90-
if ($('img#' + img).attr("src") == IMG_ON) {
91-
$('img#' + img).attr("src", IMG_OFF);
92-
} else {
93-
$('img#' + img).attr("src", IMG_ON);
94-
}
95-
}
96-
});
97-
}
98-
9979
function presetField(typeId) {
10080

10181
eleSelected = xoopsGetElementById('field_element[' + typeId + ']');

class/Building.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ public function getForm($action = false)
7070
}
7171
$form->addElement($mod_select, true);
7272

73-
$form->addElement(new \XoopsFormRadioYN(_AM_MODULEBUILDER_MODULE_INROOT_COPY, 'inroot_copy', $helper->getConfig('inroot_copy')));
74-
$form->addElement(new \XoopsFormRadioYN(_AM_MODULEBUILDER_ADMIN_BUILD_TEST . _AM_MODULEBUILDER_ADMIN_BUILD_TEST_DESC, 'testdata_restore', 0));
73+
$form->addElement(new \XoopsFormRadioYN(_AM_MODULEBUILDER_BUILDING_INROOT_COPY, 'inroot_copy', $helper->getConfig('inroot_copy')));
74+
$form->addElement(new \XoopsFormRadioYN(_AM_MODULEBUILDER_BUILDING_TEST . _AM_MODULEBUILDER_BUILDING_TEST_DESC, 'testdata_restore', 0));
7575

7676
$form->addElement(new \XoopsFormHidden('op', 'build'));
7777
$btnTray = new \XoopsFormElementTray(_REQUIRED . ' <sup class="red bold">*</sup>', '&nbsp;');
7878
$btnTray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
79-
$btnTray->addElement(new \XoopsFormButton('', 'check_data', _AM_MODULEBUILDER_ADMIN_BUILD_CHECK, 'submit'));
79+
$btnTray->addElement(new \XoopsFormButton('', 'check_data', _AM_MODULEBUILDER_BUILDING_CHECK, 'submit'));
8080
$form->addElement($btnTray);
8181

8282
return $form;

0 commit comments

Comments
 (0)