diff --git a/debian/changelog b/debian/changelog index abcb1250..6024da4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,8 @@ +<<<<<<< HEAD hedera-web (1.245-deb8) stable; urgency=low +======= +hedera-web (1.324-deb8) stable; urgency=low +>>>>>>> 5f64002b1d4eebc7fcfd7ff1916d7658fbaf57fb * Initial Release. diff --git a/debian/conf/config.php b/debian/conf/config.php index b59b22a8..1ee3ec59 100755 --- a/debian/conf/config.php +++ b/debian/conf/config.php @@ -1,6 +1,17 @@ config.www.php + * - http://test.mydomain.org -> config.test.php **/ $conf = [ @@ -9,16 +20,12 @@ $conf = [ **/ 'db' => [ 'host' => 'db.verdnatura.es' + ,'port' => 3306 ,'schema' => 'hedera-web' ,'user' => 'hedera-web' ,'pass' => 'base64pass' ] -/** - * The default language. - **/ -,'defaultLang' => 'es' - ]; ?> diff --git a/debian/control b/debian/control index 94a0fe73..a5e5a93b 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ Vcs-Git: git://www.verdnatura.es/var/git/hedera-web Package: hedera-web Architecture: all -Depends: apache2, php5-mysql, php-vn-web +Depends: apache2, php5-mysql, php5-mcrypt, php-vn-web Suggests: php-text-captcha, php5-imap, vn-image, tinymce Section: misc Priority: optional diff --git a/lib/vn/hedera/init.php b/lib/vn/hedera/init.php index cddca06c..7706960c 100644 --- a/lib/vn/hedera/init.php +++ b/lib/vn/hedera/init.php @@ -8,7 +8,7 @@ if (!defined (__NAMESPACE__.'\_DEVELOPER_MODE')) define (__NAMESPACE__.'\_LOG_DIR', '/var/log'); } -require_once (_CONFIG_DIR .'/config.php'); +$conf = NULL; ini_set ('log_errors', TRUE); ini_set ('error_log', 'syslog'); diff --git a/lib/vn/hedera/js.php b/lib/vn/hedera/js.php index adcd2fc3..df3d5963 100755 --- a/lib/vn/hedera/js.php +++ b/lib/vn/hedera/js.php @@ -10,7 +10,7 @@ class Js static function includeFile ($fileName) { - echo ''."\n\t"; + echo ''."\n\t\t"; } static function includeLib ($libName) @@ -28,7 +28,7 @@ class Js static function includeCss ($fileName) { - echo ''."\n\t"; + echo ''."\n\t\t"; } static function isMobile () diff --git a/lib/vn/hedera/web.php b/lib/vn/hedera/web.php index 9b5b72b2..235d34e7 100755 --- a/lib/vn/hedera/web.php +++ b/lib/vn/hedera/web.php @@ -16,12 +16,13 @@ class Web { static $sysConn = NULL; static $conn = NULL; + static $confIncluded = FALSE; /** * Initializes the Hedera web library. **/ static function init () - { + { if (self::isHttps ()) ini_set ('session.cookie_secure', TRUE); @@ -83,6 +84,8 @@ class Web { global $conf; + self::includeConf (); + if (self::$sysConn) return; @@ -109,16 +112,49 @@ class Web return (int) filectime (__FILE__); } + /** + * Includes the configuration file. + **/ + static function includeConf () + { + global $conf; + + if (self::$confIncluded) + return; + + $customFile = _CONFIG_DIR .'/config.my.php'; + + if (!empty ($_SERVER['SERVER_NAME']) + && preg_match ('/^[\w\-\.]+$/', $_SERVER['SERVER_NAME'])) + { + $hostSplit = explode ('.', $_SERVER['SERVER_NAME']); + $hostFile = _CONFIG_DIR .'/config.'. $hostSplit[0] .'.php'; + } + + if (isset ($hostFile) && file_exists ($hostFile)) + $confFile = $hostFile; + elseif (file_exists ($customFile)) + $confFile = $customFile; + else + $confFile = _CONFIG_DIR .'/config.php'; + + require ($confFile); + self::$confIncluded = TRUE; + } + static function login () { global $conf; + + self::includeConf (); $wasLoged = Auth::isLogged (); $useCookies = TRUE; $success = TRUE; - if (isset ($_GET['guest'])) + if (isset ($_POST['guest'])) { + self::sysInit (); $row = self::$sysConn->getRow ( 'SELECT guest_user, guest_pass FROM config'); @@ -130,9 +166,9 @@ class Web } } - try { - Auth::getCredentials (); + Auth::getCredentials (); + try { self::$conn = new Conn (); self::$conn->open ( $conf['db']['host'] @@ -141,20 +177,20 @@ class Web ,$conf['db']['schema'] ,$conf['db']['port'] ); - self::$conn->query ('CALL user_session_start (#)', - [session_id ()]); + self::$conn->query ('CALL user_session_start (#)', [session_id ()]); + self::$conn->query ('SET @lang = #', [\Vn\Lib\Locale::get ()]); - Auth::login ($useCookies); + Auth::login (TRUE, $useCookies); } catch (\Exception $e) { self::$conn = NULL; - $success = FALSE; + Auth::login (FALSE); } // Registering the user access - if ($success && !$wasLoged) + if (!$wasLoged) unset ($_SESSION['visitUser']); if (isset ($_SESSION['access']) @@ -170,12 +206,10 @@ class Web ,session_id () ] ); - + if (!isset ($_SESSION['visitUnknown']) && !$success) $_SESSION['visitUnknown'] = $_SESSION['visitUser']; } - - return $success; } static function deinit () diff --git a/lib/vn/tpv/tpv.php b/lib/vn/tpv/tpv.php index 7f29a495..40564149 100755 --- a/lib/vn/tpv/tpv.php +++ b/lib/vn/tpv/tpv.php @@ -18,6 +18,8 @@ class Tpv static function init () { global $conf; + + require (Hedera\_CONFIG_DIR .'/config.my.php'); openlog ('hedera-web', LOG_ODELAY, LOG_LOCAL0); @@ -27,6 +29,7 @@ class Tpv ,$conf['db']['user'] ,base64_decode ($conf['db']['pass']) ,$conf['db']['schema'] + ,$conf['db']['port'] ); } @@ -81,7 +84,7 @@ class Tpv $params = []; $body = imap_fetchbody ($imap, $msg, '1'); $strings = explode (';', $body); - + foreach ($strings as $string) { $x = explode (':', $string); @@ -98,18 +101,18 @@ class Tpv $folder = $imapConf['success_folder']; else $folder = $imapConf['error_folder']; - + $folder = sprintf ('INBOX.%s', $folder); if (!imap_mail_move ($imap, $msg, $folder)) - error_log ('TPV: IMAP: Can\'t move message to %s: %s' + trigger_error (sprintf ('TPV: IMAP: Can\'t move message to %s: %s' ,$folder ,imap_last_error () - ); + ), E_USER_WARNING); } if ($inbox && ($count = count ($inbox)) > 0) - error_log ('TPV: %d mails processed.', $count); + trigger_error (sprintf ('TPV: %d mails processed.', $count)); imap_expunge ($imap); @@ -138,13 +141,13 @@ class Tpv $deleted += count ($messages); } - error_log ('TPV: Cleaner: %d mails deleted.', $deleted); + trigger_error (sprintf ('TPV: Cleaner: %d mails deleted.', $deleted)); } imap_close ($imap); } else - error_log ('TPV: IMAP: %s', imap_last_error ()); + trigger_error (sprintf ('TPV: IMAP: %s', imap_last_error ()), E_USER_ERROR); self::deinit (); } @@ -183,36 +186,73 @@ class Tpv && isset ($params['Ds_Order']) && isset ($params['Ds_MerchantCode']) && isset ($params['Ds_Currency']) - && isset ($params['Ds_Response']) - && isset ($params['Ds_Signature'])) + && isset ($params['Ds_Response'])) { if (isset ($params['Ds_ErrorCode'])) $error = $params['Ds_ErrorCode']; else $error = NULL; - try { + try { return self::$conn->query ( - 'CALL transaction_confirm_with_check (#, #, #, #, #, #, #)', + 'CALL transaction_confirm (#, #, #, #, #, #)', [ $params['Ds_Amount'] ,$params['Ds_Order'] ,$params['Ds_MerchantCode'] ,$params['Ds_Currency'] ,$params['Ds_Response'] - ,$params['Ds_Signature'] ,$error ] ); } catch (\Exception $e) { - error_log ("TPV: DB: %s", $e->getMessage ()); + trigger_error (sprintf ("TPV: DB: %s", $e->getMessage ()), E_USER_WARNING); } } return FALSE; } + + static function transactionStart ($conn, $amount, $urlOk, $urlKo, $companyId, &$url, &$signature) + { + $row = $conn->getRow ('CALL transaction_start_sha256 (#, #)', + [$amount, $companyId]); + + if (!isset($row)) + throw new Exception ('Transaction error'); + + $transactionId = str_pad ($row['transaction_id'], 12, '0', STR_PAD_LEFT); + $urlOk = empty ($urlOk) ? '' : sprintf ($urlOk, $transactionId); + $urlKo = empty ($urlKo) ? '' : sprintf ($urlKo, $transactionId); + $merchantUrl = $row['merchant_url'] ? $row['merchant_url'] : ''; + + $params = [ + 'Ds_Merchant_Amount' => $amount + ,'Ds_Merchant_Order' => $transactionId + ,'Ds_Merchant_MerchantCode' => $row['merchant'] + ,'Ds_Merchant_Currency' => $row['currency'] + ,'Ds_Merchant_TransactionType' => $row['transaction_type'] + ,'Ds_Merchant_Terminal' => $row['terminal'] + ,'Ds_Merchant_MerchantURL' => $merchantUrl + ,'Ds_Merchant_UrlOK' => $urlOk + ,'Ds_Merchant_UrlKO' => $urlKo + ]; + + $encodedParams = base64_encode (json_encode ($params)); + + $key = base64_decode ($row['secret_key']); + + $bytes = array (0, 0, 0, 0, 0, 0, 0, 0); + $iv = implode (array_map ("chr", $bytes)); + $key = mcrypt_encrypt (MCRYPT_3DES, $key, $transactionId, MCRYPT_MODE_CBC, $iv); + + $signature = base64_encode (hash_hmac ('sha256', $encodedParams, $key, TRUE)); + $url = $row['url']; + + return $encodedParams; + } /** * Tests the confirmation process. The corresponding record diff --git a/php-test b/php-test new file mode 100755 index 00000000..4900d9db --- /dev/null +++ b/php-test @@ -0,0 +1,3 @@ +#!/bin/bash + +php -d auto_prepend_file=configure.php "$@" diff --git a/web/forms/account/address-list/address-list.js b/web/forms/account/address-list/address-list.js index 7e602c3f..57141a56 100755 --- a/web/forms/account/address-list/address-list.js +++ b/web/forms/account/address-list/address-list.js @@ -1,7 +1,7 @@ Vn.AddressList = new Class ({ - Extends: Vn.Module + Extends: Vn.Form ,activate: function () { diff --git a/web/forms/account/address-list/style.css b/web/forms/account/address-list/style.css index c3fba906..8bd9a259 100755 --- a/web/forms/account/address-list/style.css +++ b/web/forms/account/address-list/style.css @@ -5,7 +5,7 @@ } .address-list .box { - max-width: 40em; + max-width: 30em; } .address-list .form { @@ -15,19 +15,34 @@ } .address { - color: #555; - padding: .5em; -} -.address p.consignee -{ - font-weight: bold; + padding: 1em; + border-bottom: 1px solid #DDD; } .address p { - font-size: 1.4em; margin: 0.2em 0; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} +.address p.important +{ + font-size: 1.2em; } .address .actions { - text-align: right; + float: right; +} +.address .actions > .htk-button +{ + margin: 0; +} +.address .actions > * +{ + display: inline-block; + vertical-align: middle; +} +.address .actions > input +{ + margin: .6em; } diff --git a/web/forms/account/address-list/ui.xml b/web/forms/account/address-list/ui.xml index 033c2c0a..1fed18e4 100755 --- a/web/forms/account/address-list/ui.xml +++ b/web/forms/account/address-list/ui.xml @@ -1,76 +1,75 @@ - - SELECT user_id, default_address - FROM customer_view c + + + SELECT user_id, default_address + FROM customer_view c + - SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country - FROM address_view a - LEFT JOIN vn2008.province p ON a.province_id = p.province_id - JOIN vn2008.Paises c ON c.Id = p.Paises_Id - WHERE active != FALSE + + SELECT a.id, a.consignee, p.name province, a.zip_code, + a.city, a.name, a.active, c.Pais country + FROM address_view a + LEFT JOIN vn2008.province p ON a.province_id = p.province_id + JOIN vn2008.Paises c ON c.Id = p.Paises_Id + WHERE active != FALSE + +
+

