Skip to content

Commit 554c403

Browse files
author
Till Brehm
committed
- Added option to allow resellers to add domains in the domain limits (domain module).
- Added section toggle for client limits
1 parent 94c9617 commit 554c403

File tree

13 files changed

+67
-33
lines changed

13 files changed

+67
-33
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE `client` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0';
2+
ALTER TABLE `client_template` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0';

install/sql/ispconfig3.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ CREATE TABLE `client` (
215215
`limit_cron_frequency` int(11) NOT NULL DEFAULT '5',
216216
`limit_traffic_quota` int(11) NOT NULL DEFAULT '-1',
217217
`limit_client` int(11) NOT NULL DEFAULT '0',
218+
`limit_domainmodule` int(11) NOT NULL DEFAULT '0',
218219
`limit_mailmailinglist` int(11) NOT NULL DEFAULT '-1',
219220
`limit_openvz_vm` int(11) NOT NULL DEFAULT '0',
220221
`limit_openvz_vm_template_id` int(11) NOT NULL DEFAULT '0',
@@ -317,6 +318,7 @@ CREATE TABLE `client_template` (
317318
`limit_cron_frequency` int(11) NOT NULL default '5',
318319
`limit_traffic_quota` int(11) NOT NULL default '-1',
319320
`limit_client` int(11) NOT NULL default '0',
321+
`limit_domainmodule` int(11) NOT NULL DEFAULT '0',
320322
`limit_mailmailinglist` int(11) NOT NULL default '-1',
321323
`limit_openvz_vm` int(11) NOT NULL DEFAULT '0',
322324
`limit_openvz_vm_template_id` int(11) NOT NULL DEFAULT '0',

interface/web/client/client_template_edit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ class page_action extends tform_actions {
5555
function onSubmit() {
5656
global $app;
5757

58-
//* Resellers shall not be able to create another reseller
58+
//* Resellers shall not be able to create another reseller or set reseller specific settings
5959
if($_SESSION["s"]["user"]["typ"] == 'user') {
6060
$this->dataRecord['limit_client'] = 0;
61+
$this->dataRecord['limit_domainmodule'] = 0;
6162
}
6263

6364
parent::onSubmit();

interface/web/client/domain_edit.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
5353
include $lng_file;
5454

55+
if(!$app->tform->checkClientLimit('limit_domainmodule')) {
56+
$app->uses('ini_parser,getconf');
57+
$settings = $app->getconf->get_global_config('domains');
58+
if ($settings['use_domain_module'] == 'y') {
59+
$app->error($settings['new_domain_html']);
60+
}
61+
}
62+
63+
5564
class page_action extends tform_actions {
5665

5766
function onShowNew() {

interface/web/client/form/reseller.tform.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,20 @@
11301130
'width' => '30',
11311131
'maxlength' => '255'
11321132
),
1133+
'limit_domainmodule' => array (
1134+
'datatype' => 'INTEGER',
1135+
'formtype' => 'TEXT',
1136+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
1137+
'errmsg'=> 'limit_domainmodule_error_notint'),
1138+
),
1139+
'default' => '0',
1140+
'value' => '',
1141+
'separator' => '',
1142+
'width' => '10',
1143+
'maxlength' => '10',
1144+
'rows' => '',
1145+
'cols' => ''
1146+
),
11331147
//#################################
11341148
// END Datatable fields
11351149
//#################################

interface/web/client/lib/lang/en_client_template.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,6 @@ $wb["virtualization_limits_txt"] = 'Virtualization Limits';
8888
$wb['aps_limits_txt'] = 'APS Installer Limits';
8989
$wb['limit_aps_txt'] = 'Max. number of APS instances';
9090
$wb['limit_aps_error_notint'] = 'The APS instances limit must be a number.';
91+
$wb['limit_domainmodule_txt'] = 'Domainmodule Limit';
92+
$wb['client_limits_txt'] = 'Client Limits'
9193
?>

interface/web/client/lib/lang/en_client_template_list.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
$wb["list_head_txt"] = 'Client-Templates';
2+
$wb["list_head_txt"] = 'Client and Reseller Templates';
33
$wb["template_type_txt"] = 'Type';
44
$wb["template_name_txt"] = 'Template name';
55
$wb['template_id_txt'] = 'Template ID';

interface/web/client/lib/lang/en_reseller.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,8 @@ $wb['customer_no_start_txt'] = 'Customer No. start value';
156156
$wb['customer_no_counter_txt'] = 'Customer No. counter';
157157
$wb['added_by_txt'] = 'Added by';
158158
$wb['added_date_txt'] = 'Added date';
159+
$wb['limit_domainmodule_error_notint'] = 'Domainmodule limit must be a number.';
160+
$wb['limit_domainmodule_txt'] = 'Domainmodule Limit';
161+
$wb['client_limits_txt'] = 'Client Limits';
162+
$wb['err_msg_master_tpl_set'] = 'All custom limit settings are ignored if any master template other than "custom" is selected.';
159163
?>

interface/web/client/lib/module.conf.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
'link' => 'client/client_edit.php',
1818
'html_id' => 'client_add');
1919

20-
if($_SESSION["s"]["user"]["typ"] == 'admin'){
21-
$items[] = array( 'title' => "Edit Client-Templates",
22-
'target' => 'content',
23-
'link' => 'client/client_template_list.php',
24-
'html_id' => 'client_template_list');
25-
}
26-
2720
$module["nav"][] = array( 'title' => 'Clients',
2821
'open' => 1,
2922
'items' => $items);
@@ -66,19 +59,18 @@
6659

6760
unset($items);
6861

69-
//if($_SESSION["s"]["user"]["typ"] == 'admin'){
70-
$items[] = array( 'title' => "Limit-Templates",
71-
'target' => 'content',
72-
'link' => 'client/client_template_list.php',
73-
'html_id' => 'client_template_list');
62+
63+
$items[] = array( 'title' => "Limit-Templates",
64+
'target' => 'content',
65+
'link' => 'client/client_template_list.php',
66+
'html_id' => 'client_template_list');
7467

7568

7669
$module["nav"][] = array( 'title' => 'Templates',
7770
'open' => 1,
7871
'items' => $items);
7972

8073
unset($items);
81-
//}
8274

8375

8476
$app->uses('ini_parser,getconf');

interface/web/client/templates/client_edit_limits.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ <h2><tmpl_var name="list_head_txt"></h2>
313313
.find('div.pnl_formsarea')
314314
.find('fieldset')
315315
.find('input,select,button')
316-
.not('#template_master,#template_additional,#default_mailserver,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver')
316+
.not('#template_master,#template_additional,#default_mailserver,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver,#customer_no_template,#customer_no_start,#customer_no_counter')
317317
.click(function(e) {
318318
if(custom_template_selected()) return true;
319319
e.preventDefault();

0 commit comments

Comments
 (0)