Merge branch 'master' of github.com:serghey-rodin/vesta

This commit is contained in:
Serghey Rodin 2011-08-24 09:24:43 +03:00
commit d5361b6f70
22 changed files with 227 additions and 47 deletions

63
web/css/popup.css Normal file
View file

@ -0,0 +1,63 @@
/* Styles for popups */
.d-popup{
position:absolute;
top:100px;
left:0;
z-index:100;
background-color:#ccc;
background:url(../images/info-popup-bg-2.png) repeat;
width:250px;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
.d-popup-inner{
padding:20px;
}
.d-popup .close{
position:absolute;
top:10px;
right:10px;
display:block;
width:13px;
height:13px;
background:url(../images/info-popup-sprite.png) no-repeat;
cursor:pointer;
}
.d-popup span.close:hover{
background-position:0 -13px;
}
.d-popup span.close:active{
background-position:0 -26px;
}
.d-popup-title{
font-size:11px;
text-transform:uppercase;
text-align:center;
color:#fffdd4;
margin:0 0 9px;
}
.d-popup-items{
font-size:12px;
color:#fff;
}
.d-popup-items .item{
margin:0 0 9px;
}
.d-popup-items a{
color:#aaa;
padding-right:5px;
}
.d-popup .prop-box{
display:block;
}
.d-popup .prop-title{
color:#bbb;
}
.d-popup .prop-value{
color:#fff;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

BIN
web/images/auth-plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

BIN
web/images/checkbox-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

BIN
web/images/dotted.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
web/images/stats-brace.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

View file

@ -8,6 +8,7 @@
<link rel="stylesheet" media="all" type="text/css" href="css/reset2.css" /> <link rel="stylesheet" media="all" type="text/css" href="css/reset2.css" />
<link rel="stylesheet" media="all" type="text/css" href="css/main.css" /> <link rel="stylesheet" media="all" type="text/css" href="css/main.css" />
<link rel="stylesheet" media="all" type="text/css" href="css/popup.css" />
<!--[if lt IE 8]> <!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="http://dl.dropbox.com/u/1750887/projects/vesta2/css/ie.css" /> <link rel="stylesheet" type="text/css" href="http://dl.dropbox.com/u/1750887/projects/vesta2/css/ie.css" />
@ -52,7 +53,6 @@
<h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1> <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
</div> </div>
<ul class="settings"> <ul class="settings">
<li><a href="#">settings</a></li> <li><a href="#">settings</a></li>
<li><a href="#">exit</a></li> <li><a href="#">exit</a></li>
</ul> </ul>
@ -64,11 +64,11 @@
<dl class="users-nav-item"> <dl class="users-nav-item">
<dt class="section-title cc"> <dt class="section-title cc">
<span class="to-section">Users</span> <span class="to-section">Users</span>
<i class="add-entry">&nbsp;</i> <i class="add-entry do_action_new_entry">&nbsp;</i>
</dt> </dt>
<dd class="section-contains"> <dd class="section-contains">
<span class="def">0 users</span> <span class="def"><span class="num-total">0</span> users</span>
<span class="def">0 blocked</span> <span class="def"><span class="num-blocked">0</span> blocked</span>
</dd> </dd>
</dl> </dl>
</div> </div>
@ -80,12 +80,11 @@
<dl class="users-nav-item"> <dl class="users-nav-item">
<dt class="section-title cc"> <dt class="section-title cc">
<span class="to-section">Web Domain</span> <span class="to-section">Web Domain</span>
<i class="add-entry">&nbsp;</i> <i class="add-entry do_action_new_entry">&nbsp;</i>
</dt> </dt>
<dd class="section-contains"> <dd class="section-contains">
<span class="def">0 users</span> <span class="def"><span class="num-total">0</span> web domains</span>
<span class="def">0 blocked</span> <span class="def"><span class="num-blocked">0</span> blocked</span>
<span class="def">3 waiting</span>
</dd> </dd>
</dl> </dl>
</div> </div>
@ -95,12 +94,10 @@
<dl class="users-nav-item"> <dl class="users-nav-item">
<dt class="section-title cc"> <dt class="section-title cc">
<span class="to-section">Mail</span> <span class="to-section">Mail</span>
<i class="add-entry">&nbsp;</i> <i class="add-entry do_action_new_entry">&nbsp;</i>
</dt> </dt>
<dd class="section-contains"> <dd class="section-contains">
<span class="def">0 users</span> <span class="def"><span class="num-total">0</span> mails</span>
<span class="def">0 blocked</span>
<span class="def">3 waiting</span>
</dd> </dd>
</dl> </dl>
</div> </div>
@ -110,12 +107,11 @@
<dl class="users-nav-item"> <dl class="users-nav-item">
<dt class="section-title cc"> <dt class="section-title cc">
<span class="to-section">DB</span> <span class="to-section">DB</span>
<i class="add-entry">&nbsp;</i> <i class="add-entry do_action_new_entry">&nbsp;</i>
</dt> </dt>
<dd class="section-contains"> <dd class="section-contains">
<span class="def">0 users</span> <span class="def"><span class="num-total">0</span> databases</span>
<span class="def">0 blocked</span> <span class="def"><span class="num-blocked">0</span> blocked</span>
<span class="def">3 waiting</span>
</dd> </dd>
</dl> </dl>
</div> </div>
@ -125,7 +121,7 @@
<dl class="users-nav-item"> <dl class="users-nav-item">
<dt class="section-title cc"> <dt class="section-title cc">
<span class="to-section">DNS</span> <span class="to-section">DNS</span>
<i class="add-entry">&nbsp;</i> <i class="add-entry do_action_new_entry">&nbsp;</i>
</dt> </dt>
<dd class="section-contains"> <dd class="section-contains">
<span class="def total_dns_records">0 total records</span> <span class="def total_dns_records">0 total records</span>
@ -138,12 +134,11 @@
<dl class="users-nav-item"> <dl class="users-nav-item">
<dt class="section-title cc"> <dt class="section-title cc">
<span class="to-section">IP</span> <span class="to-section">IP</span>
<i class="add-entry">&nbsp;</i> <i class="add-entry do_action_new_entry">&nbsp;</i>
</dt> </dt>
<dd class="section-contains"> <dd class="section-contains">
<span class="def">0 users</span> <span class="def"><span class="num-total">0</span> ip entries</span>
<span class="def">0 blocked</span> <span class="def"><span class="num-blocked">0</span> blocked</span>
<span class="def">3 waiting</span>
</dd> </dd>
</dl> </dl>
</div> </div>
@ -153,12 +148,11 @@
<dl class="users-nav-item"> <dl class="users-nav-item">
<dt class="section-title cc"> <dt class="section-title cc">
<span class="to-section">Cron</span> <span class="to-section">Cron</span>
<i class="add-entry">&nbsp;</i> <i class="add-entry do_action_new_entry">&nbsp;</i>
</dt> </dt>
<dd class="section-contains"> <dd class="section-contains">
<span class="def">0 users</span> <span class="def"><span class="num-total">0</span> cron records</span>
<span class="def">0 blocked</span> <span class="def"><span class="num-blocked">0</span> blocked</span>
<span class="def">3 waiting</span>
</dd> </dd>
</dl> </dl>
</div> </div>
@ -190,7 +184,12 @@
<div class="b-console-results"></div> <div class="b-console-results"></div>
</div> </div>
</div> </div>
<div id="actions-toolbar" class="cc"><a class="add-domain do_action_new_entry" href="javascript:void(0)"><i class="icon do_action_new_entry">&nbsp;</i>add new domain</a></div> <div id="actions-toolbar" class="cc">
<a class="add-domain do_action_new_entry" href="javascript:void(0)">
<i class="icon do_action_new_entry">&nbsp;</i>
add new entry
</a>
</div>
<div id="content"> <div id="content">

View file

@ -15,6 +15,7 @@ App.Constants.DNS_FORM_ID = 'dns-form';
App.Constants.USER_FORM_ID = 'user-form'; App.Constants.USER_FORM_ID = 'user-form';
App.Constants.WEB_DOMAIN_FORM_ID = 'web_domain-form'; App.Constants.WEB_DOMAIN_FORM_ID = 'web_domain-form';
App.Constants.DB_FORM_ID = 'db-form'; App.Constants.DB_FORM_ID = 'db-form';
App.Constants.CRON_FORM_ID = 'cron-form';
App.Settings.ajax_url = 1; App.Settings.ajax_url = 1;
App.Settings.uri = location.href.replace('index.html', ''); App.Settings.uri = location.href.replace('index.html', '');

View file

@ -135,6 +135,7 @@ App.Actions.cancel_form = function(evt, params) {
$('#' + form_id).remove(); $('#' + form_id).remove();
} }
else { else {
fb.warn(elm.find('.source').val());
var options = App.Helpers.evalJSON(elm.find('.source').val()); var options = App.Helpers.evalJSON(elm.find('.source').val());
var entry_name = App.Env.world.toLowerCase() + '_entry'; var entry_name = App.Env.world.toLowerCase() + '_entry';
var tpl = App.HTML.Build[entry_name](options); var tpl = App.HTML.Build[entry_name](options);

View file

@ -189,13 +189,15 @@ App.Ajax.request = function(jedi_method, data, callback)
type: data.request_method || "POST", type: data.request_method || "POST",
data: $.extend(data, {'jedi_method': jedi_method}), data: $.extend(data, {'jedi_method': jedi_method}),
dataType: "text", dataType: "text",
async:true, async: true,
success: function(reply) success: function(reply)
{ {
timer.start(); reply = reply.replace(/\\'/gi, '');
reply = reply.replace(/\'/gi, '');
//timer.start();
callback && callback(jsonParse(reply)); callback && callback(jsonParse(reply));
App.Helpers.afterAjax(); App.Helpers.afterAjax();
timer.stop(jedi_method); //timer.stop(jedi_method);
}, },
error: function() error: function()
{ {

View file

@ -70,13 +70,21 @@ App.Helpers.getFirstKey = function(obj)
App.Helpers.updateInitial = function() App.Helpers.updateInitial = function()
{ {
// TODO: need api method // TODO: need api method
$.each(App.Env.initialParams, function(key) { $.each(App.Env.initialParams.totals, function(key) {
var item = App.Env.initialParams[key]; var item = App.Env.initialParams.totals[key];
$.each(item, function (i, o) { var expr_id = '#'+key;
if (i.indexOf('total_') != -1) { if ('undefined' != typeof item.total) {
App.View.updateInitialInfo(i, o); var ref = $(expr_id).find('.num-total');
if (ref.length > 0) {
$(ref).html(item.total);
} }
}); }
if ('undefined' != typeof item.blocked) {
var ref = $(expr_id).find('.num-blocked');
if (ref.length > 0) {
$(ref).html(item.blocked);
}
}
}); });
} }
@ -123,14 +131,17 @@ App.Helpers.getFirstValue = function(obj)
return first; return first;
} }
App.Helpers.evalJSON = function(string) App.Helpers.evalJSON = function(str)
{ {
return $.parseJSON(string); /*str = str.replace(/\\'/gi, '');
str = str.replace(/\'/gi, '');
fb.warn(str);*/
return $.parseJSON(str);
} }
App.Helpers.toJSON = function(object) App.Helpers.toJSON = function(object)
{ {
return ($.toJSON(object).replace(/'/gi, '')); return ($.toJSON(object).replace(/\\'/gi, ''));
} }

View file

@ -359,6 +359,38 @@ App.HTML.Build.cron_entry = function(o, key)
} }
App.HTML.Build.cron_form = function(options, id)
{try{
if('undefined' == typeof App.Env.initialParams) {
return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
}
var tpl = App.Templates.get('FORM', 'cron');
tpl.set(':source', options);
tpl.set(':id', id || '');
options = App.Helpers.evalJSON(options) || {};
if (App.Helpers.isEmpty(options)) {
tpl.set(':title', 'New cron entry');
tpl.set(':save_button', 'ADD');
}
else {
tpl.set(':title', 'Edit cron entry');
tpl.set(':save_button', 'SAVE');
}
options = !App.Helpers.isEmpty(options) ? options : {DAY:'', MONTH: '', WDAY:'',HOUR:'',CMD:'',MIN:''};
tpl = App.HTML.setTplKeys(tpl, options);
/*tpl.set(':id', id || '');
tpl.set(':IP_ADDRESS', options.IP_ADDRESS || '');
tpl.set(':NETMASK', options.NETMASK || '');
tpl.set(':NAME', options.NAME || '');*/
//tpl = App.HTML.Build.ip_selects(tpl, options);
}catch(e){fb.error(e);}
return tpl.finalize();
}
App.HTML.Build.dns_records = function(records) App.HTML.Build.dns_records = function(records)
{ {
var acc = []; var acc = [];

View file

@ -21,7 +21,7 @@ App.Model.WEB_DOMAIN.loadList = function()
App.Model.MAIL.loadList = function() App.Model.MAIL.loadList = function()
{ {
//App.Ajax.request('MAIL.getList', {}, App.View.listItems); //App.Ajax.request('MAIL.getList', {}, App.View.listItems);
App.Ref.CONTENT.html('<center><h1 style="padding-top: 20px;font-size: 28px;">Under maintanance</h1></center>'); App.Ref.CONTENT.html('<center><h1 style="padding-top: 20px; font-size: 28px; position: absolute; margin-left: 351px; color: white; text-shadow: 2px 1px 1px rgb(65, 124, 213);">Under maintanance</h1><img width="900px" src="http://dev.vestacp.com:8083/images/Asteroid_Vesta.jpg"></center>');
} }
App.Model.DB.loadList = function() App.Model.DB.loadList = function()

View file

@ -1,7 +1,7 @@
App.Pages.init = function(){ App.Pages.init = function(){
App.Ajax.request('MAIN.getInitial', {}, function(reply){ App.Ajax.request('MAIN.getInitial', {}, function(reply){
App.Env.initialParams = reply.data; App.Env.initialParams = reply.data;
//App.Helpers.updateInitial(); App.Helpers.updateInitial();
}); });
App.Pages.prepareHTML(); App.Pages.prepareHTML();

View file

@ -44,7 +44,7 @@ App.Templates.html = {
dns: { dns: {
FORM: [ FORM: [
'<div style="margin-top: 25px;" class="b-new-entry b-new-entry_dns" id="~!:id~!">\ '<div style="margin-top: 25px;" class="b-new-entry b-new-entry_dns" id="~!:id~!">\
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\ <input type="hidden" name="source" class="source" value=~!:source~!>\
<input type="hidden" name="target" class="target" value=\'\'>\ <input type="hidden" name="target" class="target" value=\'\'>\
<div class="entry-header">~!:title~!</div>\ <div class="entry-header">~!:title~!</div>\
<div class="errors">\ <div class="errors">\
@ -86,8 +86,8 @@ App.Templates.html = {
], ],
ENTRIES_WRAPPER: ['<div class="dns-list items-list">~!:content~!</div>'], ENTRIES_WRAPPER: ['<div class="dns-list items-list">~!:content~!</div>'],
ENTRY: ['<div class="row dns-details-row ~!:CHECKED~!">\ ENTRY: ['<div class="row dns-details-row ~!:CHECKED~!">\
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\ <input type="hidden" name="source" class="source" value=~!:source~! />\
<input type="hidden" class="target" name="target" value="" />\ <input type="hidden" class="target" name="target" value=\'\' />\
<div class="row-actions-box cc">\ <div class="row-actions-box cc">\
<div class="check-this check-control"></div>\ <div class="check-this check-control"></div>\
<div class="row-operations">\ <div class="row-operations">\
@ -763,9 +763,66 @@ App.Templates.html = {
</div>'] </div>']
}, },
cron: { cron: {
FORM: ['<div class="b-new-entry b-new-entry_cron" id="~!:id~!" >\
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
<input type="hidden" name="target" class="target" value=\'\'>\
<div class="entry-header">~!:title~!</div>\
<div class="form-error">\
<div class="error-box">\
</div>\
</div>\
<div class="form-row form-row-line run-at-box cc">\
<span class="row-header">run at:</span>\
<div class="field-box cron-minute-box">\
<label for="#" class="field-label">minute:<br>(0&mdash;59)</label>\
<div class="field-box-inner cc">\
<input type="text" value="~!:MIN~!" name="MIN" class="text-field">\
</div>\
</div>\
<div class="field-box cron-hour-box">\
<label for="#" class="field-label">hour:<br>(0&mdash;23)</label>\
<div class="field-box-inner cc">\
<input type="text" value="~!:HOUR~!" name="HOUR" class="text-field">\
</div>\
</div>\
<div class="field-box cron-day-box">\
<label for="#" class="field-label">day of Month:<br>(1&mdash;31)</label>\
<div class="field-box-inner cc">\
<input type="text" value="~!:DAY~!" name="DAY" class="text-field">\
</div>\
</div>\
<div class="field-box cron-month-box">\
<label for="#" class="field-label">Month:<br>(1&mdash;12)(Jan&mdash;Dec)</label>\
<div class="field-box-inner cc">\
<input type="text" value="~!:MONTH~!" name="MONTH" class="text-field">\
</div>\
</div>\
<div class="field-box cron-week-box">\
<label for="#" class="field-label">day of Week:<br>(1&mdash;7)(Sun&mdash;Sat)</label>\
<div class="field-box-inner cc">\
<input type="text" value="~!:WDAY~!" name="WDAY" class="text-field">\
</div>\
</div>\
</div>\
<div class="form-row cc">\
<label for="#" class="field-label">command:</label>\
<textarea class="textarea" name="CMD">~!:CMD~!</textarea>\
</div>\
<div class="form-row cc">\
<label for="#" class="field-label">report to: <span class="remark">(devide by comma ",")</span></label>\
<textarea class="textarea" name="REPORT_TO"></textarea>\
</div>\
<div class="form-row buttons-row cc">\
<input type="submit" value="~!:save_button~!" class="add-entry-btn do_action_save_form">\
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
<a target="_blank" href="http://vestacp.com/docs/cron/" class="help-btn">Help</a>\
</div>\
</div>'],
ENTRIES_WRAPPER: ['<div class="db-list">~!:content~!</div>'], ENTRIES_WRAPPER: ['<div class="db-list">~!:content~!</div>'],
ENTRY: ['<div class="row first-row cron-details-row">\ ENTRY: ['<div class="row first-row cron-details-row">\
<div class="row-actions-box cc">\ <input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
<input type="hidden" name="target" class="target" value=\'\'>\
<div class="row-actions-box cc">\
<div class="check-this check-control"></div>\ <div class="check-this check-control"></div>\
<div class="row-operations">\ <div class="row-operations">\
~!:SUSPENDED_TPL~!\ ~!:SUSPENDED_TPL~!\

View file

@ -26,7 +26,7 @@ App.Validate.form = function(world, elm)
} }
else { else {
if ($(field).val().trim() == '') { if ($(field).val().trim() == '' || $(field).val().trim() == '-') {
App.Env.FormError.push($(field).attr('name') + ' is required'); App.Env.FormError.push($(field).attr('name') + ' is required');
form_valid = false; form_valid = false;
} }

View file

@ -71,7 +71,8 @@ class MAIN extends AjaxHandler
'IP' => $this->getIpParams($data_ip), 'IP' => $this->getIpParams($data_ip),
'DNS' => $this->getDnsParams(), 'DNS' => $this->getDnsParams(),
'DB' => $this->getDbParams($data_db), 'DB' => $this->getDbParams($data_db),
'USERS' => $this->getUsersParams($data_users) 'USERS' => $this->getUsersParams($data_users),
'totals' => $this->getTotals()
); );
return $this->reply(true, $reply); return $this->reply(true, $reply);
@ -81,6 +82,19 @@ class MAIN extends AjaxHandler
// //
// //
public function getTotals($data = array())
{
return array(
'USER' => array('total' => 7, 'blocked' => 0),
'WEB_DOMAIN' => array('total' => 4, 'blocked' => 0),
'MAIL' => array('total' => 0),
'DB' => array('total' => 4, 'blocked' => 0),
'DNS' => array('total' => 4, 'blocked' => 0),
'IP' => array('total' => 2, 'blocked' => 0),
'CRON' => array('total' => 5, 'blocked' => 0)
);
}
/** /**
* WEB DOMAIN initial params * WEB DOMAIN initial params
* *