From the Administration menu, choose Accounts, then List.
+
On the Account List, under Options on the right-hand side, choose the first icon to view the account. It looks like a pair of eyes.
+
On the Account Admin page, you will find the ACCOUNT ID is the second item in the right-hand column and the SECRET KEY is about halfway down the page, near a large red warning.
', urlencode($e->getMessage()));
+
+ //if(defined('BB_DEBUG') && BB_DEBUG) {
+ print sprintf('%s', 'Set BB_DEBUG to FALSE, to hide the message below');
+ print sprintf('
Class: "%s"
', get_class($e));
+ print sprintf('
File: "%s"
', $e->getFile());
+ print sprintf('
Line: "%s"
', $e->getLine());
+ print sprintf('Trace:
%s
', $e->getTraceAsString());
+ //}
+}
+
+set_exception_handler("handler_exception");
+set_error_handler('handler_error');
+
+// multisite support. Load new config depending on current host
+// if run from cli first param must be hostname
+$configPath = BB_PATH_ROOT.'/bb-config.php';
+if((isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST']) || (php_sapi_name() == 'cli' && isset($argv[1]) ) ) {
+ if(php_sapi_name() == 'cli') {
+ $host = $argv[1];
+ } else {
+ $host = $_SERVER['HTTP_HOST'];
+ }
+
+ $predictConfigPath = BB_PATH_ROOT.'/bb-config-'.$host.'.php';
+ if(file_exists($predictConfigPath)) {
+ $configPath = $predictConfigPath;
+ }
+}
+
+// check if config is available
+if(!file_exists($configPath) || 0 == filesize( $configPath )) {
+
+ //try create empty config file
+ @file_put_contents($configPath, '');
+
+ $base_url = "http://".$_SERVER['HTTP_HOST'];
+ $base_url .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/';
+ $url = $base_url . 'install/index.php';
+ $configFile = pathinfo($configPath, PATHINFO_BASENAME);
+ $msg = sprintf("There doesn't seem to be a $configFile file or bb-config.php file does not contain required configuration parameters. I need this before we can get started. Need more help? We got it. You can create a $configFile file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.
Continue with BoxBilling installation", $url);
+ throw new Exception($msg, 101);
+}
+
+$config = require_once $configPath;
+require BB_PATH_VENDOR . '/autoload.php';
+
+define('BB_DEBUG', $config['debug']);
+define('BB_URL', $config['url']);
+define('BB_SEF_URLS', $config['sef_urls']);
+define('BB_PATH_CACHE', $config['path_data'] . '/cache');
+define('BB_PATH_LOG', $config['path_data'] . '/log');
+define('BB_SSL', (substr($config['url'], 0, 5) === 'https'));
+
+if($config['sef_urls']) {
+ define('BB_URL_API', $config['url'] . 'api/');
+} else {
+ define('BB_URL_API', $config['url'] . 'index.php/api/');
+}
+
+if($config['debug']) {
+ error_reporting( E_ALL );
+ ini_set('display_errors', '1');
+ ini_set('display_startup_errors', '1');
+} else {
+ error_reporting( E_RECOVERABLE_ERROR );
+ ini_set('display_errors', '0');
+ ini_set('display_startup_errors', '0');
+}
+
+ini_set('log_errors', '1');
+ini_set('html_errors', FALSE);
+ini_set('error_log', BB_PATH_LOG . '/php_error.log');
+
+$lang = (isset($_COOKIE) && isset($_COOKIE['BBLANG']) && !empty($_COOKIE['BBLANG'])) ? $_COOKIE['BBLANG'] : $config['locale'];
+$domain = 'messages';
+$codeset = "UTF-8";
+if(!function_exists('gettext')) {
+ require_once BB_PATH_LIBRARY . '/php-gettext/gettext.inc';
+ T_setlocale(LC_MESSAGES, $lang.'.'.$codeset);
+ T_setlocale(LC_TIME, $lang.'.'.$codeset);
+ T_bindtextdomain($domain, BB_PATH_LANGS);
+ T_bind_textdomain_codeset($domain, $codeset);
+ T_textdomain($domain);
+} else {
+ @putenv('LANG='.$lang.'.'.$codeset);
+ @putenv('LANGUAGE='.$lang.'.'.$codeset);
+ // set locale
+ if (!defined('LC_MESSAGES')) define('LC_MESSAGES', 5);
+ if (!defined('LC_TIME')) define('LC_TIME', 2);
+ setlocale(LC_MESSAGES, $lang.'.'.$codeset);
+ setlocale(LC_TIME, $lang.'.'.$codeset);
+ bindtextdomain($domain, BB_PATH_LANGS);
+ if(function_exists('bind_textdomain_codeset')) bind_textdomain_codeset($domain, $codeset);
+ textdomain($domain);
+
+ function __($msgid, array $values = NULL)
+ {
+ if(empty($msgid)) return null;
+ $string = gettext($msgid);
+ return empty($values) ? $string : strtr($string, $values);
+ }
+}
+
+// Strip magic quotes from request data.
+if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
+ // Create lamba style unescaping function (for portability)
+ $quotes_sybase = strtolower(ini_get('magic_quotes_sybase'));
+ $unescape_function = (empty($quotes_sybase) || $quotes_sybase === 'off') ? 'stripslashes($value)' : 'str_replace("\'\'","\'",$value)';
+ $stripslashes_deep = create_function('&$value, $fn', '
+ if (is_string($value)) {
+ $value = ' . $unescape_function . ';
+ } else if (is_array($value)) {
+ foreach ($value as &$v) $fn($v, $fn);
+ }
+ ');
+
+ // Unescape data
+ $stripslashes_deep($_POST, $stripslashes_deep);
+ $stripslashes_deep($_GET, $stripslashes_deep);
+ $stripslashes_deep($_COOKIE, $stripslashes_deep);
+ $stripslashes_deep($_REQUEST, $stripslashes_deep);
+}
diff --git a/src/bb-locale/admin.pot b/src/bb-locale/admin.pot
new file mode 100644
index 000000000..c333b7e6d
--- /dev/null
+++ b/src/bb-locale/admin.pot
@@ -0,0 +1,3260 @@
+msgid "Home"
+msgstr ""
+
+msgid "Products"
+msgstr ""
+
+msgid "Product promotions"
+msgstr ""
+
+msgid "Manage coupon code"
+msgstr ""
+
+msgid "Code"
+msgstr ""
+
+msgid "Discount type"
+msgstr ""
+
+msgid "Recurring"
+msgstr ""
+
+msgid "Active"
+msgstr ""
+
+msgid "Free setup"
+msgstr ""
+
+msgid "Promo code limitations"
+msgstr ""
+
+msgid "Once per client"
+msgstr ""
+
+msgid "Yes"
+msgstr ""
+
+msgid "No"
+msgstr ""
+
+msgid "Max uses (zero for unlimited)"
+msgstr ""
+
+msgid "Used"
+msgstr ""
+
+msgid "Period when code is valid"
+msgstr ""
+
+msgid "Periods (Select none to apply to all periods)"
+msgstr ""
+
+msgid "Update"
+msgstr ""
+
+msgid "System activity"
+msgstr ""
+
+msgid "Message"
+msgstr ""
+
+msgid "Ip"
+msgstr ""
+
+msgid "Country"
+msgstr ""
+
+msgid "Date"
+msgstr ""
+
+msgid "Are you sure?"
+msgstr ""
+
+msgid "The list is empty"
+msgstr ""
+
+msgid "Promo"
+msgstr ""
+
+msgid "New promo"
+msgstr ""
+
+msgid "Discount"
+msgstr ""
+
+msgid "Applies to"
+msgstr ""
+
+msgid "Valid period"
+msgstr ""
+
+msgid "Enabled"
+msgstr ""
+
+msgid "Usage"
+msgstr ""
+
+msgid "Create new coupon code"
+msgstr ""
+
+msgid "Create special offers for your clients by creating coupon codes."
+msgstr ""
+
+msgid "Absolute"
+msgstr ""
+
+msgid "Percentage"
+msgstr ""
+
+msgid "Valid time (Leave blank for undefined time)"
+msgstr ""
+
+msgid "Products (Select none to apply to all products)"
+msgstr ""
+
+msgid "Create"
+msgstr ""
+
+msgid "Details"
+msgstr ""
+
+msgid "Manage"
+msgstr ""
+
+msgid "Forum"
+msgstr ""
+
+msgid "Title"
+msgstr ""
+
+msgid "Started by"
+msgstr ""
+
+msgid "Views"
+msgstr ""
+
+msgid "Messages"
+msgstr ""
+
+msgid "Status"
+msgstr ""
+
+msgid "Sticky"
+msgstr ""
+
+msgid "Created at"
+msgstr ""
+
+msgid "Updated at"
+msgstr ""
+
+msgid "Slug"
+msgstr ""
+
+msgid "Reply"
+msgstr ""
+
+msgid "Quote"
+msgstr ""
+
+msgid "Post"
+msgstr ""
+
+msgid "ID"
+msgstr ""
+
+msgid "IP"
+msgstr ""
+
+msgid "Email history"
+msgstr ""
+
+msgid "To"
+msgstr ""
+
+msgid "From"
+msgstr ""
+
+msgid "Subject"
+msgstr ""
+
+msgid "Categories"
+msgstr ""
+
+msgid "Category updated"
+msgstr ""
+
+msgid "Icon"
+msgstr ""
+
+msgid "Browse"
+msgstr ""
+
+msgid "Select icon and click OK"
+msgstr ""
+
+msgid "Hosting settings"
+msgstr ""
+
+msgid "Server"
+msgstr ""
+
+msgid "Hosting plan"
+msgstr ""
+
+msgid "Reseller hosting"
+msgstr ""
+
+msgid "Free domain registration"
+msgstr ""
+
+msgid "Free domain transfer"
+msgstr ""
+
+msgid "Hosting plans"
+msgstr ""
+
+msgid "Servers"
+msgstr ""
+
+msgid "Redirects"
+msgstr ""
+
+msgid "Settings"
+msgstr ""
+
+msgid "The list is empty."
+msgstr ""
+
+msgid "Create new redirect"
+msgstr ""
+
+msgid "Add"
+msgstr ""
+
+msgid "Hosting plans and servers"
+msgstr ""
+
+msgid "New server"
+msgstr ""
+
+msgid "New hosting plan"
+msgstr ""
+
+msgid "Name"
+msgstr ""
+
+msgid "Server manager"
+msgstr ""
+
+msgid "Addon domains"
+msgstr ""
+
+msgid "Disk space"
+msgstr ""
+
+msgid "Bandwidth"
+msgstr ""
+
+msgid "Unique name to identify this server"
+msgstr ""
+
+msgid "Hostname"
+msgstr ""
+
+msgid "server1.yourserverdomain.com"
+msgstr ""
+
+msgid ""
+"Primary IP address of the server used to connect to it like: 123.123.123.123"
+msgstr ""
+
+msgid "Assigned IP Addresses"
+msgstr ""
+
+msgid "List the IP Addresses assigned to the server (One per line)"
+msgstr ""
+
+msgid "Enable/Disable"
+msgstr ""
+
+msgid "Nameserver 1"
+msgstr ""
+
+msgid "ns1.yourdomain.com"
+msgstr ""
+
+msgid "Nameserver 2"
+msgstr ""
+
+msgid "ns2.yourdomain.com"
+msgstr ""
+
+msgid "Nameserver 3"
+msgstr ""
+
+msgid "ns3.yourdomain.com"
+msgstr ""
+
+msgid "Nameserver 4"
+msgstr ""
+
+msgid "ns4.yourdomain.com"
+msgstr ""
+
+msgid "Username"
+msgstr ""
+
+msgid "Login username to your server: root/reseller"
+msgstr ""
+
+msgid "Password"
+msgstr ""
+
+msgid "Login password to your server"
+msgstr ""
+
+msgid "Access Hash (Insted of password for cPanel servers)"
+msgstr ""
+
+msgid "Use Secure connection"
+msgstr ""
+
+msgid "Add server"
+msgstr ""
+
+msgid "Adding new hosting plan"
+msgstr ""
+
+msgid ""
+"Depending on server manager used to setup hosting account you may require "
+"provide additional parameters in next step. In this step provide basic "
+"hosting plan information."
+msgstr ""
+
+msgid "Unique name to identify this hosting plan"
+msgstr ""
+
+msgid "Disk quota (MB)"
+msgstr ""
+
+msgid "Bandwidth (MB)"
+msgstr ""
+
+msgid "Create hosting plan"
+msgstr ""
+
+msgid "File"
+msgstr ""
+
+msgid "Currently uploaded file"
+msgstr ""
+
+msgid "Upload new file"
+msgstr ""
+
+msgid "Upload"
+msgstr ""
+
+msgid "Client area languages"
+msgstr ""
+
+msgid "New language"
+msgstr ""
+
+msgid "Language"
+msgstr ""
+
+msgid "BoxBilling in your language"
+msgstr ""
+
+msgid ""
+"Although BoxBilling displays in U.S. English by default, the software has "
+"the built-in capability to be used in any language. Follow instructions "
+"bellow to install new language."
+msgstr ""
+
+msgid "Check if your language translation file is available at"
+msgstr ""
+
+msgid "BoxBilling extensions site"
+msgstr ""
+
+msgid "Download language files and place them to"
+msgstr ""
+
+msgid ""
+"Language will be automatically available and can be changed in client area"
+msgstr ""
+
+msgid "Read"
+msgstr ""
+
+msgid "Installing BoxBilling in Your Language"
+msgstr ""
+
+msgid ""
+"to learn how to install files that will transform BoxBilling so it displays "
+"in your language."
+msgstr ""
+
+msgid "Translations can be made with"
+msgstr ""
+
+msgid "software"
+msgstr ""
+
+msgid "Changing default language"
+msgstr ""
+
+msgid "Default language can be set in"
+msgstr ""
+
+msgid "Removing language"
+msgstr ""
+
+msgid ""
+"Removing languages from BoxBilling is really simple. Just delete language "
+"folder you wish from"
+msgstr ""
+
+msgid "SEO settings"
+msgstr ""
+
+msgid "Configuration updated"
+msgstr ""
+
+msgid "Ping sitemap to Google"
+msgstr ""
+
+msgid "Ping sitemap to Yahoo"
+msgstr ""
+
+msgid "Ping sitemap to Bing"
+msgstr ""
+
+msgid "Domain type"
+msgstr ""
+
+msgid "Host subdomain"
+msgstr ""
+
+msgid "subdomain"
+msgstr ""
+
+msgid "Host domain"
+msgstr ""
+
+msgid "domain.com"
+msgstr ""
+
+msgid "Information"
+msgstr ""
+
+msgid "Mass Mail Messages"
+msgstr ""
+
+msgid "Create new mass mail message"
+msgstr ""
+
+msgid "Mass Mail Settings"
+msgstr ""
+
+msgid "Client ID to send test email while creating message"
+msgstr ""
+
+msgid "Staff Group management"
+msgstr ""
+
+msgid "Staff"
+msgstr ""
+
+msgid "Groups"
+msgstr ""
+
+msgid "Manage staff member details"
+msgstr ""
+
+msgid "Staff group updated"
+msgstr ""
+
+msgid "License details"
+msgstr ""
+
+msgid "Key"
+msgstr ""
+
+msgid "Plugin"
+msgstr ""
+
+msgid "Last ping"
+msgstr ""
+
+msgid "Validate IP"
+msgstr ""
+
+msgid "Valid IPs (one per line)"
+msgstr ""
+
+msgid "Validate host"
+msgstr ""
+
+msgid "Valid hosts (one per line)"
+msgstr ""
+
+msgid "Validate path"
+msgstr ""
+
+msgid "Valid paths (one per line)"
+msgstr ""
+
+msgid "Validate version"
+msgstr ""
+
+msgid "Valid versions (one per line)"
+msgstr ""
+
+msgid "Quantity"
+msgstr ""
+
+msgid "Client settings"
+msgstr ""
+
+msgid "General"
+msgstr ""
+
+msgid "Allow new signups"
+msgstr ""
+
+msgid "Require email confirmation"
+msgstr ""
+
+msgid "Allow email change"
+msgstr ""
+
+msgid "Required fields"
+msgstr ""
+
+msgid "Select required fields"
+msgstr ""
+
+msgid "Last Name"
+msgstr ""
+
+msgid "Company"
+msgstr ""
+
+msgid "Gender"
+msgstr ""
+
+msgid "Birthday"
+msgstr ""
+
+msgid "City"
+msgstr ""
+
+msgid "State"
+msgstr ""
+
+msgid "Address Line 1"
+msgstr ""
+
+msgid "Address Line 2"
+msgstr ""
+
+msgid "Post code"
+msgstr ""
+
+msgid "Phone"
+msgstr ""
+
+msgid "Themes"
+msgstr ""
+
+msgid "Settings for"
+msgstr ""
+
+msgid "IMPORTANT"
+msgstr ""
+
+msgid "INFORMATION"
+msgstr ""
+
+msgid ""
+"Switch to a predefined set of theme settings from the dropdown. Adjust each "
+"section and apply the changes once you're done."
+msgstr ""
+
+msgid "delete this preset"
+msgstr ""
+
+msgid "Save current settings as a new preset called"
+msgstr ""
+
+msgid "Apply changes"
+msgstr ""
+
+msgid "Payment gateways"
+msgstr ""
+
+msgid "New payment gateway"
+msgstr ""
+
+msgid "Allow one time payments"
+msgstr ""
+
+msgid "Allow subscriptions"
+msgstr ""
+
+msgid "Adding new payment gateway"
+msgstr ""
+
+msgid ""
+"Although BoxBilling ships with most popular payment gateways, you can "
+"install other gateways."
+msgstr ""
+
+msgid "Follow these instructions to install new payment gateway."
+msgstr ""
+
+msgid "Check for payment gateway at"
+msgstr ""
+
+msgid "for more payment gateways"
+msgstr ""
+
+msgid "Download payment gateway extension file and place it to"
+msgstr ""
+
+msgid "After file is uploaded in place, reload this page."
+msgstr ""
+
+msgid "Select uploaded file name and click on install."
+msgstr ""
+
+msgid ""
+"Payment gateway will be installed in BoxBilling and can be configured in "
+"\"Payment gateways\" tab."
+msgstr ""
+
+msgid "For developers. Read"
+msgstr ""
+
+msgid ""
+"to learn how to create your own payment gateway and share it with community"
+msgstr ""
+
+msgid "Install"
+msgstr ""
+
+msgid "All payment gateways installed"
+msgstr ""
+
+msgid "Login"
+msgstr ""
+
+msgid "Create main administrator account"
+msgstr ""
+
+msgid "Email"
+msgstr ""
+
+msgid "Enter your email address"
+msgstr ""
+
+msgid "Enter your password"
+msgstr ""
+
+msgid "Create administrator account"
+msgstr ""
+
+msgid "Remember me"
+msgstr ""
+
+msgid "Log me in"
+msgstr ""
+
+msgid "License"
+msgstr ""
+
+msgid "Module settings"
+msgstr ""
+
+msgid ""
+"After purchase you have received an e-mail with license key. Update license "
+"key to unlock all features of BoxBilling"
+msgstr ""
+
+msgid ""
+"To change license key, change BB_LICENSE value in bb-config."
+"php file"
+msgstr ""
+
+msgid "Edit bb-config.php file"
+msgstr ""
+
+msgid "Licensed to"
+msgstr ""
+
+msgid "Expires at"
+msgstr ""
+
+msgid "Domain"
+msgstr ""
+
+msgid "Server Name"
+msgstr ""
+
+msgid "Server IP"
+msgstr ""
+
+msgid "Account IP"
+msgstr ""
+
+msgid "per month"
+msgstr ""
+
+msgid "Disk quota"
+msgstr ""
+
+msgid "Jump to cPanel"
+msgstr ""
+
+msgid "Reseller control panel"
+msgstr ""
+
+msgid "Change hosting plan"
+msgstr ""
+
+msgid "Hosting plan changed"
+msgstr ""
+
+msgid "Change"
+msgstr ""
+
+msgid "Change account password"
+msgstr ""
+
+msgid "Account password changed"
+msgstr ""
+
+msgid "Password Confirm"
+msgstr ""
+
+msgid "Change IP"
+msgstr ""
+
+msgid "Account IP changed"
+msgstr ""
+
+msgid "Change username"
+msgstr ""
+
+msgid "Account username changed"
+msgstr ""
+
+msgid "Change domain"
+msgstr ""
+
+msgid "Account domain changed"
+msgstr ""
+
+msgid "Template"
+msgstr ""
+
+msgid "Variables"
+msgstr ""
+
+msgid "Template Settings"
+msgstr ""
+
+msgid "Reset template"
+msgstr ""
+
+msgid "Examples"
+msgstr ""
+
+msgid "Manage email template"
+msgstr ""
+
+msgid ""
+"Most email templates receives parameters from BoxBilling. You can browse "
+"them on \"Variables\" tab. Copy variable name to email template and hit "
+"preview to see parsed content. Please note that values will be different "
+"when actual email is sent."
+msgstr ""
+
+msgid "Template updated"
+msgstr ""
+
+msgid "Preview"
+msgstr ""
+
+msgid "Preview mode is disabled until first event occurrence"
+msgstr ""
+
+msgid "Template settings"
+msgstr ""
+
+msgid "Enable or disable this email template."
+msgstr ""
+
+msgid "Category"
+msgstr ""
+
+msgid "List of variables used in this email"
+msgstr ""
+
+msgid ""
+"These values will change when real email is sent. You can pass these "
+"variables to admin or guest API to get additional information from database."
+msgstr ""
+
+msgid "Variable"
+msgstr ""
+
+msgid "Example value"
+msgstr ""
+
+msgid "This template does not receive any parameters"
+msgstr ""
+
+msgid "Reset email template to default"
+msgstr ""
+
+msgid "Reset to default"
+msgstr ""
+
+msgid "Email templates examples"
+msgstr ""
+
+msgid ""
+"Email template playground. Use this tool to try rendering email templates."
+msgstr ""
+
+msgid "Invoice settings"
+msgstr ""
+
+msgid "Number of days to generate new invoice before order expiration"
+msgstr ""
+
+msgid "Invoice due days"
+msgstr ""
+
+msgid "Auto invoice approval"
+msgstr ""
+
+msgid "Proforma Invoicing / Sequential Invoice Numbering"
+msgstr ""
+
+msgid "Proforma invoice prefix/series"
+msgstr ""
+
+msgid "Paid invoice prefix/series"
+msgstr ""
+
+msgid "Next paid invoice number"
+msgstr ""
+
+msgid "Refunds settings"
+msgstr ""
+
+msgid "Refunds logic"
+msgstr ""
+
+msgid "Add funds settings"
+msgstr ""
+
+msgid "Minimum amount for add funds invoice"
+msgstr ""
+
+msgid "Unlimited"
+msgstr ""
+
+msgid "Maximum amount for add funds invoice"
+msgstr ""
+
+msgid "Update settings"
+msgstr ""
+
+msgid "New staff member"
+msgstr ""
+
+msgid "Manage groups"
+msgstr ""
+
+msgid "New group"
+msgstr ""
+
+msgid "Group"
+msgstr ""
+
+msgid "Check login IP"
+msgstr ""
+
+msgid "Allowed IPs. One per line"
+msgstr ""
+
+msgid "Signature"
+msgstr ""
+
+msgid "Inactive"
+msgstr ""
+
+msgid "Create group"
+msgstr ""
+
+msgid "Domain action"
+msgstr ""
+
+msgid "Register domain"
+msgstr ""
+
+msgid "Domain name to register"
+msgstr ""
+
+msgid "Years"
+msgstr ""
+
+msgid "Transfer domain"
+msgstr ""
+
+msgid "Domain name to transfer"
+msgstr ""
+
+msgid "Domain transfer code"
+msgstr ""
+
+msgid "Centova Cast product settings"
+msgstr ""
+
+msgid "Max clients"
+msgstr ""
+
+msgid "Max bitrate"
+msgstr ""
+
+msgid "Transfer limit"
+msgstr ""
+
+msgid "Autostart"
+msgstr ""
+
+msgid "SolusVM configuration"
+msgstr ""
+
+msgid "Virtualization type"
+msgstr ""
+
+msgid "Node"
+msgstr ""
+
+msgid ""
+"Make sure BoxBilling can connect to SolusVM master server and check if nodes "
+"are configured for selected virtualizator type. Refresh page if you have "
+"changed virtualization type to see new nodes."
+msgstr ""
+
+msgid "Plan"
+msgstr ""
+
+msgid ""
+"Make sure BoxBilling can connect to SolusVM master server and check if plans "
+"are configured for selected virtualizator type."
+msgstr ""
+
+msgid "Plan parameters"
+msgstr ""
+
+msgid "IPs amount"
+msgstr ""
+
+msgid "Guaranteed RAM"
+msgstr ""
+
+msgid "Hdd Space"
+msgstr ""
+
+msgid "CPU cores"
+msgstr ""
+
+msgid "Custom extraip"
+msgstr ""
+
+msgid "HVMT"
+msgstr ""
+
+msgid "Issue cPanel License"
+msgstr ""
+
+msgid "Dedicated CPU"
+msgstr ""
+
+msgid "Dedicated RAM"
+msgstr ""
+
+msgid "Network transfer"
+msgstr ""
+
+msgid "Description"
+msgstr ""
+
+msgid "Invoices"
+msgstr ""
+
+msgid "Filter invoices"
+msgstr ""
+
+msgid "Nr"
+msgstr ""
+
+msgid "Currency"
+msgstr ""
+
+msgid "All statuses"
+msgstr ""
+
+msgid "Paid"
+msgstr ""
+
+msgid "Unpaid"
+msgstr ""
+
+msgid "Refunded"
+msgstr ""
+
+msgid "Issue date"
+msgstr ""
+
+msgid "Filter"
+msgstr ""
+
+msgid "Unpaid invoices"
+msgstr ""
+
+msgid "Refunded invoices"
+msgstr ""
+
+msgid "Paid invoices"
+msgstr ""
+
+msgid "Total"
+msgstr ""
+
+msgid "New Invoice"
+msgstr ""
+
+msgid "Invoice"
+msgstr ""
+
+msgid "Amount"
+msgstr ""
+
+msgid "Issued at"
+msgstr ""
+
+msgid "Paid at"
+msgstr ""
+
+msgid "Client"
+msgstr ""
+
+msgid "Start typing clients name, email or ID"
+msgstr ""
+
+msgid "Prepare"
+msgstr ""
+
+msgid "Centova Cast order details"
+msgstr ""
+
+msgid "Changing settings does not send actions to CentovaCast server."
+msgstr ""
+
+msgid "Reconfigure"
+msgstr ""
+
+msgid "Changing CentovaCast server settings."
+msgstr ""
+
+msgid "IP Address"
+msgstr ""
+
+msgid "Port"
+msgstr ""
+
+msgid "Source password"
+msgstr ""
+
+msgid "Max BitRate"
+msgstr ""
+
+msgid "Organization"
+msgstr ""
+
+msgid "URL"
+msgstr ""
+
+msgid "Auto rebuild list"
+msgstr ""
+
+msgid "Account details"
+msgstr ""
+
+msgid "Parameter"
+msgstr ""
+
+msgid "Value"
+msgstr ""
+
+msgid "Payment type"
+msgstr ""
+
+msgid "Setup price"
+msgstr ""
+
+msgid "Price"
+msgstr ""
+
+msgid "One time"
+msgstr ""
+
+msgid "Price for period"
+msgstr ""
+
+msgid "First payment sum"
+msgstr ""
+
+msgid "On"
+msgstr ""
+
+msgid "Weekly"
+msgstr ""
+
+msgid "Monthly"
+msgstr ""
+
+msgid "Every 3 months"
+msgstr ""
+
+msgid "Every 6 months"
+msgstr ""
+
+msgid "Every year"
+msgstr ""
+
+msgid "Every 2 years"
+msgstr ""
+
+msgid "Every 3 years"
+msgstr ""
+
+msgid "Profile"
+msgstr ""
+
+msgid ""
+"This staff member is used by BoxBilling to perform system tasks and can not "
+"be removed."
+msgstr ""
+
+msgid "Permissions"
+msgstr ""
+
+msgid "API"
+msgstr ""
+
+msgid "%member_name% permissions"
+msgstr ""
+
+msgid "Administrator account is allowed to do everything"
+msgstr ""
+
+msgid "Permissions updated"
+msgstr ""
+
+msgid "Module"
+msgstr ""
+
+msgid "Save"
+msgstr ""
+
+msgid "Change staff member password"
+msgstr ""
+
+msgid "Staff member password changed"
+msgstr ""
+
+msgid "Repeat same password"
+msgstr ""
+
+msgid "Submit"
+msgstr ""
+
+msgid "Api key is used to manage system via other interfaces."
+msgstr ""
+
+msgid "API key"
+msgstr ""
+
+msgid "Generate new key"
+msgstr ""
+
+msgid "Number"
+msgstr ""
+
+msgid "Due at"
+msgstr ""
+
+msgid "Reminded at"
+msgstr ""
+
+msgid "Notes"
+msgstr ""
+
+msgid "Approved"
+msgstr ""
+
+msgid "Serie and number"
+msgstr ""
+
+msgid "Tax"
+msgstr ""
+
+msgid "Payment method"
+msgstr ""
+
+msgid "Text before invoice items table"
+msgstr ""
+
+msgid "Text after invoice items table"
+msgstr ""
+
+msgid "Company VAT"
+msgstr ""
+
+msgid "Company Number"
+msgstr ""
+
+msgid "Address"
+msgstr ""
+
+msgid "First name"
+msgstr ""
+
+msgid "Last name"
+msgstr ""
+
+msgid "Zip"
+msgstr ""
+
+msgid "Invoice items"
+msgstr ""
+
+msgid "Transactions"
+msgstr ""
+
+msgid "Type"
+msgstr ""
+
+msgid "Gateway"
+msgstr ""
+
+msgid "Actions"
+msgstr ""
+
+msgid "Print"
+msgstr ""
+
+msgid "Delete"
+msgstr ""
+
+msgid "Support settings"
+msgstr ""
+
+msgid "Help desks"
+msgstr ""
+
+msgid "New help desk"
+msgstr ""
+
+msgid "Auto responder settings"
+msgstr ""
+
+msgid "Enable auto responder"
+msgstr ""
+
+msgid "Auto respond message"
+msgstr ""
+
+msgid ""
+"Delay message - selected canned response message will be added to default "
+"reply message"
+msgstr ""
+
+msgid "Enable delay message"
+msgstr ""
+
+msgid "Delay hours"
+msgstr ""
+
+msgid "Delay reply"
+msgstr ""
+
+msgid "Close tickets after"
+msgstr ""
+
+msgid "Close after"
+msgstr ""
+
+msgid "Can reopen"
+msgstr ""
+
+msgid "Forum settings"
+msgstr ""
+
+msgid "Forum points"
+msgstr ""
+
+msgid "Disabled"
+msgstr ""
+
+msgid "Give points for posting in selected forums"
+msgstr ""
+
+msgid "Domains management"
+msgstr ""
+
+msgid "Support"
+msgstr ""
+
+msgid "Canned responses"
+msgstr ""
+
+msgid "Canned category"
+msgstr ""
+
+msgid "Knowledge Base"
+msgstr ""
+
+msgid "Articles"
+msgstr ""
+
+msgid "New article"
+msgstr ""
+
+msgid "New category"
+msgstr ""
+
+msgid "Manage categories"
+msgstr ""
+
+msgid "Draft"
+msgstr ""
+
+msgid "Content"
+msgstr ""
+
+msgid "Category created"
+msgstr ""
+
+msgid "Top level domains"
+msgstr ""
+
+msgid "New top level domain"
+msgstr ""
+
+msgid "Registrars"
+msgstr ""
+
+msgid "New domain registrar"
+msgstr ""
+
+msgid "Nameservers"
+msgstr ""
+
+msgid "Manage TLDs"
+msgstr ""
+
+msgid ""
+"Setup domain pricing and allowed operations. Assign specific domain "
+"registrars for each Top Level Domain (TLD)"
+msgstr ""
+
+msgid "TLD"
+msgstr ""
+
+msgid "Registration"
+msgstr ""
+
+msgid "Renew"
+msgstr ""
+
+msgid "Transfer"
+msgstr ""
+
+msgid "Operations"
+msgstr ""
+
+msgid "Registrar"
+msgstr ""
+
+msgid "Allow register:"
+msgstr ""
+
+msgid "Allow transfer:"
+msgstr ""
+
+msgid "Active:"
+msgstr ""
+
+msgid "Add new top level domain"
+msgstr ""
+
+msgid "Setup new TLD prices and properties"
+msgstr ""
+
+msgid "Tld"
+msgstr ""
+
+msgid "Registration price"
+msgstr ""
+
+msgid "Renewal price"
+msgstr ""
+
+msgid "Transfer price"
+msgstr ""
+
+msgid "Minimum years of registration"
+msgstr ""
+
+msgid "Allow registration"
+msgstr ""
+
+msgid "Allow transfer"
+msgstr ""
+
+msgid "Domain registrars"
+msgstr ""
+
+msgid "Manage domain registrars"
+msgstr ""
+
+msgid ""
+"Setup default nameservers that will be used for new domain registrations if "
+"client have not provided his own nameservers in order form"
+msgstr ""
+
+msgid "Update nameservers"
+msgstr ""
+
+msgid "Adding new domain registrar"
+msgstr ""
+
+msgid "Follow instrunctions bellow to install new domain registrar."
+msgstr ""
+
+msgid "Check domain registrar you are looking for is available at"
+msgstr ""
+
+msgid "Download domain registrar file and place to"
+msgstr ""
+
+msgid "Reload this page to see newly detected domain registrar"
+msgstr ""
+
+msgid ""
+"Click on install button. Now you will be able to create top level domains "
+"with new domain registrar"
+msgstr ""
+
+msgid "BoxBilling documentation"
+msgstr ""
+
+msgid "to learn how to create your own domain registrar."
+msgstr ""
+
+msgid "News and announcements"
+msgstr ""
+
+msgid "New announcement"
+msgstr ""
+
+msgid "Orders"
+msgstr ""
+
+msgid "Filter orders"
+msgstr ""
+
+msgid "Product"
+msgstr ""
+
+msgid "Period"
+msgstr ""
+
+msgid "Invoice option"
+msgstr ""
+
+msgid "Creation date"
+msgstr ""
+
+msgid "Pending setup"
+msgstr ""
+
+msgid "Supended"
+msgstr ""
+
+msgid "New order"
+msgstr ""
+
+msgid "Continue"
+msgstr ""
+
+msgid "Hi,"
+msgstr ""
+
+msgid "Loading ..."
+msgstr ""
+
+msgid "New"
+msgstr ""
+
+msgid "All settings"
+msgstr ""
+
+msgid "Theme settings"
+msgstr ""
+
+msgid "Help"
+msgstr ""
+
+msgid "Visit site"
+msgstr ""
+
+msgid "Logout"
+msgstr ""
+
+msgid "Notifications"
+msgstr ""
+
+msgid "Inquiries"
+msgstr ""
+
+msgid "Tickets"
+msgstr ""
+
+msgid "Clients"
+msgstr ""
+
+msgid "Dashboard"
+msgstr ""
+
+msgid "Clients logins history"
+msgstr ""
+
+msgid "Search:"
+msgstr ""
+
+msgid "Enter search text.."
+msgstr ""
+
+msgid "Import existing"
+msgstr ""
+
+msgid "Domain name"
+msgstr ""
+
+msgid "Domain TLD"
+msgstr ""
+
+msgid "Create new order"
+msgstr ""
+
+msgid "for"
+msgstr ""
+
+msgid "Activate order"
+msgstr ""
+
+msgid "Place new order"
+msgstr ""
+
+msgid "SolusVM"
+msgstr ""
+
+msgid "API configuration"
+msgstr ""
+
+msgid "Getting started with SolusVM"
+msgstr ""
+
+msgid ""
+"This guide will help you to get started selling SolusVM virtual servers with "
+"BoxBilling."
+msgstr ""
+
+msgid "1. Configure your SolusVm server"
+msgstr ""
+
+msgid "2. Configure API"
+msgstr ""
+
+msgid "3. Create new product category"
+msgstr ""
+
+msgid "4. Create SolusVM products"
+msgstr ""
+
+msgid "5. Import data from SolusVM server"
+msgstr ""
+
+msgid "Connect to SolusVM master server via API"
+msgstr ""
+
+msgid ""
+"To create an API user login to SolusVM admin area and click Configuration > "
+"API Access from the top menu then select Add API User."
+msgstr ""
+
+msgid "Master server IP"
+msgstr ""
+
+msgid "Secure connection"
+msgstr ""
+
+msgid "Custom port"
+msgstr ""
+
+msgid "Leave blank to use default port 5353 and 5656 for secure connection"
+msgstr ""
+
+msgid "Test connection"
+msgstr ""
+
+msgid "Error"
+msgstr ""
+
+msgid "Something went wrong here"
+msgstr ""
+
+msgid "Back to Dashboard"
+msgstr ""
+
+msgid "Membership details"
+msgstr ""
+
+msgid "Filter clients"
+msgstr ""
+
+msgid "Company name"
+msgstr ""
+
+msgid "All"
+msgstr ""
+
+msgid "Suspended"
+msgstr ""
+
+msgid "Canceled"
+msgstr ""
+
+msgid "Registration date"
+msgstr ""
+
+msgid "New client"
+msgstr ""
+
+msgid "Postcode"
+msgstr ""
+
+msgid "Helpdesk -"
+msgstr ""
+
+msgid "Support help desk"
+msgstr ""
+
+msgid ""
+"Help desk name will be visible for clients when submitting new ticket. "
+"Define very large number of hours to disable auto close ticket option"
+msgstr ""
+
+msgid "Product configuration"
+msgstr ""
+
+msgid "General settings"
+msgstr ""
+
+msgid "Configuration"
+msgstr ""
+
+msgid "Addons"
+msgstr ""
+
+msgid "Upgrades"
+msgstr ""
+
+msgid "Links"
+msgstr ""
+
+msgid "Hidden"
+msgstr ""
+
+msgid "Activation"
+msgstr ""
+
+msgid "Icon/Image URL"
+msgstr ""
+
+msgid "Product / service description"
+msgstr ""
+
+msgid "Choose which addons you would like to offer with"
+msgstr ""
+
+msgid "Choose which products can client upgrade to"
+msgstr ""
+
+msgid "Product Upgrades"
+msgstr ""
+
+msgid "No additional configuration for this product is required"
+msgstr ""
+
+msgid "Product links"
+msgstr ""
+
+msgid "Product ID"
+msgstr ""
+
+msgid "Order page with ID"
+msgstr ""
+
+msgid "Order page with slug"
+msgstr ""
+
+msgid "Order management"
+msgstr ""
+
+msgid "Edit order"
+msgstr ""
+
+msgid "Service management"
+msgstr ""
+
+msgid "History"
+msgstr ""
+
+msgid "Order"
+msgstr ""
+
+msgid "Payment amount"
+msgstr ""
+
+msgid "Order status"
+msgstr ""
+
+msgid "Order created"
+msgstr ""
+
+msgid "Activated"
+msgstr ""
+
+msgid "Renewal date"
+msgstr ""
+
+msgid "Order notes"
+msgstr ""
+
+msgid "Order group ID"
+msgstr ""
+
+msgid "Order promo code"
+msgstr ""
+
+msgid "Active support tickets"
+msgstr ""
+
+msgid "Reason of suspendation"
+msgstr ""
+
+msgid "Suspendation reason"
+msgstr ""
+
+msgid "Reason of cancelation"
+msgstr ""
+
+msgid "Cancelation reason"
+msgstr ""
+
+msgid "Changes status without performing action"
+msgstr ""
+
+msgid "Activated at"
+msgstr ""
+
+msgid "Addons you have ordered with this service"
+msgstr ""
+
+msgid "Product/Service"
+msgstr ""
+
+msgid "Billing Cycle"
+msgstr ""
+
+msgid "Next due date"
+msgstr ""
+
+msgid "Order invoices"
+msgstr ""
+
+msgid "Order status change history"
+msgstr ""
+
+msgid "Note"
+msgstr ""
+
+msgid "Support tickets regarding this order"
+msgstr ""
+
+msgid "Help desk"
+msgstr ""
+
+msgid "News"
+msgstr ""
+
+msgid "Post updated"
+msgstr ""
+
+msgid "Image"
+msgstr ""
+
+msgid "http://www.yourdomain.com/image.jpg"
+msgstr ""
+
+msgid "Post created"
+msgstr ""
+
+msgid "Last update"
+msgstr ""
+
+msgid "Go back"
+msgstr ""
+
+msgid "System settings"
+msgstr ""
+
+msgid "Company details"
+msgstr ""
+
+msgid "FTP layer"
+msgstr ""
+
+msgid "Countries"
+msgstr ""
+
+msgid "Cache"
+msgstr ""
+
+msgid "Logo URL"
+msgstr ""
+
+msgid "Company number, chamber of commerce number"
+msgstr ""
+
+msgid "VAT number"
+msgstr ""
+
+msgid "Bank Account number"
+msgstr ""
+
+msgid "Company terms of service, legal regulation"
+msgstr ""
+
+msgid "Company privacy policy"
+msgstr ""
+
+msgid "Countries updated"
+msgstr ""
+
+msgid "List of countries"
+msgstr ""
+
+msgid "Cache folder cleared"
+msgstr ""
+
+msgid "Invalidate cache"
+msgstr ""
+
+msgid "FTP layer for BoxBilling"
+msgstr ""
+
+msgid "FTP is used to manage BoxBilling modules and updates."
+msgstr ""
+
+msgid "FTP settings updated"
+msgstr ""
+
+msgid ""
+"FTP Hostname - can be a numerical URL 127.0.0.1 is the "
+"default address for a locally hosted server, it might be this, it might be "
+"the full URL as my example above with the File Transfer Protocol (FTP) "
+"prefix, it might be the http:// protocol it might be SFTP (secure FTP) even "
+"secure http (https). Your host will be able to advise you on the correct "
+"format."
+msgstr ""
+
+msgid ""
+"FTP port - is nearly always 21 unless the host has changed "
+"this they will have notified you of this. Secure FTP generally uses port 22."
+msgstr ""
+
+msgid ""
+"FTP user - In most cases, this is the specific user name "
+"your host has set up for you to access your Web site via FTP- It is the name "
+"you use in your FTP client. This could be an alphanumeric, it could be your "
+"name, even your e-mail address, If you don't know this speak to your host. "
+"You may have the facility on your Web account to set up additional FTP users "
+"if that is the case (and it's more secure) you are recommended to do this"
+msgstr ""
+
+msgid ""
+"FTP password - this is the password you enter in your FTP "
+"client."
+msgstr ""
+
+msgid ""
+"FTP root - This is generally the directory in which "
+"BoxBilling is installed. This setting is very important to be setup "
+"correctly as it very specifically depends on the Host server settings. In "
+"can be just / BUT it might be htdocs/boxbilling, public_html/, /public_html/"
+"boxbilling or other. It is a variable that BoxBilling has absolutely no "
+"control over. You will need to clarify this with your host."
+msgstr ""
+
+msgid "New Addon"
+msgstr ""
+
+msgid "After order is placed"
+msgstr ""
+
+msgid "After payment is received"
+msgstr ""
+
+msgid "Manual activation"
+msgstr ""
+
+msgid "Email templates"
+msgstr ""
+
+msgid "New template"
+msgstr ""
+
+msgid "Email settings"
+msgstr ""
+
+msgid "Extension"
+msgstr ""
+
+msgid ""
+"The list is empty. Depending on modules enabled email templates will be "
+"inserted after first event occurrence."
+msgstr ""
+
+msgid "Configure email options"
+msgstr ""
+
+msgid ""
+"BoxBilling sends emails using sendmail by default or you can "
+"configure your own SMTP server"
+msgstr ""
+
+msgid "Email transport"
+msgstr ""
+
+msgid "SendMail"
+msgstr ""
+
+msgid "SMTP"
+msgstr ""
+
+msgid "SMTP Hostname"
+msgstr ""
+
+msgid "SMTP Port"
+msgstr ""
+
+msgid "SMTP Username"
+msgstr ""
+
+msgid "SMTP Password"
+msgstr ""
+
+msgid "SMTP Security"
+msgstr ""
+
+msgid "Update email settings"
+msgstr ""
+
+msgid "Send test email to staff members"
+msgstr ""
+
+msgid "Where I can use new email template?"
+msgstr ""
+
+msgid "Newly created email templates can be used in custom event hooks."
+msgstr ""
+
+msgid "Action code"
+msgstr ""
+
+msgid "Subscription"
+msgstr ""
+
+msgid "Subscription details"
+msgstr ""
+
+msgid "Payment gateway"
+msgstr ""
+
+msgid "Subscription ID on payment gateway"
+msgstr ""
+
+msgid "Payment Gateway"
+msgstr ""
+
+msgid "Custom forms"
+msgstr ""
+
+msgid "Import form"
+msgstr ""
+
+msgid "Create new form"
+msgstr ""
+
+msgid "Import"
+msgstr ""
+
+msgid "Text"
+msgstr ""
+
+msgid "Dropdown"
+msgstr ""
+
+msgid "Radio"
+msgstr ""
+
+msgid "Yes/No"
+msgstr ""
+
+msgid "Textarea"
+msgstr ""
+
+msgid "Optional"
+msgstr ""
+
+msgid "Required"
+msgstr ""
+
+msgid "Done editing"
+msgstr ""
+
+msgid "Access Hash (Instead of password for cPanel servers)"
+msgstr ""
+
+msgid "Connection port"
+msgstr ""
+
+msgid "Update and test connection"
+msgstr ""
+
+msgid "Update server"
+msgstr ""
+
+msgid "File information"
+msgstr ""
+
+msgid "Filename"
+msgstr ""
+
+msgid "Location"
+msgstr ""
+
+msgid "Downloads"
+msgstr ""
+
+msgid "Upload new file for this order"
+msgstr ""
+
+msgid ""
+"Use this function to update existing order file. Client will be able to "
+"download new file from client area"
+msgstr ""
+
+msgid "Forum details"
+msgstr ""
+
+msgid "Locked"
+msgstr ""
+
+msgid "New note"
+msgstr ""
+
+msgid "Delete all messages"
+msgstr ""
+
+msgid "Add note or todo task"
+msgstr ""
+
+msgid "Add note"
+msgstr ""
+
+msgid "Support tickets"
+msgstr ""
+
+msgid "Filter support tickets"
+msgstr ""
+
+msgid "Client ID"
+msgstr ""
+
+msgid "Order ID"
+msgstr ""
+
+msgid "Ticket subject"
+msgstr ""
+
+msgid "Ticket messages"
+msgstr ""
+
+msgid "Priority"
+msgstr ""
+
+msgid "Tickets waiting for staff reply"
+msgstr ""
+
+msgid "Tickets waiting for client reply"
+msgstr ""
+
+msgid "Solved tickets"
+msgstr ""
+
+msgid "New ticket"
+msgstr ""
+
+msgid "New email"
+msgstr ""
+
+msgid "Helpdesk"
+msgstr ""
+
+msgid "ago"
+msgstr ""
+
+msgid "Open ticket for existing client"
+msgstr ""
+
+msgid "Open public ticket for non client"
+msgstr ""
+
+msgid "Receivers name"
+msgstr ""
+
+msgid "John Smith"
+msgstr ""
+
+msgid "to@gmail.com"
+msgstr ""
+
+msgid "Email subject"
+msgstr ""
+
+msgid "Posts"
+msgstr ""
+
+msgid "Topics"
+msgstr ""
+
+msgid "Forums"
+msgstr ""
+
+msgid "New topic"
+msgstr ""
+
+msgid "New forum"
+msgstr ""
+
+msgid "Replies"
+msgstr ""
+
+msgid "Sorting"
+msgstr ""
+
+msgid "Support ticket"
+msgstr ""
+
+msgid "Staff member"
+msgstr ""
+
+msgid "Announcement"
+msgstr ""
+
+msgid "Forum topic"
+msgstr ""
+
+msgid "Example module settings"
+msgstr ""
+
+msgid "Example extension settings"
+msgstr ""
+
+msgid ""
+"Every extension can have settings page. Only requirement is to have "
+"mod_example_settings.phtml page in html_admin folder"
+msgstr ""
+
+msgid "Parameter title"
+msgstr ""
+
+msgid "Example custom value"
+msgstr ""
+
+msgid "Recent posts"
+msgstr ""
+
+msgid "Enable forum points feature in extension configuration page"
+msgstr ""
+
+msgid "Main website"
+msgstr ""
+
+msgid "Send Email Message"
+msgstr ""
+
+msgid "From name"
+msgstr ""
+
+msgid "From email"
+msgstr ""
+
+msgid "Recipients filter. Select none to send message to all clients"
+msgstr ""
+
+msgid "Client status and group"
+msgstr ""
+
+msgid "Has order"
+msgstr ""
+
+msgid "Message content"
+msgstr ""
+
+msgid "Update and preview"
+msgstr ""
+
+msgid "Send test message"
+msgstr ""
+
+msgid "Send message to clients"
+msgstr ""
+
+msgid "Back to list"
+msgstr ""
+
+msgid "BoxBilling license"
+msgstr ""
+
+msgid "1. Configure API"
+msgstr ""
+
+msgid "Update API key"
+msgstr ""
+
+msgid "2. Become partner"
+msgstr ""
+
+msgid "3. Create license product"
+msgstr ""
+
+msgid "License settings"
+msgstr ""
+
+msgid "Prefix"
+msgstr ""
+
+msgid "Length"
+msgstr ""
+
+msgid "Validate Hostname"
+msgstr ""
+
+msgid "Validate Version"
+msgstr ""
+
+msgid "Validate Path"
+msgstr ""
+
+msgid "License plugins"
+msgstr ""
+
+msgid ""
+"BoxBilling gives you ability to provide your own license generation script. "
+"Follow instructions bellow to install new license plugin"
+msgstr ""
+
+msgid "License plugin is PHP class \"License_PluginName\" with one method"
+msgstr ""
+
+msgid "Take a look at default plugin at"
+msgstr ""
+
+msgid "Create your plugin and place it to"
+msgstr ""
+
+msgid "BoxBilling will automatically detect new plugin"
+msgstr ""
+
+msgid "for more information."
+msgstr ""
+
+msgid "Orders settings"
+msgstr ""
+
+msgid "Expiration date"
+msgstr ""
+
+msgid "Edit"
+msgstr ""
+
+msgid "Payments"
+msgstr ""
+
+msgid "Logins"
+msgstr ""
+
+msgid "Emails"
+msgstr ""
+
+msgid "Client profile details"
+msgstr ""
+
+msgid "Client Profile updated"
+msgstr ""
+
+msgid "Individual"
+msgstr ""
+
+msgid "Other/Unknown"
+msgstr ""
+
+msgid "Address and contact details"
+msgstr ""
+
+msgid "Additional settings"
+msgstr ""
+
+msgid "Alternative ID"
+msgstr ""
+
+msgid "Used to identify client on foreign system. Usually used by importers"
+msgstr ""
+
+msgid "Exempt from tax"
+msgstr ""
+
+msgid "Signed up time"
+msgstr ""
+
+msgid "Update profile"
+msgstr ""
+
+msgid "Change password"
+msgstr ""
+
+msgid "Password changed"
+msgstr ""
+
+msgid "Password confirm"
+msgstr ""
+
+msgid "Custom fields"
+msgstr ""
+
+msgid "Use these fields to define custom client details"
+msgstr ""
+
+msgid "Client Profile custom fields updated"
+msgstr ""
+
+msgid "Custom field"
+msgstr ""
+
+msgid "Client payments history"
+msgstr ""
+
+msgid "Balance"
+msgstr ""
+
+msgid "Add funds for client"
+msgstr ""
+
+msgid "Funds added"
+msgstr ""
+
+msgid "Add funds"
+msgstr ""
+
+msgid "Client orders"
+msgstr ""
+
+msgid "Client invoices"
+msgstr ""
+
+msgid "Client support tickets"
+msgstr ""
+
+msgid "Logins history"
+msgstr ""
+
+msgid "Emails sent to client"
+msgstr ""
+
+msgid "Date sent"
+msgstr ""
+
+msgid "Transactions received"
+msgstr ""
+
+msgid "File manager"
+msgstr ""
+
+msgid "Full screen"
+msgstr ""
+
+msgid "Canned response"
+msgstr ""
+
+msgid "Import SolusVM clients"
+msgstr ""
+
+msgid "Created"
+msgstr ""
+
+msgid "Import selected SolusVM clients to BoxBilling"
+msgstr ""
+
+msgid "No icons available"
+msgstr ""
+
+msgid "Transaction"
+msgstr ""
+
+msgid "IPN"
+msgstr ""
+
+msgid "Transaction details"
+msgstr ""
+
+msgid ""
+"If you are sure that this transaction is valid you can update transaction "
+"details in "Manage" tab and try processing transaction again"
+msgstr ""
+
+msgid "Invoice Id"
+msgstr ""
+
+msgid "Transaction ID on payment gateway"
+msgstr ""
+
+msgid "Transaction status on payment gateway"
+msgstr ""
+
+msgid "Received at"
+msgstr ""
+
+msgid "Process"
+msgstr ""
+
+msgid "Invoice ID"
+msgstr ""
+
+msgid "Transaction processing information"
+msgstr ""
+
+msgid "Validate IPN"
+msgstr ""
+
+msgid "Transaction information on payment gateway"
+msgstr ""
+
+msgid "Transaction type"
+msgstr ""
+
+msgid "Transaction status on Payment Gateway"
+msgstr ""
+
+msgid "Transaction ID on Payment Gateway"
+msgstr ""
+
+msgid "Note about this transaction"
+msgstr ""
+
+msgid "GET"
+msgstr ""
+
+msgid "No GET parameters received"
+msgstr ""
+
+msgid "POST"
+msgstr ""
+
+msgid "No POST parameters received"
+msgstr ""
+
+msgid "SERVER"
+msgstr ""
+
+msgid "No SERVER parameters logged"
+msgstr ""
+
+msgid "Tax rules"
+msgstr ""
+
+msgid "New tax rule"
+msgstr ""
+
+msgid "Tax settings"
+msgstr ""
+
+msgid "EU VAT"
+msgstr ""
+
+msgid "State/Region"
+msgstr ""
+
+msgid "Tax rate"
+msgstr ""
+
+msgid "Applies to any country"
+msgstr ""
+
+msgid "Applies to any state"
+msgstr ""
+
+msgid "Enable tax support"
+msgstr ""
+
+msgid "Automatic VAT Tax Rules Setup"
+msgstr ""
+
+msgid ""
+"If you would like BoxBilling to automatically setup the EU VAT tax rules for "
+"you for all EU Member States then simply enter your VAT Label & local VAT "
+"rate below and click the submit button. This action will delete any existing "
+"tax rules and configure the VAT rates for all EU countries."
+msgstr ""
+
+msgid "VAT Label"
+msgstr ""
+
+msgid "VAT"
+msgstr ""
+
+msgid "VAT rate"
+msgstr ""
+
+msgid "21"
+msgstr ""
+
+msgid "Create EU VAT Rules"
+msgstr ""
+
+msgid "Tax title"
+msgstr ""
+
+msgid "sales Tax"
+msgstr ""
+
+msgid "18"
+msgstr ""
+
+msgid "Leave empty to apply to all states"
+msgstr ""
+
+msgid "Filter transactions"
+msgstr ""
+
+msgid "ID on payment gateway"
+msgstr ""
+
+msgid "Processed"
+msgstr ""
+
+msgid "Statistics"
+msgstr ""
+
+msgid "Metric"
+msgstr ""
+
+msgid "Today"
+msgstr ""
+
+msgid "Yesterday"
+msgstr ""
+
+msgid "This month so far"
+msgstr ""
+
+msgid "Last month"
+msgstr ""
+
+msgid "Income"
+msgstr ""
+
+msgid "Latest orders"
+msgstr ""
+
+msgid "Product sales"
+msgstr ""
+
+msgid "No active orders available"
+msgstr ""
+
+msgid "Define date interval for graphs"
+msgstr ""
+
+msgid "Update graphs"
+msgstr ""
+
+msgid "Recent clients activity"
+msgstr ""
+
+msgid "Recent staff activity"
+msgstr ""
+
+msgid "Public tickets"
+msgstr ""
+
+msgid "Ticket ID"
+msgstr ""
+
+msgid "Author"
+msgstr ""
+
+msgid "Time opened"
+msgstr ""
+
+msgid "Last updated"
+msgstr ""
+
+msgid "Reply as"
+msgstr ""
+
+msgid "Currency management"
+msgstr ""
+
+msgid "Currency settings"
+msgstr ""
+
+msgid "Edit currency information"
+msgstr ""
+
+msgid "Conversion rate"
+msgstr ""
+
+msgid "Format"
+msgstr ""
+
+msgid "Price format"
+msgstr ""
+
+msgid "Domain management"
+msgstr ""
+
+msgid "Registrar configuration"
+msgstr ""
+
+msgid "Enable test mode"
+msgstr ""
+
+msgid "Registrar title"
+msgstr ""
+
+msgid "Payment gateway configuration"
+msgstr ""
+
+msgid "Payment gateway title"
+msgstr ""
+
+msgid ""
+"Select which currencies can accept this payment gateway (Select none to "
+"allow all currencies)"
+msgstr ""
+
+msgid "Allow subscription payments"
+msgstr ""
+
+msgid "IPN Callback URL"
+msgstr ""
+
+msgid "Queues"
+msgstr ""
+
+msgid "Example module"
+msgstr ""
+
+msgid "Example module title"
+msgstr ""
+
+msgid "This is an example extension content"
+msgstr ""
+
+msgid "Parameters from Controller"
+msgstr ""
+
+msgid "Parameters from URL"
+msgstr ""
+
+msgid "API example"
+msgstr ""
+
+msgid "README"
+msgstr ""
+
+msgid "management"
+msgstr ""
+
+msgid "Extensions"
+msgstr ""
+
+msgid "Update BoxBilling"
+msgstr ""
+
+msgid "Learn more about extensions"
+msgstr ""
+
+msgid "Hooks"
+msgstr ""
+
+msgid "Activate or deactivate extensions"
+msgstr ""
+
+msgid "Deactivate"
+msgstr ""
+
+msgid "Hook"
+msgstr ""
+
+msgid "Automatic update"
+msgstr ""
+
+msgid ""
+"Automatic updater is a tool to update BoxBilling to latest version in one "
+"click. Works on these hosting environments where PHP has permissions to "
+"overwrite files uploaded via FTP."
+msgstr ""
+
+msgid "Manual update"
+msgstr ""
+
+msgid ""
+"Manual update is a solution when auto updater can not work on current "
+"installation environment"
+msgstr ""
+
+msgid "Extending BoxBilling"
+msgstr ""
+
+msgid ""
+"BoxBilling gives developers all the capabilities to customize, integrate & "
+"extend the core system into your own website & applications."
+msgstr ""
+
+msgid "Currencies"
+msgstr ""
+
+msgid "Add new currency"
+msgstr ""
+
+msgid "Manage currencies"
+msgstr ""
+
+msgid ""
+"Default currency is the one you manage all your prices in admin area. If "
+"your client in client area chooses other than default currency, prices will "
+"be recalculated according to conversion rate. You can have only one default "
+"currency. You can not add same currency once again. Changing default "
+"currency is not recommended when active orders are available. Nothing is "
+"recalculated on default currency change. Your income is calculated in "
+"default currency. Changing default currency after you have paid invoices "
+"will distort income statistics. Currency rates are taken from Google."
+msgstr ""
+
+msgid "ISO code"
+msgstr ""
+
+msgid "Example price"
+msgstr ""
+
+msgid "Update Rates"
+msgstr ""
+
+msgid "Result"
+msgstr ""
+
+msgid "Client area themes"
+msgstr ""
+
+msgid "Set as default"
+msgstr ""
+
+msgid "Staff members logins history"
+msgstr ""
+
+msgid "Admin"
+msgstr ""
+
+msgid "Membership settings"
+msgstr ""
+
+msgid "Membership service does not have any configuration options"
+msgstr ""
+
+msgid "Import SolusVM servers"
+msgstr ""
+
+msgid "Read before importing servers"
+msgstr ""
+
+msgid "VServer ID"
+msgstr ""
+
+msgid "Import selected SolusVM virtual server to BoxBilling"
+msgstr ""
+
+msgid "Client groups"
+msgstr ""
+
+msgid "Account Id"
+msgstr ""
+
+msgid "message(s)"
+msgstr ""
+
+msgid "Ticket"
+msgstr ""
+
+msgid "Task"
+msgstr ""
+
+msgid "Client tickets"
+msgstr ""
+
+msgid "Task status"
+msgstr ""
+
+msgid "Related to"
+msgstr ""
+
+msgid "Upgrade to"
+msgstr ""
+
+msgid "BoxBilling license management"
+msgstr ""
+
+msgid "License order ID"
+msgstr ""
+
+msgid "License key"
+msgstr ""
+
+msgid "Valid IPs"
+msgstr ""
+
+msgid "Valid hostnames"
+msgstr ""
+
+msgid "Valid versions"
+msgstr ""
+
+msgid "Valid install paths"
+msgstr ""
+
+msgid "Order is not activated or not found"
+msgstr ""
+
+msgid "Node / ID / VMID"
+msgstr ""
+
+msgid "Operating System"
+msgstr ""
+
+msgid "IP address"
+msgstr ""
+
+msgid "Additional IP addresses"
+msgstr ""
+
+msgid "Root password"
+msgstr ""
+
+msgid "Client area username / password"
+msgstr ""
+
+msgid "Console user / password"
+msgstr ""
+
+msgid "Client area"
+msgstr ""
+
+msgid "Admin area"
+msgstr ""
+
+msgid "Change root password"
+msgstr ""
+
+msgid "New password"
+msgstr ""
+
+msgid "Change hostname"
+msgstr ""
+
+msgid "New hostname"
+msgstr ""
+
+msgid "Change plan"
+msgstr ""
+
+msgid "New plan"
+msgstr ""
+
+msgid "Rebuild"
+msgstr ""
+
+msgid "Usage statistics"
+msgstr ""
+
+msgid "Free"
+msgstr ""
+
+msgid "Memory"
+msgstr ""
+
+msgid "Disk usage"
+msgstr ""
+
+msgid "Traffic"
+msgstr ""
+
+msgid "Load"
+msgstr ""
+
+msgid ""
+"Master node is offline, order is not yet activated or API is not configured "
+"properly."
+msgstr ""
+
+msgid "Changing settings does not send actions to SolusVM server."
+msgstr ""
+
+msgid "Main IP address"
+msgstr ""
+
+msgid "Sent"
+msgstr ""
+
+msgid "Resend"
+msgstr ""
+
+msgid "Max Addon domains"
+msgstr ""
+
+msgid "Max FTP accounts"
+msgstr ""
+
+msgid "Max SQL Databases"
+msgstr ""
+
+msgid "Max Email Accounts"
+msgstr ""
+
+msgid "Max Subdomains"
+msgstr ""
+
+msgid "Max Parked Domains"
+msgstr ""
+
+msgid "Server manager specific parameters"
+msgstr ""
+
+msgid "Update hosting plan"
+msgstr ""
+
+msgid "Hosting plan additional parameters"
+msgstr ""
+
+msgid ""
+"Depending on server manager used to setup hosting account you may require "
+"provide additional parameters. List of parameters server managers requires "
+"you can find on extensions page."
+msgstr ""
+
+msgid "Add new configuration field"
+msgstr ""
+
+msgid "Centova Cast"
+msgstr ""
+
+msgid "Centova Cast settings"
+msgstr ""
+
+msgid "Server URL"
+msgstr ""
+
+msgid "Server Hostname"
+msgstr ""
+
+msgid "Register new server"
+msgstr ""
+
+msgid "Edit server"
+msgstr ""
+
+msgid "CentovaCast URL"
+msgstr ""
+
+msgid "Administrator password"
+msgstr ""
+
+msgid "Register Centova Cast server"
+msgstr ""
+
+msgid "Server added"
+msgstr ""
+
+msgid "Back to settings"
+msgstr ""
+
+msgid "Create CentovaCast product"
+msgstr ""
+
+msgid "Staff members"
+msgstr ""
+
+msgid "New response"
+msgstr ""
+
+msgid "Subscriptions"
+msgstr ""
+
+msgid "New subscription"
+msgstr ""
+
+msgid "Cron settings"
+msgstr ""
+
+msgid "Use Web-Cron"
+msgstr ""
+
+msgid "Setup scheduled tasks to be executed once a day"
+msgstr ""
+
+msgid ""
+"Scheduled tasks must be enabled immediately after installation. Cron is "
+"responsible for sending your clients reminder about payments, domain renewal "
+"notices and many more."
+msgstr ""
+
+msgid "Timezone"
+msgstr ""
+
+msgid "Time on server"
+msgstr ""
+
+msgid "Last time scheduled tasks were executed"
+msgstr ""
+
+msgid "Scheduled tasks were never executed"
+msgstr ""
+
+msgid "Unix crontab setup:"
+msgstr ""
+
+msgid "Execute scheduled tasks from browser"
+msgstr ""
+
+msgid "Execute now"
+msgstr ""
+
+msgid "Gravatar"
+msgstr ""
+
+msgid "Profile updated"
+msgstr ""
+
+msgid "API Key"
+msgstr ""
+
+msgid ""
+"API key allows integration with external applications. You will need this "
+"key for authentication."
+msgstr ""
+
+msgid ""
+"External application can control every aspect of BoxBilling using this API "
+"key."
+msgstr ""
+
+msgid "Warning! Resetting the key will break existing applications using it."
+msgstr ""
+
+msgid "Change your avatar at"
+msgstr ""
+
+msgid "New product"
+msgstr ""
+
+msgid "Update priority"
+msgstr ""
+
+msgid "Icon URL"
+msgstr ""
+
+msgid "Stock control settings"
+msgstr ""
+
+msgid "Enable stock control"
+msgstr ""
+
+msgid "Allow quantity select on order form"
+msgstr ""
+
+msgid "Quantity in stock"
+msgstr ""
+
+msgid "Plugin name"
+msgstr ""
+
+msgid "Update configuration fields"
+msgstr ""
+
+msgid "YouHosting settings"
+msgstr ""
+
+msgid "Advanced"
+msgstr ""
+
+msgid "Your IP"
+msgstr ""
+
+msgid "WebHook URL"
+msgstr ""
+
+msgid "Api Key"
+msgstr ""
+
+msgid "Check connection"
+msgstr ""
+
+msgid "Import clients"
+msgstr ""
+
+msgid "Import clients, accounts and products"
+msgstr ""
+
+msgid "Allowed IPs for Webhook listener"
+msgstr ""
+
+msgid "YouHosting specifict settings"
+msgstr ""
+
+msgid "Article updated"
+msgstr ""
+
+msgid "Article details"
+msgstr ""
+
+msgid "Edit product addon"
+msgstr ""
+
+msgid "Domain details"
+msgstr ""
+
+msgid "Transfer code"
+msgstr ""
+
+msgid "Privacy protected"
+msgstr ""
+
+msgid "Registration/Renewal years"
+msgstr ""
+
+msgid "Unlock"
+msgstr ""
+
+msgid "Lock"
+msgstr ""
+
+msgid "Disable privacy protection"
+msgstr ""
+
+msgid "Enable privacy protection"
+msgstr ""
+
+msgid "Update domain contact details"
+msgstr ""
+
+msgid "First Name"
+msgstr ""
+
+msgid "Phone Country Code"
+msgstr ""
+
+msgid "Phone number"
+msgstr ""
+
+msgid "SpamChecker settings"
+msgstr ""
+
+msgid "Recaptcha settings"
+msgstr ""
+
+msgid "Enable captcha for client registration and contact us forms"
+msgstr ""
+
+msgid "Sign up for Recaptcha key for your domain at"
+msgstr ""
+
+msgid "Recaptcha Enabled"
+msgstr ""
+
+msgid "ReCaptcha Public key"
+msgstr ""
+
+msgid "ReCaptcha Private key"
+msgstr ""
+
+msgid "Akismet settings"
+msgstr ""
+
+msgid ""
+"Enable forum messages checking on http://www.akismet.com database"
+msgstr ""
+
+msgid "Enable check"
+msgstr ""
+
+msgid "Akismet API key"
+msgstr ""
+
+msgid "StopForumSpam.com settings"
+msgstr ""
+
+msgid ""
+"If enabled, client ip will be checked on http://www.stopforumspam.com database before "
+"registration"
+msgstr ""
+
+msgid "Top level domain management"
+msgstr ""
diff --git a/src/bb-locale/en_US/LC_MESSAGES/admin.mo b/src/bb-locale/en_US/LC_MESSAGES/admin.mo
new file mode 100644
index 000000000..c6473c9f7
Binary files /dev/null and b/src/bb-locale/en_US/LC_MESSAGES/admin.mo differ
diff --git a/src/bb-locale/en_US/LC_MESSAGES/admin.po b/src/bb-locale/en_US/LC_MESSAGES/admin.po
new file mode 100644
index 000000000..f083c4c62
--- /dev/null
+++ b/src/bb-locale/en_US/LC_MESSAGES/admin.po
@@ -0,0 +1,3123 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: BoxBilling\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2012-08-02 09:37+0300\n"
+"Last-Translator: BoxBilling \n"
+"Language-Team: BoxBilling \n"
+"Language: English\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-Language: English\n"
+"X-Poedit-Country: UNITED STATES\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+msgid "General settings"
+msgstr ""
+
+msgid "Configuration"
+msgstr ""
+
+msgid "Addons"
+msgstr ""
+
+msgid "Upgrades"
+msgstr ""
+
+msgid "Links"
+msgstr ""
+
+msgid "Type"
+msgstr ""
+
+msgid "Category"
+msgstr ""
+
+msgid "Custom order form"
+msgstr ""
+
+msgid "Preview"
+msgstr ""
+
+msgid "Status"
+msgstr ""
+
+msgid "Hidden"
+msgstr ""
+
+msgid "Activation"
+msgstr ""
+
+msgid "Icon URL"
+msgstr ""
+
+msgid "Browse"
+msgstr ""
+
+msgid "Title"
+msgstr ""
+
+msgid "Slug"
+msgstr ""
+
+msgid "Update"
+msgstr ""
+
+msgid "Payment options"
+msgstr ""
+
+msgid "Product / service description"
+msgstr ""
+
+msgid "Choose which addons you would like to offer with"
+msgstr ""
+
+msgid "The list is empty"
+msgstr ""
+
+msgid "Choose which products can client upgrade to"
+msgstr ""
+
+msgid "Product Upgrades"
+msgstr ""
+
+msgid "No additional configuration for this product is required"
+msgstr ""
+
+msgid "Product links"
+msgstr ""
+
+msgid "Product ID"
+msgstr ""
+
+msgid "Order page with ID"
+msgstr ""
+
+msgid "Order page with slug"
+msgstr ""
+
+msgid "Select icon and click OK"
+msgstr ""
+
+msgid "Payment type"
+msgstr ""
+
+msgid "Setup price"
+msgstr ""
+
+msgid "Price"
+msgstr ""
+
+msgid "Total"
+msgstr ""
+
+msgid "One time"
+msgstr ""
+
+msgid "Price for period"
+msgstr ""
+
+msgid "First payment sum"
+msgstr ""
+
+msgid "On"
+msgstr ""
+
+msgid "Weekly"
+msgstr ""
+
+msgid "Monthly"
+msgstr ""
+
+msgid "Every 3 months"
+msgstr ""
+
+msgid "Every 6 months"
+msgstr ""
+
+msgid "Every year"
+msgstr ""
+
+msgid "Every 2 years"
+msgstr ""
+
+msgid "Every 3 years"
+msgstr ""
+
+msgid "Centova Cast order details"
+msgstr ""
+
+msgid "Changing settings does not send actions to CentovaCast server."
+msgstr ""
+
+msgid "Server"
+msgstr ""
+
+msgid "Username"
+msgstr ""
+
+msgid "Password"
+msgstr ""
+
+msgid "Reconfigure"
+msgstr ""
+
+msgid "Changing CentovaCast server settings."
+msgstr ""
+
+msgid "Hostname"
+msgstr ""
+
+msgid "IP Address"
+msgstr ""
+
+msgid "Port"
+msgstr ""
+
+msgid "Max clients"
+msgstr ""
+
+msgid "Source password"
+msgstr ""
+
+msgid "Max BitRate"
+msgstr ""
+
+msgid "Transfer limit"
+msgstr ""
+
+msgid "Disk quota"
+msgstr ""
+
+msgid "Organization"
+msgstr ""
+
+msgid "Email"
+msgstr ""
+
+msgid "URL"
+msgstr ""
+
+msgid "Auto rebuild list"
+msgstr ""
+
+msgid "Account details"
+msgstr ""
+
+msgid "Parameter"
+msgstr ""
+
+msgid "Value"
+msgstr ""
+
+msgid "Mass Mail Messages"
+msgstr ""
+
+msgid "Create new mass mail message"
+msgstr ""
+
+msgid "Settings"
+msgstr ""
+
+msgid "Subject"
+msgstr ""
+
+msgid "From"
+msgstr ""
+
+msgid "Create"
+msgstr ""
+
+msgid "Mass Mail Settings"
+msgstr ""
+
+msgid "Configuration updated"
+msgstr ""
+
+msgid "Client ID to send test email while creating message"
+msgstr ""
+
+msgid "Custom forms"
+msgstr ""
+
+msgid "Import form"
+msgstr ""
+
+msgid "Create new form"
+msgstr ""
+
+msgid "Import"
+msgstr ""
+
+msgid "Text"
+msgstr ""
+
+msgid "Dropdown"
+msgstr ""
+
+msgid "Radio"
+msgstr ""
+
+msgid "Yes/No"
+msgstr ""
+
+msgid "Textarea"
+msgstr ""
+
+msgid "Optional"
+msgstr ""
+
+msgid "Required"
+msgstr ""
+
+msgid "Yes"
+msgstr ""
+
+msgid "No"
+msgstr ""
+
+msgid "Save"
+msgstr ""
+
+msgid "Done editing"
+msgstr ""
+
+msgid "Hi,"
+msgstr ""
+
+msgid "Loading ..."
+msgstr ""
+
+msgid "New"
+msgstr ""
+
+msgid "Visit site"
+msgstr ""
+
+msgid "Help"
+msgstr ""
+
+msgid "Logout"
+msgstr ""
+
+msgid "Notifications"
+msgstr ""
+
+msgid "Orders"
+msgstr ""
+
+msgid "Invoices"
+msgstr ""
+
+msgid "Inquiries"
+msgstr ""
+
+msgid "Tickets"
+msgstr ""
+
+msgid "Clients"
+msgstr ""
+
+msgid "Dashboard"
+msgstr ""
+
+msgid "Profile"
+msgstr ""
+
+msgid "Payments"
+msgstr ""
+
+msgid "Logins"
+msgstr ""
+
+msgid "Emails"
+msgstr ""
+
+msgid "Profile details"
+msgstr ""
+
+msgid "Client profile details"
+msgstr ""
+
+msgid "Client Profile updated"
+msgstr ""
+
+msgid "Active"
+msgstr ""
+
+msgid "Suspended"
+msgstr ""
+
+msgid "Canceled"
+msgstr ""
+
+msgid "Individual"
+msgstr ""
+
+msgid "Company"
+msgstr ""
+
+msgid "Other/Unknown"
+msgstr ""
+
+msgid "Group"
+msgstr ""
+
+msgid "Name"
+msgstr ""
+
+msgid "Company details"
+msgstr ""
+
+msgid "Address and contact details"
+msgstr ""
+
+msgid "Address Line 1"
+msgstr ""
+
+msgid "Address Line 2"
+msgstr ""
+
+msgid "Country"
+msgstr ""
+
+msgid "State"
+msgstr ""
+
+msgid "City"
+msgstr ""
+
+msgid "Postcode"
+msgstr ""
+
+msgid "Phone"
+msgstr ""
+
+msgid "Additional settings"
+msgstr ""
+
+msgid "Alternative ID"
+msgstr ""
+
+msgid "Used to identify client on foreign system. Usually used by importers"
+msgstr ""
+
+msgid "Currency"
+msgstr ""
+
+msgid "Exempt from tax"
+msgstr ""
+
+msgid "Signed up time"
+msgstr ""
+
+msgid "Notes"
+msgstr ""
+
+msgid "Update profile"
+msgstr ""
+
+msgid "Change password"
+msgstr ""
+
+msgid "Password changed"
+msgstr ""
+
+msgid "Password confirm"
+msgstr ""
+
+msgid "Custom fields"
+msgstr ""
+
+msgid "Use these fields to define custom client details"
+msgstr ""
+
+msgid "Client Profile custom fields updated"
+msgstr ""
+
+msgid "Custom field"
+msgstr ""
+
+msgid "Client payments history"
+msgstr ""
+
+msgid "Amount"
+msgstr ""
+
+msgid "Description"
+msgstr ""
+
+msgid "Date"
+msgstr ""
+
+msgid "Balance"
+msgstr ""
+
+msgid "Add funds for client"
+msgstr ""
+
+msgid "Funds added"
+msgstr ""
+
+msgid "Add funds"
+msgstr ""
+
+msgid "Client orders"
+msgstr ""
+
+msgid "Client invoices"
+msgstr ""
+
+msgid "Client support tickets"
+msgstr ""
+
+msgid "Logins history"
+msgstr ""
+
+msgid "IP"
+msgstr ""
+
+msgid "Emails sent to client"
+msgstr ""
+
+msgid "Email subject"
+msgstr ""
+
+msgid "To"
+msgstr ""
+
+msgid "Date sent"
+msgstr ""
+
+msgid "Category updated"
+msgstr ""
+
+msgid "Icon"
+msgstr ""
+
+msgid "Domains management"
+msgstr ""
+
+msgid "System settings"
+msgstr ""
+
+msgid "Invoice"
+msgstr ""
+
+msgid "Order"
+msgstr ""
+
+msgid "FTP layer"
+msgstr ""
+
+msgid "Scheduled tasks"
+msgstr ""
+
+msgid "License"
+msgstr ""
+
+msgid "Address"
+msgstr ""
+
+msgid "Logo URL"
+msgstr ""
+
+msgid "Company number, chamber of commerce number"
+msgstr ""
+
+msgid "VAT number"
+msgstr ""
+
+msgid "Bank Account number"
+msgstr ""
+
+msgid "Signature"
+msgstr ""
+
+msgid "Update settings"
+msgstr ""
+
+msgid "Company terms of service, legal regulation"
+msgstr ""
+
+msgid "Company privacy policy"
+msgstr ""
+
+msgid "Orders settings"
+msgstr ""
+
+msgid "Expiration date"
+msgstr ""
+
+msgid "Invoice settings"
+msgstr ""
+
+msgid "Number of days to generate new invoice before order expiration"
+msgstr ""
+
+msgid "Invoice due days"
+msgstr ""
+
+msgid "Auto invoice approval"
+msgstr ""
+
+msgid "Proforma Invoicing / Sequential Invoice Numbering"
+msgstr ""
+
+msgid "Proforma invoice prefix/series"
+msgstr ""
+
+msgid "Paid invoice prefix/series"
+msgstr ""
+
+msgid "Next paid invoice number"
+msgstr ""
+
+msgid "Refunds settings"
+msgstr ""
+
+msgid "Refunds logic"
+msgstr ""
+
+msgid "Add funds settings"
+msgstr ""
+
+msgid "Minimum amount for add funds invoice"
+msgstr ""
+
+msgid "Unlimited"
+msgstr ""
+
+msgid "Maximum amount for add funds invoice"
+msgstr ""
+
+msgid "FTP layer for BoxBilling"
+msgstr ""
+
+msgid "FTP is used to manage BoxBilling modules and updates."
+msgstr ""
+
+msgid "FTP settings updated"
+msgstr ""
+
+msgid "FTP Hostname - can be a numerical URL 127.0.0.1 is the default address for a locally hosted server, it might be this, it might be the full URL as my example above with the File Transfer Protocol (FTP) prefix, it might be the http:// protocol it might be SFTP (secure FTP) even secure http (https). Your host will be able to advise you on the correct format."
+msgstr ""
+
+msgid "FTP port - is nearly always 21 unless the host has changed this they will have notified you of this. Secure FTP generally uses port 22."
+msgstr ""
+
+msgid "FTP user - In most cases, this is the specific user name your host has set up for you to access your Web site via FTP- It is the name you use in your FTP client. This could be an alphanumeric, it could be your name, even your e-mail address, If you don't know this speak to your host. You may have the facility on your Web account to set up additional FTP users if that is the case (and it's more secure) you are recommended to do this"
+msgstr ""
+
+msgid "FTP password - this is the password you enter in your FTP client."
+msgstr ""
+
+msgid "FTP root - This is generally the directory in which BoxBilling is installed. This setting is very important to be setup correctly as it very specifically depends on the Host server settings. In can be just / BUT it might be htdocs/boxbilling, public_html/, /public_html/boxbilling or other. It is a variable that BoxBilling has absolutely no control over. You will need to clarify this with your host."
+msgstr ""
+
+msgid "Setup scheduled tasks to be executed once a day"
+msgstr ""
+
+msgid "Scheduled tasks must be enabled immediately after installation. Cron is responsible for sending your clients reminder about payments, domain renewal notices and many more."
+msgstr ""
+
+msgid "Timezone"
+msgstr ""
+
+msgid "Time on server"
+msgstr ""
+
+msgid "Last time scheduled tasks were executed"
+msgstr ""
+
+msgid "Scheduled tasks were never executed"
+msgstr ""
+
+msgid "Unix crontab setup:"
+msgstr ""
+
+msgid "Execute scheduled tasks from browser"
+msgstr ""
+
+msgid "Execute now"
+msgstr ""
+
+msgid "After purchase you have received an e-mail with license key. Update license key to unlock all features of BoxBilling"
+msgstr ""
+
+msgid "To change license key, change BB_LICENSE value in bb-config.php file"
+msgstr ""
+
+msgid "Licensed to"
+msgstr ""
+
+msgid "Key"
+msgstr ""
+
+msgid "Expires at"
+msgstr ""
+
+msgid "Centova Cast product settings"
+msgstr ""
+
+msgid "Template"
+msgstr ""
+
+msgid "Max bitrate"
+msgstr ""
+
+msgid "Autostart"
+msgstr ""
+
+msgid "News and announcements"
+msgstr ""
+
+msgid "New announcement"
+msgstr ""
+
+msgid "Draft"
+msgstr ""
+
+msgid "Content"
+msgstr ""
+
+msgid "Edit product addon"
+msgstr ""
+
+msgid "Canned category"
+msgstr ""
+
+msgid "Queues"
+msgstr ""
+
+msgid "Extension"
+msgstr ""
+
+msgid "Messages"
+msgstr ""
+
+msgid "Created"
+msgstr ""
+
+msgid "The list is empty."
+msgstr ""
+
+msgid "Domain details"
+msgstr ""
+
+msgid "Domain"
+msgstr ""
+
+msgid "Registrar"
+msgstr ""
+
+msgid "Nameserver 1"
+msgstr ""
+
+msgid "Nameserver 2"
+msgstr ""
+
+msgid "Nameserver 3"
+msgstr ""
+
+msgid "Nameserver 4"
+msgstr ""
+
+msgid "Transfer code"
+msgstr ""
+
+msgid "Privacy protected"
+msgstr ""
+
+msgid "Locked"
+msgstr ""
+
+msgid "Registration/Renewal years"
+msgstr ""
+
+msgid "Registration date"
+msgstr ""
+
+msgid "Unlock"
+msgstr ""
+
+msgid "Lock"
+msgstr ""
+
+msgid "Disable privacy protection"
+msgstr ""
+
+msgid "Enable privacy protection"
+msgstr ""
+
+msgid "Nameservers"
+msgstr ""
+
+msgid "Update domain contact details"
+msgstr ""
+
+msgid "First Name"
+msgstr ""
+
+msgid "Last Name"
+msgstr ""
+
+msgid "Zip"
+msgstr ""
+
+msgid "Phone Country Code"
+msgstr ""
+
+msgid "Phone number"
+msgstr ""
+
+msgid "System activity"
+msgstr ""
+
+msgid "Message"
+msgstr ""
+
+msgid "Ip"
+msgstr ""
+
+msgid "Are you sure?"
+msgstr ""
+
+msgid "Variables"
+msgstr ""
+
+msgid "Template Settings"
+msgstr ""
+
+msgid "Reset template"
+msgstr ""
+
+msgid "Examples"
+msgstr ""
+
+msgid "Manage email template"
+msgstr ""
+
+msgid "Most email templates receives parameters from BoxBilling. You can browse them on \"Variables\" tab. Copy variable name to email template and hit preview to see parsed content. Please note that values will be different when actual email is sent."
+msgstr ""
+
+msgid "Template updated"
+msgstr ""
+
+msgid "Template settings"
+msgstr ""
+
+msgid "Enable or disable this email template."
+msgstr ""
+
+msgid "Enabled"
+msgstr ""
+
+msgid "List of variables used in this email"
+msgstr ""
+
+msgid "These values will change when real email is sent. You can pass these variables to admin or guest API to get additional information from database."
+msgstr ""
+
+msgid "Variable"
+msgstr ""
+
+msgid "Example value"
+msgstr ""
+
+msgid "This template does not receive any parameters"
+msgstr ""
+
+msgid "Reset email template to default"
+msgstr ""
+
+msgid "Reset to default"
+msgstr ""
+
+msgid "Email templates examples"
+msgstr ""
+
+msgid "Email template playground. Use this tool to try rendering email templates."
+msgstr ""
+
+msgid "Details"
+msgstr ""
+
+msgid "Manage"
+msgstr ""
+
+msgid "Forum"
+msgstr ""
+
+msgid "Started by"
+msgstr ""
+
+msgid "Views"
+msgstr ""
+
+msgid "Sticky"
+msgstr ""
+
+msgid "Created at"
+msgstr ""
+
+msgid "Updated at"
+msgstr ""
+
+msgid "Reply"
+msgstr ""
+
+msgid "Quote"
+msgstr ""
+
+msgid "Post"
+msgstr ""
+
+msgid "ID"
+msgstr ""
+
+msgid "Transactions"
+msgstr ""
+
+msgid "Filter transactions"
+msgstr ""
+
+msgid "ID on payment gateway"
+msgstr ""
+
+msgid "Invoice Id"
+msgstr ""
+
+msgid "Payment Gateway"
+msgstr ""
+
+msgid "Received at"
+msgstr ""
+
+msgid "Filter"
+msgstr ""
+
+msgid "Processed"
+msgstr ""
+
+msgid "Approved"
+msgstr ""
+
+msgid "Error"
+msgstr ""
+
+msgid "Gateway"
+msgstr ""
+
+msgid "Filter invoices"
+msgstr ""
+
+msgid "Nr"
+msgstr ""
+
+msgid "All statuses"
+msgstr ""
+
+msgid "Paid"
+msgstr ""
+
+msgid "Unpaid"
+msgstr ""
+
+msgid "Refunded"
+msgstr ""
+
+msgid "Issue date"
+msgstr ""
+
+msgid "Unpaid invoices"
+msgstr ""
+
+msgid "Refunded invoices"
+msgstr ""
+
+msgid "Paid invoices"
+msgstr ""
+
+msgid "New Invoice"
+msgstr ""
+
+msgid "Issued at"
+msgstr ""
+
+msgid "Paid at"
+msgstr ""
+
+msgid "Client"
+msgstr ""
+
+msgid "Start typing clients name, email or ID"
+msgstr ""
+
+msgid "Prepare"
+msgstr ""
+
+msgid "Payment gateway configuration"
+msgstr ""
+
+msgid "Payment gateway title"
+msgstr ""
+
+msgid "Select which currencies can accept this payment gateway (Select none to allow all currencies)"
+msgstr ""
+
+msgid "Allow one time payments"
+msgstr ""
+
+msgid "Allow subscription payments"
+msgstr ""
+
+msgid "Enable test mode"
+msgstr ""
+
+msgid "IPN Callback URL"
+msgstr ""
+
+msgid "Go back"
+msgstr ""
+
+msgid "Tickets waiting for staff reply"
+msgstr ""
+
+msgid "Tickets waiting for client reply"
+msgstr ""
+
+msgid "Solved tickets"
+msgstr ""
+
+msgid "Public tickets"
+msgstr ""
+
+msgid "Import SolusVM servers"
+msgstr ""
+
+msgid "Read before importing servers"
+msgstr ""
+
+msgid "VServer ID"
+msgstr ""
+
+msgid "Client ID"
+msgstr ""
+
+msgid "Import selected SolusVM virtual server to BoxBilling"
+msgstr ""
+
+msgid "Ticket ID"
+msgstr ""
+
+msgid "Author"
+msgstr ""
+
+msgid "Time opened"
+msgstr ""
+
+msgid "Last updated"
+msgstr ""
+
+msgid "SolusVM configuration"
+msgstr ""
+
+msgid "Virtualization type"
+msgstr ""
+
+msgid "Node"
+msgstr ""
+
+msgid "Make sure BoxBilling can connect to SolusVM master server and check if nodes are configured for selected virtualizator type. Refresh page if you have changed virtualization type to see new nodes."
+msgstr ""
+
+msgid "Plan"
+msgstr ""
+
+msgid "Make sure BoxBilling can connect to SolusVM master server and check if plans are configured for selected virtualizator type."
+msgstr ""
+
+msgid "Plan parameters"
+msgstr ""
+
+msgid "IPs amount"
+msgstr ""
+
+msgid "Guaranteed RAM"
+msgstr ""
+
+msgid "Hdd Space"
+msgstr ""
+
+msgid "Bandwidth"
+msgstr ""
+
+msgid "CPU cores"
+msgstr ""
+
+msgid "Custom extraip"
+msgstr ""
+
+msgid "HVMT"
+msgstr ""
+
+msgid "Issue cPanel License"
+msgstr ""
+
+msgid "Dedicated CPU"
+msgstr ""
+
+msgid "Dedicated RAM"
+msgstr ""
+
+msgid "Disk space"
+msgstr ""
+
+msgid "Network transfer"
+msgstr ""
+
+msgid "Info"
+msgstr ""
+
+msgid "BoxBilling version settings"
+msgstr ""
+
+msgid "Version"
+msgstr ""
+
+msgid "Size"
+msgstr ""
+
+msgid "Release date"
+msgstr ""
+
+msgid "Back to extensions"
+msgstr ""
+
+msgid "Download latest"
+msgstr ""
+
+msgid "Download latest update"
+msgstr ""
+
+msgid "Staff members logins history"
+msgstr ""
+
+msgid "Admin"
+msgstr ""
+
+msgid "Currency management"
+msgstr ""
+
+msgid "Currencies"
+msgstr ""
+
+msgid "Add new currency"
+msgstr ""
+
+msgid "Manage currencies"
+msgstr ""
+
+msgid "Default currency is the one you manage all your prices in admin area. If your client in client area chooses other than default currency, prices will be recalculated according to conversion rate. You can have only one default currency. You can not add same currency once again. Changing default currency is not recommended when active orders are available. Nothing is recalculated on default currency change. Your income is calculated in default currency. Changing default currency after you have paid invoices will distort income statistics. Currency rates are taken from Google."
+msgstr ""
+
+msgid "ISO code"
+msgstr ""
+
+msgid "Conversion rate"
+msgstr ""
+
+msgid "Example price"
+msgstr ""
+
+msgid "Update Rates"
+msgstr ""
+
+msgid "Code"
+msgstr ""
+
+msgid "Format"
+msgstr ""
+
+msgid "Add"
+msgstr ""
+
+msgid "Articles"
+msgstr ""
+
+msgid "New article"
+msgstr ""
+
+msgid "New category"
+msgstr ""
+
+msgid "Manage categories"
+msgstr ""
+
+msgid "Category created"
+msgstr ""
+
+msgid "Getting started with SolusVM"
+msgstr ""
+
+msgid "API configuration"
+msgstr ""
+
+msgid "This guide will help you to get started selling SolusVM virtual servers with BoxBilling."
+msgstr ""
+
+msgid "1. Configure your SolusVm server"
+msgstr ""
+
+msgid "2. Configure API"
+msgstr ""
+
+msgid "3. Create new product category"
+msgstr ""
+
+msgid "4. Create SolusVM products"
+msgstr ""
+
+msgid "5. Import data from SolusVM server"
+msgstr ""
+
+msgid "Connect to SolusVM master server via API"
+msgstr ""
+
+msgid "To create an API user login to SolusVM admin area and click Configuration > API Access from the top menu then select Add API User."
+msgstr ""
+
+msgid "INFORMATION"
+msgstr ""
+
+msgid "Master server IP"
+msgstr ""
+
+msgid "Secure connection"
+msgstr ""
+
+msgid "Custom port"
+msgstr ""
+
+msgid "Leave blank to use default port 5353 and 5656 for secure connection"
+msgstr ""
+
+msgid "Test connection"
+msgstr ""
+
+msgid "Support help desks"
+msgstr ""
+
+msgid "New help desk"
+msgstr ""
+
+msgid "Close tickets after"
+msgstr ""
+
+msgid "Close after"
+msgstr ""
+
+msgid "Can reopen"
+msgstr ""
+
+msgid "Pending approval amount"
+msgstr ""
+
+msgid "Total approved amount"
+msgstr ""
+
+msgid "Total paid amount"
+msgstr ""
+
+msgid "Balance amount"
+msgstr ""
+
+msgid "Total clicks"
+msgstr ""
+
+msgid "Unique clicks"
+msgstr ""
+
+msgid "Commisions"
+msgstr ""
+
+msgid "Actions"
+msgstr ""
+
+msgid "Main website"
+msgstr ""
+
+msgid "Membership settings"
+msgstr ""
+
+msgid "Membership service does not have any configuration options"
+msgstr ""
+
+msgid "File information"
+msgstr ""
+
+msgid "Filename"
+msgstr ""
+
+msgid "Location"
+msgstr ""
+
+msgid "Downloads"
+msgstr ""
+
+msgid "Upload new file for this order"
+msgstr ""
+
+msgid "Use this function to update existing order file. Client will be able to download new file from client area"
+msgstr ""
+
+msgid "Upload new file"
+msgstr ""
+
+msgid "Upload"
+msgstr ""
+
+msgid "Enable/Disable"
+msgstr ""
+
+msgid "Server manager"
+msgstr ""
+
+msgid "Access Hash (Instead of password for cPanel servers)"
+msgstr ""
+
+msgid "Connection port"
+msgstr ""
+
+msgid "Use Secure connection"
+msgstr ""
+
+msgid "Update and test connection"
+msgstr ""
+
+msgid "Update server"
+msgstr ""
+
+msgid "Staff members"
+msgstr ""
+
+msgid "New staff member"
+msgstr ""
+
+msgid "Manage groups"
+msgstr ""
+
+msgid "New group"
+msgstr ""
+
+msgid "Inactive"
+msgstr ""
+
+msgid "Create group"
+msgstr ""
+
+msgid "License details"
+msgstr ""
+
+msgid "Plugin"
+msgstr ""
+
+msgid "Last ping"
+msgstr ""
+
+msgid "Validate IP"
+msgstr ""
+
+msgid "Valid IPs (one per line)"
+msgstr ""
+
+msgid "Validate host"
+msgstr ""
+
+msgid "Valid hosts (one per line)"
+msgstr ""
+
+msgid "Validate path"
+msgstr ""
+
+msgid "Valid paths (one per line)"
+msgstr ""
+
+msgid "Validate version"
+msgstr ""
+
+msgid "Valid versions (one per line)"
+msgstr ""
+
+msgid "Topics"
+msgstr ""
+
+msgid "Forums"
+msgstr ""
+
+msgid "New topic"
+msgstr ""
+
+msgid "New forum"
+msgstr ""
+
+msgid "Replies"
+msgstr ""
+
+msgid "Sorting"
+msgstr ""
+
+msgid "API"
+msgstr ""
+
+msgid "Gravatar"
+msgstr ""
+
+msgid "Profile updated"
+msgstr ""
+
+msgid "API Key"
+msgstr ""
+
+msgid "API key allows integration with external applications. You will need this key for authentication."
+msgstr ""
+
+msgid "External application can control every aspect of BoxBilling using this API key."
+msgstr ""
+
+msgid "Warning! Resetting the key will break existing applications using it."
+msgstr ""
+
+msgid "Generate new key"
+msgstr ""
+
+msgid "Change your avatar at"
+msgstr ""
+
+msgid "Staff Group management"
+msgstr ""
+
+msgid "Manage staff member details"
+msgstr ""
+
+msgid "Change staff member password"
+msgstr ""
+
+msgid "Staff member password changed"
+msgstr ""
+
+msgid "Repeat same password"
+msgstr ""
+
+msgid "Submit"
+msgstr ""
+
+msgid "Api key is used to manage system via other interfaces."
+msgstr ""
+
+msgid "API key"
+msgstr ""
+
+msgid "Edit currency information"
+msgstr ""
+
+msgid "Price format"
+msgstr ""
+
+msgid "Send Email Message"
+msgstr ""
+
+msgid "From name"
+msgstr ""
+
+msgid "From email"
+msgstr ""
+
+msgid "Recipients filter. Select none to send message to all clients"
+msgstr ""
+
+msgid "Client status and group"
+msgstr ""
+
+msgid "Has order"
+msgstr ""
+
+msgid "Message content"
+msgstr ""
+
+msgid "Update and preview"
+msgstr ""
+
+msgid "Send test message"
+msgstr ""
+
+msgid "Send message to clients"
+msgstr ""
+
+msgid "Back to list"
+msgstr ""
+
+msgid "Sell BoxBilling licenses"
+msgstr ""
+
+msgid "1. Configure API"
+msgstr ""
+
+msgid "Update API key"
+msgstr ""
+
+msgid "2. Become partner"
+msgstr ""
+
+msgid "3. Create license product"
+msgstr ""
+
+msgid "Article updated"
+msgstr ""
+
+msgid "Article details"
+msgstr ""
+
+msgid "Payment gateways"
+msgstr ""
+
+msgid "New payment gateway"
+msgstr ""
+
+msgid "Allow subscriptions"
+msgstr ""
+
+msgid "Adding new payment gateway"
+msgstr ""
+
+msgid "Although BoxBilling ships with most popular payment gateways, you can install other gateways."
+msgstr ""
+
+msgid "Follow these instructions to install new payment gateway."
+msgstr ""
+
+msgid "Check for payment gateway at"
+msgstr ""
+
+msgid "for more payment gateways"
+msgstr ""
+
+msgid "Download payment gateway extension file and place it to"
+msgstr ""
+
+msgid "After file is uploaded in place, reload this page."
+msgstr ""
+
+msgid "Select uploaded file name and click on install."
+msgstr ""
+
+msgid "Payment gateway will be installed in BoxBilling and can be configured in \"Payment gateways\" tab."
+msgstr ""
+
+msgid "For developers. Read"
+msgstr ""
+
+msgid "to learn how to create your own payment gateway and share it with community"
+msgstr ""
+
+msgid "Install"
+msgstr ""
+
+msgid "All payment gateways installed"
+msgstr ""
+
+msgid "New Addon"
+msgstr ""
+
+msgid "Disabled"
+msgstr ""
+
+msgid "After order is placed"
+msgstr ""
+
+msgid "After payment is received"
+msgstr ""
+
+msgid "Manual activation"
+msgstr ""
+
+msgid "Tld management"
+msgstr ""
+
+msgid "Top level domain management"
+msgstr ""
+
+msgid "Registration price"
+msgstr ""
+
+msgid "Renewal price"
+msgstr ""
+
+msgid "Transfer price"
+msgstr ""
+
+msgid "Minimum years of registration"
+msgstr ""
+
+msgid "Allow registration"
+msgstr ""
+
+msgid "Allow transfer"
+msgstr ""
+
+msgid "Create new coupon code"
+msgstr ""
+
+msgid "Discount type"
+msgstr ""
+
+msgid "Recurring"
+msgstr ""
+
+msgid "Free setup"
+msgstr ""
+
+msgid "Promo code limitations"
+msgstr ""
+
+msgid "Once per client"
+msgstr ""
+
+msgid "Max uses (zero for unlimited)"
+msgstr ""
+
+msgid "Used"
+msgstr ""
+
+msgid "Period when code is valid"
+msgstr ""
+
+msgid "Products"
+msgstr ""
+
+msgid "Periods (Select none to apply to all periods)"
+msgstr ""
+
+msgid "Max Addon domains"
+msgstr ""
+
+msgid "Max FTP accounts"
+msgstr ""
+
+msgid "Max SQL Databases"
+msgstr ""
+
+msgid "Max Email Accounts"
+msgstr ""
+
+msgid "Max Subdomains"
+msgstr ""
+
+msgid "Max Parked Domains"
+msgstr ""
+
+msgid "Server manager specific parameters"
+msgstr ""
+
+msgid "Update hosting plan"
+msgstr ""
+
+msgid "Hosting plan additional parameters"
+msgstr ""
+
+msgid "Depending on server manager used to setup hosting account you may require provide additional parameters. List of parameters server managers requires you can find on extensions page."
+msgstr ""
+
+msgid "Add new configuration field"
+msgstr ""
+
+msgid "Pending approval"
+msgstr ""
+
+msgid "Affiliates"
+msgstr ""
+
+msgid "Clicks"
+msgstr ""
+
+msgid "Joined at"
+msgstr ""
+
+msgid "Affiliate module settings"
+msgstr ""
+
+msgid "Offer your clients become affiliates of your services."
+msgstr ""
+
+msgid "Commission from order"
+msgstr ""
+
+msgid "Days from order activation to admit commission"
+msgstr ""
+
+msgid "Bonus amount for becoming affiliate in"
+msgstr ""
+
+msgid "Minimum withdraw amount."
+msgstr ""
+
+msgid "Redirect Url. Where is your client redirected after visiting refferal link"
+msgstr ""
+
+msgid "Hosting settings"
+msgstr ""
+
+msgid "Hosting plan"
+msgstr ""
+
+msgid "Reseller hosting"
+msgstr ""
+
+msgid "Free domain registration"
+msgstr ""
+
+msgid "Free domain transfer"
+msgstr ""
+
+msgid "Hosting plans"
+msgstr ""
+
+msgid "Servers"
+msgstr ""
+
+msgid "Statistics"
+msgstr ""
+
+msgid "Website statistic"
+msgstr ""
+
+msgid "Metric"
+msgstr ""
+
+msgid "This Month"
+msgstr ""
+
+msgid "Today"
+msgstr ""
+
+msgid "Income"
+msgstr ""
+
+msgid "Define date interval for graphs "
+msgstr ""
+
+msgid "Update graphs"
+msgstr ""
+
+msgid "Support tickets"
+msgstr ""
+
+msgid "Orders by status"
+msgstr ""
+
+msgid "Income vs Refund"
+msgstr ""
+
+msgid "Hosting plans and servers"
+msgstr ""
+
+msgid "New server"
+msgstr ""
+
+msgid "New hosting plan"
+msgstr ""
+
+msgid "New server manager"
+msgstr ""
+
+msgid "Addon domains"
+msgstr ""
+
+msgid "Unique name to identify this server"
+msgstr ""
+
+msgid "server1.yourserverdomain.com"
+msgstr ""
+
+msgid "Primary IP address of the server used to connect to it like: 123.123.123.123"
+msgstr ""
+
+msgid "Assigned IP Addresses"
+msgstr ""
+
+msgid "List the IP Addresses assigned to the server (One per line)"
+msgstr ""
+
+msgid "ns1.yourdomain.com"
+msgstr ""
+
+msgid "ns2.yourdomain.com"
+msgstr ""
+
+msgid "ns3.yourdomain.com"
+msgstr ""
+
+msgid "ns4.yourdomain.com"
+msgstr ""
+
+msgid "Login username to your server: root/reseller"
+msgstr ""
+
+msgid "Login password to your server"
+msgstr ""
+
+msgid "Access Hash (Insted of password for cPanel servers)"
+msgstr ""
+
+msgid "Add server"
+msgstr ""
+
+msgid "Adding new hosting plan"
+msgstr ""
+
+msgid "Depending on server manager used to setup hosting account you may require provide additional parameters in next step. In this step provide basic hosting plan information."
+msgstr ""
+
+msgid "Unique name to identify this hosting plan"
+msgstr ""
+
+msgid "Disk quota (MB)"
+msgstr ""
+
+msgid "Bandwidth (MB)"
+msgstr ""
+
+msgid "Create hosting plan"
+msgstr ""
+
+msgid "Adding new server manager"
+msgstr ""
+
+msgid "Follow these instructions to install new hosting server manager."
+msgstr ""
+
+msgid "Check for server manager extensions at"
+msgstr ""
+
+msgid "BoxBilling extensions site"
+msgstr ""
+
+msgid "Download server manager extension file and place it to"
+msgstr ""
+
+msgid "Server manager gateway will be automatically detected."
+msgstr ""
+
+msgid "You can now create/edit servers with new server manager."
+msgstr ""
+
+msgid "BoxBilling documentation"
+msgstr ""
+
+msgid "to learn how to create your own server manager and share it with community"
+msgstr ""
+
+msgid "Import SolusVM clients"
+msgstr ""
+
+msgid "Import selected SolusVM clients to BoxBilling"
+msgstr ""
+
+msgid "Listed in public"
+msgstr ""
+
+msgid "Partner status"
+msgstr ""
+
+msgid "Partner product"
+msgstr ""
+
+msgid "Override price"
+msgstr ""
+
+msgid "Website URL"
+msgstr ""
+
+msgid "Promo"
+msgstr ""
+
+msgid "New promo"
+msgstr ""
+
+msgid "Discount"
+msgstr ""
+
+msgid "Applies to"
+msgstr ""
+
+msgid "Valid period"
+msgstr ""
+
+msgid "Usage"
+msgstr ""
+
+msgid "Create special offers for your clients by creating coupon codes."
+msgstr ""
+
+msgid "Absolute"
+msgstr ""
+
+msgid "Percentage"
+msgstr ""
+
+msgid "Valid time (Leave blank for undefined time)"
+msgstr ""
+
+msgid "Products (Select none to apply to all products)"
+msgstr ""
+
+msgid "Forum details"
+msgstr ""
+
+msgid "Clients logins history"
+msgstr ""
+
+msgid "Search:"
+msgstr ""
+
+msgid "Enter search text.."
+msgstr ""
+
+msgid "Membership details"
+msgstr ""
+
+msgid "Node / ID / VMID"
+msgstr ""
+
+msgid "Operating System"
+msgstr ""
+
+msgid "IP address"
+msgstr ""
+
+msgid "Additional IP addresses"
+msgstr ""
+
+msgid "Root password"
+msgstr ""
+
+msgid "Client area username / password"
+msgstr ""
+
+msgid "Console user / password"
+msgstr ""
+
+msgid "Client area"
+msgstr ""
+
+msgid "Admin area"
+msgstr ""
+
+msgid "Change root password"
+msgstr ""
+
+msgid "New password"
+msgstr ""
+
+msgid "Change"
+msgstr ""
+
+msgid "Change hostname"
+msgstr ""
+
+msgid "New hostname"
+msgstr ""
+
+msgid "Change plan"
+msgstr ""
+
+msgid "New plan"
+msgstr ""
+
+msgid "Rebuild"
+msgstr ""
+
+msgid "New template"
+msgstr ""
+
+msgid "Usage statistics"
+msgstr ""
+
+msgid "Free"
+msgstr ""
+
+msgid "Memory"
+msgstr ""
+
+msgid "Disk usage"
+msgstr ""
+
+msgid "Traffic"
+msgstr ""
+
+msgid "Load"
+msgstr ""
+
+msgid "Master node is offline, order is not yet activated or API is not configured properly."
+msgstr ""
+
+msgid "Service management"
+msgstr ""
+
+msgid "Changing settings does not send actions to SolusVM server."
+msgstr ""
+
+msgid "Main IP address"
+msgstr ""
+
+msgid "SpamChecker settings"
+msgstr ""
+
+msgid "Enable captcha for client registration and contact us forms"
+msgstr ""
+
+msgid "Sign up for Recaptcha key for your domain at"
+msgstr ""
+
+msgid "Recaptcha Enabled"
+msgstr ""
+
+msgid "ReCaptcha Public key"
+msgstr ""
+
+msgid "ReCaptcha Private key"
+msgstr ""
+
+msgid "Akismet settings"
+msgstr ""
+
+msgid "Enable forum messages checking on http://www.akismet.com database"
+msgstr ""
+
+msgid "Enable check"
+msgstr ""
+
+msgid "Akismet API key"
+msgstr ""
+
+msgid "StopForumSpam.com settings"
+msgstr ""
+
+msgid "If enabled, client ip will be checked on http://www.stopforumspam.com database before registration"
+msgstr ""
+
+msgid "Canned responses"
+msgstr ""
+
+msgid "New response"
+msgstr ""
+
+msgid "Categories"
+msgstr ""
+
+msgid "Example extension settings"
+msgstr ""
+
+msgid "Every extension can have settings page. Only requirement is to have mod_example_settings.phtml page in html_admin folder"
+msgstr ""
+
+msgid "Parameter title"
+msgstr ""
+
+msgid "Example custom value"
+msgstr ""
+
+msgid "New note"
+msgstr ""
+
+msgid "Delete all messages"
+msgstr ""
+
+msgid "Add note or todo task"
+msgstr ""
+
+msgid "Add note"
+msgstr ""
+
+msgid "Stock control settings"
+msgstr ""
+
+msgid "Enable stock control"
+msgstr ""
+
+msgid "Allow quantity select on order form"
+msgstr ""
+
+msgid "Quantity in stock"
+msgstr ""
+
+msgid "Plugin name"
+msgstr ""
+
+msgid "Update configuration fields"
+msgstr ""
+
+msgid "Centova Cast"
+msgstr ""
+
+msgid "Centova Cast settings"
+msgstr ""
+
+msgid "Server URL"
+msgstr ""
+
+msgid "Server Hostname"
+msgstr ""
+
+msgid "Server IP"
+msgstr ""
+
+msgid "Register new server"
+msgstr ""
+
+msgid "Edit server"
+msgstr ""
+
+msgid "CentovaCast URL"
+msgstr ""
+
+msgid "Administrator password"
+msgstr ""
+
+msgid "Register Centova Cast server"
+msgstr ""
+
+msgid "Server added"
+msgstr ""
+
+msgid "Create CentovaCast product"
+msgstr ""
+
+msgid "Email templates"
+msgstr ""
+
+msgid "Email settings"
+msgstr ""
+
+msgid "The list is empty. Depending on modules enabled email templates will be inserted after first event occurrence."
+msgstr ""
+
+msgid "Configure email options"
+msgstr ""
+
+msgid "BoxBilling sends emails using sendmail by default or you can configure your own SMTP server"
+msgstr ""
+
+msgid "Email transport"
+msgstr ""
+
+msgid "SendMail"
+msgstr ""
+
+msgid "SMTP"
+msgstr ""
+
+msgid "SMTP Hostname"
+msgstr ""
+
+msgid "SMTP Port"
+msgstr ""
+
+msgid "SMTP Username"
+msgstr ""
+
+msgid "SMTP Password"
+msgstr ""
+
+msgid "SMTP Security"
+msgstr ""
+
+msgid "Update email settings"
+msgstr ""
+
+msgid "Send test email to staff members"
+msgstr ""
+
+msgid "Where I can use new email template?"
+msgstr ""
+
+msgid "Newly created email templates can be used in custom event hooks."
+msgstr ""
+
+msgid "Action code"
+msgstr ""
+
+msgid "Number"
+msgstr ""
+
+msgid "Due at"
+msgstr ""
+
+msgid "Reminded at"
+msgstr ""
+
+msgid "Serie and number"
+msgstr ""
+
+msgid "Tax"
+msgstr ""
+
+msgid "Text before invoice items table"
+msgstr ""
+
+msgid "Text after invoice items table"
+msgstr ""
+
+msgid "Company VAT"
+msgstr ""
+
+msgid "Company Number"
+msgstr ""
+
+msgid "First name"
+msgstr ""
+
+msgid "Last name"
+msgstr ""
+
+msgid "Invoice items"
+msgstr ""
+
+msgid "Transaction Date"
+msgstr ""
+
+msgid "Transaction ID"
+msgstr ""
+
+msgid "Print"
+msgstr ""
+
+msgid "Delete"
+msgstr ""
+
+msgid "Client area themes"
+msgstr ""
+
+msgid "Admin area themes"
+msgstr ""
+
+msgid "New theme"
+msgstr ""
+
+msgid "Adding new client area theme"
+msgstr ""
+
+msgid "Follow these instructions to install new client area theme."
+msgstr ""
+
+msgid "Check for client area themes at"
+msgstr ""
+
+msgid "Upload new theme files to"
+msgstr ""
+
+msgid "and reload this page"
+msgstr ""
+
+msgid "Client area theme will appear in "Client area themes" tab. And you can select it as default"
+msgstr ""
+
+msgid "For theme designers. Read"
+msgstr ""
+
+msgid "to learn how to create your own theme"
+msgstr ""
+
+msgid "Adding new admin area theme"
+msgstr ""
+
+msgid "Admin area follows same logic as client area themes with one additional rule: admin theme directory must be prefixed with "admin_"."
+msgstr ""
+
+msgid "Quantity"
+msgstr ""
+
+msgid "Canned response"
+msgstr ""
+
+msgid "New product"
+msgstr ""
+
+msgid "Priority"
+msgstr ""
+
+msgid "Update priority"
+msgstr ""
+
+msgid "Sent emails"
+msgstr ""
+
+msgid "Subscriptions"
+msgstr ""
+
+msgid "New subscription"
+msgstr ""
+
+msgid "Subscription ID on payment gateway"
+msgstr ""
+
+msgid "Period"
+msgstr ""
+
+msgid "Import existing"
+msgstr ""
+
+msgid "Domain name"
+msgstr ""
+
+msgid "Domain TLD"
+msgstr ""
+
+msgid "File"
+msgstr ""
+
+msgid "Currently uploaded file"
+msgstr ""
+
+msgid "No icons available"
+msgstr ""
+
+msgid "Filter clients"
+msgstr ""
+
+msgid "All"
+msgstr ""
+
+msgid "New client"
+msgstr ""
+
+msgid "Groups"
+msgstr ""
+
+msgid "Ticket"
+msgstr ""
+
+msgid "Task"
+msgstr ""
+
+msgid "Client tickets"
+msgstr ""
+
+msgid "Help desk"
+msgstr ""
+
+msgid "Total responses"
+msgstr ""
+
+msgid "Task status"
+msgstr ""
+
+msgid "Related to"
+msgstr ""
+
+msgid "Upgrade to"
+msgstr ""
+
+msgid "Edit"
+msgstr ""
+
+msgid "Something went wrong here"
+msgstr ""
+
+msgid "Login"
+msgstr ""
+
+msgid "Back to Dashboard"
+msgstr ""
+
+msgid "Transaction"
+msgstr ""
+
+msgid "IPN"
+msgstr ""
+
+msgid "Transaction details"
+msgstr ""
+
+msgid "If you are sure that this transaction is valid you can update transaction details in "Manage" tab and try processing transaction again"
+msgstr ""
+
+msgid "Payment gateway"
+msgstr ""
+
+msgid "Transaction ID on payment gateway"
+msgstr ""
+
+msgid "Transaction status on payment gateway"
+msgstr ""
+
+msgid "Note"
+msgstr ""
+
+msgid "Process"
+msgstr ""
+
+msgid "Invoice ID"
+msgstr ""
+
+msgid "Transaction processing information"
+msgstr ""
+
+msgid "Validate IPN"
+msgstr ""
+
+msgid "Transaction information on payment gateway"
+msgstr ""
+
+msgid "Transaction type"
+msgstr ""
+
+msgid "Transaction status on Payment Gateway"
+msgstr ""
+
+msgid "Transaction ID on Payment Gateway"
+msgstr ""
+
+msgid "Note about this transaction"
+msgstr ""
+
+msgid "GET"
+msgstr ""
+
+msgid "No GET parameters received"
+msgstr ""
+
+msgid "POST"
+msgstr ""
+
+msgid "No POST parameters received"
+msgstr ""
+
+msgid "SERVER"
+msgstr ""
+
+msgid "No SERVER parameters logged"
+msgstr ""
+
+msgid "Braunstein extension settings"
+msgstr ""
+
+msgid "Required fields for client"
+msgstr ""
+
+msgid "Select which fields are required to be filled up by client on signup form"
+msgstr ""
+
+msgid "Company name"
+msgstr ""
+
+msgid "Gender"
+msgstr ""
+
+msgid "Birthday"
+msgstr ""
+
+msgid "Address details"
+msgstr ""
+
+msgid "Address line 1"
+msgstr ""
+
+msgid "Address line 2"
+msgstr ""
+
+msgid "Postcode/Zip"
+msgstr ""
+
+msgid "My Products & Services"
+msgstr ""
+
+msgid "Filter orders"
+msgstr ""
+
+msgid "Product"
+msgstr ""
+
+msgid "Invoice option"
+msgstr ""
+
+msgid "Creation date"
+msgstr ""
+
+msgid "Pending setup"
+msgstr ""
+
+msgid "Supended"
+msgstr ""
+
+msgid "New order"
+msgstr ""
+
+msgid "Continue"
+msgstr ""
+
+msgid "Domain action"
+msgstr ""
+
+msgid "Register domain"
+msgstr ""
+
+msgid "Domain name to register"
+msgstr ""
+
+msgid "Years"
+msgstr ""
+
+msgid "Transfer domain"
+msgstr ""
+
+msgid "Domain name to transfer"
+msgstr ""
+
+msgid "Domain transfer code"
+msgstr ""
+
+msgid "License settings"
+msgstr ""
+
+msgid "Prefix"
+msgstr ""
+
+msgid "Length"
+msgstr ""
+
+msgid "Validate Hostname"
+msgstr ""
+
+msgid "Validate Version"
+msgstr ""
+
+msgid "Validate Path"
+msgstr ""
+
+msgid "License plugins"
+msgstr ""
+
+msgid "BoxBilling gives you ability to provide your own license generation script. Follow instructions bellow to install new license plugin"
+msgstr ""
+
+msgid "License plugin is PHP class \"License_PluginName\" with one method"
+msgstr ""
+
+msgid "Take a look at default plugin at"
+msgstr ""
+
+msgid "Create your plugin and place it to"
+msgstr ""
+
+msgid "BoxBilling will automatically detect new plugin"
+msgstr ""
+
+msgid "Read"
+msgstr ""
+
+msgid "for more information."
+msgstr ""
+
+msgid "Filter support tickets"
+msgstr ""
+
+msgid "Order ID"
+msgstr ""
+
+msgid "Ticket subject"
+msgstr ""
+
+msgid "Ticket messages"
+msgstr ""
+
+msgid "New ticket"
+msgstr ""
+
+msgid "New email"
+msgstr ""
+
+msgid "Last message"
+msgstr ""
+
+msgid "ago"
+msgstr ""
+
+msgid "Open ticket for existing client"
+msgstr ""
+
+msgid "Open public ticket for non client"
+msgstr ""
+
+msgid "Receivers name"
+msgstr ""
+
+msgid "John Smith"
+msgstr ""
+
+msgid "to@gmail.com"
+msgstr ""
+
+msgid "Sent"
+msgstr ""
+
+msgid "Resend"
+msgstr ""
+
+msgid "Top level domains"
+msgstr ""
+
+msgid "New top level domain"
+msgstr ""
+
+msgid "Registrars"
+msgstr ""
+
+msgid "New domain registrar"
+msgstr ""
+
+msgid "Manage TLDs"
+msgstr ""
+
+msgid "Setup domain pricing and allowed operations. Assign specific domain registrars for each Top Level Domain (TLD)"
+msgstr ""
+
+msgid "TLD"
+msgstr ""
+
+msgid "Registration"
+msgstr ""
+
+msgid "Renew"
+msgstr ""
+
+msgid "Transfer"
+msgstr ""
+
+msgid "Operations"
+msgstr ""
+
+msgid "Allow register:"
+msgstr ""
+
+msgid "Allow transfer:"
+msgstr ""
+
+msgid "Active:"
+msgstr ""
+
+msgid "Add new top level domain"
+msgstr ""
+
+msgid "Setup new TLD prices and properties"
+msgstr ""
+
+msgid "Tld"
+msgstr ""
+
+msgid "Domain registrars"
+msgstr ""
+
+msgid "Manage domain registrars"
+msgstr ""
+
+msgid "Setup default nameservers that will be used for new domain registrations if client have not provided his own nameservers in order form"
+msgstr ""
+
+msgid "Update nameservers"
+msgstr ""
+
+msgid "Adding new domain registrar"
+msgstr ""
+
+msgid "Follow instrunctions bellow to install new domain registrar."
+msgstr ""
+
+msgid "Check domain registrar you are looking for is available at"
+msgstr ""
+
+msgid "Download domain registrar file and place to"
+msgstr ""
+
+msgid "Reload this page to see newly detected domain registrar"
+msgstr ""
+
+msgid "Click on install button. Now you will be able to create top level domains with new domain registrar"
+msgstr ""
+
+msgid "to learn how to create your own domain registrar."
+msgstr ""
+
+msgid "SEO settings"
+msgstr ""
+
+msgid "Ping sitemap to Google"
+msgstr ""
+
+msgid "Ping sitemap to Yahoo"
+msgstr ""
+
+msgid "Ping sitemap to Bing"
+msgstr ""
+
+msgid "management"
+msgstr ""
+
+msgid "Support ticket"
+msgstr ""
+
+msgid "Staff member"
+msgstr ""
+
+msgid "Announcement"
+msgstr ""
+
+msgid "Knowledge base article"
+msgstr ""
+
+msgid "Forum topic"
+msgstr ""
+
+msgid "Tax rules"
+msgstr ""
+
+msgid "New tax rule"
+msgstr ""
+
+msgid "Tax settings"
+msgstr ""
+
+msgid "EU VAT"
+msgstr ""
+
+msgid "State/Region"
+msgstr ""
+
+msgid "Tax rate"
+msgstr ""
+
+msgid "Applies to any country"
+msgstr ""
+
+msgid "Applies to any state"
+msgstr ""
+
+msgid "Enable tax support"
+msgstr ""
+
+msgid "Automatic VAT Tax Rules Setup"
+msgstr ""
+
+msgid "If you would like BoxBilling to automatically setup the EU VAT tax rules for you for all EU Member States then simply enter your VAT Label & local VAT rate below and click the submit button. This action will delete any existing tax rules and configure the VAT rates for all EU countries."
+msgstr ""
+
+msgid "VAT Label"
+msgstr ""
+
+msgid "VAT"
+msgstr ""
+
+msgid "VAT rate"
+msgstr ""
+
+msgid "21"
+msgstr ""
+
+msgid "Create EU VAT Rules"
+msgstr ""
+
+msgid "Tax title"
+msgstr ""
+
+msgid "sales Tax"
+msgstr ""
+
+msgid "18"
+msgstr ""
+
+msgid "Leave empty to apply to all states"
+msgstr ""
+
+msgid "Yesterday"
+msgstr ""
+
+msgid "This month so far"
+msgstr ""
+
+msgid "Latest orders"
+msgstr ""
+
+msgid "Product sales"
+msgstr ""
+
+msgid "Product/Service"
+msgstr ""
+
+msgid "No active orders available"
+msgstr ""
+
+msgid "Define date interval for graphs"
+msgstr ""
+
+msgid "Recent clients activity"
+msgstr ""
+
+msgid "Recent staff activity"
+msgstr ""
+
+msgid "Create new order"
+msgstr ""
+
+msgid "for"
+msgstr ""
+
+msgid "Activate order"
+msgstr ""
+
+msgid "Place new order"
+msgstr ""
+
+msgid "Order management"
+msgstr ""
+
+msgid "Edit order"
+msgstr ""
+
+msgid "History"
+msgstr ""
+
+msgid "Support"
+msgstr ""
+
+msgid "Payment amount"
+msgstr ""
+
+msgid "Order status"
+msgstr ""
+
+msgid "Order created"
+msgstr ""
+
+msgid "Activated at"
+msgstr ""
+
+msgid "Renewal date"
+msgstr ""
+
+msgid "Order notes"
+msgstr ""
+
+msgid "Order group ID"
+msgstr ""
+
+msgid "Order promo code"
+msgstr ""
+
+msgid "Active support tickets"
+msgstr ""
+
+msgid "Reason of suspendation"
+msgstr ""
+
+msgid "Suspendation reason"
+msgstr ""
+
+msgid "Reason of cancelation"
+msgstr ""
+
+msgid "Cancelation reason"
+msgstr ""
+
+msgid "Changes status without performing action"
+msgstr ""
+
+msgid "Addons you have ordered with this service"
+msgstr ""
+
+msgid "Billing Cycle"
+msgstr ""
+
+msgid "Next due date"
+msgstr ""
+
+msgid "Order invoices"
+msgstr ""
+
+msgid "Order status change history"
+msgstr ""
+
+msgid "Support tickets regarding this order"
+msgstr ""
+
+msgid "BoxBilling license management"
+msgstr ""
+
+msgid "License order ID"
+msgstr ""
+
+msgid "License key"
+msgstr ""
+
+msgid "Valid IPs"
+msgstr ""
+
+msgid "Valid hostnames"
+msgstr ""
+
+msgid "Valid versions"
+msgstr ""
+
+msgid "Valid install paths"
+msgstr ""
+
+msgid "Order is not activated or not found"
+msgstr ""
+
+msgid "Example module"
+msgstr ""
+
+msgid "Example module title"
+msgstr ""
+
+msgid "This is an example extension content"
+msgstr ""
+
+msgid "Parameters from Controller"
+msgstr ""
+
+msgid "Parameters from URL"
+msgstr ""
+
+msgid "API example"
+msgstr ""
+
+msgid "README"
+msgstr ""
+
+msgid "Subscription"
+msgstr ""
+
+msgid "Subscription details"
+msgstr ""
+
+msgid "Support help desk"
+msgstr ""
+
+msgid "Help desk name will be visible for clients when submitting new ticket. Define very large number of hours to disable auto close ticket option"
+msgstr ""
+
+msgid "Server Name"
+msgstr ""
+
+msgid "Account IP"
+msgstr ""
+
+msgid "per month"
+msgstr ""
+
+msgid "Jump to cPanel"
+msgstr ""
+
+msgid "Reseller control panel"
+msgstr ""
+
+msgid "Change hosting plan"
+msgstr ""
+
+msgid "Hosting plan changed"
+msgstr ""
+
+msgid "Change account password"
+msgstr ""
+
+msgid "Account password changed"
+msgstr ""
+
+msgid "Password Confirm"
+msgstr ""
+
+msgid "Change IP"
+msgstr ""
+
+msgid "Account IP changed"
+msgstr ""
+
+msgid "Change username"
+msgstr ""
+
+msgid "Account username changed"
+msgstr ""
+
+msgid "Change domain"
+msgstr ""
+
+msgid "Account domain changed"
+msgstr ""
+
+msgid "Client area languages"
+msgstr ""
+
+msgid "New language"
+msgstr ""
+
+msgid "Language"
+msgstr ""
+
+msgid "BoxBilling in your language"
+msgstr ""
+
+msgid "Although BoxBilling displays in U.S. English by default, the software has the built-in capability to be used in any language. Follow instructions bellow to install new language."
+msgstr ""
+
+msgid "Check if your language translation file is available at"
+msgstr ""
+
+msgid "Download language files and place them to"
+msgstr ""
+
+msgid "Language will be automatically available and can be changed in client area"
+msgstr ""
+
+msgid "Installing BoxBilling in Your Language"
+msgstr ""
+
+msgid "to learn how to install files that will transform BoxBilling so it displays in your language."
+msgstr ""
+
+msgid "Translations can be made with"
+msgstr ""
+
+msgid "software"
+msgstr ""
+
+msgid "Changing default language"
+msgstr ""
+
+msgid "Default language can be set in"
+msgstr ""
+
+msgid "Removing language"
+msgstr ""
+
+msgid "Removing languages from BoxBilling is really simple. Just delete language folder you wish from"
+msgstr ""
+
+msgid "Partners list"
+msgstr ""
+
+msgid "Logo"
+msgstr ""
+
+msgid "Sales"
+msgstr ""
+
+msgid "Signup Date"
+msgstr ""
+
+msgid "Global partners limits and settings"
+msgstr ""
+
+msgid "Default product which partners are reselling."
+msgstr ""
+
+msgid "Default order limit for partner per day. Used to prevent API abuse"
+msgstr ""
+
+msgid "Optional rules for becoming partner"
+msgstr ""
+
+msgid "Product which must be ordered before becoming partner"
+msgstr ""
+
+msgid "Check partners balance before creating new order for available amount"
+msgstr ""
+
+msgid "How much money must be on clients balance to become a partner"
+msgstr ""
+
+msgid "Registrar configuration"
+msgstr ""
+
+msgid "Registrar title"
+msgstr ""
+
+msgid "Post updated"
+msgstr ""
+
+msgid "Post created"
+msgstr ""
+
+msgid "Last update"
+msgstr ""
+
+msgid "Create main administrator account"
+msgstr ""
+
+msgid "Enter your email address"
+msgstr ""
+
+msgid "Enter your password"
+msgstr ""
+
+msgid "Create administrator account"
+msgstr ""
+
+msgid "Remember me"
+msgstr ""
+
+msgid "Log me in"
+msgstr ""
+
+msgid "Extensions"
+msgstr ""
+
+msgid "Update BoxBilling"
+msgstr ""
+
+msgid "Learn more about extensions"
+msgstr ""
+
+msgid "Hooks"
+msgstr ""
+
+msgid "Activate or deactivate extensions"
+msgstr ""
+
+msgid "Deactivate"
+msgstr ""
+
+msgid "Module settings"
+msgstr ""
+
+msgid "Hook"
+msgstr ""
+
+msgid "Automatic update"
+msgstr ""
+
+msgid "Automatic updater is a tool to update BoxBilling to latest version in one click. Works on these hosting environments where PHP has permissions to overwrite files uploaded via FTP."
+msgstr ""
+
+msgid "Manual update"
+msgstr ""
+
+msgid "Manual update is a solution when auto updater can not work on current installation environment"
+msgstr ""
+
+msgid "Extending BoxBilling"
+msgstr ""
+
+msgid "BoxBilling gives developers all the capabilities to customize, integrate & extend the core system into your own website & applications."
+msgstr ""
+
+msgid "File manager"
+msgstr ""
+
+msgid "Full screen"
+msgstr ""
+
diff --git a/src/bb-locale/en_US/LC_MESSAGES/index.html b/src/bb-locale/en_US/LC_MESSAGES/index.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/bb-locale/en_US/LC_MESSAGES/messages.mo b/src/bb-locale/en_US/LC_MESSAGES/messages.mo
new file mode 100644
index 000000000..f7c6b9835
Binary files /dev/null and b/src/bb-locale/en_US/LC_MESSAGES/messages.mo differ
diff --git a/src/bb-locale/en_US/LC_MESSAGES/messages.po b/src/bb-locale/en_US/LC_MESSAGES/messages.po
new file mode 100644
index 000000000..9638c8fb3
--- /dev/null
+++ b/src/bb-locale/en_US/LC_MESSAGES/messages.po
@@ -0,0 +1,5537 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: BoxBilling\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2012-08-02 09:38+0300\n"
+"Last-Translator: BoxBilling \n"
+"Language-Team: BoxBilling \n"
+"Language: English\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: __;gettext;Box_Exception\n"
+"X-Poedit-Basepath: ../../../\n"
+"X-Poedit-Language: English\n"
+"X-Poedit-Country: UNITED STATES\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-SearchPath-0: bb-library/Api\n"
+"X-Poedit-SearchPath-1: bb-library/Box\n"
+"X-Poedit-SearchPath-2: bb-library/License\n"
+"X-Poedit-SearchPath-3: bb-library/Model\n"
+"X-Poedit-SearchPath-4: bb-modules\n"
+
+msgid "sq_AL"
+msgstr "Albanian (Albania)"
+
+msgid "ar_DZ"
+msgstr "Arabic (Algeria)"
+
+msgid "ar_BH"
+msgstr "Arabic (Bahrain)"
+
+msgid "ar_EG"
+msgstr "Arabic (Egypt)"
+
+msgid "ar_IQ"
+msgstr "Arabic (Iraq)"
+
+msgid "ar_JO"
+msgstr "Arabic (Jordan)"
+
+msgid "ar_KW"
+msgstr "Arabic (Kuwait)"
+
+msgid "ar_LB"
+msgstr "Arabic (Lebanon)"
+
+msgid "ar_LY"
+msgstr "Arabic (Libya)"
+
+msgid "ar_MA"
+msgstr "Arabic (Morocco)"
+
+msgid "ar_OM"
+msgstr "Arabic (Oman)"
+
+msgid "ar_QA"
+msgstr "Arabic (Qatar)"
+
+msgid "ar_SA"
+msgstr "Arabic (Saudi Arabia)"
+
+msgid "ar_SD"
+msgstr "Arabic (Sudan)"
+
+msgid "ar_SY"
+msgstr "Arabic (Syria)"
+
+msgid "ar_TN"
+msgstr "Arabic (Tunisia)"
+
+msgid "ar_AE"
+msgstr "Arabic (United Arab Emirates)"
+
+msgid "ar_YE"
+msgstr "Arabic (Yemen)"
+
+msgid "be_BY"
+msgstr "Belarusian (Belarus)"
+
+msgid "bg_BG"
+msgstr "Bulgarian (Bulgaria)"
+
+msgid "ca_ES"
+msgstr "Catalan (Spain)"
+
+msgid "zh_CN"
+msgstr "Chinese (China)"
+
+msgid "zh_HK"
+msgstr "Chinese (Hong Kong)"
+
+msgid "zh_SG"
+msgstr "Chinese (Singapore)"
+
+msgid "zh_TW"
+msgstr "Chinese (Taiwan)"
+
+msgid "hr_HR"
+msgstr "Croatian (Croatia)"
+
+msgid "cs_CZ"
+msgstr "Czech (Czech Republic)"
+
+msgid "da_DK"
+msgstr "Danish (Denmark)"
+
+msgid "nl_BE"
+msgstr "Dutch (Belgium)"
+
+msgid "nl_NL"
+msgstr "Dutch (Netherlands)"
+
+msgid "en_AU"
+msgstr "English (Australia)"
+
+msgid "en_CA"
+msgstr "English (Canada)"
+
+msgid "en_IN"
+msgstr "English (India)"
+
+msgid "en_IE"
+msgstr "English (Ireland)"
+
+msgid "en_MT"
+msgstr "English (Malta)"
+
+msgid "en_NZ"
+msgstr "English (New Zealand)"
+
+msgid "en_PH"
+msgstr "English (Philippines)"
+
+msgid "en_SG"
+msgstr "English (Singapore)"
+
+msgid "en_ZA"
+msgstr "English (South Africa)"
+
+msgid "en_GB"
+msgstr "English (United Kingdom)"
+
+msgid "en_US"
+msgstr "English (United States)"
+
+msgid "et_EE"
+msgstr "Estonian (Estonia)"
+
+msgid "fi_FI"
+msgstr "Finnish (Finland)"
+
+msgid "fr_BE"
+msgstr "French (Belgium)"
+
+msgid "fr_CA"
+msgstr "French (Canada)"
+
+msgid "fr_FR"
+msgstr "French (France)"
+
+msgid "fr_LU"
+msgstr "French (Luxembourg)"
+
+msgid "fr_CH"
+msgstr "French (Switzerland)"
+
+msgid "de_AT"
+msgstr "German (Austria)"
+
+msgid "de_DE"
+msgstr "German (Germany)"
+
+msgid "de_LU"
+msgstr "German (Luxembourg)"
+
+msgid "de_CH"
+msgstr "German (Switzerland)"
+
+msgid "el_CY"
+msgstr "Greek (Cyprus)"
+
+msgid "el_GR"
+msgstr "Greek (Greece)"
+
+msgid "iw_IL"
+msgstr "Hebrew (Israel)"
+
+msgid "hi_IN"
+msgstr "Hindi (India)"
+
+msgid "hu_HU"
+msgstr "Hungarian (Hungary)"
+
+msgid "is_IS"
+msgstr "Icelandic (Iceland)"
+
+msgid "in_ID"
+msgstr "Indonesian (Indonesia)"
+
+msgid "ga_IE"
+msgstr "Irish (Ireland)"
+
+msgid "it_IT"
+msgstr "Italian (Italy)"
+
+msgid "it_CH"
+msgstr "Italian (Switzerland)"
+
+msgid "ja_JP"
+msgstr "Japanese (Japan)"
+
+msgid "ja_JP_JP"
+msgstr "Japanese (Japan,JP)"
+
+msgid "ko_KR"
+msgstr "Korean (South Korea)"
+
+msgid "lv_LV"
+msgstr "Latvian (Latvia)"
+
+msgid "lt_LT"
+msgstr "Lithuanian (Lithuania)"
+
+msgid "mk_MK"
+msgstr "Macedonian (Macedonia)"
+
+msgid "ms_MY"
+msgstr "Malay (Malaysia)"
+
+msgid "mt_MT"
+msgstr "Maltese (Malta)"
+
+msgid "no_NO"
+msgstr "Norwegian (Norway)"
+
+msgid "no_NO_NY"
+msgstr "Norwegian (Norway,Nynorsk)"
+
+msgid "pl_PL"
+msgstr "Polish (Poland)"
+
+msgid "pt_BR"
+msgstr "Portuguese (Brazil)"
+
+msgid "pt_PT"
+msgstr "Portuguese (Portugal)"
+
+msgid "ro_RO"
+msgstr "Romanian (Romania)"
+
+msgid "ru_RU"
+msgstr "Russian (Russia)"
+
+msgid "sr_BA"
+msgstr "Serbian (Bosnia and Herzegovina)"
+
+msgid "sr_ME"
+msgstr "Serbian (Montenegro)"
+
+msgid "sr_CS"
+msgstr "Serbian (Serbia and Montenegro)"
+
+msgid "sr_RS"
+msgstr "Serbian (Serbia)"
+
+msgid "sk_SK"
+msgstr "Slovak (Slovakia)"
+
+msgid "sl_SI"
+msgstr "Slovenian (Slovenia)"
+
+msgid "es_AR"
+msgstr "Spanish (Argentina)"
+
+msgid "es_BO"
+msgstr "Spanish (Bolivia)"
+
+msgid "es_CL"
+msgstr "Spanish (Chile)"
+
+msgid "es_CO"
+msgstr "Spanish (Colombia)"
+
+msgid "es_CR"
+msgstr "Spanish (Costa Rica)"
+
+msgid "es_DO"
+msgstr "Spanish (Dominican Republic)"
+
+msgid "es_EC"
+msgstr "Spanish (Ecuador)"
+
+msgid "es_SV"
+msgstr "Spanish (El Salvador)"
+
+msgid "es_GT"
+msgstr "Spanish (Guatemala)"
+
+msgid "es_HN"
+msgstr "Spanish (Honduras)"
+
+msgid "es_MX"
+msgstr "Spanish (Mexico)"
+
+msgid "es_NI"
+msgstr "Spanish (Nicaragua)"
+
+msgid "es_PA"
+msgstr "Spanish (Panama)"
+
+msgid "es_PY"
+msgstr "Spanish (Paraguay)"
+
+msgid "es_PE"
+msgstr "Spanish (Peru)"
+
+msgid "es_PR"
+msgstr "Spanish (Puerto Rico)"
+
+msgid "es_ES"
+msgstr "Spanish (Spain)"
+
+msgid "es_US"
+msgstr "Spanish (United States)"
+
+msgid "es_UY"
+msgstr "Spanish (Uruguay)"
+
+msgid "es_VE"
+msgstr "Spanish (Venezuela)"
+
+msgid "sv_SE"
+msgstr "Swedish (Sweden)"
+
+msgid "th_TH"
+msgstr "Thai (Thailand)"
+
+msgid "tr_TR"
+msgstr "Turkish (Turkey)"
+
+msgid "uk_UA"
+msgstr "Ukrainian (Ukraine)"
+
+msgid "vi_VN"
+msgstr "Vietnamese (Vietnam)"
+
+msgid "Thread / Thread Starter"
+msgstr ""
+
+msgid "Last post"
+msgstr ""
+
+msgid "Replies"
+msgstr ""
+
+msgid "Views"
+msgstr ""
+
+msgid "by"
+msgstr ""
+
+msgid "The list is empty"
+msgstr ""
+
+msgid "Forum list"
+msgstr ""
+
+msgid "New topic"
+msgstr ""
+
+msgid "Register"
+msgstr ""
+
+msgid "Start new topic in"
+msgstr ""
+
+msgid "Start new topic"
+msgstr ""
+
+msgid "Topic title"
+msgstr ""
+
+msgid "Topic message"
+msgstr ""
+
+msgid "Create new topic"
+msgstr ""
+
+msgid "Login / Sign up"
+msgstr ""
+
+msgid "Sign In / Create new account"
+msgstr ""
+
+msgid "Become a member to participate in forum, contact support, order new services"
+msgstr ""
+
+msgid "Sign in"
+msgstr ""
+
+msgid "Login to client area"
+msgstr ""
+
+msgid "Email Address"
+msgstr ""
+
+msgid "Password"
+msgstr ""
+
+msgid "Login"
+msgstr ""
+
+msgid "Reset password"
+msgstr ""
+
+msgid "Do not have an account yet?"
+msgstr ""
+
+msgid "Enter your details below"
+msgstr ""
+
+msgid "Create new profile"
+msgstr ""
+
+msgid "First Name"
+msgstr ""
+
+msgid "Last Name"
+msgstr ""
+
+msgid "Company"
+msgstr ""
+
+msgid "Password confirm"
+msgstr ""
+
+msgid "Thank you"
+msgstr ""
+
+msgid "Payment for invoice received"
+msgstr ""
+
+msgid "Your payment is being processed right now. This takes about 5 minutes to complete."
+msgstr ""
+
+msgid "You will be automatically redirected to invoice page after 5 minutes."
+msgstr ""
+
+msgid "Invoices"
+msgstr ""
+
+msgid "List of invoices"
+msgstr ""
+
+msgid "Invoice management"
+msgstr ""
+
+msgid "Unpaid"
+msgstr ""
+
+msgid "Paid"
+msgstr ""
+
+msgid "Title"
+msgstr ""
+
+msgid "Issue Date"
+msgstr ""
+
+msgid "Due Date"
+msgstr ""
+
+msgid "Total"
+msgstr ""
+
+msgid "Pay"
+msgstr ""
+
+msgid "Paid at"
+msgstr ""
+
+msgid "Forum"
+msgstr ""
+
+msgid "Welcome to our forums. If you wish to become a member and post, you have to be registered member."
+msgstr ""
+
+msgid "Threads"
+msgstr ""
+
+msgid "Posts"
+msgstr ""
+
+msgid "Forums are closed"
+msgstr ""
+
+msgid "Favorite topics"
+msgstr ""
+
+msgid "VPS management"
+msgstr ""
+
+msgid "Details"
+msgstr ""
+
+msgid "Statistics"
+msgstr ""
+
+msgid "Manage"
+msgstr ""
+
+msgid "Control panel"
+msgstr ""
+
+msgid "State"
+msgstr ""
+
+msgid "Refresh"
+msgstr ""
+
+msgid "Hostname"
+msgstr ""
+
+msgid "Plan"
+msgstr ""
+
+msgid "Operating system"
+msgstr ""
+
+msgid "IP address"
+msgstr ""
+
+msgid "Additional IP addresses"
+msgstr ""
+
+msgid "Type"
+msgstr ""
+
+msgid "Root password"
+msgstr ""
+
+msgid "Change status"
+msgstr ""
+
+msgid "VPS rebooting. Refresh page after a few moments."
+msgstr ""
+
+msgid "Reboot"
+msgstr ""
+
+msgid "VPS booting. Refresh page after a few moments."
+msgstr ""
+
+msgid "Boot"
+msgstr ""
+
+msgid "VPS shutdown"
+msgstr ""
+
+msgid "Shutdown"
+msgstr ""
+
+msgid "Change hostname"
+msgstr ""
+
+msgid "Hostname changed"
+msgstr ""
+
+msgid "New hostname"
+msgstr ""
+
+msgid "Enter new hostname"
+msgstr ""
+
+msgid "Change"
+msgstr ""
+
+msgid "Change operating system"
+msgstr ""
+
+msgid "Operating system is being changed"
+msgstr ""
+
+msgid "New operating system"
+msgstr ""
+
+msgid "Change root password"
+msgstr ""
+
+msgid "Root password changed"
+msgstr ""
+
+msgid "New password"
+msgstr ""
+
+msgid "Enter new root password"
+msgstr ""
+
+msgid "Bandwidth"
+msgstr ""
+
+msgid "Used"
+msgstr ""
+
+msgid "Free"
+msgstr ""
+
+msgid "Memory"
+msgstr ""
+
+msgid "Disk usage"
+msgstr ""
+
+msgid "Boot up server to see statistics"
+msgstr ""
+
+msgid "Are you sure?"
+msgstr ""
+
+msgid "VPS booting. Reload page after a few moments."
+msgstr ""
+
+msgid "Login details"
+msgstr ""
+
+msgid "Username"
+msgstr ""
+
+msgid "Open control panel"
+msgstr ""
+
+msgid "Change password"
+msgstr ""
+
+msgid "Change client area password"
+msgstr ""
+
+msgid "Client area password changed"
+msgstr ""
+
+msgid "Enter new password"
+msgstr ""
+
+msgid "Dashboard"
+msgstr ""
+
+msgid "Shopping cart"
+msgstr ""
+
+msgid "Profile"
+msgstr ""
+
+msgid "Sign out"
+msgstr ""
+
+msgid "Email address"
+msgstr ""
+
+msgid "Select language"
+msgstr ""
+
+msgid "Popular articles"
+msgstr ""
+
+msgid "Recent posts"
+msgstr ""
+
+msgid "About us"
+msgstr ""
+
+msgid "Terms and conditions"
+msgstr ""
+
+msgid "Privacy policy"
+msgstr ""
+
+msgid "Loading .."
+msgstr ""
+
+msgid "Incorrect please try again"
+msgstr ""
+
+msgid "Enter the words above"
+msgstr ""
+
+msgid "Support tickets"
+msgstr ""
+
+msgid "Need an answer? We are here to help"
+msgstr ""
+
+msgid "Id"
+msgstr ""
+
+msgid "Subject"
+msgstr ""
+
+msgid "Help desk"
+msgstr ""
+
+msgid "Status"
+msgstr ""
+
+msgid "Submitted"
+msgstr ""
+
+msgid "ago"
+msgstr ""
+
+msgid "Submit new ticket"
+msgstr ""
+
+msgid "Submit new support ticket"
+msgstr ""
+
+msgid "Message"
+msgstr ""
+
+msgid "Submit"
+msgstr ""
+
+msgid "Knowledge base"
+msgstr ""
+
+msgid "Blog"
+msgstr ""
+
+msgid "News & Announcements"
+msgstr ""
+
+msgid "Track our latest posts"
+msgstr ""
+
+msgid "Read more.."
+msgstr ""
+
+msgid "Centova Cast server"
+msgstr ""
+
+msgid "Recent tracks"
+msgstr ""
+
+msgid "Unable to connect to server"
+msgstr ""
+
+msgid "No recent tracks are available"
+msgstr ""
+
+msgid "Download file"
+msgstr ""
+
+msgid "Download"
+msgstr ""
+
+msgid "Back to emails"
+msgstr ""
+
+msgid "From"
+msgstr ""
+
+msgid "To"
+msgstr ""
+
+msgid "Sent"
+msgstr ""
+
+msgid "Resend"
+msgstr ""
+
+msgid "Delete"
+msgstr ""
+
+msgid "Back to list"
+msgstr ""
+
+msgid "Topic information"
+msgstr ""
+
+msgid "Topic"
+msgstr ""
+
+msgid "Started By"
+msgstr ""
+
+msgid "Messages"
+msgstr ""
+
+msgid "Since"
+msgstr ""
+
+msgid "Back to threads list"
+msgstr ""
+
+msgid "Reply"
+msgstr ""
+
+msgid "Quote"
+msgstr ""
+
+msgid "Post new message in forum"
+msgstr ""
+
+msgid "Post"
+msgstr ""
+
+msgid "No replies in this topic"
+msgstr ""
+
+msgid "Processing payment ..."
+msgstr ""
+
+msgid "Redirecting to payment gateway.."
+msgstr ""
+
+msgid "Please click here to continue if this page does not redirect automatically in 5 seconds"
+msgstr ""
+
+msgid "Quantity:"
+msgstr ""
+
+msgid "Total price:"
+msgstr ""
+
+msgid "Price"
+msgstr ""
+
+msgid "Setup Price"
+msgstr ""
+
+msgid "Continue"
+msgstr ""
+
+msgid "Order now"
+msgstr ""
+
+msgid "Proforma invoice"
+msgstr ""
+
+msgid "Proforma Invoice"
+msgstr ""
+
+msgid "Please choose payment type and pay for your chosen products."
+msgstr ""
+
+msgid "Invoice"
+msgstr ""
+
+msgid "Invoice is paid"
+msgstr ""
+
+msgid "Account"
+msgstr ""
+
+msgid "Company number"
+msgstr ""
+
+msgid "VAT"
+msgstr ""
+
+msgid "Discount"
+msgstr ""
+
+msgid "Pay by"
+msgstr ""
+
+msgid "Subscribe with"
+msgstr ""
+
+msgid "Total:"
+msgstr ""
+
+msgid "Pay now"
+msgstr ""
+
+msgid "Transactions"
+msgstr ""
+
+msgid "Transaction Date"
+msgstr ""
+
+msgid "Transaction ID"
+msgstr ""
+
+msgid "Gateway"
+msgstr ""
+
+msgid "Amount"
+msgstr ""
+
+msgid "Actions"
+msgstr ""
+
+msgid "Print"
+msgstr ""
+
+msgid "Yes"
+msgstr ""
+
+msgid "No"
+msgstr ""
+
+msgid "CPU"
+msgstr ""
+
+msgid "RAM"
+msgstr ""
+
+msgid "Disk space"
+msgstr ""
+
+msgid "Monthly price"
+msgstr ""
+
+msgid "Order confirm"
+msgstr ""
+
+msgid "Order confirmation"
+msgstr ""
+
+msgid "These are the products you have selected"
+msgstr ""
+
+msgid "Product"
+msgstr ""
+
+msgid "Period"
+msgstr ""
+
+msgid "setup"
+msgstr ""
+
+msgid "Have a promo code?"
+msgstr ""
+
+msgid "Apply"
+msgstr ""
+
+msgid "Reset"
+msgstr ""
+
+msgid "Checkout"
+msgstr ""
+
+msgid "You have not selected any product"
+msgstr ""
+
+msgid "Order new service"
+msgstr ""
+
+msgid "Home"
+msgstr ""
+
+msgid "Order"
+msgstr ""
+
+msgid "Knowledge Base"
+msgstr ""
+
+msgid "Contact us"
+msgstr ""
+
+msgid "Support"
+msgstr ""
+
+msgid "Services"
+msgstr ""
+
+msgid "Emails"
+msgstr ""
+
+msgid "Payment history"
+msgstr ""
+
+msgid "Name"
+msgstr ""
+
+msgid "Email"
+msgstr ""
+
+msgid "Send"
+msgstr ""
+
+msgid "Affiliate statistics"
+msgstr ""
+
+msgid "#"
+msgstr ""
+
+msgid "Date"
+msgstr ""
+
+msgid "by "
+msgstr ""
+
+msgid "Configure"
+msgstr ""
+
+msgid "The product/service you have chosen has the following configuration options for you to choose from."
+msgstr ""
+
+msgid "Payments history"
+msgstr ""
+
+msgid "Here you can track your payments you have made and what you have been charged for"
+msgstr ""
+
+msgid "Description"
+msgstr ""
+
+msgid "Add Funds"
+msgstr ""
+
+msgid "Balance"
+msgstr ""
+
+msgid "Add funds in advance"
+msgstr ""
+
+msgid "You can add funds to your account if you have active order."
+msgstr ""
+
+msgid "Add funds"
+msgstr ""
+
+msgid "Similiar articles"
+msgstr ""
+
+msgid "Knowledge base categories"
+msgstr ""
+
+msgid "Terms and Conditions"
+msgstr ""
+
+msgid "Ticket ID"
+msgstr ""
+
+msgid "Time opened"
+msgstr ""
+
+msgid "Related to"
+msgstr ""
+
+msgid "Service #"
+msgstr ""
+
+msgid "Tickets list"
+msgstr ""
+
+msgid "Close ticket"
+msgstr ""
+
+msgid "Manage hosting account"
+msgstr ""
+
+msgid "Domain"
+msgstr ""
+
+msgid "Server IP"
+msgstr ""
+
+msgid "Server Hostname"
+msgstr ""
+
+msgid "Hosting plan"
+msgstr ""
+
+msgid "per month"
+msgstr ""
+
+msgid "Disk quota"
+msgstr ""
+
+msgid "Manage domain"
+msgstr ""
+
+msgid "Jump to cPanel"
+msgstr ""
+
+msgid "Reseller control panel"
+msgstr ""
+
+msgid "Nameservers"
+msgstr ""
+
+msgid "Nameserver 1"
+msgstr ""
+
+msgid "Nameserver 2"
+msgstr ""
+
+msgid "Nameserver 3"
+msgstr ""
+
+msgid "Nameserver 4"
+msgstr ""
+
+msgid "FTP details"
+msgstr ""
+
+msgid "Use these details to connect to your FTP account."
+msgstr ""
+
+msgid "FTP IP"
+msgstr ""
+
+msgid "FTP Username"
+msgstr ""
+
+msgid "FTP Password"
+msgstr ""
+
+msgid "Change account password"
+msgstr ""
+
+msgid "Change your FTP cPanel SSH password."
+msgstr ""
+
+msgid "Password Confirm"
+msgstr ""
+
+msgid "Change username"
+msgstr ""
+
+msgid "Change domain"
+msgstr ""
+
+msgid "Vps hostname"
+msgstr ""
+
+msgid "Enter hostname for VPS: mydomain.com"
+msgstr ""
+
+msgid "OS template"
+msgstr ""
+
+msgid "Become Partner"
+msgstr ""
+
+msgid "Login and become partner"
+msgstr ""
+
+msgid "Manage profile"
+msgstr ""
+
+msgid "Allow to be listed in partners list"
+msgstr ""
+
+msgid "Your website where you sell BoxBilling licenses"
+msgstr ""
+
+msgid "URL to your logo"
+msgstr ""
+
+msgid "Update partner information"
+msgstr ""
+
+msgid "Public profile"
+msgstr ""
+
+msgid "Purchase License"
+msgstr ""
+
+msgid "License key"
+msgstr ""
+
+msgid "Valid IPs"
+msgstr ""
+
+msgid "Valid hostnames"
+msgstr ""
+
+msgid "Valid versions"
+msgstr ""
+
+msgid "Valid install paths"
+msgstr ""
+
+msgid "Profile details"
+msgstr ""
+
+msgid "Keep your profile up to date"
+msgstr ""
+
+msgid "Change Password"
+msgstr ""
+
+msgid "Gravatar"
+msgstr ""
+
+msgid "Currency"
+msgstr ""
+
+msgid "API"
+msgstr ""
+
+msgid "Update profile"
+msgstr ""
+
+msgid "Company Name"
+msgstr ""
+
+msgid "Phone Country Code"
+msgstr ""
+
+msgid "Phone Number"
+msgstr ""
+
+msgid "Address"
+msgstr ""
+
+msgid "Address 2"
+msgstr ""
+
+msgid "City"
+msgstr ""
+
+msgid "Country"
+msgstr ""
+
+msgid "Zip/Postal Code"
+msgstr ""
+
+msgid "API key"
+msgstr ""
+
+msgid "API key allows integration with external applications. You will need this key for authentication."
+msgstr ""
+
+msgid "Warning! Resetting the key will break existing applications using it."
+msgstr ""
+
+msgid "Your API key"
+msgstr ""
+
+msgid "Reset key"
+msgstr ""
+
+msgid "Please register with"
+msgstr ""
+
+msgid "at "
+msgstr ""
+
+msgid "to change your profile image. Gravatar image updates may not appear immediately."
+msgstr ""
+
+msgid "Your profile currency is"
+msgstr ""
+
+msgid "Create new client profile if you want to manage your money in other currency"
+msgstr ""
+
+msgid "Your profile currency will be defined after your first order. Once your currency is set, all your profile accounting will be managed in that currency and can not be changed."
+msgstr ""
+
+msgid "Addons & extras"
+msgstr ""
+
+msgid "Domain management"
+msgstr ""
+
+msgid "Domain details"
+msgstr ""
+
+msgid "Registration date"
+msgstr ""
+
+msgid "Expires at"
+msgstr ""
+
+msgid "Domain Secret"
+msgstr ""
+
+msgid "All domain names (except a .EU, .UK domain name) have a Domain (Transfer) Secret Key/Authorization Code (EPP Code) associated with them. This would be required if you want to transfer service."
+msgstr ""
+
+msgid "Get EPP code"
+msgstr ""
+
+msgid "Domain Protection"
+msgstr ""
+
+msgid "Domain locking is a security enhancement to prevent unauthorized transfers of your domain to another registrar or web host by \"locking\" your domain name servers."
+msgstr ""
+
+msgid "Unlock"
+msgstr ""
+
+msgid "Lock"
+msgstr ""
+
+msgid "Domain Privacy Settings"
+msgstr ""
+
+msgid "If you would like to hide domain contact information which is shown on WHOIS you can enable privacy protection. Once domain privacy protection is enabled no one will know who registered this service. And once you decide to disable privacy protection, information that is listed above on \"Update Domain Contact Details\" section will be seen on domain WHOIS again."
+msgstr ""
+
+msgid "Disable Privacy protection"
+msgstr ""
+
+msgid "Enable Privacy protection"
+msgstr ""
+
+msgid "Domain Nameservers"
+msgstr ""
+
+msgid "If you would like to host this domain with another company you can update nameservers."
+msgstr ""
+
+msgid "Update nameservers"
+msgstr ""
+
+msgid "Update"
+msgstr ""
+
+msgid "Domain Contact Details"
+msgstr ""
+
+msgid "Domain contact details will be displayed once someone will check WHOIS output (which is public) of your service. This will update Technical, Billing and Admin contacts for this service. You can enable domain privacy protection if you want to hide your public WHOIS information."
+msgstr ""
+
+msgid "Update domain contact details"
+msgstr ""
+
+msgid "Address Line 1"
+msgstr ""
+
+msgid "Address Line 2"
+msgstr ""
+
+msgid "Zip"
+msgstr ""
+
+msgid "Phone number"
+msgstr ""
+
+msgid "How to reset my password?"
+msgstr ""
+
+msgid "Enter your email to reset password. You will receive new password after reset link is confirmed."
+msgstr ""
+
+msgid "Password reset confirmation email was sent"
+msgstr ""
+
+msgid "License details"
+msgstr ""
+
+msgid "Key"
+msgstr ""
+
+msgid "All ips"
+msgstr ""
+
+msgid "Valid Domains"
+msgstr ""
+
+msgid "All hosts"
+msgstr ""
+
+msgid "Valid Versions"
+msgstr ""
+
+msgid "All versions"
+msgstr ""
+
+msgid "Valid Install paths"
+msgstr ""
+
+msgid "All paths"
+msgstr ""
+
+msgid "Reset license"
+msgstr ""
+
+msgid "You can reset your license parameters if you have changed your server"
+msgstr ""
+
+msgid "Ticket details"
+msgstr ""
+
+msgid "Author"
+msgstr ""
+
+msgid "Please configure domain for your hosting account"
+msgstr ""
+
+msgid "Use own"
+msgstr ""
+
+msgid "Transfer"
+msgstr ""
+
+msgid "I will use my existing domain and update nameservers"
+msgstr ""
+
+msgid "Enter your domain name"
+msgstr ""
+
+msgid "Register a new domain"
+msgstr ""
+
+msgid "Check"
+msgstr ""
+
+msgid "Transfer your domain from another registrar"
+msgstr ""
+
+msgid "Transfer price"
+msgstr ""
+
+msgid "Enter domain transfer code"
+msgstr ""
+
+msgid " Year/s @ "
+msgstr ""
+
+msgid "My Products & Services"
+msgstr ""
+
+msgid "Ordered Services"
+msgstr ""
+
+msgid "Product/Service"
+msgstr ""
+
+msgid "Next due date"
+msgstr ""
+
+msgid "Service details"
+msgstr ""
+
+msgid "All information about your service"
+msgstr ""
+
+msgid "Product name"
+msgstr ""
+
+msgid "Payment amount"
+msgstr ""
+
+msgid "Billing cycle"
+msgstr ""
+
+msgid "Order status"
+msgstr ""
+
+msgid "Order created"
+msgstr ""
+
+msgid "Activated at"
+msgstr ""
+
+msgid "Renewal date"
+msgstr ""
+
+msgid "Order notes"
+msgstr ""
+
+msgid "Active support tickets"
+msgstr ""
+
+msgid "Renew now"
+msgstr ""
+
+msgid "Request Upgrade"
+msgstr ""
+
+msgid "Open ticket"
+msgstr ""
+
+msgid "Cancel"
+msgstr ""
+
+msgid "Request Cancellation"
+msgstr ""
+
+msgid "I would like to cancel"
+msgstr ""
+
+msgid "Reason"
+msgstr ""
+
+msgid "Open new support ticket regarding this order"
+msgstr ""
+
+msgid "Submit new support ticket. Ticket will be visible in support section after submission"
+msgstr ""
+
+msgid "Request upgrade"
+msgstr ""
+
+msgid "I would like to upgrade"
+msgstr ""
+
+msgid "Upgrade to"
+msgstr ""
+
+msgid "Notes"
+msgstr ""
+
+msgid "Request"
+msgstr ""
+
+msgid "Addons you have ordered with this service"
+msgstr ""
+
+msgid "Billing Cycle"
+msgstr ""
+
+msgid "Back to services"
+msgstr ""
+
+msgid "Error"
+msgstr ""
+
+msgid "Select Product"
+msgstr ""
+
+msgid "Choose products we offer for selling"
+msgstr ""
+
+msgid "Starting from:"
+msgstr ""
+
+msgid "View products"
+msgstr ""
+
+msgid "Select product"
+msgstr ""
+
+msgid "Confirm"
+msgstr ""
+
+msgid "What are you looking for?"
+msgstr ""
+
+msgid "Search"
+msgstr ""
+
+msgid "Try using other keyword. No matches not for keyword:"
+msgstr ""
+
+msgid "Affiliates"
+msgstr ""
+
+msgid "Client Area"
+msgstr ""
+
+msgid "Tickets waiting your reply"
+msgstr ""
+
+msgid "ID"
+msgstr ""
+
+msgid "All Invoices"
+msgstr ""
+
+msgid "Active"
+msgstr ""
+
+msgid "Soon expires"
+msgstr ""
+
+msgid "All services"
+msgstr ""
+
+msgid "New order"
+msgstr ""
+
+msgid "Tickets"
+msgstr ""
+
+msgid "Open"
+msgstr ""
+
+msgid "On Hold"
+msgstr ""
+
+msgid "All tickets"
+msgstr ""
+
+msgid "New ticket"
+msgstr ""
+
+msgid "Recent orders"
+msgstr ""
+
+msgid "Recent emails"
+msgstr ""
+
+msgid "Order products and services"
+msgstr ""
+
+msgid "Become a member and manage services"
+msgstr ""
+
+msgid "Contact Us"
+msgstr ""
+
+msgid "Contact us for more information"
+msgstr ""
+
+msgid "Announcements"
+msgstr ""
+
+msgid "Latest news & announcements"
+msgstr ""
+
+msgid "Browse our KB for answers and FAQs"
+msgstr ""
+
+msgid "Invoicing Software"
+msgstr ""
+
+msgid "Powered by BoxBilling invoicing software"
+msgstr ""
+
+msgid "Example module"
+msgstr ""
+
+msgid "Example module title"
+msgstr ""
+
+msgid "See protected content"
+msgstr ""
+
+msgid "This content can be seen only if client is logged in"
+msgstr ""
+
+msgid "Your protected content"
+msgstr ""
+
+msgid "Register new domain"
+msgstr ""
+
+msgid "Transfer my domain"
+msgstr ""
+
+msgid "Check domain availability"
+msgstr ""
+
+msgid "Enter new domain name to register"
+msgstr ""
+
+msgid "I want to use my nameservers"
+msgstr ""
+
+msgid "Enter your domain name to transfer"
+msgstr ""
+
+msgid "Select currency"
+msgstr ""
+
+msgid "Emails we have sent you"
+msgstr ""
+
+msgid "Here you can track emails we have sent you"
+msgstr ""
+
+msgid "Email subject"
+msgstr ""
+
+msgid "Date sent"
+msgstr ""
+
+msgid "Could not connect to whois :server server"
+msgstr ""
+
+msgid "Error creating "
+msgstr ""
+
+msgid "Only active orders can be suspended"
+msgstr ""
+
+msgid "Can not cancel "
+msgstr ""
+
+msgid "Service "
+msgstr ""
+
+msgid "Can not remove hosting plan which has active accounts"
+msgstr ""
+
+msgid "Invoice item title is missing"
+msgstr ""
+
+msgid ":product setup"
+msgstr ""
+
+msgid "Could not activate proforma item. Order :id not found"
+msgstr ""
+
+msgid "Filename is missing in product config."
+msgstr ""
+
+msgid "Parameter :param does not exist"
+msgstr ""
+
+msgid "Theme was not found in path :path"
+msgstr ""
+
+msgid "Theme manifest file :file was not found"
+msgstr ""
+
+msgid "Unable to decode theme manifest file :file"
+msgstr ""
+
+msgid "Please check if you have configured FTP layer properly in Configuration > General settings > FTP layer."
+msgstr ""
+
+msgid "Please make sure that FTP Root is defined properly. Could not find bb-config.php file in :path"
+msgstr ""
+
+msgid "You have reached free version limit. Upgrade to PRO version of BoxBilling if you want this limit removed."
+msgstr ""
+
+msgid "BoxBilling license key must be defined in bb-config.php file as BB_LICENSE constant."
+msgstr ""
+
+msgid "PHP curl extension is disabled on your server. Please enable php curl extension."
+msgstr ""
+
+msgid "Can not remove group with clients"
+msgstr ""
+
+msgid "Could not find main domain product"
+msgstr ""
+
+msgid "Hosting product must have domain configuration"
+msgstr ""
+
+msgid "Domain action is missing"
+msgstr ""
+
+msgid "Hosting product must have defined register_sld parameter"
+msgstr ""
+
+msgid "Hosting product must have defined register_tld parameter"
+msgstr ""
+
+msgid "Hosting product must have defined transfer_sld parameter"
+msgstr ""
+
+msgid "Hosting product must have defined transfer_tld parameter"
+msgstr ""
+
+msgid "Can not remove category which has articles"
+msgstr ""
+
+msgid "Hosting product is not configured completely. Configure server for hosting product."
+msgstr ""
+
+msgid "Hosting product is not configured completely. Configure hosting plan for hosting product."
+msgstr ""
+
+msgid "Domain name is not valid."
+msgstr ""
+
+msgid "Domain extension is not valid."
+msgstr ""
+
+msgid "Server from order configuration was not found"
+msgstr ""
+
+msgid "Hosting plan from order configuration was not found"
+msgstr ""
+
+msgid "Could not activate order. Service was not created"
+msgstr ""
+
+msgid "Order :id has no active service"
+msgstr ""
+
+msgid "Account password is missing or is not valid"
+msgstr ""
+
+msgid "Account ip is missing or is not valid"
+msgstr ""
+
+msgid "Domain sld or tld is missing"
+msgstr ""
+
+msgid "Can not refund invoice with negative amount"
+msgstr ""
+
+msgid "You must have at least one active order before you can add funds so you cannot proceed at the current time!"
+msgstr ""
+
+msgid "Amount is not valid"
+msgstr ""
+
+msgid "Payment for invoice :serie:id [:title]"
+msgstr ""
+
+msgid "Payment for invoice :serie:id"
+msgstr ""
+
+msgid "Can not remove invoice. It was paid but services were not activated"
+msgstr ""
+
+msgid "License plugin :plugin was not found"
+msgstr ""
+
+msgid "License plugin do not have generate method"
+msgstr ""
+
+msgid "Custom plugin method :method is forbidden"
+msgstr ""
+
+msgid "Plugin class file :file was not found"
+msgstr ""
+
+msgid "Plugin :plugin does not support action :action"
+msgstr ""
+
+msgid "Can not remove helpdesk which has tickets"
+msgstr ""
+
+msgid "Currency conversion rate can be zero"
+msgstr ""
+
+msgid "Can not remove default currency"
+msgstr ""
+
+msgid "This administrator account is protected and can not be removed"
+msgstr ""
+
+msgid ":product_title"
+msgstr ""
+
+msgid "Can not remove product category with products"
+msgstr ""
+
+msgid "Module :mod manifest file is missing"
+msgstr ""
+
+msgid "Module :mod manifest file is not valid. Check file syntax and permissions."
+msgstr ""
+
+msgid "BoxBilling module :module not found. Was it installed?"
+msgstr ""
+
+msgid "BoxBilling core modules can not be installed or removed"
+msgstr ""
+
+msgid "Module can not be installed. It requires at least :min version of BoxBilling. You are using :v"
+msgstr ""
+
+msgid "Could not retrieve version information for extension :ext"
+msgstr ""
+
+msgid "Latest :mod version installed. No need to update"
+msgstr ""
+
+msgid "Could not retrieve :ext information"
+msgstr ""
+
+msgid "Visit extension site for update information."
+msgstr ""
+
+msgid "BoxBilling core modules can not be managed"
+msgstr ""
+
+msgid "Could not extract extension zip file"
+msgstr ""
+
+msgid "Module already installed."
+msgstr ""
+
+msgid "Extension can not be moved. Make sure your server write permissions to bb-modules folder."
+msgstr ""
+
+msgid "Extension can not be moved. Make sure your server write permissions to bb-themes folder."
+msgstr ""
+
+msgid "Extension can not be moved. Make sure your server write permissions to bb-locale folder."
+msgstr ""
+
+msgid "Extension does not support auto-install deature. Extension must be installed manually"
+msgstr ""
+
+msgid "Unable to connect to BoxBilling extensiosn site."
+msgstr ""
+
+msgid "Administrators group can not be removed"
+msgstr ""
+
+msgid "Can not remove group which has staff members"
+msgstr ""
+
+msgid "This is a last message in topic. Remove topic in order to remove this message."
+msgstr ""
+
+msgid "Payment gateway :adapter was not found"
+msgstr ""
+
+msgid "Invalid payment adapter :adapter"
+msgstr ""
+
+msgid "Are you registering new domain or transfering existing? Action parameter missing."
+msgstr ""
+
+msgid "Invalid domain action."
+msgstr ""
+
+msgid "Order data must contain :field configuration field"
+msgstr ""
+
+msgid "Domain name :domain is not valid"
+msgstr ""
+
+msgid "Domain TLD is not valid."
+msgstr ""
+
+msgid "Domain name is required."
+msgstr ""
+
+msgid "Transfer domain type (tld) is required."
+msgstr ""
+
+msgid "Transfer domain name (sld) is required."
+msgstr ""
+
+msgid "Transfer code is required for domains transfers."
+msgstr ""
+
+msgid "TLD not found"
+msgstr ""
+
+msgid ":domain can not be transfered!"
+msgstr ""
+
+msgid "Domain registration tld parameter missing."
+msgstr ""
+
+msgid "Domain registration sld parameter missing."
+msgstr ""
+
+msgid "Years parameter is missing for domain configuration."
+msgstr ""
+
+msgid ":tld can be registered for at least :years years"
+msgstr ""
+
+msgid ":domain is already registered!"
+msgstr ""
+
+msgid "Default domain nameservers are not configured"
+msgstr ""
+
+msgid "Nameserver 1 is required"
+msgstr ""
+
+msgid "Nameserver 2 is required"
+msgstr ""
+
+msgid "Required field contact is missing"
+msgstr ""
+
+msgid "Required field :field is missing"
+msgstr ""
+
+msgid "Domain name is not valid"
+msgstr ""
+
+msgid "Domain can not be transfered"
+msgstr ""
+
+msgid "Domain can not be registered"
+msgstr ""
+
+msgid "Period parameter not passed"
+msgstr ""
+
+msgid "I'm afraid we are out of stock."
+msgstr ""
+
+msgid "Addon period parameter not passed"
+msgstr ""
+
+msgid "Product not found"
+msgstr ""
+
+msgid "Add products to cart before applying promo code"
+msgstr ""
+
+msgid "Currency can not be changed. Client already have invoices issued."
+msgstr ""
+
+msgid "Currency can not be changed. Client already have orders."
+msgstr ""
+
+msgid "Could not determine domain price. Domain action is missing"
+msgstr ""
+
+msgid "Unknown TLD. Could not determine registration price"
+msgstr ""
+
+msgid "Domain product can not be removed."
+msgstr ""
+
+msgid "Unknown transaction #:id type: :type"
+msgstr ""
+
+msgid "Could not determine transaction origin. Transaction payment gateway is unknown."
+msgstr ""
+
+msgid "Can not handle transaction received from unknown payment gateway: :id"
+msgstr ""
+
+msgid "Transaction :id is not associated with an invoice."
+msgstr ""
+
+msgid "Invoice #:id not found"
+msgstr ""
+
+msgid "Instant payment notification (IPN) did not pass gateway :id validation"
+msgstr ""
+
+msgid "Payment gateway :id method getTransaction should return Payment_Transaction object"
+msgstr ""
+
+msgid "Can not create subscription. Subscription id from payment gateway was not received"
+msgstr ""
+
+msgid "Subscription #:id was not found. Could not unsusbscribe"
+msgstr ""
+
+msgid "Only approved transaction can be processed"
+msgstr ""
+
+msgid "Transaction currency :code do not match required currency :required"
+msgstr ""
+
+msgid "Transaction status on payment gateway is Pending. Only Complete or Unknown transactions can be processed."
+msgstr ""
+
+msgid "Define clients currency before adding funds."
+msgstr ""
+
+msgid "Funds amount is not valid"
+msgstr ""
+
+msgid "Funds description is not valid"
+msgstr ""
+
+msgid "Client currency do not match invoice currency"
+msgstr ""
+
+msgid "Can not add negative amount to client balance for debit transaction"
+msgstr ""
+
+msgid "Conversion rate can't be 0"
+msgstr ""
+
+msgid "Product pricing could not be determined. "
+msgstr ""
+
+msgid "Repo class for product was not found"
+msgstr ""
+
+msgid "Unknown Period selected for setup price"
+msgstr ""
+
+msgid "Product :id payment type is recurrent, but period was not selected"
+msgstr ""
+
+msgid "Unknown Period selected for price"
+msgstr ""
+
+msgid "Can not remove product which has active orders."
+msgstr ""
+
+msgid "Invalid server manager. Server was not configured properly."
+msgstr ""
+
+msgid "Server manager :adapter is not valid"
+msgstr ""
+
+msgid "Can not remove server which has active accounts"
+msgstr ""
+
+msgid "Domain registrar :adapter was not found"
+msgstr ""
+
+msgid "Registrar :adapter was not found"
+msgstr ""
+
+msgid "Registrar adapter :adapter should extend Registrar_AdapterAbstract"
+msgstr ""
+
+msgid "Can not remove registrar which has domains"
+msgstr ""
+
+msgid "Invalid identity"
+msgstr ""
+
+msgid ":module method toApiArray not found"
+msgstr ""
+
+msgid "Client api can not be invoked from guest or admin role"
+msgstr ""
+
+msgid "Invalid identity. Clear browser cookies"
+msgstr ""
+
+msgid "Method :method must contain underscore"
+msgstr ""
+
+msgid "BoxBilling module :mod is not installed/activated"
+msgstr ""
+
+msgid "Module api file :file is not available"
+msgstr ""
+
+msgid "Api class must be instance of Api_Abstract"
+msgstr ""
+
+msgid ":type API call :method does not exist in module :module"
+msgstr ""
+
+msgid "second"
+msgstr ""
+
+msgid "minute"
+msgstr ""
+
+msgid "hour"
+msgstr ""
+
+msgid "day"
+msgstr ""
+
+msgid "week"
+msgstr ""
+
+msgid "month"
+msgstr ""
+
+msgid "year"
+msgstr ""
+
+msgid "decade"
+msgstr ""
+
+msgid "Period Error. Unit :unit is not defined"
+msgstr ""
+
+msgid "Invalid period quantity :qty for unit :unit. Allowed range is from :from to :to"
+msgstr ""
+
+msgid "Every week"
+msgstr ""
+
+msgid "Every month"
+msgstr ""
+
+msgid "Every 3 months"
+msgstr ""
+
+msgid "Every 6 months"
+msgstr ""
+
+msgid "Every year"
+msgstr ""
+
+msgid "Every 2 years"
+msgstr ""
+
+msgid "Every 3 years"
+msgstr ""
+
+msgid "Every :number day"
+msgstr ""
+
+msgid "Every :number week(s)"
+msgstr ""
+
+msgid "Every :number months"
+msgstr ""
+
+msgid "Every :number years"
+msgstr ""
+
+msgid "Unit not defined"
+msgstr ""
+
+msgid "Can not determine months amount from unit"
+msgstr ""
+
+msgid "CURL extension is not enabled"
+msgstr ""
+
+msgid "Service class :class was not found in :path"
+msgstr ""
+
+msgid "Client controller class :class was not found in :path"
+msgstr ""
+
+msgid "Admin controller class :class was not found in :path"
+msgstr ""
+
+msgid "Core module can not be updated"
+msgstr ""
+
+msgid "FTP extension is not enabled in PHP. You will not be able to use automatic updates and other automation."
+msgstr ""
+
+msgid "The ftp PHP extension is not available"
+msgstr ""
+
+msgid "FTP hostname is required"
+msgstr ""
+
+msgid "FTP username is required"
+msgstr ""
+
+msgid "FTP password is required"
+msgstr ""
+
+msgid "Failed to connect to FTP Server :host : :port"
+msgstr ""
+
+msgid "FTP Username/Password incorrect for :usernmae"
+msgstr ""
+
+msgid "Resource is not a stream"
+msgstr ""
+
+msgid "Mode cannot be changed on existing streams"
+msgstr ""
+
+msgid ":stream cannot be opened with mode :mode"
+msgstr ""
+
+msgid "Unable to write to stream"
+msgstr ""
+
+msgid ":module method getSearchQuery not found"
+msgstr ""
+
+msgid "Invalid :module method getSearchQuery return"
+msgstr ""
+
+msgid "Page :url not found"
+msgstr ""
+
+msgid "Page not found"
+msgstr ""
+
+msgid "File :file does not exist"
+msgstr ""
+
+msgid "Invalid zip file"
+msgstr ""
+
+msgid "Zip extraction failed"
+msgstr ""
+
+msgid "Unknown mail transport: :transport"
+msgstr ""
+
+msgid "SMTP host not configured"
+msgstr ""
+
+msgid "SMTP port not configured"
+msgstr ""
+
+msgid "SMTP hostname is not configured."
+msgstr ""
+
+msgid "Missing log message"
+msgstr ""
+
+msgid "Bad log priority"
+msgstr ""
+
+msgid "Email is not valid"
+msgstr ""
+
+msgid "Password too short!"
+msgstr ""
+
+msgid "Password must include at least one number!"
+msgstr ""
+
+msgid "Password must include at least one letter!"
+msgstr ""
+
+msgid "Clients logins history"
+msgstr ""
+
+msgid "Client"
+msgstr ""
+
+msgid "IP"
+msgstr ""
+
+msgid "Number"
+msgstr ""
+
+msgid "Created at"
+msgstr ""
+
+msgid "Due at"
+msgstr ""
+
+msgid "Reminded at"
+msgstr ""
+
+msgid "Approved"
+msgstr ""
+
+msgid "Serie and number"
+msgstr ""
+
+msgid "Tax"
+msgstr ""
+
+msgid "Text before invoice items table"
+msgstr ""
+
+msgid "Text after invoice items table"
+msgstr ""
+
+msgid "Company VAT"
+msgstr ""
+
+msgid "Company Number"
+msgstr ""
+
+msgid "Phone"
+msgstr ""
+
+msgid "First name"
+msgstr ""
+
+msgid "Last name"
+msgstr ""
+
+msgid "Invoice items"
+msgstr ""
+
+msgid "Droid Tweak settings"
+msgstr ""
+
+msgid "Configuration updated"
+msgstr ""
+
+msgid "Payment gateway"
+msgstr ""
+
+msgid "Default Help desk"
+msgstr ""
+
+msgid "Default Ticket subject"
+msgstr ""
+
+msgid "Default ticket subject"
+msgstr ""
+
+msgid "Ticket content"
+msgstr ""
+
+msgid "Filter transactions"
+msgstr ""
+
+msgid "ID on payment gateway"
+msgstr ""
+
+msgid "Invoice Id"
+msgstr ""
+
+msgid "Payment Gateway"
+msgstr ""
+
+msgid "Received at"
+msgstr ""
+
+msgid "Filter"
+msgstr ""
+
+msgid "Processed"
+msgstr ""
+
+msgid "System activity"
+msgstr ""
+
+msgid "Ip"
+msgstr ""
+
+msgid "Birthday"
+msgstr ""
+
+msgid "You are"
+msgstr ""
+
+msgid "Partners list"
+msgstr ""
+
+msgid "Configuration"
+msgstr ""
+
+msgid "Logo"
+msgstr ""
+
+msgid "Sales"
+msgstr ""
+
+msgid "Signup Date"
+msgstr ""
+
+msgid "Global partners limits and settings"
+msgstr ""
+
+msgid "Default product which partners are reselling."
+msgstr ""
+
+msgid "Default order limit for partner per day. Used to prevent API abuse"
+msgstr ""
+
+msgid "Optional rules for becoming partner"
+msgstr ""
+
+msgid "Product which must be ordered before becoming partner"
+msgstr ""
+
+msgid "Check partners balance before creating new order for available amount"
+msgstr ""
+
+msgid "How much money must be on clients balance to become a partner"
+msgstr ""
+
+msgid "License settings"
+msgstr ""
+
+msgid "Prefix"
+msgstr ""
+
+msgid "Length"
+msgstr ""
+
+msgid "Plugin"
+msgstr ""
+
+msgid "Validate IP"
+msgstr ""
+
+msgid "Validate Hostname"
+msgstr ""
+
+msgid "Validate Version"
+msgstr ""
+
+msgid "Validate Path"
+msgstr ""
+
+msgid "License plugins"
+msgstr ""
+
+msgid "BoxBilling gives you ability to provide your own license generation script. Follow instructions bellow to install new license plugin"
+msgstr ""
+
+msgid "License plugin is PHP class \"License_PluginName\" with one method"
+msgstr ""
+
+msgid "Take a look at default plugin at"
+msgstr ""
+
+msgid "Create your plugin and place it to"
+msgstr ""
+
+msgid "BoxBilling will automatically detect new plugin"
+msgstr ""
+
+msgid "Read"
+msgstr ""
+
+msgid "BoxBilling documentation"
+msgstr ""
+
+msgid "for more information."
+msgstr ""
+
+msgid "Import existing"
+msgstr ""
+
+msgid "Domain name"
+msgstr ""
+
+msgid "Domain TLD"
+msgstr ""
+
+msgid "News and announcements"
+msgstr ""
+
+msgid "New announcement"
+msgstr ""
+
+msgid "Draft"
+msgstr ""
+
+msgid "Content"
+msgstr ""
+
+msgid "Create"
+msgstr ""
+
+msgid "Email templates"
+msgstr ""
+
+msgid "New template"
+msgstr ""
+
+msgid "Email settings"
+msgstr ""
+
+msgid "Code"
+msgstr ""
+
+msgid "Enabled"
+msgstr ""
+
+msgid "The list is empty. Depending on modules enabled email templates will be inserted after first event occurrence."
+msgstr ""
+
+msgid "Configure email options"
+msgstr ""
+
+msgid "BoxBilling sends emails using sendmail by default or you can configure your own SMTP server"
+msgstr ""
+
+msgid "Email transport"
+msgstr ""
+
+msgid "SendMail"
+msgstr ""
+
+msgid "SMTP"
+msgstr ""
+
+msgid "SMTP Hostname"
+msgstr ""
+
+msgid "SMTP Port"
+msgstr ""
+
+msgid "SMTP Username"
+msgstr ""
+
+msgid "SMTP Password"
+msgstr ""
+
+msgid "SMTP Security"
+msgstr ""
+
+msgid "Update email settings"
+msgstr ""
+
+msgid "Send test email to staff members"
+msgstr ""
+
+msgid "Where I can use new email template?"
+msgstr ""
+
+msgid "Newly created email templates can be used in custom event hooks."
+msgstr ""
+
+msgid "Category"
+msgstr ""
+
+msgid "Action code"
+msgstr ""
+
+msgid "Filter support tickets"
+msgstr ""
+
+msgid "Client ID"
+msgstr ""
+
+msgid "Order ID"
+msgstr ""
+
+msgid "Ticket subject"
+msgstr ""
+
+msgid "Ticket messages"
+msgstr ""
+
+msgid "Priority"
+msgstr ""
+
+msgid "Tickets waiting for staff reply"
+msgstr ""
+
+msgid "Tickets waiting for client reply"
+msgstr ""
+
+msgid "Solved tickets"
+msgstr ""
+
+msgid "New email"
+msgstr ""
+
+msgid "Last message"
+msgstr ""
+
+msgid "Open ticket for existing client"
+msgstr ""
+
+msgid "Start typing clients name, email or ID"
+msgstr ""
+
+msgid "Open public ticket for non client"
+msgstr ""
+
+msgid "Receivers name"
+msgstr ""
+
+msgid "John Smith"
+msgstr ""
+
+msgid "to@gmail.com"
+msgstr ""
+
+msgid "Features"
+msgstr ""
+
+msgid "Demo"
+msgstr ""
+
+msgid "Documentation"
+msgstr ""
+
+msgid "Forums"
+msgstr ""
+
+msgid "Earn money"
+msgstr ""
+
+msgid "Partners"
+msgstr ""
+
+msgid "My Account"
+msgstr ""
+
+msgid "Support Tickets"
+msgstr ""
+
+msgid "Logout"
+msgstr ""
+
+msgid "INFORMATION"
+msgstr ""
+
+msgid "Website statistic"
+msgstr ""
+
+msgid "Metric"
+msgstr ""
+
+msgid "Today"
+msgstr ""
+
+msgid "Yesterday"
+msgstr ""
+
+msgid "This month so far"
+msgstr ""
+
+msgid "Income"
+msgstr ""
+
+msgid "Clients"
+msgstr ""
+
+msgid "Orders"
+msgstr ""
+
+msgid "Latest orders"
+msgstr ""
+
+msgid "Product sales"
+msgstr ""
+
+msgid "No active orders available"
+msgstr ""
+
+msgid "Define date interval for graphs"
+msgstr ""
+
+msgid "Update graphs"
+msgstr ""
+
+msgid "Recent clients activity"
+msgstr ""
+
+msgid "Recent staff activity"
+msgstr ""
+
+msgid "Public tickets"
+msgstr ""
+
+msgid "Centova Cast"
+msgstr ""
+
+msgid "Centova Cast settings"
+msgstr ""
+
+msgid "Server URL"
+msgstr ""
+
+msgid "Register new server"
+msgstr ""
+
+msgid "Edit server"
+msgstr ""
+
+msgid "CentovaCast URL"
+msgstr ""
+
+msgid "IP Address"
+msgstr ""
+
+msgid "Administrator password"
+msgstr ""
+
+msgid "Register Centova Cast server"
+msgstr ""
+
+msgid "Server added"
+msgstr ""
+
+msgid "Add"
+msgstr ""
+
+msgid "Back to extensions"
+msgstr ""
+
+msgid "Create CentovaCast product"
+msgstr ""
+
+msgid "File information"
+msgstr ""
+
+msgid "Filename"
+msgstr ""
+
+msgid "Location"
+msgstr ""
+
+msgid "Downloads"
+msgstr ""
+
+msgid "Upload new file for this order"
+msgstr ""
+
+msgid "Use this function to update existing order file. Client will be able to download new file from client area"
+msgstr ""
+
+msgid "Upload new file"
+msgstr ""
+
+msgid "Upload"
+msgstr ""
+
+msgid "Top level domains"
+msgstr ""
+
+msgid "New top level domain"
+msgstr ""
+
+msgid "Registrars"
+msgstr ""
+
+msgid "New domain registrar"
+msgstr ""
+
+msgid "Manage TLDs"
+msgstr ""
+
+msgid "Setup domain pricing and allowed operations. Assign specific domain registrars for each Top Level Domain (TLD)"
+msgstr ""
+
+msgid "TLD"
+msgstr ""
+
+msgid "Registration"
+msgstr ""
+
+msgid "Renew"
+msgstr ""
+
+msgid "Operations"
+msgstr ""
+
+msgid "Registrar"
+msgstr ""
+
+msgid "Allow register:"
+msgstr ""
+
+msgid "Allow transfer:"
+msgstr ""
+
+msgid "Active:"
+msgstr ""
+
+msgid "Add new top level domain"
+msgstr ""
+
+msgid "Setup new TLD prices and properties"
+msgstr ""
+
+msgid "Tld"
+msgstr ""
+
+msgid "Registration price"
+msgstr ""
+
+msgid "Renewal price"
+msgstr ""
+
+msgid "Minimum years of registration"
+msgstr ""
+
+msgid "Allow registration"
+msgstr ""
+
+msgid "Allow transfer"
+msgstr ""
+
+msgid "Domain registrars"
+msgstr ""
+
+msgid "Manage domain registrars"
+msgstr ""
+
+msgid "Setup default nameservers that will be used for new domain registrations if client have not provided his own nameservers in order form"
+msgstr ""
+
+msgid "Adding new domain registrar"
+msgstr ""
+
+msgid "Follow instrunctions bellow to install new domain registrar."
+msgstr ""
+
+msgid "Check domain registrar you are looking for is available at"
+msgstr ""
+
+msgid "Download domain registrar file and place to"
+msgstr ""
+
+msgid "Reload this page to see newly detected domain registrar"
+msgstr ""
+
+msgid "Click on install button. Now you will be able to create top level domains with new domain registrar"
+msgstr ""
+
+msgid "For developers. Read"
+msgstr ""
+
+msgid "to learn how to create your own domain registrar."
+msgstr ""
+
+msgid "Install"
+msgstr ""
+
+msgid "All payment gateways installed"
+msgstr ""
+
+msgid "Subscription"
+msgstr ""
+
+msgid "Subscription details"
+msgstr ""
+
+msgid "Subscription ID on payment gateway"
+msgstr ""
+
+msgid "Updated at"
+msgstr ""
+
+msgid "Filter orders"
+msgstr ""
+
+msgid "Invoice option"
+msgstr ""
+
+msgid "Creation date"
+msgstr ""
+
+msgid "Pending setup"
+msgstr ""
+
+msgid "Supended"
+msgstr ""
+
+msgid "Max Addon domains"
+msgstr ""
+
+msgid "Max FTP accounts"
+msgstr ""
+
+msgid "Max SQL Databases"
+msgstr ""
+
+msgid "Max Email Accounts"
+msgstr ""
+
+msgid "Max Subdomains"
+msgstr ""
+
+msgid "Max Parked Domains"
+msgstr ""
+
+msgid "Server manager specific parameters"
+msgstr ""
+
+msgid "Update hosting plan"
+msgstr ""
+
+msgid "Hosting plan additional parameters"
+msgstr ""
+
+msgid "Depending on server manager used to setup hosting account you may require provide additional parameters. List of parameters server managers requires you can find on extensions page."
+msgstr ""
+
+msgid "Add new configuration field"
+msgstr ""
+
+msgid "Something went wrong here"
+msgstr ""
+
+msgid "Back to Dashboard"
+msgstr ""
+
+msgid "Get BoxBilling license"
+msgstr ""
+
+msgid "Newsletters"
+msgstr ""
+
+msgid "Create New"
+msgstr ""
+
+msgid "Articles"
+msgstr ""
+
+msgid "New article"
+msgstr ""
+
+msgid "New category"
+msgstr ""
+
+msgid "Manage categories"
+msgstr ""
+
+msgid "Category created"
+msgstr ""
+
+msgid "File manager"
+msgstr ""
+
+msgid "Full screen"
+msgstr ""
+
+msgid "Extensions"
+msgstr ""
+
+msgid "Update BoxBilling"
+msgstr ""
+
+msgid "Learn more about extensions"
+msgstr ""
+
+msgid "Hooks"
+msgstr ""
+
+msgid "Activate or deactivate extensions"
+msgstr ""
+
+msgid "Extension"
+msgstr ""
+
+msgid "Deactivate"
+msgstr ""
+
+msgid "Module settings"
+msgstr ""
+
+msgid "Hook"
+msgstr ""
+
+msgid "Automatic update"
+msgstr ""
+
+msgid "Automatic updater is a tool to update BoxBilling to latest version in one click. Works on these hosting environments where PHP has permissions to overwrite files uploaded via FTP."
+msgstr ""
+
+msgid "Manual update"
+msgstr ""
+
+msgid "Manual update is a solution when auto updater can not work on current installation environment"
+msgstr ""
+
+msgid "Extending BoxBilling"
+msgstr ""
+
+msgid "BoxBilling gives developers all the capabilities to customize, integrate & extend the core system into your own website & applications."
+msgstr ""
+
+msgid "Submited"
+msgstr ""
+
+msgid "Manage services"
+msgstr ""
+
+msgid "Search:"
+msgstr ""
+
+msgid "Enter search text.."
+msgstr ""
+
+msgid "Centova Cast product settings"
+msgstr ""
+
+msgid "Server"
+msgstr ""
+
+msgid "Template"
+msgstr ""
+
+msgid "Max clients"
+msgstr ""
+
+msgid "Max bitrate"
+msgstr ""
+
+msgid "Transfer limit"
+msgstr ""
+
+msgid "Autostart"
+msgstr ""
+
+msgid "Products"
+msgstr ""
+
+msgid "New product"
+msgstr ""
+
+msgid "Update priority"
+msgstr ""
+
+msgid "Icon URL"
+msgstr ""
+
+msgid "Queues"
+msgstr ""
+
+msgid "Created"
+msgstr ""
+
+msgid "The list is empty."
+msgstr ""
+
+msgid "Order management"
+msgstr ""
+
+msgid "Edit order"
+msgstr ""
+
+msgid "Service management"
+msgstr ""
+
+msgid "Addons"
+msgstr ""
+
+msgid "History"
+msgstr ""
+
+msgid "Order group ID"
+msgstr ""
+
+msgid "Order promo code"
+msgstr ""
+
+msgid "Reason of suspendation"
+msgstr ""
+
+msgid "Suspendation reason"
+msgstr ""
+
+msgid "Reason of cancelation"
+msgstr ""
+
+msgid "Cancelation reason"
+msgstr ""
+
+msgid "Changes status without performing action"
+msgstr ""
+
+msgid "Order invoices"
+msgstr ""
+
+msgid "Issued at"
+msgstr ""
+
+msgid "Order status change history"
+msgstr ""
+
+msgid "Note"
+msgstr ""
+
+msgid "Support tickets regarding this order"
+msgstr ""
+
+msgid "Server Name"
+msgstr ""
+
+msgid "Account IP"
+msgstr ""
+
+msgid "Change hosting plan"
+msgstr ""
+
+msgid "Hosting plan changed"
+msgstr ""
+
+msgid "New hosting plan"
+msgstr ""
+
+msgid "Account password changed"
+msgstr ""
+
+msgid "Change IP"
+msgstr ""
+
+msgid "Account IP changed"
+msgstr ""
+
+msgid "Account username changed"
+msgstr ""
+
+msgid "Account domain changed"
+msgstr ""
+
+msgid "Client area languages"
+msgstr ""
+
+msgid "New language"
+msgstr ""
+
+msgid "Language"
+msgstr ""
+
+msgid "BoxBilling in your language"
+msgstr ""
+
+msgid "Although BoxBilling displays in U.S. English by default, the software has the built-in capability to be used in any language. Follow instructions bellow to install new language."
+msgstr ""
+
+msgid "Check if your language translation file is available at"
+msgstr ""
+
+msgid "BoxBilling extensions site"
+msgstr ""
+
+msgid "Download language files and place them to"
+msgstr ""
+
+msgid "Language will be automatically available and can be changed in client area"
+msgstr ""
+
+msgid "Installing BoxBilling in Your Language"
+msgstr ""
+
+msgid "to learn how to install files that will transform BoxBilling so it displays in your language."
+msgstr ""
+
+msgid "Translations can be made with"
+msgstr ""
+
+msgid "software"
+msgstr ""
+
+msgid "Changing default language"
+msgstr ""
+
+msgid "Default language can be set in"
+msgstr ""
+
+msgid "Removing language"
+msgstr ""
+
+msgid "Removing languages from BoxBilling is really simple. Just delete language folder you wish from"
+msgstr ""
+
+msgid "Settings"
+msgstr ""
+
+msgid "Info"
+msgstr ""
+
+msgid "BoxBilling version settings"
+msgstr ""
+
+msgid "Version"
+msgstr ""
+
+msgid "Size"
+msgstr ""
+
+msgid "Release date"
+msgstr ""
+
+msgid "Download latest"
+msgstr ""
+
+msgid "Download latest update"
+msgstr ""
+
+msgid "Staff members logins history"
+msgstr ""
+
+msgid "Admin"
+msgstr ""
+
+msgid "Filter clients"
+msgstr ""
+
+msgid "Group"
+msgstr ""
+
+msgid "All"
+msgstr ""
+
+msgid "Suspended"
+msgstr ""
+
+msgid "Canceled"
+msgstr ""
+
+msgid "New client"
+msgstr ""
+
+msgid "Groups"
+msgstr ""
+
+msgid "New group"
+msgstr ""
+
+msgid "Postcode"
+msgstr ""
+
+msgid "Your Balance"
+msgstr ""
+
+msgid "Ticket"
+msgstr ""
+
+msgid "Task"
+msgstr ""
+
+msgid "Client tickets"
+msgstr ""
+
+msgid "Total responses"
+msgstr ""
+
+msgid "Add note"
+msgstr ""
+
+msgid "Task status"
+msgstr ""
+
+msgid "Edit"
+msgstr ""
+
+msgid "management"
+msgstr ""
+
+msgid "Variables"
+msgstr ""
+
+msgid "Template Settings"
+msgstr ""
+
+msgid "Reset template"
+msgstr ""
+
+msgid "Examples"
+msgstr ""
+
+msgid "Manage email template"
+msgstr ""
+
+msgid "Most email templates receives parameters from BoxBilling. You can browse them on \"Variables\" tab. Copy variable name to email template and hit preview to see parsed content. Please note that values will be different when actual email is sent."
+msgstr ""
+
+msgid "Template updated"
+msgstr ""
+
+msgid "Preview"
+msgstr ""
+
+msgid "Template settings"
+msgstr ""
+
+msgid "Enable or disable this email template."
+msgstr ""
+
+msgid "List of variables used in this email"
+msgstr ""
+
+msgid "These values will change when real email is sent. You can pass these variables to admin or guest API to get additional information from database."
+msgstr ""
+
+msgid "Variable"
+msgstr ""
+
+msgid "Example value"
+msgstr ""
+
+msgid "This template does not receive any parameters"
+msgstr ""
+
+msgid "Reset email template to default"
+msgstr ""
+
+msgid "Reset to default"
+msgstr ""
+
+msgid "Email templates examples"
+msgstr ""
+
+msgid "Email template playground. Use this tool to try rendering email templates."
+msgstr ""
+
+msgid "Affiliate settings"
+msgstr ""
+
+msgid "Affiliate module settings"
+msgstr ""
+
+msgid "Offer your clients become affiliates of your services."
+msgstr ""
+
+msgid "Commission from order"
+msgstr ""
+
+msgid "Days from order activation to admit commission"
+msgstr ""
+
+msgid "Bonus amount for becoming affiliate in"
+msgstr ""
+
+msgid "Minimum withdraw amount."
+msgstr ""
+
+msgid "Redirect Url. Where is your client redirected after visiting refferal link"
+msgstr ""
+
+msgid "Email content"
+msgstr ""
+
+msgid "Email details"
+msgstr ""
+
+msgid "Sent emails"
+msgstr ""
+
+msgid "Subscriptions"
+msgstr ""
+
+msgid "New subscription"
+msgstr ""
+
+msgid "Create main administrator account"
+msgstr ""
+
+msgid "Enter your email address"
+msgstr ""
+
+msgid "Enter your password"
+msgstr ""
+
+msgid "Create administrator account"
+msgstr ""
+
+msgid "Remember me"
+msgstr ""
+
+msgid "Log me in"
+msgstr ""
+
+msgid "Create new order"
+msgstr ""
+
+msgid "for"
+msgstr ""
+
+msgid "Activate order"
+msgstr ""
+
+msgid "Place new order"
+msgstr ""
+
+msgid "BoxBilling members area"
+msgstr ""
+
+msgid "Registering as"
+msgstr ""
+
+msgid "Individual"
+msgstr ""
+
+msgid "Company registration number"
+msgstr ""
+
+msgid "Company VAT number"
+msgstr ""
+
+msgid "Tax rules"
+msgstr ""
+
+msgid "New tax rule"
+msgstr ""
+
+msgid "Tax settings"
+msgstr ""
+
+msgid "EU VAT"
+msgstr ""
+
+msgid "State/Region"
+msgstr ""
+
+msgid "Tax rate"
+msgstr ""
+
+msgid "Applies to any country"
+msgstr ""
+
+msgid "Applies to any state"
+msgstr ""
+
+msgid "Enable tax support"
+msgstr ""
+
+msgid "Automatic VAT Tax Rules Setup"
+msgstr ""
+
+msgid "If you would like BoxBilling to automatically setup the EU VAT tax rules for you for all EU Member States then simply enter your VAT Label & local VAT rate below and click the submit button. This action will delete any existing tax rules and configure the VAT rates for all EU countries."
+msgstr ""
+
+msgid "VAT Label"
+msgstr ""
+
+msgid "VAT rate"
+msgstr ""
+
+msgid "21"
+msgstr ""
+
+msgid "Create EU VAT Rules"
+msgstr ""
+
+msgid "Tax title"
+msgstr ""
+
+msgid "sales Tax"
+msgstr ""
+
+msgid "18"
+msgstr ""
+
+msgid "Leave empty to apply to all states"
+msgstr ""
+
+msgid "Profile updated"
+msgstr ""
+
+msgid "Listed in public"
+msgstr ""
+
+msgid "Partner status"
+msgstr ""
+
+msgid "Partner product"
+msgstr ""
+
+msgid "Override price"
+msgstr ""
+
+msgid "Logo URL"
+msgstr ""
+
+msgid "Website URL"
+msgstr ""
+
+msgid "Payment gateway configuration"
+msgstr ""
+
+msgid "Payment gateway title"
+msgstr ""
+
+msgid "Select which currencies can accept this payment gateway (Select none to allow all currencies)"
+msgstr ""
+
+msgid "Allow one time payments"
+msgstr ""
+
+msgid "Allow subscription payments"
+msgstr ""
+
+msgid "Enable test mode"
+msgstr ""
+
+msgid "IPN Callback URL"
+msgstr ""
+
+msgid "Go back"
+msgstr ""
+
+msgid "Send Email Message"
+msgstr ""
+
+msgid "Newsletter updated"
+msgstr ""
+
+msgid "From name"
+msgstr ""
+
+msgid "From email"
+msgstr ""
+
+msgid "Send message"
+msgstr ""
+
+msgid "Back to newsletters"
+msgstr ""
+
+msgid "Recipients filter. Select none to send message to all clients"
+msgstr ""
+
+msgid "Client status and group"
+msgstr ""
+
+msgid "Has order"
+msgstr ""
+
+msgid "Message content"
+msgstr ""
+
+msgid "Update and preview"
+msgstr ""
+
+msgid "Send test message"
+msgstr ""
+
+msgid "Send message to clients"
+msgstr ""
+
+msgid "Topics"
+msgstr ""
+
+msgid "New forum"
+msgstr ""
+
+msgid "Sticky"
+msgstr ""
+
+msgid "Locked"
+msgstr ""
+
+msgid "Sorting"
+msgstr ""
+
+msgid "Last ping"
+msgstr ""
+
+msgid "Valid IPs (one per line)"
+msgstr ""
+
+msgid "Validate host"
+msgstr ""
+
+msgid "Valid hosts (one per line)"
+msgstr ""
+
+msgid "Validate path"
+msgstr ""
+
+msgid "Valid paths (one per line)"
+msgstr ""
+
+msgid "Validate version"
+msgstr ""
+
+msgid "Valid versions (one per line)"
+msgstr ""
+
+msgid "Existing member"
+msgstr ""
+
+msgid "Payment gateways"
+msgstr ""
+
+msgid "New payment gateway"
+msgstr ""
+
+msgid "Allow subscriptions"
+msgstr ""
+
+msgid "Adding new payment gateway"
+msgstr ""
+
+msgid "Although BoxBilling ships with most popular payment gateways, you can install other gateways."
+msgstr ""
+
+msgid "Follow these instructions to install new payment gateway."
+msgstr ""
+
+msgid "Check for payment gateway at"
+msgstr ""
+
+msgid "for more payment gateways"
+msgstr ""
+
+msgid "Download payment gateway extension file and place it to"
+msgstr ""
+
+msgid "After file is uploaded in place, reload this page."
+msgstr ""
+
+msgid "Select uploaded file name and click on install."
+msgstr ""
+
+msgid "Payment gateway will be installed in BoxBilling and can be configured in \"Payment gateways\" tab."
+msgstr ""
+
+msgid "to learn how to create your own payment gateway and share it with community"
+msgstr ""
+
+msgid "Main website"
+msgstr ""
+
+msgid "Loading ..."
+msgstr ""
+
+msgid "Help"
+msgstr ""
+
+msgid "Pending approval amount"
+msgstr ""
+
+msgid "Total approved amount"
+msgstr ""
+
+msgid "Total paid amount"
+msgstr ""
+
+msgid "Balance amount"
+msgstr ""
+
+msgid "Total clicks"
+msgstr ""
+
+msgid "Unique clicks"
+msgstr ""
+
+msgid "Commisions"
+msgstr ""
+
+msgid "Invoices waiting for your payment"
+msgstr ""
+
+msgid "Paid invoices"
+msgstr ""
+
+msgid "Canned responses"
+msgstr ""
+
+msgid "New response"
+msgstr ""
+
+msgid "Categories"
+msgstr ""
+
+msgid "oAuth for BoxBilling"
+msgstr ""
+
+msgid "Google"
+msgstr ""
+
+msgid "Facebook"
+msgstr ""
+
+msgid "Github"
+msgstr ""
+
+msgid "Use third party logins"
+msgstr ""
+
+msgid "Google.com authorization settings"
+msgstr ""
+
+msgid "Enable Google login"
+msgstr ""
+
+msgid "Client secret"
+msgstr ""
+
+msgid "Instructions to create Google.com API access"
+msgstr ""
+
+msgid "Github.com authorization settings"
+msgstr ""
+
+msgid "Enable Github login"
+msgstr ""
+
+msgid "Client Secret"
+msgstr ""
+
+msgid "Instructions to register new oAuth application on Github"
+msgstr ""
+
+msgid "Facebook.com authorization settings"
+msgstr ""
+
+msgid "Enable Facebook login"
+msgstr ""
+
+msgid "App ID"
+msgstr ""
+
+msgid "Secret"
+msgstr ""
+
+msgid "Instructions to create Facebook application"
+msgstr ""
+
+msgid "BoxBilling live demo"
+msgstr ""
+
+msgid "Payments"
+msgstr ""
+
+msgid "Logins"
+msgstr ""
+
+msgid "Client profile details"
+msgstr ""
+
+msgid "Client Profile updated"
+msgstr ""
+
+msgid "Other/Unknown"
+msgstr ""
+
+msgid "Company details"
+msgstr ""
+
+msgid "Address and contact details"
+msgstr ""
+
+msgid "Additional settings"
+msgstr ""
+
+msgid "Alternative ID"
+msgstr ""
+
+msgid "Used to identify client on foreign system. Usually used by importers"
+msgstr ""
+
+msgid "Exempt from tax"
+msgstr ""
+
+msgid "Signed up time"
+msgstr ""
+
+msgid "Password changed"
+msgstr ""
+
+msgid "Custom fields"
+msgstr ""
+
+msgid "Use these fields to define custom client details"
+msgstr ""
+
+msgid "Client Profile custom fields updated"
+msgstr ""
+
+msgid "Custom field"
+msgstr ""
+
+msgid "Client payments history"
+msgstr ""
+
+msgid "Add funds for client"
+msgstr ""
+
+msgid "Funds added"
+msgstr ""
+
+msgid "Client orders"
+msgstr ""
+
+msgid "Client invoices"
+msgstr ""
+
+msgid "Client support tickets"
+msgstr ""
+
+msgid "Logins history"
+msgstr ""
+
+msgid "Emails sent to client"
+msgstr ""
+
+msgid "Download BoxBilling"
+msgstr ""
+
+msgid "Edit product addon"
+msgstr ""
+
+msgid "Activation"
+msgstr ""
+
+msgid "Icon"
+msgstr ""
+
+msgid "System settings"
+msgstr ""
+
+msgid "FTP layer"
+msgstr ""
+
+msgid "Scheduled tasks"
+msgstr ""
+
+msgid "License"
+msgstr ""
+
+msgid "Company number, chamber of commerce number"
+msgstr ""
+
+msgid "VAT number"
+msgstr ""
+
+msgid "Bank Account number"
+msgstr ""
+
+msgid "Signature"
+msgstr ""
+
+msgid "Update settings"
+msgstr ""
+
+msgid "Company terms of service, legal regulation"
+msgstr ""
+
+msgid "Company privacy policy"
+msgstr ""
+
+msgid "Orders settings"
+msgstr ""
+
+msgid "Expiration date"
+msgstr ""
+
+msgid "Invoice settings"
+msgstr ""
+
+msgid "Number of days to generate new invoice before order expiration"
+msgstr ""
+
+msgid "Invoice due days"
+msgstr ""
+
+msgid "Auto invoice approval"
+msgstr ""
+
+msgid "Proforma Invoicing / Sequential Invoice Numbering"
+msgstr ""
+
+msgid "Proforma invoice prefix/series"
+msgstr ""
+
+msgid "Paid invoice prefix/series"
+msgstr ""
+
+msgid "Next paid invoice number"
+msgstr ""
+
+msgid "Refunds settings"
+msgstr ""
+
+msgid "Refunds logic"
+msgstr ""
+
+msgid "Add funds settings"
+msgstr ""
+
+msgid "Minimum amount for add funds invoice"
+msgstr ""
+
+msgid "Unlimited"
+msgstr ""
+
+msgid "Maximum amount for add funds invoice"
+msgstr ""
+
+msgid "FTP layer for BoxBilling"
+msgstr ""
+
+msgid "FTP is used to manage BoxBilling modules and updates."
+msgstr ""
+
+msgid "FTP settings updated"
+msgstr ""
+
+msgid "FTP Hostname - can be a numerical URL 127.0.0.1 is the default address for a locally hosted server, it might be this, it might be the full URL as my example above with the File Transfer Protocol (FTP) prefix, it might be the http:// protocol it might be SFTP (secure FTP) even secure http (https). Your host will be able to advise you on the correct format."
+msgstr ""
+
+msgid "FTP port - is nearly always 21 unless the host has changed this they will have notified you of this. Secure FTP generally uses port 22."
+msgstr ""
+
+msgid "FTP user - In most cases, this is the specific user name your host has set up for you to access your Web site via FTP- It is the name you use in your FTP client. This could be an alphanumeric, it could be your name, even your e-mail address, If you don't know this speak to your host. You may have the facility on your Web account to set up additional FTP users if that is the case (and it's more secure) you are recommended to do this"
+msgstr ""
+
+msgid "FTP password - this is the password you enter in your FTP client."
+msgstr ""
+
+msgid "FTP root - This is generally the directory in which BoxBilling is installed. This setting is very important to be setup correctly as it very specifically depends on the Host server settings. In can be just / BUT it might be htdocs/boxbilling, public_html/, /public_html/boxbilling or other. It is a variable that BoxBilling has absolutely no control over. You will need to clarify this with your host."
+msgstr ""
+
+msgid "Setup scheduled tasks to be executed once a day"
+msgstr ""
+
+msgid "Scheduled tasks must be enabled immediately after installation. Cron is responsible for sending your clients reminder about payments, domain renewal notices and many more."
+msgstr ""
+
+msgid "Timezone"
+msgstr ""
+
+msgid "Time on server"
+msgstr ""
+
+msgid "Last time scheduled tasks were executed"
+msgstr ""
+
+msgid "Scheduled tasks were never executed"
+msgstr ""
+
+msgid "Unix crontab setup:"
+msgstr ""
+
+msgid "Execute scheduled tasks from browser"
+msgstr ""
+
+msgid "Execute now"
+msgstr ""
+
+msgid "After purchase you have received an e-mail with license key. Update license key to unlock all features of BoxBilling"
+msgstr ""
+
+msgid "To change license key, change BB_LICENSE value in bb-config.php file"
+msgstr ""
+
+msgid "Licensed to"
+msgstr ""
+
+msgid "New Addon"
+msgstr ""
+
+msgid "Disabled"
+msgstr ""
+
+msgid "After order is placed"
+msgstr ""
+
+msgid "After payment is received"
+msgstr ""
+
+msgid "Manual activation"
+msgstr ""
+
+msgid "Sell BoxBilling licenses"
+msgstr ""
+
+msgid "1. Configure API"
+msgstr ""
+
+msgid "Test connection"
+msgstr ""
+
+msgid "Update API key"
+msgstr ""
+
+msgid "2. Become partner"
+msgstr ""
+
+msgid "3. Create license product"
+msgstr ""
+
+msgid "Refer and earn recurring commission"
+msgstr ""
+
+msgid "Partners profile"
+msgstr ""
+
+msgid "Issue License"
+msgstr ""
+
+msgid "Manage licenses"
+msgstr ""
+
+msgid "Licenses you have issued"
+msgstr ""
+
+msgid "Reissue"
+msgstr ""
+
+msgid "Generate new API key"
+msgstr ""
+
+msgid "Centova Cast order details"
+msgstr ""
+
+msgid "Changing settings does not send actions to CentovaCast server."
+msgstr ""
+
+msgid "Reconfigure"
+msgstr ""
+
+msgid "Changing CentovaCast server settings."
+msgstr ""
+
+msgid "Port"
+msgstr ""
+
+msgid "Source password"
+msgstr ""
+
+msgid "Max BitRate"
+msgstr ""
+
+msgid "Organization"
+msgstr ""
+
+msgid "URL"
+msgstr ""
+
+msgid "Auto rebuild list"
+msgstr ""
+
+msgid "Account details"
+msgstr ""
+
+msgid "Parameter"
+msgstr ""
+
+msgid "Value"
+msgstr ""
+
+msgid "Mass Mail Messages"
+msgstr ""
+
+msgid "Create new mass mail message"
+msgstr ""
+
+msgid "Mass Mail Settings"
+msgstr ""
+
+msgid "Client ID to send test email while creating message"
+msgstr ""
+
+msgid "Hi,"
+msgstr ""
+
+msgid "New"
+msgstr ""
+
+msgid "Visit site"
+msgstr ""
+
+msgid "Notifications"
+msgstr ""
+
+msgid "Inquiries"
+msgstr ""
+
+msgid "Anouncements"
+msgstr ""
+
+msgid "Become a member and discuss in forums"
+msgstr ""
+
+msgid "Braunstein extension settings"
+msgstr ""
+
+msgid "Required fields for client"
+msgstr ""
+
+msgid "Select which fields are required to be filled up by client on signup form"
+msgstr ""
+
+msgid "Company name"
+msgstr ""
+
+msgid "Gender"
+msgstr ""
+
+msgid "Address details"
+msgstr ""
+
+msgid "Address line 1"
+msgstr ""
+
+msgid "Address line 2"
+msgstr ""
+
+msgid "Postcode/Zip"
+msgstr ""
+
+msgid "BoxBilling full feature list"
+msgstr ""
+
+msgid "Select Slots"
+msgstr ""
+
+msgid "Earnings"
+msgstr ""
+
+msgid "API Key"
+msgstr ""
+
+msgid "External application can control every aspect of BoxBilling using this API key."
+msgstr ""
+
+msgid "Generate new key"
+msgstr ""
+
+msgid "Change your avatar at"
+msgstr ""
+
+msgid "Enable/Disable"
+msgstr ""
+
+msgid "Server manager"
+msgstr ""
+
+msgid "Access Hash (Instead of password for cPanel servers)"
+msgstr ""
+
+msgid "Connection port"
+msgstr ""
+
+msgid "Use Secure connection"
+msgstr ""
+
+msgid "Update and test connection"
+msgstr ""
+
+msgid "Update server"
+msgstr ""
+
+msgid "Hosting plans and servers"
+msgstr ""
+
+msgid "New server"
+msgstr ""
+
+msgid "New server manager"
+msgstr ""
+
+msgid "Servers"
+msgstr ""
+
+msgid "Hosting plans"
+msgstr ""
+
+msgid "Addon domains"
+msgstr ""
+
+msgid "Unique name to identify this server"
+msgstr ""
+
+msgid "server1.yourserverdomain.com"
+msgstr ""
+
+msgid "Primary IP address of the server used to connect to it like: 123.123.123.123"
+msgstr ""
+
+msgid "Assigned IP Addresses"
+msgstr ""
+
+msgid "List the IP Addresses assigned to the server (One per line)"
+msgstr ""
+
+msgid "ns1.yourdomain.com"
+msgstr ""
+
+msgid "ns2.yourdomain.com"
+msgstr ""
+
+msgid "ns3.yourdomain.com"
+msgstr ""
+
+msgid "ns4.yourdomain.com"
+msgstr ""
+
+msgid "Login username to your server: root/reseller"
+msgstr ""
+
+msgid "Login password to your server"
+msgstr ""
+
+msgid "Access Hash (Insted of password for cPanel servers)"
+msgstr ""
+
+msgid "Add server"
+msgstr ""
+
+msgid "Adding new hosting plan"
+msgstr ""
+
+msgid "Depending on server manager used to setup hosting account you may require provide additional parameters in next step. In this step provide basic hosting plan information."
+msgstr ""
+
+msgid "Unique name to identify this hosting plan"
+msgstr ""
+
+msgid "Disk quota (MB)"
+msgstr ""
+
+msgid "Bandwidth (MB)"
+msgstr ""
+
+msgid "Create hosting plan"
+msgstr ""
+
+msgid "Adding new server manager"
+msgstr ""
+
+msgid "Follow these instructions to install new hosting server manager."
+msgstr ""
+
+msgid "Check for server manager extensions at"
+msgstr ""
+
+msgid "Download server manager extension file and place it to"
+msgstr ""
+
+msgid "Server manager gateway will be automatically detected."
+msgstr ""
+
+msgid "You can now create/edit servers with new server manager."
+msgstr ""
+
+msgid "to learn how to create your own server manager and share it with community"
+msgstr ""
+
+msgid "Client area themes"
+msgstr ""
+
+msgid "Admin area themes"
+msgstr ""
+
+msgid "New theme"
+msgstr ""
+
+msgid "Adding new client area theme"
+msgstr ""
+
+msgid "Follow these instructions to install new client area theme."
+msgstr ""
+
+msgid "Check for client area themes at"
+msgstr ""
+
+msgid "Upload new theme files to"
+msgstr ""
+
+msgid "and reload this page"
+msgstr ""
+
+msgid "Client area theme will appear in "Client area themes" tab. And you can select it as default"
+msgstr ""
+
+msgid "For theme designers. Read"
+msgstr ""
+
+msgid "to learn how to create your own theme"
+msgstr ""
+
+msgid "Adding new admin area theme"
+msgstr ""
+
+msgid "Admin area follows same logic as client area themes with one additional rule: admin theme directory must be prefixed with "admin_"."
+msgstr ""
+
+msgid "Support ticket"
+msgstr ""
+
+msgid "Staff member"
+msgstr ""
+
+msgid "Announcement"
+msgstr ""
+
+msgid "Knowledge base article"
+msgstr ""
+
+msgid "Forum topic"
+msgstr ""
+
+msgid "Filter invoices"
+msgstr ""
+
+msgid "Nr"
+msgstr ""
+
+msgid "All statuses"
+msgstr ""
+
+msgid "Refunded"
+msgstr ""
+
+msgid "Issue date"
+msgstr ""
+
+msgid "Unpaid invoices"
+msgstr ""
+
+msgid "Refunded invoices"
+msgstr ""
+
+msgid "New Invoice"
+msgstr ""
+
+msgid "Prepare"
+msgstr ""
+
+msgid "New note"
+msgstr ""
+
+msgid "Delete all messages"
+msgstr ""
+
+msgid "Add note or todo task"
+msgstr ""
+
+msgid "Transaction"
+msgstr ""
+
+msgid "IPN"
+msgstr ""
+
+msgid "Transaction details"
+msgstr ""
+
+msgid "If you are sure that this transaction is valid you can update transaction details in "Manage" tab and try processing transaction again"
+msgstr ""
+
+msgid "Transaction ID on payment gateway"
+msgstr ""
+
+msgid "Transaction status on payment gateway"
+msgstr ""
+
+msgid "Process"
+msgstr ""
+
+msgid "Invoice ID"
+msgstr ""
+
+msgid "Transaction processing information"
+msgstr ""
+
+msgid "Validate IPN"
+msgstr ""
+
+msgid "Transaction information on payment gateway"
+msgstr ""
+
+msgid "Transaction type"
+msgstr ""
+
+msgid "Transaction status on Payment Gateway"
+msgstr ""
+
+msgid "Transaction ID on Payment Gateway"
+msgstr ""
+
+msgid "Note about this transaction"
+msgstr ""
+
+msgid "GET"
+msgstr ""
+
+msgid "No GET parameters received"
+msgstr ""
+
+msgid "POST"
+msgstr ""
+
+msgid "No POST parameters received"
+msgstr ""
+
+msgid "SERVER"
+msgstr ""
+
+msgid "No SERVER parameters logged"
+msgstr ""
+
+msgid "BoxBilling forum"
+msgstr ""
+
+msgid "My favorite topics"
+msgstr ""
+
+msgid "Payment type"
+msgstr ""
+
+msgid "Setup price"
+msgstr ""
+
+msgid "One time"
+msgstr ""
+
+msgid "Price for period"
+msgstr ""
+
+msgid "First payment sum"
+msgstr ""
+
+msgid "On"
+msgstr ""
+
+msgid "Weekly"
+msgstr ""
+
+msgid "Monthly"
+msgstr ""
+
+msgid "General settings"
+msgstr ""
+
+msgid "Upgrades"
+msgstr ""
+
+msgid "Links"
+msgstr ""
+
+msgid "Custom order form"
+msgstr ""
+
+msgid "Hidden"
+msgstr ""
+
+msgid "Browse"
+msgstr ""
+
+msgid "Slug"
+msgstr ""
+
+msgid "Payment options"
+msgstr ""
+
+msgid "Product / service description"
+msgstr ""
+
+msgid "Choose which addons you would like to offer with"
+msgstr ""
+
+msgid "Choose which products can client upgrade to"
+msgstr ""
+
+msgid "Product Upgrades"
+msgstr ""
+
+msgid "No additional configuration for this product is required"
+msgstr ""
+
+msgid "Product links"
+msgstr ""
+
+msgid "Product ID"
+msgstr ""
+
+msgid "Order page with ID"
+msgstr ""
+
+msgid "Order page with slug"
+msgstr ""
+
+msgid "Select icon and click OK"
+msgstr ""
+
+msgid "Lock topic"
+msgstr ""
+
+msgid "Unlock topic"
+msgstr ""
+
+msgid "Hosting settings"
+msgstr ""
+
+msgid "Reseller hosting"
+msgstr ""
+
+msgid "Free domain registration"
+msgstr ""
+
+msgid "Free domain transfer"
+msgstr ""
+
+msgid "Pending approval"
+msgstr ""
+
+msgid "Clicks"
+msgstr ""
+
+msgid "Joined at"
+msgstr ""
+
+msgid "Parameter key is missing"
+msgstr ""
+
+msgid "_tpl parameter not passed"
+msgstr ""
+
+msgid "ID is required"
+msgstr ""
+
+msgid "Event not found"
+msgstr ""
+
+msgid "Order id is required"
+msgstr ""
+
+msgid "Centova Cast order not found"
+msgstr ""
+
+msgid "Order :id is not activated"
+msgstr ""
+
+msgid "CentovaCast product is not configured properly. Field :field is missing"
+msgstr ""
+
+msgid "Could not suspend order. Service was not created"
+msgstr ""
+
+msgid "Could not unsuspend order. Service was not created"
+msgstr ""
+
+msgid "Message from name can not be empty"
+msgstr ""
+
+msgid "Message subject not passed"
+msgstr ""
+
+msgid "Add some content before sending message"
+msgstr ""
+
+msgid "Client ID needs to be configured in mass mailer settings."
+msgstr ""
+
+msgid "Message id not passed"
+msgstr ""
+
+msgid "Message not found"
+msgstr ""
+
+msgid "Queue message id is missing"
+msgstr ""
+
+msgid "Queue message not found"
+msgstr ""
+
+msgid "Queue name not provided"
+msgstr ""
+
+msgid "Module name not provided"
+msgstr ""
+
+msgid "Message handler function :method does not exists"
+msgstr ""
+
+msgid "ID or slug is missing"
+msgstr ""
+
+msgid "News item not found"
+msgstr ""
+
+msgid "Post id not passed"
+msgstr ""
+
+msgid "Post not found"
+msgstr ""
+
+msgid "Post title not passed"
+msgstr ""
+
+msgid "Form title was not provided"
+msgstr ""
+
+msgid "Form id was not passed"
+msgstr ""
+
+msgid "Form is not valid"
+msgstr ""
+
+msgid "Form field type was not passed"
+msgstr ""
+
+msgid "Theme code is missing"
+msgstr ""
+
+msgid "You have latest version of BoxBilling. You do not need to update."
+msgstr ""
+
+msgid "Extension id was not passed"
+msgstr ""
+
+msgid "Extension type was not passed"
+msgstr ""
+
+msgid "Parameter ext was not passed"
+msgstr ""
+
+msgid "Extension not found"
+msgstr ""
+
+msgid "Can not change email. It is already registered."
+msgstr ""
+
+msgid "Password required"
+msgstr ""
+
+msgid "Password confiration required"
+msgstr ""
+
+msgid "Passwords do not match."
+msgstr ""
+
+msgid "Client ID or email is required"
+msgstr ""
+
+msgid "Client not found"
+msgstr ""
+
+msgid "ID required"
+msgstr ""
+
+msgid "Email required"
+msgstr ""
+
+msgid "First name is required"
+msgstr ""
+
+msgid "Email is already registered."
+msgstr ""
+
+msgid "Client id is missing"
+msgstr ""
+
+msgid "Id required"
+msgstr ""
+
+msgid "Client ID is required"
+msgstr ""
+
+msgid "Password confirmation required"
+msgstr ""
+
+msgid "Passwords do not match"
+msgstr ""
+
+msgid "Balance line not found"
+msgstr ""
+
+msgid "Amount is required"
+msgstr ""
+
+msgid "Description is required"
+msgstr ""
+
+msgid "Id not passed"
+msgstr ""
+
+msgid "Group title is missing"
+msgstr ""
+
+msgid "Group id is missing"
+msgstr ""
+
+msgid "Group not found"
+msgstr ""
+
+msgid "First name required"
+msgstr ""
+
+msgid "Email is already registered. You may want to login instead of registering."
+msgstr ""
+
+msgid "Please check your login details"
+msgstr ""
+
+msgid "Email not found in our database"
+msgstr ""
+
+msgid "Hash required"
+msgstr ""
+
+msgid "The link have expired or you have already confirmed password reset."
+msgstr ""
+
+msgid "Country code is required"
+msgstr ""
+
+msgid "Title is required"
+msgstr ""
+
+msgid "Type is required"
+msgstr ""
+
+msgid "Product Category Id is required"
+msgstr ""
+
+msgid "You have already created domain product."
+msgstr ""
+
+msgid "Pricing type is required"
+msgstr ""
+
+msgid "priority params is missing"
+msgstr ""
+
+msgid "Addon id is required"
+msgstr ""
+
+msgid "Addon not found"
+msgstr ""
+
+msgid "Category id is missing"
+msgstr ""
+
+msgid "Category not found"
+msgstr ""
+
+msgid "Category title is missing"
+msgstr ""
+
+msgid "Promo code is missing"
+msgstr ""
+
+msgid "Promo type is missing"
+msgstr ""
+
+msgid "Promo value is missing"
+msgstr ""
+
+msgid "Promo id is missing"
+msgstr ""
+
+msgid "Promo not found"
+msgstr ""
+
+msgid "Product id not passed"
+msgstr ""
+
+msgid "Product ID or slug is missing"
+msgstr ""
+
+msgid "Email ID is required"
+msgstr ""
+
+msgid "Email not found"
+msgstr ""
+
+msgid "Receiver Email is required"
+msgstr ""
+
+msgid "Receiver Name is required"
+msgstr ""
+
+msgid "Sender Name is required"
+msgstr ""
+
+msgid "Sender email is required"
+msgstr ""
+
+msgid "Email subject is required"
+msgstr ""
+
+msgid "Email content is required"
+msgstr ""
+
+msgid "Email template ID is required"
+msgstr ""
+
+msgid "Email template not found"
+msgstr ""
+
+msgid "Email template code is required"
+msgstr ""
+
+msgid "Email template subject is required"
+msgstr ""
+
+msgid "Email template content is required"
+msgstr ""
+
+msgid "Template code not passed"
+msgstr ""
+
+msgid "Receiver is not defined. Define to or to_client or to_staff parameter"
+msgstr ""
+
+msgid "Email template code was not passed"
+msgstr ""
+
+msgid "Email template :code was not found"
+msgstr ""
+
+msgid "Akismet detected this message is spam"
+msgstr ""
+
+msgid "To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"
+msgstr ""
+
+msgid "Captcha verification failed."
+msgstr ""
+
+msgid "Your Username is blacklisted in global database"
+msgstr ""
+
+msgid "Your Email is blacklisted in global database"
+msgstr ""
+
+msgid "Your IP is blacklisted in global database"
+msgstr ""
+
+msgid "path parameter is missing"
+msgstr ""
+
+msgid "Data parameter is missing"
+msgstr ""
+
+msgid "Path parameter is missing"
+msgstr ""
+
+msgid "Type parameter is missing"
+msgstr ""
+
+msgid "Unknow item type"
+msgstr ""
+
+msgid "To parameter is missing"
+msgstr ""
+
+msgid "File does not exist"
+msgstr ""
+
+msgid "Ticket id required"
+msgstr ""
+
+msgid "Ticket not found"
+msgstr ""
+
+msgid "Ticket content required"
+msgstr ""
+
+msgid "Ticket subject required"
+msgstr ""
+
+msgid "Ticket support_helpdesk_id required"
+msgstr ""
+
+msgid "Helpdesk invalid"
+msgstr ""
+
+msgid "We have already received this request."
+msgstr ""
+
+msgid "Ticket ID required"
+msgstr ""
+
+msgid "Ticket can not be reopened."
+msgstr ""
+
+msgid "Ticket id is missing"
+msgstr ""
+
+msgid "Ticket message id is missing"
+msgstr ""
+
+msgid "Ticket message content is missing"
+msgstr ""
+
+msgid "Ticket message not found"
+msgstr ""
+
+msgid "Client name parameter is missing"
+msgstr ""
+
+msgid "Client email parameter is missing"
+msgstr ""
+
+msgid "Subject parameter is missing"
+msgstr ""
+
+msgid "Ticket message is missing"
+msgstr ""
+
+msgid "Help desk id is missing"
+msgstr ""
+
+msgid "Help desk not found"
+msgstr ""
+
+msgid "Help desk title is missing"
+msgstr ""
+
+msgid "Canned reply id is missing"
+msgstr ""
+
+msgid "Canned reply not found"
+msgstr ""
+
+msgid "Canned reply title is missing"
+msgstr ""
+
+msgid "Canned reply category id is missing"
+msgstr ""
+
+msgid "Canned category id is missing"
+msgstr ""
+
+msgid "Canned category not found"
+msgstr ""
+
+msgid "Canned category title is missing"
+msgstr ""
+
+msgid "ticket_id is missing"
+msgstr ""
+
+msgid "note is missing"
+msgstr ""
+
+msgid "Note id is missing"
+msgstr ""
+
+msgid "Note not found"
+msgstr ""
+
+msgid "Please enter your name"
+msgstr ""
+
+msgid "Please enter your email"
+msgstr ""
+
+msgid "Please enter your subject"
+msgstr ""
+
+msgid "Please enter your message"
+msgstr ""
+
+msgid "Public ticket hash required"
+msgstr ""
+
+msgid "Public ticket not found"
+msgstr ""
+
+msgid "message required"
+msgstr ""
+
+msgid "Message can not be blank"
+msgstr ""
+
+msgid "ID is missing"
+msgstr ""
+
+msgid "Staff member not found"
+msgstr ""
+
+msgid "Email param is missing"
+msgstr ""
+
+msgid "Password param is missing"
+msgstr ""
+
+msgid "Name param is missing"
+msgstr ""
+
+msgid "Staff group is missing"
+msgstr ""
+
+msgid "Administrator account already exists"
+msgstr ""
+
+msgid "Administrator email is missing."
+msgstr ""
+
+msgid "Administrator password is missing."
+msgstr ""
+
+msgid "Check your login details"
+msgstr ""
+
+msgid "BoxBilling license order not found"
+msgstr ""
+
+msgid "Order is not activated"
+msgstr ""
+
+msgid "Forum not found"
+msgstr ""
+
+msgid "Forum Topic not found"
+msgstr ""
+
+msgid "Forum ID not passed"
+msgstr ""
+
+msgid "Forum topic not passed"
+msgstr ""
+
+msgid "Forum message not passed"
+msgstr ""
+
+msgid "Your message is too short"
+msgstr ""
+
+msgid "Forum is locked. No new topics can be started"
+msgstr ""
+
+msgid "Forum Topic ID not passed"
+msgstr ""
+
+msgid "Topic message not passed"
+msgstr ""
+
+msgid "Forum topic is locked. No new message can be posted"
+msgstr ""
+
+msgid "Forum id missing"
+msgstr ""
+
+msgid "Forum title is missing"
+msgstr ""
+
+msgid "Topic id is missing"
+msgstr ""
+
+msgid "Forum topic title not passed"
+msgstr ""
+
+msgid "Forum topic message not passed"
+msgstr ""
+
+msgid "Forum topic id missing"
+msgstr ""
+
+msgid "Forum Topic message ID not passed"
+msgstr ""
+
+msgid "Forum Topic Message not found"
+msgstr ""
+
+msgid "Forum Topic message not found"
+msgstr ""
+
+msgid "Enter some keywords for search"
+msgstr ""
+
+msgid "Search keyword must be longer than 3 characters"
+msgstr ""
+
+msgid "File can not be downloaded at the moment. Please contact support"
+msgstr ""
+
+msgid "Order not found"
+msgstr ""
+
+msgid "File was not uploaded"
+msgstr ""
+
+msgid "Error uploading file"
+msgstr ""
+
+msgid "Product is not configured completely."
+msgstr ""
+
+msgid "plan_id is missing"
+msgstr ""
+
+msgid "Hosting plan not found"
+msgstr ""
+
+msgid "Server name is missing"
+msgstr ""
+
+msgid "Server IP is missing"
+msgstr ""
+
+msgid "Server manager is missing"
+msgstr ""
+
+msgid "Server id is missing"
+msgstr ""
+
+msgid "Server not found"
+msgstr ""
+
+msgid "Hosting plan id is missing"
+msgstr ""
+
+msgid "Hosting plan name is missing"
+msgstr ""
+
+msgid "Hoting plan name can not be empty"
+msgstr ""
+
+msgid ":hosting for :domain"
+msgstr ""
+
+msgid "Notification id is missing"
+msgstr ""
+
+msgid "Notification message was not found"
+msgstr ""
+
+msgid "Unknown API call :call"
+msgstr ""
+
+msgid "Unauthorized IP"
+msgstr ""
+
+msgid "Request limit reached"
+msgstr ""
+
+msgid "Unknow API call"
+msgstr ""
+
+msgid "Authentication Failed"
+msgstr ""
+
+msgid "Client API can be initiated"
+msgstr ""
+
+msgid "Hook event not passed"
+msgstr ""
+
+msgid "Param mod not passed"
+msgstr ""
+
+msgid "Article id not passed"
+msgstr ""
+
+msgid "Article not found"
+msgstr ""
+
+msgid "Article category id not passed"
+msgstr ""
+
+msgid "Article title not passed"
+msgstr ""
+
+msgid "Article id is missing"
+msgstr ""
+
+msgid "Caegory id not passed"
+msgstr ""
+
+msgid "Article Category not found"
+msgstr ""
+
+msgid "Category title not passed"
+msgstr ""
+
+msgid "Article item not found"
+msgstr ""
+
+msgid "Category ID or slug is missing"
+msgstr ""
+
+msgid "Knowledge base category not found"
+msgstr ""
+
+msgid "Invoice hash not passed"
+msgstr ""
+
+msgid "Invoice was not found"
+msgstr ""
+
+msgid "Order id required"
+msgstr ""
+
+msgid "Order :id is free. No need to generate invoice."
+msgstr ""
+
+msgid "Invoice is related to order #:id. Please cancel order first."
+msgstr ""
+
+msgid "Invoice id not passed"
+msgstr ""
+
+msgid "Invoice item id not passed"
+msgstr ""
+
+msgid "Invoice item was not found"
+msgstr ""
+
+msgid "Transaction id is missing"
+msgstr ""
+
+msgid "Transaction not found"
+msgstr ""
+
+msgid "Transaction invoice id is missing"
+msgstr ""
+
+msgid "Payment gateway id is missing"
+msgstr ""
+
+msgid "Gateway was not found"
+msgstr ""
+
+msgid "Payment gateway code is missing"
+msgstr ""
+
+msgid "Payment gateway is not available for installation."
+msgstr ""
+
+msgid "Gateway id not passed"
+msgstr ""
+
+msgid "Gateway not found"
+msgstr ""
+
+msgid "Client id not passed"
+msgstr ""
+
+msgid "Payment gateway id not passed"
+msgstr ""
+
+msgid "Subscription currency not passed"
+msgstr ""
+
+msgid "Payment gateway not found"
+msgstr ""
+
+msgid "Client currency must match subscription currency. Check if clients currency is defined."
+msgstr ""
+
+msgid "Subscription id not passed"
+msgstr ""
+
+msgid "Subscription not found"
+msgstr ""
+
+msgid "Tax id is missing"
+msgstr ""
+
+msgid "Tax rule not found"
+msgstr ""
+
+msgid "Tax name is missing"
+msgstr ""
+
+msgid "Tax rate is missing or is not valid"
+msgstr ""
+
+msgid "Invoice hash not passed. Missing param hash"
+msgstr ""
+
+msgid "Payment method not found. Missing param gateway_id"
+msgstr ""
+
+msgid "Invoice not found"
+msgstr ""
+
+msgid "Payment method not found"
+msgstr ""
+
+msgid "This invoice can't be subscribed"
+msgstr ""
+
+msgid "API call is missing arguments"
+msgstr ""
+
+msgid "Currency code is missing"
+msgstr ""
+
+msgid "Currency not found"
+msgstr ""
+
+msgid "Currency format is missing"
+msgstr ""
+
+msgid "Currency already registered"
+msgstr ""
+
+msgid "Currency code is not valid"
+msgstr ""
+
+msgid "Currency rate is not valid"
+msgstr ""
+
+msgid "You have already used this promo code. Please remove promo code and checkout again."
+msgstr ""
+
+msgid "Can not checkout empty cart."
+msgstr ""
+
+msgid "Selected currency :selected does not match your profile currency :code. Please change cart currency to continue."
+msgstr ""
+
+msgid "Shopping cart id is missing"
+msgstr ""
+
+msgid "Shopping cart not found"
+msgstr ""
+
+msgid "Currency code not passed"
+msgstr ""
+
+msgid "Promo code not passed"
+msgstr ""
+
+msgid "Promo code is expired or does not exist"
+msgstr ""
+
+msgid "Cart item id not passed"
+msgstr ""
+
+msgid "Solusvm order not found"
+msgstr ""
+
+msgid "Node is not selected for import."
+msgstr ""
+
+msgid "No servers selected for import."
+msgstr ""
+
+msgid "Select product for orders."
+msgstr ""
+
+msgid "Product is not configured completely. Please provide solusvm node in product configuration page."
+msgstr ""
+
+msgid "Product is not configured completely. Please provide solusvm plan in product configuration page."
+msgstr ""
+
+msgid "No clients selected for import."
+msgstr ""
+
+msgid "No clients found on SolusVM server."
+msgstr ""
+
+msgid "Virtual private server :title"
+msgstr ""
+
+msgid "Please enter VPS hostname."
+msgstr ""
+
+msgid "Hostname :hostname is not valid."
+msgstr ""
+
+msgid "Please select VPS template."
+msgstr ""
+
+msgid "SolusVM API ID is missing."
+msgstr ""
+
+msgid "SolusVM API KEY is missing."
+msgstr ""
+
+msgid "SolusVM API ipaddress is missing."
+msgstr ""
+
+msgid "SolusVM API secure is missing."
+msgstr ""
+
+msgid "SolusVM API port is missing."
+msgstr ""
+
+msgid "Could not activate order because ordered product does not exists"
+msgstr ""
+
+msgid "Could not activate order. Product :id configuration is missing node parameter"
+msgstr ""
+
+msgid "Could not activate order. Product :id configuration is missing plan parameter"
+msgstr ""
+
+msgid "Could not activate order. Product :id configuration is missing virtualization type parameter"
+msgstr ""
+
+msgid "Could not activate order. Product :id configuration is missing ips amount parameter"
+msgstr ""
+
+msgid "Root password must be longer than 4 symbols"
+msgstr ""
+
+msgid "Plan name must not be empty"
+msgstr ""
+
+msgid "Hostname must not be empty"
+msgstr ""
+
+msgid "Template must not be empty"
+msgstr ""
+
+msgid "Password must be longer than 4 symbols"
+msgstr ""
+
+msgid "TLD is missing"
+msgstr ""
+
+msgid "Tld already registered"
+msgstr ""
+
+msgid "TLD registrar id is missing"
+msgstr ""
+
+msgid "Registration price is missing"
+msgstr ""
+
+msgid "Renewal price is missing"
+msgstr ""
+
+msgid "Transfer price is missing"
+msgstr ""
+
+msgid "Registrar code not passed"
+msgstr ""
+
+msgid "Registrar is not available for installation."
+msgstr ""
+
+msgid "Registrar id not passed"
+msgstr ""
+
+msgid "Registrar not found"
+msgstr ""
+
+msgid "Registrar id is missing"
+msgstr ""
+
+msgid "Domain order is not activated"
+msgstr ""
+
+msgid "Tld is required"
+msgstr ""
+
+msgid "Sld is required"
+msgstr ""
+
+msgid "Domain :domain is not valid"
+msgstr ""
+
+msgid "Domain availability could not be determined. TLD is not active."
+msgstr ""
+
+msgid "Domain is not available."
+msgstr ""
+
+msgid "TLD is not active."
+msgstr ""
+
+msgid "Domain can not be transferred."
+msgstr ""
+
+msgid "Domain :domain registration"
+msgstr ""
+
+msgid "Domain :domain transfer"
+msgstr ""
+
+msgid "Only pending setup orders can be deleted."
+msgstr ""
+
+msgid "This feature is available in BoxBilling PRO version."
+msgstr ""
+
+msgid "Currency :code not found"
+msgstr ""
+
+msgid "Product :id is out of stock."
+msgstr ""
+
+msgid "Group ID parameter is missing for addon product order"
+msgstr ""
+
+msgid "Parent order :group_id was not found"
+msgstr ""
+
+msgid "Only pending setup or failed orders can be activated"
+msgstr ""
+
+msgid "Only suspended orders can be unsuspended"
+msgstr ""
+
+msgid "Only canceled orders can be uncanceled"
+msgstr ""
+
+msgid "Order config not passed"
+msgstr ""
+
+msgid "Order status was not passed"
+msgstr ""
+
+msgid "Order history line id not passed"
+msgstr ""
+
+msgid "Order history line not found"
+msgstr ""
+
+msgid "Automatically issue renewal invoices"
+msgstr ""
+
+msgid "Issue invoices manually"
+msgstr ""
+
+msgid "Order id not passed"
+msgstr ""
+
diff --git a/src/bb-locale/en_US/index.html b/src/bb-locale/en_US/index.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/bb-locale/index.html b/src/bb-locale/index.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/bb-locale/messages.pot b/src/bb-locale/messages.pot
new file mode 100644
index 000000000..78a7ce51f
--- /dev/null
+++ b/src/bb-locale/messages.pot
@@ -0,0 +1,4509 @@
+msgid "sq_AL"
+msgstr "Albanian (Albania)"
+
+msgid "ar_DZ"
+msgstr "Arabic (Algeria)"
+
+msgid "ar_BH"
+msgstr "Arabic (Bahrain)"
+
+msgid "ar_EG"
+msgstr "Arabic (Egypt)"
+
+msgid "ar_IQ"
+msgstr "Arabic (Iraq)"
+
+msgid "ar_JO"
+msgstr "Arabic (Jordan)"
+
+msgid "ar_KW"
+msgstr "Arabic (Kuwait)"
+
+msgid "ar_LB"
+msgstr "Arabic (Lebanon)"
+
+msgid "ar_LY"
+msgstr "Arabic (Libya)"
+
+msgid "ar_MA"
+msgstr "Arabic (Morocco)"
+
+msgid "ar_OM"
+msgstr "Arabic (Oman)"
+
+msgid "ar_QA"
+msgstr "Arabic (Qatar)"
+
+msgid "ar_SA"
+msgstr "Arabic (Saudi Arabia)"
+
+msgid "ar_SD"
+msgstr "Arabic (Sudan)"
+
+msgid "ar_SY"
+msgstr "Arabic (Syria)"
+
+msgid "ar_TN"
+msgstr "Arabic (Tunisia)"
+
+msgid "ar_AE"
+msgstr "Arabic (United Arab Emirates)"
+
+msgid "ar_YE"
+msgstr "Arabic (Yemen)"
+
+msgid "be_BY"
+msgstr "Belarusian (Belarus)"
+
+msgid "bg_BG"
+msgstr "Bulgarian (Bulgaria)"
+
+msgid "ca_ES"
+msgstr "Catalan (Spain)"
+
+msgid "zh_CN"
+msgstr "Chinese (China)"
+
+msgid "zh_HK"
+msgstr "Chinese (Hong Kong)"
+
+msgid "zh_SG"
+msgstr "Chinese (Singapore)"
+
+msgid "zh_TW"
+msgstr "Chinese (Taiwan)"
+
+msgid "hr_HR"
+msgstr "Croatian (Croatia)"
+
+msgid "cs_CZ"
+msgstr "Czech (Czech Republic)"
+
+msgid "da_DK"
+msgstr "Danish (Denmark)"
+
+msgid "nl_BE"
+msgstr "Dutch (Belgium)"
+
+msgid "nl_NL"
+msgstr "Dutch (Netherlands)"
+
+msgid "en_AU"
+msgstr "English (Australia)"
+
+msgid "en_CA"
+msgstr "English (Canada)"
+
+msgid "en_IN"
+msgstr "English (India)"
+
+msgid "en_IE"
+msgstr "English (Ireland)"
+
+msgid "en_MT"
+msgstr "English (Malta)"
+
+msgid "en_NZ"
+msgstr "English (New Zealand)"
+
+msgid "en_PH"
+msgstr "English (Philippines)"
+
+msgid "en_SG"
+msgstr "English (Singapore)"
+
+msgid "en_ZA"
+msgstr "English (South Africa)"
+
+msgid "en_GB"
+msgstr "English (United Kingdom)"
+
+msgid "en_US"
+msgstr "English (United States)"
+
+msgid "et_EE"
+msgstr "Estonian (Estonia)"
+
+msgid "fi_FI"
+msgstr "Finnish (Finland)"
+
+msgid "fr_BE"
+msgstr "French (Belgium)"
+
+msgid "fr_CA"
+msgstr "French (Canada)"
+
+msgid "fr_FR"
+msgstr "French (France)"
+
+msgid "fr_LU"
+msgstr "French (Luxembourg)"
+
+msgid "fr_CH"
+msgstr "French (Switzerland)"
+
+msgid "de_AT"
+msgstr "German (Austria)"
+
+msgid "de_DE"
+msgstr "German (Germany)"
+
+msgid "de_LU"
+msgstr "German (Luxembourg)"
+
+msgid "de_CH"
+msgstr "German (Switzerland)"
+
+msgid "el_CY"
+msgstr "Greek (Cyprus)"
+
+msgid "el_GR"
+msgstr "Greek (Greece)"
+
+msgid "iw_IL"
+msgstr "Hebrew (Israel)"
+
+msgid "hi_IN"
+msgstr "Hindi (India)"
+
+msgid "hu_HU"
+msgstr "Hungarian (Hungary)"
+
+msgid "is_IS"
+msgstr "Icelandic (Iceland)"
+
+msgid "in_ID"
+msgstr "Indonesian (Indonesia)"
+
+msgid "ga_IE"
+msgstr "Irish (Ireland)"
+
+msgid "it_IT"
+msgstr "Italian (Italy)"
+
+msgid "it_CH"
+msgstr "Italian (Switzerland)"
+
+msgid "ja_JP"
+msgstr "Japanese (Japan)"
+
+msgid "ja_JP_JP"
+msgstr "Japanese (Japan,JP)"
+
+msgid "ko_KR"
+msgstr "Korean (South Korea)"
+
+msgid "lv_LV"
+msgstr "Latvian (Latvia)"
+
+msgid "lt_LT"
+msgstr "Lithuanian (Lithuania)"
+
+msgid "mk_MK"
+msgstr "Macedonian (Macedonia)"
+
+msgid "ms_MY"
+msgstr "Malay (Malaysia)"
+
+msgid "mt_MT"
+msgstr "Maltese (Malta)"
+
+msgid "no_NO"
+msgstr "Norwegian (Norway)"
+
+msgid "no_NO_NY"
+msgstr "Norwegian (Norway,Nynorsk)"
+
+msgid "pl_PL"
+msgstr "Polish (Poland)"
+
+msgid "pt_BR"
+msgstr "Portuguese (Brazil)"
+
+msgid "pt_PT"
+msgstr "Portuguese (Portugal)"
+
+msgid "ro_RO"
+msgstr "Romanian (Romania)"
+
+msgid "ru_RU"
+msgstr "Russian (Russia)"
+
+msgid "sr_BA"
+msgstr "Serbian (Bosnia and Herzegovina)"
+
+msgid "sr_ME"
+msgstr "Serbian (Montenegro)"
+
+msgid "sr_CS"
+msgstr "Serbian (Serbia and Montenegro)"
+
+msgid "sr_RS"
+msgstr "Serbian (Serbia)"
+
+msgid "sk_SK"
+msgstr "Slovak (Slovakia)"
+
+msgid "sl_SI"
+msgstr "Slovenian (Slovenia)"
+
+msgid "es_AR"
+msgstr "Spanish (Argentina)"
+
+msgid "es_BO"
+msgstr "Spanish (Bolivia)"
+
+msgid "es_CL"
+msgstr "Spanish (Chile)"
+
+msgid "es_CO"
+msgstr "Spanish (Colombia)"
+
+msgid "es_CR"
+msgstr "Spanish (Costa Rica)"
+
+msgid "es_DO"
+msgstr "Spanish (Dominican Republic)"
+
+msgid "es_EC"
+msgstr "Spanish (Ecuador)"
+
+msgid "es_SV"
+msgstr "Spanish (El Salvador)"
+
+msgid "es_GT"
+msgstr "Spanish (Guatemala)"
+
+msgid "es_HN"
+msgstr "Spanish (Honduras)"
+
+msgid "es_MX"
+msgstr "Spanish (Mexico)"
+
+msgid "es_NI"
+msgstr "Spanish (Nicaragua)"
+
+msgid "es_PA"
+msgstr "Spanish (Panama)"
+
+msgid "es_PY"
+msgstr "Spanish (Paraguay)"
+
+msgid "es_PE"
+msgstr "Spanish (Peru)"
+
+msgid "es_PR"
+msgstr "Spanish (Puerto Rico)"
+
+msgid "es_ES"
+msgstr "Spanish (Spain)"
+
+msgid "es_US"
+msgstr "Spanish (United States)"
+
+msgid "es_UY"
+msgstr "Spanish (Uruguay)"
+
+msgid "es_VE"
+msgstr "Spanish (Venezuela)"
+
+msgid "sv_SE"
+msgstr "Swedish (Sweden)"
+
+msgid "th_TH"
+msgstr "Thai (Thailand)"
+
+msgid "tr_TR"
+msgstr "Turkish (Turkey)"
+
+msgid "uk_UA"
+msgstr "Ukrainian (Ukraine)"
+
+msgid "vi_VN"
+msgstr "Vietnamese (Vietnam)"
+
+msgid "Thread / Thread Starter"
+msgstr ""
+
+msgid "Last post"
+msgstr ""
+
+msgid "Replies"
+msgstr ""
+
+msgid "Views"
+msgstr ""
+
+msgid "by"
+msgstr ""
+
+msgid "The list is empty"
+msgstr ""
+
+msgid "Forum list"
+msgstr ""
+
+msgid "New topic"
+msgstr ""
+
+msgid "Register"
+msgstr ""
+
+msgid "Start new topic in"
+msgstr ""
+
+msgid "Start new topic"
+msgstr ""
+
+msgid "Topic title"
+msgstr ""
+
+msgid "Topic message"
+msgstr ""
+
+msgid "Create new topic"
+msgstr ""
+
+msgid "My Products & Services"
+msgstr ""
+
+msgid "Ordered Services"
+msgstr ""
+
+msgid "Product/Service"
+msgstr ""
+
+msgid "Price"
+msgstr ""
+
+msgid "Next due date"
+msgstr ""
+
+msgid "Status"
+msgstr ""
+
+msgid "Order new service"
+msgstr ""
+
+msgid "Order confirm"
+msgstr ""
+
+msgid "Order confirmation"
+msgstr ""
+
+msgid "These are the products you have selected"
+msgstr ""
+
+msgid "Product"
+msgstr ""
+
+msgid "Period"
+msgstr ""
+
+msgid "setup"
+msgstr ""
+
+msgid "Have a promo code?"
+msgstr ""
+
+msgid "Reset"
+msgstr ""
+
+msgid "Apply"
+msgstr ""
+
+msgid "Total:"
+msgstr ""
+
+msgid "Pay by"
+msgstr ""
+
+msgid "Checkout"
+msgstr ""
+
+msgid "Sign in"
+msgstr ""
+
+msgid "Login to client area"
+msgstr ""
+
+msgid "Email Address"
+msgstr ""
+
+msgid "Password"
+msgstr ""
+
+msgid "Login"
+msgstr ""
+
+msgid "Reset password"
+msgstr ""
+
+msgid "Do not have an account yet?"
+msgstr ""
+
+msgid "Enter your details below"
+msgstr ""
+
+msgid "Create new profile"
+msgstr ""
+
+msgid "First Name"
+msgstr ""
+
+msgid "Last Name"
+msgstr ""
+
+msgid "Company"
+msgstr ""
+
+msgid "Birthday"
+msgstr ""
+
+msgid "You are"
+msgstr ""
+
+msgid "Address"
+msgstr ""
+
+msgid "Address 2"
+msgstr ""
+
+msgid "City"
+msgstr ""
+
+msgid "Country"
+msgstr ""
+
+msgid "State"
+msgstr ""
+
+msgid "Zip/Postal Code"
+msgstr ""
+
+msgid "Phone"
+msgstr ""
+
+msgid "Password confirm"
+msgstr ""
+
+msgid "You have not selected any product"
+msgstr ""
+
+msgid "Login / Sign up"
+msgstr ""
+
+msgid "Sign In / Create new account"
+msgstr ""
+
+msgid ""
+"Become a member to participate in forum, contact support, order new services"
+msgstr ""
+
+msgid "Phone Number"
+msgstr ""
+
+msgid "Centova Cast server"
+msgstr ""
+
+msgid "Details"
+msgstr ""
+
+msgid "Recent tracks"
+msgstr ""
+
+msgid "Username"
+msgstr ""
+
+msgid "Unable to connect to server"
+msgstr ""
+
+msgid "No recent tracks are available"
+msgstr ""
+
+msgid "Invoices"
+msgstr ""
+
+msgid "List of invoices"
+msgstr ""
+
+msgid "Invoice management"
+msgstr ""
+
+msgid "Unpaid"
+msgstr ""
+
+msgid "Paid"
+msgstr ""
+
+msgid "Title"
+msgstr ""
+
+msgid "Issue Date"
+msgstr ""
+
+msgid "Due Date"
+msgstr ""
+
+msgid "Total"
+msgstr ""
+
+msgid "Pay"
+msgstr ""
+
+msgid "Paid at"
+msgstr ""
+
+msgid "Order activation process will start after confirmation"
+msgstr ""
+
+msgid "Solve captcha to activate order"
+msgstr ""
+
+msgid "Action required"
+msgstr ""
+
+msgid "Activate"
+msgstr ""
+
+msgid "Order activation captcha"
+msgstr ""
+
+msgid "Hosting management"
+msgstr ""
+
+msgid "FTP Details"
+msgstr ""
+
+msgid "Nameservers"
+msgstr ""
+
+msgid "Hostname"
+msgstr ""
+
+msgid "Account status"
+msgstr ""
+
+msgid "Account ID"
+msgstr ""
+
+msgid "IP"
+msgstr ""
+
+msgid "Open Control Panel"
+msgstr ""
+
+msgid "Configure"
+msgstr ""
+
+msgid ""
+"The product/service you have chosen has the following configuration options "
+"for you to choose from."
+msgstr ""
+
+msgid "Reply"
+msgstr ""
+
+msgid "Quote"
+msgstr ""
+
+msgid "Post"
+msgstr ""
+
+msgid "Ticket details"
+msgstr ""
+
+msgid "Subject"
+msgstr ""
+
+msgid "Author"
+msgstr ""
+
+msgid "Email"
+msgstr ""
+
+msgid "Time opened"
+msgstr ""
+
+msgid "Close ticket"
+msgstr ""
+
+msgid "Privacy policy"
+msgstr ""
+
+msgid "Service details"
+msgstr ""
+
+msgid "All information about your service"
+msgstr ""
+
+msgid "Order"
+msgstr ""
+
+msgid "Product name"
+msgstr ""
+
+msgid "Payment amount"
+msgstr ""
+
+msgid "Billing cycle"
+msgstr ""
+
+msgid "Order status"
+msgstr ""
+
+msgid "Order created"
+msgstr ""
+
+msgid "Activated at"
+msgstr ""
+
+msgid "Renewal date"
+msgstr ""
+
+msgid "Order notes"
+msgstr ""
+
+msgid "Active support tickets"
+msgstr ""
+
+msgid "Renew now"
+msgstr ""
+
+msgid "Request Upgrade"
+msgstr ""
+
+msgid "Open ticket"
+msgstr ""
+
+msgid "Cancel"
+msgstr ""
+
+msgid "Request Cancellation"
+msgstr ""
+
+msgid "Help desk"
+msgstr ""
+
+msgid "I would like to cancel"
+msgstr ""
+
+msgid "Reason"
+msgstr ""
+
+msgid "Submit"
+msgstr ""
+
+msgid "Open new support ticket regarding this order"
+msgstr ""
+
+msgid ""
+"Submit new support ticket. Ticket will be visible in support section after "
+"submission"
+msgstr ""
+
+msgid "Message"
+msgstr ""
+
+msgid "Request upgrade"
+msgstr ""
+
+msgid "I would like to upgrade"
+msgstr ""
+
+msgid "Upgrade to"
+msgstr ""
+
+msgid "Notes"
+msgstr ""
+
+msgid "Request"
+msgstr ""
+
+msgid "Addons you have ordered with this service"
+msgstr ""
+
+msgid "Billing Cycle"
+msgstr ""
+
+msgid "Back to services"
+msgstr ""
+
+msgid "Addons & extras"
+msgstr ""
+
+msgid "Order now"
+msgstr ""
+
+msgid "Contact us"
+msgstr ""
+
+msgid "Name"
+msgstr ""
+
+msgid "Send"
+msgstr ""
+
+msgid "Select currency"
+msgstr ""
+
+msgid "Error"
+msgstr ""
+
+msgid "Quantity:"
+msgstr ""
+
+msgid "Total price:"
+msgstr ""
+
+msgid "Setup Price"
+msgstr ""
+
+msgid "Continue"
+msgstr ""
+
+msgid "Blog"
+msgstr ""
+
+msgid "News & Announcements"
+msgstr ""
+
+msgid "Track our latest posts"
+msgstr ""
+
+msgid "Read more.."
+msgstr ""
+
+msgid "Support tickets"
+msgstr ""
+
+msgid "Need an answer? We are here to help"
+msgstr ""
+
+msgid "Id"
+msgstr ""
+
+msgid "Submitted"
+msgstr ""
+
+msgid "ago"
+msgstr ""
+
+msgid "Submit new ticket"
+msgstr ""
+
+msgid "Submit new support ticket"
+msgstr ""
+
+msgid "Knowledge base"
+msgstr ""
+
+msgid "Download file"
+msgstr ""
+
+msgid "Download"
+msgstr ""
+
+msgid "Select product"
+msgstr ""
+
+msgid "Confirm"
+msgstr ""
+
+msgid "Incorrect please try again"
+msgstr ""
+
+msgid "Enter the words above"
+msgstr ""
+
+msgid "Please configure domain for your hosting account"
+msgstr ""
+
+msgid "Use own"
+msgstr ""
+
+msgid "Transfer"
+msgstr ""
+
+msgid "I will use my existing domain and update nameservers"
+msgstr ""
+
+msgid "Enter your domain name"
+msgstr ""
+
+msgid "Register a new domain"
+msgstr ""
+
+msgid "Check"
+msgstr ""
+
+msgid "Transfer your domain from another registrar"
+msgstr ""
+
+msgid "Transfer price"
+msgstr ""
+
+msgid "Enter domain transfer code"
+msgstr ""
+
+msgid " Year/s @ "
+msgstr ""
+
+msgid "Back to list"
+msgstr ""
+
+msgid "Similiar articles"
+msgstr ""
+
+msgid "Knowledge base categories"
+msgstr ""
+
+msgid "Proforma invoice"
+msgstr ""
+
+msgid "Proforma Invoice"
+msgstr ""
+
+msgid "Please choose payment type and pay for your chosen products."
+msgstr ""
+
+msgid "Invoice"
+msgstr ""
+
+msgid "Invoice is paid"
+msgstr ""
+
+msgid "Account"
+msgstr ""
+
+msgid "Company number"
+msgstr ""
+
+msgid "VAT"
+msgstr ""
+
+msgid "Discount"
+msgstr ""
+
+msgid "Pay now"
+msgstr ""
+
+msgid "Transactions"
+msgstr ""
+
+msgid "Transaction Date"
+msgstr ""
+
+msgid "Transaction ID"
+msgstr ""
+
+msgid "Gateway"
+msgstr ""
+
+msgid "Amount"
+msgstr ""
+
+msgid "Actions"
+msgstr ""
+
+msgid "Change payment method"
+msgstr ""
+
+msgid "Client Area"
+msgstr ""
+
+msgid "Tickets waiting your reply"
+msgstr ""
+
+msgid "Profile"
+msgstr ""
+
+msgid "ID"
+msgstr ""
+
+msgid "Balance"
+msgstr ""
+
+msgid "Manage profile"
+msgstr ""
+
+msgid "All Invoices"
+msgstr ""
+
+msgid "Services"
+msgstr ""
+
+msgid "Active"
+msgstr ""
+
+msgid "Soon expires"
+msgstr ""
+
+msgid "All services"
+msgstr ""
+
+msgid "New order"
+msgstr ""
+
+msgid "Tickets"
+msgstr ""
+
+msgid "Open"
+msgstr ""
+
+msgid "On Hold"
+msgstr ""
+
+msgid "All tickets"
+msgstr ""
+
+msgid "New ticket"
+msgstr ""
+
+msgid "Recent orders"
+msgstr ""
+
+msgid "Recent emails"
+msgstr ""
+
+msgid "Order products and services"
+msgstr ""
+
+msgid "Become a member and manage services"
+msgstr ""
+
+msgid "Contact Us"
+msgstr ""
+
+msgid "Contact us for more information"
+msgstr ""
+
+msgid "Announcements"
+msgstr ""
+
+msgid "Latest news & announcements"
+msgstr ""
+
+msgid "Knowledge Base"
+msgstr ""
+
+msgid "Browse our KB for answers and FAQs"
+msgstr ""
+
+msgid "Invoicing Software"
+msgstr ""
+
+msgid "Powered by BoxBilling invoicing software"
+msgstr ""
+
+msgid "Register new domain"
+msgstr ""
+
+msgid "Transfer my domain"
+msgstr ""
+
+msgid "Check domain availability"
+msgstr ""
+
+msgid "Enter new domain name to register"
+msgstr ""
+
+msgid "I want to use my nameservers"
+msgstr ""
+
+msgid "Nameserver 1"
+msgstr ""
+
+msgid "Nameserver 2"
+msgstr ""
+
+msgid "Nameserver 3"
+msgstr ""
+
+msgid "Nameserver 4"
+msgstr ""
+
+msgid "Enter your domain name to transfer"
+msgstr ""
+
+msgid "License key"
+msgstr ""
+
+msgid "Valid IPs"
+msgstr ""
+
+msgid "Valid hostnames"
+msgstr ""
+
+msgid "Valid versions"
+msgstr ""
+
+msgid "Valid install paths"
+msgstr ""
+
+msgid "Processing payment ..."
+msgstr ""
+
+msgid "Redirecting to payment gateway.."
+msgstr ""
+
+msgid ""
+"Please click here to continue if this page does not redirect automatically "
+"in 5 seconds"
+msgstr ""
+
+msgid "Profile details"
+msgstr ""
+
+msgid "Keep your profile up to date"
+msgstr ""
+
+msgid "Change Password"
+msgstr ""
+
+msgid "Gravatar"
+msgstr ""
+
+msgid "Currency"
+msgstr ""
+
+msgid "API"
+msgstr ""
+
+msgid "Update profile"
+msgstr ""
+
+msgid "Company Name"
+msgstr ""
+
+msgid "Phone Country Code"
+msgstr ""
+
+msgid "Change password"
+msgstr ""
+
+msgid "Enter new password"
+msgstr ""
+
+msgid "API key"
+msgstr ""
+
+msgid ""
+"API key allows integration with external applications. You will need this "
+"key for authentication."
+msgstr ""
+
+msgid "Warning! Resetting the key will break existing applications using it."
+msgstr ""
+
+msgid "Your API key"
+msgstr ""
+
+msgid "Reset key"
+msgstr ""
+
+msgid "Please register with"
+msgstr ""
+
+msgid "at "
+msgstr ""
+
+msgid ""
+"to change your profile image. Gravatar image updates may not appear "
+"immediately."
+msgstr ""
+
+msgid "Your profile currency is"
+msgstr ""
+
+msgid ""
+"Create new client profile if you want to manage your money in other currency"
+msgstr ""
+
+msgid ""
+"Your profile currency will be defined after your first order. Once your "
+"currency is set, all your profile accounting will be managed in that "
+"currency and can not be changed."
+msgstr ""
+
+msgid "What are you looking for?"
+msgstr ""
+
+msgid "Search"
+msgstr ""
+
+msgid "Try using other keyword. No matches not for keyword:"
+msgstr ""
+
+msgid "Back to emails"
+msgstr ""
+
+msgid "From"
+msgstr ""
+
+msgid "To"
+msgstr ""
+
+msgid "Sent"
+msgstr ""
+
+msgid "Resend"
+msgstr ""
+
+msgid "Delete"
+msgstr ""
+
+msgid "VPS management"
+msgstr ""
+
+msgid "Statistics"
+msgstr ""
+
+msgid "Manage"
+msgstr ""
+
+msgid "Control panel"
+msgstr ""
+
+msgid "Refresh"
+msgstr ""
+
+msgid "Plan"
+msgstr ""
+
+msgid "Operating system"
+msgstr ""
+
+msgid "IP address"
+msgstr ""
+
+msgid "Additional IP addresses"
+msgstr ""
+
+msgid "Type"
+msgstr ""
+
+msgid "Root password"
+msgstr ""
+
+msgid "Change status"
+msgstr ""
+
+msgid "VPS rebooting. Refresh page after a few moments."
+msgstr ""
+
+msgid "Reboot"
+msgstr ""
+
+msgid "VPS booting. Refresh page after a few moments."
+msgstr ""
+
+msgid "Boot"
+msgstr ""
+
+msgid "VPS shutdown"
+msgstr ""
+
+msgid "Shutdown"
+msgstr ""
+
+msgid "Change hostname"
+msgstr ""
+
+msgid "Hostname changed"
+msgstr ""
+
+msgid "New hostname"
+msgstr ""
+
+msgid "Enter new hostname"
+msgstr ""
+
+msgid "Change"
+msgstr ""
+
+msgid "Change operating system"
+msgstr ""
+
+msgid "Operating system is being changed"
+msgstr ""
+
+msgid "New operating system"
+msgstr ""
+
+msgid "Change root password"
+msgstr ""
+
+msgid "Root password changed"
+msgstr ""
+
+msgid "New password"
+msgstr ""
+
+msgid "Enter new root password"
+msgstr ""
+
+msgid "Bandwidth"
+msgstr ""
+
+msgid "Used"
+msgstr ""
+
+msgid "Free"
+msgstr ""
+
+msgid "Memory"
+msgstr ""
+
+msgid "Disk usage"
+msgstr ""
+
+msgid "Boot up server to see statistics"
+msgstr ""
+
+msgid "Are you sure?"
+msgstr ""
+
+msgid "VPS booting. Reload page after a few moments."
+msgstr ""
+
+msgid "Login details"
+msgstr ""
+
+msgid "Open control panel"
+msgstr ""
+
+msgid "Change client area password"
+msgstr ""
+
+msgid "Client area password changed"
+msgstr ""
+
+msgid "Home"
+msgstr ""
+
+msgid "Forum"
+msgstr ""
+
+msgid "Support"
+msgstr ""
+
+msgid "Emails"
+msgstr ""
+
+msgid "Payment history"
+msgstr ""
+
+msgid "Domain management"
+msgstr ""
+
+msgid "Domain details"
+msgstr ""
+
+msgid "Domain"
+msgstr ""
+
+msgid "Registration date"
+msgstr ""
+
+msgid "Expires at"
+msgstr ""
+
+msgid "Domain Secret"
+msgstr ""
+
+msgid ""
+"All domain names (except a .EU, .UK domain name) have a Domain (Transfer) "
+"Secret Key/Authorization Code (EPP Code) associated with them. This would be "
+"required if you want to transfer service."
+msgstr ""
+
+msgid "Get EPP code"
+msgstr ""
+
+msgid "Domain Protection"
+msgstr ""
+
+msgid ""
+"Domain locking is a security enhancement to prevent unauthorized transfers "
+"of your domain to another registrar or web host by \"locking\" your domain "
+"name servers."
+msgstr ""
+
+msgid "Unlock"
+msgstr ""
+
+msgid "Lock"
+msgstr ""
+
+msgid "Domain Privacy Settings"
+msgstr ""
+
+msgid ""
+"If you would like to hide domain contact information which is shown on WHOIS "
+"you can enable privacy protection. Once domain privacy protection is enabled "
+"no one will know who registered this service. And once you decide to disable "
+"privacy protection, information that is listed above on \"Update Domain "
+"Contact Details\" section will be seen on domain WHOIS again."
+msgstr ""
+
+msgid "Disable Privacy protection"
+msgstr ""
+
+msgid "Enable Privacy protection"
+msgstr ""
+
+msgid "Domain Nameservers"
+msgstr ""
+
+msgid ""
+"If you would like to host this domain with another company you can update "
+"nameservers."
+msgstr ""
+
+msgid "Update nameservers"
+msgstr ""
+
+msgid "Update"
+msgstr ""
+
+msgid "Domain Contact Details"
+msgstr ""
+
+msgid ""
+"Domain contact details will be displayed once someone will check WHOIS "
+"output (which is public) of your service. This will update Technical, "
+"Billing and Admin contacts for this service. You can enable domain privacy "
+"protection if you want to hide your public WHOIS information."
+msgstr ""
+
+msgid "Update domain contact details"
+msgstr ""
+
+msgid "Address Line 1"
+msgstr ""
+
+msgid "Address Line 2"
+msgstr ""
+
+msgid "Zip"
+msgstr ""
+
+msgid "Phone number"
+msgstr ""
+
+msgid "Vps hostname"
+msgstr ""
+
+msgid "Enter hostname for VPS: mydomain.com"
+msgstr ""
+
+msgid "OS template"
+msgstr ""
+
+msgid "Yes"
+msgstr ""
+
+msgid "No"
+msgstr ""
+
+msgid "Topic information"
+msgstr ""
+
+msgid "Topic"
+msgstr ""
+
+msgid "Started By"
+msgstr ""
+
+msgid "Messages"
+msgstr ""
+
+msgid "Since"
+msgstr ""
+
+msgid "Back to threads list"
+msgstr ""
+
+msgid "Post new message in forum"
+msgstr ""
+
+msgid "No replies in this topic"
+msgstr ""
+
+msgid "Select Product"
+msgstr ""
+
+msgid "Choose products we offer for selling"
+msgstr ""
+
+msgid "Starting from:"
+msgstr ""
+
+msgid "View products"
+msgstr ""
+
+msgid "Manage hosting account"
+msgstr ""
+
+msgid "Server IP"
+msgstr ""
+
+msgid "Server Hostname"
+msgstr ""
+
+msgid "Hosting plan"
+msgstr ""
+
+msgid "per month"
+msgstr ""
+
+msgid "Disk quota"
+msgstr ""
+
+msgid "Manage domain"
+msgstr ""
+
+msgid "Jump to cPanel"
+msgstr ""
+
+msgid "Reseller control panel"
+msgstr ""
+
+msgid "FTP details"
+msgstr ""
+
+msgid "Use these details to connect to your FTP account."
+msgstr ""
+
+msgid "FTP IP"
+msgstr ""
+
+msgid "FTP Username"
+msgstr ""
+
+msgid "FTP Password"
+msgstr ""
+
+msgid "Change account password"
+msgstr ""
+
+msgid "Change your FTP cPanel SSH password."
+msgstr ""
+
+msgid "Password Confirm"
+msgstr ""
+
+msgid "Change username"
+msgstr ""
+
+msgid "Change domain"
+msgstr ""
+
+msgid "About us"
+msgstr ""
+
+msgid "by "
+msgstr ""
+
+msgid ""
+"Welcome to our forums. If you wish to become a member and post, you have to "
+"be registered member."
+msgstr ""
+
+msgid "Threads"
+msgstr ""
+
+msgid "Posts"
+msgstr ""
+
+msgid "Favorite topics"
+msgstr ""
+
+msgid "Dashboard"
+msgstr ""
+
+msgid "Shopping cart"
+msgstr ""
+
+msgid "Sign out"
+msgstr ""
+
+msgid "Email address"
+msgstr ""
+
+msgid "Select language"
+msgstr ""
+
+msgid "Popular articles"
+msgstr ""
+
+msgid "Recent posts"
+msgstr ""
+
+msgid "Terms and conditions"
+msgstr ""
+
+msgid "Loading .."
+msgstr ""
+
+msgid "All"
+msgstr ""
+
+msgid "License details"
+msgstr ""
+
+msgid "Key"
+msgstr ""
+
+msgid "All ips"
+msgstr ""
+
+msgid "Valid Domains"
+msgstr ""
+
+msgid "All hosts"
+msgstr ""
+
+msgid "Valid Versions"
+msgstr ""
+
+msgid "All versions"
+msgstr ""
+
+msgid "Valid Install paths"
+msgstr ""
+
+msgid "All paths"
+msgstr ""
+
+msgid "Reset license"
+msgstr ""
+
+msgid "You can reset your license parameters if you have changed your server"
+msgstr ""
+
+msgid "Payments history"
+msgstr ""
+
+msgid ""
+"Here you can track your payments you have made and what you have been "
+"charged for"
+msgstr ""
+
+msgid "Description"
+msgstr ""
+
+msgid "Date"
+msgstr ""
+
+msgid "Add Funds"
+msgstr ""
+
+msgid "Add funds in advance"
+msgstr ""
+
+msgid "You can add funds to your account if you have active order."
+msgstr ""
+
+msgid "Add funds"
+msgstr ""
+
+msgid "Host my own domain"
+msgstr ""
+
+msgid "Subdomain"
+msgstr ""
+
+msgid "CPU"
+msgstr ""
+
+msgid "RAM"
+msgstr ""
+
+msgid "Disk space"
+msgstr ""
+
+msgid "Monthly price"
+msgstr ""
+
+msgid "Ticket ID"
+msgstr ""
+
+msgid "Related to"
+msgstr ""
+
+msgid "Service #"
+msgstr ""
+
+msgid "Tickets list"
+msgstr ""
+
+msgid "Terms and Conditions"
+msgstr ""
+
+msgid "Emails we have sent you"
+msgstr ""
+
+msgid "Here you can track emails we have sent you"
+msgstr ""
+
+msgid "Email subject"
+msgstr ""
+
+msgid "Date sent"
+msgstr ""
+
+msgid "How to reset my password?"
+msgstr ""
+
+msgid ""
+"Enter your email to reset password. You will receive new password after "
+"reset link is confirmed."
+msgstr ""
+
+msgid "Password reset confirmation email was sent"
+msgstr ""
+
+msgid "Thank you"
+msgstr ""
+
+msgid "Payment for invoice received"
+msgstr ""
+
+msgid ""
+"Your payment is being processed right now. This takes about 5 minutes to "
+"complete."
+msgstr ""
+
+msgid "You will be automatically redirected to invoice page after 5 minutes."
+msgstr ""
+
+msgid "Example module"
+msgstr ""
+
+msgid "Example module title"
+msgstr ""
+
+msgid "See protected content"
+msgstr ""
+
+msgid "This content can be seen only if client is logged in"
+msgstr ""
+
+msgid "Your protected content"
+msgstr ""
+
+msgid "Payment for invoice :serie:id [:title]"
+msgstr ""
+
+msgid "Card number"
+msgstr ""
+
+msgid "CVV2"
+msgstr ""
+
+msgid "Expiration Date"
+msgstr ""
+
+msgid "Zipcode"
+msgstr ""
+
+msgid "Redirecting to 2Checkout.com"
+msgstr ""
+
+msgid "Redirecting to PayPal.com"
+msgstr ""
+
+msgid "Could not connect to whois :server server"
+msgstr ""
+
+msgid "Error creating "
+msgstr ""
+
+msgid "Only active orders can be suspended"
+msgstr ""
+
+msgid "Can not cancel "
+msgstr ""
+
+msgid "Service "
+msgstr ""
+
+msgid "Can not remove hosting plan which has active accounts"
+msgstr ""
+
+msgid "Invoice item title is missing"
+msgstr ""
+
+msgid ":product setup"
+msgstr ""
+
+msgid "Could not activate proforma item. Order :id not found"
+msgstr ""
+
+msgid "Filename is missing in product config."
+msgstr ""
+
+msgid "Parameter :param does not exist"
+msgstr ""
+
+msgid "Theme was not found in path :path"
+msgstr ""
+
+msgid "Unable to decode theme manifest file :file"
+msgstr ""
+
+msgid ""
+"Please check if you have configured FTP layer properly in Configuration > "
+"General settings > FTP layer."
+msgstr ""
+
+msgid ""
+"Please make sure that FTP Root is defined properly. Could not find bb-config."
+"php file in :path"
+msgstr ""
+
+msgid ""
+"You have reached free version limit. Upgrade to PRO version of BoxBilling if "
+"you want this limit removed."
+msgstr ""
+
+msgid ""
+"BoxBilling license key must be defined in bb-config.php file as BB_LICENSE "
+"constant."
+msgstr ""
+
+msgid ""
+"PHP curl extension is disabled on your server. Please enable php curl "
+"extension."
+msgstr ""
+
+msgid "Can not remove group with clients"
+msgstr ""
+
+msgid "Could not find main domain product"
+msgstr ""
+
+msgid "Hosting product must have domain configuration"
+msgstr ""
+
+msgid "Domain action is missing"
+msgstr ""
+
+msgid "Hosting product must have defined register_sld parameter"
+msgstr ""
+
+msgid "Hosting product must have defined register_tld parameter"
+msgstr ""
+
+msgid "Hosting product must have defined transfer_sld parameter"
+msgstr ""
+
+msgid "Hosting product must have defined transfer_tld parameter"
+msgstr ""
+
+msgid "Can not remove category which has articles"
+msgstr ""
+
+msgid ""
+"Hosting product is not configured completely. Configure server for hosting "
+"product."
+msgstr ""
+
+msgid ""
+"Hosting product is not configured completely. Configure hosting plan for "
+"hosting product."
+msgstr ""
+
+msgid "Domain name is not valid."
+msgstr ""
+
+msgid "Domain extension is not valid."
+msgstr ""
+
+msgid "Server from order configuration was not found"
+msgstr ""
+
+msgid "Hosting plan from order configuration was not found"
+msgstr ""
+
+msgid "Could not activate order. Service was not created"
+msgstr ""
+
+msgid "Order :id has no active service"
+msgstr ""
+
+msgid "Account password is missing or is not valid"
+msgstr ""
+
+msgid "Account ip is missing or is not valid"
+msgstr ""
+
+msgid "Domain sld or tld is missing"
+msgstr ""
+
+msgid "Can not refund invoice with negative amount"
+msgstr ""
+
+msgid ""
+"You must have at least one active order before you can add funds so you "
+"cannot proceed at the current time!"
+msgstr ""
+
+msgid "Amount is not valid"
+msgstr ""
+
+msgid "Invoices are not generated for 0 amount orders"
+msgstr ""
+
+msgid "Payment for invoice :serie:id"
+msgstr ""
+
+msgid "Can not remove invoice. It was paid but services were not activated"
+msgstr ""
+
+msgid "License plugin :plugin was not found"
+msgstr ""
+
+msgid "License plugin do not have generate method"
+msgstr ""
+
+msgid "Custom plugin method :method is forbidden"
+msgstr ""
+
+msgid "Plugin class file :file was not found"
+msgstr ""
+
+msgid "Plugin :plugin does not support action :action"
+msgstr ""
+
+msgid "Can not remove helpdesk which has tickets"
+msgstr ""
+
+msgid "Currency conversion rate can not be zero"
+msgstr ""
+
+msgid "Can not remove default currency"
+msgstr ""
+
+msgid "This administrator account is protected and can not be removed"
+msgstr ""
+
+msgid ":product_title"
+msgstr ""
+
+msgid "Can not remove product category with products"
+msgstr ""
+
+msgid "BoxBilling core modules can not be installed or removed"
+msgstr ""
+
+msgid ""
+"Module can not be installed. It requires at least :min version of "
+"BoxBilling. You are using :v"
+msgstr ""
+
+msgid "Could not retrieve version information for extension :ext"
+msgstr ""
+
+msgid "Latest :mod version installed. No need to update"
+msgstr ""
+
+msgid "Could not retrieve :ext information"
+msgstr ""
+
+msgid "Visit extension site for update information."
+msgstr ""
+
+msgid "BoxBilling core modules can not be managed"
+msgstr ""
+
+msgid "Could not extract extension zip file"
+msgstr ""
+
+msgid "Module already installed."
+msgstr ""
+
+msgid ""
+"Extension can not be moved. Make sure your server write permissions to bb-"
+"modules folder."
+msgstr ""
+
+msgid ""
+"Extension can not be moved. Make sure your server write permissions to bb-"
+"themes folder."
+msgstr ""
+
+msgid ""
+"Extension can not be moved. Make sure your server write permissions to bb-"
+"locale folder."
+msgstr ""
+
+msgid ""
+"Extension does not support auto-install deature. Extension must be installed "
+"manually"
+msgstr ""
+
+msgid "Unable to connect to BoxBilling extensiosn site."
+msgstr ""
+
+msgid "Administrators group can not be removed"
+msgstr ""
+
+msgid "Can not remove group which has staff members"
+msgstr ""
+
+msgid ""
+"This is a last message in topic. Remove topic in order to remove this "
+"message."
+msgstr ""
+
+msgid "Payment gateway :adapter was not found"
+msgstr ""
+
+msgid ""
+"Are you registering new domain or transfering existing? Action parameter "
+"missing."
+msgstr ""
+
+msgid "Invalid domain action."
+msgstr ""
+
+msgid "Order data must contain :field configuration field"
+msgstr ""
+
+msgid "Domain name :domain is not valid"
+msgstr ""
+
+msgid "Domain TLD is not valid."
+msgstr ""
+
+msgid "Domain name is required."
+msgstr ""
+
+msgid "Transfer domain type (tld) is required."
+msgstr ""
+
+msgid "Transfer domain name (sld) is required."
+msgstr ""
+
+msgid "Transfer code is required for domains transfers."
+msgstr ""
+
+msgid "TLD not found"
+msgstr ""
+
+msgid ":domain can not be transferred!"
+msgstr ""
+
+msgid "Domain registration tld parameter missing."
+msgstr ""
+
+msgid "Domain registration sld parameter missing."
+msgstr ""
+
+msgid "Years parameter is missing for domain configuration."
+msgstr ""
+
+msgid ":tld can be registered for at least :years years"
+msgstr ""
+
+msgid ":domain is already registered!"
+msgstr ""
+
+msgid "Default domain nameservers are not configured"
+msgstr ""
+
+msgid "Nameserver 1 is required"
+msgstr ""
+
+msgid "Nameserver 2 is required"
+msgstr ""
+
+msgid "Required field contact is missing"
+msgstr ""
+
+msgid "Required field :field is missing"
+msgstr ""
+
+msgid "Domain name is not valid"
+msgstr ""
+
+msgid "Domain can not be transferred"
+msgstr ""
+
+msgid "Domain can not be registered"
+msgstr ""
+
+msgid "Period parameter not passed"
+msgstr ""
+
+msgid "I'm afraid we are out of stock."
+msgstr ""
+
+msgid "Addon period parameter not passed"
+msgstr ""
+
+msgid "Product not found"
+msgstr ""
+
+msgid "Add products to cart before applying promo code"
+msgstr ""
+
+msgid "Currency can not be changed. Client already have invoices issued."
+msgstr ""
+
+msgid "Currency can not be changed. Client already have orders."
+msgstr ""
+
+msgid "Could not determine domain price. Domain action is missing"
+msgstr ""
+
+msgid "Unknown TLD. Could not determine registration price"
+msgstr ""
+
+msgid "Domain product can not be removed."
+msgstr ""
+
+msgid "Unknown transaction #:id type: :type"
+msgstr ""
+
+msgid ""
+"Could not determine transaction origin. Transaction payment gateway is "
+"unknown."
+msgstr ""
+
+msgid "Can not handle transaction received from unknown payment gateway: :id"
+msgstr ""
+
+msgid "Transaction :id is not associated with an invoice."
+msgstr ""
+
+msgid "Invoice #:id not found"
+msgstr ""
+
+msgid "Instant payment notification (IPN) did not pass gateway :id validation"
+msgstr ""
+
+msgid ""
+"Payment gateway :id method getTransaction should return Payment_Transaction "
+"object"
+msgstr ""
+
+msgid ""
+"Can not create subscription. Subscription id from payment gateway was not "
+"received"
+msgstr ""
+
+msgid "Subscription #:id was not found. Could not unsusbscribe"
+msgstr ""
+
+msgid "Only approved transaction can be processed"
+msgstr ""
+
+msgid "Transaction currency :code do not match required currency :required"
+msgstr ""
+
+msgid ""
+"Transaction status on payment gateway is Pending. Only Complete or Unknown "
+"transactions can be processed."
+msgstr ""
+
+msgid "Define clients currency before adding funds."
+msgstr ""
+
+msgid "Funds amount is not valid"
+msgstr ""
+
+msgid "Funds description is not valid"
+msgstr ""
+
+msgid "Client currency do not match invoice currency"
+msgstr ""
+
+msgid "Can not add negative amount to client balance for debit transaction"
+msgstr ""
+
+msgid "Conversion rate can't be 0"
+msgstr ""
+
+msgid "Product pricing could not be determined. "
+msgstr ""
+
+msgid "Repo class for product was not found"
+msgstr ""
+
+msgid "Unknown Period selected for setup price"
+msgstr ""
+
+msgid "Product :id payment type is recurrent, but period was not selected"
+msgstr ""
+
+msgid "Unknown Period selected for price"
+msgstr ""
+
+msgid "Can not remove product which has active orders."
+msgstr ""
+
+msgid "Invalid server manager. Server was not configured properly."
+msgstr ""
+
+msgid "Server manager :adapter is not valid"
+msgstr ""
+
+msgid "Can not remove server which has active accounts"
+msgstr ""
+
+msgid "Domain registrar :adapter was not found"
+msgstr ""
+
+msgid "Registrar :adapter was not found"
+msgstr ""
+
+msgid "Registrar adapter :adapter should extend Registrar_AdapterAbstract"
+msgstr ""
+
+msgid "Can not remove registrar which has domains"
+msgstr ""
+
+msgid "Invalid identity"
+msgstr ""
+
+msgid ":module method toApiArray not found"
+msgstr ""
+
+msgid "Client api can not be invoked from guest or admin role"
+msgstr ""
+
+msgid "Invalid identity. Clear browser cookies"
+msgstr ""
+
+msgid "Method :method must contain underscore"
+msgstr ""
+
+msgid "Invalid module name"
+msgstr ""
+
+msgid "BoxBilling module :mod is not installed/activated"
+msgstr ""
+
+msgid "Module api file :file is not available"
+msgstr ""
+
+msgid "You do not have access to :mod module"
+msgstr ""
+
+msgid "Api class must be instance of Api_Abstract"
+msgstr ""
+
+msgid ":type API call :method does not exist in module :module"
+msgstr ""
+
+msgid "second"
+msgstr ""
+
+msgid "minute"
+msgstr ""
+
+msgid "hour"
+msgstr ""
+
+msgid "day"
+msgstr ""
+
+msgid "week"
+msgstr ""
+
+msgid "month"
+msgstr ""
+
+msgid "year"
+msgstr ""
+
+msgid "decade"
+msgstr ""
+
+msgid "Period Error. Unit :unit is not defined"
+msgstr ""
+
+msgid ""
+"Invalid period quantity :qty for unit :unit. Allowed range is from :from to :"
+"to"
+msgstr ""
+
+msgid "Every week"
+msgstr ""
+
+msgid "Every month"
+msgstr ""
+
+msgid "Every 3 months"
+msgstr ""
+
+msgid "Every 6 months"
+msgstr ""
+
+msgid "Every year"
+msgstr ""
+
+msgid "Every 2 years"
+msgstr ""
+
+msgid "Every 3 years"
+msgstr ""
+
+msgid "Every :number day"
+msgstr ""
+
+msgid "Every :number week(s)"
+msgstr ""
+
+msgid "Every :number months"
+msgstr ""
+
+msgid "Every :number years"
+msgstr ""
+
+msgid "Unit not defined"
+msgstr ""
+
+msgid "Can not determine months amount from unit"
+msgstr ""
+
+msgid "CURL extension is not enabled"
+msgstr ""
+
+msgid "Module :mod manifest file is missing"
+msgstr ""
+
+msgid ""
+"Module :mod manifest file is not valid. Check file syntax and permissions."
+msgstr ""
+
+msgid "Service class :class was not found in :path"
+msgstr ""
+
+msgid "Client controller class :class was not found in :path"
+msgstr ""
+
+msgid "Admin controller class :class was not found in :path"
+msgstr ""
+
+msgid "Core module can not be updated"
+msgstr ""
+
+msgid ""
+"FTP extension is not enabled in PHP. You will not be able to use automatic "
+"updates and other automation."
+msgstr ""
+
+msgid "The ftp PHP extension is not available"
+msgstr ""
+
+msgid "FTP hostname is required"
+msgstr ""
+
+msgid "FTP username is required"
+msgstr ""
+
+msgid "FTP password is required"
+msgstr ""
+
+msgid "Failed to connect to FTP Server :host : :port"
+msgstr ""
+
+msgid "FTP Username/Password incorrect for :usernmae"
+msgstr ""
+
+msgid "Resource is not a stream"
+msgstr ""
+
+msgid "Mode cannot be changed on existing streams"
+msgstr ""
+
+msgid ":stream cannot be opened with mode :mode"
+msgstr ""
+
+msgid "Unable to write to stream"
+msgstr ""
+
+msgid ":module method getSearchQuery not found"
+msgstr ""
+
+msgid "Invalid :module method getSearchQuery return"
+msgstr ""
+
+msgid "Page :url not found"
+msgstr ""
+
+msgid "Page not found"
+msgstr ""
+
+msgid "File :file does not exist"
+msgstr ""
+
+msgid "Invalid zip file"
+msgstr ""
+
+msgid "Zip extraction failed"
+msgstr ""
+
+msgid "Unknown mail transport: :transport"
+msgstr ""
+
+msgid "SMTP host not configured"
+msgstr ""
+
+msgid "SMTP port not configured"
+msgstr ""
+
+msgid "SMTP hostname is not configured."
+msgstr ""
+
+msgid "Missing log message"
+msgstr ""
+
+msgid "Bad log priority"
+msgstr ""
+
+msgid "Email is not valid"
+msgstr ""
+
+msgid "Password too short!"
+msgstr ""
+
+msgid "Password must include at least one number!"
+msgstr ""
+
+msgid "Password must include at least one letter!"
+msgstr ""
+
+msgid "Client"
+msgstr ""
+
+msgid "Support ticket"
+msgstr ""
+
+msgid "Staff member"
+msgstr ""
+
+msgid "Announcement"
+msgstr ""
+
+msgid "Forum topic"
+msgstr ""
+
+msgid "Filter invoices"
+msgstr ""
+
+msgid "Nr"
+msgstr ""
+
+msgid "All statuses"
+msgstr ""
+
+msgid "Refunded"
+msgstr ""
+
+msgid "Issue date"
+msgstr ""
+
+msgid "Filter"
+msgstr ""
+
+msgid "Unpaid invoices"
+msgstr ""
+
+msgid "Refunded invoices"
+msgstr ""
+
+msgid "Paid invoices"
+msgstr ""
+
+msgid "New Invoice"
+msgstr ""
+
+msgid "Issued at"
+msgstr ""
+
+msgid "Start typing clients name, email or ID"
+msgstr ""
+
+msgid "Prepare"
+msgstr ""
+
+msgid "Settings"
+msgstr ""
+
+msgid "YouHosting settings"
+msgstr ""
+
+msgid "Advanced"
+msgstr ""
+
+msgid "Your IP"
+msgstr ""
+
+msgid "WebHook URL"
+msgstr ""
+
+msgid "Api Key"
+msgstr ""
+
+msgid "Update settings"
+msgstr ""
+
+msgid "Check connection"
+msgstr ""
+
+msgid "Import clients"
+msgstr ""
+
+msgid "Import clients, accounts and products"
+msgstr ""
+
+msgid "Allowed IPs for Webhook listener"
+msgstr ""
+
+msgid "Redirects"
+msgstr ""
+
+msgid "The list is empty."
+msgstr ""
+
+msgid "Create new redirect"
+msgstr ""
+
+msgid "Add"
+msgstr ""
+
+msgid "Number"
+msgstr ""
+
+msgid "Created at"
+msgstr ""
+
+msgid "Due at"
+msgstr ""
+
+msgid "Reminded at"
+msgstr ""
+
+msgid "Approved"
+msgstr ""
+
+msgid "Serie and number"
+msgstr ""
+
+msgid "Tax"
+msgstr ""
+
+msgid "Payment method"
+msgstr ""
+
+msgid "Text before invoice items table"
+msgstr ""
+
+msgid "Text after invoice items table"
+msgstr ""
+
+msgid "Company VAT"
+msgstr ""
+
+msgid "Company Number"
+msgstr ""
+
+msgid "First name"
+msgstr ""
+
+msgid "Last name"
+msgstr ""
+
+msgid "Invoice items"
+msgstr ""
+
+msgid "Print"
+msgstr ""
+
+msgid "Staff"
+msgstr ""
+
+msgid "New staff member"
+msgstr ""
+
+msgid "Manage groups"
+msgstr ""
+
+msgid "New group"
+msgstr ""
+
+msgid "Group"
+msgstr ""
+
+msgid "Configuration updated"
+msgstr ""
+
+msgid "Check login IP"
+msgstr ""
+
+msgid "Allowed IPs. One per line"
+msgstr ""
+
+msgid "Signature"
+msgstr ""
+
+msgid "Inactive"
+msgstr ""
+
+msgid "Create"
+msgstr ""
+
+msgid "Create group"
+msgstr ""
+
+msgid "Registrar"
+msgstr ""
+
+msgid "Transfer code"
+msgstr ""
+
+msgid "Privacy protected"
+msgstr ""
+
+msgid "Locked"
+msgstr ""
+
+msgid "Registration/Renewal years"
+msgstr ""
+
+msgid "Disable privacy protection"
+msgstr ""
+
+msgid "Enable privacy protection"
+msgstr ""
+
+msgid "management"
+msgstr ""
+
+msgid "Clients"
+msgstr ""
+
+msgid "Edit"
+msgstr ""
+
+msgid "Orders"
+msgstr ""
+
+msgid "Payments"
+msgstr ""
+
+msgid "Logins"
+msgstr ""
+
+msgid "Client profile details"
+msgstr ""
+
+msgid "Client Profile updated"
+msgstr ""
+
+msgid "Suspended"
+msgstr ""
+
+msgid "Canceled"
+msgstr ""
+
+msgid "Individual"
+msgstr ""
+
+msgid "Other/Unknown"
+msgstr ""
+
+msgid "Company details"
+msgstr ""
+
+msgid "Address and contact details"
+msgstr ""
+
+msgid "Postcode"
+msgstr ""
+
+msgid "Additional settings"
+msgstr ""
+
+msgid "Alternative ID"
+msgstr ""
+
+msgid "Used to identify client on foreign system. Usually used by importers"
+msgstr ""
+
+msgid "Exempt from tax"
+msgstr ""
+
+msgid "Signed up time"
+msgstr ""
+
+msgid "Password changed"
+msgstr ""
+
+msgid "Custom fields"
+msgstr ""
+
+msgid "Use these fields to define custom client details"
+msgstr ""
+
+msgid "Client Profile custom fields updated"
+msgstr ""
+
+msgid "Custom field"
+msgstr ""
+
+msgid "Client payments history"
+msgstr ""
+
+msgid "Add funds for client"
+msgstr ""
+
+msgid "Funds added"
+msgstr ""
+
+msgid "Client orders"
+msgstr ""
+
+msgid "Client invoices"
+msgstr ""
+
+msgid "Client support tickets"
+msgstr ""
+
+msgid "Logins history"
+msgstr ""
+
+msgid "Emails sent to client"
+msgstr ""
+
+msgid "Transactions received"
+msgstr ""
+
+msgid "Create new order"
+msgstr ""
+
+msgid "for"
+msgstr ""
+
+msgid "Invoice option"
+msgstr ""
+
+msgid "Activate order"
+msgstr ""
+
+msgid "Place new order"
+msgstr ""
+
+msgid "Themes"
+msgstr ""
+
+msgid "Client area themes"
+msgstr ""
+
+msgid "Set as default"
+msgstr ""
+
+msgid "Filter clients"
+msgstr ""
+
+msgid "Company name"
+msgstr ""
+
+msgid "New client"
+msgstr ""
+
+msgid "Groups"
+msgstr ""
+
+msgid "Tax rules"
+msgstr ""
+
+msgid "New tax rule"
+msgstr ""
+
+msgid "Tax settings"
+msgstr ""
+
+msgid "EU VAT"
+msgstr ""
+
+msgid "State/Region"
+msgstr ""
+
+msgid "Tax rate"
+msgstr ""
+
+msgid "Applies to any country"
+msgstr ""
+
+msgid "Applies to any state"
+msgstr ""
+
+msgid "Enable tax support"
+msgstr ""
+
+msgid "Automatic VAT Tax Rules Setup"
+msgstr ""
+
+msgid ""
+"If you would like BoxBilling to automatically setup the EU VAT tax rules for "
+"you for all EU Member States then simply enter your VAT Label & local VAT "
+"rate below and click the submit button. This action will delete any existing "
+"tax rules and configure the VAT rates for all EU countries."
+msgstr ""
+
+msgid "VAT Label"
+msgstr ""
+
+msgid "VAT rate"
+msgstr ""
+
+msgid "21"
+msgstr ""
+
+msgid "Create EU VAT Rules"
+msgstr ""
+
+msgid "Tax title"
+msgstr ""
+
+msgid "sales Tax"
+msgstr ""
+
+msgid "18"
+msgstr ""
+
+msgid "Leave empty to apply to all states"
+msgstr ""
+
+msgid "Filter orders"
+msgstr ""
+
+msgid "Creation date"
+msgstr ""
+
+msgid "Pending setup"
+msgstr ""
+
+msgid "Supended"
+msgstr ""
+
+msgid "File manager"
+msgstr ""
+
+msgid "Full screen"
+msgstr ""
+
+msgid "License"
+msgstr ""
+
+msgid "Module settings"
+msgstr ""
+
+msgid ""
+"After purchase you have received an e-mail with license key. Update license "
+"key to unlock all features of BoxBilling"
+msgstr ""
+
+msgid ""
+"To change license key, change BB_LICENSE value in bb-config."
+"php file"
+msgstr ""
+
+msgid "Edit bb-config.php file"
+msgstr ""
+
+msgid "Licensed to"
+msgstr ""
+
+msgid "Hi,"
+msgstr ""
+
+msgid "Loading ..."
+msgstr ""
+
+msgid "New"
+msgstr ""
+
+msgid "All settings"
+msgstr ""
+
+msgid "Theme settings"
+msgstr ""
+
+msgid "Help"
+msgstr ""
+
+msgid "Visit site"
+msgstr ""
+
+msgid "Logout"
+msgstr ""
+
+msgid "Notifications"
+msgstr ""
+
+msgid "Inquiries"
+msgstr ""
+
+msgid "INFORMATION"
+msgstr ""
+
+msgid "Metric"
+msgstr ""
+
+msgid "Today"
+msgstr ""
+
+msgid "Yesterday"
+msgstr ""
+
+msgid "This month so far"
+msgstr ""
+
+msgid "Last month"
+msgstr ""
+
+msgid "Income"
+msgstr ""
+
+msgid "Latest orders"
+msgstr ""
+
+msgid "Product sales"
+msgstr ""
+
+msgid "No active orders available"
+msgstr ""
+
+msgid "Define date interval for graphs"
+msgstr ""
+
+msgid "Update graphs"
+msgstr ""
+
+msgid "Recent clients activity"
+msgstr ""
+
+msgid "Recent staff activity"
+msgstr ""
+
+msgid "Forum settings"
+msgstr ""
+
+msgid "Forum points"
+msgstr ""
+
+msgid "Enabled"
+msgstr ""
+
+msgid "Disabled"
+msgstr ""
+
+msgid "Give points for posting in selected forums"
+msgstr ""
+
+msgid "Top level domain management"
+msgstr ""
+
+msgid "Registration price"
+msgstr ""
+
+msgid "Renewal price"
+msgstr ""
+
+msgid "Minimum years of registration"
+msgstr ""
+
+msgid "Allow registration"
+msgstr ""
+
+msgid "Allow transfer"
+msgstr ""
+
+msgid "Invoice settings"
+msgstr ""
+
+msgid "Number of days to generate new invoice before order expiration"
+msgstr ""
+
+msgid "Invoice due days"
+msgstr ""
+
+msgid "Auto invoice approval"
+msgstr ""
+
+msgid "Proforma Invoicing / Sequential Invoice Numbering"
+msgstr ""
+
+msgid "Proforma invoice prefix/series"
+msgstr ""
+
+msgid "Paid invoice prefix/series"
+msgstr ""
+
+msgid "Next paid invoice number"
+msgstr ""
+
+msgid "Refunds settings"
+msgstr ""
+
+msgid "Refunds logic"
+msgstr ""
+
+msgid "Add funds settings"
+msgstr ""
+
+msgid "Minimum amount for add funds invoice"
+msgstr ""
+
+msgid "Unlimited"
+msgstr ""
+
+msgid "Maximum amount for add funds invoice"
+msgstr ""
+
+msgid "Client area languages"
+msgstr ""
+
+msgid "New language"
+msgstr ""
+
+msgid "Language"
+msgstr ""
+
+msgid "Code"
+msgstr ""
+
+msgid "BoxBilling in your language"
+msgstr ""
+
+msgid ""
+"Although BoxBilling displays in U.S. English by default, the software has "
+"the built-in capability to be used in any language. Follow instructions "
+"bellow to install new language."
+msgstr ""
+
+msgid "Check if your language translation file is available at"
+msgstr ""
+
+msgid "BoxBilling extensions site"
+msgstr ""
+
+msgid "Download language files and place them to"
+msgstr ""
+
+msgid ""
+"Language will be automatically available and can be changed in client area"
+msgstr ""
+
+msgid "Read"
+msgstr ""
+
+msgid "Installing BoxBilling in Your Language"
+msgstr ""
+
+msgid ""
+"to learn how to install files that will transform BoxBilling so it displays "
+"in your language."
+msgstr ""
+
+msgid "Translations can be made with"
+msgstr ""
+
+msgid "software"
+msgstr ""
+
+msgid "Changing default language"
+msgstr ""
+
+msgid "Default language can be set in"
+msgstr ""
+
+msgid "Removing language"
+msgstr ""
+
+msgid ""
+"Removing languages from BoxBilling is really simple. Just delete language "
+"folder you wish from"
+msgstr ""
+
+msgid "Order management"
+msgstr ""
+
+msgid "Edit order"
+msgstr ""
+
+msgid "Service management"
+msgstr ""
+
+msgid "Addons"
+msgstr ""
+
+msgid "History"
+msgstr ""
+
+msgid "Activated"
+msgstr ""
+
+msgid "Order group ID"
+msgstr ""
+
+msgid "Order promo code"
+msgstr ""
+
+msgid "Reason of suspendation"
+msgstr ""
+
+msgid "Suspendation reason"
+msgstr ""
+
+msgid "Reason of cancelation"
+msgstr ""
+
+msgid "Cancelation reason"
+msgstr ""
+
+msgid "Changes status without performing action"
+msgstr ""
+
+msgid "Order invoices"
+msgstr ""
+
+msgid "Order status change history"
+msgstr ""
+
+msgid "Note"
+msgstr ""
+
+msgid "Support tickets regarding this order"
+msgstr ""
+
+msgid "Something went wrong here"
+msgstr ""
+
+msgid "Back to Dashboard"
+msgstr ""
+
+msgid "Main website"
+msgstr ""
+
+msgid "Extensions"
+msgstr ""
+
+msgid "Update BoxBilling"
+msgstr ""
+
+msgid "Learn more about extensions"
+msgstr ""
+
+msgid "Hooks"
+msgstr ""
+
+msgid "Activate or deactivate extensions"
+msgstr ""
+
+msgid "Extension"
+msgstr ""
+
+msgid "Deactivate"
+msgstr ""
+
+msgid "Hook"
+msgstr ""
+
+msgid "Automatic update"
+msgstr ""
+
+msgid ""
+"Automatic updater is a tool to update BoxBilling to latest version in one "
+"click. Works on these hosting environments where PHP has permissions to "
+"overwrite files uploaded via FTP."
+msgstr ""
+
+msgid "Manual update"
+msgstr ""
+
+msgid ""
+"Manual update is a solution when auto updater can not work on current "
+"installation environment"
+msgstr ""
+
+msgid "Extending BoxBilling"
+msgstr ""
+
+msgid ""
+"BoxBilling gives developers all the capabilities to customize, integrate & "
+"extend the core system into your own website & applications."
+msgstr ""
+
+msgid "Hosting plans and servers"
+msgstr ""
+
+msgid "New server"
+msgstr ""
+
+msgid "New hosting plan"
+msgstr ""
+
+msgid "Servers"
+msgstr ""
+
+msgid "Server manager"
+msgstr ""
+
+msgid "Hosting plans"
+msgstr ""
+
+msgid "Addon domains"
+msgstr ""
+
+msgid "Unique name to identify this server"
+msgstr ""
+
+msgid "server1.yourserverdomain.com"
+msgstr ""
+
+msgid ""
+"Primary IP address of the server used to connect to it like: 123.123.123.123"
+msgstr ""
+
+msgid "Assigned IP Addresses"
+msgstr ""
+
+msgid "List the IP Addresses assigned to the server (One per line)"
+msgstr ""
+
+msgid "Enable/Disable"
+msgstr ""
+
+msgid "ns1.yourdomain.com"
+msgstr ""
+
+msgid "ns2.yourdomain.com"
+msgstr ""
+
+msgid "ns3.yourdomain.com"
+msgstr ""
+
+msgid "ns4.yourdomain.com"
+msgstr ""
+
+msgid "Login username to your server: root/reseller"
+msgstr ""
+
+msgid "Login password to your server"
+msgstr ""
+
+msgid "Access Hash (Insted of password for cPanel servers)"
+msgstr ""
+
+msgid "Use Secure connection"
+msgstr ""
+
+msgid "Add server"
+msgstr ""
+
+msgid "Adding new hosting plan"
+msgstr ""
+
+msgid ""
+"Depending on server manager used to setup hosting account you may require "
+"provide additional parameters in next step. In this step provide basic "
+"hosting plan information."
+msgstr ""
+
+msgid "Unique name to identify this hosting plan"
+msgstr ""
+
+msgid "Disk quota (MB)"
+msgstr ""
+
+msgid "Bandwidth (MB)"
+msgstr ""
+
+msgid "Create hosting plan"
+msgstr ""
+
+msgid "Submited"
+msgstr ""
+
+msgid "Manage services"
+msgstr ""
+
+msgid "Features"
+msgstr ""
+
+msgid "Demo"
+msgstr ""
+
+msgid "Documentation"
+msgstr ""
+
+msgid "Forums"
+msgstr ""
+
+msgid "Partners"
+msgstr ""
+
+msgid "My Account"
+msgstr ""
+
+msgid "Support Tickets"
+msgstr ""
+
+msgid "Get BoxBilling license"
+msgstr ""
+
+msgid "Quantity"
+msgstr ""
+
+msgid "Top level domains"
+msgstr ""
+
+msgid "New top level domain"
+msgstr ""
+
+msgid "Registrars"
+msgstr ""
+
+msgid "New domain registrar"
+msgstr ""
+
+msgid "Manage TLDs"
+msgstr ""
+
+msgid ""
+"Setup domain pricing and allowed operations. Assign specific domain "
+"registrars for each Top Level Domain (TLD)"
+msgstr ""
+
+msgid "TLD"
+msgstr ""
+
+msgid "Registration"
+msgstr ""
+
+msgid "Renew"
+msgstr ""
+
+msgid "Operations"
+msgstr ""
+
+msgid "Allow register:"
+msgstr ""
+
+msgid "Allow transfer:"
+msgstr ""
+
+msgid "Active:"
+msgstr ""
+
+msgid "Add new top level domain"
+msgstr ""
+
+msgid "Setup new TLD prices and properties"
+msgstr ""
+
+msgid "Tld"
+msgstr ""
+
+msgid "Domain registrars"
+msgstr ""
+
+msgid "Manage domain registrars"
+msgstr ""
+
+msgid ""
+"Setup default nameservers that will be used for new domain registrations if "
+"client have not provided his own nameservers in order form"
+msgstr ""
+
+msgid "Adding new domain registrar"
+msgstr ""
+
+msgid "Follow instrunctions bellow to install new domain registrar."
+msgstr ""
+
+msgid "Check domain registrar you are looking for is available at"
+msgstr ""
+
+msgid "Download domain registrar file and place to"
+msgstr ""
+
+msgid "Reload this page to see newly detected domain registrar"
+msgstr ""
+
+msgid ""
+"Click on install button. Now you will be able to create top level domains "
+"with new domain registrar"
+msgstr ""
+
+msgid "For developers. Read"
+msgstr ""
+
+msgid "BoxBilling documentation"
+msgstr ""
+
+msgid "to learn how to create your own domain registrar."
+msgstr ""
+
+msgid "Install"
+msgstr ""
+
+msgid "All payment gateways installed"
+msgstr ""
+
+msgid "Orders settings"
+msgstr ""
+
+msgid "Expiration date"
+msgstr ""
+
+msgid "Predefined suspendation or cancelation reasons. One per line"
+msgstr ""
+
+msgid "Account Id"
+msgstr ""
+
+msgid "Search:"
+msgstr ""
+
+msgid "Enter search text.."
+msgstr ""
+
+msgid "Parameter key is missing"
+msgstr ""
+
+msgid "_tpl parameter not passed"
+msgstr ""
+
+msgid "mod parameter not passed"
+msgstr ""
+
+msgid "Country :code phone code is not registered"
+msgstr ""
+
+msgid "ID is required"
+msgstr ""
+
+msgid "Event not found"
+msgstr ""
+
+msgid "Order id is required"
+msgstr ""
+
+msgid "Centova Cast order not found"
+msgstr ""
+
+msgid "Order :id is not activated"
+msgstr ""
+
+msgid "CentovaCast product is not configured properly. Field :field is missing"
+msgstr ""
+
+msgid "Could not suspend order. Service was not created"
+msgstr ""
+
+msgid "Could not unsuspend order. Service was not created"
+msgstr ""
+
+msgid "Message from name can not be empty"
+msgstr ""
+
+msgid "Message subject not passed"
+msgstr ""
+
+msgid "Add some content before sending message"
+msgstr ""
+
+msgid "Client ID needs to be configured in mass mailer settings."
+msgstr ""
+
+msgid "Message id not passed"
+msgstr ""
+
+msgid "Message not found"
+msgstr ""
+
+msgid "Queue message id is missing"
+msgstr ""
+
+msgid "Queue message not found"
+msgstr ""
+
+msgid "Queue name not provided"
+msgstr ""
+
+msgid "Module name not provided"
+msgstr ""
+
+msgid "Message handler function :method does not exists"
+msgstr ""
+
+msgid "ID or slug is missing"
+msgstr ""
+
+msgid "News item not found"
+msgstr ""
+
+msgid "Post id not passed"
+msgstr ""
+
+msgid "Post not found"
+msgstr ""
+
+msgid "Post title not passed"
+msgstr ""
+
+msgid "Form title was not provided"
+msgstr ""
+
+msgid "Form id was not passed"
+msgstr ""
+
+msgid "Form is not valid"
+msgstr ""
+
+msgid "Form field type was not passed"
+msgstr ""
+
+msgid "You have latest version of BoxBilling. You do not need to update."
+msgstr ""
+
+msgid "Extension id was not passed"
+msgstr ""
+
+msgid "Extension type was not passed"
+msgstr ""
+
+msgid "Parameter ext was not passed"
+msgstr ""
+
+msgid "Extension not found"
+msgstr ""
+
+msgid "Email can not be changed"
+msgstr ""
+
+msgid "Can not change email. It is already registered."
+msgstr ""
+
+msgid "Password required"
+msgstr ""
+
+msgid "Password confiration required"
+msgstr ""
+
+msgid "Passwords do not match."
+msgstr ""
+
+msgid "Client ID or email is required"
+msgstr ""
+
+msgid "Client not found"
+msgstr ""
+
+msgid "ID required"
+msgstr ""
+
+msgid "Email required"
+msgstr ""
+
+msgid "First name is required"
+msgstr ""
+
+msgid "Email is already registered."
+msgstr ""
+
+msgid "Client id is missing"
+msgstr ""
+
+msgid "Id required"
+msgstr ""
+
+msgid "Client ID is required"
+msgstr ""
+
+msgid "Password confirmation required"
+msgstr ""
+
+msgid "Passwords do not match"
+msgstr ""
+
+msgid "Balance line not found"
+msgstr ""
+
+msgid "Amount is required"
+msgstr ""
+
+msgid "Description is required"
+msgstr ""
+
+msgid "Id not passed"
+msgstr ""
+
+msgid "Group title is missing"
+msgstr ""
+
+msgid "Group id is missing"
+msgstr ""
+
+msgid "Group not found"
+msgstr ""
+
+msgid "New registrations are temporary disabled"
+msgstr ""
+
+msgid "First name required"
+msgstr ""
+
+msgid "It is required that you provide details for field \":field\""
+msgstr ""
+
+msgid ""
+"Email is already registered. You may want to login instead of registering."
+msgstr ""
+
+msgid "Please check your login details"
+msgstr ""
+
+msgid "Email not found in our database"
+msgstr ""
+
+msgid "Hash required"
+msgstr ""
+
+msgid "The link have expired or you have already confirmed password reset."
+msgstr ""
+
+msgid "Country code is required"
+msgstr ""
+
+msgid "Invalid email confirmation link"
+msgstr ""
+
+msgid "Title is required"
+msgstr ""
+
+msgid "Type is required"
+msgstr ""
+
+msgid "You have already created domain product."
+msgstr ""
+
+msgid "Product type :type is not registered"
+msgstr ""
+
+msgid "Pricing type is required"
+msgstr ""
+
+msgid "priority params is missing"
+msgstr ""
+
+msgid "Addon id is required"
+msgstr ""
+
+msgid "Addon not found"
+msgstr ""
+
+msgid "Category id is missing"
+msgstr ""
+
+msgid "Category not found"
+msgstr ""
+
+msgid "Category title is missing"
+msgstr ""
+
+msgid "Promo code is missing"
+msgstr ""
+
+msgid "Promo type is missing"
+msgstr ""
+
+msgid "Promo value is missing"
+msgstr ""
+
+msgid "Promo id is missing"
+msgstr ""
+
+msgid "Promo not found"
+msgstr ""
+
+msgid "Product id not passed"
+msgstr ""
+
+msgid "Product ID or slug is missing"
+msgstr ""
+
+msgid "Please enter subdomain"
+msgstr ""
+
+msgid "Please select master domain"
+msgstr ""
+
+msgid "Please enter domain value"
+msgstr ""
+
+msgid ":product for :domain"
+msgstr ""
+
+msgid "Unknown domain type."
+msgstr ""
+
+msgid "Email ID is required"
+msgstr ""
+
+msgid "Email not found"
+msgstr ""
+
+msgid "Receiver Email is required"
+msgstr ""
+
+msgid "Receiver Name is required"
+msgstr ""
+
+msgid "Sender Name is required"
+msgstr ""
+
+msgid "Sender email is required"
+msgstr ""
+
+msgid "Email subject is required"
+msgstr ""
+
+msgid "Email content is required"
+msgstr ""
+
+msgid "Email template ID is required"
+msgstr ""
+
+msgid "Email template not found"
+msgstr ""
+
+msgid "Email template code is required"
+msgstr ""
+
+msgid "Email template subject is required"
+msgstr ""
+
+msgid "Email template content is required"
+msgstr ""
+
+msgid "Template code not passed"
+msgstr ""
+
+msgid "Receiver is not defined. Define to or to_client or to_staff parameter"
+msgstr ""
+
+msgid "Email template code was not passed"
+msgstr ""
+
+msgid "Email template :code was not found"
+msgstr ""
+
+msgid "Akismet detected this message is spam"
+msgstr ""
+
+msgid ""
+"To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"
+msgstr ""
+
+msgid "Captcha verification failed."
+msgstr ""
+
+msgid "Your Username is blacklisted in global database"
+msgstr ""
+
+msgid "Your Email is blacklisted in global database"
+msgstr ""
+
+msgid "Your IP is blacklisted in global database"
+msgstr ""
+
+msgid "path parameter is missing"
+msgstr ""
+
+msgid "Data parameter is missing"
+msgstr ""
+
+msgid "Path parameter is missing"
+msgstr ""
+
+msgid "Type parameter is missing"
+msgstr ""
+
+msgid "Unknow item type"
+msgstr ""
+
+msgid "To parameter is missing"
+msgstr ""
+
+msgid "File does not exist"
+msgstr ""
+
+msgid "Ticket id required"
+msgstr ""
+
+msgid "Ticket not found"
+msgstr ""
+
+msgid "Ticket content required"
+msgstr ""
+
+msgid "Ticket subject required"
+msgstr ""
+
+msgid "Ticket support_helpdesk_id required"
+msgstr ""
+
+msgid "Helpdesk invalid"
+msgstr ""
+
+msgid "We have already received this request."
+msgstr ""
+
+msgid "Ticket ID required"
+msgstr ""
+
+msgid "Ticket can not be reopened."
+msgstr ""
+
+msgid "Ticket id is missing"
+msgstr ""
+
+msgid "Ticket message id is missing"
+msgstr ""
+
+msgid "Ticket message content is missing"
+msgstr ""
+
+msgid "Ticket message not found"
+msgstr ""
+
+msgid "Client name parameter is missing"
+msgstr ""
+
+msgid "Client email parameter is missing"
+msgstr ""
+
+msgid "Subject parameter is missing"
+msgstr ""
+
+msgid "Ticket message is missing"
+msgstr ""
+
+msgid "Help desk id is missing"
+msgstr ""
+
+msgid "Help desk not found"
+msgstr ""
+
+msgid "Help desk title is missing"
+msgstr ""
+
+msgid "Canned reply id is missing"
+msgstr ""
+
+msgid "Canned reply not found"
+msgstr ""
+
+msgid "Canned reply title is missing"
+msgstr ""
+
+msgid "Canned reply category id is missing"
+msgstr ""
+
+msgid "Canned category id is missing"
+msgstr ""
+
+msgid "Canned category not found"
+msgstr ""
+
+msgid "Canned category title is missing"
+msgstr ""
+
+msgid "ticket_id is missing"
+msgstr ""
+
+msgid "note is missing"
+msgstr ""
+
+msgid "Note id is missing"
+msgstr ""
+
+msgid "Note not found"
+msgstr ""
+
+msgid "Please enter your name"
+msgstr ""
+
+msgid "Please enter your email"
+msgstr ""
+
+msgid "Please enter your subject"
+msgstr ""
+
+msgid "Please enter your message"
+msgstr ""
+
+msgid "Public ticket hash required"
+msgstr ""
+
+msgid "Public ticket not found"
+msgstr ""
+
+msgid "message required"
+msgstr ""
+
+msgid "Message can not be blank"
+msgstr ""
+
+msgid "ID is missing"
+msgstr ""
+
+msgid "Staff member not found"
+msgstr ""
+
+msgid "Email param is missing"
+msgstr ""
+
+msgid "Password param is missing"
+msgstr ""
+
+msgid "Name param is missing"
+msgstr ""
+
+msgid "Staff member with email :email is already registered"
+msgstr ""
+
+msgid "Permissions parameter missing"
+msgstr ""
+
+msgid "Staff group is missing"
+msgstr ""
+
+msgid "Administrator account already exists"
+msgstr ""
+
+msgid "Administrator email is missing."
+msgstr ""
+
+msgid "Administrator password is missing."
+msgstr ""
+
+msgid "You are not allowed to login to admin area from :ip address"
+msgstr ""
+
+msgid "Check your login details"
+msgstr ""
+
+msgid "BoxBilling license order not found"
+msgstr ""
+
+msgid "Order is not activated"
+msgstr ""
+
+msgid "Forum not found"
+msgstr ""
+
+msgid "Forum Topic not found"
+msgstr ""
+
+msgid "Forum ID not passed"
+msgstr ""
+
+msgid "Forum topic not passed"
+msgstr ""
+
+msgid "Forum message not passed"
+msgstr ""
+
+msgid "Your message is too short"
+msgstr ""
+
+msgid "Forum is locked. No new topics can be started"
+msgstr ""
+
+msgid "Forum Topic ID not passed"
+msgstr ""
+
+msgid "Topic message not passed"
+msgstr ""
+
+msgid "Forum topic is locked. No new message can be posted"
+msgstr ""
+
+msgid "Forum id missing"
+msgstr ""
+
+msgid "Forum title is missing"
+msgstr ""
+
+msgid "Topic id is missing"
+msgstr ""
+
+msgid "Forum topic title not passed"
+msgstr ""
+
+msgid "Forum topic message not passed"
+msgstr ""
+
+msgid "Forum topic id missing"
+msgstr ""
+
+msgid "Forum Topic message ID not passed"
+msgstr ""
+
+msgid "Forum Topic Message not found"
+msgstr ""
+
+msgid "Forum Topic message not found"
+msgstr ""
+
+msgid "Message ID not passed"
+msgstr ""
+
+msgid "Client ID not passed"
+msgstr ""
+
+msgid "Amount not passed"
+msgstr ""
+
+msgid "Enter some keywords for search"
+msgstr ""
+
+msgid "Search keyword must be longer than 3 characters"
+msgstr ""
+
+msgid "File can not be downloaded at the moment. Please contact support"
+msgstr ""
+
+msgid "Order not found"
+msgstr ""
+
+msgid "File was not uploaded"
+msgstr ""
+
+msgid "Error uploading file"
+msgstr ""
+
+msgid "Product is not configured completely."
+msgstr ""
+
+msgid "plan_id is missing"
+msgstr ""
+
+msgid "Hosting plan not found"
+msgstr ""
+
+msgid "Server name is missing"
+msgstr ""
+
+msgid "Server IP is missing"
+msgstr ""
+
+msgid "Server manager is missing"
+msgstr ""
+
+msgid "Server id is missing"
+msgstr ""
+
+msgid "Server not found"
+msgstr ""
+
+msgid "Hosting plan id is missing"
+msgstr ""
+
+msgid "Hosting plan name is missing"
+msgstr ""
+
+msgid "Hoting plan name can not be empty"
+msgstr ""
+
+msgid ":hosting for :domain"
+msgstr ""
+
+msgid "Notification id is missing"
+msgstr ""
+
+msgid "Notification message was not found"
+msgstr ""
+
+msgid "Redirect id not passed"
+msgstr ""
+
+msgid "Redirect path not passed"
+msgstr ""
+
+msgid "Redirect target not passed"
+msgstr ""
+
+msgid "Redirect not found"
+msgstr ""
+
+msgid "Unknown API call :call"
+msgstr ""
+
+msgid "Unauthorized IP"
+msgstr ""
+
+msgid "Request limit reached"
+msgstr ""
+
+msgid "Unknow API call"
+msgstr ""
+
+msgid "Authentication Failed"
+msgstr ""
+
+msgid "Client API can be initiated"
+msgstr ""
+
+msgid "Hook event not passed"
+msgstr ""
+
+msgid "Param mod not passed"
+msgstr ""
+
+msgid "Article id not passed"
+msgstr ""
+
+msgid "Article not found"
+msgstr ""
+
+msgid "Article category id not passed"
+msgstr ""
+
+msgid "Article title not passed"
+msgstr ""
+
+msgid "Article id is missing"
+msgstr ""
+
+msgid "Caegory id not passed"
+msgstr ""
+
+msgid "Article Category not found"
+msgstr ""
+
+msgid "Category title not passed"
+msgstr ""
+
+msgid "Article item not found"
+msgstr ""
+
+msgid "Category ID or slug is missing"
+msgstr ""
+
+msgid "Knowledge base category not found"
+msgstr ""
+
+msgid "Invoice hash not passed"
+msgstr ""
+
+msgid "Invoice was not found"
+msgstr ""
+
+msgid "Paid Invoice can not be modified"
+msgstr ""
+
+msgid "Order id required"
+msgstr ""
+
+msgid "Order :id is free. No need to generate invoice."
+msgstr ""
+
+msgid "Invoice is related to order #:id. Please cancel order first."
+msgstr ""
+
+msgid "Invoice id not passed"
+msgstr ""
+
+msgid "Invoice item id not passed"
+msgstr ""
+
+msgid "Invoice item was not found"
+msgstr ""
+
+msgid "Transaction id is missing"
+msgstr ""
+
+msgid "Transaction not found"
+msgstr ""
+
+msgid "Transaction invoice id is missing"
+msgstr ""
+
+msgid "Payment gateway id is missing"
+msgstr ""
+
+msgid "Gateway was not found"
+msgstr ""
+
+msgid "Payment gateway code is missing"
+msgstr ""
+
+msgid "Payment gateway is not available for installation."
+msgstr ""
+
+msgid "Gateway id not passed"
+msgstr ""
+
+msgid "Gateway not found"
+msgstr ""
+
+msgid "Client id not passed"
+msgstr ""
+
+msgid "Payment gateway id not passed"
+msgstr ""
+
+msgid "Subscription currency not passed"
+msgstr ""
+
+msgid "Payment gateway not found"
+msgstr ""
+
+msgid ""
+"Client currency must match subscription currency. Check if clients currency "
+"is defined."
+msgstr ""
+
+msgid "Subscription id not passed"
+msgstr ""
+
+msgid "Subscription not found"
+msgstr ""
+
+msgid "Subscription id or sid not passed"
+msgstr ""
+
+msgid "Tax id is missing"
+msgstr ""
+
+msgid "Tax rule not found"
+msgstr ""
+
+msgid "Tax name is missing"
+msgstr ""
+
+msgid "Tax rate is missing or is not valid"
+msgstr ""
+
+msgid "Invoice hash not passed. Missing param hash"
+msgstr ""
+
+msgid "Payment method not found. Missing param gateway_id"
+msgstr ""
+
+msgid "Invoice not found"
+msgstr ""
+
+msgid "Payment method not found"
+msgstr ""
+
+msgid "Payment method not enabled"
+msgstr ""
+
+msgid "Payment method can not perform single payment"
+msgstr ""
+
+msgid "Payment method can not perform reccurent payment"
+msgstr ""
+
+msgid "This invoice can't be subscribed"
+msgstr ""
+
+msgid "Transaction :id not found."
+msgstr ""
+
+msgid "Payment adapter :adapter does not support action :action"
+msgstr ""
+
+msgid "API call is missing arguments"
+msgstr ""
+
+msgid "Currency code is missing"
+msgstr ""
+
+msgid "Currency not found"
+msgstr ""
+
+msgid "Currency format is missing"
+msgstr ""
+
+msgid "Currency already registered"
+msgstr ""
+
+msgid "Currency code is not valid"
+msgstr ""
+
+msgid "Currency rate is not valid"
+msgstr ""
+
+msgid ""
+"You have already used this promo code. Please remove promo code and checkout "
+"again."
+msgstr ""
+
+msgid "Can not checkout empty cart."
+msgstr ""
+
+msgid ""
+"Selected currency :selected does not match your profile currency :code. "
+"Please change cart currency to continue."
+msgstr ""
+
+msgid "Shopping cart id is missing"
+msgstr ""
+
+msgid "Shopping cart not found"
+msgstr ""
+
+msgid "Currency code not passed"
+msgstr ""
+
+msgid "Promo code not passed"
+msgstr ""
+
+msgid "Promo code is expired or does not exist"
+msgstr ""
+
+msgid "Cart item id not passed"
+msgstr ""
+
+msgid "Solusvm order not found"
+msgstr ""
+
+msgid "Node is not selected for import."
+msgstr ""
+
+msgid "No servers selected for import."
+msgstr ""
+
+msgid "Select product for orders."
+msgstr ""
+
+msgid ""
+"Product is not configured completely. Please provide solusvm node in product "
+"configuration page."
+msgstr ""
+
+msgid ""
+"Product is not configured completely. Please provide solusvm plan in product "
+"configuration page."
+msgstr ""
+
+msgid "No clients selected for import."
+msgstr ""
+
+msgid "No clients found on SolusVM server."
+msgstr ""
+
+msgid "Virtual private server :title"
+msgstr ""
+
+msgid "Please enter VPS hostname."
+msgstr ""
+
+msgid "Hostname :hostname is not valid."
+msgstr ""
+
+msgid "Please select VPS template."
+msgstr ""
+
+msgid "SolusVM API ID is missing."
+msgstr ""
+
+msgid "SolusVM API KEY is missing."
+msgstr ""
+
+msgid "SolusVM API ipaddress is missing."
+msgstr ""
+
+msgid "SolusVM API secure is missing."
+msgstr ""
+
+msgid "SolusVM API port is missing."
+msgstr ""
+
+msgid "Could not activate order because ordered product does not exists"
+msgstr ""
+
+msgid ""
+"Could not activate order. Product :id configuration is missing node parameter"
+msgstr ""
+
+msgid ""
+"Could not activate order. Product :id configuration is missing plan parameter"
+msgstr ""
+
+msgid ""
+"Could not activate order. Product :id configuration is missing "
+"virtualization type parameter"
+msgstr ""
+
+msgid ""
+"Could not activate order. Product :id configuration is missing ips amount "
+"parameter"
+msgstr ""
+
+msgid "Root password must be longer than 4 symbols"
+msgstr ""
+
+msgid "Plan name must not be empty"
+msgstr ""
+
+msgid "Hostname must not be empty"
+msgstr ""
+
+msgid "Template must not be empty"
+msgstr ""
+
+msgid "Password must be longer than 4 symbols"
+msgstr ""
+
+msgid "TLD is missing"
+msgstr ""
+
+msgid "Tld already registered"
+msgstr ""
+
+msgid "TLD registrar id is missing"
+msgstr ""
+
+msgid "Registration price is missing"
+msgstr ""
+
+msgid "Renewal price is missing"
+msgstr ""
+
+msgid "Transfer price is missing"
+msgstr ""
+
+msgid "Registrar code not passed"
+msgstr ""
+
+msgid "Registrar is not available for installation."
+msgstr ""
+
+msgid "Registrar id not passed"
+msgstr ""
+
+msgid "Registrar not found"
+msgstr ""
+
+msgid "Registrar id is missing"
+msgstr ""
+
+msgid "Domain order is not activated"
+msgstr ""
+
+msgid "Tld is required"
+msgstr ""
+
+msgid "Sld is required"
+msgstr ""
+
+msgid "Domain :domain is not valid"
+msgstr ""
+
+msgid "Domain availability could not be determined. TLD is not active."
+msgstr ""
+
+msgid "Domain is not available."
+msgstr ""
+
+msgid "TLD is not active."
+msgstr ""
+
+msgid "Domain can not be transferred."
+msgstr ""
+
+msgid "Domain :domain registration"
+msgstr ""
+
+msgid "Domain :domain transfer"
+msgstr ""
+
+msgid "Only pending and failed setup orders can be deleted."
+msgstr ""
+
+msgid "This feature is available in BoxBilling PRO version."
+msgstr ""
+
+msgid "Currency could not be determined for order"
+msgstr ""
+
+msgid "Product :id is out of stock."
+msgstr ""
+
+msgid "Group ID parameter is missing for addon product order"
+msgstr ""
+
+msgid "Parent order :group_id was not found"
+msgstr ""
+
+msgid "Only pending setup or failed orders can be activated"
+msgstr ""
+
+msgid "Only suspended orders can be unsuspended"
+msgstr ""
+
+msgid "Only canceled orders can be uncanceled"
+msgstr ""
+
+msgid "Order config not passed"
+msgstr ""
+
+msgid "Order status was not passed"
+msgstr ""
+
+msgid "Order history line id not passed"
+msgstr ""
+
+msgid "Order history line not found"
+msgstr ""
+
+msgid "Automatically issue renewal invoices"
+msgstr ""
+
+msgid "Issue invoices manually"
+msgstr ""
+
+msgid "Order id not passed"
+msgstr ""
+
+msgid "Theme code is missing"
+msgstr ""
+
+msgid "Theme preset name is missing"
+msgstr ""
+
+msgid ""
+"Theme \":name\" assets folder is not writable. Files can not be uploaded and "
+"settings can not be saved. Set folder permissions to 777"
+msgstr ""
+
+msgid ""
+"Theme \":name\" assets folder is not writable. Set folder :folder "
+"permissions to 777"
+msgstr ""
+
+msgid "Theme \":name\" is not configurable"
+msgstr ""
+
+msgid "Theme \":name\" does not exists"
+msgstr ""
+
+msgid "Error uploading file :file Error code: :error"
+msgstr ""
diff --git a/src/bb-modules/Activity/Api/Admin.php b/src/bb-modules/Activity/Api/Admin.php
new file mode 100644
index 000000000..8ce82d8e8
--- /dev/null
+++ b/src/bb-modules/Activity/Api/Admin.php
@@ -0,0 +1,120 @@
+di['pager']->getPer_page();
+ list($sql, $params) = $this->getService()->getSearchQuery($data);
+ $pager = $this->di['pager']->getSimpleResultSet($sql, $params, $per_page);
+
+ foreach ($pager['list'] as $key => $item) {
+ if (isset($item['staff_id'])) {
+ $pager['list'][$key]['staff']['id'] = $item['staff_id'];
+ $pager['list'][$key]['staff']['name'] = $item['staff_name'];
+ $pager['list'][$key]['staff']['email'] = $item['staff_email'];
+ }
+ if (isset($item['client_id'])) {
+ $pager['list'][$key]['client']['id'] = $item['client_id'];
+ $pager['list'][$key]['client']['name'] = $item['client_name'];
+ $pager['list'][$key]['client']['email'] = $item['client_email'];
+ }
+ }
+
+ return $pager;
+ }
+
+ /**
+ * Add message to log
+ *
+ * @param string $m - Message text
+ * @optional int $admin_id - admin id
+ * @optional int $client_id - client id
+ * @optional string $priority - log priority
+ *
+ * @return bool
+ */
+ public function log($data)
+ {
+ if(!isset($data['m'])) {
+ return false;
+ }
+
+ $priority = isset($data['priority']) ? (int)$data['priority'] : 6;
+
+ $entry = $this->di['db']->dispense('ActivitySystem');
+ $entry->client_id = isset($data['client_id']) ? $data['client_id'] : NULL;
+ $entry->admin_id = isset($data['admin_id']) ? $data['admin_id'] : NULL;
+ $entry->priority = $priority;
+ $entry->message = $data['m'];
+ $entry->created_at = date('c');
+ $entry->updated_at = date('c');
+ $entry->ip = $this->di['request']->getClientAddress();
+ $this->di['db']->store($entry);
+
+ return true;
+ }
+
+ /**
+ * Add email to log
+ *
+ * @return bool
+ */
+ public function log_email($data)
+ {
+ if (!isset($data['subject'])) {
+ error_log('Email was not logged. Subject not passed');
+ return false;
+ }
+
+ $client_id = isset($data['client_id']) ? $data['client_id'] : NULL;
+ $sender = isset($data['sender']) ? $data['sender'] : NULL;
+ $recipients = isset($data['recipients']) ? $data['recipients'] : NULL;
+ $subject = isset($data['subject']) ? $data['subject'] : NULL;
+ $content_html = isset($data['content_html']) ? $data['content_html'] : NULL;
+ $content_text = isset($data['content_text']) ? $data['content_text'] : NULL;
+
+ return $this->getService()->logEmail($subject, $client_id, $sender, $recipients, $subject, $content_html, $content_text);
+ }
+
+ /**
+ * Remove activity message
+ *
+ * @param int $id - Message ID
+ */
+ public function log_delete($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('ID is required');
+ }
+
+ $database = $this->di['db'];
+ $model = $database->load('ActivitySystem', $data['id']);
+ if(!$model instanceof \Model_ActivitySystem) {
+ throw new \Box_Exception('Event not found');
+ }
+
+ $database->trash($model);
+ return true;
+ }
+}
diff --git a/src/bb-modules/Activity/Controller/Admin.php b/src/bb-modules/Activity/Controller/Admin.php
new file mode 100644
index 000000000..ddcb23031
--- /dev/null
+++ b/src/bb-modules/Activity/Controller/Admin.php
@@ -0,0 +1,67 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function fetchNavigation()
+ {
+ return array(
+ 'group'=> array(
+ 'index' => 700,
+ 'location' => 'activity',
+ 'label' => 'Activity',
+ 'class' => 'graphs',
+ ),
+ 'subpages'=> array(
+ array(
+ 'location' => 'activity',
+ 'label' => 'Events history',
+ 'index' => 100,
+ 'uri' => $this->di['url']->adminLink('activity'),
+ 'class' => '',
+ ),
+ ),
+ );
+ }
+
+ public function register(\Box_App &$app)
+ {
+ $app->get('/activity', 'get_index', array(), get_class($this));
+ }
+
+ public function get_index(\Box_App $app)
+ {
+ $api = $app->getApiAdmin();
+ return $app->render('mod_activity_index');
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Activity/Service.php b/src/bb-modules/Activity/Service.php
new file mode 100644
index 000000000..25eef59f8
--- /dev/null
+++ b/src/bb-modules/Activity/Service.php
@@ -0,0 +1,179 @@
+di = $di;
+ }
+
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function logEvent($data)
+ {
+ $entry = $this->di['db']->dispense('ActivityClientEmail');
+ $entry->client_id = isset($data['client_id']) ? $data['client_id'] : NULL;
+ $entry->sender = isset($data['sender']) ? $data['sender'] : NULL;
+ $entry->recipients = isset($data['recipients']) ? $data['recipients'] : NULL;
+ $entry->subject = isset($data['subject']) ? $data['subject'] : NULL;
+ $entry->content_html = isset($data['content_html']) ? $data['content_html'] : NULL;
+ $entry->content_text = isset($data['content_text']) ? $data['content_text'] : NULL;
+ $entry->created_at = isset($data['timestamp']) ? $data['timestamp'] : NULL;
+ $entry->updated_at = isset($data['timestamp']) ? $data['timestamp'] : NULL;
+ $this->di['db']->store($entry);
+ }
+
+ /** EVENTS **/
+
+ /*
+ public static function onEventAdminLoginFailed(Box_Event $event)
+ {
+ $api = $event->getApiAdmin();
+ $params = $event->getParameters();
+ $ip = $params['ip'];
+ throw new Exception('Wait 2 minutes');
+ }
+ */
+
+ public static function onAfterClientLogin(\Box_Event $event)
+ {
+ $params = $event->getParameters();
+ $di = $event->getDi();
+
+ $log = $di['db']->dispense('ActivityClientHistory');
+ $log->client_id = $params['id'];
+ $log->ip = $params['ip'];
+ $log->created_at = date('c');
+ $log->updated_at = date('c');
+
+ $di['db']->store($log);
+ }
+
+ public static function onAfterAdminLogin(\Box_Event $event)
+ {
+ $params = $event->getParameters();
+ $di = $event->getDi();
+
+ $log= $di['db']->dispense('ActivityAdminHistory');
+ $log->admin_id = $params['id'];
+ $log->ip = $params['ip'];
+ $log->created_at = date('c');
+ $log->updated_at = date('c');
+
+ $di['db']->store($log);
+ }
+
+ public function getSearchQuery($data)
+ {
+
+ $sql = 'SELECT m.*, a.id as staff_id, a.email as staff_email, a.name as staff_name, c.id as client_id, CONCAT(c.first_name, " ", c.last_name) as client_name, c.email as client_email
+ FROM activity_system as m
+ left join admin as a on a.id = m.admin_id
+ left join client as c on c.id = m.client_id';
+
+ $params = array();
+ $search = isset($data['search']) ? $data['search'] : NULL;
+ $priority = isset($data['priority']) ? $data['priority'] : NULL;
+ $only_staff = isset($data['only_staff']) ? $data['only_staff'] : NULL;
+ $only_clients = isset($data['only_clients']) ? $data['only_clients'] : NULL;
+ $no_info = isset($data['no_info']) ? $data['no_info'] : NULL;
+ $no_debug = isset($data['no_debug']) ? $data['no_debug'] : NULL;
+ $where = array ();
+ if($priority) {
+ $where[] = 'm.priority = :priority';
+ $params[':priority'] = $priority;
+ }
+
+ if($no_info) {
+ $where[] = 'm.priority < :priority';
+ $params[':priority'] = \Box_Log::INFO;
+ }
+
+ if($no_debug) {
+ $where[] = 'm.priority < :priority';
+ $params[':priority'] = \Box_Log::DEBUG;
+ }
+
+ if($only_staff) {
+ $where[] = 'm.admin_id IS NOT NULL';
+ }
+
+ if($only_clients) {
+ $where[] = 'm.client_id IS NOT NULL';
+ }
+
+ if($search) {
+ $where[] = 'm.message LIKE :search OR m.ip LIKE :search2';
+ $params[':search'] = $search;
+ $params[':search2'] = $search;
+ }
+
+ if (count ($where) > 0){
+ $whereStatment = implode(' and ', $where);
+ $sql .= ' WHERE '.$whereStatment;
+ }
+
+ $sql .= ' ORDER by m.id desc';
+ return array($sql, $params);
+ }
+
+ public function logEmail($subject, $clientId = null, $sender = null, $recipients = null, $subject = null, $content_html = null, $content_text = null)
+ {
+ $entry = $this->di['db']->dispense('ActivityClientEmail');
+
+ $entry->client_id = $clientId;
+ $entry->sender = $sender;
+ $entry->recipients = $recipients;
+ $entry->subject = $subject;
+ $entry->content_html = $content_html;
+ $entry->content_text = $content_text;
+ $entry->created_at = date('c');
+ $entry->updated_at = date('c');
+
+ $this->di['db']->store($entry);
+
+ return true;
+ }
+
+ public function toApiArray(\Model_ActivityClientHistory $model)
+ {
+ $client = $this->di['db']->getExistingModelById('Client', $model->client_id, 'Client not found');
+ return array(
+ 'id' => $model->id,
+ 'ip' => $model->ip,
+ 'created_at' => $model->created_at,
+ 'client' => array(
+ 'id' => $client->id,
+ 'first_name' => $client->first_name,
+ 'last_name' => $client->last_name,
+ 'email' => $client->email,
+ )
+ );
+ }
+
+ public function rmByClient(\Model_Client $client)
+ {
+ $models = $this->di['db']->find('ActivitySystem', 'client_id = ?', array($client->id));
+ foreach($models as $model){
+ $this->di['db']->trash($model);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Activity/manifest.json b/src/bb-modules/Activity/manifest.json
new file mode 100644
index 000000000..c3a3df6ed
--- /dev/null
+++ b/src/bb-modules/Activity/manifest.json
@@ -0,0 +1,7 @@
+{
+ "id": "activity",
+ "type": "mod",
+ "name": "Activity",
+ "description": "BoxBilling core module",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Api/Controller/Client.php b/src/bb-modules/Api/Controller/Client.php
new file mode 100644
index 000000000..9cddb1e4f
--- /dev/null
+++ b/src/bb-modules/Api/Controller/Client.php
@@ -0,0 +1,165 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function register(\Box_App &$app)
+ {
+ $app->post('/api/:role/:class/:method', 'post_method', array('role', 'class', 'method'), get_class($this));
+ $app->get('/api/:role/:class/:method', 'get_method', array('role', 'class', 'method'), get_class($this));
+
+ //all other requests are error requests
+ $app->get('/api/:page', 'show_error', array('page' => '(.?)+'), get_class($this));
+ $app->post('/api/:page', 'show_error', array('page' => '(.?)+'), get_class($this));
+ }
+
+ public function show_error(\Box_App $app, $page)
+ {
+ $exc = new \Box_Exception('Unknown API call :call', array(':call'=>$page), 879);
+ return $this->renderJson(null, $exc);
+ }
+
+ public function get_method(\Box_App $app, $role, $class, $method)
+ {
+ $call = $class.'_'.$method;
+ return $this->tryCall($role, $call, $_GET);
+ }
+
+ public function post_method(\Box_App $app, $role, $class, $method)
+ {
+ $p = $_POST;
+
+ // adding support for raw post input with json string
+ $input = file_get_contents("php://input");
+ if(empty($p) && !empty($input)) {
+ $p = @json_decode($input, 1);
+ }
+
+ $call = $class.'_'.$method;
+ return $this->tryCall($role, $call, $p);
+ }
+
+ private function tryCall($role, $call, $p)
+ {
+ try {
+ $this->_apiCall($role, $call, $p);
+ } catch (\Exception $exc) {
+ $this->renderJson(null, $exc);
+ }
+ }
+
+ private function _loadConfig()
+ {
+ if(is_null($this->_api_config)) {
+ $this->_api_config = $this->di['config']['api'];
+ }
+ }
+
+ private function _apiCall($role, $method, $params)
+ {
+ $this->_loadConfig();
+
+ $ips = $this->_api_config['allowed_ips'];
+ if(!empty($ips) && !in_array($this->_getIp(), $ips)) {
+ throw new \Box_Exception('Unauthorized IP', null, 1002);
+ }
+
+ $this->di['license']->check();
+
+ $service = $this->di['mod_service']('api');
+ $service->logRequest();
+
+ // Rate limit
+ $rate_span = $this->_api_config['rate_span'];
+ $rate_limit = $this->_api_config['rate_limit'];
+ $requests = $service->getRequestCount(time() - $rate_span, $this->_getIp());
+ $requests_left = $rate_limit - $requests;
+ $this->_requests_left = $requests_left;
+ if ($requests_left < 0) {
+ throw new \Box_Exception('Request limit reached', null, 1003);
+ }
+
+ // snake oil: check request is from the same domain as boxbilling is installed if present
+ $check_referer_header = isset($this->_api_config['require_referrer_header']) ? (bool)$this->_api_config['require_referrer_header'] : false;
+ if($check_referer_header) {
+ $url = strtolower(BB_URL);
+ $referer = isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : null ;
+ if(!$referer || $url != substr($referer, 0, strlen($url))) {
+ throw new \Box_Exception('Invalid request. Make sure request origin is :from', array(':from'=>BB_URL), 1004);
+ }
+ }
+
+ $api = $this->di['api']($role);
+ $result = $api->$method($params);
+ return $this->renderJson($result);
+ }
+
+ public function renderJson($data = NULL, \Exception $e = NULL)
+ {
+ // do not emit response if headers already sent
+ if (headers_sent()) {
+ return ;
+ }
+
+ $this->_loadConfig();
+
+ header('Cache-Control: no-cache, must-revalidate');
+ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+ header('Content-type: application/json; charset=utf-8');
+ header('X-BoxBilling-Version: '.\Box_Version::VERSION);
+ header('X-RateLimit-Span: '.$this->_api_config['rate_span']);
+ header('X-RateLimit-Limit: '.$this->_api_config['rate_limit']);
+ header('X-RateLimit-Remaining: '.$this->_requests_left);
+ if(NULL !== $e) {
+ error_log($e->getMessage().' '.$e->getCode());
+ $code = $e->getCode() ? $e->getCode() : 9999;
+ $result = array('result'=>NULL, 'error'=>array('message'=>$e->getMessage(), 'code'=>$code));
+ } else {
+ $result = array('result'=>$data, 'error'=> NULL);
+ }
+ print json_encode($result);
+ exit;
+ }
+
+ private function _getIp()
+ {
+ return $this->di['request']->getClientAddress();
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Api/Service.php b/src/bb-modules/Api/Service.php
new file mode 100644
index 000000000..a1c366f8e
--- /dev/null
+++ b/src/bb-modules/Api/Service.php
@@ -0,0 +1,104 @@
+di = $di;
+ }
+
+ /**
+ * @return \Box_Di
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ /**
+ * @return int - 1
+ */
+ public function logRequest()
+ {
+ $request = $this->di['request'];
+ $sql="
+ INSERT INTO api_request (ip, request, created_at)
+ VALUES(:ip, :request, NOW())
+ ";
+ $values = array(
+ 'ip' => $request->getClientAddress(),
+ 'request' => $request->getURI(),
+ );
+ return $this->di['db']->exec($sql, $values);
+ }
+
+ /**
+ * @param int $since - timestamp
+ * @param string|null $ip
+ * @return int
+ */
+ public function getRequestCount($since, $ip = null)
+ {
+ if (!is_numeric($since)){
+ $since = strtotime($since);
+ }
+ $sinceIso = date('c', $since);
+ $values = array(
+ 'since' => $sinceIso,
+ );
+ $sql="
+ SELECT COUNT(id) as cc
+ FROM api_request
+ WHERE created_at > :since
+ ";
+
+ if(null != $ip) {
+ $sql .= " AND ip = :ip";
+ $values['ip'] = $ip;
+ }
+
+ return (int)$this->di['db']->getCell($sql, $values);
+ }
+
+ /**
+ * @deprecated use DI
+ */
+ public function getApiGuest()
+ {
+ return $this->di['api_guest'];
+ }
+
+
+ /**
+ * @deprecated use DI
+ */
+ public function getApiClient($id)
+ {
+ return $this->di['api_client'];
+ }
+
+ /**
+ * @deprecated use DI
+ */
+ public function getApiAdmin($id = null)
+ {
+ return $this->di['api_admin'];
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Api/manifest.json b/src/bb-modules/Api/manifest.json
new file mode 100644
index 000000000..8dd8e6913
--- /dev/null
+++ b/src/bb-modules/Api/manifest.json
@@ -0,0 +1,7 @@
+{
+ "id": "api",
+ "type": "mod",
+ "name": "API",
+ "description": "BoxBilling core module",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Branding/Service.php b/src/bb-modules/Branding/Service.php
new file mode 100644
index 000000000..bc1d5afb2
--- /dev/null
+++ b/src/bb-modules/Branding/Service.php
@@ -0,0 +1,44 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function uninstall()
+ {
+ if(!$this->di['license']->isPro()) {
+ throw new \Exception('Branding module can only be disabled for PRO license owners', 509);
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/src/bb-modules/Branding/manifest.json b/src/bb-modules/Branding/manifest.json
new file mode 100644
index 000000000..a621c2a8b
--- /dev/null
+++ b/src/bb-modules/Branding/manifest.json
@@ -0,0 +1,11 @@
+{
+ "id": "branding",
+ "type": "mod",
+ "name": "Branding",
+ "description": "BoxBilling branding module. Can be deactivated by PRO license owners only.",
+ "homepage_url": "http://github.com/boxbilling/",
+ "author": "BoxBilling",
+ "author_url": "http://extensions.boxbilling.com/",
+ "license": "http://www.boxbilling.com/license.txt",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cart/Api/Admin.php b/src/bb-modules/Cart/Api/Admin.php
new file mode 100644
index 000000000..cbef8b45a
--- /dev/null
+++ b/src/bb-modules/Cart/Api/Admin.php
@@ -0,0 +1,78 @@
+getService()->getSearchQuery($data);
+ $per_page = isset($data['per_page']) ? $data['per_page'] : $this->di['pager']->getPer_page();
+ $pager = $this->di['pager']->getSimpleResultSet($sql, $params, $per_page);
+
+ foreach ($pager['list'] as $key => $cartArr){
+ $cart = $this->di['db']->getExistingModelById('Cart', $cartArr['id'], 'Cart not found');
+ $pager['list'][$key] = $this->getService()->toApiArray($cart);
+ }
+
+ return $pager;
+ }
+
+ /**
+ * Get shopping cart contents by id
+ * @param int $id - shoppoing cart id
+ * @return array - shopping cart contents
+ */
+ public function get($data)
+ {
+ $required = array(
+ 'id' => 'Shopping cart id is missing',
+ );
+ $this->di['validator']->checkRequiredParamsForArray($required, $data);
+
+ $cart = $this->di['db']->getExistingModelById('Cart', $data['id'], 'Shopping cart not found');
+
+ return $this->getService()->toApiArray($cart);
+ }
+
+ /**
+ * Remove shopping carts that are older than a week and was not ordered
+ *
+ * @BOXBILLING_CRON
+ * @return bool
+ */
+ public function batch_expire($data)
+ {
+ $this->di['logger']->info('Executed action to clear expired shopping carts from database');
+
+ $query = "SELECT id, created_at FROM `cart` WHERE DATEDIFF(CURDATE(), created_at) > 7;";
+ $list = $this->di['db']->getAssoc($query);
+ if ($list) {
+ foreach ($list as $id => $created_at) {
+ $this->di['db']->exec('DELETE FROM `cart_product` WHERE cart_id = :id', array(':id' => $id));
+ $this->di['db']->exec('DELETE FROM `cart` WHERE id = :id', array(':id' => $id));
+ }
+ $this->di['logger']->info('Removed %s expired shopping carts', count($list));
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cart/Api/Client.php b/src/bb-modules/Cart/Api/Client.php
new file mode 100644
index 000000000..32e60d187
--- /dev/null
+++ b/src/bb-modules/Cart/Api/Client.php
@@ -0,0 +1,35 @@
+getService()->getSessionCart();
+ $client = $this->getIdentity();
+ return $this->getService()->checkoutCart($cart, $client, $gateway_id);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cart/Api/Guest.php b/src/bb-modules/Cart/Api/Guest.php
new file mode 100644
index 000000000..e57465fee
--- /dev/null
+++ b/src/bb-modules/Cart/Api/Guest.php
@@ -0,0 +1,178 @@
+getService()->getSessionCart();
+
+ return $this->getService()->toApiArray($cart);
+ }
+
+ /**
+ * Completely remove shopping cart contents
+ *
+ * @return bool
+ */
+ public function reset()
+ {
+ $cart = $this->getService()->getSessionCart();
+
+ return $this->getService()->resetCart($cart);
+ }
+
+ /**
+ * Set shopping cart currency
+ *
+ * @param string $currency - New currency code to applied to shopping cart
+ *
+ * @return bool
+ */
+ public function set_currency($data)
+ {
+ $required = array(
+ 'currency' => 'Currency code not passed',
+ );
+ $this->di['validator']->checkRequiredParamsForArray($required, $data);
+
+ $currencyService = $this->di['mod_service']('currency');
+ $currency = $currencyService->getByCode($data['currency']);
+ if (!$currency instanceof \Model_Currency) {
+ throw new \Box_Exception('Currency not found');
+ }
+ $cart = $this->getService()->getSessionCart();
+
+ return $this->getService()->changeCartCurrency($cart, $currency);
+ }
+
+ /**
+ * Retrieve information about currently selected shopping cart currency
+ *
+ * @return array - Currency details
+ */
+ public function get_currency()
+ {
+ $cart = $this->getService()->getSessionCart();
+
+ $currencyService = $this->di['mod_service']('currency');
+ $currency = $this->di['db']->load('Currency', $cart->currency_id);
+ if (!$currency instanceof \Model_Currency) {
+ $currency = $currencyService->getDefault();
+ }
+
+ return $currencyService->toApiArray($currency);
+ }
+
+ /**
+ * Apply Promo code to shopping cart
+ *
+ * @param string $promocode - Promo code string
+ *
+ * @return bool
+ */
+ public function apply_promo($data)
+ {
+ $required = array(
+ 'promocode' => 'Promo code not passed',
+ );
+ $this->di['validator']->checkRequiredParamsForArray($required, $data);
+
+
+ $promo = $this->getService()->findActivePromoByCode($data['promocode']);
+ if (!$promo instanceof \Model_Promo) {
+ throw new \Box_Exception('Promo code is expired or does not exist');
+ }
+
+ if (!$this->getService()->promoCanBeApplied($promo)) {
+ throw new \Box_Exception('Promo code is expired or does not exist');
+ }
+
+ $cart = $this->getService()->getSessionCart();
+
+ return $this->getService()->applyPromo($cart, $promo);
+ }
+
+ /**
+ * Removes promo from shopping cart and resets discounted prices if any
+ *
+ * @return bool
+ */
+ public function remove_promo()
+ {
+ $cart = $this->getService()->getSessionCart();
+
+ return $this->getService()->removePromo($cart);
+ }
+
+ /**
+ * Removes product from shoping cart
+ *
+ * @param int $id - Shopping cart item id
+ *
+ * @return bool
+ */
+ public function remove_item($data)
+ {
+ $required = array(
+ 'id' => 'Cart item id not passed',
+ );
+ $this->di['validator']->checkRequiredParamsForArray($required, $data);
+
+ $cart = $this->getService()->getSessionCart();
+
+ return $this->getService()->removeProduct($cart, $data['id']);
+ }
+
+ /**
+ * Adds product to shopping cart
+ *
+ * @param int $id - Product ID
+ *
+ * @optional bool $multiple - Default false. Allow multiple items in cart
+ * @optional string $period - Billing period
+ * @optional int $quantity - Products quantity
+ * @optional array $config - Product configuration options
+ * @optional array $addons - List of addons ids
+ *
+ * @return bool
+ */
+ public function add_item($data)
+ {
+ $required = array(
+ 'id' => 'Product id not passed',
+ );
+ $this->di['validator']->checkRequiredParamsForArray($required, $data);
+
+ $cart = $this->getService()->getSessionCart();
+
+ $product = $this->di['db']->getExistingModelById('Product', $data['id'], 'Product not found');
+
+ //reset cart by default
+ if (!isset($data['multiple']) || !$data['multiple']) {
+ $this->reset();
+ }
+
+ return $this->getService()->addItem($cart, $product, $data);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cart/Controller/Client.php b/src/bb-modules/Cart/Controller/Client.php
new file mode 100644
index 000000000..524fd04d4
--- /dev/null
+++ b/src/bb-modules/Cart/Controller/Client.php
@@ -0,0 +1,45 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function register(\Box_App &$app)
+ {
+ $app->get('/cart', 'get_cart', array(), get_class($this));
+ }
+
+ public function get_cart(\Box_App $app)
+ {
+ return $app->render('mod_cart_index');
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cart/Service.php b/src/bb-modules/Cart/Service.php
new file mode 100644
index 000000000..035bbd177
--- /dev/null
+++ b/src/bb-modules/Cart/Service.php
@@ -0,0 +1,719 @@
+di = $di;
+ }
+
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function getSearchQuery($data)
+ {
+ $sql = "
+ SELECT cart.id FROM cart
+ LEFT JOIN currency ON cart.currency_id = currency.id
+ LEFT JOIN promo ON cart.promo_id = promo.id";
+
+ return array($sql, array());
+ }
+
+ public function getSessionCart()
+ {
+ $sqlBindings = array(':session_id' => $this->di['session']->getId());
+ $cart = $this->di['db']->findOne('Cart', 'session_id = :session_id', $sqlBindings);
+
+ if ($cart instanceof \Model_Cart) {
+ return $cart;
+ }
+
+ $cc = $this->di['mod_service']('currency');
+
+ if ($this->di['session']->get('client_id')) {
+ $client_id = $this->di['session']->get('client_id');
+ $currency = $cc->getCurrencyByClientId($client_id);
+ } else {
+ $currency = $cc->getDefault();
+ }
+
+ $cart = $this->di['db']->dispense('Cart');
+ $cart->session_id = $this->di['session']->getId();
+ $cart->currency_id = $currency->id;
+ $cart->created_at = date('c');
+ $cart->updated_at = date('c');
+ $this->di['db']->store($cart);
+
+ return $cart;
+ }
+
+ public function addItem(\Model_Cart $cart, \Model_Product $product, array $data)
+ {
+ $event_params = array_merge($data, array('cart_id' => $cart->id, 'product_id' => $product->id));
+ $this->di['events_manager']->fire(array('event' => 'onBeforeProductAddedToCart', 'params' => $event_params));
+
+ $productService = $product->getService();
+
+ if ($this->isRecurrentPricing($product)) {
+ if (!isset($data['period'])) {
+ throw new \Box_Exception('Period parameter not passed');
+ }
+
+ if (!$this->isPeriodEnabledForProduct($product, $data['period'])) {
+ throw new \Box_Exception('Selected billing period is not valid');
+ }
+ }
+
+ $qty = isset($data['quantity']) ? $data['quantity'] : 1;
+ // check stock
+ if (!$this->isStockAvailable($product, $qty)) {
+ throw new \Box_Exception("I'm afraid we are out of stock.");
+ }
+
+ $addons = isset($data['addons']) ? $data['addons'] : array();
+ unset($data['id']);
+ unset($data['addons']);
+
+ $list = array();
+ $list[] = array(
+ 'product' => $product,
+ 'config' => $data,
+ );
+
+ //check for required domain product
+ if (method_exists($productService, 'getDomainProductFromConfig')) {
+ $dc = $productService->getDomainProductFromConfig($product, $data);
+ if (isset($dc['config']) && $dc['product'] && $dc['product'] instanceof \Model_Product) {
+ $list[] = $dc;
+ }
+ }
+
+ $productService = $this->di['mod_service']('Product');
+ foreach ($addons as $id => $ac) {
+ if (isset($ac['selected']) && (bool)$ac['selected']) {
+ $addon = $productService->getAddonById($id);
+ if ($addon instanceof \Model_Product) {
+ if ($this->isRecurrentPricing($addon)) {
+ if (!isset($ac['period'])) {
+ throw new \Box_Exception('Addon period parameter not passed');
+ }
+
+ if (!$this->isPeriodEnabledForProduct($addon, $ac['period'])) {
+ throw new \Box_Exception('Selected billing period is not valid for addon');
+ }
+ }
+
+ $list[] = array(
+ 'product' => $addon,
+ 'config' => $ac,
+ );
+ } else {
+ error_log('Addon not found by id ' . $id);
+ }
+ }
+ }
+
+ foreach ($list as $c) {
+ $productFromList = $c['product'];
+ $productFromListConfig = $c['config'];
+
+ $productServiceFromList = $productFromList->getService();
+
+ //@deprecated logic
+ if (method_exists($productServiceFromList, 'prependOrderConfig')) {
+ $productFromListConfig = $productServiceFromList->prependOrderConfig($productFromList, $productFromListConfig);
+ }
+
+ if (method_exists($productServiceFromList, 'attachOrderConfig')) {
+ $model = $this->di['db']->load('Product', $productFromList->id);
+ $productFromListConfig = $productServiceFromList->attachOrderConfig($model, $productFromListConfig);
+ }
+ if (method_exists($productServiceFromList, 'validateOrderData')) {
+ $productServiceFromList->validateOrderData($productFromListConfig);
+ }
+ if (method_exists($productServiceFromList, 'validateCustomForm')) {
+ $productServiceFromList->validateCustomForm($productFromListConfig, $this->di['db']->toArray($productFromList));
+ }
+ $this->addProduct($cart, $productFromList, $productFromListConfig);
+ }
+
+ $this->di['logger']->info('Added "%s" to shopping cart', $product->title);
+
+ $this->di['events_manager']->fire(array('event' => 'onAfterProductAddedToCart', 'params' => $event_params));
+
+ return true;
+ }
+
+ public function isStockAvailable(\Model_Product $product, $qty)
+ {
+ if ($product->stock_control) {
+ return ($product->quantity_in_stock >= $qty);
+ }
+
+ return TRUE;
+ }
+
+ public function isRecurrentPricing(\Model_Product $model)
+ {
+ $productTable = $model->getTable();
+ $pricing = $productTable->getPricingArray($model);
+ return (isset($pricing['type']) && $pricing['type'] == \Model_ProductPayment::RECURRENT);
+ }
+
+ public function isPeriodEnabledForProduct(\Model_Product $model, $period)
+ {
+ $productTable = $model->getTable();
+ $pricing = $productTable->getPricingArray($model);
+ if ($pricing['type'] == \Model_ProductPayment::RECURRENT) {
+ return (bool)$pricing['recurrent'][$period]['enabled'];
+ }
+
+ return true;
+ }
+
+ protected function addProduct(\Model_Cart $cart, \Model_Product $product, array $data)
+ {
+ $item = $this->di['db']->dispense('CartProduct');
+ $item->cart_id = $cart->id;
+ $item->product_id = $product->id;
+ $item->config = json_encode($data);
+ $this->di['db']->store($item);
+
+ return true;
+ }
+
+ public function removeProduct(\Model_Cart $cart, $id)
+ {
+ $bindings = array(
+ ':cart_id' => $cart->id,
+ ':id' => $id
+ );
+
+ $cartProduct = $this->di['db']->findOne('CartProduct', 'id = :id AND cart_id = :cart_id', $bindings);
+ if (!$cartProduct instanceof \Model_CartProduct) {
+ throw new \Box_Exception('Product not found');
+ }
+ $this->di['db']->trash($cartProduct);
+
+ $this->di['logger']->info('Removed product from shopping cart');
+
+ return true;
+ }
+
+ public function changeCartCurrency(\Model_Cart $cart, \Model_Currency $currency)
+ {
+ $cart->currency_id = $currency->id;
+ $this->di['db']->store($cart);
+
+ $this->di['logger']->info('Changed shopping cart #%s currency to %s', $cart->id, $currency->title);
+
+ return true;
+ }
+
+ public function resetCart(\Model_Cart $cart)
+ {
+ $cartProducts = $this->di['db']->find('CartProduct', 'cart_id = :cart_id', array(':cart_id' => $cart->id));
+ foreach ($cartProducts as $cartProduct) {
+ $this->di['db']->trash($cartProduct);
+ }
+ $cart->promo_id = NULL;
+ $cart->updated_at = date('c');
+ $this->di['db']->store($cart);
+
+ return true;
+ }
+
+ public function removePromo(\Model_Cart $cart)
+ {
+ $cart->promo_id = NULL;
+ $cart->updated_at = date('c');
+ $this->di['db']->store($cart);
+
+ $this->di['logger']->info('Removed promo code from shopping cart #%s', $cart->id);
+
+ return true;
+ }
+
+ public function applyPromo(\Model_Cart $cart, \Model_Promo $promo)
+ {
+ if ($cart->promo_id == $promo->id) {
+ return true;
+ }
+
+ if ($this->isEmptyCart($cart)) {
+ throw new \Box_Exception('Add products to cart before applying promo code');
+ }
+
+ $cart->promo_id = $promo->id;
+ $this->di['db']->store($cart);
+
+ $this->di['logger']->info('Applied promo code %s to shopping cart', $promo->code);
+
+ return true;
+ }
+
+ protected function isEmptyCart(\Model_Cart $cart)
+ {
+ $cartProducts = $this->di['db']->find('CartProduct', 'cart_id = :cart_id', array(':cart_id' => $cart->id));
+
+ return (count($cartProducts) == 0);
+ }
+
+ public function rm(\Model_Cart $cart)
+ {
+ $cartProducts = $this->di['db']->find('CartProduct', 'cart_id = :cart_id', array(':cart_id' => $cart->id));
+
+ foreach ($cartProducts as $cartProduct) {
+ $this->di['db']->trash($cartProduct);
+ }
+
+ $this->di['db']->trash($cart);
+
+ return true;
+ }
+
+ public function toApiArray(\Model_Cart $model, $deep = false, $identity = null)
+ {
+ $products = $this->getCartProducts($model);
+
+ $currency = $this->di['db']->getExistingModelById('Currency', $model->currency_id);
+
+ $items = array();
+ $total = 0;
+ $cart_discount = 0;
+ $items_discount = 0;
+ foreach ($products as $product) {
+ $p = $this->cartProductToApiArray($product);
+ $total += $p['total'];
+ $items_discount += $p['discount'];
+ $items[] = $p;
+ }
+
+ if ($model->promo_id) {
+ $promo = $this->di['db']->getExistingModelById('Promo', $model->promo_id, 'Promo not found');
+ $promocode = $promo->code;
+ } else {
+ $promocode = NULL;
+ }
+
+ $currencyService = $this->di['mod_service']('currency');
+ $result = array(
+ 'promocode' => $promocode,
+ 'discount' => $items_discount,
+ 'total' => $total,
+ 'items' => $items,
+ 'currency' => $currencyService->toApiArray($currency),
+ );
+
+ return $result;
+ }
+
+ public function isClientAbleToUsePromo(\Model_Client $client, \Model_Promo $promo)
+ {
+ if (!$this->promoCanBeApplied($promo)) {
+ return false;
+ }
+
+ if (!$promo->once_per_client) {
+ return true;
+ }
+
+ return !$this->clientHadUsedPromo($client, $promo);
+ }
+
+ public function promoCanBeApplied(\Model_Promo $promo)
+ {
+ if (!$promo->active) {
+ return false;
+ }
+
+ if ($promo->maxuses && $promo->maxuses <= $promo->used) {
+ return false;
+ }
+
+ if ($promo->start_at && (strtotime($promo->start_at) - time() > 0)) {
+ return false;
+ }
+
+ if ($promo->end_at && (strtotime($promo->end_at) - time() < 0)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ protected function clientHadUsedPromo(\Model_Client $client, \Model_Promo $promo)
+ {
+ $sql = "SELECT id FROM client_order WHERE promo_id = :promo AND client_id = :cid LIMIT 1";
+ $promoId = $this->di['db']->getCell($sql, array(':promo' => $promo->id, ':cid' => $client->id));
+
+ return ($promoId !== null);
+ }
+
+ public function getCartProducts(\Model_Cart $model)
+ {
+ return $this->di['db']->find('CartProduct', 'cart_id = :cart_id ORDER BY id ASC', array(':cart_id' => $model->id));
+ }
+
+ public function checkoutCart(\Model_Cart $cart, \Model_Client $client, $gateway_id = null)
+ {
+ if ($cart->promo_id) {
+ $promo = $this->di['db']->load('Promo', $cart->promo_id);
+ if(!$promo instanceof \Model_Promo){
+ throw new \Box_Exception('Promo not found');
+ }
+ if (!$this->isClientAbleToUsePromo($client, $promo)) {
+ throw new \Box_Exception('You have already used this promo code. Please remove promo code and checkout again.', null, 9874);
+ }
+ }
+
+ $this->di['events_manager']->fire(
+ array(
+ 'event' => 'onBeforeClientCheckout',
+ 'params' => array(
+ 'ip' => $this->di['request']->getClientAddress(),
+ 'client_id' => $client->id,
+ 'cart_id' => $cart->id)
+ )
+ );
+
+ list($order, $invoice_id, $orders) = $this->createFromCart($client, $gateway_id);
+
+ $this->rm($cart);
+
+ $this->di['logger']->info('Checked out shopping cart');
+
+ $this->di['events_manager']->fire(
+ array(
+ 'event' => 'onAfterClientOrderCreate',
+ 'params' => array(
+ 'ip' => $this->di['request']->getClientAddress(),
+ 'client_id' => $client->id,
+ 'id' => $order->id
+ )
+ )
+ );
+
+ $result = array(
+ 'gateway_id' => $gateway_id,
+ 'invoice_hash' => null,
+ 'order_id' => $order->id,
+ 'orders' => $orders,
+ );
+
+ // invoice may not be created if total is 0
+ if ($invoice_id) {
+ $idata = $this->di['db']->getExistingModelById('Invoice', $invoice_id, 'Invoice not found');
+ $result['invoice_hash'] = $idata->hash;
+ }
+
+ return $result;
+ }
+
+ public function createFromCart(\Model_Client $client, $gateway_id = null)
+ {
+ $cart = $this->getSessionCart();
+ $cartProducts = $this->di['db']->find('CartProduct', 'cart_id = :cart_id', array(':cart_id' => $cart->id));
+ if (count($cartProducts) == 0) {
+ throw new \Box_Exception('Can not checkout empty cart.');
+ }
+
+ $ca = $this->toApiArray($cart);
+
+ $create_invoice = true;
+ if ($ca['total'] == 0) {
+ $create_invoice = false;
+ }
+
+ $currency = $this->di['db']->getExistingModelById('Currency', $cart->currency_id, 'Currency not found.');
+
+ //set default client currency
+ if (!$client->currency) {
+ $client->currency = $currency->code;
+ $this->di['db']->store($client);
+ }
+
+ if ($client->currency != $currency->code) {
+ throw new \Box_Exception('Selected currency :selected does not match your profile currency :code. Please change cart currency to continue.',
+ array(':selected' => $currency->code, ':code' => $client->currency));
+ }
+
+ $clientService = $this->di['mod_service']('client');
+ $taxed = $clientService->isClientTaxable($client);
+
+ $orders = array();
+ $invoice_items = array();
+ $master_order = null;
+ $i = 0;
+
+ foreach ($this->getCartProducts($cart) as $p) {
+ $item = $this->cartProductToApiArray($p);
+
+ $order = $this->di['db']->dispense('ClientOrder');
+ $order->client_id = $client->id;
+ $order->promo_id = $cart->promo_id;
+ $order->product_id = $item['product_id'];
+ $order->form_id = $item['form_id'];
+
+ $order->group_id = $cart->id;
+ $order->group_master = ($i == 0);
+ $order->invoice_option = 'issue-invoice';
+ $order->title = $item['title'];
+ $order->currency = $currency->code;
+ $order->service_type = $item['type'];
+ $order->unit = isset($item['unit']) ? $item['unit'] : NULL;
+ $order->period = isset($item['period']) ? $item['period'] : NULL;
+ $order->quantity = isset($item['quantity']) ? $item['quantity'] : NULL;
+ $order->price = $item['price'] * $currency->conversion_rate;
+ $order->discount = $item['discount_price'] * $currency->conversion_rate;
+ $order->status = \Model_ClientOrder::STATUS_PENDING_SETUP;
+ $order->notes = isset($item['notes']) ? $item['notes'] : NULL;
+ $order->config = json_encode($item);
+ $order->created_at = date('c');
+ $order->updated_at = date('c');
+ $this->di['db']->store($order);
+
+ $orders[] = $order->id;
+
+ // mark promo as used
+ if ($cart->promo_id) {
+ $promo = $this->di['db']->getExistingModelById('Promo', $cart->promo_id, 'Promo not found.');
+ $this->usePromo($promo);
+
+ //set promo info for later use
+ $order->promo_recurring = $promo->recurring;
+ $order->promo_used = 1;
+ $this->di['db']->store($order);
+ }
+
+ $orderService = $this->di['mod_service']('order');
+ $orderService->saveStatusChange($order, 'Order created');
+
+ $invoice_items[] = array(
+ 'title' => $order->title,
+ 'price' => $order->price - ($order->discount),
+ 'quantity' => $order->quantity,
+ 'unit' => $order->unit,
+ 'period' => $order->period,
+ 'taxed' => $taxed,
+ 'type' => \Model_InvoiceItem::TYPE_ORDER,
+ 'rel_id' => $order->id,
+ 'task' => \Model_InvoiceItem::TASK_ACTIVATE,
+ );
+
+ if ($item['setup_price'] > 0) {
+ $setup_price = ($item['setup_price'] * $currency->conversion_rate) - ($item['discount_setup'] * $currency->conversion_rate);
+ $invoice_items[] = array(
+ 'title' => __(':product setup', array(':product' => $order->title)),
+ 'price' => $setup_price,
+ 'quantity' => 1,
+ 'unit' => 'service',
+ 'taxed' => $taxed,
+ );
+ }
+
+ //define master order to be returned
+ if (null === $master_order) {
+ $master_order = $order;
+ }
+
+ $i++;
+ }
+
+ if ($create_invoice) {
+
+ $invoiceService = $this->di['mod_service']('Invoice');
+ $invoice_id = $invoiceService->prepareInvoice($client, array('client_id' => $client->id, 'items' => $invoice_items, 'gateway_id' => $gateway_id));
+ $invoiceModel = $this->di['db']->load('Invoice', $invoice_id);
+ $invoiceService->approveInvoice($invoiceModel, array('id' => $invoice_id, 'use_credits' => true));
+
+ foreach ($orders as $oid) {
+ $o = $this->di['db']->load('ClientOrder', $oid);
+ $o->unpaid_invoice_id = $invoice_id;
+ $this->di['db']->store($o);
+ }
+
+ $result = array($master_order, $invoice_id, $orders);
+ } else {
+ $result = array($master_order, null, $orders);
+ }
+
+ //activate orders if product is setup to be activated after order place or order total is $0
+ $orderService = $this->di['mod_service']('Order');
+ foreach ($orders as $oid) {
+
+ $order = $this->di['db']->load('ClientOrder', $oid);
+ $oa = $orderService->toApiArray($order, false, $client);
+ $product = $this->di['db']->getExistingModelById('Product', $oa['product_id']);
+ if ($product->setup == \Model_ProductTable::SETUP_AFTER_ORDER || ($product->setup == \Model_ProductTable::SETUP_AFTER_PAYMENT && $oa['total'] - $oa['discount'] <= 0)) {
+ try {
+ $orderService->activateOrder($order);
+ } catch (\Exception $e) {
+ error_log($e->getMessage());
+ $status = 'error';
+ $notes = 'Order could not be activated after checkout due to error: ' . $e->getMessage();
+ $orderService->orderStatusAdd($order, $status, $notes);
+ }
+ }
+ }
+
+ return $result;
+ }
+
+ public function usePromo(\Model_Promo $promo)
+ {
+ $promo->used++;
+ $promo->updated_at = date('c');
+ $this->di['db']->store($promo);
+ }
+
+ public function findActivePromoByCode($code)
+ {
+ return $this->di['db']->findOne('Promo', 'code = :code AND active = 1 ORDER BY id ASC', array(':code' => $code));
+ }
+
+ private function getItemPrice(\Model_CartProduct $model)
+ {
+ $product = $this->di['db']->load('Product', $model->product_id);
+ $config = $this->getItemConfig($model);
+ $repo = $product->getTable();
+ return $repo->getProductPrice($product, $config);
+ }
+
+ private function getItemSetupPrice(\Model_CartProduct $model)
+ {
+ $product = $this->di['db']->load('Product', $model->product_id);
+ $config = $this->getItemConfig($model);
+ $repo = $product->getTable();
+ return $repo->getProductSetupPrice($product, $config);
+ }
+
+ /**
+ * Function checks if product is related to other products in cart
+ * If relation exists then count discount for this
+ *
+ * @param Model_Cart $cart
+ * @param Model_CartProduct $model
+ * @return type
+ */
+ protected function getRelatedItemsDiscount(\Model_Cart $cart, \Model_CartProduct $model)
+ {
+ $product = $this->di['db']->load('Product', $model->product_id);
+ $repo = $product->getTable();
+ $config = $this->getItemConfig($model);
+
+ $discount = 0;
+ if(method_exists($repo, 'getRelatedDiscount')) {
+ $list = array();
+ $products = $this->getCartProducts($cart);
+ foreach($products as $p) {
+ $item = $this->di['db']->toArray($p);
+ $item['config'] = $this->getItemConfig($p);
+ $list[] = $item;
+ }
+ $discount = $repo->getRelatedDiscount($list, $product, $config);
+ }
+ return $discount;
+ }
+
+ private function getItemTitle(\Model_CartProduct $model)
+ {
+ $product = $this->di['db']->load('Product', $model->product_id);
+ $config = $this->getItemConfig($model);
+ $service = $product->getService();
+ if(method_exists($service, 'getCartProductTitle')) {
+ return $service->getCartProductTitle($product, $config);
+ } else {
+ return __(':product_title', array(':product_title'=>$product->title));
+ }
+ }
+
+ protected function getItemPromoDiscount(\Model_CartProduct $model, \Model_Promo $promo)
+ {
+ $product = $this->di['db']->load('Product', $model->product_id);
+ $repo = $this->di['mod_service']('product');
+ $config = $this->getItemConfig($model);
+ return $repo->getProductDiscount($product, $promo, $config);
+ }
+
+ public function getItemConfig(\Model_CartProduct $model)
+ {
+ return $this->di['tools']->decodeJ($model->config);
+ }
+
+ public function cartProductToApiArray(\Model_CartProduct $model)
+ {
+ $product = $this->di['db']->load('Product', $model->product_id);
+ $repo = $product->getTable();
+ $config = $this->getItemConfig($model);
+ $setup = $repo->getProductSetupPrice($product, $config);
+ $price = $repo->getProductPrice($product, $config);
+ $qty = isset($config['quantity']) ? $config['quantity'] : 1 ;
+
+ list ($discount_price, $discount_setup) = $this->getProductDiscount($model, $setup);
+
+ $discount_total = $discount_price + $discount_setup;
+
+ $subtotal = ($price * $qty) + $setup;
+ if(abs($discount_total) > $subtotal ) {
+ $discount_total = $subtotal;
+ $discount_price = $subtotal;
+ }
+
+ $data = array_merge($config, array(
+ 'id' => $model->id,
+ 'product_id' => $product->id,
+ 'form_id' => $product->form_id,
+ 'title' => $this->getItemTitle($model),
+ 'type' => $product->type,
+ 'quantity' => $qty,
+ 'unit' => $repo->getUnit($product),
+ 'price' => $price,
+ 'setup_price' => $setup,
+ 'discount' => $discount_total,
+ 'discount_price'=> $discount_price,
+ 'discount_setup'=> $discount_setup,
+ 'total' => $subtotal - $discount_total,
+ ));
+ return $data;
+ }
+
+ public function getProductDiscount(\Model_CartProduct $cartProduct, $setup)
+ {
+ $config = $this->getItemConfig($cartProduct);
+ $qty = isset($config['quantity']) ? $config['quantity'] : 1 ;
+
+ $cart = $this->di['db']->load('Cart', $cartProduct->cart_id);
+ $discount_price = $this->getRelatedItemsDiscount($cart, $cartProduct);
+ $discount_setup = 0; // discount for setup price
+ if($cart->promo_id) {
+ $promo = $this->di['db']->getExistingModelById('Promo', $cart->promo_id, 'Promo not found');
+ $discount_price += $this->getItemPromoDiscount($cartProduct, $promo);
+
+ if($promo->freesetup) {
+ $discount_setup = $setup;
+ }
+ }
+ return array($discount_price, $discount_setup);
+ }
+}
diff --git a/src/bb-modules/Cart/manifest.json b/src/bb-modules/Cart/manifest.json
new file mode 100644
index 000000000..aaa567496
--- /dev/null
+++ b/src/bb-modules/Cart/manifest.json
@@ -0,0 +1,7 @@
+{
+ "id": "cart",
+ "type": "mod",
+ "name": "Shopping cart",
+ "description": "BoxBilling core module",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/Api/Admin.php b/src/bb-modules/Client/Api/Admin.php
new file mode 100644
index 000000000..6a23a927b
--- /dev/null
+++ b/src/bb-modules/Client/Api/Admin.php
@@ -0,0 +1,722 @@
+di['pager']->getPer_page();
+ list($sql, $params) = $this->getService()->getSearchQuery($data);
+ $pager = $this->di['pager']->getSimpleResultSet($sql, $params, $per_page);
+
+ foreach($pager['list'] as $key => $clientArr){
+ $client = $this->di['db']->getExistingModelById('Client', $clientArr['id'], 'Client not found');
+ $pager['list'][$key] = $this->getService()->toApiArray($client, true, $this->getIdentity());
+ }
+
+ return $pager;
+ }
+
+ /**
+ * Get clients index
+ *
+ * @return array - list of clients in id => full name pair
+ */
+ public function get_pairs($data)
+ {
+ $service = $this->di['mod_service']('client');
+ return $service->getPairs($data);
+ }
+
+ /**
+ * Get client by id or email. Email is also unique in database
+ *
+ * @param int $id - client ID
+ *
+ * @optional string $email - client email
+ *
+ * @return array - client details
+ */
+ public function get($data)
+ {
+ $service = $this->getService();
+ $client = $service->get($data);
+ return $service->toApiArray($client, true, $this->getIdentity());
+ }
+
+ /**
+ * Login to clients area with client id
+ *
+ * @param int $id - client ID
+ *
+ * @return array - client details
+ */
+ public function login($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('ID required');
+ }
+
+ $db = $this->di['db'];
+ $client = $db->load('Client', $data['id']);
+ if(!$client instanceof \Model_Client ) {
+ throw new \Box_Exception('Client not found');
+ }
+
+ $service = $this->di['mod_service']('client');
+ $result = $service->toSessionArray($client);
+
+ $session = $this->di['session'];
+ $session->set('client_id', $client->id);
+ $this->di['logger']->info('Logged in as client #%s', $client->id);
+ return $result;
+ }
+
+ /**
+ * Creates new client
+ *
+ * @param string $email - client email, must not be registered on system
+ * @param string $first_name - client first name
+ *
+ * @optional string $password - client password
+ * @optional string $auth_type - client authorization type. Default null
+ * @optional string $last_name - client last name
+ * @optional string $aid - alternative ID. If you import cients from other systems you can use this field to store foreign system ID
+ * @optional string $group_id - client group id
+ * @optional string $status - client status: "active, suspended, canceled"
+ * @optional string $created_at - ISO 8601 date for client creation date
+ * @optional string $last_name - last name
+ * @optional string $aid - Alternative id. Usually used by import tools.
+ * @optional string $gender - Gender - values: male|female
+ * @optional string $country - Country
+ * @optional string $city - city
+ * @optional string $birthday - Birthday
+ * @optional string $company - Company
+ * @optional string $company_vat - Company VAT number
+ * @optional string $company_number - Company number
+ * @optional string $type - Identifies client type: company or individual
+ * @optional string $address_1 - Address line 1
+ * @optional string $address_2 - Address line 2
+ * @optional string $postcode - zip or postcode
+ * @optional string $state - country state
+ * @optional string $phone - Phone number
+ * @optional string $phone_cc - Phone country code
+ * @optional string $document_type - Related document type, ie: passpord, driving license
+ * @optional string $document_nr - Related document number, ie: passport number: LC45698122
+ * @optional string $notes - Notes about client. Visible for admin only
+ * @optional string $lang - Client language
+ * @optional string $custom_1 - Custom field 1
+ * @optional string $custom_2 - Custom field 2
+ * @optional string $custom_3 - Custom field 3
+ * @optional string $custom_4 - Custom field 4
+ * @optional string $custom_5 - Custom field 5
+ * @optional string $custom_6 - Custom field 6
+ * @optional string $custom_7 - Custom field 7
+ * @optional string $custom_8 - Custom field 8
+ * @optional string $custom_9 - Custom field 9
+ * @optional string $custom_10 - Custom field 10
+ *
+ * @return int - client id
+ */
+ public function create($data)
+ {
+ if(!isset($data['email']) || empty($data['email'])) {
+ throw new \Box_Exception('Email required');
+ }
+
+ if(!isset($data['first_name'])) {
+ throw new \Box_Exception('First name is required');
+ }
+
+ $validator = $this->di['validator'];
+ $validator->isEmailValid($data['email']);
+
+ $service = $this->getService();
+ if($service->emailAreadyRegistered($data['email'])) {
+ throw new \Box_Exception('Email is already registered.');
+ }
+
+ return $service->adminCreateClient($data);
+ }
+
+ /**
+ * Deletes client from system
+ *
+ * @param string $id - client ID
+ *
+ * @return bool
+ */
+ public function delete($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Client id is missing');
+ }
+
+ $model = $this->di['db']->load('Client', $data['id']);
+ if(!$model instanceof \Model_Client) {
+ throw new \Box_Exception('Client not found');
+ }
+
+ $this->di['events_manager']->fire(array('event'=>'onBeforeAdminClientDelete', 'params'=>array('id'=>$model->id)));
+
+ $id = $model->id;
+ $this->getService()->remove($model);
+ $this->di['events_manager']->fire(array('event'=>'onAfterAdminClientDelete', 'params'=>array('id'=>$id)));
+
+ $this->di['logger']->info('Removed client #%s', $id);
+ return true;
+ }
+
+ /**
+ * Update client profile
+ *
+ * @param string $id - client ID
+ *
+ * @optional string $email - client email
+ * @optional string $first_name - client first_name
+ * @optional string $last_name - client last_name
+ * @optional string $status - client status
+ * @optional string $last_name - last name
+ * @optional string $aid - Alternative id. Usually used by import tools.
+ * @optional string $gender - Gender - values: male|female
+ * @optional string $country - Country
+ * @optional string $city - city
+ * @optional string $birthday - Birthday
+ * @optional string $company - Company
+ * @optional string $company_vat - Company VAT number
+ * @optional string $company_number - Company number
+ * @optional string $type - Identifies client type: company or individual
+ * @optional string $address_1 - Address line 1
+ * @optional string $address_2 - Address line 2
+ * @optional string $postcode - zip or postcode
+ * @optional string $state - country state
+ * @optional string $phone - Phone number
+ * @optional string $phone_cc - Phone country code
+ * @optional string $document_type - Related document type, ie: passpord, driving license
+ * @optional string $document_nr - Related document number, ie: passport number: LC45698122
+ * @optional string $lang - Client language
+ * @optional string $notes - Notes about client. Visible for admin only
+ * @optional string $custom_1 - Custom field 1
+ * @optional string $custom_2 - Custom field 2
+ * @optional string $custom_3 - Custom field 3
+ * @optional string $custom_4 - Custom field 4
+ * @optional string $custom_5 - Custom field 5
+ * @optional string $custom_6 - Custom field 6
+ * @optional string $custom_7 - Custom field 7
+ * @optional string $custom_8 - Custom field 8
+ * @optional string $custom_9 - Custom field 9
+ * @optional string $custom_10 - Custom field 10
+ *
+ * @return bool
+ */
+ public function update($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Id required');
+ }
+
+ $client = $this->di['db']->load('Client', $data['id']);
+ if(!$client instanceof \Model_Client ) {
+ throw new \Box_Exception('Client not found');
+ }
+
+ $this->di['events_manager']->fire(array('event'=>'onBeforeAdminClientUpdate', 'params'=>$data));
+ $service = $this->di['mod_service']('client');
+
+ $email = isset($data['email']) ? $data['email'] : NULL ;
+ $first_name = isset($data['first_name']) ? $data['first_name'] : NULL ;
+ $last_name = isset($data['last_name']) ? $data['last_name'] : NULL ;
+ $aid = isset($data['aid']) ? $data['aid'] : NULL ;
+ $gender = isset($data['gender']) ? $data['gender'] : NULL ;
+ $birthday = isset($data['birthday']) ? $data['birthday'] : NULL ;
+ $company = isset($data['company']) ? $data['company'] : NULL ;
+ $company_vat = isset($data['company_vat']) ? $data['company_vat'] : NULL ;
+ $address_1 = isset($data['address_1']) ? $data['address_1'] : NULL ;
+ $address_2 = isset($data['address_2']) ? $data['address_2'] : NULL ;
+ $phone_cc = isset($data['phone_cc']) ? $data['phone_cc'] : NULL ;
+ $phone = isset($data['phone']) ? $data['phone'] : NULL ;
+ $document_type = isset($data['document_type']) ? $data['document_type'] : NULL ;
+ $document_nr = isset($data['document_nr']) ? $data['document_nr'] : NULL ;
+ $notes = isset($data['notes']) ? $data['notes'] : NULL ;
+ $country = isset($data['country']) ? $data['country'] : NULL ;
+ $postcode = isset($data['postcode']) ? $data['postcode'] : NULL ;
+ $state = isset($data['state']) ? $data['state'] : NULL ;
+ $city = isset($data['city']) ? $data['city'] : NULL ;
+ $currency = isset($data['currency']) ? $data['currency'] : NULL ;
+ $status = isset($data['status']) ? $data['status'] : NULL ;
+ $tax_exempt = isset($data['tax_exempt']) ? (bool)$data['tax_exempt'] : NULL;
+ $created_at = isset($data['created_at']) ? $data['created_at'] : NULL;
+
+ $c1 = isset($data['custom_1']) ? $data['custom_1'] : NULL ;
+ $c2 = isset($data['custom_2']) ? $data['custom_2'] : NULL ;
+ $c3 = isset($data['custom_3']) ? $data['custom_3'] : NULL ;
+ $c4 = isset($data['custom_4']) ? $data['custom_4'] : NULL ;
+ $c5 = isset($data['custom_5']) ? $data['custom_5'] : NULL ;
+ $c6 = isset($data['custom_6']) ? $data['custom_6'] : NULL ;
+ $c7 = isset($data['custom_7']) ? $data['custom_7'] : NULL ;
+ $c8 = isset($data['custom_8']) ? $data['custom_8'] : NULL ;
+ $c9 = isset($data['custom_9']) ? $data['custom_9'] : NULL ;
+ $c10 = isset($data['custom_10']) ? $data['custom_10'] : NULL ;
+
+ if($currency && $service->canChangeCurrency($client, $currency)) {
+ $client->currency = $currency;
+ }
+
+ if(isset($data['group_id'])) {
+ $client->client_group_id = $data['group_id'];
+ }
+
+ if(!is_null($email)) {
+ $this->di['validator']->isEmailValid($email);
+ if($service->emailAreadyRegistered($email, $client)) {
+ throw new \Box_Exception('Can not change email. It is already registered.');
+ }
+ $client->email = $email;
+ }
+
+ if(!is_null($aid)) {
+ $client->aid = $aid;
+ }
+ if(!is_null($first_name)) {
+ $client->first_name = $first_name;
+ }
+ if(!is_null($last_name)) {
+ $client->last_name = $last_name;
+ }
+ if(!is_null($status)) {
+ $client->status = $status;
+ }
+ if(!is_null($gender)) {
+ $client->gender = $gender;
+ }
+ if(!is_null($birthday)) {
+ $client->birthday = $birthday;
+ }
+ if(!is_null($phone_cc)) {
+ $client->phone_cc = $phone_cc;
+ }
+ if(!is_null($phone)) {
+ $client->phone = $phone;
+ }
+ if(!is_null($company)) {
+ $client->company = $company;
+ }
+ if(!is_null($company_vat)) {
+ $client->company_vat = $company_vat;
+ }
+ if(isset($data['company_number'])) {
+ $client->company_number = $data['company_number'];
+ }
+ if(isset($data['type'])) {
+ $client->type = $data['type'];
+ }
+ if(isset($data['lang'])) {
+ $client->lang = $data['lang'];
+ }
+ if(!is_null($address_1)) {
+ $client->address_1 = $address_1;
+ }
+ if(!is_null($address_2)) {
+ $client->address_2 = $address_2;
+ }
+ if(!is_null($city)) {
+ $client->city = $city;
+ }
+ if(!is_null($state)) {
+ $client->state = $state;
+ }
+ if(!is_null($postcode)) {
+ $client->postcode = $postcode;
+ }
+ if(!is_null($country)) {
+ $client->country = $country;
+ }
+ if(!is_null($document_type)) {
+ $client->document_type = $document_type;
+ }
+ if(!is_null($document_nr)) {
+ $client->document_nr = $document_nr;
+ }
+ if(!is_null($notes)) {
+ $client->notes = $notes;
+ }
+ if(!is_null($tax_exempt)) {
+ $client->tax_exempt = $tax_exempt;
+ }
+ if(!is_null($created_at)) {
+ $client->created_at = date('c', strtotime($created_at));
+ }
+
+ if(!is_null($c1)) {
+ $client->custom_1 = $c1;
+ }
+ if(!is_null($c2)) {
+ $client->custom_2 = $c2;
+ }
+ if(!is_null($c3)) {
+ $client->custom_3 = $c3;
+ }
+ if(!is_null($c4)) {
+ $client->custom_4 = $c4;
+ }
+ if(!is_null($c5)) {
+ $client->custom_5 = $c5;
+ }
+ if(!is_null($c6)) {
+ $client->custom_6 = $c6;
+ }
+ if(!is_null($c7)) {
+ $client->custom_7 = $c7;
+ }
+ if(!is_null($c8)) {
+ $client->custom_8 = $c8;
+ }
+ if(!is_null($c9)) {
+ $client->custom_9 = $c9;
+ }
+ if(!is_null($c10)) {
+ $client->custom_10 = $c10;
+ }
+
+ $client->updated_at = date('c');
+ $this->di['db']->store($client);
+ $this->di['events_manager']->fire(array('event'=>'onAfterAdminClientUpdate', 'params'=>array('id'=>$client->id)));
+
+ $this->di['logger']->info('Updated client #%s profile', $client->id);
+ return true;
+ }
+
+ /**
+ * Change client password
+ *
+ * @param int $id - Client ID
+ * @param string $password - new client password
+ * @param string $password_confirm - repeast same new client password
+ *
+ * @return bool
+ */
+ public function change_password($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Client ID is required');
+ }
+
+ if(!isset($data['password'])) {
+ throw new \Box_Exception('Password required');
+ }
+ if(!isset($data['password_confirm'])) {
+ throw new \Box_Exception('Password confirmation required');
+ }
+
+ if($data['password'] != $data['password_confirm']) {
+ throw new \Box_Exception('Passwords do not match');
+ }
+
+ $client = $this->di['db']->load('Client', $data['id']);
+ if(!$client instanceof \Model_Client ) {
+ throw new \Box_Exception('Client not found');
+ }
+
+ $this->di['events_manager']->fire(array('event'=>'onBeforeAdminClientPasswordChange', 'params'=>$data));
+
+ $client->pass = sha1($data['password']);
+ $client->updated_at = date('c');
+ $this->di['db']->store($client);
+
+ $this->di['events_manager']->fire(array('event'=>'onAfterAdminClientPasswordChange', 'params'=>array('id'=>$client->id, 'password'=>$data['password'])));
+
+ $this->di['logger']->info('Changed client #%s password', $client->id);
+ return true;
+ }
+
+ /**
+ * Returns list of client payments
+ *
+ * @return array
+ */
+ public function balance_get_list($data)
+ {
+ $service = $this->di['mod_service']('Client', 'Balance');
+ list($q, $params) = $service->getSearchQuery($data);
+ $per_page = isset($data['per_page']) ? $data['per_page'] : $this->di['pager']->getPer_page();
+ $pager = $this->di['pager']->getSimpleResultSet($q, $params, $per_page);
+
+ foreach($pager['list'] as $key => $item){
+ $pager['list'][$key] = array(
+ 'id' => isset($item['id']) ? $item['id'] : '',
+ 'description' => isset($item['description']) ? $item['description'] : '',
+ 'amount' => isset($item['amount']) ? $item['amount'] : '',
+ 'currency' => isset($item['currency']) ? $item['currency'] : '',
+ 'created_at' => isset($item['created_at']) ? $item['created_at'] : '',
+ );
+ }
+
+ return $pager;
+ }
+
+ /**
+ * Remove row from clients balance
+ *
+ * @param int $id - Balance line id
+ *
+ * @return bool
+ */
+ public function balance_delete($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Client ID is required');
+ }
+ $model = $this->di['db']->load('ClientBalance', $data['id']);
+ if(!$model instanceof \Model_ClientBalance) {
+ throw new \Box_Exception('Balance line not found');
+ }
+
+ $id = $model->id;
+ $client_id = $model->client_id;
+ $amount = $model->amount;
+
+ $this->di['db']->trash($model);
+
+ $this->di['logger']->info('Removed line %s from client #%s balance for %s', $id, $client_id, $amount);
+ return true;
+ }
+
+ /**
+ * Adds funds to clients balance
+ *
+ * @param int $id - Client ID
+ * @param int $amount - Amount of clients currency to added to balance
+ * @param int $description - Descrition of this transaction
+ *
+ * @optional string $type - Related item type
+ * @optional string $rel_id - Related item id
+ *
+ * @return bool
+ */
+ public function balance_add_funds($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Client ID is required');
+ }
+
+ if(!isset($data['amount'])) {
+ throw new \Box_Exception('Amount is required');
+ }
+
+ if(!isset($data['description'])) {
+ throw new \Box_Exception('Description is required');
+ }
+
+ $client = $this->di['db']->load('Client', $data['id']);
+ if(!$client instanceof \Model_Client ) {
+ throw new \Box_Exception('Client not found');
+ }
+
+ $service = $this->di['mod_service']('client');
+ $service->addFunds($client, $data['amount'], $data['description'], $data);
+ return true;
+ }
+
+ /**
+ * Remove password reminders which were not confirmed in 2 hours
+ *
+ * @return bool
+ */
+ public function batch_expire_password_reminders()
+ {
+ $service = $this->di['mod_service']('client');
+ $expired = $service->getExpiredPasswordReminders();
+ foreach($expired as $model) {
+ $this->di['db']->trash($model);
+ }
+
+ $this->di['logger']->info('Executed action to delete expired clients password reminders');
+ return TRUE;
+ }
+
+ /**
+ * Get list of clients logins history
+ *
+ * @optional int $client_id - filter by client
+ *
+ * @return array
+ */
+ public function login_history_get_list($data)
+ {
+ list($q, $params) = $this->getService()->getHistorySearchQuery($data);
+ $per_page = isset($data['per_page']) ? $data['per_page'] : $this->di['pager']->getPer_page();
+ $pager = $this->di['pager']->getSimpleResultSet($q, $params, $per_page);
+
+ foreach($pager['list'] as $key => $item){
+ $pager['list'][$key] = array(
+ 'id' => isset($item['id']) ? $item['id'] : '',
+ 'ip' => isset($item['ip']) ? $item['ip'] : '',
+ 'created_at' => isset($item['created_at']) ? $item['created_at'] : '',
+ 'client' => array(
+ 'id' => isset($item['client_id']) ? $item['client_id'] : '',
+ 'first_name' => isset($item['first_name']) ? $item['first_name'] : '',
+ 'last_name' => isset($item['last_name']) ? $item['last_name'] : '',
+ 'email' => isset($item['email']) ? $item['email'] : '',
+ )
+ );
+ }
+
+ return $pager;
+ }
+
+ /**
+ * Remove log entry form clients logins history
+ *
+ * @param int $id - Log entry ID
+ *
+ * @return bool
+ */
+ public function login_history_delete($data)
+ {
+
+ $required = array(
+ 'id' => 'Id not passed',
+ );
+ $this->di['validator']->checkRequiredParamsForArray($required, $data);
+ $model = $this->di['db']->getExistingModelById('ActivityClientHistory', $data['id']);
+
+ if(!$model instanceof \Model_ActivityClientHistory) {
+ throw new \Box_Exception('Event not found');
+ }
+ $this->di['db']->trash($model);
+ return true;
+ }
+
+ /**
+ * Return client statuses with counter.
+ *
+ * @return array
+ */
+ public function get_statuses($data)
+ {
+ $service = $this->di['mod_service']('client');
+ return $service->counter();
+ }
+
+ /**
+ * Return client groups. Id and title pairs
+ *
+ * @return array
+ */
+ public function group_get_pairs($data)
+ {
+ $service = $this->di['mod_service']('client');
+ return $service->getGroupPairs();
+ }
+
+ /**
+ * Create new clients group
+ *
+ * @param string $title - New group title
+ *
+ * @return int $id - newly created group id
+ */
+ public function group_create($data)
+ {
+ if(!isset($data['title']) || empty($data['title'])) {
+ throw new \Box_Exception('Group title is missing');
+ }
+
+ return $this->getService()->createGroup($data);
+ }
+
+ /**
+ * Update client group
+ *
+ * @param int $id - client group ID
+ * @optional string $title - new group title
+ *
+ * @return bool
+ * @throws ErrorException
+ */
+ public function group_update($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Group id is missing');
+ }
+
+ $model = $this->di['db']->load('ClientGroup', $data['id']);
+ if(!$model instanceof \Model_ClientGroup) {
+ throw new \Box_Exception('Group not found');
+ }
+
+ if(isset($data['title'])) {
+ $model->title = $data['title'];
+ }
+
+ $model->updated_at = date('c');
+ $this->di['db']->store($model);
+ return true;
+ }
+
+ /**
+ * Delete client group
+ *
+ * @param int $id - client group ID
+ *
+ * @return bool
+ * @throws ErrorException
+ */
+ public function group_delete($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Group id is missing');
+ }
+
+ $model = $this->di['db']->load('ClientGroup', $data['id']);
+ if(!$model instanceof \Model_ClientGroup) {
+ throw new \Box_Exception('Group not found');
+ }
+ return $this->getService()->deleteGroup($model);
+ }
+
+ /**
+ * Get client group details
+ *
+ * @param int $id - client group ID
+ *
+ * @return array
+ * @throws ErrorException
+ */
+ public function group_get($data)
+ {
+ if(!isset($data['id'])) {
+ throw new \Box_Exception('Group id is missing');
+ }
+
+ $model = $this->di['db']->load('ClientGroup', $data['id']);
+ if(!$model instanceof \Model_ClientGroup) {
+ throw new \Box_Exception('Group not found');
+ }
+
+ return $this->di['db']->toArray($model);
+ }
+
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/Api/Client.php b/src/bb-modules/Client/Api/Client.php
new file mode 100644
index 000000000..f026d1c93
--- /dev/null
+++ b/src/bb-modules/Client/Api/Client.php
@@ -0,0 +1,309 @@
+getService()->toApiArray($this->getIdentity(), true, $this->getIdentity());
+ }
+
+ /**
+ * Update currencty logged in client details
+ *
+ * @optional string $email - new client email. Must not exist on system
+ * @optional string $last_name - last name
+ * @optional string $aid - Alternative id. Usually used by import tools.
+ * @optional string $gender - Gender - values: male|female
+ * @optional string $country - Country
+ * @optional string $city - city
+ * @optional string $birthday - Birthday
+ * @optional string $company - Company
+ * @optional string $company_vat - Company VAT number
+ * @optional string $company_number - Company number
+ * @optional string $type - Identifies client type: company or individual
+ * @optional string $address_1 - Address line 1
+ * @optional string $address_2 - Address line 2
+ * @optional string $postcode - zip or postcode
+ * @optional string $state - country state
+ * @optional string $phone - Phone number
+ * @optional string $phone_cc - Phone country code
+ * @optional string $document_type - Related document type, ie: passpord, driving license
+ * @optional string $document_nr - Related document number, ie: passport number: LC45698122
+ * @optional string $notes - Notes about client. Visible for admin only
+ * @optional string $custom_1 - Custom field 1
+ * @optional string $custom_2 - Custom field 2
+ * @optional string $custom_3 - Custom field 3
+ * @optional string $custom_4 - Custom field 4
+ * @optional string $custom_5 - Custom field 5
+ * @optional string $custom_6 - Custom field 6
+ * @optional string $custom_7 - Custom field 7
+ * @optional string $custom_8 - Custom field 8
+ * @optional string $custom_9 - Custom field 9
+ * @optional string $custom_10 - Custom field 10
+ *
+ * @return boolean
+ * @throws Exception
+ * @deprecated moved to profile module
+ */
+ public function update($data)
+ {
+ $client = $this->getIdentity();
+
+ $event_params = $data;
+ $event_params['id'] = $client->id;
+ $this->di['events_manager']->fire(array('event'=>'onBeforeClientProfileUpdate', 'params'=>$event_params));
+
+ $mod = $this->di['mod']('client');
+ $config = $mod->getConfig();
+ if(isset($data['email'])
+ && $client->email != $data['email']
+ && isset($config['allow_change_email'])
+ && !$config['allow_change_email']) {
+ throw new \Box_Exception('Email can not be changed');
+ }
+
+ if(isset($data['email'])) {
+ $this->di['validator']->isEmailValid($data['email']);
+
+ if($this->getService()->emailAreadyRegistered($data['email'], $client)) {
+ throw new \Box_Exception('Can not change email. It is already registered.');
+ }
+
+ $client->email = strtolower(trim($data['email']));
+ }
+
+ if(isset($data['first_name'])) {
+ $client->first_name = $data['first_name'];
+ }
+
+ if(isset($data['last_name'])) {
+ $client->last_name = $data['last_name'];
+ }
+
+ if(isset($data['gender'])) {
+ $client->gender = $data['gender'];
+ }
+
+ if(isset($data['birthday'])) {
+ $client->birthday = $data['birthday'];
+ }
+
+ if(isset($data['company'])) {
+ $client->company = $data['company'];
+ }
+
+ if(isset($data['company_vat'])) {
+ $client->company_vat = $data['company_vat'];
+ }
+
+ if(isset($data['company_number'])) {
+ $client->company_number = $data['company_number'];
+ }
+
+ if(isset($data['type'])) {
+ $client->type = $data['type'];
+ }
+
+ if(isset($data['address_1'])) {
+ $client->address_1 = $data['address_1'];
+ }
+
+ if(isset($data['address_2'])) {
+ $client->address_2 = $data['address_2'];
+ }
+
+ if(isset($data['phone_cc'])) {
+ $client->phone_cc = $data['phone_cc'];
+ }
+
+ if(isset($data['phone'])) {
+ $client->phone = $data['phone'];
+ }
+
+ if(isset($data['country'])) {
+ $client->country = $data['country'];
+ }
+
+ if(isset($data['postcode'])) {
+ $client->postcode = $data['postcode'];
+ }
+
+ if(isset($data['city'])) {
+ $client->city = $data['city'];
+ }
+
+ if(isset($data['state'])) {
+ $client->state = $data['state'];
+ }
+
+ if(isset($data['document_type'])) {
+ $client->document_type = $data['document_type'];
+ }
+
+ if(isset($data['document_nr'])) {
+ $client->document_nr = $data['document_nr'];
+ }
+
+ if(isset($data['notes'])) {
+ $client->notes = $data['notes'];
+ }
+
+ if(isset($data['custom_1'])) {
+ $client->custom_1 = $data['custom_1'];
+ }
+ if(isset($data['custom_2'])) {
+ $client->custom_2 = $data['custom_2'];
+ }
+ if(isset($data['custom_3'])) {
+ $client->custom_3 = $data['custom_3'];
+ }
+ if(isset($data['custom_4'])) {
+ $client->custom_4 = $data['custom_4'];
+ }
+ if(isset($data['custom_5'])) {
+ $client->custom_5 = $data['custom_5'];
+ }
+ if(isset($data['custom_6'])) {
+ $client->custom_6 = $data['custom_6'];
+ }
+ if(isset($data['custom_7'])) {
+ $client->custom_7 = $data['custom_7'];
+ }
+ if(isset($data['custom_8'])) {
+ $client->custom_8 = $data['custom_8'];
+ }
+ if(isset($data['custom_9'])) {
+ $client->custom_9 = $data['custom_9'];
+ }
+ if(isset($data['custom_10'])) {
+ $client->custom_10 = $data['custom_10'];
+ }
+
+ $client->updated_at = date('c');
+ $this->di['db']->store($client);
+
+ $this->di['events_manager']->fire(array('event'=>'onAfterClientProfileUpdate', 'params'=>array('id'=>$client->id)));
+
+ $this->di['logger']->info('Updated profile');
+ return true;
+ }
+
+ /**
+ * Retrieve current API key
+ * @deprecated moved to profile module
+ */
+ public function api_key_get($data)
+ {
+ $client = $this->getIdentity();
+ return $client->api_token;
+ }
+
+ /**
+ * Generate new API key
+ * @deprecated moved to profile module
+ */
+ public function api_key_reset($data)
+ {
+ $client = $this->getIdentity();
+
+ $client->api_token = $this->di['tools']->generatePassword(32);
+ $client->updated_at = date('c');
+ $this->di['db']->store($client);
+
+ $this->di['logger']->info('Generated new API key');
+ return $client->api_token;
+ }
+
+ /**
+ * Change client area password
+ * @deprecated moved to profile module
+ */
+ public function change_password($data)
+ {
+ if(!isset($data['password'])) {
+ throw new \Box_Exception('Password required');
+ }
+
+ if(!isset($data['password_confirm'])) {
+ throw new \Box_Exception('Password confirmation required');
+ }
+
+ if($data['password'] != $data['password_confirm']) {
+ throw new \Box_Exception('Passwords do not match.');
+ }
+
+ $event_params = $data;
+ $event_params['id'] = $this->getIdentity()->id;
+ $this->di['events_manager']->fire(array('event'=>'onBeforeClientProfilePasswordChange', 'params'=>$event_params));
+
+ $this->di['validator']->isPasswordStrong($data['password']);
+
+ $client = $this->getIdentity();
+ $client->pass = sha1($data['password']);
+ $this->di['db']->store($client);
+
+ $this->di['events_manager']->fire(array('event'=>'onAfterClientProfilePasswordChange', 'params'=>array('id'=>$client->id)));
+
+ $this->di['logger']->info('Changed profile password');
+
+ return true;
+ }
+
+ /**
+ * Clear session and logout
+ * @return boolean
+ * @deprecated moved to profile module
+ */
+ public function logout()
+ {
+ if($_COOKIE) { // testing env fix
+ $this->di['cookie']->set('BOXCLR', "", time() - 3600, '/');
+ }
+ $this->di['session']->delete('client');
+ $this->di['session']->delete('client_id');
+ $this->di['logger']->info('Logged out');
+ return true;
+ }
+
+ /**
+ * Get payments information
+ * @return array
+ */
+ public function balance_get_list($data)
+ {
+ $service = $this->di['mod_service']('Client', 'Balance');
+ $data['client_id'] = $this->identity->id;
+
+ list($q, $params) = $service->getSearchQuery($data);
+ $per_page = isset($data['per_page']) ? $data['per_page'] : $this->di['pager']->getPer_page();
+ $pager = $this->di['pager']->getSimpleResultSet($q, $params, $per_page);
+
+ foreach ($pager['list'] as $key => $item) {
+ $balance = $this->di['db']->getExistingModelById('ClientBalance', $item['id'], 'Balance not found');
+ $pager['list'][$key] = $service->toApiArray($balance);
+ }
+
+ return $pager;
+ }
+
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/Api/Guest.php b/src/bb-modules/Client/Api/Guest.php
new file mode 100644
index 000000000..969cccc9a
--- /dev/null
+++ b/src/bb-modules/Client/Api/Guest.php
@@ -0,0 +1,281 @@
+di['mod_config']('client');
+
+ if(isset($config['allow_signup']) && !$config['allow_signup']) {
+ throw new \Box_Exception('New registrations are temporary disabled');
+ }
+
+ if(!isset($data['email'])) {
+ throw new \Box_Exception('Email required');
+ }
+
+ if(!isset($data['first_name'])) {
+ throw new \Box_Exception('First name required');
+ }
+
+ if(!isset($data['password'])) {
+ throw new \Box_Exception('Password required');
+ }
+
+ if(!isset($data['password_confirm'])) {
+ throw new \Box_Exception('Password confirmation required');
+ }
+
+ if($data['password'] != $data['password_confirm']) {
+ throw new \Box_Exception('Passwords do not match');
+ }
+
+ if(isset($config['required']) && is_array($config['required'])) {
+ foreach($config['required'] as $field) {
+ if(!isset($data[$field]) || empty($data[$field])) {
+ $name = ucwords(str_replace('_', ' ', $field));
+ throw new \Box_Exception('It is required that you provide details for field ":field"', array(':field'=>$name));
+ }
+ }
+ }
+
+ $this->di['validator']->isPasswordStrong($data['password']);
+ $this->di['validator']->isEmailValid($data['email']);
+
+ $service = $this->getService();
+ $email = strtolower(trim($data['email']));
+ if($service->clientAlreadyExists($email)) {
+ throw new \Box_Exception('Email is already registered. You may want to login instead of registering.');
+ }
+
+ $client = $service->guestCreateClient($data);
+
+ if(isset($data['auto_login']) && $data['auto_login']) {
+ try {
+ $this->login(array('email'=>$client->email, 'password' => $client->pass));
+ } catch(\Exception $e) {
+ error_log($e->getMessage());
+ }
+ }
+
+ return (int) $client->id;
+ }
+
+ /**
+ * Client login action
+ *
+ * @param string $email - client email
+ * @param string $password - client password
+ *
+ * @return array - session data
+ * @throws Box_Exception
+ */
+ public function login($data)
+ {
+ if(!isset($data['email'])) {
+ throw new \Box_Exception('Email required');
+ }
+
+ if(!isset($data['password'])) {
+ throw new \Box_Exception('Password required');
+ }
+
+ $event_params = $data;
+ $event_params['ip'] = $this->ip;
+ $this->di['events_manager']->fire(array('event'=>'onBeforeClientLogin', 'params'=>$event_params));
+
+ $service = $this->getService();
+ $client = $service->getByLoginDetails($data['email'], sha1($data['password']));
+ if(!$client instanceof \Model_Client ) {
+
+ $this->di['events_manager']->fire(array('event'=>'onEventClientLoginFailed', 'params'=>$event_params));
+
+ throw new \Box_Exception('Please check your login details', array(), 403);
+ }
+
+ if(isset($data['remember'])) {
+ $email = $data['email'];
+ $pass = $data['password'];
+ $cookie_time = (3600 * 24 * 30); // 30 days
+ $this->di['cookie']->set('BOXCLR', 'e='.base64_encode($email).'&p='.base64_encode(sha1($pass)), time() + $cookie_time, '/');
+ }
+
+ $this->di['events_manager']->fire(array('event'=>'onAfterClientLogin', 'params'=>array('id'=>$client->id, 'ip'=>$this->ip)));
+
+ $result = $service->toSessionArray($client);
+ $this->di['session']->set('client_id', $client->id);
+
+ $this->di['logger']->info('Client #%s logged in', $client->id);
+ return $result;
+ }
+
+ /**
+ * Password reset confirmation email will be sent to email.
+ *
+ * @param string $email - client email
+ * @return boolean
+ * @throws Box_Exception
+ */
+ public function reset_password($data)
+ {
+ if(!isset($data['email'])) {
+ throw new \Box_Exception('Email required');
+ }
+
+ $this->di['events_manager']->fire(array('event'=>'onBeforeGuestPasswordResetRequest', 'params'=>$data));
+
+ $c = $this->di['db']->findOne('Client', 'email = ?', array($data['email']));
+ if(!$c instanceof \Model_Client ) {
+ throw new \Box_Exception('Email not found in our database');
+ }
+
+ $hash = sha1(time() . uniqid());
+
+ $reset = $this->di['db']->dispense('ClientPasswordReset');
+ $reset->client_id = $c->id;
+ $reset->ip = $this->ip;
+ $reset->hash = $hash;
+ $reset->created_at = date('c');
+ $reset->updated_at = date('c');
+ $this->di['db']->store($reset);
+
+ //send email
+ $email = array();
+ $email['to_client'] = $c->id;
+ $email['code'] = 'mod_client_password_reset_request';
+ $email['hash'] = $hash;
+ $emailSerivce = $this->di['mod_service']('email');
+ $emailSerivce->sendTemplate($email);
+
+ $this->di['logger']->info('Client requested password reset. Sent to email %s', $c->email);
+ return true;
+ }
+
+ /**
+ * Confirm password reset action
+ *
+ * @param string $hash - hash received in email
+ * @return boolean
+ * @throws Box_Exception
+ */
+ public function confirm_reset($data)
+ {
+ if(!isset($data['hash'])) {
+ throw new \Box_Exception('Hash required');
+ }
+
+ $reset = $this->di['db']->findOne('ClientPasswordReset', 'hash = ?', array($data['hash']));
+ if(!$reset instanceof \Model_ClientPasswordReset) {
+ throw new \Box_Exception('The link have expired or you have already confirmed password reset.');
+ }
+
+ $new_pass = substr(md5(time() . uniqid()), 0, 10);
+
+ $c = $this->di['db']->load('Client', $reset->client_id);
+ $c->pass = $new_pass;
+ $this->di['db']->store($c);
+
+ //send email
+ $email = array();
+ $email['to_client'] = $reset->client_id;
+ $email['code'] = 'mod_client_password_reset_approve';
+ $email['password'] = $new_pass;
+ $emailService = $this->di['mod_service']('email');
+ $emailService->sendTemplate($email);
+
+ $this->di['db']->trash($reset);
+ $this->di['logger']->info('Client password reset request was approved');
+ return true;
+ }
+
+ /**
+ * Check if given vat number is valid EU country VAT number
+ * This method uses http://isvat.appspot.com/ method to validate VAT
+ *
+ * @param string $country - Country CODE: FR - France etc.
+ * @param string $vat - VAT number
+ *
+ * @return bool- true if VAT is valid, false if not
+ */
+ public function is_vat($data)
+ {
+ if(!isset($data['country'])) {
+ throw new \Box_Exception('Country code is required');
+ }
+
+ if(!isset($data['vat'])) {
+ throw new \Box_Exception('Country code is required');
+ }
+
+ $cc = $data['country'];
+ $vatnum = $data['vat'];
+ $url = 'http://isvat.appspot.com/'.rawurlencode($cc).'/'.rawurlencode($vatnum).'/';
+ $result = $this->di['guzzle_client']->get($url);
+ return ($result == 'true');
+ }
+
+ /**
+ * List of required fields for client registration
+ */
+ public function required()
+ {
+ $config = $this->di['mod_config']('client');
+ return isset($config['required']) ? $config['required'] : array();
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/Controller/Admin.php b/src/bb-modules/Client/Controller/Admin.php
new file mode 100644
index 000000000..129f72c79
--- /dev/null
+++ b/src/bb-modules/Client/Controller/Admin.php
@@ -0,0 +1,125 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function fetchNavigation()
+ {
+ return array(
+ 'group' => array(
+ 'index' => 200,
+ 'location' => 'client',
+ 'label' => 'Clients',
+ 'uri' => $this->di['url']->adminLink('client'),
+ 'class' => 'contacts',
+ ),
+ 'subpages' => array(
+ array(
+ 'location' => 'client',
+ 'label' => 'Overview',
+ 'uri' => $this->di['url']->adminLink('client'),
+ 'index' => 100,
+ 'class' => '',
+ ),
+ array(
+ 'location' => 'client',
+ 'label' => 'Advanced search',
+ 'uri' => $this->di['url']->adminLink('client', array('show_filter' => 1)),
+ 'index' => 200,
+ 'class' => '',
+ ),
+ array(
+ 'location' => 'activity',
+ 'index' => 900,
+ 'label' => 'Client logins history',
+ 'uri' => $this->di['url']->adminLink('client/logins'),
+ 'class' => '',
+ ),
+ ),
+ );
+ }
+
+ public function register(\Box_App &$app)
+ {
+ $app->get('/client', 'get_index', array(), get_class($this));
+ $app->get('/client/', 'get_index', array(), get_class($this));
+ $app->get('/client/index', 'get_index', array(), get_class($this));
+ $app->get('/client/login/:id', 'get_login', array('id'=>'[0-9]+'), get_class($this));
+ $app->get('/client/manage/:id', 'get_manage', array('id'=>'[0-9]+'), get_class($this));
+ $app->get('/client/group/:id', 'get_group', array('id'=>'[0-9]+'), get_class($this));
+ $app->get('/client/create', 'get_create', array(), get_class($this));
+ $app->get('/client/logins', 'get_history', array(), get_class($this));
+ }
+
+ public function get_index(\Box_App $app)
+ {
+ $app->getApiAdmin();
+ return $app->render('mod_client_index');
+ }
+
+ public function get_manage(\Box_App $app, $id)
+ {
+ $api = $app->getApiAdmin();
+ $client = $api->client_get(array('id'=>$id));
+ return $app->render('mod_client_manage', array('client'=>$client));
+ }
+
+ public function get_group(\Box_App $app, $id)
+ {
+ $api = $app->getApiAdmin();
+ $model = $api->client_group_get(array('id'=>$id));
+ return $app->render('mod_client_group', array('group'=>$model));
+ }
+
+ public function get_history(\Box_App $app)
+ {
+ $api = $app->getApiAdmin();
+ return $app->render('mod_client_login_history');
+ }
+
+ public function get_login(\Box_App $app, $id)
+ {
+ $api = $app->getApiAdmin();
+ $api->client_login(array('id'=>$id));
+
+ $redirect_to = '/';
+ if ($this->di['request']->getQuery('r')) {
+ $r = $this->di['request']->getQuery('r');
+ $redirect_to = '/' . trim($r, '/');
+ }
+
+ Header( "HTTP/1.1 301 Moved Permanently" );
+ Header( "Location: ".$this->di['tools']->url($redirect_to) );
+ exit;
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/Controller/Client.php b/src/bb-modules/Client/Controller/Client.php
new file mode 100644
index 000000000..31ffdc398
--- /dev/null
+++ b/src/bb-modules/Client/Controller/Client.php
@@ -0,0 +1,104 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function register(\Box_App &$app)
+ {
+ //@deprecated
+ $app->get('/client/me', 'get_profile', array(), get_class($this));
+
+ $app->get('/client/reset-password-confirm/:hash', 'get_reset_password_confirm', array('hash'=>'[a-z0-9]+'), get_class($this));
+ $app->get('/client', 'get_client_index', array(), get_class($this));
+ $app->get('/client/logout', 'get_client_logout', array(), get_class($this));
+ $app->get('/client/:page', 'get_client_page', array('page'=>'[a-z0-9-]+'), get_class($this));
+ $app->get('/client/confirm-email/:hash', 'get_client_confirmation', array('page'=>'[a-z0-9-]+'), get_class($this));
+ }
+
+ /**
+ * @param Box_App $app
+ * @deprecated
+ */
+ public function get_profile(\Box_App $app)
+ {
+ return $app->redirect('/client/profile');
+ }
+
+ /**
+ * @param Box_App $app
+ * @deprecated
+ */
+ public function get_balance(\Box_App $app)
+ {
+ return $app->redirect('/client/balance');
+ }
+
+ public function get_client_index(\Box_App $app)
+ {
+ $api = $app->getApiClient();
+ return $app->render('mod_client_index');
+ }
+
+ public function get_client_confirmation(\Box_App $app, $hash)
+ {
+ $mod = new Box_Mod('client');
+ $service = $mod->getService();
+ $service->approveClientEmailByHash($hash);
+ $app->redirect('/');
+ }
+
+ public function get_client_logout(\Box_App $app)
+ {
+ $api = $app->getApiClient();
+ $api->profile_logout();
+ $app->redirect('/');
+ }
+
+ public function get_client_page(\Box_App $app, $page)
+ {
+ $api = $app->getApiClient();
+ $template = 'mod_client_'.$page;
+ return $app->render($template);
+ }
+
+ public function get_reset_password_confirm(\Box_App $app, $hash)
+ {
+ $api = $app->getApiGuest();
+ $data = array(
+ 'hash' => $hash,
+ );
+ $api->client_confirm_reset($data);
+ $app->redirect('/login');
+ }
+
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/Service.php b/src/bb-modules/Client/Service.php
new file mode 100644
index 000000000..778257873
--- /dev/null
+++ b/src/bb-modules/Client/Service.php
@@ -0,0 +1,586 @@
+di = $di;
+ }
+
+ /**
+ * @return null
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function approveClientEmailByHash($hash)
+ {
+ $db = $this->di['db'];
+ $result = $db->getRow('SELECT id, client_id FROM extension_meta WHERE extension = "mod_client" AND meta_key = "confirm_email" AND meta_value = :hash', array(':hash'=>$hash));
+ if(!$result) {
+ throw new \Box_Exception('Invalid email confirmation link');
+ }
+ $db->exec('UPDATE client SET email_approved = 1 WHERE id = :id', array('id'=>$result['client_id']));
+ $db->exec('DELETE FROM extension_meta WHERE id = :id', array('id'=>$result['id']));
+ return true;
+ }
+
+ public function generateEmailConfirmationLink($client_id)
+ {
+ $hash = strtolower($this->di['tools']->generatePassword(50));
+ $db = $this->di['db'];
+
+ $meta = $db->dispense('ExtensionMeta');
+ $meta->extension = 'mod_client';
+ $meta->client_id = $client_id;
+ $meta->meta_key = 'confirm_email';
+ $meta->meta_value = $hash;
+ $meta->created_at = date('c');
+ $meta->updated_at = date('c');
+ $db->store($meta);
+
+ return $this->di['tools']->url('/client/confirm-email/'.$hash);
+ }
+
+ public static function onAfterClientSignUp(\Box_Event $event)
+ {
+ $di = $event->getDi();
+ $params = $event->getParameters();
+ $config = $di['mod_config']('client');
+ $emailService = $di['mod_service']('email');
+ try {
+ $email = array();
+ $email['to_client'] = $params['id'];
+ $email['code'] = 'mod_client_signup';
+ $email['password'] = $params['password'];
+ $email['require_email_confirmation'] = false;
+ if(isset($config['require_email_confirmation']) && $config['require_email_confirmation']) {
+ $clientService = $di['mod_service']('client');
+ $email['require_email_confirmation'] = true;
+ $email['email_confirmation_link'] = $clientService->generateEmailConfirmationLink($params['id']);
+ }
+
+ $emailService->sendTemplate($email);
+ } catch(\Exception $exc) {
+ error_log($exc->getMessage());
+ }
+
+ return true;
+ }
+
+ public function getSearchQuery($data, $selectStmt = 'SELECT c.*')
+ {
+ $sql = $selectStmt;
+ $sql .= ' FROM client as c left join client_group as cg on c.client_group_id = cg.id';
+
+ $search = (isset($data['search']) && !empty($data['search'])) ? $data['search'] : NULL;
+ $client_id = (isset($data['client_id']) && !empty($data['client_id'])) ? $data['client_id'] : NULL;
+ $group_id = (isset($data['group_id']) && !empty($data['group_id'])) ? $data['group_id'] : NULL;
+ $id = (isset($data['id']) && !empty($data['id'])) ? $data['id'] : NULL;
+ $status = (isset($data['status']) && !empty($data['status'])) ? $data['status'] : NULL;
+ $name = (isset($data['name']) && !empty($data['name'])) ? $data['name'] : NULL;
+ $company = (isset($data['company']) && !empty($data['company'])) ? $data['company'] : NULL;
+ $email = (isset($data['email']) && !empty($data['email'])) ? $data['email'] : NULL;
+ $created_at = (isset($data['created_at']) && !empty($data['created_at'])) ? $data['created_at'] : NULL;
+ $date_from = (isset($data['date_from']) && !empty($data['date_from'])) ? $data['date_from'] : NULL;
+ $date_to = (isset($data['date_to']) && !empty($data['date_to'])) ? $data['date_to'] : NULL;
+
+ $where = array();
+ $params = array();
+ if($id) {
+ $where[] = 'c.id = :client_id or c.aid = :alt_client_id';
+ $params[':client_id'] = $id;
+ $params[':alt_client_id'] = $id;
+ }
+
+ if($name) {
+ $where[] = '(c.first_name LIKE :first_name or c.last_name LIKE :last_name )';
+ $name = "%" . $name . "%";
+ $params[':first_name'] = $name;
+ $params[':last_name'] = $name;
+ }
+
+ if($email) {
+ $where[] = 'c.email LIKE :email';
+ $params[':email'] = "%" . $email . "%";
+ }
+
+ if($company) {
+ $where[] = 'c.company LIKE :company';
+ $params[':company'] = "%" . $company . "%";
+ }
+
+ if($status) {
+ $where[] = 'c.status = :status';
+ $params[':status'] = $status;
+ }
+
+ if($group_id) {
+ $where[] = 'c.client_group_id = :group_id';
+ $params[':group_id'] = $group_id;
+ }
+
+ if($created_at) {
+ $where[] = "DATE_FORMAT(c.created_at, '%Y-%m-%d') = :created_at";
+ $params[':created_at'] = date('Y-m-d', strtotime($created_at)) ;
+ }
+
+ if($date_from) {
+ $where[] = 'UNIX_TIMESTAMP(c.created_at) >= :date_from';
+ $params[':date_from'] = strtotime($date_from);
+ }
+
+ if($date_to) {
+ $where[] = 'UNIX_TIMESTAMP(c.created_at) <= :date_from';
+ $params[':date_to'] = strtotime($date_to);
+ }
+
+ //smartSearch
+ if($search) {
+ if(is_numeric($search)) {
+ $where[] = 'c.id = :cid or c.aid = :caid';
+ $params[':cid'] = $search;
+ $params[':caid'] = $search;
+ } else {
+ $where[] = "c.company LIKE :s_company OR c.first_name LIKE :s_first_time OR c.last_name LIKE :s_last_name OR c.email LIKE :s_email OR CONCAT(c.first_name, ' ', c.last_name ) LIKE :full_name";
+ $search = "%" . $search . "%";
+ $params[':s_company'] = $search;
+ $params[':s_first_time'] = $search;
+ $params[':s_last_name'] = $search;
+ $params[':s_email'] = $search;
+ $params[':full_name'] = $search;
+ }
+ }
+
+ if (!empty($where)){
+ $sql .= ' WHERE '.implode(' AND ', $where);
+ }
+ $sql = $sql.' ORDER BY c.created_at desc';
+
+ return array($sql, $params);
+ }
+
+ public function getPairs($data)
+ {
+ $limit = isset($data['per_page']) ? $data['per_page'] : 30;
+ list($sql, $params) = $this->getSearchQuery($data, "SELECT c.id, CONCAT(c.first_name, ' ', c.last_name) as full_name");
+ $sql = $sql.' LIMIT '.$limit;
+ return $this->di['db']->getAssoc($sql, $params);
+ }
+
+ public function toSessionArray(\Model_Client $model)
+ {
+ return array(
+ 'id' => $model->id,
+ 'email' => $model->email,
+ 'name' => $model->getFullName(),
+ 'role' => $model->role,
+ );
+ }
+
+ public function emailAreadyRegistered($new_email, \Model_Client $model = null)
+ {
+ if($model && $model->email == $new_email) {
+ return false;
+ }
+
+ $result = $this->di['db']->findOne('Client', 'email = ?', array($new_email));
+
+ return ($result) ? true : false;
+ }
+
+ public function canChangeCurrency(\Model_Client $model, $currency = null)
+ {
+ if(!$model->currency) {
+ return true;
+ }
+
+ if($model->currency == $currency) {
+ return false;
+ }
+
+ $invoice = $this->di['db']->load('Invoice', 'client_id = ?', $model->client_id);
+ if($invoice) {
+ throw new \Box_Exception('Currency can not be changed. Client already have invoices issued.');
+ }
+
+ $order = $this->di['db']->load('ClientOrder', 'client_id = ?', $model->client_id);
+ if($order) {
+ throw new \Box_Exception('Currency can not be changed. Client already have orders.');
+ }
+
+ /*
+ if($model->ClientBalance->count() > 0) {
+ throw new \Box_Exception('Currency can not be changed. Client have money in balance.');
+ }
+ */
+ return true;
+ }
+
+ public function addFunds(\Model_Client $client, $amount, $description, array $data = null)
+ {
+ if(!$client->currency) {
+ throw new \Box_Exception('Define clients currency before adding funds.');
+ }
+
+ if(!is_numeric($amount)) {
+ throw new \Box_Exception('Funds amount is not valid');
+ }
+
+ if(empty($description)) {
+ throw new \Box_Exception('Funds description is not valid');
+ }
+
+ $credit = $this->di['db']->dispense('ClientBalance');
+
+ $credit->client_id = $client->id;
+ $credit->type = isset($data['type']) ? $data['type'] : 'gift';
+ $credit->rel_id = isset($data['rel_id']) ? $data['rel_id'] : null;
+ $credit->description = $description;
+ $credit->amount = $amount;
+ $credit->created_at = date('c');
+ $credit->updated_at = date('c');
+
+ $this->di['db']->store($credit);
+ return true;
+ }
+
+ public function getExpiredPasswordReminders()
+ {
+ $expire_after_hours = 2;
+ $expired = $this->di['db']->find('ClientPasswordReset', 'UNIX_TIMESTAMP() - ? > created_at', array($expire_after_hours * 60 * 60));
+ return $expired;
+ }
+
+ public function getHistorySearchQuery($data)
+ {
+ $q = 'SELECT ach.*, c.first_name, c.last_name, c.email
+ FROM activity_client_history as ach
+ LEFT JOIN client as c on ach.client_id = c.id ';
+
+ $search = isset($data['search']) ? $data['search'] : NULL;
+ $client_id = isset($data['client_id']) ? $data['client_id'] : NULL;
+
+ $where = array();
+ $params = array();
+ if($search) {
+ $where[] = 'c.first_name LIKE %:first_name% OR c.last_name LIKE %:last_name% OR c.id LIKE :id';
+ $params[':first_name'] = $search;
+ $params[':last_name'] = $search;
+ $params[':id'] = $search;
+ }
+
+ if($client_id) {
+ $where[] = 'ach.client_id = :client_id';
+ $params[':client_id'] = $client_id;
+ }
+
+ if (!empty($where)){
+ $q .= ' WHERE '.implode(' AND ', $where);
+ }
+
+ $q .= ' ORDER BY ach.id desc';
+
+ return array($q, $params);
+ }
+
+ public function counter()
+ {
+ $sql = 'SELECT status, COUNT(id) as counter
+ FROM client
+ group by status';
+ $data = $this->di['db']->getAssoc($sql);
+ return array(
+ 'total' => array_sum($data),
+ \Model_Client::ACTIVE => isset($data[\Model_Client::ACTIVE]) ? $data[\Model_Client::ACTIVE] : 0,
+ \Model_Client::SUSPENDED => isset($data[\Model_Client::SUSPENDED]) ? $data[\Model_Client::SUSPENDED] : 0,
+ \Model_Client::CANCELED => isset($data[\Model_Client::CANCELED]) ? $data[\Model_Client::CANCELED] : 0,
+ );
+ }
+
+ public function getGroupPairs()
+ {
+ $sql = 'SELECT id, title
+ FROM client_group';
+ return $this->di['db']->getAssoc($sql);
+ }
+
+ public function clientAlreadyExists($email)
+ {
+ $client = $this->di['db']->findOne('Client', 'email = :email ', array(':email' => $email));
+
+ return ($client instanceof \Model_Client);
+ }
+
+ public function getByLoginDetails($email, $password)
+ {
+ $client = $this->di['db']->findOne('Client', 'email = ? and pass = ? and status = ?', array($email, $password, \Model_Client::ACTIVE));
+ return $client;
+ }
+
+ public function toApiArray(\Model_Client $model, $deep = false, $identity = null)
+ {
+ $details = array(
+ 'id' => $model->id,
+ 'aid' => $model->aid,
+ 'email' => $model->email,
+ 'type' => $model->type,
+ 'group_id' => $model->client_group_id,
+ 'company' => $model->company,
+ 'company_vat' => $model->company_vat,
+ 'company_number' => $model->company_number,
+ 'first_name' => $model->first_name,
+ 'last_name' => $model->last_name,
+ 'gender' => $model->gender,
+ 'birthday' => $model->birthday,
+ 'phone_cc' => $model->phone_cc,
+ 'phone' => $model->phone,
+ 'address_1' => $model->address_1,
+ 'address_2' => $model->address_2,
+ 'city' => $model->city,
+ 'state' => $model->state,
+ 'postcode' => $model->postcode,
+ 'country' => $model->country,
+ 'currency' => $model->currency,
+ 'notes' => $model->notes,
+ 'created_at' => $model->created_at,
+ );
+
+ if($deep) {
+ $details['balance'] = $this->getClientBalance($model);
+ }
+
+ $m = $this->di['db']->toArray($model);
+ for ($i = 1; $i < 11; $i++) {
+ $k = 'custom_'.$i;
+ if(isset($m[$k]) && !empty($m[$k])) {
+ $details[$k] = $m[$k];
+ }
+ }
+
+ $clientGroup = $this->di['db']->load('ClientGroup', $model->client_group_id);
+
+ if($identity instanceof \Model_Admin) {
+ $details['auth_type'] = $model->auth_type;
+ $details['api_token'] = $model->api_token;
+ $details['ip'] = $model->ip;
+ $details['status'] = $model->status;
+ $details['tax_exempt'] = $model->tax_exempt;
+ $details['group'] = ($clientGroup) ? $clientGroup->title : NULL;
+ $details['updated_at'] = $model->updated_at;
+ }
+
+ return $details;
+ }
+
+ public function getClientBalance(\Model_Client $c)
+ {
+ $sql = 'SELECT SUM(amount) as client_total
+ FROM client_balance
+ WHERE client_id = ?
+ GROUP BY client_id';
+
+ $balance = $this->di['db']->getCell($sql, array($c->id));
+
+ return $balance;
+ }
+
+ public function get($data)
+ {
+ if(!isset($data['id']) && !isset($data['email'])) {
+ throw new \Box_Exception('Client ID or email is required');
+ }
+
+ $db = $this->di['db'];
+ $client = null;
+ if(isset($data['id'])) {
+ $client = $db->findOne('Client', 'id = ?', array($data['id']));
+ }
+
+ if(!$client && isset($data['email'])) {
+ $client = $db->findOne('Client', 'email = ?', array($data['email']));
+ }
+
+ if(!$client instanceof \Model_Client ) {
+ throw new \Box_Exception('Client not found');
+ }
+ return $client;
+ }
+
+ public function isClientTaxable(\Model_Client $model)
+ {
+ $systemService = $this->di['mod_service']('system');
+
+ if (!$systemService->getParamValue('tax_enabled', false)) {
+ return false;
+ }
+
+ if ($model->tax_exempt) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public function createGroup(array $data)
+ {
+ $systemService = $this->di['mod_service']('system');
+ $systemService->checkLimits('Model_ClientGroup', 2);
+
+ $model = $this->di['db']->dispense('ClientGroup');
+
+ $model->title = $data['title'];
+ $model->updated_at = date('c');
+ $model->created_at = date('c');
+
+ $group_id = $this->di['db']->store($model);
+
+ $this->di['logger']->info('Created new client group #%s', $model->id);
+ return $group_id;
+ }
+
+ public function deleteGroup(\Model_ClientGroup $model)
+ {
+ $client = $this->di['db']->findOne('Client', 'client_group_id = ?', array($model->id));
+ if($client) {
+ throw new \Box_Exception('Can not remove group with clients');
+ }
+
+ $this->di['db']->trash($model);
+ $this->di['logger']->info('Removed client group #%s', $model->id);
+ return true;
+ }
+
+ private function createClient(array $data)
+ {
+ $password = isset($data['password']) ? $data['password'] : uniqid();
+
+ $client = $this->di['db']->dispense('Client');
+ $client->auth_type = isset($data['auth_type']) ? $data['auth_type'] : NULL;
+ $client->email = strtolower(trim($data['email']));
+ $client->first_name = ucwords($data['first_name']);
+ $client->pass = sha1($password);
+
+ $client->aid = isset($data['aid']) ? $data['aid'] : NULL ;
+ $client->last_name = isset($data['last_name']) ? $data['last_name'] : NULL ;
+ $client->client_group_id = isset($data['group_id']) ? $data['group_id'] : NULL ;
+ $client->status = isset($data['status']) ? $data['status'] : NULL ;
+ $client->gender = isset($data['gender']) ? $data['gender'] : NULL ;
+ $client->birthday = isset($data['birthday']) ? $data['birthday'] : NULL ;
+ $client->phone_cc = isset($data['phone_cc']) ? $data['phone_cc'] : NULL ;
+ $client->phone = isset($data['phone']) ? $data['phone'] : NULL ;
+ $client->company = isset($data['company']) ? $data['company'] : NULL ;
+ $client->company_vat = isset($data['company_vat']) ? $data['company_vat'] : NULL ;
+ $client->company_number = isset($data['company_number']) ? $data['company_number'] : NULL ;
+ $client->type = isset($data['type']) ? $data['type'] : NULL ;
+ $client->address_1 = isset($data['address_1']) ? $data['address_1'] : NULL ;
+ $client->address_2 = isset($data['address_2']) ? $data['address_2'] : NULL ;
+ $client->city = isset($data['city']) ? $data['city'] : NULL ;
+ $client->state = isset($data['state']) ? $data['state'] : NULL ;
+ $client->postcode = isset($data['postcode']) ? $data['postcode'] : NULL ;
+ $client->country = isset($data['country']) ? $data['country'] : NULL ;
+ $client->document_type = isset($data['document_type']) ? $data['document_type'] : NULL ;
+ $client->document_nr = isset($data['document_nr']) ? $data['document_nr'] : NULL ;
+ $client->notes = isset($data['notes']) ? $data['notes'] : NULL ;
+ $client->lang = isset($data['lang']) ? $data['lang'] : NULL ;
+ $client->currency = isset($data['currency']) ? $data['currency'] : NULL ;
+
+ $client->custom_1 = isset($data['custom_1']) ? $data['custom_1'] : NULL ;
+ $client->custom_2 = isset($data['custom_2']) ? $data['custom_2'] : NULL ;
+ $client->custom_3 = isset($data['custom_3']) ? $data['custom_3'] : NULL ;
+ $client->custom_4 = isset($data['custom_4']) ? $data['custom_4'] : NULL ;
+ $client->custom_5 = isset($data['custom_5']) ? $data['custom_5'] : NULL ;
+ $client->custom_6 = isset($data['custom_6']) ? $data['custom_6'] : NULL ;
+ $client->custom_7 = isset($data['custom_7']) ? $data['custom_7'] : NULL ;
+ $client->custom_8 = isset($data['custom_8']) ? $data['custom_8'] : NULL ;
+ $client->custom_9 = isset($data['custom_9']) ? $data['custom_9'] : NULL ;
+ $client->custom_10 = isset($data['custom_10']) ? $data['custom_10'] : NULL ;
+
+ $client->ip = isset($data['ip']) ? $data['ip'] : NULL;
+ $client->created_at = isset($data['created_at']) ? date('c', strtotime($data['created_at'])) : date('c');
+ $client->updated_at = date('c');
+ $this->di['db']->store($client);
+ return $client;
+ }
+
+ public function adminCreateClient(array $data)
+ {
+ $this->di['events_manager']->fire(array('event'=>'onBeforeAdminCreateClient', 'params'=>$data));
+ $client = $this->createClient($data);
+ $this->di['events_manager']->fire(array('event'=>'onAfterAdminCreateClient', 'params'=>array('id'=>$client->id, 'password'=>$client->pass)));
+ $this->di['logger']->info('Created new client #%s', $client->id);
+
+ return $client->id;
+ }
+
+ public function guestCreateClient(array $data)
+ {
+ $event_params = $data;
+ $event_params['ip'] = $this->di['request']->getClientAddress();
+ $this->di['events_manager']->fire(array('event'=>'onBeforeClientSignUp', 'params'=>$event_params));
+
+ $data['ip'] = $this->di['request']->getClientAddress();
+ $data['status'] = \Model_Client::ACTIVE;
+ $client = $this->createClient($data);
+
+ $this->di['events_manager']->fire(array('event'=>'onAfterClientSignUp', 'params'=>array('id'=>$client->id, 'password'=>$client->pass)));
+ $this->di['logger']->info('Client #%s signed up', $client->id);
+
+ return $client;
+ }
+
+ public function remove(\Model_Client $model)
+ {
+ $service = $this->di['mod_service']('Order');
+ $service->rmByClient($model);
+ $service = $this->di['mod_service']('Invoice');
+ $service->rmByClient($model);
+ $service = $this->di['mod_service']('Support');
+ $service->rmByClient($model);
+ $service = $this->di['mod_service']('Client', 'Balance');
+
+ $table = $this->di['table']('ActivityClientHistory');
+ $table->rmByClient($model);
+
+ $service->rmByClient($model);
+ $service = $this->di['mod_service']('Email');
+ $service->rmByClient($model);
+ $service = $this->di['mod_service']('Activity');
+ $service->rmByClient($model);
+
+ $table = $this->di['table']('ForumTopicMessage');
+ $table->rmByClient($model);
+
+ $table = $this->di['table']('ClientPasswordReset');
+ $table->rmByClient($model);
+
+
+ $pdo = $this->di['pdo'];
+ $stmt = $pdo->prepare('DELETE FROM extension_meta WHERE client_id = :id');
+ $stmt->execute(array('id'=>$model->id));
+
+ $this->di['db']->trash($model);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/ServiceBalance.php b/src/bb-modules/Client/ServiceBalance.php
new file mode 100644
index 000000000..5aed393d3
--- /dev/null
+++ b/src/bb-modules/Client/ServiceBalance.php
@@ -0,0 +1,121 @@
+di = $di;
+ }
+
+ /**
+ * @return null
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function getClientBalance(\Model_Client $c)
+ {
+ return (float)$this->clientTotal($c);
+ }
+
+ public function clientTotal(\Model_Client $c)
+ {
+ $sql="
+ SELECT SUM(amount) as client_total
+ FROM client_balance
+ WHERE client_id = ?
+ GROUP BY client_id
+ ORDER BY id DESC
+ ";
+ return $this->di['db']->getCell($sql, array($c->id));
+ }
+
+ public function rmByClient(\Model_Client $client)
+ {
+ $clientBalances = $this->di['db']->find('ClientBalance', 'client_id', array($client->id));
+ foreach ($clientBalances as $balanceModel){
+ $this->di['db']->trash($balanceModel);
+ }
+ }
+
+ public function rm(\Model_ClientBalance $model)
+ {
+ $this->di['db']->trash($model);
+ }
+
+ public function toApiArray(\Model_ClientBalance $model)
+ {
+ $client = $this->di['db']->getExistingModelById('Client', $model->client_id, 'Client not found');
+ return array(
+ 'id' => $model->id,
+ 'description' => $model->description,
+ 'amount' => $model->amount,
+ 'currency' => $client->currency,
+ 'created_at' => $model->created_at,
+ );
+ }
+
+ public function getSearchQuery($data)
+ {
+ $q = 'SELECT m.*, c.currency as currency
+ FROM client_balance as m
+ LEFT JOIN client as c on c.id = m.client_id';
+
+ $id = isset($data['id']) ? $data['id'] : NULL;
+ $client_id = isset($data['client_id']) ? $data['client_id'] : NULL;
+ $date_from = isset($data['date_from']) ? $data['date_from'] : NULL;
+ $date_to = isset($data['date_to']) ? $data['date_to'] : NULL;
+
+ $where = array();
+ $params = array();
+
+ if(NULL !== $id) {
+ $where[] = 'm.id = :id';
+ $params[':id'] = $id;
+ }
+
+ if(NULL !== $client_id) {
+ $where[] = 'm.client_id = :client_id';
+ $params[':client_id'] = $client_id;
+ }
+
+ if(NULL !== $date_from) {
+ $where[] = 'm.created_at >= :date_from';
+ $params[':date_from'] = strtotime($date_from);
+ }
+
+ if(NULL !== $date_to) {
+ $where[] = 'm.created_at <= :date_to';
+ $params[':date_to'] = strtotime($date_to);
+ }
+
+ if (!empty($where)){
+ $q .= ' WHERE '.implode(' AND ', $where);
+ }
+ $q .= ' ORDER by m.id DESC';
+
+ return array($q, $params);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Client/html_admin/mod_client_settings.phtml b/src/bb-modules/Client/html_admin/mod_client_settings.phtml
new file mode 100644
index 000000000..11965a502
--- /dev/null
+++ b/src/bb-modules/Client/html_admin/mod_client_settings.phtml
@@ -0,0 +1,105 @@
+{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
+{% import "macro_functions.phtml" as mf %}
+{% block meta_title %}Client settings{% endblock %}
+{% set active_menu = 'system' %}
+
+{% block breadcrumbs %}
+
{% trans 'Please enter new password two times in order avoid mistypes' %}
+
+
+
+
+
{% trans 'API key' %}
+
{% trans 'API key allows integration with external applications. You will need this key for authentication.' %}
+
+
+
+
+
{% trans 'Currency' %}
+
{% trans 'Your profile currency is defined after your first order. Once your currency is set, all your profile accounting will be managed in that currency and can not be changed.' %}
+
+ {% if profile.currency %}
+
{% trans 'Your profile currency is' %} {{ profile.currency }}
+
{% trans 'Create new client profile if you want to manage your money in other currency' %}
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+
+{% block js %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/src/bb-modules/Client/html_email/mod_client_password_reset_approve.phtml b/src/bb-modules/Client/html_email/mod_client_password_reset_approve.phtml
new file mode 100644
index 000000000..8c6f7ed2a
--- /dev/null
+++ b/src/bb-modules/Client/html_email/mod_client_password_reset_approve.phtml
@@ -0,0 +1,22 @@
+{% block subject %}[{{ guest.system_company.name }}] Password Changed{% endblock %}
+{% block content %}
+{% filter markdown %}
+
+Hello {{ c.first_name }} {{ c.last_name }},
+
+As you requested, your password for our client area has now been reset.
+Your new login details are as follows:
+
+Login at: {{'login'|link({'email' : c.email }) }}
+Email: {{ c.email }}
+Password: {{ password }}
+
+To change your password to something more memorable, after logging in go to
+Profile > Change Password.
+
+Edit your profile at {{ 'client/me'|link }}
+
+{{ guest.system_company.signature }}
+
+{% endfilter %}
+{% endblock %}
diff --git a/src/bb-modules/Client/html_email/mod_client_password_reset_request.phtml b/src/bb-modules/Client/html_email/mod_client_password_reset_request.phtml
new file mode 100644
index 000000000..366ef4d73
--- /dev/null
+++ b/src/bb-modules/Client/html_email/mod_client_password_reset_request.phtml
@@ -0,0 +1,23 @@
+{% block subject %}[{{ guest.system_company.name }}] Confirm Password Reset{% endblock %}
+{% block content %}
+{% filter markdown %}
+
+Hello {{ c.first_name }} {{ c.last_name }},
+
+Recently a request was submitted to reset your password for the client area.
+If you did not request this, please ignore this email. It will expire and will not work in 2 hours time.
+
+To reset your password, please visit the url below:
+{{'client/reset-password-confirm'|link}}/{{ hash }}
+
+
+When you visit the link above, your password will be reset and a new
+password will be emailed to you.
+
+To login, visit {{'login'|link({'email' : c.email }) }}
+Edit your profile at {{'client/me'|link}}
+
+{{ guest.system_company.signature }}
+
+{% endfilter %}
+{% endblock %}
diff --git a/src/bb-modules/Client/html_email/mod_client_signup.phtml b/src/bb-modules/Client/html_email/mod_client_signup.phtml
new file mode 100644
index 000000000..704aa5c8e
--- /dev/null
+++ b/src/bb-modules/Client/html_email/mod_client_signup.phtml
@@ -0,0 +1,26 @@
+{% block subject %}[{{ guest.system_company.name }}] Welcome {{ c.first_name }}{% endblock %}
+{% block content %}
+{% filter markdown %}
+Hello {{ c.first_name }} {{ c.last_name }},
+
+Thank you for signing up with us. Your new account has been setup and you can now login to our client area using the details below.
+
+
+Email: {{c.email}}
+Password: {{password}}
+
+{% if require_email_confirmation %}
+
+Approve your email by clicking on the link below:
+
+{{email_confirmation_link}}
+
+{% endif %}
+
+To login, visit {{'login'|link({'email' : c.email }) }}
+Edit your profile at {{'client/me'|link}}
+
+{{ guest.system_company.signature }}
+
+{% endfilter %}
+{% endblock %}
\ No newline at end of file
diff --git a/src/bb-modules/Client/icon.png b/src/bb-modules/Client/icon.png
new file mode 100644
index 000000000..219d8fa0c
Binary files /dev/null and b/src/bb-modules/Client/icon.png differ
diff --git a/src/bb-modules/Client/manifest.json b/src/bb-modules/Client/manifest.json
new file mode 100644
index 000000000..0b7bc25d4
--- /dev/null
+++ b/src/bb-modules/Client/manifest.json
@@ -0,0 +1,8 @@
+{
+ "id": "client",
+ "type": "mod",
+ "name": "Client",
+ "description": "BoxBilling core module",
+ "icon_url": "icon.png",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cron/Api/Admin.php b/src/bb-modules/Cron/Api/Admin.php
new file mode 100644
index 000000000..5cdb12647
--- /dev/null
+++ b/src/bb-modules/Cron/Api/Admin.php
@@ -0,0 +1,41 @@
+getService()->getCronInfo();
+ }
+
+ /**
+ * Run cron
+ *
+ * @return bool
+ */
+ public function run($data)
+ {
+ return $this->getService()->runCrons();
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cron/Api/Guest.php b/src/bb-modules/Cron/Api/Guest.php
new file mode 100644
index 000000000..bb59e5392
--- /dev/null
+++ b/src/bb-modules/Cron/Api/Guest.php
@@ -0,0 +1,56 @@
+getMod()->getConfig();
+ $service = $this->getService();
+ if(isset($config['use_web_cron']) && $config['use_web_cron'] && $service->isLate()) {
+ $service->runCrons();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get cron settings
+ *
+ * @return array
+ */
+ public function settings()
+ {
+ return $this->getMod()->getConfig();
+ }
+
+ /**
+ * Tells if cron is late
+ *
+ * @return bool
+ */
+ public function is_late()
+ {
+ return $this->getService()->isLate();
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cron/Service.php b/src/bb-modules/Cron/Service.php
new file mode 100644
index 000000000..375b66b76
--- /dev/null
+++ b/src/bb-modules/Cron/Service.php
@@ -0,0 +1,101 @@
+di = $di;
+ }
+
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function getCronInfo()
+ {
+ $service = $this->di['mod_service']('system');
+
+ $result = array(
+ 'cron_url' => BB_URL . 'bb-cron.php',
+ 'cron_path' => BB_PATH_ROOT . DIRECTORY_SEPARATOR . 'bb-cron.php',
+ 'last_cron_exec' => $service->getParamValue('last_cron_exec'),
+ );
+ return $result;
+ }
+
+ /**
+ * @param null $interval - parameter from CLI, pass to filter crons to run
+ * @return bool
+ * @todo finish fixing, time to sleep
+ */
+ public function runCrons($interval = null)
+ {
+ $api = $this->di['api_admin'];
+ $this->di['logger']->info('- Started executing cron');
+
+ //@core tasks
+ $this->_exec($api, 'hook_batch_connect');
+ $this->_exec($api, 'invoice_batch_pay_with_credits');
+ $this->_exec($api, 'invoice_batch_activate_paid');
+ $this->_exec($api, 'invoice_batch_send_reminders');
+ $this->_exec($api, 'invoice_batch_generate');
+ $this->_exec($api, 'invoice_batch_invoke_due_event');
+ $this->_exec($api, 'order_batch_suspend_expired');
+ $this->_exec($api, 'order_batch_cancel_suspended');
+ $this->_exec($api, 'support_batch_ticket_auto_close');
+ $this->_exec($api, 'support_batch_public_ticket_auto_close');
+ $this->_exec($api, 'client_batch_expire_password_reminders');
+ $this->_exec($api, 'cart_batch_expire');
+
+ $create = (APPLICATION_ENV == 'production');
+ $ss = $this->di['mod_service']('system');
+ $ss->setParamValue('last_cron_exec', date('c'), $create);
+
+ $this->di['events_manager']->fire(array('event'=>'onAfterAdminCronRun'));
+
+ $this->di['logger']->info('- Finished executing cron');
+ return true;
+ }
+
+ protected function _exec($api, $method, $params = null)
+ {
+ try {
+ $api->{$method}($params);
+ } catch(\Exception $e) {
+ error_log($e);
+ }
+ }
+
+ public function getLastExecutionTime()
+ {
+ $service = $this->di['mod_service']('system');
+ $last_exec = $service->getParamValue('last_cron_exec');
+ return $last_exec;
+ }
+
+ public function isLate()
+ {
+ $t1 = new \DateTime($this->getLastExecutionTime());
+ $t2 = new \DateTime('-6min');
+ return ($t1 < $t2);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Cron/html_admin/mod_cron_settings.phtml b/src/bb-modules/Cron/html_admin/mod_cron_settings.phtml
new file mode 100644
index 000000000..88d069fa1
--- /dev/null
+++ b/src/bb-modules/Cron/html_admin/mod_cron_settings.phtml
@@ -0,0 +1,87 @@
+{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
+{% import "macro_functions.phtml" as mf %}
+{% block meta_title %}{% trans 'Cron settings' %}{% endblock %}
+{% set active_menu = 'system' %}
+
+{% block breadcrumbs %}
+
{% trans 'Setup scheduled tasks to be executed once a day' %}
+
{% trans 'Scheduled tasks must be enabled immediately after installation. Cron is responsible for sending your clients reminder about payments, domain renewal notices and many more.' %}
+
+
+ {% set cron = admin.cron_info %}
+
+
+
+
{% trans 'Timezone' %}
+
{{ "now"|date('e') }}
+
+
+
+
{% trans 'Time on server' %}
+
{{ "now"|date('Y-m-d H:i:s') }}
+
+
+
{% trans 'Last time scheduled tasks were executed' %}
+
+ {% if cron.last_cron_exec %}
+ {{ cron.last_cron_exec|date('Y-m-d H:i:s') }}
+ ({{cron.last_cron_exec|timeago }} ago)
+ {% else %}
+ {% trans 'Scheduled tasks were never executed' %}
+ {% endif %}
+
+
+
+
{% trans 'Unix crontab setup:' %}
+
*/5 * * * * php {{ cron.cron_path}}
+
+
+
{% trans 'Execute scheduled tasks from browser' %}
{% trans 'Default currency is the one you manage all your prices in admin area. If your client in client area chooses other than default currency, prices will be recalculated according to conversion rate. You can have only one default currency. You can not add same currency once again. Changing default currency is not recommended when active orders are available. Nothing is recalculated on default currency change. Your income is calculated in default currency. Changing default currency after you have paid invoices will distort income statistics. Currency rates are taken from Yahoo.' %}
+
+
+
+
+
+
{% trans 'ISO code' %}
+
{% trans 'Title' %}
+
{% trans 'Conversion rate' %}
+
{% trans 'Example price' %}
+
+
+
+
+
+ {% for currency in admin.currency_get_list.list %}
+
+
+
+
+ {% set templates = admin.email_template_get_list({"per_page":100, "page":request.page}|merge(request)) %}
+ {% for i, template in templates.list %}
+
+
{{ template.subject }}
+
{{ template.category }}
+
{{ template.action_code }}
+
{{ mf.q(template.enabled) }}
+
+
+
+
+
+
+
+ {% else %}
+
+
+ {% trans 'The list is empty. Depending on modules enabled email templates will be inserted after first event occurrence.' %}
+
{% trans 'Most email templates receives parameters from BoxBilling. You can browse them on "Variables" tab. Copy variable name to email template and hit preview to see parsed content. Please note that values will be different when actual email is sent.' %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{% trans 'Template settings' %}
+
{% trans 'Enable or disable this email template.' %}
+
+
+
+
+
+
+
{% trans 'List of variables used in this email' %}
+
{% trans 'These values will change when real email is sent. You can pass these variables to admin or guest API to get additional information from database.' %}
+
+
+
+
+
+
{% trans 'Variable' %}
+
{% trans 'Example value' %}
+
+
+
+
+ {% for k,var in template.vars %}
+ {% if var|keys|length > 0 %}
+ {% for subkey,subvalue in var %}
+
+
+
{{ '{{' }} {{ k }}.{{subkey}} {{ '}}' }}
+
{{ subvalue }}
+
+ {% endfor %}
+ {% else %}
+
+
{{ '{{' }} {{ k }} {{ '}}' }}
+
{{ var }}
+
+ {% endif %}
+
+ {% else %}
+
+
{% trans 'This template does not receive any parameters' %}
+
+ {% endfor %}
+
+
+
+
+
+
+
{% trans 'Reset email template to default' %}
+
+
+
+
+
+
+
+
+
+
{% trans 'Email templates examples' %}
+
{% trans 'Email template playground. Use this tool to try rendering email templates.' %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block js %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/src/bb-modules/Email/html_client/mod_email_email.phtml b/src/bb-modules/Email/html_client/mod_email_email.phtml
new file mode 100644
index 000000000..904147d5b
--- /dev/null
+++ b/src/bb-modules/Email/html_client/mod_email_email.phtml
@@ -0,0 +1,81 @@
+{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
+
+{% block meta_title %}{% trans 'Email' %}{% endblock %}
+{% block breadcrumb %}
+
+ {% include "partial_pagination.phtml" with {'list': emails} %}
+ {% endif %}
+
+
+
+
+{% endblock %}
+{% block js %}
+{% autoescape true js %}
+
+{% endautoescape %}
+{% endblock %}
\ No newline at end of file
diff --git a/src/bb-modules/Email/html_email/mod_email_test.phtml b/src/bb-modules/Email/html_email/mod_email_test.phtml
new file mode 100644
index 000000000..825e8d6d6
--- /dev/null
+++ b/src/bb-modules/Email/html_email/mod_email_test.phtml
@@ -0,0 +1,12 @@
+{% block subject %}[{{ guest.system_company.name }}] BoxBilling Email Test{% endblock %}
+{% block content %}
+{% filter markdown %}
+Hi {{ staff.name }},
+
+If you are reading this email, BoxBilling is **configured properly**
+and is **able to send emails**.
+
+{{ guest.system_company.signature }}
+
+{% endfilter %}
+{% endblock %}
diff --git a/src/bb-modules/Email/icon.png b/src/bb-modules/Email/icon.png
new file mode 100644
index 000000000..f8a3307ff
Binary files /dev/null and b/src/bb-modules/Email/icon.png differ
diff --git a/src/bb-modules/Email/manifest.json b/src/bb-modules/Email/manifest.json
new file mode 100644
index 000000000..8804f845b
--- /dev/null
+++ b/src/bb-modules/Email/manifest.json
@@ -0,0 +1,8 @@
+{
+ "id": "email",
+ "type": "mod",
+ "name": "Email",
+ "icon_url": "icon.png",
+ "description": "BoxBilling core module",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Embed/Controller/Admin.php b/src/bb-modules/Embed/Controller/Admin.php
new file mode 100644
index 000000000..2ac2c654e
--- /dev/null
+++ b/src/bb-modules/Embed/Controller/Admin.php
@@ -0,0 +1,60 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ public function fetchNavigation()
+ {
+ return array(
+ 'subpages'=> array(
+ array(
+ 'location' => 'extensions',
+ 'label' => 'Embed and integrate',
+ 'index' => 1500,
+ 'uri' => $this->di['url']->adminLink('embed'),
+ 'class' => '',
+ ),
+ ),
+ );
+ }
+
+ public function register(\Box_App &$app)
+ {
+ $app->get('/embed', 'get_index', array(), get_class($this));
+ }
+
+ public function get_index(\Box_App $app)
+ {
+ $api = $app->getApiAdmin();
+ return $app->render('mod_embed_index');
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Embed/Controller/Client.php b/src/bb-modules/Embed/Controller/Client.php
new file mode 100644
index 000000000..84ec95390
--- /dev/null
+++ b/src/bb-modules/Embed/Controller/Client.php
@@ -0,0 +1,53 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ /**
+ * Methods maps client areas urls to corresponding methods
+ * Always use your module prefix to avoid conflicts with other modules
+ * in future
+ *
+ * @param Box_App $app - returned by reference
+ */
+ public function register(\Box_App &$app)
+ {
+ $app->get('/embed/:what', 'get_object', array('what' => '[a-z0-9-]+'), get_class($this));
+ }
+
+ public function get_object(\Box_App $app, $what)
+ {
+ $api = $app->getApiGuest();
+ $tpl = 'mod_embed_'.$what;
+ return $app->render($tpl);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Embed/README.md b/src/bb-modules/Embed/README.md
new file mode 100644
index 000000000..85e9084bf
--- /dev/null
+++ b/src/bb-modules/Embed/README.md
@@ -0,0 +1,4 @@
+# Embed and integrate parts of BoxBilling to your website
+
+Module purpose is to give ability for users to include parts of BoxBilling
+to other websites.
\ No newline at end of file
diff --git a/src/bb-modules/Embed/html_admin/mod_embed_index.phtml b/src/bb-modules/Embed/html_admin/mod_embed_index.phtml
new file mode 100644
index 000000000..88abab973
--- /dev/null
+++ b/src/bb-modules/Embed/html_admin/mod_embed_index.phtml
@@ -0,0 +1,48 @@
+{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
+{% block meta_title %}Embed parts of BoxBilling{% endblock %}
+{% set active_menu = 'system' %}
+
+{% block content %}
+
+
+
Client area login form
+
+
+
Copy and paste the embed code to your website.
+
+
+
Domain checker form
+
+
+
Copy and paste the embed code to your website.
+
+
+
Contact us form
+
+
+
Copy and paste the embed code to your website.
+
+
+
+
+{% endblock %}
+
+
+{% block js %}
+{% autoescape true js %}
+
+{% endautoescape %}
+{% endblock %}
\ No newline at end of file
diff --git a/src/bb-modules/Embed/html_client/mod_embed_contact.phtml b/src/bb-modules/Embed/html_client/mod_embed_contact.phtml
new file mode 100644
index 000000000..fcb0fad11
--- /dev/null
+++ b/src/bb-modules/Embed/html_client/mod_embed_contact.phtml
@@ -0,0 +1,122 @@
+
+
+
+ Login
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/bb-modules/Embed/html_client/mod_embed_domainchecker.phtml b/src/bb-modules/Embed/html_client/mod_embed_domainchecker.phtml
new file mode 100644
index 000000000..ad28898be
--- /dev/null
+++ b/src/bb-modules/Embed/html_client/mod_embed_domainchecker.phtml
@@ -0,0 +1,85 @@
+
+
+
+ Check domain
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/bb-modules/Embed/html_client/mod_embed_loginform.phtml b/src/bb-modules/Embed/html_client/mod_embed_loginform.phtml
new file mode 100644
index 000000000..cafb9044f
--- /dev/null
+++ b/src/bb-modules/Embed/html_client/mod_embed_loginform.phtml
@@ -0,0 +1,63 @@
+
+
+
+ Login
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/bb-modules/Embed/manifest.json b/src/bb-modules/Embed/manifest.json
new file mode 100644
index 000000000..ff79fcad3
--- /dev/null
+++ b/src/bb-modules/Embed/manifest.json
@@ -0,0 +1,11 @@
+{
+ "id": "embed",
+ "type": "mod",
+ "name": "Embed parts",
+ "description": "Provides ability to embed parts of BoxBilling to other websites",
+ "homepage_url": "http://github.com/boxbilling/",
+ "author": "BoxBilling",
+ "author_url": "http://extensions.boxbilling.com/",
+ "license": "GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html",
+ "version": "1.0.1"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Example/Api/Admin.php b/src/bb-modules/Example/Api/Admin.php
new file mode 100644
index 000000000..acbf56ed6
--- /dev/null
+++ b/src/bb-modules/Example/Api/Admin.php
@@ -0,0 +1,42 @@
+di['events_manager']->fire(array('event'=>'onAfterClientCalledExampleModule', 'params'=>array('key'=>'value')));
+
+ // Log message
+ $this->di['logger']->info('Log message to log file');
+
+ $systemService = $this->di['mod_service']('System');
+ $clientService = $this->di['mod_service']('Client');
+
+ $type = isset($data['type']) ? $data['type'] : 'info';
+
+ return array(
+ 'data' => $data,
+ 'version' => $systemService->getVersion(),
+ 'profile' => $clientService->toApiArray($this->di['loggedin_client']),
+ 'messages' => $systemService->getMessages($type)
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Example/Api/Guest.php b/src/bb-modules/Example/Api/Guest.php
new file mode 100644
index 000000000..970ff0092
--- /dev/null
+++ b/src/bb-modules/Example/Api/Guest.php
@@ -0,0 +1,77 @@
+di['tools']->file_get_contents(BB_PATH_MODS . '/Example/README.md');
+ return $readme;
+ }
+
+ /**
+ * Get Top Songs from iTunes Store
+ * @param int $limit - define songs limit
+ */
+ public function top_songs($data)
+ {
+ $limit = isset($data['limit']) ? $data['limit'] : 10;
+ $feed = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=$limit/xml";
+ $top_songs = $this->di['tools']->file_get_contents($feed);
+ $xml = simplexml_load_string($top_songs);
+ $array = array();
+ $this->_convertXmlObjToArr($xml, $array);
+ return $array;
+ }
+
+ private function _convertXmlObjToArr($obj, &$arr)
+ {
+ $children = $obj->children();
+ foreach ($children as $elementName => $node)
+ {
+ $nextIdx = count($arr);
+ $arr[$nextIdx] = array();
+ $arr[$nextIdx]['_name'] = strtolower((string)$elementName);
+ $arr[$nextIdx]['_attributes'] = array();
+ $attributes = $node->attributes();
+ foreach ($attributes as $attributeName => $attributeValue)
+ {
+ $attribName = strtolower(trim((string)$attributeName));
+ $attribVal = trim((string)$attributeValue);
+ $arr[$nextIdx]['_attributes'][$attribName] = $attribVal;
+ }
+ $text = (string)$node;
+ $text = trim($text);
+ if (strlen($text) > 0)
+ {
+ $arr[$nextIdx]['_text'] = $text;
+ }
+ $arr[$nextIdx]['_children'] = array();
+ $this->_convertXmlObjToArr($node, $arr[$nextIdx]['_children']);
+ }
+ return;
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Example/Controller/Admin.php b/src/bb-modules/Example/Controller/Admin.php
new file mode 100644
index 000000000..970c46474
--- /dev/null
+++ b/src/bb-modules/Example/Controller/Admin.php
@@ -0,0 +1,126 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ /**
+ * This method registers menu items in admin area navigation block
+ * This navigation is cached in bb-data/cache/{hash}. To see changes please
+ * remove the file
+ *
+ * @return array
+ */
+ public function fetchNavigation()
+ {
+ return array(
+ 'group' => array(
+ 'index' => 1500, // menu sort order
+ 'location' => 'example', // menu group identificator for subitems
+ 'label' => 'Example module', // menu group title
+ 'class' => 'example', // used for css styling menu item
+ ),
+ 'subpages'=> array(
+ array(
+ 'location' => 'example', // place this module in extensions group
+ 'label' => 'Example module submenu',
+ 'index' => 1500,
+ 'uri' => $this->di['url']->adminLink('example'),
+ 'class' => '',
+ ),
+ ),
+ );
+ }
+
+ /**
+ * Methods maps admin areas urls to corresponding methods
+ * Always use your module prefix to avoid conflicts with other modules
+ * in future
+ *
+ *
+ * @example $app->get('/example/test', 'get_test', null, get_class($this)); // calls get_test method on this class
+ * @example $app->get('/example/:id', 'get_index', array('id'=>'[0-9]+'), get_class($this));
+ * @param Box_App $app
+ */
+ public function register(\Box_App &$app)
+ {
+ $app->get('/example', 'get_index', array(), get_class($this));
+ $app->get('/example/test', 'get_test', array(), get_class($this));
+ $app->get('/example/user/:id', 'get_user', array('id'=>'[0-9]+'), get_class($this));
+ $app->get('/example/api', 'get_api', array(), get_class($this));
+ }
+
+ public function get_index(\Box_App $app)
+ {
+ // always call this method to validate if admin is logged in
+ $api = $app->getApiAdmin();
+ return $app->render('mod_example_index');
+ }
+
+ public function get_test(\Box_App $app)
+ {
+ // always call this method to validate if admin is logged in
+ $api = $app->getApiAdmin();
+
+ $params = array();
+ $params['youparamname'] = 'yourparamvalue';
+
+ return $app->render('mod_example_index', $params);
+ }
+
+ public function get_user(\Box_App $app, $id)
+ {
+ // always call this method to validate if admin is logged in
+ $api = $app->getApiAdmin();
+
+ $params = array();
+ $params['userid'] = $id;
+ return $app->render('mod_example_index', $params);
+ }
+
+ public function get_api(\Box_App $app, $id)
+ {
+ // always call this method to validate if admin is logged in
+ $api = $app->getApiAdmin();
+ $list_from_controller = $api->example_get_something();
+
+ $params = array();
+ $params['api_example'] = true;
+ $params['list_from_controller'] = $list_from_controller;
+
+ return $app->render('mod_example_index', $params);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Example/Controller/Client.php b/src/bb-modules/Example/Controller/Client.php
new file mode 100644
index 000000000..891a0858d
--- /dev/null
+++ b/src/bb-modules/Example/Controller/Client.php
@@ -0,0 +1,65 @@
+di = $di;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDi()
+ {
+ return $this->di;
+ }
+
+ /**
+ * Methods maps client areas urls to corresponding methods
+ * Always use your module prefix to avoid conflicts with other modules
+ * in future
+ *
+ * @param Box_App $app - returned by reference
+ */
+ public function register(\Box_App &$app)
+ {
+ $app->get('/example', 'get_index', array(), get_class($this));
+ $app->get('/example/protected', 'get_protected', array(), get_class($this));
+ }
+
+ public function get_index(\Box_App $app)
+ {
+ $api = $app->getApiGuest();
+ return $app->render('mod_example_index');
+ }
+
+ public function get_protected(\Box_App $app)
+ {
+ // call $app->getApiClient() method to validate if client is logged in
+ $api = $app->getApiClient();
+ return $app->render('mod_example_index', array('show_protected'=>true));
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Example/README.md b/src/bb-modules/Example/README.md
new file mode 100644
index 000000000..2606574df
--- /dev/null
+++ b/src/bb-modules/Example/README.md
@@ -0,0 +1,38 @@
+# Example extension readme file
+
+Module purpose is to provide a starting point for developer to get started
+creating his own BoxBilling module.
+
+Explore the files and comments in the code to better understand the structure
+of module. Contact Development helpdesk at www.boxbilling.com if you need more
+information.
+
+In general modules are used to extend BoxBilling basic functionality.
+
+All modules can access other modules via API or database
+
+More about extensions at https://extensions.boxbilling.com/article/getting-started
+
+# BoxBilling module requirements
+
+## Required
+
+* Folder must contain **manifest.json** file to describe itself
+
+## Optional
+
+* **README.md** - file for installation and getting started instructions
+* Folder **html_admin** - for admin area templates, to store custom *.phtml files
+* Folder **html_client** - for client area templates, to store custom *.phtml files
+###### Controller folder
+* **Admin.php** - if module has install/uninstall instructions or
+ admin area interface
+* **Client.php** - if module has client area interface
+###### Api folder
+* **Admin.php** - file for Admin API
+* **Client.php** - file for Client API
+* **Guest.php** - file for Guest API
+
+# Tips
+
+We recommend to host your extensions on public [github.com](http://github.com) repository
\ No newline at end of file
diff --git a/src/bb-modules/Example/Service.php b/src/bb-modules/Example/Service.php
new file mode 100644
index 000000000..dde6ff92b
--- /dev/null
+++ b/src/bb-modules/Example/Service.php
@@ -0,0 +1,238 @@
+di = $di;
+ }
+
+ /**
+ * Method to install module. In most cases you will provide your own
+ * database table or tables to store extension related data.
+ *
+ * If your extension is not very complicated then extension_meta
+ * database table might be enough.
+ *
+ * @return bool
+ * @throws Box_Exception
+ */
+ public function install()
+ {
+ // execute sql script if needed
+ $db = $this->di['db'];
+ $db->exec("SELECT NOW()");
+
+ //throw new \Box_Exception("Throw exception to terminate module installation process with a message", array(), 123);
+ return true;
+ }
+
+ /**
+ * Method to uninstall module.
+ *
+ * @return bool
+ * @throws Box_Exception
+ */
+ public function uninstall()
+ {
+ //throw new \Box_Exception("Throw exception to terminate module uninstallation process with a message", array(), 124);
+ return true;
+ }
+
+ /**
+ * Method to update module. When you release new version to
+ * extensions.boxbilling.com then this method will be called
+ * after new files are placed.
+ *
+ * @param array $manifest - information about new module version
+ * @return bool
+ * @throws Box_Exception
+ */
+ public function update($manifest)
+ {
+ //throw new \Box_Exception("Throw exception to terminate module update process with a message", array(), 125);
+ return true;
+ }
+
+ /**
+ * Method is used to create search query for paginated list.
+ * Usually there is one paginated list per module
+ *
+ * @param array $data
+ * @return array() = list of 2 parameters: array($sql, $params)
+ */
+ public function getSearchQuery($data)
+ {
+ $params = array();
+ $sql="SELECT meta_key, meta_value
+ FROM extension_meta
+ WHERE extension = 'example' ";
+
+ $client_id = isset($data['client_id']) ? $data['client_id'] : NULL;
+
+ if(NULL !== $client_id) {
+ $sql .= ' AND client_id = :client_id';
+ $params[':client_id'] = $client_id;
+ }
+
+ $sql .= ' ORDER BY created_at DESC';
+ return array($sql, $params);
+ }
+
+ /**
+ * Methods is a delegate for one database row.
+ *
+ * @param array $row - array representing one database row
+ * @param string $role - guest|client|admin who is calling this method
+ * @param bool $deep - true|false deep or light version of result to return to API
+ */
+ public function toApiArray($row, $role = 'guest', $deep = true)
+ {
+ return $row;
+ }
+
+ /**
+ * Example event hook. Any module can hook to any BoxBilling event and perform actions
+ *
+ * Make sure extension is enabled before testing this event.
+ *
+ * NOTE: IF you have BB_DEBUG mode set to TRUE then all events with params
+ * are logged to bb-data/log/hook_*.log file. Check this file to see what
+ * kind of parameters are passed to event.
+ *
+ * In this example we are going to count how many times client failed
+ * to enter correct login details
+ *
+ * @param Box_Event $event
+ * @return type
+ */
+ public function onEventClientLoginFailed(\Box_Event $event)
+ {
+ //getting Dependency Injector
+ $di = $event->getDi();
+
+ //@note almost in all cases you will need Admin API
+ $api = $di['api_admin'];
+
+ //sometimes you may need guest API
+ //$api_guest = $di['api_guest'];
+ $params = $event->getParameters();
+
+ //@note To debug parameters by throw an exception
+ //throw new Exception(print_r($params, 1));
+
+ // Use RedBean ORM in any place of BoxBilling where API call is not enough
+ // First we need to find if we already have a counter for this IP
+ // We will use extension_meta table to store this data.
+ $values = array(
+ 'ext' => 'example',
+ 'rel_type' => 'ip',
+ 'rel_id' => $params['ip'],
+ 'meta_key' => 'counter',
+ );
+ $meta = $di['db']->findOne('extension_meta', 'extension = :ext AND rel_type = :rel_type AND rel_id = :rel_id AND meta_key = :meta_key', $values);
+ if(!$meta) {
+ $meta = $di['db']->dispense('extension_meta');
+ //$count->client_id = null; // client id is not known in this situation
+ $meta->extension = 'mod_example';
+ $meta->rel_type = 'ip';
+ $meta->rel_id = $params['ip'];
+ $meta->meta_key = 'counter';
+ $meta->created_at = date('c');
+ }
+ $meta->meta_value = $meta->meta_value + 1;
+ $meta->updated_at = date('c');
+ $di['db']->store($meta);
+
+ // Now we can perform task depending on how many times wrong details were entered
+
+ // We can log event if it repeats for 2 time
+ if($meta->meta_value > 2) {
+ $api->activity_log(array('m'=>'Client failed to enter correct login details '.$meta->meta_value.' time(s)'));
+ }
+
+ // if client gets funky, we block him
+ if($meta->meta_value > 30) {
+ throw new \Exception('You have failed to login too many times. Contact support.');
+ }
+ }
+
+ /**
+ * This event hook is registered in example module client API call
+ * @param Box_Event $event
+ */
+ public static function onAfterClientCalledExampleModule(\Box_Event $event)
+ {
+ //error_log('Called event from example module');
+
+ $di = $event->getDi();
+ $params = $event->getParameters();
+
+ $meta = $di['db']->dispense('extension_meta');
+ $meta->extension = 'mod_example';
+ $meta->meta_key = 'event_params';
+ $meta->meta_value = json_encode($params);
+ $meta->created_at = date('c');
+ $meta->updated_at = date('c');
+ $di['db']->store($meta);
+ }
+
+ /**
+ * Example event hook for public ticket and set event return value
+ * @param Box_Event $event
+ */
+ public static function onBeforeGuestPublicTicketOpen(\Box_Event $event)
+ {
+ $data = $event->getParameters();
+ $data['status'] = 'closed';
+ $data['subject'] = 'Altered subject';
+ $data['message'] = 'Altered text';
+ $event->setReturnValue($data);
+ }
+
+ /**
+ * Example email sending
+ * @param Box_Event $event
+ */
+ public static function onAfterClientOrderCreate(\Box_Event $event)
+ {
+ $di = $event->getDi();
+ $api = $di['api_admin'];
+ $params = $event->getParameters();
+
+ $email = array();
+ $email['to_client'] = $params['client_id'];
+ $email['code'] = 'mod_example_email'; //@see bb-modules/mod_example/html_email/mod_example_email.phtml
+
+ // these parameters are available in email template
+ $email['order'] = $api->order_get(array('id'=>$params['id']));
+ $email['other'] = 'any other value';
+
+ $api->email_template_send($email);
+ }
+}
\ No newline at end of file
diff --git a/src/bb-modules/Example/html_admin/mod_example_index.phtml b/src/bb-modules/Example/html_admin/mod_example_index.phtml
new file mode 100644
index 000000000..66c5b8b58
--- /dev/null
+++ b/src/bb-modules/Example/html_admin/mod_example_index.phtml
@@ -0,0 +1,76 @@
+{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
+
+{% block meta_title %}{% trans 'Example module' %}{% endblock %}
+
+{% set active_menu = 'example' %}
+
+{% block content %}
+
+
+
+
{% trans 'Example module title' %}
+
+
+
+
{% trans 'This is an example extension content' %}
+
+
\ No newline at end of file
diff --git a/src/bb-modules/Filemanager/html_admin/mod_filemanager_image.phtml b/src/bb-modules/Filemanager/html_admin/mod_filemanager_image.phtml
new file mode 100644
index 000000000..3d2dd1750
--- /dev/null
+++ b/src/bb-modules/Filemanager/html_admin/mod_filemanager_image.phtml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ {{ info.basename }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/bb-modules/Filemanager/html_admin/mod_filemanager_index.phtml b/src/bb-modules/Filemanager/html_admin/mod_filemanager_index.phtml
new file mode 100644
index 000000000..8283c92bc
--- /dev/null
+++ b/src/bb-modules/Filemanager/html_admin/mod_filemanager_index.phtml
@@ -0,0 +1,9 @@
+{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
+{% import "macro_functions.phtml" as mf %}
+{% block meta_title %}Filemanager{% endblock %}
+{% set active_menu = 'system' %}
+{% set hide_menu = '1' %}
+
+{% block content_wide %}
+
+{% endblock %}
diff --git a/src/bb-modules/Filemanager/manifest.json b/src/bb-modules/Filemanager/manifest.json
new file mode 100644
index 000000000..1ae82f02c
--- /dev/null
+++ b/src/bb-modules/Filemanager/manifest.json
@@ -0,0 +1,7 @@
+{
+ "id": "filemanager",
+ "type": "mod",
+ "name": "File manager",
+ "description": "BoxBilling core module",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/src/bb-modules/Filemanager/src/ace/ace-uncompressed.js b/src/bb-modules/Filemanager/src/ace/ace-uncompressed.js
new file mode 100644
index 000000000..ccdb165e9
--- /dev/null
+++ b/src/bb-modules/Filemanager/src/ace/ace-uncompressed.js
@@ -0,0 +1,17616 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**
+ * Define a module along with a payload
+ * @param module a name for the payload
+ * @param payload a function to call with (require, exports, module) params
+ */
+
+(function() {
+
+var global = (function() {
+ return this;
+})();
+
+// if we find an existing require function use it.
+if (global.require && global.define) {
+ require.packaged = true;
+ return;
+}
+
+var _define = function(module, deps, payload) {
+ if (typeof module !== 'string') {
+ if (_define.original)
+ _define.original.apply(window, arguments);
+ else {
+ console.error('dropping module because define wasn\'t a string.');
+ console.trace();
+ }
+ return;
+ }
+
+ if (arguments.length == 2)
+ payload = deps;
+
+ if (!define.modules)
+ define.modules = {};
+
+ define.modules[module] = payload;
+};
+if (global.define)
+ _define.original = global.define;
+
+global.define = _define;
+
+
+/**
+ * Get at functionality define()ed using the function above
+ */
+var _require = function(module, callback) {
+ if (Object.prototype.toString.call(module) === "[object Array]") {
+ var params = [];
+ for (var i = 0, l = module.length; i < l; ++i) {
+ var dep = lookup(module[i]);
+ if (!dep && _require.original)
+ return _require.original.apply(window, arguments);
+ params.push(dep);
+ }
+ if (callback) {
+ callback.apply(null, params);
+ }
+ }
+ else if (typeof module === 'string') {
+ var payload = lookup(module);
+ if (!payload && _require.original)
+ return _require.original.apply(window, arguments);
+
+ if (callback) {
+ callback();
+ }
+
+ return payload;
+ }
+ else {
+ if (_require.original)
+ return _require.original.apply(window, arguments);
+ }
+};
+
+if (global.require)
+ _require.original = global.require;
+
+global.require = _require;
+require.packaged = true;
+
+/**
+ * Internal function to lookup moduleNames and resolve them by calling the
+ * definition function if needed.
+ */
+var lookup = function(moduleName) {
+ var module = define.modules[moduleName];
+ if (module == null) {
+ console.error('Missing module: ' + moduleName);
+ return null;
+ }
+
+ if (typeof module === 'function') {
+ var exports = {};
+ module(require, exports, { id: moduleName, uri: '' });
+ // cache the resulting module object for next time
+ define.modules[moduleName] = exports;
+ return exports;
+ }
+
+ return module;
+};
+
+})();// vim:set ts=4 sts=4 sw=4 st:
+// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
+// -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
+// -- dantman Daniel Friesen Copyright(C) 2010 XXX No License Specified
+// -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
+// -- Irakli Gozalishvili Copyright (C) 2010 MIT License
+
+/*!
+ Copyright (c) 2009, 280 North Inc. http://280north.com/
+ MIT License. http://github.com/280north/narwhal/blob/master/README.md
+*/
+
+define('pilot/fixoldbrowsers', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+/**
+ * Brings an environment as close to ECMAScript 5 compliance
+ * as is possible with the facilities of erstwhile engines.
+ *
+ * ES5 Draft
+ * http://www.ecma-international.org/publications/files/drafts/tc39-2009-050.pdf
+ *
+ * NOTE: this is a draft, and as such, the URL is subject to change. If the
+ * link is broken, check in the parent directory for the latest TC39 PDF.
+ * http://www.ecma-international.org/publications/files/drafts/
+ *
+ * Previous ES5 Draft
+ * http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
+ * This is a broken link to the previous draft of ES5 on which most of the
+ * numbered specification references and quotes herein were taken. Updating
+ * these references and quotes to reflect the new document would be a welcome
+ * volunteer project.
+ *
+ * @module
+ */
+
+/*whatsupdoc*/
+
+//
+// Function
+// ========
+//
+
+// ES-5 15.3.4.5
+// http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
+
+if (!Function.prototype.bind) {
+ var slice = Array.prototype.slice;
+ Function.prototype.bind = function bind(that) { // .length is 1
+ // 1. Let Target be the this value.
+ var target = this;
+ // 2. If IsCallable(Target) is false, throw a TypeError exception.
+ // XXX this gets pretty close, for all intents and purposes, letting
+ // some duck-types slide
+ if (typeof target.apply !== "function" || typeof target.call !== "function")
+ return new TypeError();
+ // 3. Let A be a new (possibly empty) internal list of all of the
+ // argument values provided after thisArg (arg1, arg2 etc), in order.
+ var args = slice.call(arguments);
+ // 4. Let F be a new native ECMAScript object.
+ // 9. Set the [[Prototype]] internal property of F to the standard
+ // built-in Function prototype object as specified in 15.3.3.1.
+ // 10. Set the [[Call]] internal property of F as described in
+ // 15.3.4.5.1.
+ // 11. Set the [[Construct]] internal property of F as described in
+ // 15.3.4.5.2.
+ // 12. Set the [[HasInstance]] internal property of F as described in
+ // 15.3.4.5.3.
+ // 13. The [[Scope]] internal property of F is unused and need not
+ // exist.
+ var bound = function bound() {
+
+ if (this instanceof bound) {
+ // 15.3.4.5.2 [[Construct]]
+ // When the [[Construct]] internal method of a function object,
+ // F that was created using the bind function is called with a
+ // list of arguments ExtraArgs the following steps are taken:
+ // 1. Let target be the value of F's [[TargetFunction]]
+ // internal property.
+ // 2. If target has no [[Construct]] internal method, a
+ // TypeError exception is thrown.
+ // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
+ // property.
+ // 4. Let args be a new list containing the same values as the
+ // list boundArgs in the same order followed by the same
+ // values as the list ExtraArgs in the same order.
+
+ var self = Object.create(target.prototype);
+ target.apply(self, args.concat(slice.call(arguments)));
+ return self;
+
+ } else {
+ // 15.3.4.5.1 [[Call]]
+ // When the [[Call]] internal method of a function object, F,
+ // which was created using the bind function is called with a
+ // this value and a list of arguments ExtraArgs the following
+ // steps are taken:
+ // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
+ // property.
+ // 2. Let boundThis be the value of F's [[BoundThis]] internal
+ // property.
+ // 3. Let target be the value of F's [[TargetFunction]] internal
+ // property.
+ // 4. Let args be a new list containing the same values as the list
+ // boundArgs in the same order followed by the same values as
+ // the list ExtraArgs in the same order. 5. Return the
+ // result of calling the [[Call]] internal method of target
+ // providing boundThis as the this value and providing args
+ // as the arguments.
+
+ // equiv: target.call(this, ...boundArgs, ...args)
+ return target.call.apply(
+ target,
+ args.concat(slice.call(arguments))
+ );
+
+ }
+
+ };
+ bound.length = (
+ // 14. If the [[Class]] internal property of Target is "Function", then
+ typeof target === "function" ?
+ // a. Let L be the length property of Target minus the length of A.
+ // b. Set the length own property of F to either 0 or L, whichever is larger.
+ Math.max(target.length - args.length, 0) :
+ // 15. Else set the length own property of F to 0.
+ 0
+ )
+ // 16. The length own property of F is given attributes as specified in
+ // 15.3.5.1.
+ // TODO
+ // 17. Set the [[Extensible]] internal property of F to true.
+ // TODO
+ // 18. Call the [[DefineOwnProperty]] internal method of F with
+ // arguments "caller", PropertyDescriptor {[[Value]]: null,
+ // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
+ // false}, and false.
+ // TODO
+ // 19. Call the [[DefineOwnProperty]] internal method of F with
+ // arguments "arguments", PropertyDescriptor {[[Value]]: null,
+ // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
+ // false}, and false.
+ // TODO
+ // NOTE Function objects created using Function.prototype.bind do not
+ // have a prototype property.
+ // XXX can't delete it in pure-js.
+ return bound;
+ };
+}
+
+// Shortcut to an often accessed properties, in order to avoid multiple
+// dereference that costs universally.
+// _Please note: Shortcuts are defined after `Function.prototype.bind` as we
+// us it in defining shortcuts.
+var call = Function.prototype.call;
+var prototypeOfArray = Array.prototype;
+var prototypeOfObject = Object.prototype;
+var owns = call.bind(prototypeOfObject.hasOwnProperty);
+
+var defineGetter, defineSetter, lookupGetter, lookupSetter, supportsAccessors;
+// If JS engine supports accessors creating shortcuts.
+if ((supportsAccessors = owns(prototypeOfObject, '__defineGetter__'))) {
+ defineGetter = call.bind(prototypeOfObject.__defineGetter__);
+ defineSetter = call.bind(prototypeOfObject.__defineSetter__);
+ lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
+ lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
+}
+
+
+//
+// Array
+// =====
+//
+
+// ES5 15.4.3.2
+if (!Array.isArray) {
+ Array.isArray = function isArray(obj) {
+ return Object.prototype.toString.call(obj) === "[object Array]";
+ };
+}
+
+// ES5 15.4.4.18
+if (!Array.prototype.forEach) {
+ Array.prototype.forEach = function forEach(block, thisObject) {
+ var len = +this.length;
+ for (var i = 0; i < len; i++) {
+ if (i in this) {
+ block.call(thisObject, this[i], i, this);
+ }
+ }
+ };
+}
+
+// ES5 15.4.4.19
+// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
+if (!Array.prototype.map) {
+ Array.prototype.map = function map(fun /*, thisp*/) {
+ var len = +this.length;
+ if (typeof fun !== "function")
+ throw new TypeError();
+
+ var res = new Array(len);
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++) {
+ if (i in this)
+ res[i] = fun.call(thisp, this[i], i, this);
+ }
+
+ return res;
+ };
+}
+
+// ES5 15.4.4.20
+if (!Array.prototype.filter) {
+ Array.prototype.filter = function filter(block /*, thisp */) {
+ var values = [];
+ var thisp = arguments[1];
+ for (var i = 0; i < this.length; i++)
+ if (block.call(thisp, this[i]))
+ values.push(this[i]);
+ return values;
+ };
+}
+
+// ES5 15.4.4.16
+if (!Array.prototype.every) {
+ Array.prototype.every = function every(block /*, thisp */) {
+ var thisp = arguments[1];
+ for (var i = 0; i < this.length; i++)
+ if (!block.call(thisp, this[i]))
+ return false;
+ return true;
+ };
+}
+
+// ES5 15.4.4.17
+if (!Array.prototype.some) {
+ Array.prototype.some = function some(block /*, thisp */) {
+ var thisp = arguments[1];
+ for (var i = 0; i < this.length; i++)
+ if (block.call(thisp, this[i]))
+ return true;
+ return false;
+ };
+}
+
+// ES5 15.4.4.21
+// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
+if (!Array.prototype.reduce) {
+ Array.prototype.reduce = function reduce(fun /*, initial*/) {
+ var len = +this.length;
+ if (typeof fun !== "function")
+ throw new TypeError();
+
+ // no value to return if no initial value and an empty array
+ if (len === 0 && arguments.length === 1)
+ throw new TypeError();
+
+ var i = 0;
+ if (arguments.length >= 2) {
+ var rv = arguments[1];
+ } else {
+ do {
+ if (i in this) {
+ rv = this[i++];
+ break;
+ }
+
+ // if array contains no values, no initial value to return
+ if (++i >= len)
+ throw new TypeError();
+ } while (true);
+ }
+
+ for (; i < len; i++) {
+ if (i in this)
+ rv = fun.call(null, rv, this[i], i, this);
+ }
+
+ return rv;
+ };
+}
+
+// ES5 15.4.4.22
+// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
+if (!Array.prototype.reduceRight) {
+ Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
+ var len = +this.length;
+ if (typeof fun !== "function")
+ throw new TypeError();
+
+ // no value to return if no initial value, empty array
+ if (len === 0 && arguments.length === 1)
+ throw new TypeError();
+
+ var i = len - 1;
+ if (arguments.length >= 2) {
+ var rv = arguments[1];
+ } else {
+ do {
+ if (i in this) {
+ rv = this[i--];
+ break;
+ }
+
+ // if array contains no values, no initial value to return
+ if (--i < 0)
+ throw new TypeError();
+ } while (true);
+ }
+
+ for (; i >= 0; i--) {
+ if (i in this)
+ rv = fun.call(null, rv, this[i], i, this);
+ }
+
+ return rv;
+ };
+}
+
+// ES5 15.4.4.14
+if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function indexOf(value /*, fromIndex */ ) {
+ var length = this.length;
+ if (!length)
+ return -1;
+ var i = arguments[1] || 0;
+ if (i >= length)
+ return -1;
+ if (i < 0)
+ i += length;
+ for (; i < length; i++) {
+ if (!owns(this, i))
+ continue;
+ if (value === this[i])
+ return i;
+ }
+ return -1;
+ };
+}
+
+// ES5 15.4.4.15
+if (!Array.prototype.lastIndexOf) {
+ Array.prototype.lastIndexOf = function lastIndexOf(value /*, fromIndex */) {
+ var length = this.length;
+ if (!length)
+ return -1;
+ var i = arguments[1] || length;
+ if (i < 0)
+ i += length;
+ i = Math.min(i, length - 1);
+ for (; i >= 0; i--) {
+ if (!owns(this, i))
+ continue;
+ if (value === this[i])
+ return i;
+ }
+ return -1;
+ };
+}
+
+//
+// Object
+// ======
+//
+
+// ES5 15.2.3.2
+if (!Object.getPrototypeOf) {
+ // https://github.com/kriskowal/es5-shim/issues#issue/2
+ // http://ejohn.org/blog/objectgetprototypeof/
+ // recommended by fschaefer on github
+ Object.getPrototypeOf = function getPrototypeOf(object) {
+ return object.__proto__ || object.constructor.prototype;
+ // or undefined if not available in this engine
+ };
+}
+
+// ES5 15.2.3.3
+if (!Object.getOwnPropertyDescriptor) {
+ var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
+ "non-object: ";
+ Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
+ if ((typeof object !== "object" && typeof object !== "function") || object === null)
+ throw new TypeError(ERR_NON_OBJECT + object);
+ // If object does not owns property return undefined immediately.
+ if (!owns(object, property))
+ return undefined;
+
+ var despriptor, getter, setter;
+
+ // If object has a property then it's for sure both `enumerable` and
+ // `configurable`.
+ despriptor = { enumerable: true, configurable: true };
+
+ // If JS engine supports accessor properties then property may be a
+ // getter or setter.
+ if (supportsAccessors) {
+ // Unfortunately `__lookupGetter__` will return a getter even
+ // if object has own non getter property along with a same named
+ // inherited getter. To avoid misbehavior we temporary remove
+ // `__proto__` so that `__lookupGetter__` will return getter only
+ // if it's owned by an object.
+ var prototype = object.__proto__;
+ object.__proto__ = prototypeOfObject;
+
+ var getter = lookupGetter(object, property);
+ var setter = lookupSetter(object, property);
+
+ // Once we have getter and setter we can put values back.
+ object.__proto__ = prototype;
+
+ if (getter || setter) {
+ if (getter) descriptor.get = getter;
+ if (setter) descriptor.set = setter;
+
+ // If it was accessor property we're done and return here
+ // in order to avoid adding `value` to the descriptor.
+ return descriptor;
+ }
+ }
+
+ // If we got this far we know that object has an own property that is
+ // not an accessor so we set it as a value and return descriptor.
+ descriptor.value = object[property];
+ return descriptor;
+ };
+}
+
+// ES5 15.2.3.4
+if (!Object.getOwnPropertyNames) {
+ Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
+ return Object.keys(object);
+ };
+}
+
+// ES5 15.2.3.5
+if (!Object.create) {
+ Object.create = function create(prototype, properties) {
+ var object;
+ if (prototype === null) {
+ object = { "__proto__": null };
+ } else {
+ if (typeof prototype !== "object")
+ throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
+ var Type = function () {};
+ Type.prototype = prototype;
+ object = new Type();
+ // IE has no built-in implementation of `Object.getPrototypeOf`
+ // neither `__proto__`, but this manually setting `__proto__` will
+ // guarantee that `Object.getPrototypeOf` will work as expected with
+ // objects created using `Object.create`
+ object.__proto__ = prototype;
+ }
+ if (typeof properties !== "undefined")
+ Object.defineProperties(object, properties);
+ return object;
+ };
+}
+
+// ES5 15.2.3.6
+if (!Object.defineProperty) {
+ var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
+ var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
+ var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
+ "on this javascript engine";
+
+ Object.defineProperty = function defineProperty(object, property, descriptor) {
+ if (typeof object !== "object" && typeof object !== "function")
+ throw new TypeError(ERR_NON_OBJECT_TARGET + object);
+ if (typeof object !== "object" || object === null)
+ throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
+
+ // If it's a data property.
+ if (owns(descriptor, "value")) {
+ // fail silently if "writable", "enumerable", or "configurable"
+ // are requested but not supported
+ /*
+ // alternate approach:
+ if ( // can't implement these features; allow false but not true
+ !(owns(descriptor, "writable") ? descriptor.writable : true) ||
+ !(owns(descriptor, "enumerable") ? descriptor.enumerable : true) ||
+ !(owns(descriptor, "configurable") ? descriptor.configurable : true)
+ )
+ throw new RangeError(
+ "This implementation of Object.defineProperty does not " +
+ "support configurable, enumerable, or writable."
+ );
+ */
+
+ if (supportsAccessors && (lookupGetter(object, property) ||
+ lookupSetter(object, property)))
+ {
+ // As accessors are supported only on engines implementing
+ // `__proto__` we can safely override `__proto__` while defining
+ // a property to make sure that we don't hit an inherited
+ // accessor.
+ var prototype = object.__proto__;
+ object.__proto__ = prototypeOfObject;
+ // Deleting a property anyway since getter / setter may be
+ // defined on object itself.
+ delete object[property];
+ object[property] = descriptor.value;
+ // Setting original `__proto__` back now.
+ object.prototype;
+ } else {
+ object[property] = descriptor.value;
+ }
+ } else {
+ if (!supportsAccessors)
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
+ // If we got that far then getters and setters can be defined !!
+ if (owns(descriptor, "get"))
+ defineGetter(object, property, descriptor.get);
+ if (owns(descriptor, "set"))
+ defineSetter(object, property, descriptor.set);
+ }
+
+ return object;
+ };
+}
+
+// ES5 15.2.3.7
+if (!Object.defineProperties) {
+ Object.defineProperties = function defineProperties(object, properties) {
+ for (var property in properties) {
+ if (owns(properties, property))
+ Object.defineProperty(object, property, properties[property]);
+ }
+ return object;
+ };
+}
+
+// ES5 15.2.3.8
+if (!Object.seal) {
+ Object.seal = function seal(object) {
+ // this is misleading and breaks feature-detection, but
+ // allows "securable" code to "gracefully" degrade to working
+ // but insecure code.
+ return object;
+ };
+}
+
+// ES5 15.2.3.9
+if (!Object.freeze) {
+ Object.freeze = function freeze(object) {
+ // this is misleading and breaks feature-detection, but
+ // allows "securable" code to "gracefully" degrade to working
+ // but insecure code.
+ return object;
+ };
+}
+
+// detect a Rhino bug and patch it
+try {
+ Object.freeze(function () {});
+} catch (exception) {
+ Object.freeze = (function freeze(freezeObject) {
+ return function freeze(object) {
+ if (typeof object === "function") {
+ return object;
+ } else {
+ return freezeObject(object);
+ }
+ };
+ })(Object.freeze);
+}
+
+// ES5 15.2.3.10
+if (!Object.preventExtensions) {
+ Object.preventExtensions = function preventExtensions(object) {
+ // this is misleading and breaks feature-detection, but
+ // allows "securable" code to "gracefully" degrade to working
+ // but insecure code.
+ return object;
+ };
+}
+
+// ES5 15.2.3.11
+if (!Object.isSealed) {
+ Object.isSealed = function isSealed(object) {
+ return false;
+ };
+}
+
+// ES5 15.2.3.12
+if (!Object.isFrozen) {
+ Object.isFrozen = function isFrozen(object) {
+ return false;
+ };
+}
+
+// ES5 15.2.3.13
+if (!Object.isExtensible) {
+ Object.isExtensible = function isExtensible(object) {
+ return true;
+ };
+}
+
+// ES5 15.2.3.14
+// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+if (!Object.keys) {
+
+ var hasDontEnumBug = true,
+ dontEnums = [
+ 'toString',
+ 'toLocaleString',
+ 'valueOf',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+ ],
+ dontEnumsLength = dontEnums.length;
+
+ for (var key in {"toString": null})
+ hasDontEnumBug = false;
+
+ Object.keys = function keys(object) {
+
+ if (
+ typeof object !== "object" && typeof object !== "function"
+ || object === null
+ )
+ throw new TypeError("Object.keys called on a non-object");
+
+ var keys = [];
+ for (var name in object) {
+ if (owns(object, name)) {
+ keys.push(name);
+ }
+ }
+
+ if (hasDontEnumBug) {
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
+ var dontEnum = dontEnums[i];
+ if (owns(object, dontEnum)) {
+ keys.push(dontEnum);
+ }
+ }
+ }
+
+ return keys;
+ };
+
+}
+
+//
+// Date
+// ====
+//
+
+// ES5 15.9.5.43
+// Format a Date object as a string according to a subset of the ISO-8601 standard.
+// Useful in Atom, among other things.
+if (!Date.prototype.toISOString) {
+ Date.prototype.toISOString = function toISOString() {
+ return (
+ this.getUTCFullYear() + "-" +
+ (this.getUTCMonth() + 1) + "-" +
+ this.getUTCDate() + "T" +
+ this.getUTCHours() + ":" +
+ this.getUTCMinutes() + ":" +
+ this.getUTCSeconds() + "Z"
+ );
+ }
+}
+
+// ES5 15.9.4.4
+if (!Date.now) {
+ Date.now = function now() {
+ return new Date().getTime();
+ };
+}
+
+// ES5 15.9.5.44
+if (!Date.prototype.toJSON) {
+ Date.prototype.toJSON = function toJSON(key) {
+ // This function provides a String representation of a Date object for
+ // use by JSON.stringify (15.12.3). When the toJSON method is called
+ // with argument key, the following steps are taken:
+
+ // 1. Let O be the result of calling ToObject, giving it the this
+ // value as its argument.
+ // 2. Let tv be ToPrimitive(O, hint Number).
+ // 3. If tv is a Number and is not finite, return null.
+ // XXX
+ // 4. Let toISO be the result of calling the [[Get]] internal method of
+ // O with argument "toISOString".
+ // 5. If IsCallable(toISO) is false, throw a TypeError exception.
+ if (typeof this.toISOString !== "function")
+ throw new TypeError();
+ // 6. Return the result of calling the [[Call]] internal method of
+ // toISO with O as the this value and an empty argument list.
+ return this.toISOString();
+
+ // NOTE 1 The argument is ignored.
+
+ // NOTE 2 The toJSON function is intentionally generic; it does not
+ // require that its this value be a Date object. Therefore, it can be
+ // transferred to other kinds of objects for use as a method. However,
+ // it does require that any such object have a toISOString method. An
+ // object is free to use the argument key to filter its
+ // stringification.
+ };
+}
+
+// 15.9.4.2 Date.parse (string)
+// 15.9.1.15 Date Time String Format
+// Date.parse
+// based on work shared by Daniel Friesen (dantman)
+// http://gist.github.com/303249
+if (isNaN(Date.parse("T00:00"))) {
+ // XXX global assignment won't work in embeddings that use
+ // an alternate object for the context.
+ Date = (function(NativeDate) {
+
+ // Date.length === 7
+ var Date = function(Y, M, D, h, m, s, ms) {
+ var length = arguments.length;
+ if (this instanceof NativeDate) {
+ var date = length === 1 && String(Y) === Y ? // isString(Y)
+ // We explicitly pass it through parse:
+ new NativeDate(Date.parse(Y)) :
+ // We have to manually make calls depending on argument
+ // length here
+ length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
+ length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
+ length >= 5 ? new NativeDate(Y, M, D, h, m) :
+ length >= 4 ? new NativeDate(Y, M, D, h) :
+ length >= 3 ? new NativeDate(Y, M, D) :
+ length >= 2 ? new NativeDate(Y, M) :
+ length >= 1 ? new NativeDate(Y) :
+ new NativeDate();
+ // Prevent mixups with unfixed Date object
+ date.constructor = Date;
+ return date;
+ }
+ return NativeDate.apply(this, arguments);
+ };
+
+ // 15.9.1.15 Date Time String Format
+ var isoDateExpression = new RegExp("^" +
+ "(?:" + // optional year-month-day
+ "(" + // year capture
+ "(?:[+-]\\d\\d)?" + // 15.9.1.15.1 Extended years
+ "\\d\\d\\d\\d" + // four-digit year
+ ")" +
+ "(?:-" + // optional month-day
+ "(\\d\\d)" + // month capture
+ "(?:-" + // optional day
+ "(\\d\\d)" + // day capture
+ ")?" +
+ ")?" +
+ ")?" +
+ "(?:T" + // hour:minute:second.subsecond
+ "(\\d\\d)" + // hour capture
+ ":(\\d\\d)" + // minute capture
+ "(?::" + // optional :second.subsecond
+ "(\\d\\d)" + // second capture
+ "(?:\\.(\\d\\d\\d))?" + // milisecond capture
+ ")?" +
+ ")?" +
+ "(?:" + // time zone
+ "Z|" + // UTC capture
+ "([+-])(\\d\\d):(\\d\\d)" + // timezone offset
+ // capture sign, hour, minute
+ ")?" +
+ "$");
+
+ // Copy any custom methods a 3rd party library may have added
+ for (var key in NativeDate)
+ Date[key] = NativeDate[key];
+
+ // Copy "native" methods explicitly; they may be non-enumerable
+ Date.now = NativeDate.now;
+ Date.UTC = NativeDate.UTC;
+ Date.prototype = NativeDate.prototype;
+ Date.prototype.constructor = Date;
+
+ // Upgrade Date.parse to handle the ISO dates we use
+ // TODO review specification to ascertain whether it is
+ // necessary to implement partial ISO date strings.
+ Date.parse = function parse(string) {
+ var match = isoDateExpression.exec(string);
+ if (match) {
+ match.shift(); // kill match[0], the full match
+ // recognize times without dates before normalizing the
+ // numeric values, for later use
+ var timeOnly = match[0] === undefined;
+ // parse numerics
+ for (var i = 0; i < 10; i++) {
+ // skip + or - for the timezone offset
+ if (i === 7)
+ continue;
+ // Note: parseInt would read 0-prefix numbers as
+ // octal. Number constructor or unary + work better
+ // here:
+ match[i] = +(match[i] || (i < 3 ? 1 : 0));
+ // match[1] is the month. Months are 0-11 in JavaScript
+ // Date objects, but 1-12 in ISO notation, so we
+ // decrement.
+ if (i === 1)
+ match[i]--;
+ }
+ // if no year-month-date is provided, return a milisecond
+ // quantity instead of a UTC date number value.
+ if (timeOnly)
+ return ((match[3] * 60 + match[4]) * 60 + match[5]) * 1000 + match[6];
+
+ // account for an explicit time zone offset if provided
+ var offset = (match[8] * 60 + match[9]) * 60 * 1000;
+ if (match[6] === "-")
+ offset = -offset;
+
+ return NativeDate.UTC.apply(this, match.slice(0, 7)) + offset;
+ }
+ return NativeDate.parse.apply(this, arguments);
+ };
+
+ return Date;
+ })(Date);
+}
+
+//
+// String
+// ======
+//
+
+// ES5 15.5.4.20
+if (!String.prototype.trim) {
+ // http://blog.stevenlevithan.com/archives/faster-trim-javascript
+ var trimBeginRegexp = /^\s\s*/;
+ var trimEndRegexp = /\s\s*$/;
+ String.prototype.trim = function trim() {
+ return String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, '');
+ };
+}
+
+});/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Kevin Dangoor (kdangoor@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/ace', ['require', 'exports', 'module' , 'pilot/index', 'pilot/fixoldbrowsers', 'pilot/plugin_manager', 'pilot/dom', 'pilot/event', 'ace/editor', 'ace/edit_session', 'ace/undomanager', 'ace/virtual_renderer', 'ace/theme/textmate', 'pilot/environment'], function(require, exports, module) {
+
+ require("pilot/index");
+ require("pilot/fixoldbrowsers");
+ var catalog = require("pilot/plugin_manager").catalog;
+ catalog.registerPlugins([ "pilot/index" ]);
+
+ var Dom = require("pilot/dom");
+ var Event = require("pilot/event");
+
+ var Editor = require("ace/editor").Editor;
+ var EditSession = require("ace/edit_session").EditSession;
+ var UndoManager = require("ace/undomanager").UndoManager;
+ var Renderer = require("ace/virtual_renderer").VirtualRenderer;
+
+ exports.edit = function(el) {
+ if (typeof(el) == "string") {
+ el = document.getElementById(el);
+ }
+
+ var doc = new EditSession(Dom.getInnerText(el));
+ doc.setUndoManager(new UndoManager());
+ el.innerHTML = '';
+
+ var editor = new Editor(new Renderer(el, require("ace/theme/textmate")));
+ editor.setSession(doc);
+
+ var env = require("pilot/environment").create();
+ catalog.startupPlugins({ env: env }).then(function() {
+ env.document = doc;
+ env.editor = editor;
+ editor.resize();
+ Event.addListener(window, "resize", function() {
+ editor.resize();
+ });
+ el.env = env;
+ });
+ // Store env on editor such that it can be accessed later on from
+ // the returned object.
+ editor.env = env;
+ return editor;
+ };
+});/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Kevin Dangoor (kdangoor@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/index', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/types/basic', 'pilot/types/command', 'pilot/types/settings', 'pilot/commands/settings', 'pilot/commands/basic', 'pilot/settings/canon', 'pilot/canon'], function(require, exports, module) {
+
+exports.startup = function(data, reason) {
+ require('pilot/fixoldbrowsers');
+
+ require('pilot/types/basic').startup(data, reason);
+ require('pilot/types/command').startup(data, reason);
+ require('pilot/types/settings').startup(data, reason);
+ require('pilot/commands/settings').startup(data, reason);
+ require('pilot/commands/basic').startup(data, reason);
+ // require('pilot/commands/history').startup(data, reason);
+ require('pilot/settings/canon').startup(data, reason);
+ require('pilot/canon').startup(data, reason);
+};
+
+exports.shutdown = function(data, reason) {
+ require('pilot/types/basic').shutdown(data, reason);
+ require('pilot/types/command').shutdown(data, reason);
+ require('pilot/types/settings').shutdown(data, reason);
+ require('pilot/commands/settings').shutdown(data, reason);
+ require('pilot/commands/basic').shutdown(data, reason);
+ // require('pilot/commands/history').shutdown(data, reason);
+ require('pilot/settings/canon').shutdown(data, reason);
+ require('pilot/canon').shutdown(data, reason);
+};
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Walker (jwalker@mozilla.com)
+ * Kevin Dangoor (kdangoor@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/types/basic', ['require', 'exports', 'module' , 'pilot/types'], function(require, exports, module) {
+
+var types = require("pilot/types");
+var Type = types.Type;
+var Conversion = types.Conversion;
+var Status = types.Status;
+
+/**
+ * These are the basic types that we accept. They are vaguely based on the
+ * Jetpack settings system (https://wiki.mozilla.org/Labs/Jetpack/JEP/24)
+ * although clearly more restricted.
+ *
+ *
In addition to these types, Jetpack also accepts range, member, password
+ * that we are thinking of adding.
+ *
+ *
This module probably should not be accessed directly, but instead used
+ * through types.js
+ */
+
+/**
+ * 'text' is the default if no type is given.
+ */
+var text = new Type();
+
+text.stringify = function(value) {
+ return value;
+};
+
+text.parse = function(value) {
+ if (typeof value != 'string') {
+ throw new Error('non-string passed to text.parse()');
+ }
+ return new Conversion(value);
+};
+
+text.name = 'text';
+
+/**
+ * We don't currently plan to distinguish between integers and floats
+ */
+var number = new Type();
+
+number.stringify = function(value) {
+ if (!value) {
+ return null;
+ }
+ return '' + value;
+};
+
+number.parse = function(value) {
+ if (typeof value != 'string') {
+ throw new Error('non-string passed to number.parse()');
+ }
+
+ if (value.replace(/\s/g, '').length === 0) {
+ return new Conversion(null, Status.INCOMPLETE, '');
+ }
+
+ var reply = new Conversion(parseInt(value, 10));
+ if (isNaN(reply.value)) {
+ reply.status = Status.INVALID;
+ reply.message = 'Can\'t convert "' + value + '" to a number.';
+ }
+
+ return reply;
+};
+
+number.decrement = function(value) {
+ return value - 1;
+};
+
+number.increment = function(value) {
+ return value + 1;
+};
+
+number.name = 'number';
+
+/**
+ * One of a known set of options
+ */
+function SelectionType(typeSpec) {
+ if (!Array.isArray(typeSpec.data) && typeof typeSpec.data !== 'function') {
+ throw new Error('instances of SelectionType need typeSpec.data to be an array or function that returns an array:' + JSON.stringify(typeSpec));
+ }
+ Object.keys(typeSpec).forEach(function(key) {
+ this[key] = typeSpec[key];
+ }, this);
+};
+
+SelectionType.prototype = new Type();
+
+SelectionType.prototype.stringify = function(value) {
+ return value;
+};
+
+SelectionType.prototype.parse = function(str) {
+ if (typeof str != 'string') {
+ throw new Error('non-string passed to parse()');
+ }
+ if (!this.data) {
+ throw new Error('Missing data on selection type extension.');
+ }
+ var data = (typeof(this.data) === 'function') ? this.data() : this.data;
+
+ // The matchedValue could be the boolean value false
+ var hasMatched = false;
+ var matchedValue;
+ var completions = [];
+ data.forEach(function(option) {
+ if (str == option) {
+ matchedValue = this.fromString(option);
+ hasMatched = true;
+ }
+ else if (option.indexOf(str) === 0) {
+ completions.push(this.fromString(option));
+ }
+ }, this);
+
+ if (hasMatched) {
+ return new Conversion(matchedValue);
+ }
+ else {
+ // This is something of a hack it basically allows us to tell the
+ // setting type to forget its last setting hack.
+ if (this.noMatch) {
+ this.noMatch();
+ }
+
+ if (completions.length > 0) {
+ var msg = 'Possibilities' +
+ (str.length === 0 ? '' : ' for \'' + str + '\'');
+ return new Conversion(null, Status.INCOMPLETE, msg, completions);
+ }
+ else {
+ var msg = 'Can\'t use \'' + str + '\'.';
+ return new Conversion(null, Status.INVALID, msg, completions);
+ }
+ }
+};
+
+SelectionType.prototype.fromString = function(str) {
+ return str;
+};
+
+SelectionType.prototype.decrement = function(value) {
+ var data = (typeof this.data === 'function') ? this.data() : this.data;
+ var index;
+ if (value == null) {
+ index = data.length - 1;
+ }
+ else {
+ var name = this.stringify(value);
+ var index = data.indexOf(name);
+ index = (index === 0 ? data.length - 1 : index - 1);
+ }
+ return this.fromString(data[index]);
+};
+
+SelectionType.prototype.increment = function(value) {
+ var data = (typeof this.data === 'function') ? this.data() : this.data;
+ var index;
+ if (value == null) {
+ index = 0;
+ }
+ else {
+ var name = this.stringify(value);
+ var index = data.indexOf(name);
+ index = (index === data.length - 1 ? 0 : index + 1);
+ }
+ return this.fromString(data[index]);
+};
+
+SelectionType.prototype.name = 'selection';
+
+/**
+ * SelectionType is a base class for other types
+ */
+exports.SelectionType = SelectionType;
+
+/**
+ * true/false values
+ */
+var bool = new SelectionType({
+ name: 'bool',
+ data: [ 'true', 'false' ],
+ stringify: function(value) {
+ return '' + value;
+ },
+ fromString: function(str) {
+ return str === 'true' ? true : false;
+ }
+});
+
+
+/**
+ * A we don't know right now, but hope to soon.
+ */
+function DeferredType(typeSpec) {
+ if (typeof typeSpec.defer !== 'function') {
+ throw new Error('Instances of DeferredType need typeSpec.defer to be a function that returns a type');
+ }
+ Object.keys(typeSpec).forEach(function(key) {
+ this[key] = typeSpec[key];
+ }, this);
+};
+
+DeferredType.prototype = new Type();
+
+DeferredType.prototype.stringify = function(value) {
+ return this.defer().stringify(value);
+};
+
+DeferredType.prototype.parse = function(value) {
+ return this.defer().parse(value);
+};
+
+DeferredType.prototype.decrement = function(value) {
+ var deferred = this.defer();
+ return (deferred.decrement ? deferred.decrement(value) : undefined);
+};
+
+DeferredType.prototype.increment = function(value) {
+ var deferred = this.defer();
+ return (deferred.increment ? deferred.increment(value) : undefined);
+};
+
+DeferredType.prototype.name = 'deferred';
+
+/**
+ * DeferredType is a base class for other types
+ */
+exports.DeferredType = DeferredType;
+
+
+/**
+ * A set of objects of the same type
+ */
+function ArrayType(typeSpec) {
+ if (typeSpec instanceof Type) {
+ this.subtype = typeSpec;
+ }
+ else if (typeof typeSpec === 'string') {
+ this.subtype = types.getType(typeSpec);
+ if (this.subtype == null) {
+ throw new Error('Unknown array subtype: ' + typeSpec);
+ }
+ }
+ else {
+ throw new Error('Can\' handle array subtype');
+ }
+};
+
+ArrayType.prototype = new Type();
+
+ArrayType.prototype.stringify = function(values) {
+ // TODO: Check for strings with spaces and add quotes
+ return values.join(' ');
+};
+
+ArrayType.prototype.parse = function(value) {
+ return this.defer().parse(value);
+};
+
+ArrayType.prototype.name = 'array';
+
+/**
+ * Registration and de-registration.
+ */
+var isStarted = false;
+exports.startup = function() {
+ if (isStarted) {
+ return;
+ }
+ isStarted = true;
+ types.registerType(text);
+ types.registerType(number);
+ types.registerType(bool);
+ types.registerType(SelectionType);
+ types.registerType(DeferredType);
+ types.registerType(ArrayType);
+};
+
+exports.shutdown = function() {
+ isStarted = false;
+ types.unregisterType(text);
+ types.unregisterType(number);
+ types.unregisterType(bool);
+ types.unregisterType(SelectionType);
+ types.unregisterType(DeferredType);
+ types.unregisterType(ArrayType);
+};
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Walker (jwalker@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/types', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+/**
+ * Some types can detect validity, that is to say they can distinguish between
+ * valid and invalid values.
+ * TODO: Change these constants to be numbers for more performance?
+ */
+var Status = {
+ /**
+ * The conversion process worked without any problem, and the value is
+ * valid. There are a number of failure states, so the best way to check
+ * for failure is (x !== Status.VALID)
+ */
+ VALID: {
+ toString: function() { return 'VALID'; },
+ valueOf: function() { return 0; }
+ },
+
+ /**
+ * A conversion process failed, however it was noted that the string
+ * provided to 'parse()' could be VALID by the addition of more characters,
+ * so the typing may not be actually incorrect yet, just unfinished.
+ * @see Status.INVALID
+ */
+ INCOMPLETE: {
+ toString: function() { return 'INCOMPLETE'; },
+ valueOf: function() { return 1; }
+ },
+
+ /**
+ * The conversion process did not work, the value should be null and a
+ * reason for failure should have been provided. In addition some completion
+ * values may be available.
+ * @see Status.INCOMPLETE
+ */
+ INVALID: {
+ toString: function() { return 'INVALID'; },
+ valueOf: function() { return 2; }
+ },
+
+ /**
+ * A combined status is the worser of the provided statuses
+ */
+ combine: function(statuses) {
+ var combined = Status.VALID;
+ for (var i = 0; i < statuses.length; i++) {
+ if (statuses[i].valueOf() > combined.valueOf()) {
+ combined = statuses[i];
+ }
+ }
+ return combined;
+ }
+};
+exports.Status = Status;
+
+/**
+ * The type.parse() method returns a Conversion to inform the user about not
+ * only the result of a Conversion but also about what went wrong.
+ * We could use an exception, and throw if the conversion failed, but that
+ * seems to violate the idea that exceptions should be exceptional. Typos are
+ * not. Also in order to store both a status and a message we'd still need
+ * some sort of exception type...
+ */
+function Conversion(value, status, message, predictions) {
+ /**
+ * The result of the conversion process. Will be null if status != VALID
+ */
+ this.value = value;
+
+ /**
+ * The status of the conversion.
+ * @see Status
+ */
+ this.status = status || Status.VALID;
+
+ /**
+ * A message to go with the conversion. This could be present for any status
+ * including VALID in the case where we want to note a warning for example.
+ * I18N: On the one hand this nasty and un-internationalized, however with
+ * a command line it is hard to know where to start.
+ */
+ this.message = message;
+
+ /**
+ * A array of strings which are the systems best guess at better inputs than
+ * the one presented.
+ * We generally expect there to be about 7 predictions (to match human list
+ * comprehension ability) however it is valid to provide up to about 20,
+ * or less. It is the job of the predictor to decide a smart cut-off.
+ * For example if there are 4 very good matches and 4 very poor ones,
+ * probably only the 4 very good matches should be presented.
+ */
+ this.predictions = predictions || [];
+}
+exports.Conversion = Conversion;
+
+/**
+ * Most of our types are 'static' e.g. there is only one type of 'text', however
+ * some types like 'selection' and 'deferred' are customizable. The basic
+ * Type type isn't useful, but does provide documentation about what types do.
+ */
+function Type() {
+};
+Type.prototype = {
+ /**
+ * Convert the given value to a string representation.
+ * Where possible, there should be round-tripping between values and their
+ * string representations.
+ */
+ stringify: function(value) { throw new Error("not implemented"); },
+
+ /**
+ * Convert the given str to an instance of this type.
+ * Where possible, there should be round-tripping between values and their
+ * string representations.
+ * @return Conversion
+ */
+ parse: function(str) { throw new Error("not implemented"); },
+
+ /**
+ * The plug-in system, and other things need to know what this type is
+ * called. The name alone is not enough to fully specify a type. Types like
+ * 'selection' and 'deferred' need extra data, however this function returns
+ * only the name, not the extra data.
+ *
In old bespin, equality was based on the name. This may turn out to be
+ * important in Ace too.
+ */
+ name: undefined,
+
+ /**
+ * If there is some concept of a higher value, return it,
+ * otherwise return undefined.
+ */
+ increment: function(value) {
+ return undefined;
+ },
+
+ /**
+ * If there is some concept of a lower value, return it,
+ * otherwise return undefined.
+ */
+ decrement: function(value) {
+ return undefined;
+ },
+
+ /**
+ * There is interesting information (like predictions) in a conversion of
+ * nothing, the output of this can sometimes be customized.
+ * @return Conversion
+ */
+ getDefault: function() {
+ return this.parse('');
+ }
+};
+exports.Type = Type;
+
+/**
+ * Private registry of types
+ * Invariant: types[name] = type.name
+ */
+var types = {};
+
+/**
+ * Add a new type to the list available to the system.
+ * You can pass 2 things to this function - either an instance of Type, in
+ * which case we return this instance when #getType() is called with a 'name'
+ * that matches type.name.
+ * Also you can pass in a constructor (i.e. function) in which case when
+ * #getType() is called with a 'name' that matches Type.prototype.name we will
+ * pass the typeSpec into this constructor. See #reconstituteType().
+ */
+exports.registerType = function(type) {
+ if (typeof type === 'object') {
+ if (type instanceof Type) {
+ if (!type.name) {
+ throw new Error('All registered types must have a name');
+ }
+ types[type.name] = type;
+ }
+ else {
+ throw new Error('Can\'t registerType using: ' + type);
+ }
+ }
+ else if (typeof type === 'function') {
+ if (!type.prototype.name) {
+ throw new Error('All registered types must have a name');
+ }
+ types[type.prototype.name] = type;
+ }
+ else {
+ throw new Error('Unknown type: ' + type);
+ }
+};
+
+exports.registerTypes = function registerTypes(types) {
+ Object.keys(types).forEach(function (name) {
+ var type = types[name];
+ type.name = name;
+ exports.registerType(type);
+ });
+};
+
+/**
+ * Remove a type from the list available to the system
+ */
+exports.deregisterType = function(type) {
+ delete types[type.name];
+};
+
+/**
+ * See description of #exports.registerType()
+ */
+function reconstituteType(name, typeSpec) {
+ if (name.substr(-2) === '[]') { // i.e. endsWith('[]')
+ var subtypeName = name.slice(0, -2);
+ return new types['array'](subtypeName);
+ }
+
+ var type = types[name];
+ if (typeof type === 'function') {
+ type = new type(typeSpec);
+ }
+ return type;
+}
+
+/**
+ * Find a type, previously registered using #registerType()
+ */
+exports.getType = function(typeSpec) {
+ if (typeof typeSpec === 'string') {
+ return reconstituteType(typeSpec);
+ }
+
+ if (typeof typeSpec === 'object') {
+ if (!typeSpec.name) {
+ throw new Error('Missing \'name\' member to typeSpec');
+ }
+ return reconstituteType(typeSpec.name, typeSpec);
+ }
+
+ throw new Error('Can\'t extract type from ' + typeSpec);
+};
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Walker (jwalker@mozilla.com)
+ * Kevin Dangoor (kdangoor@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/types/command', ['require', 'exports', 'module' , 'pilot/canon', 'pilot/types/basic', 'pilot/types'], function(require, exports, module) {
+
+var canon = require("pilot/canon");
+var SelectionType = require("pilot/types/basic").SelectionType;
+var types = require("pilot/types");
+
+
+/**
+ * Select from the available commands
+ */
+var command = new SelectionType({
+ name: 'command',
+ data: function() {
+ return canon.getCommandNames();
+ },
+ stringify: function(command) {
+ return command.name;
+ },
+ fromString: function(str) {
+ return canon.getCommand(str);
+ }
+});
+
+
+/**
+ * Registration and de-registration.
+ */
+exports.startup = function() {
+ types.registerType(command);
+};
+
+exports.shutdown = function() {
+ types.unregisterType(command);
+};
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Walker (jwalker@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/canon', ['require', 'exports', 'module' , 'pilot/console', 'pilot/stacktrace', 'pilot/oop', 'pilot/useragent', 'pilot/keys', 'pilot/event_emitter', 'pilot/typecheck', 'pilot/catalog', 'pilot/types', 'pilot/lang'], function(require, exports, module) {
+
+var console = require('pilot/console');
+var Trace = require('pilot/stacktrace').Trace;
+var oop = require('pilot/oop');
+var useragent = require('pilot/useragent');
+var keyUtil = require('pilot/keys');
+var EventEmitter = require('pilot/event_emitter').EventEmitter;
+var typecheck = require('pilot/typecheck');
+var catalog = require('pilot/catalog');
+var Status = require('pilot/types').Status;
+var types = require('pilot/types');
+var lang = require('pilot/lang');
+
+/*
+// TODO: this doesn't belong here - or maybe anywhere?
+var dimensionsChangedExtensionSpec = {
+ name: 'dimensionsChanged',
+ description: 'A dimensionsChanged is a way to be notified of ' +
+ 'changes to the dimension of Skywriter'
+};
+exports.startup = function(data, reason) {
+ catalog.addExtensionSpec(commandExtensionSpec);
+};
+exports.shutdown = function(data, reason) {
+ catalog.removeExtensionSpec(commandExtensionSpec);
+};
+*/
+
+var commandExtensionSpec = {
+ name: 'command',
+ description: 'A command is a bit of functionality with optional ' +
+ 'typed arguments which can do something small like moving ' +
+ 'the cursor around the screen, or large like cloning a ' +
+ 'project from VCS.',
+ indexOn: 'name'
+};
+
+exports.startup = function(data, reason) {
+ // TODO: this is probably all kinds of evil, but we need something working
+ catalog.addExtensionSpec(commandExtensionSpec);
+};
+
+exports.shutdown = function(data, reason) {
+ catalog.removeExtensionSpec(commandExtensionSpec);
+};
+
+/**
+ * Manage a list of commands in the current canon
+ */
+
+/**
+ * A Command is a discrete action optionally with a set of ways to customize
+ * how it happens. This is here for documentation purposes.
+ * TODO: Document better
+ */
+var thingCommand = {
+ name: 'thing',
+ description: 'thing is an example command',
+ params: [{
+ name: 'param1',
+ description: 'an example parameter',
+ type: 'text',
+ defaultValue: null
+ }],
+ exec: function(env, args, request) {
+ thing();
+ }
+};
+
+/**
+ * A lookup hash of our registered commands
+ */
+var commands = {};
+
+/**
+ * A lookup has for command key bindings that use a string as sender.
+ */
+var commmandKeyBinding = {};
+
+/**
+ * Array with command key bindings that use a function to determ the sender.
+ */
+var commandKeyBindingFunc = { };
+
+function splitSafe(s, separator, limit, bLowerCase) {
+ return (bLowerCase && s.toLowerCase() || s)
+ .replace(/(?:^\s+|\n|\s+$)/g, "")
+ .split(new RegExp("[\\s ]*" + separator + "[\\s ]*", "g"), limit || 999);
+}
+
+function parseKeys(keys, val, ret) {
+ var key,
+ hashId = 0,
+ parts = splitSafe(keys, "\\-", null, true),
+ i = 0,
+ l = parts.length;
+
+ for (; i < l; ++i) {
+ if (keyUtil.KEY_MODS[parts[i]])
+ hashId = hashId | keyUtil.KEY_MODS[parts[i]];
+ else
+ key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
+ }
+
+ if (ret == null) {
+ return {
+ key: key,
+ hashId: hashId
+ }
+ } else {
+ (ret[hashId] || (ret[hashId] = {}))[key] = val;
+ }
+}
+
+var platform = useragent.isMac ? "mac" : "win";
+function buildKeyHash(command) {
+ var binding = command.bindKey,
+ key = binding[platform],
+ ckb = commmandKeyBinding,
+ ckbf = commandKeyBindingFunc
+
+ if (!binding.sender) {
+ throw new Error('All key bindings must have a sender');
+ }
+ if (!binding.mac && binding.mac !== null) {
+ throw new Error('All key bindings must have a mac key binding');
+ }
+ if (!binding.win && binding.win !== null) {
+ throw new Error('All key bindings must have a windows key binding');
+ }
+ if(!binding[platform]) {
+ // No keymapping for this platform.
+ return;
+ }
+ if (typeof binding.sender == 'string') {
+ var targets = splitSafe(binding.sender, "\\|", null, true);
+ targets.forEach(function(target) {
+ if (!ckb[target]) {
+ ckb[target] = { };
+ }
+ key.split("|").forEach(function(keyPart) {
+ parseKeys(keyPart, command, ckb[target]);
+ });
+ });
+ } else if (typecheck.isFunction(binding.sender)) {
+ var val = {
+ command: command,
+ sender: binding.sender
+ };
+
+ keyData = parseKeys(key);
+ if (!ckbf[keyData.hashId]) {
+ ckbf[keyData.hashId] = { };
+ }
+ if (!ckbf[keyData.hashId][keyData.key]) {
+ ckbf[keyData.hashId][keyData.key] = [ val ];
+ } else {
+ ckbf[keyData.hashId][keyData.key].push(val);
+ }
+ } else {
+ throw new Error('Key binding must have a sender that is a string or function');
+ }
+}
+
+function findKeyCommand(env, sender, hashId, textOrKey) {
+ // Convert keyCode to the string representation.
+ if (typecheck.isNumber(textOrKey)) {
+ textOrKey = keyUtil.keyCodeToString(textOrKey);
+ }
+
+ // Check bindings with functions as sender first.
+ var bindFuncs = (commandKeyBindingFunc[hashId] || {})[textOrKey] || [];
+ for (var i = 0; i < bindFuncs.length; i++) {
+ if (bindFuncs[i].sender(env, sender, hashId, textOrKey)) {
+ return bindFuncs[i].command;
+ }
+ }
+
+ var ckbr = commmandKeyBinding[sender];
+ return ckbr && ckbr[hashId] && ckbr[hashId][textOrKey];
+}
+
+function execKeyCommand(env, sender, hashId, textOrKey) {
+ var command = findKeyCommand(env, sender, hashId, textOrKey);
+ if (command) {
+ return exec(command, env, sender, { });
+ } else {
+ return false;
+ }
+}
+
+/**
+ * A sorted list of command names, we regularly want them in order, so pre-sort
+ */
+var commandNames = [];
+
+/**
+ * This registration method isn't like other Ace registration methods because
+ * it doesn't return a decorated command because there is no functional
+ * decoration to be done.
+ * TODO: Are we sure that in the future there will be no such decoration?
+ */
+function addCommand(command) {
+ if (!command.name) {
+ throw new Error('All registered commands must have a name');
+ }
+ if (command.params == null) {
+ command.params = [];
+ }
+ if (!Array.isArray(command.params)) {
+ throw new Error('command.params must be an array in ' + command.name);
+ }
+ // Replace the type
+ command.params.forEach(function(param) {
+ if (!param.name) {
+ throw new Error('In ' + command.name + ': all params must have a name');
+ }
+ upgradeType(command.name, param);
+ }, this);
+ commands[command.name] = command;
+
+ if (command.bindKey) {
+ buildKeyHash(command);
+ }
+
+ commandNames.push(command.name);
+ commandNames.sort();
+};
+
+function upgradeType(name, param) {
+ var lookup = param.type;
+ param.type = types.getType(lookup);
+ if (param.type == null) {
+ throw new Error('In ' + name + '/' + param.name +
+ ': can\'t find type for: ' + JSON.stringify(lookup));
+ }
+}
+
+function removeCommand(command) {
+ var name = (typeof command === 'string' ? command : command.name);
+ command = commands[name];
+ delete commands[name];
+ lang.arrayRemove(commandNames, name);
+
+ // exaustive search is a little bit brute force but since removeCommand is
+ // not a performance critical operation this should be OK
+ var ckb = commmandKeyBinding;
+ for (var k1 in ckb) {
+ for (var k2 in ckb[k1]) {
+ for (var k3 in ckb[k1][k2]) {
+ if (ckb[k1][k2][k3] == command)
+ delete ckb[k1][k2][k3];
+ }
+ }
+ }
+
+ var ckbf = commandKeyBindingFunc;
+ for (var k1 in ckbf) {
+ for (var k2 in ckbf[k1]) {
+ ckbf[k1][k2].forEach(function(cmd, i) {
+ if (cmd.command == command) {
+ ckbf[k1][k2].splice(i, 1);
+ }
+ })
+ }
+ }
+};
+
+function getCommand(name) {
+ return commands[name];
+};
+
+function getCommandNames() {
+ return commandNames;
+};
+
+/**
+ * Default ArgumentProvider that is used if no ArgumentProvider is provided
+ * by the command's sender.
+ */
+function defaultArgsProvider(request, callback) {
+ var args = request.args,
+ params = request.command.params;
+
+ for (var i = 0; i < params.length; i++) {
+ var param = params[i];
+
+ // If the parameter is already valid, then don't ask for it anymore.
+ if (request.getParamStatus(param) != Status.VALID ||
+ // Ask for optional parameters as well.
+ param.defaultValue === null)
+ {
+ var paramPrompt = param.description;
+ if (param.defaultValue === null) {
+ paramPrompt += " (optional)";
+ }
+ var value = prompt(paramPrompt, param.defaultValue || "");
+ // No value but required -> nope.
+ if (!value) {
+ callback();
+ return;
+ } else {
+ args[param.name] = value;
+ }
+ }
+ }
+ callback();
+}
+
+/**
+ * Entry point for keyboard accelerators or anything else that wants to execute
+ * a command. A new request object is created and a check performed, if the
+ * passed in arguments are VALID/INVALID or INCOMPLETE. If they are INCOMPLETE
+ * the ArgumentProvider on the sender is called or otherwise the default
+ * ArgumentProvider to get the still required arguments.
+ * If they are valid (or valid after the ArgumentProvider is done), the command
+ * is executed.
+ *
+ * @param command Either a command, or the name of one
+ * @param env Current environment to execute the command in
+ * @param sender String that should be the same as the senderObject stored on
+ * the environment in env[sender]
+ * @param args Arguments for the command
+ * @param typed (Optional)
+ */
+function exec(command, env, sender, args, typed) {
+ if (typeof command === 'string') {
+ command = commands[command];
+ }
+ if (!command) {
+ // TODO: Should we complain more than returning false?
+ return false;
+ }
+
+ var request = new Request({
+ sender: sender,
+ command: command,
+ args: args || {},
+ typed: typed
+ });
+
+ /**
+ * Executes the command and ensures request.done is called on the request in
+ * case it's not marked to be done already or async.
+ */
+ function execute() {
+ command.exec(env, request.args, request);
+
+ // If the request isn't asnync and isn't done, then make it done.
+ if (!request.isAsync && !request.isDone) {
+ request.done();
+ }
+ }
+
+
+ if (request.getStatus() == Status.INVALID) {
+ console.error("Canon.exec: Invalid parameter(s) passed to " +
+ command.name);
+ return false;
+ }
+ // If the request isn't complete yet, try to complete it.
+ else if (request.getStatus() == Status.INCOMPLETE) {
+ // Check if the sender has a ArgsProvider, otherwise use the default
+ // build in one.
+ var argsProvider;
+ var senderObj = env[sender];
+ if (!senderObj || !senderObj.getArgsProvider ||
+ !(argsProvider = senderObj.getArgsProvider()))
+ {
+ argsProvider = defaultArgsProvider;
+ }
+
+ // Ask the paramProvider to complete the request.
+ argsProvider(request, function() {
+ if (request.getStatus() == Status.VALID) {
+ execute();
+ }
+ });
+ return true;
+ } else {
+ execute();
+ return true;
+ }
+};
+
+exports.removeCommand = removeCommand;
+exports.addCommand = addCommand;
+exports.getCommand = getCommand;
+exports.getCommandNames = getCommandNames;
+exports.findKeyCommand = findKeyCommand;
+exports.exec = exec;
+exports.execKeyCommand = execKeyCommand;
+exports.upgradeType = upgradeType;
+
+
+/**
+ * We publish a 'output' event whenever new command begins output
+ * TODO: make this more obvious
+ */
+oop.implement(exports, EventEmitter);
+
+
+/**
+ * Current requirements are around displaying the command line, and provision
+ * of a 'history' command and cursor up|down navigation of history.
+ *
Future requirements could include:
+ *
+ *
Multiple command lines
+ *
The ability to recall key presses (i.e. requests with no output) which
+ * will likely be needed for macro recording or similar
+ *
The ability to store the command history either on the server or in the
+ * browser local storage.
+ *
+ *
The execute() command doesn't really live here, except as part of that
+ * last future requirement, and because it doesn't really have anywhere else to
+ * live.
+ */
+
+/**
+ * The array of requests that wish to announce their presence
+ */
+var requests = [];
+
+/**
+ * How many requests do we store?
+ */
+var maxRequestLength = 100;
+
+/**
+ * To create an invocation, you need to do something like this (all the ctor
+ * args are optional):
+ *
+ * @constructor
+ */
+function Request(options) {
+ options = options || {};
+
+ // Will be used in the keyboard case and the cli case
+ this.command = options.command;
+
+ // Will be used only in the cli case
+ this.args = options.args;
+ this.typed = options.typed;
+
+ // Have we been initialized?
+ this._begunOutput = false;
+
+ this.start = new Date();
+ this.end = null;
+ this.completed = false;
+ this.error = false;
+};
+
+oop.implement(Request.prototype, EventEmitter);
+
+/**
+ * Return the status of a parameter on the request object.
+ */
+Request.prototype.getParamStatus = function(param) {
+ var args = this.args || {};
+
+ // Check if there is already a value for this parameter.
+ if (param.name in args) {
+ // If there is no value set and then the value is VALID if it's not
+ // required or INCOMPLETE if not set yet.
+ if (args[param.name] == null) {
+ if (param.defaultValue === null) {
+ return Status.VALID;
+ } else {
+ return Status.INCOMPLETE;
+ }
+ }
+
+ // Check if the parameter value is valid.
+ var reply,
+ // The passed in value when parsing a type is a string.
+ argsValue = args[param.name].toString();
+
+ // Type.parse can throw errors.
+ try {
+ reply = param.type.parse(argsValue);
+ } catch (e) {
+ return Status.INVALID;
+ }
+
+ if (reply.status != Status.VALID) {
+ return reply.status;
+ }
+ }
+ // Check if the param is marked as required.
+ else if (param.defaultValue === undefined) {
+ // The parameter is not set on the args object but it's required,
+ // which means, things are invalid.
+ return Status.INCOMPLETE;
+ }
+
+ return Status.VALID;
+}
+
+/**
+ * Return the status of a parameter name on the request object.
+ */
+Request.prototype.getParamNameStatus = function(paramName) {
+ var params = this.command.params || [];
+
+ for (var i = 0; i < params.length; i++) {
+ if (params[i].name == paramName) {
+ return this.getParamStatus(params[i]);
+ }
+ }
+
+ throw "Parameter '" + paramName +
+ "' not defined on command '" + this.command.name + "'";
+}
+
+/**
+ * Checks if all required arguments are set on the request such that it can
+ * get executed.
+ */
+Request.prototype.getStatus = function() {
+ var args = this.args || {},
+ params = this.command.params;
+
+ // If there are not parameters, then it's valid.
+ if (!params || params.length == 0) {
+ return Status.VALID;
+ }
+
+ var status = [];
+ for (var i = 0; i < params.length; i++) {
+ status.push(this.getParamStatus(params[i]));
+ }
+
+ return Status.combine(status);
+}
+
+/**
+ * Lazy init to register with the history should only be done on output.
+ * init() is expensive, and won't be used in the majority of cases
+ */
+Request.prototype._beginOutput = function() {
+ this._begunOutput = true;
+ this.outputs = [];
+
+ requests.push(this);
+ // This could probably be optimized with some maths, but 99.99% of the
+ // time we will only be off by one, and I'm feeling lazy.
+ while (requests.length > maxRequestLength) {
+ requests.shiftObject();
+ }
+
+ exports._dispatchEvent('output', { requests: requests, request: this });
+};
+
+/**
+ * Sugar for:
+ *
request.error = true; request.done(output);
+ */
+Request.prototype.doneWithError = function(content) {
+ this.error = true;
+ this.done(content);
+};
+
+/**
+ * Declares that this function will not be automatically done when
+ * the command exits
+ */
+Request.prototype.async = function() {
+ this.isAsync = true;
+ if (!this._begunOutput) {
+ this._beginOutput();
+ }
+};
+
+/**
+ * Complete the currently executing command with successful output.
+ * @param output Either DOM node, an SproutCore element or something that
+ * can be used in the content of a DIV to create a DOM node.
+ */
+Request.prototype.output = function(content) {
+ if (!this._begunOutput) {
+ this._beginOutput();
+ }
+
+ if (typeof content !== 'string' && !(content instanceof Node)) {
+ content = content.toString();
+ }
+
+ this.outputs.push(content);
+ this.isDone = true;
+ this._dispatchEvent('output', {});
+
+ return this;
+};
+
+/**
+ * All commands that do output must call this to indicate that the command
+ * has finished execution.
+ */
+Request.prototype.done = function(content) {
+ this.completed = true;
+ this.end = new Date();
+ this.duration = this.end.getTime() - this.start.getTime();
+
+ if (content) {
+ this.output(content);
+ }
+
+ // Ensure to finish the request only once.
+ if (!this.isDone) {
+ this.isDone = true;
+ this._dispatchEvent('output', {});
+ }
+};
+exports.Request = Request;
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Walker (jwalker@mozilla.com)
+ * Patrick Walton (pwalton@mozilla.com)
+ * Julian Viereck (jviereck@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+define('pilot/console', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+/**
+ * This object represents a "safe console" object that forwards debugging
+ * messages appropriately without creating a dependency on Firebug in Firefox.
+ */
+
+var noop = function() {};
+
+// These are the functions that are available in Chrome 4/5, Safari 4
+// and Firefox 3.6. Don't add to this list without checking browser support
+var NAMES = [
+ "assert", "count", "debug", "dir", "dirxml", "error", "group", "groupEnd",
+ "info", "log", "profile", "profileEnd", "time", "timeEnd", "trace", "warn"
+];
+
+if (typeof(window) === 'undefined') {
+ // We're in a web worker. Forward to the main thread so the messages
+ // will show up.
+ NAMES.forEach(function(name) {
+ exports[name] = function() {
+ var args = Array.prototype.slice.call(arguments);
+ var msg = { op: 'log', method: name, args: args };
+ postMessage(JSON.stringify(msg));
+ };
+ });
+} else {
+ // For each of the console functions, copy them if they exist, stub if not
+ NAMES.forEach(function(name) {
+ if (window.console && window.console[name]) {
+ exports[name] = Function.prototype.bind.call(window.console[name], window.console);
+ } else {
+ exports[name] = noop;
+ }
+ });
+}
+
+});
+define('pilot/stacktrace', ['require', 'exports', 'module' , 'pilot/useragent', 'pilot/console'], function(require, exports, module) {
+
+var ua = require("pilot/useragent");
+var console = require('pilot/console');
+
+// Changed to suit the specific needs of running within Skywriter
+
+// Domain Public by Eric Wendelin http://eriwen.com/ (2008)
+// Luke Smith http://lucassmith.name/ (2008)
+// Loic Dachary (2008)
+// Johan Euphrosine (2008)
+// Øyvind Sean Kinsey http://kinsey.no/blog
+//
+// Information and discussions
+// http://jspoker.pokersource.info/skin/test-printstacktrace.html
+// http://eriwen.com/javascript/js-stack-trace/
+// http://eriwen.com/javascript/stacktrace-update/
+// http://pastie.org/253058
+// http://browsershots.org/http://jspoker.pokersource.info/skin/test-printstacktrace.html
+//
+
+//
+// guessFunctionNameFromLines comes from firebug
+//
+// Software License Agreement (BSD License)
+//
+// Copyright (c) 2007, Parakey Inc.
+// All rights reserved.
+//
+// Redistribution and use of this software in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above
+// copyright notice, this list of conditions and the
+// following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the
+// following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// * Neither the name of Parakey Inc. nor the names of its
+// contributors may be used to endorse or promote products
+// derived from this software without specific prior
+// written permission of Parakey Inc.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+/**
+ * Different browsers create stack traces in different ways.
+ * Feature Browser detection baby ;).
+ */
+var mode = (function() {
+
+ // We use SC's browser detection here to avoid the "break on error"
+ // functionality provided by Firebug. Firebug tries to do the right
+ // thing here and break, but it happens every time you load the page.
+ // bug 554105
+ if (ua.isGecko) {
+ return 'firefox';
+ } else if (ua.isOpera) {
+ return 'opera';
+ } else {
+ return 'other';
+ }
+
+ // SC doesn't do any detection of Chrome at this time.
+
+ // this is the original feature detection code that is used as a
+ // fallback.
+ try {
+ (0)();
+ } catch (e) {
+ if (e.arguments) {
+ return 'chrome';
+ }
+ if (e.stack) {
+ return 'firefox';
+ }
+ if (window.opera && !('stacktrace' in e)) { //Opera 9-
+ return 'opera';
+ }
+ }
+ return 'other';
+})();
+
+/**
+ *
+ */
+function stringifyArguments(args) {
+ for (var i = 0; i < args.length; ++i) {
+ var argument = args[i];
+ if (typeof argument == 'object') {
+ args[i] = '#object';
+ } else if (typeof argument == 'function') {
+ args[i] = '#function';
+ } else if (typeof argument == 'string') {
+ args[i] = '"' + argument + '"';
+ }
+ }
+ return args.join(',');
+}
+
+/**
+ * Extract a stack trace from the format emitted by each browser.
+ */
+var decoders = {
+ chrome: function(e) {
+ var stack = e.stack;
+ if (!stack) {
+ console.log(e);
+ return [];
+ }
+ return stack.replace(/^.*?\n/, '').
+ replace(/^.*?\n/, '').
+ replace(/^.*?\n/, '').
+ replace(/^[^\(]+?[\n$]/gm, '').
+ replace(/^\s+at\s+/gm, '').
+ replace(/^Object.\s*\(/gm, '{anonymous}()@').
+ split('\n');
+ },
+
+ firefox: function(e) {
+ var stack = e.stack;
+ if (!stack) {
+ console.log(e);
+ return [];
+ }
+ // stack = stack.replace(/^.*?\n/, '');
+ stack = stack.replace(/(?:\n@:0)?\s+$/m, '');
+ stack = stack.replace(/^\(/gm, '{anonymous}(');
+ return stack.split('\n');
+ },
+
+ // Opera 7.x and 8.x only!
+ opera: function(e) {
+ var lines = e.message.split('\n'), ANON = '{anonymous}',
+ lineRE = /Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i, i, j, len;
+
+ for (i = 4, j = 0, len = lines.length; i < len; i += 2) {
+ if (lineRE.test(lines[i])) {
+ lines[j++] = (RegExp.$3 ? RegExp.$3 + '()@' + RegExp.$2 + RegExp.$1 : ANON + '()@' + RegExp.$2 + ':' + RegExp.$1) +
+ ' -- ' +
+ lines[i + 1].replace(/^\s+/, '');
+ }
+ }
+
+ lines.splice(j, lines.length - j);
+ return lines;
+ },
+
+ // Safari, Opera 9+, IE, and others
+ other: function(curr) {
+ var ANON = '{anonymous}', fnRE = /function\s*([\w\-$]+)?\s*\(/i, stack = [], j = 0, fn, args;
+
+ var maxStackSize = 10;
+ while (curr && stack.length < maxStackSize) {
+ fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON : ANON;
+ args = Array.prototype.slice.call(curr['arguments']);
+ stack[j++] = fn + '(' + stringifyArguments(args) + ')';
+
+ //Opera bug: if curr.caller does not exist, Opera returns curr (WTF)
+ if (curr === curr.caller && window.opera) {
+ //TODO: check for same arguments if possible
+ break;
+ }
+ curr = curr.caller;
+ }
+ return stack;
+ }
+};
+
+/**
+ *
+ */
+function NameGuesser() {
+}
+
+NameGuesser.prototype = {
+
+ sourceCache: {},
+
+ ajax: function(url) {
+ var req = this.createXMLHTTPObject();
+ if (!req) {
+ return;
+ }
+ req.open('GET', url, false);
+ req.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
+ req.send('');
+ return req.responseText;
+ },
+
+ createXMLHTTPObject: function() {
+ // Try XHR methods in order and store XHR factory
+ var xmlhttp, XMLHttpFactories = [
+ function() {
+ return new XMLHttpRequest();
+ }, function() {
+ return new ActiveXObject('Msxml2.XMLHTTP');
+ }, function() {
+ return new ActiveXObject('Msxml3.XMLHTTP');
+ }, function() {
+ return new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ ];
+ for (var i = 0; i < XMLHttpFactories.length; i++) {
+ try {
+ xmlhttp = XMLHttpFactories[i]();
+ // Use memoization to cache the factory
+ this.createXMLHTTPObject = XMLHttpFactories[i];
+ return xmlhttp;
+ } catch (e) {}
+ }
+ },
+
+ getSource: function(url) {
+ if (!(url in this.sourceCache)) {
+ this.sourceCache[url] = this.ajax(url).split('\n');
+ }
+ return this.sourceCache[url];
+ },
+
+ guessFunctions: function(stack) {
+ for (var i = 0; i < stack.length; ++i) {
+ var reStack = /{anonymous}\(.*\)@(\w+:\/\/([-\w\.]+)+(:\d+)?[^:]+):(\d+):?(\d+)?/;
+ var frame = stack[i], m = reStack.exec(frame);
+ if (m) {
+ var file = m[1], lineno = m[4]; //m[7] is character position in Chrome
+ if (file && lineno) {
+ var functionName = this.guessFunctionName(file, lineno);
+ stack[i] = frame.replace('{anonymous}', functionName);
+ }
+ }
+ }
+ return stack;
+ },
+
+ guessFunctionName: function(url, lineNo) {
+ try {
+ return this.guessFunctionNameFromLines(lineNo, this.getSource(url));
+ } catch (e) {
+ return 'getSource failed with url: ' + url + ', exception: ' + e.toString();
+ }
+ },
+
+ guessFunctionNameFromLines: function(lineNo, source) {
+ var reFunctionArgNames = /function ([^(]*)\(([^)]*)\)/;
+ var reGuessFunction = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(function|eval|new Function)/;
+ // Walk backwards from the first line in the function until we find the line which
+ // matches the pattern above, which is the function definition
+ var line = '', maxLines = 10;
+ for (var i = 0; i < maxLines; ++i) {
+ line = source[lineNo - i] + line;
+ if (line !== undefined) {
+ var m = reGuessFunction.exec(line);
+ if (m) {
+ return m[1];
+ }
+ else {
+ m = reFunctionArgNames.exec(line);
+ }
+ if (m && m[1]) {
+ return m[1];
+ }
+ }
+ }
+ return '(?)';
+ }
+};
+
+var guesser = new NameGuesser();
+
+var frameIgnorePatterns = [
+ /http:\/\/localhost:4020\/sproutcore.js:/
+];
+
+exports.ignoreFramesMatching = function(regex) {
+ frameIgnorePatterns.push(regex);
+};
+
+/**
+ * Create a stack trace from an exception
+ * @param ex {Error} The error to create a stacktrace from (optional)
+ * @param guess {Boolean} If we should try to resolve the names of anonymous functions
+ */
+exports.Trace = function Trace(ex, guess) {
+ this._ex = ex;
+ this._stack = decoders[mode](ex);
+
+ if (guess) {
+ this._stack = guesser.guessFunctions(this._stack);
+ }
+};
+
+/**
+ * Log to the console a number of lines (default all of them)
+ * @param lines {number} Maximum number of lines to wrote to console
+ */
+exports.Trace.prototype.log = function(lines) {
+ if (lines <= 0) {
+ // You aren't going to have more lines in your stack trace than this
+ // and it still fits in a 32bit integer
+ lines = 999999999;
+ }
+
+ var printed = 0;
+ for (var i = 0; i < this._stack.length && printed < lines; i++) {
+ var frame = this._stack[i];
+ var display = true;
+ frameIgnorePatterns.forEach(function(regex) {
+ if (regex.test(frame)) {
+ display = false;
+ }
+ });
+ if (display) {
+ console.debug(frame);
+ printed++;
+ }
+ }
+};
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/useragent', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
+var ua = navigator.userAgent;
+var av = navigator.appVersion;
+
+/** Is the user using a browser that identifies itself as Windows */
+exports.isWin = (os == "win");
+
+/** Is the user using a browser that identifies itself as Mac OS */
+exports.isMac = (os == "mac");
+
+/** Is the user using a browser that identifies itself as Linux */
+exports.isLinux = (os == "linux");
+
+exports.isIE = ! + "\v1";
+
+/** Is this Firefox or related? */
+exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
+
+/** oldGecko == rev < 2.0 **/
+exports.isOldGecko = exports.isGecko && /rv\:1/.test(navigator.userAgent);
+
+/** Is this Opera */
+exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
+
+/** Is the user using a browser that identifies itself as WebKit */
+exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
+
+exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
+
+exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
+
+exports.isIPad = ua.indexOf("iPad") >= 0;
+
+/**
+ * I hate doing this, but we need some way to determine if the user is on a Mac
+ * The reason is that users have different expectations of their key combinations.
+ *
+ * Take copy as an example, Mac people expect to use CMD or APPLE + C
+ * Windows folks expect to use CTRL + C
+ */
+exports.OS = {
+ LINUX: 'LINUX',
+ MAC: 'MAC',
+ WINDOWS: 'WINDOWS'
+};
+
+/**
+ * Return an exports.OS constant
+ */
+exports.getOS = function() {
+ if (exports.isMac) {
+ return exports.OS['MAC'];
+ } else if (exports.isLinux) {
+ return exports.OS['LINUX'];
+ } else {
+ return exports.OS['WINDOWS'];
+ }
+};
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+exports.inherits = (function() {
+ var tempCtor = function() {};
+ return function(ctor, superCtor) {
+ tempCtor.prototype = superCtor.prototype;
+ ctor.super_ = superCtor.prototype;
+ ctor.prototype = new tempCtor();
+ ctor.prototype.constructor = ctor;
+ }
+}());
+
+exports.mixin = function(obj, mixin) {
+ for (var key in mixin) {
+ obj[key] = mixin[key];
+ }
+};
+
+exports.implement = function(proto, mixin) {
+ exports.mixin(proto, mixin);
+};
+
+});
+/*! @license
+==========================================================================
+SproutCore -- JavaScript Application Framework
+copyright 2006-2009, Sprout Systems Inc., Apple Inc. and contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+SproutCore and the SproutCore logo are trademarks of Sprout Systems, Inc.
+
+For more information about SproutCore, visit http://www.sproutcore.com
+
+
+==========================================================================
+@license */
+
+// Most of the following code is taken from SproutCore with a few changes.
+
+define('pilot/keys', ['require', 'exports', 'module' , 'pilot/oop'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+
+/**
+ * Helper functions and hashes for key handling.
+ */
+var Keys = (function() {
+ var ret = {
+ MODIFIER_KEYS: {
+ 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
+ },
+
+ KEY_MODS: {
+ "ctrl": 1, "alt": 2, "option" : 2,
+ "shift": 4, "meta": 8, "command": 8
+ },
+
+ FUNCTION_KEYS : {
+ 8 : "Backspace",
+ 9 : "Tab",
+ 13 : "Return",
+ 19 : "Pause",
+ 27 : "Esc",
+ 32 : "Space",
+ 33 : "PageUp",
+ 34 : "PageDown",
+ 35 : "End",
+ 36 : "Home",
+ 37 : "Left",
+ 38 : "Up",
+ 39 : "Right",
+ 40 : "Down",
+ 44 : "Print",
+ 45 : "Insert",
+ 46 : "Delete",
+ 112: "F1",
+ 113: "F2",
+ 114: "F3",
+ 115: "F4",
+ 116: "F5",
+ 117: "F6",
+ 118: "F7",
+ 119: "F8",
+ 120: "F9",
+ 121: "F10",
+ 122: "F11",
+ 123: "F12",
+ 144: "Numlock",
+ 145: "Scrolllock"
+ },
+
+ PRINTABLE_KEYS: {
+ 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
+ 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
+ 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
+ 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
+ 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
+ 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
+ 188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',
+ 221: ']', 222: '\"'
+ }
+ };
+
+ // A reverse map of FUNCTION_KEYS
+ for (i in ret.FUNCTION_KEYS) {
+ var name = ret.FUNCTION_KEYS[i].toUpperCase();
+ ret[name] = parseInt(i, 10);
+ }
+
+ // Add the MODIFIER_KEYS, FUNCTION_KEYS and PRINTABLE_KEYS to the KEY
+ // variables as well.
+ oop.mixin(ret, ret.MODIFIER_KEYS);
+ oop.mixin(ret, ret.PRINTABLE_KEYS);
+ oop.mixin(ret, ret.FUNCTION_KEYS);
+
+ return ret;
+})();
+oop.mixin(exports, Keys);
+
+exports.keyCodeToString = function(keyCode) {
+ return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
+}
+
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Irakli Gozalishvili (http://jeditoolkit.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+var EventEmitter = {};
+
+EventEmitter._emit =
+EventEmitter._dispatchEvent = function(eventName, e) {
+ this._eventRegistry = this._eventRegistry || {};
+
+ var listeners = this._eventRegistry[eventName];
+ if (!listeners || !listeners.length) return;
+
+ var e = e || {};
+ e.type = eventName;
+
+ for (var i=0; i
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+exports.stringReverse = function(string) {
+ return string.split("").reverse().join("");
+};
+
+exports.stringRepeat = function (string, count) {
+ return new Array(count + 1).join(string);
+};
+
+var trimBeginRegexp = /^\s\s*/;
+var trimEndRegexp = /\s\s*$/;
+
+exports.stringTrimLeft = function (string) {
+ return string.replace(trimBeginRegexp, '')
+};
+
+exports.stringTrimRight = function (string) {
+ return string.replace(trimEndRegexp, '');
+};
+
+exports.copyObject = function(obj) {
+ var copy = {};
+ for (var key in obj) {
+ copy[key] = obj[key];
+ }
+ return copy;
+};
+
+exports.copyArray = function(array){
+ var copy = [];
+ for (i=0, l=array.length; i (http://jeditoolkit.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/settings', ['require', 'exports', 'module' , 'pilot/console', 'pilot/oop', 'pilot/types', 'pilot/event_emitter', 'pilot/catalog'], function(require, exports, module) {
+
+/**
+ * This plug-in manages settings.
+ */
+
+var console = require('pilot/console');
+var oop = require('pilot/oop');
+var types = require('pilot/types');
+var EventEmitter = require('pilot/event_emitter').EventEmitter;
+var catalog = require('pilot/catalog');
+
+var settingExtensionSpec = {
+ name: 'setting',
+ description: 'A setting is something that the application offers as a ' +
+ 'way to customize how it works',
+ register: 'env.settings.addSetting',
+ indexOn: 'name'
+};
+
+exports.startup = function(data, reason) {
+ catalog.addExtensionSpec(settingExtensionSpec);
+};
+
+exports.shutdown = function(data, reason) {
+ catalog.removeExtensionSpec(settingExtensionSpec);
+};
+
+
+/**
+ * Create a new setting.
+ * @param settingSpec An object literal that looks like this:
+ * {
+ * name: 'thing',
+ * description: 'Thing is an example setting',
+ * type: 'string',
+ * defaultValue: 'something'
+ * }
+ */
+function Setting(settingSpec, settings) {
+ this._settings = settings;
+
+ Object.keys(settingSpec).forEach(function(key) {
+ this[key] = settingSpec[key];
+ }, this);
+
+ this.type = types.getType(this.type);
+ if (this.type == null) {
+ throw new Error('In ' + this.name +
+ ': can\'t find type for: ' + JSON.stringify(settingSpec.type));
+ }
+
+ if (!this.name) {
+ throw new Error('Setting.name == undefined. Ignoring.', this);
+ }
+
+ if (!this.defaultValue === undefined) {
+ throw new Error('Setting.defaultValue == undefined', this);
+ }
+
+ if (this.onChange) {
+ this.on('change', this.onChange.bind(this))
+ }
+
+ this.set(this.defaultValue);
+}
+Setting.prototype = {
+ get: function() {
+ return this.value;
+ },
+
+ set: function(value) {
+ if (this.value === value) {
+ return;
+ }
+
+ this.value = value;
+ if (this._settings.persister) {
+ this._settings.persister.persistValue(this._settings, this.name, value);
+ }
+
+ this._dispatchEvent('change', { setting: this, value: value });
+ },
+
+ /**
+ * Reset the value of the key setting to it's default
+ */
+ resetValue: function() {
+ this.set(this.defaultValue);
+ },
+ toString: function () {
+ return this.name;
+ }
+};
+oop.implement(Setting.prototype, EventEmitter);
+
+
+/**
+ * A base class for all the various methods of storing settings.
+ *
Usage:
+ *
+ * // Create manually, or require 'settings' from the container.
+ * // This is the manual version:
+ * var settings = plugins.catalog.getObject('settings');
+ * // Add a new setting
+ * settings.addSetting({ name:'foo', ... });
+ * // Display the default value
+ * alert(settings.get('foo'));
+ * // Alter the value, which also publishes the change etc.
+ * settings.set('foo', 'bar');
+ * // Reset the value to the default
+ * settings.resetValue('foo');
+ *
+ * @constructor
+ */
+function Settings(persister) {
+ // Storage for deactivated values
+ this._deactivated = {};
+
+ // Storage for the active settings
+ this._settings = {};
+ // We often want sorted setting names. Cache
+ this._settingNames = [];
+
+ if (persister) {
+ this.setPersister(persister);
+ }
+};
+
+Settings.prototype = {
+ /**
+ * Function to add to the list of available settings.
+ *
Example usage:
+ *
+ * var settings = plugins.catalog.getObject('settings');
+ * settings.addSetting({
+ * name: 'tabsize', // For use in settings.get('X')
+ * type: 'number', // To allow value checking.
+ * defaultValue: 4 // Default value for use when none is directly set
+ * });
+ *
+ * @param {object} settingSpec Object containing name/type/defaultValue members.
+ */
+ addSetting: function(settingSpec) {
+ var setting = new Setting(settingSpec, this);
+ this._settings[setting.name] = setting;
+ this._settingNames.push(setting.name);
+ this._settingNames.sort();
+ },
+
+ addSettings: function addSettings(settings) {
+ Object.keys(settings).forEach(function (name) {
+ var setting = settings[name];
+ if (!('name' in setting)) setting.name = name;
+ this.addSetting(setting);
+ }, this);
+ },
+
+ removeSetting: function(setting) {
+ var name = (typeof setting === 'string' ? setting : setting.name);
+ setting = this._settings[name];
+ delete this._settings[name];
+ util.arrayRemove(this._settingNames, name);
+ settings.removeAllListeners('change');
+ },
+
+ removeSettings: function removeSettings(settings) {
+ Object.keys(settings).forEach(function(name) {
+ var setting = settings[name];
+ if (!('name' in setting)) setting.name = name;
+ this.removeSettings(setting);
+ }, this);
+ },
+
+ getSettingNames: function() {
+ return this._settingNames;
+ },
+
+ getSetting: function(name) {
+ return this._settings[name];
+ },
+
+ /**
+ * A Persister is able to store settings. It is an object that defines
+ * two functions:
+ * loadInitialValues(settings) and persistValue(settings, key, value).
+ */
+ setPersister: function(persister) {
+ this._persister = persister;
+ if (persister) {
+ persister.loadInitialValues(this);
+ }
+ },
+
+ resetAll: function() {
+ this.getSettingNames().forEach(function(key) {
+ this.resetValue(key);
+ }, this);
+ },
+
+ /**
+ * Retrieve a list of the known settings and their values
+ */
+ _list: function() {
+ var reply = [];
+ this.getSettingNames().forEach(function(setting) {
+ reply.push({
+ 'key': setting,
+ 'value': this.getSetting(setting).get()
+ });
+ }, this);
+ return reply;
+ },
+
+ /**
+ * Prime the local cache with the defaults.
+ */
+ _loadDefaultValues: function() {
+ this._loadFromObject(this._getDefaultValues());
+ },
+
+ /**
+ * Utility to load settings from an object
+ */
+ _loadFromObject: function(data) {
+ // We iterate over data rather than keys so we don't forget values
+ // which don't have a setting yet.
+ for (var key in data) {
+ if (data.hasOwnProperty(key)) {
+ var setting = this._settings[key];
+ if (setting) {
+ var value = setting.type.parse(data[key]);
+ this.set(key, value);
+ } else {
+ this.set(key, data[key]);
+ }
+ }
+ }
+ },
+
+ /**
+ * Utility to grab all the settings and export them into an object
+ */
+ _saveToObject: function() {
+ return this.getSettingNames().map(function(key) {
+ return this._settings[key].type.stringify(this.get(key));
+ }.bind(this));
+ },
+
+ /**
+ * The default initial settings
+ */
+ _getDefaultValues: function() {
+ return this.getSettingNames().map(function(key) {
+ return this._settings[key].spec.defaultValue;
+ }.bind(this));
+ }
+};
+exports.settings = new Settings();
+
+/**
+ * Save the settings in a cookie
+ * This code has not been tested since reboot
+ * @constructor
+ */
+function CookiePersister() {
+};
+
+CookiePersister.prototype = {
+ loadInitialValues: function(settings) {
+ settings._loadDefaultValues();
+ var data = cookie.get('settings');
+ settings._loadFromObject(JSON.parse(data));
+ },
+
+ persistValue: function(settings, key, value) {
+ try {
+ var stringData = JSON.stringify(settings._saveToObject());
+ cookie.set('settings', stringData);
+ } catch (ex) {
+ console.error('Unable to JSONify the settings! ' + ex);
+ return;
+ }
+ }
+};
+
+exports.CookiePersister = CookiePersister;
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Skywriter Team (skywriter@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/commands/settings', ['require', 'exports', 'module' , 'pilot/canon'], function(require, exports, module) {
+
+
+var setCommandSpec = {
+ name: 'set',
+ params: [
+ {
+ name: 'setting',
+ type: 'setting',
+ description: 'The name of the setting to display or alter',
+ defaultValue: null
+ },
+ {
+ name: 'value',
+ type: 'settingValue',
+ description: 'The new value for the chosen setting',
+ defaultValue: null
+ }
+ ],
+ description: 'define and show settings',
+ exec: function(env, args, request) {
+ var html;
+ if (!args.setting) {
+ // 'set' by itself lists all the settings
+ var names = env.settings.getSettingNames();
+ html = '';
+ // first sort the settingsList based on the name
+ names.sort(function(name1, name2) {
+ return name1.localeCompare(name2);
+ });
+
+ names.forEach(function(name) {
+ var setting = env.settings.getSetting(name);
+ var url = 'https://wiki.mozilla.org/Labs/Skywriter/Settings#' +
+ setting.name;
+ html += '' +
+ setting.name +
+ ' = ' +
+ setting.value +
+ ' ';
+ });
+ } else {
+ // set with only a setting, shows the value for that setting
+ if (args.value === undefined) {
+ html = '' + setting.name + ' = ' +
+ setting.get();
+ } else {
+ // Actually change the setting
+ args.setting.set(args.value);
+ html = 'Setting: ' + args.setting.name + ' = ' +
+ args.setting.get();
+ }
+ }
+ request.done(html);
+ }
+};
+
+var unsetCommandSpec = {
+ name: 'unset',
+ params: [
+ {
+ name: 'setting',
+ type: 'setting',
+ description: 'The name of the setting to return to defaults'
+ }
+ ],
+ description: 'unset a setting entirely',
+ exec: function(env, args, request) {
+ var setting = env.settings.get(args.setting);
+ if (!setting) {
+ request.doneWithError('No setting with the name ' +
+ args.setting + '.');
+ return;
+ }
+
+ setting.reset();
+ request.done('Reset ' + setting.name + ' to default: ' +
+ env.settings.get(args.setting));
+ }
+};
+
+var canon = require('pilot/canon');
+
+exports.startup = function(data, reason) {
+ canon.addCommand(setCommandSpec);
+ canon.addCommand(unsetCommandSpec);
+};
+
+exports.shutdown = function(data, reason) {
+ canon.removeCommand(setCommandSpec);
+ canon.removeCommand(unsetCommandSpec);
+};
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Skywriter Team (skywriter@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/commands/basic', ['require', 'exports', 'module' , 'pilot/typecheck', 'pilot/canon'], function(require, exports, module) {
+
+
+var checks = require("pilot/typecheck");
+var canon = require('pilot/canon');
+
+/**
+ * 'help' command
+ */
+var helpCommandSpec = {
+ name: 'help',
+ params: [
+ {
+ name: 'search',
+ type: 'text',
+ description: 'Search string to narrow the output.',
+ defaultValue: null
+ }
+ ],
+ description: 'Get help on the available commands.',
+ exec: function(env, args, request) {
+ var output = [];
+
+ var command = canon.getCommand(args.search);
+ if (command && command.exec) {
+ // caught a real command
+ output.push(command.description ?
+ command.description :
+ 'No description for ' + args.search);
+ } else {
+ var showHidden = false;
+
+ if (command) {
+ // We must be looking at sub-commands
+ output.push('
');
+ for (var i = 0; i < commandNames.length; i++) {
+ command = canon.getCommand(commandNames[i]);
+ if (!showHidden && command.hidden) {
+ continue;
+ }
+ if (command.description === undefined) {
+ // Ignore editor actions
+ continue;
+ }
+ if (args.search && command.name.indexOf(args.search) !== 0) {
+ // Filtered out by the user
+ continue;
+ }
+ if (!args.search && command.name.indexOf(' ') != -1) {
+ // sub command
+ continue;
+ }
+ if (command && command.name == args.search) {
+ // sub command, and we've already given that help
+ continue;
+ }
+
+ // todo add back a column with parameter information, perhaps?
+
+ output.push('
');
+ output.push('
' + command.name + '
');
+ output.push('
' + command.description + '
');
+ output.push('
');
+ }
+ output.push('
');
+ }
+
+ request.done(output.join(''));
+ }
+};
+
+/**
+ * 'eval' command
+ */
+var evalCommandSpec = {
+ name: 'eval',
+ params: [
+ {
+ name: 'javascript',
+ type: 'text',
+ description: 'The JavaScript to evaluate'
+ }
+ ],
+ description: 'evals given js code and show the result',
+ hidden: true,
+ exec: function(env, args, request) {
+ var result;
+ var javascript = args.javascript;
+ try {
+ result = eval(javascript);
+ } catch (e) {
+ result = 'Error: ' + e.message + '';
+ }
+
+ var msg = '';
+ var type = '';
+ var x;
+
+ if (checks.isFunction(result)) {
+ // converts the function to a well formated string
+ msg = (result + '').replace(/\n/g, ' ').replace(/ /g, ' ');
+ type = 'function';
+ } else if (checks.isObject(result)) {
+ if (Array.isArray(result)) {
+ type = 'array';
+ } else {
+ type = 'object';
+ }
+
+ var items = [];
+ var value;
+
+ for (x in result) {
+ if (result.hasOwnProperty(x)) {
+ if (checks.isFunction(result[x])) {
+ value = '[function]';
+ } else if (checks.isObject(result[x])) {
+ value = '[object]';
+ } else {
+ value = result[x];
+ }
+
+ items.push({name: x, value: value});
+ }
+ }
+
+ items.sort(function(a,b) {
+ return (a.name.toLowerCase() < b.name.toLowerCase()) ? -1 : 1;
+ });
+
+ for (x = 0; x < items.length; x++) {
+ msg += '' + items[x].name + ': ' + items[x].value + ' ';
+ }
+
+ } else {
+ msg = result;
+ type = typeof result;
+ }
+
+ request.done('Result for eval \'' + javascript + '\'' +
+ ' (type: '+ type+'):
'+ msg);
+ }
+};
+
+var canon = require('pilot/canon');
+
+exports.startup = function(data, reason) {
+ canon.addCommand(helpCommandSpec);
+ canon.addCommand(evalCommandSpec);
+};
+
+exports.shutdown = function(data, reason) {
+ canon.removeCommand(helpCommandSpec);
+ canon.removeCommand(evalCommandSpec);
+};
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Walker (jwalker@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/settings/canon', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+
+var historyLengthSetting = {
+ name: "historyLength",
+ description: "How many typed commands do we recall for reference?",
+ type: "number",
+ defaultValue: 50
+};
+
+exports.startup = function(data, reason) {
+ data.env.settings.addSetting(historyLengthSetting);
+};
+
+exports.shutdown = function(data, reason) {
+ data.env.settings.removeSetting(historyLengthSetting);
+};
+
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Kevin Dangoor (kdangoor@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/plugin_manager', ['require', 'exports', 'module' , 'pilot/promise'], function(require, exports, module) {
+
+var Promise = require("pilot/promise").Promise;
+
+exports.REASONS = {
+ APP_STARTUP: 1,
+ APP_SHUTDOWN: 2,
+ PLUGIN_ENABLE: 3,
+ PLUGIN_DISABLE: 4,
+ PLUGIN_INSTALL: 5,
+ PLUGIN_UNINSTALL: 6,
+ PLUGIN_UPGRADE: 7,
+ PLUGIN_DOWNGRADE: 8
+};
+
+exports.Plugin = function(name) {
+ this.name = name;
+ this.status = this.INSTALLED;
+};
+
+exports.Plugin.prototype = {
+ /**
+ * constants for the state
+ */
+ NEW: 0,
+ INSTALLED: 1,
+ REGISTERED: 2,
+ STARTED: 3,
+ UNREGISTERED: 4,
+ SHUTDOWN: 5,
+
+ install: function(data, reason) {
+ var pr = new Promise();
+ if (this.status > this.NEW) {
+ pr.resolve(this);
+ return pr;
+ }
+ require([this.name], function(pluginModule) {
+ if (pluginModule.install) {
+ pluginModule.install(data, reason);
+ }
+ this.status = this.INSTALLED;
+ pr.resolve(this);
+ }.bind(this));
+ return pr;
+ },
+
+ register: function(data, reason) {
+ var pr = new Promise();
+ if (this.status != this.INSTALLED) {
+ pr.resolve(this);
+ return pr;
+ }
+ require([this.name], function(pluginModule) {
+ if (pluginModule.register) {
+ pluginModule.register(data, reason);
+ }
+ this.status = this.REGISTERED;
+ pr.resolve(this);
+ }.bind(this));
+ return pr;
+ },
+
+ startup: function(data, reason) {
+ reason = reason || exports.REASONS.APP_STARTUP;
+ var pr = new Promise();
+ if (this.status != this.REGISTERED) {
+ pr.resolve(this);
+ return pr;
+ }
+ require([this.name], function(pluginModule) {
+ if (pluginModule.startup) {
+ pluginModule.startup(data, reason);
+ }
+ this.status = this.STARTED;
+ pr.resolve(this);
+ }.bind(this));
+ return pr;
+ },
+
+ shutdown: function(data, reason) {
+ if (this.status != this.STARTED) {
+ return;
+ }
+ pluginModule = require(this.name);
+ if (pluginModule.shutdown) {
+ pluginModule.shutdown(data, reason);
+ }
+ }
+};
+
+exports.PluginCatalog = function() {
+ this.plugins = {};
+};
+
+exports.PluginCatalog.prototype = {
+ registerPlugins: function(pluginList, data, reason) {
+ var registrationPromises = [];
+ pluginList.forEach(function(pluginName) {
+ var plugin = this.plugins[pluginName];
+ if (plugin === undefined) {
+ plugin = new exports.Plugin(pluginName);
+ this.plugins[pluginName] = plugin;
+ registrationPromises.push(plugin.register(data, reason));
+ }
+ }.bind(this));
+ return Promise.group(registrationPromises);
+ },
+
+ startupPlugins: function(data, reason) {
+ var startupPromises = [];
+ for (var pluginName in this.plugins) {
+ var plugin = this.plugins[pluginName];
+ startupPromises.push(plugin.startup(data, reason));
+ }
+ return Promise.group(startupPromises);
+ }
+};
+
+exports.catalog = new exports.PluginCatalog();
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Skywriter.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Walker (jwalker@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/promise', ['require', 'exports', 'module' , 'pilot/console', 'pilot/stacktrace'], function(require, exports, module) {
+
+var console = require("pilot/console");
+var Trace = require('pilot/stacktrace').Trace;
+
+/**
+ * A promise can be in one of 2 states.
+ * The ERROR and SUCCESS states are terminal, the PENDING state is the only
+ * start state.
+ */
+var ERROR = -1;
+var PENDING = 0;
+var SUCCESS = 1;
+
+/**
+ * We give promises and ID so we can track which are outstanding
+ */
+var _nextId = 0;
+
+/**
+ * Debugging help if 2 things try to complete the same promise.
+ * This can be slow (especially on chrome due to the stack trace unwinding) so
+ * we should leave this turned off in normal use.
+ */
+var _traceCompletion = false;
+
+/**
+ * Outstanding promises. Handy list for debugging only.
+ */
+var _outstanding = [];
+
+/**
+ * Recently resolved promises. Also for debugging only.
+ */
+var _recent = [];
+
+/**
+ * Create an unfulfilled promise
+ */
+Promise = function () {
+ this._status = PENDING;
+ this._value = undefined;
+ this._onSuccessHandlers = [];
+ this._onErrorHandlers = [];
+
+ // Debugging help
+ this._id = _nextId++;
+ //this._createTrace = new Trace(new Error());
+ _outstanding[this._id] = this;
+};
+
+/**
+ * Yeay for RTTI.
+ */
+Promise.prototype.isPromise = true;
+
+/**
+ * Have we either been resolve()ed or reject()ed?
+ */
+Promise.prototype.isComplete = function() {
+ return this._status != PENDING;
+};
+
+/**
+ * Have we resolve()ed?
+ */
+Promise.prototype.isResolved = function() {
+ return this._status == SUCCESS;
+};
+
+/**
+ * Have we reject()ed?
+ */
+Promise.prototype.isRejected = function() {
+ return this._status == ERROR;
+};
+
+/**
+ * Take the specified action of fulfillment of a promise, and (optionally)
+ * a different action on promise rejection.
+ */
+Promise.prototype.then = function(onSuccess, onError) {
+ if (typeof onSuccess === 'function') {
+ if (this._status === SUCCESS) {
+ onSuccess.call(null, this._value);
+ } else if (this._status === PENDING) {
+ this._onSuccessHandlers.push(onSuccess);
+ }
+ }
+
+ if (typeof onError === 'function') {
+ if (this._status === ERROR) {
+ onError.call(null, this._value);
+ } else if (this._status === PENDING) {
+ this._onErrorHandlers.push(onError);
+ }
+ }
+
+ return this;
+};
+
+/**
+ * Like then() except that rather than returning this we return
+ * a promise which
+ */
+Promise.prototype.chainPromise = function(onSuccess) {
+ var chain = new Promise();
+ chain._chainedFrom = this;
+ this.then(function(data) {
+ try {
+ chain.resolve(onSuccess(data));
+ } catch (ex) {
+ chain.reject(ex);
+ }
+ }, function(ex) {
+ chain.reject(ex);
+ });
+ return chain;
+};
+
+/**
+ * Supply the fulfillment of a promise
+ */
+Promise.prototype.resolve = function(data) {
+ return this._complete(this._onSuccessHandlers, SUCCESS, data, 'resolve');
+};
+
+/**
+ * Renege on a promise
+ */
+Promise.prototype.reject = function(data) {
+ return this._complete(this._onErrorHandlers, ERROR, data, 'reject');
+};
+
+/**
+ * Internal method to be called on resolve() or reject().
+ * @private
+ */
+Promise.prototype._complete = function(list, status, data, name) {
+ // Complain if we've already been completed
+ if (this._status != PENDING) {
+ console.group('Promise already closed');
+ console.error('Attempted ' + name + '() with ', data);
+ console.error('Previous status = ', this._status,
+ ', previous value = ', this._value);
+ console.trace();
+
+ if (this._completeTrace) {
+ console.error('Trace of previous completion:');
+ this._completeTrace.log(5);
+ }
+ console.groupEnd();
+ return this;
+ }
+
+ if (_traceCompletion) {
+ this._completeTrace = new Trace(new Error());
+ }
+
+ this._status = status;
+ this._value = data;
+
+ // Call all the handlers, and then delete them
+ list.forEach(function(handler) {
+ handler.call(null, this._value);
+ }, this);
+ this._onSuccessHandlers.length = 0;
+ this._onErrorHandlers.length = 0;
+
+ // Remove the given {promise} from the _outstanding list, and add it to the
+ // _recent list, pruning more than 20 recent promises from that list.
+ delete _outstanding[this._id];
+ _recent.push(this);
+ while (_recent.length > 20) {
+ _recent.shift();
+ }
+
+ return this;
+};
+
+/**
+ * Takes an array of promises and returns a promise that that is fulfilled once
+ * all the promises in the array are fulfilled
+ * @param group The array of promises
+ * @return the promise that is fulfilled when all the array is fulfilled
+ */
+Promise.group = function(promiseList) {
+ if (!(promiseList instanceof Array)) {
+ promiseList = Array.prototype.slice.call(arguments);
+ }
+
+ // If the original array has nothing in it, return now to avoid waiting
+ if (promiseList.length === 0) {
+ return new Promise().resolve([]);
+ }
+
+ var groupPromise = new Promise();
+ var results = [];
+ var fulfilled = 0;
+
+ var onSuccessFactory = function(index) {
+ return function(data) {
+ results[index] = data;
+ fulfilled++;
+ // If the group has already failed, silently drop extra results
+ if (groupPromise._status !== ERROR) {
+ if (fulfilled === promiseList.length) {
+ groupPromise.resolve(results);
+ }
+ }
+ };
+ };
+
+ promiseList.forEach(function(promise, index) {
+ var onSuccess = onSuccessFactory(index);
+ var onError = groupPromise.reject.bind(groupPromise);
+ promise.then(onSuccess, onError);
+ });
+
+ return groupPromise;
+};
+
+exports.Promise = Promise;
+exports._outstanding = _outstanding;
+exports._recent = _recent;
+
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Mihai Sucan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/dom', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+var XHTML_NS = "http://www.w3.org/1999/xhtml";
+
+exports.createElement = function(tag, ns) {
+ return document.createElementNS ?
+ document.createElementNS(ns || XHTML_NS, tag) :
+ document.createElement(tag);
+};
+
+exports.setText = function(elem, text) {
+ if (elem.innerText !== undefined) {
+ elem.innerText = text;
+ }
+ if (elem.textContent !== undefined) {
+ elem.textContent = text;
+ }
+};
+
+if (!document.documentElement.classList) {
+ exports.hasCssClass = function(el, name) {
+ var classes = el.className.split(/\s+/g);
+ return classes.indexOf(name) !== -1;
+ };
+
+ /**
+ * Add a CSS class to the list of classes on the given node
+ */
+ exports.addCssClass = function(el, name) {
+ if (!exports.hasCssClass(el, name)) {
+ el.className += " " + name;
+ }
+ };
+
+ /**
+ * Remove a CSS class from the list of classes on the given node
+ */
+ exports.removeCssClass = function(el, name) {
+ var classes = el.className.split(/\s+/g);
+ while (true) {
+ var index = classes.indexOf(name);
+ if (index == -1) {
+ break;
+ }
+ classes.splice(index, 1);
+ }
+ el.className = classes.join(" ");
+ };
+
+ exports.toggleCssClass = function(el, name) {
+ var classes = el.className.split(/\s+/g), add = true;
+ while (true) {
+ var index = classes.indexOf(name);
+ if (index == -1) {
+ break;
+ }
+ add = false;
+ classes.splice(index, 1);
+ }
+ if(add)
+ classes.push(name);
+
+ el.className = classes.join(" ");
+ return add;
+ };
+} else {
+ exports.hasCssClass = function(el, name) {
+ return el.classList.contains(name);
+ };
+
+ exports.addCssClass = function(el, name) {
+ el.classList.add(name);
+ };
+
+ exports.removeCssClass = function(el, name) {
+ el.classList.remove(name);
+ };
+
+ exports.toggleCssClass = function(el, name) {
+ return el.classList.toggle(name);
+ };
+}
+
+/**
+ * Add or remove a CSS class from the list of classes on the given node
+ * depending on the value of include
+ */
+exports.setCssClass = function(node, className, include) {
+ if (include) {
+ exports.addCssClass(node, className);
+ } else {
+ exports.removeCssClass(node, className);
+ }
+};
+
+exports.importCssString = function(cssText, doc){
+ doc = doc || document;
+
+ if (doc.createStyleSheet) {
+ var sheet = doc.createStyleSheet();
+ sheet.cssText = cssText;
+ }
+ else {
+ var style = doc.createElementNS ?
+ doc.createElementNS(XHTML_NS, "style") :
+ doc.createElement("style");
+
+ style.appendChild(doc.createTextNode(cssText));
+
+ var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
+ head.appendChild(style);
+ }
+};
+
+exports.getInnerWidth = function(element) {
+ return (parseInt(exports.computedStyle(element, "paddingLeft"))
+ + parseInt(exports.computedStyle(element, "paddingRight")) + element.clientWidth);
+};
+
+exports.getInnerHeight = function(element) {
+ return (parseInt(exports.computedStyle(element, "paddingTop"))
+ + parseInt(exports.computedStyle(element, "paddingBottom")) + element.clientHeight);
+};
+
+if (window.pageYOffset !== undefined) {
+ exports.getPageScrollTop = function() {
+ return window.pageYOffset;
+ };
+
+ exports.getPageScrollLeft = function() {
+ return window.pageXOffset;
+ };
+}
+else {
+ exports.getPageScrollTop = function() {
+ return document.body.scrollTop;
+ };
+
+ exports.getPageScrollLeft = function() {
+ return document.body.scrollLeft;
+ };
+}
+
+if (window.getComputedStyle)
+ exports.computedStyle = function(element, style) {
+ if (style)
+ return (window.getComputedStyle(element, "") || {})[style] || "";
+ return window.getComputedStyle(element, "") || {}
+ };
+else
+ exports.computedStyle = function(element, style) {
+ if (style)
+ return element.currentStyle[style];
+ return element.currentStyle
+ };
+
+exports.scrollbarWidth = function() {
+
+ var inner = exports.createElement("p");
+ inner.style.width = "100%";
+ inner.style.minWidth = "0px";
+ inner.style.height = "200px";
+
+ var outer = exports.createElement("div");
+ var style = outer.style;
+
+ style.position = "absolute";
+ style.left = "-10000px";
+ style.overflow = "hidden";
+ style.width = "200px";
+ style.minWidth = "0px";
+ style.height = "150px";
+
+ outer.appendChild(inner);
+
+ var body = document.body || document.documentElement;
+ body.appendChild(outer);
+
+ var noScrollbar = inner.offsetWidth;
+
+ style.overflow = "scroll";
+ var withScrollbar = inner.offsetWidth;
+
+ if (noScrollbar == withScrollbar) {
+ withScrollbar = outer.clientWidth;
+ }
+
+ body.removeChild(outer);
+
+ return noScrollbar-withScrollbar;
+};
+
+/**
+ * Optimized set innerHTML. This is faster than plain innerHTML if the element
+ * already contains a lot of child elements.
+ *
+ * See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details
+ */
+exports.setInnerHtml = function(el, innerHtml) {
+ var element = el.cloneNode(false);//document.createElement("div");
+ element.innerHTML = innerHtml;
+ el.parentNode.replaceChild(element, el);
+ return element;
+};
+
+exports.setInnerText = function(el, innerText) {
+ if (document.body && "textContent" in document.body)
+ el.textContent = innerText;
+ else
+ el.innerText = innerText;
+
+};
+
+exports.getInnerText = function(el) {
+ if (document.body && "textContent" in document.body)
+ return el.textContent;
+ else
+ return el.innerText || el.textContent || "";
+};
+
+exports.getParentWindow = function(document) {
+ return document.defaultView || document.parentWindow;
+};
+
+exports.getSelectionStart = function(textarea) {
+ // TODO IE
+ var start;
+ try {
+ start = textarea.selectionStart || 0;
+ } catch (e) {
+ start = 0;
+ }
+ return start;
+};
+
+exports.setSelectionStart = function(textarea, start) {
+ // TODO IE
+ return textarea.selectionStart = start;
+};
+
+exports.getSelectionEnd = function(textarea) {
+ // TODO IE
+ var end;
+ try {
+ end = textarea.selectionEnd || 0;
+ } catch (e) {
+ end = 0;
+ }
+ return end;
+};
+
+exports.setSelectionEnd = function(textarea, end) {
+ // TODO IE
+ return textarea.selectionEnd = end;
+};
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/event', ['require', 'exports', 'module' , 'pilot/keys', 'pilot/useragent', 'pilot/dom'], function(require, exports, module) {
+
+var keys = require("pilot/keys");
+var useragent = require("pilot/useragent");
+var dom = require("pilot/dom");
+
+exports.addListener = function(elem, type, callback) {
+ if (elem.addEventListener) {
+ return elem.addEventListener(type, callback, false);
+ }
+ if (elem.attachEvent) {
+ var wrapper = function() {
+ callback(window.event);
+ };
+ callback._wrapper = wrapper;
+ elem.attachEvent("on" + type, wrapper);
+ }
+};
+
+exports.removeListener = function(elem, type, callback) {
+ if (elem.removeEventListener) {
+ return elem.removeEventListener(type, callback, false);
+ }
+ if (elem.detachEvent) {
+ elem.detachEvent("on" + type, callback._wrapper || callback);
+ }
+};
+
+/**
+* Prevents propagation and clobbers the default action of the passed event
+*/
+exports.stopEvent = function(e) {
+ exports.stopPropagation(e);
+ exports.preventDefault(e);
+ return false;
+};
+
+exports.stopPropagation = function(e) {
+ if (e.stopPropagation)
+ e.stopPropagation();
+ else
+ e.cancelBubble = true;
+};
+
+exports.preventDefault = function(e) {
+ if (e.preventDefault)
+ e.preventDefault();
+ else
+ e.returnValue = false;
+};
+
+exports.getDocumentX = function(e) {
+ if (e.clientX) {
+ return e.clientX + dom.getPageScrollLeft();
+ } else {
+ return e.pageX;
+ }
+};
+
+exports.getDocumentY = function(e) {
+ if (e.clientY) {
+ return e.clientY + dom.getPageScrollTop();
+ } else {
+ return e.pageY;
+ }
+};
+
+/**
+ * @return {Number} 0 for left button, 1 for middle button, 2 for right button
+ */
+exports.getButton = function(e) {
+ if (e.type == "dblclick")
+ return 0;
+ else if (e.type == "contextmenu")
+ return 2;
+
+ // DOM Event
+ if (e.preventDefault) {
+ return e.button;
+ }
+ // old IE
+ else {
+ return {1:0, 2:2, 4:1}[e.button];
+ }
+};
+
+if (document.documentElement.setCapture) {
+ exports.capture = function(el, eventHandler, releaseCaptureHandler) {
+ function onMouseMove(e) {
+ eventHandler(e);
+ return exports.stopPropagation(e);
+ }
+
+ function onReleaseCapture(e) {
+ eventHandler && eventHandler(e);
+ releaseCaptureHandler && releaseCaptureHandler();
+
+ exports.removeListener(el, "mousemove", eventHandler);
+ exports.removeListener(el, "mouseup", onReleaseCapture);
+ exports.removeListener(el, "losecapture", onReleaseCapture);
+
+ el.releaseCapture();
+ }
+
+ exports.addListener(el, "mousemove", eventHandler);
+ exports.addListener(el, "mouseup", onReleaseCapture);
+ exports.addListener(el, "losecapture", onReleaseCapture);
+ el.setCapture();
+ };
+}
+else {
+ exports.capture = function(el, eventHandler, releaseCaptureHandler) {
+ function onMouseMove(e) {
+ eventHandler(e);
+ e.stopPropagation();
+ }
+
+ function onMouseUp(e) {
+ eventHandler && eventHandler(e);
+ releaseCaptureHandler && releaseCaptureHandler();
+
+ document.removeEventListener("mousemove", onMouseMove, true);
+ document.removeEventListener("mouseup", onMouseUp, true);
+
+ e.stopPropagation();
+ }
+
+ document.addEventListener("mousemove", onMouseMove, true);
+ document.addEventListener("mouseup", onMouseUp, true);
+ };
+}
+
+exports.addMouseWheelListener = function(el, callback) {
+ var listener = function(e) {
+ if (e.wheelDelta !== undefined) {
+ if (e.wheelDeltaX !== undefined) {
+ e.wheelX = -e.wheelDeltaX / 8;
+ e.wheelY = -e.wheelDeltaY / 8;
+ } else {
+ e.wheelX = 0;
+ e.wheelY = -e.wheelDelta / 8;
+ }
+ }
+ else {
+ if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
+ e.wheelX = (e.detail || 0) * 5;
+ e.wheelY = 0;
+ } else {
+ e.wheelX = 0;
+ e.wheelY = (e.detail || 0) * 5;
+ }
+ }
+ callback(e);
+ };
+ exports.addListener(el, "DOMMouseScroll", listener);
+ exports.addListener(el, "mousewheel", listener);
+};
+
+exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) {
+ var clicks = 0;
+ var startX, startY;
+
+ var listener = function(e) {
+ clicks += 1;
+ if (clicks == 1) {
+ startX = e.clientX;
+ startY = e.clientY;
+
+ setTimeout(function() {
+ clicks = 0;
+ }, timeout || 600);
+ }
+
+ var isButton = exports.getButton(e) == button;
+ if (!isButton || Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5)
+ clicks = 0;
+
+ if (clicks == count) {
+ clicks = 0;
+ callback(e);
+ }
+
+ if (isButton)
+ return exports.preventDefault(e);
+ };
+
+ exports.addListener(el, "mousedown", listener);
+ useragent.isIE && exports.addListener(el, "dblclick", listener);
+};
+
+function normalizeCommandKeys(callback, e, keyCode) {
+ var hashId = 0;
+ if (useragent.isOpera && useragent.isMac) {
+ hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
+ | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
+ } else {
+ hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
+ | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
+ }
+
+ if (keyCode in keys.MODIFIER_KEYS) {
+ switch (keys.MODIFIER_KEYS[keyCode]) {
+ case "Alt":
+ hashId = 2;
+ break;
+ case "Shift":
+ hashId = 4;
+ break
+ case "Ctrl":
+ hashId = 1;
+ break;
+ default:
+ hashId = 8;
+ break;
+ }
+ keyCode = 0;
+ }
+
+ if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
+ keyCode = 0;
+ }
+
+ // If there is no hashID and the keyCode is not a function key, then
+ // we don't call the callback as we don't handle a command key here
+ // (it's a normal key/character input).
+ if (hashId == 0 && !(keyCode in keys.FUNCTION_KEYS)) {
+ return false;
+ }
+
+ return callback(e, hashId, keyCode);
+}
+
+exports.addCommandKeyListener = function(el, callback) {
+ var addListener = exports.addListener;
+ if (useragent.isOldGecko) {
+ // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
+ // event if the user pressed the key for a longer time. Instead, the
+ // keydown event was fired once and later on only the keypress event.
+ // To emulate the 'right' keydown behavior, the keyCode of the initial
+ // keyDown event is stored and in the following keypress events the
+ // stores keyCode is used to emulate a keyDown event.
+ var lastKeyDownKeyCode = null;
+ addListener(el, "keydown", function(e) {
+ lastKeyDownKeyCode = e.keyCode;
+ });
+ addListener(el, "keypress", function(e) {
+ return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
+ });
+ } else {
+ var lastDown = null;
+
+ addListener(el, "keydown", function(e) {
+ lastDown = e.keyIdentifier || e.keyCode;
+ return normalizeCommandKeys(callback, e, e.keyCode);
+ });
+
+ // repeated keys are fired as keypress and not keydown events
+ if (useragent.isMac && useragent.isOpera) {
+ addListener(el, "keypress", function(e) {
+ var keyId = e.keyIdentifier || e.keyCode;
+ if (lastDown !== keyId) {
+ return normalizeCommandKeys(callback, e, e.keyCode);
+ } else {
+ lastDown = null;
+ }
+ });
+ }
+ }
+};
+
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Irakli Gozalishvili (http://jeditoolkit.com)
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
+
+require("pilot/fixoldbrowsers");
+
+var oop = require("pilot/oop");
+var event = require("pilot/event");
+var lang = require("pilot/lang");
+var useragent = require("pilot/useragent");
+var TextInput = require("ace/keyboard/textinput").TextInput;
+var MouseHandler = require("ace/mouse_handler").MouseHandler;
+//var TouchHandler = require("ace/touch_handler").TouchHandler;
+var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
+var EditSession = require("ace/edit_session").EditSession;
+var Search = require("ace/search").Search;
+var Range = require("ace/range").Range;
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+
+var Editor =function(renderer, session) {
+ var container = renderer.getContainerElement();
+ this.container = container;
+ this.renderer = renderer;
+
+ this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
+ this.keyBinding = new KeyBinding(this);
+
+ // TODO detect touch event support
+ if (useragent.isIPad) {
+ //this.$mouseHandler = new TouchHandler(this);
+ } else {
+ this.$mouseHandler = new MouseHandler(this);
+ }
+
+ this.$blockScrolling = 0;
+ this.$search = new Search().set({
+ wrap: true
+ });
+
+ this.setSession(session || new EditSession(""));
+};
+
+(function(){
+
+ oop.implement(this, EventEmitter);
+
+ this.$forwardEvents = {
+ gutterclick: 1,
+ gutterdblclick: 1
+ };
+
+ this.$originalAddEventListener = this.addEventListener;
+ this.$originalRemoveEventListener = this.removeEventListener;
+
+ this.addEventListener = function(eventName, callback) {
+ if (this.$forwardEvents[eventName]) {
+ return this.renderer.addEventListener(eventName, callback);
+ } else {
+ return this.$originalAddEventListener(eventName, callback);
+ }
+ };
+
+ this.removeEventListener = function(eventName, callback) {
+ if (this.$forwardEvents[eventName]) {
+ return this.renderer.removeEventListener(eventName, callback);
+ } else {
+ return this.$originalRemoveEventListener(eventName, callback);
+ }
+ };
+
+ this.setKeyboardHandler = function(keyboardHandler) {
+ this.keyBinding.setKeyboardHandler(keyboardHandler);
+ };
+
+ this.getKeyboardHandler = function() {
+ return this.keyBinding.getKeyboardHandler();
+ };
+
+ this.setSession = function(session) {
+ if (this.session == session)
+ return;
+
+ if (this.session) {
+ var oldSession = this.session;
+ this.session.removeEventListener("change", this.$onDocumentChange);
+ this.session.removeEventListener("changeMode", this.$onChangeMode);
+ this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
+ this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
+ this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
+ this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
+ this.session.removeEventListener("onChangeFold", this.$onChangeFold);
+ this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
+ this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
+ this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
+ this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
+ this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
+
+ var selection = this.session.getSelection();
+ selection.removeEventListener("changeCursor", this.$onCursorChange);
+ selection.removeEventListener("changeSelection", this.$onSelectionChange);
+
+ this.session.setScrollTopRow(this.renderer.getScrollTopRow());
+ }
+
+ this.session = session;
+
+ this.$onDocumentChange = this.onDocumentChange.bind(this);
+ session.addEventListener("change", this.$onDocumentChange);
+ this.renderer.setSession(session);
+
+ this.$onChangeMode = this.onChangeMode.bind(this);
+ session.addEventListener("changeMode", this.$onChangeMode);
+
+ this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
+ session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
+
+ this.$onChangeTabSize = this.renderer.updateText.bind(this.renderer);
+ session.addEventListener("changeTabSize", this.$onChangeTabSize);
+
+ this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
+ session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
+
+ this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
+ session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
+
+ this.$onChangeFold = this.onChangeFold.bind(this);
+ session.addEventListener("changeFold", this.$onChangeFold);
+
+ this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
+ this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
+
+ this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
+ this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
+
+ this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
+ this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
+
+ this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
+ this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
+
+ this.$onCursorChange = this.onCursorChange.bind(this);
+ this.session.addEventListener("changeOverwrite", this.$onCursorChange);
+
+ this.selection = session.getSelection();
+ this.selection.addEventListener("changeCursor", this.$onCursorChange);
+
+ this.$onSelectionChange = this.onSelectionChange.bind(this);
+ this.selection.addEventListener("changeSelection", this.$onSelectionChange);
+
+ this.onChangeMode();
+
+ this.onCursorChange();
+ this.onSelectionChange();
+ this.onChangeFrontMarker();
+ this.onChangeBackMarker();
+ this.onChangeBreakpoint();
+ this.onChangeAnnotation();
+ this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
+ this.renderer.scrollToRow(session.getScrollTopRow());
+ this.renderer.updateFull();
+
+ this._dispatchEvent("changeSession", {
+ session: session,
+ oldSession: oldSession
+ });
+ };
+
+ this.getSession = function() {
+ return this.session;
+ };
+
+ this.getSelection = function() {
+ return this.selection;
+ };
+
+ this.resize = function() {
+ this.renderer.onResize();
+ };
+
+ this.setTheme = function(theme) {
+ this.renderer.setTheme(theme);
+ };
+
+ this.getTheme = function() {
+ return this.renderer.getTheme();
+ };
+
+ this.setStyle = function(style) {
+ this.renderer.setStyle(style);
+ };
+
+ this.unsetStyle = function(style) {
+ this.renderer.unsetStyle(style);
+ };
+
+ this.setFontSize = function(size) {
+ this.container.style.fontSize = size;
+ };
+
+ this.$highlightBrackets = function() {
+ if (this.session.$bracketHighlight) {
+ this.session.removeMarker(this.session.$bracketHighlight);
+ this.session.$bracketHighlight = null;
+ }
+
+ if (this.$highlightPending) {
+ return;
+ }
+
+ // perform highlight async to not block the browser during navigation
+ var self = this;
+ this.$highlightPending = true;
+ setTimeout(function() {
+ self.$highlightPending = false;
+
+ var pos = self.session.findMatchingBracket(self.getCursorPosition());
+ if (pos) {
+ var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
+ self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
+ }
+ }, 10);
+ };
+
+ this.focus = function() {
+ // Safari needs the timeout
+ // iOS and Firefox need it called immediately
+ // to be on the save side we do both
+ // except for IE
+ var _self = this;
+ if (!useragent.isIE) {
+ setTimeout(function() {
+ _self.textInput.focus();
+ });
+ }
+ this.textInput.focus();
+ };
+
+ this.isFocused = function() {
+ return this.textInput.isFocused();
+ };
+
+ this.blur = function() {
+ this.textInput.blur();
+ };
+
+ this.onFocus = function() {
+ this.renderer.showCursor();
+ this.renderer.visualizeFocus();
+ this._dispatchEvent("focus");
+ };
+
+ this.onBlur = function() {
+ this.renderer.hideCursor();
+ this.renderer.visualizeBlur();
+ this._dispatchEvent("blur");
+ };
+
+ this.onDocumentChange = function(e) {
+ var delta = e.data;
+ var range = delta.range;
+
+ if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
+ var lastRow = range.end.row;
+ else
+ lastRow = Infinity;
+ this.renderer.updateLines(range.start.row, lastRow);
+
+ // update cursor because tab characters can influence the cursor position
+ this.renderer.updateCursor();
+ };
+
+ this.onTokenizerUpdate = function(e) {
+ var rows = e.data;
+ this.renderer.updateLines(rows.first, rows.last);
+ };
+
+ this.onCursorChange = function(e) {
+ this.renderer.updateCursor();
+
+ if (!this.$blockScrolling) {
+ this.renderer.scrollCursorIntoView();
+ }
+
+ // move text input over the cursor
+ // this is required for iOS and IME
+ this.renderer.moveTextAreaToCursor(this.textInput.getElement());
+
+ this.$highlightBrackets();
+ this.$updateHighlightActiveLine();
+ };
+
+ this.$updateHighlightActiveLine = function() {
+ var session = this.getSession();
+
+ if (session.$highlightLineMarker) {
+ session.removeMarker(session.$highlightLineMarker);
+ }
+ session.$highlightLineMarker = null;
+
+ if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
+ var cursor = this.getCursorPosition(),
+ foldLine = this.session.getFoldLine(cursor.row);
+ var range;
+ if (foldLine) {
+ range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
+ } else {
+ range = new Range(cursor.row, 0, cursor.row+1, 0);
+ }
+ session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
+ }
+ };
+
+ this.onSelectionChange = function(e) {
+ var session = this.getSession();
+
+ if (session.$selectionMarker) {
+ session.removeMarker(session.$selectionMarker);
+ }
+ session.$selectionMarker = null;
+
+ if (!this.selection.isEmpty()) {
+ var range = this.selection.getRange();
+ var style = this.getSelectionStyle();
+ session.$selectionMarker = session.addMarker(range, "ace_selection", style);
+ } else {
+ this.$updateHighlightActiveLine();
+ }
+
+ if (this.$highlightSelectedWord)
+ this.session.getMode().highlightSelection(this);
+ };
+
+ this.onChangeFrontMarker = function() {
+ this.renderer.updateFrontMarkers();
+ };
+
+ this.onChangeBackMarker = function() {
+ this.renderer.updateBackMarkers();
+ };
+
+ this.onChangeBreakpoint = function() {
+ this.renderer.setBreakpoints(this.session.getBreakpoints());
+ };
+
+ this.onChangeAnnotation = function() {
+ this.renderer.setAnnotations(this.session.getAnnotations());
+ };
+
+ this.onChangeMode = function() {
+ this.renderer.updateText()
+ };
+
+ this.onChangeWrapLimit = function() {
+ this.renderer.updateFull();
+ };
+
+ this.onChangeWrapMode = function() {
+ this.renderer.onResize(true);
+ };
+
+ this.onChangeFold = function() {
+ // Update the active line marker as due to folding changes the current
+ // line range on the screen might have changed.
+ this.$updateHighlightActiveLine();
+ // TODO: This might be too much updating. Okay for now.
+ this.renderer.updateFull();
+ };
+
+ this.getCopyText = function() {
+ if (!this.selection.isEmpty()) {
+ return this.session.getTextRange(this.getSelectionRange());
+ }
+ else {
+ return "";
+ }
+ };
+
+ this.onCut = function() {
+ if (this.$readOnly)
+ return;
+
+ if (!this.selection.isEmpty()) {
+ this.session.remove(this.getSelectionRange())
+ this.clearSelection();
+ }
+ };
+
+ this.insert = function(text) {
+ if (this.$readOnly)
+ return;
+
+ var session = this.session;
+ var mode = session.getMode();
+
+ var cursor = this.getCursorPosition();
+
+ if (this.getBehavioursEnabled()) {
+ // Get a transform if the current mode wants one.
+ var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
+ if (transform)
+ text = transform.text;
+ }
+
+ text = text.replace("\t", this.session.getTabString());
+
+ // remove selected text
+ if (!this.selection.isEmpty()) {
+ var cursor = this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ }
+ else if (this.session.getOverwrite()) {
+ var range = new Range.fromPoints(cursor, cursor);
+ range.end.column += text.length;
+ this.session.remove(range);
+ }
+
+ this.clearSelection();
+
+ var start = cursor.column;
+ var lineState = session.getState(cursor.row);
+ var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
+ var line = session.getLine(cursor.row);
+ var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
+ var end = session.insert(cursor, text);
+
+ if (transform && transform.selection) {
+ if (transform.selection.length == 2) { // Transform relative to the current column
+ this.selection.setSelectionRange(
+ new Range(cursor.row, start + transform.selection[0],
+ cursor.row, start + transform.selection[1]));
+ } else { // Transform relative to the current row.
+ this.selection.setSelectionRange(
+ new Range(cursor.row + transform.selection[0],
+ transform.selection[1],
+ cursor.row + transform.selection[2],
+ transform.selection[3]));
+ }
+ }
+
+ var lineState = session.getState(cursor.row);
+
+ // TODO disabled multiline auto indent
+ // possibly doing the indent before inserting the text
+ // if (cursor.row !== end.row) {
+ if (session.getDocument().isNewLine(text)) {
+ this.moveCursorTo(cursor.row+1, 0);
+
+ var size = session.getTabSize();
+ var minIndent = Number.MAX_VALUE;
+
+ for (var row = cursor.row + 1; row <= end.row; ++row) {
+ var indent = 0;
+
+ line = session.getLine(row);
+ for (var i = 0; i < line.length; ++i)
+ if (line.charAt(i) == '\t')
+ indent += size;
+ else if (line.charAt(i) == ' ')
+ indent += 1;
+ else
+ break;
+ if (/[^\s]/.test(line))
+ minIndent = Math.min(indent, minIndent);
+ }
+
+ for (var row = cursor.row + 1; row <= end.row; ++row) {
+ var outdent = minIndent;
+
+ line = session.getLine(row);
+ for (var i = 0; i < line.length && outdent > 0; ++i)
+ if (line.charAt(i) == '\t')
+ outdent -= size;
+ else if (line.charAt(i) == ' ')
+ outdent -= 1;
+ session.remove(new Range(row, 0, row, i));
+ }
+ session.indentRows(cursor.row + 1, end.row, lineIndent);
+ } else {
+ if (shouldOutdent) {
+ mode.autoOutdent(lineState, session, cursor.row);
+ }
+ }
+ };
+
+ this.onTextInput = function(text, notPasted) {
+ // In case the text was not pasted and we got only one character, then
+ // handel it as a command key stroke.
+ if (notPasted && text.length == 1) {
+ // Note: The `null` as `keyCode` is important here, as there are
+ // some checks in the code for `keyCode == 0` meaning the text comes
+ // from the keyBinding.onTextInput code path.
+ var handled = this.keyBinding.onCommandKey({}, 0, null, text);
+
+ // Check if the text was handled. If not, then handled it as "normal"
+ // text and insert it to the editor directly. This shouldn't be done
+ // using the this.keyBinding.onTextInput(text) function, as it would
+ // make the `text` get sent to the keyboardHandler twice, which might
+ // turn out to be a bad thing in case there is a custome keyboard
+ // handler like the StateHandler.
+ if (!handled) {
+ this.insert(text);
+ }
+ } else {
+ this.keyBinding.onTextInput(text);
+ }
+ };
+
+ this.onCommandKey = function(e, hashId, keyCode) {
+ this.keyBinding.onCommandKey(e, hashId, keyCode);
+ };
+
+ this.setOverwrite = function(overwrite) {
+ this.session.setOverwrite(overwrite);
+ };
+
+ this.getOverwrite = function() {
+ return this.session.getOverwrite();
+ };
+
+ this.toggleOverwrite = function() {
+ this.session.toggleOverwrite();
+ };
+
+ this.setScrollSpeed = function(speed) {
+ this.$mouseHandler.setScrollSpeed(speed);
+ };
+
+ this.getScrollSpeed = function() {
+ return this.$mouseHandler.getScrollSpeed()
+ };
+
+ this.$selectionStyle = "line";
+ this.setSelectionStyle = function(style) {
+ if (this.$selectionStyle == style) return;
+
+ this.$selectionStyle = style;
+ this.onSelectionChange();
+ this._dispatchEvent("changeSelectionStyle", {data: style});
+ };
+
+ this.getSelectionStyle = function() {
+ return this.$selectionStyle;
+ };
+
+ this.$highlightActiveLine = true;
+ this.setHighlightActiveLine = function(shouldHighlight) {
+ if (this.$highlightActiveLine == shouldHighlight) return;
+
+ this.$highlightActiveLine = shouldHighlight;
+ this.$updateHighlightActiveLine();
+ };
+
+ this.getHighlightActiveLine = function() {
+ return this.$highlightActiveLine;
+ };
+
+ this.$highlightSelectedWord = true;
+ this.setHighlightSelectedWord = function(shouldHighlight) {
+ if (this.$highlightSelectedWord == shouldHighlight)
+ return;
+
+ this.$highlightSelectedWord = shouldHighlight;
+ if (shouldHighlight)
+ this.session.getMode().highlightSelection(this);
+ else
+ this.session.getMode().clearSelectionHighlight(this);
+ };
+
+ this.getHighlightSelectedWord = function() {
+ return this.$highlightSelectedWord;
+ };
+
+ this.setShowInvisibles = function(showInvisibles) {
+ if (this.getShowInvisibles() == showInvisibles)
+ return;
+
+ this.renderer.setShowInvisibles(showInvisibles);
+ };
+
+ this.getShowInvisibles = function() {
+ return this.renderer.getShowInvisibles();
+ };
+
+ this.setShowPrintMargin = function(showPrintMargin) {
+ this.renderer.setShowPrintMargin(showPrintMargin);
+ };
+
+ this.getShowPrintMargin = function() {
+ return this.renderer.getShowPrintMargin();
+ };
+
+ this.setPrintMarginColumn = function(showPrintMargin) {
+ this.renderer.setPrintMarginColumn(showPrintMargin);
+ };
+
+ this.getPrintMarginColumn = function() {
+ return this.renderer.getPrintMarginColumn();
+ };
+
+ this.$readOnly = false;
+ this.setReadOnly = function(readOnly) {
+ this.$readOnly = readOnly;
+ };
+
+ this.getReadOnly = function() {
+ return this.$readOnly;
+ };
+
+ this.$modeBehaviours = true;
+ this.setBehavioursEnabled = function (enabled) {
+ this.$modeBehaviours = enabled;
+ }
+
+ this.getBehavioursEnabled = function () {
+ return this.$modeBehaviours;
+ }
+
+ this.removeRight = function() {
+ if (this.$readOnly)
+ return;
+
+ if (this.selection.isEmpty()) {
+ this.selection.selectRight();
+ }
+ this.session.remove(this.getSelectionRange())
+ this.clearSelection();
+ };
+
+ this.removeLeft = function() {
+ if (this.$readOnly)
+ return;
+
+ if (this.selection.isEmpty())
+ this.selection.selectLeft();
+
+ var range = this.getSelectionRange();
+ if (this.getBehavioursEnabled()) {
+ var session = this.session;
+ var state = session.getState(range.start.row);
+ var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
+ if (new_range !== false) {
+ range = new_range;
+ }
+ }
+
+ this.session.remove(range);
+ this.clearSelection();
+ };
+
+ this.removeWordRight = function() {
+ if (this.$readOnly)
+ return;
+
+ if (this.selection.isEmpty())
+ this.selection.selectWordRight();
+
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ };
+
+ this.removeWordLeft = function() {
+ if (this.$readOnly)
+ return;
+
+ if (this.selection.isEmpty())
+ this.selection.selectWordLeft();
+
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ };
+
+ this.removeToLineStart = function() {
+ if (this.$readOnly)
+ return;
+
+ if (this.selection.isEmpty())
+ this.selection.selectLineStart();
+
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ };
+
+ this.removeToLineEnd = function() {
+ if (this.$readOnly)
+ return;
+
+ if (this.selection.isEmpty())
+ this.selection.selectLineEnd();
+
+ var range = this.getSelectionRange();
+ if (range.start.column == range.end.column && range.start.row == range.end.row) {
+ range.end.column = 0;
+ range.end.row++;
+ }
+
+ this.session.remove(range);
+ this.clearSelection();
+ };
+
+ this.splitLine = function() {
+ if (this.$readOnly)
+ return;
+
+ if (!this.selection.isEmpty()) {
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ }
+
+ var cursor = this.getCursorPosition();
+ this.insert("\n");
+ this.moveCursorToPosition(cursor);
+ };
+
+ this.transposeLetters = function() {
+ if (this.$readOnly)
+ return;
+
+ if (!this.selection.isEmpty()) {
+ return;
+ }
+
+ var cursor = this.getCursorPosition();
+ var column = cursor.column;
+ if (column == 0)
+ return;
+
+ var line = this.session.getLine(cursor.row);
+ if (column < line.length) {
+ var swap = line.charAt(column) + line.charAt(column-1);
+ var range = new Range(cursor.row, column-1, cursor.row, column+1)
+ }
+ else {
+ var swap = line.charAt(column-1) + line.charAt(column-2);
+ var range = new Range(cursor.row, column-2, cursor.row, column)
+ }
+ this.session.replace(range, swap);
+ };
+
+ this.indent = function() {
+ if (this.$readOnly)
+ return;
+
+ var session = this.session;
+ var range = this.getSelectionRange();
+
+ if (range.start.row < range.end.row || range.start.column < range.end.column) {
+ var rows = this.$getSelectedRows();
+ session.indentRows(rows.first, rows.last, "\t");
+ } else {
+ var indentString;
+
+ if (this.session.getUseSoftTabs()) {
+ var size = session.getTabSize(),
+ position = this.getCursorPosition(),
+ column = session.documentToScreenColumn(position.row, position.column),
+ count = (size - column % size);
+
+ indentString = lang.stringRepeat(" ", count);
+ } else
+ indentString = "\t";
+ return this.onTextInput(indentString);
+ }
+ };
+
+ this.blockOutdent = function() {
+ if (this.$readOnly)
+ return;
+
+ var selection = this.session.getSelection();
+ this.session.outdentRows(selection.getRange());
+ };
+
+ this.toggleCommentLines = function() {
+ if (this.$readOnly)
+ return;
+
+ var state = this.session.getState(this.getCursorPosition().row);
+ var rows = this.$getSelectedRows()
+ this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
+ };
+
+ this.removeLines = function() {
+ if (this.$readOnly)
+ return;
+
+ var rows = this.$getSelectedRows();
+ if (rows.last == 0 || rows.last+1 < this.session.getLength())
+ var range = new Range(rows.first, 0, rows.last+1, 0)
+ else
+ var range = new Range(
+ rows.first-1, this.session.getLine(rows.first).length,
+ rows.last, this.session.getLine(rows.last).length
+ );
+ this.session.remove(range);
+ this.clearSelection();
+ };
+
+ this.moveLinesDown = function() {
+ if (this.$readOnly)
+ return;
+
+ this.$moveLines(function(firstRow, lastRow) {
+ return this.session.moveLinesDown(firstRow, lastRow);
+ });
+ };
+
+ this.moveLinesUp = function() {
+ if (this.$readOnly)
+ return;
+
+ this.$moveLines(function(firstRow, lastRow) {
+ return this.session.moveLinesUp(firstRow, lastRow);
+ });
+ };
+
+ this.moveText = function(range, toPosition) {
+ if (this.$readOnly)
+ return null;
+
+ return this.session.moveText(range, toPosition);
+ };
+
+ this.copyLinesUp = function() {
+ if (this.$readOnly)
+ return;
+
+ this.$moveLines(function(firstRow, lastRow) {
+ this.session.duplicateLines(firstRow, lastRow);
+ return 0;
+ });
+ };
+
+ this.copyLinesDown = function() {
+ if (this.$readOnly)
+ return;
+
+ this.$moveLines(function(firstRow, lastRow) {
+ return this.session.duplicateLines(firstRow, lastRow);
+ });
+ };
+
+
+ this.$moveLines = function(mover) {
+ var rows = this.$getSelectedRows();
+
+ var linesMoved = mover.call(this, rows.first, rows.last);
+
+ var selection = this.selection;
+ selection.setSelectionAnchor(rows.last+linesMoved+1, 0);
+ selection.$moveSelection(function() {
+ selection.moveCursorTo(rows.first+linesMoved, 0);
+ });
+ };
+
+ this.$getSelectedRows = function() {
+ var range = this.getSelectionRange().collapseRows();
+
+ return {
+ first: range.start.row,
+ last: range.end.row
+ };
+ };
+
+ this.onCompositionStart = function(text) {
+ this.renderer.showComposition(this.getCursorPosition());
+ };
+
+ this.onCompositionUpdate = function(text) {
+ this.renderer.setCompositionText(text);
+ };
+
+ this.onCompositionEnd = function() {
+ this.renderer.hideComposition();
+ };
+
+
+ this.getFirstVisibleRow = function() {
+ return this.renderer.getFirstVisibleRow();
+ };
+
+ this.getLastVisibleRow = function() {
+ return this.renderer.getLastVisibleRow();
+ };
+
+ this.isRowVisible = function(row) {
+ return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
+ };
+
+ this.$getVisibleRowCount = function() {
+ return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
+ };
+
+ this.$getPageDownRow = function() {
+ return this.renderer.getScrollBottomRow();
+ };
+
+ this.$getPageUpRow = function() {
+ var firstRow = this.renderer.getScrollTopRow();
+ var lastRow = this.renderer.getScrollBottomRow();
+
+ return firstRow - (lastRow - firstRow);
+ };
+
+ this.selectPageDown = function() {
+ var row = this.$getPageDownRow() + Math.floor(this.$getVisibleRowCount() / 2);
+
+ this.scrollPageDown();
+
+ var selection = this.getSelection();
+ var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
+ var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
+ selection.selectTo(dest.row, dest.column);
+ };
+
+ this.selectPageUp = function() {
+ var visibleRows = this.renderer.getScrollTopRow() - this.renderer.getScrollBottomRow();
+ var row = this.$getPageUpRow() + Math.round(visibleRows / 2);
+
+ this.scrollPageUp();
+
+ var selection = this.getSelection();
+ var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
+ var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
+ selection.selectTo(dest.row, dest.column);
+ };
+
+ this.gotoPageDown = function() {
+ var row = this.$getPageDownRow();
+ var column = this.getCursorPositionScreen().column;
+
+ this.scrollToRow(row);
+ this.getSelection().moveCursorToScreen(row, column);
+ };
+
+ this.gotoPageUp = function() {
+ var row = this.$getPageUpRow();
+ var column = this.getCursorPositionScreen().column;
+
+ this.scrollToRow(row);
+ this.getSelection().moveCursorToScreen(row, column);
+ };
+
+ this.scrollPageDown = function() {
+ this.scrollToRow(this.$getPageDownRow());
+ };
+
+ this.scrollPageUp = function() {
+ this.renderer.scrollToRow(this.$getPageUpRow());
+ };
+
+ this.scrollToRow = function(row) {
+ this.renderer.scrollToRow(row);
+ };
+
+ this.scrollToLine = function(line, center) {
+ this.renderer.scrollToLine(line, center);
+ };
+
+ this.centerSelection = function() {
+ var range = this.getSelectionRange();
+ var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
+ this.renderer.scrollToLine(line, true);
+ };
+
+ this.getCursorPosition = function() {
+ return this.selection.getCursor();
+ };
+
+ this.getCursorPositionScreen = function() {
+ return this.session.documentToScreenPosition(this.getCursorPosition());
+ };
+
+ this.getSelectionRange = function() {
+ return this.selection.getRange();
+ };
+
+
+ this.selectAll = function() {
+ this.$blockScrolling += 1;
+ this.selection.selectAll();
+ this.$blockScrolling -= 1;
+ };
+
+ this.clearSelection = function() {
+ this.selection.clearSelection();
+ };
+
+ this.moveCursorTo = function(row, column) {
+ this.selection.moveCursorTo(row, column);
+ };
+
+ this.moveCursorToPosition = function(pos) {
+ this.selection.moveCursorToPosition(pos);
+ };
+
+
+ this.gotoLine = function(lineNumber, column) {
+ this.selection.clearSelection();
+
+ this.$blockScrolling += 1;
+ this.moveCursorTo(lineNumber-1, column || 0);
+ this.$blockScrolling -= 1;
+
+ if (!this.isRowVisible(this.getCursorPosition().row)) {
+ this.scrollToLine(lineNumber, true);
+ }
+ },
+
+ this.navigateTo = function(row, column) {
+ this.clearSelection();
+ this.moveCursorTo(row, column);
+ };
+
+ this.navigateUp = function(times) {
+ this.selection.clearSelection();
+ times = times || 1;
+ this.selection.moveCursorBy(-times, 0);
+ };
+
+ this.navigateDown = function(times) {
+ this.selection.clearSelection();
+ times = times || 1;
+ this.selection.moveCursorBy(times, 0);
+ };
+
+ this.navigateLeft = function(times) {
+ if (!this.selection.isEmpty()) {
+ var selectionStart = this.getSelectionRange().start;
+ this.moveCursorToPosition(selectionStart);
+ }
+ else {
+ times = times || 1;
+ while (times--) {
+ this.selection.moveCursorLeft();
+ }
+ }
+ this.clearSelection();
+ };
+
+ this.navigateRight = function(times) {
+ if (!this.selection.isEmpty()) {
+ var selectionEnd = this.getSelectionRange().end;
+ this.moveCursorToPosition(selectionEnd);
+ }
+ else {
+ times = times || 1;
+ while (times--) {
+ this.selection.moveCursorRight();
+ }
+ }
+ this.clearSelection();
+ };
+
+ this.navigateLineStart = function() {
+ this.selection.moveCursorLineStart();
+ this.clearSelection();
+ };
+
+ this.navigateLineEnd = function() {
+ this.selection.moveCursorLineEnd();
+ this.clearSelection();
+ };
+
+ this.navigateFileEnd = function() {
+ this.selection.moveCursorFileEnd();
+ this.clearSelection();
+ };
+
+ this.navigateFileStart = function() {
+ this.selection.moveCursorFileStart();
+ this.clearSelection();
+ };
+
+ this.navigateWordRight = function() {
+ this.selection.moveCursorWordRight();
+ this.clearSelection();
+ };
+
+ this.navigateWordLeft = function() {
+ this.selection.moveCursorWordLeft();
+ this.clearSelection();
+ };
+
+ this.replace = function(replacement, options) {
+ if (options)
+ this.$search.set(options);
+
+ var range = this.$search.find(this.session);
+ if (!range)
+ return;
+
+ this.$tryReplace(range, replacement);
+ if (range !== null)
+ this.selection.setSelectionRange(range);
+ },
+
+ this.replaceAll = function(replacement, options) {
+ if (options) {
+ this.$search.set(options);
+ }
+
+ var ranges = this.$search.findAll(this.session);
+ if (!ranges.length)
+ return;
+
+ var selection = this.getSelectionRange();
+ this.clearSelection();
+ this.selection.moveCursorTo(0, 0);
+
+ this.$blockScrolling += 1;
+ for (var i = ranges.length - 1; i >= 0; --i)
+ this.$tryReplace(ranges[i], replacement);
+
+ this.selection.setSelectionRange(selection);
+ this.$blockScrolling -= 1;
+ },
+
+ this.$tryReplace = function(range, replacement) {
+ var input = this.session.getTextRange(range);
+ var replacement = this.$search.replace(input, replacement);
+ if (replacement !== null) {
+ range.end = this.session.replace(range, replacement);
+ return range;
+ } else {
+ return null;
+ }
+ };
+
+ this.getLastSearchOptions = function() {
+ return this.$search.getOptions();
+ };
+
+ this.find = function(needle, options) {
+ this.clearSelection();
+ options = options || {};
+ options.needle = needle;
+ this.$search.set(options);
+ this.$find();
+ },
+
+ this.findNext = function(options) {
+ options = options || {};
+ if (typeof options.backwards == "undefined")
+ options.backwards = false;
+ this.$search.set(options);
+ this.$find();
+ };
+
+ this.findPrevious = function(options) {
+ options = options || {};
+ if (typeof options.backwards == "undefined")
+ options.backwards = true;
+ this.$search.set(options);
+ this.$find();
+ };
+
+ this.$find = function(backwards) {
+ if (!this.selection.isEmpty()) {
+ this.$search.set({needle: this.session.getTextRange(this.getSelectionRange())});
+ }
+
+ if (typeof backwards != "undefined")
+ this.$search.set({backwards: backwards});
+
+ var range = this.$search.find(this.session);
+ if (range) {
+ this.gotoLine(range.end.row+1, range.end.column);
+ this.selection.setSelectionRange(range);
+ }
+ };
+
+ this.undo = function() {
+ this.session.getUndoManager().undo();
+ };
+
+ this.redo = function() {
+ this.session.getUndoManager().redo();
+ };
+
+ this.destroy = function() {
+ this.renderer.destroy();
+ }
+
+}).call(Editor.prototype);
+
+
+exports.Editor = Editor;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Mihai Sucan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/keyboard/textinput', ['require', 'exports', 'module' , 'pilot/event', 'pilot/useragent', 'pilot/dom'], function(require, exports, module) {
+
+var event = require("pilot/event");
+var useragent = require("pilot/useragent");
+var dom = require("pilot/dom");
+
+var TextInput = function(parentNode, host) {
+
+ var text = dom.createElement("textarea");
+ text.style.left = "-10000px";
+ parentNode.appendChild(text);
+
+ var PLACEHOLDER = String.fromCharCode(0);
+ sendText();
+
+ var inCompostion = false;
+ var copied = false;
+ var pasted = false;
+ var tempStyle = '';
+
+ function sendText(valueToSend) {
+ if (!copied) {
+ var value = valueToSend || text.value;
+ if (value) {
+ if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) {
+ value = value.slice(0, -1);
+ if (value)
+ host.onTextInput(value, !pasted);
+ }
+ else {
+ host.onTextInput(value, !pasted);
+ }
+
+ // If editor is no longer focused we quit immediately, since
+ // it means that something else is in charge now.
+ if (!isFocused())
+ return false;
+ }
+ }
+
+ copied = false;
+ pasted = false;
+
+ // Safari doesn't fire copy events if no text is selected
+ text.value = PLACEHOLDER;
+ text.select();
+ }
+
+ var onTextInput = function(e) {
+ setTimeout(function () {
+ if (!inCompostion)
+ sendText(e.data);
+ }, 0);
+ };
+
+ var onKeyPress = function(e) {
+ if (useragent.isIE && text.value.charCodeAt(0) > 128) return;
+ setTimeout(function() {
+ if (!inCompostion)
+ sendText();
+ }, 0);
+ };
+
+ var onCompositionStart = function(e) {
+ inCompostion = true;
+ host.onCompositionStart();
+ if (!useragent.isGecko) setTimeout(onCompositionUpdate, 0);
+ };
+
+ var onCompositionUpdate = function() {
+ if (!inCompostion) return;
+ host.onCompositionUpdate(text.value);
+ };
+
+ var onCompositionEnd = function(e) {
+ inCompostion = false;
+ host.onCompositionEnd();
+ };
+
+ var onCopy = function(e) {
+ copied = true;
+ var copyText = host.getCopyText();
+ if(copyText)
+ text.value = copyText;
+ else
+ e.preventDefault();
+ text.select();
+ setTimeout(function () {
+ sendText();
+ }, 0);
+ };
+
+ var onCut = function(e) {
+ copied = true;
+ var copyText = host.getCopyText();
+ if(copyText) {
+ text.value = copyText;
+ host.onCut();
+ } else
+ e.preventDefault();
+ text.select();
+ setTimeout(function () {
+ sendText();
+ }, 0);
+ };
+
+ event.addCommandKeyListener(text, host.onCommandKey.bind(host));
+ if (useragent.isIE) {
+ var keytable = { 13:1, 27:1 };
+ event.addListener(text, "keyup", function (e) {
+ if (inCompostion && (!text.value || keytable[e.keyCode]))
+ setTimeout(onCompositionEnd, 0);
+ if ((text.value.charCodeAt(0)|0) < 129) {
+ return;
+ };
+ inCompostion ? onCompositionUpdate() : onCompositionStart();
+ });
+ };
+
+ if (text.attachEvent) {
+ // Old IE + Opera
+ event.addListener(text, "propertychange", onKeyPress);
+ }
+ else {
+ if (useragent.isChrome || useragent.isSafari)
+ event.addListener(text, "textInput", onTextInput);
+ else if (useragent.isIE)
+ // IE9
+ event.addListener(text, "textinput", onTextInput);
+ else
+ // All browsers except old IE
+ event.addListener(text, "input", onTextInput);
+ }
+
+
+ event.addListener(text, "paste", function(e) {
+ // Mark that the next input text comes from past.
+ pasted = true;
+ // Some browsers support the event.clipboardData API. Use this to get
+ // the pasted content which increases speed if pasting a lot of lines.
+ if (e.clipboardData && e.clipboardData.getData) {
+ sendText(e.clipboardData.getData("text/plain"));
+ e.preventDefault();
+ }
+ else {
+ // If a browser doesn't support any of the things above, use the regular
+ // method to detect the pasted input.
+ onKeyPress();
+ }
+ });
+
+ if (useragent.isIE) {
+ event.addListener(text, "beforecopy", function(e) {
+ var copyText = host.getCopyText();
+ if(copyText)
+ clipboardData.setData("Text", copyText);
+ else
+ e.preventDefault();
+ });
+ event.addListener(parentNode, "keydown", function(e) {
+ if (e.ctrlKey && e.keyCode == 88) {
+ var copyText = host.getCopyText();
+ if (copyText) {
+ clipboardData.setData("Text", copyText);
+ host.onCut();
+ }
+ event.preventDefault(e)
+ }
+ });
+ }
+ else {
+ event.addListener(text, "copy", onCopy);
+ event.addListener(text, "cut", onCut);
+ }
+
+ event.addListener(text, "compositionstart", onCompositionStart);
+ if (useragent.isGecko) {
+ event.addListener(text, "text", onCompositionUpdate);
+ };
+ if (useragent.isWebKit) {
+ event.addListener(text, "keyup", onCompositionUpdate);
+ };
+ event.addListener(text, "compositionend", onCompositionEnd);
+
+ event.addListener(text, "blur", function() {
+ host.onBlur();
+ });
+
+ event.addListener(text, "focus", function() {
+ host.onFocus();
+ text.select();
+ });
+
+ this.focus = function() {
+ host.onFocus();
+ text.select();
+ text.focus();
+ };
+
+ this.blur = function() {
+ text.blur();
+ };
+
+ function isFocused() {
+ return document.activeElement === text;
+ };
+ this.isFocused = isFocused;
+
+ this.getElement = function() {
+ return text;
+ };
+
+ this.onContextMenu = function(mousePos, isEmpty){
+ if (mousePos) {
+ if(!tempStyle)
+ tempStyle = text.style.cssText;
+ text.style.cssText = 'position:fixed; z-index:1000;' +
+ 'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;'
+
+ }
+ if (isEmpty)
+ text.value='';
+ }
+
+ this.onContextMenuClose = function(){
+ setTimeout(function () {
+ if (tempStyle) {
+ text.style.cssText = tempStyle;
+ tempStyle = '';
+ }
+ sendText();
+ }, 0);
+ }
+};
+
+exports.TextInput = TextInput;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Mihai Sucan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/browser_focus'], function(require, exports, module) {
+
+var event = require("pilot/event");
+var dom = require("pilot/dom");
+var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
+
+var STATE_UNKNOWN = 0;
+var STATE_SELECT = 1;
+var STATE_DRAG = 2;
+
+var DRAG_TIMER = 250; // milliseconds
+var DRAG_OFFSET = 5; // pixels
+
+var MouseHandler = function(editor) {
+ this.editor = editor;
+
+ this.browserFocus = new BrowserFocus();
+ event.addListener(editor.container, "mousedown", function(e) {
+ editor.focus();
+ return event.preventDefault(e);
+ });
+ event.addListener(editor.container, "selectstart", function(e) {
+ return event.preventDefault(e);
+ });
+
+ var mouseTarget = editor.renderer.getMouseEventTarget();
+ event.addListener(mouseTarget, "mousedown", this.onMouseDown.bind(this));
+ event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
+ event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
+ event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
+ event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this));
+};
+
+(function() {
+
+ this.$scrollSpeed = 1;
+ this.setScrollSpeed = function(speed) {
+ this.$scrollSpeed = speed;
+ };
+
+ this.getScrollSpeed = function() {
+ return this.$scrollSpeed;
+ };
+
+ this.$getEventPosition = function(e) {
+ var pageX = event.getDocumentX(e);
+ var pageY = event.getDocumentY(e);
+ var pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
+ pos.row = Math.max(0, Math.min(pos.row, this.editor.session.getLength()-1));
+ return pos;
+ };
+
+ this.$distance = function(ax, ay, bx, by) {
+ return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
+ };
+
+ this.onMouseDown = function(e) {
+ // if this click caused the editor to be focused ignore the click
+ // for selection and cursor placement
+ if (
+ !this.browserFocus.isFocused()
+ || new Date().getTime() - this.browserFocus.lastFocus < 20
+ || !this.editor.isFocused()
+ )
+ return;
+
+ var pageX = event.getDocumentX(e);
+ var pageY = event.getDocumentY(e);
+ var pos = this.$getEventPosition(e);
+ var editor = this.editor;
+ var self = this;
+ var selectionRange = editor.getSelectionRange();
+ var selectionEmpty = selectionRange.isEmpty();
+ var state = STATE_UNKNOWN;
+ var inSelection = false;
+
+ var button = event.getButton(e);
+ if (button !== 0) {
+ if (selectionEmpty) {
+ editor.moveCursorToPosition(pos);
+ }
+ if(button == 2) {
+ editor.textInput.onContextMenu({x: pageX, y: pageY}, selectionEmpty);
+ event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
+ }
+ return;
+ } else {
+ // Select the fold as the user clicks it.
+ var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
+ if (fold) {
+ editor.selection.setSelectionRange(fold.range);
+ return;
+ }
+
+ inSelection = !editor.getReadOnly()
+ && !selectionEmpty
+ && selectionRange.contains(pos.row, pos.column);
+ }
+
+ if (!inSelection) {
+ // Directly pick STATE_SELECT, since the user is not clicking inside
+ // a selection.
+ onStartSelect(pos);
+ }
+
+ var mousePageX, mousePageY;
+ var overwrite = editor.getOverwrite();
+ var mousedownTime = (new Date()).getTime();
+ var dragCursor, dragRange;
+
+ var onMouseSelection = function(e) {
+ mousePageX = event.getDocumentX(e);
+ mousePageY = event.getDocumentY(e);
+ };
+
+ var onMouseSelectionEnd = function() {
+ clearInterval(timerId);
+ if (state == STATE_UNKNOWN)
+ onStartSelect(pos);
+ else if (state == STATE_DRAG)
+ onMouseDragSelectionEnd();
+
+ self.$clickSelection = null;
+ state = STATE_UNKNOWN;
+ };
+
+ var onMouseDragSelectionEnd = function() {
+ dom.removeCssClass(editor.container, "ace_dragging");
+ editor.session.removeMarker(dragSelectionMarker);
+
+ if (!self.$clickSelection) {
+ if (!dragCursor) {
+ editor.moveCursorToPosition(pos);
+ editor.selection.clearSelection(pos.row, pos.column);
+ }
+ }
+
+ if (!dragCursor)
+ return;
+
+ if (dragRange.contains(dragCursor.row, dragCursor.column)) {
+ dragCursor = null;
+ return;
+ }
+
+ editor.clearSelection();
+ var newRange = editor.moveText(dragRange, dragCursor);
+ if (!newRange) {
+ dragCursor = null;
+ return;
+ }
+
+ editor.selection.setSelectionRange(newRange);
+ };
+
+ var onSelectionInterval = function() {
+ if (mousePageX === undefined || mousePageY === undefined)
+ return;
+
+ if (state == STATE_UNKNOWN) {
+ var distance = self.$distance(pageX, pageY, mousePageX, mousePageY);
+ var time = (new Date()).getTime();
+
+
+ if (distance > DRAG_OFFSET) {
+ state = STATE_SELECT;
+ var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
+ cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
+ onStartSelect(cursor);
+ } else if ((time - mousedownTime) > DRAG_TIMER) {
+ state = STATE_DRAG;
+ dragRange = editor.getSelectionRange();
+ var style = editor.getSelectionStyle();
+ dragSelectionMarker = editor.session.addMarker(dragRange, "ace_selection", style);
+ editor.clearSelection();
+ dom.addCssClass(editor.container, "ace_dragging");
+ }
+
+ }
+
+ if (state == STATE_DRAG)
+ onDragSelectionInterval();
+ else if (state == STATE_SELECT)
+ onUpdateSelectionInterval();
+ };
+
+ function onStartSelect(pos) {
+ if (e.shiftKey)
+ editor.selection.selectToPosition(pos)
+ else {
+ if (!self.$clickSelection) {
+ editor.moveCursorToPosition(pos);
+ editor.selection.clearSelection(pos.row, pos.column);
+ }
+ }
+ state = STATE_SELECT;
+ }
+
+ var onUpdateSelectionInterval = function() {
+ var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
+ cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
+
+ if (self.$clickSelection) {
+ if (self.$clickSelection.contains(cursor.row, cursor.column)) {
+ editor.selection.setSelectionRange(self.$clickSelection);
+ } else {
+ if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
+ var anchor = self.$clickSelection.end;
+ } else {
+ var anchor = self.$clickSelection.start;
+ }
+ editor.selection.setSelectionAnchor(anchor.row, anchor.column);
+ editor.selection.selectToPosition(cursor);
+ }
+ }
+ else {
+ editor.selection.selectToPosition(cursor);
+ }
+
+ editor.renderer.scrollCursorIntoView();
+ };
+
+ var onDragSelectionInterval = function() {
+ dragCursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
+ dragCursor.row = Math.max(0, Math.min(dragCursor.row,
+ editor.session.getLength() - 1));
+
+ editor.moveCursorToPosition(dragCursor);
+ };
+
+ event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
+ var timerId = setInterval(onSelectionInterval, 20);
+
+ return event.preventDefault(e);
+ };
+
+ this.onMouseDoubleClick = function(e) {
+ var editor = this.editor;
+ var pos = this.$getEventPosition(e);
+
+ // If the user dclicked on a fold, then expand it.
+ var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
+ if (fold) {
+ editor.session.expandFold(fold);
+ } else {
+ editor.moveCursorToPosition(pos);
+ editor.selection.selectWord();
+ this.$clickSelection = editor.getSelectionRange();
+ }
+ };
+
+ this.onMouseTripleClick = function(e) {
+ var pos = this.$getEventPosition(e);
+ this.editor.moveCursorToPosition(pos);
+ this.editor.selection.selectLine();
+ this.$clickSelection = this.editor.getSelectionRange();
+ };
+
+ this.onMouseQuadClick = function(e) {
+ this.editor.selectAll();
+ this.$clickSelection = this.editor.getSelectionRange();
+ };
+
+ this.onMouseWheel = function(e) {
+ var speed = this.$scrollSpeed * 2;
+
+ this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
+ return event.preventDefault(e);
+ };
+
+
+}).call(MouseHandler.prototype);
+
+exports.MouseHandler = MouseHandler;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Irakli Gozalishvili (http://jeditoolkit.com)
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('pilot/browser_focus', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event', 'pilot/event_emitter'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var event = require("pilot/event");
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+
+/**
+ * This class keeps track of the focus state of the given window.
+ * Focus changes for example when the user switches a browser tab,
+ * goes to the location bar or switches to another application.
+ */
+var BrowserFocus = function(win) {
+ win = win || window;
+
+ this.lastFocus = new Date().getTime();
+ this._isFocused = true;
+
+ var _self = this;
+ event.addListener(win, "blur", function(e) {
+ _self._setFocused(false);
+ });
+
+ event.addListener(win, "focus", function(e) {
+ _self._setFocused(true);
+ });
+};
+
+(function(){
+
+ oop.implement(this, EventEmitter);
+
+ this.isFocused = function() {
+ return this._isFocused;
+ };
+
+ this._setFocused = function(isFocused) {
+ if (this._isFocused == isFocused)
+ return;
+
+ if (isFocused)
+ this.lastFocus = new Date().getTime();
+
+ this._isFocused = isFocused;
+ this._emit("changeFocus");
+ };
+
+}).call(BrowserFocus.prototype);
+
+
+exports.BrowserFocus = BrowserFocus;
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/keyboard/keybinding', ['require', 'exports', 'module' , 'pilot/useragent', 'pilot/keys', 'pilot/event', 'pilot/settings', 'pilot/canon', 'ace/commands/default_commands'], function(require, exports, module) {
+
+var useragent = require("pilot/useragent");
+var keyUtil = require("pilot/keys");
+var event = require("pilot/event");
+var settings = require("pilot/settings").settings;
+var canon = require("pilot/canon");
+require("ace/commands/default_commands");
+
+var KeyBinding = function(editor) {
+ this.$editor = editor;
+ this.$data = { };
+ this.$keyboardHandler = null;
+};
+
+(function() {
+ this.setKeyboardHandler = function(keyboardHandler) {
+ if (this.$keyboardHandler != keyboardHandler) {
+ this.$data = { };
+ this.$keyboardHandler = keyboardHandler;
+ }
+ };
+
+ this.getKeyboardHandler = function() {
+ return this.$keyboardHandler;
+ };
+
+ this.$callKeyboardHandler = function (e, hashId, keyOrText, keyCode) {
+ var env = {editor: this.$editor},
+ toExecute;
+
+ if (this.$keyboardHandler) {
+ toExecute =
+ this.$keyboardHandler.handleKeyboard(this.$data, hashId, keyOrText, keyCode, e);
+ }
+
+ // If there is nothing to execute yet, then use the default keymapping.
+ if (!toExecute || !toExecute.command) {
+ if (hashId != 0 || keyCode != 0) {
+ toExecute = {
+ command: canon.findKeyCommand(env, "editor", hashId, keyOrText)
+ }
+ } else {
+ toExecute = {
+ command: "inserttext",
+ args: {
+ text: keyOrText
+ }
+ }
+ }
+ }
+
+ var success = false;
+ if (toExecute) {
+ success = canon.exec(toExecute.command,
+ env, "editor", toExecute.args);
+ if (success) {
+ event.stopEvent(e);
+ }
+ }
+ return success;
+ };
+
+ this.onCommandKey = function(e, hashId, keyCode, keyString) {
+ // In case there is no keyString, try to interprete the keyCode.
+ if (!keyString) {
+ keyString = keyUtil.keyCodeToString(keyCode);
+ }
+ return this.$callKeyboardHandler(e, hashId, keyString, keyCode);
+ };
+
+ this.onTextInput = function(text) {
+ return this.$callKeyboardHandler({}, 0, text, 0);
+ }
+
+}).call(KeyBinding.prototype);
+
+exports.KeyBinding = KeyBinding;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Julian Viereck
+ * Mihai Sucan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/commands/default_commands', ['require', 'exports', 'module' , 'pilot/lang', 'pilot/canon'], function(require, exports, module) {
+
+var lang = require("pilot/lang");
+var canon = require("pilot/canon");
+
+function bindKey(win, mac) {
+ return {
+ win: win,
+ mac: mac,
+ sender: "editor"
+ };
+}
+
+canon.addCommand({
+ name: "null",
+ exec: function(env, args, request) { }
+});
+
+canon.addCommand({
+ name: "selectall",
+ bindKey: bindKey("Ctrl-A", "Command-A"),
+ exec: function(env, args, request) { env.editor.selectAll(); }
+});
+canon.addCommand({
+ name: "removeline",
+ bindKey: bindKey("Ctrl-D", "Command-D"),
+ exec: function(env, args, request) { env.editor.removeLines(); }
+});
+canon.addCommand({
+ name: "gotoline",
+ bindKey: bindKey("Ctrl-L", "Command-L"),
+ exec: function(env, args, request) {
+ var line = parseInt(prompt("Enter line number:"));
+ if (!isNaN(line)) {
+ env.editor.gotoLine(line);
+ }
+ }
+});
+canon.addCommand({
+ name: "togglecomment",
+ bindKey: bindKey("Ctrl-7", "Command-7"),
+ exec: function(env, args, request) { env.editor.toggleCommentLines(); }
+});
+canon.addCommand({
+ name: "findnext",
+ bindKey: bindKey("Ctrl-K", "Command-G"),
+ exec: function(env, args, request) { env.editor.findNext(); }
+});
+canon.addCommand({
+ name: "findprevious",
+ bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
+ exec: function(env, args, request) { env.editor.findPrevious(); }
+});
+canon.addCommand({
+ name: "find",
+ bindKey: bindKey("Ctrl-F", "Command-F"),
+ exec: function(env, args, request) {
+ var needle = prompt("Find:");
+ env.editor.find(needle);
+ }
+});
+canon.addCommand({
+ name: "replace",
+ bindKey: bindKey("Ctrl-R", "Command-Option-F"),
+ exec: function(env, args, request) {
+ var needle = prompt("Find:");
+ if (!needle)
+ return;
+ var replacement = prompt("Replacement:");
+ if (!replacement)
+ return;
+ env.editor.replace(replacement, {needle: needle});
+ }
+});
+canon.addCommand({
+ name: "replaceall",
+ bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
+ exec: function(env, args, request) {
+ var needle = prompt("Find:");
+ if (!needle)
+ return;
+ var replacement = prompt("Replacement:");
+ if (!replacement)
+ return;
+ env.editor.replaceAll(replacement, {needle: needle});
+ }
+});
+canon.addCommand({
+ name: "undo",
+ bindKey: bindKey("Ctrl-Z", "Command-Z"),
+ exec: function(env, args, request) { env.editor.undo(); }
+});
+canon.addCommand({
+ name: "redo",
+ bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
+ exec: function(env, args, request) { env.editor.redo(); }
+});
+canon.addCommand({
+ name: "overwrite",
+ bindKey: bindKey("Insert", "Insert"),
+ exec: function(env, args, request) { env.editor.toggleOverwrite(); }
+});
+canon.addCommand({
+ name: "copylinesup",
+ bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
+ exec: function(env, args, request) { env.editor.copyLinesUp(); }
+});
+canon.addCommand({
+ name: "movelinesup",
+ bindKey: bindKey("Alt-Up", "Option-Up"),
+ exec: function(env, args, request) { env.editor.moveLinesUp(); }
+});
+canon.addCommand({
+ name: "selecttostart",
+ bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
+ exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
+});
+canon.addCommand({
+ name: "gotostart",
+ bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
+ exec: function(env, args, request) { env.editor.navigateFileStart(); }
+});
+canon.addCommand({
+ name: "selectup",
+ bindKey: bindKey("Shift-Up", "Shift-Up"),
+ exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
+});
+canon.addCommand({
+ name: "golineup",
+ bindKey: bindKey("Up", "Up|Ctrl-P"),
+ exec: function(env, args, request) { env.editor.navigateUp(args.times); }
+});
+canon.addCommand({
+ name: "copylinesdown",
+ bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
+ exec: function(env, args, request) { env.editor.copyLinesDown(); }
+});
+canon.addCommand({
+ name: "movelinesdown",
+ bindKey: bindKey("Alt-Down", "Option-Down"),
+ exec: function(env, args, request) { env.editor.moveLinesDown(); }
+});
+canon.addCommand({
+ name: "selecttoend",
+ bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
+ exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
+});
+canon.addCommand({
+ name: "gotoend",
+ bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
+ exec: function(env, args, request) { env.editor.navigateFileEnd(); }
+});
+canon.addCommand({
+ name: "selectdown",
+ bindKey: bindKey("Shift-Down", "Shift-Down"),
+ exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
+});
+canon.addCommand({
+ name: "golinedown",
+ bindKey: bindKey("Down", "Down|Ctrl-N"),
+ exec: function(env, args, request) { env.editor.navigateDown(args.times); }
+});
+canon.addCommand({
+ name: "selectwordleft",
+ bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
+ exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
+});
+canon.addCommand({
+ name: "gotowordleft",
+ bindKey: bindKey("Ctrl-Left", "Option-Left"),
+ exec: function(env, args, request) { env.editor.navigateWordLeft(); }
+});
+canon.addCommand({
+ name: "selecttolinestart",
+ bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
+ exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
+});
+canon.addCommand({
+ name: "gotolinestart",
+ bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
+ exec: function(env, args, request) { env.editor.navigateLineStart(); }
+});
+canon.addCommand({
+ name: "selectleft",
+ bindKey: bindKey("Shift-Left", "Shift-Left"),
+ exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
+});
+canon.addCommand({
+ name: "gotoleft",
+ bindKey: bindKey("Left", "Left|Ctrl-B"),
+ exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
+});
+canon.addCommand({
+ name: "selectwordright",
+ bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
+ exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
+});
+canon.addCommand({
+ name: "gotowordright",
+ bindKey: bindKey("Ctrl-Right", "Option-Right"),
+ exec: function(env, args, request) { env.editor.navigateWordRight(); }
+});
+canon.addCommand({
+ name: "selecttolineend",
+ bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
+ exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
+});
+canon.addCommand({
+ name: "gotolineend",
+ bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
+ exec: function(env, args, request) { env.editor.navigateLineEnd(); }
+});
+canon.addCommand({
+ name: "selectright",
+ bindKey: bindKey("Shift-Right", "Shift-Right"),
+ exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
+});
+canon.addCommand({
+ name: "gotoright",
+ bindKey: bindKey("Right", "Right|Ctrl-F"),
+ exec: function(env, args, request) { env.editor.navigateRight(args.times); }
+});
+canon.addCommand({
+ name: "selectpagedown",
+ bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
+ exec: function(env, args, request) { env.editor.selectPageDown(); }
+});
+canon.addCommand({
+ name: "pagedown",
+ bindKey: bindKey(null, "PageDown"),
+ exec: function(env, args, request) { env.editor.scrollPageDown(); }
+});
+canon.addCommand({
+ name: "gotopagedown",
+ bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
+ exec: function(env, args, request) { env.editor.gotoPageDown(); }
+});
+canon.addCommand({
+ name: "selectpageup",
+ bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
+ exec: function(env, args, request) { env.editor.selectPageUp(); }
+});
+canon.addCommand({
+ name: "pageup",
+ bindKey: bindKey(null, "PageUp"),
+ exec: function(env, args, request) { env.editor.scrollPageUp(); }
+});
+canon.addCommand({
+ name: "gotopageup",
+ bindKey: bindKey("PageUp", "Option-PageUp"),
+ exec: function(env, args, request) { env.editor.gotoPageUp(); }
+});
+canon.addCommand({
+ name: "selectlinestart",
+ bindKey: bindKey("Shift-Home", "Shift-Home"),
+ exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
+});
+canon.addCommand({
+ name: "selectlineend",
+ bindKey: bindKey("Shift-End", "Shift-End"),
+ exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
+});
+canon.addCommand({
+ name: "del",
+ bindKey: bindKey("Delete", "Delete|Ctrl-D"),
+ exec: function(env, args, request) { env.editor.removeRight(); }
+});
+canon.addCommand({
+ name: "backspace",
+ bindKey: bindKey(
+ "Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
+ "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
+ ),
+ exec: function(env, args, request) { env.editor.removeLeft(); }
+});
+canon.addCommand({
+ name: "removetolinestart",
+ bindKey: bindKey(null, "Option-Backspace"),
+ exec: function(env, args, request) { env.editor.removeToLineStart(); }
+});
+canon.addCommand({
+ name: "removetolineend",
+ bindKey: bindKey(null, "Ctrl-K"),
+ exec: function(env, args, request) { env.editor.removeToLineEnd(); }
+});
+canon.addCommand({
+ name: "removewordleft",
+ bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
+ exec: function(env, args, request) { env.editor.removeWordLeft(); }
+});
+canon.addCommand({
+ name: "removewordright",
+ bindKey: bindKey(null, "Alt-Delete"),
+ exec: function(env, args, request) { env.editor.removeWordRight(); }
+});
+canon.addCommand({
+ name: "outdent",
+ bindKey: bindKey("Shift-Tab", "Shift-Tab"),
+ exec: function(env, args, request) { env.editor.blockOutdent(); }
+});
+canon.addCommand({
+ name: "indent",
+ bindKey: bindKey("Tab", "Tab"),
+ exec: function(env, args, request) { env.editor.indent(); }
+});
+canon.addCommand({
+ name: "inserttext",
+ exec: function(env, args, request) {
+ env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
+ }
+});
+canon.addCommand({
+ name: "centerselection",
+ bindKey: bindKey(null, "Ctrl-L"),
+ exec: function(env, args, request) { env.editor.centerSelection(); }
+});
+canon.addCommand({
+ name: "splitline",
+ bindKey: bindKey(null, "Ctrl-O"),
+ exec: function(env, args, request) { env.editor.splitLine(); }
+});
+canon.addCommand({
+ name: "transposeletters",
+ bindKey: bindKey("Ctrl-T", "Ctrl-T"),
+ exec: function(env, args, request) { env.editor.transposeLetters(); }
+});
+
+});/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Mihai Sucan
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/edit_session', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'pilot/event_emitter', 'ace/selection', 'ace/mode/text', 'ace/range', 'ace/document', 'ace/background_tokenizer', 'ace/edit_session/folding'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var lang = require("pilot/lang");
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+var Selection = require("ace/selection").Selection;
+var TextMode = require("ace/mode/text").Mode;
+var Range = require("ace/range").Range;
+var Document = require("ace/document").Document;
+var BackgroundTokenizer = require("ace/background_tokenizer").BackgroundTokenizer;
+
+var EditSession = function(text, mode) {
+ this.$modified = true;
+ this.$breakpoints = [];
+ this.$frontMarkers = {};
+ this.$backMarkers = {};
+ this.$markerId = 1;
+ this.$rowCache = [];
+ this.$wrapData = [];
+ this.$foldData = [];
+ this.$foldData.toString = function() {
+ var str = "";
+ this.forEach(function(foldLine) {
+ str += "\n" + foldLine.toString();
+ });
+ return str;
+ }
+
+ if (text instanceof Document) {
+ this.setDocument(text);
+ } else {
+ this.setDocument(new Document(text));
+ }
+
+ this.selection = new Selection(this);
+ if (mode)
+ this.setMode(mode);
+ else
+ this.setMode(new TextMode());
+};
+
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.setDocument = function(doc) {
+ if (this.doc)
+ throw new Error("Document is already set");
+
+ this.doc = doc;
+ doc.on("change", this.onChange.bind(this));
+ this.on("changeFold", this.onChangeFold.bind(this));
+ };
+
+ this.getDocument = function() {
+ return this.doc;
+ };
+
+ this.$resetRowCache = function(row) {
+ if (row == 0) {
+ this.$rowCache = [];
+ return;
+ }
+ var rowCache = this.$rowCache;
+ for (var i = 0; i < rowCache.length; i++) {
+ if (rowCache[i].docRow >= row) {
+ rowCache.splice(i, rowCache.length);
+ return;
+ }
+ }
+ };
+
+ this.onChangeFold = function(e) {
+ var fold = e.data;
+ this.$resetRowCache(fold.start.row);
+ };
+
+ this.onChange = function(e) {
+ var delta = e.data;
+ this.$modified = true;
+
+ this.$resetRowCache(delta.range.start.row);
+
+ var removedFolds = this.$updateInternalDataOnChange(e);
+ if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
+ this.$deltasDoc.push(delta);
+ if (removedFolds && removedFolds.length != 0) {
+ this.$deltasFold.push({
+ action: "removeFolds",
+ folds: removedFolds
+ });
+ }
+
+ this.$informUndoManager.schedule();
+ }
+
+ this.bgTokenizer.start(delta.range.start.row);
+ this._dispatchEvent("change", e);
+ };
+
+ this.setValue = function(text) {
+ this.doc.setValue(text);
+ this.selection.moveCursorTo(0, 0);
+ this.selection.clearSelection();
+
+ this.$resetRowCache(0);
+ this.$deltas = [];
+ this.$deltasDoc = [];
+ this.$deltasFold = [];
+ this.getUndoManager().reset();
+ };
+
+ this.getValue =
+ this.toString = function() {
+ return this.doc.getValue();
+ };
+
+ this.getSelection = function() {
+ return this.selection;
+ };
+
+ this.getState = function(row) {
+ return this.bgTokenizer.getState(row);
+ };
+
+ this.getTokens = function(firstRow, lastRow) {
+ return this.bgTokenizer.getTokens(firstRow, lastRow);
+ };
+
+ this.setUndoManager = function(undoManager) {
+ this.$undoManager = undoManager;
+ this.$resetRowCache(0);
+ this.$deltas = [];
+ this.$deltasDoc = [];
+ this.$deltasFold = [];
+
+ if (this.$informUndoManager)
+ this.$informUndoManager.cancel();
+
+ if (undoManager) {
+ var self = this;
+ this.$syncInformUndoManager = function() {
+ self.$informUndoManager.cancel();
+
+ if (self.$deltasFold.length) {
+ self.$deltas.push({
+ group: "fold",
+ deltas: self.$deltasFold
+ });
+ self.$deltasFold = [];
+ }
+
+ if (self.$deltasDoc.length) {
+ self.$deltas.push({
+ group: "doc",
+ deltas: self.$deltasDoc
+ });
+ self.$deltasDoc = [];
+ }
+
+ if (self.$deltas.length > 0) {
+ undoManager.execute({
+ action: "aceupdate",
+ args: [self.$deltas, self]
+ });
+ }
+
+ self.$deltas = [];
+ }
+ this.$informUndoManager =
+ lang.deferredCall(this.$syncInformUndoManager);
+ }
+ };
+
+ this.$defaultUndoManager = {
+ undo: function() {},
+ redo: function() {},
+ reset: function() {}
+ };
+
+ this.getUndoManager = function() {
+ return this.$undoManager || this.$defaultUndoManager;
+ },
+
+ this.getTabString = function() {
+ if (this.getUseSoftTabs()) {
+ return lang.stringRepeat(" ", this.getTabSize());
+ } else {
+ return "\t";
+ }
+ };
+
+ this.$useSoftTabs = true;
+ this.setUseSoftTabs = function(useSoftTabs) {
+ if (this.$useSoftTabs === useSoftTabs) return;
+
+ this.$useSoftTabs = useSoftTabs;
+ };
+
+ this.getUseSoftTabs = function() {
+ return this.$useSoftTabs;
+ };
+
+ this.$tabSize = 4;
+ this.setTabSize = function(tabSize) {
+ if (isNaN(tabSize) || this.$tabSize === tabSize) return;
+
+ this.$modified = true;
+ this.$tabSize = tabSize;
+ this._dispatchEvent("changeTabSize");
+ };
+
+ this.getTabSize = function() {
+ return this.$tabSize;
+ };
+
+ this.isTabStop = function(position) {
+ return this.$useSoftTabs && (position.column % this.$tabSize == 0);
+ };
+
+ this.$overwrite = false;
+ this.setOverwrite = function(overwrite) {
+ if (this.$overwrite == overwrite) return;
+
+ this.$overwrite = overwrite;
+ this._dispatchEvent("changeOverwrite");
+ };
+
+ this.getOverwrite = function() {
+ return this.$overwrite;
+ };
+
+ this.toggleOverwrite = function() {
+ this.setOverwrite(!this.$overwrite);
+ };
+
+ this.getBreakpoints = function() {
+ return this.$breakpoints;
+ };
+
+ this.setBreakpoints = function(rows) {
+ this.$breakpoints = [];
+ for (var i=0; i 0) {
+ inToken = !!line.charAt(column - 1).match(this.tokenRe);
+ }
+
+ if (!inToken) {
+ inToken = !!line.charAt(column).match(this.tokenRe);
+ }
+
+ var re = inToken ? this.tokenRe : this.nonTokenRe;
+
+ var start = column;
+ if (start > 0) {
+ do {
+ start--;
+ }
+ while (start >= 0 && line.charAt(start).match(re));
+ start++;
+ }
+
+ var end = column;
+ while (end < line.length && line.charAt(end).match(re)) {
+ end++;
+ }
+
+ return new Range(row, start, row, end);
+ };
+
+ this.setNewLineMode = function(newLineMode) {
+ this.doc.setNewLineMode(newLineMode);
+ };
+
+ this.getNewLineMode = function() {
+ return this.doc.getNewLineMode();
+ };
+
+ this.$useWorker = true;
+ this.setUseWorker = function(useWorker) {
+ if (this.$useWorker == useWorker)
+ return;
+
+ this.$useWorker = useWorker;
+
+ this.$stopWorker();
+ if (useWorker)
+ this.$startWorker();
+ };
+
+ this.getUseWorker = function() {
+ return this.$useWorker;
+ };
+
+ this.onReloadTokenizer = function(e) {
+ var rows = e.data;
+ this.bgTokenizer.start(rows.first);
+ this._dispatchEvent("tokenizerUpdate", e);
+ };
+
+ this.$mode = null;
+ this.setMode = function(mode) {
+ if (this.$mode === mode) return;
+ this.$mode = mode;
+
+ this.$stopWorker();
+
+ if (this.$useWorker)
+ this.$startWorker();
+
+ var tokenizer = mode.getTokenizer();
+
+ if(tokenizer.addEventListener !== undefined) {
+ var onReloadTokenizer = this.onReloadTokenizer.bind(this);
+ tokenizer.addEventListener("update", onReloadTokenizer);
+ }
+
+ if (!this.bgTokenizer) {
+ this.bgTokenizer = new BackgroundTokenizer(tokenizer);
+ var _self = this;
+ this.bgTokenizer.addEventListener("update", function(e) {
+ _self._dispatchEvent("tokenizerUpdate", e);
+ });
+ } else {
+ this.bgTokenizer.setTokenizer(tokenizer);
+ }
+
+ this.bgTokenizer.setDocument(this.getDocument());
+ this.bgTokenizer.start(0);
+
+ this.tokenRe = mode.tokenRe;
+ this.nonTokenRe = mode.nonTokenRe;
+
+ this._dispatchEvent("changeMode");
+ };
+
+ this.$stopWorker = function() {
+ if (this.$worker)
+ this.$worker.terminate();
+
+ this.$worker = null;
+ };
+
+ this.$startWorker = function() {
+ if (typeof Worker !== "undefined" && !require.noWorker) {
+ try {
+ this.$worker = this.$mode.createWorker(this);
+ } catch (e) {
+ console.log("Could not load worker");
+ console.log(e);
+ this.$worker = null;
+ }
+ }
+ else
+ this.$worker = null;
+ };
+
+ this.getMode = function() {
+ return this.$mode;
+ };
+
+ this.$scrollTop = 0;
+ this.setScrollTopRow = function(scrollTopRow) {
+ if (this.$scrollTop === scrollTopRow) return;
+
+ this.$scrollTop = scrollTopRow;
+ this._dispatchEvent("changeScrollTop");
+ };
+
+ this.getScrollTopRow = function() {
+ return this.$scrollTop;
+ };
+
+ this.getWidth = function() {
+ this.$computeWidth();
+ return this.width;
+ };
+
+ this.getScreenWidth = function() {
+ this.$computeWidth();
+ return this.screenWidth;
+ };
+
+ this.$computeWidth = function(force) {
+ if (this.$modified || force) {
+ this.$modified = false;
+
+ var lines = this.doc.getAllLines();
+ var longestLine = 0;
+ var longestScreenLine = 0;
+
+ for ( var i = 0; i < lines.length; i++) {
+ var foldLine = this.getFoldLine(i),
+ line, len;
+
+ line = lines[i];
+ if (foldLine) {
+ var end = foldLine.range.end;
+ line = this.getFoldDisplayLine(foldLine);
+ // Continue after the foldLine.end.row. All the lines in
+ // between are folded.
+ i = end.row;
+ }
+ len = line.length;
+ longestLine = Math.max(longestLine, len);
+ if (!this.$useWrapMode) {
+ longestScreenLine = Math.max(
+ longestScreenLine,
+ this.$getStringScreenWidth(line)[0]
+ );
+ }
+ }
+ this.width = longestLine;
+
+ if (this.$useWrapMode) {
+ this.screenWidth = this.$wrapLimit;
+ } else {
+ this.screenWidth = longestScreenLine;
+ }
+ }
+ };
+
+ /**
+ * Get a verbatim copy of the given line as it is in the document
+ */
+ this.getLine = function(row) {
+ return this.doc.getLine(row);
+ };
+
+ this.getLines = function(firstRow, lastRow) {
+ return this.doc.getLines(firstRow, lastRow);
+ };
+
+ this.getLength = function() {
+ return this.doc.getLength();
+ };
+
+ this.getTextRange = function(range) {
+ return this.doc.getTextRange(range);
+ };
+
+ this.findMatchingBracket = function(position) {
+ if (position.column == 0) return null;
+
+ var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
+ if (charBeforeCursor == "") return null;
+
+ var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
+ if (!match) {
+ return null;
+ }
+
+ if (match[1]) {
+ return this.$findClosingBracket(match[1], position);
+ } else {
+ return this.$findOpeningBracket(match[2], position);
+ }
+ };
+
+ this.$brackets = {
+ ")": "(",
+ "(": ")",
+ "]": "[",
+ "[": "]",
+ "{": "}",
+ "}": "{"
+ };
+
+ this.$findOpeningBracket = function(bracket, position) {
+ var openBracket = this.$brackets[bracket];
+
+ var column = position.column - 2;
+ var row = position.row;
+ var depth = 1;
+
+ var line = this.getLine(row);
+
+ while (true) {
+ while(column >= 0) {
+ var ch = line.charAt(column);
+ if (ch == openBracket) {
+ depth -= 1;
+ if (depth == 0) {
+ return {row: row, column: column};
+ }
+ }
+ else if (ch == bracket) {
+ depth +=1;
+ }
+ column -= 1;
+ }
+ row -=1;
+ if (row < 0) break;
+
+ var line = this.getLine(row);
+ var column = line.length-1;
+ }
+ return null;
+ };
+
+ this.$findClosingBracket = function(bracket, position) {
+ var closingBracket = this.$brackets[bracket];
+
+ var column = position.column;
+ var row = position.row;
+ var depth = 1;
+
+ var line = this.getLine(row);
+ var lineCount = this.getLength();
+
+ while (true) {
+ while(column < line.length) {
+ var ch = line.charAt(column);
+ if (ch == closingBracket) {
+ depth -= 1;
+ if (depth == 0) {
+ return {row: row, column: column};
+ }
+ }
+ else if (ch == bracket) {
+ depth +=1;
+ }
+ column += 1;
+ }
+ row +=1;
+ if (row >= lineCount) break;
+
+ var line = this.getLine(row);
+ var column = 0;
+ }
+ return null;
+ };
+
+ this.insert = function(position, text) {
+ return this.doc.insert(position, text);
+ };
+
+ this.remove = function(range) {
+ return this.doc.remove(range);
+ };
+
+ this.undoChanges = function(deltas, dontSelect) {
+ if (!deltas.length)
+ return;
+
+ this.$fromUndo = true;
+ var lastUndoRange = null;
+ for (var i = deltas.length - 1; i != -1; i--) {
+ delta = deltas[i];
+ if (delta.group == "doc") {
+ this.doc.revertDeltas(delta.deltas);
+ lastUndoRange =
+ this.$getUndoSelection(delta.deltas, true, lastUndoRange);
+ } else {
+ delta.deltas.forEach(function(foldDelta) {
+ this.addFolds(foldDelta.folds);
+ }, this);
+ }
+ }
+ this.$fromUndo = false;
+ lastUndoRange &&
+ !dontSelect &&
+ this.selection.setSelectionRange(lastUndoRange);
+ return lastUndoRange;
+ },
+
+ this.redoChanges = function(deltas, dontSelect) {
+ if (!deltas.length)
+ return;
+
+ this.$fromUndo = true;
+ var lastUndoRange = null;
+ for (var i = 0; i < deltas.length; i++) {
+ delta = deltas[i];
+ if (delta.group == "doc") {
+ this.doc.applyDeltas(delta.deltas);
+ lastUndoRange =
+ this.$getUndoSelection(delta.deltas, false, lastUndoRange);
+ }
+ }
+ this.$fromUndo = false;
+ lastUndoRange &&
+ !dontSelect &&
+ this.selection.setSelectionRange(lastUndoRange);
+ return lastUndoRange;
+ },
+
+ this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
+ function isInsert(delta) {
+ var insert =
+ delta.action == "insertText" || delta.action == "insertLines";
+ return isUndo ? !insert : insert;
+ }
+
+ var delta = deltas[0];
+ var range, point;
+ var lastDeltaIsInsert = false;
+ if (isInsert(delta)) {
+ range = delta.range.clone();
+ lastDeltaIsInsert = true;
+ } else {
+ range = Range.fromPoints(delta.range.start, delta.range.start);
+ lastDeltaIsInsert = false;
+ }
+
+ for (var i = 1; i < deltas.length; i++) {
+ delta = deltas[i];
+ if (isInsert(delta)) {
+ point = delta.range.start;
+ if (range.compare(point.row, point.column) == -1) {
+ range.setStart(delta.range.start);
+ }
+ point = delta.range.end;
+ if (range.compare(point.row, point.column) == 1) {
+ range.setEnd(delta.range.end);
+ }
+ lastDeltaIsInsert = true;
+ } else {
+ point = delta.range.start;
+ if (range.compare(point.row, point.column) == -1) {
+ range =
+ Range.fromPoints(delta.range.start, delta.range.start);
+ }
+ lastDeltaIsInsert = false;
+ }
+ }
+
+ // Check if this range and the last undo range has something in common.
+ // If true, merge the ranges.
+ if (lastUndoRange != null) {
+ var cmp = lastUndoRange.compareRange(range);
+ if (cmp == 1) {
+ range.setStart(lastUndoRange.start);
+ } else if (cmp == -1) {
+ range.setEnd(lastUndoRange.end);
+ }
+ }
+
+ return range;
+ },
+
+ this.replace = function(range, text) {
+ return this.doc.replace(range, text);
+ };
+
+ /**
+ * Move a range of text from the given range to the given position.
+ *
+ * @param fromRange {Range} The range of text you want moved within the
+ * document.
+ * @param toPosition {Object} The location (row and column) where you want
+ * to move the text to.
+ * @return {Range} The new range where the text was moved to.
+ */
+ this.moveText = function(fromRange, toPosition) {
+ var text = this.getTextRange(fromRange);
+ this.remove(fromRange);
+
+ var toRow = toPosition.row;
+ var toColumn = toPosition.column;
+
+ // Make sure to update the insert location, when text is removed in
+ // front of the chosen point of insertion.
+ if (!fromRange.isMultiLine() && fromRange.start.row == toRow &&
+ fromRange.end.column < toColumn)
+ toColumn -= text.length;
+
+ if (fromRange.isMultiLine() && fromRange.end.row < toRow) {
+ var lines = this.doc.$split(text);
+ toRow -= lines.length - 1;
+ }
+
+ var endRow = toRow + fromRange.end.row - fromRange.start.row;
+ var endColumn = fromRange.isMultiLine() ?
+ fromRange.end.column :
+ toColumn + fromRange.end.column - fromRange.start.column;
+
+ var toRange = new Range(toRow, toColumn, endRow, endColumn);
+
+ this.insert(toRange.start, text);
+
+ return toRange;
+ };
+
+ this.indentRows = function(startRow, endRow, indentString) {
+ indentString = indentString.replace(/\t/g, this.getTabString());
+ for (var row=startRow; row<=endRow; row++) {
+ this.insert({row: row, column:0}, indentString);
+ }
+ };
+
+ this.outdentRows = function (range) {
+ var rowRange = range.collapseRows();
+ var deleteRange = new Range(0, 0, 0, 0);
+ var size = this.getTabSize();
+
+ for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
+ var line = this.getLine(i);
+
+ deleteRange.start.row = i;
+ deleteRange.end.row = i;
+ for (var j = 0; j < size; ++j)
+ if (line.charAt(j) != ' ')
+ break;
+ if (j < size && line.charAt(j) == '\t') {
+ deleteRange.start.column = j;
+ deleteRange.end.column = j + 1;
+ } else {
+ deleteRange.start.column = 0;
+ deleteRange.end.column = j;
+ }
+ this.remove(deleteRange);
+ }
+ };
+
+ this.moveLinesUp = function(firstRow, lastRow) {
+ if (firstRow <= 0) return 0;
+
+ var removed = this.doc.removeLines(firstRow, lastRow);
+ this.doc.insertLines(firstRow - 1, removed);
+ return -1;
+ };
+
+ this.moveLinesDown = function(firstRow, lastRow) {
+ if (lastRow >= this.doc.getLength()-1) return 0;
+
+ var removed = this.doc.removeLines(firstRow, lastRow);
+ this.doc.insertLines(firstRow+1, removed);
+ return 1;
+ };
+
+ this.duplicateLines = function(firstRow, lastRow) {
+ var firstRow = this.$clipRowToDocument(firstRow);
+ var lastRow = this.$clipRowToDocument(lastRow);
+
+ var lines = this.getLines(firstRow, lastRow);
+ this.doc.insertLines(firstRow, lines);
+
+ var addedRows = lastRow - firstRow + 1;
+ return addedRows;
+ };
+
+ this.$clipRowToDocument = function(row) {
+ return Math.max(0, Math.min(row, this.doc.getLength()-1));
+ };
+
+ this.$clipPositionToDocument = function(row, column) {
+ column = Math.max(0, column);
+
+ if (row < 0) {
+ row = 0;
+ column = 0;
+ } else {
+ var len = this.doc.getLength();
+ if (row >= len) {
+ row = len - 1;
+ column = this.doc.getLine(len-1).length;
+ } else {
+ column = Math.min(this.doc.getLine(row).length, column);
+ }
+ }
+
+ return {
+ row: row,
+ column: column
+ };
+ };
+
+ // WRAPMODE
+ this.$wrapLimit = 80;
+ this.$useWrapMode = false;
+ this.$wrapLimitRange = {
+ min : null,
+ max : null
+ };
+
+ this.setUseWrapMode = function(useWrapMode) {
+ if (useWrapMode != this.$useWrapMode) {
+ this.$useWrapMode = useWrapMode;
+ this.$modified = true;
+ this.$resetRowCache(0);
+
+ // If wrapMode is activaed, the wrapData array has to be initialized.
+ if (useWrapMode) {
+ var len = this.getLength();
+ this.$wrapData = [];
+ for (i = 0; i < len; i++) {
+ this.$wrapData.push([]);
+ }
+ this.$updateWrapData(0, len - 1);
+ }
+
+ this._dispatchEvent("changeWrapMode");
+ }
+ };
+
+ this.getUseWrapMode = function() {
+ return this.$useWrapMode;
+ };
+
+ // Allow the wrap limit to move freely between min and max. Either
+ // parameter can be null to allow the wrap limit to be unconstrained
+ // in that direction. Or set both parameters to the same number to pin
+ // the limit to that value.
+ this.setWrapLimitRange = function(min, max) {
+ if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
+ this.$wrapLimitRange.min = min;
+ this.$wrapLimitRange.max = max;
+ this.$modified = true;
+ // This will force a recalculation of the wrap limit
+ this._dispatchEvent("changeWrapMode");
+ }
+ };
+
+ // This should generally only be called by the renderer when a resize
+ // is detected.
+ this.adjustWrapLimit = function(desiredLimit) {
+ var wrapLimit = this.$constrainWrapLimit(desiredLimit);
+ if (wrapLimit != this.$wrapLimit && wrapLimit > 0) {
+ this.$wrapLimit = wrapLimit;
+ this.$modified = true;
+ if (this.$useWrapMode) {
+ this.$updateWrapData(0, this.getLength() - 1);
+ this.$resetRowCache(0)
+ this._dispatchEvent("changeWrapLimit");
+ }
+ return true;
+ }
+ return false;
+ };
+
+ this.$constrainWrapLimit = function(wrapLimit) {
+ var min = this.$wrapLimitRange.min;
+ if (min)
+ wrapLimit = Math.max(min, wrapLimit);
+
+ var max = this.$wrapLimitRange.max;
+ if (max)
+ wrapLimit = Math.min(max, wrapLimit);
+
+ // What would a limit of 0 even mean?
+ return Math.max(1, wrapLimit);
+ };
+
+ this.getWrapLimit = function() {
+ return this.$wrapLimit;
+ };
+
+ this.getWrapLimitRange = function() {
+ // Avoid unexpected mutation by returning a copy
+ return {
+ min : this.$wrapLimitRange.min,
+ max : this.$wrapLimitRange.max
+ };
+ };
+
+ this.$updateInternalDataOnChange = function(e) {
+ var useWrapMode = this.$useWrapMode;
+ var len;
+ var action = e.data.action;
+ var firstRow = e.data.range.start.row,
+ lastRow = e.data.range.end.row,
+ start = e.data.range.start,
+ end = e.data.range.end;
+ var removedFolds = null;
+
+ if (action.indexOf("Lines") != -1) {
+ if (action == "insertLines") {
+ lastRow = firstRow + (e.data.lines.length);
+ } else {
+ lastRow = firstRow;
+ }
+ len = e.data.lines.length;
+ } else {
+ len = lastRow - firstRow;
+ }
+
+ if (len != 0) {
+ if (action.indexOf("remove") != -1) {
+ useWrapMode && this.$wrapData.splice(firstRow, len);
+
+ var foldLines = this.$foldData;
+ removedFolds = this.getFoldsInRange(e.data.range);
+ this.removeFolds(removedFolds);
+
+ var foldLine = this.getFoldLine(end.row);
+ var idx = 0;
+ if (foldLine) {
+ foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
+ foldLine.shiftRow(-len);
+
+ var foldLineBefore = this.getFoldLine(firstRow);
+ if (foldLineBefore && foldLineBefore !== foldLine) {
+ foldLineBefore.merge(foldLine);
+ foldLine = foldLineBefore;
+ }
+ idx = foldLines.indexOf(foldLine) + 1;
+ }
+
+ for (idx; idx < foldLines.length; idx++) {
+ var foldLine = foldLines[idx];
+ if (foldLine.start.row >= end.row) {
+ foldLine.shiftRow(-len);
+ }
+ }
+
+ lastRow = firstRow;
+ } else {
+ var args;
+ if (useWrapMode) {
+ args = [firstRow, 0];
+ for (var i = 0; i < len; i++) args.push([]);
+ this.$wrapData.splice.apply(this.$wrapData, args);
+ }
+
+ // If some new line is added inside of a foldLine, then split
+ // the fold line up.
+ var foldLines = this.$foldData;
+ var foldLine = this.getFoldLine(firstRow);
+ var idx = 0;
+ if (foldLine) {
+ var cmp = foldLine.range.compareInside(start.row, start.column)
+ // Inside of the foldLine range. Need to split stuff up.
+ if (cmp == 0) {
+ foldLine = foldLine.split(start.row, start.column);
+ foldLine.shiftRow(len);
+ foldLine.addRemoveChars(
+ lastRow, 0, end.column - start.column);
+ } else
+ // Infront of the foldLine but same row. Need to shift column.
+ if (cmp == -1) {
+ foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
+ foldLine.shiftRow(len);
+ }
+ // Nothing to do if the insert is after the foldLine.
+ idx = foldLines.indexOf(foldLine) + 1;
+ }
+
+ for (idx; idx < foldLines.length; idx++) {
+ var foldLine = foldLines[idx];
+ if (foldLine.start.row >= firstRow) {
+ foldLine.shiftRow(len);
+ }
+ }
+ }
+ } else {
+ // Realign folds. E.g. if you add some new chars before a fold, the
+ // fold should "move" to the right.
+ var column;
+ len = Math.abs(e.data.range.start.column - e.data.range.end.column);
+ if (action.indexOf("remove") != -1) {
+ // Get all the folds in the change range and remove them.
+ removedFolds = this.getFoldsInRange(e.data.range);
+ this.removeFolds(removedFolds);
+
+ len = -len;
+ }
+ var foldLine = this.getFoldLine(firstRow);
+ if (foldLine) {
+ foldLine.addRemoveChars(firstRow, start.column, len);
+ }
+ }
+
+ if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
+ console.error("doc.getLength() and $wrapData.length have to be the same!");
+ }
+
+ useWrapMode && this.$updateWrapData(firstRow, lastRow);
+
+ return removedFolds;
+ };
+
+ this.$updateWrapData = function(firstRow, lastRow) {
+ var lines = this.doc.getAllLines();
+ var tabSize = this.getTabSize();
+ var wrapData = this.$wrapData;
+ var wrapLimit = this.$wrapLimit;
+ var tokens;
+ var foldLine;
+
+ var row = firstRow;
+ lastRow = Math.min(lastRow, lines.length - 1);
+ while (row <= lastRow) {
+ foldLine = this.getFoldLine(row);
+ if (!foldLine) {
+ tokens = this.$getDisplayTokens(lang.stringTrimRight(lines[row]));
+ } else {
+ tokens = [];
+ foldLine.walk(
+ function(placeholder, row, column, lastColumn) {
+ var walkTokens;
+ if (placeholder) {
+ walkTokens = this.$getDisplayTokens(
+ placeholder, tokens.length);
+ walkTokens[0] = PLACEHOLDER_START;
+ for (var i = 1; i < walkTokens.length; i++) {
+ walkTokens[i] = PLACEHOLDER_BODY;
+ }
+ } else {
+ walkTokens = this.$getDisplayTokens(
+ lines[row].substring(lastColumn, column),
+ tokens.length);
+ }
+ tokens = tokens.concat(walkTokens);
+ }.bind(this),
+ foldLine.end.row,
+ lines[foldLine.end.row].length + 1
+ );
+ // Remove spaces/tabs from the back of the token array.
+ while (tokens.length != 0
+ && tokens[tokens.length - 1] >= SPACE)
+ {
+ tokens.pop();
+ }
+ }
+ wrapData[row] =
+ this.$computeWrapSplits(tokens, wrapLimit, tabSize);
+
+ row = this.getRowFoldEnd(row) + 1;
+ }
+ };
+
+ // "Tokens"
+ var CHAR = 1,
+ CHAR_EXT = 2,
+ PLACEHOLDER_START = 3,
+ PLACEHOLDER_BODY = 4,
+ SPACE = 10,
+ TAB = 11,
+ TAB_SPACE = 12;
+
+ this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) {
+ if (tokens.length == 0) {
+ return [];
+ }
+
+ var tabSize = this.getTabSize();
+ var splits = [];
+ var displayLength = tokens.length;
+ var lastSplit = 0, lastDocSplit = 0;
+
+ function addSplit(screenPos) {
+ var displayed = tokens.slice(lastSplit, screenPos);
+
+ // The document size is the current size - the extra width for tabs
+ // and multipleWidth characters.
+ var len = displayed.length;
+ displayed.join("").
+ // Get all the TAB_SPACEs.
+ replace(/12/g, function(m) {
+ len -= 1;
+ }).
+ // Get all the CHAR_EXT/multipleWidth characters.
+ replace(/2/g, function(m) {
+ len -= 1;
+ });
+
+ lastDocSplit += len;
+ splits.push(lastDocSplit);
+ lastSplit = screenPos;
+ }
+
+ while (displayLength - lastSplit > wrapLimit) {
+ // This is, where the split should be.
+ var split = lastSplit + wrapLimit;
+
+ // If there is a space or tab at this split position, then making
+ // a split is simple.
+ if (tokens[split] >= SPACE) {
+ // Include all following spaces + tabs in this split as well.
+ while (tokens[split] >= SPACE) {
+ split ++;
+ }
+ addSplit(split);
+ continue;
+ }
+
+ // === ELSE ===
+ // Check if split is inside of a placeholder. Placeholder are
+ // not splitable. Therefore, seek the beginning of the placeholder
+ // and try to place the split beofre the placeholder's start.
+ if (tokens[split] == PLACEHOLDER_START
+ || tokens[split] == PLACEHOLDER_BODY)
+ {
+ // Seek the start of the placeholder and do the split
+ // before the placeholder. By definition there always
+ // a PLACEHOLDER_START between split and lastSplit.
+ for (split; split != lastSplit - 1; split--) {
+ if (tokens[split] == PLACEHOLDER_START) {
+ // split++; << No incremental here as we want to
+ // have the position before the Placeholder.
+ break;
+ }
+ }
+
+ // If the PLACEHOLDER_START is not the index of the
+ // last split, then we can do the split
+ if (split > lastSplit) {
+ addSplit(split);
+ continue;
+ }
+
+ // If the PLACEHOLDER_START IS the index of the last
+ // split, then we have to place the split after the
+ // placeholder. So, let's seek for the end of the placeholder.
+ split = lastSplit + wrapLimit;
+ for (split; split < tokens.length; split++) {
+ if (tokens[split] != PLACEHOLDER_BODY)
+ {
+ break;
+ }
+ }
+
+ // If spilt == tokens.length, then the placeholder is the last
+ // thing in the line and adding a new split doesn't make sense.
+ if (split == tokens.length) {
+ break; // Breaks the while-loop.
+ }
+
+ // Finally, add the split...
+ addSplit(split);
+ continue;
+ }
+
+ // === ELSE ===
+ // Search for the first non space/tab/placeholder token backwards.
+ for (split; split != lastSplit - 1; split--) {
+ if (tokens[split] >= PLACEHOLDER_START) {
+ split++;
+ break;
+ }
+ }
+ // If we found one, then add the split.
+ if (split > lastSplit) {
+ addSplit(split);
+ continue;
+ }
+
+ // === ELSE ===
+ split = lastSplit + wrapLimit;
+ // The split is inside of a CHAR or CHAR_EXT token and no space
+ // around -> force a split.
+ addSplit(lastSplit + wrapLimit);
+ }
+ return splits;
+ }
+
+ /**
+ * @param
+ * offset: The offset in screenColumn at which position str starts.
+ * Important for calculating the realTabSize.
+ */
+ this.$getDisplayTokens = function(str, offset) {
+ var arr = [];
+ var tabSize;
+ offset = offset || 0;
+
+ for (var i = 0; i < str.length; i++) {
+ var c = str.charCodeAt(i);
+ // Tab
+ if (c == 9) {
+ tabSize = this.getScreenTabSize(arr.length + offset);
+ arr.push(TAB);
+ for (var n = 1; n < tabSize; n++) {
+ arr.push(TAB_SPACE);
+ }
+ }
+ // Space
+ else if(c == 32) {
+ arr.push(SPACE);
+ }
+ // full width characters
+ else if (isFullWidth(c)) {
+ arr.push(CHAR, CHAR_EXT);
+ } else {
+ arr.push(CHAR);
+ }
+ }
+ return arr;
+ }
+
+ /**
+ * Calculates the width of the a string on the screen while assuming that
+ * the string starts at the first column on the screen.
+ *
+ * @param string str String to calculate the screen width of
+ * @return array
+ * [0]: number of columns for str on screen.
+ * [1]: docColumn position that was read until (useful with screenColumn)
+ */
+ this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
+ if (maxScreenColumn == 0) {
+ return [0, 0];
+ }
+ if (maxScreenColumn == null) {
+ maxScreenColumn = screenColumn +
+ str.length * Math.max(this.getTabSize(), 2);
+ }
+ screenColumn = screenColumn || 0;
+
+ var c, column;
+ for (column = 0; column < str.length; column++) {
+ c = str.charCodeAt(column);
+ // tab
+ if (c == 9) {
+ screenColumn += this.getScreenTabSize(screenColumn);
+ }
+ // full width characters
+ else if (isFullWidth(c)) {
+ screenColumn += 2;
+ } else {
+ screenColumn += 1;
+ }
+ if (screenColumn > maxScreenColumn) {
+ break
+ }
+ }
+
+ return [screenColumn, column];
+ }
+
+ /**
+ * Returns the number of rows required to render this row on the screen
+ */
+ this.getRowLength = function(row) {
+ if (!this.$useWrapMode || !this.$wrapData[row]) {
+ return 1;
+ } else {
+ return this.$wrapData[row].length + 1;
+ }
+ }
+
+ /**
+ * Returns the height in pixels required to render this row on the screen
+ **/
+ this.getRowHeight = function(config, row) {
+ return this.getRowLength(row) * config.lineHeight;
+ }
+
+ this.getScreenLastRowColumn = function(screenRow) {
+ //return this.screenToDocumentColumn(screenRow, Number.MAX_VALUE / 10)
+ return this.documentToScreenColumn(screenRow, this.doc.getLine(screenRow).length);
+ };
+
+ this.getDocumentLastRowColumn = function(docRow, docColumn) {
+ var screenRow = this.documentToScreenRow(docRow, docColumn);
+ return this.getScreenLastRowColumn(screenRow);
+ };
+
+ this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
+ var screenRow = this.documentToScreenRow(docRow, docColumn);
+ return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
+ };
+
+ this.getRowSplitData = function(row) {
+ if (!this.$useWrapMode) {
+ return undefined;
+ } else {
+ return this.$wrapData[row];
+ }
+ };
+
+ /**
+ * Returns the width of a tab character at screenColumn.
+ */
+ this.getScreenTabSize = function(screenColumn) {
+ return this.$tabSize - screenColumn % this.$tabSize;
+ };
+
+ this.screenToDocumentRow = function(screenRow, screenColumn) {
+ return this.screenToDocumentPosition(screenRow, screenColumn).row;
+ };
+
+ this.screenToDocumentColumn = function(screenRow, screenColumn) {
+ return this.screenToDocumentPosition(screenRow, screenColumn).column;
+ };
+
+ this.screenToDocumentPosition = function(screenRow, screenColumn) {
+ if (screenRow < 0) {
+ return {
+ row: 0,
+ column: 0
+ }
+ }
+
+ var line;
+ var docRow = 0;
+ var docColumn = 0;
+ var column;
+ var foldLineRowLength;
+ var row = 0;
+ var rowLength = 0;
+
+ var rowCache = this.$rowCache;
+ for (var i = 0; i < rowCache.length; i++) {
+ if (rowCache[i].screenRow < screenRow) {
+ row = rowCache[i].screenRow;
+ docRow = rowCache[i].docRow;
+ }
+ else {
+ break;
+ }
+ }
+ var doCache = !rowCache.length || i == rowCache.length;
+
+ // clamp row before clamping column, for selection on last line
+ var maxRow = this.getLength() - 1;
+
+ var foldLine = this.getNextFold(docRow);
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+ while (row <= screenRow) {
+ rowLength = this.getRowLength(docRow);
+ if (row + rowLength - 1 >= screenRow || docRow >= maxRow) {
+ break;
+ } else {
+ row += rowLength;
+ docRow++;
+ if (docRow > foldStart) {
+ docRow = foldLine.end.row+1;
+ foldLine = this.getNextFold(docRow);
+ foldStart = foldLine ? foldLine.start.row : Infinity;
+ }
+ }
+ if (doCache) {
+ rowCache.push({
+ docRow: docRow,
+ screenRow: row
+ });
+ }
+ }
+
+ if (foldLine && foldLine.start.row <= docRow)
+ line = this.getFoldDisplayLine(foldLine);
+ else {
+ line = this.getLine(docRow);
+ foldLine = null;
+ }
+
+ var splits = [];
+ if (this.$useWrapMode) {
+ splits = this.$wrapData[docRow];
+ if (splits) {
+ column = splits[screenRow - row]
+ if(screenRow > row && splits.length) {
+ docColumn = splits[screenRow - row - 1] || splits[splits.length - 1];
+ line = line.substring(docColumn);
+ }
+ }
+ }
+
+ docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
+
+ // clip row at the end of the document
+ if (row + splits.length < screenRow)
+ docColumn = Number.MAX_VALUE;
+
+ // Need to do some clamping action here.
+ if (this.$useWrapMode) {
+ if (docColumn >= column) {
+ // We remove one character at the end such that the docColumn
+ // position returned is not associated to the next row on the
+ // screen.
+ docColumn = column - 1;
+ }
+ } else {
+ docColumn = Math.min(docColumn, line.length);
+ }
+
+ if (foldLine) {
+ return foldLine.idxToPosition(docColumn);
+ }
+
+ return {
+ row: docRow,
+ column: docColumn
+ }
+ };
+
+ this.documentToScreenPosition = function(docRow, docColumn) {
+ // Normalize the passed in arguments.
+ if (typeof docColumn === "undefined")
+ var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
+ else
+ pos = this.$clipPositionToDocument(docRow, docColumn);
+
+ docRow = pos.row;
+ docColumn = pos.column;
+
+ var LL = this.$rowCache.length;
+
+ var wrapData;
+ // Special case in wrapMode if the doc is at the end of the document.
+ if (this.$useWrapMode) {
+ wrapData = this.$wrapData;
+ if (docRow > wrapData.length - 1) {
+ return {
+ row: this.getScreenLength(),
+ column: wrapData.length == 0
+ ? 0
+ : (wrapData[wrapData.length - 1].length - 1)
+ };
+ }
+ }
+
+ var screenRow = 0;
+ var screenColumn = 0;
+ var foldStartRow = null;
+ var fold = null;
+
+ // Clamp the docRow position in case it's inside of a folded block.
+ fold = this.getFoldAt(docRow, docColumn, 1);
+ if (fold) {
+ docRow = fold.start.row;
+ docColumn = fold.start.column;
+ }
+
+ var rowEnd, row = 0;
+ var rowCache = this.$rowCache;
+
+ for (var i = 0; i < rowCache.length; i++) {
+ if (rowCache[i].docRow < docRow) {
+ screenRow = rowCache[i].screenRow;
+ row = rowCache[i].docRow;
+ } else {
+ break;
+ }
+ }
+ var doCache = !rowCache.length || i == rowCache.length;
+
+ var foldLine = this.getNextFold(row);
+ var foldStart = foldLine ?foldLine.start.row :Infinity;
+
+ while (row < docRow) {
+ if (row >= foldStart) {
+ rowEnd = foldLine.end.row + 1;
+ if (rowEnd > docRow)
+ break;
+ foldLine = this.getNextFold(rowEnd);
+ foldStart = foldLine ?foldLine.start.row :Infinity;
+ }
+ else {
+ rowEnd = row + 1;
+ }
+
+ screenRow += this.getRowLength(row);
+ row = rowEnd;
+
+ if (doCache) {
+ rowCache.push({
+ docRow: row,
+ screenRow: screenRow
+ });
+ }
+ }
+
+ // Calculate the text line that is displayed in docRow on the screen.
+ var textLine = "";
+ // Check if the final row we want to reach is inside of a fold.
+ if (foldLine && row >= foldStart) {
+ textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
+ foldStartRow = foldLine.start.row;
+ } else {
+ textLine = this.getLine(docRow).substring(0, docColumn);
+ foldStartRow = docRow;
+ }
+ // Clamp textLine if in wrapMode.
+ if (this.$useWrapMode) {
+ var wrapRow = wrapData[foldStartRow];
+ var screenRowOffset = 0;
+ while (textLine.length >= wrapRow[screenRowOffset]) {
+ screenRow ++;
+ screenRowOffset++;
+ }
+ textLine = textLine.substring(
+ wrapRow[screenRowOffset - 1] || 0, textLine.length
+ );
+ }
+
+ return {
+ row: screenRow,
+ column: this.$getStringScreenWidth(textLine)[0]
+ };
+ };
+
+ this.documentToScreenColumn = function(row, docColumn) {
+ return this.documentToScreenPosition(row, docColumn).column;
+ };
+
+ this.documentToScreenRow = function(docRow, docColumn) {
+ return this.documentToScreenPosition(docRow, docColumn).row;
+ };
+
+ this.getScreenLength = function() {
+ var screenRows = 0;
+ var lastFoldLine = null;
+ var foldLine = null;
+ if (!this.$useWrapMode) {
+ screenRows = this.getLength();
+
+ // Remove the folded lines again.
+ var foldData = this.$foldData;
+ for (var i = 0; i < foldData.length; i++) {
+ foldLine = foldData[i];
+ screenRows -= foldLine.end.row - foldLine.start.row;
+ }
+ } else {
+ for (var row = 0; row < this.$wrapData.length; row++) {
+ if (foldLine = this.getFoldLine(row, lastFoldLine)) {
+ row = foldLine.end.row;
+ screenRows += 1;
+ } else {
+ screenRows += this.$wrapData[row].length + 1;
+ }
+ }
+ }
+
+ return screenRows;
+ }
+
+ // For every keystroke this gets called once per char in the whole doc!!
+ // Wouldn't hurt to make it a bit faster for c >= 0x1100
+ function isFullWidth(c) {
+ if (c < 0x1100)
+ return false;
+ return c >= 0x1100 && c <= 0x115F ||
+ c >= 0x11A3 && c <= 0x11A7 ||
+ c >= 0x11FA && c <= 0x11FF ||
+ c >= 0x2329 && c <= 0x232A ||
+ c >= 0x2E80 && c <= 0x2E99 ||
+ c >= 0x2E9B && c <= 0x2EF3 ||
+ c >= 0x2F00 && c <= 0x2FD5 ||
+ c >= 0x2FF0 && c <= 0x2FFB ||
+ c >= 0x3000 && c <= 0x303E ||
+ c >= 0x3041 && c <= 0x3096 ||
+ c >= 0x3099 && c <= 0x30FF ||
+ c >= 0x3105 && c <= 0x312D ||
+ c >= 0x3131 && c <= 0x318E ||
+ c >= 0x3190 && c <= 0x31BA ||
+ c >= 0x31C0 && c <= 0x31E3 ||
+ c >= 0x31F0 && c <= 0x321E ||
+ c >= 0x3220 && c <= 0x3247 ||
+ c >= 0x3250 && c <= 0x32FE ||
+ c >= 0x3300 && c <= 0x4DBF ||
+ c >= 0x4E00 && c <= 0xA48C ||
+ c >= 0xA490 && c <= 0xA4C6 ||
+ c >= 0xA960 && c <= 0xA97C ||
+ c >= 0xAC00 && c <= 0xD7A3 ||
+ c >= 0xD7B0 && c <= 0xD7C6 ||
+ c >= 0xD7CB && c <= 0xD7FB ||
+ c >= 0xF900 && c <= 0xFAFF ||
+ c >= 0xFE10 && c <= 0xFE19 ||
+ c >= 0xFE30 && c <= 0xFE52 ||
+ c >= 0xFE54 && c <= 0xFE66 ||
+ c >= 0xFE68 && c <= 0xFE6B ||
+ c >= 0xFF01 && c <= 0xFF60 ||
+ c >= 0xFFE0 && c <= 0xFFE6;
+ };
+
+}).call(EditSession.prototype);
+
+require("ace/edit_session/folding").Folding.call(EditSession.prototype);
+
+exports.EditSession = EditSession;
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/selection', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'pilot/event_emitter', 'ace/range'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var lang = require("pilot/lang");
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+var Range = require("ace/range").Range;
+
+/**
+ * Keeps cursor position and the text selection of an edit session.
+ *
+ * The row/columns used in the selection are in document coordinates
+ * representing ths coordinates as thez appear in the document
+ * before applying soft wrap and folding.
+ */
+var Selection = function(session) {
+ this.session = session;
+ this.doc = session.getDocument();
+
+ this.clearSelection();
+ this.selectionLead = this.doc.createAnchor(0, 0);
+ this.selectionAnchor = this.doc.createAnchor(0, 0);
+
+ var _self = this;
+ this.selectionLead.on("change", function(e) {
+ _self._dispatchEvent("changeCursor");
+ if (!_self.$isEmpty)
+ _self._dispatchEvent("changeSelection");
+ if (!_self.$preventUpdateDesiredColumnOnChange && e.old.column != e.value.column)
+ _self.$updateDesiredColumn();
+ });
+
+ this.selectionAnchor.on("change", function() {
+ if (!_self.$isEmpty)
+ _self._dispatchEvent("changeSelection");
+ });
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.isEmpty = function() {
+ return (this.$isEmpty || (
+ this.selectionAnchor.row == this.selectionLead.row &&
+ this.selectionAnchor.column == this.selectionLead.column
+ ));
+ };
+
+ this.isMultiLine = function() {
+ if (this.isEmpty()) {
+ return false;
+ }
+
+ return this.getRange().isMultiLine();
+ };
+
+ this.getCursor = function() {
+ return this.selectionLead.getPosition();
+ };
+
+ this.setSelectionAnchor = function(row, column) {
+ this.selectionAnchor.setPosition(row, column);
+
+ if (this.$isEmpty) {
+ this.$isEmpty = false;
+ this._dispatchEvent("changeSelection");
+ }
+ };
+
+ this.getSelectionAnchor = function() {
+ if (this.$isEmpty)
+ return this.getSelectionLead()
+ else
+ return this.selectionAnchor.getPosition();
+ };
+
+ this.getSelectionLead = function() {
+ return this.selectionLead.getPosition();
+ };
+
+ this.shiftSelection = function(columns) {
+ if (this.$isEmpty) {
+ this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
+ return;
+ };
+
+ var anchor = this.getSelectionAnchor();
+ var lead = this.getSelectionLead();
+
+ var isBackwards = this.isBackwards();
+
+ if (!isBackwards || anchor.column !== 0)
+ this.setSelectionAnchor(anchor.row, anchor.column + columns);
+
+ if (isBackwards || lead.column !== 0) {
+ this.$moveSelection(function() {
+ this.moveCursorTo(lead.row, lead.column + columns);
+ });
+ }
+ };
+
+ this.isBackwards = function() {
+ var anchor = this.selectionAnchor;
+ var lead = this.selectionLead;
+ return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
+ };
+
+ this.getRange = function() {
+ var anchor = this.selectionAnchor;
+ var lead = this.selectionLead;
+
+ if (this.isEmpty())
+ return Range.fromPoints(lead, lead);
+
+ if (this.isBackwards()) {
+ return Range.fromPoints(lead, anchor);
+ }
+ else {
+ return Range.fromPoints(anchor, lead);
+ }
+ };
+
+ this.clearSelection = function() {
+ if (!this.$isEmpty) {
+ this.$isEmpty = true;
+ this._dispatchEvent("changeSelection");
+ }
+ };
+
+ this.selectAll = function() {
+ var lastRow = this.doc.getLength() - 1;
+ this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
+ this.moveCursorTo(0, 0);
+ };
+
+ this.setSelectionRange = function(range, reverse) {
+ if (reverse) {
+ this.setSelectionAnchor(range.end.row, range.end.column);
+ this.selectTo(range.start.row, range.start.column);
+ } else {
+ this.setSelectionAnchor(range.start.row, range.start.column);
+ this.selectTo(range.end.row, range.end.column);
+ }
+ this.$updateDesiredColumn();
+ };
+
+ this.$updateDesiredColumn = function() {
+ var cursor = this.getCursor();
+ this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column);
+ };
+
+ this.$moveSelection = function(mover) {
+ var lead = this.selectionLead;
+ if (this.$isEmpty)
+ this.setSelectionAnchor(lead.row, lead.column);
+
+ mover.call(this);
+ };
+
+ this.selectTo = function(row, column) {
+ this.$moveSelection(function() {
+ this.moveCursorTo(row, column);
+ });
+ };
+
+ this.selectToPosition = function(pos) {
+ this.$moveSelection(function() {
+ this.moveCursorToPosition(pos);
+ });
+ };
+
+ this.selectUp = function() {
+ this.$moveSelection(this.moveCursorUp);
+ };
+
+ this.selectDown = function() {
+ this.$moveSelection(this.moveCursorDown);
+ };
+
+ this.selectRight = function() {
+ this.$moveSelection(this.moveCursorRight);
+ };
+
+ this.selectLeft = function() {
+ this.$moveSelection(this.moveCursorLeft);
+ };
+
+ this.selectLineStart = function() {
+ this.$moveSelection(this.moveCursorLineStart);
+ };
+
+ this.selectLineEnd = function() {
+ this.$moveSelection(this.moveCursorLineEnd);
+ };
+
+ this.selectFileEnd = function() {
+ this.$moveSelection(this.moveCursorFileEnd);
+ };
+
+ this.selectFileStart = function() {
+ this.$moveSelection(this.moveCursorFileStart);
+ };
+
+ this.selectWordRight = function() {
+ this.$moveSelection(this.moveCursorWordRight);
+ };
+
+ this.selectWordLeft = function() {
+ this.$moveSelection(this.moveCursorWordLeft);
+ };
+
+ this.selectWord = function() {
+ var cursor = this.getCursor();
+ var range = this.session.getWordRange(cursor.row, cursor.column);
+ this.setSelectionRange(range);
+ };
+
+ this.selectLine = function() {
+ var rowStart = this.selectionLead.row;
+ var rowEnd;
+
+ var foldLine = this.session.getFoldLine(rowStart);
+ if (foldLine) {
+ rowStart = foldLine.start.row;
+ rowEnd = foldLine.end.row;
+ } else {
+ rowEnd = rowStart;
+ }
+ this.setSelectionAnchor(rowStart, 0);
+ this.$moveSelection(function() {
+ this.moveCursorTo(rowEnd + 1, 0);
+ });
+ };
+
+ this.moveCursorUp = function() {
+ this.moveCursorBy(-1, 0);
+ };
+
+ this.moveCursorDown = function() {
+ this.moveCursorBy(1, 0);
+ };
+
+ this.moveCursorLeft = function() {
+ var cursor = this.selectionLead.getPosition(),
+ fold;
+
+ if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
+ this.moveCursorTo(fold.start.row, fold.start.column);
+ } else if (cursor.column == 0) {
+ // cursor is a line (start
+ if (cursor.row > 0) {
+ this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
+ }
+ }
+ else {
+ var tabSize = this.session.getTabSize();
+ if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
+ this.moveCursorBy(0, -tabSize);
+ else
+ this.moveCursorBy(0, -1);
+ }
+ };
+
+ this.moveCursorRight = function() {
+ var cursor = this.selectionLead.getPosition(),
+ fold;
+ if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
+ this.moveCursorTo(fold.end.row, fold.end.column);
+ }
+ else if (this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) {
+ if (this.selectionLead.row < this.doc.getLength() - 1) {
+ this.moveCursorTo(this.selectionLead.row + 1, 0);
+ }
+ }
+ else {
+ var tabSize = this.session.getTabSize();
+ var cursor = this.selectionLead;
+ if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
+ this.moveCursorBy(0, tabSize);
+ else
+ this.moveCursorBy(0, 1);
+ }
+ };
+
+ this.moveCursorLineStart = function() {
+ var row = this.selectionLead.row;
+ var column = this.selectionLead.column;
+ var screenRow = this.session.documentToScreenRow(row, column);
+
+ // Determ the doc-position of the first character at the screen line.
+ var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
+
+ // Determ the line
+ var beforeCursor = this.session.getDisplayLine(
+ row, null,
+ firstColumnPosition.row, firstColumnPosition.column
+ );
+
+ var leadingSpace = beforeCursor.match(/^\s*/);
+ if (leadingSpace[0].length == column) {
+ this.moveCursorTo(
+ firstColumnPosition.row, firstColumnPosition.column
+ );
+ }
+ else {
+ this.moveCursorTo(
+ firstColumnPosition.row,
+ firstColumnPosition.column + leadingSpace[0].length
+ );
+ }
+ };
+
+ this.moveCursorLineEnd = function() {
+ var lead = this.selectionLead;
+ var lastRowColumnPosition =
+ this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
+ this.moveCursorTo(
+ lastRowColumnPosition.row,
+ lastRowColumnPosition.column
+ );
+ };
+
+ this.moveCursorFileEnd = function() {
+ var row = this.doc.getLength() - 1;
+ var column = this.doc.getLine(row).length;
+ this.moveCursorTo(row, column);
+ };
+
+ this.moveCursorFileStart = function() {
+ this.moveCursorTo(0, 0);
+ };
+
+ this.moveCursorWordRight = function() {
+ var row = this.selectionLead.row;
+ var column = this.selectionLead.column;
+ var line = this.doc.getLine(row);
+ var rightOfCursor = line.substring(column);
+
+ var match;
+ this.session.nonTokenRe.lastIndex = 0;
+ this.session.tokenRe.lastIndex = 0;
+
+ var fold;
+ if (fold = this.session.getFoldAt(row, column, 1)) {
+ this.moveCursorTo(fold.end.row, fold.end.column);
+ return;
+ } else if (column == line.length) {
+ this.moveCursorRight();
+ return;
+ }
+ else if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
+ column += this.session.nonTokenRe.lastIndex;
+ this.session.nonTokenRe.lastIndex = 0;
+ }
+ else if (match = this.session.tokenRe.exec(rightOfCursor)) {
+ column += this.session.tokenRe.lastIndex;
+ this.session.tokenRe.lastIndex = 0;
+ }
+
+ this.moveCursorTo(row, column);
+ };
+
+ this.moveCursorWordLeft = function() {
+ var row = this.selectionLead.row;
+ var column = this.selectionLead.column;
+
+ var fold;
+ if (fold = this.session.getFoldAt(row, column, -1)) {
+ this.moveCursorTo(fold.start.row, fold.start.column);
+ return;
+ }
+
+ if (column == 0) {
+ this.moveCursorLeft();
+ return;
+ }
+
+ var str = this.session.getFoldStringAt(row, column, -1);
+ if (str == null) {
+ str = this.doc.getLine(row).substring(0, column)
+ }
+ var leftOfCursor = lang.stringReverse(str);
+
+ var match;
+ this.session.nonTokenRe.lastIndex = 0;
+ this.session.tokenRe.lastIndex = 0;
+
+ if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
+ column -= this.session.nonTokenRe.lastIndex;
+ this.session.nonTokenRe.lastIndex = 0;
+ }
+ else if (match = this.session.tokenRe.exec(leftOfCursor)) {
+ column -= this.session.tokenRe.lastIndex;
+ this.session.tokenRe.lastIndex = 0;
+ }
+
+ this.moveCursorTo(row, column);
+ };
+
+ this.moveCursorBy = function(rows, chars) {
+ var screenPos = this.session.documentToScreenPosition(
+ this.selectionLead.row,
+ this.selectionLead.column
+ );
+ var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column;
+ var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
+ this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
+ };
+
+ this.moveCursorToPosition = function(position) {
+ this.moveCursorTo(position.row, position.column);
+ };
+
+ this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
+ // Ensure the row/column is not inside of a fold.
+ var fold = this.session.getFoldAt(row, column, 1);
+ if (fold) {
+ row = fold.start.row;
+ column = fold.start.column;
+ }
+
+ this.$preventUpdateDesiredColumnOnChange = true;
+ this.selectionLead.setPosition(row, column);
+ this.$preventUpdateDesiredColumnOnChange = false;
+
+ if (!preventUpdateDesiredColumn)
+ this.$updateDesiredColumn(this.selectionLead.column);
+ };
+
+ this.moveCursorToScreen = function(row, column, preventUpdateDesiredColumn) {
+ var pos = this.session.screenToDocumentPosition(row, column);
+ row = pos.row;
+ column = pos.column;
+ this.moveCursorTo(row, column, preventUpdateDesiredColumn);
+ };
+
+}).call(Selection.prototype);
+
+exports.Selection = Selection;
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+var Range = function(startRow, startColumn, endRow, endColumn) {
+ this.start = {
+ row: startRow,
+ column: startColumn
+ };
+
+ this.end = {
+ row: endRow,
+ column: endColumn
+ };
+};
+
+(function() {
+
+ this.toString = function() {
+ return ("Range: [" + this.start.row + "/" + this.start.column +
+ "] -> [" + this.end.row + "/" + this.end.column + "]");
+ };
+
+ this.contains = function(row, column) {
+ return this.compare(row, column) == 0;
+ };
+
+ /**
+ * Compares this range (A) with another range (B), where B is the passed in
+ * range.
+ *
+ * Return values:
+ * -2: (B) is infront of (A) and doesn't intersect with (A)
+ * -1: (B) begins before (A) but ends inside of (A)
+ * 0: (B) is completly inside of (A) OR (A) is complety inside of (B)
+ * +1: (B) begins inside of (A) but ends outside of (A)
+ * +2: (B) is after (A) and doesn't intersect with (A)
+ *
+ * 42: FTW state: (B) ends in (A) but starts outside of (A)
+ */
+ this.compareRange = function(range) {
+ var cmp,
+ end = range.end,
+ start = range.start;
+
+ cmp = this.compare(end.row, end.column);
+ if (cmp == 1) {
+ cmp = this.compare(start.row, start.column);
+ if (cmp == 1) {
+ return 2;
+ } else if (cmp == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+ } else if (cmp == -1) {
+ return -2;
+ } else {
+ cmp = this.compare(start.row, start.column);
+ if (cmp == -1) {
+ return -1;
+ } else if (cmp == 1) {
+ return 42;
+ } else {
+ return 0;
+ }
+ }
+ }
+
+ this.containsRange = function(range) {
+ var cmp = this.compareRange(range);
+ return (cmp == -1 || cmp == 0 || cmp == 1);
+ }
+
+ this.isEnd = function(row, column) {
+ return this.end.row == row && this.end.column == column;
+ }
+
+ this.isStart = function(row, column) {
+ return this.start.row == row && this.start.column == column;
+ }
+
+ this.setStart = function(row, column) {
+ if (typeof row == "object") {
+ this.start.column = row.column;
+ this.start.row = row.row;
+ } else {
+ this.start.row = row;
+ this.start.column = column;
+ }
+ }
+
+ this.setEnd = function(row, column) {
+ if (typeof row == "object") {
+ this.end.column = row.column;
+ this.end.row = row.row;
+ } else {
+ this.end.row = row;
+ this.end.column = column;
+ }
+ }
+
+ this.inside = function(row, column) {
+ if (this.compare(row, column) == 0) {
+ if (this.isEnd(row, column) || this.isStart(row, column)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ this.insideStart = function(row, column) {
+ if (this.compare(row, column) == 0) {
+ if (this.isEnd(row, column)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ this.insideEnd = function(row, column) {
+ if (this.compare(row, column) == 0) {
+ if (this.isStart(row, column)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ this.compare = function(row, column) {
+ if (!this.isMultiLine()) {
+ if (row === this.start.row) {
+ return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
+ };
+ }
+
+ if (row < this.start.row)
+ return -1;
+
+ if (row > this.end.row)
+ return 1;
+
+ if (this.start.row === row)
+ return column >= this.start.column ? 0 : -1;
+
+ if (this.end.row === row)
+ return column <= this.end.column ? 0 : 1;
+
+ return 0;
+ };
+
+ /**
+ * Like .compare(), but if isStart is true, return -1;
+ */
+ this.compareStart = function(row, column) {
+ if (this.start.row == row && this.start.column == column) {
+ return -1;
+ } else {
+ return this.compare(row, column);
+ }
+ }
+
+ /**
+ * Like .compare(), but if isEnd is true, return 1;
+ */
+ this.compareEnd = function(row, column) {
+ if (this.end.row == row && this.end.column == column) {
+ return 1;
+ } else {
+ return this.compare(row, column);
+ }
+ }
+
+ this.compareInside = function(row, column) {
+ if (this.end.row == row && this.end.column == column) {
+ return 1;
+ } else if (this.start.row == row && this.start.column == column) {
+ return -1;
+ } else {
+ return this.compare(row, column);
+ }
+ }
+
+ this.clipRows = function(firstRow, lastRow) {
+ if (this.end.row > lastRow) {
+ var end = {
+ row: lastRow+1,
+ column: 0
+ };
+ }
+
+ if (this.start.row > lastRow) {
+ var start = {
+ row: lastRow+1,
+ column: 0
+ };
+ }
+
+ if (this.start.row < firstRow) {
+ var start = {
+ row: firstRow,
+ column: 0
+ };
+ }
+
+ if (this.end.row < firstRow) {
+ var end = {
+ row: firstRow,
+ column: 0
+ };
+ }
+ return Range.fromPoints(start || this.start, end || this.end);
+ };
+
+ this.extend = function(row, column) {
+ var cmp = this.compare(row, column);
+
+ if (cmp == 0)
+ return this;
+ else if (cmp == -1)
+ var start = {row: row, column: column};
+ else
+ var end = {row: row, column: column};
+
+ return Range.fromPoints(start || this.start, end || this.end);
+ };
+
+ this.isEmpty = function() {
+ return (this.start.row == this.end.row && this.start.column == this.end.column);
+ };
+
+ this.isMultiLine = function() {
+ return (this.start.row !== this.end.row);
+ };
+
+ this.clone = function() {
+ return Range.fromPoints(this.start, this.end);
+ };
+
+ this.collapseRows = function() {
+ if (this.end.column == 0)
+ return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
+ else
+ return new Range(this.start.row, 0, this.end.row, 0)
+ };
+
+ this.toScreenRange = function(session) {
+ var screenPosStart =
+ session.documentToScreenPosition(this.start);
+ var screenPosEnd =
+ session.documentToScreenPosition(this.end);
+
+ return new Range(
+ screenPosStart.row, screenPosStart.column,
+ screenPosEnd.row, screenPosEnd.column
+ );
+ };
+
+}).call(Range.prototype);
+
+
+Range.fromPoints = function(start, end) {
+ return new Range(start.row, start.column, end.row, end.column);
+};
+
+exports.Range = Range;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Mihai Sucan
+ * Chris Spencer
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/mode/text', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/behaviour', 'ace/unicode'], function(require, exports, module) {
+
+var Tokenizer = require("ace/tokenizer").Tokenizer;
+var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
+var Behaviour = require("ace/mode/behaviour").Behaviour;
+var unicode = require("ace/unicode");
+
+var Mode = function() {
+ this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
+ this.$behaviour = new Behaviour();
+};
+
+(function() {
+
+ this.tokenRe = new RegExp("^["
+ + unicode.packages.L
+ + unicode.packages.Mn + unicode.packages.Mc
+ + unicode.packages.Nd
+ + unicode.packages.Pc + "\\$_]+", "g"
+ );
+
+ this.nonTokenRe = new RegExp("^(?:[^"
+ + unicode.packages.L
+ + unicode.packages.Mn + unicode.packages.Mc
+ + unicode.packages.Nd
+ + unicode.packages.Pc + "\\$_]|\s])+", "g"
+ );
+
+ this.getTokenizer = function() {
+ return this.$tokenizer;
+ };
+
+ this.toggleCommentLines = function(state, doc, startRow, endRow) {
+ };
+
+ this.getNextLineIndent = function(state, line, tab) {
+ return "";
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return false;
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ };
+
+ this.$getIndent = function(line) {
+ var match = line.match(/^(\s+)/);
+ if (match) {
+ return match[1];
+ }
+
+ return "";
+ };
+
+ this.createWorker = function(session) {
+ return null;
+ };
+
+ this.highlightSelection = function(editor) {
+ var session = editor.session;
+ if (!session.$selectionOccurrences)
+ session.$selectionOccurrences = [];
+
+ if (session.$selectionOccurrences.length)
+ this.clearSelectionHighlight(editor);
+
+ var selection = editor.getSelectionRange();
+ if (selection.isEmpty() || selection.isMultiLine())
+ return;
+
+ var startOuter = selection.start.column - 1;
+ var endOuter = selection.end.column + 1;
+ var line = session.getLine(selection.start.row);
+ var lineCols = line.length;
+ var needle = line.substring(Math.max(startOuter, 0),
+ Math.min(endOuter, lineCols));
+
+ // Make sure the outer characters are not part of the word.
+ if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
+ (endOuter <= lineCols && /[\w\d]$/.test(needle)))
+ return;
+
+ needle = line.substring(selection.start.column, selection.end.column);
+ if (!/^[\w\d]+$/.test(needle))
+ return;
+
+ var cursor = editor.getCursorPosition();
+
+ var newOptions = {
+ wrap: true,
+ wholeWord: true,
+ caseSensitive: true,
+ needle: needle
+ };
+
+ var currentOptions = editor.$search.getOptions();
+ editor.$search.set(newOptions);
+
+ var ranges = editor.$search.findAll(session);
+ ranges.forEach(function(range) {
+ if (!range.contains(cursor.row, cursor.column)) {
+ var marker = session.addMarker(range, "ace_selected_word", "text");
+ session.$selectionOccurrences.push(marker);
+ }
+ });
+
+ editor.$search.set(currentOptions);
+ };
+
+ this.clearSelectionHighlight = function(editor) {
+ if (!editor.session.$selectionOccurrences)
+ return;
+
+ editor.session.$selectionOccurrences.forEach(function(marker) {
+ editor.session.removeMarker(marker);
+ });
+
+ editor.session.$selectionOccurrences = [];
+ };
+
+ this.createModeDelegates = function (mapping) {
+ if (!this.$embeds) {
+ return;
+ }
+ this.$modes = {};
+ for (var i = 0; i < this.$embeds.length; i++) {
+ if (mapping[this.$embeds[i]]) {
+ this.$modes[this.$embeds[i]] = new mapping[this.$embeds[i]]();
+ }
+ }
+
+ var delegations = ['toggleCommentLines', 'getNextLineIndent', 'checkOutdent', 'autoOutdent', 'transformAction'];
+
+ for (var i = 0; i < delegations.length; i++) {
+ (function(scope) {
+ var functionName = delegations[i];
+ var defaultHandler = scope[functionName];
+ scope[delegations[i]] = function() {
+ return this.$delegator(functionName, arguments, defaultHandler);
+ }
+ } (this));
+ }
+ }
+
+ this.$delegator = function(method, args, defaultHandler) {
+ var state = args[0];
+
+ for (var i = 0; i < this.$embeds.length; i++) {
+ if (!this.$modes[this.$embeds[i]]) continue;
+
+ var split = state.split(this.$embeds[i]);
+ if (!split[0] && split[1]) {
+ args[0] = split[1];
+ var mode = this.$modes[this.$embeds[i]];
+ return mode[method].apply(mode, args);
+ }
+ }
+ var ret = defaultHandler.apply(this, args);
+ return defaultHandler ? ret : undefined;
+ };
+
+ this.transformAction = function(state, action, editor, session, param) {
+ if (this.$behaviour) {
+ var behaviours = this.$behaviour.getBehaviours();
+ for (var key in behaviours) {
+ if (behaviours[key][action]) {
+ var ret = behaviours[key][action].apply(this, arguments);
+ if (ret !== false) {
+ return ret;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/tokenizer', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+var Tokenizer = function(rules) {
+ this.rules = rules;
+
+ this.regExps = {};
+ this.matchMappings = {};
+ for ( var key in this.rules) {
+ var rule = this.rules[key];
+ var state = rule;
+ var ruleRegExps = [];
+ var matchTotal = 0;
+ var mapping = this.matchMappings[key] = {};
+
+ for ( var i = 0; i < state.length; i++) {
+ // Count number of matching groups. 2 extra groups from the full match
+ // And the catch-all on the end (used to force a match);
+ var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
+
+ // Replace any backreferences and offset appropriately.
+ var adjustedregex = state[i].regex.replace(/\\([0-9]+)/g, function (match, digit) {
+ return "\\" + (parseInt(digit, 10) + matchTotal + 1);
+ });
+
+ mapping[matchTotal] = {
+ rule: i,
+ len: matchcount
+ };
+ matchTotal += matchcount;
+
+ ruleRegExps.push(adjustedregex);
+ }
+
+ this.regExps[key] = new RegExp("(?:(" + ruleRegExps.join(")|(") + ")|(.))", "g");
+ }
+};
+
+(function() {
+
+ this.getLineTokens = function(line, startState) {
+ var currentState = startState;
+ var state = this.rules[currentState];
+ var mapping = this.matchMappings[currentState];
+ var re = this.regExps[currentState];
+ re.lastIndex = 0;
+
+ var match, tokens = [];
+
+ var lastIndex = 0;
+
+ var token = {
+ type: null,
+ value: ""
+ };
+
+ while (match = re.exec(line)) {
+ var type = "text";
+ var rule = null;
+ var value = [match[0]];
+
+ for (var i = 0; i < match.length-2; i++) {
+ if (match[i + 1] !== undefined) {
+ rule = state[mapping[i].rule];
+
+ if (mapping[i].len > 1) {
+ value = match.slice(i+2, i+1+mapping[i].len);
+ }
+
+ // compute token type
+ if (typeof rule.token == "function")
+ type = rule.token.apply(this, value);
+ else
+ type = rule.token;
+
+ var next = rule.next;
+ if (next && next !== currentState) {
+ currentState = next;
+ state = this.rules[currentState];
+ mapping = this.matchMappings[currentState];
+ lastIndex = re.lastIndex;
+
+ re = this.regExps[currentState];
+ re.lastIndex = lastIndex;
+ }
+ break;
+ }
+ };
+
+ if (value[0]) {
+ if (typeof type == "string") {
+ value = [value.join("")];
+ type = [type];
+ }
+ for (var i = 0; i < value.length; i++) {
+ if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
+ token.value += value[i];
+ } else {
+ if (token.type) {
+ tokens.push(token);
+ }
+
+ token = {
+ type: type[i],
+ value: value[i]
+ }
+ }
+ }
+ }
+
+ if (lastIndex == line.length)
+ break;
+
+ lastIndex = re.lastIndex;
+ };
+
+ if (token.type)
+ tokens.push(token);
+
+ return {
+ tokens : tokens,
+ state : currentState
+ };
+ };
+
+}).call(Tokenizer.prototype);
+
+exports.Tokenizer = Tokenizer;
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/mode/text_highlight_rules', ['require', 'exports', 'module' , 'pilot/lang'], function(require, exports, module) {
+
+var lang = require("pilot/lang");
+
+var TextHighlightRules = function() {
+
+ // regexp must not have capturing parentheses
+ // regexps are ordered -> the first match is used
+
+ this.$rules = {
+ "start" : [{
+ token : "empty_line",
+ regex : '^$'
+ }, {
+ token : "text",
+ regex : ".+"
+ }]
+ };
+};
+
+(function() {
+
+ this.addRules = function(rules, prefix) {
+ for (var key in rules) {
+ var state = rules[key];
+ for (var i=0; i
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/mode/behaviour', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+var Behaviour = function() {
+ this.$behaviours = {};
+};
+
+(function () {
+
+ this.add = function (name, action, callback) {
+ switch (undefined) {
+ case this.$behaviours:
+ this.$behaviours = {};
+ case this.$behaviours[name]:
+ this.$behaviours[name] = {};
+ }
+ this.$behaviours[name][action] = callback;
+ }
+
+ this.addBehaviours = function (behaviours) {
+ for (var key in behaviours) {
+ for (var action in behaviours[key]) {
+ this.add(key, action, behaviours[key][action]);
+ }
+ }
+ }
+
+ this.remove = function (name) {
+ if (this.$behaviours && this.$behaviours[name]) {
+ delete this.$behaviours[name];
+ }
+ }
+
+ this.inherit = function (mode, filter) {
+ if (typeof mode === "function") {
+ var behaviours = new mode().getBehaviours(filter);
+ } else {
+ var behaviours = mode.getBehaviours(filter);
+ }
+ this.addBehaviours(behaviours);
+ }
+
+ this.getBehaviours = function (filter) {
+ if (!filter) {
+ return this.$behaviours;
+ } else {
+ var ret = {}
+ for (var i = 0; i < filter.length; i++) {
+ if (this.$behaviours[filter[i]]) {
+ ret[filter[i]] = this.$behaviours[filter[i]];
+ }
+ }
+ return ret;
+ }
+ }
+
+}).call(Behaviour.prototype);
+
+exports.Behaviour = Behaviour;
+});define('ace/unicode', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+/*
+XRegExp Unicode plugin pack: Categories 1.0
+(c) 2010 Steven Levithan
+MIT License
+
+Uses the Unicode 5.2 character database
+
+This package for the XRegExp Unicode plugin enables the following Unicode categories (aka properties):
+
+L - Letter (the top-level Letter category is included in the Unicode plugin base script)
+ Ll - Lowercase letter
+ Lu - Uppercase letter
+ Lt - Titlecase letter
+ Lm - Modifier letter
+ Lo - Letter without case
+M - Mark
+ Mn - Non-spacing mark
+ Mc - Spacing combining mark
+ Me - Enclosing mark
+N - Number
+ Nd - Decimal digit
+ Nl - Letter number
+ No - Other number
+P - Punctuation
+ Pd - Dash punctuation
+ Ps - Open punctuation
+ Pe - Close punctuation
+ Pi - Initial punctuation
+ Pf - Final punctuation
+ Pc - Connector punctuation
+ Po - Other punctuation
+S - Symbol
+ Sm - Math symbol
+ Sc - Currency symbol
+ Sk - Modifier symbol
+ So - Other symbol
+Z - Separator
+ Zs - Space separator
+ Zl - Line separator
+ Zp - Paragraph separator
+C - Other
+ Cc - Control
+ Cf - Format
+ Co - Private use
+ Cs - Surrogate
+ Cn - Unassigned
+
+Example usage:
+
+ \p{N}
+ \p{Cn}
+*/
+
+
+// will be populated by addUnicodePackage
+exports.packages = {};
+
+addUnicodePackage({
+ L: "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
+ Ll: "0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",
+ Lu: "0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",
+ Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",
+ Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",
+ Lo: "01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
+ M: "0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",
+ Mn: "0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",
+ Mc: "0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",
+ Me: "0488048906DE20DD-20E020E2-20E4A670-A672",
+ N: "0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
+ Nd: "0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
+ Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",
+ No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",
+ P: "0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",
+ Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",
+ Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",
+ Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",
+ Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",
+ Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21",
+ Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F",
+ Po: "0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",
+ S: "0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",
+ Sm: "002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",
+ Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",
+ Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",
+ So: "00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",
+ Z: "002000A01680180E2000-200A20282029202F205F3000",
+ Zs: "002000A01680180E2000-200A202F205F3000",
+ Zl: "2028",
+ Zp: "2029",
+ C: "0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",
+ Cc: "0000-001F007F-009F",
+ Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",
+ Co: "E000-F8FF",
+ Cs: "D800-DFFF",
+ Cn: "03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"
+});
+
+function addUnicodePackage (pack) {
+ var codePoint = /\w{4}/g;
+ for (var name in pack)
+ exports.packages[name] = pack[name].replace(codePoint, "\\u$&");
+};
+
+});/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/document', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+var Range = require("ace/range").Range;
+var Anchor = require("ace/anchor").Anchor;
+
+var Document = function(text) {
+ this.$lines = [];
+
+ if (Array.isArray(text)) {
+ this.insertLines(0, text);
+ }
+ // There has to be one line at least in the document. If you pass an empty
+ // string to the insert function, nothing will happen. Workaround.
+ else if (text.length == 0) {
+ this.$lines = [""];
+ } else {
+ this.insert({row: 0, column:0}, text);
+ }
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.setValue = function(text) {
+ var len = this.getLength();
+ this.remove(new Range(0, 0, len, this.getLine(len-1).length));
+ this.insert({row: 0, column:0}, text);
+ };
+
+ this.getValue = function() {
+ return this.getAllLines().join(this.getNewLineCharacter());
+ };
+
+ this.createAnchor = function(row, column) {
+ return new Anchor(this, row, column);
+ };
+
+ // check for IE split bug
+ if ("aaa".split(/a/).length == 0)
+ this.$split = function(text) {
+ return text.replace(/\r\n|\r/g, "\n").split("\n");
+ }
+ else
+ this.$split = function(text) {
+ return text.split(/\r\n|\r|\n/);
+ };
+
+
+ this.$detectNewLine = function(text) {
+ var match = text.match(/^.*?(\r?\n)/m);
+ if (match) {
+ this.$autoNewLine = match[1];
+ } else {
+ this.$autoNewLine = "\n";
+ }
+ };
+
+ this.getNewLineCharacter = function() {
+ switch (this.$newLineMode) {
+ case "windows":
+ return "\r\n";
+
+ case "unix":
+ return "\n";
+
+ case "auto":
+ return this.$autoNewLine;
+ }
+ },
+
+ this.$autoNewLine = "\n";
+ this.$newLineMode = "auto";
+ this.setNewLineMode = function(newLineMode) {
+ if (this.$newLineMode === newLineMode) return;
+
+ this.$newLineMode = newLineMode;
+ };
+
+ this.getNewLineMode = function() {
+ return this.$newLineMode;
+ };
+
+ this.isNewLine = function(text) {
+ return (text == "\r\n" || text == "\r" || text == "\n");
+ };
+
+ /**
+ * Get a verbatim copy of the given line as it is in the document
+ */
+ this.getLine = function(row) {
+ return this.$lines[row] || "";
+ };
+
+ this.getLines = function(firstRow, lastRow) {
+ return this.$lines.slice(firstRow, lastRow + 1);
+ };
+
+ /**
+ * Returns all lines in the document as string array. Warning: The caller
+ * should not modify this array!
+ */
+ this.getAllLines = function() {
+ return this.getLines(0, this.getLength());
+ };
+
+ this.getLength = function() {
+ return this.$lines.length;
+ };
+
+ this.getTextRange = function(range) {
+ if (range.start.row == range.end.row) {
+ return this.$lines[range.start.row].substring(range.start.column,
+ range.end.column);
+ }
+ else {
+ var lines = [];
+ lines.push(this.$lines[range.start.row].substring(range.start.column));
+ lines.push.apply(lines, this.getLines(range.start.row+1, range.end.row-1));
+ lines.push(this.$lines[range.end.row].substring(0, range.end.column));
+ return lines.join(this.getNewLineCharacter());
+ }
+ };
+
+ this.$clipPosition = function(position) {
+ var length = this.getLength();
+ if (position.row >= length) {
+ position.row = Math.max(0, length - 1);
+ position.column = this.getLine(length-1).length;
+ }
+ return position;
+ }
+
+ this.insert = function(position, text) {
+ if (text.length == 0)
+ return position;
+
+ position = this.$clipPosition(position);
+
+ if (this.getLength() <= 1)
+ this.$detectNewLine(text);
+
+ var lines = this.$split(text);
+ var firstLine = lines.splice(0, 1)[0];
+ var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
+
+ position = this.insertInLine(position, firstLine);
+ if (lastLine !== null) {
+ position = this.insertNewLine(position); // terminate first line
+ position = this.insertLines(position.row, lines);
+ position = this.insertInLine(position, lastLine || "");
+ }
+ return position;
+ };
+
+ this.insertLines = function(row, lines) {
+ if (lines.length == 0)
+ return {row: row, column: 0};
+
+ var args = [row, 0];
+ args.push.apply(args, lines);
+ this.$lines.splice.apply(this.$lines, args);
+
+ var range = new Range(row, 0, row + lines.length, 0);
+ var delta = {
+ action: "insertLines",
+ range: range,
+ lines: lines
+ };
+ this._dispatchEvent("change", { data: delta });
+ return range.end;
+ },
+
+ this.insertNewLine = function(position) {
+ position = this.$clipPosition(position);
+ var line = this.$lines[position.row] || "";
+
+ this.$lines[position.row] = line.substring(0, position.column);
+ this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
+
+ var end = {
+ row : position.row + 1,
+ column : 0
+ };
+
+ var delta = {
+ action: "insertText",
+ range: Range.fromPoints(position, end),
+ text: this.getNewLineCharacter()
+ };
+ this._dispatchEvent("change", { data: delta });
+
+ return end;
+ };
+
+ this.insertInLine = function(position, text) {
+ if (text.length == 0)
+ return position;
+
+ var line = this.$lines[position.row] || "";
+
+ this.$lines[position.row] = line.substring(0, position.column) + text
+ + line.substring(position.column);
+
+ var end = {
+ row : position.row,
+ column : position.column + text.length
+ };
+
+ var delta = {
+ action: "insertText",
+ range: Range.fromPoints(position, end),
+ text: text
+ };
+ this._dispatchEvent("change", { data: delta });
+
+ return end;
+ };
+
+ this.remove = function(range) {
+ // clip to document
+ range.start = this.$clipPosition(range.start);
+ range.end = this.$clipPosition(range.end);
+
+ if (range.isEmpty())
+ return range.start;
+
+ var firstRow = range.start.row;
+ var lastRow = range.end.row;
+
+ if (range.isMultiLine()) {
+ var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
+ var lastFullRow = lastRow - 1;
+
+ if (range.end.column > 0)
+ this.removeInLine(lastRow, 0, range.end.column);
+
+ if (lastFullRow >= firstFullRow)
+ this.removeLines(firstFullRow, lastFullRow);
+
+ if (firstFullRow != firstRow) {
+ this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
+ this.removeNewLine(range.start.row);
+ }
+ }
+ else {
+ this.removeInLine(firstRow, range.start.column, range.end.column);
+ }
+ return range.start;
+ };
+
+ this.removeInLine = function(row, startColumn, endColumn) {
+ if (startColumn == endColumn)
+ return;
+
+ var range = new Range(row, startColumn, row, endColumn);
+ var line = this.getLine(row);
+ var removed = line.substring(startColumn, endColumn);
+ var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
+ this.$lines.splice(row, 1, newLine);
+
+ var delta = {
+ action: "removeText",
+ range: range,
+ text: removed
+ };
+ this._dispatchEvent("change", { data: delta });
+ return range.start;
+ };
+
+ /**
+ * Removes a range of full lines
+ *
+ * @param firstRow {Integer} The first row to be removed
+ * @param lastRow {Integer} The last row to be removed
+ * @return {String[]} The removed lines
+ */
+ this.removeLines = function(firstRow, lastRow) {
+ var range = new Range(firstRow, 0, lastRow + 1, 0);
+ var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
+
+ var delta = {
+ action: "removeLines",
+ range: range,
+ nl: this.getNewLineCharacter(),
+ lines: removed
+ };
+ this._dispatchEvent("change", { data: delta });
+ return removed;
+ };
+
+ this.removeNewLine = function(row) {
+ var firstLine = this.getLine(row);
+ var secondLine = this.getLine(row+1);
+
+ var range = new Range(row, firstLine.length, row+1, 0);
+ var line = firstLine + secondLine;
+
+ this.$lines.splice(row, 2, line);
+
+ var delta = {
+ action: "removeText",
+ range: range,
+ text: this.getNewLineCharacter()
+ };
+ this._dispatchEvent("change", { data: delta });
+ };
+
+ this.replace = function(range, text) {
+ if (text.length == 0 && range.isEmpty())
+ return range.start;
+
+ // Shortcut: If the text we want to insert is the same as it is already
+ // in the document, we don't have to replace anything.
+ if (text == this.getTextRange(range))
+ return range.end;
+
+ this.remove(range);
+ if (text) {
+ var end = this.insert(range.start, text);
+ }
+ else {
+ end = range.start;
+ }
+
+ return end;
+ };
+
+ this.applyDeltas = function(deltas) {
+ for (var i=0; i=0; i--) {
+ var delta = deltas[i];
+
+ var range = Range.fromPoints(delta.range.start, delta.range.end);
+
+ if (delta.action == "insertLines")
+ this.removeLines(range.start.row, range.end.row - 1)
+ else if (delta.action == "insertText")
+ this.remove(range)
+ else if (delta.action == "removeLines")
+ this.insertLines(range.start.row, delta.lines)
+ else if (delta.action == "removeText")
+ this.insert(range.start, delta.text)
+ }
+ };
+
+}).call(Document.prototype);
+
+exports.Document = Document;
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/anchor', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event_emitter'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+
+/**
+ * An Anchor is a floating pointer in the document. Whenever text is inserted or
+ * deleted before the cursor, the position of the cursor is updated
+ */
+var Anchor = exports.Anchor = function(doc, row, column) {
+ this.document = doc;
+
+ if (typeof column == "undefined")
+ this.setPosition(row.row, row.column);
+ else
+ this.setPosition(row, column);
+
+ this.$onChange = this.onChange.bind(this);
+ doc.on("change", this.$onChange);
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.getPosition = function() {
+ return this.$clipPositionToDocument(this.row, this.column);
+ };
+
+ this.getDocument = function() {
+ return this.document;
+ };
+
+ this.onChange = function(e) {
+ var delta = e.data;
+ var range = delta.range;
+
+ if (range.start.row == range.end.row && range.start.row != this.row)
+ return;
+
+ if (range.start.row > this.row)
+ return;
+
+ if (range.start.row == this.row && range.start.column > this.column)
+ return;
+
+ var row = this.row;
+ var column = this.column;
+
+ if (delta.action === "insertText") {
+ if (range.start.row === row && range.start.column <= column) {
+ if (range.start.row === range.end.row) {
+ column += range.end.column - range.start.column;
+ }
+ else {
+ column -= range.start.column;
+ row += range.end.row - range.start.row;
+ }
+ }
+ else if (range.start.row !== range.end.row && range.start.row < row) {
+ row += range.end.row - range.start.row;
+ }
+ } else if (delta.action === "insertLines") {
+ if (range.start.row <= row) {
+ row += range.end.row - range.start.row;
+ }
+ }
+ else if (delta.action == "removeText") {
+ if (range.start.row == row && range.start.column < column) {
+ if (range.end.column >= column)
+ column = range.start.column;
+ else
+ column = Math.max(0, column - (range.end.column - range.start.column));
+
+ } else if (range.start.row !== range.end.row && range.start.row < row) {
+ if (range.end.row == row) {
+ column = Math.max(0, column - range.end.column) + range.start.column;
+ }
+ row -= (range.end.row - range.start.row);
+ }
+ else if (range.end.row == row) {
+ row -= range.end.row - range.start.row;
+ column = Math.max(0, column - range.end.column) + range.start.column;
+ }
+ } else if (delta.action == "removeLines") {
+ if (range.start.row <= row) {
+ if (range.end.row <= row)
+ row -= range.end.row - range.start.row;
+ else {
+ row = range.start.row;
+ column = 0;
+ }
+ }
+ }
+
+ this.setPosition(row, column, true);
+ };
+
+ this.setPosition = function(row, column, noClip) {
+ var pos;
+ if (noClip) {
+ pos = {
+ row: row,
+ column: column
+ };
+ }
+ else {
+ pos = this.$clipPositionToDocument(row, column);
+ }
+
+ if (this.row == pos.row && this.column == pos.column)
+ return;
+
+ var old = {
+ row: this.row,
+ column: this.column
+ };
+
+ this.row = pos.row;
+ this.column = pos.column;
+ this._dispatchEvent("change", {
+ old: old,
+ value: pos
+ });
+ };
+
+ this.detach = function() {
+ this.document.removeEventListener("change", this.$onChange);
+ };
+
+ this.$clipPositionToDocument = function(row, column) {
+ var pos = {};
+
+ if (row >= this.document.getLength()) {
+ pos.row = Math.max(0, this.document.getLength() - 1);
+ pos.column = this.document.getLine(pos.row).length;
+ }
+ else if (row < 0) {
+ pos.row = 0;
+ pos.column = 0;
+ }
+ else {
+ pos.row = row;
+ pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
+ }
+
+ if (column < 0)
+ pos.column = 0;
+
+ return pos;
+ };
+
+}).call(Anchor.prototype);
+
+});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/background_tokenizer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event_emitter'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+
+var BackgroundTokenizer = function(tokenizer, editor) {
+ this.running = false;
+ this.lines = [];
+ this.currentLine = 0;
+ this.tokenizer = tokenizer;
+
+ var self = this;
+
+ this.$worker = function() {
+ if (!self.running) { return; }
+
+ var workerStart = new Date();
+ var startLine = self.currentLine;
+ var doc = self.doc;
+
+ var processedLines = 0;
+
+ var len = doc.getLength();
+ while (self.currentLine < len) {
+ self.lines[self.currentLine] = self.$tokenizeRows(self.currentLine, self.currentLine)[0];
+ self.currentLine++;
+
+ // only check every 5 lines
+ processedLines += 1;
+ if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
+ self.fireUpdateEvent(startLine, self.currentLine-1);
+ self.running = setTimeout(self.$worker, 20);
+ return;
+ }
+ }
+
+ self.running = false;
+
+ self.fireUpdateEvent(startLine, len - 1);
+ };
+};
+
+(function(){
+
+ oop.implement(this, EventEmitter);
+
+ this.setTokenizer = function(tokenizer) {
+ this.tokenizer = tokenizer;
+ this.lines = [];
+
+ this.start(0);
+ };
+
+ this.setDocument = function(doc) {
+ this.doc = doc;
+ this.lines = [];
+
+ this.stop();
+ };
+
+ this.fireUpdateEvent = function(firstRow, lastRow) {
+ var data = {
+ first: firstRow,
+ last: lastRow
+ };
+ this._dispatchEvent("update", {data: data});
+ };
+
+ this.start = function(startRow) {
+ this.currentLine = Math.min(startRow || 0, this.currentLine,
+ this.doc.getLength());
+
+ // remove all cached items below this line
+ this.lines.splice(this.currentLine, this.lines.length);
+
+ this.stop();
+ // pretty long delay to prevent the tokenizer from interfering with the user
+ this.running = setTimeout(this.$worker, 700);
+ };
+
+ this.stop = function() {
+ if (this.running)
+ clearTimeout(this.running);
+ this.running = false;
+ };
+
+ this.getTokens = function(firstRow, lastRow) {
+ return this.$tokenizeRows(firstRow, lastRow);
+ };
+
+ this.getState = function(row) {
+ return this.$tokenizeRows(row, row)[0].state;
+ };
+
+ this.$tokenizeRows = function(firstRow, lastRow) {
+ if (!this.doc)
+ return [];
+
+ var rows = [];
+
+ // determine start state
+ var state = "start";
+ var doCache = false;
+ if (firstRow > 0 && this.lines[firstRow - 1]) {
+ state = this.lines[firstRow - 1].state;
+ doCache = true;
+ } else if (firstRow == 0) {
+ state = "start";
+ doCache = true;
+ } else if (this.lines.length > 0) {
+ // Guess that we haven't changed state.
+ state = this.lines[this.lines.length-1].state;
+ }
+
+ var lines = this.doc.getLines(firstRow, lastRow);
+ for (var row=firstRow; row<=lastRow; row++) {
+ if (!this.lines[row]) {
+ var tokens = this.tokenizer.getLineTokens(lines[row-firstRow] || "", state);
+ var state = tokens.state;
+ rows.push(tokens);
+
+ if (doCache) {
+ this.lines[row] = tokens;
+ }
+ }
+ else {
+ var tokens = this.lines[row];
+ state = tokens.state;
+ rows.push(tokens);
+ }
+ }
+ return rows;
+ };
+
+}).call(BackgroundTokenizer.prototype);
+
+exports.BackgroundTokenizer = BackgroundTokenizer;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/edit_session/folding', ['require', 'exports', 'module' , 'ace/range', 'ace/edit_session/fold_line', 'ace/edit_session/fold'], function(require, exports, module) {
+
+var Range = require("ace/range").Range;
+var FoldLine = require("ace/edit_session/fold_line").FoldLine;
+var Fold = require("ace/edit_session/fold").Fold;
+
+function Folding() {
+ /**
+ * Looks up a fold at a given row/column. Possible values for side:
+ * -1: ignore a fold if fold.start = row/column
+ * +1: ignore a fold if fold.end = row/column
+ */
+ this.getFoldAt = function(row, column, side) {
+ var foldLine = this.getFoldLine(row);
+ if (!foldLine)
+ return null;
+
+ var folds = foldLine.folds;
+ for (var i = 0; i < folds.length; i++) {
+ var fold = folds[i];
+ if (fold.range.contains(row, column)) {
+ if (side == 1 && fold.range.isEnd(row, column)) {
+ continue;
+ } else if (side == -1 && fold.range.isStart(row, column)) {
+ continue;
+ }
+ return fold;
+ }
+ }
+ };
+
+ /**
+ * Returns all folds in the given range. Note, that this will return folds
+ *
+ */
+ this.getFoldsInRange = function(range) {
+ range = range.clone();
+ var start = range.start;
+ var end = range.end;
+ var foldLines = this.$foldData;
+ var foundFolds = [];
+
+ start.column += 1;
+ end.column -= 1;
+
+ for (var i = 0; i < foldLines.length; i++) {
+ var cmp = foldLines[i].range.compareRange(range);
+ if (cmp == 2) {
+ // Range is before foldLine. No intersection. This means,
+ // there might be other foldLines that intersect.
+ continue;
+ }
+ else if (cmp == -2) {
+ // Range is after foldLine. There can't be any other foldLines then,
+ // so let's give up.
+ break;
+ }
+
+ var folds = foldLines[i].folds;
+ for (var j = 0; j < folds.length; j++) {
+ var fold = folds[j];
+ cmp = fold.range.compareRange(range);
+ if (cmp == -2) {
+ break;
+ } else if (cmp == 2) {
+ continue;
+ } else
+ // WTF-state: Can happen due to -1/+1 to start/end column.
+ if (cmp == 42) {
+ break;
+ }
+ foundFolds.push(fold);
+ }
+ }
+ return foundFolds;
+ }
+
+ /**
+ * Returns the string between folds at the given position.
+ * E.g.
+ * foob|arwolrd -> "bar"
+ * foobarwol|rd -> "world"
+ * foobarwolrd ->
+ *
+ * where | means the position of row/column
+ *
+ * The trim option determs if the return string should be trimed according
+ * to the "side" passed with the trim value:
+ *
+ * E.g.
+ * foob|arwolrd -trim=-1> "b"
+ * foobarwol|rd -trim=+1> "rld"
+ * fo|obarwolrd -trim=00> "foo"
+ */
+ this.getFoldStringAt = function(row, column, trim, foldLine) {
+ var foldLine = foldLine || this.getFoldLine(row);
+ if (!foldLine)
+ return null;
+
+ var lastFold = {
+ end: { column: 0 }
+ };
+ // TODO: Refactor to use getNextFoldTo function.
+ for (var i = 0; i < foldLine.folds.length; i++) {
+ var fold = foldLine.folds[i];
+ var cmp = fold.range.compareEnd(row, column);
+ if (cmp == -1) {
+ var str = this
+ .getLine(fold.start.row)
+ .substring(lastFold.end.column, fold.start.column);
+ break;
+ }
+ else if (cmp == 0) {
+ return null;
+ }
+ lastFold = fold;
+ }
+ if (!str)
+ str = this.getLine(fold.start.row).substring(lastFold.end.column);
+
+ if (trim == -1)
+ return str.substring(0, column - lastFold.end.column);
+ else if (trim == 1)
+ return str.substring(column - lastFold.end.column)
+ else
+ return str;
+ }
+
+ this.getFoldLine = function(docRow, startFoldLine) {
+ var foldData = this.$foldData;
+ var i = 0;
+ if (startFoldLine)
+ i = foldData.indexOf(startFoldLine);
+ if (i == -1)
+ i = 0;
+ for (i; i < foldData.length; i++) {
+ var foldLine = foldData[i];
+ if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
+ return foldLine;
+ } else if (foldLine.end.row > docRow) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ // returns the fold which starts after or contains docRow
+ this.getNextFold = function(docRow, startFoldLine) {
+ var foldData = this.$foldData, ans;
+ var i = 0;
+ if (startFoldLine)
+ i = foldData.indexOf(startFoldLine);
+ if (i == -1)
+ i = 0;
+ for (i; i < foldData.length; i++) {
+ var foldLine = foldData[i];
+ if (foldLine.end.row >= docRow) {
+ return foldLine;
+ }
+ }
+ return null;
+ }
+
+ this.getFoldedRowCount = function(first, last) {
+ var foldData = this.$foldData, rowCount = last-first+1;
+ for (var i = 0; i < foldData.length; i++) {
+ var foldLine = foldData[i],
+ end = foldLine.end.row,
+ start = foldLine.start.row;
+ if (end >= last) {
+ if(start < last) {
+ if(start >= first)
+ rowCount -= last-start;
+ else
+ rowCount = 0;//in one fold
+ }
+ break;
+ } else if(end >= first){
+ if (start >= first) //fold inside range
+ rowCount -= end-start;
+ else
+ rowCount -= end-first+1;
+ }
+ }
+ return rowCount;
+ }
+
+ this.$addFoldLine = function(foldLine) {
+ this.$foldData.push(foldLine);
+ this.$foldData.sort(function(a, b) {
+ return a.start.row - b.start.row;
+ });
+ return foldLine;
+ }
+
+ /**
+ * Adds a new fold.
+ *
+ * @returns
+ * The new created Fold object or an existing fold object in case the
+ * passed in range fits an existing fold exactly.
+ */
+ this.addFold = function(placeholder, range) {
+ var foldData = this.$foldData;
+ var added = false;
+
+ if (placeholder instanceof Fold)
+ var fold = placeholder;
+ else
+ fold = new Fold(range, placeholder);
+
+ var startRow = fold.start.row;
+ var startColumn = fold.start.column;
+ var endRow = fold.end.row;
+ var endColumn = fold.end.column;
+
+ // --- Some checking ---
+ if (fold.placeholder.length < 2)
+ throw "Placeholder has to be at least 2 characters";
+
+ if (startRow == endRow && endColumn - startColumn < 2)
+ throw "The range has to be at least 2 characters width";
+
+ var existingFold = this.getFoldAt(startRow, startColumn, 1);
+ if (
+ existingFold
+ && existingFold.range.isEnd(endRow, endColumn)
+ && existingFold.range.isStart(startRow, startColumn)
+ ) {
+ return fold;
+ }
+
+ existingFold = this.getFoldAt(startRow, startColumn, 1);
+ if (existingFold && !existingFold.range.isStart(startRow, startColumn))
+ throw "A fold can't start inside of an already existing fold";
+
+ existingFold = this.getFoldAt(endRow, endColumn, -1);
+ if (existingFold && !existingFold.range.isEnd(endRow, endColumn))
+ throw "A fold can't end inside of an already existing fold";
+
+ if (endRow >= this.doc.getLength())
+ throw "End of fold is outside of the document.";
+
+ if (endColumn > this.getLine(endRow).length || startColumn > this.getLine(startRow).length)
+ throw "End of fold is outside of the document.";
+
+ // Check if there are folds in the range we create the new fold for.
+ var folds = this.getFoldsInRange(fold.range);
+ if (folds.length > 0) {
+ // Remove the folds from fold data.
+ this.removeFolds(folds);
+ // Add the removed folds as subfolds on the new fold.
+ fold.subFolds = folds;
+ }
+
+ for (var i = 0; i < foldData.length; i++) {
+ var foldLine = foldData[i];
+ if (endRow == foldLine.start.row) {
+ foldLine.addFold(fold);
+ added = true;
+ break;
+ }
+ else if (startRow == foldLine.end.row) {
+ foldLine.addFold(fold);
+ added = true;
+ if (!fold.sameRow) {
+ // Check if we might have to merge two FoldLines.
+ foldLineNext = foldData[i + 1];
+ if (foldLineNext && foldLineNext.start.row == endRow) {
+ // We need to merge!
+ foldLine.merge(foldLineNext);
+ break;
+ }
+ }
+ break;
+ }
+ else if (endRow <= foldLine.start.row) {
+ break;
+ }
+ }
+
+ if (!added)
+ foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
+
+ if (this.$useWrapMode)
+ this.$updateWrapData(foldLine.start.row, foldLine.start.row);
+
+ // Notify that fold data has changed.
+ this.$modified = true;
+ this._dispatchEvent("changeFold", { data: fold });
+
+ return fold;
+ };
+
+ this.addFolds = function(folds) {
+ folds.forEach(function(fold) {
+ this.addFold(fold);
+ }, this);
+ };
+
+ this.removeFold = function(fold) {
+ var foldLine = fold.foldLine;
+ var startRow = foldLine.start.row;
+ var endRow = foldLine.end.row;
+
+ var foldLines = this.$foldData,
+ folds = foldLine.folds;
+ // Simple case where there is only one fold in the FoldLine such that
+ // the entire fold line can get removed directly.
+ if (folds.length == 1) {
+ foldLines.splice(foldLines.indexOf(foldLine), 1);
+ } else
+ // If the fold is the last fold of the foldLine, just remove it.
+ if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
+ folds.pop();
+ foldLine.end.row = folds[folds.length - 1].end.row;
+ foldLine.end.column = folds[folds.length - 1].end.column;
+ } else
+ // If the fold is the first fold of the foldLine, just remove it.
+ if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
+ folds.shift();
+ foldLine.start.row = folds[0].start.row;
+ foldLine.start.column = folds[0].start.column;
+ } else
+ // We know there are more then 2 folds and the fold is not at the edge.
+ // This means, the fold is somewhere in between.
+ //
+ // If the fold is in one row, we just can remove it.
+ if (fold.sameRow) {
+ folds.splice(folds.indexOf(fold), 1);
+ } else
+ // The fold goes over more then one row. This means remvoing this fold
+ // will cause the fold line to get splitted up.
+ {
+ var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
+ newFoldLine.folds.shift();
+ foldLine.start.row = folds[0].start.row;
+ foldLine.start.column = folds[0].start.column;
+ this.$addFoldLine(newFoldLine);
+ }
+
+ if (this.$useWrapMode) {
+ this.$updateWrapData(startRow, endRow);
+ }
+
+ // Notify that fold data has changed.
+ this.$modified = true;
+ this._dispatchEvent("changeFold", { data: fold });
+ }
+
+ this.removeFolds = function(folds) {
+ // We need to clone the folds array passed in as it might be the folds
+ // array of a fold line and as we call this.removeFold(fold), folds
+ // are removed from folds and changes the current index.
+ var cloneFolds = [];
+ for (var i = 0; i < folds.length; i++) {
+ cloneFolds.push(folds[i]);
+ }
+
+ cloneFolds.forEach(function(fold) {
+ this.removeFold(fold);
+ }, this);
+ this.$modified = true;
+ }
+
+ this.expandFold = function(fold) {
+ this.removeFold(fold);
+ fold.subFolds.forEach(function(fold) {
+ this.addFold(fold);
+ }, this);
+ fold.subFolds = [];
+ }
+
+ this.expandFolds = function(folds) {
+ folds.forEach(function(fold) {
+ this.expandFold(fold);
+ }, this);
+ }
+
+ /**
+ * Checks if a given documentRow is folded. This is true if there are some
+ * folded parts such that some parts of the line is still visible.
+ **/
+ this.isRowFolded = function(docRow, startFoldRow) {
+ return !!this.getFoldLine(docRow, startFoldRow);
+ };
+
+ this.getRowFoldEnd = function(docRow, startFoldRow) {
+ var foldLine = this.getFoldLine(docRow, startFoldRow);
+ return (foldLine
+ ? foldLine.end.row
+ : docRow)
+ };
+
+ this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
+ if (startRow == null) {
+ startRow = foldLine.start.row;
+ startColumn = 0;
+ }
+
+ if (endRow == null) {
+ endRow = foldLine.end.row;
+ endColumn = this.getLine(endRow).length;
+ }
+
+ // Build the textline using the FoldLine walker.
+ var line = "";
+ var doc = this.doc;
+ var textLine = "";
+
+ foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
+ if (row < startRow) {
+ return;
+ } else if (row == startRow) {
+ if (column < startColumn) {
+ return;
+ }
+ lastColumn = Math.max(startColumn, lastColumn);
+ }
+ if (placeholder) {
+ textLine += placeholder;
+ } else {
+ textLine += doc.getLine(row).substring(lastColumn, column);
+ }
+ }.bind(this), endRow, endColumn);
+ return textLine;
+ };
+
+ this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
+ var foldLine = this.getFoldLine(row);
+
+ if (!foldLine) {
+ var line;
+ line = this.doc.getLine(row);
+ return line.substring(startColumn || 0, endColumn || line.length);
+ } else {
+ return this.getFoldDisplayLine(
+ foldLine, row, endColumn, startRow, startColumn);
+ }
+ };
+
+ this.$cloneFoldData = function() {
+ var foldData = this.$foldData;
+ var fd = [];
+ fd = this.$foldData.map(function(foldLine) {
+ var folds = foldLine.folds.map(function(fold) {
+ return fold.clone();
+ });
+ return new FoldLine(fd, folds);
+ });
+
+ return fd;
+ };
+}
+
+exports.Folding = Folding;
+
+});/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/edit_session/fold_line', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
+
+var Range = require("ace/range").Range;
+
+/**
+ * If the an array is passed in, the folds are expected to be sorted already.
+ */
+function FoldLine(foldData, folds) {
+ this.foldData = foldData;
+ if (Array.isArray(folds)) {
+ this.folds = folds;
+ } else {
+ folds = this.folds = [ folds ];
+ }
+
+ var last = folds[folds.length - 1]
+ this.range = new Range(folds[0].start.row, folds[0].start.column,
+ last.end.row, last.end.column);
+ this.start = this.range.start;
+ this.end = this.range.end;
+
+ this.folds.forEach(function(fold) {
+ fold.setFoldLine(this);
+ }, this);
+}
+
+(function() {
+ /**
+ * Note: This doesn't update wrapData!
+ */
+ this.shiftRow = function(shift) {
+ this.start.row += shift;
+ this.end.row += shift;
+ this.folds.forEach(function(fold) {
+ fold.start.row += shift;
+ fold.end.row += shift;
+ });
+ }
+
+ this.addFold = function(fold) {
+ if (fold.sameRow) {
+ if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
+ throw "Can't add a fold to this FoldLine as it has no connection";
+ }
+ this.folds.push(fold);
+ this.folds.sort(function(a, b) {
+ return -a.range.compareEnd(b.start.row, b.start.column);
+ });
+ if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
+ this.end.row = fold.end.row;
+ this.end.column = fold.end.column;
+ } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
+ this.start.row = fold.start.row;
+ this.start.column = fold.start.column;
+ }
+ } else if (fold.start.row == this.end.row) {
+ this.folds.push(fold);
+ this.end.row = fold.end.row;
+ this.end.column = fold.end.column;
+ } else if (fold.end.row == this.start.row) {
+ this.folds.unshift(fold);
+ this.start.row = fold.start.row;
+ this.start.column = fold.start.column;
+ } else {
+ throw "Trying to add fold to FoldRow that doesn't have a matching row";
+ }
+ fold.foldLine = this;
+ }
+
+ this.containsRow = function(row) {
+ return row >= this.start.row && row <= this.end.row;
+ }
+
+ this.walk = function(callback, endRow, endColumn) {
+ var lastEnd = 0,
+ folds = this.folds,
+ fold,
+ comp, stop, isNewRow = true;
+
+ if (endRow == null) {
+ endRow = this.end.row;
+ endColumn = this.end.column;
+ }
+
+ for (var i = 0; i < folds.length; i++) {
+ fold = folds[i];
+
+ comp = fold.range.compareStart(endRow, endColumn);
+ // This fold is after the endRow/Column.
+ if (comp == -1) {
+ callback(null, endRow, endColumn, lastEnd, isNewRow);
+ return;
+ }
+
+ stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
+ stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
+
+ // If the user requested to stop the walk or endRow/endColumn is
+ // inside of this fold (comp == 0), then end here.
+ if (stop || comp == 0) {
+ return;
+ }
+
+ // Note the new lastEnd might not be on the same line. However,
+ // it's the callback's job to recognize this.
+ isNewRow = !fold.sameRow;
+ lastEnd = fold.end.column;
+ }
+ callback(null, endRow, endColumn, lastEnd, isNewRow);
+ }
+
+ this.getNextFoldTo = function(row, column) {
+ var fold, cmp;
+ for (var i = 0; i < this.folds.length; i++) {
+ fold = this.folds[i];
+ cmp = fold.range.compareEnd(row, column);
+ if (cmp == -1) {
+ return {
+ fold: fold,
+ kind: "after"
+ };
+ } else if (cmp == 0) {
+ return {
+ fold: fold,
+ kind: "inside"
+ }
+ }
+ }
+ return null;
+ }
+
+ this.addRemoveChars = function(row, column, len) {
+ var ret = this.getNextFoldTo(row, column),
+ fold, folds;
+ if (ret) {
+ fold = ret.fold;
+ if (ret.kind == "inside"
+ && fold.start.column != column
+ && fold.start.row != row)
+ {
+ throw "Moving characters inside of a fold should never be reached";
+ } else if (fold.start.row == row) {
+ folds = this.folds;
+ var i = folds.indexOf(fold);
+ if (i == 0) {
+ this.start.column += len;
+ }
+ for (i; i < folds.length; i++) {
+ fold = folds[i];
+ fold.start.column += len;
+ if (!fold.sameRow) {
+ return;
+ }
+ fold.end.column += len;
+ }
+ this.end.column += len;
+ }
+ }
+ }
+
+ this.split = function(row, column) {
+ var fold = this.getNextFoldTo(row, column).fold,
+ folds = this.folds;
+ var foldData = this.foldData;
+
+ if (!fold) {
+ return null;
+ }
+ var i = folds.indexOf(fold);
+ var foldBefore = folds[i - 1];
+ this.end.row = foldBefore.end.row;
+ this.end.column = foldBefore.end.column;
+
+ // Remove the folds after row/column and create a new FoldLine
+ // containing these removed folds.
+ folds = folds.splice(i, folds.length - i);
+
+ var newFoldLine = new FoldLine(foldData, folds);
+ foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
+ return newFoldLine;
+ }
+
+ this.merge = function(foldLineNext) {
+ var folds = foldLineNext.folds;
+ for (var i = 0; i < folds.length; i++) {
+ this.addFold(folds[i]);
+ }
+ // Remove the foldLineNext - no longer needed, as
+ // it's merged now with foldLineNext.
+ var foldData = this.foldData;
+ foldData.splice(foldData.indexOf(foldLineNext), 1);
+ }
+
+ this.toString = function() {
+ var ret = [this.range.toString() + ": [" ];
+
+ this.folds.forEach(function(fold) {
+ ret.push(" " + fold.toString());
+ });
+ ret.push("]")
+ return ret.join("\n");
+ }
+
+ this.idxToPosition = function(idx) {
+ var lastFoldEndColumn = 0;
+ var fold;
+
+ for (var i = 0; i < this.folds.length; i++) {
+ var fold = this.folds[i];
+
+ idx -= fold.start.column - lastFoldEndColumn;
+ if (idx < 0) {
+ return {
+ row: fold.start.row,
+ column: fold.start.column + idx
+ };
+ }
+
+ idx -= fold.placeholder.length;
+ if (idx < 0) {
+ return fold.start;
+ }
+
+ lastFoldEndColumn = fold.end.column;
+ }
+
+ return {
+ row: this.end.row,
+ column: this.end.column + idx
+ };
+ }
+}).call(FoldLine.prototype);
+
+exports.FoldLine = FoldLine;
+});/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/edit_session/fold', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+/**
+ * Simple fold-data struct.
+ **/
+var Fold = exports.Fold = function(range, placeholder) {
+ this.foldLine = null;
+ this.placeholder = placeholder;
+ this.range = range;
+ this.start = range.start;
+ this.end = range.end;
+
+ this.sameRow = range.start.row == range.end.row;
+ this.subFolds = [];
+};
+
+(function() {
+
+ this.toString = function() {
+ return '"' + this.placeholder + '" ' + this.range.toString();
+ };
+
+ this.setFoldLine = function(foldLine) {
+ this.foldLine = foldLine;
+ this.subFolds.forEach(function(fold) {
+ fold.setFoldLine(foldLine);
+ });
+ };
+
+ this.clone = function() {
+ var range = this.range.clone();
+ var fold = new Fold(range, this.placeholder);
+ this.subFolds.forEach(function(subFold) {
+ fold.subFolds.push(subFold.clone());
+ });
+ return fold;
+ };
+
+}).call(Fold.prototype);
+
+});/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Mihai Sucan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/search', ['require', 'exports', 'module' , 'pilot/lang', 'pilot/oop', 'ace/range'], function(require, exports, module) {
+
+var lang = require("pilot/lang");
+var oop = require("pilot/oop");
+var Range = require("ace/range").Range;
+
+var Search = function() {
+ this.$options = {
+ needle: "",
+ backwards: false,
+ wrap: false,
+ caseSensitive: false,
+ wholeWord: false,
+ scope: Search.ALL,
+ regExp: false
+ };
+};
+
+Search.ALL = 1;
+Search.SELECTION = 2;
+
+(function() {
+
+ this.set = function(options) {
+ oop.mixin(this.$options, options);
+ return this;
+ };
+
+ this.getOptions = function() {
+ return lang.copyObject(this.$options);
+ };
+
+ this.find = function(session) {
+ if (!this.$options.needle)
+ return null;
+
+ if (this.$options.backwards) {
+ var iterator = this.$backwardMatchIterator(session);
+ } else {
+ iterator = this.$forwardMatchIterator(session);
+ }
+
+ var firstRange = null;
+ iterator.forEach(function(range) {
+ firstRange = range;
+ return true;
+ });
+
+ return firstRange;
+ };
+
+ this.findAll = function(session) {
+ if (!this.$options.needle)
+ return [];
+
+ if (this.$options.backwards) {
+ var iterator = this.$backwardMatchIterator(session);
+ } else {
+ iterator = this.$forwardMatchIterator(session);
+ }
+
+ var ranges = [];
+ iterator.forEach(function(range) {
+ ranges.push(range);
+ });
+
+ return ranges;
+ };
+
+ this.replace = function(input, replacement) {
+ var re = this.$assembleRegExp();
+ var match = re.exec(input);
+ if (match && match[0].length == input.length) {
+ if (this.$options.regExp) {
+ return input.replace(re, replacement);
+ } else {
+ return replacement;
+ }
+ } else {
+ return null;
+ }
+ };
+
+ this.$forwardMatchIterator = function(session) {
+ var re = this.$assembleRegExp();
+ var self = this;
+
+ return {
+ forEach: function(callback) {
+ self.$forwardLineIterator(session).forEach(function(line, startIndex, row) {
+ if (startIndex) {
+ line = line.substring(startIndex);
+ }
+
+ var matches = [];
+
+ line.replace(re, function(str) {
+ var offset = arguments[arguments.length-2];
+ matches.push({
+ str: str,
+ offset: startIndex + offset
+ });
+ return str;
+ });
+
+ for (var i=0; i= 0; i--) {
+ var match = matches[i];
+ var range = self.$rangeFromMatch(row, match.offset, match.str.length);
+ if (callback(range))
+ return true;
+ }
+ });
+ }
+ };
+ };
+
+ this.$rangeFromMatch = function(row, column, length) {
+ return new Range(row, column, row, column+length);
+ };
+
+ this.$assembleRegExp = function() {
+ if (this.$options.regExp) {
+ var needle = this.$options.needle;
+ } else {
+ needle = lang.escapeRegExp(this.$options.needle);
+ }
+
+ if (this.$options.wholeWord) {
+ needle = "\\b" + needle + "\\b";
+ }
+
+ var modifier = "g";
+ if (!this.$options.caseSensitive) {
+ modifier += "i";
+ }
+
+ var re = new RegExp(needle, modifier);
+ return re;
+ };
+
+ this.$forwardLineIterator = function(session) {
+ var searchSelection = this.$options.scope == Search.SELECTION;
+
+ var range = session.getSelection().getRange();
+ var start = session.getSelection().getCursor();
+
+ var firstRow = searchSelection ? range.start.row : 0;
+ var firstColumn = searchSelection ? range.start.column : 0;
+ var lastRow = searchSelection ? range.end.row : session.getLength() - 1;
+
+ var wrap = this.$options.wrap;
+ var inWrap = false;
+
+ function getLine(row) {
+ var line = session.getLine(row);
+ if (searchSelection && row == range.end.row) {
+ line = line.substring(0, range.end.column);
+ }
+ if (inWrap && row == start.row) {
+ line = line.substring(0, start.column);
+ }
+ return line;
+ }
+
+ return {
+ forEach: function(callback) {
+ var row = start.row;
+
+ var line = getLine(row);
+ var startIndex = start.column;
+
+ var stop = false;
+ inWrap = false;
+
+ while (!callback(line, startIndex, row)) {
+
+ if (stop) {
+ return;
+ }
+
+ row++;
+ startIndex = 0;
+
+ if (row > lastRow) {
+ if (wrap) {
+ row = firstRow;
+ startIndex = firstColumn;
+ inWrap = true;
+ } else {
+ return;
+ }
+ }
+
+ if (row == start.row)
+ stop = true;
+
+ line = getLine(row);
+ }
+ }
+ };
+ };
+
+ this.$backwardLineIterator = function(session) {
+ var searchSelection = this.$options.scope == Search.SELECTION;
+
+ var range = session.getSelection().getRange();
+ var start = searchSelection ? range.end : range.start;
+
+ var firstRow = searchSelection ? range.start.row : 0;
+ var firstColumn = searchSelection ? range.start.column : 0;
+ var lastRow = searchSelection ? range.end.row : session.getLength() - 1;
+
+ var wrap = this.$options.wrap;
+
+ return {
+ forEach : function(callback) {
+ var row = start.row;
+
+ var line = session.getLine(row).substring(0, start.column);
+ var startIndex = 0;
+ var stop = false;
+ var inWrap = false;
+
+ while (!callback(line, startIndex, row)) {
+
+ if (stop)
+ return;
+
+ row--;
+ startIndex = 0;
+
+ if (row < firstRow) {
+ if (wrap) {
+ row = lastRow;
+ inWrap = true;
+ } else {
+ return;
+ }
+ }
+
+ if (row == start.row)
+ stop = true;
+
+ line = session.getLine(row);
+ if (searchSelection) {
+ if (row == firstRow)
+ startIndex = firstColumn;
+ else if (row == lastRow)
+ line = line.substring(0, range.end.column);
+ }
+
+ if (inWrap && row == start.row)
+ startIndex = start.column;
+ }
+ }
+ };
+ };
+
+}).call(Search.prototype);
+
+exports.Search = Search;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Mihai Sucan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/undomanager', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+var UndoManager = function() {
+ this.reset();
+};
+
+(function() {
+
+ this.execute = function(options) {
+ var deltas = options.args[0];
+ this.$doc = options.args[1];
+ this.$undoStack.push(deltas);
+ this.$redoStack = [];
+ };
+
+ this.undo = function(dontSelect) {
+ var deltas = this.$undoStack.pop();
+ var undoSelectionRange = null;
+ if (deltas) {
+ undoSelectionRange =
+ this.$doc.undoChanges(deltas, dontSelect);
+ this.$redoStack.push(deltas);
+ }
+ return undoSelectionRange;
+ };
+
+ this.redo = function(dontSelect) {
+ var deltas = this.$redoStack.pop();
+ var redoSelectionRange = null;
+ if (deltas) {
+ redoSelectionRange =
+ this.$doc.redoChanges(deltas, dontSelect);
+ this.$undoStack.push(deltas);
+ }
+ return redoSelectionRange;
+ };
+
+ this.reset = function() {
+ this.$undoStack = [];
+ this.$redoStack = [];
+ };
+
+ this.hasUndo = function() {
+ return this.$undoStack.length > 0;
+ };
+
+ this.hasRedo = function() {
+ return this.$redoStack.length > 0;
+ };
+
+}).call(UndoManager.prototype);
+
+exports.UndoManager = UndoManager;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Irakli Gozalishvili (http://jeditoolkit.com)
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/virtual_renderer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/event', 'pilot/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'pilot/event_emitter', 'text/ace/css/editor.css'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var dom = require("pilot/dom");
+var event = require("pilot/event");
+var useragent = require("pilot/useragent");
+var GutterLayer = require("ace/layer/gutter").Gutter;
+var MarkerLayer = require("ace/layer/marker").Marker;
+var TextLayer = require("ace/layer/text").Text;
+var CursorLayer = require("ace/layer/cursor").Cursor;
+var ScrollBar = require("ace/scrollbar").ScrollBar;
+var RenderLoop = require("ace/renderloop").RenderLoop;
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+var editorCss = require("text/ace/css/editor.css");
+
+// import CSS once
+dom.importCssString(editorCss);
+
+var VirtualRenderer = function(container, theme) {
+ this.container = container;
+ dom.addCssClass(this.container, "ace_editor");
+
+ this.setTheme(theme);
+
+ this.$gutter = dom.createElement("div");
+ this.$gutter.className = "ace_gutter";
+ this.container.appendChild(this.$gutter);
+
+ this.scroller = dom.createElement("div");
+ this.scroller.className = "ace_scroller";
+ this.container.appendChild(this.scroller);
+
+ this.content = dom.createElement("div");
+ this.content.className = "ace_content";
+ this.scroller.appendChild(this.content);
+
+ this.$gutterLayer = new GutterLayer(this.$gutter);
+ this.$markerBack = new MarkerLayer(this.content);
+
+ var textLayer = this.$textLayer = new TextLayer(this.content);
+ this.canvas = textLayer.element;
+
+ this.$markerFront = new MarkerLayer(this.content);
+
+ this.characterWidth = textLayer.getCharacterWidth();
+ this.lineHeight = textLayer.getLineHeight();
+
+ this.$cursorLayer = new CursorLayer(this.content);
+ this.$cursorPadding = 8;
+
+ // Indicates whether the horizontal scrollbar is visible
+ this.$horizScroll = true;
+ this.$horizScrollAlwaysVisible = true;
+
+ this.scrollBar = new ScrollBar(container);
+ this.scrollBar.addEventListener("scroll", this.onScroll.bind(this));
+
+ this.scrollTop = 0;
+
+ this.cursorPos = {
+ row : 0,
+ column : 0
+ };
+
+ var _self = this;
+ this.$textLayer.addEventListener("changeCharaterSize", function() {
+ _self.characterWidth = textLayer.getCharacterWidth();
+ _self.lineHeight = textLayer.getLineHeight();
+ _self.$updatePrintMargin();
+ _self.onResize(true);
+
+ _self.$loop.schedule(_self.CHANGE_FULL);
+ });
+ event.addListener(this.$gutter, "click", this.$onGutterClick.bind(this));
+ event.addListener(this.$gutter, "dblclick", this.$onGutterClick.bind(this));
+
+ this.$size = {
+ width: 0,
+ height: 0,
+ scrollerHeight: 0,
+ scrollerWidth: 0
+ };
+
+ this.layerConfig = {
+ width : 1,
+ padding : 0,
+ firstRow : 0,
+ firstRowScreen: 0,
+ lastRow : 0,
+ lineHeight : 1,
+ characterWidth : 1,
+ minHeight : 1,
+ maxHeight : 1,
+ offset : 0,
+ height : 1
+ };
+
+ this.$loop = new RenderLoop(this.$renderChanges.bind(this));
+ this.$loop.schedule(this.CHANGE_FULL);
+
+ this.setPadding(4);
+ this.$updatePrintMargin();
+};
+
+(function() {
+ this.showGutter = true;
+
+ this.CHANGE_CURSOR = 1;
+ this.CHANGE_MARKER = 2;
+ this.CHANGE_GUTTER = 4;
+ this.CHANGE_SCROLL = 8;
+ this.CHANGE_LINES = 16;
+ this.CHANGE_TEXT = 32;
+ this.CHANGE_SIZE = 64;
+ this.CHANGE_MARKER_BACK = 128;
+ this.CHANGE_MARKER_FRONT = 256;
+ this.CHANGE_FULL = 512;
+
+ oop.implement(this, EventEmitter);
+
+ this.setSession = function(session) {
+ this.session = session;
+ this.$cursorLayer.setSession(session);
+ this.$markerBack.setSession(session);
+ this.$markerFront.setSession(session);
+ this.$gutterLayer.setSession(session);
+ this.$textLayer.setSession(session);
+ this.$loop.schedule(this.CHANGE_FULL);
+ };
+
+ /**
+ * Triggers partial update of the text layer
+ */
+ this.updateLines = function(firstRow, lastRow) {
+ if (lastRow === undefined)
+ lastRow = Infinity;
+
+ if (!this.$changedLines) {
+ this.$changedLines = {
+ firstRow: firstRow,
+ lastRow: lastRow
+ };
+ }
+ else {
+ if (this.$changedLines.firstRow > firstRow)
+ this.$changedLines.firstRow = firstRow;
+
+ if (this.$changedLines.lastRow < lastRow)
+ this.$changedLines.lastRow = lastRow;
+ }
+
+ this.$loop.schedule(this.CHANGE_LINES);
+ };
+
+ /**
+ * Triggers full update of the text layer
+ */
+ this.updateText = function() {
+ this.$loop.schedule(this.CHANGE_TEXT);
+ };
+
+ /**
+ * Triggers a full update of all layers
+ */
+ this.updateFull = function() {
+ this.$loop.schedule(this.CHANGE_FULL);
+ };
+
+ this.updateFontSize = function() {
+ this.$textLayer.checkForSizeChanges();
+ };
+
+ /**
+ * Triggers resize of the editor
+ */
+ this.onResize = function(force) {
+ var changes = this.CHANGE_SIZE;
+ var size = this.$size;
+
+ var height = dom.getInnerHeight(this.container);
+ if (force || size.height != height) {
+ size.height = height;
+
+ this.scroller.style.height = height + "px";
+ size.scrollerHeight = this.scroller.clientHeight;
+ this.scrollBar.setHeight(size.scrollerHeight);
+
+ if (this.session) {
+ this.scrollToY(this.getScrollTop());
+ changes = changes | this.CHANGE_FULL;
+ }
+ }
+
+ var width = dom.getInnerWidth(this.container);
+ if (force || size.width != width) {
+ size.width = width;
+
+ var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
+ this.scroller.style.left = gutterWidth + "px";
+ size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth())
+ this.scroller.style.width = size.scrollerWidth + "px";
+
+ if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
+ changes = changes | this.CHANGE_FULL;
+ }
+
+ this.$loop.schedule(changes);
+ };
+
+ this.adjustWrapLimit = function(){
+ var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
+ var limit = Math.floor(availableWidth / this.characterWidth) - 1;
+ return this.session.adjustWrapLimit(limit);
+ };
+
+ this.$onGutterClick = function(e) {
+ var pageX = event.getDocumentX(e);
+ var pageY = event.getDocumentY(e);
+
+ this._dispatchEvent("gutter" + e.type, {
+ row: this.screenToTextCoordinates(pageX, pageY).row,
+ htmlEvent: e
+ });
+ };
+
+ this.setShowInvisibles = function(showInvisibles) {
+ if (this.$textLayer.setShowInvisibles(showInvisibles))
+ this.$loop.schedule(this.CHANGE_TEXT);
+ };
+
+ this.getShowInvisibles = function() {
+ return this.$textLayer.showInvisibles;
+ };
+
+ this.$showPrintMargin = true;
+ this.setShowPrintMargin = function(showPrintMargin) {
+ this.$showPrintMargin = showPrintMargin;
+ this.$updatePrintMargin();
+ };
+
+ this.getShowPrintMargin = function() {
+ return this.$showPrintMargin;
+ };
+
+ this.$printMarginColumn = 80;
+ this.setPrintMarginColumn = function(showPrintMargin) {
+ this.$printMarginColumn = showPrintMargin;
+ this.$updatePrintMargin();
+ };
+
+ this.getPrintMarginColumn = function() {
+ return this.$printMarginColumn;
+ };
+
+ this.getShowGutter = function(){
+ return this.showGutter;
+ };
+
+ this.setShowGutter = function(show){
+ if(this.showGutter === show)
+ return;
+ this.$gutter.style.display = show ? "block" : "none";
+ this.showGutter = show;
+ this.onResize(true);
+ };
+
+ this.$updatePrintMargin = function() {
+ var containerEl;
+
+ if (!this.$showPrintMargin && !this.$printMarginEl)
+ return;
+
+ if (!this.$printMarginEl) {
+ containerEl = dom.createElement("div");
+ containerEl.className = "ace_print_margin_layer";
+ this.$printMarginEl = dom.createElement("div");
+ this.$printMarginEl.className = "ace_print_margin";
+ containerEl.appendChild(this.$printMarginEl);
+ this.content.insertBefore(containerEl, this.$textLayer.element);
+ }
+
+ var style = this.$printMarginEl.style;
+ style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding * 2) + "px";
+ style.visibility = this.$showPrintMargin ? "visible" : "hidden";
+ };
+
+ this.getContainerElement = function() {
+ return this.container;
+ };
+
+ this.getMouseEventTarget = function() {
+ return this.content;
+ };
+
+ this.getTextAreaContainer = function() {
+ return this.container;
+ };
+
+ this.moveTextAreaToCursor = function(textarea) {
+ // in IE the native cursor always shines through
+ if (useragent.isIE)
+ return;
+
+ var pos = this.$cursorLayer.getPixelPosition();
+ if (!pos)
+ return;
+
+ var bounds = this.content.getBoundingClientRect();
+ var offset = this.layerConfig.offset;
+
+ textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
+ textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
+ };
+
+ this.getFirstVisibleRow = function() {
+ return this.layerConfig.firstRow;
+ };
+
+ this.getFirstFullyVisibleRow = function() {
+ return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
+ };
+
+ this.getLastFullyVisibleRow = function() {
+ var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
+ return this.layerConfig.firstRow - 1 + flint;
+ };
+
+ this.getLastVisibleRow = function() {
+ return this.layerConfig.lastRow;
+ };
+
+ this.$padding = null;
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ this.$textLayer.setPadding(padding);
+ this.$cursorLayer.setPadding(padding);
+ this.$markerFront.setPadding(padding);
+ this.$markerBack.setPadding(padding);
+ this.$loop.schedule(this.CHANGE_FULL);
+ this.$updatePrintMargin();
+ };
+
+ this.getHScrollBarAlwaysVisible = function() {
+ return this.$horizScrollAlwaysVisible;
+ };
+
+ this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
+ if (this.$horizScrollAlwaysVisible != alwaysVisible) {
+ this.$horizScrollAlwaysVisible = alwaysVisible;
+ if (!this.$horizScrollAlwaysVisible || !this.$horizScroll)
+ this.$loop.schedule(this.CHANGE_SCROLL);
+ }
+ };
+
+ this.onScroll = function(e) {
+ this.scrollToY(e.data);
+ };
+
+ this.$updateScrollBar = function() {
+ this.scrollBar.setInnerHeight(this.layerConfig.maxHeight);
+ this.scrollBar.setScrollTop(this.scrollTop);
+ };
+
+ this.$renderChanges = function(changes) {
+ if (!changes || !this.session)
+ return;
+
+ // text, scrolling and resize changes can cause the view port size to change
+ if (changes & this.CHANGE_FULL ||
+ changes & this.CHANGE_SIZE ||
+ changes & this.CHANGE_TEXT ||
+ changes & this.CHANGE_LINES ||
+ changes & this.CHANGE_SCROLL
+ )
+ this.$computeLayerConfig();
+
+ // full
+ if (changes & this.CHANGE_FULL) {
+ this.$textLayer.update(this.layerConfig);
+ if (this.showGutter)
+ this.$gutterLayer.update(this.layerConfig);
+ this.$markerBack.update(this.layerConfig);
+ this.$markerFront.update(this.layerConfig);
+ this.$cursorLayer.update(this.layerConfig);
+ this.$updateScrollBar();
+ return;
+ }
+
+ // scrolling
+ if (changes & this.CHANGE_SCROLL) {
+ if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
+ this.$textLayer.update(this.layerConfig);
+ else
+ this.$textLayer.scrollLines(this.layerConfig);
+
+ if (this.showGutter)
+ this.$gutterLayer.update(this.layerConfig);
+ this.$markerBack.update(this.layerConfig);
+ this.$markerFront.update(this.layerConfig);
+ this.$cursorLayer.update(this.layerConfig);
+ this.$updateScrollBar();
+ return;
+ }
+
+ if (changes & this.CHANGE_TEXT) {
+ this.$textLayer.update(this.layerConfig);
+ if (this.showGutter)
+ this.$gutterLayer.update(this.layerConfig);
+ }
+ else if (changes & this.CHANGE_LINES) {
+ this.$updateLines();
+ this.$updateScrollBar();
+ if (this.showGutter)
+ this.$gutterLayer.update(this.layerConfig);
+ } else if (changes & this.CHANGE_GUTTER) {
+ if (this.showGutter)
+ this.$gutterLayer.update(this.layerConfig);
+ }
+
+ if (changes & this.CHANGE_CURSOR)
+ this.$cursorLayer.update(this.layerConfig);
+
+ if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
+ this.$markerFront.update(this.layerConfig);
+ }
+
+ if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
+ this.$markerBack.update(this.layerConfig);
+ }
+
+ if (changes & this.CHANGE_SIZE)
+ this.$updateScrollBar();
+ };
+
+ this.$computeLayerConfig = function() {
+ var session = this.session;
+
+ var offset = this.scrollTop % this.lineHeight;
+ var minHeight = this.$size.scrollerHeight + this.lineHeight;
+
+ var longestLine = this.$getLongestLine();
+ var widthChanged = this.layerConfig.width != longestLine;
+
+ var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
+ var horizScrollChanged = this.$horizScroll !== horizScroll;
+ this.$horizScroll = horizScroll;
+ if (horizScrollChanged)
+ this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
+
+ var maxHeight = this.session.getScreenLength() * this.lineHeight;
+ this.scrollTop = Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight));
+
+ var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
+ var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
+ var lastRow = firstRow + lineCount;
+
+ // Map lines on the screen to lines in the document.
+ var firstRowScreen, firstRowHeight;
+ var lineHeight = { lineHeight: this.lineHeight };
+ firstRow = session.screenToDocumentRow(firstRow, 0);
+
+ // Check if firstRow is inside of a foldLine. If true, then use the first
+ // row of the foldLine.
+ var foldLine = session.getFoldLine(firstRow);
+ if (foldLine) {
+ firstRow = foldLine.start.row;
+ }
+
+ firstRowScreen = session.documentToScreenRow(firstRow, 0);
+ firstRowHeight = session.getRowHeight(lineHeight, firstRow);
+
+ lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
+ minHeight = this.$size.scrollerHeight + session.getRowHeight(lineHeight, lastRow)+
+ firstRowHeight;
+
+ offset = this.scrollTop - firstRowScreen * this.lineHeight;
+
+ this.layerConfig = {
+ width : longestLine,
+ padding : this.$padding,
+ firstRow : firstRow,
+ firstRowScreen: firstRowScreen,
+ lastRow : lastRow,
+ lineHeight : this.lineHeight,
+ characterWidth : this.characterWidth,
+ minHeight : minHeight,
+ maxHeight : maxHeight,
+ offset : offset,
+ height : this.$size.scrollerHeight
+ };
+
+ // For debugging.
+ // console.log(JSON.stringify(this.layerConfig));
+
+ this.$gutterLayer.element.style.marginTop = (-offset) + "px";
+ this.content.style.marginTop = (-offset) + "px";
+ this.content.style.width = longestLine + "px";
+ this.content.style.height = minHeight + "px";
+
+ // scroller.scrollWidth was smaller than scrollLeft we needed
+ if (this.$desiredScrollLeft) {
+ this.scrollToX(this.$desiredScrollLeft);
+ this.$desiredScrollLeft = 0;
+ }
+
+ // Horizontal scrollbar visibility may have changed, which changes
+ // the client height of the scroller
+ if (horizScrollChanged)
+ this.onResize(true);
+ };
+
+ this.$updateLines = function() {
+ var firstRow = this.$changedLines.firstRow;
+ var lastRow = this.$changedLines.lastRow;
+ this.$changedLines = null;
+
+ var layerConfig = this.layerConfig;
+
+ // if the update changes the width of the document do a full redraw
+ if (layerConfig.width != this.$getLongestLine())
+ return this.$textLayer.update(layerConfig);
+
+ if (firstRow > layerConfig.lastRow + 1) { return; }
+ if (lastRow < layerConfig.firstRow) { return; }
+
+ // if the last row is unknown -> redraw everything
+ if (lastRow === Infinity) {
+ if (this.showGutter)
+ this.$gutterLayer.update(layerConfig);
+ this.$textLayer.update(layerConfig);
+ return;
+ }
+
+ // else update only the changed rows
+ this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
+ };
+
+ this.$getLongestLine = function() {
+ var charCount = this.session.getScreenWidth() + 1;
+ if (this.$textLayer.showInvisibles)
+ charCount += 1;
+
+ return Math.max(this.$size.scrollerWidth, Math.round(charCount * this.characterWidth));
+ };
+
+ this.updateFrontMarkers = function() {
+ this.$markerFront.setMarkers(this.session.getMarkers(true));
+ this.$loop.schedule(this.CHANGE_MARKER_FRONT);
+ };
+
+ this.updateBackMarkers = function() {
+ this.$markerBack.setMarkers(this.session.getMarkers());
+ this.$loop.schedule(this.CHANGE_MARKER_BACK);
+ };
+
+ this.addGutterDecoration = function(row, className){
+ this.$gutterLayer.addGutterDecoration(row, className);
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ };
+
+ this.removeGutterDecoration = function(row, className){
+ this.$gutterLayer.removeGutterDecoration(row, className);
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ };
+
+ this.setBreakpoints = function(rows) {
+ this.$gutterLayer.setBreakpoints(rows);
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ };
+
+ this.setAnnotations = function(annotations) {
+ this.$gutterLayer.setAnnotations(annotations);
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ };
+
+ this.updateCursor = function() {
+ this.$loop.schedule(this.CHANGE_CURSOR);
+ };
+
+ this.hideCursor = function() {
+ this.$cursorLayer.hideCursor();
+ };
+
+ this.showCursor = function() {
+ this.$cursorLayer.showCursor();
+ };
+
+ this.scrollCursorIntoView = function() {
+ // the editor is not visible
+ if (this.$size.scrollerHeight === 0)
+ return;
+
+ var pos = this.$cursorLayer.getPixelPosition();
+
+ var left = pos.left + this.$padding;
+ var top = pos.top;
+
+ if (this.scrollTop > top) {
+ this.scrollToY(top);
+ }
+
+ if (this.scrollTop + this.$size.scrollerHeight < top + this.lineHeight) {
+ this.scrollToY(top + this.lineHeight - this.$size.scrollerHeight);
+ }
+
+ var scrollLeft = this.scroller.scrollLeft;
+
+ if (scrollLeft > left) {
+ this.scrollToX(left);
+ }
+
+ if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
+ if (left > this.layerConfig.width)
+ this.$desiredScrollLeft = left + 2 * this.characterWidth;
+ else
+ this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
+ }
+ };
+
+ this.getScrollTop = function() {
+ return this.scrollTop;
+ };
+
+ this.getScrollLeft = function() {
+ return this.scroller.scrollLeft;
+ };
+
+ this.getScrollTopRow = function() {
+ return this.scrollTop / this.lineHeight;
+ };
+
+ this.getScrollBottomRow = function() {
+ return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
+ };
+
+ this.scrollToRow = function(row) {
+ this.scrollToY(row * this.lineHeight);
+ };
+
+ this.scrollToLine = function(line, center) {
+ var lineHeight = { lineHeight: this.lineHeight };
+ var offset = 0;
+ for (var l = 1; l < line; l++) {
+ offset += this.session.getRowHeight(lineHeight, l-1);
+ }
+
+ if (center) {
+ offset -= this.$size.scrollerHeight / 2;
+ }
+ this.scrollToY(offset);
+ };
+
+ this.scrollToY = function(scrollTop) {
+ // after calling scrollBar.setScrollTop
+ // scrollbar sends us event with same scrollTop. ignore it
+ scrollTop = Math.max(0, scrollTop);
+ if (this.scrollTop !== scrollTop) {
+ this.$loop.schedule(this.CHANGE_SCROLL);
+ this.scrollTop = scrollTop;
+ }
+ };
+
+ this.scrollToX = function(scrollLeft) {
+ if (scrollLeft <= this.$padding)
+ scrollLeft = 0;
+
+ this.scroller.scrollLeft = scrollLeft;
+ };
+
+ this.scrollBy = function(deltaX, deltaY) {
+ deltaY && this.scrollToY(this.scrollTop + deltaY);
+ deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
+ };
+
+ this.screenToTextCoordinates = function(pageX, pageY) {
+ var canvasPos = this.scroller.getBoundingClientRect();
+
+ var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
+ / this.characterWidth);
+ var row = Math.floor((pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
+ / this.lineHeight);
+
+ return this.session.screenToDocumentPosition(row, Math.max(col, 0));
+ };
+
+ this.textToScreenCoordinates = function(row, column) {
+ var canvasPos = this.scroller.getBoundingClientRect();
+ var pos = this.session.documentToScreenPosition(row, column);
+
+ var x = this.$padding + Math.round(pos.column * this.characterWidth);
+ var y = pos.row * this.lineHeight;
+
+ return {
+ pageX: canvasPos.left + x - this.getScrollLeft(),
+ pageY: canvasPos.top + y - this.getScrollTop()
+ };
+ };
+
+ this.visualizeFocus = function() {
+ dom.addCssClass(this.container, "ace_focus");
+ };
+
+ this.visualizeBlur = function() {
+ dom.removeCssClass(this.container, "ace_focus");
+ };
+
+ this.showComposition = function(position) {
+ if (!this.$composition) {
+ this.$composition = dom.createElement("div");
+ this.$composition.className = "ace_composition";
+ this.content.appendChild(this.$composition);
+ }
+
+ this.$composition.innerHTML = " ";
+
+ var pos = this.$cursorLayer.getPixelPosition();
+ var style = this.$composition.style;
+ style.top = pos.top + "px";
+ style.left = (pos.left + this.$padding) + "px";
+ style.height = this.lineHeight + "px";
+
+ this.hideCursor();
+ };
+
+ this.setCompositionText = function(text) {
+ dom.setInnerText(this.$composition, text);
+ };
+
+ this.hideComposition = function() {
+ this.showCursor();
+
+ if (!this.$composition)
+ return;
+
+ var style = this.$composition.style;
+ style.top = "-10000px";
+ style.left = "-10000px";
+ };
+
+ this.setTheme = function(theme) {
+ var _self = this;
+
+ this.$themeValue = theme;
+ if (!theme || typeof theme == "string") {
+ theme = theme || "ace/theme/textmate";
+ require([theme], function(theme) {
+ afterLoad(theme);
+ });
+ } else {
+ afterLoad(theme);
+ }
+
+ function afterLoad(theme) {
+ if (_self.$theme)
+ dom.removeCssClass(_self.container, _self.$theme);
+
+ _self.$theme = theme ? theme.cssClass : null;
+
+ if (_self.$theme)
+ dom.addCssClass(_self.container, _self.$theme);
+
+ // force re-measure of the gutter width
+ if (_self.$size) {
+ _self.$size.width = 0;
+ _self.onResize();
+ }
+ }
+ };
+
+ this.getTheme = function() {
+ return this.$themeValue;
+ };
+
+ // Methods allows to add / remove CSS classnames to the editor element.
+ // This feature can be used by plug-ins to provide a visual indication of
+ // a certain mode that editor is in.
+
+ this.setStyle = function setStyle(style) {
+ dom.addCssClass(this.container, style);
+ };
+
+ this.unsetStyle = function unsetStyle(style) {
+ dom.removeCssClass(this.container, style);
+ };
+
+ this.destroy = function() {
+ this.$textLayer.destroy();
+ this.$cursorLayer.destroy();
+ };
+
+}).call(VirtualRenderer.prototype);
+
+exports.VirtualRenderer = VirtualRenderer;
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/layer/gutter', ['require', 'exports', 'module' , 'pilot/dom'], function(require, exports, module) {
+
+var dom = require("pilot/dom");
+
+var Gutter = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_gutter-layer";
+ parentEl.appendChild(this.element);
+
+ this.$breakpoints = [];
+ this.$annotations = [];
+ this.$decorations = [];
+};
+
+(function() {
+
+ this.setSession = function(session) {
+ this.session = session;
+ };
+
+ this.addGutterDecoration = function(row, className){
+ if (!this.$decorations[row])
+ this.$decorations[row] = "";
+ this.$decorations[row] += " ace_" + className;
+ }
+
+ this.removeGutterDecoration = function(row, className){
+ this.$decorations[row] = this.$decorations[row].replace(" ace_" + className, "");
+ };
+
+ this.setBreakpoints = function(rows) {
+ this.$breakpoints = rows.concat();
+ };
+
+ this.setAnnotations = function(annotations) {
+ // iterate over sparse array
+ this.$annotations = [];
+ for (var row in annotations) if (annotations.hasOwnProperty(row)) {
+ var rowAnnotations = annotations[row];
+ if (!rowAnnotations)
+ continue;
+
+ var rowInfo = this.$annotations[row] = {
+ text: []
+ };
+ for (var i=0; i foldStart) {
+ i = fold.end.row + 1;
+ fold = this.session.getNextFold(i);
+ foldStart = fold ?fold.start.row :Infinity;
+ }
+ if(i > lastRow)
+ break;
+
+ var annotation = this.$annotations[i] || emptyAnno;
+ html.push("
", (i+1));
+
+ var wrappedRowLength = this.session.getRowLength(i) - 1;
+ while (wrappedRowLength--) {
+ html.push("
¦
");
+ }
+
+ html.push("
");
+
+ i++;
+ }
+ this.element = dom.setInnerHtml(this.element, html.join(""));
+ this.element.style.height = config.minHeight + "px";
+ };
+
+}).call(Gutter.prototype);
+
+exports.Gutter = Gutter;
+
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Julian Viereck
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/layer/marker', ['require', 'exports', 'module' , 'ace/range', 'pilot/dom'], function(require, exports, module) {
+
+var Range = require("ace/range").Range;
+var dom = require("pilot/dom");
+
+var Marker = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_marker-layer";
+ parentEl.appendChild(this.element);
+};
+
+(function() {
+
+ this.$padding = 0;
+
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ };
+ this.setSession = function(session) {
+ this.session = session;
+ };
+
+ this.setMarkers = function(markers) {
+ this.markers = markers;
+ };
+
+ this.update = function(config) {
+ var config = config || this.config;
+ if (!config)
+ return;
+
+ this.config = config;
+
+
+ var html = [];
+ for ( var key in this.markers) {
+ var marker = this.markers[key];
+
+ var range = marker.range.clipRows(config.firstRow, config.lastRow);
+ if (range.isEmpty()) continue;
+
+ range = range.toScreenRange(this.session);
+ if (marker.renderer) {
+ var top = this.$getTop(range.start.row, config);
+ var left = Math.round(
+ this.$padding + range.start.column * config.characterWidth
+ );
+ marker.renderer(html, range, left, top, config);
+ }
+ else if (range.isMultiLine()) {
+ if (marker.type == "text") {
+ this.drawTextMarker(html, range, marker.clazz, config);
+ } else {
+ this.drawMultiLineMarker(
+ html, range, marker.clazz, config,
+ marker.type
+ );
+ }
+ }
+ else {
+ this.drawSingleLineMarker(
+ html, range, marker.clazz, config,
+ null, marker.type
+ );
+ }
+ }
+ this.element = dom.setInnerHtml(this.element, html.join(""));
+ };
+
+ this.$getTop = function(row, layerConfig) {
+ return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
+ };
+
+ /**
+ * Draws a marker, which spans a range of text in a single line
+ */
+ this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
+ // selection start
+ var row = range.start.row;
+
+ var lineRange = new Range(
+ row, range.start.column,
+ row, this.session.getScreenLastRowColumn(row)
+ );
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
+
+ // selection end
+ row = range.end.row;
+ lineRange = new Range(row, 0, row, range.end.column);
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, "text");
+
+ for (row = range.start.row + 1; row < range.end.row; row++) {
+ lineRange.start.row = row;
+ lineRange.end.row = row;
+ lineRange.end.column = this.session.getScreenLastRowColumn(row);
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
+ }
+ };
+
+ /**
+ * Draws a multi line marker, where lines span the full width
+ */
+ this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
+ // from selection start to the end of the line
+ var padding = type === "background" ? 0 : this.$padding;
+ var height = layerConfig.lineHeight;
+ var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
+ var top = this.$getTop(range.start.row, layerConfig);
+ var left = Math.round(
+ padding + range.start.column * layerConfig.characterWidth
+ );
+
+ stringBuilder.push(
+ ""
+ );
+
+ // from start of the last line to the selection end
+ top = this.$getTop(range.end.row, layerConfig);
+ width = Math.round(range.end.column * layerConfig.characterWidth);
+
+ stringBuilder.push(
+ ""
+ );
+
+ // all the complete lines
+ height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
+ if (height < 0)
+ return;
+ top = this.$getTop(range.start.row + 1, layerConfig);
+ width = layerConfig.width;
+
+ stringBuilder.push(
+ ""
+ );
+ };
+
+ /**
+ * Draws a marker which covers one single full line
+ */
+ this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, type) {
+ var padding = type === "background" ? 0 : this.$padding;
+ var height = layerConfig.lineHeight;
+
+ if (type === "background")
+ var width = layerConfig.width;
+ else
+ width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
+
+ var top = this.$getTop(range.start.row, layerConfig);
+ var left = Math.round(
+ padding + range.start.column * layerConfig.characterWidth
+ );
+
+ stringBuilder.push(
+ ""
+ );
+ };
+
+}).call(Marker.prototype);
+
+exports.Marker = Marker;
+
+});
+/* vim:ts=4:sts=4:sw=4:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs
+ * Julian Viereck
+ * Mihai Sucan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define('ace/layer/text', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/lang', 'pilot/useragent', 'pilot/event_emitter'], function(require, exports, module) {
+
+var oop = require("pilot/oop");
+var dom = require("pilot/dom");
+var lang = require("pilot/lang");
+var useragent = require("pilot/useragent");
+var EventEmitter = require("pilot/event_emitter").EventEmitter;
+
+var Text = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_text-layer";
+ this.element.style.width = "auto";
+ parentEl.appendChild(this.element);
+
+ this.$characterSize = this.$measureSizes() || {width: 0, height: 0};
+ this.$pollSizeChanges();
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.EOF_CHAR = "¶";
+ this.EOL_CHAR = "¬";
+ this.TAB_CHAR = "→";
+ this.SPACE_CHAR = "·";
+ this.$padding = 0;
+
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ this.element.style.padding = "0 " + padding + "px";
+ };
+
+ this.getLineHeight = function() {
+ return this.$characterSize.height || 1;
+ };
+
+ this.getCharacterWidth = function() {
+ return this.$characterSize.width || 1;
+ };
+
+ this.checkForSizeChanges = function() {
+ var size = this.$measureSizes();
+ if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
+ this.$characterSize = size;
+ this._dispatchEvent("changeCharaterSize", {data: size});
+ }
+ };
+
+ this.$pollSizeChanges = function() {
+ var self = this;
+ this.$pollSizeChangesTimer = setInterval(function() {
+ self.checkForSizeChanges();
+ }, 500);
+ };
+
+ this.$fontStyles = {
+ fontFamily : 1,
+ fontSize : 1,
+ fontWeight : 1,
+ fontStyle : 1,
+ lineHeight : 1
+ };
+
+ this.$measureSizes = function() {
+ var n = 1000;
+ if (!this.$measureNode) {
+ var measureNode = this.$measureNode = dom.createElement("div");
+ var style = measureNode.style;
+
+ style.width = style.height = "auto";
+ style.left = style.top = (-n * 40) + "px";
+
+ style.visibility = "hidden";
+ style.position = "absolute";
+ style.overflow = "visible";
+ style.whiteSpace = "nowrap";
+
+ // in FF 3.6 monospace fonts can have a fixed sub pixel width.
+ // that's why we have to measure many characters
+ // Note: characterWidth can be a float!
+ measureNode.innerHTML = lang.stringRepeat("Xy", n);
+
+ if (document.body) {
+ document.body.appendChild(measureNode);
+ } else {
+ var container = this.element.parentNode;
+ while (!dom.hasCssClass(container, "ace_editor"))
+ container = container.parentNode;
+ container.appendChild(measureNode);
+ }
+
+ }
+
+ var style = this.$measureNode.style;
+ var computedStyle = dom.computedStyle(this.element);
+ for (var prop in this.$fontStyles)
+ style[prop] = computedStyle[prop];
+
+ var size = {
+ height: this.$measureNode.offsetHeight,
+ width: this.$measureNode.offsetWidth / (n * 2)
+ };
+
+ // Size and width can be null if the editor is not visible or
+ // detached from the document
+ if (size.width == 0 && size.height == 0)
+ return null;
+
+ return size;
+ };
+
+ this.setSession = function(session) {
+ this.session = session;
+ };
+
+ this.showInvisibles = false;
+ this.setShowInvisibles = function(showInvisibles) {
+ if (this.showInvisibles == showInvisibles)
+ return false;
+
+ this.showInvisibles = showInvisibles;
+ return true;
+ };
+
+ this.$tabStrings = [];
+ this.$computeTabString = function() {
+ var tabSize = this.session.getTabSize();
+ var tabStr = this.$tabStrings = [0];
+ for (var i = 1; i < tabSize + 1; i++) {
+ if (this.showInvisibles) {
+ tabStr.push(""
+ + this.TAB_CHAR
+ + new Array(i).join(" ")
+ + "");
+ } else {
+ tabStr.push(new Array(i+1).join(" "));
+ }
+ }
+
+ };
+
+ this.updateLines = function(config, firstRow, lastRow) {
+ this.$computeTabString();
+ // Due to wrap line changes there can be new lines if e.g.
+ // the line to updated wrapped in the meantime.
+ if (this.config.lastRow != config.lastRow ||
+ this.config.firstRow != config.firstRow) {
+ this.scrollLines(config);
+ }
+ this.config = config;
+
+ var first = Math.max(firstRow, config.firstRow);
+ var last = Math.min(lastRow, config.lastRow);
+
+ var lineElements = this.element.childNodes;
+ var lineElementsIdx = 0;
+
+ for (var row = config.firstRow; row < first; row++) {
+ var foldLine = this.session.getFoldLine(row);
+ if (foldLine) {
+ if (foldLine.containsRow(first)) {
+ break;
+ } else {
+ row = foldLine.end.row;
+ }
+ }
+ lineElementsIdx ++;
+ }
+
+ for (var i=first; i<=last; i++) {
+ var lineElement = lineElements[lineElementsIdx++];
+ if (!lineElement)
+ continue;
+
+ var html = [];
+ var tokens = this.session.getTokens(i, i);
+ this.$renderLine(html, i, tokens[0].tokens, true);
+ lineElement = dom.setInnerHtml(lineElement, html.join(""));
+
+ i = this.session.getRowFoldEnd(i);
+ }
+ };
+
+ this.scrollLines = function(config) {
+ this.$computeTabString();
+ var oldConfig = this.config;
+ this.config = config;
+
+ if (!oldConfig || oldConfig.lastRow < config.firstRow)
+ return this.update(config);
+
+ if (config.lastRow < oldConfig.firstRow)
+ return this.update(config);
+
+ var el = this.element;
+ if (oldConfig.firstRow < config.firstRow)
+ for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)
+ el.removeChild(el.firstChild);
+
+ if (oldConfig.lastRow > config.lastRow)
+ for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)
+ el.removeChild(el.lastChild);
+
+ if (config.firstRow < oldConfig.firstRow) {
+ var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
+ if (el.firstChild)
+ el.insertBefore(fragment, el.firstChild);
+ else
+ el.appendChild(fragment);
+ }
+
+ if (config.lastRow > oldConfig.lastRow) {
+ var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
+ el.appendChild(fragment);
+ }
+ };
+
+ this.$renderLinesFragment = function(config, firstRow, lastRow) {
+ var fragment = document.createDocumentFragment(),
+ row = firstRow,
+ fold = this.session.getNextFold(row),
+ foldStart = fold ?fold.start.row :Infinity;
+
+ while (true) {
+ if(row > foldStart) {
+ row = fold.end.row+1;
+ fold = this.session.getNextFold(row);
+ foldStart = fold ?fold.start.row :Infinity;
+ }
+ if(row > lastRow)
+ break;
+
+ var container = dom.createElement("div");
+
+ var html = [];
+ // Get the tokens per line as there might be some lines in between
+ // beeing folded.
+ // OPTIMIZE: If there is a long block of unfolded lines, just make
+ // this call once for that big block of unfolded lines.
+ var tokens = this.session.getTokens(row, row);
+ if (tokens.length == 1)
+ this.$renderLine(html, row, tokens[0].tokens, false);
+
+ // don't use setInnerHtml since we are working with an empty DIV
+ container.innerHTML = html.join("");
+ var lines = container.childNodes
+ while(lines.length)
+ fragment.appendChild(lines[0]);
+
+ row++;
+ }
+ return fragment;
+ };
+
+ this.update = function(config) {
+ this.$computeTabString();
+ this.config = config;
+
+ var html = [];
+ var firstRow = config.firstRow, lastRow = config.lastRow;
+
+ var row = firstRow,
+ fold = this.session.getNextFold(row),
+ foldStart = fold ?fold.start.row :Infinity;
+
+ while (true) {
+ if(row > foldStart) {
+ row = fold.end.row+1;
+ fold = this.session.getNextFold(row);
+ foldStart = fold ?fold.start.row :Infinity;
+ }
+ if(row > lastRow)
+ break;
+
+ // Get the tokens per line as there might be some lines in between
+ // beeing folded.
+ // OPTIMIZE: If there is a long block of unfolded lines, just make
+ // this call once for that big block of unfolded lines.
+ var tokens = this.session.getTokens(row, row);
+ if (tokens.length == 1)
+ this.$renderLine(html, row, tokens[0].tokens, false);
+
+ row++;
+ }
+ this.element = dom.setInnerHtml(this.element, html.join(""));
+ };
+
+ this.$textToken = {
+ "text": true,
+ "rparen": true,
+ "lparen": true
+ };
+
+ this.$renderToken = function(stringBuilder, screenColumn, token, value) {
+ var self = this;
+ var replaceReg = /\t|&|<|( +)|([\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000])|[\u1100-\u115F]|[\u11A3-\u11A7]|[\u11FA-\u11FF]|[\u2329-\u232A]|[\u2E80-\u2E99]|[\u2E9B-\u2EF3]|[\u2F00-\u2FD5]|[\u2FF0-\u2FFB]|[\u3000-\u303E]|[\u3041-\u3096]|[\u3099-\u30FF]|[\u3105-\u312D]|[\u3131-\u318E]|[\u3190-\u31BA]|[\u31C0-\u31E3]|[\u31F0-\u321E]|[\u3220-\u3247]|[\u3250-\u32FE]|[\u3300-\u4DBF]|[\u4E00-\uA48C]|[\uA490-\uA4C6]|[\uA960-\uA97C]|[\uAC00-\uD7A3]|[\uD7B0-\uD7C6]|[\uD7CB-\uD7FB]|[\uF900-\uFAFF]|[\uFE10-\uFE19]|[\uFE30-\uFE52]|[\uFE54-\uFE66]|[\uFE68-\uFE6B]|[\uFF01-\uFF60]|[\uFFE0-\uFFE6]/g;
+ var replaceFunc = function(c, a, b, tabIdx, idx4) {
+ if (c.charCodeAt(0) == 32) {
+ return new Array(c.length+1).join(" ");
+ } else if (c == "\t") {
+ var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
+ screenColumn += tabSize - 1;
+ return self.$tabStrings[tabSize];
+ } else if (c == "&") {
+ if (useragent.isOldGecko)
+ return "&";
+ else
+ return "&";
+ } else if (c == "<") {
+ return "<";
+ } else if (c.match(/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/)) {
+ if (self.showInvisibles) {
+ var space = new Array(c.length+1).join(self.SPACE_CHAR);
+ return "" + space + "";
+ } else {
+ return " ";
+ }
+ } else {
+ screenColumn += 1;
+ return "" + c + "";
+ }
+ };
+
+ var output = value.replace(replaceReg, replaceFunc);
+
+ if (!this.$textToken[token.type]) {
+ var classes = "ace_" + token.type.replace(/\./g, " ace_");
+ stringBuilder.push("", output, "");
+ }
+ else {
+ stringBuilder.push(output);
+ }
+ return screenColumn + value.length;
+ };
+
+ this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits, onlyContents) {
+ var chars = 0;
+ var split = 0;
+ var splitChars;
+ var characterWidth = this.config.characterWidth;
+ var screenColumn = 0;
+ var self = this;
+
+ if (!splits || splits.length == 0)
+ splitChars = Number.MAX_VALUE;
+ else
+ splitChars = splits[0];
+
+ if (!onlyContents) {
+ stringBuilder.push("
"
+ );
+ }
+
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i];
+ var value = token.value;
+
+ if (chars + value.length < splitChars) {
+ screenColumn = self.$renderToken(
+ stringBuilder, screenColumn, token, value
+ );
+ chars += value.length;
+ }
+ else {
+ while (chars + value.length >= splitChars) {
+ screenColumn = self.$renderToken(
+ stringBuilder, screenColumn,
+ token, value.substring(0, splitChars - chars)
+ );
+ value = value.substring(splitChars - chars);
+ chars = splitChars;
+
+ if (!onlyContents) {
+ stringBuilder.push("
")}c.done(d.join(""))}},evalCommandSpec={name:"eval",params:[{name:"javascript",type:"text",description:"The JavaScript to evaluate"}],description:"evals given js code and show the result",hidden:!0,exec:function(env,args,request){var result,javascript=args.javascript;try{result=eval(javascript)}catch(e){result="Error: "+e.message+""}var msg="",type="",x;if(checks.isFunction(result))msg=(result+"").replace(/\n/g," ").replace(/ /g," "),type="function";else if(checks.isObject(result)){Array.isArray(result)?type="array":type="object";var items=[],value;for(x in result)result.hasOwnProperty(x)&&(checks.isFunction(result[x])?value="[function]":checks.isObject(result[x])?value="[object]":value=result[x],items.push({name:x,value:value}));items.sort(function(a,b){return a.name.toLowerCase()"+items[x].name+": "+items[x].value+" "}else msg=result,type=typeof result;request.done("Result for eval '"+javascript+"'"+" (type: "+type+"):
+ Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
+ It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.
+
+
Nerd alert: Bootstrap is built with Less and was designed to work out of the gate with only modern browsers in mind.
+
+
+
+
+
+
+
+
+
Hotlink the CSS
+
For the quickest and easiest start, just copy this snippet into your webpage.
+
+
+
+
Use it with Less
+
A fan of using Less? No problem, just clone the repo and add these lines:
+
+
+
+
Fork on GitHub
+
Download, fork, pull, file issues, and more with the official Bootstrap repo on Github.
Grid system Rock the standard 940px or roll your own
+
+
+
+
Default grid
+
The default grid system provided as part of Bootstrap is a 940px wide 16-column grid. It’s a flavor of the popular 960 grid system, but without the additional margin/padding on the left and right sides.
+
+
+
Example grid markup
+
As shown here, a basic layout can be created with two "columns," each spanning a number of the 16 foundational columns we defined as part of our grid system. See the examples below for more variations.
Typography Headings, paragraphs, lists, and other inline type elements
+
+
+
+
+
Headings and copy
+
A standard typographic hierarchy for structuring your webpages.
+
+
+
h1. Heading 1
+
h2. Heading 2
+
h3. Heading 3
+
h4. Heading 4
+
h5. Heading 5
+
h6. Heading 6
+
+
+
Example paragraph
+
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula ut id elit.
+
Example headingHas sub-heading…
+
You can also add subheadings with the <strong> and <em>
+
+
+
+
+
+
Misc. elements
+
Using emphasis, addresses, & abbreviations
+
+ <strong>
+ <em>
+ <address>
+ <abbr>
+
+
+
+
When to use
+
Emphasis tags (<strong> and <em>) should be used to add visual distinction between a word or phrase and its surrounding copy. Use <strong> for plain old attention and <em> for slick attention and titles.
+
Emphasis in a paragraph
+
Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Maecenas faucibus mollis interdum. Nulla vitae elit libero, a pharetra augue.
+
Note: It’s still okay to use <b> and <i> tags in HTML5, but they don’t come with inherent styles anymore. <b> is meant to convey importance while <i> is mostly for voice, technical terms, etc.
+
Addresses
+
The address element is used for contact information for its nearest ancestor, or the entire body of work. Here’s how it looks:
+
+ Twitter, Inc.
+ 795 Folsom Ave, Suite 600
+ San Francisco, CA 94107
+ P: (123) 456-7890
+
+
Note: Each line in an address must end with a line-break (<br />) or be wrapped in a block-level tag (e.g., p) to properly structure the content.
+
Abbreviations
+
For abbreviations and acronyms, use the abbr tag (acronym is deprecated in HTML5). Put the shorthand form within the tag and set a title for the complete name.
+
+
+
+
+
+
Blockquotes
+
+ <blockquote>
+ <p>
+ <small>
+
+
+
+
Be sure to wrap your blockquote around paragraph and small tags. When citing a source, use the small element. The CSS will automatically preface a name with an em dash (—).
+
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua…
+ Dr. Julius Hibbert
+
+
+
+
+
+
Lists
+
+
+
Unordered <ul>
+
+
Jeremy Bixby
+
Robert Dezure
+
Josh Washington
+
Anton Capresi
+
My Team Mates
+
+
George Castanza
+
Jerry Seinfeld
+
Cosmo Kramer
+
Elaine Bennis
+
Newman
+
+
+
John Jacob
+
Paul Pierce
+
Kevin Garnett
+
+
+
+
Unstyled <ul.unstyled>
+
+
Jeremy Bixby
+
Robert Dezure
+
Josh Washington
+
Anton Capresi
+
My Team Mates
+
+
George Castanza
+
Jerry Seinfeld
+
Cosmo Kramer
+
Elaine Bennis
+
Newman
+
+
+
John Jacob
+
Paul Pierce
+
Kevin Garnett
+
+
+
+
Ordered <ol>
+
+
Jeremy Bixby
+
Robert Dezure
+
Josh Washington
+
Anton Capresi
+
My Team Mates
+
+
George Castanza
+
Jerry Seinfeld
+
Cosmo Kramer
+
Elaine Bennis
+
Newman
+
+
+
John Jacob
+
Paul Pierce
+
Kevin Garnett
+
+
+
+
Description dl
+
+
Description lists
+
A description list is perfect for defining terms.
+
Euismod
+
Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
Tables are great—for a lot of things. Great tables, however, need a bit of markup love to be useful, scalable, and readable (at the code level). Here are a few tips to help.
+
Always wrap your column headers in a thead such that hierarchy is thead > tr > th.
+
Similar to the column headers, all your table’s body content should be wrapped in a tbody so your hierarchy is tbody > tr > td.
+
+
+
+
Example: Default table styles
+
All tables will be automatically styled with only the essential borders to ensure readability and maintain structure. No need to add extra classes or attributes.
+
+
+
+
#
+
First Name
+
Last Name
+
Language
+
+
+
+
+
1
+
Some
+
One
+
English
+
+
+
2
+
Joe
+
Sixpack
+
English
+
+
+
3
+
Stu
+
Dent
+
Code
+
+
+
+
+<table class="common-table">
+ ...
+</table>
+
+
Example: Zebra-striped
+
Get a little fancy with your tables by adding zebra-striping—just add the .zebra-striped class.
Taking the previous example, we improve the usefulness of our tables by providing sorting functionality via jQuery and the Tablesorter plugin. Click any column’s header to change the sort.
All forms are given default styles to present them in a readable and scalable way. Styles are provided for text inputs, select lists, textareas, radio buttons and checkboxes, and buttons.
+
+
+
+
+
+
+
+
+
+
+
Stacked forms
+
Add .form-stacked to your form’s HTML and you’ll have labels on top of their fields instead of to their left. This works great if your forms are short or you have two columns of inputs for heavier forms.
+
+
+
+
+
+
+
+
+
Buttons
+
As a convention, buttons are used for actions while links are used for objects. For instance, "Download" could be a button and "recent activity" could be a link.
+
All buttons default to a light gray style, but a blue .primary class is available. Plus, rolling your own styles is easy peasy.
+
+
+
Example buttons
+
Button styles can be applied to anything with the .btn applied. Typically you’ll want to apply these to only a, button, and select input elements. Here’s how it looks:
For buttons that are not active or are disabled by the app for one reason or another, use the disabled state. That’s .disabled for links and :disabled for button elements.
Our topbar is a fixed bar that houses a website’s logo or name, primary navigation, and search form.
+
+
+
Customizable
+
All elements within, and the entire topbar as well, are optional. You can choose to include a logo/name, nav, search, and a secondary nav—or any combination of that.
+
+
+
Dropdowns included
+
As part of the main navigation, we’ve included the ability for you to add dropdowns to your nav. Check out the secondary nav above (right aligned) to see how it’s done.
+
+
+
+
+
+
+
+
Tabs and pills
+
Create simple secondary navigation with a ul. Swap between tabs or pills by adding the appropriate class.
+
Great for sub-sections of content like our account settings pages and user timelines for toggling between pages of like content. Available in tabbed or pill styles.
Heads up! This is an alert that needs your attention, but it’s not a huge priority just yet.
+
+
+
+
+
+
Block messages
+
For messages that require a bit of explanation, we have paragraph style alerts. These are perfect for bubbling up longer error messages, warning a user of a pending action, or just presenting information for more emphasis on the page.
Oh snap! You got an error! Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Holy gaucamole! This is a warning! Best check yo self, you’re not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
Well done! You successfully read this alert message. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas faucibus mollis interdum.
Twipsies are super useful for aiding a confused user and pointing them in the right direction.
+
+
+
+
+
+Lorem ipsum dolar sit amet illo error ipsum veritatis aut iste perspiciatis iste voluptas natus illo quasi odit aut natus consequuntur consequuntur, aut natus illo voluptatem odit perspiciatis laudantium rem doloremque totam voluptas. Voluptasdicta eaque beatae aperiam ut enim voluptatem explicabo explicabo, voluptas quia odit fugit accusantium totam totam architecto explicabo sit quasi fugit fugit, totam doloremque unde sunt sed dicta quae accusantium fugit voluptas nemo voluptas voluptatem rem quae aut veritatis quasi quae.
+
+
+
+
below!
+
+
+
+
right!
+
+
+
+
left!
+
+
+
+
above!
+
+
+
+
+
+
+
+
+
+
Popovers
+
Use popovers to provide subtextual information to a page without effecting layout.
+
+
+
+
+
+
+
+
Popover Title
+
+
Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Using Bootstrap with Less Supercharge your CSS with variables, mixins, and functions
+
+
+
+
Bootstrap was built with Preboot, an open-source pack of mixins and variables to be used in conjunction with Less, a CSS preprocessor for faster and easier web development.
+
Check out how we used Preboot in Bootstrap and how you can make use of it should you choose to run Less on your next project.
+
+
+
How to use it
+
Use this option to make full use of Bootstrap’s Less variables, mixins, and nesting in CSS via javascript in your browser.
Here are some of the highlights of what’s included in Twitter Bootstrap as part of Bootstrap. Head over to the Bootstrap website or Github project page to download and learn more.
+
Color variables
+
Variables in Less are perfect for maintaining and updating your CSS headache free. When you want to change a color value or a frequently used value, update it in one spot and you’re set.
Less also provides another style of commenting in addition to CSS’s normal /* ... */ syntax.
+
+// This is a comment
+/* This is also a comment */
+
+
+
Mixins up the wazoo
+
Mixins are basically includes or partials for CSS, allowing you to combine a block of code into one. They’re great for vendor prefixed properties like box-shadow, cross-browser gradients, font stacks, and more. Below is a sample of the mixins that are included with Bootstrap.
+ {% include "partial_pagination.phtml" with {'list': posts, 'url':'profile/'~client_id} %}
+
+
+
+
+ {% if params.forum_points_enable %}
+
+
+
+
{% trans 'Message' %}
+
{% trans 'Actions' %}
+
+
+
+
+ {% set posts = admin.forum_message_get_list({"per_page":20, "client_id":client_id, "with_points":1}|merge(request)) %}
+ {% for i, post in posts.list %}
+
+{% set messages = guest.forum_get_topic_message_list({"forum_topic_id":topic.id, "page":request.page, "per_page":30}) %}
+{% for i, message in messages.list %}
+
+{% endfor %}
+
+{% if client and client.forum_favorites %}
+
+
+
+
+
{% trans 'Favorite topics' %}
+
{% trans 'You set this topic as favorite. It can be done by opening any topic and clicking on "Add to favorites" button in "Topic information" block.' %}
+
+
+
+
+
+
+
+
{% trans 'Thread / Thread Starter' %}
+
{% trans 'Last post' %}
+
{% trans 'Replies' %}
+
{% trans 'Views' %}
+
+
+
+
+ {% for i, topic in client.forum_favorites %}
+
+
+
+ {% set messages = guest.forum_get_topic_message_list({"forum_topic_id":topic.id, "page":request.page, "per_page":10}) %}
+ {% for i, message in messages.list %}
+
+{% endblock %}
+
+{% block js %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/src/bb-modules/Orderbutton/html_client/mod_orderbutton_addons.phtml b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_addons.phtml
new file mode 100644
index 000000000..b35a80f7e
--- /dev/null
+++ b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_addons.phtml
@@ -0,0 +1,55 @@
+{% if product.addons|length > 0 %}
+
+
+
+
{% trans 'Addons & extras' %}
+
+
+
+
+
+ {% for addon in product.addons %}
+
+
+
+{% endif %}
\ No newline at end of file
diff --git a/src/bb-modules/Orderbutton/html_client/mod_orderbutton_checkout.phtml b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_checkout.phtml
new file mode 100644
index 000000000..6b9a4b2fb
--- /dev/null
+++ b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_checkout.phtml
@@ -0,0 +1,190 @@
+{% set cart = guest.cart_get%}
+
+ {% if item.form_id and guest.extension_is_on({"mod":"formbuilder"}) %}
+ {% set form = guest.formbuilder_get({"id": item.form_id}) %}
+ {# debug form #}
+
+
+ {% for field, value in item %}
+ {% for form_field in form.fields %}
+ {% if value is not empty %}
+ {% if form_field.name == field%}
+
+ {{form_field.label}}
+
+
+ {% if form_field.type == "checkbox"%}
+ {% for selection in value %}
+ {% for field_key,field_value in form_field.options%}
+ {% if field_value == selection %}
+ {{ field_key }}
+ {% endif %}
+ {% endfor %}
+ {% endfor%}
+ {% elseif form_field.type == "select" or form_field.type == "radio" %}
+ {% for field_key,field_value in form_field.options%}
+ {% if field_value == value %}
+ {{ field_key }}
+ {% endif %}
+ {% endfor %}
+ {% else %}
+ {{value}}
+ {% endif %}
+
+
\ No newline at end of file
diff --git a/src/bb-modules/Orderbutton/html_client/mod_orderbutton_choose_product.phtml b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_choose_product.phtml
new file mode 100644
index 000000000..44ced879a
--- /dev/null
+++ b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_choose_product.phtml
@@ -0,0 +1,17 @@
+
\ No newline at end of file
diff --git a/src/bb-modules/Orderbutton/html_client/mod_orderbutton_client.phtml b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_client.phtml
new file mode 100644
index 000000000..1f514e2ee
--- /dev/null
+++ b/src/bb-modules/Orderbutton/html_client/mod_orderbutton_client.phtml
@@ -0,0 +1,218 @@
+
";
+ * // ----------------------------------------------------------------------------
+ *
+ *
+ * // Example POST request:
+ * // ----------------------------------------------------------------------------
+ * $keyword = "blitzaffe code"; // search Google for this keyword
+ * $values = array(
+ * "hl"=>"en",
+ * "q"=>"%22".urlencode($keyword)."%22",
+ * "btnG"=>"Search",
+ * "meta"=>""
+ * );
+ * // Note: This example is just to demonstrate the POST equivalent of the GET
+ * // example above; running this script will return a 501 Not Implemented, as
+ * // Google does not support POST requests.
+ * if (!$http->post("http://www.google.com/search",$http->make_query_string($values))) {
+ * echo "HTTP request error: #{$http->result_code}: {$http->result_text}";
+ * return false;
+ * }
+ * echo "HTTP response headers:
";
+ * // ----------------------------------------------------------------------------
+ *
+ *
+ * LICENSE
+ *
+ * This script is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This script is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this script; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// define user agent ID's
+define("UA_EXPLORER",0);
+define("UA_MOZILLA",1);
+define("UA_FIREFOX",2);
+define("UA_OPERA",3);
+
+// define progress message severity levels
+define('HRP_DEBUG',0);
+define('HRP_INFO',1);
+define('HRP_ERROR',2);
+
+if (!defined("CURL_PATH")) define("CURL_PATH","/usr/bin/curl");
+
+// if the CURL extension is not loaded, but the CURL Emulation Library is found, try
+// to load it
+if (!extension_loaded("curl") && !defined('HTTPR_NO_REDECLARE_CURL') ) {
+ foreach (array(dirname(__FILE__)."/",dirname(__FILE__)."/libcurlemu/") as $k=>$libcurlemupath) {
+ $libcurlemuinc = $libcurlemupath.'libcurlemu.inc.php';
+ if (is_readable($libcurlemuinc)) require_once($libcurlemuinc);
+ }
+}
+
+class HTTPRetriever {
+
+ var $class_version = '1.1.11';
+
+ // Constructor
+ function HTTPRetriever() {
+ // default HTTP headers to send with all requests
+ $this->headers = array(
+ "Referer"=>"",
+ "User-Agent"=>"HTTPRetriever/".$this->class_version,
+ "Connection"=>"close"
+ );
+
+ // HTTP version (has no effect if using CURL)
+ $this->version = "1.1";
+
+ // Normally, CURL is only used for HTTPS requests; setting this to
+ // TRUE will force CURL for HTTP requests as well. Not recommended.
+ $this->force_curl = false;
+
+ // If you don't want to use CURL at all, set this to TRUE.
+ $this->disable_curl = false;
+
+ // If HTTPS request return an error message about SSL certificates in
+ // $this->error and you don't care about security, set this to TRUE
+ $this->insecure_ssl = false;
+
+ // Set the maximum time to wait for a connection
+ $this->connect_timeout = 15;
+
+ // Set the maximum time to allow a transfer to run, or 0 to disable.
+ $this->max_time = 0;
+
+ // Set the maximum time for a socket read/write operation, or 0 to disable.
+ $this->stream_timeout = 0;
+
+ // If you're making an HTTPS request to a host whose SSL certificate
+ // doesn't match its domain name, AND YOU FULLY UNDERSTAND THE
+ // SECURITY IMPLICATIONS OF IGNORING THIS PROBLEM, set this to TRUE.
+ $this->ignore_ssl_hostname = false;
+
+ // If TRUE, the get() and post() methods will close the connection
+ // and return immediately after receiving the HTTP result code
+ $this->result_close = false;
+
+ // If set to a positive integer value, retrieved pages will be cached
+ // for this number of seconds. Any subsequent calls within the cache
+ // period will return the cached page, without contacting the remote
+ // server.
+ $this->caching = false;
+
+ // If TRUE and $this->caching is not false, retrieved pages/files will be
+ // cached only if they appear to be static.
+ $this->caching_intelligent = false;
+
+ // If TRUE, cached files will be stored in subdirectories corresponding
+ // to the first 2 letters of the hash filename
+ $this->caching_highvolume = false;
+
+ // If $this->caching is enabled, this specifies the folder under which
+ // cached pages are saved.
+ $this->cache_path = '/tmp/';
+
+ // Set these to perform basic HTTP authentication
+ $this->auth_username = '';
+ $this->auth_password = '';
+
+ // Optionally set this to a valid callback method to have HTTPRetriever
+ // provide page preprocessing capabilities to your script. If set, this
+ // method should accept two arguments: an object representing an instance
+ // of HTTPRetriever, and a string containing the page contents
+ $this->page_preprocessor = null;
+
+ // Optionally set this to a valid callback method to have HTTPRetriever
+ // provide progress messages. Your callback must accept 2 parameters:
+ // an integer representing the severity (0=debug, 1=information, 2=error),
+ // and a string representing the progress message
+ $this->progress_callback = null;
+
+ // Optionally set this to a valid callback method to have HTTPRetriever
+ // provide bytes-transferred messages. Your callbcak must accept 2
+ // parameters: an integer representing the number of bytes transferred,
+ // and an integer representing the total number of bytes expected (or
+ // -1 if unknown).
+ $this->transfer_callback = null;
+
+ // Set this to TRUE to have HTTPRetriever transparently follow HTTP
+ // redirects (code 301, 302, 303, and 307). Optionally set this to a
+ // numeric value to limit the maximum number of redirects to the specified
+ // value. (Redirection loops are detected automatically.)
+ // Note that non-GET/HEAD requests will NOT be redirected except on code
+ // 303, as per HTTP standards.
+ $this->follow_redirects = false;
+
+ // Set this to TRUE to have HTTPRetriever automatically follow HTTP
+ // code 301 and 302 redirects received in response to HTTP POST requests,
+ // and treat them like a code 303. This is technically contrary to the
+ // RFCs but all common browsers do it anyway, so it's necessary for usable
+ // browser emulation.
+ $this->redirect_on_post = true;
+
+ // Set this to TRUE to have HTTPRetriever automatically manage cookies
+ // for each request, simulating the behavior of an actual browser. When
+ // this is used, the $cookies parameter to the get(), and post() methods
+ // is ignored and cookies can only be set by the remote web server.
+ $this->manage_cookies = false;
+ $this->managed_cookies = array();
+ }
+
+ // Send an HTTP GET request to $url; if $ipaddress is specified, the
+ // connection will be made to the selected IP instead of resolving the
+ // hostname in $url.
+ //
+ // If $cookies is set, it should be an array in one of two formats.
+ //
+ // Either: $cookies[ 'cookiename' ] = array (
+ // '/path/'=>array(
+ // 'expires'=>time(),
+ // 'domain'=>'yourdomain.com',
+ // 'value'=>'cookievalue'
+ // )
+ // );
+ //
+ // Or, a more simplified format:
+ // $cookies[ 'cookiename' ] = 'value';
+ //
+ // The former format will automatically check to make sure that the path, domain,
+ // and expiration values match the HTTP request, and will only send the cookie if
+ // they do match. The latter will force the cookie to be set for the HTTP request
+ // unconditionally.
+ //
+ function get($url,$ipaddress = false,$cookies = false) {
+ $this->method = "GET";
+ $this->post_data = "";
+ $this->connect_ip = $ipaddress;
+ return $this->_execute_request($url,$cookies);
+ }
+
+ // Send an HTTP POST request to $url containing the POST data $data. See ::get()
+ // for a description of the remaining arguments.
+ function post($url,$data="",$ipaddress = false,$cookies = false) {
+ $this->method = "POST";
+ $this->post_data = $data;
+ $this->connect_ip = $ipaddress;
+ return $this->_execute_request($url,$cookies);
+ }
+
+ // Send an HTTP HEAD request to $url. See ::get() for a description of the arguments.
+ function head($url,$ipaddress = false,$cookies = false) {
+ $this->method = "HEAD";
+ $this->post_data = "";
+ $this->connect_ip = $ipaddress;
+ return $this->_execute_request($url,$cookies);
+ }
+
+ // send an alternate (non-GET/POST) HTTP request to $url
+ function custom($method,$url,$data="",$ipaddress = false,$cookies = false) {
+ $this->method = $method;
+ $this->post_data = $data;
+ $this->connect_ip = $ipaddress;
+ return $this->_execute_request($url,$cookies);
+ }
+
+ function array_to_query($arrayname,$arraycontents) {
+ $output = "";
+ foreach ($arraycontents as $key=>$value) {
+ if (is_array($value)) {
+ $output .= $this->array_to_query(sprintf('%s[%s]',$arrayname,urlencode($key)),$value);
+ } else {
+ $output .= sprintf('%s[%s]=%s&',$arrayname,urlencode($key),urlencode($value));
+ }
+ }
+ return $output;
+ }
+
+ // builds a query string from the associative array array $data;
+ // returns a string that can be passed to $this->post()
+ function make_query_string($data) {
+ $output = "";
+ if (is_array($data)) {
+ foreach ($data as $name=>$value) {
+ if (is_array($value)) {
+ $output .= $this->array_to_query(urlencode($name),$value);
+ } elseif (is_scalar($value)) {
+ $output .= urlencode($name)."=".urlencode($value)."&";
+ } else {
+ $output .= urlencode($name)."=".urlencode(serialize($value)).'&';
+ }
+ }
+ }
+ return substr($output,0,strlen($output)-1);
+ }
+
+
+ // this is pretty limited... but really, if you're going to spoof you UA, you'll probably
+ // want to use a Windows OS for the spoof anyway
+ //
+ // if you want to set the user agent to a custom string, just assign your string to
+ // $this->headers["User-Agent"] directly
+ function set_user_agent($agenttype,$agentversion,$windowsversion) {
+ $useragents = array(
+ "Mozilla/4.0 (compatible; MSIE %agent%; Windows NT %os%%ie7osstuff%)", // IE
+ "Mozilla/5.0 (Windows; U; Windows NT %os%; en-US; rv:%agent%) Gecko/20040514", // Moz
+ "Mozilla/5.0 (Windows; U; Windows NT %os%; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/%agent%", // FFox
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT %os%) Opera %agent% [en]", // Opera
+ );
+
+ $agent = $useragents[$agenttype];
+
+ if ( ($agenttype==UA_EXPLORER) && (substr($agentversion,0,1)=='7') ) {
+ // cheeky, yes?
+ $agent = str_replace('%ie7osstuff%','; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022',$agent);
+ }
+
+ $this->headers["User-Agent"] = str_replace(array("%agent%","%os%"),array($agentversion,$windowsversion),$agent);
+ }
+
+ // this isn't presently used as it's now handled inline by the request parser
+ function remove_chunkiness() {
+ $remaining = $this->response;
+ $this->response = "";
+
+ while ($remaining) {
+ $hexlen = strpos($remaining,"\r");
+ $chunksize = substr($remaining,0,$hexlen);
+ $argstart = strpos($chunksize,';');
+ if ($argstart!==false) $chunksize = substr($chunksize,0,$argstart);
+ $chunksize = (int) @hexdec($chunksize);
+
+ $this->response .= substr($remaining,$hexlen+2,$chunksize);
+ $remaining = substr($remaining,$hexlen+2+$chunksize+2);
+
+ if (!$chunksize) {
+ // either we're done, or something's borked... exit
+ $this->response .= $remaining;
+ return;
+ }
+ }
+ }
+
+ // (internal) store a page in the cache
+ function _cache_store($token,$url) {
+
+ if ($this->caching_intelligent) {
+ $urlinfo = @parse_url($url);
+ if ($this->method=='POST') {
+ $this->progress(HRP_DEBUG,"POST request; not caching");
+ return;
+ } else if (strlen($urlinfo['query'])) {
+ $this->progress(HRP_DEBUG,"Request used query string; not caching");
+ return;
+ } else {
+ $this->progress(HRP_DEBUG,"Request appears to be static and cacheable");
+ }
+ }
+
+ $values = array(
+ "stats"=>$this->stats,
+ "result_code"=>$this->result_code,
+ "result_text"=>$this->result_text,
+ "version"=>$this->version,
+ "response"=>$this->response,
+ "response_headers"=>$this->response_headers,
+ "response_cookies"=>$this->response_cookies,
+ "raw_response"=>$this->raw_response,
+ );
+ $values = serialize($values);
+
+ $cache_dir = $this->cache_path;
+ if (substr($cache_dir,-1)!='/') $cache_dir .= '/';
+
+ if ($this->caching_highvolume) {
+ $cache_dir .= substr($token,0,2) . '/';
+ if (!is_dir($cache_dir)) @mkdir($cache_dir);
+ }
+
+ $filename = $cache_dir.$token.'.tmp';
+
+ $fp = @fopen($filename,"w");
+ if (!$fp) {
+ $this->progress(HRP_DEBUG,"Unable to create cache file");
+ return false;
+ }
+ fwrite($fp,$values);
+ fclose($fp);
+
+ $this->progress(HRP_DEBUG,"HTTP response stored to cache");
+ }
+
+ // (internal) fetch a page from the cache
+ function _cache_fetch($token) {
+ $this->cache_hit = false;
+ $this->progress(HRP_DEBUG,"Checking for cached page value");
+
+ $cache_dir = $this->cache_path;
+ if (substr($cache_dir,-1)!='/') $cache_dir .= '/';
+
+ if ($this->caching_highvolume) $cache_dir .= substr($token,0,2) . '/';
+
+ $filename = $cache_dir.$token.'.tmp';
+ if (!file_exists($filename)) {
+ $this->progress(HRP_DEBUG,"Page not available in cache");
+ return false;
+ }
+
+ if (time()-filemtime($filename)>$this->caching) {
+ $this->progress(HRP_DEBUG,"Page in cache is expired");
+ @unlink($filename);
+ return false;
+ }
+
+ if ($values = file_get_contents($filename)) {
+ $values = unserialize($values);
+ if (!$values) {
+ $this->progress(HRP_DEBUG,"Invalid cache contents");
+ return false;
+ }
+
+ $this->stats = $values["stats"];
+ $this->result_code = $values["result_code"];
+ $this->result_text = $values["result_text"];
+ $this->version = $values["version"];
+ $this->response = $values["response"];
+ $this->response_headers = $values["response_headers"];
+ $this->response_cookies = $values["response_cookies"];
+ $this->raw_response = $values["raw_response"];
+
+ $this->progress(HRP_DEBUG,"Page loaded from cache");
+ $this->cache_hit = true;
+ return true;
+ } else {
+ $this->progress(HRP_DEBUG,"Error reading cache file");
+ return false;
+ }
+ }
+
+ function parent_path($path) {
+ if (substr($path,0,1)=='/') $path = substr($path,1);
+ if (substr($path,-1)=='/') $path = substr($path,0,strlen($path)-1);
+ $path = explode('/',$path);
+ array_pop($path);
+ return count($path) ? ('/' . implode('/',$path)) : '';
+ }
+
+ // $cookies should be an array in one of two formats.
+ //
+ // Either: $cookies[ 'cookiename' ] = array (
+ // '/path/'=>array(
+ // 'expires'=>time(),
+ // 'domain'=>'yourdomain.com',
+ // 'value'=>'cookievalue'
+ // )
+ // );
+ //
+ // Or, a more simplified format:
+ // $cookies[ 'cookiename' ] = 'value';
+ //
+ // The former format will automatically check to make sure that the path, domain,
+ // and expiration values match the HTTP request, and will only send the cookie if
+ // they do match. The latter will force the cookie to be set for the HTTP request
+ // unconditionally.
+ //
+ function response_to_request_cookies($cookies,$urlinfo) {
+ if (!is_array($cookies)) return;
+
+ // check for simplified cookie format (name=value)
+ $cookiekeys = array_keys($cookies);
+ if (!count($cookiekeys)) return;
+
+ $testkey = array_pop($cookiekeys);
+ if (!is_array($cookies[ $testkey ])) {
+ foreach ($cookies as $k=>$v) $this->request_cookies[$k] = $v;
+ return;
+ }
+
+ // must not be simplified format, so parse as complex format:
+ foreach ($cookies as $name=>$paths) {
+ foreach ($paths as $path=>$values) {
+ // make sure the cookie isn't expired
+ if ( isset($values['expires']) && ($values['expires']