Addresses

+
+
+ +
-
-

Addresses

-
- - + + + +
+
+ + + +
+

+ +

+

+ +

+

+ , + +

-
-
-
- - - - -
+
+
diff --git a/web/forms/account/address/address.js b/web/forms/account/address/address.js index c9ad6d9e..aca0a781 100755 --- a/web/forms/account/address/address.js +++ b/web/forms/account/address/address.js @@ -1,7 +1,7 @@ Vn.Address = new Class ({ - Extends: Vn.Module + Extends: Vn.Form ,activate: function () { diff --git a/web/forms/account/address/style.css b/web/forms/account/address/style.css index f26a2151..6b4daad6 100755 --- a/web/forms/account/address/style.css +++ b/web/forms/account/address/style.css @@ -5,27 +5,16 @@ } .address .box { - max-width: 40em; + max-width: 30em; + padding: 2em; } -.address .box .body +.address .form { margin: 0 auto; max-width: 25em; - padding: 3em; } -div.form-group +.address .form-group { padding: 0.4em; } -.address label -{ - display: block; - margin-bottom: 0.5em; -} -.address input, -.address select -{ - margin: 0; - width: 100%; -} diff --git a/web/forms/account/address/ui.xml b/web/forms/account/address/ui.xml index 89c4076b..c8a7f77d 100755 --- a/web/forms/account/address/ui.xml +++ b/web/forms/account/address/ui.xml @@ -1,38 +1,47 @@ - - - + + - - - SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id - FROM address_view a - LEFT JOIN vn2008.province p ON p.province_id = a.province_id - JOIN vn2008.Paises c ON c.Id = p.Paises_Id - WHERE active != FALSE AND a.id = #address + + + SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id + FROM address_view a + LEFT JOIN vn2008.province p ON p.province_id = a.province_id + JOIN vn2008.Paises c ON c.Id = p.Paises_Id + WHERE active != FALSE AND a.id = #address + - + + + +
+

AddEditAddress

+
+
+ + +
-
-

AddEditAddress

-
- - -
-
-
+
@@ -51,10 +60,18 @@
- + + - SELECT Id, Pais FROM vn2008.Paises - ORDER BY Pais + + SELECT Id, Pais FROM vn2008.Paises + ORDER BY Pais +
@@ -62,11 +79,15 @@ - SELECT province_id, name FROM vn2008.province - WHERE Paises_Id = #country - ORDER BY name + + SELECT province_id, name FROM vn2008.province + WHERE Paises_Id = #country + ORDER BY name + - + + + diff --git a/web/forms/account/conf/conf.js b/web/forms/account/conf/conf.js index 3f89b752..440f12f3 100755 --- a/web/forms/account/conf/conf.js +++ b/web/forms/account/conf/conf.js @@ -1,7 +1,7 @@ Vn.Conf = new Class ({ - Extends: Vn.Module + Extends: Vn.Form ,activate: function () { diff --git a/web/forms/account/conf/style.css b/web/forms/account/conf/style.css index 73e95e6e..ece49089 100755 --- a/web/forms/account/conf/style.css +++ b/web/forms/account/conf/style.css @@ -5,29 +5,18 @@ } .conf .box { - max-width: 40em; + max-width: 30em; + padding: 2em; } .conf .form { margin: 0 auto; max-width: 25em; - padding: 2em; } .conf .form-group { padding: 0.4em; } -.conf .form-group label -{ - display: block; - margin-bottom: 0.5em; -} -.conf .form-group input[type=text], -.conf .form-group input[type=password] -{ - margin: 0; - width: 100%; -} .conf .form-group input[type=password] { margin-bottom: 0.5em; diff --git a/web/forms/account/conf/ui.xml b/web/forms/account/conf/ui.xml index 7fd48b11..6473c5ce 100755 --- a/web/forms/account/conf/ui.xml +++ b/web/forms/account/conf/ui.xml @@ -1,33 +1,37 @@ - - SELECT id, u.name, email, mail, c.user_id, c.default_address - FROM user_view u - LEFT JOIN customer_view c - ON u.id = c.user_id + + + SELECT id, u.name, email, mail, c.user_id, c.default_address + FROM user_view u + LEFT JOIN customer_view c + ON u.id = c.user_id + - SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country - FROM address_view a - LEFT JOIN vn2008.province p ON a.province_id = p.province_id - JOIN vn2008.Paises c ON c.Id = p.Paises_Id - WHERE active != FALSE + + SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country + FROM address_view a + LEFT JOIN vn2008.province p ON a.province_id = p.province_id + JOIN vn2008.Paises c ON c.Id = p.Paises_Id + WHERE active != FALSE + +
+

Configuration

+
+
+ +
-
-

Configuration

-
- -
-
-
diff --git a/web/forms/admin/access-log/access-log.js b/web/forms/admin/access-log/access-log.js index 108fc6cd..f226a950 100755 --- a/web/forms/admin/access-log/access-log.js +++ b/web/forms/admin/access-log/access-log.js @@ -1,6 +1,6 @@ Vn.AccessLog = new Class ({ - Extends: Vn.Module + Extends: Vn.Form }); diff --git a/web/forms/admin/access-log/style.css b/web/forms/admin/access-log/style.css index 35a35eb1..9a6b0cfe 100755 --- a/web/forms/admin/access-log/style.css +++ b/web/forms/admin/access-log/style.css @@ -1,15 +1,36 @@ .access-log { padding: 1em; - min-width: 35em; } .access-log .box { - max-width: 50em; + max-width: 25em; margin: 0 auto; } -.access-log .htk-grid tbody tr +.access-log .form { - height: 3.4em; + padding: 2em; +} +.access-log .form > p +{ + font-size: 1.2em; + margin: .1em 0; +} + +/* List */ + +.access-log .list +{ + margin-top: 1em; +} +.access-log .item +{ + display: block; + padding: 1em; + border-bottom: 1px solid #DDD; +} +.access-log .item > p +{ + margin: .1em 0; } diff --git a/web/forms/admin/access-log/ui.xml b/web/forms/admin/access-log/ui.xml index 1dff1256..a3eaa665 100755 --- a/web/forms/admin/access-log/ui.xml +++ b/web/forms/admin/access-log/ui.xml @@ -1,80 +1,77 @@ - - - + + - - SELECT Id_Cliente, Cliente, Telefono, movil - FROM vn2008.Clientes WHERE Id_Cliente = #user + + + SELECT Id_Cliente, Cliente, Telefono, movil + FROM vn2008.Clientes WHERE Id_Cliente = #user + - + + + +
+

AccessLog

+
-
-

AccessLog

+
+

+ +

+

+ +

+

+ +

+

+ +

- - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
+
+
- - - SELECT u.date_time, a.platform, a.browser, a.version, a.javascript, a.cookies - FROM visit_user u - JOIN visit_access c ON u.access_id = c.id - JOIN visit_agent a ON c.agent_id = a.id - WHERE u.user_id = #user - ORDER BY u.date_time DESC - LIMIT 30 + + + + SELECT u.date_time, a.platform, a.browser, a.version, a.javascript, a.cookies + FROM visit_user u + JOIN visit_access c ON u.access_id = c.id + JOIN visit_agent a ON c.agent_id = a.id + WHERE u.user_id = #user + ORDER BY u.date_time DESC + LIMIT 8 + - + + + - - - - - - - + +
+

+ +

+

+ - + + +

+
+
+
diff --git a/web/forms/admin/connections/connections.js b/web/forms/admin/connections/connections.js new file mode 100755 index 00000000..ba3fd12f --- /dev/null +++ b/web/forms/admin/connections/connections.js @@ -0,0 +1,53 @@ + +Vn.Connections = new Class +({ + Extends: Vn.Form + + ,_timeoutId: null + + ,onModelStatusChange: function (model, status) + { + if (!model.ready) + return; + + if (this._timeoutId) + clearTimeout (this._timeoutId); + + this._timeoutId = setTimeout (this.onRefreshClick.bind (this), 60000); + } + + ,deactivate: function () + { + clearTimeout (this._timeoutId); + } + + ,onRefreshClick: function () + { + this.$('sessions').refresh (); + } + + ,onAccessLogClick: function (button, form) + { + this.hash.set ({ + 'form': 'admin/access-log' + ,'user': form.get ('user_id') + }); + } + + ,onChangeUserClick: function (button, form) + { + this.gui.supplantUser (form.get ('user_id'), + this.onUserSupplant.bind (this)); + } + + ,onUserSupplant: function (userName) + { + this.hash.set ({'form': 'ecomerce/orders'}); + } + + ,sessionsFunc: function () + { + return 1; + } +}); + diff --git a/web/forms/admin/connections/style.css b/web/forms/admin/connections/style.css new file mode 100755 index 00000000..b27e9449 --- /dev/null +++ b/web/forms/admin/connections/style.css @@ -0,0 +1,44 @@ +.connections +{ + padding: 1em; +} +.connections .box +{ + max-width: 25em; + margin: 0 auto; +} +.action-bar .connections-sum +{ + padding: .4em; + margin-top: .9em; + margin-right: .5em; + background-color: #1e88e5; + border-radius: 0.1em; + box-shadow: 0 0 0.4em #666; +} + +/* List */ + +.connections .item +{ + display: block; + padding: 1em; + border-bottom: 1px solid #DDD; +} +.connections .item > button +{ + float: right; + margin: 0; +} +.connections .item > p +{ + margin: .1em 0; +} +.connections .item > p.important +{ + font-size: 1.2em; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + diff --git a/web/forms/admin/connections/ui.xml b/web/forms/admin/connections/ui.xml new file mode 100755 index 00000000..e6d2a079 --- /dev/null +++ b/web/forms/admin/connections/ui.xml @@ -0,0 +1,69 @@ + +
+

Connections

+
+
+ +
+ + + + connections +
+
+
+
+ + + + SELECT s.id, e.user_id, c.Cliente, e.date_time login, is_new, + s.date_time last_activity, a.platform, a.browser, a.version + FROM user_session s + JOIN visit_user e ON s.visit_user_id = e.id + JOIN visit_access c ON e.access_id = c.id + JOIN visit_agent a ON c.agent_id = a.id + JOIN visit v ON a.visit_id = v.id + JOIN account.user u ON e.user_id = u.id + JOIN vn2008.Clientes c ON e.user_id = c.Id_cliente + ORDER BY last_activity DESC + + + +
+ + +

+ +

+

+ - + +

+

+ - + + +

+
+
+
+
+
+
diff --git a/web/forms/admin/items/items.js b/web/forms/admin/items/items.js new file mode 100755 index 00000000..bb42361d --- /dev/null +++ b/web/forms/admin/items/items.js @@ -0,0 +1,23 @@ + +Vn.Items = new Class +({ + Extends: Vn.Form + + ,activate: function () + { + this.$('warehouse').value = 7; + this.$('realm').value = null; + } + + ,onPreviewClick: function () + { + var batch = new Sql.Batch (); + batch.addValues ({ + 'warehouse': this.$('warehouse').value + ,'realm': this.$('realm').value + ,'rate': this.$('rate').value + }); + this.gui.openReport ('items-report', batch); + } +}); + diff --git a/web/forms/admin/items/style.css b/web/forms/admin/items/style.css new file mode 100755 index 00000000..ff9ba1be --- /dev/null +++ b/web/forms/admin/items/style.css @@ -0,0 +1,43 @@ + +.items +{ + padding: 1em; +} +.items .box +{ + max-width: 30em; + padding: 2em; +} +.items .form +{ + max-width: 25em; + margin: auto; +} +.items .form-group +{ + padding: 0.4em; +} +.items form label +{ + display: block; + margin-bottom: 0.5em; +} +.items input[type=text], +.items select +{ + margin: 0; + width: 100%; +} + +/* Footer */ + +.items .footer +{ + text-align: center; + margin-top: 1.5em; +} +.items .footer > button +{ + margin: 0 .2em; +} + diff --git a/web/forms/admin/items/ui.xml b/web/forms/admin/items/ui.xml new file mode 100755 index 00000000..65f97fbb --- /dev/null +++ b/web/forms/admin/items/ui.xml @@ -0,0 +1,48 @@ + +
+

Item list

+
+
+
+
+
+ + + + + + SELECT id, name FROM vn2008.warehouse + WHERE reserve ORDER BY name + + + +
+
+ + + + + + SELECT id, reino FROM vn2008.reinos + WHERE display != FALSE ORDER BY reino + + + +
+
+ + +
+
+ +
+
+
diff --git a/web/forms/admin/links/links.js b/web/forms/admin/links/links.js index c5a3ea5a..41c14fa7 100755 --- a/web/forms/admin/links/links.js +++ b/web/forms/admin/links/links.js @@ -1,16 +1,11 @@ Vn.Links = new Class ({ - Extends: Vn.Module + Extends: Vn.Form - ,activate: function () + ,repeaterFunc: function (res, form) { - this.$('column-link').renderer = this.linkRenderer; - } - - ,linkRenderer: function (column, form) - { - column.href = form.get ('link'); + res.$('link').href = form.get ('link'); } }); diff --git a/web/forms/admin/links/style.css b/web/forms/admin/links/style.css index 962e8734..a2a73f3a 100755 --- a/web/forms/admin/links/style.css +++ b/web/forms/admin/links/style.css @@ -5,14 +5,34 @@ } .cpanel .box { - max-width: 60em; - min-width: 25em; + max-width: 30em; } -.cpanel tbody tr + +/* Items */ + +.cpanel .item { - height: 3.5em; + display: block; + padding: 1em; + border-bottom: 1px solid #DDD; } -.cpanel tbody td img +.cpanel .item:hover { - min-height: 1.6em; + background-color: rgba(1, 1, 1, 0.05); +} +.cpanel .item > img +{ + margin: .2em 0; + margin-right: 1em; + float: left; + max-height: 3em; + max-width: 3em; +} +.cpanel .item > p +{ + margin: .1em 0; +} +.cpanel .item > p.important +{ + font-size: 1.2em; } diff --git a/web/forms/admin/links/ui.xml b/web/forms/admin/links/ui.xml index 41c8adaf..79540fd9 100755 --- a/web/forms/admin/links/ui.xml +++ b/web/forms/admin/links/ui.xml @@ -1,18 +1,32 @@ +
+

ControlPanel

+
-
-

ControlPanel

-
- - - SELECT image, name, description, link FROM link - ORDER BY name + + + + SELECT image, name, description, link FROM link + ORDER BY name + - - - - + + + +

+ +

+

+ +

+
+
+
diff --git a/web/forms/admin/photos/photos.js b/web/forms/admin/photos/photos.js index 8033f604..0f2b7da4 100755 --- a/web/forms/admin/photos/photos.js +++ b/web/forms/admin/photos/photos.js @@ -1,7 +1,7 @@ Vn.Photos = new Class ({ - Extends: Vn.Module + Extends: Vn.Form ,activate: function () { diff --git a/web/forms/admin/photos/send-data.php b/web/forms/admin/photos/send-data.php deleted file mode 100755 index b202eaef..00000000 --- a/web/forms/admin/photos/send-data.php +++ /dev/null @@ -1,42 +0,0 @@ -'); - - echo json_encode (TRUE); -} -else - echo json_encode (FALSE); - -unset ($_SESSION['captcha']); - -?> diff --git a/web/forms/admin/photos/style.css b/web/forms/admin/photos/style.css index 1d43878d..c25d6923 100755 --- a/web/forms/admin/photos/style.css +++ b/web/forms/admin/photos/style.css @@ -5,28 +5,14 @@ } .photos .box { - max-width: 40em; + max-width: 30em; + padding: 2em; } -.photos form +.photos .form { margin: 0 auto; max-width: 25em; } -div.form-group -{ - padding: 0.4em; -} -.photos form label -{ - display: block; - margin-bottom: 0.5em; -} -.photos input, -.photos select -{ - margin: 0; - width: 100%; -} .photos iframe { display: none; diff --git a/web/forms/admin/photos/ui.xml b/web/forms/admin/photos/ui.xml index 46e7be67..1b074152 100755 --- a/web/forms/admin/photos/ui.xml +++ b/web/forms/admin/photos/ui.xml @@ -1,10 +1,10 @@ +
+

Photos

+
-
-

Photos

-
-
+
- diff --git a/web/forms/admin/queries/queries.js b/web/forms/admin/queries/queries.js new file mode 100755 index 00000000..4e273761 --- /dev/null +++ b/web/forms/admin/queries/queries.js @@ -0,0 +1,102 @@ + +Vn.Queries = new Class +({ + Extends: Vn.Form + + ,activate: function () + { + this.$('result-index').value = 0; + } + + ,clean: function () + { + if (this._grid) + { + this.$('grid-holder').removeChild (this._grid.getNode ()); + this._grid.unref (); + this._grid = null; + } + } + + ,_onExecuteClick: function () + { + this.clean (); + + var model = new Db.Model ({ + conn: this.conn, + query: this.$('sql').value, + resultIndex: this.$('result-index').value, + updatable: this.$('updatable').value + }); + model.on ('status-changed', this._onModelChange, this); + } + + ,_onCleanClick: function () + { + this.clean (); + } + + ,_onModelChange: function (model, status) + { + if (status !== Db.Model.Status.LOADING) + { + model.disconnect ('status-changed', this._onModelChange, this); + model.unref (); + } + + if (status !== Db.Model.Status.READY) + return; + + Htk.Toast.showMessage (_('Query executed!')); + + var gridHolder = this.$('grid-holder'); + + if (gridHolder.firstChild) + gridHolder.removeChilds (gridHolder.firstChild); + + var grid = new Htk.Grid (); + + var columns = model.columns; + + for (var i = 0; i < columns.length; i++) + { + var c = columns[i]; + + switch (c.type) + { + case Db.Conn.Type.BOOLEAN: + var column = new Htk.ColumnCheck (); + break; + case Db.Conn.Type.INTEGER: + var column = new Htk.ColumnSpin (); + break; + case Db.Conn.Type.DOUBLE: + var column = new Htk.ColumnSpin ({digits: 2}); + break; + case Db.Conn.Type.DATE: + var column = new Htk.ColumnDate ({format: '%a, %e %b %Y'}); + break; + case Db.Conn.Type.DATE_TIME: + var column = new Htk.ColumnDate ({format: '%a, %e %b %Y, %T'}); + break; + case Db.Conn.Type.STRING: + default: + var column = new Htk.ColumnText (); + } + + column.setProperties ({ + title: c.name, + editable: this.$('updatable').value, + columnIndex: i + }); + + grid.appendColumn (column); + } + + grid.model = model; + gridHolder.appendChild (grid.getNode ()); + this._grid = grid; + + } +}); + diff --git a/web/forms/admin/queries/style.css b/web/forms/admin/queries/style.css new file mode 100755 index 00000000..e3c925ca --- /dev/null +++ b/web/forms/admin/queries/style.css @@ -0,0 +1,25 @@ +.queries +{ + padding: 1em; +} +.queries .box +{ + max-width: 40em; + margin: 0 auto; +} +.queries .form +{ + box-sizing: border-box; + padding: 2em; +} +.queries textarea +{ + display: block; + width: 100%; + height: 8em; +} +.queries .result +{ + margin-top: 1em; + overflow: auto; +} diff --git a/web/forms/admin/queries/ui.xml b/web/forms/admin/queries/ui.xml new file mode 100755 index 00000000..a944946f --- /dev/null +++ b/web/forms/admin/queries/ui.xml @@ -0,0 +1,40 @@ + +
+

Queries

+
+
+ + +
+
+
+
+ +