mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
SLL certificates upload implementation step #1
This commit is contained in:
parent
994b0cfa14
commit
373c5f25b2
10 changed files with 52 additions and 171 deletions
|
@ -187,7 +187,7 @@
|
||||||
<div id="actions-toolbar" class="cc">
|
<div id="actions-toolbar" class="cc">
|
||||||
<a class="add-domain do_action_new_entry" href="javascript:void(0)">
|
<a class="add-domain do_action_new_entry" href="javascript:void(0)">
|
||||||
<i class="icon do_action_new_entry"> </i>
|
<i class="icon do_action_new_entry"> </i>
|
||||||
add new <span id="new-entry-keyword">entry</span>
|
add new <span id="new-entry-keyword" class="do_action_new_entry">entry</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ App.Settings.Imutable.IP = ['INTERFACE'];
|
||||||
// Empty
|
// Empty
|
||||||
App.Empty = {};
|
App.Empty = {};
|
||||||
App.Empty.USER = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','LNAME':'', 'FNAME':'','NS1':'','NS2':'','NS3':'','NS4':'','NS5':'','NS6':'','NS7':'','NS8':''};
|
App.Empty.USER = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','LNAME':'', 'FNAME':'','NS1':'','NS2':'','NS3':'','NS4':'','NS5':'','NS6':'','NS7':'','NS8':''};
|
||||||
App.Empty.WEB_DOMAIN = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','NS':'', 'DOMAIN':'','SSL_CERT':'','SSL_HOME':'','STATS_PASSWORD':'','STATS_LOGIN':'','ALIAS':''};
|
App.Empty.WEB_DOMAIN = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','NS':'', 'DOMAIN':'','SSL_CERT':'','SSL_KEY':'','SSL_HOME':'','STATS_PASSWORD':'','STATS_LOGIN':'','ALIAS':''};
|
||||||
App.Empty.DB = {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''};
|
App.Empty.DB = {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''};
|
||||||
|
|
||||||
App.Settings.getMethodName = function(action)
|
App.Settings.getMethodName = function(action)
|
||||||
|
|
|
@ -184,11 +184,19 @@ App.Ajax.request = function(jedi_method, data, callback)
|
||||||
dataType: "text",
|
dataType: "text",
|
||||||
async: true,
|
async: true,
|
||||||
success: function(reply)
|
success: function(reply)
|
||||||
{
|
{
|
||||||
reply = reply.replace(/\\'/gi, '');
|
reply = reply.replace(/\\'/gi, '');
|
||||||
reply = reply.replace(/\'/gi, '');
|
reply = reply.replace(/\'/gi, '');
|
||||||
|
|
||||||
|
reply = jsonParse(reply);
|
||||||
|
|
||||||
|
if (reply.result == 'NOT_AUTHORISED') {
|
||||||
|
|
||||||
|
return alert('NOT AUTH');
|
||||||
|
}
|
||||||
|
|
||||||
//timer.start();
|
//timer.start();
|
||||||
callback && callback(jsonParse(reply));
|
callback && callback(reply);
|
||||||
App.Helpers.afterAjax();
|
App.Helpers.afterAjax();
|
||||||
//timer.stop(jedi_method);
|
//timer.stop(jedi_method);
|
||||||
},
|
},
|
||||||
|
|
|
@ -473,6 +473,12 @@ App.HTML.Build.dns_subrecord = function(record)
|
||||||
return tpl;
|
return tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App.HTML.Build.ssl_key_file = function()
|
||||||
|
{
|
||||||
|
return '<iframe src="http://dev.vestacp.com:8083/vesta/upload.php?action=show&type=key" width="500px;" height="50px;" framevorder="0" scroll="no">..</iframe>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
App.HTML.Build.user_selects = function(tpl, options)
|
App.HTML.Build.user_selects = function(tpl, options)
|
||||||
{
|
{
|
||||||
var acc = [];
|
var acc = [];
|
||||||
|
|
|
@ -1,153 +1 @@
|
||||||
/*
|
|
||||||
|
|
||||||
CUSTOM FORM ELEMENTS
|
|
||||||
|
|
||||||
Created by Ryan Fait
|
|
||||||
www.ryanfait.com
|
|
||||||
|
|
||||||
The only things you may need to change in this file are the following
|
|
||||||
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)
|
|
||||||
|
|
||||||
The numbers you set for checkboxHeight and radioHeight should be one quarter
|
|
||||||
of the total height of the image want to use for checkboxes and radio
|
|
||||||
buttons. Both images should contain the four stages of both inputs stacked
|
|
||||||
on top of each other in this order: unchecked, unchecked-clicked, checked,
|
|
||||||
checked-clicked.
|
|
||||||
|
|
||||||
You may need to adjust your images a bit if there is a slight vertical
|
|
||||||
movement during the different stages of the button activation.
|
|
||||||
|
|
||||||
The value of selectWidth should be the width of your select list image.
|
|
||||||
|
|
||||||
Visit http://ryanfait.com/ for more information.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
var checkboxHeight = "25";
|
|
||||||
var radioHeight = "25";
|
|
||||||
var selectWidth = "210";
|
|
||||||
|
|
||||||
|
|
||||||
/* No need to change anything after this */
|
|
||||||
|
|
||||||
|
|
||||||
document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');
|
|
||||||
|
|
||||||
var Custom = {
|
|
||||||
init: function() {
|
|
||||||
var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
|
|
||||||
for(a = 0; a < inputs.length; a++) {
|
|
||||||
if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
|
|
||||||
span[a] = document.createElement("span");
|
|
||||||
span[a].className = inputs[a].type;
|
|
||||||
|
|
||||||
if(inputs[a].checked == true) {
|
|
||||||
if(inputs[a].type == "checkbox") {
|
|
||||||
position = "0 -" + (checkboxHeight*2) + "px";
|
|
||||||
span[a].style.backgroundPosition = position;
|
|
||||||
} else {
|
|
||||||
position = "0 -" + (radioHeight*2) + "px";
|
|
||||||
span[a].style.backgroundPosition = position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputs[a].parentNode.insertBefore(span[a], inputs[a]);
|
|
||||||
inputs[a].onchange = Custom.clear;
|
|
||||||
if(!inputs[a].getAttribute("disabled")) {
|
|
||||||
span[a].onmousedown = Custom.pushed;
|
|
||||||
span[a].onmouseup = Custom.check;
|
|
||||||
} else {
|
|
||||||
span[a].className = span[a].className += " disabled";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputs = document.getElementsByTagName("select");
|
|
||||||
for(a = 0; a < inputs.length; a++) {
|
|
||||||
try{
|
|
||||||
fb.log($(inputs[a]).hasClass("styled"));
|
|
||||||
if($(inputs[a]).hasClass("styled")) {
|
|
||||||
option = inputs[a].getElementsByTagName("option");
|
|
||||||
active = option[0].childNodes[0].nodeValue;
|
|
||||||
textnode = document.createTextNode(active);
|
|
||||||
for(b = 0; b < option.length; b++) {
|
|
||||||
if(option[b].selected == true) {
|
|
||||||
textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
span[a] = document.createElement("span");
|
|
||||||
span[a].className = "select";
|
|
||||||
span[a].id = "select-" + inputs[a].name + a;
|
|
||||||
span[a].appendChild(textnode);
|
|
||||||
inputs[a].parentNode.insertBefore(span[a], inputs[a]);
|
|
||||||
inputs[a].id = inputs[a].name + a;
|
|
||||||
if(!inputs[a].getAttribute("disabled")) {
|
|
||||||
inputs[a].onchange = Custom.choose;
|
|
||||||
} else {
|
|
||||||
inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch(e){fb.error(e);}
|
|
||||||
}
|
|
||||||
document.onmouseup = Custom.clear;
|
|
||||||
},
|
|
||||||
pushed: function() {
|
|
||||||
element = this.nextSibling;
|
|
||||||
if(element.checked == true && element.type == "checkbox") {
|
|
||||||
this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
|
|
||||||
} else if(element.checked == true && element.type == "radio") {
|
|
||||||
this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
|
|
||||||
} else if(element.checked != true && element.type == "checkbox") {
|
|
||||||
this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
|
|
||||||
} else {
|
|
||||||
this.style.backgroundPosition = "0 -" + radioHeight + "px";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
check: function() {
|
|
||||||
element = this.nextSibling;
|
|
||||||
if(element.checked == true && element.type == "checkbox") {
|
|
||||||
this.style.backgroundPosition = "0 0";
|
|
||||||
element.checked = false;
|
|
||||||
} else {
|
|
||||||
if(element.type == "checkbox") {
|
|
||||||
this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
|
|
||||||
} else {
|
|
||||||
this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
|
|
||||||
group = this.nextSibling.name;
|
|
||||||
inputs = document.getElementsByTagName("input");
|
|
||||||
for(a = 0; a < inputs.length; a++) {
|
|
||||||
if(inputs[a].name == group && inputs[a] != this.nextSibling) {
|
|
||||||
inputs[a].previousSibling.style.backgroundPosition = "0 0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
element.checked = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clear: function() {
|
|
||||||
inputs = document.getElementsByTagName("input");
|
|
||||||
for(var b = 0; b < inputs.length; b++) {
|
|
||||||
if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
|
|
||||||
inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
|
|
||||||
} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
|
|
||||||
inputs[b].previousSibling.style.backgroundPosition = "0 0";
|
|
||||||
} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
|
|
||||||
inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
|
|
||||||
} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
|
|
||||||
inputs[b].previousSibling.style.backgroundPosition = "0 0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
choose: function() {
|
|
||||||
option = this.getElementsByTagName("option");
|
|
||||||
for(d = 0; d < option.length; d++) {
|
|
||||||
if(option[d].selected == true) {
|
|
||||||
//
|
|
||||||
var expr = '#select-' + this.id;
|
|
||||||
fb.log(expr);
|
|
||||||
$(expr).text(option[d].childNodes[0].nodeValue);
|
|
||||||
// bad!
|
|
||||||
//document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
window.onload = Custom.init;
|
|
|
@ -58,5 +58,23 @@ App.Pages.USER.new_entry = function(evt)
|
||||||
var tpl = App.HTML.Build[build_method]({}, form_id);
|
var tpl = App.HTML.Build[build_method]({}, form_id);
|
||||||
App.Ref.CONTENT.prepend(tpl);
|
App.Ref.CONTENT.prepend(tpl);
|
||||||
App.Helpers.updateScreen();
|
App.Helpers.updateScreen();
|
||||||
$('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden');
|
$('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
App.Pages.WEB_DOMAIN.new_entry = function(evt)
|
||||||
|
{
|
||||||
|
var form_id = App.Constants[App.Env.world + '_FORM_ID'];
|
||||||
|
$('#'+form_id).remove();
|
||||||
|
var build_method = App.Env.getWorldName() + '_form';
|
||||||
|
var tpl = App.HTML.Build[build_method]({}, form_id);
|
||||||
|
App.Ref.CONTENT.prepend(tpl);
|
||||||
|
App.Helpers.updateScreen();
|
||||||
|
$('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden');
|
||||||
|
var ssl_key_upload = App.HTML.Build.ssl_key_file();
|
||||||
|
$('#'+form_id).find('.ssl-key-input-dummy:first').replaceWith(ssl_key_upload);
|
||||||
|
}
|
||||||
|
|
||||||
|
App.Pages.WEB_DOMAIN.setSSL = function(content, type)
|
||||||
|
{
|
||||||
|
fb.warn(content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,7 +492,7 @@ App.Templates.html = {
|
||||||
</div><!-- // .row-details -->\
|
</div><!-- // .row-details -->\
|
||||||
</div>']
|
</div>']
|
||||||
},
|
},
|
||||||
web_domain: {
|
web_domain: {
|
||||||
FORM: ['<div id="~!:id~!" class="b-new-entry b-new-entry_domain form">\
|
FORM: ['<div id="~!:id~!" class="b-new-entry b-new-entry_domain form">\
|
||||||
<input type="hidden" class="source" name="source" value=\'~!:source~!\' />\
|
<input type="hidden" class="source" name="source" value=\'~!:source~!\' />\
|
||||||
<input type="hidden" class="target" name="target" value="" />\
|
<input type="hidden" class="target" name="target" value="" />\
|
||||||
|
@ -565,8 +565,13 @@ App.Templates.html = {
|
||||||
<input type="text" name="SSL_HOME" class="text-field" value="~!:SSL_HOME~!">\
|
<input type="text" name="SSL_HOME" class="text-field" value="~!:SSL_HOME~!">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row ssl-crtfct-box cc">\
|
<div class="form-row ssl-crtfct-box cc">\
|
||||||
|
<label for="#" class="field-label">ssl key: <span class="remark">(upload file or insert text)</span></label>\
|
||||||
|
<span class="ssl-key-input-dummy">...</span>\
|
||||||
|
<textarea name="SSL_KEY" class="textarea">~!:SSL_KEY~!</textarea>\
|
||||||
|
</div>\
|
||||||
|
<div class="form-row ssl-crtfct-box cc">\
|
||||||
<label for="#" class="field-label">ssl certificate: <span class="remark">(upload file or insert text)</span></label>\
|
<label for="#" class="field-label">ssl certificate: <span class="remark">(upload file or insert text)</span></label>\
|
||||||
<input type="file" value="" size="43" class="file-upload">\
|
<span class="ssl-cert-input-dummy">...</span>\
|
||||||
<textarea name="SSL_CERT" class="textarea">~!:SSL_CERT~!</textarea>\
|
<textarea name="SSL_CERT" class="textarea">~!:SSL_CERT~!</textarea>\
|
||||||
</div>\
|
</div>\
|
||||||
</div><!-- // advanced options -->\
|
</div><!-- // advanced options -->\
|
||||||
|
|
|
@ -47,6 +47,8 @@ class AjaxHandler {
|
||||||
throw new SystemException(Message::INVALID_METHOD);
|
throw new SystemException(Message::INVALID_METHOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return $this->reply('NOT_AUTHORISED');
|
||||||
|
|
||||||
require $inc_file;
|
require $inc_file;
|
||||||
|
|
||||||
$space = new $method['namespace'];
|
$space = new $method['namespace'];
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$url = "http://dev.vestacp.com:8083/dispatch.php";
|
|
||||||
$useragent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
|
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_URL,$url);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
|
|
||||||
$result= curl_exec ($ch);
|
|
||||||
curl_close ($ch);
|
|
||||||
die();
|
|
||||||
|
|
||||||
|
|
||||||
define('V_ROOT_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
define('V_ROOT_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
require_once V_ROOT_DIR . 'config/Config.class.php';
|
require_once V_ROOT_DIR . 'config/Config.class.php';
|
||||||
|
|
|
@ -5,6 +5,11 @@ class VestaSession
|
||||||
|
|
||||||
static public $instance = null;
|
static public $instance = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//session_start();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab current instance or create it
|
* Grab current instance or create it
|
||||||
*
|
*
|
||||||
|
@ -17,6 +22,7 @@ class VestaSession
|
||||||
|
|
||||||
public function getUser()
|
public function getUser()
|
||||||
{
|
{
|
||||||
|
//var_dump($_SESSION);die();
|
||||||
return array('uid' => 'vesta');
|
return array('uid' => 'vesta');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue