diff --git a/test/test_actions.sh b/test/test_actions.sh index 1e4396bd..c57df4fb 100755 --- a/test/test_actions.sh +++ b/test/test_actions.sh @@ -6,14 +6,14 @@ V_BIN="$VESTA/bin" V_TEST="$VESTA/test" # Define functions -tmp_user() { +random() { MATRIX='0123456789' - LENGTH=4 + LENGTH=$1 while [ ${n:=1} -le $LENGTH ]; do rand="$rand${MATRIX:$(($RANDOM%${#MATRIX})):1}" let n+=1 done - echo "tmp_$rand" + echo "$rand" } echo_result() { @@ -25,8 +25,8 @@ echo_result() { echo -n 'FAILED' echo -n ']' echo -ne '\r\n' - echo "$4" - echo "RETURN VALUE $2" + echo ">>> $4" + echo ">>> RETURN VALUE $2" cat $3 else echo -n ' OK ' @@ -36,54 +36,63 @@ echo_result() { } # Create random username -user=$(tmp_user) +user="tmp_$(random 4)" while [ ! -z "$(grep "^$user:" /etc/passwd)" ]; do - user=$(tmp_user) + user="tmp_$(random 4)" done # Create random tmpfile tmpfile=$(mktemp -p /tmp ) + # Add new user cmd="v_add_user $user $user $user@vestacp.com default Super Test" $cmd > $tmpfile 2>> $tmpfile echo_result "Adding new user $user" "$?" "$tmpfile" "$cmd" + # Change system shell cmd="v_change_user_shell $user bash" $cmd > $tmpfile 2>> $tmpfile echo_result "Changing system shell to /bin/bash" "$?" "$tmpfile" "$cmd" + # Change name servers cmd="v_change_user_ns $user ns0.com ns1.com ns2.com ns3.com" $cmd > $tmpfile 2>> $tmpfile echo_result "Changing nameservers" "$?" "$tmpfile" "$cmd" + # Add cron job cmd="v_add_cron_job $user 1 1 1 1 1 echo" $cmd > $tmpfile 2>> $tmpfile echo_result "Adding cron job" "$?" "$tmpfile" "$cmd" + # Suspend cron job cmd="v_suspend_cron_job $user 1" $cmd > $tmpfile 2>> $tmpfile echo_result "Suspending cron job" "$?" "$tmpfile" "$cmd" + # Unsuspend cron job cmd="v_unsuspend_cron_job $user 1" $cmd > $tmpfile 2>> $tmpfile echo_result "Unsuspending cron job" "$?" "$tmpfile" "$cmd" + # Delete cron job cmd="v_delete_cron_job $user 1" $cmd > $tmpfile 2>> $tmpfile echo_result "Deleting cron job" "$?" "$tmpfile" "$cmd" + # Add cron job cmd="v_add_cron_job $user 1 1 1 1 1 echo 1" $cmd > $tmpfile 2>> $tmpfile echo_result "Adding cron job" "$?" "$tmpfile" "$cmd" + # Add cron job cmd="v_add_cron_job $user 1 1 1 1 1 echo 1" $cmd > $tmpfile 2>> $tmpfile @@ -94,9 +103,28 @@ else fi echo_result "Dublicate cron job check" "$retval" "$tmpfile" "$cmd" -# Check ip -#cat /proc/net/dev|cut -f 1 -d :|tail -n1 -#v_add_sys_ip 192.168.11.11 255.255.255.255 venet0 ekho + +# List network interfaces +cmd="v_list_sys_interfaces plain" +interface=$($cmd 2> $tmpfile | head -n 1) +if [ -z "$interface" ]; then + echo_result "Listing network interfaces" "1" "$tmpfile" "$cmd" +else + echo_result "Listing network interfaces" "0" "$tmpfile" "$cmd" +fi + + +# Add new ip address +cmd="v_add_sys_ip 198.18.0.123 255.255.255.255 $interface $user" +$cmd > $tmpfile 2>> $tmpfile +echo_result "Adding ip 198.18.0.123" "$?" "$tmpfile" "$cmd" + + +# Delete ip address +cmd="v_delete_sys_ip 198.18.0.123" +$cmd > $tmpfile 2>> $tmpfile +echo_result "Deleting ip 198.18.0.123" "$?" "$tmpfile" "$cmd" + # Delete new user cmd="v_delete_user $user" diff --git a/web/css/main.css b/web/css/main.css index 6f4f5943..1d209ea4 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -1584,10 +1584,14 @@ input::-moz-focus-inner{ background-color:#FFFFCB; } .b-new-entry select.styled{ - top:10px; + top:0; } .b-new-entry option{ - font:14px arial,sans-serif; + padding:5px 5px 5px 8px; + font-family:Arial, Helvetica, sans-serif; + font-size:14px; + font-weight:bold; + color:#555; } .b-new-entry .form-options-group{} diff --git a/web/images/checkbox-selector.png b/web/images/checkbox-selector.png index f2005fbf..698ac83b 100644 Binary files a/web/images/checkbox-selector.png and b/web/images/checkbox-selector.png differ diff --git a/web/images/checkboxes.png b/web/images/checkboxes.png new file mode 100644 index 00000000..b3704072 Binary files /dev/null and b/web/images/checkboxes.png differ diff --git a/web/images/chekbox-selector.png b/web/images/chekbox-selector.png index 23f9ef1d..f2005fbf 100644 Binary files a/web/images/chekbox-selector.png and b/web/images/chekbox-selector.png differ diff --git a/web/images/fav.ico b/web/images/fav.ico index 7c26ae9d..a1ef0199 100644 Binary files a/web/images/fav.ico and b/web/images/fav.ico differ diff --git a/web/images/form-checkboxes.png b/web/images/form-checkboxes.png new file mode 100644 index 00000000..fadce3ea Binary files /dev/null and b/web/images/form-checkboxes.png differ diff --git a/web/images/section-status-sprite-7.png b/web/images/section-status-sprite-7.png new file mode 100644 index 00000000..f17efb73 Binary files /dev/null and b/web/images/section-status-sprite-7.png differ diff --git a/web/index.html b/web/index.html index febb7127..92b4a2f3 100644 --- a/web/index.html +++ b/web/index.html @@ -82,7 +82,6 @@
User -  
0 users @@ -98,7 +97,6 @@
Web -  
0 web domains @@ -108,12 +106,24 @@ +
  • +
    +
    +
    + DNS +
    +
    + 0 dns domain(s) +
    +
    +
    + +
  • Mail -  
    0 mail domain(s) @@ -127,7 +137,6 @@
    DB -  
    0 databases @@ -137,44 +146,28 @@
  • -
  • +
  • - DNS -   + Cron
    - 0 dns domain(s) -
    -
    -
    - -
  • -
  • -
    -
    -
    - IP -   -
    -
    - 0 ip address(es) + 0 cron job(s) 0 suspended
  • -
  • +
  • - Cron -   + IP
    - 0 cron job(s) + 0 ip address(es) 0 suspended
    diff --git a/web/js/__init__.js b/web/js/__init__.js index a475c716..0926352f 100644 --- a/web/js/__init__.js +++ b/web/js/__init__.js @@ -11,9 +11,9 @@ $('document').ready(function() { App.Utils.detectBrowser(); App.Ref.init(); - App.Env.world = 'USER'; + //App.Env.world = 'USER'; // Disabled cookie tab restoring. Enable if needed - /*if ('undefined' != typeof App.Tmp.loadTAB) { + if ('undefined' != typeof App.Tmp.loadTAB) { App.Env.world = App.Tmp.loadTAB; } @@ -25,7 +25,7 @@ $('document').ready(function() { else { App.Env.world = App.Constants.TABS[0]; } - }*/ + } App.Pages.init(); App.Core.listen(); diff --git a/web/js/_settings.js b/web/js/_settings.js index 47e07e5c..2c34671a 100644 --- a/web/js/_settings.js +++ b/web/js/_settings.js @@ -59,11 +59,12 @@ App.Messages.get = function(key, plural) { } // Imutable -App.Settings.Imutable = {}; -App.Settings.Imutable.USER = ['LOGIN_NAME']; -App.Settings.Imutable.DB = ['DB', 'TYPE', 'USER']; -App.Settings.Imutable.DNS = ['DNS_DOMAIN']; -App.Settings.Imutable.IP = ['INTERFACE']; +App.Settings.Imutable = {}; +App.Settings.Imutable.USER = ['LOGIN_NAME']; +App.Settings.Imutable.WEB_DOMAIN = ['DOMAIN']; +App.Settings.Imutable.DB = ['DB', 'TYPE', 'USER', 'CHARSET', 'HOST']; +App.Settings.Imutable.DNS = ['DNS_DOMAIN']; +App.Settings.Imutable.IP = ['IP_ADDRESS', 'NETMASK', 'INTERFACE']; // Empty diff --git a/web/js/actions.js b/web/js/actions.js index 6c1867e7..dd5bbe4c 100644 --- a/web/js/actions.js +++ b/web/js/actions.js @@ -87,7 +87,7 @@ App.Actions.update_cs_value = function(evt) if (App.Tmp[App.Env.world + '_selected_records'] > 0) { var confirm_message_key = App.Tmp[App.Env.world + '_selected_records'] == 1 ? 1 + ' record' : App.Tmp[App.Env.world + '_selected_records'] + ' records'; - var confirmed = confirm('This action will ' + val.toLowerCase() + ' ' + confirm_message_key + '. Do you want to proceede?'); + var confirmed = confirm('This action will ' + val.toLowerCase() + ' ' + confirm_message_key + '. Do you want to proceed?'); if (confirmed) { fb.log('mass_' + val); var func_name = val.toLowerCase(); diff --git a/web/js/html.js b/web/js/html.js index 49606040..f8c5d94d 100644 --- a/web/js/html.js +++ b/web/js/html.js @@ -110,7 +110,7 @@ App.HTML.Build.user_form = function (options, id) { ns[ns.length++] = App.Templates.get('PLUS_ONE_NS', 'user').finalize(); tpl.set(':NS', ns.done()); } else { -// tpl.set(':NS', ''); + tpl.set(':NS', ''); } tpl = App.HTML.setTplKeys(tpl, options, true); tpl = App.HTML.Build.user_selects(tpl, options); @@ -664,27 +664,14 @@ App.HTML.Build.db_selects = function (tpl, options) { }); tpl.set(':TYPE_OPTIONS', acc.done()); - acc = []; - var items = App.Env.initialParams.DB.HOST; - $.each(items, function (val) { - var tpl = App.Templates.get('select_option', 'general'); - tpl.set(':VALUE', val); - tpl.set(':TEXT', items[val]); - tpl.set(':SELECTED', val == options.HOST ? 'selected="selected"' : ''); - acc[acc.length++] = tpl.finalize(); - }); - tpl.set(':HOST_OPTIONS', acc.done()); + var obj = App.Env.initialParams.DB.HOST; + var opts = App.HTML.Build.options(obj, options.HOST); + tpl.set(':HOST_OPTIONS', opts); - acc = []; - var items = App.Env.initialParams.DB.ENCODING; - $.each(items, function (val) { - var tpl = App.Templates.get('select_option', 'general'); - tpl.set(':VALUE', val); - tpl.set(':TEXT', items[val]); - tpl.set(':SELECTED', val == options.ENCODING ? 'selected="selected"' : ''); - acc[acc.length++] = tpl.finalize(); - }); - tpl.set(':ENCODING_OPTIONS', acc.done()); + + var obj = App.Env.initialParams.DB.CHARSET; + var opts = App.HTML.Build.options(obj, options.CHARSET); + tpl.set(':CHARSET_OPTIONS', opts); return tpl; } diff --git a/web/js/lib/custom-form-elements.js b/web/js/lib/custom-form-elements.js index a68126b1..95ec2b4f 100644 --- a/web/js/lib/custom-form-elements.js +++ b/web/js/lib/custom-form-elements.js @@ -25,7 +25,7 @@ Visit http://ryanfait.com/ for more information. var checkboxHeight = "25"; var radioHeight = "25"; -var selectWidth = "210"; +var selectWidth = "230"; /* No need to change anything after this */ @@ -47,6 +47,9 @@ var Custom = { if ($(inputs[a]).attr('class').indexOf('do_action_toggle_batch_selector') != -1) { span[a].className += ' do_action_toggle_batch_selector'; // save toggle functionality } + if ($(inputs[a]).attr('class').indexOf('do_action_toggle_ssl_support') != -1) { + span[a].className += ' do_action_toggle_ssl_support'; // save toggle functionality + } if(inputs[a].checked == true) { diff --git a/web/js/pages.js b/web/js/pages.js index 381059d2..1343e449 100644 --- a/web/js/pages.js +++ b/web/js/pages.js @@ -70,7 +70,8 @@ App.Pages.USER.new_entry = function(evt) $(box).find('.suspended').addClass('hidden'); App.Ref.CONTENT.prepend($(box).html()); App.Helpers.updateScreen(); - $('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden'); + $('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden').find('.rule-required').removeClass('rule-required'); + $('#'+form_id).find('.shell-entry').addClass('hidden'); } App.Pages.WEB_DOMAIN.new_entry = function(evt) diff --git a/web/js/templates.js b/web/js/templates.js index f48e1738..c9a964ad 100644 --- a/web/js/templates.js +++ b/web/js/templates.js @@ -144,14 +144,14 @@ App.Templates.html = { \ View template settings\
    \ -
    \ + \
    \ \ \ @@ -241,7 +241,7 @@ App.Templates.html = { \ \
    \ -
    \ + \
    '] }, ip: { @@ -403,12 +403,12 @@ App.Templates.html = { ~!:PACKAGE_OPTIONS~!\ \ \ - \ + \ \
    \ \ \ @@ -860,14 +860,14 @@ App.Templates.html = { Generate\
    \ \ - \ - \ + \ +
    \ + \ + \ +
    \
    \ \ \ @@ -912,10 +912,10 @@ App.Templates.html = {
    \
    \ \ - \ + \ + Character Set:\ + ~!:CHARSET~!\ + \ \
    \
    \ diff --git a/web/js/templates_admin.js b/web/js/templates_admin.js new file mode 100644 index 00000000..5a7f9a8a --- /dev/null +++ b/web/js/templates_admin.js @@ -0,0 +1,1151 @@ +App.Templates.html = { + help: { + DNS_form: ['

    Some Things You Just Can\'t Explain

    \ + A farmer was sitting in the neighborhood bar getting drunk. A man came in and asked the farmer, "Hey, why are you sitting here on this beautiful day, getting drunk?" The farmer shook his head and replied, "Some things you just can\'t explain."\ + "So what happened that\'s so horrible?" the man asked as he sat down next to the farmer.\ + "Well," the farmer said, "today I was sitting by my cow, milking her. Just as I got the bucket full, she lifted her left leg and kicked over the bucket."\ + "Okay," said the man, "but that\'s not so bad." "Some things you just can\'t explain," the farmer replied. "So what happened then?" the man asked. The farmer said, "I took her left leg and tied it to the post on the left."\ + "And then?"\ + "Well, I sat back down and continued to milk her. Just as I got the bucket full, she took her right leg and kicked over the bucket."\ + The man laughed and said, "Again?" The farmer replied, "Some things you just can\'t explain." "So, what did you do then?" the man asked.\ + "I took her right leg this time and tied it to the post on the right."\ + "And then?"\ + "Well, I sat back down and began milking her again. Just as I got the bucket full, the stupid cow knocked over the bucket with her tail."\ + "Hmmm," the man said and nodded his head. "Some things you just can\'t explain," the farmer said.\ + "So, what did you do?" the man asked.\ + "Well," the farmer said, "I didn\'t have anymore rope, so I took off my belt and tied her tail to the rafter. In that moment, my pants fell down and my wife walked in ... Some things you just can\'t explain."'] + }, + general: { + over_bar: [''], + loading: ['
    \ +
    \ +
    '], + popup: ['\ + '], + inner_popup: ['
    \ +
    \ + ×\ +
    ~!:POPUP_TITLE~!
    \ +
    \ + ~!:CONTENT~!\ +
    \ +
    \ +
    '], + select_option: [''], + error_elm: ['
    ~!:ERROR~!
    '], + SUSPENDED_TPL_NOT_SUSPENDED : ['enabled'], + SUSPENDED_TPL_SUSPENDED : ['suspended'] + }, + popup: { + error: ['

    Important: An Error Has Occured.


        Something went wrong and some of your actions can be not saved in system. Mostly, it happens when you have network connection errors.
    ,    However, please notify us about the situation. It would be helpfull if you will write us approximate time the error occured and last actions you were performing. You send your petition on this email: BLABLA,

    Sorry for inconvinience. (We recommend you to reload the page)
    '], + change_psw: [ + '
    \ +
    \ +
    \ + \ + ~!:VERSION~!\ +
    \ + ~!:PRODUCT_NAME~! \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + \ +
    \ + \ + \ +
    \ +
    \ +  \ +
    \ + \ +
    \ +
    \ +

    \ +
    \ +

    For questions please contact ~!:EMAIL~!

    \ +
    © ~!:YEAR~! Vesta Control Panel
    \ +
    \ +
    \ +
    \ +
    ' + ], + login: ['
    \ +
    \ +
    \ + \ + ~!:VERSION~!\ +
    \ + ~!:PRODUCT_NAME~! \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ +
    \ +

    forgot password?

    \ +
    \ +

    For questions please contact ~!:EMAIL~!

    \ +
    © ~!:YEAR~! Vesta Control Panel
    \ +
    \ +
    \ +
    \ +
    '] + }, + dates: { + 'lock_plan_date' : [''], + 'save_forecasted_date' : [''] + }, + dns: { + FORM: [ + '
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ + \ +
    \ +
    \ + \ +
    \ + \ +  \ +
    \ +
    \ +
    \ + \ + ~!:TPL_DEFAULT_VALUE~!\ + \ + View template settings\ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    ' + ], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ + ~!:DNS_DOMAIN~!\ +
    \ +
    Show records
    \ +
    \ +
    \ +
    \ + ~!:IP~!\ + \ + template:\ + \ + ~!:TPL~!\ + \ +
    \ +
    \ +
    \ + \ + ttl:\ + ~!:TTL~!\ + \ + \ + soa:\ + ~!:SOA~!\ + \ +
    \ +
    \ +
    '], + SUBFORM: ['
    \ +
    \ +
    Hide records
    \ +
    \ +
    \ +
    \ + \ + ~!:SUBRECORDS~!\ +
    \ + \ + Cancel\ + \ +
    \ +
    '], + SUBENTRY: ['
    \ + \ +
    \ + \ +
    \ + \ +
    in
    \ +
    \ +
    \ +
    \ + \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ +
    '] + }, + ip: { + FORM: ['\ +
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    \ + '], + DOT: ['.'], + ENTRY: ['\ +
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ + ~!:IP_ADDRESS~!\ +
    \ + \ + netmask:\ + ~!:NETMASK~!\ + \ + \ + interface:\ + ~!:INTERFACE~!\ + \ + \ + name:\ + ~!:NAME~!\ + \ +
    \ +
    \ + \ + owner:\ + ~!:OWNER~!\ + \ + \ + status:\ + ~!:STATUS~!\ + \ +
    \ +
    \ + \ + sys users:\ + ~!:U_SYS_USERS~!\ + \ + \ + web domains:\ + ~!:U_WEB_DOMAINS~!\ + \ +
    \ +
    \ +
    \ + '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + SUSPENDED_TPL_ENABLED : ['enabled\ + delete'], + SUSPENDED_TPL_DISABLED : ['suspended'] + }, + + + user: { + WEB_TPL_MINIMIZED: ['~!:WEB_TPL_MINI~!\ + \ + ~!:MORE_NUMBER~! more\ + '], + WEB_TPL: ['~!:NAME~!'], + NS_MINIMIZED: ['~!:NS_MINI~!\ + \ + ~!:MORE_NUMBER~! more\ + '], + NS_RECORD: ['~!:NAME~!'], + NS_INPUT: ['
    \ + \ + \ + \ +
    '], + PLUS_ONE_NS: [''], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + Generate\ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + ~!:NS~!\ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + ~!:LOGIN_NAME~!\ + \ + \ + \ + package:\ + ~!:PACKAGE~!\ + \ +
    \ +
    \ + \ + \ + \ + \ + name:\ + ~!:FULLNAME~!\ + \ + \ + email:\ + \ + ~!:CONTACT~!\ + (reports ~!:REPORTS_ENABLED~!)\ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    stats
    \ + \ +
    \ + disk usage:\ +
    \ +
    \ +
    \ + ~!:U_DISK_PERCENTAGE~!% (~!:U_DISK~! ~!:DISK_QUOTA_MEASURE~!)\ + \ + ~!:OVER_BAR~!\ +
    \ +
    \ +
    ~!:DISK_QUOTA~! ~!:DISK_QUOTA_MEASURE_2~!
    \ +
    \ +
    \ +
    \ + \ +
    \ + bandwidth:\ +
    \ +
    \ +
    \ + ~!:U_BANDWIDTH_PERCENTAGE~!% (~!:U_BANDWIDTH~! ~!:BANDWIDTH_MEASURE~!)\ + \ + ~!:OVER_BAR_2~!\ +
    \ +
    \ +
    ~!:BANDWIDTH~! ~!:BANDWIDTH_MEASURE_2~!
    \ +
    \ +
    \ +
    \ +
    \ + \ + web ssl:\ + ~!:U_WEB_SSL~! (~!:WEB_SSL~!)\ + \ + \ + web alias:\ + ~!:WEB_ALIASES~! per domain\ + \ + \ + web templates:\ + \ + ~!:WEB_TPL~!\ + \ + \ + \ + databases:\ + ~!:U_DATABASES~! (~!:DATABASES~!)\ + \ + \ + shell:\ + ~!:SHELL~!\ + \ + \ + backups:\ + retention ~!:BACKUPS~!\ + \ +
    \ +
    \ + \ + mailboxes:\ + ~!:U_MAIL_BOXES~! (~!:MAIL_BOXES~!)\ + \ + \ + mail forwarders:\ + ~!:U_MAIL_FORWARDERS~! (~!:MAIL_FORWARDERS~!)\ + \ + \ + mail domains:\ + ~!:U_MAIL_DOMAINS~! (~!:MAIL_DOMAINS~!)\ + \ + \ + web domains:\ + ~!:U_WEB_DOMAINS~! (~!:WEB_DOMAINS~!)\ + \ + \ + dns domains:\ + ~!:U_DNS_DOMAINS~! (~!:DNS_DOMAINS~!)\ + \ + \ + ns list:\ + \ + ~!:NS~!\ + \ +
    \ +
    \ +
    '] + }, + web_domain: { + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ + ~!:DOMAIN~!\ + Alias:\ + ~!:ALIAS~!\ +
    \ +
    \ +
    \ + ~!:IP~!\ + \ + template:\ + ~!:TPL~!\ + \ +
    \ +
    \ +
    stats
    \ + \ +
    \ + disk usage:\ +
    \ +
    \ +
    \ + ~!:U_DISK_PERCENTAGE~!% (~!:U_DISK~! ~!:DISK_QUOTA_MEASURE~!)\ + \ + ~!:OVER_BAR~!\ +
    \ +
    \ +
    ~!:DISK_QUOTA~! ~!:DISK_QUOTA_MEASURE_2~!
    \ +
    \ +
    \ +
    \ + \ +
    \ + bandwidth:\ +
    \ +
    \ +
    \ + ~!:U_BANDWIDTH_PERCENTAGE~!% (~!:U_BANDWIDTH~! ~!:BANDWIDTH_MEASURE~!)\ + \ + ~!:OVER_BAR_2~!\ +
    \ +
    \ +
    ~!:BANDWIDTH~! ~!:BANDWIDTH_MEASURE_2~!
    \ +
    \ +
    \ +
    \ +
    \ + \ + php:\ + ~!:PHP~!\ + \ + \ + cgi:\ + ~!:CGI~!\ + \ + \ + elog:\ + ~!:ELOG~!\ + \ + \ + stats:\ + ~!:STAT~!\ + \ + ~!:STATS_AUTH~!\ + \ + \ +
    \ +
    \ + \ + ssl:\ + ~!:SSL~!\ + \ + \ + nginx:\ + ~!:NGINX~!\ + extension list\ + \ +
    \ +
    \ +
    '] + }, + db: { + USER_ITEMS_WRAPPER: ['
    ~!:CONTENT~!
    '], + USER_ITEM: ['\ + ~!:NAME~!\ + \ + change password'], + DIVIDER: ['
    \ + \ + \ + ~!:TYPE~!\ + \ + \ +
    '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + Generate\ +
    \ +
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    \ + \ + ~!:OWNER~!\ + \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ + ~!:DB~!\ +
    \ +
    \ + \ +
    \ + backup\ + \ +
    \ +
    \ +
    \ + ~!:U_DISK~! Mb\ +
    \ + \ +
    \ +
    \ +
    ~!:DISK~! ~!:DISK_MEASURE~!
    \ +
    \ +
    \ +
    \ +
    \ +
    '] + }, + cron: { + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + Schedule Time:\ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ + \ + min\ + ~!:MIN~!\ + \ + \ + hour\ + ~!:HOUR~!\ + \ + \ + day of Month\ + ~!:DAY~!\ + \ + \ + Month\ + ~!:MONTH~!\ + \ + \ + day of Week\ + ~!:WDAY~!\ + \ +
    \ +
    \ + ~!:CMD~!\ +
    \ + \ +
    \ +
    '] + }, + backup: { + WRAPPER: ['
    ~!:CONTENT~!
    '], + ENTRY: ['
    \ + \ +
    \ +
    \ +
    \ + \ + owner:\ + ~!:OWNER~!\ + \ +
    \ +
    \ +
    \ +
    \ + \ + \ + ~!:CREATED_AT~!\ + ~!:CREATED_AT_TIME~!\ + \ + ~!:CREATED_AT_WDAY~!\ + \ + \ + Generation time:\ + ~!:GENERATION_TIME~!\ + \ +
    \ +
    \ + \ + ~!:SIZE~!\ + \ + download\ +
    \ + \ +
    \ +
    '] + }, + stats: { + WRAPPER: ['
    ~!:CONTENT~!
    '], + ENTRY: ['
    \ +

    ~!:HEADER~!

    \ +
    \ + \ +
    \ +
    '], + SUBMENU: ['today\ + week\ + month\ + year
    '] + } +} + + +// Internals +var Tpl = App.Templates; +var Templator = function() +{ + var init = function() { + fb.info('Templator work'); + Templator.splitThemAll(); + Templator.freezeTplIndexes(); + }; + + /** + * Split the tpl strings into arrays + */ + Templator.splitThemAll = function() + { + fb.info('splitting tpls'); + $.each(App.Templates.html, function(o) { + var tpls = App.Templates.html[o]; + $.each(tpls, function(t) { + tpls[t] = tpls[t][0].split('~!'); + }); + }); + }, + + /** + * Iterates tpls + */ + Templator.freezeTplIndexes = function() + { + fb.info('freezing tpl keys'); + $.each(App.Templates.html, Templator.cacheTplIndexes); + }, + + /** + * Grab the tpl group key and process it + */ + Templator.cacheTplIndexes = function(key) + { + var tpls = App.Templates.html[key]; + $.each(tpls, function(o) { + var tpl = tpls[o]; + Templator.catchIndex(key, o, tpl); + }); + }, + + /** + * Set the indexes + */ + Templator.catchIndex = function(key, ref_key, tpl) + { + 'undefined' == typeof App.Templates._indexes[key] ? App.Templates._indexes[key] = {} : false; + 'undefined' == typeof App.Templates._indexes[key][ref_key] ? App.Templates._indexes[key][ref_key] = {} : false; + $(tpl).each(function(index, o) { + if(':' == o.charAt(0)){ + App.Templates._indexes[key][ref_key][o.toString()] = index; + } + }); + } + + /** + * Get concrete templates + */ + init(); + return Templator; +}; +Templator.getTemplate = function(ns, key) +{ + return [ + App.Templates._indexes[ns][key], + App.Templates.html[ns][key].slice(0) + ]; +} +// init templator +Tpl.Templator = Templator(); +Tpl.get = function(key, group) +{ + return Tpl.Templator.getTemplate(group, key); +} diff --git a/web/js/user_templates.js b/web/js/user_templates.js new file mode 100644 index 00000000..beefbc05 --- /dev/null +++ b/web/js/user_templates.js @@ -0,0 +1,1151 @@ +alert('User templates loaded'); +App.Templates.html = { + help: { + DNS_form: ['

    Some Things You Just Can\'t Explain

    \ + A farmer was sitting in the neighborhood bar getting drunk. A man came in and asked the farmer, "Hey, why are you sitting here on this beautiful day, getting drunk?" The farmer shook his head and replied, "Some things you just can\'t explain."\ + "So what happened that\'s so horrible?" the man asked as he sat down next to the farmer.\ + "Well," the farmer said, "today I was sitting by my cow, milking her. Just as I got the bucket full, she lifted her left leg and kicked over the bucket."\ + "Okay," said the man, "but that\'s not so bad." "Some things you just can\'t explain," the farmer replied. "So what happened then?" the man asked. The farmer said, "I took her left leg and tied it to the post on the left."\ + "And then?"\ + "Well, I sat back down and continued to milk her. Just as I got the bucket full, she took her right leg and kicked over the bucket."\ + The man laughed and said, "Again?" The farmer replied, "Some things you just can\'t explain." "So, what did you do then?" the man asked.\ + "I took her right leg this time and tied it to the post on the right."\ + "And then?"\ + "Well, I sat back down and began milking her again. Just as I got the bucket full, the stupid cow knocked over the bucket with her tail."\ + "Hmmm," the man said and nodded his head. "Some things you just can\'t explain," the farmer said.\ + "So, what did you do?" the man asked.\ + "Well," the farmer said, "I didn\'t have anymore rope, so I took off my belt and tied her tail to the rafter. In that moment, my pants fell down and my wife walked in ... Some things you just can\'t explain."'] + }, + general: { + logged_as: ['
    You (~!:YOU_ARE~!) are viewing ~!:USER~! interface. Exit it to return to your own.
    '], + over_bar: [''], + loading: ['
    \ +
    \ +
    '], + popup: ['\ + '], + inner_popup: ['
    \ +
    \ + ×\ +
    ~!:POPUP_TITLE~!
    \ +
    \ + ~!:CONTENT~!\ +
    \ +
    \ +
    '], + select_option: [''], + error_elm: ['
    ~!:ERROR~!
    '], + SUSPENDED_TPL_NOT_SUSPENDED : ['enabled'], + SUSPENDED_TPL_SUSPENDED : ['suspended'] + }, + popup: { + error: ['

    Important: An Error Has Occured.


        Something went wrong and some of your actions can be not saved in system. Mostly, it happens when you have network connection errors.
    ,    However, please notify us about the situation. It would be helpfull if you will write us approximate time the error occured and last actions you were performing. You send your petition on this email: BLABLA,

    Sorry for inconvinience. (We recommend you to reload the page)
    '], + change_psw: [ + '
    \ +
    \ +
    \ + \ + ~!:VERSION~!\ +
    \ + ~!:PRODUCT_NAME~! \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + \ +
    \ + \ + \ +
    \ +
    \ +  \ +
    \ + \ +
    \ +
    \ +

    \ +
    \ +

    For questions please contact ~!:EMAIL~!

    \ +
    © ~!:YEAR~! Vesta Control Panel
    \ +
    \ +
    \ +
    \ +
    ' + ], + login: ['
    \ +
    \ +
    \ + \ + ~!:VERSION~!\ +
    \ + ~!:PRODUCT_NAME~! \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ +
    \ +

    forgot password?

    \ +
    \ +

    For questions please contact ~!:EMAIL~!

    \ +
    © ~!:YEAR~! Vesta Control Panel
    \ +
    \ +
    \ +
    \ +
    '] + }, + dates: { + 'lock_plan_date' : [''], + 'save_forecasted_date' : [''] + }, + dns: { + FORM: [ + '
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ + \ +
    \ +
    \ + \ +
    \ + \ +  \ +
    \ +
    \ +
    \ + \ + ~!:TPL_DEFAULT_VALUE~!\ + \ + View template settings\ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    ' + ], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ + ~!:DNS_DOMAIN~!\ +
    \ +
    Show records
    \ +
    \ +
    \ +
    \ + ~!:IP~!\ + \ + template:\ + \ + ~!:TPL~!\ + \ +
    \ +
    \ +
    \ + \ + ttl:\ + ~!:TTL~!\ + \ + \ + soa:\ + ~!:SOA~!\ + \ +
    \ +
    \ +
    '], + SUBFORM: ['
    \ +
    \ +
    Hide records
    \ +
    \ +
    \ +
    \ + \ + ~!:SUBRECORDS~!\ +
    \ + \ + Cancel\ + \ +
    \ +
    '], + SUBENTRY: ['
    \ + \ +
    \ + \ +
    \ + \ +
    in
    \ +
    \ +
    \ +
    \ + \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ +
    '] + }, + ip: { + FORM: ['\ +
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    \ + '], + DOT: ['.'], + ENTRY: ['\ +
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ + ~!:IP_ADDRESS~!\ +
    \ + \ + netmask:\ + ~!:NETMASK~!\ + \ + \ + interface:\ + ~!:INTERFACE~!\ + \ + \ + name:\ + ~!:NAME~!\ + \ +
    \ +
    \ + \ + owner:\ + ~!:OWNER~!\ + \ + \ + status:\ + ~!:STATUS~!\ + \ +
    \ +
    \ + \ + sys users:\ + ~!:U_SYS_USERS~!\ + \ + \ + web domains:\ + ~!:U_WEB_DOMAINS~!\ + \ +
    \ +
    \ +
    \ + '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + SUSPENDED_TPL_ENABLED : ['enabled\ + delete'], + SUSPENDED_TPL_DISABLED : ['suspended'] + }, + + + user: { + WEB_TPL_MINIMIZED: ['~!:WEB_TPL_MINI~!\ + \ + ~!:MORE_NUMBER~! more\ + '], + WEB_TPL: ['~!:NAME~!'], + NS_MINIMIZED: ['~!:NS_MINI~!\ + \ + ~!:MORE_NUMBER~! more\ + '], + NS_RECORD: ['~!:NAME~!'], + NS_INPUT: ['
    \ + \ + \ + \ +
    '], + PLUS_ONE_NS: [''], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + Generate\ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + ~!:NS~!\ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + ~!:LOGIN_NAME~!\ + \ + \ + \ + package:\ + ~!:PACKAGE~!\ + \ +
    \ +
    \ + \ + name:\ + ~!:FULLNAME~!\ + \ + \ + email:\ + \ + ~!:CONTACT~!\ + (reports ~!:REPORTS_ENABLED~!)\ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    stats
    \ + \ +
    \ + disk usage:\ +
    \ +
    \ +
    \ + ~!:U_DISK_PERCENTAGE~!% (~!:U_DISK~! ~!:DISK_QUOTA_MEASURE~!)\ + \ + ~!:OVER_BAR~!\ +
    \ +
    \ +
    ~!:DISK_QUOTA~! ~!:DISK_QUOTA_MEASURE_2~!
    \ +
    \ +
    \ +
    \ + \ +
    \ + bandwidth:\ +
    \ +
    \ +
    \ + ~!:U_BANDWIDTH_PERCENTAGE~!% (~!:U_BANDWIDTH~! ~!:BANDWIDTH_MEASURE~!)\ + \ + ~!:OVER_BAR_2~!\ +
    \ +
    \ +
    ~!:BANDWIDTH~! ~!:BANDWIDTH_MEASURE_2~!
    \ +
    \ +
    \ + \ +
    \ +
    \ + \ + web ssl:\ + ~!:U_WEB_SSL~! (~!:WEB_SSL~!)\ + \ + \ + web alias:\ + ~!:WEB_ALIASES~! per domain\ + \ + \ + web templates:\ + \ + ~!:WEB_TPL~!\ + \ + \ + \ + databases:\ + ~!:U_DATABASES~! (~!:DATABASES~!)\ + \ + \ + shell:\ + ~!:SHELL~!\ + \ + \ + backups:\ + retention ~!:BACKUPS~!\ + \ +
    \ +
    \ + \ + mailboxes:\ + ~!:U_MAIL_BOXES~! (~!:MAIL_BOXES~!)\ + \ + \ + mail forwarders:\ + ~!:U_MAIL_FORWARDERS~! (~!:MAIL_FORWARDERS~!)\ + \ + \ + mail domains:\ + ~!:U_MAIL_DOMAINS~! (~!:MAIL_DOMAINS~!)\ + \ + \ + web domains:\ + ~!:U_WEB_DOMAINS~! (~!:WEB_DOMAINS~!)\ + \ + \ + dns domains:\ + ~!:U_DNS_DOMAINS~! (~!:DNS_DOMAINS~!)\ + \ + \ + ns list:\ + \ + ~!:NS~!\ + \ +
    \ +
    \ +
    '] + }, + web_domain: { + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ + ~!:DOMAIN~!\ + Alias:\ + ~!:ALIAS~!\ +
    \ +
    \ +
    \ + ~!:IP~!\ + \ + template:\ + ~!:TPL~!\ + \ +
    \ +
    \ +
    stats
    \ + \ +
    \ + disk usage:\ +
    \ +
    \ +
    \ + ~!:U_DISK_PERCENTAGE~!% (~!:U_DISK~! ~!:DISK_QUOTA_MEASURE~!)\ + \ + ~!:OVER_BAR~!\ +
    \ +
    \ +
    ~!:DISK_QUOTA~! ~!:DISK_QUOTA_MEASURE_2~!
    \ +
    \ +
    \ +
    \ + \ +
    \ + bandwidth:\ +
    \ +
    \ +
    \ + ~!:U_BANDWIDTH_PERCENTAGE~!% (~!:U_BANDWIDTH~! ~!:BANDWIDTH_MEASURE~!)\ + \ + ~!:OVER_BAR_2~!\ +
    \ +
    \ +
    ~!:BANDWIDTH~! ~!:BANDWIDTH_MEASURE_2~!
    \ +
    \ +
    \ +
    \ +
    \ + \ + php:\ + ~!:PHP~!\ + \ + \ + cgi:\ + ~!:CGI~!\ + \ + \ + elog:\ + ~!:ELOG~!\ + \ + \ + stats:\ + ~!:STAT~!\ + \ + ~!:STATS_AUTH~!\ + \ + \ +
    \ +
    \ + \ + ssl:\ + ~!:SSL~!\ + \ + \ + nginx:\ + ~!:NGINX~!\ + extension list\ + \ +
    \ +
    \ +
    '] + }, + db: { + USER_ITEMS_WRAPPER: ['
    ~!:CONTENT~!
    '], + USER_ITEM: ['\ + ~!:NAME~!\ + \ + change password'], + DIVIDER: ['
    \ + \ + \ + ~!:TYPE~!\ + \ + \ +
    '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + \ + \ + Generate\ +
    \ +
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    \ + \ + ~!:OWNER~!\ + \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ +
    \ + ~!:DB~!\ +
    \ +
    \ + \ +
    \ + backup\ + \ +
    \ +
    \ +
    \ + ~!:U_DISK~! Mb\ +
    \ + \ +
    \ +
    \ +
    ~!:DISK~! ~!:DISK_MEASURE~!
    \ +
    \ +
    \ +
    \ +
    \ +
    '] + }, + cron: { + FORM: ['
    \ + \ + \ +
    ~!:title~!
    \ + \ +
    \ + Schedule Time:\ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + \ + \ +
    \ + \ +
    \ + \ + \ +
    \ +
    \ + \ + Cancel\ + Delete\ +
    \ +
    '], + ENTRIES_WRAPPER: ['
    ~!:content~!
    '], + ENTRY: ['
    \ + \ + \ +
    \ +
    \ +
    \ + ~!:SUSPENDED_TPL~!\ +
    \ +
    \ +
    \ +
    ~!:DATE~!
    \ +
    \ +
    \ +
    \ + \ + min\ + ~!:MIN~!\ + \ + \ + hour\ + ~!:HOUR~!\ + \ + \ + day of Month\ + ~!:DAY~!\ + \ + \ + Month\ + ~!:MONTH~!\ + \ + \ + day of Week\ + ~!:WDAY~!\ + \ +
    \ +
    \ + ~!:CMD~!\ +
    \ + \ +
    \ +
    '] + }, + backup: { + WRAPPER: ['
    ~!:CONTENT~!
    '], + ENTRY: ['
    \ + \ +
    \ +
    \ +
    \ + \ + owner:\ + ~!:OWNER~!\ + \ +
    \ +
    \ +
    \ +
    \ + \ + \ + ~!:CREATED_AT~!\ + ~!:CREATED_AT_TIME~!\ + \ + ~!:CREATED_AT_WDAY~!\ + \ + \ + Generation time:\ + ~!:GENERATION_TIME~!\ + \ +
    \ +
    \ + \ + ~!:SIZE~!\ + \ + download\ +
    \ + \ +
    \ +
    '] + }, + stats: { + WRAPPER: ['
    ~!:CONTENT~!
    '], + ENTRY: ['
    \ +

    ~!:HEADER~!

    \ +
    \ + \ +
    \ +
    '], + SUBMENU: ['today\ + week\ + month\ + year
    '] + } +} + + +// Internals +var Tpl = App.Templates; +var Templator = function() +{ + var init = function() { + fb.info('Templator work'); + Templator.splitThemAll(); + Templator.freezeTplIndexes(); + }; + + /** + * Split the tpl strings into arrays + */ + Templator.splitThemAll = function() + { + fb.info('splitting tpls'); + $.each(App.Templates.html, function(o) { + var tpls = App.Templates.html[o]; + $.each(tpls, function(t) { + tpls[t] = tpls[t][0].split('~!'); + }); + }); + }, + + /** + * Iterates tpls + */ + Templator.freezeTplIndexes = function() + { + fb.info('freezing tpl keys'); + $.each(App.Templates.html, Templator.cacheTplIndexes); + }, + + /** + * Grab the tpl group key and process it + */ + Templator.cacheTplIndexes = function(key) + { + var tpls = App.Templates.html[key]; + $.each(tpls, function(o) { + var tpl = tpls[o]; + Templator.catchIndex(key, o, tpl); + }); + }, + + /** + * Set the indexes + */ + Templator.catchIndex = function(key, ref_key, tpl) + { + 'undefined' == typeof App.Templates._indexes[key] ? App.Templates._indexes[key] = {} : false; + 'undefined' == typeof App.Templates._indexes[key][ref_key] ? App.Templates._indexes[key][ref_key] = {} : false; + $(tpl).each(function(index, o) { + if(':' == o.charAt(0)){ + App.Templates._indexes[key][ref_key][o.toString()] = index; + } + }); + } + + /** + * Get concrete templates + */ + init(); + return Templator; +}; +Templator.getTemplate = function(ns, key) +{ + return [ + App.Templates._indexes[ns][key], + App.Templates.html[ns][key].slice(0) + ]; +} +// init templator +Tpl.Templator = Templator(); +Tpl.get = function(key, group) +{ + return Tpl.Templator.getTemplate(group, key); +} diff --git a/web/vesta/api/DB.class.php b/web/vesta/api/DB.class.php index 9c7967f1..142c44b2 100644 --- a/web/vesta/api/DB.class.php +++ b/web/vesta/api/DB.class.php @@ -38,8 +38,7 @@ class DB extends AjaxHandler 'TYPE' => $record['TYPE'], 'U_DISK' => $record['U_DISK'], 'DISK' => 2024, - 'ENCODING' => "utf-8",//$record['ENCODING'], - // 'ENCODING' => $record['ENCODING'], + 'CHARSET' => strtolower($record['CHARSET']), 'SUSPEND' => $record['SUSPEND'], 'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE']))) ); @@ -68,8 +67,8 @@ class DB extends AjaxHandler 'DB_USER' => $_s['USER'], 'DB_PASSWORD' => $_s['PASSWORD'], 'TYPE' => $_s['TYPE'], - 'HOST' => '' - // 'ENCODING' => $_s['ENCODING'] + 'HOST' => $_s['HOST'], + 'CHARSET' => $_s['CHARSET'] ); $result = Vesta::execute(Vesta::V_ADD_DB_BASE, $params); diff --git a/web/vesta/api/DNS.class.php b/web/vesta/api/DNS.class.php index f8f205cc..85bf3d54 100644 --- a/web/vesta/api/DNS.class.php +++ b/web/vesta/api/DNS.class.php @@ -102,7 +102,7 @@ class DNS extends AjaxHandler 'TPL' => $_s['TPL'], 'EXP' => $_s['EXP'], 'SOA' => $_s['SOA'], - 'TTL' => $_s['TTL'], + 'TTL' => $_s['TTL'] ); $result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN, $params); diff --git a/web/vesta/api/MAIN.class.php b/web/vesta/api/MAIN.class.php index f069c1d1..aafb25b3 100644 --- a/web/vesta/api/MAIN.class.php +++ b/web/vesta/api/MAIN.class.php @@ -370,13 +370,14 @@ MAIL; public function getDbParams($data = array()) { $db_types = $this->getDBTypes(); + $db_hosts = $this->getDBHosts(); + $result = Vesta::execute(Vesta::V_LIST_DNS_TEMPLATES, null, self::JSON); return array( - 'TYPE' => $db_types, - 'HOST' => array('vestacp.com' => 'vestacp.com', 'askcow.org' => 'askcow.org'), - 'ENCODING' => array( - - 'utf8' => 'utf8', 'latin1' => 'latin1', 'cp1251' => 'cp1251', - + 'TYPE' => $db_types, + 'HOST' => $db_hosts, + 'CHARSET' => array( + 'utf8' => 'utf8', 'latin1' => 'latin1', 'cp1251' => 'cp1251' +/* '' => '', 'big5' => 'Big5 — Traditional Chinese ', @@ -415,13 +416,30 @@ MAIL; 'geostd8' => 'geostd8 — GEOSTD8 Georgian', 'cp932' => 'cp932 — SJIS for Windows Japanese', 'eucjpms' => 'eucjpms — UJIS for Windows Japanese' +*/ ) ); } public function getDBTypes() { - return array('mysql' => 'mysql', 'postgre' => 'postgre'); + return array('mysql' => 'MySQL', 'pgsql' => 'PostgreSQL'); + } + + public function getDBHosts() + { + + return array('localhost' => 'localhost'); + foreach($this->getDBTypes() as $type => $type_name){ + $result = Vesta::execute(Vesta::V_LIST_DB_HOSTS, $type, self::JSON); + foreach ($result['data'] as $host_name => $host_data) { + if (Utils::getCheckboxBooleanValue($host_data['ACTIVE'])) { + $hosts[$host_name] = $type_name .' – '. $host_name; + } + } + } + + return $hosts; } /** diff --git a/web/vesta/api/USER.class.php b/web/vesta/api/USER.class.php index 5b101bfb..bd5529ff 100644 --- a/web/vesta/api/USER.class.php +++ b/web/vesta/api/USER.class.php @@ -51,6 +51,7 @@ class USER extends AjaxHandler "SUSPEND" => $details['SUSPENDED'], "CONTACT" => $details['CONTACT'], "REPORTS" => $details['REPORTS'], + "REPORTS_ENABLED" => $details['REPORTS'], "IP_OWNED" => $details['IP_OWNED'], "U_DIR_DISK" => $details['U_DIR_DISK'], "U_DISK" => $details['U_DISK'], @@ -132,33 +133,42 @@ class USER extends AjaxHandler */ public function addExecute(Request $request) { - $spell = $request->getParameter('spell'); + $_s = $request->getParameter('spell'); $user = $this->getLoggedUser(); $params = array( - 'USER' => $spell['LOGIN_NAME'], - 'PASSWORD' => $spell['PASSWORD'], - 'EMAIL' => $spell['CONTACT'], - 'PACKAGE' => $spell['PACKAGE'], - 'FNAME' => $spell['FNAME'], - 'LNAME' => $spell['LNAME'] + 'USER' => $_s['LOGIN_NAME'], + 'PASSWORD' => $_s['PASSWORD'], + 'EMAIL' => $_s['CONTACT'], + 'PACKAGE' => $_s['PACKAGE'], + 'FNAME' => $_s['FNAME'], + 'LNAME' => $_s['LNAME'] ); $result = Vesta::execute(Vesta::V_ADD_SYS_USER, $params); // Reports - $enable_reports = Utils::getCheckboxBooleanValue($spell['REPORTS_ENABLED']); - $reports_result = $this->setUserReports($spell['LOGIN_NAME'], $spell['REPORTS_ENABLED']); + // $enable_reports = Utils::getCheckboxBooleanValue($spell['REPORTS_ENABLED']); + // $reports_result = $this->setUserReports($spell['LOGIN_NAME'], $spell['REPORTS_ENABLED']); // Set SHELL - $this->setShell($spell['LOGIN_NAME'], $spell['SHELL']); + // $this->setShell($_s['LOGIN_NAME'], $_s['SHELL']); if (!$result['status']) { $this->errors[] = array($result['error_code'] => $result['error_message']); } + if(@Utils::getCheckboxBooleanValue($_s['REPORTS_ENABLED'])){ + $result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS, array('USER' => $_USER)); + if (!$result['status']) { + $this->status = FALSE; + $this->errors['REPORTS'] = array($result['error_code'] => $result['error_message']); + } + } + + if ($_s['SUSPEND'] == 'on') { if($result['status']){ $result = array(); - $result = Vesta::execute(Vesta::V_SUSPEND_SYS_USER, array('USER' => $user['uid'], 'USER' => $spell['LOGIN_NAME'])); + $result = Vesta::execute(Vesta::V_SUSPEND_SYS_USER, array('USER' => $user['uid'], 'USER' => $_s['LOGIN_NAME'])); if (!$result['status']) { $this->status = FALSE; $this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']); @@ -249,6 +259,20 @@ class USER extends AjaxHandler } } + if ($_old['REPORTS_ENABLED'] != $_new['REPORTS_ENABLED']) { + $result = array(); + if(@Utils::getCheckboxBooleanValue($_new['REPORTS_ENABLED'])){ + $result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS, array('USER' => $_USER)); + } + else{ + $result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS, array('USER' => $_USER)); + } + if (!$result['status']) { + $this->status = FALSE; + $this->errors['REPORTS'] = array($result['error_code'] => $result['error_message']); + } + } + // Set SHELL $this->setShell($_USER, $_new['SHELL']); diff --git a/web/vesta/core/Vesta.class.php b/web/vesta/core/Vesta.class.php index 6e4f1958..b5402c1d 100644 --- a/web/vesta/core/Vesta.class.php +++ b/web/vesta/core/Vesta.class.php @@ -29,6 +29,7 @@ class Vesta const V_LIST_SYS_USER = 'v_list_user'; const V_LIST_USER_PACKAGES = 'v_list_user_packages'; const V_ADD_SYS_USER = 'v_add_user'; + const V_ADD_SYS_USER_REPORTS = 'v_add_user_reports'; const V_CHANGE_SYS_USER_CONTACT = 'v_change_user_contact'; const V_CHANGE_SYS_USER_NS = 'v_change_user_ns'; const V_CHANGE_SYS_USER_PACKAGE = 'v_change_user_package'; @@ -39,6 +40,7 @@ class Vesta const V_SUSPEND_SYS_USER = 'v_suspend_user'; const V_UNSUSPEND_SYS_USER = 'v_unsuspend_user'; const V_DEL_SYS_USER = 'v_delete_user'; + const V_DEL_SYS_USER_REPORTS = 'v_delete_user_reports'; // WEB_DOMAIN const V_LIST_WEB_DOMAINS = 'v_list_web_domains'; const V_LIST_WEB_DOMAINS_ALIAS = 'v_list_web_domains_alias'; @@ -122,14 +124,14 @@ class Vesta // CRON const V_LIST_CRON_JOBS = 'v_list_cron_jobs'; const V_ADD_CRON_JOB = 'v_add_cron_job'; - const V_ADD_SYS_USER_REPORTS = 'v_add_user_reports'; + // const V_ADD_SYS_USER_REPORTS = 'v_add_user_reports'; const V_CHANGE_CRON_JOB = 'v_change_cron_job'; const V_SUSPEND_CRON_JOB = 'v_suspend_cron_job'; const V_SUSPEND_CRON_JOBS = 'v_suspend_cron_jobs'; const V_UNSUSPEND_CRON_JOB = 'v_unsuspend_cron_job'; const V_UNSUSPEND_CRON_JOBS = 'v_unsuspend_cron_jobs'; const V_DEL_CRON_JOB = 'v_delete_cron_job'; - const V_DEL_SYS_USER_REPORTS = 'v_delete_user_reports'; + // const V_DEL_SYS_USER_REPORTS = 'v_delete_user_reports'; // STATS const V_LIST_SYS_RRD = 'v_list_sys_rrd json'; const V_UPDATE_SYS_RRD = 'v_update_sys_rrd'; diff --git a/web/vesta/core/VestaSession.class.php b/web/vesta/core/VestaSession.class.php index 9c49fd48..91efd436 100644 --- a/web/vesta/core/VestaSession.class.php +++ b/web/vesta/core/VestaSession.class.php @@ -76,20 +76,20 @@ class VestaSession public function loginAs($login) { - // TODO checkrights for login as - // if(Vesta::hasRights(self::getUserRole();, 'login_as')){ - - if(!$_SESSION['real_user']) - $_SESSION['real_user'] = $_SESSION['user']; + // TODO checkrights for login as + if(Vesta::hasRights(self::getUserRole(), 'login_as')){ + if(!$_SESSION['real_user']){ + $_SESSION['real_user'] = $_SESSION['user']; + } + } - $_SESSION['user'] = $login; - - // } + $_SESSION['user'] = $login; } public function logoutAs() { $_SESSION['user'] = $_SESSION['real_user']; + $_SESSION['real_user'] = false; } } ?> diff --git a/web/vesta/upload.php b/web/vesta/upload.php index ecbd148e..e573b2bd 100644 --- a/web/vesta/upload.php +++ b/web/vesta/upload.php @@ -18,7 +18,7 @@ switch ($_GET['action']) { handleUpload(); } else { - show_form(); + show_form(); } break; } @@ -59,8 +59,8 @@ function handleUpload() function show_form() { $type = $_GET['type']; - if (!in_array($type, array('key', 'cert'))) { - exit; + if (!in_array($type, array('key', 'cert', 'ca'))) { + exit; } print << \ No newline at end of file +?>