Skip to content

Commit 737370c

Browse files
committed
Merge branch 'master' of github.com:serghey-rodin/vesta
2 parents 5760da5 + 52a8ae0 commit 737370c

28 files changed

+793
-346
lines changed

web/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2005-2010, http://vestacp.com
1+
Copyright (c) 2005-2010, http://www.vestacp.com
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification,

web/css/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,3 +2428,4 @@ select{
24282428
font-size:14px;
24292429
font-weight:bold;
24302430
}
2431+

web/dispatch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vesta/core/utils/error_logger.php'
3+
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vesta/core/utils/error_logger.php';
44
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vesta/app.init.php';
55

66
?>

web/images/form-bottom-bg.png

48 Bytes
Loading

web/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
204204

205205

206206
<!-- script type="text/javascript" src="js/lib/jquery-1.4.4.min.js"></script -->
207+
<script type="text/javascript" src="js/lib/cookie.js"></script>
207208
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.js"></script>
208209
<script type="text/javascript" src="js/date_format.js"></script>
209210
<script type="text/javascript" src="js/lib/custom-form-elements.js"></script>

web/js/__init__.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
$(document).ready(function(){
22
try{
33
App.Utils.detectBrowser();
4-
App.Env.world = 'CRON';
4+
5+
if ('undefined' != typeof App.Tmp.loadTAB) {
6+
App.Env.world = App.Tmp.loadTAB;
7+
}
8+
9+
if ('undefined' == typeof App.Tmp.loadTAB && cookieEnabled()) {
10+
var tab = getCookie('tab');
11+
if (null != tab && $.inArray(tab, App.Constants.TABS)) {
12+
App.Env.world = tab;
13+
}
14+
else {
15+
App.Env.world = App.Constants.TABS[0];
16+
}
17+
}
18+
519
App.Pages.init();
620
App.Ref.init();
721

web/js/_settings.js

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,38 @@ App.i18n.getMessage = function(key)
88
}
99

1010

11-
1211
// Constants
13-
App.Constants.IP_FORM_ID = 'ip-form';
14-
App.Constants.DNS_FORM_ID = 'dns-form';
15-
App.Constants.USER_FORM_ID = 'user-form';
16-
App.Constants.WEB_DOMAIN_FORM_ID = 'web_domain-form';
17-
App.Constants.DB_FORM_ID = 'db-form';
18-
App.Constants.CRON_FORM_ID = 'cron-form';
19-
20-
App.Settings.ajax_url = 1;
21-
App.Settings.uri = location.href.replace('index.html', '');
22-
App.Settings.popup_conf = { 'centered' : true, 'bgcolor' : '#FF0000', 'lightboxSpeed' : 'fast', 'destroyOnClose': true };
12+
App.Constants.IP_FORM_ID = 'ip-form';
13+
App.Constants.DNS_FORM_ID = 'dns-form';
14+
App.Constants.USER_FORM_ID = 'user-form';
15+
App.Constants.WEB_DOMAIN_FORM_ID = 'web_domain-form';
16+
App.Constants.DB_FORM_ID = 'db-form';
17+
App.Constants.CRON_FORM_ID = 'cron-form';
18+
App.Constants.IP = 'IP';
19+
App.Constants.DNS = 'DNS';
20+
App.Constants.SUSPENDED_YES = 'yes';
21+
App.Constants.DNS_TEMPLATES = {'default': 'Default'};
2322

24-
App.Constants.SUSPENDED_YES = 'yes';
23+
// Settings
24+
App.Settings.USER_VISIBLE_NS = 2;
25+
App.Settings.NS_MIN = 2;
26+
App.Settings.NS_MAX = 8;
27+
App.Settings.ajax_url = 1;
28+
App.Settings.uri = location.href.replace('index.html', '');
29+
App.Settings.popup_conf = { 'centered' : true, 'bgcolor' : '#FF0000', 'lightboxSpeed' : 'fast', 'destroyOnClose': true };
2530

26-
App.Constants.IP = 'IP';
27-
App.Constants.DNS = 'DNS';
28-
29-
App.Constants.DNS_TEMPLATES = {'default': 'Default'};
3031

32+
// Messages
3133
App.Messages.total_dns_records = {single: 'total record', plural: 'total records'};
32-
3334
App.Messages.get = function(key, plural) {
3435
if ('undefined' != typeof App.Messages[key]) {
3536
return plural ? App.Messages[key].plural : App.Messages[key].single;
3637
}
3738
}
3839

40+
// Empty
41+
App.Empty = {};
42+
App.Empty.USER = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','LNAME':'', 'FNAME':'','NS1':'','NS2':'','NS3':'','NS4':'','NS5':'','NS6':'','NS7':'','NS8':''};
3943

4044
App.Settings.getMethodName = function(action)
4145
{

web/js/actions.js

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ App.Actions.save_form = function(evt) {
103103
else { // OLD ITEM, UPDATING IT
104104
var source = $(elm).find('.source').val();
105105
var values = App.Helpers.getFormValues(elm);
106-
if(App.Validate.form(values, $('#'+elm_id))) {
107-
App.Model.add(values, source);
106+
if(App.Validate.form(values, $('#'+elm_id))) {
108107
App.Model.update(values, source, elm);
109108
}
110109
}
@@ -146,12 +145,49 @@ App.Actions.cancel_form = function(evt, params) {
146145

147146
App.Actions.suspend = function(evt)
148147
{
149-
alert('Suspend?');
148+
var confirmed = confirm('Suspend?');
149+
if (!confirmed) {
150+
return ;
151+
}
152+
var elm = $(evt.target);
153+
var row = elm.parents('.row');
154+
155+
var options = row.find('.source').val();
156+
App.Ajax.request(App.Env.world+'.suspend', {spell: options}, function(reply) {
157+
if (reply.result) {
158+
//var tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general');
159+
//$(elm).replaceWith(tpl.finalize());
160+
App.Pages.prepareHTML();
161+
App.Helpers.updateScreen();
162+
}
163+
else {
164+
return App.Helpers.alert('Failed to suspend');
165+
}
166+
});
150167
}
151168

152169
App.Actions.unsuspend = function(evt)
153170
{
154-
alert('Unsuspend?');
171+
var confirmed = confirm('Unsuspend?');
172+
if (!confirmed) {
173+
return ;
174+
}
175+
176+
var elm = $(evt.target);
177+
var row = elm.parents('.row');
178+
179+
var options = row.find('.source').val();
180+
App.Ajax.request(App.Env.world+'.unsuspend', {spell: options}, function(reply) {
181+
if (reply.result) {
182+
//var tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general');
183+
//$(elm).replaceWith(tpl.finalize());
184+
App.Pages.prepareHTML();
185+
App.Helpers.updateScreen();
186+
}
187+
else {
188+
return App.Helpers.alert('Failed to suspend');
189+
}
190+
});
155191
}
156192

157193
// do_action_form_help
@@ -230,3 +266,56 @@ App.Actions.backup_db = function(evt)
230266
{
231267
alert('TODO');
232268
}
269+
270+
App.Actions.add_form_ns = function(evt)
271+
{
272+
var elm = $(evt.target);
273+
274+
form = elm.parents('.form:first');
275+
var total_nses = $(form).find('.ns-entry').length;
276+
if (total_nses == App.Settings.NS_MAX) {
277+
return App.Helpers.alert('Maximum number of NS cannot be more than ' + App.Settings.NS_MAX);
278+
}
279+
280+
var tpl = App.Templates.get('NS_INPUT', 'user');
281+
tpl.set(':NAME', '');
282+
tpl.set(':NS_LABEL', 'NS');
283+
elm.before(tpl.finalize());
284+
285+
if ((total_nses + 1) == App.Settings.NS_MAX ) { // added last NS
286+
$('.additional-ns-add', form).addClass('hidden');
287+
}
288+
289+
$(form).find('.ns-entry').each(function(i, o)
290+
{
291+
$(o).find('label').text('NS #' + (i + 1));
292+
$(o).find('input').attr('name', 'NS' + (i + 1));
293+
});
294+
}
295+
296+
App.Actions.delete_ns = function(evt)
297+
{
298+
var elm = $(evt.target);
299+
300+
form = elm.parents('.form:first');
301+
var total_nses = $(form).find('.ns-entry').length;
302+
if (total_nses == App.Settings.NS_MIN) {
303+
return App.Helpers.alert('Minimum number of NS is ' + App.Settings.NS_MIN);
304+
}
305+
306+
var form = elm.parents('.form:first');
307+
$(elm).parents('.form:first').find('.additional-ns-add').removeClass('hidden');
308+
$(elm).parents('.ns-entry').remove();
309+
310+
$(form).find('.ns-entry').each(function(i, o)
311+
{
312+
$(o).find('label').text('NS #' + (i + 1));
313+
$(o).find('input').attr('name', 'NS' + (i + 1));
314+
});
315+
}
316+
317+
App.Actions.view_full_ns_list = function(evt)
318+
{
319+
var elm = $(evt.target);
320+
App.Helpers.openInnerPopup(elm, $(elm).parents('.prop-box').find('.ns-full-list:first').html());
321+
}

web/js/app.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ var App = {
7878
Core: {},
7979
Bash: {},
8080
Console: {},
81-
Constants: {},
81+
Constants: {
82+
TABS: ['USER','WEB_DOMAIN','MAIL','DB','DNS','IP','CRON']
83+
},
8284
Actions: {},
8385
Helpers: {},
8486
Filters: {},
@@ -175,16 +177,7 @@ App.Ajax.request = function(jedi_method, data, callback)
175177
{
176178
App.Helpers.beforeAjax(jedi_method);
177179
$.ajax({
178-
url: function() {
179-
var url_parts = location.href.replace('#', '').split('/');
180-
if (url_parts[url_parts.length -1] == 'index.html') {
181-
url_parts[url_parts.length -1] = 'dispatch.php';
182-
}
183-
else {
184-
url_parts.push('dispatch.php');
185-
}
186-
return url_parts.join('/');
187-
}(),
180+
url: App.Helpers.getBackendUrl(),
188181
global: false,
189182
type: data.request_method || "POST",
190183
data: $.extend(data, {'jedi_method': jedi_method}),

web/js/helpers.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,26 @@ App.Helpers.closeInnerPopup = function(evt)
264264
{
265265
$('#inner-popup').remove();
266266
}
267+
268+
App.Helpers.getBackendUrl = function()
269+
{
270+
var url_parts = location.href.split('#');
271+
if (url_parts.length > 1) {
272+
var tab = url_parts[url_parts.length - 1];
273+
if ($.inArray(tab, App.Constants.TABS) != -1) {
274+
App.Tmp.loadTAB = tab;
275+
}
276+
}
277+
278+
var url_parts = location.href.split('?', 1);
279+
var url = url_parts[0];
280+
url_parts = url.split('/');
281+
if (url_parts[url_parts.length -1] == 'index.html') {
282+
url_parts[url_parts.length -1] = 'dispatch.php';
283+
}
284+
else {
285+
url_parts.push('dispatch.php');
286+
}
287+
288+
return url_parts.join('/');
289+
}

0 commit comments

Comments
 (0)